Browse Source

资料审核

change 3 years ago
parent
commit
e0d1c11bc9
17 changed files with 658 additions and 49 deletions
  1. 13 1
      zhongzheng-admin/src/main/java/com/zhongzheng/controller/schedule/ScheduleController.java
  2. 2 0
      zhongzheng-api/src/main/resources/application.yml
  3. 90 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java
  4. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/mapper/ClassGradeMapper.java
  5. 119 30
      zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java
  6. 1 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/service/impl/InformUserServiceImpl.java
  7. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/IScheduleService.java
  8. 64 9
      zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java
  9. 6 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserSubscribeMapper.java
  10. 2 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserSubscribeService.java
  11. 260 4
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserSubscribeServiceImpl.java
  12. 5 0
      zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserSubscribeVo.java
  13. 21 1
      zhongzheng-system/src/main/java/com/zhongzheng/modules/wx/service/impl/WxPayServiceImpl.java
  14. 1 0
      zhongzheng-system/src/main/resources/mapper/modules/course/CourseMapper.xml
  15. 21 0
      zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeMapper.xml
  16. 8 2
      zhongzheng-system/src/main/resources/mapper/modules/inform/InformUserMapper.xml
  17. 38 1
      zhongzheng-system/src/main/resources/mapper/modules/user/UserSubscribeMapper.xml

+ 13 - 1
zhongzheng-admin/src/main/java/com/zhongzheng/controller/schedule/ScheduleController.java

@@ -42,11 +42,23 @@ public class ScheduleController extends BaseController {
      * 考试提醒
      * @return
      */
-    @ApiOperation("考试提醒")
+    @ApiOperation("考试预约提醒")
     @GetMapping("/updateExamSend")
     public AjaxResult updateExamSend(UserQueryBo bo) {
         iScheduleService.updateExamSend(bo);
         return AjaxResult.success();
     }
 
+
+    /**
+     * 考试提醒
+     * @return
+     */
+    @ApiOperation("每天10点请求的考试提醒")
+    @GetMapping("/timeSend")
+    public AjaxResult timeSend(UserQueryBo bo) {
+        iScheduleService.timeSend(bo);
+        return AjaxResult.success();
+    }
+
 }

+ 2 - 0
zhongzheng-api/src/main/resources/application.yml

@@ -286,3 +286,5 @@ aliyun:
     OverdueReminder: SMS_230980259  #班级过期提醒
     OverdueReminderHave: SMS_230965228  #班级过期提醒有学习次数
     planReminder: SMS_230970248     #学习计划提醒
+    commitmentCode: SMS_231190546     #承诺书审核通过通知
+    commitmentFailsCode: SMS_231215516     #承诺书审核不通过通知

+ 90 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java

@@ -94,6 +94,12 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
     @Value("${aliyun.sms.NotificationOfFailureCode}")
     private String NotificationOfFailureCode;
 
+    @Value("${aliyun.sms.commitmentCode}")
+    private String commitmentCode;
+
+    @Value("${aliyun.sms.commitmentFailsCode}")
+    private String commitmentFailsCode;
+
     @Override
     public UserProfileVo queryById(Long id){
         UserProfileQueryBo userProfileQueryBo = new UserProfileQueryBo();
@@ -237,10 +243,93 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
         update.setUpdateTime(DateUtils.getNowTime());
         update.setAuditTime(DateUtils.getNowTime());
         update.setChangeStatus(1);
-        sendAuidit(update);
+
+        UserProfileVo userProfileVo = this.queryById(bo.getId());
+        if (userProfileVo.getTypeStatus().equals(1)){
+            sendAuidit(update);
+        }else if (userProfileVo.getTypeStatus().equals(2)){
+            sendAuiditSMS(update);
+        }
         return this.updateById(update);
     }
 
