|
@@ -2,10 +2,14 @@ package com.zhongzheng.modules.order.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.modules.course.domain.CourseChapterSection;
|
|
|
+import com.zhongzheng.modules.exam.domain.ExamNumber;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
+import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
+import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
import com.zhongzheng.modules.order.bo.*;
|
|
|
import com.zhongzheng.modules.order.domain.Order;
|
|
|
import com.zhongzheng.modules.order.domain.OrderBillGoods;
|
|
@@ -18,6 +22,12 @@ import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
|
import com.zhongzheng.modules.order.service.IOrderService;
|
|
|
import com.zhongzheng.modules.order.vo.OrderBillSheetVo;
|
|
|
import com.zhongzheng.modules.order.vo.OrderGoodsVo;
|
|
|
+import com.zhongzheng.modules.user.bo.UserExamGoodsQueryBo;
|
|
|
+import com.zhongzheng.modules.user.bo.UserExamGoodsSupplementAddBo;
|
|
|
+import com.zhongzheng.modules.user.domain.UserExamGoods;
|
|
|
+import com.zhongzheng.modules.user.service.IUserExamGoodsService;
|
|
|
+import com.zhongzheng.modules.user.service.IUserExamGoodsSupplementService;
|
|
|
+import com.zhongzheng.modules.user.vo.UserExamGoodsVo;
|
|
|
import com.zhongzheng.modules.wx.service.IWxPayService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -52,6 +62,16 @@ public class OrderBillSheetServiceImpl extends ServiceImpl<OrderBillSheetMapper,
|
|
|
@Autowired
|
|
|
private IWxPayService iWxPayService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IUserExamGoodsService userExamGoodsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IUserExamGoodsSupplementService userExamGoodsSupplementService;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IGoodsService iGoodsService;
|
|
|
+
|
|
|
private Map<String, List<OrderGoodsVo>> orderGoodsList = new HashMap<>();
|
|
|
|
|
|
@Override
|
|
@@ -195,6 +215,7 @@ public class OrderBillSheetServiceImpl extends ServiceImpl<OrderBillSheetMapper,
|
|
|
iOrderService.updateById(order);
|
|
|
goods.setUpdateTime(DateUtils.getNowTime());
|
|
|
iOrderGoodsService.updateById(goods);
|
|
|
+ updateUserExamGoods(goods,order);
|
|
|
}
|
|
|
iOrderBillGoodsService.saveBatch(coll);
|
|
|
this.save(add);
|
|
@@ -203,6 +224,72 @@ public class OrderBillSheetServiceImpl extends ServiceImpl<OrderBillSheetMapper,
|
|
|
result.put("sheetSn",sheet_no);
|
|
|
return result;
|
|
|
}
|
|
|
+ private void updateUserExamGoods(OrderGoods g,Order order) {
|
|
|
+ GoodsVo goodsVo = iGoodsService.queryById(g.getGoodsId());
|
|
|
+ //添加商品考试次数和补考次数
|
|
|
+ if (goodsVo.getGoodsType().equals(1)){
|
|
|
+ if (userExamGoodsService.queryExamGoods(goodsVo.getGoodsId(),order.getUserId()) < 1){
|
|
|
+ ExamNumber examNumber = userExamGoodsService.queryExam(goodsVo.getGoodsId());
|
|
|
+ if (examNumber != null) {
|
|
|
+ UserExamGoods add = new UserExamGoods();
|
|
|
+ add.setGoodsId(g.getGoodsId());
|
|
|
+ add.setUserId(order.getUserId());
|
|
|
+ add.setExamNumber(examNumber.getExamNumber());
|
|
|
+ add.setDoNumber(examNumber.getDoNumber());
|
|
|
+ add.setCreateTime(DateUtils.getNowTime());
|
|
|
+ add.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ userExamGoodsService.save(add);
|
|
|
+ UserExamGoodsSupplementAddBo userExamGoodsSupplementAddBo = new UserExamGoodsSupplementAddBo();
|
|
|
+ userExamGoodsSupplementAddBo.setGoodsId(goodsVo.getGoodsId());
|
|
|
+ userExamGoodsSupplementAddBo.setUserExamGoodsId(add.getUserExamGoodsId());
|
|
|
+ userExamGoodsSupplementAddBo.setExamNumber(examNumber.getExamNumber());
|
|
|
+ userExamGoodsSupplementAddBo.setDoNumber(examNumber.getDoNumber());
|
|
|
+ userExamGoodsSupplementAddBo.setStatus(3);
|
|
|
+ userExamGoodsSupplementService.insertByAddBo(userExamGoodsSupplementAddBo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //增加前培次数
|
|
|
+ if (goodsVo.getGoodsType().equals(4)){
|
|
|
+ UserExamGoodsQueryBo userExamGoodsQueryBo = new UserExamGoodsQueryBo();
|
|
|
+ userExamGoodsQueryBo.setUserId(order.getUserId());
|
|
|
+ userExamGoodsQueryBo.setGoodsId(goodsVo.getMakeGoodsId());
|
|
|
+ List<UserExamGoodsVo> userExamGoodsVos = userExamGoodsService.queryList(userExamGoodsQueryBo);
|
|
|
+ if (!CollectionUtils.isEmpty(userExamGoodsVos)){
|
|
|
+ UserExamGoodsVo userExamGoodsVo = userExamGoodsVos.get(0);
|
|
|
+ UserExamGoodsSupplementAddBo userExamGoodsSupplementAddBo = new UserExamGoodsSupplementAddBo();
|
|
|
+ userExamGoodsSupplementAddBo.setGoodsId(goodsVo.getGoodsId());
|
|
|
+ userExamGoodsSupplementAddBo.setUserExamGoodsId(userExamGoodsVo.getUserExamGoodsId());
|
|
|
+ userExamGoodsSupplementAddBo.setDoNumber(goodsVo.getStudyCount());
|
|
|
+ userExamGoodsSupplementAddBo.setStatus(2);
|
|
|
+ userExamGoodsSupplementService.insertByAddBo(userExamGoodsSupplementAddBo);
|
|
|
+ UserExamGoods userExamGoods = new UserExamGoods();
|
|
|
+ userExamGoods.setUserExamGoodsId(userExamGoodsVo.getUserExamGoodsId());
|
|
|
+ userExamGoods.setDoNumber(userExamGoodsVo.getDoNumber()+goodsVo.getStudyCount());
|
|
|
+ userExamGoodsService.updateById(userExamGoods);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //增加考试次数
|
|
|
+ if (goodsVo.getGoodsType().equals(3)){
|
|
|
+ UserExamGoodsQueryBo userExamGoodsQueryBo = new UserExamGoodsQueryBo();
|
|
|
+ userExamGoodsQueryBo.setUserId(order.getUserId());
|
|
|
+ userExamGoodsQueryBo.setGoodsId(goodsVo.getMakeGoodsId());
|
|
|
+ List<UserExamGoodsVo> userExamGoodsVos = userExamGoodsService.queryList(userExamGoodsQueryBo);
|
|
|
+ if (!CollectionUtils.isEmpty(userExamGoodsVos)){
|
|
|
+ UserExamGoodsVo userExamGoodsVo = userExamGoodsVos.get(0);
|
|
|
+ UserExamGoodsSupplementAddBo userExamGoodsSupplementAddBo = new UserExamGoodsSupplementAddBo();
|
|
|
+ userExamGoodsSupplementAddBo.setGoodsId(goodsVo.getGoodsId());
|
|
|
+ userExamGoodsSupplementAddBo.setUserExamGoodsId(userExamGoodsVo.getUserExamGoodsId());
|
|
|
+ userExamGoodsSupplementAddBo.setExamNumber(goodsVo.getStudyCount());
|
|
|
+ userExamGoodsSupplementAddBo.setStatus(1);
|
|
|
+ userExamGoodsSupplementService.insertByAddBo(userExamGoodsSupplementAddBo);
|
|
|
+ UserExamGoods userExamGoods = new UserExamGoods();
|
|
|
+ userExamGoods.setUserExamGoodsId(userExamGoodsVo.getUserExamGoodsId());
|
|
|
+ userExamGoods.setExamNumber(userExamGoodsVo.getExamNumber()+goodsVo.getStudyCount());
|
|
|
+ userExamGoodsService.updateById(userExamGoods);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 修改订单商品支付状态为完全支付
|