yangdamao há 1 ano atrás
pai
commit
2720086dc7

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/bo/OrderGoodsAddBo.java

@@ -71,6 +71,9 @@ public class OrderGoodsAddBo {
     /** 复购老订单商品ID */
     @ApiModelProperty("复购老订单商品ID")
     private Long rebuyOrderGoodsId;
+    /** 补考用的订单商品Id */
+    @ApiModelProperty("补考用的订单商品Id")
+    private Long learnOrderGoodsId;
     /** 学习次数 */
     @ApiModelProperty("学习次数")
     private Long studyCount;

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/domain/OrderGoods.java

@@ -121,6 +121,9 @@ private static final long serialVersionUID=1L;
     /** 商品试卷数量 */
     private Integer examNum;
 
+    /** 补考用的订单商品ID */
+    private Long replenishSign;
+
     /** 完成日期 */
     @TableField(updateStrategy = FieldStrategy.IGNORED)
     private Long finishTime;

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java

@@ -2137,6 +2137,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             if (StringUtils.isNotBlank(goods.getSevenYear())){
                 orderGoods.setSevenYear(goods.getSevenYear());
             }
+            if (ObjectUtils.isNotNull(g.getLearnOrderGoodsId())){
+                orderGoods.setReplenishSign(g.getLearnOrderGoodsId());
+            }
             //赋值业务信息
            /* orderGoods.setBusinessOwner(bo.getOrderBusiness().getBusinessOwner());
             orderGoods.setDept(bo.getOrderBusiness().getDept());

+ 23 - 6
zhongzheng-system/src/main/java/com/zhongzheng/modules/wx/service/impl/WxPayServiceImpl.java

@@ -1185,12 +1185,29 @@ public class WxPayServiceImpl implements IWxPayService {
                     HttpUtils.sendPostJsonHeaderAsync(EXAM_SUBSCRIBE_ADD_EXAM_NUM, param, headersMap);
                 }
             }else {
-                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);//取最后即最新一条
+//                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);
+//                    userExamGoodsSupplementAddBo.setOrderGoodsId(g.getOrderGoodsId());
+//                    userExamGoodsSupplementService.insertByAddBo(userExamGoodsSupplementAddBo);
+//                    UserExamGoods userExamGoods = new UserExamGoods();
+//                    userExamGoods.setUserExamGoodsId(userExamGoodsVo.getUserExamGoodsId());
+//                    userExamGoods.setExamNumber(userExamGoodsVo.getExamNumber() + goodsVo.getStudyCount());
+//                    userExamGoodsService.updateById(userExamGoods);
+//                }
+                UserExamGoods userExamGoodsVo = userExamGoodsService
+                        .getOne(new LambdaQueryWrapper<UserExamGoods>()
+                                .eq(UserExamGoods::getOrderGoodsId, g.getReplenishSign())
+                                .last("limit 1"));
+                if (ObjectUtils.isNotNull(userExamGoodsVo)) {
                     UserExamGoodsSupplementAddBo userExamGoodsSupplementAddBo = new UserExamGoodsSupplementAddBo();
                     userExamGoodsSupplementAddBo.setGoodsId(goodsVo.getGoodsId());
                     userExamGoodsSupplementAddBo.setUserExamGoodsId(userExamGoodsVo.getUserExamGoodsId());

+ 1 - 0
zhongzheng-system/src/main/resources/mapper/modules/exam/ExamApplyMapper.xml

@@ -297,6 +297,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           and us.subscribe_status = 1
           and us.goods_id = #{goodsId}
           and us.order_goods_id = #{orderGoodsId}
+          and us.apply_site_exam_time > UNIX_TIMESTAMP(NOW())
     </select>
 
     <select id="getEntityById" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.exam.domain.ExamApply">