Merge remote-tracking branch 'origin/master'

This commit is contained in:
Tankaikai
2025-02-20 16:04:09 +08:00
62 changed files with 1436 additions and 511 deletions

View File

@@ -39,13 +39,13 @@ public class PadProdController {
/**
* 获取点餐详情
* @param padProductCategory tb_pad_product_category Id
* @param id tb_pad_product_category Id
* @return 数据
*/
@SaAdminCheckPermission(value = "padProd:detail", name = "pad点餐详情")
@GetMapping("/detail")
public CzgResult<PadDetailDTO> detail(Long padProductCategory) {
return CzgResult.success(padProdService.detail(StpKit.USER.getShopId(), padProductCategory));
public CzgResult<PadDetailDTO> detail(Long id) {
return CzgResult.success(padProdService.detail(StpKit.USER.getShopId(), id));
}
/**
@@ -69,7 +69,7 @@ public class PadProdController {
}
/**
* pad点餐修改
* pad点餐删除
* @return 是否成功
*/
@SaAdminCheckPermission(value = "padProd:del", name = "pad点餐删除")

View File

@@ -0,0 +1,93 @@
package com.czg.controller.admin;
import cn.hutool.core.util.StrUtil;
import com.czg.account.dto.print.PrinterAddDTO;
import com.czg.account.dto.print.PrinterDelDTO;
import com.czg.account.dto.print.PrinterEditDTO;
import com.czg.account.entity.PrintMachine;
import com.czg.account.service.PrintMachineService;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.czg.utils.PageUtil;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 打印机管理
* @author Administrator
*/
@RestController
@RequestMapping("/admin/printer")
public class PrintMachineController {
@Resource
private PrintMachineService printMachineService;
/**
* 打印机列表
* @param name 名称
* @param connectionType 类型 USB 网络 蓝牙
* @return 打印机列表
*/
@SaAdminCheckPermission(value = "printer:list", name = "打印机列表获取")
@GetMapping
public CzgResult<Page<PrintMachine>> list(String name, String connectionType) {
QueryWrapper queryWrapper = new QueryWrapper().eq(PrintMachine::getShopId, StpKit.USER.getShopId());
if (StrUtil.isNotBlank(name)) {
queryWrapper.like(PrintMachine::getName, name);
}
if (StrUtil.isNotBlank(connectionType)) {
queryWrapper.eq(PrintMachine::getConnectionType, connectionType);
}
queryWrapper.orderBy(PrintMachine::getSort, true).orderBy(PrintMachine::getId, false);
return CzgResult.success(printMachineService.page(PageUtil.buildPage(), queryWrapper));
}
/**
* 打印机详情
* @param id 打印机id
* @return 是否成功
*/
@SaAdminCheckPermission(value = "printer:detail", name = "打印机详情获取")
@GetMapping("/detail")
public CzgResult<PrintMachine> detail(@RequestParam Integer id) {
return CzgResult.success(printMachineService.getOne(new QueryWrapper().eq(PrintMachine::getId, id).eq(PrintMachine::getShopId, StpKit.USER.getShopId())));
}
/**
* 打印机新增
* @return 打印机列表
*/
@SaAdminCheckPermission(value = "printer:add", name = "打印机新增")
@PostMapping
public CzgResult<Boolean> list(@RequestBody @Validated PrinterAddDTO printerAddDTO) {
return CzgResult.success(printMachineService.add(StpKit.USER.getShopId(), printerAddDTO));
}
/**
* 打印机修改
* @return 打印机列表
*/
@SaAdminCheckPermission(value = "printer:edit", name = "打印机编辑")
@PutMapping
public CzgResult<Boolean> edit(@RequestBody @Validated PrinterEditDTO printerEditDTO) {
return CzgResult.success(printMachineService.edit(StpKit.USER.getShopId(), printerEditDTO));
}
/**
* 打印机删除
* @return 打印机列表
*/
@SaAdminCheckPermission(value = "printer:del", name = "打印机删除")
@DeleteMapping
public CzgResult<Boolean> edit(@RequestBody @Validated PrinterDelDTO printerDelDTO) {
return CzgResult.success(printMachineService.remove(new QueryWrapper().eq(PrintMachine::getShopId, StpKit.USER.getShopId()).eq(PrintMachine::getId, printerDelDTO.getId())));
}
}

View File

@@ -1,12 +1,15 @@
package com.czg.controller.user;
import com.czg.order.dto.OrderInfoAddDTO;
import com.czg.order.dto.OrderInfoQueryDTO;
import com.czg.order.entity.OrderInfo;
import com.czg.order.service.OrderInfoService;
import com.czg.order.vo.OrderInfoCreateVo;
import com.czg.order.vo.OrderInfoVo;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import com.czg.utils.AssertUtil;
import com.czg.utils.ServletUtil;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
@@ -36,10 +39,12 @@ public class UserOrderController {
}
@PostMapping("/createOrder")
public CzgResult<Void> createOrder(@RequestBody OrderInfoQueryDTO queryDTO) {
queryDTO.setIsDel(1);
queryDTO.setUserId(StpKit.USER.getLoginIdAsLong());
return CzgResult.success();
public CzgResult<OrderInfoCreateVo> createOrder(@RequestBody OrderInfoAddDTO addDto) {
addDto.setPlatformType(ServletUtil.getHeaderIgnoreCase(ServletUtil.getRequest(), "platformType"));
addDto.setUserId(StpKit.USER.getLoginIdAsLong());
addDto.setShopId(StpKit.USER.getShopId());
addDto.setOrderType("miniapp");
return CzgResult.success(orderInfoService.createOrder(addDto));
}
@PutMapping("/{id}")

View File

@@ -0,0 +1,14 @@
package com.czg.account.dto;
import lombok.Data;
/**
* @author ww
* @description
*/
@Data
public class ShopActivateCouponDTO {
private Long id;
private Integer num;
private String name;
}

View File

@@ -14,12 +14,14 @@ import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
/**
* 活动 实体类。
*
* @author ww
* @since 2025-02-17
* @since 2025-02-20
*/
@Data
@Builder
@@ -55,17 +57,14 @@ public class ShopActivateDTO implements Serializable {
/**
* 是否赠送优惠卷 0否 1是
*/
private Integer isGiftCoupon = 0;
private Integer isGiftCoupon;
private List<ShopActivateCouponDTO> couponList;
/**
* 优惠卷id
* 优惠卷信息{卷id数量}
*/
private Long couponId;
/**
* 优惠卷数量
*/
private Integer num;
private String coupons;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;

View File

@@ -17,5 +17,6 @@ public class PadDetailEditDTO {
@NotNull(message = "tb_pad_product_categoryId不为空")
private Long id;
private Long padLayoutId;
private Integer sort;
private List<Long> productIdList = new ArrayList<>();
}

View File

@@ -0,0 +1,94 @@
package com.czg.account.dto.print;
import com.alibaba.fastjson2.annotation.JSONField;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import java.io.Serial;
import java.time.LocalDateTime;
/**
* @author Administrator
*/
@Data
public class PrinterAddDTO {
/**
* 设备名称
*/
@NotBlank(message = "设备名称不为空")
private String name;
/**
* 现在打印机支持USB 和 网络、蓝牙
*/
@NotBlank
private String connectionType;
/**
* ip地址
*/
private String address;
/**
* 端口
*/
private String port;
/**
* 打印类型分类label标签cash小票kitchen出品
*/
private String subType;
/**
* 打印机品牌
*/
@NotBlank(message = "打印机品牌不为空")
private String contentType;
/**
* 打印分类Id
*/
private String categoryIds;
/**
* 分类
*/
private String categoryList;
/**
* 排序
*/
private Integer sort;
/**
* 小票尺寸 58mm 80mm
*/
private String receiptSize;
/**
* 分类打印 0-所有 1-部分分类 2-部分商品
*/
@NotBlank(message = "打印分类不为空")
private String classifyPrint;
/**
* 打印数量 c1m1^2=顾客+商家[2张] m1^1=商家[1张] c1^1顾客[1张] c2m1^3顾客2+商家1[3张]
*/
@NotBlank(message = "打印数量不为空")
private String printQty;
/**
* 打印方式 all-全部打印 normal-仅打印结账单「前台」one-仅打印制作单「厨房」
*/
@NotBlank(message = "打印方式不为空")
private String printMethod;
/**
* 打印类型JSON数组 refund-确认退款单 handover-交班单 queue-排队取号
*/
@NotBlank(message = "打印类型不为空")
private String printType;
}

View File

@@ -0,0 +1,13 @@
package com.czg.account.dto.print;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
* @author Administrator
*/
@Data
public class PrinterDelDTO {
@NotNull(message = "打印机id不为空")
private Long id;
}

View File

@@ -0,0 +1,89 @@
package com.czg.account.dto.print;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
/**
* @author Administrator
*/
@Data
public class PrinterEditDTO {
@NotNull(message = "打印机id不为空")
private Long id;
/**
* 设备名称
*/
private String name;
/**
* 现在打印机支持USB 和 网络、蓝牙
*/
private String connectionType;
/**
* ip地址
*/
private String address;
/**
* 端口
*/
private String port;
/**
* 打印类型分类label标签cash小票kitchen出品
*/
private String subType;
/**
* 打印机品牌
*/
private String contentType;
/**
* 打印分类Id
*/
private String categoryIds;
/**
* 分类
*/
private String categoryList;
/**
* 排序
*/
private Integer sort;
/**
* 小票尺寸 58mm 80mm
*/
private String receiptSize;
/**
* 分类打印 0-所有 1-部分分类 2-部分商品
*/
private String classifyPrint;
/**
* 打印数量 c1m1^2=顾客+商家[2张] m1^1=商家[1张] c1^1顾客[1张] c2m1^3顾客2+商家1[3张]
*/
private String printQty;
/**
* 打印方式 all-全部打印 normal-仅打印结账单「前台」one-仅打印制作单「厨房」
*/
private String printMethod;
/**
* 打印类型JSON数组 refund-确认退款单 handover-交班单 queue-排队取号
*/
private String printType;
/**
* 打印机状态 online在线
*/
private String status;
}

View File

@@ -1,11 +1,9 @@
package com.czg.account.dto.shopinfo;
import com.mybatisflex.annotation.Column;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* @author Administrator
@@ -207,11 +205,6 @@ public class ShopInfoEditDTO {
private String address;
/**
* 积分群体 all-所有 vip-仅针对会员
*/
private String consumeColony;
/**
* 小程序码(零点八零首页)
*/

View File

@@ -0,0 +1,96 @@
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-20
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_points_basic_setting")
public class PointsBasicSetting implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 店铺id
*/
@Id(keyType = KeyType.Auto)
private Long shopId;
/**
* 开启消费赠送积分 1-开启 0-关闭
*/
private Integer enableRewards;
/**
* 赠积分适用群体 all-全部 vip-仅会员
*/
private String rewardsGroup;
/**
* 每消费xx元赠送1积分
*/
private BigDecimal consumeAmount;
/**
* 开启下单积分抵扣 1-开启 0-关闭
*/
private Integer enableDeduction;
/**
* 抵扣适用群体 all-全部 vip-仅会员
*/
private String deductionGroup;
/**
* 下单实付抵扣门槛
*/
private BigDecimal minPaymentAmount;
/**
* 下单最高抵扣比例
*/
private BigDecimal maxDeductionRatio;
/**
* 下单抵扣积分比例 1元=?积分
*/
private Integer equivalentPoints;
/**
* 开启积分商城
*/
private Integer enablePointsMall;
/**
* 浏览模式 list-列表 grid-宫格
*/
private String browseMode;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
}

View File

@@ -0,0 +1,122 @@
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 zs
* @since 2025-02-20
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_print_machine")
public class PrintMachine implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id(keyType = KeyType.Auto)
private Integer id;
/**
* 设备名称
*/
private String name;
/**
* 现在打印机支持USB 和 网络、蓝牙
*/
private String connectionType;
/**
* ip地址
*/
private String address;
/**
* 端口
*/
private String port;
/**
* 打印类型分类label标签cash小票kitchen出品
*/
private String subType;
/**
* 状态 online
*/
private Integer status;
/**
* 店铺Id
*/
private String shopId;
/**
* 分类Id
*/
private String categoryIds;
/**
* 现在打印机支持USB 和 网络两种
*/
private String contentType;
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
@Column(onInsertValue = "now()", onUpdateValue = "now()")
private LocalDateTime updateTime;
/**
* 分类
*/
private String categoryList;
/**
* 排序
*/
private Integer sort;
/**
* 小票尺寸 58mm 80mm
*/
private String receiptSize;
/**
* 分类打印 0-所有 1-部分分类 2-部分商品
*/
private String classifyPrint;
/**
* 打印数量 c1m1^2=顾客+商家[2张] m1^1=商家[1张] c1^1顾客[1张] c2m1^3顾客2+商家1[3张]
*/
private String printQty;
/**
* 打印方式 all-全部打印 normal-仅打印结账单「前台」one-仅打印制作单「厨房」
*/
private String printMethod;
/**
* 打印类型JSON数组 refund-确认退款单 handover-交班单 queue-排队取号
*/
private String printType;
}

View File

@@ -18,7 +18,7 @@ import java.time.LocalDateTime;
* 活动 实体类。
*
* @author ww
* @since 2025-02-17
* @since 2025-02-20
*/
@Data
@Builder
@@ -56,14 +56,9 @@ public class ShopActivate implements Serializable {
private Integer isGiftCoupon;
/**
* 优惠卷id
* 优惠卷信息{卷id数量}
*/
private Long couponId;
/**
* 优惠卷数量
*/
private Integer num;
private String coupons;
@Column(onInsertValue = "now()")
private LocalDateTime createTime;

View File

@@ -4,6 +4,7 @@ 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;
@@ -19,14 +20,14 @@ import lombok.NoArgsConstructor;
* 活动商品赠送记录表 实体类
*
* @author ww
* @since 2025-02-17
* @since 2025-02-20
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_shop_activate_in_record")
public class ShopActivateInRecord implements Serializable {
@Table("tb_shop_activate_coupon_record")
public class ShopActivateCouponRecord implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@@ -69,16 +70,6 @@ public class ShopActivateInRecord implements Serializable {
*/
private BigDecimal discountAmount;
/**
* 赠送数量
*/
private Integer num;
/**
* 未使用数量
*/
private Integer overNum;
/**
* 店铺id
*/
@@ -109,9 +100,13 @@ public class ShopActivateInRecord implements Serializable {
private String couponJson;
/**
* invited/activate
*/
private String source;
/**
* 已使用 used
* 未使用 not_used
* 已过期 expired
*/
private String status;
}

View File

@@ -1,79 +0,0 @@
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;
}

View File

@@ -4,21 +4,23 @@ 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;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 优惠券 实体类。
*
* @author ww
* @since 2025-02-17
* @since 2025-02-20
*/
@Data
@Builder
@@ -36,17 +38,22 @@ public class ShopCoupon implements Serializable {
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 状态0-关闭 1 正常
*/
private Integer status;
private Long shopId;
/**
* 名称(无意义)
*/
private String title;
private Long shopId;
/**
* 1-满减 2-商品
*/
private Integer type;
/**
* 状态0-关闭 1 正常
*/
private Integer status;
/**
* 已使用数量
@@ -71,7 +78,7 @@ public class ShopCoupon implements Serializable {
/**
* 有效天数
*/
private Long validDays;
private Integer validDays;
/**
* 隔多少天生效
@@ -99,19 +106,14 @@ public class ShopCoupon implements Serializable {
private String useTimeType;
/**
* 可用开始时间 00:00
* 可用开始时间
*/
private String useStartTime;
private Time useStartTime;
/**
* 可用结束时间 23:59
* 可用结束时间
*/
private String useEndTime;
/**
* 1-满减 2-商品
*/
private Integer type;
private Time useEndTime;
/**
* 满多少金额
@@ -123,6 +125,11 @@ public class ShopCoupon implements Serializable {
*/
private BigDecimal discountAmount;
/**
* 商品id
*/
private Long proId;
/**
* 描述
*/

View File

@@ -1,56 +0,0 @@
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 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-18
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_shop_coupon_product")
public class ShopCouponProduct implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 活动Id
*/
private Long couponId;
/**
* 商品id
*/
private Long productId;
/**
* 数量
*/
private Integer num;
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
@Column(onInsertValue = "now()", onUpdateValue = "now()")
private LocalDateTime updateTime;
}

View File

@@ -90,7 +90,11 @@ public class ShopInfo implements Serializable {
* 店铺简介
*/
private String detail;
/**
* 注册类型
* 快餐版 先付 munchies
* 餐饮版 先付/后付 restaurant
*/
private String registerType;
/**
@@ -224,11 +228,6 @@ public class ShopInfo implements Serializable {
*/
private Integer isMemberPrice;
/**
* 积分群体 all-所有 vip-仅针对会员
*/
private String consumeColony;
/**
* 就餐模式 堂食 dine-in 外带 take-out
*/

View File

@@ -0,0 +1,14 @@
package com.czg.account.service;
import com.mybatisflex.core.service.IService;
import com.czg.account.entity.PointsBasicSetting;
/**
* 积分基本设置 服务层。
*
* @author ww
* @since 2025-02-20
*/
public interface PointsBasicSettingService extends IService<PointsBasicSetting> {
}

View File

@@ -0,0 +1,21 @@
package com.czg.account.service;
import com.czg.account.dto.print.PrinterAddDTO;
import com.czg.account.dto.print.PrinterEditDTO;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import com.czg.account.entity.PrintMachine;
/**
* 打印机设备 服务层。
*
* @author zs
* @since 2025-02-20
*/
public interface PrintMachineService extends IService<PrintMachine> {
boolean add(Long shopId, PrinterAddDTO printerAddDTO);
Boolean edit(Long shopId, PrinterEditDTO printerEditDTO);
}

View File

@@ -0,0 +1,14 @@
package com.czg.account.service;
import com.mybatisflex.core.service.IService;
import com.czg.account.entity.ShopActivateCouponRecord;
/**
* 活动商品赠送记录表 服务层。
*
* @author ww
* @since 2025-02-20
*/
public interface ShopActivateCouponRecordService extends IService<ShopActivateCouponRecord> {
}

View File

@@ -1,14 +0,0 @@
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> {
}

View File

@@ -1,14 +0,0 @@
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> {
}

View File

@@ -1,14 +0,0 @@
package com.czg.account.service;
import com.czg.account.entity.ShopCouponProduct;
import com.mybatisflex.core.service.IService;
/**
* 活动赠送商品表 服务层。
*
* @author ww
* @since 2025-02-18
*/
public interface ShopCouponProductService extends IService<ShopCouponProduct> {
}

View File

@@ -1,7 +1,6 @@
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;
@@ -20,7 +19,6 @@ public interface ShopCouponService extends IService<ShopCoupon> {
*
* @param shopId 店铺id
* @param status 状态 0 未使用 1已使用 -1已过期
* @return
*/
List<ShopCoupon> getList(Long shopId, Integer status);
ShopCouponDTO getCouponById(ShopCouponDTO couponDTO);
@@ -31,9 +29,9 @@ public interface ShopCouponService extends IService<ShopCoupon> {
Boolean delete(Long id);
Boolean find(Long id);
Boolean use(Integer shopId, Integer orderId, Integer vipUserId, List<ShopActivateOutRecord> param);
Boolean use(Integer shopId, Integer orderId, Integer vipUserId);
Boolean refund(List<ShopActivateOutRecord> param);
Boolean refund();

View File

@@ -2,10 +2,11 @@ package com.czg.account.service;
import com.czg.account.dto.table.ShopTableAddDTO;
import com.czg.account.dto.table.ShopTableBindDTO;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import com.czg.account.entity.ShopTable;
import com.mybatisflex.core.service.IService;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.io.IOException;
@@ -19,6 +20,8 @@ public interface ShopTableService extends IService<ShopTable> {
Boolean add(Long shopId, ShopTableAddDTO shopTableAddDTO);
ShopTable getOneByTableCode(@NotNull Long shopId,@NotBlank String tableCode);
void createQrCode(Long shopId, Integer num, HttpServletResponse response) throws IOException;
Boolean bind(Long shopId, ShopTableBindDTO shopTableBindDTO);

View File

@@ -1,20 +0,0 @@
package com.czg.account.vo;
import lombok.Data;
/**
* @author ww
* @description
*/
@Data
public class CouponProductVo {
/**
* 商品id
*/
private Long productId;
/**
* 数量
*/
private Integer num;
}

View File

@@ -0,0 +1,140 @@
package com.czg.order.dto;
import cn.hutool.core.util.StrUtil;
import jakarta.validation.constraints.NotBlank;
import lombok.*;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 订单表 实体类。
*
* @author ww
* @since 2025-02-13
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OrderInfoAddDTO implements Serializable {
private Long orderId;
/**
* 店铺Id
*/
private Long shopId;
private Long userId;
/**
* 用餐人数
*/
private Integer seatNum;
/**
* 打包费
*/
private BigDecimal packFee;
/**
* 订单原金额(包含打包费+餐位费) 不含折扣价格
*/
private BigDecimal originAmount;
/**
* 折扣比例(计算时 向上取整保留 两位小数)
*/
private BigDecimal discountRatio;
/**
* 手动优惠金额
*/
private BigDecimal discountAmount;
/**
* 商品优惠券抵扣金额
*/
private BigDecimal productCouponDiscountAmount;
/**
* 满减优惠券抵扣金额
*/
private BigDecimal fullCouponDiscountAmount;
/**
* 用户使用的卡券
*/
private String couponInfoList;
/**
* 订单金额
*/
private BigDecimal orderAmount;
/**
* 积分抵扣金额(tb_points_basic_setting表)
*/
private BigDecimal pointsDiscountAmount;
/**
* 使用的积分数量 (扣除各类折扣 enable_deduction后使用)
*/
private BigDecimal pointsNum;
/**
* 台桌Id
*/
@NotBlank(message = "台桌码不能为空")
private String tableCode;
/**
* 订单类型-
* cash收银(除小程序以外 都属于收银)
* miniapp小程序
*/
private String orderType;
/**
* 平台类型 pc 收银机客户端 wechat 微信小程序 alipay 支付宝小程序 admin-pc PC管理端 admin-app APP管理端
*/
private String platformType;
/**
* 用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
*/
@NotBlank(message = "用餐模式不能为空")
private String eatModel;
/**
* 支付模式: afterPay 后付费 normal 正常模式
*/
@NotBlank(message = "付款模式不能为空")
private String payMode;
/**
* 备注
*/
private String remark;
/**
* 当前订单下单次数
*/
private Integer placeNum;
/**
* 是否等叫 0 否 1 等叫
*/
private boolean waitCall;
/**
* 是否使用会员价
*/
private boolean vipPrice;
public Integer getSeatNum() {
return seatNum == null ? 0 : seatNum;
}
public String getEatModel() {
return StrUtil.isBlank(eatModel) ? "dine-in" : eatModel;
}
public BigDecimal getPointsNum() {
return pointsNum == null ? BigDecimal.ZERO : pointsNum;
}
}

View File

@@ -0,0 +1,131 @@
package com.czg.order.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* 购物车 实体类。
*
* @author ww
* @since 2025-02-20
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("tb_cashier_cart")
public class CashierCart implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 店铺Id
*/
private Long shopId;
/**
* skuId
*/
private Long skuId;
/**
* 商品Id
*/
private Long productId;
/**
* 商品名称(临时菜使用)
*/
private String productName;
/**
* 规格描述(临时菜使用)
*/
private String skuName;
/**
* 数量
*/
private BigDecimal number;
/**
* 台桌桌码
* 平台类型
* 小程序为 桌码
* 其余为
* 收银机客户端 PC+唯一值
* PC管理端 APC+唯一值
* APP管理端 APP+唯一值
*/
private String tableCode;
/**
* 是否打包
*/
private Integer isPack;
/**
* 是否赠送
*/
private Integer isGift;
/**
* 是否是临时菜
*/
private Integer isTemporary;
/**
* 单品改价金额
*/
private BigDecimal discountSaleAmount;
/**
* 改价备注
*/
private String discountSaleNote;
/**
* 是否打票
*/
private Integer isPrint;
/**
* 是否等叫
*/
private Integer isWaitCall;
/**
* 套餐商品选择信息
*/
private String proGroupInfo;
/**
* 备注
*/
private String remark;
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
@Column(onInsertValue = "now()", onUpdateValue = "now()")
private LocalDateTime updateTime;
}

View File

@@ -0,0 +1,23 @@
package com.czg.order.service;
import com.czg.order.entity.OrderDetail;
import com.mybatisflex.core.service.IService;
import com.czg.order.entity.CashierCart;
import jakarta.validation.constraints.NotBlank;
import java.util.List;
/**
* 购物车 服务层。
*
* @author ww
* @since 2025-02-20
*/
public interface CashierCartService extends IService<CashierCart> {
/**
* 获取到的结果 是针对tb_order_detail的
* @param tableCode 桌码
*/
List<OrderDetail> getCartByTableCode(@NotBlank String tableCode);
}

View File

@@ -1,9 +1,11 @@
package com.czg.order.service;
import com.alibaba.fastjson2.JSONObject;
import com.czg.order.dto.OrderInfoAddDTO;
import com.czg.order.dto.OrderInfoQueryDTO;
import com.czg.order.entity.OrderInfo;
import com.czg.order.enums.PayEnums;
import com.czg.order.vo.OrderInfoCreateVo;
import com.czg.order.vo.OrderInfoVo;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
@@ -22,6 +24,7 @@ import java.time.LocalDateTime;
public interface OrderInfoService extends IService<OrderInfo> {
Page<OrderInfoVo> getOrderByPage(OrderInfoQueryDTO param);
OrderInfoCreateVo createOrder(OrderInfoAddDTO param);
void payCallBackOrder(@NotBlank String orderNo, @NotNull JSONObject resultJson);

View File

@@ -0,0 +1,11 @@
package com.czg.order.vo;
import lombok.Data;
/**
* @author ww
* @description
*/
@Data
public class OrderInfoCreateVo {
}

View File

@@ -61,7 +61,7 @@ public class LoadingRole implements CommandLineRunner {
log.info("接口菜单添加成功, 菜单名称: {}, 菜单权限: {}", title, permission);
}
if (StrUtil.isNotBlank(permissionName) && !title.equals(permissionName)) {
if (StrUtil.isNotBlank(permissionName) && (title == null || !title.equals(permissionName))) {
sql = "update sys_menu set title=? where menu_id=?";
Db.updateBySql(sql, permissionName, menuId);
log.info("接口菜单修改成功, 旧名称: {}, 新菜单名称: {}", title, permissionName);

View File

@@ -0,0 +1,93 @@
package com.czg.utils;
import cn.hutool.core.util.StrUtil;
import com.mybatisflex.core.exception.FlexExceptions;
import com.mybatisflex.core.query.*;
import com.mybatisflex.core.table.TableInfo;
import com.mybatisflex.core.table.TableInfoFactory;
import com.mybatisflex.core.util.LambdaGetter;
import java.io.Serializable;
import java.lang.invoke.SerializedLambda;
import java.lang.reflect.Method;
import static com.mybatisflex.core.util.LambdaUtil.getFieldName;
/**
* 关联查询的queryWrapper
* @author Administrator
*/
public class JoinQueryWrapper extends QueryWrapper {
public JoinQueryWrapper() {
super();
}
private static SerializedLambda getSerializedLambda(Serializable getter) {
try {
Method method = getter.getClass().getDeclaredMethod("writeReplace");
method.setAccessible(Boolean.TRUE);
return (SerializedLambda) method.invoke(getter);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private static String getImplClassName(SerializedLambda lambda) {
String type = lambda.getInstantiatedMethodType();
return type.substring(2, type.indexOf(";"));
}
private static Class<?> getImplClass0(SerializedLambda lambda) {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
String implClass = getImplClassName(lambda);
try {
return Class.forName(implClass.replace("/", "."), true, classLoader);
} catch (ClassNotFoundException e) {
throw FlexExceptions.wrap(e);
}
}
public <T> String getColum(LambdaGetter<T> column) {
SerializedLambda lambda = getSerializedLambda(column);
Class<?> entityClass = getImplClass0(lambda);
TableInfo tableInfo = TableInfoFactory.ofEntityClass(entityClass);
return tableInfo.getTableName() + "." + StrUtil.toUnderlineCase(getFieldName(column));
}
@Override
public <T> JoinQueryWrapper eq(LambdaGetter<T> column, Object value) {
eq(getColum(column), value);
return this;
}
@Override
public <T> JoinQueryWrapper lt(LambdaGetter<T> column, Object value) {
lt(getColum(column), value);
return this;
}
@Override
public <T> QueryWrapper gt(LambdaGetter<T> column, Object value) {
gt(getColum(column), value);
return this;
}
@Override
public <T> QueryWrapper in(LambdaGetter<T> column, Object... values) {
in(getColum(column), values);
return this;
}
@Override
public <T> QueryWrapper notIn(LambdaGetter<T> column, Object... values) {
notIn(getColum(column), values);
return this;
}
@Override
public <T> JoinQueryWrapper orderBy(LambdaGetter<T> column, Boolean asc) {
orderBy(getColum(column), asc);
return this;
}
}

View File

@@ -13,5 +13,5 @@ import com.mybatisflex.core.paginate.Page;
*/
public interface PadProductCategoryDetailMapper extends BaseMapper<PadProductCategoryDetail> {
Page<PadProductCategoryDTO> selectPageByKeyAndShopId();
Page<PadProductCategoryDTO> selectPageByKeyAndShopId_COUNT();
long selectPageByKeyAndShopId_COUNT();
}

View File

@@ -0,0 +1,14 @@
package com.czg.service.account.mapper;
import com.mybatisflex.core.BaseMapper;
import com.czg.account.entity.PointsBasicSetting;
/**
* 积分基本设置 映射层。
*
* @author ww
* @since 2025-02-20
*/
public interface PointsBasicSettingMapper extends BaseMapper<PointsBasicSetting> {
}

View File

@@ -0,0 +1,14 @@
package com.czg.service.account.mapper;
import com.mybatisflex.core.BaseMapper;
import com.czg.account.entity.PrintMachine;
/**
* 打印机设备 映射层。
*
* @author zs
* @since 2025-02-20
*/
public interface PrintMachineMapper extends BaseMapper<PrintMachine> {
}

View File

@@ -0,0 +1,14 @@
package com.czg.service.account.mapper;
import com.mybatisflex.core.BaseMapper;
import com.czg.account.entity.ShopActivateCouponRecord;
/**
* 活动商品赠送记录表 映射层。
*
* @author ww
* @since 2025-02-20
*/
public interface ShopActivateCouponRecordMapper extends BaseMapper<ShopActivateCouponRecord> {
}

View File

@@ -1,14 +0,0 @@
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> {
}

View File

@@ -1,14 +0,0 @@
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> {
}

View File

@@ -1,14 +0,0 @@
package com.czg.service.account.mapper;
import com.czg.account.entity.ShopCouponProduct;
import com.mybatisflex.core.BaseMapper;
/**
* 活动赠送商品表 映射层。
*
* @author ww
* @since 2025-02-18
*/
public interface ShopCouponProductMapper extends BaseMapper<ShopCouponProduct> {
}

View File

@@ -3,9 +3,9 @@ package com.czg.service.account.service.impl;
import com.czg.account.dto.pad.*;
import com.czg.account.entity.*;
import com.czg.account.service.*;
import com.czg.enums.StatusEnum;
import com.czg.exception.ApiNotPrintException;
import com.czg.service.account.mapper.PadProductCategoryDetailMapper;
import com.czg.utils.JoinQueryWrapper;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
@@ -34,10 +34,11 @@ public class PadProdServiceImpl implements PadProdService {
@Override
public Page<PadProductCategoryDTO> pageInfo(Page<PadProductCategoryDTO> objectPage, Long productCategoryId, Long shopId) {
QueryWrapper queryWrapper = new QueryWrapper().eq(PadProductCategoryDetail::getPadProductCategoryId, shopId);
JoinQueryWrapper queryWrapper = new JoinQueryWrapper().eq(PadProductCategory::getShopId, shopId);
if (productCategoryId != null) {
queryWrapper.eq(PadProductCategoryDetail::getPadProductCategoryId, productCategoryId);
queryWrapper.eq(PadProductCategory::getProductCategoryId, productCategoryId);
}
queryWrapper.orderBy(PadProductCategory::getSort, true).orderBy(PadProductCategory::getId, false);
return padProductCategoryDetailMapper.xmlPaginate("selectPageByKeyAndShopId", objectPage, queryWrapper);
}
@@ -72,12 +73,11 @@ public class PadProdServiceImpl implements PadProdService {
PadProductCategory padProductCategory = new PadProductCategory().setPadLayoutId(padDetailAddDTO.getPadLayoutId()).setProductCategoryId(padDetailAddDTO.getProductCategoryId())
.setShopId(shopId);
padProductCategory.setSort(0);
padProductCategoryService.save(padProductCategory);
ArrayList<PadProductCategoryDetail> details = new ArrayList<>();
padDetailAddDTO.getProductIdList().forEach(item -> {
details.add(new PadProductCategoryDetail().setPadProductCategoryId(padProductCategory.getId()).setProductId(item));
});
padDetailAddDTO.getProductIdList().forEach(item -> details.add(new PadProductCategoryDetail().setPadProductCategoryId(padProductCategory.getId()).setProductId(item)));
return padProductCategoryDetailService.saveBatch(details);
}
@@ -89,16 +89,18 @@ public class PadProdServiceImpl implements PadProdService {
}
checkInfo(shopId, padDetailEditDTO.getPadLayoutId(), padDetailEditDTO.getProductIdList());
padProductCategoryDetailService.remove(new QueryWrapper().eq(PadProductCategoryDetail::getPadProductCategoryId, padDetailEditDTO.getId()));
category.setPadLayoutId(padDetailEditDTO.getPadLayoutId());
category.setSort(padDetailEditDTO.getSort());
padProductCategoryService.updateById(category);
ArrayList<PadProductCategoryDetail> details = new ArrayList<>();
padDetailEditDTO.getProductIdList().forEach(item -> {
details.add(new PadProductCategoryDetail().setPadProductCategoryId(padDetailEditDTO.getId()).setProductId(item));
});
return padProductCategoryDetailService.saveBatch(details);
if (padDetailEditDTO.getProductIdList() != null && !padDetailEditDTO.getProductIdList().isEmpty()) {
padProductCategoryDetailService.remove(new QueryWrapper().eq(PadProductCategoryDetail::getPadProductCategoryId, padDetailEditDTO.getId()));
ArrayList<PadProductCategoryDetail> details = new ArrayList<>();
padDetailEditDTO.getProductIdList().forEach(item -> details.add(new PadProductCategoryDetail().setPadProductCategoryId(padDetailEditDTO.getId()).setProductId(item)));
return padProductCategoryDetailService.saveBatch(details);
}
return true;
}
private void checkInfo(Long shopId, Long padLayoutId, List<Long> productIdList) {
@@ -107,9 +109,11 @@ public class PadProdServiceImpl implements PadProdService {
throw new ApiNotPrintException("pad布局不存在");
}
long proCount = productService.count(new QueryWrapper().eq(Product::getShopId, shopId).in(Product::getId, productIdList));
if (proCount != productIdList.size()) {
throw new ApiNotPrintException("存在错误商品id");
if (productIdList != null && !productIdList.isEmpty()) {
long proCount = productService.count(new QueryWrapper().eq(Product::getShopId, shopId).in(Product::getId, productIdList));
if (proCount != productIdList.size()) {
throw new ApiNotPrintException("存在错误商品id");
}
}
}

View File

@@ -0,0 +1,18 @@
package com.czg.service.account.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.PointsBasicSetting;
import com.czg.account.service.PointsBasicSettingService;
import com.czg.service.account.mapper.PointsBasicSettingMapper;
import org.springframework.stereotype.Service;
/**
* 积分基本设置 服务层实现。
*
* @author ww
* @since 2025-02-20
*/
@Service
public class PointsBasicSettingServiceImpl extends ServiceImpl<PointsBasicSettingMapper, PointsBasicSetting> implements PointsBasicSettingService{
}

View File

@@ -0,0 +1,57 @@
package com.czg.service.account.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.czg.account.dto.print.PrinterAddDTO;
import com.czg.account.dto.print.PrinterEditDTO;
import com.czg.exception.ApiNotPrintException;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.PrintMachine;
import com.czg.account.service.PrintMachineService;
import com.czg.service.account.mapper.PrintMachineMapper;
import org.springframework.stereotype.Service;
/**
* 打印机设备 服务层实现。
*
* @author zs
* @since 2025-02-20
*/
@Service
public class PrintMachineServiceImpl extends ServiceImpl<PrintMachineMapper, PrintMachine> implements PrintMachineService{
@Override
public boolean add(Long shopId, PrinterAddDTO dto) {
//分类打印选择部分打印时必传JsonArray字符串数据 如:[{"id":125,"name":"意式咖啡"},{"id":127,"name":"饮品"}]
if ("1".equals(dto.getClassifyPrint()) || "2".equals(dto.getClassifyPrint())) {
if (StrUtil.isBlank(dto.getCategoryList())) {
throw new ApiNotPrintException("分类打印选择部分打印时,必须勾选需要部分打印的菜品");
}
if (!JSONUtil.isTypeJSONArray(dto.getCategoryList())) {
throw new ApiNotPrintException("传递的部分打印菜品数据不合法");
}
if (StrUtil.isBlank(dto.getCategoryIds())) {
throw new ApiNotPrintException("分类打印选择部分打印时传递的部分打印菜品id数据不能为空");
}
} else {
dto.setCategoryIds(null);
dto.setCategoryList(null);
}
PrintMachine entity = BeanUtil.copyProperties(dto, PrintMachine.class);
return save(entity);
}
@Override
public Boolean edit(Long shopId, PrinterEditDTO printerEditDTO) {
PrintMachine printMachine = getOne(new QueryWrapper().eq(PrintMachine::getShopId, shopId).eq(PrintMachine::getId, printerEditDTO.getId()));
if (printMachine == null) {
throw new ApiNotPrintException("打印机不存在");
}
BeanUtil.copyProperties(printerEditDTO, printerEditDTO);
return updateById(printMachine);
}
}

View File

@@ -0,0 +1,18 @@
package com.czg.service.account.service.impl;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.ShopActivateCouponRecord;
import com.czg.account.service.ShopActivateCouponRecordService;
import com.czg.service.account.mapper.ShopActivateCouponRecordMapper;
import org.springframework.stereotype.Service;
/**
* 活动商品赠送记录表 服务层实现。
*
* @author ww
* @since 2025-02-20
*/
@Service
public class ShopActivateCouponRecordServiceImpl extends ServiceImpl<ShopActivateCouponRecordMapper, ShopActivateCouponRecord> implements ShopActivateCouponRecordService{
}

View File

@@ -1,20 +0,0 @@
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{
}

View File

@@ -1,19 +0,0 @@
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{
}

View File

@@ -1,17 +1,22 @@
package com.czg.service.account.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.czg.account.dto.ShopActivateCouponDTO;
import com.czg.account.dto.ShopActivateDTO;
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
import com.czg.account.entity.ShopActivate;
import com.czg.account.entity.ShopActivateInRecord;
import com.czg.account.entity.ShopActivateCouponRecord;
import com.czg.account.entity.ShopCoupon;
import com.czg.account.entity.ShopCouponProduct;
import com.czg.account.service.*;
import com.czg.account.vo.CouponProductVo;
import com.czg.account.service.ShopActivateCouponRecordService;
import com.czg.account.service.ShopActivateService;
import com.czg.account.service.ShopCouponService;
import com.czg.account.service.ShopUserService;
import com.czg.enums.ShopUserFlowBizEnum;
import com.czg.sa.StpKit;
import com.czg.service.account.mapper.ShopActivateMapper;
@@ -24,7 +29,9 @@ import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 活动 服务层实现。
@@ -38,24 +45,31 @@ public class ShopActivateServiceImpl extends ServiceImpl<ShopActivateMapper, Sho
@Resource
private ShopCouponService couponService;
@Resource
private ShopActivateInRecordService inRecordService;
@Resource
private ShopCouponProductService couProductService;
private ShopActivateCouponRecordService inRecordService;
@Resource
private ShopUserService shopUserService;
@Override
public List<ShopActivateDTO> getList() {
return queryChain().select()
List<ShopActivateDTO> activateDtoS = queryChain().select()
.eq(ShopActivate::getShopId, StpKit.USER.getShopId())
.orderBy(ShopActivate::getAmount, true)
.listAs(ShopActivateDTO.class);
for (ShopActivateDTO activateDTO : activateDtoS) {
if (StrUtil.isNotBlank(activateDTO.getCoupons())) {
activateDTO.setCouponList(JSON.parseArray(activateDTO.getCoupons(), ShopActivateCouponDTO.class));
}
}
return activateDtoS;
}
@Override
public Boolean add(ShopActivateDTO activateDTO) {
ShopActivate shopActivate = new ShopActivate();
BeanUtil.copyProperties(activateDTO, shopActivate);
if (CollUtil.isNotEmpty(activateDTO.getCouponList())) {
shopActivate.setCoupons(JSONObject.toJSONString(activateDTO.getCouponList()));
}
return save(shopActivate);
}
@@ -63,6 +77,9 @@ public class ShopActivateServiceImpl extends ServiceImpl<ShopActivateMapper, Sho
public Boolean edit(ShopActivateDTO activateDTO) {
ShopActivate shopActivate = new ShopActivate();
BeanUtil.copyProperties(activateDTO, shopActivate);
if (CollUtil.isNotEmpty(activateDTO.getCouponList())) {
shopActivate.setCoupons(JSONObject.toJSONString(activateDTO.getCouponList()));
}
return updateById(shopActivate);
}
@@ -77,70 +94,58 @@ public class ShopActivateServiceImpl extends ServiceImpl<ShopActivateMapper, Sho
}
//赠送优惠券
if (activate.getIsGiftCoupon() == 1) {
ShopCoupon shopCoupon = couponService.getById(activate.getCouponId());
if (shopCoupon != null && shopCoupon.getStatus().equals(1) && shopCoupon.getLeftNumber() > activate.getNum()) {
LocalDateTime start = LocalDateTime.now().with(LocalTime.MIN);
LocalDateTime end = null;
if ("fixed".equals(shopCoupon.getValidityType())) {
//固定时间
end = LocalDateTimeUtil.offset(start, shopCoupon.getValidDays(), ChronoUnit.DAYS).with(LocalTime.MAX);
} else if ("custom".equals(shopCoupon.getValidityType())) {
//自定义时间
start = shopCoupon.getValidStartTime();
end = shopCoupon.getValidEndTime();
List<ShopActivateCouponDTO> activateCoupons = JSON.parseArray(activate.getCoupons(), ShopActivateCouponDTO.class);
Map<Long, ShopCoupon> couponMap = new HashMap<>();
activateCoupons.forEach(coupon -> {
ShopCoupon shopCoupon = new ShopCoupon();
if (couponMap.containsKey(coupon.getId())) {
shopCoupon = couponMap.get(coupon.getId());
} else {
shopCoupon = couponService.queryChain().select().eq(ShopCoupon::getId, coupon.getId()).one();
couponMap.put(coupon.getId(), shopCoupon);
}
List<ShopActivateInRecord> actGiveRecords = new ArrayList<>();
if (shopCoupon.getType() == 1) {
//满减
ShopActivateInRecord record = new ShopActivateInRecord();
if (shopCoupon != null && shopCoupon.getStatus().equals(1) && shopCoupon.getLeftNumber() > coupon.getNum()) {
LocalDateTime start = LocalDateTime.now().with(LocalTime.MIN);
LocalDateTime end = null;
if ("fixed".equals(shopCoupon.getValidityType())) {
//固定时间
end = LocalDateTimeUtil.offset(start, shopCoupon.getValidDays(), ChronoUnit.DAYS).with(LocalTime.MAX);
} else if ("custom".equals(shopCoupon.getValidityType())) {
//自定义时间
start = shopCoupon.getValidStartTime();
end = shopCoupon.getValidEndTime();
}
List<ShopActivateCouponRecord> actGiveRecords = new ArrayList<>();
ShopActivateCouponRecord record = new ShopActivateCouponRecord();
record.setVipUserId(vipId);
record.setCouponId(shopCoupon.getId());
record.setName("" + shopCoupon.getFullAmount() + "" + shopCoupon.getDiscountAmount());
record.setFullAmount(shopCoupon.getFullAmount());
record.setDiscountAmount(shopCoupon.getDiscountAmount());
record.setType(1);
record.setNum(activate.getNum());
record.setOverNum(activate.getNum());
record.setShopId(shopId);
record.setSourceActId(activate.getId());
record.setSourceFlowId(relationId);
record.setUseStartTime(start);
record.setUseEndTime(end);
record.setSource("activate");
record.setCouponJson(getCouponJson(activate, shopCoupon, null));
actGiveRecords.add(record);
} else if (shopCoupon.getType() == 2) {
List<CouponProductVo> couponProducts = couProductService.queryChain()
.select(ShopCouponProduct::getProductId, ShopCouponProduct::getNum)
.eq(ShopCouponProduct::getCouponId, shopCoupon.getId())
.listAs(CouponProductVo.class);
//商品券
for (CouponProductVo actPro : couponProducts) {
ShopActivateInRecord record = new ShopActivateInRecord();
record.setVipUserId(vipId);
record.setCouponId(shopCoupon.getId());
record.setName("商品券");
record.setCouponJson(getCouponJson(activate, shopCoupon));
if (shopCoupon.getType() == 1) {
record.setType(1);
record.setName("" + shopCoupon.getFullAmount() + "" + shopCoupon.getDiscountAmount());
record.setFullAmount(shopCoupon.getFullAmount());
record.setDiscountAmount(shopCoupon.getDiscountAmount());
} else if (shopCoupon.getType() == 2) {
record.setType(2);
record.setProId(actPro.getProductId());
record.setNum(actPro.getNum() * activate.getNum());
record.setOverNum(actPro.getNum() * activate.getNum());
record.setShopId(shopId);
record.setSourceActId(activate.getId());
record.setSourceFlowId(relationId);
record.setUseStartTime(start);
record.setUseEndTime(end);
record.setSource("activate");
record.setCouponJson(getCouponJson(activate, shopCoupon, actPro));
record.setName("商品券");
record.setProId(shopCoupon.getProId());
}
for (int i = 0; i < coupon.getNum(); i++) {
actGiveRecords.add(record);
}
inRecordService.saveBatch(actGiveRecords);
couponService.updateChain()
.set(ShopCoupon::getLeftNumber, shopCoupon.getLeftNumber() - coupon.getNum())
.eq(ShopCoupon::getId, shopCoupon.getId())
.update();
}
inRecordService.saveBatch(actGiveRecords);
shopCoupon.setLeftNumber(shopCoupon.getLeftNumber() - activate.getNum());
couponService.updateChain()
.set(ShopCoupon::getLeftNumber, shopCoupon.getLeftNumber() - activate.getNum())
.eq(ShopCoupon::getId, shopCoupon.getId())
.update();
}
});
}
//赠送金额
if (activate.getGiftAmount() != null && activate.getGiftAmount().compareTo(BigDecimal.ZERO) > 0) {
@@ -158,13 +163,10 @@ public class ShopActivateServiceImpl extends ServiceImpl<ShopActivateMapper, Sho
}
private String getCouponJson(ShopActivate activate, ShopCoupon tbShopCoupon, CouponProductVo couProduct) {
private String getCouponJson(ShopActivate activate, ShopCoupon tbShopCoupon) {
JSONObject result = new JSONObject();
result.put("activate", JSONObject.toJSONString(activate));
result.put("coupon", JSONObject.toJSONString(tbShopCoupon));
if (couProduct != null) {
result.put("couProduct", JSONObject.toJSONString(couProduct));
}
return result.toJSONString();
}
}

View File

@@ -1,18 +0,0 @@
package com.czg.service.account.service.impl;
import com.czg.account.entity.ShopCouponProduct;
import com.czg.account.service.ShopCouponProductService;
import com.czg.service.account.mapper.ShopCouponProductMapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* 活动赠送商品表 服务层实现。
*
* @author ww
* @since 2025-02-18
*/
@Service
public class ShopCouponProductServiceImpl extends ServiceImpl<ShopCouponProductMapper, ShopCouponProduct> implements ShopCouponProductService {
}

View File

@@ -2,10 +2,8 @@ package com.czg.service.account.service.impl;
import cn.hutool.core.date.DateUtil;
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.czg.account.entity.ShopActivateCouponRecord;
import com.czg.account.service.ShopActivateCouponRecordService;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.ShopCoupon;
@@ -26,23 +24,21 @@ import java.util.List;
public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCoupon> implements ShopCouponService {
@Resource
private ShopActivateInRecordService inService;
@Resource
private ShopActivateOutRecordService outService;
private ShopActivateCouponRecordService inService;
@Override
public List<ShopCoupon> getList(Long shopId, Integer status) {
QueryWrapper queryWrapper = new QueryWrapper();
if (shopId != null) {
if (status == 1) {
queryWrapper.eq(ShopActivateOutRecord::getShopId, shopId);
queryWrapper.eq(ShopActivateCouponRecord::getShopId, shopId);
}else {
queryWrapper.eq(ShopActivateInRecord::getShopId, shopId);
queryWrapper.eq(ShopActivateCouponRecord::getShopId, shopId);
}
}
return switch (status) {
case -1 -> {
queryWrapper.ge(ShopActivateInRecord::getUseEndTime, DateUtil.date());
queryWrapper.ge(ShopActivateCouponRecord::getUseEndTime, DateUtil.date());
yield list(queryWrapper);
}
case 0 -> {
@@ -84,17 +80,16 @@ public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCou
}
@Override
public Boolean use(Integer shopId, Integer orderId, Integer vipUserId, List<ShopActivateOutRecord> param) {
public Boolean use(Integer shopId, Integer orderId, Integer vipUserId) {
return null;
}
/**
* 退还券
*
* @param param giveId和 refNum 必传
*/
@Override
public Boolean refund(List<ShopActivateOutRecord> param) {
public Boolean refund() {
// for (ShopActivateOutRecord outRecord : param) {
// outService.updateChain()
// .set(ShopActivateOutRecord::getRefNum, outRecord.getRefNum())

View File

@@ -120,7 +120,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
@Override
public ShopInfo detail(Integer id) {
ShopInfo shopInfo = queryChain().eq(ShopInfo::getId, id).one();
ShopInfo shopInfo = queryChain().eq(ShopInfo::getId, id == null ? StpKit.USER.getShopId() : id).one();
if (shopInfo == null) {
throw new ApiNotPrintException("店铺信息不存在");
}

View File

@@ -7,21 +7,21 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.qrcode.QrCodeUtil;
import com.czg.account.dto.table.ShopTableAddDTO;
import com.czg.account.dto.table.ShopTableBindDTO;
import com.czg.account.entity.ShopTable;
import com.czg.account.entity.ShopTableArea;
import com.czg.account.entity.ShopTableCode;
import com.czg.account.service.ShopTableAreaService;
import com.czg.account.service.ShopTableCodeService;
import com.czg.account.service.ShopTableService;
import com.czg.enums.ShopTableStatusEnum;
import com.czg.exception.ApiNotPrintException;
import com.czg.service.account.mapper.ShopTableMapper;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.account.entity.ShopTable;
import com.czg.account.service.ShopTableService;
import com.czg.service.account.mapper.ShopTableMapper;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Service;
import org.apache.dubbo.config.annotation.DubboService;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
@@ -39,8 +39,8 @@ import java.util.zip.ZipOutputStream;
* @author zs
* @since 2025-02-13
*/
@Service
public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable> implements ShopTableService{
@DubboService
public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable> implements ShopTableService {
@Resource
private ShopTableAreaService shopAreaService;
@Resource
@@ -80,6 +80,11 @@ public class ShopTableServiceImpl extends ServiceImpl<ShopTableMapper, ShopTable
return true;
}
@Override
public ShopTable getOneByTableCode(Long shopId, String tableCode) {
return queryChain().eq(ShopTable::getShopId, shopId).eq(ShopTable::getTableCode, tableCode).one();
}
@Override
public void createQrCode(Long shopId, Integer num, HttpServletResponse response) throws IOException {
// 查询 shop 下面有多少台桌

View File

@@ -20,7 +20,7 @@
${qwSql}
limit ${pageOffset}, ${pageSize}
</select>
<select id="selectPageByKeyAndShopId_COUNT" resultType="com.czg.account.dto.pad.PadProductCategoryDTO">
<select id="selectPageByKeyAndShopId_COUNT" resultType="java.lang.Long">
SELECT count(1)
FROM tb_pad_product_category
LEFT JOIN tb_pad_product_category_detail

View File

@@ -2,6 +2,6 @@
<!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 namespace="com.czg.service.account.mapper.PointsBasicSettingMapper">
</mapper>

View File

@@ -2,6 +2,6 @@
<!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.ShopCouponProductMapper">
<mapper namespace="com.czg.service.account.mapper.PrintMachineMapper">
</mapper>

View File

@@ -2,6 +2,6 @@
<!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 namespace="com.czg.service.account.mapper.ShopActivateCouponRecordMapper">
</mapper>

View File

@@ -28,7 +28,7 @@ public class Main {
// String packageName = "product";
// String packageName = "order";
String tableName = "tb_product";
String tableName = "tb_print_machine";
String author = "zs";
//是否生成DTO实体 默认生成
boolean isGenerateDto = true;

View File

@@ -0,0 +1,19 @@
package com.czg.service.order.mapper;
import com.czg.order.entity.OrderDetail;
import com.mybatisflex.core.BaseMapper;
import com.czg.order.entity.CashierCart;
import java.util.List;
/**
* 购物车 映射层。
*
* @author ww
* @since 2025-02-20
*/
public interface CashierCartMapper extends BaseMapper<CashierCart> {
List<OrderDetail> getCartByTableCode(String tableCode);
}

View File

@@ -0,0 +1,25 @@
package com.czg.service.order.service.impl;
import com.czg.order.entity.OrderDetail;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.czg.order.entity.CashierCart;
import com.czg.order.service.CashierCartService;
import com.czg.service.order.mapper.CashierCartMapper;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 购物车 服务层实现。
*
* @author ww
* @since 2025-02-20
*/
@Service
public class CashierCartServiceImpl extends ServiceImpl<CashierCartMapper, CashierCart> implements CashierCartService{
@Override
public List<OrderDetail> getCartByTableCode(String tableCode) {
return getMapper().getCartByTableCode(tableCode);
}
}

View File

@@ -1,29 +1,33 @@
package com.czg.service.order.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.exceptions.ValidateException;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
import com.czg.account.entity.ShopUser;
import com.czg.account.service.ShopActivateService;
import com.czg.account.service.ShopUserService;
import com.czg.account.entity.*;
import com.czg.account.service.*;
import com.czg.config.RabbitPublisher;
import com.czg.entity.notify.CzgPayNotifyDTO;
import com.czg.entity.notify.CzgRefundNotifyDTO;
import com.czg.enums.ShopUserFlowBizEnum;
import com.czg.order.dto.OrderInfoAddDTO;
import com.czg.order.dto.OrderInfoQueryDTO;
import com.czg.order.entity.OrderDetail;
import com.czg.order.entity.OrderInfo;
import com.czg.order.entity.OrderPayment;
import com.czg.order.enums.PayEnums;
import com.czg.order.service.CashierCartService;
import com.czg.order.service.OrderDetailService;
import com.czg.order.service.OrderInfoService;
import com.czg.order.service.OrderPaymentService;
import com.czg.order.vo.OrderDetailSmallVO;
import com.czg.order.vo.OrderInfoCreateVo;
import com.czg.order.vo.OrderInfoVo;
import com.czg.service.order.enums.OrderStatusEnums;
import com.czg.service.order.mapper.OrderInfoMapper;
import com.czg.utils.AssertUtil;
import com.czg.utils.CzgStrUtils;
import com.czg.utils.PageUtil;
import com.mybatisflex.core.paginate.Page;
@@ -59,9 +63,21 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
private OrderPaymentService paymentService;
@Resource
private RabbitPublisher rabbitPublisher;
@Resource
private CashierCartService cartService;
@Resource
private OrderDetailService detailService;
@DubboReference
private ShopTableService shopTableService;
@DubboReference
private ShopInfoService shopInfoService;
@DubboReference
private PointsBasicSettingService pointsBasicService;
@DubboReference
private ShopUserService shopUserService;
@DubboReference
private UserInfoService userInfoService;
@DubboReference
private ShopActivateService activateService;
@Override
@@ -97,6 +113,41 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
return orderInfoVoPage;
}
@Override
public OrderInfoCreateVo createOrder(OrderInfoAddDTO param) {
ShopInfo shopInfo = shopInfoService.getById(param.getShopId());
AssertUtil.isNull(shopInfo, "生成订单失败,店铺信息不存在");
if (shopInfo.getIsTableFee().equals(0) && param.getSeatNum() == 0) {
throw new ValidateException("生成订单失败,请选择用餐人数后下单");
}
if (!shopInfo.getEatModel().contains(param.getEatModel())) {
throw new ValidateException("生成订单失败,店铺不支持该用餐模式");
}
if ("afterPay".equals(param.getPayMode()) && !"restaurant".equals(shopInfo.getRegisterType())) {
throw new ValidateException("生成订单失败,该店铺不支持后付费");
}
if (param.isVipPrice() && !shopInfo.getIsMemberPrice().equals(1)) {
throw new ValidateException("生成订单失败,该店铺不支持使用会员价");
}
PointsBasicSetting pointSetting = pointsBasicService.getById(shopInfo.getId());
if (param.getPointsNum().compareTo(BigDecimal.ZERO) > 0 && !pointSetting.getEnableDeduction().equals(1)) {
throw new ValidateException("生成订单失败,该店铺未开启积分抵扣");
}
UserInfo userInfo = userInfoService.getById(param.getUserId());
AssertUtil.isNull(userInfo, "生成订单失败,用户信息不存在");
ShopUser shopUser = shopUserService.getShopUserInfo(param.getShopId(), param.getUserId());
if (!shopUser.getIsVip().equals(1) && pointSetting.getDeductionGroup().contains("vip")) {
throw new ValidateException("生成订单失败,该店铺仅会员可使用积分抵扣");
}
ShopTable table = shopTableService.getOneByTableCode(param.getShopId(), param.getTableCode());
AssertUtil.isNull(table, "生成订单失败,桌台信息不存在");
// List<CashierCart> cashierCarts = cartService.
return null;
}
@Override
@Transactional
public void payCallBackOrder(@NotBlank String orderNo, @NotNull JSONObject resultJson) {

View File

@@ -63,7 +63,7 @@ public class PayServiceImpl implements PayService {
@DubboReference
private ShopUserFlowService userFlowService;
@DubboReference
private ShopActivateInRecordService inRecordService;
private ShopActivateCouponRecordService inRecordService;
@Resource
private RabbitPublisher rabbitPublisher;
@Resource
@@ -309,7 +309,7 @@ public class PayServiceImpl implements PayService {
.eq(ShopUserFlow::getBizCode, ShopUserFlowBizEnum.AWARD_IN.getCode())
.one();
resultMap.put("amount", shopUser.getAmount());
resultMap.put("inAmount", inFlow.getAmount( ));
resultMap.put("inAmount", inFlow.getAmount());
resultMap.put("inRefundAmount", inFlow.getRefundAmount());
resultMap.put("giftAmount", giftFlow == null ? BigDecimal.ZERO : giftFlow.getAmount());
resultMap.put("giftRefundAmount", giftFlow == null ? BigDecimal.ZERO : giftFlow.getRefundAmount());
@@ -356,34 +356,34 @@ public class PayServiceImpl implements PayService {
if (res.getCode() != 200 || res.getData() == null) {
return CzgResult.failure(res.getMsg());
}
} else {
ShopUserMoneyEditDTO shopUserMoneyEditDTO = ShopUserMoneyEditDTO.builder()
.id(shopUser.getId())
.money(refPayParam.getRefAmount())
.type(0)
.remark("退款")
.bizEnum(ShopUserFlowBizEnum.RECHARGE_REFUND)
.relationId(refPaymentId)
.rechargeId(inFlow.getId())
.build();
//更新会员余额 并生成流水
shopUserService.updateMoney(shopUser.getShopId(), shopUserMoneyEditDTO);
}
ShopUserMoneyEditDTO shopUserMoneyEditDTO = ShopUserMoneyEditDTO.builder()
.id(shopUser.getId())
.money(refPayParam.getRefAmount())
.type(0)
.remark("退款")
.bizEnum(ShopUserFlowBizEnum.RECHARGE_REFUND)
.relationId(refPaymentId)
.rechargeId(inFlow.getId())
.build();
//更新会员余额 并生成流水
shopUserService.updateMoney(shopUser.getShopId(), shopUserMoneyEditDTO);
userFlowService.updateChain()
.setRaw(ShopUserFlow::getRefundAmount, "refund_amount" + refPayParam.getRefAmount())
.eq(ShopUserFlow::getId, inFlow.getId())
.update();
if (giftFlow != null) {
userFlowService.updateChain()
.setRaw(ShopUserFlow::getRefundAmount, "refund_amount" + refPayParam.getRefAmount())
.eq(ShopUserFlow::getId, inFlow.getId())
.update();
if (giftFlow != null) {
userFlowService.updateChain()
.setRaw(ShopUserFlow::getRefundAmount, "refund_amount" + giftFlow.getAmount())
.eq(ShopUserFlow::getId, giftFlow.getId())
.update();
}
inRecordService.updateChain()
.set(ShopActivateInRecord::getOverNum, 0)
.eq(ShopActivateInRecord::getId, inFlow.getId())
.setRaw(ShopUserFlow::getRefundAmount, "refund_amount" + giftFlow.getAmount())
.eq(ShopUserFlow::getId, giftFlow.getId())
.update();
}
inRecordService.updateChain()
.set(ShopActivateCouponRecord::getStatus, "not_used")
.eq(ShopActivateCouponRecord::getSourceFlowId, inFlow.getId())
.update();
return CzgResult.success();
}

View File

@@ -0,0 +1,19 @@
<?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.order.mapper.CashierCartMapper">
<select id="getCartByTableCode" resultType="com.czg.order.entity.OrderDetail">
select cart.shop_id as shopId,
cart.product_id as productId,
pros.product_name as productName,
cart.sku_id as skuId,
skus.spec_info as skuName,
cart.number as number,
from tb_cashier_cart cart
left join tb_product pros on cart.product_id = pros.id
left join tb_prod_sku skus on cart.sku_id = skus.id
where table_code = #{tableCode}
</select>
</mapper>