Przeglądaj źródła

[A端][修复]:修复更新campaign重复创建couponchannel的问题

release_toaliyun_real
hupeng 7 lat temu
rodzic
commit
a16dc87cfb
1 zmienionych plików z 13 dodań i 10 usunięć
  1. +13
    -10
      mallinkService/src/main/java/com/simple/service/impl/WxCampaignServiceImpl.java

+ 13
- 10
mallinkService/src/main/java/com/simple/service/impl/WxCampaignServiceImpl.java Wyświetl plik

@@ -77,6 +77,7 @@ public class WxCampaignServiceImpl implements WxCampaignService {
if (wxCouponChannels.size() > 0) { if (wxCouponChannels.size() > 0) {
for (WxCouponChannel ch : wxCouponChannels) { for (WxCouponChannel ch : wxCouponChannels) {
ch.setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); ch.setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode());
wxCouponChannels.get(i).setUpdateDate(new Date());
wxCouponChannelMapper.updateByPrimaryKeySelective(ch); wxCouponChannelMapper.updateByPrimaryKeySelective(ch);
} }
} }
@@ -99,6 +100,7 @@ public class WxCampaignServiceImpl implements WxCampaignService {
{ {
for (int i = 0; i < wxCouponChannels.size(); i++) { for (int i = 0; i < wxCouponChannels.size(); i++) {
wxCouponChannels.get(i).setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()); wxCouponChannels.get(i).setStatus(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode());
wxCouponChannels.get(i).setUpdateDate(new Date());
wxCouponChannelMapper.updateByPrimaryKeySelective(wxCouponChannels.get(i)); wxCouponChannelMapper.updateByPrimaryKeySelective(wxCouponChannels.get(i));
} }


@@ -118,19 +120,20 @@ public class WxCampaignServiceImpl implements WxCampaignService {
throw new MallinkException(ErrorCode.COUPON_IS_TAKE_OFF); throw new MallinkException(ErrorCode.COUPON_IS_TAKE_OFF);
} }


if(wxCouponChannels.size()>0) {
for (int i = 0; i < wxCouponChannels.size(); i++) {
if (wxCouponChannels.get(i).getId().longValue() == couponId.longValue()) {
wxCouponChannels.get(i).setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());
wxCouponChannels.get(i).setBeginTime(record.getValidStartDate());
wxCouponChannels.get(i).setEndTime(record.getValidEndDate());
wxCouponChannelMapper.updateByPrimaryKeySelective(wxCouponChannels.get(i));
wxCouponChannels.remove(i);
return;
}
for (int i = 0; i < wxCouponChannels.size(); i++) {
if (wxCouponChannels.get(i).getCouponId().longValue() == couponId.longValue()) {
wxCouponChannels.get(i).setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());
wxCouponChannels.get(i).setBeginTime(record.getValidStartDate());
wxCouponChannels.get(i).setEndTime(record.getValidEndDate());
wxCouponChannels.get(i).setUpdateDate(new Date());
wxCouponChannelMapper.updateByPrimaryKeySelective(wxCouponChannels.get(i));
wxCouponChannels.remove(i);
return;
} }
} }



WxCouponChannel wxCouponChannel = new WxCouponChannel(); WxCouponChannel wxCouponChannel = new WxCouponChannel();
wxCouponChannel.setBeginTime(record.getValidStartDate()); wxCouponChannel.setBeginTime(record.getValidStartDate());
wxCouponChannel.setEndTime(record.getValidEndDate()); wxCouponChannel.setEndTime(record.getValidEndDate());


Ładowanie…
Anuluj
Zapisz