From 6f94f63697d8e0842404b0caec24bbd204ec625d Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Tue, 29 Oct 2024 18:25:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=86=E4=BA=AB=E5=A5=BD=E5=8F=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TbShopShareController.java | 40 +++++ .../cashierservice/dao/TbShopShareMapper.java | 69 ++++++++ .../cashierservice/entity/TbShopShare.java | 129 ++++++++++++++ .../service/TbShopShareService.java | 24 +++ .../service/impl/TbShopCouponServiceImpl.java | 68 ++++---- .../service/impl/TbShopShareServiceImpl.java | 107 ++++++++++++ .../resources/mapper/TbShopShareMapper.xml | 164 ++++++++++++++++++ 7 files changed, 567 insertions(+), 34 deletions(-) create mode 100644 src/main/java/com/chaozhanggui/system/cashierservice/controller/TbShopShareController.java create mode 100644 src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopShareMapper.java create mode 100644 src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShare.java create mode 100644 src/main/java/com/chaozhanggui/system/cashierservice/service/TbShopShareService.java create mode 100644 src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareServiceImpl.java create mode 100644 src/main/resources/mapper/TbShopShareMapper.xml diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/controller/TbShopShareController.java b/src/main/java/com/chaozhanggui/system/cashierservice/controller/TbShopShareController.java new file mode 100644 index 0000000..c3f139f --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/controller/TbShopShareController.java @@ -0,0 +1,40 @@ +package com.chaozhanggui.system.cashierservice.controller; + +import com.chaozhanggui.system.cashierservice.service.TbShopShareService; +import com.chaozhanggui.system.cashierservice.sign.Result; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +/** + * 店铺分享(TbShopShare)表控制层 + * + * @author ww + * @since 2024-11-07 14:36:27 + */ +@RestController +@RequestMapping("tbShopShare") +public class TbShopShareController { + /** + * 服务对象 + */ + @Resource + private TbShopShareService tbShopShareService; + + + /** + * 通过主键查询单条数据 + * + * @param shopId 主键 + * @return 单条数据 + */ + @GetMapping("getByShopId") + public Result queryById(@RequestParam Integer shopId) { + return Result.successWithData(tbShopShareService.queryByShopId(shopId)); + } + +} + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopShareMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopShareMapper.java new file mode 100644 index 0000000..a24827a --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopShareMapper.java @@ -0,0 +1,69 @@ +package com.chaozhanggui.system.cashierservice.dao; + +import com.chaozhanggui.system.cashierservice.entity.TbShopShare; +import org.apache.ibatis.annotations.Param; +import org.springframework.data.domain.Pageable; + +import java.util.List; + +/** + * 店铺分享(TbShopShare)表数据库访问层 + * + * @author ww + * @since 2024-11-07 14:36:27 + */ +public interface TbShopShareMapper { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + TbShopShare queryById(Integer id); + TbShopShare queryByShopId(Integer shopId); + + /** + * 查询数据 + * + * @param tbShopShare 查询条件 + * @param pageable 分页对象 + * @return 对象列表 + */ + List queryAll(TbShopShare tbShopShare, @Param("pageable") Pageable pageable); + + + /** + * 新增数据 + * + * @param tbShopShare 实例对象 + * @return 影响行数 + */ + int insert(TbShopShare tbShopShare); + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param tbShopShare 实例对象 + * @return 影响行数 + */ + int update(TbShopShare tbShopShare); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(Integer id); + +} + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShare.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShare.java new file mode 100644 index 0000000..e770a75 --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShare.java @@ -0,0 +1,129 @@ +package com.chaozhanggui.system.cashierservice.entity; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.annotation.TableField; +import com.chaozhanggui.system.cashierservice.util.JSONUtil; +import lombok.Data; +import org.apache.commons.lang3.StringUtils; + +import java.math.BigDecimal; +import java.util.Date; +import java.io.Serializable; +import java.util.List; + +/** + * 店铺分享(TbShopShare)实体类 + * + * @author ww + * @since 2024-11-07 14:36:27 + */ +@Data +public class TbShopShare implements Serializable { + private static final long serialVersionUID = 955264376724636315L; + + private Integer id; + /** + * 店铺Id + */ + private Integer shopId; + /** + * 标题 + */ + private String title; + /** + * 分享封面图 + */ + private String shareImg; + /** + * 邀请顶部图 + */ + private String invitedImg; + /** + * 被邀顶部图 + */ + private String beInvitedImg; + /** + * 活动开始时间 + */ + private Date startTime; + /** + * 活动结束时间 + */ + private Date endTime; + /** + * 新用户获得券 + */ + private String newCoupon; + /** + * 邀请人数 + */ + private Integer invitedNum; + /** + * 奖励券 + */ + private String rewardCoupon; + /** + * 获取方法 get-新用户领取获得 use-新用户使用获得 + */ + private String getMethod; + /** + * 0 关闭 1 开启 + */ + private Integer status; + + @TableField(exist = false) + private List newCoupons; + + @TableField(exist = false) + private List rewardCoupons; + + public void setNewCoupon(String newCoupon) { + this.newCoupon = newCoupon; + if(StringUtils.isNotBlank(newCoupon)){ + this.newCoupons = JSONUtil.parseListTNewList(newCoupon,ShareCoupons.class); + } + } + + public void setRewardCoupon(String rewardCoupon) { + this.rewardCoupon = rewardCoupon; + if(StringUtils.isNotBlank(rewardCoupon)){ + this.rewardCoupons = JSONUtil.parseListTNewList(rewardCoupon,ShareCoupons.class); + } + } + + public void setNewCoupons(List newCoupons) { + this.newCoupons = newCoupons; + if(CollectionUtil.isNotEmpty(newCoupons)){ + this.newCoupon = JSONUtil.toJSONString(newCoupons); + } + } + + public void setRewardCoupons(List rewardCoupons) { + this.rewardCoupons = rewardCoupons; + if(CollectionUtil.isNotEmpty(rewardCoupons)){ + this.rewardCoupon = JSONUtil.toJSONString(rewardCoupons); + } + } + + @Data + public static class ShareCoupons { + //优惠券Id + private Integer couponId; + //优惠券名称 + private String couponName; + //优惠券数量 + private Integer couponNum; + //1 满减 2 商品 + private Integer type; + //满多少金额 + private Integer fullAmount; + //优惠多少金额 + private Integer discountAmount; + //使用描述 + private String useDetail; + //商品描述 + private List gives; + } + +} + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/TbShopShareService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbShopShareService.java new file mode 100644 index 0000000..998321b --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbShopShareService.java @@ -0,0 +1,24 @@ +package com.chaozhanggui.system.cashierservice.service; + +import com.chaozhanggui.system.cashierservice.entity.TbShopShare; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; + +/** + * 店铺分享(TbShopShare)表服务接口 + * + * @author ww + * @since 2024-11-07 14:36:27 + */ +public interface TbShopShareService { + + /** + * 通过ID查询单条数据 + * + * @param shopId 主键 + * @return 实例对象 + */ + TbShopShare queryByShopId(Integer shopId); + + +} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopCouponServiceImpl.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopCouponServiceImpl.java index 91148ae..bf1e314 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopCouponServiceImpl.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopCouponServiceImpl.java @@ -74,42 +74,42 @@ public class TbShopCouponServiceImpl implements TbShopCouponService { return canUseCoupon; } - private void setCouponInfo( Map coupons, TbUserCouponVo tbUserCouponVo, BigDecimal amount, String week, LocalTime now, DateTimeFormatter formatter) { - JsonObject json = new JsonObject(); - boolean isUse = true; - TbShopCoupon tbShopCoupon = couponMapper.queryById(tbUserCouponVo.getCouponId()); - StringBuilder useRestrictions = new StringBuilder("每天 "); - if (tbShopCoupon.getType().equals(1)) { - if (amount.compareTo(new BigDecimal(tbShopCoupon.getFullAmount())) < 0) { - isUse = false; - } + private void setCouponInfo(Map coupons, TbUserCouponVo tbUserCouponVo, BigDecimal amount, String week, LocalTime now, DateTimeFormatter formatter) { + JsonObject json = new JsonObject(); + boolean isUse = true; + TbShopCoupon tbShopCoupon = couponMapper.queryById(tbUserCouponVo.getCouponId()); + StringBuilder useRestrictions = new StringBuilder("每天 "); + if (tbShopCoupon.getType().equals(1)) { + if (amount.compareTo(new BigDecimal(tbShopCoupon.getFullAmount())) < 0) { + isUse = false; } - if (StringUtils.isNotBlank(tbShopCoupon.getUserDays())) { - String[] split = tbShopCoupon.getUserDays().split(","); - if (split.length != 7) { - useRestrictions = new StringBuilder(tbShopCoupon.getUserDays() + " "); - } - if (!tbShopCoupon.getUserDays().contains(week)) { - isUse = false; - } - } - if (tbShopCoupon.getUseTimeType().equals("custom")) { - if (now.isBefore(tbShopCoupon.getUseStartTime()) || now.isAfter(tbShopCoupon.getUseEndTime())) { - isUse = false; - } - useRestrictions.append( - tbShopCoupon.getUseStartTime().format(formatter) - + "-" - + tbShopCoupon.getUseEndTime().format(formatter)); - } else { - useRestrictions.append("全时段"); - } - useRestrictions.append(" 可用"); - json.addProperty("isUse", isUse); - json.addProperty("useRestrictions", useRestrictions.toString()); - - coupons.put(tbUserCouponVo.getCouponId(), json); } + if (StringUtils.isNotBlank(tbShopCoupon.getUserDays())) { + String[] split = tbShopCoupon.getUserDays().split(","); + if (split.length != 7) { + useRestrictions = new StringBuilder(tbShopCoupon.getUserDays() + " "); + } + if (!tbShopCoupon.getUserDays().contains(week)) { + isUse = false; + } + } + if (tbShopCoupon.getUseTimeType().equals("custom")) { + if (now.isBefore(tbShopCoupon.getUseStartTime()) || now.isAfter(tbShopCoupon.getUseEndTime())) { + isUse = false; + } + useRestrictions.append( + tbShopCoupon.getUseStartTime().format(formatter) + + "-" + + tbShopCoupon.getUseEndTime().format(formatter)); + } else { + useRestrictions.append("全时段"); + } + useRestrictions.append(" 可用"); + json.addProperty("isUse", isUse); + json.addProperty("useRestrictions", useRestrictions.toString()); + + coupons.put(tbUserCouponVo.getCouponId(), json); + } @Override diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareServiceImpl.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareServiceImpl.java new file mode 100644 index 0000000..9ba35fc --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareServiceImpl.java @@ -0,0 +1,107 @@ +package com.chaozhanggui.system.cashierservice.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.chaozhanggui.system.cashierservice.dao.TbCouponProductMapper; +import com.chaozhanggui.system.cashierservice.dao.TbShopCouponMapper; +import com.chaozhanggui.system.cashierservice.dao.TbShopShareMapper; +import com.chaozhanggui.system.cashierservice.entity.TbShopCoupon; +import com.chaozhanggui.system.cashierservice.entity.TbShopShare; +import com.chaozhanggui.system.cashierservice.service.TbShopShareService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.time.format.DateTimeFormatter; + +/** + * 店铺分享(TbShopShare)表服务实现类 + * + * @author ww + * @since 2024-11-07 14:36:27 + */ +@Service("tbShopShareService") +public class TbShopShareServiceImpl implements TbShopShareService { + @Resource + private TbShopShareMapper tbShopShareMapper; + @Autowired + private TbShopCouponMapper couponMapper; + @Autowired + private TbCouponProductMapper couProductMapper; + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public TbShopShare queryByShopId(Integer id) { + TbShopShare tbShopShare = tbShopShareMapper.queryByShopId(id); + if (tbShopShare != null) { + if(CollectionUtil.isNotEmpty(tbShopShare.getNewCoupons())){ + for (TbShopShare.ShareCoupons newCoupon : tbShopShare.getNewCoupons()) { + TbShopCoupon coupon = couponMapper.queryById(newCoupon.getCouponId()); + if (coupon != null) { + if (coupon.getType() == 1) { + //满减 + newCoupon.setType(1); + newCoupon.setFullAmount(coupon.getFullAmount()); + newCoupon.setDiscountAmount(coupon.getDiscountAmount()); + newCoupon.setUseDetail(setCouponInfo(coupon)); + } else if (coupon.getType() == 2) { + //商品 + newCoupon.setType(2); + newCoupon.setUseDetail(setCouponInfo(coupon)); + newCoupon.setGives(couProductMapper.queryProsByActivateId(coupon.getId(), newCoupon.getCouponNum())); + } + } + } + } + if(CollectionUtil.isNotEmpty(tbShopShare.getRewardCoupons())){ + for (TbShopShare.ShareCoupons rewardCoupon : tbShopShare.getRewardCoupons()) { + TbShopCoupon coupon = couponMapper.queryById(rewardCoupon.getCouponId()); + if (coupon != null) { + if (coupon.getType() == 1) { + //满减 + rewardCoupon.setType(1); + rewardCoupon.setFullAmount(coupon.getFullAmount()); + rewardCoupon.setDiscountAmount(coupon.getDiscountAmount()); + rewardCoupon.setUseDetail(setCouponInfo(coupon)); + } else if (coupon.getType() == 2) { + //商品 + rewardCoupon.setType(2); + rewardCoupon.setUseDetail(setCouponInfo(coupon)); + rewardCoupon.setGives(couProductMapper.queryProsByActivateId(coupon.getId(), rewardCoupon.getCouponNum())); + } + } + } + } + } + return tbShopShare; + } + + private String setCouponInfo(TbShopCoupon tbShopCoupon) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss"); + StringBuilder useRestrictions = new StringBuilder("每天 "); + if (StringUtils.isNotBlank(tbShopCoupon.getUserDays())) { + String[] split = tbShopCoupon.getUserDays().split(","); + if (split.length != 7) { + useRestrictions = new StringBuilder(tbShopCoupon.getUserDays() + " "); + } + + } + if (tbShopCoupon.getUseTimeType().equals("custom")) { + useRestrictions.append( + tbShopCoupon.getUseStartTime().format(formatter) + + "-" + + tbShopCoupon.getUseEndTime().format(formatter)); + } else { + useRestrictions.append("全时段"); + } + useRestrictions.append(" 可用"); + + return useRestrictions.toString(); + } + +} diff --git a/src/main/resources/mapper/TbShopShareMapper.xml b/src/main/resources/mapper/TbShopShareMapper.xml new file mode 100644 index 0000000..f4734dd --- /dev/null +++ b/src/main/resources/mapper/TbShopShareMapper.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + id + , shop_id, title, share_img, invited_img, be_invited_img, start_time, end_time, new_coupon, invited_num, reward_coupon, get_method, status + + + + + + + + + + + + + insert into tb_shop_share(shop_id, title, share_img, invited_img, be_invited_img, start_time, end_time, + new_coupon, invited_num, reward_coupon, get_method, status) + values (#{shopId}, #{title}, #{shareImg}, #{invitedImg}, #{beInvitedImg}, #{startTime}, #{endTime}, + #{newCoupon}, #{invitedNum}, #{rewardCoupon}, #{getMethod}, #{status}) + + + + insert into tb_shop_share(shop_id, title, share_img, invited_img, be_invited_img, start_time, end_time, + new_coupon, invited_num, reward_coupon, get_method, status) + values + + (#{entity.shopId}, #{entity.title}, #{entity.shareImg}, #{entity.invitedImg}, #{entity.beInvitedImg}, + #{entity.startTime}, #{entity.endTime}, #{entity.newCoupon}, #{entity.invitedNum}, #{entity.rewardCoupon}, + #{entity.getMethod}, #{entity.status}) + + + + + + update tb_shop_share + + + shop_id = #{shopId}, + + + title = #{title}, + + + share_img = #{shareImg}, + + + invited_img = #{invitedImg}, + + + be_invited_img = #{beInvitedImg}, + + + start_time = #{startTime}, + + + end_time = #{endTime}, + + + new_coupon = #{newCoupon}, + + + invited_num = #{invitedNum}, + + + reward_coupon = #{rewardCoupon}, + + + get_method = #{getMethod}, + + + status = #{status}, + + + where id = #{id} + + + + + delete + from tb_shop_share + where id = #{id} + + + + From 6a54e8f23a70c052e1457defd38c7b265179c4eb Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 7 Nov 2024 15:25:37 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=86=E4=BA=AB=E5=A5=BD=E5=8F=8B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TbShopShareController.java | 3 ++- .../cashierservice/entity/TbShopShare.java | 3 +++ .../service/impl/TbShopShareServiceImpl.java | 23 ++++++++----------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/controller/TbShopShareController.java b/src/main/java/com/chaozhanggui/system/cashierservice/controller/TbShopShareController.java index c3f139f..12bf3da 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/controller/TbShopShareController.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/controller/TbShopShareController.java @@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.controller; import com.chaozhanggui.system.cashierservice.service.TbShopShareService; import com.chaozhanggui.system.cashierservice.sign.Result; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -21,7 +22,7 @@ public class TbShopShareController { /** * 服务对象 */ - @Resource + @Autowired private TbShopShareService tbShopShareService; diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShare.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShare.java index e770a75..9c3021f 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShare.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShare.java @@ -3,6 +3,7 @@ package com.chaozhanggui.system.cashierservice.entity; import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.annotation.TableField; import com.chaozhanggui.system.cashierservice.util.JSONUtil; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.apache.commons.lang3.StringUtils; @@ -45,10 +46,12 @@ public class TbShopShare implements Serializable { /** * 活动开始时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startTime; /** * 活动结束时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date endTime; /** * 新用户获得券 diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareServiceImpl.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareServiceImpl.java index 9ba35fc..156b121 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareServiceImpl.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareServiceImpl.java @@ -9,6 +9,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbShopShare; import com.chaozhanggui.system.cashierservice.service.TbShopShareService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -20,26 +21,22 @@ import java.time.format.DateTimeFormatter; * @author ww * @since 2024-11-07 14:36:27 */ -@Service("tbShopShareService") +@Primary +@Service public class TbShopShareServiceImpl implements TbShopShareService { - @Resource + @Autowired private TbShopShareMapper tbShopShareMapper; @Autowired private TbShopCouponMapper couponMapper; @Autowired private TbCouponProductMapper couProductMapper; - /** - * 通过ID查询单条数据 - * - * @param id 主键 - * @return 实例对象 - */ + @Override - public TbShopShare queryByShopId(Integer id) { - TbShopShare tbShopShare = tbShopShareMapper.queryByShopId(id); + public TbShopShare queryByShopId(Integer shopId) { + TbShopShare tbShopShare = tbShopShareMapper.queryByShopId(shopId); if (tbShopShare != null) { - if(CollectionUtil.isNotEmpty(tbShopShare.getNewCoupons())){ + if (CollectionUtil.isNotEmpty(tbShopShare.getNewCoupons())) { for (TbShopShare.ShareCoupons newCoupon : tbShopShare.getNewCoupons()) { TbShopCoupon coupon = couponMapper.queryById(newCoupon.getCouponId()); if (coupon != null) { @@ -58,7 +55,7 @@ public class TbShopShareServiceImpl implements TbShopShareService { } } } - if(CollectionUtil.isNotEmpty(tbShopShare.getRewardCoupons())){ + if (CollectionUtil.isNotEmpty(tbShopShare.getRewardCoupons())) { for (TbShopShare.ShareCoupons rewardCoupon : tbShopShare.getRewardCoupons()) { TbShopCoupon coupon = couponMapper.queryById(rewardCoupon.getCouponId()); if (coupon != null) { @@ -91,7 +88,7 @@ public class TbShopShareServiceImpl implements TbShopShareService { } } - if (tbShopCoupon.getUseTimeType().equals("custom")) { + if (StringUtils.isNotBlank(tbShopCoupon.getUseTimeType()) && tbShopCoupon.getUseTimeType().equals("custom")) { useRestrictions.append( tbShopCoupon.getUseStartTime().format(formatter) + "-"