소스 검색

fix 退款考试次数

he2802 3 년 전
부모
커밋
a6f5a3319d

+ 8 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderGoodsRefundServiceImpl.java

@@ -75,6 +75,8 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
     @Autowired
     private IUserExamGoodsService iUserExamGoodsService;
 
+
+
     @Override
     public OrderGoodsRefundVo queryById(Long refundId){
         OrderGoodsRefund db = this.baseMapper.selectById(refundId);
@@ -332,11 +334,15 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
         }
         if(goodsType==2){
             //删除题库历史
-            iUserExamRecordService.delUserBankHistory(userId,goodsId);
+            iUserExamRecordService.delUserBankHistory(userId,goodsId,orderGoodsId);
         }
         if(goodsType==3||goodsType==4){
             //减去考试和前培次数
-
+            UserExamGoodsQueryBo examGoodsQueryBo = new UserExamGoodsQueryBo();
+            examGoodsQueryBo.setUserId(userId);
+            examGoodsQueryBo.setGoodsId(goodsId);
+            examGoodsQueryBo.setOrderGoodsId(orderGoodsId);
+            iUserExamGoodsService.delNum(examGoodsQueryBo);
         }
         return true;
     }

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/IUserExamRecordService.java

@@ -34,7 +34,7 @@ public interface IUserExamRecordService extends IService<UserExamRecord> {
 
 	Long getUserDoQuestionNum(UserExamRecordQueryBo bo);
 
-	Boolean delUserBankHistory(Long userId,Long goodsId);
+	Boolean delUserBankHistory(Long userId,Long goodsId,Long orderGoodsId);
 
 	/**
 	 * 查询列表

+ 5 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserExamRecordServiceImpl.java

@@ -81,23 +81,26 @@ public class UserExamRecordServiceImpl extends ServiceImpl<UserExamRecordMapper,
     }
 
     @Override
-    public Boolean delUserBankHistory(Long userId, Long goodsId) {
+    public Boolean delUserBankHistory(Long userId, Long goodsId,Long orderGoodsId) {
         //删除做题历史
         LambdaQueryWrapper<UserExamRecord> lqw = Wrappers.lambdaQuery();
         lqw.eq(UserExamRecord::getGoodsId, goodsId);
         lqw.eq( UserExamRecord::getUserId, userId);
+        lqw.eq( UserExamRecord::getOrderGoodsId, orderGoodsId);
         remove(lqw);
         //删除错题历史
         LambdaQueryWrapper<UserExamWrongRecord> lqw1 = Wrappers.lambdaQuery();
         lqw1.eq(UserExamWrongRecord::getGoodsId, goodsId);
         lqw1.eq( UserExamWrongRecord::getUserId, userId);
+        lqw1.eq( UserExamWrongRecord::getOrderGoodsId, orderGoodsId);
         iUserExamWrongRecordService.remove(lqw1);
         //删除收藏
         LambdaQueryWrapper<CollectQuestion> lqw2 = Wrappers.lambdaQuery();
         lqw2.eq(CollectQuestion::getGoodsId, goodsId);
         lqw2.eq( CollectQuestion::getUserId, userId);
+        lqw2.eq( CollectQuestion::getOrderGoodsId, orderGoodsId);
         iCollectQuestionService.remove(lqw2);
-        return null;
+        return true;
     }
 
     @Override