yangdamao 2 anni fa
parent
commit
7951e7f0bb

+ 1 - 1
zhongzheng-framework/src/main/java/com/zhongzheng/framework/web/service/WxLoginService.java

@@ -965,7 +965,7 @@ public class WxLoginService implements IWxLoginService {
         JSONObject obj = new JSONObject();
         obj.put("page", "pages5/mockExam/examApply");
         obj.put("scene",String.format("tid=%s",activityId));
-        obj.put("env_version","trial");
+        obj.put("env_version",enCodeVersion);
         String result = HttpUtils.sendPost(url, obj);
         if (result.contains("errcode")){
             List<String> codes = Arrays.asList("40001", "42001");

+ 41 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java

@@ -399,6 +399,25 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
         if (examUserApplyVo == null) {
             throw new CustomException("商品无考试计划,无需预约考试");
         }
+
+        //如果成绩已经出了,第2次约考需要等待15个工作日
+        UserSubscribe subscribe = iUserSubscribeService.getOne(new LambdaQueryWrapper<UserSubscribe>()
+                .eq(UserSubscribe::getUserId, bo.getUserId())
+                .eq(UserSubscribe::getGoodsId, bo.getGoodsId())
+                .eq(UserSubscribe::getSubscribeStatus, 1)
+                .eq(UserSubscribe::getOrderGoodsId, bo.getOrderGoodsId())
+                .eq(UserSubscribe::getResult, 2)
+                .orderByDesc(UserSubscribe::getCreateTime)
+                .last("limit 1"));
+        if (ObjectUtils.isNotNull(subscribe)) {
+            Long examTime = subscribe.getApplySiteExamTime();
+            //向后推15个工作日
+            Long applyEndTime = getApplyEndTime(examTime * 1000, 15);
+            if (DateUtils.getNowTime() < applyEndTime){
+                throw new CustomException("成绩审核中,请等待15个工作日后再预约!");
+            }
+        }
+
         ExamApplySite site = iExamApplySiteService
                 .getOne(new LambdaQueryWrapper<ExamApplySite>()
                 .eq(ExamApplySite::getApplyId, examUserApplyVo.getApplyId())
@@ -411,6 +430,28 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
         return examUserApplyVo;
     }
 
+    private Long getApplyEndTime(Long millisecond, Integer day) {
+        for (Integer i = 0; i < day; i++) {
+            Long dayAfter = DateUtils.getDayBefore(millisecond, 1);
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(DateUtils.timeToDate(dayAfter));
+            int index = calendar.get(Calendar.DAY_OF_WEEK) - 1;
+            String[] weeks = new String[]{"星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
+
+            if (weeks[index].equals("星期六") || weeks[index].equals("星期天")) {
+                day += 1;
+
+            }
+            //判断当前是否为工作日
+            if (!DateUtils.isWorkingDay(dayAfter)) {
+                day += 1;
+            }
+            millisecond = dayAfter;
+        }
+
+        return millisecond;
+    }
+
     @Override
     public Long subscribeNext(ExamApplyQueryBo bo) {
         //查看是否有无考试记录

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

@@ -33,6 +33,7 @@ import com.zhongzheng.modules.course.service.IMajorService;
 import com.zhongzheng.modules.exam.bo.ExamApplyQueryBo;
 import com.zhongzheng.modules.exam.bo.ExamApplySiteTimeJson;
 import com.zhongzheng.modules.exam.bo.ExamApplySiteTimeTwoAddBo;
+import com.zhongzheng.modules.exam.domain.ExamApply;
 import com.zhongzheng.modules.exam.domain.ExamApplySite;
 import com.zhongzheng.modules.exam.domain.ExamApplySiteTime;
 import com.zhongzheng.modules.exam.domain.ExamSite;
@@ -390,24 +391,25 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
                 iInformUserService.insertByAddBo(informUserAddBo);
             }
             if (informRemindVo.getNoteStatus().equals(1)) {
-                InformUserAddBo informUserAddBo = new InformUserAddBo();
-                informUserAddBo.setUserId(bo.getUserId());
-                informUserAddBo.setSendTime(DateUtils.getNowTime());
-                informUserAddBo.setSendStatus(1);
-                informUserAddBo.setCreateTime(DateUtils.getNowTime());
-                informUserAddBo.setUpdateTime(DateUtils.getNowTime());
-                informUserAddBo.setRemindId(informRemindVo.getId());
-                informUserAddBo.setSystemStatus(3);
-                informUserAddBo.setRemind("考试预约成功提醒");
-                informUserAddBo.setGoodsId(bo.getGoodsId());
-                GoodsVo goodsVo1 = iGoodsService.queryById(bo.getGoodsId());
-                informUserAddBo.setText("尊敬的用户:已成功预约施工现场专业人员" + goodsVo1.getGoodsName() + "考试");
-                content = "尊敬的用户:已成功预约施工现场专业人员" + goodsVo1.getGoodsName() + "考试";
-                iInformUserService.insertByAddBo(informUserAddBo);
-                UserVo userVo = iUserService.queryById(bo.getUserId());
-                Map<String, Object> param = new HashMap<>();
-                param.put("goods", goodsVo1.getGoodsName());
-                IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), reservationSuccess);
+                //暂时不发送短信
+//                InformUserAddBo informUserAddBo = new InformUserAddBo();
+//                informUserAddBo.setUserId(bo.getUserId());
+//                informUserAddBo.setSendTime(DateUtils.getNowTime());
+//                informUserAddBo.setSendStatus(1);
+//                informUserAddBo.setCreateTime(DateUtils.getNowTime());
+//                informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+//                informUserAddBo.setRemindId(informRemindVo.getId());
+//                informUserAddBo.setSystemStatus(3);
+//                informUserAddBo.setRemind("考试预约成功提醒");
+//                informUserAddBo.setGoodsId(bo.getGoodsId());
+//                GoodsVo goodsVo1 = iGoodsService.queryById(bo.getGoodsId());
+//                informUserAddBo.setText("尊敬的用户:已成功预约施工现场专业人员" + goodsVo1.getGoodsName() + "考试");
+//                content = "尊敬的用户:已成功预约施工现场专业人员" + goodsVo1.getGoodsName() + "考试";
+//                iInformUserService.insertByAddBo(informUserAddBo);
+//                UserVo userVo = iUserService.queryById(bo.getUserId());
+//                Map<String, Object> param = new HashMap<>();
+//                param.put("goods", goodsVo1.getGoodsName());
+//                IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), reservationSuccess);
             }
             if (informRemindVo.getGzhTpStatus().equals(1)) {
                 InformUserAddBo informUserAddBo = new InformUserAddBo();
@@ -428,9 +430,10 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
                 if(Validator.isNotEmpty(userVo.getOpenId())){
                     Map<String,String> paramMap = new HashMap<>();
                     paramMap.put("first","您已成功预约施工现场专业人员考试");
-                    paramMap.put("keyword1",goodsVo1.getGoodsName());
+                    ExamApply apply = iExamApplyService.getById(bo.getApplyId());
+                    paramMap.put("keyword1",apply.getApplyName());
                     paramMap.put("keyword2",DateUtils.getDate());
-                    paramMap.put("keyword3","已成功");
+                    paramMap.put("keyword3","已成功】考试当天请携带本人身份证提前30分钟到达考场。\n座位号:【号数】,\n考试地址:广州市天河区燕岭路123号建设大厦3楼 ,\n考试时间:2小时,\n考试形式:机考,\n考试成绩:提交试卷后即刻显示成绩,60分以上合格。带好随身物品即可离开考场。");
                     paramMap.put("remark","如您存在异议可联系学校老师进行核对。");
                     paramMap.put("pagepath","pages2/exam/exam_appointment?current=0");
                     iWxLoginService.sendQdySubStatusTpMsg(userVo.getOpenId(),paramMap);
@@ -746,7 +749,7 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
             };
             userSubscribeEditBo.setSubscribeId(s);
             //发送消息
-            sendExamcancel(userSubscribeEditBo);
+//            sendExamcancel(userSubscribeEditBo);
         }
 
         return this.updateById(update);