he2802 3 роки тому
батько
коміт
99c72381ee

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/alisms/service/impl/AliSmsServiceImpl.java

@@ -77,7 +77,7 @@ public class AliSmsServiceImpl implements IAliSmsService {
         //发送带指定短信code带参数发送不同短信内容
         try{
             SendSmsResponse response = SmsUtils.sendSms(tel,SIGNNAME,code,param,ACCESSKEYID,ACCESSKEYSECRET);
-            System.out.println(response);
+            return new ResultBean(response);
         }catch (Exception e){
 
         }

+ 26 - 14
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java

@@ -18,6 +18,7 @@ import com.zhongzheng.common.core.redis.RedisCache;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.http.HttpUtils;
 import com.zhongzheng.common.utils.polyv.PolyvUtils;
+import com.zhongzheng.modules.alisms.vo.ResultBean;
 import com.zhongzheng.modules.base.service.IProfileTpService;
 import com.zhongzheng.modules.base.vo.ProfileTpVo;
 import com.zhongzheng.modules.base.vo.UserProfileVo;
@@ -246,11 +247,14 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                     informUserAddBo.setGoodsId(goodsVo.getGoodsId());
                     GoodsVo goodsVo1 = iGoodsService.queryById(goodsVo.getGoodsId());
                     informUserAddBo.setText("尊敬的用户:您购买的" + goodsVo1.getGoodsName() + "已经开通,请尽快去学习吧。");
-                    iInformUserService.insertByAddBo(informUserAddBo);
                     UserVo userVo = iUserService.queryById(goodsVo.getUserId());
                     Map<String, Object> param = new HashMap<>();
                     param.put("goods", goodsVo1.getGoodsName());
-                    IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), OpenTheGoodsCode);
+                    ResultBean rb = IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), OpenTheGoodsCode);
+                    if(Validator.isNotEmpty(rb)){
+                        iInformUserService.insertByAddBo(informUserAddBo);
+                    }
+
                 }
                 if (informRemindTwoVo.getNoteStatus() == 1 && profileTpVo != null) {
                     InformUserAddBo informUserAddBo = new InformUserAddBo();
@@ -265,11 +269,13 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                     informUserAddBo.setGoodsId(goodsVo.getGoodsId());
                     GoodsVo goodsVo1 = iGoodsService.queryById(goodsVo.getGoodsId());
                     informUserAddBo.setText("尊敬的用户:您购买的" + goodsVo1.getGoodsName() + "已经开通,请尽快去学习吧。");
-                    iInformUserService.insertByAddBo(informUserAddBo);
                     UserVo userVo = iUserService.queryById(goodsVo.getUserId());
                     Map<String, Object> param = new HashMap<>();
                     param.put("goods", goodsVo1.getGoodsName());
-                    IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), informationNotificationCode);
+                    ResultBean rb = IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), informationNotificationCode);
+                    if(Validator.isNotEmpty(rb)){
+                        iInformUserService.insertByAddBo(informUserAddBo);
+                    }
                 }
             }
         }
@@ -359,12 +365,13 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                 informUserAddBo.setGradeId(classTwentyGradeUserVo.getGradeId());
                 GoodsVo goodsVo1 = iGoodsService.queryById(classTwentyGradeUserVo.getGoodsId());
                 informUserAddBo.setText("尊敬的用户:您购买的课程班级有效期还剩20天,未在"+resEnd+"前完成全部学时,可能会影响审核进度,最终导致学时无效,请尽快完成学习");
-                iInformUserService.insertByAddBo(informUserAddBo);
                 UserVo userVo = iUserService.queryById(classTwentyGradeUserVo.getUserId());
                 Map<String, Object> param = new HashMap<>();
                 param.put("time", resEnd);
                 param.put("day", 20);
-                IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), remainingDaysValidityCode);
+                if(Validator.isNotEmpty(IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), remainingDaysValidityCode))){
+                    iInformUserService.insertByAddBo(informUserAddBo);
+                }
             }
         }
 
@@ -409,12 +416,14 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                 informUserAddBo.setGradeId(classTenGradeUserVo.getGradeId());
                 GoodsVo goodsVo1 = iGoodsService.queryById(classTenGradeUserVo.getGoodsId());
                 informUserAddBo.setText("尊敬的用户:您购买的课程班级有效期还剩10天,未在"+resEnd+"前完成全部学时,可能会影响审核进度,最终导致学时无效,请尽快完成学习");
-                iInformUserService.insertByAddBo(informUserAddBo);
+
                 UserVo userVo = iUserService.queryById(classTenGradeUserVo.getUserId());
                 Map<String, Object> param = new HashMap<>();
                 param.put("time", resEnd);
                 param.put("day", 10);
-                IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), remainingDaysValidityCode);
+                if(Validator.isNotEmpty(IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), remainingDaysValidityCode))){
+                    iInformUserService.insertByAddBo(informUserAddBo);
+                }
             }
         }
 
@@ -459,12 +468,13 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                 informUserAddBo.setGradeId(classFiveGradeUserVo.getGradeId());
                 GoodsVo goodsVo1 = iGoodsService.queryById(classFiveGradeUserVo.getGoodsId());
                 informUserAddBo.setText("尊敬的用户:您购买的课程班级有效期还剩5天,未在"+resEnd+"前完成全部学时,可能会影响审核进度,最终导致学时无效,请尽快完成学习");
