From 1d098f37ca12a7f56438ea4cc23f604ed3e56892 Mon Sep 17 00:00:00 2001 From: Administrator Date: Thu, 3 Mar 2022 13:35:18 +0800 Subject: [PATCH] 去掉了redis --- src/main/java/com/subsidy/common/constant/SmsCode.java | 2 +- src/main/java/com/subsidy/jobs/CourseNotificationJob.java | 11 ++++++----- src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java | 2 +- src/main/java/com/subsidy/mapper/VodPlayHistoryMapper.java | 2 +- src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java | 24 +++++++++++++++++------- src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java | 2 +- src/main/java/com/subsidy/service/impl/ClassNoticeServiceImpl.java | 2 +- src/main/java/com/subsidy/service/impl/MemberServiceImpl.java | 4 ++-- src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java | 7 ++++--- src/main/java/com/subsidy/util/SMSUtils.java | 22 ++++++++++++++-------- src/main/java/com/subsidy/vo/member/StudyPageVO.java | 2 +- src/main/resources/code.properties | 1 + src/main/resources/mapper/ExerciseDoneResultMapper.xml | 1 + src/main/resources/mapper/MemberMapper.xml | 2 +- src/main/resources/mapper/VodPlayHistoryMapper.xml | 2 +- 15 files changed, 53 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/subsidy/common/constant/SmsCode.java b/src/main/java/com/subsidy/common/constant/SmsCode.java index af4b353..aef2eb2 100644 --- a/src/main/java/com/subsidy/common/constant/SmsCode.java +++ b/src/main/java/com/subsidy/common/constant/SmsCode.java @@ -7,7 +7,7 @@ public enum SmsCode { SIGN_IN("SMS_234409992", "签到通知"), TEST("SMS_234414789", "测试通知"), - CLASS_START("SMS_228017725", "开课通知"), + CLASS_START("SMS_228137810", "开课通知"), ALL("SMS_228137810", "全部成员"), NOT_SIGNED_IN("SMS_234409992","未签到成员"), UNFINISHED("SMS_234414789","未完课成员"); diff --git a/src/main/java/com/subsidy/jobs/CourseNotificationJob.java b/src/main/java/com/subsidy/jobs/CourseNotificationJob.java index 7f3c762..d4b2a30 100644 --- a/src/main/java/com/subsidy/jobs/CourseNotificationJob.java +++ b/src/main/java/com/subsidy/jobs/CourseNotificationJob.java @@ -52,14 +52,15 @@ public class CourseNotificationJob implements Job { if(list != null && list.size() > 0) { for (MemberDO memberDO : list) { if(memberDO != null) { - Map data = Arrays.stream(SmsCode.values()).collect(Collectors.toMap(SmsCode::getType, SmsCode::getCode)); String sms = ""; if(classNoticeDO.getNoticeType().equals(SmsCode.CLASS_START.getType())) { - sms = "{\"company\": \""+ cmInfo.getCompany() +"\", \"course\":\""+ cmInfo.getCourseName() +"\",\" startDate\": \""+ cmInfo.getStartDate()+"\", \"endDate\": \""+ cmInfo.getEndDate()+"\"}"; - } else if(classNoticeDO.getNoticeType().equals(SmsCode.SIGN_IN.getType()) || - classNoticeDO.getNoticeType().equals(SmsCode.TEST.getType())) { - sms = "{\"name\": \""+ cmInfo.getName() +"\", \"course\": \""+ cmInfo.getCourseName()+"\"}"; + sms = "{\"company\":\""+ cmInfo.getCompany() +"\", \"course\":\""+ cmInfo.getCourseName() +"\", \"startDate\": \""+ cmInfo.getStartDate()+"\", \"endDate\": \""+ cmInfo.getEndDate()+"\"}"; + } else if(classNoticeDO.getNoticeType().equals(SmsCode.SIGN_IN.getType())) { + sms = "{ \"name\": \""+ cmInfo.getName() +"\", \"course\":\""+ cmInfo.getCourseName()+"\"}"; + } else if(classNoticeDO.getNoticeType().equals(SmsCode.TEST.getType())) { + sms = "{ \"name\": \""+ cmInfo.getName() +"\", \"course\":\""+ cmInfo.getCourseName()+"\"}"; } + Map data = Arrays.stream(SmsCode.values()).collect(Collectors.toMap(SmsCode::getType, SmsCode::getCode)); SMSUtils.sendNoticeSMS(data.get(classNoticeDO.getNoticeType()), memberDO.getTelephone(), sms); } } diff --git a/src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java b/src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java index d71378c..c1db7a1 100644 --- a/src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java +++ b/src/main/java/com/subsidy/mapper/ExerciseDoneResultMapper.java @@ -51,7 +51,7 @@ public interface ExerciseDoneResultMapper extends BaseMapper { /** * 查看学生是否完成了某个视频 */ - int completeVodOrNot(Long memberId, Long vodId); + int completeVodOrNot(Long memberId, Long vodId,Long classId); ///** // * 查看某个班级的学习记录 diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java index dc8b5d3..22c7b1b 100644 --- a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java @@ -743,7 +743,7 @@ public class AdministerServiceImpl extends ServiceImpl exerciseTestVOS = exportExerciseTest(classDetailDTO); - testListExcel(companyDictDO.getCompanyName(), studyDate, courseDictDO.getCourseName(), "测试成绩表", ExcelFormatUtils.scoreList, exerciseTestVOS, null, 0, baos2); - compressFileToZipStream(zipOutputStream, baos2, "test.xlsx"); + + //查看某个课程下有几个试卷 + List exerciseDoneResultDOS = exerciseDoneResultMapper.selectList(new QueryWrapper() + .lambda() + .eq(ExerciseDoneResultDO::getClassId,classDetailDTO.getId())); + + for (int i = 0 ; i < exerciseDoneResultDOS.size();i++){ + ByteArrayOutputStream baos2 = new ByteArrayOutputStream(); + classDetailDTO.setFlag(false); + classDetailDTO.setPaperId(exerciseDoneResultDOS.get(i).getPaperId()); + List exerciseTestVOS = exportExerciseTest(classDetailDTO); + testListExcel(companyDictDO.getCompanyName(), studyDate, courseDictDO.getCourseName(), "测试成绩表", ExcelFormatUtils.scoreList, exerciseTestVOS, null, 0, baos2); + compressFileToZipStream(zipOutputStream, baos2, "test"+i+".xlsx"); + } + /** diff --git a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java index 4b95206..331134a 100644 --- a/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java @@ -223,7 +223,7 @@ public class ClassDictServiceImpl extends ServiceImpl imple .eq(SmsVerifyCodeDO::getVerifyCode, verifyCodeDTO.getVerifyCode()) .gt(SmsVerifyCodeDO::getCreateDate, LocalDateTime.now().minusMinutes(30L))); - if (null != smsCodeDO || !verifyCodeDTO.getVerifyCode().equals(smsCodeDO.getVerifyCode())) { + if (null == smsCodeDO || !verifyCodeDTO.getVerifyCode().equals(smsCodeDO.getVerifyCode())) { OprMemDictDO oprMemDictDO = new OprMemDictDO(); oprMemDictDO.setUserId(memberDO.getId()); oprMemDictDO.setOprType("登录"); @@ -505,7 +505,7 @@ public class MemberServiceImpl extends ServiceImpl imple //该成员完成了几个视频 for (VodDictDO vodDictDO : vodDictDOS) { - int completeVodOrNot = vodPlayHistoryMapper.completeVodOrNot(memberId, vodDictDO.getId()); + int completeVodOrNot = vodPlayHistoryMapper.completeVodOrNot(memberId, vodDictDO.getId(),studyPageVO.getClassId()); i += completeVodOrNot; } studyPageVO.setDoneVods(i); diff --git a/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java b/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java index beccc4e..390731e 100644 --- a/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/SmsVerifyCodeServiceImpl.java @@ -47,9 +47,10 @@ public class SmsVerifyCodeServiceImpl extends ServiceImpl() + .lambda() + .eq(SmsVerifyCodeDO::getTelephone,sendVerifyCodeDTO.getTelephone())); + //redisUtil.set(RedisPrefixConstant.SUBSIDY_TELEPHONE_PREFIX + sendVerifyCodeDTO.getTelephone(), code, 30 * 60); SmsVerifyCodeDO smsCodeDO = new SmsVerifyCodeDO(); smsCodeDO.setVerifyCode(code); diff --git a/src/main/java/com/subsidy/util/SMSUtils.java b/src/main/java/com/subsidy/util/SMSUtils.java index 73b3f15..a1883a2 100644 --- a/src/main/java/com/subsidy/util/SMSUtils.java +++ b/src/main/java/com/subsidy/util/SMSUtils.java @@ -1,5 +1,7 @@ package com.subsidy.util; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.aliyuncs.CommonRequest; import com.aliyuncs.CommonResponse; import com.aliyuncs.DefaultAcsClient; @@ -19,6 +21,8 @@ import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombi import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.Map; + /** * 短信发送工具类 */ @@ -122,15 +126,17 @@ public class SMSUtils { // } request.putQueryParameter("TemplateParam",param); CommonResponse response = null; - try - - { + try { response = client.getCommonResponse(request); - return ConstantUtils.SUCCESS_SEND_OUT; - } catch( - Exception e) - - { + if(response != null) { + JSONObject data = JSON.parseObject(response.getData()); + if(data.get("Code").equals("OK")) { + return ConstantUtils.SUCCESS_SEND_OUT; + } + throw new HttpException(1000, data.get("Message").toString()); + } + return ConstantUtils.FAIL_SEND_OUT; + } catch(Exception e) { e.printStackTrace(); return ConstantUtils.FAIL_SEND_OUT; } diff --git a/src/main/java/com/subsidy/vo/member/StudyPageVO.java b/src/main/java/com/subsidy/vo/member/StudyPageVO.java index 154c85a..e799af0 100644 --- a/src/main/java/com/subsidy/vo/member/StudyPageVO.java +++ b/src/main/java/com/subsidy/vo/member/StudyPageVO.java @@ -7,7 +7,7 @@ public class StudyPageVO { private Long id; - private Integer classId; + private Long classId; private String courseName; diff --git a/src/main/resources/code.properties b/src/main/resources/code.properties index 99b7c12..e8ea425 100644 --- a/src/main/resources/code.properties +++ b/src/main/resources/code.properties @@ -54,3 +54,4 @@ meishu.code-message[12001]=该职级已存在 meishu.code-message[13001]=已达到当日最大时长 + diff --git a/src/main/resources/mapper/ExerciseDoneResultMapper.xml b/src/main/resources/mapper/ExerciseDoneResultMapper.xml index ea70564..839563d 100644 --- a/src/main/resources/mapper/ExerciseDoneResultMapper.xml +++ b/src/main/resources/mapper/ExerciseDoneResultMapper.xml @@ -131,6 +131,7 @@ t.delete_date IS NULL AND t.member_id = #{memberId} AND t.paper_id = #{paperId} + and t.class_id = #{classId} GROUP BY t.class_id, t.paper_id, diff --git a/src/main/resources/mapper/MemberMapper.xml b/src/main/resources/mapper/MemberMapper.xml index 3024b3e..b40214f 100644 --- a/src/main/resources/mapper/MemberMapper.xml +++ b/src/main/resources/mapper/MemberMapper.xml @@ -305,7 +305,7 @@ cmm.class_id = #{classId} AND m.delete_date IS NULL AND cmm.delete_date IS NULL - AND s.signInCount = 0 + AND s.signInCount is null GROUP BY m.id diff --git a/src/main/resources/mapper/VodPlayHistoryMapper.xml b/src/main/resources/mapper/VodPlayHistoryMapper.xml index ad1f407..e1b16aa 100644 --- a/src/main/resources/mapper/VodPlayHistoryMapper.xml +++ b/src/main/resources/mapper/VodPlayHistoryMapper.xml @@ -126,7 +126,7 @@ WHERE t.delete_date IS NULL AND t.member_id = #{memberId} - + and t.class_id = #{classId} AND t.vod_id = #{vodId} -- libgit2 0.25.0