Forráskód Böngészése

1、太乙堂优惠卷数据展示,未统计核销卷

yys 2 hete
szülő
commit
c04f3e247c

+ 6 - 1
fs-service/src/main/java/com/fs/his/service/impl/FsUserCouponServiceImpl.java

@@ -16,6 +16,7 @@ import com.fs.his.utils.PhoneUtil;
 import com.fs.his.vo.FsUserCouponCountUVO;
 import com.fs.his.vo.FsUserCouponListUVO;
 import com.fs.his.vo.FsUserCouponListVO;
+import com.fs.live.service.ILiveCouponUserService;
 import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -38,6 +39,9 @@ public class FsUserCouponServiceImpl implements IFsUserCouponService
 
     @Autowired
     private FsCouponMapper fsCouponMapper;
+
+    @Autowired
+    private ILiveCouponUserService liveCouponUserService;
     /**
      * 查询会员优惠券
      *
@@ -200,7 +204,8 @@ public class FsUserCouponServiceImpl implements IFsUserCouponService
             for (int i=0;i<3;i++){
                 param.setStatus(i);
                 List<FsUserCouponListUVO> list = fsUserCouponMapper.selectFsUserCouponListUVO(param);
-                countArray[i] = list.size();
+                // 互医优惠券 + 直播优惠券(status:0未使用/未核销 1已使用/已核销 2已过期)
+                countArray[i] = list.size() + liveCouponUserService.countByUserIdAndStatus(param.getUserId(), i);
             }
             countUVO.setNotUsedCount(countArray[0]);
             countUVO.setUsedCount(countArray[1]);

+ 6 - 0
fs-service/src/main/java/com/fs/live/mapper/LiveCouponUserMapper.java

@@ -88,6 +88,12 @@ public interface LiveCouponUserMapper
     @Select("select lcu.* from live_coupon_user lcu where lcu.verify_code = #{verifyCode} and lcu.is_del = 0 limit 1")
     LiveCouponUser selectLiveCouponUserByVerifyCode(@Param("verifyCode") String verifyCode);
 
+    /**
+     * 按用户与状态统计直播优惠券数量(排除已删除)
+     */
+    @Select("select count(1) from live_coupon_user where user_id = #{userId} and (is_del is null or is_del = 0) and status = #{status}")
+    int countByUserIdAndStatus(@Param("userId") Long userId, @Param("status") Integer status);
+
     List<LiveCouponUserDetailVo> selectLiveCouponUserDetailList(CouponPO coupon);
 
     LiveCouponUserDetailVo selectLiveCouponUserDetailById(@Param("id") Long id);

+ 5 - 0
fs-service/src/main/java/com/fs/live/service/ILiveCouponUserService.java

@@ -63,6 +63,11 @@ public interface ILiveCouponUserService
 
     List<LiveCouponUser> selectLiveCouponUserByCouponPO(CouponPO coupon);
 
+    /**
+     * 按用户与状态统计直播优惠券数量
+     */
+    int countByUserIdAndStatus(Long userId, Integer status);
+
     List<LiveCouponUser> curCoupon(CouponPO coupon);
 
     List<LiveCouponUserDetailVo> selectLiveCouponUserDetailList(CouponPO coupon);

+ 5 - 0
fs-service/src/main/java/com/fs/live/service/impl/LiveCouponUserServiceImpl.java

@@ -102,6 +102,11 @@ public class LiveCouponUserServiceImpl implements ILiveCouponUserService
         return liveCouponUserMapper.selectLiveCouponUserByCouponPO(coupon);
     }
 
+    @Override
+    public int countByUserIdAndStatus(Long userId, Integer status) {
+        return liveCouponUserMapper.countByUserIdAndStatus(userId, status);
+    }
+
     @Override
     public List<LiveCouponUser> curCoupon(CouponPO coupon) {
         return liveCouponUserMapper.curCoupon(coupon);