|
|
|
@@ -69,31 +69,52 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { |
|
|
|
WxCouponChannel wxCouponChannel = new WxCouponChannel(); |
|
|
|
wxCouponChannel.updateTenantInfo(ttCouponVo); |
|
|
|
wxCouponChannel.setCouponIds(ids); |
|
|
|
wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); |
|
|
|
//上架状态 |
|
|
|
List<WxCouponChannel> list = wxCouponChannelMapper.findList(wxCouponChannel); |
|
|
|
if (!list.isEmpty()) { |
|
|
|
Map<Long, List<WxCouponChannel>> groupBy = list.stream().collect(Collectors.groupingBy(WxCouponChannel::getCouponId)); |
|
|
|
for (TtCouponVo temp : couponList) { |
|
|
|
if (groupBy.get(temp.getId()) != null) { |
|
|
|
List<Integer> channels = new ArrayList<>(); |
|
|
|
for (WxCouponChannel tempchannel : groupBy.get(temp.getId())) { |
|
|
|
if (!channels.contains(tempchannel.getTargetAd())) { |
|
|
|
channels.add(tempchannel.getTargetAd()); |
|
|
|
} |
|
|
|
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()); |
|
|
|
} |
|
|
|
String sss = JSON.toJSONString(channels); |
|
|
|
temp.setChannels(sss); |
|
|
|
} else { |
|
|
|
temp.setChannels(""); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
for (TtCouponVo temp : couponList) { |
|
|
|
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); |
|
|
|
|