parent
ff35c584db
commit
cd9ab53d72
|
|
@ -1,11 +1,19 @@
|
|||
package com.czg;
|
||||
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
*/
|
||||
@EnableDiscoveryClient
|
||||
@EnableTransactionManagement
|
||||
@MapperScan("com.czg.service.*.mapper")
|
||||
@EnableDubbo
|
||||
@SpringBootApplication
|
||||
public class OrderApplication {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.entity.resp.*;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.order.dto.OrderPayParamDTO;
|
||||
import com.czg.service.order.service.PayService;
|
||||
import com.czg.utils.ServletUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 支付
|
||||
*
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/admin/pay")
|
||||
public class PayController {
|
||||
@Resource
|
||||
private PayService payService;
|
||||
|
||||
/**
|
||||
* h5支付
|
||||
*/
|
||||
@PostMapping("h5Pay")
|
||||
CzgResult<CzgH5PayResp> h5PayOrder(HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
return payService.h5PayOrder(ServletUtil.getClientIPByHeader(request), payParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* js支付
|
||||
* <p>
|
||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
||||
* openId 必填
|
||||
*/
|
||||
@PostMapping("jsPay")
|
||||
CzgResult<CzgJsPayResp> jsPayOrder(HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
return payService.jsPayOrder(ServletUtil.getClientIPByHeader(request), payParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序支付
|
||||
* payType 必填 支付方式,aliPay 支付宝,wechatPay 微信
|
||||
* openId 必填
|
||||
*/
|
||||
@PostMapping("ltPayOrder")
|
||||
CzgResult<CzgLtPayResp> ltPayOrder(HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
return payService.ltPayOrder(ServletUtil.getClientIPByHeader(request), payParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 正扫
|
||||
*/
|
||||
@PostMapping("scanPay")
|
||||
CzgResult<CzgScanPayResp> scanPayOrder(HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
return payService.scanPayOrder(ServletUtil.getClientIPByHeader(request), payParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 反扫
|
||||
* authCode 必填 扫描码
|
||||
*/
|
||||
@PostMapping("microPay")
|
||||
CzgResult<CzgMicroPayResp> microPayOrder(@Validated @RequestBody OrderPayParamDTO payParam) {
|
||||
return payService.microPayOrder(payParam);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.czg.controller.user;
|
||||
|
||||
import com.czg.order.dto.OrderInfoQueryDTO;
|
||||
import com.czg.order.service.OrderInfoService;
|
||||
import com.czg.order.vo.OrderInfoVo;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* 订单管理
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user/order")
|
||||
public class OrderController {
|
||||
|
||||
@Resource
|
||||
private OrderInfoService orderInfoService;
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
*/
|
||||
@GetMapping
|
||||
public CzgResult<Page<OrderInfoVo>> get(OrderInfoQueryDTO queryDTO) {
|
||||
return CzgResult.success(orderInfoService.getOrderByPage(queryDTO));
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,8 @@ import lombok.Data;
|
|||
public class ShopMerchantEditDTO {
|
||||
@NotEmpty(message = "支付系统商户id不为空")
|
||||
private String storeId;
|
||||
@NotEmpty(message = "支付系统商户名称不为空")
|
||||
private String merchantName;
|
||||
@NotEmpty(message = "商户应用id不为空")
|
||||
private String appId;
|
||||
@NotEmpty(message = "商户秘钥不为空")
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ public class ShopMerchant implements Serializable {
|
|||
*/
|
||||
private String storeId;
|
||||
|
||||
private String merchantName;
|
||||
|
||||
/**
|
||||
* 商户应用id
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,151 @@
|
|||
|
||||
package com.czg.order.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
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-14
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderDetailDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long orderId;
|
||||
|
||||
private Long shopId;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private String productImg;
|
||||
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 商品类型:单规格商品 single 多规格商品 sku 套餐商品 package 称重商品 weigh 团购券 coupon
|
||||
*/
|
||||
private String productType;
|
||||
|
||||
private Long skuId;
|
||||
|
||||
private String skuName;
|
||||
|
||||
/**
|
||||
* 用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
|
||||
*/
|
||||
private String dineMode;
|
||||
|
||||
/**
|
||||
* 单价:原价/会员价/临时改价
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 折扣金额
|
||||
*/
|
||||
private BigDecimal discountAmount;
|
||||
|
||||
/**
|
||||
* 打包费
|
||||
*/
|
||||
private BigDecimal packAmount;
|
||||
|
||||
/**
|
||||
* 总金额/实付金额,包含打包费 不包括优惠金额
|
||||
*/
|
||||
private BigDecimal payAmount;
|
||||
|
||||
/**
|
||||
* 已退款金额
|
||||
*/
|
||||
private BigDecimal returnAmount;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal num;
|
||||
|
||||
/**
|
||||
* 退菜数量(不管价格)
|
||||
*/
|
||||
private BigDecimal returnNum;
|
||||
|
||||
/**
|
||||
* 退单数量
|
||||
*/
|
||||
private BigDecimal refundNum;
|
||||
|
||||
/**
|
||||
* 退款单号
|
||||
*/
|
||||
private String refundNo;
|
||||
|
||||
/**
|
||||
* 临时改价备注
|
||||
*/
|
||||
private String discountSaleNote;
|
||||
|
||||
/**
|
||||
* 状态: in-production 制作中;wait-out 待取餐;refunding 退款中; part-refund 部分退单; refund-退单; done 完成;
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 当前下单次数
|
||||
*/
|
||||
private Integer placeNum;
|
||||
|
||||
/**
|
||||
* 是否是临时菜品
|
||||
*/
|
||||
private Integer isTemporary;
|
||||
|
||||
/**
|
||||
* 是否打票
|
||||
*/
|
||||
private Integer isPrint;
|
||||
|
||||
/**
|
||||
* 是否等叫
|
||||
*/
|
||||
private Integer isWaitCall;
|
||||
|
||||
/**
|
||||
* 套餐商品选择信息
|
||||
*/
|
||||
private String proGroupInfo;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 退款备注
|
||||
*/
|
||||
private String refundRemark;
|
||||
|
||||
@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,250 @@
|
|||
|
||||
package com.czg.order.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
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-13
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderInfoDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private BigInteger id;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
* pc 收银机客户端 PC+雪花ID
|
||||
* wechat 微信小程序 WX+雪花ID
|
||||
* alipay 支付宝小程序 ALI+雪花ID
|
||||
* admin-pc PC管理端 WEB+雪花ID
|
||||
* admin-app APP管理端 APP+雪花ID
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 店铺Id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 用户Id user_info表的id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 退单金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
/**
|
||||
* 订单原金额 不含折扣价格
|
||||
*/
|
||||
private BigDecimal originAmount;
|
||||
|
||||
/**
|
||||
* 订单金额 (扣除各类折扣)
|
||||
*/
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
/**
|
||||
* 实际支付金额
|
||||
*/
|
||||
private BigDecimal payAmount;
|
||||
|
||||
/**
|
||||
* 积分抵扣金额
|
||||
*/
|
||||
private BigDecimal pointsDiscountAmount;
|
||||
|
||||
/**
|
||||
* 使用的积分数量
|
||||
*/
|
||||
private BigDecimal pointsNum;
|
||||
|
||||
/**
|
||||
* 商品优惠券抵扣金额
|
||||
*/
|
||||
private BigDecimal productCouponDiscountAmount;
|
||||
|
||||
/**
|
||||
* 用户使用的卡券
|
||||
*/
|
||||
private String couponInfoList;
|
||||
|
||||
/**
|
||||
* 满减优惠券抵扣金额
|
||||
*/
|
||||
private BigDecimal fullCouponDiscountAmount;
|
||||
|
||||
/**
|
||||
* 折扣金额
|
||||
*/
|
||||
private BigDecimal discountAmount;
|
||||
|
||||
/**
|
||||
* 折扣比例
|
||||
*/
|
||||
private BigDecimal discountRatio;
|
||||
|
||||
/**
|
||||
* 打包费
|
||||
*/
|
||||
private BigDecimal packFee;
|
||||
|
||||
/**
|
||||
* 台桌Id
|
||||
*/
|
||||
private String tableCode;
|
||||
|
||||
/**
|
||||
* 台桌名称
|
||||
*/
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 订单类型-
|
||||
* cash收银(除小程序以外 都属于收银)
|
||||
* miniapp小程序
|
||||
*/
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 平台类型 pc 收银机客户端 wechat 微信小程序 alipay 支付宝小程序 admin-pc PC管理端 admin-app APP管理端
|
||||
*/
|
||||
private String platformType;
|
||||
|
||||
/**
|
||||
* 用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
|
||||
*/
|
||||
private String dineMode;
|
||||
|
||||
/**
|
||||
* 支付模式: afterPay 后付费 normal 正常模式
|
||||
*/
|
||||
private String payMode;
|
||||
|
||||
/**
|
||||
* 支付类型
|
||||
* 主扫 main-scan
|
||||
* 被扫 back-scan
|
||||
* 微信小程序 wechat-mini
|
||||
* 支付宝小程序 alipay-mini
|
||||
* 会员支付 vip-pay
|
||||
* 现金支付 cash-pay
|
||||
*/
|
||||
private String payType;
|
||||
|
||||
/**
|
||||
* 状态: unpaid-待支付;in-production 制作中;wait-out 待取餐;;done-订单完成;refunding-申请退单;refund-退单;part-refund 部分退单;cancelled-取消订单
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 折扣信息 json
|
||||
*/
|
||||
private String discountInfo;
|
||||
|
||||
/**
|
||||
* 是否支持退款,1支持退单, 0不支持退单
|
||||
*/
|
||||
private Integer refundAble;
|
||||
|
||||
/**
|
||||
* 支付时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime paidTime;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 支付订单号
|
||||
*/
|
||||
private String payOrderNo;
|
||||
|
||||
/**
|
||||
* 交易日期
|
||||
*/
|
||||
private String tradeDay;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 取餐码
|
||||
*/
|
||||
private String takeCode;
|
||||
|
||||
/**
|
||||
* 员工id
|
||||
*/
|
||||
private Long staffId;
|
||||
|
||||
/**
|
||||
* 当前订单下单次数
|
||||
*/
|
||||
private Integer placeNum;
|
||||
|
||||
/**
|
||||
* 用餐人数
|
||||
*/
|
||||
private Integer seatNum;
|
||||
|
||||
/**
|
||||
* 餐位费
|
||||
*/
|
||||
private BigDecimal seatAmount;
|
||||
|
||||
/**
|
||||
* 退款备注
|
||||
*/
|
||||
private String refundRemark;
|
||||
|
||||
/**
|
||||
* 是否使用了霸王餐
|
||||
*/
|
||||
private Integer isFreeDine;
|
||||
|
||||
/**
|
||||
* 是否等叫 0 否 1 等叫
|
||||
*/
|
||||
private Integer isWaitCall;
|
||||
|
||||
/**
|
||||
* 挂账人id
|
||||
*/
|
||||
private Long creditBuyerId;
|
||||
|
||||
/**
|
||||
* 是否回收站 0-否,1回收站
|
||||
*/
|
||||
private Integer isDel;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
|
||||
package com.czg.order.dto;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 订单表 实体类。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderInfoQueryDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 店铺Id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 用户Id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 台桌Id
|
||||
*/
|
||||
private String tableCode;
|
||||
|
||||
/**
|
||||
* 台桌名称
|
||||
*/
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 发货类型post快递,takeaway外卖,takeself,自提table---堂食
|
||||
*/
|
||||
private String sendType;
|
||||
|
||||
/**
|
||||
* 订单类型-cash收银-miniapp小程序-offline线下
|
||||
*/
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 支付类型
|
||||
*/
|
||||
private String payType;
|
||||
|
||||
/**
|
||||
* 平台类型
|
||||
*/
|
||||
private String platformType;
|
||||
|
||||
/**
|
||||
* 状态: unpaid-待支付;in-production 制作中;wait-out 待取餐;;done-订单完成;refunding-申请退单;refund-退单;part-refund 部分退单;cancelled-取消订单
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 是否回收站 0-否,1回收站 默认查未删除
|
||||
*/
|
||||
private Integer isDel = 0;
|
||||
|
||||
/**
|
||||
* 查询包含该商品的 所有订单
|
||||
*/
|
||||
private String productName;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime startTime;
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
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 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-14
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_order_detail")
|
||||
public class OrderDetail implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
private Long orderId;
|
||||
|
||||
private Long shopId;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private String productImg;
|
||||
|
||||
private String productName;
|
||||
|
||||
/**
|
||||
* 商品类型:单规格商品 single 多规格商品 sku 套餐商品 package 称重商品 weigh 团购券 coupon
|
||||
*/
|
||||
private String productType;
|
||||
|
||||
private Long skuId;
|
||||
|
||||
private String skuName;
|
||||
|
||||
/**
|
||||
* 用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
|
||||
*/
|
||||
private String dineMode;
|
||||
|
||||
/**
|
||||
* 单价:原价/会员价/临时改价
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 折扣金额
|
||||
*/
|
||||
private BigDecimal discountAmount;
|
||||
|
||||
/**
|
||||
* 打包费
|
||||
*/
|
||||
private BigDecimal packAmount;
|
||||
|
||||
/**
|
||||
* 总金额/实付金额,包含打包费 不包括优惠金额
|
||||
*/
|
||||
private BigDecimal payAmount;
|
||||
|
||||
/**
|
||||
* 已退款金额
|
||||
*/
|
||||
private BigDecimal returnAmount;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal num;
|
||||
|
||||
/**
|
||||
* 退菜数量(不管价格)
|
||||
*/
|
||||
private BigDecimal returnNum;
|
||||
|
||||
/**
|
||||
* 退单数量
|
||||
*/
|
||||
private BigDecimal refundNum;
|
||||
|
||||
/**
|
||||
* 退款单号
|
||||
*/
|
||||
private String refundNo;
|
||||
|
||||
/**
|
||||
* 临时改价备注
|
||||
*/
|
||||
private String discountSaleNote;
|
||||
|
||||
/**
|
||||
* 状态: in-production 制作中;wait-out 待取餐;refunding 退款中; part-refund 部分退单; refund-退单; done 完成;
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 当前下单次数
|
||||
*/
|
||||
private Integer placeNum;
|
||||
|
||||
/**
|
||||
* 是否是临时菜品
|
||||
*/
|
||||
private Integer isTemporary;
|
||||
|
||||
/**
|
||||
* 是否打票
|
||||
*/
|
||||
private Integer isPrint;
|
||||
|
||||
/**
|
||||
* 是否等叫
|
||||
*/
|
||||
private Integer isWaitCall;
|
||||
|
||||
/**
|
||||
* 套餐商品选择信息
|
||||
*/
|
||||
private String proGroupInfo;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 退款备注
|
||||
*/
|
||||
private String refundRemark;
|
||||
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,253 @@
|
|||
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 java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
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-13
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_order_info")
|
||||
public class OrderInfo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private BigInteger id;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
* pc 收银机客户端 PC+雪花ID
|
||||
* wechat 微信小程序 WX+雪花ID
|
||||
* alipay 支付宝小程序 ALI+雪花ID
|
||||
* admin-pc PC管理端 WEB+雪花ID
|
||||
* admin-app APP管理端 APP+雪花ID
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 店铺Id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 用户Id user_info表的id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 退单金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
/**
|
||||
* 订单原金额 不含折扣价格
|
||||
*/
|
||||
private BigDecimal originAmount;
|
||||
|
||||
/**
|
||||
* 订单金额 (扣除各类折扣)
|
||||
*/
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
/**
|
||||
* 实际支付金额
|
||||
*/
|
||||
private BigDecimal payAmount;
|
||||
|
||||
/**
|
||||
* 积分抵扣金额
|
||||
*/
|
||||
private BigDecimal pointsDiscountAmount;
|
||||
|
||||
/**
|
||||
* 使用的积分数量
|
||||
*/
|
||||
private BigDecimal pointsNum;
|
||||
|
||||
/**
|
||||
* 商品优惠券抵扣金额
|
||||
*/
|
||||
private BigDecimal productCouponDiscountAmount;
|
||||
|
||||
/**
|
||||
* 用户使用的卡券
|
||||
*/
|
||||
private String couponInfoList;
|
||||
|
||||
/**
|
||||
* 满减优惠券抵扣金额
|
||||
*/
|
||||
private BigDecimal fullCouponDiscountAmount;
|
||||
|
||||
/**
|
||||
* 折扣金额
|
||||
*/
|
||||
private BigDecimal discountAmount;
|
||||
|
||||
/**
|
||||
* 折扣比例
|
||||
*/
|
||||
private BigDecimal discountRatio;
|
||||
|
||||
/**
|
||||
* 打包费
|
||||
*/
|
||||
private BigDecimal packFee;
|
||||
|
||||
/**
|
||||
* 台桌Id
|
||||
*/
|
||||
private String tableCode;
|
||||
|
||||
/**
|
||||
* 台桌名称
|
||||
*/
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 订单类型-
|
||||
* cash收银(除小程序以外 都属于收银)
|
||||
* miniapp小程序
|
||||
*/
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 平台类型 pc 收银机客户端 wechat 微信小程序 alipay 支付宝小程序 admin-pc PC管理端 admin-app APP管理端
|
||||
*/
|
||||
private String platformType;
|
||||
|
||||
/**
|
||||
* 用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
|
||||
*/
|
||||
private String dineMode;
|
||||
|
||||
/**
|
||||
* 支付模式: afterPay 后付费 normal 正常模式
|
||||
*/
|
||||
private String payMode;
|
||||
|
||||
/**
|
||||
* 支付类型
|
||||
* 主扫 main-scan
|
||||
* 被扫 back-scan
|
||||
* 微信小程序 wechat-mini
|
||||
* 支付宝小程序 alipay-mini
|
||||
* 会员支付 vip-pay
|
||||
* 现金支付 cash-pay
|
||||
*/
|
||||
private String payType;
|
||||
|
||||
/**
|
||||
* 状态: unpaid-待支付;in-production 制作中;wait-out 待取餐;;done-订单完成;refunding-申请退单;refund-退单;part-refund 部分退单;cancelled-取消订单
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 折扣信息 json
|
||||
*/
|
||||
private String discountInfo;
|
||||
|
||||
/**
|
||||
* 是否支持退款,1支持退单, 0不支持退单
|
||||
*/
|
||||
private Integer refundAble;
|
||||
|
||||
/**
|
||||
* 支付时间
|
||||
*/
|
||||
private LocalDateTime paidTime;
|
||||
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 支付订单号
|
||||
*/
|
||||
private String payOrderNo;
|
||||
|
||||
/**
|
||||
* 交易日期
|
||||
*/
|
||||
private String tradeDay;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 取餐码
|
||||
*/
|
||||
private String takeCode;
|
||||
|
||||
/**
|
||||
* 员工id
|
||||
*/
|
||||
private Long staffId;
|
||||
|
||||
/**
|
||||
* 当前订单下单次数
|
||||
*/
|
||||
private Integer placeNum;
|
||||
|
||||
/**
|
||||
* 用餐人数
|
||||
*/
|
||||
private Integer seatNum;
|
||||
|
||||
/**
|
||||
* 餐位费
|
||||
*/
|
||||
private BigDecimal seatAmount;
|
||||
|
||||
/**
|
||||
* 退款备注
|
||||
*/
|
||||
private String refundRemark;
|
||||
|
||||
/**
|
||||
* 是否使用了霸王餐
|
||||
*/
|
||||
private Integer isFreeDine;
|
||||
|
||||
/**
|
||||
* 是否等叫 0 否 1 等叫
|
||||
*/
|
||||
private Integer isWaitCall;
|
||||
|
||||
/**
|
||||
* 挂账人id
|
||||
*/
|
||||
private Long creditBuyerId;
|
||||
|
||||
/**
|
||||
* 是否回收站 0-否,1回收站
|
||||
*/
|
||||
private Integer isDel;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.czg.order.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.order.entity.OrderDetail;
|
||||
|
||||
/**
|
||||
* 订单详情 服务层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
public interface OrderDetailService extends IService<OrderDetail> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.czg.order.service;
|
||||
|
||||
import com.czg.order.dto.OrderInfoQueryDTO;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.czg.order.vo.OrderInfoVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
/**
|
||||
* 订单表 服务层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
public interface OrderInfoService extends IService<OrderInfo> {
|
||||
|
||||
Page<OrderInfoVo> getOrderByPage(OrderInfoQueryDTO param);
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
|
||||
package com.czg.order.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 订单详情 实体类。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderDetailSmallVO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String productImg;
|
||||
private String productName;
|
||||
private String skuName;
|
||||
private BigDecimal num;
|
||||
private BigDecimal refundNum;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
package com.czg.order.vo;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
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;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单表 通用展示类
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderInfoVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 店铺Id
|
||||
*/
|
||||
private String shopId;
|
||||
|
||||
|
||||
/**
|
||||
* 退单金额
|
||||
*/
|
||||
private BigDecimal refundAmount;
|
||||
|
||||
/**
|
||||
* 订单原金额 不含折扣价格
|
||||
*/
|
||||
private BigDecimal originAmount;
|
||||
|
||||
/**
|
||||
* 订单金额 (扣除各类折扣)
|
||||
*/
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
/**
|
||||
* 实际支付金额
|
||||
*/
|
||||
private BigDecimal payAmount;
|
||||
|
||||
|
||||
/**
|
||||
* 台桌名称
|
||||
*/
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 订单类型-
|
||||
* cash收银(除小程序以外 都属于收银)
|
||||
* miniapp小程序
|
||||
*/
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 平台类型 pc 收银机客户端 wechat 微信小程序 alipay 支付宝小程序 admin-pc PC管理端 admin-app APP管理端
|
||||
*/
|
||||
private String platformType;
|
||||
|
||||
/**
|
||||
* 用餐模式 堂食 dine-in 外带 take-out 外卖 take-away
|
||||
*/
|
||||
private String dineMode;
|
||||
|
||||
/**
|
||||
* 支付类型
|
||||
* 主扫 main-scan
|
||||
* 被扫 back-scan
|
||||
* 微信小程序 wechat-mini
|
||||
* 支付宝小程序 alipay-mini
|
||||
* 会员支付 vip-pay
|
||||
* 现金支付 cash-pay
|
||||
*/
|
||||
private String payType;
|
||||
|
||||
/**
|
||||
* 状态: unpaid-待支付;in-production 制作中;wait-out 待取餐;;done-订单完成;refunding-申请退单;refund-退单;part-refund 部分退单;cancelled-取消订单
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 是否支持退款,1支持退单, 0不支持退单
|
||||
*/
|
||||
private Integer refundAble;
|
||||
|
||||
/**
|
||||
* 支付时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime paidTime;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 支付订单号
|
||||
*/
|
||||
private String payOrderNo;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否使用了霸王餐
|
||||
*/
|
||||
private Integer isFreeDine;
|
||||
|
||||
/**
|
||||
* 订单商品列表
|
||||
*/
|
||||
private List<OrderDetailSmallVO> goods;
|
||||
|
||||
}
|
||||
|
|
@ -10,6 +10,8 @@ import lombok.Getter;
|
|||
public enum SysParamCodeEnum {
|
||||
|
||||
PAY_CZG_DOMAIN("pay_czg_domain", "超掌柜支付域名"),
|
||||
PAY_CZG_NOTIFY_URL("pay_czg_notify_url", "超掌柜支付回调地址"),
|
||||
PAY_CZG_REFUND_NOTIFY_URL("pay_czg_refund_notify_url", "超掌柜退款回调地址"),
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
|
|
|||
|
|
@ -30,4 +30,5 @@ public class ServletUtil extends JakartaServletUtil {
|
|||
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
|
||||
return (ServletRequestAttributes) attributes;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ public class CzgRefundNotifyDTO {
|
|||
private String mchRefundNo;
|
||||
/**
|
||||
* 平台退款订单号 String(30)
|
||||
*
|
||||
*/
|
||||
private String refundOrderId;
|
||||
/**
|
||||
|
|
@ -62,7 +61,7 @@ public class CzgRefundNotifyDTO {
|
|||
*/
|
||||
private String ifCode;
|
||||
/**
|
||||
* 备注 String(30)
|
||||
* 备注 String(30)
|
||||
*/
|
||||
private String note;
|
||||
/**
|
||||
|
|
@ -72,6 +71,10 @@ public class CzgRefundNotifyDTO {
|
|||
private String refundTime;
|
||||
/**
|
||||
* 自定义扩展参数 String(256)
|
||||
* * 扩展参数
|
||||
* * {
|
||||
* * "pay_type": "order/vip"
|
||||
* * }
|
||||
*/
|
||||
private String extParam;
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.czg.entity.req;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
|
|
@ -28,10 +29,13 @@ public class CzgBaseReq {
|
|||
/**
|
||||
* 商户订单号 String(30)
|
||||
* 操作方式+雪花算法
|
||||
* 如 h5雪花ID
|
||||
* 如 js雪花ID
|
||||
* 如 lt雪花ID
|
||||
* 如 refund雪花ID
|
||||
* 收银机客户端 PC+雪花ID
|
||||
* 微信小程序 WX+雪花ID
|
||||
* 支付宝小程序 ALI+雪花ID
|
||||
* PC管理端 WEB+雪花ID
|
||||
* APP管理端 APP+雪花ID
|
||||
* <p>
|
||||
* 退款 re+雪花ID
|
||||
*/
|
||||
private String mchOrderNo;
|
||||
/**
|
||||
|
|
@ -73,6 +77,10 @@ public class CzgBaseReq {
|
|||
/**
|
||||
* 扩展参数 String(512)
|
||||
* 商户扩展参数,回调时会原样返回
|
||||
* * 扩展参数
|
||||
* * {
|
||||
* * "pay_type": "order/vip"
|
||||
* * }
|
||||
*/
|
||||
private String extParam;
|
||||
|
||||
|
|
@ -99,15 +107,18 @@ public class CzgBaseReq {
|
|||
|
||||
}
|
||||
|
||||
public CzgBaseReq(String storeId, String mchOrderNo, Long amount, String subject, String body,
|
||||
String buyerRemark, String notifyUrl, String extParam) {
|
||||
this.storeId = storeId;
|
||||
public CzgBaseReq(String mchOrderNo, Long amount, String body,
|
||||
String buyerRemark, String extParam) {
|
||||
this.mchOrderNo = mchOrderNo;
|
||||
this.subject = subject;
|
||||
this.body = body;
|
||||
this.amount = amount;
|
||||
this.buyerRemark = buyerRemark;
|
||||
this.notifyUrl = notifyUrl;
|
||||
this.extParam = extParam;
|
||||
}
|
||||
|
||||
public void assignMerchant(@NonNull String storeId, @NonNull String subject, @NonNull String notifyUrl) {
|
||||
this.storeId = storeId;
|
||||
this.subject = subject;
|
||||
this.notifyUrl = notifyUrl;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,12 @@ import lombok.NonNull;
|
|||
|
||||
/**
|
||||
* h5支付请求参数
|
||||
*
|
||||
* @author ww
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CzgH5PayReq extends CzgBaseReq{
|
||||
public class CzgH5PayReq extends CzgBaseReq {
|
||||
//必填范围
|
||||
/**
|
||||
* 用户IP 支付的用户IP
|
||||
|
|
@ -26,11 +27,9 @@ public class CzgH5PayReq extends CzgBaseReq{
|
|||
private String returnUrl;
|
||||
|
||||
|
||||
public CzgH5PayReq(@NonNull String storeId, @NonNull String mchOrderNo,
|
||||
@NonNull String subject, @NonNull Long amount, String body,
|
||||
@NonNull String clientIp, @NonNull String notifyUrl,
|
||||
String returnUrl, String buyerRemark, String extParam) {
|
||||
super(subject, body, amount, mchOrderNo, storeId, buyerRemark, notifyUrl, extParam);
|
||||
public CzgH5PayReq(@NonNull String mchOrderNo, @NonNull Long amount, String body, @NonNull String clientIp,
|
||||
String returnUrl, String buyerRemark, @NonNull String extParam) {
|
||||
super(mchOrderNo, amount, body, buyerRemark, extParam);
|
||||
this.clientIp = clientIp;
|
||||
this.returnUrl = returnUrl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,14 +52,13 @@ public class CzgJsPayReq extends CzgBaseReq {
|
|||
*/
|
||||
private String frontFailUrl;
|
||||
|
||||
public CzgJsPayReq(@NonNull String storeId, @NonNull String subAppid, @NonNull String mchOrderNo,
|
||||
@NonNull String subject, @NonNull Long amount, String body,
|
||||
@NonNull String userId, @NonNull String clientIp, @NonNull String notifyUrl,
|
||||
String returnUrl, String buyerRemark, String extParam) {
|
||||
super(subject, body, amount, mchOrderNo, storeId, buyerRemark, notifyUrl, extParam);
|
||||
this.userId = userId;
|
||||
public CzgJsPayReq(@NonNull String mchOrderNo,
|
||||
@NonNull Long amount, String body,
|
||||
@NonNull String openId, @NonNull String clientIp,
|
||||
String returnUrl, String buyerRemark,@NonNull String extParam) {
|
||||
super(mchOrderNo, amount, body, buyerRemark, extParam);
|
||||
this.userId = openId;
|
||||
this.clientIp = clientIp;
|
||||
this.subAppid = subAppid;
|
||||
this.returnUrl = returnUrl;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,14 +50,12 @@ public class CzgLtPayReq extends CzgBaseReq {
|
|||
*/
|
||||
private boolean isScreen;
|
||||
|
||||
public CzgLtPayReq(@NonNull String storeId, @NonNull String subAppid, @NonNull String mchOrderNo,
|
||||
@NonNull String subject, @NonNull Long amount, String body,
|
||||
@NonNull String userId, @NonNull String clientIp, @NonNull String notifyUrl,
|
||||
String returnUrl, String buyerRemark, String extParam) {
|
||||
super(storeId, mchOrderNo, amount, subject, body, buyerRemark, notifyUrl, extParam);
|
||||
this.userId = userId;
|
||||
public CzgLtPayReq(@NonNull String mchOrderNo, @NonNull Long amount,
|
||||
String body, @NonNull String openId, @NonNull String clientIp,
|
||||
String returnUrl, String buyerRemark, @NonNull String extParam) {
|
||||
super(mchOrderNo, amount, body, buyerRemark, extParam);
|
||||
this.userId = openId;
|
||||
this.clientIp = clientIp;
|
||||
this.returnUrl = returnUrl;
|
||||
this.subAppid = subAppid;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,12 +29,9 @@ public class CzgMicroPayReq extends CzgBaseReq {
|
|||
*/
|
||||
private String subAppid;
|
||||
|
||||
public CzgMicroPayReq(@NonNull String storeId, @NonNull String subAppid, @NonNull String mchOrderNo,
|
||||
@NonNull String subject, @NonNull Long amount, String body,
|
||||
@NonNull String authCode, @NonNull String notifyUrl,
|
||||
String buyerRemark, String extParam) {
|
||||
super(storeId, mchOrderNo, amount, subject, body, buyerRemark, notifyUrl, extParam);
|
||||
public CzgMicroPayReq(@NonNull String mchOrderNo, @NonNull Long amount, String body,
|
||||
@NonNull String authCode, String buyerRemark, @NonNull String extParam) {
|
||||
super(mchOrderNo, amount, body, buyerRemark, extParam);
|
||||
this.authCode = authCode;
|
||||
this.subAppid = subAppid;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@ public class CzgRefundReq {
|
|||
private String mchOrderNo;
|
||||
/**
|
||||
* 扩展参数
|
||||
* * 扩展参数
|
||||
* * {
|
||||
* * "pay_type": "order/vip"
|
||||
* * }
|
||||
*/
|
||||
private String extParam;
|
||||
/**
|
||||
|
|
@ -47,13 +51,11 @@ public class CzgRefundReq {
|
|||
* payOrderId和mchOrderNo 二选一 必填
|
||||
*/
|
||||
public CzgRefundReq(@NonNull String mchRefundNo, @NonNull String refundReason, @NonNull Long refundAmount,
|
||||
@NonNull String notifyUrl, String payOrderId, String mchOrderNo, String extParam) {
|
||||
String mchOrderNo, String extParam) {
|
||||
this.mchRefundNo = mchRefundNo;
|
||||
this.refundReason = refundReason;
|
||||
this.refundAmount = refundAmount;
|
||||
this.payOrderId = payOrderId;
|
||||
this.mchOrderNo = mchOrderNo;
|
||||
this.extParam = extParam;
|
||||
this.notifyUrl = notifyUrl;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,11 +26,9 @@ public class CzgScanPayReq extends CzgBaseReq {
|
|||
*/
|
||||
private String returnUrl;
|
||||
|
||||
public CzgScanPayReq(@NonNull String storeId, @NonNull String mchOrderNo,
|
||||
@NonNull String subject, @NonNull Long amount, String body,
|
||||
@NonNull String clientIp, @NonNull String notifyUrl,
|
||||
String returnUrl, String buyerRemark, String extParam) {
|
||||
super(storeId, mchOrderNo, amount, subject, body, buyerRemark, notifyUrl, extParam);
|
||||
public CzgScanPayReq(@NonNull String mchOrderNo, @NonNull Long amount, String body,
|
||||
@NonNull String clientIp, String returnUrl, String buyerRemark, @NonNull String extParam) {
|
||||
super(mchOrderNo, amount, body, buyerRemark, extParam);
|
||||
this.clientIp = clientIp;
|
||||
this.returnUrl = returnUrl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,9 @@ public class CzgBaseResp {
|
|||
private String channelTradeNo;
|
||||
/**
|
||||
* 扩展参数
|
||||
* {
|
||||
* "pay_type": "order/vip"
|
||||
* }
|
||||
*/
|
||||
private String extParam;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.czg</groupId>
|
||||
<artifactId>czg-pay</artifactId>
|
||||
<artifactId>pay-service</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package com.czg.service.order.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 支付接收参数 实体类
|
||||
*
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
public class OrderPayParamDTO {
|
||||
@NotEmpty(message = "店铺不能为空")
|
||||
private Long shopId;
|
||||
@NotEmpty(message = "订单不能为空")
|
||||
private Long orderId;
|
||||
private String buyerRemark;
|
||||
private String returnUrl;
|
||||
private String payType;
|
||||
private String openId;
|
||||
private String authCode;
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.czg.service.order.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.order.entity.OrderDetail;
|
||||
|
||||
/**
|
||||
* 订单详情 映射层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
public interface OrderDetailMapper extends BaseMapper<OrderDetail> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.czg.service.order.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
|
||||
/**
|
||||
* 订单表 映射层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
public interface OrderInfoMapper extends BaseMapper<OrderInfo> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package com.czg.service.order.service;
|
||||
|
||||
import com.czg.entity.notify.CzgPayNotifyDTO;
|
||||
import com.czg.entity.notify.CzgRefundNotifyDTO;
|
||||
import com.czg.entity.resp.*;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.order.dto.OrderPayParamDTO;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* 支付
|
||||
* @author ww
|
||||
*/
|
||||
public interface PayService {
|
||||
/**
|
||||
* h5支付
|
||||
*/
|
||||
CzgResult<CzgH5PayResp> h5PayOrder(String clintIp, OrderPayParamDTO payParam);
|
||||
|
||||
/**
|
||||
* js支付
|
||||
*/
|
||||
CzgResult<CzgJsPayResp> jsPayOrder(String clintIp, OrderPayParamDTO payParam);
|
||||
|
||||
/**
|
||||
* 小程序支付
|
||||
*/
|
||||
CzgResult<CzgLtPayResp> ltPayOrder(String clintIp, OrderPayParamDTO payParam);
|
||||
|
||||
/**
|
||||
* PC扫码支付
|
||||
*/
|
||||
CzgResult<CzgScanPayResp> scanPayOrder(String clintIp, OrderPayParamDTO payParam);
|
||||
|
||||
/**
|
||||
* 聚合反扫
|
||||
*/
|
||||
CzgResult<CzgMicroPayResp> microPayOrder(OrderPayParamDTO payParam);
|
||||
|
||||
|
||||
/**
|
||||
* 订单退款
|
||||
*/
|
||||
CzgResult<CzgRefundResp> refundOrder(Long shopId, Long orderId,String refundReason,BigDecimal refundAmount);
|
||||
|
||||
|
||||
/**
|
||||
* 支付查询
|
||||
*
|
||||
* @param payOrderId 平台订单号
|
||||
* @param mchOrderNo 商户订单号
|
||||
*/
|
||||
CzgResult<CzgBaseResp> queryPayOrder(Long shopId, String payOrderId, String mchOrderNo);
|
||||
|
||||
/**
|
||||
* 退款查询
|
||||
*
|
||||
* @param mchRefundNo 商户退款订单号 二选一
|
||||
* @param refundOrderId 平台退款订单号 二选一
|
||||
*/
|
||||
CzgResult<CzgRefundResp> queryRefund(Long shopId, String mchRefundNo, String refundOrderId);
|
||||
|
||||
|
||||
/**
|
||||
* 支付回调数据处理
|
||||
*
|
||||
* @param dataJsonStr 带解析数据
|
||||
*/
|
||||
CzgPayNotifyDTO getPayNotifyData(String dataJsonStr);
|
||||
|
||||
/**
|
||||
* 退款回调数据处理
|
||||
*
|
||||
* @param dataJsonStr 带解析数据
|
||||
*/
|
||||
CzgRefundNotifyDTO getRefundNotifyData(String dataJsonStr);
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.czg.service.order.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.order.entity.OrderDetail;
|
||||
import com.czg.order.service.OrderDetailService;
|
||||
import com.czg.service.order.mapper.OrderDetailMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 订单详情 服务层实现。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
@Service
|
||||
public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, OrderDetail> implements OrderDetailService{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.czg.service.order.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.order.entity.OrderDetail;
|
||||
import com.czg.order.service.OrderDetailService;
|
||||
import com.czg.order.dto.OrderInfoQueryDTO;
|
||||
import com.czg.order.vo.OrderDetailSmallVO;
|
||||
import com.czg.order.vo.OrderInfoVo;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.czg.order.service.OrderInfoService;
|
||||
import com.czg.service.order.mapper.OrderInfoMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单表 服务层实现。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-13
|
||||
*/
|
||||
@Service
|
||||
public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo> implements OrderInfoService {
|
||||
|
||||
@Resource
|
||||
private OrderDetailService orderDetailService;
|
||||
|
||||
@Override
|
||||
public Page<OrderInfoVo> getOrderByPage(OrderInfoQueryDTO param) {
|
||||
String productName = param.getProductName();
|
||||
List<Long> like = null;
|
||||
if (StrUtil.isNotBlank(productName)) {
|
||||
like = orderDetailService.queryChain()
|
||||
.select(OrderDetail::getOrderId)
|
||||
.eq(OrderDetail::getShopId, param.getShopId())
|
||||
.like(OrderDetail::getProductName, productName).listAs(Long.class);
|
||||
}
|
||||
|
||||
QueryWrapper queryWrapper = PageUtil.buildSortQueryWrapper();
|
||||
|
||||
queryWrapper.eq(OrderInfo::getShopId, param.getShopId())
|
||||
.eq(OrderInfo::getStatus, param.getStatus())
|
||||
.eq(OrderInfo::getOrderNo, param.getOrderNo())
|
||||
.eq(OrderInfo::getPayType, param.getPayType())
|
||||
.eq(OrderInfo::getTableCode, param.getTableCode())
|
||||
.eq(OrderInfo::getUserId, param.getUserId())
|
||||
.in(OrderInfo::getId, like);
|
||||
Page<OrderInfoVo> orderInfoVoPage = pageAs(PageUtil.buildPage(), queryWrapper, OrderInfoVo.class);
|
||||
orderInfoVoPage.getRecords().parallelStream().forEach(s -> {
|
||||
List<OrderDetailSmallVO> orderDetails = orderDetailService.queryChain().select()
|
||||
.eq(OrderDetail::getShopId, s.getShopId())
|
||||
.eq(OrderDetail::getOrderId, s.getId()).listAs(OrderDetailSmallVO.class);
|
||||
s.setGoods(orderDetails);
|
||||
});
|
||||
return orderInfoVoPage;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
package com.czg.service.order.service.impl;
|
||||
|
||||
import com.czg.account.entity.ShopMerchant;
|
||||
import com.czg.account.service.ShopMerchantService;
|
||||
import com.czg.entity.notify.CzgPayNotifyDTO;
|
||||
import com.czg.entity.notify.CzgRefundNotifyDTO;
|
||||
import com.czg.entity.req.*;
|
||||
import com.czg.entity.resp.*;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.czg.order.service.OrderInfoService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.CzgPayService;
|
||||
import com.czg.service.order.dto.OrderPayParamDTO;
|
||||
import com.czg.service.order.service.PayService;
|
||||
import com.czg.system.enums.SysParamCodeEnum;
|
||||
import com.czg.system.service.SysParamsService;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.NonNull;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
public class PayServiceImpl implements PayService {
|
||||
|
||||
@DubboReference
|
||||
private ShopMerchantService shopMerchantService;
|
||||
@DubboReference
|
||||
private SysParamsService sysParamsService;
|
||||
@Resource
|
||||
private CzgPayService czgPayService;
|
||||
@Resource
|
||||
private OrderInfoService orderInfoService;
|
||||
|
||||
private final BigDecimal MONEY_RATE = new BigDecimal("100");
|
||||
private final String payJsonExtParam = "{\"payType\":\"1\"}";
|
||||
private final String refundJsonExtParam = "{\"payType\":\"1\"}";
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgH5PayResp> h5PayOrder(@NonNull String clintIp, OrderPayParamDTO payParam) {
|
||||
OrderInfo orderInfo = orderInfoService.getById(payParam.getOrderId());
|
||||
AssertUtil.isNull(orderInfo, "订单不存在");
|
||||
return h5Pay(payParam.getShopId(), new CzgH5PayReq(orderInfo.getOrderNo(), orderInfo.getPayAmount().multiply(MONEY_RATE).longValue(),
|
||||
"点餐支付", clintIp, payParam.getReturnUrl(), payParam.getBuyerRemark(), payJsonExtParam));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgJsPayResp> jsPayOrder(@NonNull String clintIp, OrderPayParamDTO payParam) {
|
||||
OrderInfo orderInfo = orderInfoService.getById(payParam.getOrderId());
|
||||
AssertUtil.isNull(orderInfo, "订单不存在");
|
||||
return jsPay(payParam.getShopId(), payParam.getPayType(), new CzgJsPayReq(orderInfo.getOrderNo(), orderInfo.getPayAmount().multiply(MONEY_RATE).longValue(),
|
||||
"点餐支付", payParam.getOpenId(), clintIp, payParam.getReturnUrl(), payParam.getBuyerRemark(), payJsonExtParam));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgLtPayResp> ltPayOrder(@NonNull String clintIp, OrderPayParamDTO payParam) {
|
||||
OrderInfo orderInfo = orderInfoService.getById(payParam.getOrderId());
|
||||
AssertUtil.isNull(orderInfo, "订单不存在");
|
||||
return ltPay(payParam.getShopId(), payParam.getPayType(), new CzgLtPayReq(orderInfo.getOrderNo(), orderInfo.getPayAmount().multiply(MONEY_RATE).longValue(),
|
||||
"点餐支付", payParam.getOpenId(), clintIp, payParam.getReturnUrl(), payParam.getBuyerRemark(), payJsonExtParam));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgScanPayResp> scanPayOrder(@NonNull String clintIp, OrderPayParamDTO payParam) {
|
||||
OrderInfo orderInfo = orderInfoService.getById(payParam.getOrderId());
|
||||
AssertUtil.isNull(orderInfo, "订单不存在");
|
||||
return scanPay(payParam.getShopId(), new CzgScanPayReq(orderInfo.getOrderNo(), orderInfo.getPayAmount().multiply(MONEY_RATE).longValue(),
|
||||
"点餐支付", clintIp, payParam.getReturnUrl(), payParam.getBuyerRemark(), payJsonExtParam));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgMicroPayResp> microPayOrder(OrderPayParamDTO payParam) {
|
||||
OrderInfo orderInfo = orderInfoService.getById(payParam.getOrderId());
|
||||
AssertUtil.isNull(orderInfo, "订单不存在");
|
||||
return microPay(payParam.getShopId(), new CzgMicroPayReq(orderInfo.getOrderNo(), orderInfo.getPayAmount().multiply(MONEY_RATE).longValue(),
|
||||
"点餐支付", payParam.getAuthCode(), payParam.getBuyerRemark(), payJsonExtParam));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgRefundResp> refundOrder(@NonNull Long shopId, @NonNull Long orderId,@NonNull String refundReason,@NonNull BigDecimal refundAmount) {
|
||||
|
||||
// refund(shopId, new CzgRefundReq("1", refundReason, refundAmount.multiply(MONEY_RATE).longValue(),
|
||||
// "1", refundJsonExtParam));
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgBaseResp> queryPayOrder(@NonNull Long shopId, String payOrderId, String mchOrderNo) {
|
||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||
return czgPayService.queryPayOrder(shopMerchant.getAppId(), shopMerchant.getAppSecret(), payOrderId, mchOrderNo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgRefundResp> queryRefund(@NonNull Long shopId, String mchRefundNo, String refundOrderId) {
|
||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||
return czgPayService.queryRefundOrder(shopMerchant.getAppId(), shopMerchant.getAppSecret(), mchRefundNo, refundOrderId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CzgPayNotifyDTO getPayNotifyData(String dataJsonStr) {
|
||||
return czgPayService.getPayNotifyData(dataJsonStr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgRefundNotifyDTO getRefundNotifyData(String dataJsonStr) {
|
||||
return czgPayService.getRefundNotifyData(dataJsonStr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private CzgResult<CzgH5PayResp> h5Pay(@NonNull Long shopId, CzgH5PayReq bizData) {
|
||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
||||
return czgPayService.h5Pay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||
}
|
||||
|
||||
private CzgResult<CzgJsPayResp> jsPay(@NonNull Long shopId, @NonNull String payType, CzgJsPayReq bizData) {
|
||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||
bizData.setSubAppid("aliPay" .equals(payType) ? shopMerchant.getAlipaySmallAppid() : shopMerchant.getWechatSmallAppid());
|
||||
AssertUtil.isBlank(bizData.getSubAppid(), "暂不可用,请联系商家配置" + ("aliPay" .equals(payType) ? "支付宝" : "微信") + "小程序");
|
||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
||||
return czgPayService.jsPay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||
}
|
||||
|
||||
private CzgResult<CzgLtPayResp> ltPay(@NonNull Long shopId, String payType, CzgLtPayReq bizData) {
|
||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||
bizData.setSubAppid("aliPay" .equals(payType) ? shopMerchant.getAlipaySmallAppid() : shopMerchant.getWechatSmallAppid());
|
||||
AssertUtil.isBlank(bizData.getSubAppid(), "暂不可用,请联系商家配置" + ("aliPay" .equals(payType) ? "支付宝" : "微信") + "小程序");
|
||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
||||
return czgPayService.ltPay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||
}
|
||||
|
||||
private CzgResult<CzgScanPayResp> scanPay(@NonNull Long shopId, CzgScanPayReq bizData) {
|
||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
||||
return czgPayService.scanPay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||
}
|
||||
|
||||
private CzgResult<CzgMicroPayResp> microPay(@NonNull Long shopId, CzgMicroPayReq bizData) {
|
||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
||||
return czgPayService.microPay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||
}
|
||||
|
||||
private CzgResult<CzgRefundResp> refund(@NonNull Long shopId, CzgRefundReq bizData) {
|
||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||
bizData.setNotifyUrl(sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_REFUND_NOTIFY_URL.getCode()));
|
||||
return czgPayService.refundOrder(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||
}
|
||||
}
|
||||
|
|
@ -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.order.mapper.OrderDetailMapper">
|
||||
|
||||
</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.order.mapper.OrderInfoMapper">
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue