|
@@ -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();
|
|
|
+ }
|
|
|
}
|