From 27a4934c0e95db931201ace33cd375211e14cc40 Mon Sep 17 00:00:00 2001 From: tuyp Date: Fri, 10 Feb 2023 18:18:07 +0800 Subject: [PATCH] 人社局对接测试 --- pom.xml | 7 ++++++- src/main/java/com/subsidy/common/configure/WebSocketConfig.java | 9 +++++++++ src/main/java/com/subsidy/controller/ActivityDetectionController.java | 7 +++++++ src/main/java/com/subsidy/controller/RenSheJuController.java | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------- src/main/java/com/subsidy/controller/RenshejuHistoryController.java | 22 ++++++++++++++++++++++ src/main/java/com/subsidy/controller/VodPlayHistoryController.java | 4 ++-- src/main/java/com/subsidy/dto/renshe/ActivityList.java | 23 +++++++++++++++++++++++ src/main/java/com/subsidy/dto/renshe/AnswerAndQuestionList.java | 18 ++++++++++++++++++ src/main/java/com/subsidy/dto/renshe/AnswerBasic.java | 18 ++++++++++++++++++ src/main/java/com/subsidy/dto/renshe/ChapterExamBasic.java | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/dto/renshe/ChapterList2.java | 18 ++++++++++++++++++ src/main/java/com/subsidy/dto/renshe/ChapterList3.java | 29 +++++++++++++++++++++++++++++ src/main/java/com/subsidy/dto/renshe/ClassBaseInfoDTO.java | 14 ++++++++++++++ src/main/java/com/subsidy/dto/renshe/ClassCodeBasic.java | 17 +++++++++++++++++ src/main/java/com/subsidy/dto/renshe/ClassHourBasic.java | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/dto/renshe/ClassHourBehaviorDTO.java | 19 +++++++++++++++++++ src/main/java/com/subsidy/dto/renshe/EpidemicSituationClassBasic.java | 35 +++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/dto/renshe/ExamList.java | 21 +++++++++++++++++++++ src/main/java/com/subsidy/dto/renshe/ImageDetailList.java | 37 +++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/dto/renshe/LoginList.java | 27 +++++++++++++++++++++++++++ src/main/java/com/subsidy/dto/renshe/UploadChapterBehaviorDTO.java | 19 +++++++++++++++++++ src/main/java/com/subsidy/dto/renshe/UploadClassAnswerQuestionBehaviorDTO.java | 14 ++++++++++++++ src/main/java/com/subsidy/dto/renshe/UploadClassCodeDTO.java | 17 +++++++++++++++++ src/main/java/com/subsidy/dto/renshe/UploadImageDTO.java | 23 +++++++++++++++++++++++ src/main/java/com/subsidy/jobs/RenSheJuJob.java | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/mapper/ClassDictMapper.java | 6 ++++++ src/main/java/com/subsidy/mapper/RenSheJuMapper.java | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/mapper/RenshejuHistoryMapper.java | 18 ++++++++++++++++++ src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java | 4 ++++ src/main/java/com/subsidy/model/CompanyDictDO.java | 5 +++++ src/main/java/com/subsidy/model/RenshejuHistoryDO.java | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/model/VodPlayHistoryDO.java | 5 +++++ src/main/java/com/subsidy/service/ActivityDetectionService.java | 1 + src/main/java/com/subsidy/service/RenSheJuService.java | 32 ++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/RenshejuHistoryService.java | 16 ++++++++++++++++ src/main/java/com/subsidy/service/impl/ActivityDetectionServiceImpl.java | 16 ++++++++++++++++ src/main/java/com/subsidy/service/impl/ImageCheckRecordServiceImpl.java | 9 +++++---- src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java | 572 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/service/impl/RenshejuHistoryServiceImpl.java | 20 ++++++++++++++++++++ src/main/java/com/subsidy/util/RenSheJuConstant.java | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/vo/administer/OperatorsVO.java | 2 ++ src/main/java/com/subsidy/vo/renshe/ActivityList9.java | 37 +++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/vo/renshe/ChapterList9.java | 38 ++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/vo/renshe/ClassBaseInfoVO.java | 26 ++++++++++++++++++++++++++ src/main/java/com/subsidy/vo/renshe/ClassImageChecksVO.java | 37 +++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/vo/renshe/Ctt7.java | 25 +++++++++++++++++++++++++ src/main/java/com/subsidy/vo/renshe/Ctt9.java | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/vo/renshe/DailyActivitiesVO.java | 13 +++++++++++++ src/main/java/com/subsidy/vo/renshe/DailyAnswerVO.java | 20 ++++++++++++++++++++ src/main/java/com/subsidy/vo/renshe/DailyExamBasicVO.java | 23 +++++++++++++++++++++++ src/main/java/com/subsidy/vo/renshe/DailyStudyInfoVO.java | 42 ++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/vo/renshe/ExamActivitiesVO.java | 12 ++++++++++++ src/main/java/com/subsidy/vo/renshe/GetSecretChildVO.java | 14 ++++++++++++++ src/main/java/com/subsidy/vo/renshe/GetSecretVO.java | 14 ++++++++++++++ src/main/java/com/subsidy/vo/renshe/LoginList9.java | 39 +++++++++++++++++++++++++++++++++++++++ src/main/java/com/subsidy/vo/renshe/MemberVO.java | 15 +++++++++++++++ src/main/java/com/subsidy/vo/renshe/RensheResponseVO.java | 21 +++++++++++++++++++++ src/main/java/com/subsidy/vo/renshe/RensheStringVO.java | 21 +++++++++++++++++++++ src/main/resources/application-dev.properties | 2 +- src/main/resources/application-online.properties | 5 ++++- src/main/resources/mapper/ClassDictMapper.xml | 10 ++++++++++ src/main/resources/mapper/CompanyDictMapper.xml | 3 ++- src/main/resources/mapper/RenSheJuMapper.xml | 404 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/resources/mapper/RenshejuHistoryMapper.xml | 24 ++++++++++++++++++++++++ src/main/resources/mapper/VodPlayHistoryMapper.xml | 12 ++++++++++++ 65 files changed, 2438 insertions(+), 32 deletions(-) create mode 100644 src/main/java/com/subsidy/controller/RenshejuHistoryController.java create mode 100644 src/main/java/com/subsidy/dto/renshe/ActivityList.java create mode 100644 src/main/java/com/subsidy/dto/renshe/AnswerAndQuestionList.java create mode 100644 src/main/java/com/subsidy/dto/renshe/AnswerBasic.java create mode 100644 src/main/java/com/subsidy/dto/renshe/ChapterExamBasic.java create mode 100644 src/main/java/com/subsidy/dto/renshe/ChapterList2.java create mode 100644 src/main/java/com/subsidy/dto/renshe/ChapterList3.java create mode 100644 src/main/java/com/subsidy/dto/renshe/ClassBaseInfoDTO.java create mode 100644 src/main/java/com/subsidy/dto/renshe/ClassCodeBasic.java create mode 100644 src/main/java/com/subsidy/dto/renshe/ClassHourBasic.java create mode 100644 src/main/java/com/subsidy/dto/renshe/ClassHourBehaviorDTO.java create mode 100644 src/main/java/com/subsidy/dto/renshe/EpidemicSituationClassBasic.java create mode 100644 src/main/java/com/subsidy/dto/renshe/ExamList.java create mode 100644 src/main/java/com/subsidy/dto/renshe/ImageDetailList.java create mode 100644 src/main/java/com/subsidy/dto/renshe/LoginList.java create mode 100644 src/main/java/com/subsidy/dto/renshe/UploadChapterBehaviorDTO.java create mode 100644 src/main/java/com/subsidy/dto/renshe/UploadClassAnswerQuestionBehaviorDTO.java create mode 100644 src/main/java/com/subsidy/dto/renshe/UploadClassCodeDTO.java create mode 100644 src/main/java/com/subsidy/dto/renshe/UploadImageDTO.java create mode 100644 src/main/java/com/subsidy/mapper/RenSheJuMapper.java create mode 100644 src/main/java/com/subsidy/mapper/RenshejuHistoryMapper.java create mode 100644 src/main/java/com/subsidy/model/RenshejuHistoryDO.java create mode 100644 src/main/java/com/subsidy/service/RenSheJuService.java create mode 100644 src/main/java/com/subsidy/service/RenshejuHistoryService.java create mode 100644 src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java create mode 100644 src/main/java/com/subsidy/service/impl/RenshejuHistoryServiceImpl.java create mode 100644 src/main/java/com/subsidy/util/RenSheJuConstant.java create mode 100644 src/main/java/com/subsidy/vo/renshe/ActivityList9.java create mode 100644 src/main/java/com/subsidy/vo/renshe/ChapterList9.java create mode 100644 src/main/java/com/subsidy/vo/renshe/ClassBaseInfoVO.java create mode 100644 src/main/java/com/subsidy/vo/renshe/ClassImageChecksVO.java create mode 100644 src/main/java/com/subsidy/vo/renshe/Ctt7.java create mode 100644 src/main/java/com/subsidy/vo/renshe/Ctt9.java create mode 100644 src/main/java/com/subsidy/vo/renshe/DailyActivitiesVO.java create mode 100644 src/main/java/com/subsidy/vo/renshe/DailyAnswerVO.java create mode 100644 src/main/java/com/subsidy/vo/renshe/DailyExamBasicVO.java create mode 100644 src/main/java/com/subsidy/vo/renshe/DailyStudyInfoVO.java create mode 100644 src/main/java/com/subsidy/vo/renshe/ExamActivitiesVO.java create mode 100644 src/main/java/com/subsidy/vo/renshe/GetSecretChildVO.java create mode 100644 src/main/java/com/subsidy/vo/renshe/GetSecretVO.java create mode 100644 src/main/java/com/subsidy/vo/renshe/LoginList9.java create mode 100644 src/main/java/com/subsidy/vo/renshe/MemberVO.java create mode 100644 src/main/java/com/subsidy/vo/renshe/RensheResponseVO.java create mode 100644 src/main/java/com/subsidy/vo/renshe/RensheStringVO.java create mode 100644 src/main/resources/mapper/RenSheJuMapper.xml create mode 100644 src/main/resources/mapper/RenshejuHistoryMapper.xml diff --git a/pom.xml b/pom.xml index 201adc6..0daf981 100644 --- a/pom.xml +++ b/pom.xml @@ -259,7 +259,12 @@ com.squareup.okhttp3 okhttp - 4.10.0 + 3.10.0 + + + com.squareup.okio + okio + 1.13.0 diff --git a/src/main/java/com/subsidy/common/configure/WebSocketConfig.java b/src/main/java/com/subsidy/common/configure/WebSocketConfig.java index 277b1ba..76b18fd 100644 --- a/src/main/java/com/subsidy/common/configure/WebSocketConfig.java +++ b/src/main/java/com/subsidy/common/configure/WebSocketConfig.java @@ -5,6 +5,8 @@ import com.subsidy.util.websocket.WebSocketUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.TaskScheduler; +import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.web.socket.config.annotation.EnableWebSocket; import org.springframework.web.socket.config.annotation.WebSocketConfigurer; import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; @@ -58,4 +60,11 @@ public class WebSocketConfig extends ServerEndpointConfig.Configurator implemen return new ServerEndpointExporter(); } + @Bean + public TaskScheduler taskScheduler(){ + ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler(); + taskScheduler.setPoolSize(10); + taskScheduler.initialize(); + return taskScheduler; + } } \ No newline at end of file diff --git a/src/main/java/com/subsidy/controller/ActivityDetectionController.java b/src/main/java/com/subsidy/controller/ActivityDetectionController.java index e693da3..aaee5c8 100644 --- a/src/main/java/com/subsidy/controller/ActivityDetectionController.java +++ b/src/main/java/com/subsidy/controller/ActivityDetectionController.java @@ -6,6 +6,7 @@ import com.subsidy.common.ResponseVO; import com.subsidy.common.interceptor.TimeRequired; import com.subsidy.dto.detection.GetCheckHistoryDTO; import com.subsidy.dto.detection.VerifyDTO; +import com.subsidy.model.ActivityDetectionDO; import com.subsidy.service.ActivityDetectionService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -47,4 +48,10 @@ public class ActivityDetectionController { return ResponseData.generateCreatedResponse(0,activityDetectionService.getCheckHistory(getCheckHistoryDTO)); } + @PostMapping("verifyError") + @ApiOperation("验证失败记录 classId memberId") + public ResponseVO verifyError(@RequestBody ActivityDetectionDO activityDetectionDO){ + return ResponseData.generateCreatedResponse(0,activityDetectionService.verifyError(activityDetectionDO)); + } + } diff --git a/src/main/java/com/subsidy/controller/RenSheJuController.java b/src/main/java/com/subsidy/controller/RenSheJuController.java index 62548c1..e4bbde0 100644 --- a/src/main/java/com/subsidy/controller/RenSheJuController.java +++ b/src/main/java/com/subsidy/controller/RenSheJuController.java @@ -1,48 +1,78 @@ package com.subsidy.controller; -import com.squareup.okhttp.*; +import com.subsidy.service.RenSheJuService; +import com.subsidy.vo.renshe.RensheResponseVO; +import com.subsidy.vo.renshe.RensheStringVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.io.IOException; +import java.util.List; + @RestController @Api(tags = "人社局数据对接") @RequestMapping("/rensheju") public class RenSheJuController { + @Autowired + private RenSheJuService renSheJuService; - @PostMapping("getSecret") - @ApiOperation("获取秘钥") - public String getSecret(){ + @PostMapping("classBaseInfo") + @ApiOperation("POST-2:班级基本信息信息采集接口") + public RensheResponseVO classBaseInfo() throws IOException { + return renSheJuService.classBaseInfo(); + } - MediaType mediaType = MediaType.parse("text/plain"); + @PostMapping("classHourBehavior") + @ApiOperation("POST-3:学时信息采集接口") + public RensheResponseVO classHourBehavior() throws IOException { + return renSheJuService.classHourBehavior(); + } - OkHttpClient client = new OkHttpClient(); - RequestBody body = RequestBody.create(mediaType, "json"); - Request request = new Request.Builder() - .url("https://api.shzypxy.com/token/accessPrivateKey") - .post(body) - .build(); - try { - Response response = client.newCall(request).execute(); - return response.body().string(); - }catch (Exception e){ - e.printStackTrace(); - } + @PostMapping("uploadChapterBehavior") + @ApiOperation("POST-4:考试信息采集接口") + public RensheResponseVO uploadChapterBehavior() throws IOException { + return renSheJuService.uploadChapterBehavior(); + } - return null; + @PostMapping("uploadClassAnswerQuestionBehavior") + @ApiOperation("POST-5:答疑辅导采集接口") + public RensheResponseVO uploadClassAnswerQuestionBehavior() throws IOException { + return renSheJuService.uploadClassAnswerQuestionBehavior(); } - @PostMapping("classBaseInfo") - @ApiOperation("班级基本信息信息采集接口") - public String classBaseInfo(){ + @PostMapping("uploadImage") + @ApiOperation("POST-6 班级活跃度/实名认证照片信息采集接口") + public List uploadImage()throws IOException { + return renSheJuService.uploadImage(); + } + @PostMapping("getClassCodeByPrivateKey") + @ApiOperation("POST-7 获取培训待绑定的(班级编号,项目编号)列表") + public RensheResponseVO getClassCodeByPrivateKey()throws IOException { + return renSheJuService.getClassCodeByPrivateKey(); + } + @PostMapping("uploadClassCode") + @ApiOperation("POST-8 上下游班级数据绑定接口") + public RensheResponseVO uploadClassCode()throws IOException { + return renSheJuService.uploadClassCode(); + } + @PostMapping("getErrorClass") + @ApiOperation("POST-9 获取推送失败班级列表") + public RensheResponseVO getErrorClass()throws IOException{ + return renSheJuService.getErrorClass(); + } - return null; + @PostMapping("clear") + @ApiOperation("POST-10 清除推送失败班级缓存") + public RensheStringVO clear()throws IOException{ + return renSheJuService.clear(); } } diff --git a/src/main/java/com/subsidy/controller/RenshejuHistoryController.java b/src/main/java/com/subsidy/controller/RenshejuHistoryController.java new file mode 100644 index 0000000..03bc5de --- /dev/null +++ b/src/main/java/com/subsidy/controller/RenshejuHistoryController.java @@ -0,0 +1,22 @@ +package com.subsidy.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.Api; + +/** + *

+ * 人社局推送失败记录表 前端控制器 + *

+ * + * @author Tuyp + * @since 2023-02-07 + */ +@RestController +@Api(tags = "人社局推送失败记录表") +@RequestMapping("/rensheju-history-do") +public class RenshejuHistoryController { + +} diff --git a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java index ff5f4b6..724c142 100644 --- a/src/main/java/com/subsidy/controller/VodPlayHistoryController.java +++ b/src/main/java/com/subsidy/controller/VodPlayHistoryController.java @@ -37,7 +37,7 @@ public class VodPlayHistoryController { @PostMapping("insertHistory") @ApiOperation("记录学生看视频位置 ajax请求 classId班级id vodId 视频id " + - "memberId 成员id playLength 播放时长 playRecord 位点 ") + "memberId 成员id playLength 播放时长 playRecord 位点 suspendLength暂停时长 ") @LoginRequired @TimeRequired public ResponseVO insertHistory(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){ @@ -46,7 +46,7 @@ public class VodPlayHistoryController { @RequestMapping("insertHistoryNew") @ApiOperation("记录学生看视频位置 classId班级id vodId 视频id memberId 成员id " + - "playLength 播放时长 playRecord 位点 ") + "playLength 播放时长 playRecord 位点 suspendLength") @TimeRequired public ResponseVO insertHistoryNew(@RequestBody String param){ InsertHistoryNewDTO insertHistoryNewDTO = JSON.parseObject(param, InsertHistoryNewDTO.class); diff --git a/src/main/java/com/subsidy/dto/renshe/ActivityList.java b/src/main/java/com/subsidy/dto/renshe/ActivityList.java new file mode 100644 index 0000000..9b50d6d --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/ActivityList.java @@ -0,0 +1,23 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +@Data +public class ActivityList { + /** + * 是否通过,0.通过 1.未通过 + */ + private Integer access; + /** + * 检验类型,1.人脸识别 2.弹出框点击事件 3.课堂答题 4.其他 + */ + private Integer activityDetection; + /** + * 活跃度检测时间,【13位时间戳】【精确到毫秒】 + */ + private Long activityTime; + /** + * 错误类型,1.人脸识别未通过2.弹出框未点击3.没有做课堂答题4.课堂答题合格率不达标 + */ + private Integer errorInfo; +} diff --git a/src/main/java/com/subsidy/dto/renshe/AnswerAndQuestionList.java b/src/main/java/com/subsidy/dto/renshe/AnswerAndQuestionList.java new file mode 100644 index 0000000..711bbb4 --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/AnswerAndQuestionList.java @@ -0,0 +1,18 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +@Data +public class AnswerAndQuestionList { + + /** + * 回答时间 + */ + private long answer; + /** + * 提问时间 + */ + private long question; + + +} diff --git a/src/main/java/com/subsidy/dto/renshe/AnswerBasic.java b/src/main/java/com/subsidy/dto/renshe/AnswerBasic.java new file mode 100644 index 0000000..2b2b177 --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/AnswerBasic.java @@ -0,0 +1,18 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +import java.util.List; + +@Data +public class AnswerBasic { + + /** + * 答疑辅导,提问和回答都存在值时才进行传递 + */ + private List answerAndQuestionList; + private String downCode; + private String identity; + + +} diff --git a/src/main/java/com/subsidy/dto/renshe/ChapterExamBasic.java b/src/main/java/com/subsidy/dto/renshe/ChapterExamBasic.java new file mode 100644 index 0000000..1dba752 --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/ChapterExamBasic.java @@ -0,0 +1,47 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +import java.util.List; + +@Data +public class ChapterExamBasic { + + /** + * 是否通过,0通过1未通过 + */ + private Long access; + /** + * 活跃度列表(数组),【数组】 + */ + private List activityList; + /** + * 章节(课程)编码 + */ + private String chapterCode; + /** + * 临时班级(项目)编号 + */ + private String downCode; + /** + * 章节(课程)考试时间列表,【数组】 + */ + private List examList; + /** + * 章节(课程)考试总时长,该字段数据应为当日产生examList列表内多条结束时间-开始时间累加和【秒】 + */ + private Long examTime; + /** + * 学员身份证号,会对身份证号长度、格式进行校验、X用大写 + */ + private String identity; + /** + * 学员电话号,会对学生手机号长度、格式进行校验 + */ + private String phone; + /** + * 学员姓名 + */ + private String studentName; + +} diff --git a/src/main/java/com/subsidy/dto/renshe/ChapterList2.java b/src/main/java/com/subsidy/dto/renshe/ChapterList2.java new file mode 100644 index 0000000..1f12b04 --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/ChapterList2.java @@ -0,0 +1,18 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +@Data +public class ChapterList2 { + + private String chapterCode; + + private String chapterName; + + private Integer isExam; + + private String chapterTime; + + private String examTime; + +} diff --git a/src/main/java/com/subsidy/dto/renshe/ChapterList3.java b/src/main/java/com/subsidy/dto/renshe/ChapterList3.java new file mode 100644 index 0000000..511ed4a --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/ChapterList3.java @@ -0,0 +1,29 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +@Data +public class ChapterList3 { + + /** + * 章节(课程)编码,与基本信息内的章节(课程)编码相对应 + */ + private String chapterCode; + /** + * 章节(课程)学习时长,该学习时间段内本章节学习累计时长【秒】 + */ + private long chapterTime; + /** + * 学习结束时间(视频播放结束时间),【13位时间戳】【精确到毫秒】 + */ + private long endTime; + /** + * 章节(课程)暂停时长,该学习时间段内本章节播放暂停累计时长【秒】(2023年2月1日开始实行) + */ + private long pauseTime; + /** + * 学习开始时间(视频播放开始时间),【13位时间戳】【精确到毫秒】 + */ + private long startTime; + +} diff --git a/src/main/java/com/subsidy/dto/renshe/ClassBaseInfoDTO.java b/src/main/java/com/subsidy/dto/renshe/ClassBaseInfoDTO.java new file mode 100644 index 0000000..229af63 --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/ClassBaseInfoDTO.java @@ -0,0 +1,14 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +import java.util.List; + +@Data +public class ClassBaseInfoDTO { + + private List epidemicSituationClassBasic; + + private String privateKey; + +} diff --git a/src/main/java/com/subsidy/dto/renshe/ClassCodeBasic.java b/src/main/java/com/subsidy/dto/renshe/ClassCodeBasic.java new file mode 100644 index 0000000..1ab875e --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/ClassCodeBasic.java @@ -0,0 +1,17 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +@Data +public class ClassCodeBasic { + + /** + * 班级(项目)编号 + */ + private String classCode; + /** + * 临时班级(项目)编号 + */ + private String downCode; + +} diff --git a/src/main/java/com/subsidy/dto/renshe/ClassHourBasic.java b/src/main/java/com/subsidy/dto/renshe/ClassHourBasic.java new file mode 100644 index 0000000..7b81722 --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/ClassHourBasic.java @@ -0,0 +1,47 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +import java.util.List; + +@Data +public class ClassHourBasic { + + /** + * 活跃度列表,【数组】 + */ + private List activityList; + /** + * 临时班级(临时项目)编号 + */ + private String downCode; + /** + * 学员身份证号,会对身份证号长度、格式进行校验、X用大写 + */ + private String identity; + /** + * 当日累计学习时长,视频暂停时间不计入【秒】 + */ + private long learnTime; + /** + * 上线时间列表,【数组】 + */ + private List loginList; + /** + * 当日累计登陆时长,该字段数据应为当日产生LoginList列表内多条下线时间-上线时间累加和【秒】 + */ + private long loginTime; + /** + * 学员电话号,会对学生手机号长度、格式进行校验 + */ + private String phone; + /** + * 当日累计播放时长,视频暂停时间计入【秒】 + */ + private Long playTime; + /** + * 学员姓名 + */ + private String studentName; + +} diff --git a/src/main/java/com/subsidy/dto/renshe/ClassHourBehaviorDTO.java b/src/main/java/com/subsidy/dto/renshe/ClassHourBehaviorDTO.java new file mode 100644 index 0000000..2888c7e --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/ClassHourBehaviorDTO.java @@ -0,0 +1,19 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +import java.util.List; + +@Data +public class ClassHourBehaviorDTO { + + /** + * 班级(项目)学时列表,【数组】班级(项目)学时列表 + */ + private List classHourBasic; + /** + * 私钥 + */ + private String privateKey; + +} diff --git a/src/main/java/com/subsidy/dto/renshe/EpidemicSituationClassBasic.java b/src/main/java/com/subsidy/dto/renshe/EpidemicSituationClassBasic.java new file mode 100644 index 0000000..f51cd96 --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/EpidemicSituationClassBasic.java @@ -0,0 +1,35 @@ +package com.subsidy.dto.renshe; + +import com.subsidy.vo.renshe.MemberVO; +import lombok.Data; + +import java.util.List; + +@Data +public class EpidemicSituationClassBasic { + + private String areaName; + + private List chapterList; + + private Long courseHour; + + private String downCode; + + private Long endDate; + + private Long learnHour; + +// private String professionName; + + private String shortName; + + private Long startDate; + + private List studentList; + + private String trainingCode; + + private String trainingName; + +} diff --git a/src/main/java/com/subsidy/dto/renshe/ExamList.java b/src/main/java/com/subsidy/dto/renshe/ExamList.java new file mode 100644 index 0000000..d3c34f6 --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/ExamList.java @@ -0,0 +1,21 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +@Data +public class ExamList { + + /** + * 章节(课程)考试时间列表,【13位时间戳】【精确到毫秒】 + */ + private long endTime; + /** + * 登录ip,会对IP进行校验 + */ + private String ip; + /** + * 章节(课程)考试开始时间,【13位时间戳】【精确到毫秒】 + */ + private long startTime; + +} diff --git a/src/main/java/com/subsidy/dto/renshe/ImageDetailList.java b/src/main/java/com/subsidy/dto/renshe/ImageDetailList.java new file mode 100644 index 0000000..93a2b35 --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/ImageDetailList.java @@ -0,0 +1,37 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +@Data +public class ImageDetailList { + + /** + * 检测时间,【13位时间戳】【精确到毫秒】如检测类型为活跃度检测则与【学时信息采集接口】、【考试信息采集接口】activityTime时间保持一致 + */ + private Long activityTime; + /** + * 检测类型,0.实名认证 1活跃度检测 (实名认证第一次必须是活体采集) + */ + private Long detectionType; + /** + * 学员身份证,会对身份证号长度、格式进行校验、X用大写 + */ + private String identity; + /** + * Base64图片,【jpg】【30kb~50kb】【413*295】 + */ + private String imageBase64; + /** + * 学员电话号,会对学生手机号长度、格式进行校验 + */ + private String phone; + /** + * 行为类型,0实名认证 1 学时行为类型的活跃度检测 2 考试行为类型的活跃度检测 + */ + private Long processType; + /** + * 学员姓名 + */ + private String studentName; + +} diff --git a/src/main/java/com/subsidy/dto/renshe/LoginList.java b/src/main/java/com/subsidy/dto/renshe/LoginList.java new file mode 100644 index 0000000..7d0297e --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/LoginList.java @@ -0,0 +1,27 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +import java.util.List; + +@Data +public class LoginList { + + /** + * 章节(课程)学时列表 + */ + private List chapterList; + /** + * 下线时间,【13位时间戳】【精确到毫秒】 + */ + private long endTime; + /** + * 登录ip,会对IP进行校验 + */ + private String ip; + /** + * 上线时间,【13位时间戳】【精确到毫秒】 + */ + private long startTime; + +} diff --git a/src/main/java/com/subsidy/dto/renshe/UploadChapterBehaviorDTO.java b/src/main/java/com/subsidy/dto/renshe/UploadChapterBehaviorDTO.java new file mode 100644 index 0000000..139a6c9 --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/UploadChapterBehaviorDTO.java @@ -0,0 +1,19 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +import java.util.List; + +@Data +public class UploadChapterBehaviorDTO { + + /** + * 章节(课程)考试列表,【数组】 + */ + private List chapterExamBasic; + /** + * 私钥 + */ + private String privateKey; + +} diff --git a/src/main/java/com/subsidy/dto/renshe/UploadClassAnswerQuestionBehaviorDTO.java b/src/main/java/com/subsidy/dto/renshe/UploadClassAnswerQuestionBehaviorDTO.java new file mode 100644 index 0000000..67b9842 --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/UploadClassAnswerQuestionBehaviorDTO.java @@ -0,0 +1,14 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +import java.util.List; + +@Data +public class UploadClassAnswerQuestionBehaviorDTO { + + private List answerBasic; + + private String privateKey; + +} diff --git a/src/main/java/com/subsidy/dto/renshe/UploadClassCodeDTO.java b/src/main/java/com/subsidy/dto/renshe/UploadClassCodeDTO.java new file mode 100644 index 0000000..07f0b97 --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/UploadClassCodeDTO.java @@ -0,0 +1,17 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +import java.util.List; + +@Data +public class UploadClassCodeDTO { + + private List classCodeBasic; + /** + * 私钥 + */ + private String privateKey; + + +} diff --git a/src/main/java/com/subsidy/dto/renshe/UploadImageDTO.java b/src/main/java/com/subsidy/dto/renshe/UploadImageDTO.java new file mode 100644 index 0000000..c0b96dc --- /dev/null +++ b/src/main/java/com/subsidy/dto/renshe/UploadImageDTO.java @@ -0,0 +1,23 @@ +package com.subsidy.dto.renshe; + +import lombok.Data; + +import java.util.List; + +@Data +public class UploadImageDTO { + + /** + * 临时班级(项目)编码 + */ + private String downCode; + /** + * 活跃度照片列表,【数组】 + */ + private List imageDetailList; + /** + * 私钥 + */ + private String privateKey; + +} diff --git a/src/main/java/com/subsidy/jobs/RenSheJuJob.java b/src/main/java/com/subsidy/jobs/RenSheJuJob.java index 3726ea7..f318f49 100644 --- a/src/main/java/com/subsidy/jobs/RenSheJuJob.java +++ b/src/main/java/com/subsidy/jobs/RenSheJuJob.java @@ -1,7 +1,14 @@ package com.subsidy.jobs; +import com.subsidy.service.RenSheJuService; +import com.subsidy.service.RenshejuHistoryService; +import com.subsidy.service.impl.RenshejuHistoryServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; +import java.io.IOException; + /** * 人社局数据对接 */ @@ -9,4 +16,72 @@ import org.springframework.stereotype.Component; public class RenSheJuJob { + @Autowired + private RenSheJuService renSheJuService; + + /** + * POST-2:班级基本信息信息采集接口 + */ + @Scheduled(cron = "0 0 1 * * ?") + public void classBaseInfo()throws IOException { + renSheJuService.classBaseInfo(); + } + + /** + * POST-3:学时信息采集接口 + */ + @Scheduled(cron = "0 5 1 * * ?") + public void classHourBehavior() throws IOException { + renSheJuService.classHourBehavior(); + } + + /** + * POST-4:考试信息采集接口 + */ + @Scheduled(cron = "0 10 1 * * ?") + public void uploadChapterBehavior() throws IOException { + renSheJuService.uploadChapterBehavior(); + } + + /** + * POST-5:答疑辅导采集接口 + */ + @Scheduled(cron = "0 15 1 * * ?") + public void uploadClassAnswerQuestionBehavior() throws IOException { + renSheJuService.uploadClassAnswerQuestionBehavior(); + } + + /** + * POST-6 班级活跃度/实名认证照片信息采集接口 + */ + @Scheduled(cron = "0 20 1 * * ?") + public void uploadImage()throws IOException { + renSheJuService.uploadImage(); + } + + /** + * POST-7 获取培训待绑定的(班级编号,项目编号)列表 + */ + @Scheduled(cron = "0 25 1 * * ?") + public void getClassCodeByPrivateKey()throws IOException { + renSheJuService.getClassCodeByPrivateKey(); + } + + /** + * POST-8 上下游班级数据绑定接口 + */ + @Scheduled(cron = "0 30 1 * * ?") + public void uploadClassCode()throws IOException { + renSheJuService.uploadClassCode(); + } + +// /** +// * POST-9 获取推送失败班级列表 +// */ +// @Scheduled(cron = "0 35 1 * * ?") +// public void getErrorClass()throws IOException{ +// renSheJuService.getErrorClass(); +// } + + } diff --git a/src/main/java/com/subsidy/mapper/ClassDictMapper.java b/src/main/java/com/subsidy/mapper/ClassDictMapper.java index 0736035..a16ad8e 100644 --- a/src/main/java/com/subsidy/mapper/ClassDictMapper.java +++ b/src/main/java/com/subsidy/mapper/ClassDictMapper.java @@ -66,4 +66,10 @@ public interface ClassDictMapper extends BaseMapper { * 获取证书的全部班级 */ List getAllCertClasses(ClassDictDO classDictDO); + + /** + * 前一天产生视频学习数据的班级信息 + */ + List dailyClassInfo(); + } diff --git a/src/main/java/com/subsidy/mapper/RenSheJuMapper.java b/src/main/java/com/subsidy/mapper/RenSheJuMapper.java new file mode 100644 index 0000000..b375587 --- /dev/null +++ b/src/main/java/com/subsidy/mapper/RenSheJuMapper.java @@ -0,0 +1,111 @@ +package com.subsidy.mapper; + +import com.subsidy.dto.renshe.ChapterExamBasic; +import com.subsidy.dto.renshe.ChapterList2; +import com.subsidy.dto.renshe.ChapterList3; +import com.subsidy.dto.renshe.ClassHourBasic; +import com.subsidy.model.ActivityDetectionDO; +import com.subsidy.model.ClassMemberMappingDO; +import com.subsidy.model.ExerciseDoneResultDO; +import com.subsidy.model.OprMemDictDO; +import com.subsidy.vo.renshe.*; +import org.springframework.stereotype.Repository; + +import java.time.LocalDateTime; +import java.util.List; + +@Repository +public interface RenSheJuMapper { + + /** + * 查询班级基本信息 + */ + ClassBaseInfoVO classBaseInfo(Long classId); + + /** + * 查询班级学员信息 + */ + List classMembers(Long classId); + + /** + * 课程下章节信息 + */ + List classChapters(Long classId); + + /** + * 新增班级 + */ + List newClasses(); + + /** + * 前一天新增视频学习数据 + */ + List dailyStudyInfo(); + + /** + * 前一天活跃度检测列表 + */ + List dailyActivities(String classId, Long memberId); + + /** + * 考试活跃度检测--人脸 + */ + List examActivities(String classId,Long memberId); + + /** + * 某人某天累计在线时长 + */ + Long dailyStayLength(Long memberId); + + /** + * 查看某人前一天上线的时间 + */ + List loginRecords(Long memberId); + + /** + * 查看某人前一天下线的时间 + */ + List loginOutRecords(Long memberId); + + /** + * 某个人某时间段的学习记录 + */ + List dailyStudyRecords(Long memberId,String classId,String startDate, String endDate); + + /** + * 前一天考试通过数据 + */ + List dailyExamBasic(); + + /** + * 查找课程最后一个视频 + */ + String classVodName(String classId); + + /** + * 找到某人某个时间段内的测评记录 + */ + List dailyExerciseDone(Long memberId, String startDate, String endDate); + + /** + * 找到某人当天答疑的记录 + */ + List dailyAnswer(); + + /** + * 查找前一天做过人脸识别的班级 + */ + List checkClassIds(); + + /** + * 查看某个班级的成员做过的人脸识别记录 + */ + List classImageChecks(Long classId); + + /** + * 前一天做过考试验证并且通过的人 + */ + List passExamCheck(Long classId); + + +} diff --git a/src/main/java/com/subsidy/mapper/RenshejuHistoryMapper.java b/src/main/java/com/subsidy/mapper/RenshejuHistoryMapper.java new file mode 100644 index 0000000..d71c37f --- /dev/null +++ b/src/main/java/com/subsidy/mapper/RenshejuHistoryMapper.java @@ -0,0 +1,18 @@ +package com.subsidy.mapper; + +import com.subsidy.model.RenshejuHistoryDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 人社局推送失败记录表 Mapper 接口 + *

+ * + * @author Tuyp + * @since 2023-02-07 + */ + @Repository +public interface RenshejuHistoryMapper extends BaseMapper { + +} diff --git a/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java b/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java index df1fcc2..93e34cd 100644 --- a/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java +++ b/src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java @@ -96,6 +96,10 @@ public interface VodPlayHistoryMapper extends BaseMapper { */ List getVodPlayDay(Long classId, Long memberId, Date endDate); + /** + * 找到某个人最新的学习记录 + */ +// Long memberLatestRecord(Long memberId); double getStudyTotal(); diff --git a/src/main/java/com/subsidy/model/CompanyDictDO.java b/src/main/java/com/subsidy/model/CompanyDictDO.java index 76af168..9643b32 100644 --- a/src/main/java/com/subsidy/model/CompanyDictDO.java +++ b/src/main/java/com/subsidy/model/CompanyDictDO.java @@ -56,6 +56,11 @@ public class CompanyDictDO extends BaseModel { private String address; /** + * 区域 + */ + private String areaName; + + /** * 是否需要跳转到Q学友 */ private Boolean qxyStatus; diff --git a/src/main/java/com/subsidy/model/RenshejuHistoryDO.java b/src/main/java/com/subsidy/model/RenshejuHistoryDO.java new file mode 100644 index 0000000..d6a1567 --- /dev/null +++ b/src/main/java/com/subsidy/model/RenshejuHistoryDO.java @@ -0,0 +1,44 @@ +package com.subsidy.model; + +import com.subsidy.util.BaseModel; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 人社局推送失败记录表 + *

+ * + * @author Tuyp + * @since 2023-02-07 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("rensheju_history") +public class RenshejuHistoryDO extends BaseModel { + + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 接口名称 + */ + private String interfaceName; + + /** + * 入参 + */ + private String inputParam; + + /** + * 出参 + */ + private Object outputParam; + + +} diff --git a/src/main/java/com/subsidy/model/VodPlayHistoryDO.java b/src/main/java/com/subsidy/model/VodPlayHistoryDO.java index 2086fba..ec42acd 100644 --- a/src/main/java/com/subsidy/model/VodPlayHistoryDO.java +++ b/src/main/java/com/subsidy/model/VodPlayHistoryDO.java @@ -48,6 +48,11 @@ public class VodPlayHistoryDO extends BaseModel { private Integer playLength; /** + * 暂停时长 + */ + private Integer suspendLength; + + /** * 播放视频位置 */ private Integer playRecord; diff --git a/src/main/java/com/subsidy/service/ActivityDetectionService.java b/src/main/java/com/subsidy/service/ActivityDetectionService.java index a02bb4c..777ebef 100644 --- a/src/main/java/com/subsidy/service/ActivityDetectionService.java +++ b/src/main/java/com/subsidy/service/ActivityDetectionService.java @@ -23,4 +23,5 @@ public interface ActivityDetectionService extends IService IPage getCheckHistory(GetCheckHistoryDTO getCheckHistoryDTO); + String verifyError(ActivityDetectionDO activityDetectionDO); } diff --git a/src/main/java/com/subsidy/service/RenSheJuService.java b/src/main/java/com/subsidy/service/RenSheJuService.java new file mode 100644 index 0000000..99a89bd --- /dev/null +++ b/src/main/java/com/subsidy/service/RenSheJuService.java @@ -0,0 +1,32 @@ +package com.subsidy.service; + +import com.subsidy.dto.renshe.*; +import com.subsidy.vo.renshe.RensheResponseVO; +import com.subsidy.vo.renshe.RensheStringVO; + +import java.io.IOException; +import java.util.List; + +public interface RenSheJuService { + + RensheResponseVO classBaseInfo() throws IOException; + + RensheResponseVO classHourBehavior() throws IOException; + + RensheResponseVO uploadChapterBehavior() throws IOException; + + RensheResponseVO uploadClassAnswerQuestionBehavior()throws IOException; + + List uploadImage()throws IOException; + + RensheResponseVO getClassCodeByPrivateKey()throws IOException; + + RensheResponseVO uploadClassCode()throws IOException; + + RensheResponseVO getErrorClass()throws IOException; + + RensheStringVO clear()throws IOException; + + void test(); + +} diff --git a/src/main/java/com/subsidy/service/RenshejuHistoryService.java b/src/main/java/com/subsidy/service/RenshejuHistoryService.java new file mode 100644 index 0000000..73ef5ca --- /dev/null +++ b/src/main/java/com/subsidy/service/RenshejuHistoryService.java @@ -0,0 +1,16 @@ +package com.subsidy.service; + +import com.subsidy.model.RenshejuHistoryDO; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 人社局推送失败记录表 服务类 + *

+ * + * @author Tuyp + * @since 2023-02-07 + */ +public interface RenshejuHistoryService extends IService { + +} diff --git a/src/main/java/com/subsidy/service/impl/ActivityDetectionServiceImpl.java b/src/main/java/com/subsidy/service/impl/ActivityDetectionServiceImpl.java index e2f1f6e..42e0f47 100644 --- a/src/main/java/com/subsidy/service/impl/ActivityDetectionServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ActivityDetectionServiceImpl.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.subsidy.common.exception.HttpException; import com.subsidy.dto.detection.GetCheckHistoryDTO; import com.subsidy.dto.detection.VerifyDTO; +import com.subsidy.mapper.VodPlayHistoryMapper; import com.subsidy.model.ActivityDetectionDO; import com.subsidy.mapper.ActivityDetectionMapper; import com.subsidy.service.ActivityDetectionService; @@ -13,6 +14,7 @@ import com.subsidy.util.ActivityDetectionUtils; import com.subsidy.util.ConstantUtils; import com.subsidy.vo.activity.GetCheckHistoryVO; import com.tencentcloudapi.captcha.v20190722.models.DescribeCaptchaResultResponse; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; @@ -28,6 +30,9 @@ import javax.servlet.http.HttpServletRequest; @Service public class ActivityDetectionServiceImpl extends ServiceImpl implements ActivityDetectionService { + @Autowired + private VodPlayHistoryMapper vodPlayHistoryMapper; + public String verify(VerifyDTO verifyDTO, HttpServletRequest request){ try{ @@ -47,6 +52,11 @@ public class ActivityDetectionServiceImpl extends ServiceImpl() .lambda() .eq(ClassMemberMappingDO::getMemberId, imageCheckRecordDO.getMemberId()) .eq(ClassMemberMappingDO::getClassId, imageCheckRecordDO.getClassId())); - - classMemberMappingDO.setPhoto(imageCheckRecordDO.getPhoto()); - classMemberMappingMapper.updateById(classMemberMappingDO); + if (StringUtils.isEmpty(classMemberMappingDO.getPhoto())){ + classMemberMappingDO.setPhoto(imageCheckRecordDO.getPhoto()); + classMemberMappingMapper.updateById(classMemberMappingDO); + } } } else { activityDetectionDO.setStatus(0); diff --git a/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java b/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java new file mode 100644 index 0000000..25dd12e --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java @@ -0,0 +1,572 @@ +package com.subsidy.service.impl; + +import com.alibaba.fastjson.JSON; +import com.subsidy.common.configure.RenSheConfig; +import com.subsidy.dto.renshe.*; +import com.subsidy.mapper.ClassDictMapper; +import com.subsidy.mapper.RenSheJuMapper; +import com.subsidy.mapper.RenshejuHistoryMapper; +import com.subsidy.model.ClassDictDO; +import com.subsidy.model.ExerciseDoneResultDO; +import com.subsidy.model.OprMemDictDO; +import com.subsidy.model.RenshejuHistoryDO; +import com.subsidy.service.RenSheJuService; +import com.subsidy.util.OSSUtils; +import com.subsidy.util.RenSheJuConstant; +import com.subsidy.vo.renshe.*; +import net.sf.json.JSONObject; +import okhttp3.*; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.sql.Timestamp; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +@Service +public class RenSheJuServiceImpl implements RenSheJuService { + + @Autowired + private RenSheJuMapper renSheJuMapper; + + @Autowired + private RenSheConfig renSheConfig; + + @Autowired + private ClassDictMapper classDictMapper; + + @Autowired + RenshejuHistoryMapper renshejuHistoryMapper; + + public RensheResponseVO classBaseInfo() throws IOException { + OkHttpClient client = new OkHttpClient().newBuilder() + .build(); + MediaType mediaType = MediaType.parse("application/json"); + + //拼数据 + ClassBaseInfoDTO classBaseInfoDTO = new ClassBaseInfoDTO(); + classBaseInfoDTO.setPrivateKey(getSecret()); + + List epidemicSituationClassBasics = new ArrayList<>(); + + //查找前一天产生数据的班级 + List classIds = renSheJuMapper.newClasses(); + for (Long classId : classIds) { + EpidemicSituationClassBasic epidemicSituationClassBasic = new EpidemicSituationClassBasic(); + //班级基本信息 + ClassBaseInfoVO classBaseInfoVO = renSheJuMapper.classBaseInfo(classId); + BeanUtils.copyProperties(classBaseInfoVO, epidemicSituationClassBasic); + epidemicSituationClassBasic.setDownCode(classBaseInfoVO.getDownCode()); + + //章节 + List chapterLists = renSheJuMapper.classChapters(classId); + ChapterList2 chapterList2 = chapterLists.get(chapterLists.size() - 1); + chapterList2.setIsExam(1); + epidemicSituationClassBasic.setChapterList(chapterLists); + + //学员列表 + List memberVOS = renSheJuMapper.classMembers(classId); + epidemicSituationClassBasic.setStudentList(memberVOS); + + epidemicSituationClassBasics.add(epidemicSituationClassBasic); + } + classBaseInfoDTO.setEpidemicSituationClassBasic(epidemicSituationClassBasics); + + 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()); +// renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString()); +// renshejuHistoryMapper.insert(renshejuHistoryDO); +// System.out.println(rensheResponseVO); +// return rensheResponseVO; + return null; + + } + + public RensheResponseVO classHourBehavior() throws IOException { + OkHttpClient client = new OkHttpClient().newBuilder() + .build(); + MediaType mediaType = MediaType.parse("application/json"); + + ClassHourBehaviorDTO classHourBehaviorDTO = new ClassHourBehaviorDTO(); + + classHourBehaviorDTO.setPrivateKey(getSecret()); + + List classHourBasics = new ArrayList<>(); + + //前一天新增视频学习数据的班级 + List dailyStudyInfoVOS = renSheJuMapper.dailyStudyInfo(); + 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(0).getCreateDate().toString().replace("T", " "), loginOutRecords.get(i).getCreateDate().toString().replace("T", " ")); + 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); + } + activityList.setActivityDetection(2); + 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/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); + if (null!=rensheResponseVO.getCtt()){ + RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); + renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_3); + renshejuHistoryDO.setInputParam(JSONObject.fromObject(classHourBehaviorDTO).toString()); + renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString()); + renshejuHistoryMapper.insert(renshejuHistoryDO); + } + System.out.println(rensheResponseVO); + return rensheResponseVO; + } + + public RensheResponseVO uploadChapterBehavior() throws IOException { + + OkHttpClient client = new OkHttpClient().newBuilder() + .build(); + MediaType mediaType = MediaType.parse("application/json"); + + UploadChapterBehaviorDTO uploadChapterBehaviorDTO = new UploadChapterBehaviorDTO(); + + uploadChapterBehaviorDTO.setPrivateKey(getSecret()); + + List chapterExamBasics = new ArrayList<>(); + + List dailyExamBasicVOS = renSheJuMapper.dailyExamBasic(); + + for (DailyExamBasicVO dailyExamBasicVO : dailyExamBasicVOS) { + + //章节课程考试时间列表 + ChapterExamBasic chapterExamBasic = new ChapterExamBasic(); + BeanUtils.copyProperties(dailyExamBasicVO, chapterExamBasic); + chapterExamBasic.setDownCode(dailyExamBasicVO.getDownCode()); + + //最后一节课作为chapterCode + String vodId = renSheJuMapper.classVodName(dailyExamBasicVO.getDownCode()); + chapterExamBasic.setChapterCode(vodId); + + //考试活跃度列表 + List activityLists = new ArrayList<>(); + List activityDetectionDOS = renSheJuMapper.examActivities(dailyExamBasicVO.getDownCode(), dailyExamBasicVO.getMemberId()); + for (ExamActivitiesVO dailyActivitiesVO : activityDetectionDOS) { + + ActivityList activityList = new ActivityList(); + if (null == dailyActivitiesVO.getAccess() || 0 == dailyActivitiesVO.getAccess()) { + activityList.setAccess(1); + activityList.setErrorInfo(1); + } else { + activityList.setAccess(0); + } + activityList.setActivityDetection(1); + activityList.setActivityTime(dailyActivitiesVO.getActivityTime()); + activityLists.add(activityList); + } + chapterExamBasic.setActivityList(activityLists); + + //考试时间列表 + //上线时间 + List loginRecords = renSheJuMapper.loginRecords(dailyExamBasicVO.getMemberId()); + //下线时间 + List loginOutRecords = renSheJuMapper.loginOutRecords(dailyExamBasicVO.getMemberId()); + + List examLists = new ArrayList(); + + for (int i = 0; i < loginRecords.size(); i++) { + //找到该时间段内的测评 + List exerciseDoneResultDOS = renSheJuMapper.dailyExerciseDone(dailyExamBasicVO.getMemberId(), loginRecords.get(i).getCreateDate().toString().replace("T", " "), loginOutRecords.get(i).getCreateDate().toString().replace("T", " ")); + for (ExerciseDoneResultDO exerciseDoneResultDO : exerciseDoneResultDOS) { + ExamList examList = new ExamList(); + examList.setStartTime(Timestamp.valueOf(exerciseDoneResultDO.getStartDate()).getTime()); + examList.setEndTime(Timestamp.valueOf(exerciseDoneResultDO.getCreateDate()).getTime()); + examList.setIp(loginRecords.get(i).getIpAddress()); + examLists.add(examList); + } + } + chapterExamBasic.setExamList(examLists); + chapterExamBasics.add(chapterExamBasic); + } + + uploadChapterBehaviorDTO.setChapterExamBasic(chapterExamBasics); + + System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(uploadChapterBehaviorDTO)); + + RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(uploadChapterBehaviorDTO).toString()); + Request request = new Request.Builder() + .url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadChapterBehavior") + .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); + System.out.println(rensheResponseVO); + if (null!=rensheResponseVO.getCtt()){ + RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); + renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_4); + renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadChapterBehaviorDTO).toString()); + renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString()); + renshejuHistoryMapper.insert(renshejuHistoryDO); + } + return rensheResponseVO; + } + + public RensheResponseVO uploadClassAnswerQuestionBehavior() throws IOException { + + OkHttpClient client = new OkHttpClient().newBuilder() + .build(); + MediaType mediaType = MediaType.parse("application/json"); + + UploadClassAnswerQuestionBehaviorDTO uploadClassAnswerQuestionBehaviorDTO = new UploadClassAnswerQuestionBehaviorDTO(); + + //秘钥 + uploadClassAnswerQuestionBehaviorDTO.setPrivateKey(getSecret()); + + List dailyAnswerVOS = renSheJuMapper.dailyAnswer(); + + HashMap> hashMap = new HashMap<>(); + for (DailyAnswerVO dailyAnswerVO : dailyAnswerVOS) { + + if (!hashMap.containsKey(dailyAnswerVO.getDownCode() + ":" + dailyAnswerVO.getIdentity())) { + List answerAndQuestionLists = new ArrayList<>(); + AnswerAndQuestionList answerAndQuestionList = new AnswerAndQuestionList(); + answerAndQuestionList.setAnswer(dailyAnswerVO.getAnswer()); + answerAndQuestionList.setQuestion(dailyAnswerVO.getQuestion()); + answerAndQuestionLists.add(answerAndQuestionList); + hashMap.put(dailyAnswerVO.getDownCode() + ":" + dailyAnswerVO.getIdentity(), answerAndQuestionLists); + } else { + List answerAndQuestionLists = hashMap.get(dailyAnswerVO.getDownCode() + ":" + dailyAnswerVO.getIdentity()); + AnswerAndQuestionList answerAndQuestionList = new AnswerAndQuestionList(); + answerAndQuestionList.setAnswer(dailyAnswerVO.getAnswer()); + answerAndQuestionList.setQuestion(dailyAnswerVO.getQuestion()); + answerAndQuestionLists.add(answerAndQuestionList); + hashMap.put(dailyAnswerVO.getDownCode() + ":" + dailyAnswerVO.getIdentity(), answerAndQuestionLists); + } + } + + List answerBasics = new ArrayList<>(); + + for (String key : hashMap.keySet()) { + AnswerBasic answerBasic = new AnswerBasic(); + String downCode = key.split(":")[0]; + String identity = key.split(":")[1]; + answerBasic.setDownCode(downCode); + answerBasic.setIdentity(identity); + answerBasic.setAnswerAndQuestionList(hashMap.get(key)); + answerBasics.add(answerBasic); + } + + uploadClassAnswerQuestionBehaviorDTO.setAnswerBasic(answerBasics); + System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(uploadClassAnswerQuestionBehaviorDTO)); + RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(uploadClassAnswerQuestionBehaviorDTO).toString()); + Request request = new Request.Builder() + .url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadClassAnswerQuestionBehavior") + .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); + System.out.println(rensheResponseVO); + if (null!=rensheResponseVO.getCtt()){ + RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); + renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_5); + renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadClassAnswerQuestionBehaviorDTO).toString()); + renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString()); + renshejuHistoryMapper.insert(renshejuHistoryDO); + } + + return rensheResponseVO; + } + + public List uploadImage() throws IOException { + + List rensheResponseVOS = new ArrayList<>(); + + OkHttpClient client = new OkHttpClient().newBuilder() + .build(); + MediaType mediaType = MediaType.parse("application/json"); + + + //找到昨天做过人脸识别的班级 + List classIds = renSheJuMapper.checkClassIds(); + for (Long classId : classIds) { + + UploadImageDTO uploadImage = new UploadImageDTO(); + uploadImage.setPrivateKey(getSecret()); + uploadImage.setDownCode(String.valueOf(classId)); +// //查找班级下所有人做过的实名认证记录 + List classImageChecksVOS = renSheJuMapper.classImageChecks(classId); + + List imageDetailLists = new ArrayList(); + // + for (ClassImageChecksVO classImageChecksVO : classImageChecksVOS) { + ImageDetailList imageDetailList = new ImageDetailList(); + BeanUtils.copyProperties(classImageChecksVO, imageDetailList); + imageDetailList.setImageBase64(OSSUtils.image2Base64(classImageChecksVO.getImage())); + imageDetailList.setProcessType(0L); + imageDetailList.setDetectionType(0L); + imageDetailLists.add(imageDetailList); + } + + //查找前一天做过考试验证的记录 + List classImageChecksVOS1 = renSheJuMapper.passExamCheck(classId); + + for (ClassImageChecksVO cic : classImageChecksVOS1) { + ImageDetailList imageDetailList = new ImageDetailList(); + BeanUtils.copyProperties(cic, imageDetailList); + imageDetailList.setImageBase64(OSSUtils.image2Base64(cic.getImage())); + imageDetailList.setProcessType(2L); + imageDetailList.setDetectionType(1L); + imageDetailLists.add(imageDetailList); + } + + uploadImage.setImageDetailList(imageDetailLists); + 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") + .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); + + if (null!=rensheResponseVO.getCtt()){ + RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); + renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_6); + renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadImage).toString()); + renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString()); + renshejuHistoryMapper.insert(renshejuHistoryDO); + } + System.out.println(rensheResponseVO); + rensheResponseVOS.add(rensheResponseVO); + } + + return rensheResponseVOS; + } + + public RensheResponseVO getClassCodeByPrivateKey() throws IOException { + + OkHttpClient client = new OkHttpClient().newBuilder() + .build(); + MediaType mediaType = MediaType.parse("text/plain"); + RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM) + .addFormDataPart("privateKey", getSecret()) + .build(); + Request request = new Request.Builder() + .url(renSheConfig.getUrl() + "/import/downstream/enterprise/getClassCodeByPrivateKey") + .method("POST", body) + .addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)") + .build(); + Response response = client.newCall(request).execute(); + System.out.println(response); + RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class); + System.out.println(rensheResponseVO); + + if (null!=rensheResponseVO.getCtt()){ + RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); + renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_7); + renshejuHistoryDO.setInputParam(getSecret()); + renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString()); + renshejuHistoryMapper.insert(renshejuHistoryDO); + } + return rensheResponseVO; + } + + public RensheResponseVO uploadClassCode() throws IOException { + + OkHttpClient client = new OkHttpClient().newBuilder() + .build(); + MediaType mediaType = MediaType.parse("application/json"); + + UploadClassCodeDTO uploadClassCodeDTO = new UploadClassCodeDTO(); + + uploadClassCodeDTO.setPrivateKey(getSecret()); + + //所有班级 + List classIds = renSheJuMapper.newClasses(); + + List classCodeBasics = new ArrayList(); + for (Long classId : classIds) { + ClassCodeBasic classCodeBasic = new ClassCodeBasic(); + ClassDictDO classDictDO = classDictMapper.selectById(classId); + classCodeBasic.setDownCode(String.valueOf(classDictDO.getId())); + classCodeBasic.setClassCode(classDictDO.getClassCode()); + classCodeBasics.add(classCodeBasic); + } + uploadClassCodeDTO.setClassCodeBasic(classCodeBasics); + + System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(uploadClassCodeDTO)); + + RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(uploadClassCodeDTO).toString()); + Request request = new Request.Builder() + .url(renSheConfig.getUrl()+"/import/downstream/enterprise/uploadClassCode") + .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); + System.out.println(rensheResponseVO); + + if (null!=rensheResponseVO.getCtt()){ + RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); + renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_8); + renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadClassCodeDTO).toString()); + renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString()); + renshejuHistoryMapper.insert(renshejuHistoryDO); + } + return rensheResponseVO; + } + + public RensheResponseVO getErrorClass() throws IOException { + + OkHttpClient client = new OkHttpClient().newBuilder() + .build(); + MediaType mediaType = MediaType.parse("text/plain"); + RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM) + .addFormDataPart("privateKey", getSecret()) + .build(); + Request request = new Request.Builder() + .url(renSheConfig.getUrl() + "/import/downstream/enterprise/getErrorClass") + .method("POST", body) + .addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)") + .build(); + Response response = client.newCall(request).execute(); + RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class); + System.out.println(rensheResponseVO); + if (null!=rensheResponseVO.getCtt()){ + RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); + renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_9); + renshejuHistoryDO.setInputParam(getSecret()); + renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString()); + renshejuHistoryMapper.insert(renshejuHistoryDO); + } + return rensheResponseVO; + } + + public RensheStringVO clear() throws IOException { + + OkHttpClient client = new OkHttpClient().newBuilder() + .build(); +// MediaType mediaType = MediaType.parse("text/plain"); + RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM) + .addFormDataPart("privateKey", getSecret()) + .build(); + Request request = new Request.Builder() + .url(renSheConfig.getUrl() + "/import/downstream/enterprise/clear") + .method("POST", body) + .addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)") + .build(); + Response response = client.newCall(request).execute(); + RensheStringVO rensheStringVO = JSON.parseObject(response.body().string(), RensheStringVO.class); + System.out.println(rensheStringVO); + + return rensheStringVO; + } + + + public String getSecret() throws IOException { + OkHttpClient client = new OkHttpClient().newBuilder() + .build(); +// MediaType mediaType = MediaType.parse("text/plain"); + RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM) + .addFormDataPart("publicKey", renSheConfig.getSecretKey()) + .build(); + Request request = new Request.Builder() + .url(renSheConfig.getUrl() + "/token/accessPrivateKey") + .method("POST", body) + .addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)") + .build(); + Response response = client.newCall(request).execute(); + GetSecretVO getSecretVO = JSON.parseObject(response.body().string(), GetSecretVO.class); + System.out.println(getSecretVO); + return getSecretVO.getCtt().getPrivateKey(); + } + + public static void main(String[] args) { +// GetSecretVO getSecretVO = new GetSecretVO(); +// +// getSecretVO.setC(1); +// getSecretVO.setMsg("aaaa"); +// GetSecretChildVO getSecretChildVO = new GetSecretChildVO(); +// getSecretChildVO.setIp("1121"); +// getSecretChildVO.setPrivateKey("1111111"); +//// getSecretChildVO.setValidTime("2212"); +// getSecretVO.setCtt(getSecretChildVO); +// String s = JSONObject.fromObject(getSecretVO).toString(); +// System.out.println(s); + + LocalDateTime localDateTime = LocalDateTime.now(); + System.out.println(localDateTime.toString()); + + } + + public void test(){ + System.out.println("132222222222222222222222222222"); + } + +} diff --git a/src/main/java/com/subsidy/service/impl/RenshejuHistoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/RenshejuHistoryServiceImpl.java new file mode 100644 index 0000000..bf9f47a --- /dev/null +++ b/src/main/java/com/subsidy/service/impl/RenshejuHistoryServiceImpl.java @@ -0,0 +1,20 @@ +package com.subsidy.service.impl; + +import com.subsidy.model.RenshejuHistoryDO; +import com.subsidy.mapper.RenshejuHistoryMapper; +import com.subsidy.service.RenshejuHistoryService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 人社局推送失败记录表 服务实现类 + *

+ * + * @author Tuyp + * @since 2023-02-07 + */ +@Service +public class RenshejuHistoryServiceImpl extends ServiceImpl implements RenshejuHistoryService { + +} diff --git a/src/main/java/com/subsidy/util/RenSheJuConstant.java b/src/main/java/com/subsidy/util/RenSheJuConstant.java new file mode 100644 index 0000000..a79e493 --- /dev/null +++ b/src/main/java/com/subsidy/util/RenSheJuConstant.java @@ -0,0 +1,51 @@ +package com.subsidy.util; + +public class RenSheJuConstant { + + /** + * POST-2:班级基本信息信息采集接口 + */ + public static final String POST_2 = "POST_2_classBaseInfo"; + + /** + * POST-3:学时信息采集接口 + */ + public static final String POST_3 = "POST_3_classHourBehavior"; + + /** + * POST-4:考试信息采集接口 + */ + public static final String POST_4 = "POST_4_uploadChapterBehavior"; + + /** + * POST-5:答疑辅导采集接口 + */ + public static final String POST_5 = "POST_5_uploadClassAnswerQuestionBehavior"; + + /** + * POST-6 班级活跃度/实名认证照片信息采集接口 + */ + public static final String POST_6 = "POST_6_uploadImage"; + + /** + * POST-7 获取培训待绑定的(班级编号,项目编号)列表 + */ + public static final String POST_7 = "POST_7_getClassCodeByPrivateKey"; + + /** + * POST-8 上下游班级数据绑定接口 + */ + public static final String POST_8 = "POST_8_uploadClassCode"; + + /** + * POST-9 获取推送失败班级列表 + */ + public static final String POST_9 = "POST_9_getErrorClass"; + + /** + * POST-10 清除推送失败班级缓存 + */ + public static final String POST_10 = "POST_10_clear"; + + +} diff --git a/src/main/java/com/subsidy/vo/administer/OperatorsVO.java b/src/main/java/com/subsidy/vo/administer/OperatorsVO.java index e866734..91fef68 100644 --- a/src/main/java/com/subsidy/vo/administer/OperatorsVO.java +++ b/src/main/java/com/subsidy/vo/administer/OperatorsVO.java @@ -35,4 +35,6 @@ public class OperatorsVO { private String superviseName; private String companyCode; + + private String areaName; } diff --git a/src/main/java/com/subsidy/vo/renshe/ActivityList9.java b/src/main/java/com/subsidy/vo/renshe/ActivityList9.java new file mode 100644 index 0000000..df2cb5e --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/ActivityList9.java @@ -0,0 +1,37 @@ +package com.subsidy.vo.renshe; + +import lombok.Data; + +@Data +public class ActivityList9 { + + /** + * 活跃度是否通过 + */ + private String access; + /** + * 活跃度检测依据 + */ + private String activityDetection; + /** + * 活跃度检测时间 + */ + private String activityTime; + /** + * 活跃度未通过原因 + */ + private String errorInfo; + /** + * 未通过详情 + */ + private String errorMessage; + /** + * 修改日期 + */ + private String updateDate; + /** + * 同步状态 + */ + private String updateStatus; + +} diff --git a/src/main/java/com/subsidy/vo/renshe/ChapterList9.java b/src/main/java/com/subsidy/vo/renshe/ChapterList9.java new file mode 100644 index 0000000..3b54fb2 --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/ChapterList9.java @@ -0,0 +1,38 @@ +package com.subsidy.vo.renshe; + +import lombok.Data; + +@Data +public class ChapterList9 { + + /** + * 章节(课程)编码,与基本信息内的章节(课程)编码相对应 + */ + private String chapterCode; + /** + * 章节(课程)学习时长,本次登录时间段内本章节学习累计时长【分】 + */ + private long chapterTime; + /** + * 学习结束时间 + */ + private String endTime; + /** + * 未通过详情 + */ + private String errorMessage; + /** + * 学习开始时间 + */ + private String startTime; + /** + * 修改日期 + */ + private String updateDate; + /** + * 同步状态 + */ + private String updateStatus; + + +} diff --git a/src/main/java/com/subsidy/vo/renshe/ClassBaseInfoVO.java b/src/main/java/com/subsidy/vo/renshe/ClassBaseInfoVO.java new file mode 100644 index 0000000..5f0e434 --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/ClassBaseInfoVO.java @@ -0,0 +1,26 @@ +package com.subsidy.vo.renshe; + +import lombok.Data; + +@Data +public class ClassBaseInfoVO { + + private String downCode; + + private String shortName; + + private Long learnHour; + + private Long courseHour; + + private Long startDate; + + private Long endDate; + + private String areaName; + + private String trainingName; + + private String trainingCode; + +} diff --git a/src/main/java/com/subsidy/vo/renshe/ClassImageChecksVO.java b/src/main/java/com/subsidy/vo/renshe/ClassImageChecksVO.java new file mode 100644 index 0000000..3a5b265 --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/ClassImageChecksVO.java @@ -0,0 +1,37 @@ +package com.subsidy.vo.renshe; + +import lombok.Data; + +@Data +public class ClassImageChecksVO { + + /** + * 检测时间,【13位时间戳】【精确到毫秒】如检测类型为活跃度检测则与【学时信息采集接口】、【考试信息采集接口】activityTime时间保持一致 + */ + private Long activityTime; + /** + * 检测类型,0.实名认证 1活跃度检测 (实名认证第一次必须是活体采集) + */ + private Long detectionType; + /** + * 学员身份证,会对身份证号长度、格式进行校验、X用大写 + */ + private String identity; + /** + * Base64图片,【jpg】【30kb~50kb】【413*295】 + */ + private String image; + /** + * 学员电话号,会对学生手机号长度、格式进行校验 + */ + private String phone; + /** + * 行为类型,0实名认证 1 学时行为类型的活跃度检测 2 考试行为类型的活跃度检测 + */ + private Long processType; + /** + * 学员姓名 + */ + private String studentName; + +} diff --git a/src/main/java/com/subsidy/vo/renshe/Ctt7.java b/src/main/java/com/subsidy/vo/renshe/Ctt7.java new file mode 100644 index 0000000..44f3133 --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/Ctt7.java @@ -0,0 +1,25 @@ +package com.subsidy.vo.renshe; + +import lombok.Data; + +@Data +public class Ctt7 { + + /** + * 所在区域名称 + */ + private String areaName; + /** + * 班级(项目)编号 + */ + private String classCode; + /** + * 项目(项目)名称 + */ + private String name; + /** + * 所属企业名称 + */ + private String trainingUnit; + +} diff --git a/src/main/java/com/subsidy/vo/renshe/Ctt9.java b/src/main/java/com/subsidy/vo/renshe/Ctt9.java new file mode 100644 index 0000000..52ac825 --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/Ctt9.java @@ -0,0 +1,60 @@ +package com.subsidy.vo.renshe; + +import com.subsidy.dto.renshe.LoginList; +import lombok.Data; + +import java.util.List; + +@Data +public class Ctt9 { + + /** + * 活跃度列表,【数组】 + */ + private List activityList; + /** + * 班级(项目)编码 + */ + private Object downCode; + /** + * 未通过详情 + */ + private String errorMessage; + /** + * 学员身份证,会对身份证号长度、格式进行校验、X用大写 + */ + private String identity; + /** + * 当日累计学习时长,视频暂停时间不计入【分】 + */ + private Object learnTime; + /** + * 上线时间列表,【数组】 + */ + private List loginList; + /** + * 当日累计登陆时长,该字段数据应为当日产生LoginList列表内多条下线时间-上线时间累加和【分】 + */ + private Object loginTime; + /** + * 学员电话,会对手机号长度、格式进行校验 + */ + private String phone; + /** + * 当日累计播放时长,视频暂停时间计入【分】 + */ + private Object playTime; + /** + * 学员姓名 + */ + private String studentName; + /** + * 修改日期 + */ + private Long updateDate; + /** + * 同步状态 + */ + private String updateStatus; + +} diff --git a/src/main/java/com/subsidy/vo/renshe/DailyActivitiesVO.java b/src/main/java/com/subsidy/vo/renshe/DailyActivitiesVO.java new file mode 100644 index 0000000..5bb512d --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/DailyActivitiesVO.java @@ -0,0 +1,13 @@ +package com.subsidy.vo.renshe; + +import lombok.Data; + +@Data +public class DailyActivitiesVO { + + private Integer access; + + private Long activityTime; + + +} diff --git a/src/main/java/com/subsidy/vo/renshe/DailyAnswerVO.java b/src/main/java/com/subsidy/vo/renshe/DailyAnswerVO.java new file mode 100644 index 0000000..f7d9d42 --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/DailyAnswerVO.java @@ -0,0 +1,20 @@ +package com.subsidy.vo.renshe; + +import lombok.Data; + +@Data +public class DailyAnswerVO { + + private Long id; + + private Long askId; + + private String downCode; + + private String identity; + + private Long answer; + + private Long question; + +} diff --git a/src/main/java/com/subsidy/vo/renshe/DailyExamBasicVO.java b/src/main/java/com/subsidy/vo/renshe/DailyExamBasicVO.java new file mode 100644 index 0000000..58724b3 --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/DailyExamBasicVO.java @@ -0,0 +1,23 @@ +package com.subsidy.vo.renshe; + +import lombok.Data; + +@Data +public class DailyExamBasicVO { + + + private Long memberId; + + private String downCode; + + private String studentName; + + private String phone; + + private String identity; + + private Long access; + + private Long examTime; + +} diff --git a/src/main/java/com/subsidy/vo/renshe/DailyStudyInfoVO.java b/src/main/java/com/subsidy/vo/renshe/DailyStudyInfoVO.java new file mode 100644 index 0000000..eb488d3 --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/DailyStudyInfoVO.java @@ -0,0 +1,42 @@ +package com.subsidy.vo.renshe; + +import lombok.Data; + +@Data +public class DailyStudyInfoVO { + + private Long memberId; + +// private Long classId; + + /** + * 临时班级(临时项目)编号 + */ + private String downCode; + /** + * 学员身份证号,会对身份证号长度、格式进行校验、X用大写 + */ + private String identity; + /** + * 当日累计学习时长,视频暂停时间不计入【秒】 + */ + private long learnTime; + + /** + * 当日累计登陆时长,该字段数据应为当日产生LoginList列表内多条下线时间-上线时间累加和【秒】 + */ + private long loginTime; + /** + * 学员电话号,会对学生手机号长度、格式进行校验 + */ + private String phone; + /** + * 当日累计播放时长,视频暂停时间计入【秒】 + */ + private Long playTime; + /** + * 学员姓名 + */ + private String studentName; + +} diff --git a/src/main/java/com/subsidy/vo/renshe/ExamActivitiesVO.java b/src/main/java/com/subsidy/vo/renshe/ExamActivitiesVO.java new file mode 100644 index 0000000..d90e3cd --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/ExamActivitiesVO.java @@ -0,0 +1,12 @@ +package com.subsidy.vo.renshe; + +import lombok.Data; + +@Data +public class ExamActivitiesVO { + + private Integer access; + + private Long activityTime; + +} diff --git a/src/main/java/com/subsidy/vo/renshe/GetSecretChildVO.java b/src/main/java/com/subsidy/vo/renshe/GetSecretChildVO.java new file mode 100644 index 0000000..405ca3e --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/GetSecretChildVO.java @@ -0,0 +1,14 @@ +package com.subsidy.vo.renshe; + +import lombok.Data; + +@Data +public class GetSecretChildVO { + + private String privateKey; + + private String validTime; + + private String ip; + +} diff --git a/src/main/java/com/subsidy/vo/renshe/GetSecretVO.java b/src/main/java/com/subsidy/vo/renshe/GetSecretVO.java new file mode 100644 index 0000000..3967b06 --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/GetSecretVO.java @@ -0,0 +1,14 @@ +package com.subsidy.vo.renshe; + +import lombok.Data; + +@Data +public class GetSecretVO { + + private Integer c; + + private String msg; + + private GetSecretChildVO ctt; + +} diff --git a/src/main/java/com/subsidy/vo/renshe/LoginList9.java b/src/main/java/com/subsidy/vo/renshe/LoginList9.java new file mode 100644 index 0000000..30dad11 --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/LoginList9.java @@ -0,0 +1,39 @@ +package com.subsidy.vo.renshe; + +import lombok.Data; + +import java.util.List; + +@Data +public class LoginList9 { + + /** + * 章节(课程)学时列表 + */ + private List chapterList; + /** + * 下线时间,【13位时间戳】【精确到毫秒】 + */ + private long endTime; + /** + * 未通过详情 + */ + private String errorMessage; + /** + * 登录ip,会对IP进行校验 + */ + private String ip; + /** + * 上线时间,【13位时间戳】【精确到毫秒】 + */ + private long startTime; + /** + * 修改日期 + */ + private String updateDate; + /** + * 同步状态 + */ + private String updateStatus; + +} diff --git a/src/main/java/com/subsidy/vo/renshe/MemberVO.java b/src/main/java/com/subsidy/vo/renshe/MemberVO.java new file mode 100644 index 0000000..8753fef --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/MemberVO.java @@ -0,0 +1,15 @@ +package com.subsidy.vo.renshe; + +import lombok.Data; + +@Data +public class MemberVO { + + private String name; + + private String phone; + + private String identity; + + +} diff --git a/src/main/java/com/subsidy/vo/renshe/RensheResponseVO.java b/src/main/java/com/subsidy/vo/renshe/RensheResponseVO.java new file mode 100644 index 0000000..f1b2ce9 --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/RensheResponseVO.java @@ -0,0 +1,21 @@ +package com.subsidy.vo.renshe; + +import lombok.Data; + +@Data +public class RensheResponseVO { + + /** + * 响应码 + */ + private long c; + /** + * 响应体 + */ + private Object ctt; + /** + * 响应信息 + */ + private String msg; + +} diff --git a/src/main/java/com/subsidy/vo/renshe/RensheStringVO.java b/src/main/java/com/subsidy/vo/renshe/RensheStringVO.java new file mode 100644 index 0000000..2dc9eaa --- /dev/null +++ b/src/main/java/com/subsidy/vo/renshe/RensheStringVO.java @@ -0,0 +1,21 @@ +package com.subsidy.vo.renshe; + +import lombok.Data; + +@Data +public class RensheStringVO { + + /** + * 响应码 + */ + private long c; + /** + * 响应体 + */ + private Object ctt; + /** + * 响应信息 + */ + private String msg; + +} diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index c07a6e3..1dbb2bb 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -57,4 +57,4 @@ qxueyou.securityKey=626737T1-65K0-5xC2-0Y0V-2Aq95qxy qxueyou.url=https://dev.qxueyou.com/auth/user/token renshe.url = https://test.shzypxy.com -renshe.secretKey = 111 \ No newline at end of file +renshe.secretKey = ad927f0b-6a39-43a7-bac7-163baef1fff7 \ No newline at end of file diff --git a/src/main/resources/application-online.properties b/src/main/resources/application-online.properties index 441d9b9..5bca86a 100644 --- a/src/main/resources/application-online.properties +++ b/src/main/resources/application-online.properties @@ -54,4 +54,7 @@ spring.redis.lettuce.pool.min-idle=8 qxueyou.appId=qxywz5nnWMI77CM3Tx qxueyou.securityKey=626737T1-65K0-5xC2-0Y0V-2Aq95qxy -qxueyou.url=https://dev.qxueyou.com/auth/user/token \ No newline at end of file +qxueyou.url=https://dev.qxueyou.com/auth/user/token + +renshe.url = https://api.shzypxy.com +renshe.secretKey = 111 \ No newline at end of file diff --git a/src/main/resources/mapper/ClassDictMapper.xml b/src/main/resources/mapper/ClassDictMapper.xml index b18c881..4801738 100644 --- a/src/main/resources/mapper/ClassDictMapper.xml +++ b/src/main/resources/mapper/ClassDictMapper.xml @@ -250,4 +250,14 @@ order by t.create_date desc + + diff --git a/src/main/resources/mapper/CompanyDictMapper.xml b/src/main/resources/mapper/CompanyDictMapper.xml index 6844115..4c5107e 100644 --- a/src/main/resources/mapper/CompanyDictMapper.xml +++ b/src/main/resources/mapper/CompanyDictMapper.xml @@ -33,7 +33,8 @@ t2.logo, t2.address, t2.supervise_name, - t2.company_code + t2.company_code, + t2.area_name FROM administer t left join role_administer_mapping t4 on t.id = t4.administer_id diff --git a/src/main/resources/mapper/RenSheJuMapper.xml b/src/main/resources/mapper/RenSheJuMapper.xml new file mode 100644 index 0000000..7545a9c --- /dev/null +++ b/src/main/resources/mapper/RenSheJuMapper.xml @@ -0,0 +1,404 @@ + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, company_id, cert_id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/RenshejuHistoryMapper.xml b/src/main/resources/mapper/RenshejuHistoryMapper.xml new file mode 100644 index 0000000..1095cf9 --- /dev/null +++ b/src/main/resources/mapper/RenshejuHistoryMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + create_date, + update_date, + delete_date, + id, interface_name, input_param, output_param + + + diff --git a/src/main/resources/mapper/VodPlayHistoryMapper.xml b/src/main/resources/mapper/VodPlayHistoryMapper.xml index c16ee43..dba0765 100644 --- a/src/main/resources/mapper/VodPlayHistoryMapper.xml +++ b/src/main/resources/mapper/VodPlayHistoryMapper.xml @@ -399,6 +399,18 @@ t.create_date + + + + + + + + + + + +