diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/controller/PayController.java b/src/main/java/com/chaozhanggui/system/cashierservice/controller/PayController.java index 34e9417..e868891 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/controller/PayController.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/controller/PayController.java @@ -136,7 +136,6 @@ public class PayController { @RequestMapping("getActive") public Result getActive( - @RequestHeader("token") String token, @RequestParam("shopId") String shopId, @RequestParam("page") int page, @RequestParam("pageSize") int pageSize) { diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/controller/TbShopCouponController.java b/src/main/java/com/chaozhanggui/system/cashierservice/controller/TbShopCouponController.java new file mode 100644 index 0000000..7e0047e --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/controller/TbShopCouponController.java @@ -0,0 +1,37 @@ +package com.chaozhanggui.system.cashierservice.controller; + +import com.chaozhanggui.system.cashierservice.entity.dto.CouponDto; +import com.chaozhanggui.system.cashierservice.service.TbShopCouponService; +import com.chaozhanggui.system.cashierservice.sign.Result; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 优惠券(TbShopCoupon)表控制层 + * + * @author ww + * @since 2024-10-23 15:37:26 + */ +@RestController +@RequestMapping("coupon") +public class TbShopCouponController { + /** + * 服务对象 + */ + @Autowired + private TbShopCouponService tbShopCouponService; + + /** + * 根据优惠券DTO查询优惠券 + * @param param 优惠券DTO + * @return 查询结果 + */ + @RequestMapping("find") + public Result find(@RequestBody CouponDto param) { + return tbShopCouponService.find(param); + } + +} + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateInRecordMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateInRecordMapper.java index 883c0d0..2b1b96a 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateInRecordMapper.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateInRecordMapper.java @@ -1,8 +1,7 @@ package com.chaozhanggui.system.cashierservice.dao; import com.chaozhanggui.system.cashierservice.entity.TbActivateInRecord; -import com.chaozhanggui.system.cashierservice.entity.TbProduct; -import com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo; +import com.chaozhanggui.system.cashierservice.entity.vo.TbUserCouponVo; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -31,10 +30,11 @@ public interface TbActivateInRecordMapper { */ List queryAll(TbActivateInRecord tbActivateInRecord); - List queryByVipIdAndShopId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId); - List queryVipPro(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId,@Param("shopName")String shopName); - int queryByVipIdAndShopIdAndProId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId,@Param("productId") Integer productId); - List queryAllByVipIdAndShopIdAndProId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId,@Param("productId") Integer productId); + //未使用券 + List queryByVipIdAndShopId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId); + List queryByVipIdAndShopIdIn(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId); + //过期券 + List queryByVipIdAndShopIdExpire(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId); int countCouponNum(@Param("userId") Integer userId); @@ -63,8 +63,6 @@ public interface TbActivateInRecordMapper { */ int update(TbActivateInRecord tbActivateInRecord); - int updateOverNumById(@Param("id")Integer id,@Param("overNum")Integer overNum); - /** * 通过主键删除数据 * diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateMapper.java index 34b3888..bd125a3 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateMapper.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateMapper.java @@ -1,29 +1,72 @@ package com.chaozhanggui.system.cashierservice.dao; import com.chaozhanggui.system.cashierservice.entity.TbActivate; -import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Component; +import org.springframework.data.domain.Pageable; import java.math.BigDecimal; import java.util.List; -@Component -@Mapper +/** + * (TbActivate)表数据库访问层 + * + * @author ww + * @since 2024-10-23 14:19:53 + */ public interface TbActivateMapper { -// int deleteByPrimaryKey(Integer id); -// int insert(TbActivate record); + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + TbActivate queryById(Integer id); -// int insertSelective(TbActivate record); + /** + * 查询数据 + * + * @param tbActivate 查询条件 + * @param pageable 分页对象 + * @return 对象列表 + */ + List queryAll(TbActivate tbActivate, @Param("pageable") Pageable pageable); - TbActivate selectByPrimaryKey(Integer id); - -// int updateByPrimaryKeySelective(TbActivate record); - -// int updateByPrimaryKey(TbActivate record); + List selectByShopId(String shopId); TbActivate selectByAmount(@Param("shopId") String shopId,@Param("amount") BigDecimal amount); - List selectByShopId(String shopId); + + /** + * 新增数据 + * + * @param tbActivate 实例对象 + * @return 影响行数 + */ + int insert(TbActivate tbActivate); + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param tbActivate 实例对象 + * @return 影响行数 + */ + int update(TbActivate tbActivate); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(Integer id); + } \ No newline at end of file diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateOutRecordMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateOutRecordMapper.java index 7b8b5ba..9bd655d 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateOutRecordMapper.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateOutRecordMapper.java @@ -1,8 +1,9 @@ package com.chaozhanggui.system.cashierservice.dao; import com.chaozhanggui.system.cashierservice.entity.TbActivateOutRecord; -import com.chaozhanggui.system.cashierservice.entity.vo.UserCouponVo; +import com.chaozhanggui.system.cashierservice.entity.vo.TbUserCouponVo; import org.apache.ibatis.annotations.Param; +import org.springframework.data.domain.Pageable; import java.util.List; @@ -10,7 +11,7 @@ import java.util.List; * 活动赠送商品使用记录表(TbActivateOutRecord)表数据库访问层 * * @author ww - * @since 2024-08-22 11:21:56 + * @since 2024-10-23 14:55:22 */ public interface TbActivateOutRecordMapper { @@ -26,12 +27,12 @@ public interface TbActivateOutRecordMapper { * 查询数据 * * @param tbActivateOutRecord 查询条件 + * @param pageable 分页对象 * @return 对象列表 */ - List queryAll(TbActivateOutRecord tbActivateOutRecord); - - List queryVipPro(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId, @Param("shopName") String shopName); + List queryAll(TbActivateOutRecord tbActivateOutRecord, @Param("pageable") Pageable pageable); + List queryByVipIdAndShopId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId); /** * 新增数据 @@ -57,14 +58,6 @@ public interface TbActivateOutRecordMapper { */ int update(TbActivateOutRecord tbActivateOutRecord); - /** - * 根据订单id 将数据状态变为 - * @param orderId 订单Id - * @param status 状态 - * @return - */ - int updateByOrderIdAndStatus(@Param("orderId")Integer orderId,@Param("status")String status); - /** * 通过主键删除数据 * diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateProductMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateProductMapper.java deleted file mode 100644 index 6240a16..0000000 --- a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbActivateProductMapper.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.chaozhanggui.system.cashierservice.dao; - -import com.chaozhanggui.system.cashierservice.entity.TbActivateProduct; -import org.apache.ibatis.annotations.Param; -import java.util.List; - -/** - * 活动赠送商品表(TbActivateProduct)表数据库访问层 - * - * @author ww - * @since 2024-08-20 15:14:55 - */ -public interface TbActivateProductMapper { - - /** - * 通过ID查询单条数据 - * - * @param id 主键 - * @return 实例对象 - */ - TbActivateProduct queryById(Integer id); - - /** - * 查询数据 - * - * @param tbActivateProduct 查询条件 - * @return 对象列表 - */ - List queryAll(TbActivateProduct tbActivateProduct); - - List queryAllByActivateId(Integer activateId); - List queryProsByActivateId(Integer activateId); - - - /** - * 新增数据 - * - * @param tbActivateProduct 实例对象 - * @return 影响行数 - */ - int insert(TbActivateProduct tbActivateProduct); - - /** - * 批量新增数据(MyBatis原生foreach方法) - * - * @param entities List 实例对象列表 - * @return 影响行数 - */ - int insertBatch(@Param("entities") List entities); - - /** - * 修改数据 - * - * @param tbActivateProduct 实例对象 - * @return 影响行数 - */ - int update(TbActivateProduct tbActivateProduct); - - /** - * 通过主键删除数据 - * - * @param id 主键 - * @return 影响行数 - */ - int deleteById(Integer id); - -} - diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbCouponProductMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbCouponProductMapper.java new file mode 100644 index 0000000..6ca6628 --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbCouponProductMapper.java @@ -0,0 +1,72 @@ +package com.chaozhanggui.system.cashierservice.dao; + +import com.chaozhanggui.system.cashierservice.entity.TbCouponProduct; +import org.apache.ibatis.annotations.Param; +import org.springframework.data.domain.Pageable; + +import java.util.List; + +/** + * 活动赠送商品表(TbCouponProduct)表数据库访问层 + * + * @author ww + * @since 2024-10-23 14:35:49 + */ +public interface TbCouponProductMapper { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + TbCouponProduct queryById(Integer id); + + /** + * 查询数据 + * + * @param tbCouponProduct 查询条件 + * @param pageable 分页对象 + * @return 对象列表 + */ + List queryAll(TbCouponProduct tbCouponProduct, @Param("pageable") Pageable pageable); + + + List queryAllByCouponId(Integer couponId); + List queryProsByActivateId(@Param("couponId")Integer couponId,@Param("num")Integer num); + + + /** + * 新增数据 + * + * @param tbCouponProduct 实例对象 + * @return 影响行数 + */ + int insert(TbCouponProduct tbCouponProduct); + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param tbCouponProduct 实例对象 + * @return 影响行数 + */ + int update(TbCouponProduct tbCouponProduct); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(Integer id); + +} + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopCouponMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopCouponMapper.java new file mode 100644 index 0000000..0ce36a0 --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopCouponMapper.java @@ -0,0 +1,68 @@ +package com.chaozhanggui.system.cashierservice.dao; + +import com.chaozhanggui.system.cashierservice.entity.TbShopCoupon; +import org.apache.ibatis.annotations.Param; +import org.springframework.data.domain.Pageable; + +import java.util.List; + +/** + * 优惠券(TbShopCoupon)表数据库访问层 + * + * @author ww + * @since 2024-10-23 14:25:13 + */ +public interface TbShopCouponMapper { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + TbShopCoupon queryById(Integer id); + + /** + * 查询数据 + * + * @param tbShopCoupon 查询条件 + * @param pageable 分页对象 + * @return 对象列表 + */ + List queryAll(TbShopCoupon tbShopCoupon, @Param("pageable") Pageable pageable); + + + /** + * 新增数据 + * + * @param tbShopCoupon 实例对象 + * @return 影响行数 + */ + int insert(TbShopCoupon tbShopCoupon); + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param tbShopCoupon 实例对象 + * @return 影响行数 + */ + int update(TbShopCoupon tbShopCoupon); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(Integer id); + +} + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopInfoMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopInfoMapper.java index ad6904e..a22953d 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopInfoMapper.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopInfoMapper.java @@ -13,11 +13,6 @@ import java.util.List; @Component @Mapper public interface TbShopInfoMapper { - int deleteByPrimaryKey(Integer id); - - int insert(TbShopInfo record); - - int insertSelective(TbShopInfo record); List selShopInfoByGps(@Param("rightTopLng") Double rightTopLng, @Param("rightTopLat") Double rightTopLat, @Param("leftBottomLng") Double leftBottomLng, @Param("leftBottomLat") Double leftBottomLat, @@ -30,12 +25,6 @@ public interface TbShopInfoMapper { List selectByIds(@Param("list") List ids); - int updateByPrimaryKeySelective(TbShopInfo record); - - int updateByPrimaryKeyWithBLOBs(TbShopInfo record); - - int updateByPrimaryKey(TbShopInfo record); - TbShopInfo selectByQrCode(String qrcode); TbShopInfo selectByPhone(String phone); diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivate.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivate.java index a2d5246..35d9c79 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivate.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivate.java @@ -1,33 +1,49 @@ package com.chaozhanggui.system.cashierservice.entity; -import org.springframework.util.CollectionUtils; - +import java.util.Date; import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; import java.util.List; +/** + * (TbActivate)实体类 + * + * @author ww + * @since 2024-10-23 14:16:33 + */ public class TbActivate implements Serializable { + private static final long serialVersionUID = 216340931948517603L; + private Integer id; private Integer shopId; + /** + * 充值金额 + */ + private Integer amount; + /** + * 赠送金额 + */ + private Integer giftAmount; + /** + * 是否使用优惠卷 0否 1是 + */ + private Integer isUseCoupon; + /** + * 优惠卷id + */ + private Integer couponId; + /** + * 优惠卷数量 + */ + private Integer num; - private Integer minNum; + private Date createTime = new Date(); - private Integer maxNum; + private Date updateTime = new Date(); - private BigDecimal handselNum; - - private String handselType; - - private String isDel; - - //是否赠送商品 0否 1是 - private Integer isGiftPro; + private String couponDesc; private List gives; - private static final long serialVersionUID = 1L; - public Integer getId() { return id; } @@ -44,52 +60,69 @@ public class TbActivate implements Serializable { this.shopId = shopId; } - public Integer getMinNum() { - return minNum; + public Integer getAmount() { + return amount; } - public void setMinNum(Integer minNum) { - this.minNum = minNum; + public void setAmount(Integer amount) { + this.amount = amount; } - public Integer getMaxNum() { - return maxNum; + public Integer getGiftAmount() { + return giftAmount; } - public void setMaxNum(Integer maxNum) { - this.maxNum = maxNum; + public void setGiftAmount(Integer giftAmount) { + this.giftAmount = giftAmount; } - public BigDecimal getHandselNum() { - return handselNum; + public Integer getIsUseCoupon() { + return isUseCoupon; } - public void setHandselNum(BigDecimal handselNum) { - this.handselNum = handselNum; + public void setIsUseCoupon(Integer isUseCoupon) { + this.isUseCoupon = isUseCoupon; } - public String getHandselType() { - return handselType; + public Integer getCouponId() { + return couponId; } - public void setHandselType(String handselType) { - this.handselType = handselType == null ? null : handselType.trim(); + public void setCouponId(Integer couponId) { + this.couponId = couponId; } - public String getIsDel() { - return isDel; + public Integer getNum() { + return num; } - public void setIsDel(String isDel) { - this.isDel = isDel == null ? null : isDel.trim(); + public void setNum(Integer num) { + this.num = num; } - public Integer getIsGiftPro() { - return isGiftPro; + public Date getCreateTime() { + return createTime; } - public void setIsGiftPro(Integer isGiftPro) { - this.isGiftPro = isGiftPro; + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + + public String getCouponDesc() { + return couponDesc; + } + + public void setCouponDesc(String couponDesc) { + this.couponDesc = couponDesc; } public List getGives() { @@ -97,10 +130,7 @@ public class TbActivate implements Serializable { } public void setGives(List gives) { - if(CollectionUtils.isEmpty(gives)){ - this.gives = new ArrayList<>(); - }else { - this.gives = gives; - } + this.gives = gives; } -} \ No newline at end of file +} + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateInRecord.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateInRecord.java index afc81af..e7385df 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateInRecord.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateInRecord.java @@ -4,56 +4,75 @@ import java.util.Date; import java.io.Serializable; /** - * 活动商品赠送表(TbActivateInRecord)实体类 + * 活动商品赠送记录表(TbActivateInRecord)实体类 * * @author ww - * @since 2024-08-22 11:13:40 + * @since 2024-10-23 16:43:02 */ public class TbActivateInRecord implements Serializable { - private static final long serialVersionUID = -35515830201618782L; + private static final long serialVersionUID = -31673077202067433L; private Integer id; - /** +/** * 会员id */ private Integer vipUserId; - /** +/** + * 卷Id (校验是否可用) + */ + private Integer couponId; +/** + * 卷描述 满10减2/商品卷 + */ + private String name; +/** + * 1-满减 2-商品 + */ + private Integer type; +/** * 商品id */ private Integer proId; - /** +/** + * 满多少金额 + */ + private Integer fullAmount; +/** + * 减多少金额 + */ + private Integer discountAmount; +/** * 赠送数量 */ private Integer num; - /** +/** * 未使用数量 */ private Integer overNum; - /** +/** * 店铺id */ private Integer shopId; - /** +/** * 来源活动id */ private Integer sourceActId; private Integer sourceFlowId; +/** + * 可用开始时间 + */ + private Date useStartTime; +/** + * 可用结束时间 + */ + private Date useEndTime; private Date createTime; private Date updateTime; - public TbActivateInRecord(Integer vipUserId, Integer proId, Integer num, Integer shopId, Integer sourceActId,Integer sourceFlowId) { - this.vipUserId = vipUserId; - this.proId = proId; - this.num = num; - this.overNum = num; - this.shopId = shopId; - this.sourceActId = sourceActId; - this.sourceFlowId = sourceFlowId; - this.createTime=new Date(); - } + private String couponJson; public Integer getId() { @@ -72,6 +91,30 @@ public class TbActivateInRecord implements Serializable { this.vipUserId = vipUserId; } + public Integer getCouponId() { + return couponId; + } + + public void setCouponId(Integer couponId) { + this.couponId = couponId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + public Integer getProId() { return proId; } @@ -80,6 +123,22 @@ public class TbActivateInRecord implements Serializable { this.proId = proId; } + public Integer getFullAmount() { + return fullAmount; + } + + public void setFullAmount(Integer fullAmount) { + this.fullAmount = fullAmount; + } + + public Integer getDiscountAmount() { + return discountAmount; + } + + public void setDiscountAmount(Integer discountAmount) { + this.discountAmount = discountAmount; + } + public Integer getNum() { return num; } @@ -120,6 +179,22 @@ public class TbActivateInRecord implements Serializable { this.sourceFlowId = sourceFlowId; } + public Date getUseStartTime() { + return useStartTime; + } + + public void setUseStartTime(Date useStartTime) { + this.useStartTime = useStartTime; + } + + public Date getUseEndTime() { + return useEndTime; + } + + public void setUseEndTime(Date useEndTime) { + this.useEndTime = useEndTime; + } + public Date getCreateTime() { return createTime; } @@ -136,5 +211,13 @@ public class TbActivateInRecord implements Serializable { this.updateTime = updateTime; } + public String getCouponJson() { + return couponJson; + } + + public void setCouponJson(String couponJson) { + this.couponJson = couponJson; + } + } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateOutRecord.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateOutRecord.java index dd5d295..d1afc74 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateOutRecord.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateOutRecord.java @@ -7,20 +7,30 @@ import java.io.Serializable; * 活动赠送商品使用记录表(TbActivateOutRecord)实体类 * * @author ww - * @since 2024-08-22 11:21:56 + * @since 2024-10-23 14:55:22 */ public class TbActivateOutRecord implements Serializable { - private static final long serialVersionUID = -54399746948905097L; + private static final long serialVersionUID = -34082928893064380L; private Integer id; + + private Integer shopId; /** - * 商品赠送Id + * 订单id + */ + private String orderId; + /** + * 商品赠送Id tb_activate_in_record的id */ private Integer giveId; /** - * 商品id + * 会员id */ - private Integer proId; + private Integer vipUserId; + /** + * 1-满减 2-商品 + */ + private Integer type; /** * 使用数量 */ @@ -30,24 +40,14 @@ public class TbActivateOutRecord implements Serializable { */ private Integer refNum; /** - * 订单id + * 新建: create, 完成: closed, 取消:cancel, */ - private String orderId; - //新建: create, 完成: closed, 取消:cancel, private String status; private Date createTime; private Date updateTime; - public TbActivateOutRecord(Integer giveId, Integer proId, Integer useNum, String orderId, String status) { - this.giveId = giveId; - this.proId = proId; - this.useNum = useNum; - this.orderId = orderId; - this.status = status; - this.createTime = new Date(); - } public Integer getId() { return id; @@ -57,6 +57,22 @@ public class TbActivateOutRecord implements Serializable { this.id = id; } + public Integer getShopId() { + return shopId; + } + + public void setShopId(Integer shopId) { + this.shopId = shopId; + } + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + public Integer getGiveId() { return giveId; } @@ -65,12 +81,20 @@ public class TbActivateOutRecord implements Serializable { this.giveId = giveId; } - public Integer getProId() { - return proId; + public Integer getVipUserId() { + return vipUserId; } - public void setProId(Integer proId) { - this.proId = proId; + public void setVipUserId(Integer vipUserId) { + this.vipUserId = vipUserId; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; } public Integer getUseNum() { @@ -97,14 +121,6 @@ public class TbActivateOutRecord implements Serializable { this.status = status; } - public String getOrderId() { - return orderId; - } - - public void setOrderId(String orderId) { - this.orderId = orderId; - } - public Date getCreateTime() { return createTime; } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateProduct.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbCouponProduct.java similarity index 72% rename from src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateProduct.java rename to src/main/java/com/chaozhanggui/system/cashierservice/entity/TbCouponProduct.java index d8383dd..2572106 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateProduct.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbCouponProduct.java @@ -4,24 +4,24 @@ import java.util.Date; import java.io.Serializable; /** - * 活动赠送商品表(TbActivateProduct)实体类 + * 活动赠送商品表(TbCouponProduct)实体类 * * @author ww - * @since 2024-08-20 15:15:01 + * @since 2024-10-23 14:35:49 */ -public class TbActivateProduct implements Serializable { - private static final long serialVersionUID = 592370528166603965L; +public class TbCouponProduct implements Serializable { + private static final long serialVersionUID = 619724621133545616L; private Integer id; -/** + /** * 活动Id */ - private Integer activateId; -/** + private Integer couponId; + /** * 商品id */ private Integer productId; -/** + /** * 数量 */ private Integer num; @@ -39,12 +39,12 @@ public class TbActivateProduct implements Serializable { this.id = id; } - public Integer getActivateId() { - return activateId; + public Integer getCouponId() { + return couponId; } - public void setActivateId(Integer activateId) { - this.activateId = activateId; + public void setCouponId(Integer couponId) { + this.couponId = couponId; } public Integer getProductId() { diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopCoupon.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopCoupon.java new file mode 100644 index 0000000..fc54428 --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopCoupon.java @@ -0,0 +1,288 @@ +package com.chaozhanggui.system.cashierservice.entity; + +import java.time.LocalTime; +import java.util.Date; +import java.io.Serializable; + +/** + * 优惠券(TbShopCoupon)实体类 + * + * @author ww + * @since 2024-10-24 10:40:00 + */ +public class TbShopCoupon implements Serializable { + private static final long serialVersionUID = 382961088281627909L; + /** + * 自增 + */ + private Integer id; + + private String shopId; + /** + * 名称(无意义) + */ + private String title; + /** + * 1-满减 2-商品 + */ + private Integer type; + /** + * 满多少金额 + */ + private Integer fullAmount; + /** + * 减多少金额 + */ + private Integer discountAmount; + /** + * 描述 + */ + private String description; + /** + * 发放数量 + */ + private Integer number; + /** + * 剩余数量 + */ + private Integer leftNumber; + /** + * 有效期类型,可选值为 fixed(固定时间)/custom(自定义时间) + */ + private String validityType; + /** + * 有效天数 + */ + private Integer validDays; + /** + * 隔多少天生效 + */ + private Integer daysToTakeEffect; + /** + * 有效开始时间 + */ + private Date validStartTime; + /** + * 有效结束时间 + */ + private Date validEndTime; + /** + * 周 数组["周一","周二"] + */ + private String userDays; + /** + * all-全时段 custom-指定时段 + */ + private String useTimeType; + /** + * 可用开始时间 + */ + private LocalTime useStartTime; + /** + * 可用结束时间 + */ + private LocalTime useEndTime; + /** + * 已使用数量 + */ + private Integer useNumber; + /** + * 发放人 + */ + private String editor; + /** + * 状态0-关闭 1 正常 + */ + private Integer status; + + private Date createTime; + + private Date updateTime; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getShopId() { + return shopId; + } + + public void setShopId(String shopId) { + this.shopId = shopId; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public Integer getFullAmount() { + return fullAmount; + } + + public void setFullAmount(Integer fullAmount) { + this.fullAmount = fullAmount; + } + + public Integer getDiscountAmount() { + return discountAmount; + } + + public void setDiscountAmount(Integer discountAmount) { + this.discountAmount = discountAmount; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Integer getNumber() { + return number; + } + + public void setNumber(Integer number) { + this.number = number; + } + + public Integer getLeftNumber() { + return leftNumber; + } + + public void setLeftNumber(Integer leftNumber) { + this.leftNumber = leftNumber; + } + + public String getValidityType() { + return validityType; + } + + public void setValidityType(String validityType) { + this.validityType = validityType; + } + + public Integer getValidDays() { + return validDays; + } + + public void setValidDays(Integer validDays) { + this.validDays = validDays; + } + + public Integer getDaysToTakeEffect() { + return daysToTakeEffect; + } + + public void setDaysToTakeEffect(Integer daysToTakeEffect) { + this.daysToTakeEffect = daysToTakeEffect; + } + + public Date getValidStartTime() { + return validStartTime; + } + + public void setValidStartTime(Date validStartTime) { + this.validStartTime = validStartTime; + } + + public Date getValidEndTime() { + return validEndTime; + } + + public void setValidEndTime(Date validEndTime) { + this.validEndTime = validEndTime; + } + + public String getUserDays() { + return userDays; + } + + public void setUserDays(String userDays) { + this.userDays = userDays; + } + + public String getUseTimeType() { + return useTimeType; + } + + public void setUseTimeType(String useTimeType) { + this.useTimeType = useTimeType; + } + + public LocalTime getUseStartTime() { + return useStartTime; + } + + public void setUseStartTime(LocalTime useStartTime) { + this.useStartTime = useStartTime; + } + + public LocalTime getUseEndTime() { + return useEndTime; + } + + public void setUseEndTime(LocalTime useEndTime) { + this.useEndTime = useEndTime; + } + + public Integer getUseNumber() { + return useNumber; + } + + public void setUseNumber(Integer useNumber) { + this.useNumber = useNumber; + } + + public String getEditor() { + return editor; + } + + public void setEditor(String editor) { + this.editor = editor; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + 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/TbShopInfo.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopInfo.java index 708a336..0d0ecc2 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopInfo.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopInfo.java @@ -1,128 +1,785 @@ package com.chaozhanggui.system.cashierservice.entity; -import lombok.Data; - -import java.io.Serializable; import java.math.BigDecimal; +import java.io.Serializable; - -@Data +/** + * (TbShopInfo)实体类 + * + * @author ww + * @since 2024-10-23 15:03:55 + */ public class TbShopInfo implements Serializable { + private static final long serialVersionUID = -75915575260078554L; + /** + * 自增id + */ private Integer id; - + /** + * 店铺帐号 + */ private String account; - + /** + * 店铺代号,策略方式为city +店铺号(8位) + */ private String shopCode; - + /** + * 店铺口号 + */ private String subTitle; - + /** + * 商户Id + */ private String merchantId; - + /** + * 店铺名称 + */ private String shopName; - + /** + * 连锁店扩展店名 + */ private String chainName; - + /** + * 背景图 + */ private String backImg; - + /** + * 门头照 + */ private String frontImg; - + /** + * 联系人姓名 + */ private String contactName; - + /** + * 联系电话 + */ private String phone; - + /** + * 店铺log0 + */ private String logo; - - private Byte isDeposit; - - private Byte isSupply; - + /** + * 是否参与代收 0--不参与 1参与 + */ + private Integer isDeposit; + /** + * 是否为供应商 + */ + private Integer isSupply; + /** + * 封面图 + */ private String coverImg; - + /** + * 店铺分享图 + */ private String shareImg; - + /** + * 轮播图 + */ + private String view; + /** + * 店铺简介 + */ private String detail; - + /** + * 经纬度 + */ private String lat; - + /** + * 经纬度 + */ private String lng; - + /** + * 未用 + */ private String mchId; private String registerType; - - private Byte isWxMaIndependent; - + /** + * 是否独立的微信小程序 + */ + private Integer isWxMaIndependent; + /** + * 详细地址 + */ private String address; - + /** + * 类似于这种规则51.51.570 + */ private String city; - + /** + * 店铺类型 超市--MARKET---其它店SHOP + */ private String type; - + /** + * 行业 + */ private String industry; - + /** + * 行业名称 + */ private String industryName; - + /** + * 营业时间(周开始) + */ private String businessStartDay; + /** + * 营业时间(周结束) + */ private String businessEndDay; + /** + * 营业时间 + */ private String businessTime; - + /** + * 配送时间 + */ private String postTime; private BigDecimal postAmountLine; - - private Byte onSale; - - private Byte settleType; - + /** + * 0停业1,正常营业,网上售卖 + */ + private Integer onSale; + /** + * 0今日,1次日 + */ + private Integer settleType; + /** + * 时间 + */ private String settleTime; - + /** + * 入驻时间 + */ private Integer enterAt; - + /** + * 到期时间 + */ private Long expireAt; - - private Byte status; - - private Float average; - + /** + * -1 平台禁用 0-过期,1正式营业, + */ + private Integer status; + /** + * 人均消费 + */ + private BigDecimal average; + /** + * 订单等待时间 + */ private Integer orderWaitPayMinute; - + /** + * 支持登陆设备个数 + */ private Integer supportDeviceNumber; - - private Byte distributeLevel; + /** + * 分销层级(1-下级分销 2-两下级分销) + */ + private Integer distributeLevel; private Long createdAt; private Long updatedAt; private String proxyId; - - private String view; + /** + * trial试用版,release正式 + */ + private String profiles; /** * 商家二维码 */ private String shopQrcode; - private String isOpenYhq; - private Byte isUseVip; /** - * 商户标签 + * 商家标签 */ private String tag; - private String provinces; - private String cities; - private String districts; + private String isOpenYhq; + /** + * 0否1是 + */ + private Integer isUseVip; + /** + * 省 + */ + private String provinces; + /** + * 市 + */ + private String cities; + /** + * 区/县 + */ + private String districts; + /** + * 是否允许会员自定义金额 1 允许 0 不允许 + */ private String isCustom; - //是否开启桌位费 0否1是 + /** + * 是否开启退款密码 1 启用 0 禁用 + */ + private String isReturn; + /** + * 是否开启会员充值密码 1 启用 0 禁用 + */ + private String isMemberIn; + /** + * 是否开启会员退款密码 1 启用 0 禁用 + */ + private String isMemberReturn; + /** + * 是否免除桌位费 0否1是 + */ private Integer isTableFee; - //桌位费 + /** + * 是否启用会员价 0否1是 + */ + private Integer isMemberPrice; + /** + * 积分群体 all-所有 vip-仅针对会员 + */ + private String consumeColony; + /** + * 桌位费 + */ private BigDecimal tableFee; - //就餐模式 堂食 dine-in 外带 take-out + /** + * 就餐模式 堂食 dine-in 外带 take-out + */ private String eatModel; - //程序码(零点八零首页) + /** + * 小程序码(零点八零首页) + */ private String smallQrcode; - //店铺收款码 + /** + * 店铺收款码 + */ private String paymentQrcode; - private static final long serialVersionUID = 1L; -} \ No newline at end of file + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + public String getShopCode() { + return shopCode; + } + + public void setShopCode(String shopCode) { + this.shopCode = shopCode; + } + + public String getSubTitle() { + return subTitle; + } + + public void setSubTitle(String subTitle) { + this.subTitle = subTitle; + } + + public String getMerchantId() { + return merchantId; + } + + public void setMerchantId(String merchantId) { + this.merchantId = merchantId; + } + + public String getShopName() { + return shopName; + } + + public void setShopName(String shopName) { + this.shopName = shopName; + } + + public String getChainName() { + return chainName; + } + + public void setChainName(String chainName) { + this.chainName = chainName; + } + + public String getBackImg() { + return backImg; + } + + public void setBackImg(String backImg) { + this.backImg = backImg; + } + + public String getFrontImg() { + return frontImg; + } + + public void setFrontImg(String frontImg) { + this.frontImg = frontImg; + } + + public String getContactName() { + return contactName; + } + + public void setContactName(String contactName) { + this.contactName = contactName; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getLogo() { + return logo; + } + + public void setLogo(String logo) { + this.logo = logo; + } + + public Integer getIsDeposit() { + return isDeposit; + } + + public void setIsDeposit(Integer isDeposit) { + this.isDeposit = isDeposit; + } + + public Integer getIsSupply() { + return isSupply; + } + + public void setIsSupply(Integer isSupply) { + this.isSupply = isSupply; + } + + public String getCoverImg() { + return coverImg; + } + + public void setCoverImg(String coverImg) { + this.coverImg = coverImg; + } + + public String getShareImg() { + return shareImg; + } + + public void setShareImg(String shareImg) { + this.shareImg = shareImg; + } + + public String getView() { + return view; + } + + public void setView(String view) { + this.view = view; + } + + public String getDetail() { + return detail; + } + + public void setDetail(String detail) { + this.detail = detail; + } + + public String getLat() { + return lat; + } + + public void setLat(String lat) { + this.lat = lat; + } + + public String getLng() { + return lng; + } + + public void setLng(String lng) { + this.lng = lng; + } + + public String getMchId() { + return mchId; + } + + public void setMchId(String mchId) { + this.mchId = mchId; + } + + public String getRegisterType() { + return registerType; + } + + public void setRegisterType(String registerType) { + this.registerType = registerType; + } + + public Integer getIsWxMaIndependent() { + return isWxMaIndependent; + } + + public void setIsWxMaIndependent(Integer isWxMaIndependent) { + this.isWxMaIndependent = isWxMaIndependent; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getIndustry() { + return industry; + } + + public void setIndustry(String industry) { + this.industry = industry; + } + + public String getIndustryName() { + return industryName; + } + + public void setIndustryName(String industryName) { + this.industryName = industryName; + } + + public String getBusinessStartDay() { + return businessStartDay; + } + + public void setBusinessStartDay(String businessStartDay) { + this.businessStartDay = businessStartDay; + } + + public String getBusinessEndDay() { + return businessEndDay; + } + + public void setBusinessEndDay(String businessEndDay) { + this.businessEndDay = businessEndDay; + } + + public String getBusinessTime() { + return businessTime; + } + + public void setBusinessTime(String businessTime) { + this.businessTime = businessTime; + } + + public String getPostTime() { + return postTime; + } + + public void setPostTime(String postTime) { + this.postTime = postTime; + } + + public BigDecimal getPostAmountLine() { + return postAmountLine; + } + + public void setPostAmountLine(BigDecimal postAmountLine) { + this.postAmountLine = postAmountLine; + } + + public Integer getOnSale() { + return onSale; + } + + public void setOnSale(Integer onSale) { + this.onSale = onSale; + } + + public Integer getSettleType() { + return settleType; + } + + public void setSettleType(Integer settleType) { + this.settleType = settleType; + } + + public String getSettleTime() { + return settleTime; + } + + public void setSettleTime(String settleTime) { + this.settleTime = settleTime; + } + + public Integer getEnterAt() { + return enterAt; + } + + public void setEnterAt(Integer enterAt) { + this.enterAt = enterAt; + } + + public Long getExpireAt() { + return expireAt; + } + + public void setExpireAt(Long expireAt) { + this.expireAt = expireAt; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public BigDecimal getAverage() { + return average; + } + + public void setAverage(BigDecimal average) { + this.average = average; + } + + public Integer getOrderWaitPayMinute() { + return orderWaitPayMinute; + } + + public void setOrderWaitPayMinute(Integer orderWaitPayMinute) { + this.orderWaitPayMinute = orderWaitPayMinute; + } + + public Integer getSupportDeviceNumber() { + return supportDeviceNumber; + } + + public void setSupportDeviceNumber(Integer supportDeviceNumber) { + this.supportDeviceNumber = supportDeviceNumber; + } + + public Integer getDistributeLevel() { + return distributeLevel; + } + + public void setDistributeLevel(Integer distributeLevel) { + this.distributeLevel = distributeLevel; + } + + public Long getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Long createdAt) { + this.createdAt = createdAt; + } + + public Long getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Long updatedAt) { + this.updatedAt = updatedAt; + } + + public String getProxyId() { + return proxyId; + } + + public void setProxyId(String proxyId) { + this.proxyId = proxyId; + } + + public String getProfiles() { + return profiles; + } + + public void setProfiles(String profiles) { + this.profiles = profiles; + } + + public String getShopQrcode() { + return shopQrcode; + } + + public void setShopQrcode(String shopQrcode) { + this.shopQrcode = shopQrcode; + } + + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + public String getIsOpenYhq() { + return isOpenYhq; + } + + public void setIsOpenYhq(String isOpenYhq) { + this.isOpenYhq = isOpenYhq; + } + + public Integer getIsUseVip() { + return isUseVip; + } + + public void setIsUseVip(Integer isUseVip) { + this.isUseVip = isUseVip; + } + + public String getProvinces() { + return provinces; + } + + public void setProvinces(String provinces) { + this.provinces = provinces; + } + + public String getCities() { + return cities; + } + + public void setCities(String cities) { + this.cities = cities; + } + + public String getDistricts() { + return districts; + } + + public void setDistricts(String districts) { + this.districts = districts; + } + + public String getIsCustom() { + return isCustom; + } + + public void setIsCustom(String isCustom) { + this.isCustom = isCustom; + } + + public String getIsReturn() { + return isReturn; + } + + public void setIsReturn(String isReturn) { + this.isReturn = isReturn; + } + + public String getIsMemberIn() { + return isMemberIn; + } + + public void setIsMemberIn(String isMemberIn) { + this.isMemberIn = isMemberIn; + } + + public String getIsMemberReturn() { + return isMemberReturn; + } + + public void setIsMemberReturn(String isMemberReturn) { + this.isMemberReturn = isMemberReturn; + } + + public Integer getIsTableFee() { + return isTableFee; + } + + public void setIsTableFee(Integer isTableFee) { + this.isTableFee = isTableFee; + } + + public Integer getIsMemberPrice() { + return isMemberPrice; + } + + public void setIsMemberPrice(Integer isMemberPrice) { + this.isMemberPrice = isMemberPrice; + } + + public String getConsumeColony() { + return consumeColony; + } + + public void setConsumeColony(String consumeColony) { + this.consumeColony = consumeColony; + } + + public BigDecimal getTableFee() { + return tableFee; + } + + public void setTableFee(BigDecimal tableFee) { + this.tableFee = tableFee; + } + + public String getEatModel() { + return eatModel; + } + + public void setEatModel(String eatModel) { + this.eatModel = eatModel; + } + + public String getSmallQrcode() { + return smallQrcode; + } + + public void setSmallQrcode(String smallQrcode) { + this.smallQrcode = smallQrcode; + } + + public String getPaymentQrcode() { + return paymentQrcode; + } + + public void setPaymentQrcode(String paymentQrcode) { + this.paymentQrcode = paymentQrcode; + } + +} + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/dto/CouponDto.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/dto/CouponDto.java new file mode 100644 index 0000000..3e18d1e --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/dto/CouponDto.java @@ -0,0 +1,11 @@ +package com.chaozhanggui.system.cashierservice.entity.dto; + +import lombok.Data; +@Data +public class CouponDto { + private Integer shopId; + private Integer userId; + //-1已过期 1未使用 2已使用 + private Integer status; + private Integer orderId; +} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/GroupOrderDetailsVo.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/GroupOrderDetailsVo.java index cee294b..9dfc193 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/GroupOrderDetailsVo.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/GroupOrderDetailsVo.java @@ -55,7 +55,7 @@ public class GroupOrderDetailsVo { * 商家名称 */ private String shopName; - private Byte isUseVip; + private Integer isUseVip; /** * 商家电话 */ diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/IntegralFlowVo.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/IntegralFlowVo.java deleted file mode 100644 index 12cfe06..0000000 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/IntegralFlowVo.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.chaozhanggui.system.cashierservice.entity.vo; - -import lombok.Data; - -import java.math.BigDecimal; - -/** - * @author lyf - */ -@Data -public class IntegralFlowVo { - private String openId; - private Integer page; - private Integer pageSize; - private String sign; - -} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/IntegralVo.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/IntegralVo.java deleted file mode 100644 index c26ab36..0000000 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/IntegralVo.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.chaozhanggui.system.cashierservice.entity.vo; - -import lombok.Data; - -import java.math.BigDecimal; - -/** - * @author lyf - */ -@Data -public class IntegralVo { - //openId - private String openId; - //数量 - private BigDecimal num; - //类型 - private String type; - //签名 - private String sign; - -} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/OrderConfirmVo.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/OrderConfirmVo.java index 1e774e4..5ffcca6 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/OrderConfirmVo.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/OrderConfirmVo.java @@ -8,7 +8,7 @@ import java.math.BigDecimal; public class OrderConfirmVo { private String proId; private String shopId; - private Byte isUseVip; + private Integer isUseVip; /** * 商品图片 */ 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 new file mode 100644 index 0000000..1e787be --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/TbUserCouponVo.java @@ -0,0 +1,30 @@ +package com.chaozhanggui.system.cashierservice.entity.vo; + +import lombok.Data; + +import java.util.Date; + +@Data +public class TbUserCouponVo { + private Integer couponId; + private Integer proId; + //优惠券名称 + private String name; + //优惠券类型 1 满减 2 商品券 + private Integer type; + //数量 + private Integer num; + //到期时间 + private Date endTime; + private Long expireTime; + private String useRestrictions; + private boolean isUse = false; + + + public void setEndTime(Date endTime) { + this.endTime = endTime; + if(endTime!=null){ + expireTime=endTime.getTime(); + } + } +} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/UserCouponVo.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/UserCouponVo.java deleted file mode 100644 index a2c7723..0000000 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/UserCouponVo.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.chaozhanggui.system.cashierservice.entity.vo; - -import lombok.Data; - -import java.math.BigDecimal; - -@Data -public class UserCouponVo { - /** - * 2 会员商品卷 - */ - private Integer type; - /** - * 卷描述 - */ - private String detail; - private String shopId; - private String shopName; - private String orderId; - /** - * 优惠金额 - */ - private BigDecimal couponsPrice = BigDecimal.ZERO; - /** - * 多少可用 - */ - private BigDecimal couponsAmount = BigDecimal.ZERO; - /** - * 数量 - */ - private Integer num; - /** - * 卷状态 0 未使用 - */ - private String status; -} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/VipProductsLimits.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/VipProductsLimits.java deleted file mode 100644 index 74f091b..0000000 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/vo/VipProductsLimits.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.chaozhanggui.system.cashierservice.entity.vo; - -import com.chaozhanggui.system.cashierservice.entity.TbProduct; -import lombok.Data; - -@Data -public class VipProductsLimits extends TbProduct { - - private Integer vipLimitNumber; - -} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/CartService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/CartService.java index a95cc07..2dd70c4 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/CartService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/CartService.java @@ -839,27 +839,6 @@ public class CartService { cart.setPackFee(BigDecimal.ZERO); } - if (cart.getIsVip().equals((byte) 1)) { - if (isVip) { - int i1 = activateInRecordService.queryByVipIdAndShopIdAndProId( - Integer.valueOf(tbShopUser.getId()), Integer.valueOf(shopId), Integer.valueOf(cart.getProductId())); - if (i1 < cart.getTotalNumber()) { - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("status", "fail"); - jsonObject1.put("msg", "会员商品[" + cart.getName() + "],可下单数量为" + i1); - jsonObject1.put("data", new ArrayList<>()); - PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), tableCartKey, jsonObject.getString("userId"), true); - continue; - } - } else { - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("status", "fail"); - jsonObject1.put("msg", "非会员用户不可下单会员商品"); - jsonObject1.put("data", new ArrayList<>()); - PushToAppChannelHandlerAdapter.getInstance().AppSendInfo(jsonObject1.toString(), tableCartKey, jsonObject.getString("userId"), true); - continue; - } - } TbProductSkuWithBLOBs tbProduct; if (!"-999".equals(cart.getProductId())) { tbProduct = productSkuMapper.selectByPrimaryKey(Integer.valueOf(cart.getSkuId())); @@ -1039,29 +1018,7 @@ public class CartService { } // 去除餐位费信息 - - List outRecords = new ArrayList<>(); for (TbCashierCart cashierCart : cashierCartList) { - if (!cashierCart.getProductId().equals("-999") && cashierCart.getIsVip().equals((byte) 1)) { - List actInRecords = activateInRecordService.queryAllByVipIdAndShopIdAndProId( - Integer.valueOf(tbShopUser.getId()), Integer.valueOf(orderInfo.getShopId()), Integer.valueOf(cashierCart.getProductId())); - Integer totalNumber = cashierCart.getTotalNumber(); - for (TbActivateInRecord actInRecord : actInRecords) { - if (totalNumber > 0) { - if (actInRecord.getOverNum() > totalNumber) { - TbActivateOutRecord outRecord = new TbActivateOutRecord(actInRecord.getId(), actInRecord.getProId(), totalNumber, orderInfo.getId().toString(), "create"); - outRecords.add(outRecord); - activateInRecordService.updateOverNumById(actInRecord.getId(), actInRecord.getOverNum() - totalNumber); - break; - } else { - TbActivateOutRecord outRecord = new TbActivateOutRecord(actInRecord.getId(), actInRecord.getProId(), actInRecord.getOverNum(), orderInfo.getId().toString(), "create"); - outRecords.add(outRecord); - activateInRecordService.updateOverNumById(actInRecord.getId(), 0); - totalNumber = totalNumber - actInRecord.getOverNum(); - } - } - } - } cashierCart.setUpdatedAt(System.currentTimeMillis()); cashierCart.setOrderId(orderId + ""); if ((!TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId()) && !shopEatTypeInfoDTO.isDineInAfter()) @@ -1080,7 +1037,6 @@ public class CartService { // cashierCartMapper.deleteByPrimaryKey(seatCartInfo.getId()); // } - if (!CollectionUtils.isEmpty(outRecords)) outRecordMapper.insertBatch(outRecords); // 打印票据 if (!addOrderDetail.isEmpty() && shopEatTypeInfoDTO.isDineInAfter()) { diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/CashierCartService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/CashierCartService.java deleted file mode 100644 index 760fdfa..0000000 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/CashierCartService.java +++ /dev/null @@ -1,156 +0,0 @@ -//package com.chaozhanggui.system.cashierservice.service; -// -//import com.chaozhanggui.system.cashierservice.dao.TbCashierCartMapper; -//import com.chaozhanggui.system.cashierservice.dao.TbProductMapper; -//import com.chaozhanggui.system.cashierservice.dao.TbProductSkuMapper; -//import com.chaozhanggui.system.cashierservice.entity.TbCashierCart; -//import com.chaozhanggui.system.cashierservice.entity.TbProduct; -//import com.chaozhanggui.system.cashierservice.entity.TbProductSku; -//import com.chaozhanggui.system.cashierservice.entity.dto.ProductCartDto; -//import com.chaozhanggui.system.cashierservice.entity.vo.CashierCarVo; -//import com.chaozhanggui.system.cashierservice.exception.MsgException; -//import com.chaozhanggui.system.cashierservice.sign.CodeEnum; -//import com.chaozhanggui.system.cashierservice.sign.Result; -//import lombok.extern.slf4j.Slf4j; -//import org.springframework.beans.BeanUtils; -//import org.springframework.stereotype.Service; -//import org.springframework.transaction.annotation.Transactional; -// -//import javax.annotation.Resource; -//import java.math.BigDecimal; -//import java.time.Instant; -//import java.util.ArrayList; -//import java.util.HashMap; -//import java.util.List; -// -///** -// * @author lyf -// */ -//@Service -//@Slf4j -//public class CashierCartService { -// @Resource -// private TbCashierCartMapper cashierCartMapper; -// @Resource -// private TbProductMapper productMapper; -// @Resource -// private TbProductSkuMapper productSkuMapper; -// -// /** -// * 增加购物车 -// * @param productCartDto -// * @return -// */ -// @Transactional(rollbackFor = Exception.class) -// public Result batchAdd(ProductCartDto productCartDto){ -// //首先确认金额 -// TbProduct tbProduct = productMapper.selectById(Integer.valueOf(productCartDto.getProductId())); -// if (tbProduct == null){ -// return Result.fail("商品信息不存在"); -// } -// -// TbCashierCart cashierCart = cashierCartMapper.selectByProduct(productCartDto.getProductId(), productCartDto.getTableId()); -// if (cashierCart != null){ -// if ("add".equals(productCartDto.getType())){ -// TbCashierCart cashierCartNow = new TbCashierCart(); -// cashierCartNow.setNumber(cashierCart.getNumber()+1F); -// cashierCartNow.setId(cashierCart.getId()); -// cashierCartMapper.updateByPrimaryKeySelective(cashierCartNow); -// return Result.success(CodeEnum.ENCRYPT); -// }else if ("minus".equals(productCartDto.getType())){ -// TbCashierCart cashierCartNow = new TbCashierCart(); -// cashierCartNow.setNumber(cashierCart.getNumber()-1F); -// cashierCartNow.setId(cashierCart.getId()); -// if (cashierCartNow.getNumber() == 0F){ -// cashierCartNow.setStatus("clear"); -// cashierCartMapper.updateByPrimaryKeySelective(cashierCartNow); -// return Result.success(CodeEnum.ENCRYPT); -// } -// cashierCartMapper.updateByPrimaryKeySelective(cashierCartNow); -// return Result.success(CodeEnum.ENCRYPT); -// }else { -// throw new MsgException("添加购物车失败"); -// } -// } -// //增加新的购物车 -// TbCashierCart tbCashierCart = new TbCashierCart(); -// BeanUtils.copyProperties(productCartDto,tbCashierCart); -// tbCashierCart.setSalePrice(tbProduct.getLowPrice()); -// tbCashierCart.setCreatedAt(Instant.now().toEpochMilli()); -// tbCashierCart.setUpdatedAt(Instant.now().toEpochMilli()); -// tbCashierCart.setTotalNumber(0.00F); -// tbCashierCart.setRefundNumber(0.00F); -// tbCashierCart.setType((byte) 0); -// tbCashierCart.setSkuId(productCartDto.getSkuInfo()); -// //购物车状态打开 -// tbCashierCart.setStatus("open"); -// -// int insert = cashierCartMapper.insertSelective(tbCashierCart); -// if (insert>0){ -// return Result.success(CodeEnum.SUCCESS); -// } -// throw new MsgException("添加购物车失败"); -// } -// -// -// public Result cartList(Integer tableId){ -// HashMap map = new HashMap<>(); -// List tbCashierCarts = cashierCartMapper.selectByTableId(tableId); -// BigDecimal total = new BigDecimal("0.00"); -// for (TbCashierCart date :tbCashierCarts) { -// Float number = date.getNumber(); -// BigDecimal bigDecimalValue = new BigDecimal(number.toString()); -// total=total.add(bigDecimalValue.multiply(date.getSalePrice())); -// } -// -// map.put("cartList",tbCashierCarts); -// map.put("total",total); -// -// return Result.success(CodeEnum.ENCRYPT,map); -// -// } -// @Transactional(rollbackFor = Exception.class) -// public Result updateNumber(Integer tableId,String type){ -// TbCashierCart cashierCart = cashierCartMapper.selectByPrimaryKey(tableId); -// if (cashierCart == null){ -// return Result.fail("商品不存在"); -// } -// if ("add".equals(type)){ -// TbCashierCart cashierCartNow = new TbCashierCart(); -// cashierCartNow.setNumber(cashierCart.getNumber()+1F); -// cashierCartNow.setId(cashierCart.getId()); -// cashierCartMapper.updateByPrimaryKeySelective(cashierCartNow); -// return Result.success(CodeEnum.ENCRYPT); -// }else if ("minus".equals(type)){ -// TbCashierCart cashierCartNow = new TbCashierCart(); -// cashierCartNow.setNumber(cashierCart.getNumber()-1F); -// cashierCartNow.setId(cashierCart.getId()); -// if (cashierCartNow.getNumber() == 0F){ -// cashierCartNow.setStatus("clear"); -// cashierCartMapper.updateByPrimaryKeySelective(cashierCartNow); -// return Result.success(CodeEnum.ENCRYPT); -// } -// cashierCartMapper.updateByPrimaryKeySelective(cashierCartNow); -// return Result.success(CodeEnum.ENCRYPT); -// }else { -// throw new MsgException("更改商品失败"); -// } -// -// } -// @Transactional(rollbackFor = Exception.class) -// public Result clearCart(Integer tableId){ -// List cashierCarVos = cashierCartMapper.selectByTableIdOpen(tableId); -// if (cashierCarVos.isEmpty()){ -// return Result.fail("购物车内无商品"); -// } -// List ids = new ArrayList<>(); -// for (CashierCarVo date :cashierCarVos) { -// ids.add(date.getId()); -// } -// int i = cashierCartMapper.updateByIdsStatus(ids, Instant.now().toEpochMilli()); -// if (i != ids.size()){ -// throw new MsgException("清空购物车失败"); -// } -// return Result.success(CodeEnum.ENCRYPT); -// } -//} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java index 9c281b0..fcc0fbe 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/PayService.java @@ -1,5 +1,6 @@ package com.chaozhanggui.system.cashierservice.service; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.StrUtil; @@ -82,7 +83,9 @@ public class PayService { @Autowired TbShopPayTypeMapper tbShopPayTypeMapper; @Autowired - private TbActivateProductMapper actProductMapper; + private TbCouponProductMapper couProductMapper; + @Autowired + private TbShopCouponMapper couponMapper; @Resource private TbActivateInRecordMapper activateInRecordMapper; @@ -475,7 +478,6 @@ public class PayService { .eq(TbOrderDetail::getStatus, "unpaid") .set(TbOrderDetail::getStatus, "closed")); - outRecordMapper.updateByOrderIdAndStatus(orderInfo.getId(), "closed"); log.info("更新购物车:{}", cartCount); JSONObject jsonObject = new JSONObject(); @@ -1013,7 +1015,6 @@ public class PayService { //更新子单状态 tbOrderDetailMapper.updateStatusByOrderIdAndStatus(orderInfo.getId(), "closed"); - outRecordMapper.updateByOrderIdAndStatus(orderInfo.getId(), "closed"); //修改主单状态 orderInfo.setStatus("closed"); orderInfo.setPayType("wx_lite"); @@ -1098,7 +1099,6 @@ public class PayService { orderInfo.setPayAmount(orderInfo.getOrderAmount()); orderInfo.setPaidTime(System.currentTimeMillis()); tbOrderInfoMapper.updateByPrimaryKeySelective(orderInfo); - outRecordMapper.updateByOrderIdAndStatus(orderInfo.getId(), "closed"); JSONObject jsonObject = new JSONObject(); jsonObject.put("token", 0); @@ -1176,8 +1176,18 @@ public class PayService { PageHelper.startPage(page, pageSize); List list = tbActivateMapper.selectByShopId(shopId); for (TbActivate tbActivate : list) { - if (tbActivate.getIsGiftPro() == 1) { - tbActivate.setGives(actProductMapper.queryProsByActivateId(tbActivate.getId())); + if (tbActivate.getIsUseCoupon() == 1) { + TbShopCoupon coupon = couponMapper.queryById(tbActivate.getCouponId()); + if(coupon!=null){ + if(coupon.getType()==1){ + //满减 + tbActivate.setCouponDesc("满"+coupon.getFullAmount() + "减" + coupon.getDiscountAmount()+" * "+tbActivate.getNum()+"张"); + } else if (coupon.getType() == 2) { + //商品 + tbActivate.setCouponDesc("商品券"); + tbActivate.setGives(couProductMapper.queryProsByActivateId(coupon.getId(),tbActivate.getNum())); + } + } } } PageInfo pageInfo = new PageInfo(list); @@ -1292,25 +1302,68 @@ public class PayService { public BigDecimal giveActivate(TbShopUser tbShopUser, BigDecimal memAmount, Integer flowId) { TbActivate activate = tbActivateMapper.selectByAmount(tbShopUser.getShopId(), memAmount); if (ObjectUtil.isNotEmpty(activate) && ObjectUtil.isNotNull(activate)) { - if (activate.getIsGiftPro() != null && activate.getIsGiftPro() == 1) { - List tbActivateProducts = actProductMapper.queryAllByActivateId(activate.getId()); - List actGiveRecords = new ArrayList<>(); - for (TbActivateProduct actPro : tbActivateProducts) { - TbActivateInRecord record = new TbActivateInRecord(Integer.valueOf(tbShopUser.getId()), actPro.getProductId(), actPro.getNum(), Integer.valueOf(tbShopUser.getShopId()), activate.getId(), flowId); - actGiveRecords.add(record); + if (activate.getIsUseCoupon() == 1) { + TbShopCoupon tbShopCoupon = couponMapper.queryById(activate.getCouponId()); + Date start = new Date(); + Date end = new Date(); + if ("fixed".equals(tbShopCoupon.getValidityType())) { + //固定时间 + end = DateUtil.offsetDay(new Date(),tbShopCoupon.getValidDays()); + } else if ("custom".equals(tbShopCoupon.getValidityType())) { + //自定义时间 + start = tbShopCoupon.getValidStartTime(); + end = tbShopCoupon.getValidEndTime(); + } + if (tbShopCoupon != null) { + List actGiveRecords = new ArrayList<>(); + if(tbShopCoupon.getType() == 1) { + //满减 + TbActivateInRecord record = new TbActivateInRecord(); + record.setVipUserId(Integer.valueOf(tbShopUser.getId())); + record.setCouponId(tbShopCoupon.getId()); + record.setName("满" + tbShopCoupon.getFullAmount() + "减" + tbShopCoupon.getDiscountAmount()); + record.setFullAmount(tbShopCoupon.getFullAmount()); + record.setDiscountAmount(tbShopCoupon.getDiscountAmount()); + record.setType(1); + record.setNum(activate.getNum()); + record.setOverNum(activate.getNum()); + record.setShopId(Integer.valueOf(tbShopUser.getShopId())); + record.setSourceActId(activate.getId()); + record.setSourceFlowId(flowId); + record.setUseStartTime(start); + record.setUseEndTime(end); + record.setCouponJson(activateInRecordService.getCouponJson(activate,tbShopCoupon,null)); + actGiveRecords.add(record); + } else if (tbShopCoupon.getType() == 2) { + //商品卷 + List tbCouponProducts = couProductMapper.queryAllByCouponId(tbShopCoupon.getId()); + for (TbCouponProduct actPro : tbCouponProducts) { + TbActivateInRecord record = new TbActivateInRecord(); + record.setVipUserId(Integer.valueOf(tbShopUser.getId())); + record.setCouponId(tbShopCoupon.getId()); + record.setName("商品卷"); + record.setType(2); + record.setProId(actPro.getProductId()); + record.setNum(actPro.getNum()*tbShopCoupon.getNumber()); + record.setOverNum(actPro.getNum()*tbShopCoupon.getNumber()); + record.setShopId(Integer.valueOf(tbShopUser.getShopId())); + record.setSourceActId(activate.getId()); + record.setSourceFlowId(flowId); + record.setUseStartTime(start); + record.setUseEndTime(end); + record.setCouponJson(activateInRecordService.getCouponJson(activate,tbShopCoupon,actPro)); + actGiveRecords.add(record); + } + } + activateInRecordMapper.insertBatch(actGiveRecords); + tbShopCoupon.setLeftNumber(tbShopCoupon.getLeftNumber()-activate.getNum()); + couponMapper.update(tbShopCoupon); } - activateInRecordMapper.insertBatch(actGiveRecords); - } - BigDecimal amount = BigDecimal.ZERO; - switch (activate.getHandselType()) { - case "GD": - amount = activate.getHandselNum(); - break; - case "RATIO": - amount = memAmount.multiply(activate.getHandselNum()); - break; } + BigDecimal amount = activate.getGiftAmount() == null ? + BigDecimal.ZERO : new BigDecimal(activate.getGiftAmount()); + tbShopUser.setAmount(tbShopUser.getAmount().add(amount)); tbShopUser.setUpdatedAt(System.currentTimeMillis()); tbShopUserMapper.updateByPrimaryKeySelective(tbShopUser); diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java index 13bce08..8164930 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java @@ -234,16 +234,6 @@ public class ProductService { } }); groupList.sort(Comparator.comparingInt(TbProductGroup::getIsSale).reversed()); - TbShopUser tbShopUser = tbShopUserMapper.selectByUserIdAndShopId(userId, shopId); - if (tbShopUser != null) { - TbProductGroup vipProGroup = new TbProductGroup(); - vipProGroup.setName("会员商品"); - List vipPros = activateInRecordService.queryByVipIdAndShopId(Integer.valueOf(tbShopUser.getId()), Integer.valueOf(shopId)); - if(!CollectionUtils.isEmpty(vipPros)){ - vipProGroup.setProducts(handleDate(vipPros, true, 1, true)); - groupList.add(0, vipProGroup); - } - } groupList.add(0, hot); concurrentMap.put("productInfo", groupList); } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/TbActivateInRecordService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbActivateInRecordService.java index 01c3a7d..fb12c4a 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/TbActivateInRecordService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbActivateInRecordService.java @@ -1,11 +1,10 @@ package com.chaozhanggui.system.cashierservice.service; -import com.chaozhanggui.system.cashierservice.entity.TbActivateInRecord; -import com.chaozhanggui.system.cashierservice.entity.TbProduct; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; - -import java.util.List; +import com.alibaba.fastjson.JSONObject; +import com.chaozhanggui.system.cashierservice.entity.TbActivate; +import com.chaozhanggui.system.cashierservice.entity.TbCouponProduct; +import com.chaozhanggui.system.cashierservice.entity.TbShopCoupon; +import org.springframework.stereotype.Service; /** * 活动商品赠送表(TbActivateInRecord)表服务接口 @@ -13,44 +12,14 @@ import java.util.List; * @author ww * @since 2024-08-22 11:13:40 */ -public interface TbActivateInRecordService { - - /** - * 通过ID查询单条数据 - * - * @param id 主键 - * @return 实例对象 - */ - TbActivateInRecord queryById(Integer id); - - List queryByVipIdAndShopId(Integer vipUserId, Integer shopId); - int queryByVipIdAndShopIdAndProId(Integer vipUserId, Integer shopId,Integer productId); - List queryAllByVipIdAndShopIdAndProId(Integer vipUserId, Integer shopId,Integer productId); - - /** - * 新增数据 - * - * @param tbActivateInRecord 实例对象 - * @return 实例对象 - */ - TbActivateInRecord insert(TbActivateInRecord tbActivateInRecord); - - /** - * 修改数据 - * - * @param tbActivateInRecord 实例对象 - * @return 实例对象 - */ - TbActivateInRecord update(TbActivateInRecord tbActivateInRecord); - - int updateOverNumById(Integer id,Integer overNum); - - /** - * 通过主键删除数据 - * - * @param id 主键 - * @return 是否成功 - */ - boolean deleteById(Integer id); +@Service +public class TbActivateInRecordService { + public String getCouponJson(TbActivate activate, TbShopCoupon tbShopCoupon, TbCouponProduct couProduct){ + JSONObject result = new JSONObject(); + result.put("activate",JSONObject.toJSON(activate)); + result.put("coupon",JSONObject.toJSON(tbShopCoupon)); + result.put("couProduct",JSONObject.toJSON(couProduct)); + return result.toJSONString(); + } } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/TbActivateOutRecordService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbActivateOutRecordService.java deleted file mode 100644 index e8be3aa..0000000 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/TbActivateOutRecordService.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.chaozhanggui.system.cashierservice.service; - -import com.chaozhanggui.system.cashierservice.entity.TbActivateOutRecord; - -/** - * 活动赠送商品使用记录表(TbActivateOutRecord)表服务接口 - * - * @author ww - * @since 2024-08-22 11:21:56 - */ -public interface TbActivateOutRecordService { - - /** - * 通过ID查询单条数据 - * - * @param id 主键 - * @return 实例对象 - */ - TbActivateOutRecord queryById(Integer id); - - /** - * 新增数据 - * - * @param tbActivateOutRecord 实例对象 - * @return 实例对象 - */ - TbActivateOutRecord insert(TbActivateOutRecord tbActivateOutRecord); - - /** - * 修改数据 - * - * @param tbActivateOutRecord 实例对象 - * @return 实例对象 - */ - TbActivateOutRecord update(TbActivateOutRecord tbActivateOutRecord); - - /** - * 通过主键删除数据 - * - * @param id 主键 - * @return 是否成功 - */ - boolean deleteById(Integer id); - -} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/TbShopCouponService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbShopCouponService.java new file mode 100644 index 0000000..aed7e77 --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbShopCouponService.java @@ -0,0 +1,15 @@ +package com.chaozhanggui.system.cashierservice.service; + +import com.chaozhanggui.system.cashierservice.entity.dto.CouponDto; +import com.chaozhanggui.system.cashierservice.sign.Result; +import org.springframework.context.annotation.Primary; + +/** + * 优惠券(TbShopCoupon)表服务接口 + * + * @author ww + * @since 2024-10-23 15:37:37 + */ +public interface TbShopCouponService { + Result find(CouponDto param); +} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/UserService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/UserService.java index 3e9345f..0240ce0 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/UserService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/UserService.java @@ -4,21 +4,16 @@ import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.qrcode.QrCodeUtil; import cn.hutool.extra.qrcode.QrConfig; -import com.alibaba.fastjson.JSONObject; import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper; import com.chaozhanggui.system.cashierservice.dao.TbShopUserMapper; import com.chaozhanggui.system.cashierservice.dao.TbUserInfoMapper; import com.chaozhanggui.system.cashierservice.entity.TbShopInfo; import com.chaozhanggui.system.cashierservice.entity.TbShopUser; import com.chaozhanggui.system.cashierservice.entity.TbUserInfo; -import com.chaozhanggui.system.cashierservice.entity.vo.IntegralVo; import com.chaozhanggui.system.cashierservice.entity.vo.OpenMemberVo; import com.chaozhanggui.system.cashierservice.exception.MsgException; import com.chaozhanggui.system.cashierservice.sign.CodeEnum; import com.chaozhanggui.system.cashierservice.sign.Result; -import com.chaozhanggui.system.cashierservice.util.CacheMap; -import com.chaozhanggui.system.cashierservice.util.JSONUtil; -import com.chaozhanggui.system.cashierservice.util.MD5Util; import com.chaozhanggui.system.cashierservice.util.RedisUtils; import com.chaozhanggui.system.cashierservice.wxUtil.WxAccountUtil; import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; @@ -62,21 +57,6 @@ public class UserService { } - public static void main(String[] args) { - IntegralVo integralVo = new IntegralVo(); - integralVo.setNum(new BigDecimal("5254")); - integralVo.setOpenId("or1l864NBOoJZhC5x_yeziZ26j6c"); - integralVo.setType("sub"); - JSONObject object = (JSONObject) JSONObject.toJSON(integralVo); - object.put("userSign", "02c03d79c36b4c01b217ffb1baef9009"); - JSONObject jsonObject = JSONUtil.sortJSONObject(object, CacheMap.map); - System.out.println("加密前字符串:" + jsonObject.toJSONString()); - String sign = MD5Util.encrypt(jsonObject.toJSONString()); - System.out.println("加密后签名:" + sign); - } - - - public String getSubQrCode(String shopId) throws Exception { 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 new file mode 100644 index 0000000..7075f61 --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopCouponServiceImpl.java @@ -0,0 +1,128 @@ +package com.chaozhanggui.system.cashierservice.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DateUtil; +import com.chaozhanggui.system.cashierservice.dao.*; +import com.chaozhanggui.system.cashierservice.entity.*; +import com.chaozhanggui.system.cashierservice.entity.dto.CouponDto; +import com.chaozhanggui.system.cashierservice.entity.vo.TbUserCouponVo; +import com.chaozhanggui.system.cashierservice.service.TbShopCouponService; +import com.chaozhanggui.system.cashierservice.sign.CodeEnum; +import com.chaozhanggui.system.cashierservice.sign.Result; +import com.google.gson.JsonObject; +import org.apache.commons.lang3.StringUtils; +import org.springframework.context.annotation.Primary; +import org.springframework.stereotype.Service; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.PageRequest; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 优惠券(TbShopCoupon)表服务实现类 + * + * @author ww + * @since 2024-10-23 15:37:37 + */ +@Primary +@Service +public class TbShopCouponServiceImpl implements TbShopCouponService { + @Resource + private TbOrderDetailMapper orderDetailMapper; + @Resource + private TbShopUserMapper shopUserMapper; + @Resource + private TbShopCouponMapper couponMapper; + @Resource + private TbOrderInfoMapper orderInfoMapper; + @Resource + private TbActivateInRecordMapper inRecordMapper; + @Resource + private TbActivateOutRecordMapper outRecordMapper; + + @Override + public Result find(CouponDto param) { + TbShopUser tbShopUser = shopUserMapper.selectByUserIdAndShopId(param.getUserId().toString(), param.getShopId().toString()); + if (param.getOrderId() != null) { + TbOrderInfo tbOrderInfo = orderInfoMapper.selectByPrimaryKey(param.getOrderId()); + List tbOrderDetails = orderDetailMapper.selectAllByOrderId(param.getOrderId()); + Set pros = tbOrderDetails.stream().map(TbOrderDetail::getProductId).collect(Collectors.toSet()); + if (CollectionUtil.isNotEmpty(tbOrderDetails)) { + List tbUserCouponVos = inRecordMapper.queryByVipIdAndShopId(Integer.valueOf(tbShopUser.getId()), param.getShopId()); + if (CollectionUtil.isNotEmpty(tbUserCouponVos)) { + String week = DateUtil.dayOfWeekEnum(new Date()).toChinese("周"); + LocalTime now = LocalTime.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss"); + + //券id 券使用描述 + Map coupons = new HashMap<>(); + for (TbUserCouponVo tbUserCouponVo : tbUserCouponVos) { + if (!coupons.containsKey(tbUserCouponVo.getCouponId())) { + JsonObject json=new JsonObject(); + boolean isUse = true; + TbShopCoupon tbShopCoupon = couponMapper.queryById(tbUserCouponVo.getCouponId()); + StringBuilder useRestrictions = new StringBuilder("每天 "); + if(tbShopCoupon.getType().equals(1)){ + if(tbOrderInfo.getOrderAmount().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); + } + JsonObject couponJson = coupons.get(tbUserCouponVo.getCouponId()); + tbUserCouponVo.setUseRestrictions(couponJson.get("useRestrictions").toString()); + if(tbUserCouponVo.getType().equals(1)){ + tbUserCouponVo.setUse(couponJson.get("isUse").getAsBoolean()); + } else if (tbUserCouponVo.getType().equals(2) && couponJson.get("isUse").getAsBoolean()) { + if(!pros.contains(tbUserCouponVo.getProId())){ + tbUserCouponVo.setUse(false); + } + } + } + tbUserCouponVos.sort(Comparator.comparing(TbUserCouponVo::isUse).reversed().thenComparing(TbUserCouponVo::getExpireTime)); + return new Result(CodeEnum.SUCCESS, tbUserCouponVos); + } + } + } else { + if (param.getStatus().equals(1)) { + return new Result(CodeEnum.SUCCESS, inRecordMapper.queryByVipIdAndShopId(Integer.valueOf(tbShopUser.getId()), param.getShopId())); + } else if (param.getStatus().equals(-1)) { + return new Result(CodeEnum.SUCCESS, inRecordMapper.queryByVipIdAndShopIdExpire(Integer.valueOf(tbShopUser.getId()), param.getShopId())); + } else if (param.getStatus().equals(2)) { + return new Result(CodeEnum.SUCCESS, outRecordMapper.queryByVipIdAndShopId(Integer.valueOf(tbShopUser.getId()), param.getShopId())); + } + } + return new Result(CodeEnum.SUCCESS); + } + +} diff --git a/src/main/resources/mapper/TbActivateInRecordMapper.xml b/src/main/resources/mapper/TbActivateInRecordMapper.xml index 4c9f5e1..ed6befc 100644 --- a/src/main/resources/mapper/TbActivateInRecordMapper.xml +++ b/src/main/resources/mapper/TbActivateInRecordMapper.xml @@ -5,29 +5,97 @@ + + + + + + + + - - id - , vip_user_id, pro_id, num, over_num, shop_id, source_act_id, source_flow_id, create_time, update_time + +id, vip_user_id, coupon_id, name, type, pro_id, full_amount, discount_amount, num, over_num, shop_id, source_act_id, source_flow_id, use_start_time, use_end_time, create_time, update_time, coupon_json + + + + + + - - - - - - - - - insert into tb_activate_in_record(vip_user_id, pro_id, num, over_num, shop_id, source_act_id, source_flow_id, - create_time, update_time) - values (#{vipUserId}, #{proId}, #{num}, #{overNum}, #{shopId}, #{sourceActId}, #{sourceFlowId}, #{createTime}, - #{updateTime}) + insert into tb_activate_in_record(vip_user_id, coupon_id, name, type, pro_id, full_amount, discount_amount, num, over_num, shop_id, source_act_id, source_flow_id, use_start_time, use_end_time, create_time, update_time, coupon_json) + values (#{vipUserId}, #{couponId}, #{name}, #{type}, #{proId}, #{fullAmount}, #{discountAmount}, #{num}, #{overNum}, #{shopId}, #{sourceActId}, #{sourceFlowId}, #{useStartTime}, #{useEndTime}, #{createTime}, #{updateTime}, #{couponJson}) - insert into tb_activate_in_record(vip_user_id, pro_id, num, over_num, shop_id, source_act_id, source_flow_id, - create_time, update_time) + insert into tb_activate_in_record(vip_user_id, coupon_id, name, type, pro_id, full_amount, discount_amount, num, over_num, shop_id, source_act_id, source_flow_id, use_start_time, use_end_time, create_time, update_time, coupon_json) values - (#{entity.vipUserId}, #{entity.proId}, #{entity.num}, #{entity.overNum}, #{entity.shopId}, - #{entity.sourceActId}, #{entity.sourceFlowId}, #{entity.createTime}, #{entity.updateTime}) + (#{entity.vipUserId}, #{entity.couponId}, #{entity.name}, #{entity.type}, #{entity.proId}, #{entity.fullAmount}, #{entity.discountAmount}, #{entity.num}, #{entity.overNum}, #{entity.shopId}, #{entity.sourceActId}, #{entity.sourceFlowId}, #{entity.useStartTime}, #{entity.useEndTime}, #{entity.createTime}, #{entity.updateTime}, #{entity.couponJson}) @@ -153,9 +191,24 @@ vip_user_id = #{vipUserId}, + + coupon_id = #{couponId}, + + + name = #{name}, + + + type = #{type}, + pro_id = #{proId}, + + full_amount = #{fullAmount}, + + + discount_amount = #{discountAmount}, + num = #{num}, @@ -171,28 +224,28 @@ source_flow_id = #{sourceFlowId}, + + use_start_time = #{useStartTime}, + + + use_end_time = #{useEndTime}, + create_time = #{createTime}, update_time = #{updateTime}, + + coupon_json = #{couponJson}, + where id = #{id} - - update tb_activate_in_record - set - over_num = #{overNum} - where id = #{id}; - - - delete - from tb_activate_in_record - where id = #{id} + delete from tb_activate_in_record where id = #{id} diff --git a/src/main/resources/mapper/TbActivateMapper.xml b/src/main/resources/mapper/TbActivateMapper.xml index 8eb2307..bddebc8 100644 --- a/src/main/resources/mapper/TbActivateMapper.xml +++ b/src/main/resources/mapper/TbActivateMapper.xml @@ -1,132 +1,143 @@ - - - - - - - - - - - - id, shop_id, min_num, max_num, handsel_num, handsel_type, is_del,is_gift_pro - - - - delete from tb_activate - where id = #{id,jdbcType=INTEGER} - - - insert into tb_activate (id, shop_id, min_num, - max_num, handsel_num, handsel_type, - is_del) - values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{minNum,jdbcType=INTEGER}, - #{maxNum,jdbcType=INTEGER}, #{handselNum,jdbcType=DECIMAL}, #{handselType,jdbcType=VARCHAR}, - #{isDel,jdbcType=VARCHAR}) - - - insert into tb_activate - - - id, - - - shop_id, - - - min_num, - - - max_num, - - - handsel_num, - - - handsel_type, - - - is_del, - - - - - #{id,jdbcType=INTEGER}, - - - #{shopId,jdbcType=INTEGER}, - - - #{minNum,jdbcType=INTEGER}, - - - #{maxNum,jdbcType=INTEGER}, - - - #{handselNum,jdbcType=DECIMAL}, - - - #{handselType,jdbcType=VARCHAR}, - - - #{isDel,jdbcType=VARCHAR}, - - - - - update tb_activate - - - shop_id = #{shopId,jdbcType=INTEGER}, - - - min_num = #{minNum,jdbcType=INTEGER}, - - - max_num = #{maxNum,jdbcType=INTEGER}, - - - handsel_num = #{handselNum,jdbcType=DECIMAL}, - - - handsel_type = #{handselType,jdbcType=VARCHAR}, - - - is_del = #{isDel,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=INTEGER} - - - update tb_activate - set shop_id = #{shopId,jdbcType=INTEGER}, - min_num = #{minNum,jdbcType=INTEGER}, - max_num = #{maxNum,jdbcType=INTEGER}, - handsel_num = #{handselNum,jdbcType=DECIMAL}, - handsel_type = #{handselType,jdbcType=VARCHAR}, - is_del = #{isDel,jdbcType=VARCHAR} - where id = #{id,jdbcType=INTEGER} - - + + + + + + + + + + + + + + id + , shop_id, amount, gift_amount, is_use_coupon, coupon_id, num, create_time, update_time + + + + + + + + + + + + + + + + insert into tb_activate(shop_id, amount, gift_amount, is_use_coupon, coupon_id, num, create_time, update_time) + values (#{shopId}, #{amount}, #{giftAmount}, #{isUseCoupon}, #{couponId}, #{num}, #{createTime}, #{updateTime}) + + + + insert into tb_activate(shop_id, amount, gift_amount, is_use_coupon, coupon_id, num, create_time, update_time) + values + + (#{entity.shopId}, #{entity.amount}, #{entity.giftAmount}, #{entity.isUseCoupon}, #{entity.couponId}, + #{entity.num}, #{entity.createTime}, #{entity.updateTime}) + + + + + + update tb_activate + + + shop_id = #{shopId}, + + + amount = #{amount}, + + + gift_amount = #{giftAmount}, + + + is_use_coupon = #{isUseCoupon}, + + + coupon_id = #{couponId}, + + + num = #{num}, + + + create_time = #{createTime}, + + + update_time = #{updateTime}, + + + where id = #{id} + + + + + delete + from tb_activate + where id = #{id} + + + - - \ No newline at end of file diff --git a/src/main/resources/mapper/TbActivateOutRecordMapper.xml b/src/main/resources/mapper/TbActivateOutRecordMapper.xml index 9f053b4..86b536d 100644 --- a/src/main/resources/mapper/TbActivateOutRecordMapper.xml +++ b/src/main/resources/mapper/TbActivateOutRecordMapper.xml @@ -4,11 +4,13 @@ + + - + + - @@ -16,7 +18,7 @@ id - , give_id, pro_id, use_num, ref_num, order_id,status, create_time, update_time + , shop_id, order_id, give_id, vip_user_id, type, use_num, ref_num, status, create_time, update_time - - + SELECT + CASE + WHEN outRecord.type = 1 THEN inRecord.name + WHEN outRecord.type = 2 THEN pro.NAME + END AS `name`, + outRecord.type, + outRecord.use_num-outRecord.ref_num as num + FROM + tb_activate_out_record outRecord + INNER JOIN tb_activate_in_record inRecord + on outRecord.give_id = inRecord.id + and inRecord.shop_id = #{shopId} + and inRecord.vip_user_id = #{vipUserId} + LEFT JOIN tb_product pro + ON inRecord.pro_id = pro.id and pro.shop_id = #{shopId} + WHERE + outRecord.vip_user_id = #{vipUserId} + and outRecord.shop_id = #{shopId} + and outRecord.status = 'closed' + and outRecord.use_num-outRecord.ref_num >0 + order by outRecord.create_time desc @@ -57,11 +63,20 @@ and id = #{id} + + and shop_id = #{shopId} + + + and order_id = #{orderId} + and give_id = #{giveId} - - and pro_id = #{proId} + + and vip_user_id = #{vipUserId} + + + and type = #{type} and use_num = #{useNum} @@ -69,9 +84,6 @@ and ref_num = #{refNum} - - and order_id = #{orderId} - and status = #{status} @@ -87,16 +99,19 @@ - insert into tb_activate_out_record(give_id, pro_id, use_num, ref_num, order_id, status, create_time, update_time) - values (#{giveId}, #{proId}, #{useNum}, #{refNum}, #{orderId}, #{status} #{createTime}, #{updateTime}) + insert into tb_activate_out_record(shop_id, order_id, give_id, vip_user_id, type, use_num, ref_num, status, + create_time, update_time) + values (#{shopId}, #{orderId}, #{giveId}, #{vipUserId}, #{type}, #{useNum}, #{refNum}, #{status}, #{createTime}, + #{updateTime}) - insert into tb_activate_out_record(give_id, pro_id, use_num, ref_num, order_id, status, create_time, update_time) + insert into tb_activate_out_record(shop_id, order_id, give_id, vip_user_id, type, use_num, ref_num, status, + create_time, update_time) values - (#{entity.giveId}, #{entity.proId}, #{entity.useNum}, #{entity.refNum}, #{entity.orderId}, - #{entity.status}, #{entity.createTime}, #{entity.updateTime}) + (#{entity.shopId}, #{entity.orderId}, #{entity.giveId}, #{entity.vipUserId}, #{entity.type}, + #{entity.useNum}, #{entity.refNum}, #{entity.status}, #{entity.createTime}, #{entity.updateTime}) @@ -104,11 +119,20 @@ update tb_activate_out_record + + shop_id = #{shopId}, + + + order_id = #{orderId}, + give_id = #{giveId}, - - pro_id = #{proId}, + + vip_user_id = #{vipUserId}, + + + type = #{type}, use_num = #{useNum}, @@ -116,9 +140,6 @@ ref_num = #{refNum}, - - order_id = #{orderId}, - status = #{status}, @@ -131,13 +152,6 @@ where id = #{id} - - update tb_activate_out_record - set - status = 'closed' - where order_id = #{orderId} - - diff --git a/src/main/resources/mapper/TbActivateProductMapper.xml b/src/main/resources/mapper/TbCouponProductMapper.xml similarity index 60% rename from src/main/resources/mapper/TbActivateProductMapper.xml rename to src/main/resources/mapper/TbCouponProductMapper.xml index 2f59325..251e1b6 100644 --- a/src/main/resources/mapper/TbActivateProductMapper.xml +++ b/src/main/resources/mapper/TbCouponProductMapper.xml @@ -1,39 +1,41 @@ - - + + + - + - -id, activate_id, product_id, num, create_time, update_time + + id + , coupon_id, product_id, num, create_time, update_time - select - + - from tb_activate_product + from tb_coupon_product where id = #{id} - select - + - from tb_activate_product + from tb_coupon_product and id = #{id} - - and activate_id = #{activateId} + + and coupon_id = #{couponId} and product_id = #{productId} @@ -50,43 +52,42 @@ id, activate_id, product_id, num, create_time, update_time - select - from tb_activate_product + from tb_coupon_product where - activate_id = #{activateId} + coupon_id = #{couponId} - - insert into tb_activate_product(activate_id, product_id, num, create_time, update_time) - values (#{activateId}, #{productId}, #{num}, #{createTime}, #{updateTime}) + insert into tb_coupon_product(coupon_id, product_id, num, create_time, update_time) + values (#{couponId}, #{productId}, #{num}, #{createTime}, #{updateTime}) - insert into tb_activate_product(activate_id, product_id, num, create_time, update_time) + insert into tb_coupon_product(coupon_id, product_id, num, create_time, update_time) values - (#{entity.activateId}, #{entity.productId}, #{entity.num}, #{entity.createTime}, #{entity.updateTime}) + (#{entity.couponId}, #{entity.productId}, #{entity.num}, #{entity.createTime}, #{entity.updateTime}) - update tb_activate_product + update tb_coupon_product - - activate_id = #{activateId}, + + coupon_id = #{couponId}, product_id = #{productId}, @@ -106,7 +107,9 @@ id, activate_id, product_id, num, create_time, update_time - delete from tb_activate_product where id = #{id} + delete + from tb_coupon_product + where id = #{id} diff --git a/src/main/resources/mapper/TbShopCouponMapper.xml b/src/main/resources/mapper/TbShopCouponMapper.xml new file mode 100644 index 0000000..32d2beb --- /dev/null +++ b/src/main/resources/mapper/TbShopCouponMapper.xml @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + , shop_id, title, type, full_amount, discount_amount, description, number, left_number, validity_type, valid_days, days_to_take_effect, valid_start_time, valid_end_time, user_days, use_time_type, use_start_time, use_end_time, use_number, editor, status, create_time, update_time + + + + + + + + + + + insert into tb_shop_coupon(shop_id, title, type, full_amount, discount_amount, description, number, left_number, + validity_type, valid_days, days_to_take_effect, valid_start_time, valid_end_time, + user_days, use_time_type, use_start_time, use_end_time, use_number, editor, status, + create_time, update_time) + values (#{shopId}, #{title}, #{type}, #{fullAmount}, #{discountAmount}, #{description}, #{number}, + #{leftNumber}, #{validityType}, #{validDays}, #{daysToTakeEffect}, #{validStartTime}, #{validEndTime}, + #{userDays}, #{useTimeType}, #{useStartTime}, #{useEndTime}, #{useNumber}, #{editor}, #{status}, + #{createTime}, #{updateTime}) + + + + insert into tb_shop_coupon(shop_id, title, type, full_amount, discount_amount, description, number, left_number, + validity_type, valid_days, days_to_take_effect, valid_start_time, valid_end_time, user_days, use_time_type, + use_start_time, use_end_time, use_number, editor, status, create_time, update_time) + values + + (#{entity.shopId}, #{entity.title}, #{entity.type}, #{entity.fullAmount}, #{entity.discountAmount}, + #{entity.description}, #{entity.number}, #{entity.leftNumber}, #{entity.validityType}, #{entity.validDays}, + #{entity.daysToTakeEffect}, #{entity.validStartTime}, #{entity.validEndTime}, #{entity.userDays}, + #{entity.useTimeType}, #{entity.useStartTime}, #{entity.useEndTime}, #{entity.useNumber}, #{entity.editor}, + #{entity.status}, #{entity.createTime}, #{entity.updateTime}) + + + + + + update tb_shop_coupon + + + shop_id = #{shopId}, + + + title = #{title}, + + + type = #{type}, + + + full_amount = #{fullAmount}, + + + discount_amount = #{discountAmount}, + + + description = #{description}, + + + number = #{number}, + + + left_number = #{leftNumber}, + + + validity_type = #{validityType}, + + + valid_days = #{validDays}, + + + days_to_take_effect = #{daysToTakeEffect}, + + + valid_start_time = #{validStartTime}, + + + valid_end_time = #{validEndTime}, + + + user_days = #{userDays}, + + + use_time_type = #{useTimeType}, + + + use_start_time = #{useStartTime}, + + + use_end_time = #{useEndTime}, + + + use_number = #{useNumber}, + + + editor = #{editor}, + + + status = #{status}, + + + create_time = #{createTime}, + + + update_time = #{updateTime}, + + + where id = #{id} + + + + + delete + from tb_shop_coupon + where id = #{id} + + + + diff --git a/src/main/resources/mapper/TbShopInfoMapper.xml b/src/main/resources/mapper/TbShopInfoMapper.xml index 78d2a24..f531d27 100644 --- a/src/main/resources/mapper/TbShopInfoMapper.xml +++ b/src/main/resources/mapper/TbShopInfoMapper.xml @@ -1,87 +1,82 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id - , account, shop_code, sub_title, merchant_id, shop_name, chain_name, back_img, - front_img, contact_name, phone, logo, is_deposit, is_supply, cover_img, share_img, - detail, lat, lng, mch_id, register_type, is_wx_ma_independent, address, city, type, - industry, industry_name, business_start_day,business_end_day,business_time, post_time, post_amount_line, on_sale, settle_type, - settle_time, enter_at, expire_at, status, average, order_wait_pay_minute, support_device_number, - distribute_level, created_at, updated_at, proxy_id, shop_qrcode, tag,is_open_yhq,is_use_vip,provinces,cities,districts,is_custom, - is_table_fee,table_fee,eat_model,small_qrcode,payment_qrcode - - - view - - select - , - from tb_shop_info where id = #{id,jdbcType=INTEGER} @@ -114,544 +109,6 @@ - - delete - from tb_shop_info - where id = #{id,jdbcType=INTEGER} - - - insert into tb_shop_info (id, account, shop_code, - sub_title, merchant_id, shop_name, - chain_name, back_img, front_img, - contact_name, phone, logo, - is_deposit, is_supply, cover_img, - share_img, detail, lat, - lng, mch_id, register_type, - is_wx_ma_independent, address, city, - type, industry, industry_name, - business_time, post_time, post_amount_line, - on_sale, settle_type, settle_time, - enter_at, expire_at, status, - average, order_wait_pay_minute, support_device_number, - distribute_level, created_at, updated_at, - proxy_id, view) - values (#{id,jdbcType=INTEGER}, #{account,jdbcType=VARCHAR}, #{shopCode,jdbcType=VARCHAR}, - #{subTitle,jdbcType=VARCHAR}, #{merchantId,jdbcType=VARCHAR}, #{shopName,jdbcType=VARCHAR}, - #{chainName,jdbcType=VARCHAR}, #{backImg,jdbcType=VARCHAR}, #{frontImg,jdbcType=VARCHAR}, - #{contactName,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{logo,jdbcType=VARCHAR}, - #{isDeposit,jdbcType=TINYINT}, #{isSupply,jdbcType=TINYINT}, #{coverImg,jdbcType=VARCHAR}, - #{shareImg,jdbcType=VARCHAR}, #{detail,jdbcType=VARCHAR}, #{lat,jdbcType=VARCHAR}, - #{lng,jdbcType=VARCHAR}, #{mchId,jdbcType=VARCHAR}, #{registerType,jdbcType=VARCHAR}, - #{isWxMaIndependent,jdbcType=TINYINT}, #{address,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, - #{type,jdbcType=VARCHAR}, #{industry,jdbcType=VARCHAR}, #{industryName,jdbcType=VARCHAR}, - #{businessTime,jdbcType=VARCHAR}, #{postTime,jdbcType=VARCHAR}, #{postAmountLine,jdbcType=DECIMAL}, - #{onSale,jdbcType=TINYINT}, #{settleType,jdbcType=TINYINT}, #{settleTime,jdbcType=VARCHAR}, - #{enterAt,jdbcType=INTEGER}, #{expireAt,jdbcType=BIGINT}, #{status,jdbcType=TINYINT}, - #{average,jdbcType=REAL}, #{orderWaitPayMinute,jdbcType=INTEGER}, - #{supportDeviceNumber,jdbcType=INTEGER}, - #{distributeLevel,jdbcType=TINYINT}, #{createdAt,jdbcType=BIGINT}, #{updatedAt,jdbcType=BIGINT}, - #{proxyId,jdbcType=VARCHAR}, #{view,jdbcType=LONGVARCHAR}) - - - insert into tb_shop_info - - - id, - - - account, - - - shop_code, - - - sub_title, - - - merchant_id, - - - shop_name, - - - chain_name, - - - back_img, - - - front_img, - - - contact_name, - - - phone, - - - logo, - - - is_deposit, - - - is_supply, - - - cover_img, - - - share_img, - - - detail, - - - lat, - - - lng, - - - mch_id, - - - register_type, - - - is_wx_ma_independent, - - - address, - - - city, - - - type, - - - industry, - - - industry_name, - - - business_time, - - - post_time, - - - post_amount_line, - - - on_sale, - - - settle_type, - - - settle_time, - - - enter_at, - - - expire_at, - - - status, - - - average, - - - order_wait_pay_minute, - - - support_device_number, - - - distribute_level, - - - created_at, - - - updated_at, - - - proxy_id, - - - view, - - - - - #{id,jdbcType=INTEGER}, - - - #{account,jdbcType=VARCHAR}, - - - #{shopCode,jdbcType=VARCHAR}, - - - #{subTitle,jdbcType=VARCHAR}, - - - #{merchantId,jdbcType=VARCHAR}, - - - #{shopName,jdbcType=VARCHAR}, - - - #{chainName,jdbcType=VARCHAR}, - - - #{backImg,jdbcType=VARCHAR}, - - - #{frontImg,jdbcType=VARCHAR}, - - - #{contactName,jdbcType=VARCHAR}, - - - #{phone,jdbcType=VARCHAR}, - - - #{logo,jdbcType=VARCHAR}, - - - #{isDeposit,jdbcType=TINYINT}, - - - #{isSupply,jdbcType=TINYINT}, - - - #{coverImg,jdbcType=VARCHAR}, - - - #{shareImg,jdbcType=VARCHAR}, - - - #{detail,jdbcType=VARCHAR}, - - - #{lat,jdbcType=VARCHAR}, - - - #{lng,jdbcType=VARCHAR}, - - - #{mchId,jdbcType=VARCHAR}, - - - #{registerType,jdbcType=VARCHAR}, - - - #{isWxMaIndependent,jdbcType=TINYINT}, - - - #{address,jdbcType=VARCHAR}, - - - #{city,jdbcType=VARCHAR}, - - - #{type,jdbcType=VARCHAR}, - - - #{industry,jdbcType=VARCHAR}, - - - #{industryName,jdbcType=VARCHAR}, - - - #{businessTime,jdbcType=VARCHAR}, - - - #{postTime,jdbcType=VARCHAR}, - - - #{postAmountLine,jdbcType=DECIMAL}, - - - #{onSale,jdbcType=TINYINT}, - - - #{settleType,jdbcType=TINYINT}, - - - #{settleTime,jdbcType=VARCHAR}, - - - #{enterAt,jdbcType=INTEGER}, - - - #{expireAt,jdbcType=BIGINT}, - - - #{status,jdbcType=TINYINT}, - - - #{average,jdbcType=REAL}, - - - #{orderWaitPayMinute,jdbcType=INTEGER}, - - - #{supportDeviceNumber,jdbcType=INTEGER}, - - - #{distributeLevel,jdbcType=TINYINT}, - - - #{createdAt,jdbcType=BIGINT}, - - - #{updatedAt,jdbcType=BIGINT}, - - - #{proxyId,jdbcType=VARCHAR}, - - - #{view,jdbcType=LONGVARCHAR}, - - - - - update tb_shop_info - - - account = #{account,jdbcType=VARCHAR}, - - - shop_code = #{shopCode,jdbcType=VARCHAR}, - - - sub_title = #{subTitle,jdbcType=VARCHAR}, - - - merchant_id = #{merchantId,jdbcType=VARCHAR}, - - - shop_name = #{shopName,jdbcType=VARCHAR}, - - - chain_name = #{chainName,jdbcType=VARCHAR}, - - - back_img = #{backImg,jdbcType=VARCHAR}, - - - front_img = #{frontImg,jdbcType=VARCHAR}, - - - contact_name = #{contactName,jdbcType=VARCHAR}, - - - phone = #{phone,jdbcType=VARCHAR}, - - - logo = #{logo,jdbcType=VARCHAR}, - - - is_deposit = #{isDeposit,jdbcType=TINYINT}, - - - is_supply = #{isSupply,jdbcType=TINYINT}, - - - cover_img = #{coverImg,jdbcType=VARCHAR}, - - - share_img = #{shareImg,jdbcType=VARCHAR}, - - - detail = #{detail,jdbcType=VARCHAR}, - - - lat = #{lat,jdbcType=VARCHAR}, - - - lng = #{lng,jdbcType=VARCHAR}, - - - mch_id = #{mchId,jdbcType=VARCHAR}, - - - register_type = #{registerType,jdbcType=VARCHAR}, - - - is_wx_ma_independent = #{isWxMaIndependent,jdbcType=TINYINT}, - - - address = #{address,jdbcType=VARCHAR}, - - - city = #{city,jdbcType=VARCHAR}, - - - type = #{type,jdbcType=VARCHAR}, - - - industry = #{industry,jdbcType=VARCHAR}, - - - industry_name = #{industryName,jdbcType=VARCHAR}, - - - business_time = #{businessTime,jdbcType=VARCHAR}, - - - post_time = #{postTime,jdbcType=VARCHAR}, - - - post_amount_line = #{postAmountLine,jdbcType=DECIMAL}, - - - on_sale = #{onSale,jdbcType=TINYINT}, - - - settle_type = #{settleType,jdbcType=TINYINT}, - - - settle_time = #{settleTime,jdbcType=VARCHAR}, - - - enter_at = #{enterAt,jdbcType=INTEGER}, - - - expire_at = #{expireAt,jdbcType=BIGINT}, - - - status = #{status,jdbcType=TINYINT}, - - - average = #{average,jdbcType=REAL}, - - - order_wait_pay_minute = #{orderWaitPayMinute,jdbcType=INTEGER}, - - - support_device_number = #{supportDeviceNumber,jdbcType=INTEGER}, - - - distribute_level = #{distributeLevel,jdbcType=TINYINT}, - - - created_at = #{createdAt,jdbcType=BIGINT}, - - - updated_at = #{updatedAt,jdbcType=BIGINT}, - - - proxy_id = #{proxyId,jdbcType=VARCHAR}, - - - view = #{view,jdbcType=LONGVARCHAR}, - - - where id = #{id,jdbcType=INTEGER} - - - update tb_shop_info - set account = #{account,jdbcType=VARCHAR}, - shop_code = #{shopCode,jdbcType=VARCHAR}, - sub_title = #{subTitle,jdbcType=VARCHAR}, - merchant_id = #{merchantId,jdbcType=VARCHAR}, - shop_name = #{shopName,jdbcType=VARCHAR}, - chain_name = #{chainName,jdbcType=VARCHAR}, - back_img = #{backImg,jdbcType=VARCHAR}, - front_img = #{frontImg,jdbcType=VARCHAR}, - contact_name = #{contactName,jdbcType=VARCHAR}, - phone = #{phone,jdbcType=VARCHAR}, - logo = #{logo,jdbcType=VARCHAR}, - is_deposit = #{isDeposit,jdbcType=TINYINT}, - is_supply = #{isSupply,jdbcType=TINYINT}, - cover_img = #{coverImg,jdbcType=VARCHAR}, - share_img = #{shareImg,jdbcType=VARCHAR}, - detail = #{detail,jdbcType=VARCHAR}, - lat = #{lat,jdbcType=VARCHAR}, - lng = #{lng,jdbcType=VARCHAR}, - mch_id = #{mchId,jdbcType=VARCHAR}, - register_type = #{registerType,jdbcType=VARCHAR}, - is_wx_ma_independent = #{isWxMaIndependent,jdbcType=TINYINT}, - address = #{address,jdbcType=VARCHAR}, - city = #{city,jdbcType=VARCHAR}, - type = #{type,jdbcType=VARCHAR}, - industry = #{industry,jdbcType=VARCHAR}, - industry_name = #{industryName,jdbcType=VARCHAR}, - business_time = #{businessTime,jdbcType=VARCHAR}, - post_time = #{postTime,jdbcType=VARCHAR}, - post_amount_line = #{postAmountLine,jdbcType=DECIMAL}, - on_sale = #{onSale,jdbcType=TINYINT}, - settle_type = #{settleType,jdbcType=TINYINT}, - settle_time = #{settleTime,jdbcType=VARCHAR}, - enter_at = #{enterAt,jdbcType=INTEGER}, - expire_at = #{expireAt,jdbcType=BIGINT}, - status = #{status,jdbcType=TINYINT}, - average = #{average,jdbcType=REAL}, - order_wait_pay_minute = #{orderWaitPayMinute,jdbcType=INTEGER}, - support_device_number = #{supportDeviceNumber,jdbcType=INTEGER}, - distribute_level = #{distributeLevel,jdbcType=TINYINT}, - created_at = #{createdAt,jdbcType=BIGINT}, - updated_at = #{updatedAt,jdbcType=BIGINT}, - proxy_id = #{proxyId,jdbcType=VARCHAR}, - view = #{view,jdbcType=LONGVARCHAR} - where id = #{id,jdbcType=INTEGER} - - - update tb_shop_info - set account = #{account,jdbcType=VARCHAR}, - shop_code = #{shopCode,jdbcType=VARCHAR}, - sub_title = #{subTitle,jdbcType=VARCHAR}, - merchant_id = #{merchantId,jdbcType=VARCHAR}, - shop_name = #{shopName,jdbcType=VARCHAR}, - chain_name = #{chainName,jdbcType=VARCHAR}, - back_img = #{backImg,jdbcType=VARCHAR}, - front_img = #{frontImg,jdbcType=VARCHAR}, - contact_name = #{contactName,jdbcType=VARCHAR}, - phone = #{phone,jdbcType=VARCHAR}, - logo = #{logo,jdbcType=VARCHAR}, - is_deposit = #{isDeposit,jdbcType=TINYINT}, - is_supply = #{isSupply,jdbcType=TINYINT}, - cover_img = #{coverImg,jdbcType=VARCHAR}, - share_img = #{shareImg,jdbcType=VARCHAR}, - detail = #{detail,jdbcType=VARCHAR}, - lat = #{lat,jdbcType=VARCHAR}, - lng = #{lng,jdbcType=VARCHAR}, - mch_id = #{mchId,jdbcType=VARCHAR}, - register_type = #{registerType,jdbcType=VARCHAR}, - is_wx_ma_independent = #{isWxMaIndependent,jdbcType=TINYINT}, - address = #{address,jdbcType=VARCHAR}, - city = #{city,jdbcType=VARCHAR}, - type = #{type,jdbcType=VARCHAR}, - industry = #{industry,jdbcType=VARCHAR}, - industry_name = #{industryName,jdbcType=VARCHAR}, - business_time = #{businessTime,jdbcType=VARCHAR}, - post_time = #{postTime,jdbcType=VARCHAR}, - post_amount_line = #{postAmountLine,jdbcType=DECIMAL}, - on_sale = #{onSale,jdbcType=TINYINT}, - settle_type = #{settleType,jdbcType=TINYINT}, - settle_time = #{settleTime,jdbcType=VARCHAR}, - enter_at = #{enterAt,jdbcType=INTEGER}, - expire_at = #{expireAt,jdbcType=BIGINT}, - status = #{status,jdbcType=TINYINT}, - average = #{average,jdbcType=REAL}, - order_wait_pay_minute = #{orderWaitPayMinute,jdbcType=INTEGER}, - support_device_number = #{supportDeviceNumber,jdbcType=INTEGER}, - distribute_level = #{distributeLevel,jdbcType=TINYINT}, - created_at = #{createdAt,jdbcType=BIGINT}, - updated_at = #{updatedAt,jdbcType=BIGINT}, - proxy_id = #{proxyId,jdbcType=VARCHAR} - where id = #{id,jdbcType=INTEGER} - - select - , - from tb_shop_info where id IN #{item} - \ No newline at end of file + + +