-                iInformUserService.insertByAddBo(informUserAddBo);
                 UserVo userVo = iUserService.queryById(classFiveGradeUserVo.getUserId());
                 Map<String, Object> param = new HashMap<>();
                 param.put("time", resEnd);
                 param.put("day", 5);
-                IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), remainingDaysValidityCode);
+                if(Validator.isNotEmpty(IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), remainingDaysValidityCode))){
+                    iInformUserService.insertByAddBo(informUserAddBo);
+                }
             }
         }
 
@@ -513,13 +523,14 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                 GoodsVo goodsVo1 = iGoodsService.queryById(subscribeVo.getGoodsId());
                 informUserAddBo.setText("尊敬的用户:您预约的施工现场专业人员"+goodsVo1.getGoodsName()+"考试将在"+res+"("+startTime+"-"+endTime+")进行," +
                         "考试地点:"+subscribeVo.getApplySiteAddress()+"");
-                iInformUserService.insertByAddBo(informUserAddBo);
                 UserVo userVo = iUserService.queryById(subscribeVo.getUserId());
                 Map<String, Object> param = new HashMap<>();
                 param.put("goods", goodsVo1.getGoodsName());
                 param.put("time", res+"("+startTime+"-"+endTime+")");
                 param.put("address", subscribeVo.getApplySiteAddress());
-                IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), examinationRemind);
+                if(Validator.isNotEmpty(IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), examinationRemind))){
+                    iInformUserService.insertByAddBo(informUserAddBo);
+                }
             }
         }
     }
@@ -919,11 +930,12 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                 GoodsVo goodsVo1 = iGoodsService.queryById(examUserApplyVo.getGoodsId());
                 informUserAddBo.setGradeId(examUserApplyVo.getGradeId());
                 informUserAddBo.setText("尊敬的用户:七大员新考考试预约已经开始,预约截至时间"+res+",请马上点击进行预约考试。");
-                iInformUserService.insertByAddBo(informUserAddBo);
                 UserVo userVo = iUserService.queryById(examUserApplyVo.getUserId());
                 Map<String, Object> param = new HashMap<>();
                 param.put("time", res);
-                IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), bookingReminder);
+                if(Validator.isNotEmpty(IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), bookingReminder))){
+                    iInformUserService.insertByAddBo(informUserAddBo);
+                }
             }
         }
     }

+ 6 - 6
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserSubscribeServiceImpl.java

@@ -215,22 +215,22 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
         Long time = sdf.parse(dateForma).getTime() / 1000;
         if (System.currentTimeMillis()/1000 > time){
-            throw new IllegalArgumentException("当前选择的考试时间已过期,请重新预约,选择未过期考试时间");
+            throw new CustomException("当前选择的考试时间已过期,请重新预约,选择未过期考试时间");
         }
         ExamApplyQueryBo queryTimeBo = new ExamApplyQueryBo();
         queryTimeBo.setApplyId(bo.getApplyId());
         queryTimeBo.setStartTime(bo.getApplySiteStartTime().replace("-", ":"));
         queryTimeBo.setEndTime(bo.getApplySiteEndTime().replace("-", ":"));
-        queryTimeBo.setExamTime(time);
+        queryTimeBo.setExamTime(bo.getApplySiteExamTime());
         queryTimeBo.setApplySiteAddress(bo.getApplySiteAddress());
         //考点已申报人数
         Long sitePeopleNum = examApplyMapper.sitePeopleNum(queryTimeBo);
         String siteTimeJson = examApplyMapper.siteTimeJson(queryTimeBo);
         if (Validator.isEmpty(siteTimeJson)) {
-            throw new IllegalArgumentException("考点数据错误");
+            throw new CustomException("考点数据错误");
         }
-        int existNum = findPeopleNum(queryTimeBo,siteTimeJson);
-        if(existNum==-1||existNum>=sitePeopleNum){
+        int num = findPeopleNum(queryTimeBo,siteTimeJson);
+        if(num==-1||num<=sitePeopleNum){
             throw new CustomException("考点人数已满");
         }
         validEntityBeforeSave(add);
@@ -994,7 +994,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
                 continue;
             }
             ExamApplyQueryBo queryTimeBo = new ExamApplyQueryBo();
-            queryTimeBo.setApplySiteId(applySiteId);
+            queryTimeBo.setApplyId(applyId);
             queryTimeBo.setStartTime(startTime);
             queryTimeBo.setEndTime(endTime);
             queryTimeBo.setExamTime(userSubscribeAddBo.getApplySiteExamTime());

+ 2 - 2
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamApplyMapper.xml

@@ -411,12 +411,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="sitePeopleNum" parameterType="com.zhongzheng.modules.exam.bo.ExamApplyQueryBo" resultType="long">
-        SELECT count(*) FROM user_subscribe  where apply_id = #{applySiteId} and apply_site_start_time = #{startTime} and apply_site_end_time = #{endTime} and apply_site_exam_time = #{examTime} and apply_site_address = #{applySiteAddress} and subscribe_status = 1
+        SELECT count(*) FROM user_subscribe  where apply_id = #{applyId} and apply_site_start_time = #{startTime} and apply_site_end_time = #{endTime} and apply_site_exam_time = #{examTime} and apply_site_address = #{applySiteAddress} and subscribe_status = 1
     </select>
 
     <select id="siteTimeJson" parameterType="com.zhongzheng.modules.exam.bo.ExamApplyQueryBo" resultType="String">
         SELECT
-            site_time
+            e1.site_time
         FROM
             exam_apply_site_time e1
                 LEFT JOIN exam_apply_site ea ON e1.apply_site_id = ea.id