优惠券 出入
This commit is contained in:
@@ -0,0 +1,54 @@
|
|||||||
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
|
import com.czg.account.dto.ShopActivateDTO;
|
||||||
|
import com.czg.account.service.ShopActivateService;
|
||||||
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺充值活动管理
|
||||||
|
* @author ww
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/admin/activate")
|
||||||
|
public class ShopActivateController {
|
||||||
|
@Resource
|
||||||
|
private ShopActivateService shopActivateService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺充值活动列表
|
||||||
|
* 权限标识: activate:list
|
||||||
|
*/
|
||||||
|
@SaAdminCheckPermission("activate:list")
|
||||||
|
@GetMapping
|
||||||
|
public CzgResult<List<ShopActivateDTO>> detail() {
|
||||||
|
return CzgResult.success(shopActivateService.getList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺充值活动新增
|
||||||
|
* 权限标识: activate:add
|
||||||
|
*/
|
||||||
|
@SaAdminCheckPermission("activate:add")
|
||||||
|
@PutMapping
|
||||||
|
public CzgResult<Boolean> add(@RequestBody @Validated ShopActivateDTO activateDTO) {
|
||||||
|
return CzgResult.success(shopActivateService.add(activateDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺充值活动修改
|
||||||
|
* 权限标识: activate:edit
|
||||||
|
*/
|
||||||
|
@SaAdminCheckPermission("activate:edit")
|
||||||
|
@PutMapping
|
||||||
|
public CzgResult<Boolean> edit(@RequestBody @Validated ShopActivateDTO activateDTO) {
|
||||||
|
return CzgResult.success(shopActivateService.edit(activateDTO));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
|
import com.czg.account.service.ShopCouponService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ww
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/admin/coupon")
|
||||||
|
public class ShopCouponController {
|
||||||
|
@Resource
|
||||||
|
private ShopCouponService couponService;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.czg.controller.user;
|
||||||
|
|
||||||
|
import com.czg.account.dto.ShopActivateDTO;
|
||||||
|
import com.czg.account.service.ShopActivateService;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺充值活动管理
|
||||||
|
* @author ww
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/user/activate")
|
||||||
|
public class UserShopActivateController {
|
||||||
|
@Resource
|
||||||
|
private ShopActivateService shopActivateService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺充值活动列表
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public CzgResult<List<ShopActivateDTO>> detail() {
|
||||||
|
return CzgResult.success(shopActivateService.getList());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.czg.controller.user;
|
package com.czg.controller.user;
|
||||||
|
|
||||||
import com.czg.order.dto.OrderInfoQueryDTO;
|
import com.czg.order.dto.OrderInfoQueryDTO;
|
||||||
|
import com.czg.order.entity.OrderInfo;
|
||||||
import com.czg.order.service.OrderInfoService;
|
import com.czg.order.service.OrderInfoService;
|
||||||
import com.czg.order.vo.OrderInfoVo;
|
import com.czg.order.vo.OrderInfoVo;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
|
import com.czg.sa.StpKit;
|
||||||
|
import com.czg.utils.AssertUtil;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -11,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单管理
|
* 订单管理
|
||||||
|
*
|
||||||
* @author ww
|
* @author ww
|
||||||
* @description
|
* @description
|
||||||
*/
|
*/
|
||||||
@@ -25,7 +29,27 @@ public class UserOrderController {
|
|||||||
* 订单列表
|
* 订单列表
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public CzgResult<Page<OrderInfoVo>> get(@RequestBody OrderInfoQueryDTO queryDTO) {
|
public CzgResult<Page<OrderInfoVo>> getOrderPage(@RequestBody OrderInfoQueryDTO queryDTO) {
|
||||||
|
queryDTO.setIsDel(1);
|
||||||
|
queryDTO.setUserId(StpKit.USER.getLoginIdAsLong());
|
||||||
return CzgResult.success(orderInfoService.getOrderByPage(queryDTO));
|
return CzgResult.success(orderInfoService.getOrderByPage(queryDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public CzgResult<Void> createOrder(@RequestBody OrderInfoQueryDTO queryDTO) {
|
||||||
|
queryDTO.setIsDel(1);
|
||||||
|
queryDTO.setUserId(StpKit.USER.getLoginIdAsLong());
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("{id}")
|
||||||
|
public CzgResult<Void> upOrderIsDel(@PathVariable("id") Long id) {
|
||||||
|
//效验数据
|
||||||
|
AssertUtil.isNull(id, "{}不能为空", "订单Id");
|
||||||
|
orderInfoService.updateChain()
|
||||||
|
.set(OrderInfo::getIsDel, 1)
|
||||||
|
.eq(OrderInfoVo::getId, id)
|
||||||
|
.update();
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public class RabbitmqReceiver {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 消费者监听,绑定队列
|
* 消费者监听,绑定队列
|
||||||
|
* Queue RabbitConfig类的 orderPrintQueue
|
||||||
*/
|
*/
|
||||||
@RabbitListener(
|
@RabbitListener(
|
||||||
bindings = @QueueBinding(value = @Queue(value = "#{orderPrintQueue.name}", durable = "true",
|
bindings = @QueueBinding(value = @Queue(value = "#{orderPrintQueue.name}", durable = "true",
|
||||||
@@ -26,11 +27,9 @@ public class RabbitmqReceiver {
|
|||||||
concurrency = "10"
|
concurrency = "10"
|
||||||
)
|
)
|
||||||
@RabbitHandler
|
@RabbitHandler
|
||||||
public void receiveOrderPrintQueue(Channel channel, String payload, Message message) throws IOException {
|
public void receiveOrderPrintQueue(Channel channel, String orderId, Message message) throws IOException {
|
||||||
try {
|
try {
|
||||||
System.out.println("Topic模式(orderPrintQueue)消费者收到消息: " + message);
|
log.info("订单监听 消息体:{},消息内容:{}", message, orderId);
|
||||||
System.out.println(payload);
|
|
||||||
|
|
||||||
// 手动确认消息,multiple 参数表示是否批量确认
|
// 手动确认消息,multiple 参数表示是否批量确认
|
||||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -17,12 +17,20 @@ public class RabbitPublisher {
|
|||||||
@Resource
|
@Resource
|
||||||
private RabbitTemplate rabbitTemplate;
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
public void sendOrderStockMsg(String msg) {
|
/**
|
||||||
sendMsg(RabbitConstants.Exchange.CASH_EXCHANGE, RabbitConstants.Queue.ORDER_STOCK_QUEUE, msg);
|
* 库存损耗消息
|
||||||
|
* @param orderId 订单id
|
||||||
|
*/
|
||||||
|
public void sendOrderStockMsg(String orderId) {
|
||||||
|
sendMsg(RabbitConstants.Exchange.CASH_EXCHANGE, RabbitConstants.Queue.ORDER_STOCK_QUEUE, orderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendOrderPrintMsg(String msg) {
|
/**
|
||||||
sendMsg(RabbitConstants.Exchange.CASH_EXCHANGE, RabbitConstants.Queue.ORDER_PRINT_QUEUE, msg);
|
* 订单打印消息
|
||||||
|
* @param orderId
|
||||||
|
*/
|
||||||
|
public void sendOrderPrintMsg(String orderId) {
|
||||||
|
sendMsg(RabbitConstants.Exchange.CASH_EXCHANGE, RabbitConstants.Queue.ORDER_PRINT_QUEUE, orderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendMsg(String exchange, String queue, String msg) {
|
private void sendMsg(String exchange, String queue, String msg) {
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
|
||||||
|
package com.czg.account.dto;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import com.czg.validator.group.InsertGroup;
|
||||||
|
import com.czg.validator.group.UpdateGroup;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动 实体类。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ShopActivateDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@NotNull(message = "主键不能为空", groups = {UpdateGroup.class})
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值金额
|
||||||
|
*/
|
||||||
|
@NotNull(message = "充值金额不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||||
|
private Integer amount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 赠送金额
|
||||||
|
*/
|
||||||
|
private Integer giftAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 赠送积分
|
||||||
|
*/
|
||||||
|
private Integer giftPoints;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否赠送优惠卷 0否 1是
|
||||||
|
*/
|
||||||
|
private Integer isGiftCoupon = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠卷id
|
||||||
|
*/
|
||||||
|
private Long couponId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠卷数量
|
||||||
|
*/
|
||||||
|
private Integer num;
|
||||||
|
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
|
||||||
|
package com.czg.account.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Time;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import java.io.Serial;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券 实体类。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ShopCouponDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自增
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态0-关闭 1 正常
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称(无意义)
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
private String shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已使用数量
|
||||||
|
*/
|
||||||
|
private Integer useNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发放数量
|
||||||
|
*/
|
||||||
|
private Integer number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 剩余数量
|
||||||
|
*/
|
||||||
|
private Integer leftNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有效期类型,可选值为 fixed(固定时间)/custom(自定义时间)
|
||||||
|
*/
|
||||||
|
private String validityType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有效天数
|
||||||
|
*/
|
||||||
|
private Integer validDays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隔多少天生效
|
||||||
|
*/
|
||||||
|
private Integer daysToTakeEffect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有效开始时间
|
||||||
|
*/
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime validStartTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有效结束时间
|
||||||
|
*/
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime validEndTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 周 数组["周一","周二"]
|
||||||
|
*/
|
||||||
|
private String userDays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* all-全时段 custom-指定时段
|
||||||
|
*/
|
||||||
|
private String useTimeType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可用开始时间
|
||||||
|
*/
|
||||||
|
@JSONField(format = "HH:mm:ss")
|
||||||
|
private Time useStartTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可用结束时间
|
||||||
|
*/
|
||||||
|
@JSONField(format = "HH:mm:ss")
|
||||||
|
private Time useEndTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1-满减 2-商品
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 满多少金额
|
||||||
|
*/
|
||||||
|
private BigDecimal fullAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 减多少金额
|
||||||
|
*/
|
||||||
|
private BigDecimal discountAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发放人
|
||||||
|
*/
|
||||||
|
private String editor;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package com.czg.account.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动 实体类。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("tb_shop_activate")
|
||||||
|
public class ShopActivate implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值金额
|
||||||
|
*/
|
||||||
|
private Integer amount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 赠送金额
|
||||||
|
*/
|
||||||
|
private Integer giftAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 赠送积分
|
||||||
|
*/
|
||||||
|
private Integer giftPoints;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否赠送优惠卷 0否 1是
|
||||||
|
*/
|
||||||
|
private Integer isGiftCoupon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠卷id
|
||||||
|
*/
|
||||||
|
private Long couponId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠卷数量
|
||||||
|
*/
|
||||||
|
private Integer num;
|
||||||
|
|
||||||
|
@Column(onInsertValue = "now()")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
package com.czg.account.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动商品赠送记录表 实体类。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("tb_shop_activate_in_record")
|
||||||
|
public class ShopActivateInRecord implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员id
|
||||||
|
*/
|
||||||
|
private Long vipUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卷Id (校验是否可用)
|
||||||
|
*/
|
||||||
|
private Long couponId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 卷描述 满10减2/商品卷
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1-满减 2-商品
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品id
|
||||||
|
*/
|
||||||
|
private Long proId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 满多少金额
|
||||||
|
*/
|
||||||
|
private BigDecimal fullAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 减多少金额
|
||||||
|
*/
|
||||||
|
private BigDecimal discountAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 赠送数量
|
||||||
|
*/
|
||||||
|
private Integer num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未使用数量
|
||||||
|
*/
|
||||||
|
private Integer overNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 来源活动id
|
||||||
|
*/
|
||||||
|
private Long sourceActId;
|
||||||
|
|
||||||
|
private Long sourceFlowId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可用开始时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime useStartTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可用结束时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime useEndTime;
|
||||||
|
|
||||||
|
@Column(onInsertValue = "now()")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
private String couponJson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* invited/activate
|
||||||
|
*/
|
||||||
|
private String source;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package com.czg.account.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动赠送商品使用记录表 实体类。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("tb_shop_activate_out_record")
|
||||||
|
public class ShopActivateOutRecord implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品赠送Id tb_activate_in_record的id
|
||||||
|
*/
|
||||||
|
private Long giveId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员id
|
||||||
|
*/
|
||||||
|
private Long vipUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1-满减 2-商品
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用数量
|
||||||
|
*/
|
||||||
|
private Integer useNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退单量
|
||||||
|
*/
|
||||||
|
private Integer refNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建: create, 完成: closed, 取消:cancel,
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Column(onInsertValue = "now()")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
package com.czg.account.entity;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Time;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券 实体类。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("tb_shop_coupon")
|
||||||
|
public class ShopCoupon implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自增
|
||||||
|
*/
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态0-关闭 1 正常
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Column(onInsertValue = "now()")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称(无意义)
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
private String shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已使用数量
|
||||||
|
*/
|
||||||
|
private Integer useNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发放数量
|
||||||
|
*/
|
||||||
|
private Integer number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 剩余数量
|
||||||
|
*/
|
||||||
|
private Integer leftNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有效期类型,可选值为 fixed(固定时间)/custom(自定义时间)
|
||||||
|
*/
|
||||||
|
private String validityType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有效天数
|
||||||
|
*/
|
||||||
|
private Integer validDays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隔多少天生效
|
||||||
|
*/
|
||||||
|
private Integer daysToTakeEffect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有效开始时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime validStartTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有效结束时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime validEndTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 周 数组["周一","周二"]
|
||||||
|
*/
|
||||||
|
private String userDays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* all-全时段 custom-指定时段
|
||||||
|
*/
|
||||||
|
private String useTimeType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可用开始时间
|
||||||
|
*/
|
||||||
|
private Time useStartTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可用结束时间
|
||||||
|
*/
|
||||||
|
private Time useEndTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1-满减 2-商品
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 满多少金额
|
||||||
|
*/
|
||||||
|
private BigDecimal fullAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 减多少金额
|
||||||
|
*/
|
||||||
|
private BigDecimal discountAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发放人
|
||||||
|
*/
|
||||||
|
private String editor;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -106,11 +106,6 @@ public class ShopUser implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员码
|
|
||||||
*/
|
|
||||||
private String dynamicCode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最近一次积分变动时间
|
* 最近一次积分变动时间
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.account.service;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.czg.account.entity.ShopActivateInRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动商品赠送记录表 服务层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
public interface ShopActivateInRecordService extends IService<ShopActivateInRecord> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.account.service;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.czg.account.entity.ShopActivateOutRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动赠送商品使用记录表 服务层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
public interface ShopActivateOutRecordService extends IService<ShopActivateOutRecord> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.czg.account.service;
|
||||||
|
|
||||||
|
import com.czg.account.dto.ShopActivateDTO;
|
||||||
|
import com.czg.account.entity.ShopActivate;
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动 服务层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
public interface ShopActivateService extends IService<ShopActivate> {
|
||||||
|
|
||||||
|
List<ShopActivateDTO> getList();
|
||||||
|
|
||||||
|
Boolean add(ShopActivateDTO activateDTO);
|
||||||
|
|
||||||
|
Boolean edit(ShopActivateDTO activateDTO);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.czg.account.service;
|
||||||
|
|
||||||
|
import com.czg.account.dto.ShopCouponDTO;
|
||||||
|
import com.czg.account.entity.ShopActivateOutRecord;
|
||||||
|
import com.czg.account.entity.ShopCoupon;
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券 服务层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
public interface ShopCouponService extends IService<ShopCoupon> {
|
||||||
|
|
||||||
|
List<ShopCouponDTO> getList(ShopCouponDTO couponDTO);
|
||||||
|
ShopCouponDTO getCouponById(ShopCouponDTO couponDTO);
|
||||||
|
|
||||||
|
Boolean add(ShopCouponDTO couponDTO);
|
||||||
|
|
||||||
|
Boolean edit(ShopCouponDTO couponDTO);
|
||||||
|
|
||||||
|
Boolean delete(Long id);
|
||||||
|
Boolean find(Long id);
|
||||||
|
Boolean use(Integer shopId, Integer orderId, Integer vipUserId, List<ShopActivateOutRecord> param);
|
||||||
|
|
||||||
|
Boolean refund(List<ShopActivateOutRecord> param);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.czg.account.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserCouponVo {
|
||||||
|
private Long id;
|
||||||
|
private BigDecimal fullAmount;
|
||||||
|
private BigDecimal discountAmount;
|
||||||
|
private Long couponId;
|
||||||
|
private Long proId;
|
||||||
|
// 商品名称
|
||||||
|
private String productName;
|
||||||
|
private String productCover;
|
||||||
|
//优惠券名称
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
//优惠券类型 1 满减 2 商品券
|
||||||
|
private Integer type;
|
||||||
|
//数量
|
||||||
|
private Integer num;
|
||||||
|
//到期时间
|
||||||
|
private Date endTime;
|
||||||
|
private Long expireTime;
|
||||||
|
private String useRestrictions;
|
||||||
|
private boolean isUse = false;
|
||||||
|
//当前使用数量
|
||||||
|
private BigDecimal currentUseNum;
|
||||||
|
private Integer finalUseNum;
|
||||||
|
private BigDecimal finalDiscountAmount = new BigDecimal(0);
|
||||||
|
|
||||||
|
|
||||||
|
public void setEndTime(Date endTime) {
|
||||||
|
this.endTime = endTime;
|
||||||
|
if(endTime!=null){
|
||||||
|
expireTime=endTime.getTime();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.service.account.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.account.entity.ShopActivateInRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动商品赠送记录表 映射层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
public interface ShopActivateInRecordMapper extends BaseMapper<ShopActivateInRecord> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.service.account.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.account.entity.ShopActivate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动 映射层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
public interface ShopActivateMapper extends BaseMapper<ShopActivate> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.service.account.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.account.entity.ShopActivateOutRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动赠送商品使用记录表 映射层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
public interface ShopActivateOutRecordMapper extends BaseMapper<ShopActivateOutRecord> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.service.account.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.account.entity.ShopCoupon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券 映射层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
public interface ShopCouponMapper extends BaseMapper<ShopCoupon> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.czg.service.account.service.impl;
|
||||||
|
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.czg.account.entity.ShopActivateInRecord;
|
||||||
|
import com.czg.account.service.ShopActivateInRecordService;
|
||||||
|
import com.czg.service.account.mapper.ShopActivateInRecordMapper;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动商品赠送记录表 服务层实现。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@DubboService
|
||||||
|
public class ShopActivateInRecordServiceImpl extends ServiceImpl<ShopActivateInRecordMapper, ShopActivateInRecord> implements ShopActivateInRecordService{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.czg.service.account.service.impl;
|
||||||
|
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.czg.account.entity.ShopActivateOutRecord;
|
||||||
|
import com.czg.account.service.ShopActivateOutRecordService;
|
||||||
|
import com.czg.service.account.mapper.ShopActivateOutRecordMapper;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动赠送商品使用记录表 服务层实现。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@DubboService
|
||||||
|
public class ShopActivateOutRecordServiceImpl extends ServiceImpl<ShopActivateOutRecordMapper, ShopActivateOutRecord> implements ShopActivateOutRecordService{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.czg.service.account.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.czg.account.dto.ShopActivateDTO;
|
||||||
|
import com.czg.account.entity.ShopActivate;
|
||||||
|
import com.czg.account.service.ShopActivateService;
|
||||||
|
import com.czg.sa.StpKit;
|
||||||
|
import com.czg.service.account.mapper.ShopActivateMapper;
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动 服务层实现。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@DubboService
|
||||||
|
public class ShopActivateServiceImpl extends ServiceImpl<ShopActivateMapper, ShopActivate> implements ShopActivateService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ShopActivateDTO> getList() {
|
||||||
|
return queryChain().select().eq(ShopActivate::getShopId, StpKit.USER.getShopId())
|
||||||
|
.orderBy(ShopActivate::getAmount, true).listAs(ShopActivateDTO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean add(ShopActivateDTO activateDTO) {
|
||||||
|
ShopActivate shopActivate = new ShopActivate();
|
||||||
|
BeanUtil.copyProperties(activateDTO, shopActivate);
|
||||||
|
return save(shopActivate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean edit(ShopActivateDTO activateDTO) {
|
||||||
|
ShopActivate shopActivate = new ShopActivate();
|
||||||
|
BeanUtil.copyProperties(activateDTO, shopActivate);
|
||||||
|
return updateById(shopActivate);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package com.czg.service.account.service.impl;
|
||||||
|
|
||||||
|
import com.czg.account.dto.ShopCouponDTO;
|
||||||
|
import com.czg.account.entity.ShopActivateInRecord;
|
||||||
|
import com.czg.account.entity.ShopActivateOutRecord;
|
||||||
|
import com.czg.account.service.ShopActivateInRecordService;
|
||||||
|
import com.czg.account.service.ShopActivateOutRecordService;
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.czg.account.entity.ShopCoupon;
|
||||||
|
import com.czg.account.service.ShopCouponService;
|
||||||
|
import com.czg.service.account.mapper.ShopCouponMapper;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券 服务层实现。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCoupon> implements ShopCouponService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShopActivateInRecordService inService;
|
||||||
|
@Resource
|
||||||
|
private ShopActivateOutRecordService outService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ShopCouponDTO> getList(ShopCouponDTO couponDTO) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ShopCouponDTO getCouponById(ShopCouponDTO couponDTO) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean add(ShopCouponDTO couponDTO) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean edit(ShopCouponDTO couponDTO) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean delete(Long id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean find(Long id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean use(Integer shopId, Integer orderId, Integer vipUserId, List<ShopActivateOutRecord> param) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退还券
|
||||||
|
*
|
||||||
|
* @param param giveId和 refNum 必传
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean refund(List<ShopActivateOutRecord> param) {
|
||||||
|
// for (ShopActivateOutRecord outRecord : param) {
|
||||||
|
// outService.updateChain()
|
||||||
|
// .set(ShopActivateOutRecord::getRefNum, outRecord.getRefNum())
|
||||||
|
// .eq(ShopActivateOutRecord::getId, outRecord.getId())
|
||||||
|
// .update();
|
||||||
|
// ShopActivateInRecord inRecord = inService.getById(outRecord.getGiveId());
|
||||||
|
// inRecord.setOverNum(inRecord.getOverNum() + outRecord.getRefNum());
|
||||||
|
// inService.updateOverNum(inRecord.getId(), inRecord.getOverNum());
|
||||||
|
// }
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ import com.czg.exception.ApiNotPrintException;
|
|||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.service.RedisService;
|
import com.czg.service.RedisService;
|
||||||
import com.czg.service.account.mapper.ShopUserMapper;
|
import com.czg.service.account.mapper.ShopUserMapper;
|
||||||
|
import com.czg.utils.AssertUtil;
|
||||||
import com.czg.utils.PageUtil;
|
import com.czg.utils.PageUtil;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
@@ -131,13 +132,9 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||||||
@Override
|
@Override
|
||||||
public String getCode(long userInfoId, long shopId) {
|
public String getCode(long userInfoId, long shopId) {
|
||||||
ShopUser shopUser = queryChain().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, userInfoId).one();
|
ShopUser shopUser = queryChain().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, userInfoId).one();
|
||||||
if (shopUser == null) {
|
AssertUtil.isNull(shopUser, "会员信息不存在");
|
||||||
throw new ApiNotPrintException("会员信息不存在");
|
|
||||||
}
|
|
||||||
String dynamicCode = generatePaymentCode(String.valueOf(shopId), String.valueOf(userInfoId));
|
String dynamicCode = generatePaymentCode(String.valueOf(shopId), String.valueOf(userInfoId));
|
||||||
redisService.set(RedisCst.SHOP_USER_DYNAMIC_CODE + shopUser.getId(), dynamicCode, 300);
|
redisService.set(RedisCst.SHOP_USER_DYNAMIC_CODE + shopUser.getId() + ":" + dynamicCode, 1, 180);
|
||||||
shopUser.setDynamicCode(dynamicCode);
|
|
||||||
updateById(shopUser);
|
|
||||||
return dynamicCode;
|
return dynamicCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.czg.service.account.mapper.ShopActivateInRecordMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.czg.service.account.mapper.ShopActivateMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.czg.service.account.mapper.ShopActivateOutRecordMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.czg.service.account.mapper.ShopCouponMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.czg.service.order.dto;
|
||||||
|
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建订单
|
||||||
|
* @author ww
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CreateOrderDTO {
|
||||||
|
@NotBlank(message = "桌号不能为空")
|
||||||
|
private String tableCode;
|
||||||
|
@NotBlank(message = "用餐模式 堂食 dine-in 外带 take-out 外卖 take-away")
|
||||||
|
private String dineMode;
|
||||||
|
/**
|
||||||
|
* 平台类型
|
||||||
|
* 微信小程序 WX
|
||||||
|
* 支付宝小程序 ALI
|
||||||
|
* 收银机客户端 PC
|
||||||
|
* PC管理端 APC
|
||||||
|
* APP管理端 APP
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "平台类型不能为空")
|
||||||
|
private String platformType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否使用了霸王餐
|
||||||
|
*/
|
||||||
|
private boolean isFreeDine = false;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
// 使用的积分抵扣数量
|
||||||
|
private Integer pointsNum;
|
||||||
|
|
||||||
|
// 使用的优惠券
|
||||||
|
@Valid
|
||||||
|
private List<UserCouponInfoDTO> userCouponInfos = new ArrayList<>();
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.czg.service.order.dto;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserCouponInfoDTO {
|
||||||
|
private Long userCouponId;
|
||||||
|
@Min(1)
|
||||||
|
private Integer num;
|
||||||
|
}
|
||||||
@@ -57,10 +57,12 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
|
|
||||||
queryWrapper.eq(OrderInfo::getShopId, param.getShopId())
|
queryWrapper.eq(OrderInfo::getShopId, param.getShopId())
|
||||||
.eq(OrderInfo::getStatus, param.getStatus())
|
.eq(OrderInfo::getStatus, param.getStatus())
|
||||||
.eq(OrderInfo::getOrderNo, param.getOrderNo())
|
|
||||||
.eq(OrderInfo::getPayType, param.getPayType())
|
.eq(OrderInfo::getPayType, param.getPayType())
|
||||||
.eq(OrderInfo::getTableCode, param.getTableCode())
|
|
||||||
.eq(OrderInfo::getUserId, param.getUserId())
|
.eq(OrderInfo::getUserId, param.getUserId())
|
||||||
|
.eq(OrderInfo::getTableCode, param.getTableCode())
|
||||||
|
.eq(OrderInfo::getOrderNo, param.getOrderNo())
|
||||||
|
.gt(OrderInfo::getCreateTime, param.getStartTime())
|
||||||
|
.le(OrderInfo::getCreateTime, param.getEndTime())
|
||||||
.in(OrderInfo::getId, like);
|
.in(OrderInfo::getId, like);
|
||||||
Page<OrderInfoVo> orderInfoVoPage = pageAs(PageUtil.buildPage(), queryWrapper, OrderInfoVo.class);
|
Page<OrderInfoVo> orderInfoVoPage = pageAs(PageUtil.buildPage(), queryWrapper, OrderInfoVo.class);
|
||||||
orderInfoVoPage.getRecords().parallelStream().forEach(s -> {
|
orderInfoVoPage.getRecords().parallelStream().forEach(s -> {
|
||||||
@@ -83,8 +85,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||||||
.where(OrderPayment::getId).eq(payment.getId())
|
.where(OrderPayment::getId).eq(payment.getId())
|
||||||
.update();
|
.update();
|
||||||
|
|
||||||
if ("TRADE_SUCCESS" .equals(czgCallBackDto.getState())) {
|
if ("TRADE_SUCCESS".equals(czgCallBackDto.getState())) {
|
||||||
if ("order" .equals(payment.getPayType())) {
|
if ("order".equals(payment.getPayType())) {
|
||||||
updateChain().of(OrderInfo.class)
|
updateChain().of(OrderInfo.class)
|
||||||
.set(OrderInfo::getPayAmount, new BigDecimal(czgCallBackDto.getAmount() / 100L))
|
.set(OrderInfo::getPayAmount, new BigDecimal(czgCallBackDto.getAmount() / 100L))
|
||||||
.set(OrderInfo::getStatus, OrderStatusEnums.DONE.getCode())
|
.set(OrderInfo::getStatus, OrderStatusEnums.DONE.getCode())
|
||||||
|
|||||||
Reference in New Issue
Block a user