Merge branch 'company_server' of https://gitee.com/doc_wei01/skyeye into company_server

This commit is contained in:
wst 2024-12-14 21:58:13 +08:00
commit c7bb8790cc
3 changed files with 2 additions and 13 deletions

View file

@ -25,6 +25,4 @@ public interface CouponService extends SkyeyeBusinessService<Coupon> {
void queryCouponListByState(InputObject inputObject, OutputObject outputObject);
void queryCouponListByMaterialId(InputObject inputObject, OutputObject outputObject);
Integer getUseCount(String couponId);
}

View file

@ -274,15 +274,6 @@ public class CouponServiceImpl extends SkyeyeBusinessServiceImpl<CouponDao, Coup
outputObject.settotal(list.size());
}
@Override
public Integer getUseCount(String couponId) {
Coupon coupon = selectById(couponId);
if (ObjUtil.isEmpty(coupon)) {
throw new CustomException("优惠券不存在");
}
return coupon.getUseCount();
}
private void setDrawState(List<Coupon> list) {
if (CollectionUtil.isEmpty(list)) return;
List<String> couponIdList = list.stream().map(Coupon::getId).collect(Collectors.toList());

View file

@ -142,10 +142,10 @@ public class CouponUseServiceImpl extends SkyeyeBusinessServiceImpl<CouponUseDao
public void createPostpose(CouponUse couponUse, String userId) {
// 更新优惠券领取数量
couponService.updateTakeCount(couponUse.getCouponId(), couponUse.getCouponMation().getTakeCount() + 1);
Integer useCount = couponService.getUseCount(couponUse.getCouponId());
couponUse.setUsageCount(useCount);
// 新增优惠券可使用的商品信息
couponUseMaterialService.createEntity(couponUse.getCouponUseMaterialList(), userId);
Coupon coupon = couponService.selectById(couponUse.getCouponId());
couponUse.setUsageCount(coupon.getUseCount());
// 定时任务
Coupon couponMation = couponUse.getCouponMation();
if (Objects.equals(couponMation.getValidityType(), CouponValidityType.TERM.getKey())) {