ソースを参照

fix 模板编辑

he2802 3 年 前
コミット
e31366b087

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

@@ -178,14 +178,14 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
         }
         Map<String, String> payResult =  iWxPayService.refund(out_trade_no,order.getTransid(),add.getRefundFee(),order.getPayPrice());
         if("OK".equals(payResult.get("return_msg"))&&Validator.isNotEmpty(payResult.get("refund_id"))){
-            return refundCall(payResult.get("refund_id"),add.getRefundId(),orderGoods.getOrderGoodsId(),order,goods.getGoodsType(),orderGoods.getGradeId());
+            return refundCall(payResult.get("refund_id"),add.getRefundId(),orderGoods.getOrderGoodsId(),order,goods.getGoodsType(),orderGoods.getGradeId(),bo.getUserId(),goods.getGoodsId());
         }else{
 
             throw new CustomException("退款错误"+ JSON.toJSONString(payResult));
         }
     }
 
-    public Boolean refundCall(String WxpayRefundId,Long refundId,Long orderGoodsId,Order order,Long goodsType,Long gradeId){
+    public Boolean refundCall(String WxpayRefundId,Long refundId,Long orderGoodsId,Order order,Long goodsType,Long gradeId,Long userId,Long goodsId){
         OrderGoodsRefund update = new OrderGoodsRefund();
         update.setRefundId(refundId);
         update.setUpdateTime(DateUtils.getNowTime());
@@ -227,6 +227,10 @@ public class OrderGoodsRefundServiceImpl extends ServiceImpl<OrderGoodsRefundMap
                 iClassGradeUserService.updateById(classGradeUser);
             }
         }
+        if(goodsType==2){
+            //删除题库历史
+            iUserExamRecordService.delUserBankHistory(userId,goodsId);
+        }
         return true;
     }
 

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderGoodsServiceImpl.java

@@ -68,6 +68,8 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
     @Autowired
     private IClassGradeGoodsService iClassGradeGoodsService;
 
+
+
     @Override
     public OrderGoodsVo queryById(Long orderGoodsId){
         OrderGoods db = this.baseMapper.selectById(orderGoodsId);

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

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

+ 31 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserExamRecordServiceImpl.java

@@ -3,13 +3,19 @@ package com.zhongzheng.modules.user.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.collect.domain.CollectBank;
+import com.zhongzheng.modules.collect.domain.CollectQuestion;
+import com.zhongzheng.modules.collect.service.ICollectBankService;
+import com.zhongzheng.modules.collect.service.ICollectQuestionService;
 import com.zhongzheng.modules.user.bo.UserExamRecordAddBo;
 import com.zhongzheng.modules.user.bo.UserExamRecordEditBo;
 import com.zhongzheng.modules.user.bo.UserExamRecordQueryBo;
 import com.zhongzheng.modules.user.domain.UserExamRecord;
+import com.zhongzheng.modules.user.domain.UserExamWrongRecord;
 import com.zhongzheng.modules.user.mapper.UserExamRecordMapper;
 import com.zhongzheng.modules.user.mapper.UserSubscribeMapper;
 import com.zhongzheng.modules.user.service.IUserExamRecordService;
+import com.zhongzheng.modules.user.service.IUserExamWrongRecordService;
 import com.zhongzheng.modules.user.vo.UserExamRecordVo;
 import com.zhongzheng.modules.user.vo.UserExamWrongRecordVo;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -36,6 +42,11 @@ public class UserExamRecordServiceImpl extends ServiceImpl<UserExamRecordMapper,
     @Autowired
     private UserExamRecordMapper userExamRecordMapper;
 
+    @Autowired
+    private IUserExamWrongRecordService iUserExamWrongRecordService;
+    @Autowired
+    private ICollectQuestionService iCollectQuestionService;
+
     @Override
     public UserExamRecordVo queryById(Long recordId){
         UserExamRecord db = this.baseMapper.selectById(recordId);
@@ -67,6 +78,26 @@ public class UserExamRecordServiceImpl extends ServiceImpl<UserExamRecordMapper,
         return this.baseMapper.getUserDoQuestionNum(bo);
     }
 
+    @Override
+    public Boolean delUserBankHistory(Long userId, Long goodsId) {
+        //删除做题历史
+        LambdaQueryWrapper<UserExamRecord> lqw = Wrappers.lambdaQuery();
+        lqw.eq(UserExamRecord::getGoodsId, goodsId);
+        lqw.eq( UserExamRecord::getUserId, userId);
+        remove(lqw);
+        //删除错题历史
+        LambdaQueryWrapper<UserExamWrongRecord> lqw1 = Wrappers.lambdaQuery();
+        lqw1.eq(UserExamWrongRecord::getGoodsId, goodsId);
+        lqw1.eq( UserExamWrongRecord::getUserId, userId);
+        iUserExamWrongRecordService.remove(lqw1);
+        //删除收藏
+        LambdaQueryWrapper<CollectQuestion> lqw2 = Wrappers.lambdaQuery();
+        lqw2.eq(CollectQuestion::getGoodsId, goodsId);
+        lqw2.eq( CollectQuestion::getUserId, userId);
+        iCollectQuestionService.remove(lqw2);
+        return null;
+    }
+
     @Override
     public List<UserExamRecordVo> queryList(UserExamRecordQueryBo bo) {
         LambdaQueryWrapper<UserExamRecord> lqw = Wrappers.lambdaQuery();

+ 2 - 2
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeUserMapper.xml

@@ -716,7 +716,7 @@
         LEFT JOIN goods g on cgg.goods_id = g.goods_id
         LEFT JOIN inform_remind_business irb on  irb.business_id = g.business_id
         where 1=1
-        and irb.remind_id =5
+        and irb.remind_id =6
           and cgu.status = 1
         AND unix_timestamp(now()) BETWEEN cg.class_end_time-864000 and cg.class_end_time-777600
         AND (SELECT COUNT(1) FROM inform_user iu where 1=1 and iu.remind_id = 6 and cgu.user_id = iu.user_id and cgu.grade_id = iu.grade_id and iu.system_status=3) &lt; 1
@@ -738,7 +738,7 @@
         LEFT JOIN goods g on cgg.goods_id = g.goods_id
         LEFT JOIN inform_remind_business irb on  irb.business_id = g.business_id
         where 1=1
-        and irb.remind_id =5
+        and irb.remind_id =7
           and cgu.status = 1
         AND unix_timestamp(now()) BETWEEN cg.class_end_time-432000 and cg.class_end_time-345600
         AND (SELECT COUNT(1) FROM inform_user iu where 1=1 and iu.remind_id = 6 and cgu.user_id = iu.user_id and cgu.grade_id = iu.grade_id and iu.system_status=3) &lt; 1

+ 1 - 1
zhongzheng-system/src/main/resources/mapper/modules/user/UserExamWrongRecordMapper.xml

@@ -136,7 +136,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="recordNum" parameterType="com.zhongzheng.modules.user.bo.UserExamWrongRecordQueryBo"  resultType="Long">
         SELECT
-        SUM( uewr.num )
+        IFNULL(SUM( uewr.num ),0)
         FROM
         (
         SELECT