diff --git a/src/main/java/com/subsidy/mapper/RenSheJuMapper.java b/src/main/java/com/subsidy/mapper/RenSheJuMapper.java index bc2685a..b11f288 100644 --- a/src/main/java/com/subsidy/mapper/RenSheJuMapper.java +++ b/src/main/java/com/subsidy/mapper/RenSheJuMapper.java @@ -37,7 +37,7 @@ public interface RenSheJuMapper { /** * 前一天新增视频学习数据 */ - List dailyStudyInfo(String classId); + List dailyStudyInfo(Long classId); /** * 前一天活跃度检测列表 diff --git a/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java b/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java index 571baa5..c0e5b28 100644 --- a/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java @@ -155,9 +155,18 @@ public class RenSheJuServiceImpl implements RenSheJuService { List classHourBasics = new ArrayList<>(); try { - //看视频的班级 - List dailyStudyInfoVOS = renSheJuMapper.dailyStudyInfo("0"); - for (DailyStudyInfoVO dailyStudyInfoVO : dailyStudyInfoVOS) { + //产生视频学习数据的班级 + List vodClassIds = renSheJuMapper.vodClassIds("0"); + + List result = new ArrayList<>(); + + for (Long classId : vodClassIds){ + //产生数据的班级 + List 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") diff --git a/src/main/java/com/subsidy/service/impl/ShehuihuaServiceImpl.java b/src/main/java/com/subsidy/service/impl/ShehuihuaServiceImpl.java index 477a9cd..308d7ed 100644 --- a/src/main/java/com/subsidy/service/impl/ShehuihuaServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ShehuihuaServiceImpl.java @@ -179,87 +179,88 @@ public class ShehuihuaServiceImpl implements ShehuihuaService { List classHourBasics = new ArrayList<>(); try { - //前一天新增视频学习数据的班级 - List dailyStudyInfoVOS = renSheJuMapper.dailyStudyInfo("1"); - for (DailyStudyInfoVO dailyStudyInfoVO : dailyStudyInfoVOS) { - ClassHourBasic4DTO classHourBasic = new ClassHourBasic4DTO(); - BeanUtils.copyProperties(dailyStudyInfoVO, classHourBasic); - classHourBasic.setClassCode(dailyStudyInfoVO.getDownCode()); - - //上线时间列表 - //找到当天每次上线下线时间 - //上线时间 - List loginRecords = renSheJuMapper.loginRecords(dailyStudyInfoVO.getMemberId()); - //下线时间 - List loginOutRecords = renSheJuMapper.loginOutRecords(dailyStudyInfoVO.getMemberId()); - - List 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 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 activityLists = new ArrayList<>(); - List 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 dailyStudyInfoVOS = renSheJuMapper.dailyStudyInfo("1"); +// for (DailyStudyInfoVO dailyStudyInfoVO : dailyStudyInfoVOS) { +// ClassHourBasic4DTO classHourBasic = new ClassHourBasic4DTO(); +// BeanUtils.copyProperties(dailyStudyInfoVO, classHourBasic); +// classHourBasic.setClassCode(dailyStudyInfoVO.getDownCode()); +// +// //上线时间列表 +// //找到当天每次上线下线时间 +// //上线时间 +// List loginRecords = renSheJuMapper.loginRecords(dailyStudyInfoVO.getMemberId()); +// //下线时间 +// List loginOutRecords = renSheJuMapper.loginOutRecords(dailyStudyInfoVO.getMemberId()); +// +// List 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 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 activityLists = new ArrayList<>(); +// List 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(); diff --git a/src/main/resources/mapper/RenSheJuMapper.xml b/src/main/resources/mapper/RenSheJuMapper.xml index e979fb7..dd022a9 100644 --- a/src/main/resources/mapper/RenSheJuMapper.xml +++ b/src/main/resources/mapper/RenSheJuMapper.xml @@ -105,78 +105,76 @@