Commit d0cc596e by 吕明尚

修改我的优惠券查询

parent 0184db76
...@@ -104,7 +104,14 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe ...@@ -104,7 +104,14 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
SConsumerCouponVo vo = new SConsumerCouponVo(); SConsumerCouponVo vo = new SConsumerCouponVo();
BeanUtils.copyProperties(item, vo); BeanUtils.copyProperties(item, vo);
if (!ObjectUtils.isEmpty(item.getStoreId())) { if (!ObjectUtils.isEmpty(item.getStoreId())) {
vo.setStoreName(list.stream().filter(obj -> obj.getId().equals(item.getStoreId())).findFirst().get().getName()); Optional<SStore> matchingObj = list.stream()
.filter(obj -> obj.getId().equals(item.getStoreId()))
.findAny();
if (matchingObj.isPresent()) {
vo.setStoreName(matchingObj.get().getName());
} else {
vo.setStoreName("");
}
} }
if (item.getCouponType().equals(CouponTypeEnum.CASH.getCode()) && StringUtils.isEmpty(item.getStoreIds())) { if (item.getCouponType().equals(CouponTypeEnum.CASH.getCode()) && StringUtils.isEmpty(item.getStoreIds())) {
item.setStoreIds(list.stream().map(SStore::getId).collect(Collectors.toList()).stream().map(String::valueOf).collect(Collectors.joining(","))); item.setStoreIds(list.stream().map(SStore::getId).collect(Collectors.toList()).stream().map(String::valueOf).collect(Collectors.joining(",")));
...@@ -428,6 +435,9 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe ...@@ -428,6 +435,9 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
newSConsumerCoupon.setMinPrice(new BigDecimal(0.00)); newSConsumerCoupon.setMinPrice(new BigDecimal(0.00));
newSConsumerCoupon.setSubPrice(sCoupon.getSubPrice()); newSConsumerCoupon.setSubPrice(sCoupon.getSubPrice());
newSConsumerCoupon.setWeeks(sCoupon.getWeeks()); newSConsumerCoupon.setWeeks(sCoupon.getWeeks());
newSConsumerCoupon.setStoreIds(sCoupon.getStoreIds());
newSConsumerCoupon.setSubPrice(sCoupon.getSubPrice());
newSConsumerCoupon.setCouponPayPrice(sCoupon.getCouponPayPrice());
newSConsumerCoupon.setMinDuration(sCoupon.getMinDuration()); newSConsumerCoupon.setMinDuration(sCoupon.getMinDuration());
newSConsumerCoupon.setMaxDuration(sCoupon.getMaxDuration()); newSConsumerCoupon.setMaxDuration(sCoupon.getMaxDuration());
newSConsumerCoupon.setDuration(sCoupon.getDuration()); newSConsumerCoupon.setDuration(sCoupon.getDuration());
......
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