|
|
|
@@ -91,72 +91,72 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
@Autowired |
|
|
|
WxMerchantService wxMerchantService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultData couponList(TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize) { |
|
|
|
PageInfo<TtCouponVo> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.ttCouponList(ttCouponVo)); |
|
|
|
List<TtCouponVo> couponList = pageInfo.getList(); |
|
|
|
|
|
|
|
if(!couponList.isEmpty()){ |
|
|
|
List<Long> ids = couponList.stream().map(p -> p.getId()).collect(toList()); |
|
|
|
WxCouponChannel wxCouponChannel = new WxCouponChannel(); |
|
|
|
wxCouponChannel.updateTenantInfo(ttCouponVo); |
|
|
|
wxCouponChannel.setCouponIds(ids); |
|
|
|
//上架状态 |
|
|
|
wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); |
|
|
|
List<WxCouponChannel> channellist = wxCouponChannelMapper.findList(wxCouponChannel); |
|
|
|
Map<Long, List<WxCouponChannel>> channelGroupCoupon = new HashMap<>(); |
|
|
|
if(!channellist.isEmpty()){ |
|
|
|
channelGroupCoupon = channellist.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId)); |
|
|
|
} |
|
|
|
|
|
|
|
//预审状态 |
|
|
|
wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode()); |
|
|
|
List<WxCouponChannel> planchannellist = wxCouponChannelMapper.findList(wxCouponChannel); |
|
|
|
Map<Long, List<WxCouponChannel>> planChannelGroupCoupon = new HashMap<>(); |
|
|
|
if(!planchannellist.isEmpty()){ |
|
|
|
planChannelGroupCoupon = planchannellist.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId)); |
|
|
|
} |
|
|
|
|
|
|
|
for (TtCouponVo temp : couponList) { |
|
|
|
List<Integer> channels = new ArrayList<>(); |
|
|
|
List<WxCouponChannel> couponChannels = channelGroupCoupon.get(temp.getId()); |
|
|
|
if(couponChannels != null && !couponChannels.isEmpty()){ |
|
|
|
for (WxCouponChannel tempchannel : couponChannels) { |
|
|
|
if (!channels.contains(tempchannel.getTargetAd())) { |
|
|
|
channels.add(tempchannel.getTargetAd()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(!channels.isEmpty()){ |
|
|
|
temp.setChannels(JSON.toJSONString(channels)); |
|
|
|
}else{ |
|
|
|
temp.setChannels(""); |
|
|
|
} |
|
|
|
|
|
|
|
List<Integer> planChannels = new ArrayList<>(); |
|
|
|
List<WxCouponChannel> planCouponChannels = planChannelGroupCoupon.get(temp.getId()); |
|
|
|
if(planCouponChannels != null && !planCouponChannels.isEmpty()){ |
|
|
|
for (WxCouponChannel tempchannel : planCouponChannels) { |
|
|
|
if (!planChannels.contains(tempchannel.getTargetAd())) { |
|
|
|
planChannels.add(tempchannel.getTargetAd()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(!planChannels.isEmpty()){ |
|
|
|
temp.setPlanChannels(JSON.toJSONString(planChannels)); |
|
|
|
}else{ |
|
|
|
temp.setPlanChannels(""); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return new ResultData(pageInfo); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultData channelList(TtCouponChannelVo ttChannelVo, Integer pageNum, Integer pageSize) { |
|
|
|
PageInfo<TtCouponChannelVo> ttCouponChannelVoPageInfo = wxCouponChannelService.ttChannelList(ttChannelVo, pageNum, pageSize); |
|
|
|
return new ResultData(ttCouponChannelVoPageInfo); |
|
|
|
} |
|
|
|
// @Override |
|
|
|
// public ResultData couponList(TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize) { |
|
|
|
// PageInfo<TtCouponVo> pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> wxCouponMapper.ttCouponList(ttCouponVo)); |
|
|
|
// List<TtCouponVo> couponList = pageInfo.getList(); |
|
|
|
// |
|
|
|
// if(!couponList.isEmpty()){ |
|
|
|
// List<Long> ids = couponList.stream().map(p -> p.getId()).collect(toList()); |
|
|
|
// WxCouponChannel wxCouponChannel = new WxCouponChannel(); |
|
|
|
// wxCouponChannel.updateTenantInfo(ttCouponVo); |
|
|
|
// wxCouponChannel.setCouponIds(ids); |
|
|
|
// //上架状态 |
|
|
|
// wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); |
|
|
|
// List<WxCouponChannel> channellist = wxCouponChannelMapper.findList(wxCouponChannel); |
|
|
|
// Map<Long, List<WxCouponChannel>> channelGroupCoupon = new HashMap<>(); |
|
|
|
// if(!channellist.isEmpty()){ |
|
|
|
// channelGroupCoupon = channellist.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId)); |
|
|
|
// } |
|
|
|
// |
|
|
|
// //预审状态 |
|
|
|
// wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode()); |
|
|
|
// List<WxCouponChannel> planchannellist = wxCouponChannelMapper.findList(wxCouponChannel); |
|
|
|
// Map<Long, List<WxCouponChannel>> planChannelGroupCoupon = new HashMap<>(); |
|
|
|
// if(!planchannellist.isEmpty()){ |
|
|
|
// planChannelGroupCoupon = planchannellist.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId)); |
|
|
|
// } |
|
|
|
// |
|
|
|
// for (TtCouponVo temp : couponList) { |
|
|
|
// List<Integer> channels = new ArrayList<>(); |
|
|
|
// List<WxCouponChannel> couponChannels = channelGroupCoupon.get(temp.getId()); |
|
|
|
// if(couponChannels != null && !couponChannels.isEmpty()){ |
|
|
|
// for (WxCouponChannel tempchannel : couponChannels) { |
|
|
|
// if (!channels.contains(tempchannel.getTargetAd())) { |
|
|
|
// channels.add(tempchannel.getTargetAd()); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// if(!channels.isEmpty()){ |
|
|
|
// temp.setChannels(JSON.toJSONString(channels)); |
|
|
|
// }else{ |
|
|
|
// temp.setChannels(""); |
|
|
|
// } |
|
|
|
// |
|
|
|
// List<Integer> planChannels = new ArrayList<>(); |
|
|
|
// List<WxCouponChannel> planCouponChannels = planChannelGroupCoupon.get(temp.getId()); |
|
|
|
// if(planCouponChannels != null && !planCouponChannels.isEmpty()){ |
|
|
|
// for (WxCouponChannel tempchannel : planCouponChannels) { |
|
|
|
// if (!planChannels.contains(tempchannel.getTargetAd())) { |
|
|
|
// planChannels.add(tempchannel.getTargetAd()); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// if(!planChannels.isEmpty()){ |
|
|
|
// temp.setPlanChannels(JSON.toJSONString(planChannels)); |
|
|
|
// }else{ |
|
|
|
// temp.setPlanChannels(""); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// return new ResultData(pageInfo); |
|
|
|
// } |
|
|
|
// |
|
|
|
// @Override |
|
|
|
// public ResultData channelList(TtCouponChannelVo ttChannelVo, Integer pageNum, Integer pageSize) { |
|
|
|
// PageInfo<TtCouponChannelVo> ttCouponChannelVoPageInfo = wxCouponChannelService.ttChannelList(ttChannelVo, pageNum, pageSize); |
|
|
|
// return new ResultData(ttCouponChannelVoPageInfo); |
|
|
|
// } |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) |
|
|
|
@@ -685,7 +685,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
if(wxCoupon == null){ |
|
|
|
return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"未找到该券"); |
|
|
|
} |
|
|
|
if(!EnumCouponType.COUPON_DOUYIN.getCode().equals(wxCoupon.getType())){ |
|
|
|
if(!EnumCouponType.getDouYinType().contains(wxCoupon.getType())){ |
|
|
|
return new ResultData(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED); |
|
|
|
} |
|
|
|
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(wxCoupon.getTenantId(),wxCoupon.getId()); |
|
|
|
@@ -737,7 +737,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
if(wxCoupon == null){ |
|
|
|
return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"未找到该券"); |
|
|
|
} |
|
|
|
if(!EnumCouponType.COUPON_DOUYIN.getCode().equals(wxCoupon.getType())){ |
|
|
|
if(!EnumCouponType.getDouYinType().contains(wxCoupon.getType())){ |
|
|
|
return new ResultData(ErrorCode.COUPON_ORDER_TYPE_NOT_SUPPORTED); |
|
|
|
} |
|
|
|
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(wxCoupon.getTenantId(),wxCoupon.getId()); |
|
|
|
|