+    private void sendAuiditSMS(UserProfile bo) {
+        UserProfileVo userProfileVo = this.queryById(bo.getId());
+        if (bo.getStatus().equals(1)) {
+            InformRemindVo informRemindVo = informRemindService.queryById(23L);
+            if (informRemindVo.getWayStatus().equals(1)) {
+                InformUserAddBo informUserAddBo = new InformUserAddBo();
+                informUserAddBo.setUserId(userProfileVo.getUserId());
+                informUserAddBo.setSendStatus(1);
+                informUserAddBo.setSendTime(DateUtils.getNowTime());
+                informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                informUserAddBo.setRemindId(23L);
+                informUserAddBo.setSystemStatus(1);
+                informUserAddBo.setRemind("资料审核通过通知");
+                informUserAddBo.setGoodsId(userProfileVo.getGoodsId());
+                GoodsVo goodsVo1 = iGoodsService.queryById(userProfileVo.getGoodsId());
+                informUserAddBo.setText("尊敬的用户:您上传"+goodsVo1.getGoodsName()+"课程的承诺书审核成功");
+                iInformUserService.insertByAddBo(informUserAddBo);
+            }
+            if (informRemindVo.getNoteStatus().equals(1)){
+                InformUserAddBo informUserAddBo = new InformUserAddBo();
+                informUserAddBo.setUserId(userProfileVo.getUserId());
+                informUserAddBo.setSendTime(DateUtils.getNowTime());
+                informUserAddBo.setSendStatus(1);
+                informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                informUserAddBo.setRemindId(23L);
+                informUserAddBo.setSystemStatus(3);
+                informUserAddBo.setRemind("资料审核通过通知");
+                informUserAddBo.setGoodsId(userProfileVo.getGoodsId());
+                GoodsVo goodsVo1 = iGoodsService.queryById(userProfileVo.getGoodsId());
+                informUserAddBo.setText("尊敬的用户:您上传"+goodsVo1.getGoodsName()+"课程的承诺书审核成功");
+                iInformUserService.insertByAddBo(informUserAddBo);
+                UserVo userVo = iUserService.queryById(userProfileVo.getUserId());
+                Map<String, Object> param = new HashMap<>();
+                param.put("goods", goodsVo1.getGoodsName());
+                IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), commitmentCode);
+            }
+        }else {
+            InformRemindVo informRemindTwoVo = informRemindService.queryById(24L);
+            if (informRemindTwoVo.getWayStatus().equals(1)) {
+                InformUserAddBo informUserAddBo = new InformUserAddBo();
+                informUserAddBo.setUserId(userProfileVo.getUserId());
+                informUserAddBo.setSendStatus(1);
+                informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                informUserAddBo.setSendTime(DateUtils.getNowTime());
+                informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                informUserAddBo.setRemindId(24L);
+                informUserAddBo.setSystemStatus(1);
+                informUserAddBo.setRemind("资料审核不通过通知");
+                informUserAddBo.setGoodsId(userProfileVo.getGoodsId());
+                GoodsVo goodsVo1 = iGoodsService.queryById(userProfileVo.getGoodsId());
+                informUserAddBo.setText("尊敬的用户:您上传"+goodsVo1.getGoodsName()+"课程的承诺书审核不通过,请重新完善吧");
+                iInformUserService.insertByAddBo(informUserAddBo);
+            }
+            if (informRemindTwoVo.getNoteStatus().equals(1)){
+                InformUserAddBo informUserAddBo = new InformUserAddBo();
+                informUserAddBo.setUserId(userProfileVo.getUserId());
+                informUserAddBo.setSendTime(DateUtils.getNowTime());
+                informUserAddBo.setSendStatus(1);
+                informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                informUserAddBo.setRemindId(24L);
+                informUserAddBo.setSystemStatus(3);
+                informUserAddBo.setRemind("资料审核不通过通知");
+                informUserAddBo.setGoodsId(userProfileVo.getGoodsId());
+                GoodsVo goodsVo1 = iGoodsService.queryById(userProfileVo.getGoodsId());
+                informUserAddBo.setText("尊敬的用户:您上传"+goodsVo1.getGoodsName()+"课程的承诺书审核不通过,请重新完善吧");
+                iInformUserService.insertByAddBo(informUserAddBo);
+                UserVo userVo = iUserService.queryById(userProfileVo.getUserId());
+                Map<String, Object> param = new HashMap<>();
+                param.put("goods", goodsVo1.getGoodsName());
+                IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), commitmentFailsCode);
+            }
+        }
+    }
+
     private void sendAuidit(UserProfile bo) {
         UserProfileVo userProfileVo = this.queryById(bo.getId());
         if (bo.getStatus().equals(1)) {

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/mapper/ClassGradeMapper.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.grade.vo.ClassGradeStudentVo;
 import com.zhongzheng.modules.grade.vo.ClassGradeUserListVo;
 import com.zhongzheng.modules.grade.vo.ClassGradeVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.Collection;
 import java.util.List;
@@ -32,4 +33,8 @@ public interface ClassGradeMapper extends BaseMapper<ClassGrade> {
     List<ClassGradeStudentVo> listGradeStudy(ClassGradeQueryBo bo);
 
     List<ClassGradeStudentVo> listGradeService(Long id);
+
+    Long querClassSMS(@Param("gradeId") Long gradeId,@Param("businessId") Long businessId);
+
+    List<Long> queryUser(Long gradeId);
 }

+ 119 - 30
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -3,11 +3,13 @@ package com.zhongzheng.modules.grade.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.SecurityUtils;
 import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.modules.alisms.service.IAliSmsService;
 import com.zhongzheng.modules.course.bo.CourseBusinessQueryBo;
 import com.zhongzheng.modules.course.bo.CourseEducationTypeQueryBo;
 import com.zhongzheng.modules.course.bo.CourseProjectTypeQueryBo;
@@ -27,15 +29,23 @@ import com.zhongzheng.modules.grade.service.IClassGradeUserService;
 import com.zhongzheng.modules.grade.vo.ClassGradeStudentVo;
 import com.zhongzheng.modules.grade.vo.ClassGradeUserListVo;
 import com.zhongzheng.modules.grade.vo.ClassGradeUserVo;
+import com.zhongzheng.modules.inform.bo.InformUserAddBo;
+import com.zhongzheng.modules.inform.service.IInformRemindService;
+import com.zhongzheng.modules.inform.service.IInformUserService;
+import com.zhongzheng.modules.inform.vo.InformRemindBusinessVo;
+import com.zhongzheng.modules.inform.vo.InformRemindVo;
 import com.zhongzheng.modules.system.domain.SysConfig;
 import com.zhongzheng.modules.user.bo.SubjectStudyRecordQueryBo;
 import com.zhongzheng.modules.user.bo.UserUpdateQueryBo;
 import com.zhongzheng.modules.user.domain.SchoolProject;
 import com.zhongzheng.modules.user.domain.UserUpdate;
+import com.zhongzheng.modules.user.service.IUserService;
 import com.zhongzheng.modules.user.service.IUserStudyRecordService;
 import com.zhongzheng.modules.user.service.IUserUpdateService;
 import com.zhongzheng.modules.user.vo.SubjectStudyRecordVo;
+import com.zhongzheng.modules.user.vo.UserVo;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -48,10 +58,8 @@ import com.zhongzheng.modules.grade.service.IClassGradeService;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
+import java.text.SimpleDateFormat;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -64,7 +72,7 @@ import java.util.stream.Collectors;
 public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGrade> implements IClassGradeService {
 
     @Autowired
-    private  IGoodsService iGoodsService;
+    private IGoodsService iGoodsService;
 
     @Autowired
     private ICourseEducationTypeService courseEducationTypeService;
@@ -90,8 +98,23 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
     @Autowired
     private IUserUpdateService iUserUpdateService;
 
+    @Autowired
+    private IInformRemindService informRemindService;
+
+    @Autowired
+    private IInformUserService iInformUserService;
+
+    @Autowired
+    private IUserService iUserService;
+
+    @Autowired
+    private com.zhongzheng.modules.alisms.service.IAliSmsService IAliSmsService;
+
+    @Value("${aliyun.sms.classRemind}")
+    private String classRemind;
+
     @Override
-    public ClassGradeVo queryById(Long gradeId){
+    public ClassGradeVo queryById(Long gradeId) {
         ClassGradeQueryBo classGradeQueryBo = new ClassGradeQueryBo();
         classGradeQueryBo.setGradeId(gradeId);
         return entity2Vo(baseMapper.queryList(classGradeQueryBo)).get(0);
@@ -103,24 +126,24 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
     }
 
     /**
-    * 实体类转化成视图对象
-    *
-    * @param collection 实体类集合
-    * @return
-    */
+     * 实体类转化成视图对象
+     *
+     * @param collection 实体类集合
+     * @return
+     */
     private List<ClassGradeVo> entity2Vo(Collection<ClassGradeVo> collection) {
         List<ClassGradeVo> voList = collection.stream()
                 .map(any -> BeanUtil.toBean(any, ClassGradeVo.class))
                 .collect(Collectors.toList());
         if (collection instanceof Page) {
-            Page<ClassGradeVo> page = (Page<ClassGradeVo>)collection;
+            Page<ClassGradeVo> page = (Page<ClassGradeVo>) collection;
             Page<ClassGradeVo> pageVo = new Page<>();
-            BeanUtil.copyProperties(page,pageVo);
+            BeanUtil.copyProperties(page, pageVo);
             pageVo.addAll(voList);
             voList = pageVo;
         }
         for (ClassGradeVo classGradeVo : voList) {
-            List<GoodsVo> goodsVoList=baseMapper.queryGoodsList(classGradeVo.getGradeId());
+            List<GoodsVo> goodsVoList = baseMapper.queryGoodsList(classGradeVo.getGradeId());
             classGradeVo.setGoodsList(goodsVoList);
         }
         return voList;
@@ -138,11 +161,11 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         lqw.eq(ClassGrade::getClassName, add.getClassName());
         lqw.eq(ClassGrade::getStatus, 1);
         List<ClassGrade> list = this.list(lqw);
-        if (CollectionUtils.isNotEmpty(list)){
+        if (CollectionUtils.isNotEmpty(list)) {
             throw new RuntimeException("班级名称不能重复");
         }
         boolean save = this.save(add);
-        if (bo.getClassGradeGoodsAddBos() != null){
+        if (bo.getClassGradeGoodsAddBos() != null) {
             for (Long classGradeGoodsAddBo : bo.getClassGradeGoodsAddBos()) {
                 ClassGradeGoods classGradeGoods = new ClassGradeGoods();
                 classGradeGoods.setGradeId(add.getGradeId());
@@ -152,7 +175,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                 classGradeGoodsService.save(classGradeGoods);
             }
         }
-        if (bo.getSysUserId() != null){
+        if (bo.getSysUserId() != null) {
             ClassGradeSys classGradeSys = new ClassGradeSys();
             classGradeSys.setGradeId(add.getGradeId());
             classGradeSys.setCreateBy(SecurityUtils.getUsername());
@@ -185,25 +208,25 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                 lqw.eq(ClassGrade::getClassName, update.getClassName());
                 lqw.eq(ClassGrade::getStatus, 1);
                 List<ClassGrade> classList = this.list(lqw);
-                if (CollectionUtils.isNotEmpty(classList)){
+                if (CollectionUtils.isNotEmpty(classList)) {
                     throw new RuntimeException("班级名称不能重复");
                 }
             }
         }
-        if (bo.getSysUserId() != null){
+        if (bo.getSysUserId() != null) {
             LambdaQueryWrapper<ClassGradeSys> lqw = new LambdaQueryWrapper<>();
-            lqw.like(ClassGradeSys::getGradeId,bo.getGradeId());
-            lqw.like(ClassGradeSys::getSysUserId,bo.getSysUserId());
-            lqw.like(ClassGradeSys::getStatus,1);
-            if (CollectionUtils.isEmpty(classGradeSysService.list(lqw))){
+            lqw.like(ClassGradeSys::getGradeId, bo.getGradeId());
+            lqw.like(ClassGradeSys::getSysUserId, bo.getSysUserId());
+            lqw.like(ClassGradeSys::getStatus, 1);
+            if (CollectionUtils.isEmpty(classGradeSysService.list(lqw))) {
                 lqw.clear();
-                lqw.like(ClassGradeSys::getGradeId,bo.getGradeId());
-                lqw.like(ClassGradeSys::getStatus,1);
+                lqw.like(ClassGradeSys::getGradeId, bo.getGradeId());
+                lqw.like(ClassGradeSys::getStatus, 1);
                 ClassGradeSys classGradeSys1 = new ClassGradeSys();
                 classGradeSys1.setStatus(0);
                 classGradeSys1.setEndTime(DateUtils.getNowTime());
                 classGradeSys1.setUpdateTime(DateUtils.getNowTime());
-                classGradeSysService.update(classGradeSys1,lqw);
+                classGradeSysService.update(classGradeSys1, lqw);
 
                 ClassGradeSys classGradeSys = new ClassGradeSys();
                 classGradeSys.setGradeId(bo.getGradeId());
@@ -216,21 +239,87 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                 classGradeSysService.save(classGradeSys);
             }
         }
+        ClassGradeVo classGradeVo = this.queryById(bo.getGradeId());
+        if (update.getClassStatus() != null && update.getClassStatus().equals(1) && (classGradeVo.getClassStatus() == null || classGradeVo.getClassStatus().equals(0))) {
+            sendClassSMS(classGradeVo);
+        }
         return this.updateById(update);
     }
 
+    private void sendClassSMS(ClassGradeVo classGradeVo) {
+        InformRemindVo informRemindVo = informRemindService.queryById(19L);
+        if (CollectionUtils.isEmpty(classGradeVo.getGoodsList())){
+            return;
+        }
+        if (!CollectionUtils.isEmpty(informRemindVo.getInformRemindBusiness())) {
+            Long businessId = 0L;
+            for (InformRemindBusinessVo informRemindBusiness : informRemindVo.getInformRemindBusiness()) {
+                businessId += baseMapper.querClassSMS(classGradeVo.getGradeId(), informRemindBusiness.getBusinessId());
+            }
+            String endTime;
+            String startTime;
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            Long timeId = classGradeVo.getClassEndTime()*1000;
+            Date date = new Date(timeId);
+            endTime = simpleDateFormat.format(date);
+            Long timeSId = classGradeVo.getClassEndTime()*1000;
+            Date dateS = new Date(timeSId);
+            startTime = simpleDateFormat.format(dateS);
+            List<Long> userIds = baseMapper.queryUser(classGradeVo.getGradeId());
+            if (businessId > 0) {
+                for (Long userId : userIds) {
+                    if (informRemindVo.getWayStatus().equals(1)) {
+                        InformUserAddBo informUserAddBo = new InformUserAddBo();
+                        informUserAddBo.setUserId(userId);
+                        informUserAddBo.setSendStatus(1);
+                        informUserAddBo.setSendTime(DateUtils.getNowTime());
+                        informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                        informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                        informUserAddBo.setRemindId(19L);
+                        informUserAddBo.setSystemStatus(1);
+                        informUserAddBo.setRemind("二建继教开班提醒");
+                        informUserAddBo.setGoodsId(classGradeVo.getGoodsList().get(0).getGoodsId());
+                        GoodsVo goodsVo1 = iGoodsService.queryById(classGradeVo.getGoodsList().get(0).getGoodsId());
+                        informUserAddBo.setText("尊敬的用户:您购买的"+goodsVo1+"课程已开班,班级有效期为"+startTime+"至"+endTime+",请及时完成学习,如过期未完成学习,则需要重新购买学习,马上点击“立即学习”进行学习。");
+                        iInformUserService.insertByAddBo(informUserAddBo);
+                    }
+                    if (informRemindVo.getNoteStatus().equals(1)) {
+                        InformUserAddBo informUserAddBo = new InformUserAddBo();
+                        informUserAddBo.setUserId(userId);
+                        informUserAddBo.setSendTime(DateUtils.getNowTime());
+                        informUserAddBo.setSendStatus(1);
+                        informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                        informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                        informUserAddBo.setRemindId(19L);
+                        informUserAddBo.setSystemStatus(3);
+                        informUserAddBo.setRemind("二建继教开班提醒");
+                        informUserAddBo.setGoodsId(classGradeVo.getGoodsList().get(0).getGoodsId());
+                        GoodsVo goodsVo1 = iGoodsService.queryById(classGradeVo.getGoodsList().get(0).getGoodsId());
+                        informUserAddBo.setText("尊敬的用户:您购买的"+goodsVo1+"课程已开班,班级有效期为"+startTime+"至"+endTime+",请及时完成学习,如过期未完成学习,则需要重新购买学习,马上点击“立即学习”进行学习。");
+                        iInformUserService.insertByAddBo(informUserAddBo);
+                        UserVo userVo = iUserService.queryById(userId);
+                        Map<String, Object> param = new HashMap<>();
+                        param.put("goods", goodsVo1.getGoodsName());
+                        param.put("time", startTime+"至"+endTime);
+                        IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), classRemind);
+                    }
+                }
+            }
+        }
+    }
+
     /**
      * 保存前的数据校验
      *
      * @param entity 实体类数据
      */
-    private void validEntityBeforeSave(ClassGrade entity){
+    private void validEntityBeforeSave(ClassGrade entity) {
         //TODO 做一些数据校验,如唯一约束
     }
 
     @Override
     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
-        if(isValid){
+        if (isValid) {
             //TODO 做一些业务上的校验,判断是否需要校验
         }
         return this.removeByIds(ids);
@@ -269,7 +358,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
         ClassGradeQueryBo classGradeQueryBo = new ClassGradeQueryBo();
         classGradeQueryBo.setGradeId(bo.getGradeId());
         ClassGradeVo classGradeVo = entity2Vo(baseMapper.queryList(classGradeQueryBo)).get(0);
-        if ((classGradeVo.getStudentUpper() - classGradeVo.getStudentNum()) < bo.getUserId().length){
+        if ((classGradeVo.getStudentUpper() - classGradeVo.getStudentNum()) < bo.getUserId().length) {
             throw new IllegalArgumentException("当前班级超出上限,不允许添加这么多学员");
         }
         for (Long aLong : bo.getUserId()) {
@@ -281,7 +370,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
             status.add(1);
             classGradeUserQueryBo.setStatus(status);
             List<ClassGradeUserVo> classGradeUserVos = iClassGradeUserService.queryList(classGradeUserQueryBo);
-            if (CollectionUtils.isNotEmpty(classGradeUserVos)){
+            if (CollectionUtils.isNotEmpty(classGradeUserVos)) {
                 continue;
             }
             //进入班级

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

@@ -83,6 +83,7 @@ public class InformUserServiceImpl extends ServiceImpl<InformUserMapper, InformU
         lqw.eq(bo.getSendStatus() != null, InformUser::getSendStatus, bo.getSendStatus());
         lqw.eq(bo.getReceiptStatus() != null, InformUser::getReceiptStatus, bo.getReceiptStatus());
         lqw.in( InformUser::getSystemStatus, status);
+        lqw.orderByDesc(InformUser::getSendTime);
         List<InformUserVo> informUserVos = entity2Vo(this.list(lqw));
         for (InformUserVo informUserVo : informUserVos) {
             if (informUserVo.getSystemStatus() == 2) {

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/IScheduleService.java

@@ -25,4 +25,6 @@ public interface IScheduleService extends IService<PolyvVideo> {
     String updateGoodsSend(UserQueryBo bo);
 
     void updateExamSend(UserQueryBo bo);
+
+    void timeSend(UserQueryBo bo);
 }

+ 64 - 9
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java

@@ -46,7 +46,10 @@ import com.zhongzheng.modules.polyv.vo.PolyvVideoVo;
 import com.zhongzheng.modules.polyv.vo.PolyvVo;
 import com.zhongzheng.modules.schedule.service.IScheduleService;
 import com.zhongzheng.modules.user.bo.UserQueryBo;
+import com.zhongzheng.modules.user.domain.UserSubscribe;
 import com.zhongzheng.modules.user.service.IUserService;
+import com.zhongzheng.modules.user.service.IUserSubscribeService;
+import com.zhongzheng.modules.user.vo.UserSubscribeVo;
 import com.zhongzheng.modules.user.vo.UserVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -107,6 +110,9 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
     @Autowired
     private IUserService iUserService;
 
+    @Autowired
+    private IUserSubscribeService iUserSubscribeService;
+
     @Value("${aliyun.sms.OpenTheGoodsCode}")
     private String OpenTheGoodsCode;
 
@@ -116,6 +122,9 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
     @Value("${aliyun.sms.bookingReminder}")
     private String bookingReminder;
 
+    @Value("${aliyun.sms.examinationRemind}")
+    private String examinationRemind;
+
     @Override
     public String updateGoodsSend(UserQueryBo bo) {
         InformRemindVo informRemindVo = informRemindService.queryById(1L);
@@ -210,18 +219,63 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
         //新考预约提醒
         sendExamSubscribe();
 
-        //
+
     }
 
-    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);
+    @Override
+    public void timeSend(UserQueryBo bo) {
+        List<UserSubscribeVo> userSubscribeVo = iUserSubscribeService.timeSend();
+        InformRemindVo informRemindVo = informRemindService.queryById(16L);
+        for (UserSubscribeVo subscribeVo : userSubscribeVo) {
+            String res;
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            Long timeId = subscribeVo.getApplySiteExamTime()*1000;
+            Date date = new Date(timeId);
+            res = simpleDateFormat.format(date);
+            String startTime = subscribeVo.getApplySiteStartTime().replace("-", ":");
+            String endTime = subscribeVo.getApplySiteEndTime().replace("-", ":");
+            if (informRemindVo.getWayStatus().equals(1)) {
+                InformUserAddBo informUserAddBo = new InformUserAddBo();
+                informUserAddBo.setUserId(subscribeVo.getUserId());
+                informUserAddBo.setSendStatus(1);
+                informUserAddBo.setSendTime(DateUtils.getNowTime());
+                informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                informUserAddBo.setRemindId(16L);
+                informUserAddBo.setSystemStatus(1);
+                informUserAddBo.setRemind("考试提醒");
+                informUserAddBo.setGoodsId(subscribeVo.getGoodsId());
+                GoodsVo goodsVo1 = iGoodsService.queryById(subscribeVo.getGoodsId());
+                informUserAddBo.setText("尊敬的用户:您预约的施工现场专业人员"+goodsVo1.getGoodsName()+"考试将在"+res+"("+startTime+"-"+endTime+")进行," +
+                        "考试地点:"+subscribeVo.getApplySiteAddress()+"");
+                iInformUserService.insertByAddBo(informUserAddBo);
+            }
+            if (informRemindVo.getNoteStatus().equals(1)){
+                InformUserAddBo informUserAddBo = new InformUserAddBo();
+                informUserAddBo.setUserId(subscribeVo.getUserId());
+                informUserAddBo.setSendTime(DateUtils.getNowTime());
+                informUserAddBo.setSendStatus(1);
+                informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                informUserAddBo.setRemindId(3L);
+                informUserAddBo.setSystemStatus(3);
+                informUserAddBo.setRemind("考试提醒");
+                informUserAddBo.setGoodsId(subscribeVo.getGoodsId());
+                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", startTime+"-"+endTime);
+                param.put("address", subscribeVo.getApplySiteAddress());
+                IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), examinationRemind);
+            }
+        }
     }
 
+
     private void sendExamSubscribe() {
         List<ExamUserApplyVo> examUserApplyVos = iInformUserService.listUserApply();
         for (ExamUserApplyVo examUserApplyVo : examUserApplyVos) {
@@ -242,6 +296,7 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                 informUserAddBo.setSystemStatus(1);
                 informUserAddBo.setRemind("考试预约提醒");
                 informUserAddBo.setGoodsId(examUserApplyVo.getGoodsId());
+                informUserAddBo.setGradeId(examUserApplyVo.getGradeId());
                 GoodsVo goodsVo1 = iGoodsService.queryById(examUserApplyVo.getGoodsId());
                 informUserAddBo.setText("尊敬的用户:七大员新考考试预约已经开始,预约截至时间"+res+",请马上点击进行预约考试。");
                 iInformUserService.insertByAddBo(informUserAddBo);
@@ -258,6 +313,7 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                 informUserAddBo.setRemind("考试预约提醒");
                 informUserAddBo.setGoodsId(examUserApplyVo.getGoodsId());
                 GoodsVo goodsVo1 = iGoodsService.queryById(examUserApplyVo.getGoodsId());
+                informUserAddBo.setGradeId(examUserApplyVo.getGradeId());
                 informUserAddBo.setText("尊敬的用户:七大员新考考试预约已经开始,预约截至时间"+res+",请马上点击进行预约考试。");
                 iInformUserService.insertByAddBo(informUserAddBo);
                 UserVo userVo = iUserService.queryById(examUserApplyVo.getUserId());
@@ -265,7 +321,6 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                 param.put("time", res);
                 IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), bookingReminder);
             }
-
         }
     }
 }

+ 6 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserSubscribeMapper.java

@@ -27,4 +27,10 @@ public interface UserSubscribeMapper extends BaseMapper<UserSubscribe> {
     Long selectApplyId(String applyName);
 
     Long selectSubscribeId(@Param("applyId") Long applyId,@Param("goodsId") Long goodsId,@Param("userId")  Long userId);
+
+    Long queryBusinessId(@Param("subscribeId")Long subscribeId,@Param("businessId")Long businessId);
+
+    List<UserSubscribeVo> timeSend();
+
+    Long sendExamSucceed(Long goodsId);
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserSubscribeService.java

@@ -58,4 +58,6 @@ public interface IUserSubscribeService extends IService<UserSubscribe> {
 	List<UserSubscribeImport> importData(List<UserSubscribeImport> userSubscribeImportList);
 
 	List<UserSubscribeImport> importUpdateData(List<UserSubscribeImport> userSubscribeImportList);
+
+	List<UserSubscribeVo> timeSend();
 }

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

@@ -3,14 +3,27 @@ package com.zhongzheng.modules.user.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.alisms.service.IAliSmsService;
 import com.zhongzheng.modules.exam.mapper.ExamApplyMapper;
 import com.zhongzheng.modules.exam.vo.ExamApplySiteTimeVo;
 import com.zhongzheng.modules.exam.vo.ExamApplySiteVo;
+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.inform.bo.InformUserAddBo;
+import com.zhongzheng.modules.inform.service.IInformRemindService;
+import com.zhongzheng.modules.inform.service.IInformUserService;
+import com.zhongzheng.modules.inform.vo.InformRemindBusinessVo;
+import com.zhongzheng.modules.inform.vo.InformRemindVo;
 import com.zhongzheng.modules.user.bo.*;
+import com.zhongzheng.modules.user.service.IUserService;
 import com.zhongzheng.modules.user.vo.UserSubscribeImport;
+import com.zhongzheng.modules.user.vo.UserVo;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -23,10 +36,8 @@ import com.zhongzheng.modules.user.service.IUserSubscribeService;
 import org.springframework.transaction.annotation.Transactional;
 import org.thymeleaf.util.StringUtils;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
+import java.text.SimpleDateFormat;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -41,6 +52,33 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
     @Autowired
     private ExamApplyMapper examApplyMapper;
 
+    @Autowired
+    private IInformRemindService informRemindService;
+
+    @Autowired
+    private IGoodsService iGoodsService;
+
+    @Autowired
+    private IInformUserService iInformUserService;
+
+    @Autowired
+    private IUserService iUserService;
+
+    @Value("${aliyun.sms.cancellationReminder}")
+    private String cancellationReminder;
+
+    @Value("${aliyun.sms.reservationSuccess}")
+    private String reservationSuccess;
+
+    @Value("${aliyun.sms.newExamPass}")
+    private String newExamPass;
+
+    @Value("${aliyun.sms.newExamFail}")
+    private String newExamFail;
+
+    @Autowired
+    private com.zhongzheng.modules.alisms.service.IAliSmsService IAliSmsService;
+
     @Override
     public UserSubscribeVo queryById(Long subscribeId) {
         UserSubscribe db = this.baseMapper.selectById(subscribeId);
@@ -94,9 +132,52 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
         add.setCreateTime(DateUtils.getNowTime());
         add.setUpdateTime(DateUtils.getNowTime());
         this.save(add);
+        sendExamSucceed(bo);
         return add.getSubscribeId();
     }
 
+    private void sendExamSucceed(UserSubscribeAddBo bo) {
+        InformRemindVo informRemindVo = informRemindService.queryById(15L);
+        Long count = baseMapper.sendExamSucceed(bo.getGoodsId());
+        if (count > 0) {
+            if (informRemindVo.getWayStatus().equals(1)) {
+                InformUserAddBo informUserAddBo = new InformUserAddBo();
+                informUserAddBo.setUserId(bo.getUserId());
+                informUserAddBo.setSendStatus(1);
+                informUserAddBo.setSendTime(DateUtils.getNowTime());
+                informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                informUserAddBo.setRemindId(15L);
+                informUserAddBo.setSystemStatus(1);
+                informUserAddBo.setRemind("考试预约成功提醒");
+                informUserAddBo.setGoodsId(bo.getGoodsId());
+                GoodsVo goodsVo1 = iGoodsService.queryById(bo.getGoodsId());
+                informUserAddBo.setText("尊敬的用户:已成功预约施工现场专业人员" + goodsVo1.getGoodsName() + "考试");
+                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(3L);
+                informUserAddBo.setSystemStatus(3);
+                informUserAddBo.setRemind("考试预约成功提醒");
+                informUserAddBo.setGoodsId(bo.getGoodsId());
+                GoodsVo goodsVo1 = iGoodsService.queryById(bo.getGoodsId());
+                informUserAddBo.setText("尊敬的用户:已成功预约施工现场专业人员" + 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);
+            }
+        }
+
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean updateByEditBo(UserSubscribeEditBo bo) {
@@ -104,6 +185,9 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
             UserSubscribe update = new UserSubscribe();
             update.setSubscribeId(subscribe);
             update.setSubscribeStatus(bo.getSubscribeStatus());
+            if (bo.getSubscribeStatus() != null && bo.getSubscribeStatus().equals(2)) {
+                sendExamcancel(bo);
+            }
             update.setExamStatus(bo.getExamStatus());
             update.setRemark(bo.getRemark());
             update.setBeforeId(bo.getBeforeId());
@@ -114,10 +198,69 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
         return true;
     }
 
+    //取消预约
+    private void sendExamcancel(UserSubscribeEditBo bo) {
+        for (Long subscribe : bo.getSubscribeId()) {
+            UserSubscribeVo userSubscribeVo = this.queryById(subscribe);
+            InformRemindVo informRemindVo = informRemindService.queryById(14L);
+            if (!CollectionUtils.isEmpty(informRemindVo.getInformRemindBusiness())) {
+                Long businessId = 0L;
+                for (InformRemindBusinessVo informRemindBusiness : informRemindVo.getInformRemindBusiness()) {
+                    businessId += baseMapper.queryBusinessId(subscribe, informRemindBusiness.getBusinessId());
+                }
+                if (businessId > 0) {
+                    if (informRemindVo.getWayStatus().equals(1)) {
+                        InformUserAddBo informUserAddBo = new InformUserAddBo();
+                        informUserAddBo.setUserId(userSubscribeVo.getUserId());
+                        informUserAddBo.setSendStatus(1);
+                        informUserAddBo.setSendTime(DateUtils.getNowTime());
+                        informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                        informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                        informUserAddBo.setRemindId(14L);
+                        informUserAddBo.setSystemStatus(1);
+                        informUserAddBo.setRemind("考试预约取消提醒");
+                        informUserAddBo.setGoodsId(userSubscribeVo.getGoodsId());
+                        GoodsVo goodsVo1 = iGoodsService.queryById(userSubscribeVo.getGoodsId());
+                        informUserAddBo.setText("尊敬的用户:已取消预约施工现场专业人员" + goodsVo1.getGoodsName() + "考试。");
+                        iInformUserService.insertByAddBo(informUserAddBo);
+                    }
+                    if (informRemindVo.getNoteStatus().equals(1)) {
+                        InformUserAddBo informUserAddBo = new InformUserAddBo();
+                        informUserAddBo.setUserId(userSubscribeVo.getUserId());
+                        informUserAddBo.setSendTime(DateUtils.getNowTime());
+                        informUserAddBo.setSendStatus(1);
+                        informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                        informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                        informUserAddBo.setRemindId(14L);
+                        informUserAddBo.setSystemStatus(3);
+                        informUserAddBo.setRemind("考试预约取消提醒");
+                        informUserAddBo.setGoodsId(userSubscribeVo.getGoodsId());
+                        GoodsVo goodsVo1 = iGoodsService.queryById(userSubscribeVo.getGoodsId());
+                        informUserAddBo.setText("尊敬的用户:已取消预约施工现场专业人员" + goodsVo1.getGoodsName() + "考试。");
+                        iInformUserService.insertByAddBo(informUserAddBo);
+                        UserVo userVo = iUserService.queryById(userSubscribeVo.getUserId());
+                        Map<String, Object> param = new HashMap<>();
+                        param.put("goods", goodsVo1.getGoodsName());
+                        IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), cancellationReminder);
+                    }
+                }
+            }
+        }
+
+    }
+
     @Override
     public Boolean updateByEditSingleBo(UserAppSubscribeEditBo bo) {
         UserSubscribe update = BeanUtil.toBean(bo, UserSubscribe.class);
         validEntityBeforeSave(update);
+        if (bo.getSubscribeStatus() != null && bo.getSubscribeStatus().equals(2)) {
+            UserSubscribeEditBo userSubscribeEditBo = new UserSubscribeEditBo();
+            Long[] s = new Long[]{
+                    bo.getSubscribeId()
+            };
+            userSubscribeEditBo.setSubscribeId(s);
+            sendExamcancel(userSubscribeEditBo);
+        }
         update.setUpdateTime(DateUtils.getNowTime());
         return this.updateById(update);
     }
@@ -156,6 +299,9 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
             update.setRemark(userSubscribeCertificateEditBo.getRemark());
             update.setUpdateTime(DateUtils.getNowTime());
             boolean b = this.updateById(update);
+            UserSubscribeVo userSubscribeVo = this.queryById(userSubscribeCertificateEditBo.getSubscribeId());
+            UserSubscribe userSubscribe = BeanUtil.toBean(userSubscribeVo, UserSubscribe.class);
+            sendExamPass(userSubscribe);
         }
         return true;
     }
@@ -341,6 +487,9 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
             userSubscribeAddBo.setCreateTime(DateUtils.getNowTime());
             userSubscribeAddBo.setUpdateTime(DateUtils.getNowTime());
             this.insertByAddBo(userSubscribeAddBo);
+            if (userSubscribeImport.getSubscribeStatus().equals("正常")) {
+                sendExamSucceed(userSubscribeAddBo);
+            }
         }
         return userSubscribeImports;
     }
@@ -535,7 +684,114 @@ public class UserSubscribeServiceImpl extends ServiceImpl<UserSubscribeMapper, U
 
             userSbusciEditBo.setUpdateTime(DateUtils.getNowTime());
             this.updateById(userSbusciEditBo);
+
+            if (userSubscribeImport.getSubscribeStatus().equals("取消")) {
+                userSbusciEditBo.setSubscribeStatus(0);
+                UserSubscribeEditBo userSubscribeEditBo = new UserSubscribeEditBo();
+                Long[] s = new Long[]{
+                        userSbusciEditBo.getSubscribeId()
+                };
+                userSubscribeEditBo.setSubscribeId(s);
+                sendExamcancel(userSubscribeEditBo);
+            }
+            if (!StringUtils.isEmpty(userSubscribeImport.getResult())) {
+                sendExamPass(userSbusciEditBo);
+            }
         }
         return userSubscribeImports;
     }
+
+    private void sendExamPass(UserSubscribe bo) {
+        UserSubscribeVo userSubscribeVo = this.queryById(bo.getSubscribeId());
+        InformRemindVo informRemindVoPass = informRemindService.queryById(17L);
+        InformRemindVo informRemindVo = informRemindService.queryById(18L);
+        if (!CollectionUtils.isEmpty(informRemindVo.getInformRemindBusiness())) {
+            Long businessId = 0L;
+            for (InformRemindBusinessVo informRemindBusiness : informRemindVo.getInformRemindBusiness()) {
+                businessId += baseMapper.queryBusinessId(bo.getSubscribeId(), informRemindBusiness.getBusinessId());
+            }
+            if (businessId > 0) {
+                if (userSubscribeVo.getResult().equals(1)) {
+                    if (informRemindVoPass.getWayStatus().equals(1)) {
+                        InformUserAddBo informUserAddBo = new InformUserAddBo();
+                        informUserAddBo.setUserId(userSubscribeVo.getUserId());
+                        informUserAddBo.setSendStatus(1);
+                        informUserAddBo.setSendTime(DateUtils.getNowTime());
+                        informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                        informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                        informUserAddBo.setRemindId(17L);
+                        informUserAddBo.setSystemStatus(1);
+                        informUserAddBo.setRemind("七大员新考考试通过提醒");
+                        informUserAddBo.setGoodsId(userSubscribeVo.getGoodsId());
+                        GoodsVo goodsVo1 = iGoodsService.queryById(userSubscribeVo.getGoodsId());
+                        informUserAddBo.setText("尊敬的用户:您已通过施工现场专业人员"+goodsVo1.getGoodsName()+"岗位考核,分数:" + bo.getPerformance() + ",证书编号:"+bo.getCertificateCode());
+                        iInformUserService.insertByAddBo(informUserAddBo);
+                    }
+                    if (informRemindVoPass.getNoteStatus().equals(1)) {
+                        InformUserAddBo informUserAddBo = new InformUserAddBo();
+                        informUserAddBo.setUserId(userSubscribeVo.getUserId());
+                        informUserAddBo.setSendTime(DateUtils.getNowTime());
+                        informUserAddBo.setSendStatus(1);
+                        informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                        informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                        informUserAddBo.setRemindId(17L);
+                        informUserAddBo.setSystemStatus(3);
+                        informUserAddBo.setRemind("七大员新考考试通过提醒");
+                        informUserAddBo.setGoodsId(userSubscribeVo.getGoodsId());
+                        GoodsVo goodsVo1 = iGoodsService.queryById(userSubscribeVo.getGoodsId());
+                        informUserAddBo.setText("尊敬的用户:您已通过施工现场专业人员"+goodsVo1.getGoodsName()+"岗位考核,分数:" + bo.getPerformance() + ",证书编号:"+bo.getCertificateCode());
+                        iInformUserService.insertByAddBo(informUserAddBo);
+                        UserVo userVo = iUserService.queryById(userSubscribeVo.getUserId());
+                        Map<String, Object> param = new HashMap<>();
+                        param.put("goods", goodsVo1.getGoodsName());
+                        param.put("score", bo.getPerformance());
+                        param.put("number", bo.getCertificateCode());
+                        IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), newExamPass);
+                    }
+                }
+                if (userSubscribeVo.getResult().equals(0)) {
+                    if (informRemindVo.getWayStatus().equals(1)) {
+                        InformUserAddBo informUserAddBo = new InformUserAddBo();
+                        informUserAddBo.setUserId(userSubscribeVo.getUserId());
+                        informUserAddBo.setSendStatus(1);
+                        informUserAddBo.setSendTime(DateUtils.getNowTime());
+                        informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                        informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                        informUserAddBo.setRemindId(18L);
+                        informUserAddBo.setSystemStatus(1);
+                        informUserAddBo.setRemind("七大员新考考试不通过提醒");
+                        informUserAddBo.setGoodsId(userSubscribeVo.getGoodsId());
+                        GoodsVo goodsVo1 = iGoodsService.queryById(userSubscribeVo.getGoodsId());
+                        informUserAddBo.setText("尊敬的用户:您缺席或未通过施工现场专业人员"+goodsVo1.getGoodsName()+"岗位考核,分数:" + bo.getPerformance() + ",请马重新预约考试.");
+                        iInformUserService.insertByAddBo(informUserAddBo);
+                    }
+                    if (informRemindVo.getNoteStatus().equals(1)) {
+                        InformUserAddBo informUserAddBo = new InformUserAddBo();
+                        informUserAddBo.setUserId(userSubscribeVo.getUserId());
+                        informUserAddBo.setSendTime(DateUtils.getNowTime());
+                        informUserAddBo.setSendStatus(1);
+                        informUserAddBo.setCreateTime(DateUtils.getNowTime());
+                        informUserAddBo.setUpdateTime(DateUtils.getNowTime());
+                        informUserAddBo.setRemindId(18L);
+                        informUserAddBo.setSystemStatus(3);
+                        informUserAddBo.setRemind("七大员新考考试不通过提醒");
+                        informUserAddBo.setGoodsId(userSubscribeVo.getGoodsId());
+                        GoodsVo goodsVo1 = iGoodsService.queryById(userSubscribeVo.getGoodsId());
+                        informUserAddBo.setText("尊敬的用户:您缺席或未通过施工现场专业人员"+goodsVo1.getGoodsName()+"岗位考核,分数:" + bo.getPerformance() + ",请马重新预约考试.");
+                        iInformUserService.insertByAddBo(informUserAddBo);
+                        UserVo userVo = iUserService.queryById(userSubscribeVo.getUserId());
+                        Map<String, Object> param = new HashMap<>();
+                        param.put("goods", goodsVo1.getGoodsName());
+                        param.put("score", bo.getPerformance());
+                        IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), newExamFail);
+                    }
+                }
+            }
+        }
+    }
+
+    @Override
+    public List<UserSubscribeVo> timeSend() {
+        return baseMapper.timeSend();
+    }
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserSubscribeVo.java

