Commit 1177d0df by 涂亚平

15天数据全部推送备份

1 parent 9f513ae2
Showing with 1532 additions and 314 deletions
......@@ -47,11 +47,11 @@ public class AdministerController {
@PostMapping("/login")
@ApiOperation("登录接口 accountName password")
public ResponseVO login(@RequestBody AdministerDO administerDO){
return ResponseData.generateCreatedResponse(0,administerService.login(administerDO));
public ResponseVO login(@RequestBody AdministerDO administerDO) {
return ResponseData.generateCreatedResponse(0, administerService.login(administerDO));
}
@PostMapping("/getPermissions")
@PostMapping("/getPermissions")
@ApiOperation("权限查询")
@LoginRequired
public ResponseVO getPermissions() {
......@@ -61,64 +61,64 @@ public class AdministerController {
@PostMapping("/administers")
@ApiOperation("查询所有运营者 { userName pageNum pageSize }")
// @LoginRequired
public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){
return ResponseData.generateCreatedResponse(0,administerService.operators(operatorsDTO));
public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO) {
return ResponseData.generateCreatedResponse(0, administerService.operators(operatorsDTO));
}
@PostMapping("addAdminister")
@ApiOperation("添加运营者 id userName 名称 accountName 账号 ")
@LoginRequired
public ResponseVO addAdminister(@RequestBody AdministerDO administerDO){
return ResponseData.generateCreatedResponse(0,administerService.addAdminister(administerDO));
public ResponseVO addAdminister(@RequestBody AdministerDO administerDO) {
return ResponseData.generateCreatedResponse(0, administerService.addAdminister(administerDO));
}
@PostMapping("deleteAdminister")
@ApiOperation("添加运营者 id ")
@LoginRequired
public ResponseVO deleteAdminister(@RequestBody AdministerDO administerDO){
return ResponseData.generateCreatedResponse(0,administerService.deleteAdminister(administerDO));
public ResponseVO deleteAdminister(@RequestBody AdministerDO administerDO) {
return ResponseData.generateCreatedResponse(0, administerService.deleteAdminister(administerDO));
}
@PostMapping("updateAdminister")
@ApiOperation("编辑运营者 id userName 名称 accountName 账号 password")
@LoginRequired
public ResponseVO updateAdminister(@RequestBody AdministerDO administerDO){
return ResponseData.generateCreatedResponse(0,administerService.updateAdminister(administerDO));
public ResponseVO updateAdminister(@RequestBody AdministerDO administerDO) {
return ResponseData.generateCreatedResponse(0, administerService.updateAdminister(administerDO));
}
@PostMapping("classSummary")
@ApiOperation("班级详情--数据概览 id 班级id ")
// @LoginRequired
public ResponseVO classSummary(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.classSummary(classDetailDTO));
public ResponseVO classSummary(@RequestBody ClassDetailDTO classDetailDTO) {
return ResponseData.generateCreatedResponse(0, administerService.classSummary(classDetailDTO));
}
@PostMapping("classDetail")
@ApiOperation("班级管理--班级成员 id 班级id userName pageSize pageNum")
@LoginRequired
public ResponseVO classDetail(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.classDetail(classDetailDTO));
public ResponseVO classDetail(@RequestBody ClassDetailDTO classDetailDTO) {
return ResponseData.generateCreatedResponse(0, administerService.classDetail(classDetailDTO));
}
@PostMapping("exportClassDetail")
@ApiOperation("班级管理--班级成员--导出 id 班级id userName")
@LoginRequired
public void exportClassDetail(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
public void exportClassDetail(@RequestBody ClassDetailDTO classDetailDTO) throws Exception {
classDetailDTO.setFlag(true);
administerService.exportClassDetail(classDetailDTO);
administerService.exportClassDetail(classDetailDTO);
}
@PostMapping("signDetail")
@ApiOperation("班级管理--注册签到 id 班级id userName pageSize pageNum")
@LoginRequired
public ResponseVO signDetail(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.signDetail(classDetailDTO));
public ResponseVO signDetail(@RequestBody ClassDetailDTO classDetailDTO) {
return ResponseData.generateCreatedResponse(0, administerService.signDetail(classDetailDTO));
}
@PostMapping("exportSignDetail")
@ApiOperation("班级管理--注册签到 id 班级id userName")
@LoginRequired
public void exportSignDetail(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
public void exportSignDetail(@RequestBody ClassDetailDTO classDetailDTO) throws Exception {
classDetailDTO.setFlag(true);
administerService.exportSignDetail(classDetailDTO);
}
......@@ -126,14 +126,14 @@ public class AdministerController {
@PostMapping("exerciseTest")
@ApiOperation("班级管理--测评成绩 id 班级id userName paperId pageSize pageNum")
@LoginRequired
public ResponseVO exerciseTest(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.exerciseTest(classDetailDTO));
public ResponseVO exerciseTest(@RequestBody ClassDetailDTO classDetailDTO) {
return ResponseData.generateCreatedResponse(0, administerService.exerciseTest(classDetailDTO));
}
@PostMapping("exportExerciseTest")
@ApiOperation("班级管理--测评成绩 id 班级id userName paperId")
@LoginRequired
public void exportExerciseTest(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
public void exportExerciseTest(@RequestBody ClassDetailDTO classDetailDTO) throws Exception {
classDetailDTO.setFlag(true);
administerService.exportExerciseTest(classDetailDTO);
}
......@@ -141,28 +141,28 @@ public class AdministerController {
@PostMapping("getMemberPapers")
@ApiOperation("获取某个成员某个卷子的做题历史 memberId paperId")
@LoginRequired
public ResponseVO getMemberPapers(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){
return ResponseData.generateCreatedResponse(0,administerService.getMemberPapers(exerciseDoneResultDO));
public ResponseVO getMemberPapers(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO) {
return ResponseData.generateCreatedResponse(0, administerService.getMemberPapers(exerciseDoneResultDO));
}
@PostMapping("getPaperDetail")
@ApiOperation("获取某个卷子做题详情 doneId getMemberPapers接口返回id memberId成员id")
@LoginRequired
public ResponseVO getPaperDetail(@RequestBody ExerciseDoneHistoryDO exerciseDoneHistoryDO){
return ResponseData.generateCreatedResponse(0,administerService.getPaperDetail(exerciseDoneHistoryDO));
public ResponseVO getPaperDetail(@RequestBody ExerciseDoneHistoryDO exerciseDoneHistoryDO) {
return ResponseData.generateCreatedResponse(0, administerService.getPaperDetail(exerciseDoneHistoryDO));
}
@PostMapping("answerRecord")
@ApiOperation("班级管理--答疑 id 班级id userName")
@LoginRequired
public ResponseVO answerRecord(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.answerRecord(classDetailDTO));
public ResponseVO answerRecord(@RequestBody ClassDetailDTO classDetailDTO) {
return ResponseData.generateCreatedResponse(0, administerService.answerRecord(classDetailDTO));
}
@PostMapping("exportAnswerRecord")
@ApiOperation("班级管理--答疑 id 班级id userName")
@LoginRequired
public void exportAnswerRecord(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
public void exportAnswerRecord(@RequestBody ClassDetailDTO classDetailDTO) throws Exception {
classDetailDTO.setFlag(true);
administerService.exportAnswerRecord(classDetailDTO);
}
......@@ -170,112 +170,112 @@ public class AdministerController {
@PostMapping("classVodInfo")
@ApiOperation("学习记录---课件进度提醒 {courseId 课程id classId 班级id vodName视频名称}")
@LoginRequired
public ResponseVO classVodInfo(@RequestBody ClassVodInfoDTO classVodInfoDTO){
return ResponseData.generateCreatedResponse(0,administerService.classVodInfo(classVodInfoDTO));
public ResponseVO classVodInfo(@RequestBody ClassVodInfoDTO classVodInfoDTO) {
return ResponseData.generateCreatedResponse(0, administerService.classVodInfo(classVodInfoDTO));
}
@PostMapping("classDailyInfo")
@ApiOperation("学习记录---每日学习时长 {courseId 课程id classId 班级id userName startDate endDate}")
@LoginRequired
public ResponseVO classDailyInfo(@RequestBody ClassDailyInfoDTO classDailyInfoDTO){
return ResponseData.generateCreatedResponse(0,administerService.classDailyInfo(classDailyInfoDTO));
public ResponseVO classDailyInfo(@RequestBody ClassDailyInfoDTO classDailyInfoDTO) {
return ResponseData.generateCreatedResponse(0, administerService.classDailyInfo(classDailyInfoDTO));
}
@PostMapping("exportClassDailyInfo")
@ApiParam("每日学习日志")
@LoginRequired
public void exportVodInfo(@RequestBody ClassDailyInfoDTO classDailyInfoDTO){
public void exportVodInfo(@RequestBody ClassDailyInfoDTO classDailyInfoDTO) {
administerService.exportClassDailyInfo(classDailyInfoDTO);
}
@PostMapping("classVodDailyInfo")
@ApiOperation("学习记录---每日学习时长(视频维度)")
@LoginRequired
public ResponseVO classVodDailyInfo(@RequestBody ClassVodDailyInfoDTO classVodDailyInfoDTO ){
return ResponseData.generateCreatedResponse(0,administerService.classVodDailyInfo(classVodDailyInfoDTO));
public ResponseVO classVodDailyInfo(@RequestBody ClassVodDailyInfoDTO classVodDailyInfoDTO) {
return ResponseData.generateCreatedResponse(0, administerService.classVodDailyInfo(classVodDailyInfoDTO));
}
@PostMapping("exportClassVodDailyInfo")
@ApiOperation("学习记录---每日学习时长(视频维度) pageSize pageNum userName classId")
@LoginRequired
public void exportClassVodDailyInfo(@RequestBody ClassVodDailyInfoDTO classVodDailyInfoDTO ){
public void exportClassVodDailyInfo(@RequestBody ClassVodDailyInfoDTO classVodDailyInfoDTO) {
administerService.exportClassVodDailyInfo(classVodDailyInfoDTO);
}
@PostMapping("memberStudy")
@ApiOperation("学员学习日志 pageSize pageNum classId memberId")
@LoginRequired
public ResponseVO memberStudy(@RequestBody MemberStudyLogDTO memberStudyLogDTO){
return ResponseData.generateCreatedResponse(0,administerService.memberStudy(memberStudyLogDTO));
public ResponseVO memberStudy(@RequestBody MemberStudyLogDTO memberStudyLogDTO) {
return ResponseData.generateCreatedResponse(0, administerService.memberStudy(memberStudyLogDTO));
}
@PostMapping("memberDetectionRecord")
@ApiOperation("获取某个班级活跃度检测记录 id userName pageSize pageNum ")
@LoginRequired
public ResponseVO memberDetectionRecord(@RequestBody ClassDetailDTO classDetailDTO ){
return ResponseData.generateCreatedResponse(0,administerService.memberDetectionRecord(classDetailDTO));
public ResponseVO memberDetectionRecord(@RequestBody ClassDetailDTO classDetailDTO) {
return ResponseData.generateCreatedResponse(0, administerService.memberDetectionRecord(classDetailDTO));
}
@PostMapping("exportMemberDetectionRecord")
@ApiOperation("获取某个班级活跃度检测记录 id userName ")
@LoginRequired
public void exportMemberDetectionRecord(@RequestBody ClassDetailDTO classDetailDTO ){
administerService.exportMemberDetectionRecord(classDetailDTO);
public void exportMemberDetectionRecord(@RequestBody ClassDetailDTO classDetailDTO) {
administerService.exportMemberDetectionRecord(classDetailDTO);
}
@PostMapping("imageCheckDetail")
@ApiOperation("实名制验证详情 id 班级id userName pageSize pageNum")
@LoginRequired
public ResponseVO imageCheckDetail(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.imageCheckDetail(classDetailDTO));
public ResponseVO imageCheckDetail(@RequestBody ClassDetailDTO classDetailDTO) {
return ResponseData.generateCreatedResponse(0, administerService.imageCheckDetail(classDetailDTO));
}
@PostMapping("getMemberCheckDetail")
@ApiOperation("查看某个学生的验证详情 memberId 学员id classId")
@LoginRequired
public ResponseVO getMemberCheckDetail(@RequestBody ImageCheckRecordDO imageCheckRecordDO){
return ResponseData.generateCreatedResponse(0,administerService.getMemberCheckDetail(imageCheckRecordDO));
public ResponseVO getMemberCheckDetail(@RequestBody ImageCheckRecordDO imageCheckRecordDO) {
return ResponseData.generateCreatedResponse(0, administerService.getMemberCheckDetail(imageCheckRecordDO));
}
@PostMapping("exportZip")
@ApiOperation("下载压缩包 id 班级id")
@CrossOrigin
// @LoginRequired
public void exportZip(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
public void exportZip(@RequestBody ClassDetailDTO classDetailDTO) throws Exception {
administerService.export(classDetailDTO);
}
@PostMapping("memberStudyLog")
@ApiOperation("学员学习日志 classId memberId")
@LoginRequired
public void memberStudyLog(@RequestBody MemberStudyLogDTO memberStudyLogDTO) throws Exception{
public void memberStudyLog(@RequestBody MemberStudyLogDTO memberStudyLogDTO) throws Exception {
administerService.memberStudyLog(memberStudyLogDTO);
}
@PostMapping("importMember")
@ApiOperation("导入学生 {companyId 公司id file}")
// @LoginRequired
public ResponseVO importMember(Long companyId,@RequestParam("file") MultipartFile file)throws Exception{
return ResponseData.generateCreatedResponse(0,administerService.importMember(companyId,file));
public ResponseVO importMember(Long companyId, @RequestParam("file") MultipartFile file) throws Exception {
return ResponseData.generateCreatedResponse(0, administerService.importMember(companyId, file));
}
@PostMapping("manageMember")
@ApiOperation("用户管理 {pageSize pageNum userName:名字 }")
@LoginRequired
public ResponseVO manageMember(@RequestBody ManageMemberDTO manageMemberDTO){
return ResponseData.generateCreatedResponse(0,administerService.manageMember(manageMemberDTO));
public ResponseVO manageMember(@RequestBody ManageMemberDTO manageMemberDTO) {
return ResponseData.generateCreatedResponse(0, administerService.manageMember(manageMemberDTO));
}
@PostMapping("exportManageMember")
@ApiOperation("导出认证信息 {pageSize pageNum userName:名字 } ")
@LoginRequired
public void exportManageMember(@RequestBody ManageMemberDTO manageMemberDTO){
public void exportManageMember(@RequestBody ManageMemberDTO manageMemberDTO) {
administerService.exportManageMember(manageMemberDTO);
}
@PostMapping("selfExport")
@ApiOperation("自助导出 id导出")
public void selfExport(@RequestBody ClassDictDO classDictDO){
public void selfExport(@RequestBody ClassDictDO classDictDO) {
administerService.selfExport(classDictDO);
}
......
......@@ -14,7 +14,7 @@ import java.io.IOException;
import java.util.List;
@RestController
@Api(tags = "人社局数据对接")
@Api(tags = "企业职工线上培训")
@RequestMapping("/rensheju")
public class RenSheJuController {
......
package com.subsidy.controller;
import com.subsidy.service.ShehuihuaService;
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("/social")
public class ShehuihuaController {
@Autowired
private ShehuihuaService shehuihuaService;
@PostMapping("getClassCodeByPrivateKey")
@ApiOperation("POST-2 获取培训待绑定的(班级编号,项目编号)列表")
public RensheResponseVO getClassCodeByPrivateKey()throws IOException {
return shehuihuaService.getClassCodeByPrivateKey();
}
@PostMapping("uploadClass")
@ApiOperation("POST-3:班级基本信息信息采集接口")
public RensheResponseVO uploadClass() throws IOException {
return shehuihuaService.uploadClass();
}
@PostMapping("classHourBehavior")
@ApiOperation("POST-4:学时信息采集接口")
public RensheResponseVO classHourBehavior() throws IOException {
return shehuihuaService.classHourBehavior();
}
@PostMapping("uploadChapterBehavior")
@ApiOperation("POST-5:考试信息采集接口")
public RensheResponseVO uploadChapterBehavior() throws IOException {
return shehuihuaService.uploadChapterBehavior();
}
@PostMapping("uploadClassAnswerQuestionBehavior")
@ApiOperation("POST-6:答疑辅导采集接口")
public RensheResponseVO uploadClassAnswerQuestionBehavior() throws IOException {
return shehuihuaService.uploadClassAnswerQuestionBehavior();
}
@PostMapping("uploadImage")
@ApiOperation("POST-7 班级活跃度/实名认证照片信息采集接口")
public List<RensheResponseVO> uploadImage()throws IOException {
return shehuihuaService.uploadImage();
}
@PostMapping("getErrorClass")
@ApiOperation("POST-8 获取推送失败班级列表")
public RensheResponseVO getErrorClass()throws IOException{
return shehuihuaService.getErrorClass();
}
@PostMapping("clear")
@ApiOperation("POST-9 清除推送失败班级缓存")
public RensheStringVO clear()throws IOException{
return shehuihuaService.clear();
}
}
......@@ -7,14 +7,20 @@ import java.util.List;
@Data
public class ClassHourBasic {
/**
* 活跃度列表,【数组】
*/
private List<ActivityList> activityList;
/**
* 临时班级(临时项目)编号
*/
private String downCode;
/**
* 学员姓名
*/
private String studentName;
/**
* 学员电话号,会对学生手机号长度、格式进行校验
*/
private String phone;
/**
* 学员身份证号,会对身份证号长度、格式进行校验、X用大写
*/
......@@ -23,25 +29,23 @@ public class ClassHourBasic {
* 当日累计学习时长,视频暂停时间不计入【秒】
*/
private long learnTime;
/**
* 上线时间列表,【数组】
*/
private List<LoginList> loginList;
/**
* 当日累计登陆时长,该字段数据应为当日产生LoginList列表内多条下线时间-上线时间累加和【秒】
*/
private long loginTime;
/**
* 学员电话号,会对学生手机号长度、格式进行校验
*/
private String phone;
/**
* 当日累计播放时长,视频暂停时间计入【秒】
*/
private Long playTime;
/**
* 学员姓名
* 上线时间列表,【数组】
*/
private String studentName;
private List<LoginList> loginList;
/**
* 活跃度列表,【数组】
*/
private List<ActivityList> activityList;
}
package com.subsidy.dto.renshe;
import com.subsidy.dto.shehuihua.ChapterExamBasic5;
import lombok.Data;
import java.util.List;
......
package com.subsidy.dto.renshe;
import com.subsidy.dto.shehuihua.AnswerBasic6;
import lombok.Data;
import java.util.List;
......
package com.subsidy.dto.shehuihua;
import com.subsidy.dto.renshe.AnswerAndQuestionList;
import lombok.Data;
import java.util.List;
@Data
public class AnswerBasic6 {
/**
* 答疑辅导,提问和回答都存在值时才进行传递
*/
private List<AnswerAndQuestionList> answerAndQuestionList;
private String classCode;
private String identity;
}
package com.subsidy.dto.shehuihua;
import com.subsidy.dto.renshe.ActivityList;
import com.subsidy.dto.renshe.ExamList;
import lombok.Data;
import java.util.List;
@Data
public class ChapterExamBasic5 {
/**
* 是否通过,0通过1未通过
*/
private long access;
/**
* 活跃度列表,【数组】
*/
private List<ActivityList> activityList;
/**
* 章节(课程)编码,11
*/
private String chapterCode;
/**
* 班级(项目)编号
*/
private String classCode;
/**
* 章节(课程)考试时间列表,【数组】
*/
private List<ExamList> examList;
/**
* 章节(课程)考试总时长,该字段数据应为当日产生examList列表内多条结束时间-开始时间累加和【秒】
*/
private long examTime;
/**
* 学员身份证号,会对身份证号长度、格式进行校验、X用大写
*/
private String identity;
/**
* 学员手机号,会对手机号长度、格式进行校验
*/
private String phone;
/**
* 学员姓名
*/
private String studentName;
}
package com.subsidy.dto.shehuihua;
import lombok.Data;
@Data
public class ChapterList22 {
private String chapterCode;
private String chapterName;
}
package com.subsidy.dto.shehuihua;
import com.subsidy.dto.renshe.ActivityList;
import com.subsidy.dto.renshe.LoginList;
import lombok.Data;
import java.util.List;
@Data
public class ClassHourBasic4DTO {
/**
* 临时班级(临时项目)编号
*/
private String classCode;
/**
* 学员姓名
*/
private String studentName;
/**
* 学员电话号,会对学生手机号长度、格式进行校验
*/
private String phone;
/**
* 学员身份证号,会对身份证号长度、格式进行校验、X用大写
*/
private String identity;
/**
* 当日累计学习时长,视频暂停时间不计入【秒】
*/
private long learnTime;
/**
* 当日累计登陆时长,该字段数据应为当日产生LoginList列表内多条下线时间-上线时间累加和【秒】
*/
private long loginTime;
/**
* 当日累计播放时长,视频暂停时间计入【秒】
*/
private Long playTime;
/**
* 上线时间列表,【数组】
*/
private List<LoginList> loginList;
/**
* 活跃度列表,【数组】
*/
private List<ActivityList> activityList;
}
package com.subsidy.dto.shehuihua;
import com.subsidy.dto.renshe.ClassHourBasic;
import lombok.Data;
import java.util.List;
@Data
public class ClassHourBehavior4DTO {
/**
* 班级(项目)学时列表,【数组】班级(项目)学时列表
*/
private List<ClassHourBasic4DTO> classHourBasic;
/**
* 私钥
*/
private String privateKey;
}
package com.subsidy.dto.shehuihua;
import com.subsidy.dto.renshe.ChapterList2;
import com.subsidy.vo.renshe.MemberVO;
import lombok.Data;
import java.util.List;
@Data
public class ClassInfoBasicDTO {
private String classCode;
private String shortName;
private Long learnHour;
private List<ChapterList22> chapterList;
private List<MemberVO> studentList;
}
package com.subsidy.dto.shehuihua;
import com.subsidy.dto.renshe.ChapterExamBasic;
import lombok.Data;
import java.util.List;
@Data
public class UploadChapterBehavior5DTO {
/**
* 章节(课程)考试列表,【数组】
*/
private List<ChapterExamBasic5> chapterExamBasic;
/**
* 私钥
*/
private String privateKey;
}
package com.subsidy.dto.shehuihua;
import lombok.Data;
import java.util.List;
@Data
public class UploadClassAnswerQuestionBehavior6DTO {
private List<AnswerBasic6> answerBasic;
private String privateKey;
}
package com.subsidy.dto.shehuihua;
import lombok.Data;
import java.util.List;
@Data
public class UploadClassDTO {
private String privateKey;
private List<ClassInfoBasicDTO> classInfoBasic;
}
package com.subsidy.dto.shehuihua;
import com.subsidy.dto.renshe.ImageDetailList;
import lombok.Data;
import java.util.List;
@Data
public class UploadImageDTO7 {
/**
* 临时班级(项目)编码
*/
private String classCode;
/**
* 活跃度照片列表,【数组】
*/
private List<ImageDetailList> imageDetailList;
/**
* 私钥
*/
private String privateKey;
}
//package com.subsidy.jobs;
//
//import com.alibaba.fastjson.JSONObject;
//import com.subsidy.common.ResponseData;
//import com.subsidy.mapper.OprMemDictMapper;
//import com.subsidy.model.OprMemDictDO;
//import com.subsidy.service.RenSheJuService;
//import com.subsidy.service.RenshejuHistoryService;
//import com.subsidy.service.impl.RenshejuHistoryServiceImpl;
//import com.subsidy.util.websocket.WebSocketUtil;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//import org.springframework.web.socket.TextMessage;
//import org.springframework.web.socket.WebSocketSession;
//
//import java.io.IOException;
//import java.util.List;
//import java.util.concurrent.ConcurrentHashMap;
//
///**
// * 人社局数据对接
// */
//@Component
//public class RenSheJuJob {
//
//
// @Autowired
// private RenSheJuService renSheJuService;
//
// @Autowired
// private OprMemDictMapper oprMemDictMapper;
//
package com.subsidy.jobs;
import com.alibaba.fastjson.JSONObject;
import com.subsidy.common.ResponseData;
import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.model.OprMemDictDO;
import com.subsidy.service.RenSheJuService;
import com.subsidy.util.websocket.WebSocketUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
/**
* 企业职工线上培训
*/
@Component
public class RenSheJuJob {
@Autowired
private RenSheJuService renSheJuService;
@Autowired
private OprMemDictMapper oprMemDictMapper;
/**
* 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-2:班级基本信息信息采集接口
// * POST-9 获取推送失败班级列表
// */
// @Scheduled(cron = "0 0 1 * * ?")
// public void classBaseInfo()throws IOException {
// renSheJuService.classBaseInfo();
// @Scheduled(cron = "0 35 1 * * ?")
// public void getErrorClass()throws IOException{
// renSheJuService.getErrorClass();
// }
//
// /**
// * 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();
//// }
//
// @Scheduled(cron = "00 58 23 * * ?")
// public void cancelLogin(){
// ConcurrentHashMap<Long, WebSocketSession> webSocketMap = WebSocketUtil.webSocketMap;
//
// List<Long> onLineUsers = oprMemDictMapper.onlineUsers();
//
// for (Long key : onLineUsers){
// try {
// if (null != webSocketMap.get(key)){
// webSocketMap.get(key).sendMessage(new TextMessage(JSONObject.toJSONString(ResponseData.generateCreatedResponse(17001))));
// }
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setResult(1);
// oprMemDictDO.setOprType("登出");
// oprMemDictDO.setUserId(key);
// oprMemDictMapper.insert(oprMemDictDO);
// }catch (Exception e){
// e.printStackTrace();
// }
// }
// }
//
//}
@Scheduled(cron = "00 58 23 * * ?")
public void cancelLogin(){
ConcurrentHashMap<Long, WebSocketSession> webSocketMap = WebSocketUtil.webSocketMap;
List<Long> onLineUsers = oprMemDictMapper.onlineUsers();
for (Long key : onLineUsers){
try {
if (null != webSocketMap.get(key)){
webSocketMap.get(key).sendMessage(new TextMessage(JSONObject.toJSONString(ResponseData.generateCreatedResponse(17001))));
}
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setResult(1);
oprMemDictDO.setOprType("登出");
oprMemDictDO.setUserId(key);
oprMemDictMapper.insert(oprMemDictDO);
}catch (Exception e){
e.printStackTrace();
}
}
}
}
package com.subsidy.jobs;
import com.subsidy.service.ShehuihuaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.io.IOException;
/**`
* 社会化、学徒制数据推送
*/
@Component
public class ShehuihuaJob {
@Autowired
private ShehuihuaService shehuihuaService;
/**
* POST-2 获取培训待绑定的(班级编号,项目编号)列表
*/
@Scheduled(cron = "0 0 2 * * ?")
public void getClassCodeByPrivateKey()throws IOException {
shehuihuaService.getClassCodeByPrivateKey();
}
/**
* POST-3:班级基本信息信息采集接口
*/
@Scheduled(cron = "0 5 2 * * ?")
public void uploadClass() throws IOException {
shehuihuaService.uploadClass();
}
/**
* POST-4:考试信息采集接口
*/
@Scheduled(cron = "0 10 2 * * ?")
public void classHourBehavior() throws IOException {
shehuihuaService.classHourBehavior();
}
/**
* POST-5:答疑辅导采集接口
*/
@Scheduled(cron = "0 15 2 * * ?")
public void uploadChapterBehavior() throws IOException {
shehuihuaService.uploadChapterBehavior();
}
/**
* POST-6 班级活跃度/实名认证照片信息采集接口
*/
@Scheduled(cron = "0 20 2 * * ?")
public void uploadClassAnswerQuestionBehavior()throws IOException {
shehuihuaService.uploadClassAnswerQuestionBehavior();
}
/**
* POST-7 获取培训待绑定的(班级编号,项目编号)列表
*/
@Scheduled(cron = "0 25 2 * * ?")
public void uploadImage()throws IOException {
shehuihuaService.uploadImage();
}
}
......@@ -32,12 +32,12 @@ public interface RenSheJuMapper {
/**
* 新增班级
*/
List<Long> newClasses();
List<Long> newClasses(String classType);
/**
* 前一天新增视频学习数据
*/
List<DailyStudyInfoVO> dailyStudyInfo();
List<DailyStudyInfoVO> dailyStudyInfo(String classType);
/**
* 前一天活跃度检测列表
......@@ -105,7 +105,7 @@ public interface RenSheJuMapper {
/**
* 查找前一天做过人脸识别的班级
*/
List<Long> checkClassIds();
List<Long> checkClassIds(String classType);
/**
* 查看某个班级的成员做过的人脸识别记录 弃用
......
......@@ -123,4 +123,14 @@ public class ClassDictDO extends BaseModel {
*/
private Integer playSnap;
/**
* 班级所属职业类型
*/
private String profession;
/**
* 班级所属职业等级
*/
private String professionRank;
}
package com.subsidy.service;
import com.subsidy.vo.renshe.RensheResponseVO;
import com.subsidy.vo.renshe.RensheStringVO;
import java.io.IOException;
import java.util.List;
public interface ShehuihuaService {
RensheResponseVO getClassCodeByPrivateKey()throws IOException;
RensheResponseVO uploadClass() throws IOException;
RensheResponseVO classHourBehavior() throws IOException;
RensheResponseVO uploadChapterBehavior() throws IOException;
RensheResponseVO uploadClassAnswerQuestionBehavior()throws IOException;
List<RensheResponseVO> uploadImage()throws IOException;
RensheResponseVO getErrorClass()throws IOException;
RensheStringVO clear()throws IOException;
void test();
}
......@@ -59,7 +59,11 @@ public class RenSheJuServiceImpl implements RenSheJuService {
List<EpidemicSituationClassBasic> epidemicSituationClassBasics = new ArrayList<>();
//查找前一天产生数据的班级
List<Long> classIds = renSheJuMapper.newClasses();
// List<Long> classIds = renSheJuMapper.newClasses("0");
List<Long> classIds = new ArrayList<>();
classIds.add(404L);
try {
if (classIds.size() > 0) {
for (Long classId : classIds) {
......@@ -105,6 +109,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO;
// return null;
} else {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_2);
......@@ -115,6 +120,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
}
} catch (Exception e) {
e.printStackTrace();
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_2);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classBaseInfoDTO).toString());
......@@ -137,7 +143,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
List<ClassHourBasic> classHourBasics = new ArrayList<>();
try {
//前一天新增视频学习数据的班级
List<DailyStudyInfoVO> dailyStudyInfoVOS = renSheJuMapper.dailyStudyInfo();
List<DailyStudyInfoVO> dailyStudyInfoVOS = renSheJuMapper.dailyStudyInfo("0");
for (DailyStudyInfoVO dailyStudyInfoVO : dailyStudyInfoVOS) {
ClassHourBasic classHourBasic = new ClassHourBasic();
BeanUtils.copyProperties(dailyStudyInfoVO, classHourBasic);
......@@ -196,27 +202,28 @@ public class RenSheJuServiceImpl implements RenSheJuService {
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);
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;
return null;
} catch (Exception e) {
e.printStackTrace();
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
......@@ -241,10 +248,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
List<ChapterExamBasic> chapterExamBasics = new ArrayList<>();
//找出前一天产生考试数据的班级
// List<Long> classIds = renSheJuMapper.dailyExamBasic();
List<Long> classIds = new ArrayList<>();
classIds.add(404L);
List<Long> classIds = renSheJuMapper.dailyExamBasic();
try {
if (classIds.size() > 0) {
......@@ -290,7 +294,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
chapterExamBasic.setActivityList(activityLists);
List<ExamList> examLists = new ArrayList<ExamList>();
List<ExamList> examLists = new ArrayList<>();
//上线时间
List<OprMemDictDO> loginRecords = renSheJuMapper.loginRecords(memberDO.getId());
//下线时间
......@@ -326,29 +330,29 @@ public class RenSheJuServiceImpl implements RenSheJuService {
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 (200 == response.code()) {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_4);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadChapterBehaviorDTO).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(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 (200 == response.code()) {
// RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
// renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_4);
// renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadChapterBehaviorDTO).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_4);
......@@ -416,27 +420,28 @@ public class RenSheJuServiceImpl implements RenSheJuService {
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);
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_5);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadClassAnswerQuestionBehaviorDTO).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(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);
// RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
// renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_5);
// renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadClassAnswerQuestionBehaviorDTO).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_5);
......@@ -465,10 +470,8 @@ public class RenSheJuServiceImpl implements RenSheJuService {
//找到昨天做过人脸识别的班级
// List<Long> classIds = renSheJuMapper.checkClassIds();
List<Long> classIds = renSheJuMapper.checkClassIds("0");
List<Long> classIds = new ArrayList<>();
classIds.add(404L);
for (Long classId : classIds) {
UploadImageDTO uploadImage = new UploadImageDTO();
......@@ -506,43 +509,43 @@ public class RenSheJuServiceImpl implements RenSheJuService {
}
// /**
// * 考试检测数据
// */
// List<ClassImageChecksVO> examChecks = renSheJuMapper.examCheck(classId);
//
// if (examChecks.size() > 0) {
// for (ClassImageChecksVO cicon : examChecks) {
//
// ImageDetailList imageDetailList = new ImageDetailList();
// BeanUtils.copyProperties(cicon, imageDetailList);
// imageDetailList.setImageBase64("data:image/jpeg;base64," + OSSUtils.image2Base64(cicon.getImage()));
// imageDetailList.setProcessType(2L);
// imageDetailList.setDetectionType(1L);
// imageDetailLists.add(imageDetailList);
// }
// }
/**
* 考试检测数据
*/
List<ClassImageChecksVO> examChecks = renSheJuMapper.examCheck(classId);
if (examChecks.size() > 0) {
for (ClassImageChecksVO cicon : examChecks) {
ImageDetailList imageDetailList = new ImageDetailList();
BeanUtils.copyProperties(cicon, imageDetailList);
imageDetailList.setImageBase64("data:image/jpeg;base64," + OSSUtils.image2Base64(cicon.getImage()));
imageDetailList.setProcessType(2L);
imageDetailList.setDetectionType(1L);
imageDetailLists.add(imageDetailList);
}
}
uploadImage.setImageDetailList(imageDetailLists);
if (imageDetailLists.size() > 0) {
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);
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_6);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadImage).toString());
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
renshejuHistoryMapper.insert(renshejuHistoryDO);
rensheResponseVOS.add(rensheResponseVO);
// 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);
//
// RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
// renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_6);
// renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadImage).toString());
// renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
// renshejuHistoryMapper.insert(renshejuHistoryDO);
// rensheResponseVOS.add(rensheResponseVO);
System.out.println(111);
} else {
RenshejuHistoryDO renshejuHistoryDO1 = new RenshejuHistoryDO();
......@@ -615,7 +618,9 @@ public class RenSheJuServiceImpl implements RenSheJuService {
uploadClassCodeDTO.setPrivateKey(getSecret());
//所有班级
List<Long> classIds = renSheJuMapper.newClasses();
// List<Long> classIds = renSheJuMapper.newClasses("0");
List<Long> classIds = new ArrayList<Long>();
classIds.add(404L);
List<ClassCodeBasic> classCodeBasics = new ArrayList<ClassCodeBasic>();
for (Long classId : classIds) {
......@@ -650,6 +655,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO;
// return null;
} catch (Exception e) {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_8);
......
package com.subsidy.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.common.configure.RenSheConfig;
import com.subsidy.dto.renshe.*;
import com.subsidy.dto.shehuihua.*;
import com.subsidy.mapper.ClassDictMapper;
import com.subsidy.mapper.ImageCheckRecordMapper;
import com.subsidy.mapper.RenSheJuMapper;
import com.subsidy.mapper.RenshejuHistoryMapper;
import com.subsidy.model.*;
import com.subsidy.service.ShehuihuaService;
import com.subsidy.util.OSSUtils;
import com.subsidy.util.RenSheJuConstant;
import com.subsidy.util.ShehuihuaConstant;
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 ShehuihuaServiceImpl implements ShehuihuaService {
@Autowired
private RenSheJuMapper renSheJuMapper;
@Autowired
private RenSheConfig renSheConfig;
@Autowired
private ClassDictMapper classDictMapper;
@Autowired
RenshejuHistoryMapper renshejuHistoryMapper;
@Autowired
private ImageCheckRecordMapper imageCheckRecordMapper;
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/social/getClassCodeByPrivateKey")
.method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.build();
try {
Response response = client.newCall(request).execute();
RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class);
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(ShehuihuaConstant.POST_2);
renshejuHistoryDO.setInputParam(getSecret());
if (200 == response.code()) {
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
} else {
renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR);
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO;
} catch (Exception e) {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(ShehuihuaConstant.POST_2);
renshejuHistoryDO.setInputParam(getSecret());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return null;
}
public RensheResponseVO uploadClass() throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
//拼数据
UploadClassDTO classBaseInfoDTO = new UploadClassDTO();
classBaseInfoDTO.setPrivateKey(getSecret());
List<ClassInfoBasicDTO> classInfoBasicDTOS = new ArrayList<>();
//查找前一天产生数据的班级
List<Long> classIds = renSheJuMapper.newClasses("1");
try {
if (classIds.size() > 0) {
for (Long classId : classIds) {
ClassInfoBasicDTO classInfoBasicDTO = new ClassInfoBasicDTO();
//班级基本信息
ClassBaseInfoVO classBaseInfoVO = renSheJuMapper.classBaseInfo(classId);
BeanUtils.copyProperties(classBaseInfoVO, classInfoBasicDTO);
classInfoBasicDTO.setClassCode(classBaseInfoVO.getDownCode());
//章节
List<ChapterList2> chapterLists = renSheJuMapper.classChapters(classId);
List<ChapterList22> chapterList22s = new ArrayList<>();
for (ChapterList2 chapterList2 : chapterLists){
ChapterList22 chapterList22 = new ChapterList22();
chapterList22.setChapterName(chapterList2.getChapterName());
chapterList22.setChapterCode(chapterList2.getChapterCode());
chapterList22s.add(chapterList22);
}
classInfoBasicDTO.setChapterList(chapterList22s);
//学员列表
List<MemberVO> memberVOS = renSheJuMapper.classMembers(classId);
classInfoBasicDTO.setStudentList(memberVOS);
classInfoBasicDTOS.add(classInfoBasicDTO);
}
classBaseInfoDTO.setClassInfoBasic(classInfoBasicDTOS);
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/social/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(ShehuihuaConstant.POST_3);
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(ShehuihuaConstant.POST_3);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classBaseInfoDTO).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.NO_DATA);
renshejuHistoryMapper.insert(renshejuHistoryDO);
return null;
}
} catch (Exception e) {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(ShehuihuaConstant.POST_3);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classBaseInfoDTO).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return null;
}
public RensheResponseVO classHourBehavior() throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
ClassHourBehavior4DTO classHourBehaviorDTO = new ClassHourBehavior4DTO();
classHourBehaviorDTO.setPrivateKey(getSecret());
List<ClassHourBasic4DTO> classHourBasics = new ArrayList<>();
try {
//前一天新增视频学习数据的班级
List<DailyStudyInfoVO> dailyStudyInfoVOS = renSheJuMapper.dailyStudyInfo("1");
for (DailyStudyInfoVO dailyStudyInfoVO : dailyStudyInfoVOS) {
ClassHourBasic4DTO classHourBasic = new ClassHourBasic4DTO();
BeanUtils.copyProperties(dailyStudyInfoVO, classHourBasic);
classHourBasic.setClassCode(dailyStudyInfoVO.getDownCode());
//上线时间列表
//找到当天每次上线下线时间
//上线时间
List<OprMemDictDO> loginRecords = renSheJuMapper.loginRecords(dailyStudyInfoVO.getMemberId());
//下线时间
List<OprMemDictDO> loginOutRecords = renSheJuMapper.loginOutRecords(dailyStudyInfoVO.getMemberId());
List<LoginList> loginLists = new ArrayList<>();
for (int i = 0; i < loginRecords.size(); i++) {
LoginList loginList = new LoginList();
loginList.setIp(loginRecords.get(i).getIpAddress());
loginList.setStartTime(Timestamp.valueOf(loginRecords.get(i).getCreateDate()).getTime());
loginList.setEndTime(Timestamp.valueOf(loginOutRecords.get(i).getCreateDate()).getTime());
//查看这个人该时间段的学习记录
List<ChapterList3> chapterList3s = renSheJuMapper.dailyStudyRecords(dailyStudyInfoVO.getMemberId(), dailyStudyInfoVO.getDownCode(), loginRecords.get(0).getCreateDate().toString().replace("T", " "), loginOutRecords.get(i).getCreateDate().toString().replace("T", " "));
if (chapterList3s.size() > 0) {
loginList.setChapterList(chapterList3s);
loginLists.add(loginList);
}
}
classHourBasic.setLoginList(loginLists);
//活跃度列表
List<ActivityList> activityLists = new ArrayList<>();
List<DailyActivitiesVO> activityDetectionDOS = renSheJuMapper.dailyActivities(dailyStudyInfoVO.getDownCode(), dailyStudyInfoVO.getMemberId());
for (DailyActivitiesVO dailyActivitiesVO : activityDetectionDOS) {
ActivityList activityList = new ActivityList();
if (dailyActivitiesVO.getAccess() == 1) {
activityList.setAccess(0);
} else {
activityList.setAccess(1);
activityList.setErrorInfo(2);
}
if (0 == dailyActivitiesVO.getCheckType()) {
activityList.setActivityDetection(2);
} else if (1 == dailyActivitiesVO.getCheckType()) {
activityList.setActivityDetection(1);
}
activityList.setActivityTime(dailyActivitiesVO.getActivityTime());
activityLists.add(activityList);
}
classHourBasic.setActivityList(activityLists);
classHourBasics.add(classHourBasic);
}
classHourBehaviorDTO.setClassHourBasic(classHourBasics);
System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(classHourBehaviorDTO));
RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classHourBehaviorDTO).toString());
Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/social/uploadClassHourBehavior")
.method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class);
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(ShehuihuaConstant.POST_4);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classHourBehaviorDTO).toString());
if (200 == response.code()) {
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
} else {
renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR);
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO;
// return null;
} catch (Exception e) {
e.printStackTrace();
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(ShehuihuaConstant.POST_4);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classHourBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return null;
}
public RensheResponseVO uploadChapterBehavior() throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
UploadChapterBehavior5DTO uploadChapterBehaviorDTO = new UploadChapterBehavior5DTO();
uploadChapterBehaviorDTO.setPrivateKey(getSecret());
List<ChapterExamBasic5> chapterExamBasics = new ArrayList<>();
//找出前一天产生考试数据的班级
List<Long> classIds = renSheJuMapper.dailyExamBasic();
try {
if (classIds.size() > 0) {
for (Long classId : classIds) {
//具体哪些人做了
List<MemberDO> memberDOList = renSheJuMapper.memberIds(classId);
for (MemberDO memberDO : memberDOList) {
//章节课程考试时间列表
ChapterExamBasic5 chapterExamBasic = new ChapterExamBasic5();
chapterExamBasic.setClassCode(String.valueOf(classId));
//最后一节课作为chapterCode
String vodId = renSheJuMapper.classVodName(classId);
chapterExamBasic.setChapterCode(vodId);
chapterExamBasic.setStudentName(memberDO.getUserName());
chapterExamBasic.setPhone(memberDO.getTelephone());
chapterExamBasic.setIdentity(memberDO.getIdCard());
//考试花了多长时间
Long examLength = renSheJuMapper.examLength(memberDO.getId(), classId);
chapterExamBasic.setExamTime(examLength);
//考试活跃度列表
List<ActivityList> activityLists = new ArrayList<>();
List<ExamActivitiesVO> activityDetectionDOS = renSheJuMapper.examActivities(classId, memberDO.getId());
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<ExamList> examLists = new ArrayList<>();
//上线时间
List<OprMemDictDO> loginRecords = renSheJuMapper.loginRecords(memberDO.getId());
//下线时间
List<OprMemDictDO> loginOutRecords = renSheJuMapper.loginOutRecords(memberDO.getId());
boolean flag = false;
for (int i = 0; i < loginRecords.size(); i++) {
//找到该时间段内的测评
List<ExerciseDoneResultDO> exerciseDoneResultDOS = renSheJuMapper.dailyExerciseDone(memberDO.getId(), loginRecords.get(i).getCreateDate().toString().replace("T", " "), loginOutRecords.get(i).getCreateDate().toString().replace("T", " "), classId);
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());
if ("合格".equals(exerciseDoneResultDO.getResult())) {
flag = true;
}
examLists.add(examList);
}
}
if (flag == true) {
chapterExamBasic.setAccess(0L);
} else {
chapterExamBasic.setAccess(1L);
}
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/social/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 (200 == response.code()) {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(ShehuihuaConstant.POST_5);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadChapterBehaviorDTO).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(ShehuihuaConstant.POST_5);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadChapterBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.NO_DATA);
renshejuHistoryMapper.insert(renshejuHistoryDO);
return null;
}
} catch (Exception e) {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(ShehuihuaConstant.POST_5);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadChapterBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return null;
}
public RensheResponseVO uploadClassAnswerQuestionBehavior() throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
UploadClassAnswerQuestionBehavior6DTO uploadClassAnswerQuestionBehaviorDTO = new UploadClassAnswerQuestionBehavior6DTO();
//秘钥
uploadClassAnswerQuestionBehaviorDTO.setPrivateKey(getSecret());
List<DailyAnswerVO> dailyAnswerVOS = renSheJuMapper.dailyAnswer();
try {
if (dailyAnswerVOS.size() > 0) {
HashMap<String, List<AnswerAndQuestionList>> hashMap = new HashMap<>();
for (DailyAnswerVO dailyAnswerVO : dailyAnswerVOS) {
if (!hashMap.containsKey(dailyAnswerVO.getDownCode() + ":" + dailyAnswerVO.getIdentity())) {
List<AnswerAndQuestionList> 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<AnswerAndQuestionList> 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<AnswerBasic6> answerBasics = new ArrayList<>();
for (String key : hashMap.keySet()) {
AnswerBasic6 answerBasic = new AnswerBasic6();
String downCode = key.split(":")[0];
String identity = key.split(":")[1];
answerBasic.setClassCode(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/social/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);
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(ShehuihuaConstant.POST_6);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadClassAnswerQuestionBehaviorDTO).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(ShehuihuaConstant.POST_6);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadClassAnswerQuestionBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.NO_DATA);
renshejuHistoryMapper.insert(renshejuHistoryDO);
return null;
}
} catch (Exception e) {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(ShehuihuaConstant.POST_6);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadClassAnswerQuestionBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return null;
}
public List<RensheResponseVO> uploadImage() throws IOException {
List<RensheResponseVO> rensheResponseVOS = new ArrayList<>();
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
//找到昨天做过人脸识别的班级
List<Long> classIds = renSheJuMapper.checkClassIds("1");
for (Long classId : classIds) {
UploadImageDTO7 uploadImage = new UploadImageDTO7();
uploadImage.setPrivateKey(getSecret());
uploadImage.setClassCode(String.valueOf(classId));
List<ImageDetailList> imageDetailLists = new ArrayList<ImageDetailList>();
try {
/**
* 第二次人脸识别
*/
List<ClassImageChecksVO> classImageChecksVOS2 = renSheJuMapper.studyCheck(classId);
if (classImageChecksVOS2.size() > 0) {
for (ClassImageChecksVO cicon : classImageChecksVOS2) {
int count = imageCheckRecordMapper.selectCount(new QueryWrapper<ImageCheckRecordDO>()
.lambda()
.eq(ImageCheckRecordDO::getResult, 1)
.isNull(ImageCheckRecordDO::getPaperId)
.eq(ImageCheckRecordDO::getMemberId, cicon.getMemberId())
.eq(ImageCheckRecordDO::getClassId, cicon.getClassId()));
ImageDetailList imageDetailList = new ImageDetailList();
BeanUtils.copyProperties(cicon, imageDetailList);
imageDetailList.setImageBase64("data:image/jpeg;base64," + OSSUtils.image2Base64(cicon.getImage()));
if (count == 1) {
imageDetailList.setProcessType(0L);
imageDetailList.setDetectionType(0L);
} else if (count == 2) {
imageDetailList.setProcessType(1L);
imageDetailList.setDetectionType(1L);
}
imageDetailLists.add(imageDetailList);
}
}
/**
* 考试检测数据
*/
List<ClassImageChecksVO> examChecks = renSheJuMapper.examCheck(classId);
if (examChecks.size() > 0) {
for (ClassImageChecksVO cicon : examChecks) {
ImageDetailList imageDetailList = new ImageDetailList();
BeanUtils.copyProperties(cicon, imageDetailList);
imageDetailList.setImageBase64("data:image/jpeg;base64," + OSSUtils.image2Base64(cicon.getImage()));
imageDetailList.setProcessType(2L);
imageDetailList.setDetectionType(1L);
imageDetailLists.add(imageDetailList);
}
}
uploadImage.setImageDetailList(imageDetailLists);
if (imageDetailLists.size() > 0) {
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/social/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);
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(ShehuihuaConstant.POST_7);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadImage).toString());
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
renshejuHistoryMapper.insert(renshejuHistoryDO);
rensheResponseVOS.add(rensheResponseVO);
System.out.println(111);
} else {
RenshejuHistoryDO renshejuHistoryDO1 = new RenshejuHistoryDO();
renshejuHistoryDO1.setInterfaceName(ShehuihuaConstant.POST_7);
renshejuHistoryDO1.setInputParam(JSONObject.fromObject(uploadImage).toString());
renshejuHistoryDO1.setOutputParam(RenSheJuConstant.NO_DATA);
renshejuHistoryMapper.insert(renshejuHistoryDO1);
}
} catch (Exception e) {
e.printStackTrace();
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(ShehuihuaConstant.POST_7);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadImage).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
}
return rensheResponseVOS;
}
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/social/getErrorClass")
.method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.build();
try {
Response response = client.newCall(request).execute();
RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class);
System.out.println(rensheResponseVO);
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(ShehuihuaConstant.POST_8);
renshejuHistoryDO.setInputParam(getSecret());
if (200 == response.code()) {
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
} else {
renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR);
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO;
} catch (Exception e) {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(ShehuihuaConstant.POST_8);
renshejuHistoryDO.setInputParam(getSecret());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return null;
}
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/social/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);
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");
}
}
package com.subsidy.util;
public class ShehuihuaConstant {
/**
* 获取培训正在进行中的(班级编号,项目编号)列表
*/
public static final String POST_2 = "Shehuihua_2_getClassCodeByPrivateKey";
/**
* POST-3:班级基本信息信息采集接口
*/
public static final String POST_3 = "Shehuihua_3_uploadClass";
/**
* POST-4:学时信息采集接口
*/
public static final String POST_4 = "Shehuihua_4_classHourBehavior";
/**
* POST-5:考试信息采集接口
*/
public static final String POST_5 = "Shehuihua_5_uploadChapterBehavior";
/**
* POST-6:答疑辅导采集接口
*/
public static final String POST_6 = "Shehuihua_6_uploadClassAnswerQuestionBehavior";
/**
* POST-7 班级活跃度/实名认证照片信息采集接口
*/
public static final String POST_7 = "Shehuihua_7_import/downstream/social/uploadImage";
/**
* POST-8 获取推送失败班级列表
*/
public static final String POST_8 = "Shehuihua_8_getErrorClass";
/**
* POST-9 清除推送失败班级缓存
*/
public static final String POST_9 = "Shehuihua_9_clear";
/**
* 调取失败
*/
public static final String API_ERROR = "调取失败";
/**
* 当天没数据
*/
public static final String NO_DATA = "NO_DATA";
/**
* 推送失败
*/
public static final String PUSH_FAIL = "推送失败";
/**
* 推送成功
*/
public static final String PUSH_SUCCESS = "推送成功";
}
......@@ -89,7 +89,7 @@
t7.order_no
</select>
<select id="newClasses" resultType="long">
<select id="newClasses" parameterType="string" resultType="long">
SELECT DISTINCT
t1.id
FROM
......@@ -98,6 +98,9 @@
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
and t1.class_code is not NULL
<if test="classType != null and classType != ''">
and t1.class_type = #{classType}
</if>
</select>
<select id="dailyStudyInfo" resultType="com.subsidy.vo.renshe.DailyStudyInfoVO">
......@@ -120,7 +123,7 @@
FROM
vod_play_history t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 7 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
GROUP BY
t1.class_id,
......@@ -162,6 +165,9 @@
GROUP BY user_id
) t2 ON t3.user_id = t2.user_id
) t5 ON t4.id = t5.user_id
<if test="classType != null and classType != ''">
where t3.class_type = #{classType}
</if>
</select>
......@@ -173,7 +179,7 @@
FROM
activity_detection t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 7 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
AND t1.member_id = #{memberId}
AND t1.class_id = #{classId}
......@@ -187,7 +193,7 @@
image_check_record t1
WHERE
class_id =#{classId}
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 7 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.paper_id IS NOT NULL
and t1.result =1
AND t1.member_id=#{memberId}
......@@ -237,7 +243,7 @@
AND t.result = 1
AND t.delete_date IS NULL
AND opr_type = "登录"
AND DATE_FORMAT( DATE_ADD( create_date, INTERVAL 7 DAY ), '%Y-%m-%d' ) = DATE_FORMAT(
AND DATE_FORMAT( DATE_ADD( create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
......@@ -253,7 +259,7 @@
AND t.result = 1
AND t.delete_date IS NULL
AND opr_type = "登出"
AND DATE_FORMAT( DATE_ADD( create_date, INTERVAL 7 DAY ), '%Y-%m-%d' ) = DATE_FORMAT(
AND DATE_FORMAT( DATE_ADD( create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
......@@ -301,7 +307,7 @@
LEFT JOIN member t2 ON t1.member_id = t2.id
WHERE
t1.delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 7 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
And class_id = #{classId}
</select>
......@@ -335,7 +341,7 @@
exercise_done_result t1
WHERE
t1.delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 7 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND class_id = #{classId}
AND member_id = #{memberId}
</select>
......@@ -372,18 +378,23 @@
AND t3.delete_date IS NULL
</select>
<select id="checkClassIds" resultType="long">
<select id="checkClassIds" parameterType="string" resultType="long">
SELECT
distinct class_id
FROM
image_check_record
image_check_record t
left join class_dict t2 on t.class_id = t2.id
WHERE
delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( update_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT(
t.delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( t.update_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
and class_id is not null
<if test="classType != null and classType != ''">
and t2.class_type = #{classType}
</if>
</select>
<select id="classImageChecks" parameterType="long" resultType="com.subsidy.vo.renshe.ClassImageChecksVO">
......@@ -440,8 +451,7 @@
WHERE
t1.delete_date is null
and class_id = #{classId}
and t1.id in (568,569,571,572,576,577)
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 13 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.paper_id IS NULL
AND t1.result = 1
and t1.member_id
......@@ -464,7 +474,7 @@
LEFT JOIN member t2 ON t1.member_id = t2.id
WHERE
t1.delete_date is null
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 7 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
and class_id = #{classId}
AND t1.paper_id IS not NULL
AND t1.result = 1
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!