Commit 2308be45 by 涂亚平

补贴培训第4次上课熬夜改数据

1 parent 895053e3
......@@ -37,7 +37,7 @@ public interface RenSheJuMapper {
/**
* 前一天新增视频学习数据
*/
List<DailyStudyInfoVO> dailyStudyInfo(String classId);
List<DailyStudyInfoVO> dailyStudyInfo(Long classId);
/**
* 前一天活跃度检测列表
......
......@@ -155,9 +155,18 @@ public class RenSheJuServiceImpl implements RenSheJuService {
List<ClassHourBasic> classHourBasics = new ArrayList<>();
try {
//看视频的班级
List<DailyStudyInfoVO> dailyStudyInfoVOS = renSheJuMapper.dailyStudyInfo("0");
for (DailyStudyInfoVO dailyStudyInfoVO : dailyStudyInfoVOS) {
//产生视频学习数据的班级
List<Long> vodClassIds = renSheJuMapper.vodClassIds("0");
List<DailyStudyInfoVO> result = new ArrayList<>();
for (Long classId : vodClassIds){
//产生数据的班级
List<DailyStudyInfoVO> dailyStudyInfoVOS = renSheJuMapper.dailyStudyInfo(classId);
result.addAll(dailyStudyInfoVOS);
}
for (DailyStudyInfoVO dailyStudyInfoVO : result) {
ClassHourBasic classHourBasic = new ClassHourBasic();
BeanUtils.copyProperties(dailyStudyInfoVO, classHourBasic);
classHourBasic.setDownCode(dailyStudyInfoVO.getDownCode());
......@@ -549,7 +558,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
uploadImage.setImageDetailList(imageDetailLists);
if (imageDetailLists.size() > 0) {
// System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(uploadImage));
System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(uploadImage));
RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(uploadImage).toString());
Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadImage")
......
......@@ -179,87 +179,88 @@ public class ShehuihuaServiceImpl implements ShehuihuaService {
List<ClassHourBasic4DTO> classHourBasics = new ArrayList<>();
try {
//前一天新增视频学习数据的班级
List<DailyStudyInfoVO> dailyStudyInfoVOS = renSheJuMapper.dailyStudyInfo("1");
for (DailyStudyInfoVO dailyStudyInfoVO : dailyStudyInfoVOS) {
ClassHourBasic4DTO classHourBasic = new ClassHourBasic4DTO();
BeanUtils.copyProperties(dailyStudyInfoVO, classHourBasic);
classHourBasic.setClassCode(dailyStudyInfoVO.getDownCode());
//上线时间列表
//找到当天每次上线下线时间
//上线时间
List<OprMemDictDO> loginRecords = renSheJuMapper.loginRecords(dailyStudyInfoVO.getMemberId());
//下线时间
List<OprMemDictDO> loginOutRecords = renSheJuMapper.loginOutRecords(dailyStudyInfoVO.getMemberId());
List<LoginList> loginLists = new ArrayList<>();
for (int i = 0; i < loginRecords.size(); i++) {
LoginList loginList = new LoginList();
loginList.setIp(loginRecords.get(i).getIpAddress());
loginList.setStartTime(Timestamp.valueOf(loginRecords.get(i).getCreateDate()).getTime());
loginList.setEndTime(Timestamp.valueOf(loginOutRecords.get(i).getCreateDate()).getTime());
//查看这个人该时间段的学习记录
List<ChapterList3> chapterList3s = renSheJuMapper.dailyStudyRecords(dailyStudyInfoVO.getMemberId(), dailyStudyInfoVO.getDownCode(), loginRecords.get(i).getCreateDate().toString().replace("T", " "), loginOutRecords.get(i).getCreateDate().toString().replace("T", " "));
if (chapterList3s.size() > 0) {
loginList.setChapterList(chapterList3s);
loginLists.add(loginList);
}
}
classHourBasic.setLoginList(loginLists);
//活跃度列表
List<ActivityList> activityLists = new ArrayList<>();
List<DailyActivitiesVO> activityDetectionDOS = renSheJuMapper.dailyActivities(dailyStudyInfoVO.getDownCode(), dailyStudyInfoVO.getMemberId());
for (DailyActivitiesVO dailyActivitiesVO : activityDetectionDOS) {
ActivityList activityList = new ActivityList();
if (dailyActivitiesVO.getAccess() == 1) {
activityList.setAccess(0);
} else {
activityList.setAccess(1);
activityList.setErrorInfo(2);
}
if (0 == dailyActivitiesVO.getCheckType()) {
activityList.setActivityDetection(2);
} else if (1 == dailyActivitiesVO.getCheckType()) {
activityList.setActivityDetection(1);
}
activityList.setActivityTime(dailyActivitiesVO.getActivityTime());
activityLists.add(activityList);
}
classHourBasic.setActivityList(activityLists);
classHourBasics.add(classHourBasic);
}
classHourBehaviorDTO.setClassHourBasic(classHourBasics);
System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(classHourBehaviorDTO));
RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classHourBehaviorDTO).toString());
Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/social/uploadClassHourBehavior")
.method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class);
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(ShehuihuaConstant.POST_4);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classHourBehaviorDTO).toString());
if (200 == response.code()) {
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
} else {
renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR);
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO;
//TODO 需要按照人社局Impl修改一下
// //前一天新增视频学习数据的班级
// List<DailyStudyInfoVO> dailyStudyInfoVOS = renSheJuMapper.dailyStudyInfo("1");
// for (DailyStudyInfoVO dailyStudyInfoVO : dailyStudyInfoVOS) {
// ClassHourBasic4DTO classHourBasic = new ClassHourBasic4DTO();
// BeanUtils.copyProperties(dailyStudyInfoVO, classHourBasic);
// classHourBasic.setClassCode(dailyStudyInfoVO.getDownCode());
//
// //上线时间列表
// //找到当天每次上线下线时间
// //上线时间
// List<OprMemDictDO> loginRecords = renSheJuMapper.loginRecords(dailyStudyInfoVO.getMemberId());
// //下线时间
// List<OprMemDictDO> loginOutRecords = renSheJuMapper.loginOutRecords(dailyStudyInfoVO.getMemberId());
//
// List<LoginList> loginLists = new ArrayList<>();
// for (int i = 0; i < loginRecords.size(); i++) {
// LoginList loginList = new LoginList();
// loginList.setIp(loginRecords.get(i).getIpAddress());
// loginList.setStartTime(Timestamp.valueOf(loginRecords.get(i).getCreateDate()).getTime());
// loginList.setEndTime(Timestamp.valueOf(loginOutRecords.get(i).getCreateDate()).getTime());
//
// //查看这个人该时间段的学习记录
// List<ChapterList3> chapterList3s = renSheJuMapper.dailyStudyRecords(dailyStudyInfoVO.getMemberId(), dailyStudyInfoVO.getDownCode(), loginRecords.get(i).getCreateDate().toString().replace("T", " "), loginOutRecords.get(i).getCreateDate().toString().replace("T", " "));
// if (chapterList3s.size() > 0) {
// loginList.setChapterList(chapterList3s);
// loginLists.add(loginList);
// }
// }
// classHourBasic.setLoginList(loginLists);
//
// //活跃度列表
// List<ActivityList> activityLists = new ArrayList<>();
// List<DailyActivitiesVO> activityDetectionDOS = renSheJuMapper.dailyActivities(dailyStudyInfoVO.getDownCode(), dailyStudyInfoVO.getMemberId());
// for (DailyActivitiesVO dailyActivitiesVO : activityDetectionDOS) {
//
// ActivityList activityList = new ActivityList();
// if (dailyActivitiesVO.getAccess() == 1) {
// activityList.setAccess(0);
// } else {
// activityList.setAccess(1);
// activityList.setErrorInfo(2);
// }
//
// if (0 == dailyActivitiesVO.getCheckType()) {
// activityList.setActivityDetection(2);
// } else if (1 == dailyActivitiesVO.getCheckType()) {
// activityList.setActivityDetection(1);
// }
//
// activityList.setActivityTime(dailyActivitiesVO.getActivityTime());
// activityLists.add(activityList);
// }
// classHourBasic.setActivityList(activityLists);
//
// classHourBasics.add(classHourBasic);
// }
// classHourBehaviorDTO.setClassHourBasic(classHourBasics);
//
// System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(classHourBehaviorDTO));
//
// RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classHourBehaviorDTO).toString());
//
// Request request = new Request.Builder()
// .url(renSheConfig.getUrl() + "/import/downstream/social/uploadClassHourBehavior")
// .method("POST", body)
// .addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
// .addHeader("Content-Type", "application/json")
// .build();
// Response response = client.newCall(request).execute();
//
// RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class);
// RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
// renshejuHistoryDO.setInterfaceName(ShehuihuaConstant.POST_4);
// renshejuHistoryDO.setInputParam(JSONObject.fromObject(classHourBehaviorDTO).toString());
// if (200 == response.code()) {
// renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
// } else {
// renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR);
// }
// renshejuHistoryMapper.insert(renshejuHistoryDO);
// return rensheResponseVO;
// return null;
} catch (Exception e) {
e.printStackTrace();
......
......@@ -105,78 +105,76 @@
<select id="dailyStudyInfo" resultType="com.subsidy.vo.renshe.DailyStudyInfoVO">
SELECT
DISTINCT
IFNULL(t2.class_id,t7.class_id) AS downCode,
t6.member_id,
t4.user_name AS studentName,
t4.telephone AS phone,
t4.id_card AS identity,
IFNULL(t2.learnTime,0),
IFNULL(t2.playTime,0),
t5.loginTime
t.class_id AS downCode,
t3.id AS member_id,
t3.user_name AS studentName,
t3.telephone AS phone,
t3.id_card identity,
IFNULL( t4.learnTime, 0 ) learnTime,
IFNULL( t4.playTime, 0 ) playTime,
t2.loginTime
FROM
class_member_mapping t6
LEFT JOIN member t4 ON t4.id = t6.member_id
LEFT JOIN (
SELECT
t3.user_id,
login - logout AS loginTime ,
t3.create_date
FROM
(
SELECT
user_id,
sum(
unix_timestamp( t1.create_date )) AS login ,
create_date
FROM
opr_mem_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
AND opr_type = "登出"
AND result = 1
GROUP BY
user_id
) t3
LEFT JOIN (
SELECT
user_id,
sum(
unix_timestamp( t1.create_date )) AS logout ,
create_date
FROM
opr_mem_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
AND opr_type = "登录"
AND result = 1
GROUP BY
user_id
) t2 ON t3.user_id = t2.user_id
) t5 on t5.user_id = t4.id
LEFT JOIN (
SELECT
t1.class_id,
t1.member_id,
sum( t1.play_length ) AS learnTime,
sum( t1.play_length + t1.suspend_length ) AS playTime
FROM
vod_play_history t1
class_member_mapping t
LEFT JOIN (
SELECT
t3.user_id,
login - logout AS loginTime,
t3.create_date
FROM
(
SELECT
user_id,
sum(
unix_timestamp( t1.create_date )) AS login,
create_date
FROM
opr_mem_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
AND opr_type = "登出"
AND result = 1
GROUP BY
user_id
) t3
LEFT JOIN (
SELECT
user_id,
sum(
unix_timestamp( t1.create_date )) AS logout,
create_date
FROM
opr_mem_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
AND opr_type = "登录"
AND result = 1
GROUP BY
user_id
) t2 ON t3.user_id = t2.user_id
) t2 ON t2.user_id = t.member_id
LEFT JOIN member t3 ON t.member_id = t3.id
LEFT JOIN (
SELECT
t1.class_id,
t1.member_id,
sum( t1.play_length ) AS learnTime,
sum( t1.play_length + t1.suspend_length ) AS playTime
FROM
vod_play_history t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
GROUP BY
t1.class_id,
t1.member_id
) t4 ON t.member_id = t4.member_id
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
GROUP BY
t1.class_id,
t1.member_id
) t2 ON t5.user_id = t2.member_id
LEFT JOIN class_dict t3 ON t2.class_id = t3.id and t6.class_id = t3.id
LEFT JOIN image_check_record t7 on t5.user_id = t7.member_id and DATE_FORMAT(t5.create_date,'%Y-%m-%d') = DATE_FORMAT(t7.create_date,'%Y-%m-%d') and t7.result = 1
where t6.delete_date is null and t5.loginTime is not null and IFNULL(t2.class_id,t7.class_id) is not null
<if test="classType != null and classType != ''">
and t3.class_type = #{classType}
</if>
t.delete_date IS NULL
AND t3.delete_date IS NULL
AND t.class_id = #{classId}
AND t2.loginTime IS NOT NULL
</select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!