...
|
...
|
@@ -145,14 +145,16 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ |
|
|
if (CollectionUtils.isNotEmpty(coupons)){
|
|
|
List<Integer> couponIdList = coupons.stream().map(Coupon::getId).collect(Collectors.toList());
|
|
|
List<UserCouponNum> sendNumList = userCouponMapper.selectByCouponIds(couponIdList);
|
|
|
LOGGER.info("sendNumList is {}", sendNumList);
|
|
|
sendNumMap = sendNumList.stream().collect(Collectors.toMap(UserCouponNum::getCouponId, Function.identity(), (k1,k2)->k2));
|
|
|
List<UserCouponNum> useNumList = userCouponMapper.selectByCouponIdsAndStatus(couponIdList);
|
|
|
LOGGER.info("useNumList is {}", useNumList);
|
|
|
useNumMap = useNumList.stream().collect(Collectors.toMap(UserCouponNum::getCouponId, Function.identity(), (k1,k2)->k2));
|
|
|
}
|
|
|
|
|
|
List<CouponQueryResp> couponQueryResps = initCouponQueryResps(coupons,req.getCurTime());
|
|
|
|
|
|
if (MapUtils.isEmpty(sendNumMap) && MapUtils.isEmpty(useNumMap)) {
|
|
|
if (MapUtils.isNotEmpty(sendNumMap) || MapUtils.isNotEmpty(useNumMap)) {
|
|
|
Map<Integer, UserCouponNum> finalSendNumMap = sendNumMap;
|
|
|
Map<Integer, UserCouponNum> finalUseNumMap = useNumMap;
|
|
|
couponQueryResps = couponQueryResps.stream().map(x->{
|
...
|
...
|
@@ -236,7 +238,8 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{ |
|
|
LOGGER.info("before saveOrUpdateCoupon#deleteByCouponId,couponId is {}",req.getId());
|
|
|
|
|
|
// 已经有了优惠券的发放记录
|
|
|
if (coupon.getSendNum() > 0){
|
|
|
UserCouponNum userCouponNum = userCouponMapper.selectByCouponId(coupon.getId());
|
|
|
if (Objects.isNull(userCouponNum) && userCouponNum.getCnt()>0){
|
|
|
CouponSaveUpdateReq couponSaveUpdateReq = new CouponSaveUpdateReq();
|
|
|
couponSaveUpdateReq.setId(coupon.getId());
|
|
|
|
...
|
...
|
|