|
@@ -2,10 +2,21 @@ package com.zhongzheng.modules.grade.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
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.goods.service.IGoodsService;
|
|
|
+import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
|
|
|
import com.zhongzheng.modules.grade.service.IUserPeriodStatusService;
|
|
|
+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.InformRemindVo;
|
|
|
+import com.zhongzheng.modules.user.service.IUserService;
|
|
|
+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;
|
|
@@ -20,9 +31,7 @@ import com.zhongzheng.modules.grade.vo.UserPeriodVo;
|
|
|
import com.zhongzheng.modules.grade.service.IUserPeriodService;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.Collection;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -37,6 +46,27 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
|
|
|
@Autowired
|
|
|
private IUserPeriodStatusService userPeriodStatusService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IInformRemindService informRemindService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IGoodsService iGoodsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IInformUserService iInformUserService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IUserService iUserService;
|
|
|
+
|
|
|
+ @Value("${aliyun.sms.schoolHoursCode}")
|
|
|
+ private String schoolHoursCode;
|
|
|
+
|
|
|
+ @Value("${aliyun.sms.auditFailedCode}")
|
|
|
+ private String auditFailedCode;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private com.zhongzheng.modules.alisms.service.IAliSmsService IAliSmsService;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public UserPeriodVo queryById(Long id){
|
|
@@ -138,6 +168,161 @@ public class UserPeriodServiceImpl extends ServiceImpl<UserPeriodMapper, UserPer
|
|
|
userPeriods.eq( UserPeriodStatus::getStatus, 2);
|
|
|
userPeriodStatusService.update(userPeriodStatus,userPeriods);
|
|
|
}
|
|
|
+ sendPeriodSMS(bo);
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ private void sendPeriodSMS(UserPeriodEditBo bo) {
|
|
|
+ GoodsVo goodsVo1 = iGoodsService.queryById(bo.getGoodsId());
|
|
|
+ if (bo.getStatus().equals(1)){
|
|
|
+ InformRemindVo informRemindVo = informRemindService.queryById(9L);
|
|
|
+ if (!CollectionUtils.isEmpty(informRemindVo.getInformRemindBusiness()) && !CollectionUtils.isEmpty(informRemindVo.getInformRemindBusiness().stream().filter(informRemindBusinessVo -> informRemindBusinessVo.getBusinessId().equals(goodsVo1.getBusinessId())).collect(Collectors.toList()))) {
|
|
|
+ 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(9L);
|
|
|
+ informUserAddBo.setSystemStatus(1);
|
|
|
+ informUserAddBo.setRemind("学时机构审核通过提醒");
|
|
|
+ informUserAddBo.setGoodsId(bo.getGoodsId());
|
|
|
+ informUserAddBo.setText("尊敬的用户:你已完成本课程的所有学时学习,经机构审核通过,需注册中心复审后即可获得继续教育学时,审核时间约15个工作日。");
|
|
|
+ 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(9L);
|
|
|
+ informUserAddBo.setSystemStatus(3);
|
|
|
+ informUserAddBo.setRemind("学时机构审核通过提醒");
|
|
|
+ informUserAddBo.setGoodsId(bo.getGoodsId());
|
|
|
+ informUserAddBo.setText("尊敬的用户:你已完成本课程的所有学时学习,经机构审核通过,需注册中心复审后即可获得继续教育学时,审核时间约15个工作日。");
|
|
|
+ iInformUserService.insertByAddBo(informUserAddBo);
|
|
|
+ UserVo userVo = iUserService.queryById(bo.getUserId());
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), schoolHoursCode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ InformRemindVo informRemindTwoVo = informRemindService.queryById(10L);
|
|
|
+ if (!CollectionUtils.isEmpty(informRemindTwoVo.getInformRemindBusiness()) && !CollectionUtils.isEmpty(informRemindTwoVo.getInformRemindBusiness().stream().filter(informRemindBusinessVo -> informRemindBusinessVo.getBusinessId().equals(goodsVo1.getBusinessId())).collect(Collectors.toList()))) {
|
|
|
+
|
|
|
+ if (informRemindTwoVo.getWayStatus().equals(1)) {
|
|
|
+ InformUserAddBo informUserAddBo = new InformUserAddBo();
|
|
|
+ informUserAddBo.setUserId(bo.getUserId());
|
|
|
+ informUserAddBo.setSendStatus(1);
|
|
|
+ informUserAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setSendTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setRemindId(10L);
|
|
|
+ informUserAddBo.setSystemStatus(1);
|
|
|
+ informUserAddBo.setRemind("学时机构审核不通过提醒");
|
|
|
+ informUserAddBo.setGoodsId(bo.getGoodsId());
|
|
|
+ informUserAddBo.setText("尊敬的用户:您购买的"+goodsVo1.getGoodsName()+"课程学时机构审核不通过,为了不影响您的学习进度,请点击立即重学进行重学。");
|
|
|
+ iInformUserService.insertByAddBo(informUserAddBo);
|
|
|
+ }
|
|
|
+ if (informRemindTwoVo.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(10L);
|
|
|
+ informUserAddBo.setSystemStatus(3);
|
|
|
+ informUserAddBo.setRemind("学时机构审核不通过提醒");
|
|
|
+ informUserAddBo.setGoodsId(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), auditFailedCode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /* private void sendPeriodSevenSMS(UserPeriodEditBo bo) {
|
|
|
+ GoodsVo goodsVo1 = iGoodsService.queryById(bo.getGoodsId());
|
|
|
+ if (bo.getStatus().equals(1)){
|
|
|
+ InformRemindVo informRemindVo = informRemindService.queryById(11L);
|
|
|
+ if (!CollectionUtils.isEmpty(informRemindVo.getInformRemindBusiness()) && !CollectionUtils.isEmpty(informRemindVo.getInformRemindBusiness().stream().filter(informRemindBusinessVo -> informRemindBusinessVo.getBusinessId().equals(goodsVo1.getBusinessId())).collect(Collectors.toList()))) {
|
|
|
+ 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(9L);
|
|
|
+ informUserAddBo.setSystemStatus(1);
|
|
|
+ informUserAddBo.setRemind("学时机构审核通过提醒");
|
|
|
+ informUserAddBo.setGoodsId(bo.getGoodsId());
|
|
|
+ informUserAddBo.setText("尊敬的用户:你已完成本课程的所有学时机构审核通过,马上点击“预约考试”进行预约考试。");
|
|
|
+ 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(9L);
|
|
|
+ informUserAddBo.setSystemStatus(3);
|
|
|
+ informUserAddBo.setRemind("学时机构审核通过提醒");
|
|
|
+ informUserAddBo.setGoodsId(bo.getGoodsId());
|
|
|
+ informUserAddBo.setText("尊敬的用户:你已完成本课程的所有学时学习,经机构审核通过,需注册中心复审后即可获得继续教育学时,审核时间约15个工作日。");
|
|
|
+ iInformUserService.insertByAddBo(informUserAddBo);
|
|
|
+ UserVo userVo = iUserService.queryById(bo.getUserId());
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ IAliSmsService.sendInformSms(userVo.getTelphone(), JSON.toJSONString(param), schoolHoursCode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ InformRemindVo informRemindTwoVo = informRemindService.queryById(12L);
|
|
|
+ if (!CollectionUtils.isEmpty(informRemindTwoVo.getInformRemindBusiness()) && !CollectionUtils.isEmpty(informRemindTwoVo.getInformRemindBusiness().stream().filter(informRemindBusinessVo -> informRemindBusinessVo.getBusinessId().equals(goodsVo1.getBusinessId())).collect(Collectors.toList()))) {
|
|
|
+
|
|
|
+ if (informRemindTwoVo.getWayStatus().equals(1)) {
|
|
|
+ InformUserAddBo informUserAddBo = new InformUserAddBo();
|
|
|
+ informUserAddBo.setUserId(bo.getUserId());
|
|
|
+ informUserAddBo.setSendStatus(1);
|
|
|
+ informUserAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setSendTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ informUserAddBo.setRemindId(10L);
|
|
|
+ informUserAddBo.setSystemStatus(1);
|
|
|
+ informUserAddBo.setRemind("学时机构审核不通过提醒");
|
|
|
+ informUserAddBo.setGoodsId(bo.getGoodsId());
|
|
|
+ informUserAddBo.setText("尊敬的用户:您购买的"+goodsVo1.getGoodsName()+"课程学时机构审核不通过,为了不影响您的学习进度,请点击立即重学进行重学。");
|
|
|
+ iInformUserService.insertByAddBo(informUserAddBo);
|
|
|
+ }
|
|
|
+ if (informRemindTwoVo.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(10L);
|
|
|
+ informUserAddBo.setSystemStatus(3);
|
|
|
+ informUserAddBo.setRemind("学时机构审核不通过提醒");
|
|
|
+ informUserAddBo.setGoodsId(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), auditFailedCode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }*/
|
|
|
}
|