|
@@ -22,6 +22,7 @@ import com.chelvc.framework.common.model.Pagination;
|
|
|
import com.chelvc.framework.database.context.DatabaseContextHolder;
|
|
|
import com.chelvc.framework.database.util.PagingUtils;
|
|
|
import lombok.NonNull;
|
|
|
+import org.apache.dubbo.config.annotation.DubboService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
@@ -32,7 +33,7 @@ import org.springframework.util.StringUtils;
|
|
|
* @author Woody
|
|
|
* @date 2023/7/17
|
|
|
*/
|
|
|
-@Service
|
|
|
+@DubboService(interfaceClass = com.chelvc.cloud.vehicle.api.service.CouponService.class)
|
|
|
public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> implements CouponService,
|
|
|
com.chelvc.cloud.vehicle.api.service.CouponService {
|
|
|
@Override
|
|
@@ -65,8 +66,9 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
|
|
|
// 查询优惠券列表
|
|
|
Page<Coupon> page = this.lambdaQuery()
|
|
|
.eq(Objects.nonNull(param.getMerchantId()), Coupon::getMerchantId, param.getMerchantId())
|
|
|
- .eq(Objects.nonNull(param.getCouponType()), Coupon::getType, param.getCouponType().name())
|
|
|
- .eq(Objects.nonNull(param.getCouponStatus()), Coupon::getStatus, param.getCouponStatus().name())
|
|
|
+ .eq(Objects.nonNull(param.getCouponType()), Coupon::getType, param.getCouponType())
|
|
|
+ .eq(Objects.nonNull(param.getCouponStatus()), Coupon::getStatus, param.getCouponStatus())
|
|
|
+ .eq(Objects.nonNull(param.getCouponClaimType()), Coupon::getClaimType, param.getCouponClaimType())
|
|
|
.or().like(!StringUtils.isEmpty(param.getKeyword()), Coupon::getName, param.getKeyword())
|
|
|
.orderByDesc(Coupon::getCreateTime).page(PagingUtils.convert(param.getPaging()));
|
|
|
List<Coupon> records = page.getRecords();
|
|
@@ -101,7 +103,10 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
|
|
|
if (Objects.isNull(coupon)) {
|
|
|
throw new ResourceUnavailableException("当前优惠券不存在");
|
|
|
}
|
|
|
- this.baseMapper.updateCouponReceivedNum(couponId, receiveNum);
|
|
|
+ int row = this.baseMapper.updateCouponReceivedNum(couponId, receiveNum, coupon.getPublishNum());
|
|
|
+ if (row < 1) {
|
|
|
+ throw new ResourceUnavailableException("修改优惠券已被领取数量失败!");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|