Commit d37ce92e by huluobin

update

parent 16a28fa1
...@@ -200,6 +200,7 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme ...@@ -200,6 +200,7 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
public void checkCouponConflict(Collection<Integer> couponIdList) throws RRException { public void checkCouponConflict(Collection<Integer> couponIdList) throws RRException {
LinkedList<Integer> linkList = new LinkedList<>(couponIdList); LinkedList<Integer> linkList = new LinkedList<>(couponIdList);
//终止条件 //终止条件
if (linkList.size() == 2) { if (linkList.size() == 2) {
Integer couponId = linkList.get(0); Integer couponId = linkList.get(0);
...@@ -209,18 +210,18 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme ...@@ -209,18 +210,18 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
if (couponExcludeDetailed != null) { if (couponExcludeDetailed != null) {
Coupon coupon = this.getById(couponId); Coupon coupon = this.getById(couponId);
Coupon excludeCoupon = this.getById(excludeCouponId); Coupon excludeCoupon = this.getById(excludeCouponId);
throw new RRException("卡券:{}和卡券{}不同同时使用", coupon.getName(), excludeCoupon.getName()); throw new RRException("卡券:%s和卡券%s不能同时使用", coupon.getName(), excludeCoupon.getName());
} }
} }
// //
else { else if (linkList.size() > 2) {
Integer first = linkList.pollFirst(); Integer first = linkList.pollFirst();
for (Integer couponId : linkList) { for (Integer couponId : linkList) {
CouponExcludeDetailed couponExcludeDetailed = couponExcludeDetailedMapper.selectExcludeDetailed(couponId, first); CouponExcludeDetailed couponExcludeDetailed = couponExcludeDetailedMapper.selectExcludeDetailed(couponId, first);
if (couponExcludeDetailed != null) { if (couponExcludeDetailed != null) {
Coupon coupon = this.getById(couponExcludeDetailed.getCouponId()); Coupon coupon = this.getById(couponExcludeDetailed.getCouponId());
Coupon excludeCoupon = this.getById(couponExcludeDetailed.getExcludeCouponId()); Coupon excludeCoupon = this.getById(couponExcludeDetailed.getExcludeCouponId());
throw new RRException("卡券:{}和卡券{}不同同时使用", coupon.getName(), excludeCoupon.getName()); throw new RRException("卡券:%s和卡券%s不能同时使用", coupon.getName(), excludeCoupon.getName());
} }
} }
...@@ -229,5 +230,4 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme ...@@ -229,5 +230,4 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment