From 19202f58818e51535f0c67fc00b5f312477cf553 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 8 Nov 2024 11:42:12 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E9=82=80=E8=AF=B7=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashierservice/auth/LoginFilter.java | 1 - .../dao/TbShopShareRecordMapper.java | 6 + .../entity/TbShopShareRecord.java | 106 +----------------- .../entity/dto/UserCouponDto.java | 11 -- .../service/TbShopShareRecordService.java | 3 +- .../impl/TbShopShareRecordServiceImpl.java | 22 +++- .../mapper/TbShopShareRecordMapper.xml | 39 +++++++ 7 files changed, 69 insertions(+), 119 deletions(-) delete mode 100644 src/main/java/com/chaozhanggui/system/cashierservice/entity/dto/UserCouponDto.java diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/auth/LoginFilter.java b/src/main/java/com/chaozhanggui/system/cashierservice/auth/LoginFilter.java index 5c49993..cb6cfc2 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/auth/LoginFilter.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/auth/LoginFilter.java @@ -45,7 +45,6 @@ public class LoginFilter implements Filter { "cashierService/home",//首页 "cashierService/order/testMessage",//首页 "cashierService/common/**",//通用接口 - "cashierService/tbShopShare/**",//通用接口 "cashierService/distirict/**",//首页其它接口 // "cashierService/login/**",//登录部分接口不校验 diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopShareRecordMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopShareRecordMapper.java index a48eace..5ee94c6 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopShareRecordMapper.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopShareRecordMapper.java @@ -1,10 +1,12 @@ package com.chaozhanggui.system.cashierservice.dao; import com.chaozhanggui.system.cashierservice.entity.TbShopShareRecord; +import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Param; import org.springframework.data.domain.Pageable; import java.util.List; +import java.util.Map; /** * (TbShopShareRecord)表数据库访问层 @@ -37,6 +39,10 @@ public interface TbShopShareRecordMapper { * @return 对象列表 */ List query(TbShopShareRecord tbShopShareRecord); + Map statisticsRecord(TbShopShareRecord tbShopShareRecord); + + List queryIsSuccess(TbShopShareRecord tbShopShareRecord); + List queryIsNoSuccess(TbShopShareRecord tbShopShareRecord); /** diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShareRecord.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShareRecord.java index 36b0a63..11238c4 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShareRecord.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShareRecord.java @@ -1,5 +1,8 @@ package com.chaozhanggui.system.cashierservice.entity; +import com.chaozhanggui.system.cashierservice.entity.dto.BasePageDto; +import lombok.Data; + import java.util.Date; import java.io.Serializable; @@ -9,7 +12,8 @@ import java.io.Serializable; * @author ww * @since 2024-11-07 15:50:04 */ -public class TbShopShareRecord implements Serializable { +@Data +public class TbShopShareRecord extends BasePageDto implements Serializable { private static final long serialVersionUID = -41620929736900271L; private Integer id; @@ -45,6 +49,7 @@ public class TbShopShareRecord implements Serializable { * 1 未领取 2 已领取 3 已使用 */ private Integer status; + private boolean isSuccess = true; /** * 生效时间/获得奖励的时间 */ @@ -53,104 +58,5 @@ public class TbShopShareRecord implements Serializable { private Date createTime; private Date updateTime; - - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getShareId() { - return shareId; - } - - public void setShareId(Integer shareId) { - this.shareId = shareId; - } - - public Integer getShopId() { - return shopId; - } - - public void setShopId(Integer shopId) { - this.shopId = shopId; - } - - public Integer getInvitedId() { - return invitedId; - } - - public void setInvitedId(Integer invitedId) { - this.invitedId = invitedId; - } - - public String getInvitedName() { - return invitedName; - } - - public void setInvitedName(String invitedName) { - this.invitedName = invitedName; - } - - public Integer getBeInvitedId() { - return beInvitedId; - } - - public void setBeInvitedId(Integer beInvitedId) { - this.beInvitedId = beInvitedId; - } - - - public String getBeInvitedName() { - return beInvitedName; - } - - public void setBeInvitedName(String beInvitedName) { - this.beInvitedName = beInvitedName; - } - - public String getMethod() { - return method; - } - - public void setMethod(String method) { - this.method = method; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public Date getRewardTime() { - return rewardTime; - } - - public void setRewardTime(Date rewardTime) { - this.rewardTime = rewardTime; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/dto/UserCouponDto.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/dto/UserCouponDto.java deleted file mode 100644 index b53d03f..0000000 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/dto/UserCouponDto.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.chaozhanggui.system.cashierservice.entity.dto; - -import lombok.Data; - -@Data -public class UserCouponDto extends BasePageDto{ - private Integer userId; - private Integer status; - private Integer shopId; - -} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/TbShopShareRecordService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbShopShareRecordService.java index c71057c..82e681e 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/TbShopShareRecordService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbShopShareRecordService.java @@ -6,6 +6,7 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import java.util.List; +import java.util.Map; /** * (TbShopShareRecord)表服务接口 @@ -29,7 +30,7 @@ public interface TbShopShareRecordService { * @param tbShopShareRecord 筛选条件 * @return 查询结果 */ - List query(TbShopShareRecord tbShopShareRecord); + Map query(TbShopShareRecord tbShopShareRecord); Result receive(TbShopShareRecord tbShopShareRecord); diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java index 35ff26a..50e5801 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java @@ -7,7 +7,10 @@ import cn.hutool.core.util.RandomUtil; import com.chaozhanggui.system.cashierservice.dao.*; import com.chaozhanggui.system.cashierservice.entity.*; import com.chaozhanggui.system.cashierservice.service.TbShopShareRecordService; +import com.chaozhanggui.system.cashierservice.sign.CodeEnum; import com.chaozhanggui.system.cashierservice.sign.Result; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; @@ -17,9 +20,7 @@ import org.springframework.data.domain.PageRequest; import javax.annotation.Resource; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +import java.util.*; /** * (TbShopShareRecord)表服务实现类 @@ -63,12 +64,21 @@ public class TbShopShareRecordServiceImpl implements TbShopShareRecordService { * @return 查询结果 */ @Override - public List query(TbShopShareRecord tbShopShareRecord) { - List records = tbShopShareRecordMapper.query(tbShopShareRecord); + public Map query(TbShopShareRecord tbShopShareRecord) { + Map result = tbShopShareRecordMapper.statisticsRecord(tbShopShareRecord); + PageHelper.startPage(tbShopShareRecord.getPage(), tbShopShareRecord.getSize()); + + List records; + if(tbShopShareRecord.isSuccess()){ + records = tbShopShareRecordMapper.queryIsSuccess(tbShopShareRecord); + }else { + records = tbShopShareRecordMapper.queryIsNoSuccess(tbShopShareRecord); + } for (TbShopShareRecord shareRecord : records) { shareRecord.setBeInvitedName(userInfoMapper.selectNameByPrimaryKey(shareRecord.getBeInvitedId())); } - return records; + result.put("records",new PageInfo<>(records)); + return result; } @Override diff --git a/src/main/resources/mapper/TbShopShareRecordMapper.xml b/src/main/resources/mapper/TbShopShareRecordMapper.xml index 12d0744..2e7fdb8 100644 --- a/src/main/resources/mapper/TbShopShareRecordMapper.xml +++ b/src/main/resources/mapper/TbShopShareRecordMapper.xml @@ -92,6 +92,45 @@ + + + + + + From 7c2b6cb25f09df99f057963b7674e7253a54d512 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 8 Nov 2024 13:36:12 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/TbCouponProductMapper.java | 1 + .../entity/TbCouponProduct.java | 54 ++----------------- .../cashierservice/entity/TbShopShare.java | 2 +- .../entity/TbShopShareRecord.java | 2 + .../impl/TbShopShareRecordServiceImpl.java | 45 +++++++++++++++- .../service/impl/TbShopShareServiceImpl.java | 4 +- .../mapper/TbCouponProductMapper.xml | 8 +++ 7 files changed, 63 insertions(+), 53 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbCouponProductMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbCouponProductMapper.java index 6ca6628..538dfa4 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbCouponProductMapper.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbCouponProductMapper.java @@ -34,6 +34,7 @@ public interface TbCouponProductMapper { List queryAllByCouponId(Integer couponId); List queryProsByActivateId(@Param("couponId")Integer couponId,@Param("num")Integer num); + List queryProInfoByActivateId(@Param("couponId")Integer couponId,@Param("num")Integer num); /** diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbCouponProduct.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbCouponProduct.java index 2572106..66d2e2d 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbCouponProduct.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbCouponProduct.java @@ -1,5 +1,7 @@ package com.chaozhanggui.system.cashierservice.entity; +import lombok.Data; + import java.util.Date; import java.io.Serializable; @@ -9,6 +11,7 @@ import java.io.Serializable; * @author ww * @since 2024-10-23 14:35:49 */ +@Data public class TbCouponProduct implements Serializable { private static final long serialVersionUID = 619724621133545616L; @@ -21,6 +24,8 @@ public class TbCouponProduct implements Serializable { * 商品id */ private Integer productId; + private String proName; + private String proImg; /** * 数量 */ @@ -30,54 +35,5 @@ public class TbCouponProduct implements Serializable { private Date updateTime; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getCouponId() { - return couponId; - } - - public void setCouponId(Integer couponId) { - this.couponId = couponId; - } - - public Integer getProductId() { - return productId; - } - - public void setProductId(Integer productId) { - this.productId = productId; - } - - public Integer getNum() { - return num; - } - - public void setNum(Integer num) { - this.num = num; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - } 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 9c3021f..8f014af 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShare.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShare.java @@ -125,7 +125,7 @@ public class TbShopShare implements Serializable { //使用描述 private String useDetail; //商品描述 - private List gives; + private List gives; } } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShareRecord.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShareRecord.java index 11238c4..b2051e3 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShareRecord.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShareRecord.java @@ -5,6 +5,7 @@ import lombok.Data; import java.util.Date; import java.io.Serializable; +import java.util.List; /** * (TbShopShareRecord)实体类 @@ -45,6 +46,7 @@ public class TbShopShareRecord extends BasePageDto implements Serializable { * 奖励券获得方式 get/use 领取获得/使用获得 */ private String method; + private List newCoupons; /** * 1 未领取 2 已领取 3 已使用 */ diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java index 50e5801..22f1c85 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java @@ -11,6 +11,7 @@ import com.chaozhanggui.system.cashierservice.sign.CodeEnum; import com.chaozhanggui.system.cashierservice.sign.Result; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; @@ -20,6 +21,7 @@ import org.springframework.data.domain.PageRequest; import javax.annotation.Resource; import java.math.BigDecimal; +import java.time.format.DateTimeFormatter; import java.util.*; /** @@ -113,11 +115,11 @@ public class TbShopShareRecordServiceImpl implements TbShopShareRecordService { @Override public Result insert(TbShopShareRecord tbShopShareRecord) { TbShopUser shopUserInfo = getShopUserInfo(tbShopShareRecord.getBeInvitedId(), tbShopShareRecord.getShopId()); + TbShopShare tbShopShare = tbShopShareMapper.queryById(tbShopShareRecord.getShareId()); TbShopShareRecord query = tbShopShareRecordMapper.queryByData( tbShopShareRecord.getShareId(), tbShopShareRecord.getShopId(), tbShopShareRecord.getInvitedId(), tbShopShareRecord.getBeInvitedId()); if (query == null) { - TbShopShare tbShopShare = tbShopShareMapper.queryById(tbShopShareRecord.getShareId()); tbShopShareRecord.setMethod(tbShopShare.getGetMethod()); tbShopShareRecord.setShopId(tbShopShareRecord.getShopId()); tbShopShareRecord.setCreateTime(new Date()); @@ -146,6 +148,24 @@ public class TbShopShareRecordServiceImpl implements TbShopShareRecordService { if (query == null) { query = tbShopShareRecord; } + 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.queryProInfoByActivateId(coupon.getId(), newCoupon.getCouponNum())); + } + } + } + query.setNewCoupons(tbShopShare.getNewCoupons()); return Result.successWithData(query); } @@ -269,4 +289,27 @@ public class TbShopShareRecordServiceImpl implements TbShopShareRecordService { } } + + 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 (StringUtils.isNotBlank(tbShopCoupon.getUseTimeType()) && 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/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareServiceImpl.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareServiceImpl.java index 156b121..bf6bde3 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 @@ -50,7 +50,7 @@ public class TbShopShareServiceImpl implements TbShopShareService { //商品 newCoupon.setType(2); newCoupon.setUseDetail(setCouponInfo(coupon)); - newCoupon.setGives(couProductMapper.queryProsByActivateId(coupon.getId(), newCoupon.getCouponNum())); + newCoupon.setGives(couProductMapper.queryProInfoByActivateId(coupon.getId(), newCoupon.getCouponNum())); } } } @@ -69,7 +69,7 @@ public class TbShopShareServiceImpl implements TbShopShareService { //商品 rewardCoupon.setType(2); rewardCoupon.setUseDetail(setCouponInfo(coupon)); - rewardCoupon.setGives(couProductMapper.queryProsByActivateId(coupon.getId(), rewardCoupon.getCouponNum())); + rewardCoupon.setGives(couProductMapper.queryProInfoByActivateId(coupon.getId(), rewardCoupon.getCouponNum())); } } } diff --git a/src/main/resources/mapper/TbCouponProductMapper.xml b/src/main/resources/mapper/TbCouponProductMapper.xml index 251e1b6..8042d8e 100644 --- a/src/main/resources/mapper/TbCouponProductMapper.xml +++ b/src/main/resources/mapper/TbCouponProductMapper.xml @@ -68,6 +68,14 @@ group by tb_coupon_product.product_id + + insert into tb_coupon_product(coupon_id, product_id, num, create_time, update_time) From b2e228b83a50ff8950c67afbdc345560ac50f8ef Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 8 Nov 2024 14:23:42 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/TbShopShareRecord.java | 3 ++- .../impl/TbShopShareRecordServiceImpl.java | 17 ++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShareRecord.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShareRecord.java index b2051e3..9dccda5 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShareRecord.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShareRecord.java @@ -51,7 +51,7 @@ public class TbShopShareRecord extends BasePageDto implements Serializable { * 1 未领取 2 已领取 3 已使用 */ private Integer status; - private boolean isSuccess = true; + private boolean success = true; /** * 生效时间/获得奖励的时间 */ @@ -60,5 +60,6 @@ public class TbShopShareRecord extends BasePageDto implements Serializable { private Date createTime; private Date updateTime; + } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java index 22f1c85..251daba 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java @@ -68,6 +68,11 @@ public class TbShopShareRecordServiceImpl implements TbShopShareRecordService { @Override public Map query(TbShopShareRecord tbShopShareRecord) { Map result = tbShopShareRecordMapper.statisticsRecord(tbShopShareRecord); + if(CollectionUtil.isEmpty(result)){ + result=new HashMap<>(); + result.put("isSuccess",0); + result.put("isFail",0); + } PageHelper.startPage(tbShopShareRecord.getPage(), tbShopShareRecord.getSize()); List records; @@ -79,7 +84,7 @@ public class TbShopShareRecordServiceImpl implements TbShopShareRecordService { for (TbShopShareRecord shareRecord : records) { shareRecord.setBeInvitedName(userInfoMapper.selectNameByPrimaryKey(shareRecord.getBeInvitedId())); } - result.put("records",new PageInfo<>(records)); + result.put("records",new PageInfo<>()); return result; } @@ -128,19 +133,13 @@ public class TbShopShareRecordServiceImpl implements TbShopShareRecordService { query.setUpdateTime(new Date()); } if (shopUserInfo == null) { - if (query != null) { - query.setStatus(1); - tbShopShareRecordMapper.update(query); - } else { + if (query == null) { tbShopShareRecord.setStatus(1); tbShopShareRecordMapper.insert(tbShopShareRecord); } saveShopUser(tbShopShareRecord.getBeInvitedId(), tbShopShareRecord.getShopId()); } else { - if (query != null) { - query.setStatus(0); - tbShopShareRecordMapper.update(query); - } else { + if (query == null){ tbShopShareRecord.setStatus(0); tbShopShareRecordMapper.insert(tbShopShareRecord); } From 46d2eff3aacdc2e288d6b69b3f205b8f56d5a9a1 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 8 Nov 2024 16:49:01 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=20=E8=BF=94?= =?UTF-8?q?=E5=9B=9EshopId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/cashierservice/entity/vo/TbUserCouponVo.java | 1 + src/main/resources/mapper/TbActivateInRecordMapper.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/TbUserCouponVo.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/TbUserCouponVo.java index ee2c289..12e598d 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/TbUserCouponVo.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/TbUserCouponVo.java @@ -11,6 +11,7 @@ public class TbUserCouponVo { private BigDecimal fullAmount; private BigDecimal discountAmount; private Integer couponId; + private Integer shopId; private Integer proId; //优惠券名称 private String name; diff --git a/src/main/resources/mapper/TbActivateInRecordMapper.xml b/src/main/resources/mapper/TbActivateInRecordMapper.xml index c5eafbf..8b385f7 100644 --- a/src/main/resources/mapper/TbActivateInRecordMapper.xml +++ b/src/main/resources/mapper/TbActivateInRecordMapper.xml @@ -42,6 +42,7 @@ id, vip_user_id, coupon_id, name, type, pro_id, full_amount, discount_amount, nu inRecord.full_amount as fullAmount, inRecord.discount_amount as discountAmount, inRecord.coupon_id as couponId, + inRecord.shop_id as shopId, pro.id as proId, CASE WHEN inRecord.type = 1 THEN inRecord.NAME From c0aa30c750031f8dd3db586d3b96735201119079 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 8 Nov 2024 17:24:43 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=8F=82=E5=8A=A0=E6=B4=BB=E5=8A=A8=20?= =?UTF-8?q?=E6=BB=A1=E8=B6=B3=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/mapper/TbActivateMapper.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/mapper/TbActivateMapper.xml b/src/main/resources/mapper/TbActivateMapper.xml index 4e32f51..c68a8a7 100644 --- a/src/main/resources/mapper/TbActivateMapper.xml +++ b/src/main/resources/mapper/TbActivateMapper.xml @@ -41,8 +41,8 @@ from tb_activate where shop_id = #{shopId} - and amount = #{amount} - order by id desc + and amount <= #{amount} + order by amount desc limit 1 From 82ccac56b7a8a4926a850e6650f537a5f00d6545 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 8 Nov 2024 18:13:06 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=8F=82=E5=8A=A0=E6=B4=BB=E5=8A=A8=20?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/TbShopShareRecordServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java index 251daba..d5d905b 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java @@ -258,6 +258,7 @@ public class TbShopShareRecordServiceImpl implements TbShopShareRecordService { record.setNum(newCoupon.getCouponNum()); record.setOverNum(newCoupon.getCouponNum()); record.setShopId(Integer.valueOf(tbShopUser.getShopId())); + record.setCreateTime(new Date()); record.setSourceActId(shopShare.getId()); record.setUseStartTime(start); record.setUseEndTime(end); @@ -279,6 +280,7 @@ public class TbShopShareRecordServiceImpl implements TbShopShareRecordService { record.setSourceActId(shopShare.getId()); record.setUseStartTime(start); record.setUseEndTime(end); + record.setCreateTime(new Date()); record.setSource("invited"); actGiveRecords.add(record); }