Procházet zdrojové kódy

fix 渠道优惠码

zoujiajian před 1 rokem
rodič
revize
0f15cd0419

+ 8 - 4
netflix-service/src/main/java/com/cyksj/service/distribute/impl/DistributeServiceImpl.java

@@ -458,12 +458,16 @@ public class DistributeServiceImpl implements DistributeService {
 			//个人渠道
 			for (CouponDistributePopularize couponDistributePopularize : popularizeList) {
 				Long disId = couponDistributePopularize.getDistributeId();
-				if (disId != null && !ObjectUtil.equal(disId, distributeId)) {
-					throw BusinessRuntimeException.getInstance("优惠码:{0}已存在", exCode);
+				if (disId != null) {
+					if (!ObjectUtil.equal(disId, distributeId) || !ObjectUtil.equal(couponDistributePopularize.getCouponId(), data.getCouponId())) {
+						throw BusinessRuntimeException.getInstance("优惠码:{0}已存在", exCode);
+					}
 				}
 				Long uid = couponDistributePopularize.getUserId();
-				if (uid != null && !ObjectUtil.equal(uid, userId)) {
-					throw BusinessRuntimeException.getInstance("优惠码:{0}已存在", exCode);
+				if (uid != null) {
+					if (!ObjectUtil.equal(uid, userId) || !ObjectUtil.equal(couponDistributePopularize.getCouponId(), data.getCouponId())) {
+						throw BusinessRuntimeException.getInstance("优惠码:{0}已存在", exCode);
+					}
 				}
 			}
 			Integer count = couponMapper.selectCount(Wrappers.lambdaQuery(Coupon.class).eq(Coupon::getExCode, exCode).eq(Coupon::getDeleted, true));