Jelajahi Sumber

fix 发布状态

he2802 3 tahun lalu
induk
melakukan
02cae0c70c

+ 24 - 18
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamNumberServiceImpl.java

@@ -142,26 +142,28 @@ public class ExamNumberServiceImpl extends ServiceImpl<ExamNumberMapper, ExamNum
             LambdaQueryWrapper<ExamNumberGoods> lqw = Wrappers.lambdaQuery();
             lqw.eq(ExamNumberGoods::getExamNumberId, bo.getExamNumberId());
             List<ExamNumberGoods> list = examNumberGoodsService.list(lqw);
-            for (ExamNumberGoods examNumberGoods : list) {
-                if (bo.getStatus() == -1) {
-                    Integer apply = baseMapper.selectApply(examNumberGoods.getGoodsId());
-                    if (apply > 0) {
-                        throw new IllegalArgumentException("当前商品已启用考试安排,不可删除");
+            if (!CollectionUtils.isEmpty(list)) {
+                for (ExamNumberGoods examNumberGoods : list) {
+                    if (bo.getStatus() == -1) {
+                        Integer apply = baseMapper.selectApply(examNumberGoods.getGoodsId());
+                        if (apply > 0) {
+                            throw new IllegalArgumentException("当前商品已启用考试安排,不可删除");
+                        }
+
+                        Integer applyBefore = baseMapper.selectApplyBefore(examNumberGoods.getGoodsId());
+                        if (applyBefore > 0) {
+                            throw new IllegalArgumentException("当前商品已启用前培安排,不可删除");
+                        }
                     }
-
-                    Integer applyBefore = baseMapper.selectApplyBefore(examNumberGoods.getGoodsId());
-                    if (applyBefore > 0) {
-                        throw new IllegalArgumentException("当前商品已启用前培安排,不可删除");
+                    Integer integer = baseMapper.selectExam(examNumberGoods.getGoodsId(), update.getExamNumberId());
+                    if (bo.getStatus() == 1 && integer > 0) {
+                        throw new IllegalArgumentException("当前商品已启用考次配置,不可开启,请重新创建新的配置考试次数和前培次数商品");
                     }
-                }
-                Integer integer = baseMapper.selectExam(examNumberGoods.getGoodsId(),update.getExamNumberId());
-                if (bo.getStatus() == 1 && integer > 0) {
-                    throw new IllegalArgumentException("当前商品已启用考次配置,不可开启,请重新创建新的配置考试次数和前培次数商品");
-                }
-                if (bo.getStatus()==0){
-                    Integer apply = baseMapper.selectApply(examNumberGoods.getGoodsId());
-                    if (apply > 0) {
-                        throw new IllegalArgumentException("当前商品已启用考试安排,不可关闭");
+                    if (bo.getStatus() == 0) {
+                        Integer apply = baseMapper.selectApply(examNumberGoods.getGoodsId());
+                        if (apply > 0) {
+                            throw new IllegalArgumentException("当前商品已启用考试安排,不可关闭");
+                        }
                     }
                 }
             }
@@ -186,6 +188,10 @@ public class ExamNumberServiceImpl extends ServiceImpl<ExamNumberMapper, ExamNum
                 if (apply > 0) {
                     throw new IllegalArgumentException("当前商品已启用考试安排,不可删除");
                 }
+                Integer applyBefore = baseMapper.selectApplyBefore(examNumberGoods.getGoodsId());
+                if (applyBefore > 0) {
+                    throw new IllegalArgumentException("当前商品已启用前培安排,不可删除");
+                }
             }
         }
         return this.updateById(update);

+ 12 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/vo/ExamUserApplyVo.java

@@ -56,6 +56,18 @@ public class ExamUserApplyVo {
 	@ApiModelProperty("身份证号")
 	private String idCard;
 
+	/** 身份证号 */
+	@ApiModelProperty("商品")
+	private Long goodsId;
+
+	/** 身份证号 */
+	@ApiModelProperty("班级")
+	private Long gradeId;
+
+	/** 身份证号 */
+	@ApiModelProperty("用户id")
+	private Long userId;
+
 	/** 1非补考学员 2补考学员 3都有 */
 	@Excel(name = "1非补考学员 2补考学员 ")
 	@ApiModelProperty("1非补考学员 2补考学员 ")

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/mapper/InformUserMapper.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.inform.mapper;
 
+import com.zhongzheng.modules.exam.vo.ExamUserApplyVo;
 import com.zhongzheng.modules.inform.bo.InformUserQueryBo;
 import com.zhongzheng.modules.inform.domain.InformUser;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -16,4 +17,6 @@ import java.util.List;
 public interface InformUserMapper extends BaseMapper<InformUser> {
 
     List<InformUserVo> queryUserList(InformUserQueryBo bo);
+
+    List<ExamUserApplyVo> listUserApply();
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/IInformUserService.java

@@ -1,5 +1,6 @@
 package com.zhongzheng.modules.inform.service;
 
+import com.zhongzheng.modules.exam.vo.ExamUserApplyVo;
 import com.zhongzheng.modules.inform.domain.InformUser;
 import com.zhongzheng.modules.inform.vo.InformUserVo;
 import com.zhongzheng.modules.inform.bo.InformUserQueryBo;
@@ -51,4 +52,6 @@ public interface IInformUserService extends IService<InformUser> {
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
     List<InformUserVo> queryUserList(InformUserQueryBo bo);
+
+    List<ExamUserApplyVo> listUserApply();
 }

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/impl/InformUserServiceImpl.java

@@ -3,6 +3,7 @@ package com.zhongzheng.modules.inform.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.exam.vo.ExamUserApplyVo;
 import com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo;
 import com.zhongzheng.modules.grade.mapper.ClassGradeUserMapper;
 import com.zhongzheng.modules.grade.vo.ClassGradeUserGoodsVo;
@@ -167,4 +168,9 @@ public class InformUserServiceImpl extends ServiceImpl<InformUserMapper, InformU
         }
         return informUserVos;
     }
+
+    @Override
+    public List<ExamUserApplyVo> listUserApply() {
+        return baseMapper.listUserApply();
+    }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/polyv/mapper/PolyvVideoMapper.java

@@ -1,9 +1,12 @@
 package com.zhongzheng.modules.polyv.mapper;
 
+import com.zhongzheng.modules.exam.vo.ExamUserApplyVo;
 import com.zhongzheng.modules.polyv.domain.PolyvVideo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.polyv.vo.PolyvVideoVo;
 
+import java.util.List;
+
 /**
  * 保利威视频信息Mapper接口
  *
@@ -13,4 +16,6 @@ import com.zhongzheng.modules.polyv.vo.PolyvVideoVo;
 public interface PolyvVideoMapper extends BaseMapper<PolyvVideo> {
 
     PolyvVideo selectByVID(String VId);
+
+    List<ExamUserApplyVo> listUserApply();
 }

+ 59 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java

@@ -18,6 +18,8 @@ import com.zhongzheng.common.utils.http.HttpUtils;
 import com.zhongzheng.common.utils.polyv.PolyvUtils;
 import com.zhongzheng.modules.base.service.IProfileTpService;
 import com.zhongzheng.modules.base.vo.ProfileTpVo;
+import com.zhongzheng.modules.base.vo.UserProfileVo;
+import com.zhongzheng.modules.exam.vo.ExamUserApplyVo;
 import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.service.IClassGradeGoodsService;
@@ -53,10 +55,8 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import java.io.IOException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.text.SimpleDateFormat;
+import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
@@ -113,6 +113,9 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
     @Value("${aliyun.sms.informationNotificationCode}")
     private String informationNotificationCode;
 
+    @Value("${aliyun.sms.bookingReminder}")
+    private String bookingReminder;
+
     @Override
     public String updateGoodsSend(UserQueryBo bo) {
         InformRemindVo informRemindVo = informRemindService.queryById(1L);
@@ -210,7 +213,59 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
         //
     }
 
+    public static void main(String[] args) {
+        String res;
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Long timeId = System.currentTimeMillis();
+        Date date = new Date(timeId);
+        res = simpleDateFormat.format(date);
+        System.out.println(res);
+    }
+
     private void sendExamSubscribe() {
+        List<ExamUserApplyVo> examUserApplyVos = iInformUserService.listUserApply();
+        for (ExamUserApplyVo examUserApplyVo : examUserApplyVos) {
+            InformRemindVo informRemindVo = informRemindService.queryById(13L);
+            String res;
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            Long timeId = examUserApplyVo.getApplyEndTime()*1000;
+            Date date = new Date(timeId);
+            res = simpleDateFormat.format(date);
+            if (informRemindVo.getWayStatus().equals(1)) {
+                InformUserAddBo informUserAddBo = new InformUserAddBo();
+                informUserAddBo.setUserId(examUserApplyVo.getUserId());
+                informUserAddBo.setSendStatus(1);
+                informUserAddBo.setSendTime(DateUtils.getNowTime());
+                informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                informUserAddBo.setRemindId(13L);
+                informUserAddBo.setSystemStatus(1);
+                informUserAddBo.setRemind("考试预约提醒");
+                informUserAddBo.setGoodsId(examUserApplyVo.getGoodsId());
+                GoodsVo goodsVo1 = iGoodsService.queryById(examUserApplyVo.getGoodsId());
+                informUserAddBo.setText("尊敬的用户:七大员新考考试预约已经开始,预约截至时间"+res+",请马上点击进行预约考试。");
+                iInformUserService.insertByAddBo(informUserAddBo);
+            }
+            if (informRemindVo.getNoteStatus().equals(1)) {
+                InformUserAddBo informUserAddBo = new InformUserAddBo();
+                informUserAddBo.setUserId(examUserApplyVo.getUserId());
+                informUserAddBo.setSendTime(DateUtils.getNowTime());
+                informUserAddBo.setSendStatus(1);
+                informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                informUserAddBo.setRemindId(13L);
+                informUserAddBo.setSystemStatus(3);
+                informUserAddBo.setRemind("考试预约提醒");
+                informUserAddBo.setGoodsId(examUserApplyVo.getGoodsId());
+                GoodsVo goodsVo1 = iGoodsService.queryById(examUserApplyVo.getGoodsId());
+                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);
+            }
 
+        }
     }
 }

+ 73 - 0
zhongzheng-system/src/main/resources/mapper/modules/inform/InformUserMapper.xml

@@ -25,6 +25,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="telPhone" column="telphone"/>
     </resultMap>
 
+    <resultMap type="com.zhongzheng.modules.exam.vo.ExamUserApplyVo" id="ExamUserApplyVo">
+        <result property="userId" column="user_id"/>
+        <result property="applyId" column="apply_id"/>
+        <result property="applyStatus" column="apply_status"/>
+        <result property="goodsId" column="goods_id"/>
+        <result property="applyEndTime" column="apply_end_time"/>
+        <result property="idCard" column="id_card"/>
+    </resultMap>
+
     <select id="queryUserList" parameterType="com.zhongzheng.modules.inform.bo.InformUserQueryBo" resultMap="InformUserVo">
         SELECT
             iu.id,
@@ -50,4 +59,68 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
               (SELECT count(cg.class_name) FROM class_grade_user cgu LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id where cgu.user_id=iu.user_id and cgu.`status`=1 and cg.`status`=1 and cg.class_name like concat('%', #{receiptName}, '%')) > 0)
         </if>
     </select>
+
+    <select id="listUserApply"  resultMap="ExamUserApplyVo">
+        SELECT
+        cgu.user_id,
+        ea.apply_id,
+        ea.apply_status,
+        cgg.goods_id,
+        cgg.grade_id,
+        ea.apply_end_time
+        FROM
+        exam_apply ea
+        LEFT JOIN exam_apply_goods eag on ea.apply_id = eag.apply_id
+        LEFT JOIN class_grade_goods cgg on cgg.goods_id=eag.goods_id
+        LEFT JOIN class_grade_user cgu on cgg.grade_id = cgu.grade_id
+        LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
+        WHERE
+        ea.`status` =1
+        AND cg.`status`=1
+        and cgu.period_status =1
+        AND (SELECT count(1) FROM inform_user iu where iu.goods_id = cgg.goods_id and iu.remind_id=13 and cgu.user_id = iu.user_id) &lt; 1
+        AND  ea.apply_status='1'
+        AND (SELECT COUNT(1) FROM user_subscribe us where us.apply_id = ea.apply_id and us.user_id = cgu.user_id and us.subscribe_status=1) &lt; 1
+        UNION
+        SELECT
+        cgu.user_id,
+        ea.apply_id,
+        ea.apply_status,
+        cgg.goods_id,
+        cgg.grade_id,
+        ea.apply_end_time
+        FROM
+        exam_apply ea
+        LEFT JOIN exam_apply_goods eag on ea.apply_id = eag.apply_id
+        LEFT JOIN class_grade_goods cgg on cgg.goods_id=eag.goods_id
+        LEFT JOIN class_grade_user cgu on cgg.grade_id = cgu.grade_id
+        LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
+        WHERE
+        ea.`status` =1
+        and cgu.period_status =1
+        AND cg.`status`=1
+        AND (SELECT count(1) FROM inform_user iu where iu.goods_id = cgg.goods_id and iu.remind_id=13 and cgu.user_id = iu.user_id) &lt; 1
+        AND  ea.apply_status='1,2'
+        UNION
+        SELECT
+        cgu.user_id,
+        ea.apply_id,
+        ea.apply_status,
+        cgg.goods_id,
+        cgg.grade_id,
+        ea.apply_end_time
+        FROM
+        exam_apply ea
+        LEFT JOIN exam_apply_goods eag on ea.apply_id = eag.apply_id
+        LEFT JOIN class_grade_goods cgg on cgg.goods_id=eag.goods_id
+        LEFT JOIN class_grade_user cgu on cgg.grade_id = cgu.grade_id
+        LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
+        WHERE
+        ea.`status` =1
+        AND cg.`status`=1
+        and cgu.period_status =1
+        AND (SELECT count(1) FROM inform_user iu where iu.goods_id = cgg.goods_id and iu.remind_id=13 and cgu.user_id = iu.user_id) &lt; 1
+        AND  ea.apply_status='2'
+        AND (SELECT COUNT(1) FROM user_subscribe us where us.apply_id = ea.apply_id and us.user_id = cgu.user_id and us.exam_status in (2,3,4) and us.exam_status != 1) > 0
+        </select>
 </mapper>