Ver Fonte

fix 订单

he2802 há 3 anos atrás
pai
commit
db89c7a2bd

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/bo/InformUserAddBo.java

@@ -58,4 +58,11 @@ public class InformUserAddBo {
     @ApiModelProperty("绑定商品ID")
     private Long goodsId;
 
+    /** 计划ID */
+    @ApiModelProperty("计划ID")
+    private Long planId;
+    /** 班级ID */
+    @ApiModelProperty("班级ID")
+    private Long gradeId;
+
 }

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/bo/InformUserEditBo.java

@@ -64,5 +64,12 @@ public class InformUserEditBo {
     @ApiModelProperty("绑定商品ID")
     private Long goodsId;
 
+    /** 计划ID */
+    @ApiModelProperty("计划ID")
+    private Long planId;
+    /** 班级ID */
+    @ApiModelProperty("班级ID")
+    private Long gradeId;
+
 
 }

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/bo/InformUserQueryBo.java

@@ -77,4 +77,11 @@ public class InformUserQueryBo extends BaseEntity {
 	/** 绑定商品ID */
 	@ApiModelProperty("绑定商品ID")
 	private Long goodsId;
+
+	/** 计划ID */
+	@ApiModelProperty("计划ID")
+	private Long planId;
+	/** 班级ID */
+	@ApiModelProperty("班级ID")
+	private Long gradeId;
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/domain/InformUser.java

@@ -56,4 +56,9 @@ private static final long serialVersionUID=1L;
 
     /** 绑定商品ID */
     private Long goodsId;
+
+    /** 计划ID */
+    private Long planId;
+    /** 班级ID */
+    private Long gradeId;
 }

+ 7 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/inform/vo/InformUserVo.java

@@ -86,5 +86,12 @@ public class InformUserVo {
 	@ApiModelProperty("班级名称")
 	private List<String> className;
 
+	/** 计划ID */
+	@ApiModelProperty("计划ID")
+	private Long planId;
+	/** 班级ID */
+	@ApiModelProperty("班级ID")
+	private Long gradeId;
+
 
 }

+ 80 - 9
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -10,8 +10,11 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.microsoft.schemas.office.visio.x2012.main.SectionType;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.modules.bank.domain.Exam;
+import com.zhongzheng.modules.course.bo.CourseQueryBo;
 import com.zhongzheng.modules.face.service.IFaceService;
+import com.zhongzheng.modules.goods.service.IGoodsService;
 import com.zhongzheng.modules.goods.vo.GoodsUserVo;
+import com.zhongzheng.modules.goods.vo.GoodsVo;
 import com.zhongzheng.modules.grade.bo.UserPeriodAddBo;
 import com.zhongzheng.modules.grade.bo.UserPeriodStatusAddBo;
 import com.zhongzheng.modules.grade.domain.UserPeriod;
@@ -19,16 +22,20 @@ import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
 import com.zhongzheng.modules.grade.service.IUserPeriodService;
 import com.zhongzheng.modules.grade.service.IUserPeriodStatusService;
 import com.zhongzheng.modules.grade.vo.UserPeriodStatusVo;
+import com.zhongzheng.modules.inform.bo.InformRemindQueryBo;
+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.domain.UserPlan;
 import com.zhongzheng.modules.user.domain.UserStudyRecord;
 import com.zhongzheng.modules.user.mapper.UserStudyRecordMapper;
-import com.zhongzheng.modules.user.service.IUserPlanGoodsService;
-import com.zhongzheng.modules.user.service.IUserPlanService;
-import com.zhongzheng.modules.user.service.IUserStudyRecordPhotoService;
-import com.zhongzheng.modules.user.service.IUserStudyRecordService;
+import com.zhongzheng.modules.user.service.*;
 import com.zhongzheng.modules.user.vo.*;
 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;
@@ -37,10 +44,7 @@ import com.github.pagehelper.Page;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -71,6 +75,25 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
     @Autowired
     private IUserPlanService userPlanService;
 
+    @Autowired
+    private IInformRemindService iInformRemindService;
+
+    @Autowired
+    private IGoodsService iGoodsService;
+
+    @Autowired
+    private com.zhongzheng.modules.alisms.service.IAliSmsService IAliSmsService;
+
+    @Autowired
+    private IUserService iUserService;
+
+    @Autowired
+    private IInformUserService iInformUserService;
+
+    @Value("${aliyun.sms.completionReminderCode}")
+    private String completionReminderCode;
+
+
 
     @Override
     public UserStudyRecordVo queryById(Long recordId) {
@@ -162,7 +185,55 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
             }
             //发送课时完成
             if (secLong.equals(studyLong)) {
-
+                InformRemindQueryBo informRemindQueryBo = new InformRemindQueryBo();
+                informRemindQueryBo.setSort(8L);
+                List<InformRemindVo> list = iInformRemindService.queryList(informRemindQueryBo);
+                CourseQueryBo courseQueryBo = new CourseQueryBo();
+                courseQueryBo.setGoodsId(bo.getGoodsId());
+                GoodsVo goodsVo = iGoodsService.selectUserDetail(courseQueryBo);
+                if (!CollectionUtils.isEmpty(list)){
+                    InformRemindVo informRemindVo = list.get(0);
+                    if (!CollectionUtils.isEmpty(informRemindVo.getInformRemindBusiness())) {
+                        for (InformRemindBusinessVo informRemindBusiness : informRemindVo.getInformRemindBusiness()) {
+                            if (goodsVo.getBusinessId().equals(informRemindBusiness.getBusinessId())) {
+                                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(8L);
+                                    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(8L);
+                                    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), completionReminderCode);
+                                }
+                            }
+                        }
+                    }
+                }
             }
         }
     }