diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java index 9a10309ea..1d0a2619b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java @@ -1,6 +1,5 @@ package com.iformall.service.impl; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -24,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import springfox.documentation.spring.web.json.Json; import java.text.SimpleDateFormat; import java.util.*; @@ -88,40 +86,20 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { /** * 会员生日券处理 + * * @param record * @return */ private WxCouponSend buildConditions(WxCouponSend record) { - if (!Objects.equals(record.getSendType(), EnumCouponSendSendType.BIRTHDAY.getCode())) { - return record ; - } - //会员生日券 - JSONObject conditions = JSONObject.parseObject(record.getConditions()); - Long couponId = record.getCouponId(); - if (Objects.nonNull(couponId)) { - JSONArray couponIds; - if (Objects.isNull(record.getId())) { - //添加新卡券 - couponIds = new JSONArray(); - couponIds.add(couponId); - } else { - //更新卡券列表 - WxCouponSend couponSend = wxCouponSendMapper.selectByPrimaryKey(record.getId()); - JSONObject couponSendJo = JSONObject.parseObject(couponSend.getConditions()); - couponIds = couponSendJo.getJSONArray("couponIds"); - if (Objects.isNull(couponIds)) { - couponIds = new JSONArray(); - couponIds.add(couponId); - } else { - //添加新卡券 - if (!couponIds.contains(couponId)) { - couponIds.add(couponId); - } - } + if (Objects.equals(record.getSendType(), EnumCouponSendSendType.BIRTHDAY.getCode())) { + if (Objects.isNull(record.getTitle())) { + record.setTitle(""); + } + if (Objects.isNull(record.getCouponId())) { + record.setCouponId(0L); } - conditions.put("couponIds", couponIds); + return record; } - record.setConditions(conditions.toJSONString()); return record; }