From de277cb7cc91c9c07265637b69271f6fd6aa139f Mon Sep 17 00:00:00 2001 From: tuyp Date: Tue, 30 Aug 2022 16:41:58 +0800 Subject: [PATCH] 拉websocket前备个份 --- src/main/java/com/subsidy/common/interceptor/WebSocketInterceptor.java | 4 +--- src/main/java/com/subsidy/controller/MemberController.java | 2 +- src/main/java/com/subsidy/dto/course/QueryCoursesDTO.java | 2 +- src/main/java/com/subsidy/mapper/CourseDictMapper.java | 2 +- src/main/java/com/subsidy/model/CourseDictDO.java | 2 +- src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java | 22 ++++++++++------------ src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java | 1 + src/main/java/com/subsidy/service/impl/CourseDictServiceImpl.java | 2 +- src/main/java/com/subsidy/service/impl/ImageCheckRecordServiceImpl.java | 24 +++++++++++++++++------- src/main/java/com/subsidy/service/impl/MemberServiceImpl.java | 4 ++-- src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java | 6 +++--- src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java | 2 +- src/main/java/com/subsidy/util/SecretUtils.java | 2 +- src/main/java/com/subsidy/util/websocket/WebSocketUtil.java | 2 +- src/main/java/com/subsidy/vo/classdict/ClassSettingsVO.java | 2 ++ src/main/resources/application.properties | 6 +++--- 16 files changed, 47 insertions(+), 38 deletions(-) diff --git a/src/main/java/com/subsidy/common/interceptor/WebSocketInterceptor.java b/src/main/java/com/subsidy/common/interceptor/WebSocketInterceptor.java index cec09bf..ac7b36b 100644 --- a/src/main/java/com/subsidy/common/interceptor/WebSocketInterceptor.java +++ b/src/main/java/com/subsidy/common/interceptor/WebSocketInterceptor.java @@ -41,9 +41,7 @@ public class WebSocketInterceptor implements HandshakeInterceptor { HttpServletRequest httpServletRequest = ((ServletServerHttpRequest) request).getServletRequest(); Long userId = Long.parseLong(httpServletRequest.getParameter("userId")); MemberDO memberDO = memberMapper.selectById(userId); - if(null != memberDO) { - return true; - } + return null != memberDO; } return false; } diff --git a/src/main/java/com/subsidy/controller/MemberController.java b/src/main/java/com/subsidy/controller/MemberController.java index 8106814..2d1fe45 100644 --- a/src/main/java/com/subsidy/controller/MemberController.java +++ b/src/main/java/com/subsidy/controller/MemberController.java @@ -88,7 +88,7 @@ public class MemberController { } @PostMapping("checkStatus") - @ApiOperation("实名制验证状态 memberId") + @ApiOperation("实名制验证状态 id") @TimeRequired public ResponseVO checkStatus(@RequestBody MemberDO memberDO){ return ResponseData.generateCreatedResponse(0,memberService.checkStatus(memberDO)); diff --git a/src/main/java/com/subsidy/dto/course/QueryCoursesDTO.java b/src/main/java/com/subsidy/dto/course/QueryCoursesDTO.java index 1fd28bd..3ef2fb7 100644 --- a/src/main/java/com/subsidy/dto/course/QueryCoursesDTO.java +++ b/src/main/java/com/subsidy/dto/course/QueryCoursesDTO.java @@ -25,6 +25,6 @@ public class QueryCoursesDTO { private Long companyId; - private Integer openStatus; + private String openStatus; } diff --git a/src/main/java/com/subsidy/mapper/CourseDictMapper.java b/src/main/java/com/subsidy/mapper/CourseDictMapper.java index c35773d..d225141 100644 --- a/src/main/java/com/subsidy/mapper/CourseDictMapper.java +++ b/src/main/java/com/subsidy/mapper/CourseDictMapper.java @@ -27,7 +27,7 @@ public interface CourseDictMapper extends BaseMapper { * courseName fieldId categoryId jobId courseRank courseType * @return */ - IPage queryCourses(IPage page, String courseName, Long fieldId,Long categoryId,Long jobId,Long rankId, String courseType,Long companyId,Integer openStatus,Long businessId); + IPage queryCourses(IPage page, String courseName, Long fieldId,Long categoryId,Long jobId,Long rankId, String courseType,Long companyId,String openStatus,Long businessId); /** * 通过课程id查询课程下的学生-----弃用 diff --git a/src/main/java/com/subsidy/model/CourseDictDO.java b/src/main/java/com/subsidy/model/CourseDictDO.java index 84d91b0..7965cb5 100644 --- a/src/main/java/com/subsidy/model/CourseDictDO.java +++ b/src/main/java/com/subsidy/model/CourseDictDO.java @@ -52,7 +52,7 @@ public class CourseDictDO extends BaseModel { /** * 课程开放状态 */ - private Integer openStatus; + private String openStatus; /** * 备注 diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java index db5fb0d..91c5d0f 100644 --- a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java @@ -605,9 +605,9 @@ public class AdministerServiceImpl extends ServiceImpl classDetailVOS = exportClassDetail(classDetailDTO); String studyDate = classDictDO.getStartDate() + " 至 " + classDictDO.getEndDate(); - membersListExcel(companyDictDO.getCompanyName(), studyDate, courseDictDO.getCourseName(), "授课记录汇总表", ExcelFormatUtils.memberList, classDetailVOS, null, 0, baos); + membersListExcel(companyDictDO.getCompanyName(), studyDate, classDictDO.getClassName(), "授课记录汇总表", ExcelFormatUtils.memberList, classDetailVOS, null, 0, baos); compressFileToZipStream(zipOutputStream, baos, "member.xlsx"); /** @@ -1222,7 +1220,7 @@ public class AdministerServiceImpl extends ServiceImpl classSignVOS = exportSignDetail(classDetailDTO); - signListExcel(companyDictDO.getCompanyName(), studyDate, courseDictDO.getCourseName(), "注册签到", ExcelFormatUtils.signList, classSignVOS, null, 0, baos1); + signListExcel(companyDictDO.getCompanyName(), studyDate, classDictDO.getClassName(), "注册签到", ExcelFormatUtils.signList, classSignVOS, null, 0, baos1); compressFileToZipStream(zipOutputStream, baos1, "sign.xlsx"); @@ -1244,7 +1242,7 @@ public class AdministerServiceImpl extends ServiceImpl exerciseTestVOS = exportExerciseTest(classDetailDTO); - testListExcel(companyDictDO.getCompanyName(), studyDate, courseDictDO.getCourseName(), "测试成绩表", ExcelFormatUtils.scoreList, exerciseTestVOS, null, 0, baos2); + testListExcel(companyDictDO.getCompanyName(), studyDate, classDictDO.getClassName(), "测试成绩表", ExcelFormatUtils.scoreList, exerciseTestVOS, null, 0, baos2); compressFileToZipStream(zipOutputStream, baos2, "test" + i + ".xlsx"); } @@ -1253,7 +1251,7 @@ public class AdministerServiceImpl extends ServiceImpl answerRecordVOS = exportAnswerRecord(classDetailDTO); - askListExcel(companyDictDO.getCompanyName(), studyDate, courseDictDO.getCourseName(), "答疑记录", ExcelFormatUtils.answersList, answerRecordVOS, null, 0, baos3); + askListExcel(companyDictDO.getCompanyName(), studyDate, classDictDO.getClassName(), "答疑记录", ExcelFormatUtils.answersList, answerRecordVOS, null, 0, baos3); compressFileToZipStream(zipOutputStream, baos3, "answer.xlsx"); zipOutputStream.flush(); diff --git a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java index f510627..9a78f6b 100644 --- a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java @@ -153,6 +153,7 @@ public class ClassDictServiceImpl extends ServiceImpl signList1 = Arrays.asList(WBAPPID, NONCE, memberDO.getId() + "", "1.0.0"); + List signList1 =new ArrayList<>(); + signList1.add(WBAPPID); + signList1.add(memberDO.getId()+""); + signList1.add("1.0.0"); + signList1.add(NONCE); String sign = sign(signList1, idCardTicketsVO.getValue()); //合作方后台上送身份信息 @@ -143,7 +148,13 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl signList2 = Arrays.asList(WBAPPID, NONCE, imageCheckRecordDO.getId() + "", sendIdCardInfoVO.getResult().getH5faceId(), memberDO.getId() + "", "1.0.0"); + List signList2 = new ArrayList<>(); + signList2.add(WBAPPID); + signList2.add(imageCheckRecordDO.getId()+""); + signList2.add(memberDO.getId()+""); + signList2.add("1.0.0"); + signList2.add(sendIdCardInfoVO.getResult().getFaceId()); + signList2.add(NONCE); String sign2 = sign(signList2, nonceTicket.getValue()); sendIdCardInfoVO.getResult().setWbAppId(WBAPPID); @@ -179,7 +190,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl signList1 = Arrays.asList(WBAPPID, imageCheckRecordDO.getId() + "", memberDO.getUserName(), memberDO.getIdCard(), memberDO.getId() + "", "1.0.0"); + List signList1 = new ArrayList(Arrays.asList(WBAPPID, imageCheckRecordDO.getId() + "", memberDO.getUserName(), memberDO.getIdCard(), memberDO.getId() + "", "1.0.0")); String sign = sign(signList1, idCardTicketsVO.getValue()); //合作方后台上送身份信息 @@ -200,7 +211,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl signList2 = Arrays.asList(WBAPPID, memberDO.getId() + "", NONCE, "1.0.0", sendIdCardInfoVO.getResult().getFaceId(), sendIdCardInfoVO.getResult().getOrderNo()); + List signList2 = new ArrayList(Arrays.asList(WBAPPID, memberDO.getId() + "", NONCE, "1.0.0", sendIdCardInfoVO.getResult().getFaceId(), sendIdCardInfoVO.getResult().getOrderNo())); String sign2 = sign(signList2, nonceTicket.getValue()); sendIdCardInfoVO.getResult().setWbAppId(WBAPPID); @@ -423,8 +434,8 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl() - .lambda() - .lt(AccessTokenDO::getCreateDate, LocalDateTime.now().minusMinutes(19L))); + .lambda() //21min //39min + .gt(AccessTokenDO::getCreateDate, LocalDateTime.now().minusMinutes(19L))); //数据库没有的话 if (null == accessTokenDO) { @@ -438,5 +449,4 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl imple .eq(RotationImgDictDO::getCompanyId, companyDictDO.getId())); userRoleVO.setRotationImgDictDOS(rotationImgDictDOS); String token = JwtUtil.generateToken(memberDO.getId(), ConstantUtils.MOBILE_TERMINATE); - redisUtil.set(ConstantUtils.MOBILE_TERMINATE + "_" + memberDO.getId(), token); +// redisUtil.set(ConstantUtils.MOBILE_TERMINATE + "_" + memberDO.getId(), token); userRoleVO.setToken(token); return userRoleVO; } @@ -677,7 +677,7 @@ public class MemberServiceImpl extends ServiceImpl imple .eq(RotationImgDictDO::getCompanyId, companyDictDO.getId())); userRoleVO.setRotationImgDictDOS(rotationImgDictDOS); String token = JwtUtil.generateToken(memberDO.getId(), ConstantUtils.MOBILE_TERMINATE); - redisUtil.set(ConstantUtils.MOBILE_TERMINATE + "_" + memberDO.getId(), token); +// redisUtil.set(ConstantUtils.MOBILE_TERMINATE + "_" + memberDO.getId(), token); userRoleVO.setToken(token); return userRoleVO; } diff --git a/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java index 812c39a..16dc601 100644 --- a/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java @@ -86,11 +86,11 @@ public class VodDictServiceImpl extends ServiceImpl im throw new HttpException(18000); } - if(vodDictDO.getVodCode() != null) { - VodUtil.deleteMedia(vodConfig, vodDictDO.getVodCode()); + if(vod.getVodCode() != null) { + VodUtil.deleteMedia(vodConfig, vod.getVodCode()); } - this.baseMapper.deleteById(vodDictDO.getId()); + this.baseMapper.deleteById(vod.getId()); } @Override diff --git a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java index e6fd91f..611cdec 100644 --- a/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java @@ -632,7 +632,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl classIdArr = Arrays.asList(classIds.split(",")); + String[] classIdArr = classIds.split(","); HashSet result = new HashSet<>(); for (String classId : classIdArr) { diff --git a/src/main/java/com/subsidy/util/SecretUtils.java b/src/main/java/com/subsidy/util/SecretUtils.java index 4bff771..46e3976 100644 --- a/src/main/java/com/subsidy/util/SecretUtils.java +++ b/src/main/java/com/subsidy/util/SecretUtils.java @@ -22,7 +22,7 @@ public class SecretUtils { public static String getMD5String(String str) { try { // 生成一个MD5加密计算摘要 - return DigestUtils.md5Hex(str.toString()).toUpperCase(); + return DigestUtils.md5Hex(str).toUpperCase(); // MessageDigest md = MessageDigest.getInstance("MD5"); // 计算md5函数 // md.update(str.getBytes("utf-8")); diff --git a/src/main/java/com/subsidy/util/websocket/WebSocketUtil.java b/src/main/java/com/subsidy/util/websocket/WebSocketUtil.java index 8bbee2a..8012193 100644 --- a/src/main/java/com/subsidy/util/websocket/WebSocketUtil.java +++ b/src/main/java/com/subsidy/util/websocket/WebSocketUtil.java @@ -103,7 +103,7 @@ public class WebSocketUtil implements WebSocketHandler { } webSocketMap.put(id, session); - /* 班级配置信息 */ + /* 班级配置信息 */ //查人的班级 List classSettings = classDictMapper.getClassSettings(id); if(CollectionUtils.isNotEmpty(classSettings)) { String data = JSONObject.toJSONString(ResponseData.generateCreatedResponse(0, classSettings), SerializerFeature.WriteMapNullValue); diff --git a/src/main/java/com/subsidy/vo/classdict/ClassSettingsVO.java b/src/main/java/com/subsidy/vo/classdict/ClassSettingsVO.java index 3638978..aa9716f 100644 --- a/src/main/java/com/subsidy/vo/classdict/ClassSettingsVO.java +++ b/src/main/java/com/subsidy/vo/classdict/ClassSettingsVO.java @@ -65,4 +65,6 @@ public class ClassSettingsVO { private Integer ipAddressRecord; private Integer deviceNoRecord; + + private Integer timeLimit; } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 5c5c4fa..559f4ed 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -68,7 +68,7 @@ spring.quartz.overwrite-existing-jobs=false #spring.redis.port=6379 #spring.redis.password=r-uf6m4cpkjrgpzywjm3:Ykhl@208 -wechat: +wechat= #pro -appId: wx5e1ecb9c9bd33451 -appSecret: 4f5e1abb6fb4f68f5273820b6295ec6b +appId= wx5e1ecb9c9bd33451 +appSecret= 4f5e1abb6fb4f68f5273820b6295ec6b -- libgit2 0.25.0