|
|
|
@@ -12,10 +12,7 @@ import com.iformall.domain.po.WxCoupon; |
|
|
|
import com.iformall.domain.po.WxCouponChannel; |
|
|
|
import com.iformall.domain.po.WxCouponMerchant; |
|
|
|
import com.iformall.domain.vo.WxCouponCVo; |
|
|
|
import com.iformall.enums.EnumCouponChannelStatus; |
|
|
|
import com.iformall.enums.EnumCouponSendStatus; |
|
|
|
import com.iformall.enums.EnumCouponStatus; |
|
|
|
import com.iformall.enums.EnumCouponType; |
|
|
|
import com.iformall.enums.*; |
|
|
|
import com.iformall.mapper.WxCouponMapper; |
|
|
|
import com.iformall.mapper.WxCouponMerchantMapper; |
|
|
|
import com.iformall.service.WxCouponChannelService; |
|
|
|
@@ -82,6 +79,7 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
cm.setCouponId(record.getId()); |
|
|
|
cm.setCreateDate(new Date()); |
|
|
|
cm.setUpdateDate(new Date()); |
|
|
|
cm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); |
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
//param.put("",record.get); |
|
|
|
cm.setParameter(param.toString()); |
|
|
|
@@ -97,6 +95,11 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
&& !record.getMerchantIds().isEmpty()) |
|
|
|
{ |
|
|
|
String[] ids = StringUtils.split(record.getMerchantIds(),","); |
|
|
|
|
|
|
|
WxCouponMerchant cmParam = new WxCouponMerchant(); |
|
|
|
cmParam.setCouponId(record.getId()); |
|
|
|
List<WxCouponMerchant> oldList = wxCouponMerchantMapper.findList(cmParam); |
|
|
|
|
|
|
|
Arrays.stream(ids).forEach(id -> { |
|
|
|
WxCouponMerchant cm = new WxCouponMerchant(); |
|
|
|
cm.setMerchantId(Long.valueOf(id)); |
|
|
|
@@ -105,11 +108,13 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
if (rcm != null) { |
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
//param.put("",record.get); |
|
|
|
rcm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); |
|
|
|
rcm.setParameter(param.toString()); |
|
|
|
rcm.setUpdateDate(new Date()); |
|
|
|
wxCouponMerchantMapper.updateByPrimaryKeySelective(rcm); |
|
|
|
}else { |
|
|
|
cm.setId(idWorker.nextId()); |
|
|
|
cm.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); |
|
|
|
cm.setCreateDate(new Date()); |
|
|
|
cm.setUpdateDate(new Date()); |
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
@@ -117,6 +122,15 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
cm.setParameter(param.toString()); |
|
|
|
wxCouponMerchantMapper.insertSelective(cm); |
|
|
|
} |
|
|
|
oldList.removeIf( |
|
|
|
old->old.getCouponId().equals(record.getId()) && |
|
|
|
old.getMerchantId().equals(Long.valueOf(id))); |
|
|
|
}); |
|
|
|
|
|
|
|
oldList.stream().forEach(old->{ |
|
|
|
old.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_INVALID.getCode()); |
|
|
|
old.setUpdateDate(new Date()); |
|
|
|
wxCouponMerchantMapper.updateByPrimaryKeySelective(old); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|