@@ -168,4 +168,9 @@ public class UserSubscribeVo {
 	@Excel(name = "考培日期")
 	@ApiModelProperty("考培日期")
 	private Long applySiteExamTrainTime;
+
+	/** 业务ID */
+	@Excel(name = "业务ID")
+	@ApiModelProperty("业务ID")
+	private Long businessId;
 }

+ 21 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/wx/service/impl/WxPayServiceImpl.java

@@ -29,6 +29,8 @@ import com.zhongzheng.modules.course.domain.Course;
 import com.zhongzheng.modules.course.service.ICourseService;
 import com.zhongzheng.modules.exam.service.IExamNoteService;
 
+import com.zhongzheng.modules.goods.service.IGoodsService;
+import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.domain.ClassGradeUserTemp;
 import com.zhongzheng.modules.grade.service.IClassGradeUserTempService;
 import com.zhongzheng.modules.order.bo.OrderGoodsQueryBo;
@@ -127,6 +129,9 @@ public class WxPayServiceImpl  implements IWxPayService {
     @Autowired
     private IOrderGoodsService iOrderGoodsService;
 
+    @Autowired
+    private IGoodsService iGoodsService;
+
 
 
 
@@ -305,7 +310,8 @@ public class WxPayServiceImpl  implements IWxPayService {
                     g.setGoodsReceived(g.getGoodsRealPrice());
                     iOrderGoodsService.updateById(g);
                     this.joinLockGrade(order.getOrderSn(),g.getGoodsId(),g.getOrderGoodsId());
-
+                    //给用户增加商品考试次数前培次数
+                    updateUserExamGoods(g,order);
                 }
             }
 
