分享好友1
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
/**
|
||||
* 新用户获得券
|
||||
|
||||
@@ -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)
|
||||
+ "-"
|
||||
|
||||
Reference in New Issue
Block a user