diff --git a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java index abe0560..eae9d9c 100644 --- a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java +++ b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java @@ -80,8 +80,8 @@ public class VodPlayHistoryController { @GetMapping("testPlays") @ApiOperation("解决有交叉时间的数据 classId") - public ResponseVO testPlays(@RequestParam("classId") Long classId ){ - return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.testPlays(classId)); + public ResponseVO testPlays(){ + return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.testPlays()); } @PostMapping("warning") diff --git a/src/main/java/com/subsidy/jobs/WarningJob.java b/src/main/java/com/subsidy/jobs/WarningJob.java index ef1aa0d..0e4d548 100644 --- a/src/main/java/com/subsidy/jobs/WarningJob.java +++ b/src/main/java/com/subsidy/jobs/WarningJob.java @@ -10,13 +10,14 @@ import com.subsidy.vo.vod.VodPlayStateVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -//@Component +@Component public class WarningJob { /** @@ -67,11 +68,6 @@ public class WarningJob { } } -// List telephones = Arrays.asList(new String[]{"15201936167", "18201963812", "18217669021"}); -// telephones.stream().forEach(x -> { -// smsUtils.sendVerifySMS("SMS_460945631", x, result.toString()); -// }); - if (result.size()>0){ List telephones = Arrays.asList(new String[]{"15201936167", "18201963812", "18217669021"}); for (String telephone : telephones){ diff --git a/src/main/java/com/subsidy/mapper/RenSheJuMapper.java b/src/main/java/com/subsidy/mapper/RenSheJuMapper.java index 580a493..bc2685a 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 classType); + List dailyStudyInfo(String classId); /** * 前一天活跃度检测列表 diff --git a/src/main/java/com/subsidy/service/VodPlayHistoryService.java b/src/main/java/com/subsidy/service/VodPlayHistoryService.java index ebe8b5f..0878f4c 100644 --- a/src/main/java/com/subsidy/service/VodPlayHistoryService.java +++ b/src/main/java/com/subsidy/service/VodPlayHistoryService.java @@ -8,6 +8,7 @@ import com.subsidy.model.VodPlayHistoryDO; import com.baomidou.mybatisplus.extension.service.IService; import com.subsidy.vo.vod.VodPlayStateVO; +import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -33,7 +34,7 @@ public interface VodPlayHistoryService extends IService { void playLengthFix(RemainSecondsDTO remainSecondsDTO); - HashSet testPlays(Long classId); + HashMap> testPlays(); void warning(); diff --git a/src/main/java/com/subsidy/service/impl/DudaoServiceImpl.java b/src/main/java/com/subsidy/service/impl/DudaoServiceImpl.java index 2a362d5..e2155ae 100644 --- a/src/main/java/com/subsidy/service/impl/DudaoServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/DudaoServiceImpl.java @@ -30,6 +30,12 @@ public class DudaoServiceImpl implements DudaoService { */ public static final String PREFIX_URL = "http://180.167.195.117:18015/ddproject"; + /** + * 正式环境 + */ + public static final String PROD_URL = "http://180.167.195.117:18025/ddproject"; + + @Autowired private RenSheJuMapper renSheJuMapper; diff --git a/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java b/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java index 176f16d..5b8abd7 100644 --- a/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java @@ -102,27 +102,27 @@ public class RenSheJuServiceImpl implements RenSheJuService { System.out.println(JSONObject.fromObject(classBaseInfoDTO).toString()); -// RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classBaseInfoDTO).toString()); -// Request request = new Request.Builder() -// .url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadClass") -// .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(RenSheJuConstant.POST_2); -// renshejuHistoryDO.setInputParam(JSONObject.fromObject(classBaseInfoDTO).toString()); -// if (200 == response.code()) { -// renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString()); -// } else { -// renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR); -// } -// renshejuHistoryMapper.insert(renshejuHistoryDO); -// return rensheResponseVO; - return null; + RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classBaseInfoDTO).toString()); + Request request = new Request.Builder() + .url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadClass") + .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(RenSheJuConstant.POST_2); + renshejuHistoryDO.setInputParam(JSONObject.fromObject(classBaseInfoDTO).toString()); + if (200 == response.code()) { + renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString()); + } else { + renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR); + } + renshejuHistoryMapper.insert(renshejuHistoryDO); + return rensheResponseVO; +// return null; } else { RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_2); @@ -155,88 +155,89 @@ public class RenSheJuServiceImpl implements RenSheJuService { List classHourBasics = new ArrayList<>(); try { - //前一天新增视频学习数据的班级 - List dailyStudyInfoVOS = renSheJuMapper.dailyStudyInfo("0"); - for (DailyStudyInfoVO dailyStudyInfoVO : dailyStudyInfoVOS) { - ClassHourBasic classHourBasic = new ClassHourBasic(); - BeanUtils.copyProperties(dailyStudyInfoVO, classHourBasic); - classHourBasic.setDownCode(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); + //看视频的班级 + List dailyStudyInfoVOS = renSheJuMapper.dailyStudyInfo("0"); + for (DailyStudyInfoVO dailyStudyInfoVO : dailyStudyInfoVOS) { + ClassHourBasic classHourBasic = new ClassHourBasic(); + BeanUtils.copyProperties(dailyStudyInfoVO, classHourBasic); + classHourBasic.setDownCode(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); + classHourBasic.setLoginList(loginLists); - //活跃度列表 - List activityLists = new ArrayList<>(); - List activityDetectionDOS = renSheJuMapper.dailyActivities(dailyStudyInfoVO.getDownCode(), dailyStudyInfoVO.getMemberId()); - for (DailyActivitiesVO dailyActivitiesVO : activityDetectionDOS) { + //活跃度列表 + List activityLists = new ArrayList<>(); + List activityDetectionDOS = renSheJuMapper.dailyActivities(dailyStudyInfoVO.getDownCode(), dailyStudyInfoVO.getMemberId()); + for (DailyActivitiesVO dailyActivitiesVO : activityDetectionDOS) { - ActivityList activityList = new ActivityList(); - if (null == dailyActivitiesVO.getAccess() || 0 == dailyActivitiesVO.getAccess()) { - activityList.setAccess(1); - activityList.setErrorInfo(2); - } else { - activityList.setAccess(0); - } + ActivityList activityList = new ActivityList(); + if (null == dailyActivitiesVO.getAccess() || 0 == dailyActivitiesVO.getAccess()) { + activityList.setAccess(1); + activityList.setErrorInfo(2); + } else { + activityList.setAccess(0); + } - if (0 == dailyActivitiesVO.getCheckType()) { - activityList.setActivityDetection(2); - } else if (1 == dailyActivitiesVO.getCheckType()) { - activityList.setActivityDetection(1); - } + if (0 == dailyActivitiesVO.getCheckType()) { + activityList.setActivityDetection(2); + } else if (1 == dailyActivitiesVO.getCheckType()) { + activityList.setActivityDetection(1); + } - activityList.setActivityTime(dailyActivitiesVO.getActivityTime()); - activityLists.add(activityList); + activityList.setActivityTime(dailyActivitiesVO.getActivityTime()); + activityLists.add(activityList); + } + classHourBasic.setActivityList(activityLists); + classHourBasics.add(classHourBasic); } - classHourBasic.setActivityList(activityLists); - classHourBasics.add(classHourBasic); - } + classHourBehaviorDTO.setClassHourBasic(classHourBasics); System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(classHourBehaviorDTO)); if (classHourBasics.size()>0){ -// RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classHourBehaviorDTO).toString()); -// -// Request request = new Request.Builder() -// .url(renSheConfig.getUrl() + "/import/downstream/enterprise/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(RenSheJuConstant.POST_3); -// 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; + RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classHourBehaviorDTO).toString()); + + Request request = new Request.Builder() + .url(renSheConfig.getUrl() + "/import/downstream/enterprise/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(RenSheJuConstant.POST_3); + 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; }else { RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_3); diff --git a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java index 4eb7892..a5a2d25 100644 --- a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java @@ -635,23 +635,27 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl testPlays(Long classId) { + public HashMap> testPlays() { -// String[] classIdArr = classIds.split(","); - HashSet result = new HashSet<>(); -// for (String classId : classIdArr) { - List classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper() - .lambda() - .eq(ClassMemberMappingDO::getClassId, classId)); - for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) { - List vodPlayStateVOS = vodDictMapper.testPlays(classMemberMappingDO.getMemberId(), Long.valueOf(classId)); - for (int i = 0; i < vodPlayStateVOS.size() - 1; i++) { - VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(i + 1); //后面 - VodPlayStateVO vodPlayStateVO1 = vodPlayStateVOS.get(i); //前面 - if (vodPlayStateVO1.getEndDate().getTime() > vodPlayStateVO.getStartDate().getTime()) { - //这一条数据有问题 - System.out.println("111111111111111111111" + vodPlayStateVO); - //查看这个人 这个课程 当天的全部数据 按照createDate升序排序 + //查看当天产生视频学习的班级 + List classIds = vodPlayHistoryMapper.dailyVodRecord(); + + HashMap> hashMap = new HashMap(); + + for (Long classId : classIds) { + List classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper() + .lambda() + .eq(ClassMemberMappingDO::getClassId, classId)); + HashSet result = new HashSet<>(); + for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) { + List vodPlayStateVOS = vodDictMapper.testPlays(classMemberMappingDO.getMemberId(), Long.valueOf(classId)); + for (int i = 0; i < vodPlayStateVOS.size() - 1; i++) { + VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(i + 1); //后面 + VodPlayStateVO vodPlayStateVO1 = vodPlayStateVOS.get(i); //前面 + if (vodPlayStateVO1.getEndDate().getTime() > vodPlayStateVO.getStartDate().getTime()) { + //这一条数据有问题 +// System.out.println("111111111111111111111" + vodPlayStateVO); + //查看这个人 这个课程 当天的全部数据 按照createDate升序排序 // List vodPlayHistoryDOS = this.baseMapper.getVodPlayDay(Long.valueOf(classId), classMemberMappingDO.getMemberId(), vodPlayStateVO.getStartDate()); // //从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推 // for (int l = 0; l < vodPlayHistoryDOS.size() - 1; l++) { @@ -664,13 +668,14 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl vodPlayStateVO.getStartDate().getTime()) { - if (!result.contains(vodPlayStateVO1.getClassId())){ + if (!result.contains(vodPlayStateVO1.getClassId())) { result.add(vodPlayStateVO.getClassId()); } } @@ -699,12 +704,13 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl0){ - List telephones = Arrays.asList(new String[]{"15201936167", "18201963812", "18217669021"}); - for (String telephone : telephones){ - smsUtils.sendWarning("SMS_460945631", telephone, result.toString()); - } - } + System.out.println(result.toString()); +// if (result.size()>0){ +// List telephones = Arrays.asList(new String[]{"15201936167", "18201963812", "18217669021"}); +// for (String telephone : telephones){ +// smsUtils.sendWarning("SMS_460945631", telephone, result.toString()); +// } +// } } //19为基数的话,3次签到6.5到8,4次签到4.8-6, diff --git a/src/main/resources/mapper/RenSheJuMapper.xml b/src/main/resources/mapper/RenSheJuMapper.xml index 66ac7d5..e979fb7 100644 --- a/src/main/resources/mapper/RenSheJuMapper.xml +++ b/src/main/resources/mapper/RenSheJuMapper.xml @@ -105,70 +105,77 @@ @@ -254,8 +261,7 @@