From 70bfd420bbeaac0b4877a1e7ec5d373774f21c26 Mon Sep 17 00:00:00 2001 From: tuyp Date: Fri, 3 Mar 2023 11:20:58 +0800 Subject: [PATCH] 人社局测试 --- src/main/java/com/subsidy/controller/AdministerController.java | 2 +- src/main/java/com/subsidy/jobs/RenSheJuJob.java | 214 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------- src/main/java/com/subsidy/mapper/OprMemDictMapper.java | 21 ++++++++++++++++++++- src/main/java/com/subsidy/mapper/RenSheJuMapper.java | 33 ++++++++++++++++++++++++--------- src/main/java/com/subsidy/service/impl/ImageCheckRecordServiceImpl.java | 40 ++++++++++++++++++++++++++++------------ src/main/java/com/subsidy/service/impl/MemberServiceImpl.java | 7 +++++-- src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java | 206 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------- src/main/java/com/subsidy/util/Base64Util.java | 6 +++++- src/main/java/com/subsidy/util/MathUtil.java | 2 +- src/main/java/com/subsidy/util/OSSUtils.java | 3 ++- src/main/resources/mapper/OprMemDictMapper.xml | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++------- src/main/resources/mapper/RenSheJuMapper.xml | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------- 12 files changed, 463 insertions(+), 223 deletions(-) diff --git a/src/main/java/com/subsidy/controller/AdministerController.java b/src/main/java/com/subsidy/controller/AdministerController.java index e4ab4ab..74772dc 100644 --- a/src/main/java/com/subsidy/controller/AdministerController.java +++ b/src/main/java/com/subsidy/controller/AdministerController.java @@ -51,7 +51,7 @@ public class AdministerController { return ResponseData.generateCreatedResponse(0,administerService.login(administerDO)); } - @PostMapping("/getPermissions") + @PostMapping("/getPermissions") @ApiOperation("权限查询") @LoginRequired public ResponseVO getPermissions() { diff --git a/src/main/java/com/subsidy/jobs/RenSheJuJob.java b/src/main/java/com/subsidy/jobs/RenSheJuJob.java index 5527ba3..307104f 100644 --- a/src/main/java/com/subsidy/jobs/RenSheJuJob.java +++ b/src/main/java/com/subsidy/jobs/RenSheJuJob.java @@ -1,100 +1,120 @@ -package com.subsidy.jobs; - -import com.alibaba.fastjson.JSONObject; -import com.subsidy.common.ResponseData; -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.concurrent.ConcurrentHashMap; - -/** - * 人社局数据对接 - */ -@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(); - } - +//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; +// // /** -// * POST-9 获取推送失败班级列表 +// * POST-2:班级基本信息信息采集接口 // */ -// @Scheduled(cron = "0 35 1 * * ?") -// public void getErrorClass()throws IOException{ -// renSheJuService.getErrorClass(); +// @Scheduled(cron = "0 0 1 * * ?") +// public void classBaseInfo()throws IOException { +// renSheJuService.classBaseInfo(); // } - - @Scheduled(cron = "00 58 23 * * ?") - public void cancelLogin()throws IOException{ - ConcurrentHashMap webSocketMap = WebSocketUtil.webSocketMap; - for (Long key : webSocketMap.keySet()){ - webSocketMap.get(key).sendMessage(new TextMessage(JSONObject.toJSONString(ResponseData.generateCreatedResponse(17001)))); - } - } - -} +// +// /** +// * 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 webSocketMap = WebSocketUtil.webSocketMap; +// +// List 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(); +// } +// } +// } +// +//} diff --git a/src/main/java/com/subsidy/mapper/OprMemDictMapper.java b/src/main/java/com/subsidy/mapper/OprMemDictMapper.java index beb95d5..c0ea6ed 100644 --- a/src/main/java/com/subsidy/mapper/OprMemDictMapper.java +++ b/src/main/java/com/subsidy/mapper/OprMemDictMapper.java @@ -23,8 +23,27 @@ public interface OprMemDictMapper extends BaseMapper { List getRecordByDate(); + /** + * 当天最后一次登录记录 + */ OprMemDictDO getLatestLoginInfo(Long userId); - void deleteData(OprMemDictDO oprMemDictDO); + +// /** +// * 当天最后一次登录 +// */ +// OprMemDictDO getLatestLogoutInfo(Long userId); + +// void deleteData(OprMemDictDO oprMemDictDO); + + /** + * 查看当天还在线的用户 + */ + List onlineUsers(); + +// /** +// * 根据最后一次看视频时间随机去写几秒登出 +// */ +// void insertLastStudyRecord(); } diff --git a/src/main/java/com/subsidy/mapper/RenSheJuMapper.java b/src/main/java/com/subsidy/mapper/RenSheJuMapper.java index ba995b4..cdd0d43 100644 --- a/src/main/java/com/subsidy/mapper/RenSheJuMapper.java +++ b/src/main/java/com/subsidy/mapper/RenSheJuMapper.java @@ -4,10 +4,7 @@ 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.model.*; import com.subsidy.vo.renshe.*; import org.springframework.stereotype.Repository; @@ -50,7 +47,9 @@ public interface RenSheJuMapper { /** * 考试活跃度检测--人脸 */ - List examActivities(String classId,Long memberId); + List examActivities(Long classId,Long memberId); + + /** * 某人某天累计在线时长 @@ -75,17 +74,28 @@ public interface RenSheJuMapper { /** * 前一天考试通过数据 */ - List dailyExamBasic(); + List dailyExamBasic(); + + /** + * 前一天做过考试通过数据 + */ + List memberIds(Long classId); /** * 查找课程最后一个视频 */ - String classVodName(String classId); + String classVodName(Long classId); + + /** + * 查出考试时间 + */ + Long examLength(Long memberId,Long classId); + /** * 找到某人某个时间段内的测评记录 */ - List dailyExerciseDone(Long memberId, String startDate, String endDate); + List dailyExerciseDone(Long memberId, String startDate, String endDate,Long classId); /** * 找到某人当天答疑的记录 @@ -108,8 +118,13 @@ public interface RenSheJuMapper { List passExamCheck(Long classId); /** - * 进入到课程第二次做人脸识别 + * 进入到课程第二次做人脸识别 弃用 */ List studyCheck(Long classId); + /** + * 考试数据 + */ + List examCheck(Long classId); + } diff --git a/src/main/java/com/subsidy/service/impl/ImageCheckRecordServiceImpl.java b/src/main/java/com/subsidy/service/impl/ImageCheckRecordServiceImpl.java index 6f87933..6f0b2bc 100644 --- a/src/main/java/com/subsidy/service/impl/ImageCheckRecordServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ImageCheckRecordServiceImpl.java @@ -133,12 +133,17 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl() + .lambda() + .eq(ClassMemberMappingDO::getMemberId, memberDO.getId()) + .eq(ClassMemberMappingDO::getClassId, classId)); + //合作方后台上送身份信息 SendIdCardInfoVO sendIdCardInfoVO = null; - if (StringUtils.isEmpty(memberDO.getCheckImage())) { + if (StringUtils.isEmpty(classMemberMappingDO.getPhoto())) { sendIdCardInfoVO = this.h5SendIdCardInfo(imageCheckRecordDO.getBizSeqNo(), memberDO, sign); } else { - sendIdCardInfoVO = this.h5SendIdCardInfoCompare(imageCheckRecordDO.getBizSeqNo(), memberDO, sign); + sendIdCardInfoVO = this.h5SendIdCardInfoCompare(imageCheckRecordDO.getBizSeqNo(), memberDO, sign, OSSUtils.image2Base64(classMemberMappingDO.getPhoto())); } if (!"0".equals(sendIdCardInfoVO.getCode())) { @@ -205,14 +210,21 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl() + .lambda() + .eq(ClassMemberMappingDO::getMemberId, memberDO.getId()) + .eq(ClassMemberMappingDO::getClassId, classId)); + + + if (StringUtils.isEmpty(classMemberMappingDO.getPhoto())) { signList1.add(memberDO.getUserName()); signList1.add(memberDO.getIdCard()); sign = sign(signList1, idCardTicketsVO.getValue()); sendIdCardInfoVO = this.sendIdCardInfo(imageCheckRecordDO.getBizSeqNo(), memberDO, sign); } else { sign = sign(signList1, idCardTicketsVO.getValue()); - sendIdCardInfoVO = this.sendIdCardInfoCompare(imageCheckRecordDO.getBizSeqNo(), memberDO, sign); + sendIdCardInfoVO = this.sendIdCardInfoCompare(imageCheckRecordDO.getBizSeqNo(), memberDO, sign, OSSUtils.image2Base64(classMemberMappingDO.getPhoto())); } if (!"0".equals(sendIdCardInfoVO.getCode())) { @@ -255,8 +267,8 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl() - .lambda() - .eq(ImageCheckRecordDO::getBizSeqNo,checkResultDTO.getId())); + .lambda() + .eq(ImageCheckRecordDO::getBizSeqNo, checkResultDTO.getId())); if (!StringUtils.isEmpty(resultVO.getSimilarity())) { BeanUtils.copyProperties(resultVO, imageCheckRecordDO); ActivityDetectionDO activityDetectionDO = new ActivityDetectionDO(); @@ -265,7 +277,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl 50)) { imageCheckRecordDO.setResult(1); activityDetectionDO.setStatus(1); @@ -276,7 +288,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl imple .eq(MemberTokensDO::getMemberId, memberDO.getId())); OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId()); - if (oprMemDictDO.getResult() == 1 && "登出".equals(oprMemDictDO.getOprType())) { - oprMemDictMapper.deleteData(oprMemDictDO); + if (null != oprMemDictDO){ + if (oprMemDictDO.getResult() == 1 && "登出".equals(oprMemDictDO.getOprType())) { + oprMemDictMapper.deleteById(oprMemDictDO.getId()); +// oprMemDictMapper.deleteData(oprMemDictDO); + } } oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setResult(1); diff --git a/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java b/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java index 782016a..a4cf9b9 100644 --- a/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java @@ -44,6 +44,7 @@ public class RenSheJuServiceImpl implements RenSheJuService { @Autowired private ImageCheckRecordMapper imageCheckRecordMapper; + public RensheResponseVO classBaseInfo() throws IOException { OkHttpClient client = new OkHttpClient().newBuilder() @@ -176,11 +177,26 @@ public class RenSheJuServiceImpl implements RenSheJuService { activityList.setAccess(1); activityList.setErrorInfo(2); } + + int count = imageCheckRecordMapper.selectCount(new QueryWrapper() + .lambda() + .eq(ImageCheckRecordDO::getResult, 1) + .isNull(ImageCheckRecordDO::getPaperId) + .eq(ImageCheckRecordDO::getMemberId, dailyStudyInfoVO.getMemberId()) + .eq(ImageCheckRecordDO::getClassId, dailyStudyInfoVO.getDownCode())); + if (0 == dailyActivitiesVO.getCheckType()) { activityList.setActivityDetection(2); - } else { + } else if (1 == dailyActivitiesVO.getCheckType()) { activityList.setActivityDetection(1); + } else { + activityList.setActivityDetection(3); + } + + if (count >= 2 && dailyActivitiesVO.getCheckType() == 1) { + activityList.setActivityDetection(4); } + activityList.setActivityTime(dailyActivitiesVO.getActivityTime()); activityLists.add(activityList); } @@ -236,60 +252,86 @@ public class RenSheJuServiceImpl implements RenSheJuService { List chapterExamBasics = new ArrayList<>(); - List dailyExamBasicVOS = renSheJuMapper.dailyExamBasic(); + //找出前一天产生考试数据的班级 +// List classIds = renSheJuMapper.dailyExamBasic(); + + List classIds = new ArrayList<>(); + classIds.add(404L); try { - if (dailyExamBasicVOS.size() > 0) { - 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); + if (classIds.size() > 0) { + for (Long classId : classIds) { + + //具体哪些人做了 + List memberDOList = renSheJuMapper.memberIds(classId); + + for (MemberDO memberDO : memberDOList) { + + //章节课程考试时间列表 + ChapterExamBasic chapterExamBasic = new ChapterExamBasic(); + chapterExamBasic.setDownCode(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 activityLists = new ArrayList<>(); + List 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(3); + activityList.setActivityTime(dailyActivitiesVO.getActivityTime()); + activityLists.add(activityList); } - 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.setActivityList(activityLists); + + + List examLists = new ArrayList(); + //上线时间 + List loginRecords = renSheJuMapper.loginRecords(memberDO.getId()); + //下线时间 + List loginOutRecords = renSheJuMapper.loginOutRecords(memberDO.getId()); + + boolean flag = false; + + for (int i = 0; i < loginRecords.size(); i++) { + //找到该时间段内的测评 + List 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); } - chapterExamBasic.setExamList(examLists); - chapterExamBasics.add(chapterExamBasic); } uploadChapterBehaviorDTO.setChapterExamBasic(chapterExamBasics); @@ -306,18 +348,19 @@ public class RenSheJuServiceImpl implements RenSheJuService { 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); + 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); } - renshejuHistoryMapper.insert(renshejuHistoryDO); -// } return rensheResponseVO; +// return null; } else { RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_4); @@ -434,14 +477,15 @@ public class RenSheJuServiceImpl implements RenSheJuService { //找到昨天做过人脸识别的班级 - List classIds = renSheJuMapper.checkClassIds(); +// List classIds = renSheJuMapper.checkClassIds(); + + List classIds = new ArrayList<>(); + classIds.add(404L); 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(); try { @@ -465,16 +509,35 @@ public class RenSheJuServiceImpl implements RenSheJuService { if (count == 1) { imageDetailList.setProcessType(0L); imageDetailList.setDetectionType(0L); - imageDetailLists.add(imageDetailList); } else if (count == 2) { imageDetailList.setProcessType(1L); imageDetailList.setDetectionType(1L); - imageDetailLists.add(imageDetailList); } imageDetailLists.add(imageDetailList); } - uploadImage.setImageDetailList(imageDetailLists); + } + + /** + * 考试检测数据 + */ + List 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() @@ -492,13 +555,15 @@ public class RenSheJuServiceImpl implements RenSheJuService { renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString()); renshejuHistoryMapper.insert(renshejuHistoryDO); rensheResponseVOS.add(rensheResponseVO); + System.out.println(111); } else { - RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); - renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_6); - renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadImage).toString()); - renshejuHistoryDO.setOutputParam(RenSheJuConstant.NO_DATA); - renshejuHistoryMapper.insert(renshejuHistoryDO); + RenshejuHistoryDO renshejuHistoryDO1 = new RenshejuHistoryDO(); + renshejuHistoryDO1.setInterfaceName(RenSheJuConstant.POST_6); + renshejuHistoryDO1.setInputParam(JSONObject.fromObject(uploadImage).toString()); + renshejuHistoryDO1.setOutputParam(RenSheJuConstant.NO_DATA); + renshejuHistoryMapper.insert(renshejuHistoryDO1); } + } catch (Exception e) { e.printStackTrace(); RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); @@ -507,7 +572,6 @@ public class RenSheJuServiceImpl implements RenSheJuService { renshejuHistoryDO.setOutputParam(RenSheJuConstant.PUSH_FAIL); renshejuHistoryMapper.insert(renshejuHistoryDO); } -// System.out.println(rensheResponseVO); } return rensheResponseVOS; diff --git a/src/main/java/com/subsidy/util/Base64Util.java b/src/main/java/com/subsidy/util/Base64Util.java index b473446..cabdb91 100644 --- a/src/main/java/com/subsidy/util/Base64Util.java +++ b/src/main/java/com/subsidy/util/Base64Util.java @@ -36,7 +36,11 @@ class Base64Util { BASE64Encoder decoder = new BASE64Encoder(); return replaceEnter(decoder.encode(image)); } - + + public static void main(String[] args) { + System.out.println(encode("http://ykhl-bigger.oss-cn-beijing.aliyuncs.com/2023-02-1618cb936b-4825-429c-9fdd-dd9d0de97ed7.jpg?x-oss-process=image/auto-orient,1/resize,m_pad,w_500,h_500/quality,Q_100/format,jpg")); + } + public static String encode(String uri){ BASE64Encoder encoder = new BASE64Encoder(); return replaceEnter(encoder.encode(uri.getBytes())); diff --git a/src/main/java/com/subsidy/util/MathUtil.java b/src/main/java/com/subsidy/util/MathUtil.java index 7c47499..79275a8 100644 --- a/src/main/java/com/subsidy/util/MathUtil.java +++ b/src/main/java/com/subsidy/util/MathUtil.java @@ -37,7 +37,7 @@ public class MathUtil { //习题/视频 ==> 秒钟向下取整 public static String floorSecond(int length) { - return String.valueOf((int) Math.ceil((double) length / 60)); + return String.valueOf((int) Math.floor((double) length / 60)); } //视频秒数处理 diff --git a/src/main/java/com/subsidy/util/OSSUtils.java b/src/main/java/com/subsidy/util/OSSUtils.java index 7f19d6f..1bc6a26 100644 --- a/src/main/java/com/subsidy/util/OSSUtils.java +++ b/src/main/java/com/subsidy/util/OSSUtils.java @@ -115,6 +115,7 @@ public class OSSUtils { } public static void main(String[] args) { - System.out.println(image2Base64("https://shixischool.oss-cn-beijing.aliyuncs.com/2022-12-219df5b721-99b7-48c4-916e-e474a4eca946.jpg?x-oss-process=image/auto-orient,1/resize,m_pad,w_500,h_500/quality,Q_100/format,jpg")); +// System.out.println(image2Base64("https://shixischool.oss-cn-beijing.aliyuncs.com/2022-12-219df5b721-99b7-48c4-916e-e474a4eca946.jpg?x-oss-process=image/auto-orient,1/resize,m_pad,w_500,h_500/quality,Q_100/format,jpg")); + System.out.println(image2Base64("http://ykhl-bigger.oss-cn-beijing.aliyuncs.com/2023-02-1618cb936b-4825-429c-9fdd-dd9d0de97ed7.jpg?x-oss-process=image/auto-orient,1/resize,m_pad,w_500,h_500/quality,Q_100/format,jpg")); } } diff --git a/src/main/resources/mapper/OprMemDictMapper.xml b/src/main/resources/mapper/OprMemDictMapper.xml index 5ebdae3..0ab3b1d 100644 --- a/src/main/resources/mapper/OprMemDictMapper.xml +++ b/src/main/resources/mapper/OprMemDictMapper.xml @@ -68,16 +68,66 @@ t.delete_date IS NULL AND t.result = 1 AND t.user_id =#{userId} - order by t.create_date desc + and DATE_FORMAT( create_date, '%Y-%m-%d' ) = DATE_FORMAT( now(), '%Y-%m-%d' ) + order by t.id desc limit 1 - - DELETE + + + + + + + + + + + + + + + + diff --git a/src/main/resources/mapper/RenSheJuMapper.xml b/src/main/resources/mapper/RenSheJuMapper.xml index 2ab3b97..5711de7 100644 --- a/src/main/resources/mapper/RenSheJuMapper.xml +++ b/src/main/resources/mapper/RenSheJuMapper.xml @@ -182,13 +182,14 @@ @@ -276,26 +277,35 @@ and t.class_id = #{classId} - + SELECT DISTINCT + class_id + FROM + exercise_done_result t1 + WHERE + t1.delete_date IS NULL + AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( + NOW(), + '%Y-%m-%d' + ) - + SELECT DISTINCT + member_id as id, + t2.id_card, + t2.telephone, + t2.user_name + FROM + exercise_done_result t1 + 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 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' ) + And class_id = #{classId} + + + + + + + -- libgit2 0.25.0