@@ -313,6 +319,20 @@ public class WxPayServiceImpl  implements IWxPayService {
         return true;
     }
 
+    private void updateUserExamGoods(OrderGoods g,Order order) {
+        GoodsVo goodsVo = iGoodsService.queryById(g.getGoodsId());
+        //添加商品考试次数和补考次数
+        if (goodsVo.getGoodsType().equals(1)){
+
+        }
+        if (goodsVo.getGoodsType().equals(4)){
+
+        }
+        if (goodsVo.getGoodsType().equals(3)){
+
+        }
+    }
+
     //加入锁定班级
     @Override
     public boolean joinLockGrade(String orderSn,Long goodsId,Long orderGoodsId){

+ 1 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMapper.xml

@@ -420,6 +420,7 @@
         <if test="userId != null and userId != ''">
             and o.user_id = #{userId}
         </if>
+        order by o.pay_time desc
     </select>
     <select id="courseList" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo"  resultMap="CourseUserVo">
         SELECT

+ 21 - 0
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeMapper.xml

@@ -448,4 +448,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         and pay_status in (2,3)
         and g.business_id =#{businessId}
     </select>
+
+    <select id="querClassSMS"  parameterType="map" resultMap="ClassGradeStudentVo">
+        SELECT
+            COUNT(1)
+        FROM
+            class_grade_goods cgg
+                LEFT JOIN goods g ON g.business_id = cgg.goods_id
+        where 1=1
+          and cgg.grade_id=#{gradeId}
+          and g.business_id=#{businessId}
+    </select>
+
+    <select id="queryUser"  parameterType="Long" resultType="Long">
+        SELECT
+            user_id
+        FROM
+            class_grade_user
+        WHERE
+            grade_id = #{gradeId}
+          and `status` = 1
+    </select>
 </mapper>

+ 8 - 2
zhongzheng-system/src/main/resources/mapper/modules/inform/InformUserMapper.xml

@@ -31,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <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"/>
+        <result property="gradeId" column="grade_id"/>
     </resultMap>
 
     <select id="queryUserList" parameterType="com.zhongzheng.modules.inform.bo.InformUserQueryBo" resultMap="InformUserVo">
@@ -74,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         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
+        LEFT JOIN goods g on g.goods_id = cgg.goods_id
         WHERE
         ea.`status` =1
         AND cg.`status`=1
@@ -81,6 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         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
+        and (SELECT COUNT(1) FROM inform_remind_business ifb where g.business_id = ifb.business_id and ifb.remind_id = 13) >0
         UNION
         SELECT
         cgu.user_id,
@@ -95,12 +97,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         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
+        LEFT JOIN goods g on g.goods_id = cgg.goods_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'
+        and (SELECT COUNT(1) FROM inform_remind_business ifb where g.business_id = ifb.business_id and ifb.remind_id = 13) >0
         UNION
         SELECT
         cgu.user_id,
@@ -115,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         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
+        LEFT JOIN goods g on g.goods_id = cgg.goods_id
         WHERE
         ea.`status` =1
         AND cg.`status`=1
@@ -122,5 +127,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         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>
+        and (SELECT COUNT(1) FROM inform_remind_business ifb where g.business_id = ifb.business_id and ifb.remind_id = 13) >0
+    </select>
 </mapper>

+ 38 - 1
zhongzheng-system/src/main/resources/mapper/modules/user/UserSubscribeMapper.xml

@@ -57,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="applySiteExamTrainTime" column="apply_site_exam_train_time"/>
         <result property="applyStartTime" column="apply_start_time"/>
         <result property="applyEndTime" column="apply_end_time"/>
+        <result property="businessId" column="business_id"/>
     </resultMap>
 
     <select id="listSubscribe" parameterType="com.zhongzheng.modules.user.bo.UserSubscribeQueryBo" resultMap="UserSubscribeVo">
@@ -141,4 +142,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           and us.goods_id=#{goodsId}
           and us.user_id = #{userId}
     </select>
-</mapper>
+
+    <select id="queryBusinessId" parameterType="map"  resultType="Long">
+        SELECT
+            COUNT( 1 )
+        FROM
+            user_subscribe us
+                LEFT JOIN exam_apply ea ON ea.apply_id = us.apply_id
+                LEFT JOIN exam_apply_goods eag on ea.apply_id = eag.apply_id
+                LEFT JOIN goods g on eag.goods_id = g.goods_id
+        where 1=1
+          AND g.business_id = #{businessId}
+          AND us.subscribe_id = #{subscribeId}
+    </select>
+
+    <select id="timeSend"  resultMap="UserSubscribeVo">
+        SELECT
+        * ,
+        (SELECT g.business_id FROM goods g where g.goods_id = us.goods_id) as business_id
+        FROM
+        user_subscribe us
+        WHERE us.subscribe_status = 1
+        and unix_timestamp(now())+86400 > us.apply_site_exam_time
+        and unix_timestamp(now()) &lt; us.apply_site_exam_time
+        and (SELECT COUNT(1) FROM inform_remind ir LEFT JOIN inform_remind_business irb on ir.id = irb.remind_id where ir.id=16 and (SELECT g.business_id FROM goods g where g.goods_id = us.goods_id) = irb.business_id) > 0
+    </select>
+
+    <select id="sendExamSucceed" parameterType="map"  resultType="Long">
+        SELECT
+            COUNT( 1 )
+        FROM
+            inform_remind ir
+                LEFT JOIN inform_remind_business irb on irb.remind_id =ir.id
+                LEFT JOIN goods g on g.business_id = irb.business_id
+        where 1=1
+          and g.goods_id = #{goodsId}
+    </select>
+</mapper>