Commit 0e68a92c2996d7770b0651007acad70670c5c6cb

Authored by dengwei
1 parent d12bab8f

feat cashier mall init

Showing 29 changed files with 1174 additions and 409 deletions
cashier-mall/src/main/java/com/diligrp/cashier/mall/api/MallAuthApi.java
@@ -53,7 +53,7 @@ public class MallAuthApi { @@ -53,7 +53,7 @@ public class MallAuthApi {
53 /** 53 /**
54 * 获取用户信息 54 * 获取用户信息
55 */ 55 */
56 - @PostMapping("/user/info") 56 + @PostMapping(value = {"/user/info", "/auth/user/info"})
57 @ParamLogPrint(outPrint = true) 57 @ParamLogPrint(outPrint = true)
58 @Sign(sign = RtMallSign.class) 58 @Sign(sign = RtMallSign.class)
59 public RtMarkMessage<UserInfoVO> userInfo(@RequestBody @Valid Object req) { 59 public RtMarkMessage<UserInfoVO> userInfo(@RequestBody @Valid Object req) {
cashier-mall/src/main/java/com/diligrp/cashier/mall/api/RtMallOrderApi.java
@@ -23,6 +23,8 @@ import org.springframework.web.bind.annotation.RequestBody; @@ -23,6 +23,8 @@ import org.springframework.web.bind.annotation.RequestBody;
23 import org.springframework.web.bind.annotation.RequestMapping; 23 import org.springframework.web.bind.annotation.RequestMapping;
24 import org.springframework.web.bind.annotation.RestController; 24 import org.springframework.web.bind.annotation.RestController;
25 25
  26 +import java.util.List;
  27 +
26 /** 28 /**
27 * @ClassName RtMallOrderApi.java 29 * @ClassName RtMallOrderApi.java
28 * @author dengwei 30 * @author dengwei
@@ -49,7 +51,7 @@ public class RtMallOrderApi { @@ -49,7 +51,7 @@ public class RtMallOrderApi {
49 public RtMarkMessage<OrderSuccessVO> createOrder(@Valid @RequestBody Object req) { 51 public RtMarkMessage<OrderSuccessVO> createOrder(@Valid @RequestBody Object req) {
50 OrderCO orderCo = JsonUtils.convertValue(req, OrderCO.class); 52 OrderCO orderCo = JsonUtils.convertValue(req, OrderCO.class);
51 RtMallValidateUtils.valid(orderCo); 53 RtMallValidateUtils.valid(orderCo);
52 - return RtMarkMessage.success(mallBizOrderService.createOrder(orderCo)); 54 + return RtMarkMessage.success(mallBizOrderService.createOrder(List.of(orderCo)));
53 } 55 }
54 56
55 /** 57 /**
cashier-mall/src/main/java/com/diligrp/cashier/mall/api/RtMallOrderRefundApi.java
1 package com.diligrp.cashier.mall.api; 1 package com.diligrp.cashier.mall.api;
2 2
3 import com.diligrp.cashier.mall.domain.rtmall.RtMarkMessage; 3 import com.diligrp.cashier.mall.domain.rtmall.RtMarkMessage;
4 -import com.diligrp.cashier.mall.domain.rtmall.co.OrderCO;  
5 import com.diligrp.cashier.mall.domain.rtmall.co.RefundCO; 4 import com.diligrp.cashier.mall.domain.rtmall.co.RefundCO;
  5 +import com.diligrp.cashier.mall.domain.rtmall.co.RefundStatusCO;
  6 +import com.diligrp.cashier.mall.domain.rtmall.vo.RefundVO;
6 import com.diligrp.cashier.mall.domain.rtmall.vo.RefundSuccessVO; 7 import com.diligrp.cashier.mall.domain.rtmall.vo.RefundSuccessVO;
7 import com.diligrp.cashier.mall.service.biz.MallBizRefundService; 8 import com.diligrp.cashier.mall.service.biz.MallBizRefundService;
8 import com.diligrp.cashier.mall.sign.RtMallSign; 9 import com.diligrp.cashier.mall.sign.RtMallSign;
@@ -56,9 +57,9 @@ public class RtMallOrderRefundApi { @@ -56,9 +57,9 @@ public class RtMallOrderRefundApi {
56 @PostMapping("/refund/v1/info") 57 @PostMapping("/refund/v1/info")
57 @ParamLogPrint(outPrint = true) 58 @ParamLogPrint(outPrint = true)
58 @Sign(sign = RtMallSign.class) 59 @Sign(sign = RtMallSign.class)
59 - public RtMarkMessage<?> info(@Valid @RequestBody Object req) {  
60 - OrderCO orderCo = JsonUtils.convertValue(req, OrderCO.class);  
61 - RtMallValidateUtils.valid(orderCo);  
62 - return RtMarkMessage.success(); 60 + public RtMarkMessage<RefundVO> info(@Valid @RequestBody Object req) {
  61 + RefundStatusCO refundStatusCo = JsonUtils.convertValue(req, RefundStatusCO.class);
  62 + RtMallValidateUtils.valid(refundStatusCo);
  63 + return RtMarkMessage.success(mallBizRefundService.info(refundStatusCo));
63 } 64 }
64 } 65 }
cashier-mall/src/main/java/com/diligrp/cashier/mall/dao/MallBizOrderAddressDao.java
@@ -2,6 +2,9 @@ package com.diligrp.cashier.mall.dao; @@ -2,6 +2,9 @@ package com.diligrp.cashier.mall.dao;
2 2
3 import com.diligrp.cashier.mall.model.MallBizOrderAddress; 3 import com.diligrp.cashier.mall.model.MallBizOrderAddress;
4 import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport; 4 import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport;
  5 +import org.apache.ibatis.annotations.Param;
  6 +
  7 +import java.util.List;
5 8
6 /** 9 /**
7 * MallBizOrderAddressDao 10 * MallBizOrderAddressDao
@@ -20,4 +23,6 @@ public interface MallBizOrderAddressDao extends MybatisMapperSupport { @@ -20,4 +23,6 @@ public interface MallBizOrderAddressDao extends MybatisMapperSupport {
20 int updateByPrimaryKeySelective(MallBizOrderAddress record); 23 int updateByPrimaryKeySelective(MallBizOrderAddress record);
21 24
22 int updateByPrimaryKey(MallBizOrderAddress record); 25 int updateByPrimaryKey(MallBizOrderAddress record);
  26 +
  27 + void batchInsert(@Param("list") List<MallBizOrderAddress> mallBizOrderAddress);
23 } 28 }
cashier-mall/src/main/java/com/diligrp/cashier/mall/dao/MallBizOrderDao.java
@@ -5,6 +5,8 @@ import com.diligrp.cashier.mall.model.MallBizOrder; @@ -5,6 +5,8 @@ import com.diligrp.cashier.mall.model.MallBizOrder;
5 import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport; 5 import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport;
6 import org.apache.ibatis.annotations.Param; 6 import org.apache.ibatis.annotations.Param;
7 7
  8 +import java.util.List;
  9 +
8 /** 10 /**
9 * MallBizOrderDao 11 * MallBizOrderDao
10 * 12 *
@@ -26,4 +28,6 @@ public interface MallBizOrderDao extends MybatisMapperSupport { @@ -26,4 +28,6 @@ public interface MallBizOrderDao extends MybatisMapperSupport {
26 int update(MallBizOrder mallBizOrder); 28 int update(MallBizOrder mallBizOrder);
27 29
28 MallBizOrder getByOrderId(@Param("orderId") String orderId); 30 MallBizOrder getByOrderId(@Param("orderId") String orderId);
  31 +
  32 + void batchInsert(@Param("list") List<MallBizOrder> mallBizOrders);
29 } 33 }
cashier-mall/src/main/java/com/diligrp/cashier/mall/dao/MallBizPaymentDao.java
@@ -20,6 +20,4 @@ public interface MallBizPaymentDao extends MybatisMapperSupport { @@ -20,6 +20,4 @@ public interface MallBizPaymentDao extends MybatisMapperSupport {
20 int updateByPrimaryKeySelective(MallBizPayment record); 20 int updateByPrimaryKeySelective(MallBizPayment record);
21 21
22 int updateByPrimaryKey(MallBizPayment record); 22 int updateByPrimaryKey(MallBizPayment record);
23 -  
24 - MallBizPayment getMallBizPayment(MallBizPayment mallBizPayment);  
25 } 23 }
cashier-mall/src/main/java/com/diligrp/cashier/mall/dao/MallBizPaymentOrderDao.java 0 → 100644
  1 +package com.diligrp.cashier.mall.dao;
  2 +
  3 +import com.diligrp.cashier.mall.model.MallBizPaymentOrder;
  4 +import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport;
  5 +import org.apache.ibatis.annotations.Param;
  6 +
  7 +import java.util.List;
  8 +
  9 +/**
  10 + * MallBizPaymentOrderDao
  11 + * @author dengwei
  12 + */
  13 +public interface MallBizPaymentOrderDao extends MybatisMapperSupport {
  14 + int deleteByPrimaryKey(Long id);
  15 +
  16 + int insert(MallBizPaymentOrder record);
  17 +
  18 + int insertSelective(MallBizPaymentOrder record);
  19 +
  20 + MallBizPaymentOrder selectByPrimaryKey(Long id);
  21 +
  22 + int updateByPrimaryKeySelective(MallBizPaymentOrder record);
  23 +
  24 + int updateByPrimaryKey(MallBizPaymentOrder record);
  25 +
  26 + void batchInsert(@Param("list") List<MallBizPaymentOrder> mallBizPaymentOrders);
  27 +
  28 + MallBizPaymentOrder getMallBizPaymentOrder(MallBizPaymentOrder mallBizPaymentOrder);
  29 +}
cashier-mall/src/main/java/com/diligrp/cashier/mall/dao/MallBizRefundDao.java
@@ -16,4 +16,6 @@ public interface MallBizRefundDao extends MybatisMapperSupport { @@ -16,4 +16,6 @@ public interface MallBizRefundDao extends MybatisMapperSupport {
16 int updateByPrimaryKeySelective(MallBizRefund record); 16 int updateByPrimaryKeySelective(MallBizRefund record);
17 17
18 int updateByPrimaryKey(MallBizRefund record); 18 int updateByPrimaryKey(MallBizRefund record);
  19 +
  20 + MallBizRefund getMallBizRefund(MallBizRefund refund);
19 } 21 }
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/co/RefundStatusCO.java 0 → 100644
  1 +package com.diligrp.cashier.mall.domain.rtmall.co;
  2 +
  3 +import com.diligrp.cashier.mall.domain.rtmall.RtMarkBaseCO;
  4 +import jakarta.validation.constraints.NotBlank;
  5 +
  6 +/**
  7 + * @ClassName RefundStatusCO.java
  8 + * @author dengwei
  9 + * @version 1.0.0
  10 + * @Description RefundStatusCO
  11 + * 查询退款状态
  12 + */
  13 +public class RefundStatusCO extends RtMarkBaseCO {
  14 + /**
  15 + * 订单ID
  16 + */
  17 + @NotBlank(message = "order_id is required")
  18 + private String orderId;
  19 +
  20 + /**
  21 + * 业务侧退款单号
  22 + */
  23 + @NotBlank(message = "refund bn is required")
  24 + private String refundBn;
  25 +
  26 + /**
  27 + * 会员编号
  28 + */
  29 + @NotBlank(message = "user_code is required")
  30 + private String userCode;
  31 +
  32 + /**
  33 + * 公司ID
  34 + */
  35 + private String companyCode;
  36 +
  37 +
  38 + public String getOrderId() {
  39 + return orderId;
  40 + }
  41 +
  42 + public void setOrderId(String orderId) {
  43 + this.orderId = orderId;
  44 + }
  45 +
  46 + public String getUserCode() {
  47 + return userCode;
  48 + }
  49 +
  50 + public void setUserCode(String userCode) {
  51 + this.userCode = userCode;
  52 + }
  53 +
  54 + public String getCompanyCode() {
  55 + return companyCode;
  56 + }
  57 +
  58 + public void setCompanyCode(String companyCode) {
  59 + this.companyCode = companyCode;
  60 + }
  61 +
  62 + public String getRefundBn() {
  63 + return refundBn;
  64 + }
  65 +
  66 + public void setRefundBn(String refundBn) {
  67 + this.refundBn = refundBn;
  68 + }
  69 +}
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/vo/RefundVO.java 0 → 100644
  1 +package com.diligrp.cashier.mall.domain.rtmall.vo;
  2 +
  3 +import com.diligrp.cashier.shared.jackson.serialization.DateToSecondSerializer;
  4 +import com.fasterxml.jackson.databind.PropertyNamingStrategies;
  5 +import com.fasterxml.jackson.databind.annotation.JsonNaming;
  6 +import com.fasterxml.jackson.databind.annotation.JsonSerialize;
  7 +
  8 +import java.time.LocalDateTime;
  9 +
  10 +/**
  11 + * @ClassName RefundStatusVO.java
  12 + * @author dengwei
  13 + * @version 1.0.0
  14 + * @Description RefundStatusVO
  15 + */
  16 +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
  17 +public class RefundVO {
  18 + /**
  19 + * 商户支付单号
  20 + */
  21 + private String outTradeNo;
  22 +
  23 + /**
  24 + * 商户退款单号
  25 + */
  26 + private String outRefundNo;
  27 +
  28 + /**
  29 + * 退款状态
  30 + */
  31 + private Integer refundStatus;
  32 +
  33 + /**
  34 + * 退款金额
  35 + */
  36 + private Long refundFee;
  37 +
  38 + /**
  39 + * 退款时间
  40 + */
  41 + @JsonSerialize(using = DateToSecondSerializer.class)
  42 + private LocalDateTime refundTime;
  43 +
  44 + /**
  45 + * 拒绝原因
  46 + */
  47 + private String refuseReason;
  48 +
  49 + public String getOutTradeNo() {
  50 + return outTradeNo;
  51 + }
  52 +
  53 + public void setOutTradeNo(String outTradeNo) {
  54 + this.outTradeNo = outTradeNo;
  55 + }
  56 +
  57 + public String getOutRefundNo() {
  58 + return outRefundNo;
  59 + }
  60 +
  61 + public void setOutRefundNo(String outRefundNo) {
  62 + this.outRefundNo = outRefundNo;
  63 + }
  64 +
  65 + public Integer getRefundStatus() {
  66 + return refundStatus;
  67 + }
  68 +
  69 + public void setRefundStatus(Integer refundStatus) {
  70 + this.refundStatus = refundStatus;
  71 + }
  72 +
  73 + public Long getRefundFee() {
  74 + return refundFee;
  75 + }
  76 +
  77 + public void setRefundFee(Long refundFee) {
  78 + this.refundFee = refundFee;
  79 + }
  80 +
  81 + public LocalDateTime getRefundTime() {
  82 + return refundTime;
  83 + }
  84 +
  85 + public void setRefundTime(LocalDateTime refundTime) {
  86 + this.refundTime = refundTime;
  87 + }
  88 +
  89 + public String getRefuseReason() {
  90 + return refuseReason;
  91 + }
  92 +
  93 + public void setRefuseReason(String refuseReason) {
  94 + this.refuseReason = refuseReason;
  95 + }
  96 +}
cashier-mall/src/main/java/com/diligrp/cashier/mall/model/MallBizOrder.java
@@ -10,9 +10,13 @@ import com.diligrp.cashier.shared.domain.BaseDO; @@ -10,9 +10,13 @@ import com.diligrp.cashier.shared.domain.BaseDO;
10 import com.diligrp.cashier.shared.util.SpringContextUtils; 10 import com.diligrp.cashier.shared.util.SpringContextUtils;
11 import com.diligrp.cashier.trade.type.SnowflakeKey; 11 import com.diligrp.cashier.trade.type.SnowflakeKey;
12 import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 12 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  13 +import org.apache.commons.lang3.ObjectUtils;
  14 +import org.apache.commons.lang3.StringUtils;
  15 +import org.apache.commons.lang3.math.NumberUtils;
13 import org.springframework.beans.BeanUtils; 16 import org.springframework.beans.BeanUtils;
14 17
15 import java.time.LocalDateTime; 18 import java.time.LocalDateTime;
  19 +import java.util.Arrays;
16 import java.util.List; 20 import java.util.List;
17 import java.util.Optional; 21 import java.util.Optional;
18 22
@@ -128,8 +132,16 @@ public class MallBizOrder extends BaseDO { @@ -128,8 +132,16 @@ public class MallBizOrder extends BaseDO {
128 */ 132 */
129 private MallBizOrderAddress mallBizOrderAddress; 133 private MallBizOrderAddress mallBizOrderAddress;
130 134
  135 + /**
  136 + * 订单商品信息
  137 + */
131 private List<MallBizOrderItem> mallBizOrderItems; 138 private List<MallBizOrderItem> mallBizOrderItems;
132 139
  140 + /**
  141 + * 订单支付信息
  142 + */
  143 + private List<MallBizPaymentOrder> mallBizPaymentOrders;
  144 +
133 public String getOrderNo() { 145 public String getOrderNo() {
134 return orderNo; 146 return orderNo;
135 } 147 }
@@ -298,48 +310,82 @@ public class MallBizOrder extends BaseDO { @@ -298,48 +310,82 @@ public class MallBizOrder extends BaseDO {
298 this.mallBizOrderItems = mallBizOrderItems; 310 this.mallBizOrderItems = mallBizOrderItems;
299 } 311 }
300 312
  313 + public List<MallBizPaymentOrder> getMallBizPaymentOrders() {
  314 + return mallBizPaymentOrders;
  315 + }
  316 +
  317 + public void setMallBizPaymentOrders(List<MallBizPaymentOrder> mallBizPaymentOrders) {
  318 + this.mallBizPaymentOrders = mallBizPaymentOrders;
  319 + }
  320 +
301 /** 321 /**
302 * of 322 * of
303 */ 323 */
304 - public static MallBizOrder of(OrderCO orderCo, AuthLoginCO authLogin) {  
305 - orderCo.setVersion(null);  
306 - MallBizOrder mallBizOrder = new MallBizOrder();  
307 - BeanUtils.copyProperties(orderCo, mallBizOrder);  
308 - 324 + public static List<MallBizOrder> of(final List<OrderCO> orderCos,
  325 + final AuthLoginCO authLogin) {
309 MallSnowflakeKeyManager snowflakeKeyManager = SpringContextUtils.getBean(MallSnowflakeKeyManager.class); 326 MallSnowflakeKeyManager snowflakeKeyManager = SpringContextUtils.getBean(MallSnowflakeKeyManager.class);
310 - mallBizOrder.setId(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_ORDER_ID));  
311 - mallBizOrder.setOrderNo(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_ORDER_ID).toString());  
312 - BeanUtils.copyProperties(authLogin, mallBizOrder);  
313 -  
314 - Optional.ofNullable(orderCo.getReceiverInfo())  
315 - .ifPresent(receiverInfo -> {  
316 - MallBizOrderAddress address = new MallBizOrderAddress();  
317 - mallBizOrder.setMallBizOrderAddress(address);  
318 -  
319 - address.setId(mallBizOrder.getId());  
320 - address.setReceiverName(receiverInfo.getReceiverName());  
321 - address.setReceiverMobile(receiverInfo.getReceiverMobile());  
322 - address.setReceiverAddress(receiverInfo.getReceiverAddress());  
323 - });  
324 -  
325 - Optional.ofNullable(orderCo.getItemList())  
326 - .ifPresent(itemList -> {  
327 - List<MallBizOrderItem> orderItems = itemList  
328 - .stream()  
329 - .map(itemCo -> {  
330 - MallBizOrderItem item = new MallBizOrderItem();  
331 - BeanUtils.copyProperties(itemCo, item);  
332 -  
333 - item.setId(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_ORDER_ID));  
334 - item.setBizOrderId(mallBizOrder.getId());  
335 - item.setOrderId(orderCo.getOrderId());  
336 - item.setShopCode(orderCo.getShopCode());  
337 - item.setShopName(orderCo.getShopName());  
338 - return item;  
339 - }).toList();  
340 - mallBizOrder.setMallBizOrderItems(orderItems);  
341 - });  
342 - return mallBizOrder; 327 + List<MallBizOrder> mallBizOrders = orderCos
  328 + .stream()
  329 + .map(orderCo -> {
  330 + orderCo.setVersion(null);
  331 + MallBizOrder mallBizOrder = new MallBizOrder();
  332 + BeanUtils.copyProperties(orderCo, mallBizOrder);
  333 +
  334 + mallBizOrder.setId(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_ORDER_ID));
  335 + mallBizOrder.setOrderNo(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_ORDER_ID).toString());
  336 + BeanUtils.copyProperties(authLogin, mallBizOrder);
  337 +
  338 + // 订单地址
  339 + Optional.ofNullable(orderCo.getReceiverInfo())
  340 + .ifPresent(receiverInfo -> {
  341 + MallBizOrderAddress address = new MallBizOrderAddress();
  342 + mallBizOrder.setMallBizOrderAddress(address);
  343 +
  344 + address.setId(mallBizOrder.getId());
  345 + address.setReceiverName(receiverInfo.getReceiverName());
  346 + address.setReceiverMobile(receiverInfo.getReceiverMobile());
  347 + address.setReceiverAddress(receiverInfo.getReceiverAddress());
  348 + });
  349 +
  350 + // 订单商品
  351 + Optional.ofNullable(orderCo.getItemList())
  352 + .ifPresent(itemList -> {
  353 + List<MallBizOrderItem> orderItems = itemList
  354 + .stream()
  355 + .map(itemCo -> {
  356 + MallBizOrderItem item = new MallBizOrderItem();
  357 + BeanUtils.copyProperties(itemCo, item);
  358 +
  359 + item.setId(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_ORDER_ID));
  360 + item.setBizOrderId(mallBizOrder.getId());
  361 + item.setOrderId(orderCo.getOrderId());
  362 + item.setShopCode(orderCo.getShopCode());
  363 + item.setShopName(orderCo.getShopName());
  364 + return item;
  365 + }).toList();
  366 + mallBizOrder.setMallBizOrderItems(orderItems);
  367 + });
  368 +
  369 + // 结算订单-支持多个
  370 + Optional.ofNullable(orderCo.getTradeId())
  371 + .map(vo -> StringUtils.split(vo, ","))
  372 + .ifPresent(tradeIds -> {
  373 + List<MallBizPaymentOrder> bizPaymentOrders = Arrays.stream(tradeIds)
  374 + .map(tradeId -> {
  375 + MallBizPaymentOrder paymentOrder = new MallBizPaymentOrder();
  376 +
  377 + paymentOrder.setId(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_PAYMENT_ID));
  378 + paymentOrder.setBizOrderId(mallBizOrder.getId());
  379 + paymentOrder.setOrderId(orderCo.getOrderId());
  380 + paymentOrder.setTradeId(tradeId);
  381 + paymentOrder.setPayFee(ObjectUtils.defaultIfNull(orderCo.getTotalAmount(), NumberUtils.LONG_ZERO));
  382 + return paymentOrder;
  383 + }).toList();
  384 + mallBizOrder.setMallBizPaymentOrders(bizPaymentOrders);
  385 + });
  386 + return mallBizOrder;
  387 + }).toList();
  388 + return mallBizOrders;
343 } 389 }
344 390
345 /** 391 /**
cashier-mall/src/main/java/com/diligrp/cashier/mall/model/MallBizPayment.java
1 package com.diligrp.cashier.mall.model; 1 package com.diligrp.cashier.mall.model;
2 2
3 -import com.diligrp.cashier.mall.domain.rtmall.co.OrderCO;  
4 import com.diligrp.cashier.mall.domain.rtmall.vo.OrderPaymentVO; 3 import com.diligrp.cashier.mall.domain.rtmall.vo.OrderPaymentVO;
5 -import com.diligrp.cashier.mall.property.MallDynamicProperty;  
6 import com.diligrp.cashier.mall.property.RtMallDynamicProperty; 4 import com.diligrp.cashier.mall.property.RtMallDynamicProperty;
7 import com.diligrp.cashier.mall.type.PayState; 5 import com.diligrp.cashier.mall.type.PayState;
8 import com.diligrp.cashier.mall.util.MallSnowflakeKeyManager; 6 import com.diligrp.cashier.mall.util.MallSnowflakeKeyManager;
@@ -11,6 +9,8 @@ import com.diligrp.cashier.shared.util.SpringContextUtils; @@ -11,6 +9,8 @@ import com.diligrp.cashier.shared.util.SpringContextUtils;
11 import com.diligrp.cashier.trade.type.SnowflakeKey; 9 import com.diligrp.cashier.trade.type.SnowflakeKey;
12 10
13 import java.time.LocalDateTime; 11 import java.time.LocalDateTime;
  12 +import java.util.List;
  13 +import java.util.stream.Collectors;
14 14
15 /** 15 /**
16 * MallBizPayment 16 * MallBizPayment
@@ -24,17 +24,17 @@ public class MallBizPayment extends BaseDO { @@ -24,17 +24,17 @@ public class MallBizPayment extends BaseDO {
24 private String payTradeNo; 24 private String payTradeNo;
25 25
26 /** 26 /**
27 - * 订单id(biz_order) 27 + * 订单id集合(mall_biz_order.id)
28 */ 28 */
29 - private Long bizOrderId; 29 + private String bizOrderId;
30 30
31 /** 31 /**
32 - * 业务侧订单号 32 + * 业务侧订单号(多个)
33 */ 33 */
34 private String orderId; 34 private String orderId;
35 35
36 /** 36 /**
37 - * 业务侧支付单号 37 + * 业务侧支付单号(多个)
38 */ 38 */
39 private String tradeId; 39 private String tradeId;
40 40
@@ -44,7 +44,7 @@ public class MallBizPayment extends BaseDO { @@ -44,7 +44,7 @@ public class MallBizPayment extends BaseDO {
44 private String payPaymentId; 44 private String payPaymentId;
45 45
46 /** 46 /**
47 - * 商户id 47 + * 商户code
48 */ 48 */
49 private String mchId; 49 private String mchId;
50 50
@@ -74,6 +74,11 @@ public class MallBizPayment extends BaseDO { @@ -74,6 +74,11 @@ public class MallBizPayment extends BaseDO {
74 private Long fundAccountId; 74 private Long fundAccountId;
75 75
76 /** 76 /**
  77 + * 第三方openid
  78 + */
  79 + private String openId;
  80 +
  81 + /**
77 * 支付金额(分) 82 * 支付金额(分)
78 */ 83 */
79 private Long payFee; 84 private Long payFee;
@@ -91,6 +96,7 @@ public class MallBizPayment extends BaseDO { @@ -91,6 +96,7 @@ public class MallBizPayment extends BaseDO {
91 96
92 /** 97 /**
93 * 支付渠道(微信 园区卡) 98 * 支付渠道(微信 园区卡)
  99 + * @see com.diligrp.cashier.mall.type.PaymentChanel
94 */ 100 */
95 private Integer channelId; 101 private Integer channelId;
96 102
@@ -112,27 +118,36 @@ public class MallBizPayment extends BaseDO { @@ -112,27 +118,36 @@ public class MallBizPayment extends BaseDO {
112 this.tradeId = tradeId; 118 this.tradeId = tradeId;
113 } 119 }
114 120
115 - public static MallBizPayment of(final OrderCO orderCo,  
116 - final MallBizOrder mallBizOrder) { 121 + /**
  122 + * of
  123 + */
  124 + public static MallBizPayment of(final List<MallBizOrder> mallBizOrder) {
117 MallSnowflakeKeyManager snowflakeKeyManager = SpringContextUtils.getBean(MallSnowflakeKeyManager.class); 125 MallSnowflakeKeyManager snowflakeKeyManager = SpringContextUtils.getBean(MallSnowflakeKeyManager.class);
118 126
119 MallBizPayment mallBizPayment = new MallBizPayment(); 127 MallBizPayment mallBizPayment = new MallBizPayment();
120 mallBizPayment.setId(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_PAYMENT_ID)); 128 mallBizPayment.setId(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_PAYMENT_ID));
121 mallBizPayment.setPayTradeNo(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_PAYMENT_ID).toString()); 129 mallBizPayment.setPayTradeNo(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_PAYMENT_ID).toString());
122 - mallBizPayment.setBizOrderId(mallBizOrder.getId());  
123 - mallBizPayment.setOrderId(orderCo.getOrderId());  
124 - mallBizPayment.setTradeId(orderCo.getTradeId());  
125 - mallBizPayment.setPayFee(orderCo.getTotalAmount());  
126 - mallBizPayment.setMchId(mallBizOrder.getMchId()); 130 + mallBizPayment.setBizOrderId(mallBizOrder.stream().map(vo -> vo.getId().toString()).collect(Collectors.joining(",")));
  131 + mallBizPayment.setOrderId(mallBizOrder.stream().map(MallBizOrder::getOrderId).collect(Collectors.joining(",")));
  132 + mallBizPayment.setTradeId(mallBizOrder.stream().flatMap(vo -> vo.getMallBizPaymentOrders().stream().map(MallBizPaymentOrder::getTradeId)).collect(Collectors.joining(",")));
  133 + mallBizPayment.setMchId(mallBizOrder.getFirst().getMchId());
127 134
128 - // TODO 2025/12/29: 支付信息  
129 - mallBizPayment.setPayPaymentId("6666666666");  
130 - String cashierUrl = SpringContextUtils.getBean(MallDynamicProperty.class).getUrl();  
131 - mallBizPayment.setCashierUrl(cashierUrl.concat("?outTradeNo=").concat(mallBizPayment.getPayTradeNo())); 135 + long sum = mallBizOrder.stream().flatMap(vo -> vo.getMallBizPaymentOrders().stream().map(MallBizPaymentOrder::getPayFee)).mapToLong(vo -> vo).sum();
  136 + mallBizPayment.setPayFee(sum);
132 137
  138 + // 完善payment_callback
133 RtMallDynamicProperty rtMallDynamicProperty = SpringContextUtils.getBean(RtMallDynamicProperty.class); 139 RtMallDynamicProperty rtMallDynamicProperty = SpringContextUtils.getBean(RtMallDynamicProperty.class);
134 - RtMallDynamicProperty.AppSecretDynamicProperty property = rtMallDynamicProperty.getBySourceAndType(mallBizOrder.getSource(), mallBizOrder.getOrderType()); 140 + RtMallDynamicProperty.AppSecretDynamicProperty property = rtMallDynamicProperty.getBySourceAndType(mallBizOrder.getFirst().getSource(), mallBizOrder.getFirst().getOrderType());
135 mallBizPayment.setPaymentCallback(property.getCallbackDomain()); 141 mallBizPayment.setPaymentCallback(property.getCallbackDomain());
  142 +
  143 + // 完善mall_biz_payment_order
  144 + List<MallBizPaymentOrder> bizPaymentOrders = mallBizOrder.stream()
  145 + .flatMap(vo -> vo.getMallBizPaymentOrders().stream())
  146 + .toList();
  147 + bizPaymentOrders.forEach(vo -> {
  148 + vo.setBizPaymentId(mallBizPayment.getId());
  149 + vo.setPayTradeNo(mallBizPayment.getPayTradeNo());
  150 + });
136 return mallBizPayment; 151 return mallBizPayment;
137 } 152 }
138 153
@@ -141,14 +156,14 @@ public class MallBizPayment extends BaseDO { @@ -141,14 +156,14 @@ public class MallBizPayment extends BaseDO {
141 } 156 }
142 157
143 public void setPayTradeNo(String payTradeNo) { 158 public void setPayTradeNo(String payTradeNo) {
144 - this.payTradeNo = payTradeNo == null ? null : payTradeNo.trim(); 159 + this.payTradeNo = payTradeNo;
145 } 160 }
146 161
147 - public Long getBizOrderId() { 162 + public String getBizOrderId() {
148 return bizOrderId; 163 return bizOrderId;
149 } 164 }
150 165
151 - public void setBizOrderId(Long bizOrderId) { 166 + public void setBizOrderId(String bizOrderId) {
152 this.bizOrderId = bizOrderId; 167 this.bizOrderId = bizOrderId;
153 } 168 }
154 169
@@ -157,7 +172,7 @@ public class MallBizPayment extends BaseDO { @@ -157,7 +172,7 @@ public class MallBizPayment extends BaseDO {
157 } 172 }
158 173
159 public void setOrderId(String orderId) { 174 public void setOrderId(String orderId) {
160 - this.orderId = orderId == null ? null : orderId.trim(); 175 + this.orderId = orderId;
161 } 176 }
162 177
163 public String getTradeId() { 178 public String getTradeId() {
@@ -165,7 +180,7 @@ public class MallBizPayment extends BaseDO { @@ -165,7 +180,7 @@ public class MallBizPayment extends BaseDO {
165 } 180 }
166 181
167 public void setTradeId(String tradeId) { 182 public void setTradeId(String tradeId) {
168 - this.tradeId = tradeId == null ? null : tradeId.trim(); 183 + this.tradeId = tradeId;
169 } 184 }
170 185
171 public String getPayPaymentId() { 186 public String getPayPaymentId() {
@@ -173,7 +188,7 @@ public class MallBizPayment extends BaseDO { @@ -173,7 +188,7 @@ public class MallBizPayment extends BaseDO {
173 } 188 }
174 189
175 public void setPayPaymentId(String payPaymentId) { 190 public void setPayPaymentId(String payPaymentId) {
176 - this.payPaymentId = payPaymentId == null ? null : payPaymentId.trim(); 191 + this.payPaymentId = payPaymentId;
177 } 192 }
178 193
179 public String getMchId() { 194 public String getMchId() {
@@ -181,7 +196,7 @@ public class MallBizPayment extends BaseDO { @@ -181,7 +196,7 @@ public class MallBizPayment extends BaseDO {
181 } 196 }
182 197
183 public void setMchId(String mchId) { 198 public void setMchId(String mchId) {
184 - this.mchId = mchId == null ? null : mchId.trim(); 199 + this.mchId = mchId;
185 } 200 }
186 201
187 public String getCardNo() { 202 public String getCardNo() {
@@ -189,7 +204,7 @@ public class MallBizPayment extends BaseDO { @@ -189,7 +204,7 @@ public class MallBizPayment extends BaseDO {
189 } 204 }
190 205
191 public void setCardNo(String cardNo) { 206 public void setCardNo(String cardNo) {
192 - this.cardNo = cardNo == null ? null : cardNo.trim(); 207 + this.cardNo = cardNo;
193 } 208 }
194 209
195 public String getUsername() { 210 public String getUsername() {
@@ -197,7 +212,7 @@ public class MallBizPayment extends BaseDO { @@ -197,7 +212,7 @@ public class MallBizPayment extends BaseDO {
197 } 212 }
198 213
199 public void setUsername(String username) { 214 public void setUsername(String username) {
200 - this.username = username == null ? null : username.trim(); 215 + this.username = username;
201 } 216 }
202 217
203 public Long getUserId() { 218 public Long getUserId() {
@@ -224,6 +239,14 @@ public class MallBizPayment extends BaseDO { @@ -224,6 +239,14 @@ public class MallBizPayment extends BaseDO {
224 this.fundAccountId = fundAccountId; 239 this.fundAccountId = fundAccountId;
225 } 240 }
226 241
  242 + public String getOpenId() {
  243 + return openId;
  244 + }
  245 +
  246 + public void setOpenId(String openId) {
  247 + this.openId = openId;
  248 + }
  249 +
227 public Long getPayFee() { 250 public Long getPayFee() {
228 return payFee; 251 return payFee;
229 } 252 }
@@ -261,7 +284,7 @@ public class MallBizPayment extends BaseDO { @@ -261,7 +284,7 @@ public class MallBizPayment extends BaseDO {
261 } 284 }
262 285
263 public void setCashierUrl(String cashierUrl) { 286 public void setCashierUrl(String cashierUrl) {
264 - this.cashierUrl = cashierUrl == null ? null : cashierUrl.trim(); 287 + this.cashierUrl = cashierUrl;
265 } 288 }
266 289
267 public String getPaymentCallback() { 290 public String getPaymentCallback() {
@@ -269,7 +292,7 @@ public class MallBizPayment extends BaseDO { @@ -269,7 +292,7 @@ public class MallBizPayment extends BaseDO {
269 } 292 }
270 293
271 public void setPaymentCallback(String paymentCallback) { 294 public void setPaymentCallback(String paymentCallback) {
272 - this.paymentCallback = paymentCallback == null ? null : paymentCallback.trim(); 295 + this.paymentCallback = paymentCallback;
273 } 296 }
274 297
275 /** 298 /**
cashier-mall/src/main/java/com/diligrp/cashier/mall/model/MallBizPaymentOrder.java 0 → 100644
  1 +package com.diligrp.cashier.mall.model;
  2 +
  3 +import com.diligrp.cashier.mall.domain.rtmall.vo.OrderPaymentVO;
  4 +import com.diligrp.cashier.shared.domain.BaseDO;
  5 +
  6 +import java.time.LocalDateTime;
  7 +
  8 +/**
  9 + * 业务侧支付单
  10 + */
  11 +public class MallBizPaymentOrder extends BaseDO {
  12 +
  13 + /**
  14 + * 结算id(mall_biz_paymen.id)
  15 + */
  16 + private Long bizPaymentId;
  17 +
  18 + /**
  19 + * 支付单号(mall_biz_paymen.pay_trade_no)
  20 + */
  21 + private String payTradeNo;
  22 +
  23 + /**
  24 + * 订单id(mall_biz_order.id)
  25 + */
  26 + private Long bizOrderId;
  27 +
  28 + /**
  29 + * 业务侧订单号
  30 + */
  31 + private String orderId;
  32 +
  33 + /**
  34 + * 业务侧支付单号
  35 + */
  36 + private String tradeId;
  37 +
  38 + /**
  39 + * dili交易流水号(mall_biz_payment.pay_payment_id)
  40 + */
  41 + private String payPaymentId;
  42 +
  43 + /**
  44 + * 支付金额分
  45 + */
  46 + private Long payFee;
  47 +
  48 + /**
  49 + * 支付状态
  50 + * @see com.diligrp.cashier.mall.type.PayState
  51 + */
  52 + private Integer payState;
  53 +
  54 + /**
  55 + * 支付时间
  56 + */
  57 + private LocalDateTime payTime;
  58 +
  59 + public MallBizPaymentOrder() {
  60 + }
  61 +
  62 + public MallBizPaymentOrder(String orderId, String tradeId) {
  63 + this.orderId = orderId;
  64 + this.tradeId = tradeId;
  65 + }
  66 +
  67 + public Long getBizPaymentId() {
  68 + return bizPaymentId;
  69 + }
  70 +
  71 + public void setBizPaymentId(Long bizPaymentId) {
  72 + this.bizPaymentId = bizPaymentId;
  73 + }
  74 +
  75 + public String getPayTradeNo() {
  76 + return payTradeNo;
  77 + }
  78 +
  79 + public void setPayTradeNo(String payTradeNo) {
  80 + this.payTradeNo = payTradeNo;
  81 + }
  82 +
  83 + public Long getBizOrderId() {
  84 + return bizOrderId;
  85 + }
  86 +
  87 + public void setBizOrderId(Long bizOrderId) {
  88 + this.bizOrderId = bizOrderId;
  89 + }
  90 +
  91 + public String getOrderId() {
  92 + return orderId;
  93 + }
  94 +
  95 + public void setOrderId(String orderId) {
  96 + this.orderId = orderId;
  97 + }
  98 +
  99 + public String getTradeId() {
  100 + return tradeId;
  101 + }
  102 +
  103 + public void setTradeId(String tradeId) {
  104 + this.tradeId = tradeId;
  105 + }
  106 +
  107 + public String getPayPaymentId() {
  108 + return payPaymentId;
  109 + }
  110 +
  111 + public void setPayPaymentId(String payPaymentId) {
  112 + this.payPaymentId = payPaymentId;
  113 + }
  114 +
  115 + public Long getPayFee() {
  116 + return payFee;
  117 + }
  118 +
  119 + public void setPayFee(Long payFee) {
  120 + this.payFee = payFee;
  121 + }
  122 +
  123 + public Integer getPayState() {
  124 + return payState;
  125 + }
  126 +
  127 + public void setPayState(Integer payState) {
  128 + this.payState = payState;
  129 + }
  130 +
  131 + public LocalDateTime getPayTime() {
  132 + return payTime;
  133 + }
  134 +
  135 + public void setPayTime(LocalDateTime payTime) {
  136 + this.payTime = payTime;
  137 + }
  138 +
  139 + /**
  140 + * ofOrderPaymentVO
  141 + *
  142 + */
  143 + public OrderPaymentVO ofOrderPaymentVO() {
  144 + OrderPaymentVO orderPaymentVO = new OrderPaymentVO();
  145 + orderPaymentVO.setOutTradeNo(payTradeNo);
  146 + orderPaymentVO.setPayStatus(payState);
  147 + orderPaymentVO.setPayFee(payFee);
  148 + orderPaymentVO.setPayTime(payTime);
  149 + orderPaymentVO.setTransactionId(payPaymentId);
  150 + return orderPaymentVO;
  151 + }
  152 +}
cashier-mall/src/main/java/com/diligrp/cashier/mall/model/MallBizRefund.java
1 package com.diligrp.cashier.mall.model; 1 package com.diligrp.cashier.mall.model;
2 2
3 import com.diligrp.cashier.mall.domain.rtmall.co.RefundCO; 3 import com.diligrp.cashier.mall.domain.rtmall.co.RefundCO;
  4 +import com.diligrp.cashier.mall.domain.rtmall.vo.RefundVO;
4 import com.diligrp.cashier.mall.property.RtMallDynamicProperty; 5 import com.diligrp.cashier.mall.property.RtMallDynamicProperty;
5 import com.diligrp.cashier.mall.type.RefundState; 6 import com.diligrp.cashier.mall.type.RefundState;
6 import com.diligrp.cashier.mall.util.MallSnowflakeKeyManager; 7 import com.diligrp.cashier.mall.util.MallSnowflakeKeyManager;
@@ -15,7 +16,7 @@ import java.util.Optional; @@ -15,7 +16,7 @@ import java.util.Optional;
15 16
16 /** 17 /**
17 * MallBizRefund 18 * MallBizRefund
18 - * 19 + * 退款数据量应该不会太大 主键自增即可
19 * @author dengwei 20 * @author dengwei
20 */ 21 */
21 public class MallBizRefund extends BaseDO { 22 public class MallBizRefund extends BaseDO {
@@ -285,16 +286,17 @@ public class MallBizRefund extends BaseDO { @@ -285,16 +286,17 @@ public class MallBizRefund extends BaseDO {
285 */ 286 */
286 public static MallBizRefund of(final RefundCO refundCo, 287 public static MallBizRefund of(final RefundCO refundCo,
287 final MallBizOrder mallBizOrder, 288 final MallBizOrder mallBizOrder,
288 - final MallBizPayment mallBizPayment) { 289 + final MallBizPaymentOrder mallBizPaymentOrder) {
289 MallSnowflakeKeyManager snowflakeKeyManager = SpringContextUtils.getBean(MallSnowflakeKeyManager.class); 290 MallSnowflakeKeyManager snowflakeKeyManager = SpringContextUtils.getBean(MallSnowflakeKeyManager.class);
290 291
291 MallBizRefund mallBizRefund = new MallBizRefund(); 292 MallBizRefund mallBizRefund = new MallBizRefund();
292 - mallBizRefund.setRefundTradeNo(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_REFUND_ID).toString());  
293 BeanUtils.copyProperties(refundCo, mallBizRefund); 293 BeanUtils.copyProperties(refundCo, mallBizRefund);
294 294
295 - mallBizRefund.setTradeId(mallBizPayment.getTradeId());  
296 - mallBizRefund.setPayTradeNo(mallBizPayment.getPayTradeNo());  
297 - mallBizRefund.setPayPaymentId(mallBizPayment.getPayPaymentId()); 295 + mallBizRefund.setOrderId(mallBizOrder.getOrderId());
  296 + mallBizRefund.setTradeId(mallBizPaymentOrder.getTradeId());
  297 + mallBizRefund.setPayTradeNo(mallBizPaymentOrder.getPayTradeNo());
  298 + mallBizRefund.setRefundTradeNo(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_REFUND_ID).toString());
  299 + mallBizRefund.setPayPaymentId(mallBizPaymentOrder.getPayPaymentId());
298 300
299 // 回调地址 301 // 回调地址
300 RtMallDynamicProperty rtMallDynamicProperty = SpringContextUtils.getBean(RtMallDynamicProperty.class); 302 RtMallDynamicProperty rtMallDynamicProperty = SpringContextUtils.getBean(RtMallDynamicProperty.class);
@@ -313,4 +315,19 @@ public class MallBizRefund extends BaseDO { @@ -313,4 +315,19 @@ public class MallBizRefund extends BaseDO {
313 }); 315 });
314 return mallBizRefund; 316 return mallBizRefund;
315 } 317 }
  318 +
  319 + /**
  320 + * ofRefundStatusVO VO
  321 + *
  322 + */
  323 + public RefundVO ofRefundVO() {
  324 + RefundVO refundVO = new RefundVO();
  325 + refundVO.setOutRefundNo(this.getRefundTradeNo());
  326 + refundVO.setOutTradeNo(this.getPayTradeNo());
  327 + refundVO.setRefundFee(this.getRefundFee());
  328 + refundVO.setRefundStatus(this.getRefundState());
  329 + refundVO.setRefundTime(this.getRefundTime());
  330 + refundVO.setRefuseReason(this.getRefuseReason());
  331 + return refundVO;
  332 + }
316 } 333 }
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/MallBizOrderService.java
@@ -8,6 +8,8 @@ import com.diligrp.cashier.mall.domain.rtmall.vo.OrderStatusCallbackVO; @@ -8,6 +8,8 @@ import com.diligrp.cashier.mall.domain.rtmall.vo.OrderStatusCallbackVO;
8 import com.diligrp.cashier.mall.domain.rtmall.vo.OrderSuccessVO; 8 import com.diligrp.cashier.mall.domain.rtmall.vo.OrderSuccessVO;
9 import com.diligrp.cashier.mall.model.MallBizOrder; 9 import com.diligrp.cashier.mall.model.MallBizOrder;
10 10
  11 +import java.util.List;
  12 +
11 /** 13 /**
12 * @ClassName MallBizOrderService.java 14 * @ClassName MallBizOrderService.java
13 * @author dengwei 15 * @author dengwei
@@ -19,7 +21,7 @@ public interface MallBizOrderService { @@ -19,7 +21,7 @@ public interface MallBizOrderService {
19 /** 21 /**
20 * createOrder 22 * createOrder
21 */ 23 */
22 - OrderSuccessVO createOrder(OrderCO orderCo); 24 + OrderSuccessVO createOrder(List<OrderCO> orderCos);
23 25
24 /** 26 /**
25 * info 27 * info
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/MallBizPaymentService.java
1 package com.diligrp.cashier.mall.service.biz; 1 package com.diligrp.cashier.mall.service.biz;
2 2
3 -import com.diligrp.cashier.mall.domain.rtmall.vo.OrderPaymentVO;  
4 import com.diligrp.cashier.mall.model.MallBizPayment; 3 import com.diligrp.cashier.mall.model.MallBizPayment;
  4 +import com.diligrp.cashier.mall.model.MallBizPaymentOrder;
5 5
6 /** 6 /**
7 * @ClassName MallBizPaymentService.java 7 * @ClassName MallBizPaymentService.java
@@ -13,5 +13,5 @@ import com.diligrp.cashier.mall.model.MallBizPayment; @@ -13,5 +13,5 @@ import com.diligrp.cashier.mall.model.MallBizPayment;
13 public interface MallBizPaymentService { 13 public interface MallBizPaymentService {
14 void save(MallBizPayment mallBizPayment); 14 void save(MallBizPayment mallBizPayment);
15 15
16 - MallBizPayment paymentInfo(MallBizPayment mallBizPayment); 16 + MallBizPaymentOrder paymentOrderInfo(MallBizPaymentOrder mallBizPaymentOrder);
17 } 17 }
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/MallBizRefundService.java
1 package com.diligrp.cashier.mall.service.biz; 1 package com.diligrp.cashier.mall.service.biz;
2 2
3 import com.diligrp.cashier.mall.domain.rtmall.co.RefundCO; 3 import com.diligrp.cashier.mall.domain.rtmall.co.RefundCO;
  4 +import com.diligrp.cashier.mall.domain.rtmall.co.RefundStatusCO;
  5 +import com.diligrp.cashier.mall.domain.rtmall.vo.RefundVO;
4 import com.diligrp.cashier.mall.domain.rtmall.vo.RefundSuccessVO; 6 import com.diligrp.cashier.mall.domain.rtmall.vo.RefundSuccessVO;
5 7
6 /** 8 /**
@@ -11,4 +13,6 @@ import com.diligrp.cashier.mall.domain.rtmall.vo.RefundSuccessVO; @@ -11,4 +13,6 @@ import com.diligrp.cashier.mall.domain.rtmall.vo.RefundSuccessVO;
11 */ 13 */
12 public interface MallBizRefundService { 14 public interface MallBizRefundService {
13 RefundSuccessVO refund(RefundCO refundCo); 15 RefundSuccessVO refund(RefundCO refundCo);
  16 +
  17 + RefundVO info(RefundStatusCO refundStatusCo);
14 } 18 }
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/PayNotifyService.java 0 → 100644
  1 +package com.diligrp.cashier.mall.service.biz;
  2 +
  3 +/**
  4 + * @ClassName PayNotifyService.java
  5 + * @author dengwei
  6 + * @version 1.0.0
  7 + * @Description PayNotifyService
  8 + */
  9 +public interface PayNotifyService {
  10 +}
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/impl/MallBizOrderServiceImpl.java
1 package com.diligrp.cashier.mall.service.biz.impl; 1 package com.diligrp.cashier.mall.service.biz.impl;
2 2
  3 +import cn.hutool.core.util.IdUtil;
3 import com.diligrp.cashier.mall.MallConstants; 4 import com.diligrp.cashier.mall.MallConstants;
4 import com.diligrp.cashier.mall.dao.MallBizOrderAddressDao; 5 import com.diligrp.cashier.mall.dao.MallBizOrderAddressDao;
5 import com.diligrp.cashier.mall.dao.MallBizOrderDao; 6 import com.diligrp.cashier.mall.dao.MallBizOrderDao;
6 import com.diligrp.cashier.mall.dao.MallBizOrderItemDao; 7 import com.diligrp.cashier.mall.dao.MallBizOrderItemDao;
  8 +import com.diligrp.cashier.mall.dao.MallBizPaymentOrderDao;
7 import com.diligrp.cashier.mall.domain.rtmall.co.AuthLoginCO; 9 import com.diligrp.cashier.mall.domain.rtmall.co.AuthLoginCO;
8 import com.diligrp.cashier.mall.domain.rtmall.co.OrderCO; 10 import com.diligrp.cashier.mall.domain.rtmall.co.OrderCO;
9 import com.diligrp.cashier.mall.domain.rtmall.co.OrderInfoCO; 11 import com.diligrp.cashier.mall.domain.rtmall.co.OrderInfoCO;
@@ -12,8 +14,7 @@ import com.diligrp.cashier.mall.domain.rtmall.vo.OrderPaymentVO; @@ -12,8 +14,7 @@ import com.diligrp.cashier.mall.domain.rtmall.vo.OrderPaymentVO;
12 import com.diligrp.cashier.mall.domain.rtmall.vo.OrderStatusCallbackVO; 14 import com.diligrp.cashier.mall.domain.rtmall.vo.OrderStatusCallbackVO;
13 import com.diligrp.cashier.mall.domain.rtmall.vo.OrderSuccessVO; 15 import com.diligrp.cashier.mall.domain.rtmall.vo.OrderSuccessVO;
14 import com.diligrp.cashier.mall.exception.RtMartMallException; 16 import com.diligrp.cashier.mall.exception.RtMartMallException;
15 -import com.diligrp.cashier.mall.model.MallBizOrder;  
16 -import com.diligrp.cashier.mall.model.MallBizPayment; 17 +import com.diligrp.cashier.mall.model.*;
17 import com.diligrp.cashier.mall.service.biz.MallBizOrderService; 18 import com.diligrp.cashier.mall.service.biz.MallBizOrderService;
18 import com.diligrp.cashier.mall.service.biz.MallBizPaymentService; 19 import com.diligrp.cashier.mall.service.biz.MallBizPaymentService;
19 import com.diligrp.cashier.mall.type.RtMarkErrorCode; 20 import com.diligrp.cashier.mall.type.RtMarkErrorCode;
@@ -26,6 +27,7 @@ import org.springframework.data.redis.core.RedisTemplate; @@ -26,6 +27,7 @@ import org.springframework.data.redis.core.RedisTemplate;
26 import org.springframework.stereotype.Service; 27 import org.springframework.stereotype.Service;
27 import org.springframework.transaction.annotation.Transactional; 28 import org.springframework.transaction.annotation.Transactional;
28 29
  30 +import java.util.List;
29 import java.util.Objects; 31 import java.util.Objects;
30 import java.util.Optional; 32 import java.util.Optional;
31 33
@@ -45,6 +47,8 @@ public class MallBizOrderServiceImpl implements MallBizOrderService { @@ -45,6 +47,8 @@ public class MallBizOrderServiceImpl implements MallBizOrderService {
45 @Resource 47 @Resource
46 private MallBizPaymentService mallBizPaymentService; 48 private MallBizPaymentService mallBizPaymentService;
47 @Resource 49 @Resource
  50 + private MallBizPaymentOrderDao mallBizPaymentOrderDao;
  51 + @Resource
48 private MallBizOrderDao mallBizOrderDao; 52 private MallBizOrderDao mallBizOrderDao;
49 @Resource 53 @Resource
50 private MallBizOrderAddressDao mallBizOrderAddressDao; 54 private MallBizOrderAddressDao mallBizOrderAddressDao;
@@ -57,17 +61,21 @@ public class MallBizOrderServiceImpl implements MallBizOrderService { @@ -57,17 +61,21 @@ public class MallBizOrderServiceImpl implements MallBizOrderService {
57 */ 61 */
58 @Override 62 @Override
59 @Transactional(rollbackFor = {Exception.class}) 63 @Transactional(rollbackFor = {Exception.class})
60 - public OrderSuccessVO createOrder(OrderCO orderCo) {  
61 - AuthLoginCO authLogin = getAuthLogin(orderCo.getUserCode()); 64 + public OrderSuccessVO createOrder(List<OrderCO> orderCos) {
  65 + AuthLoginCO authLogin = getAuthLogin(orderCos.getFirst().getUserCode());
62 66
63 // order 67 // order
64 - MallBizOrder mallBizOrder = MallBizOrder.of(orderCo, authLogin); 68 + List<MallBizOrder> mallBizOrders = MallBizOrder.of(orderCos, authLogin);
65 69
66 // payment 70 // payment
67 - MallBizPayment mallBizPayment = MallBizPayment.of(orderCo, mallBizOrder); 71 + MallBizPayment mallBizPayment = MallBizPayment.of(mallBizOrders);
  72 +
  73 + // TODO 2025/12/30: 预支付信息 收银台地址信息
  74 + mallBizPayment.setPayPaymentId(IdUtil.simpleUUID());
  75 + mallBizPayment.setCashierUrl("https://cashier.test.gszdtop.com?payTradeNo=" + mallBizPayment.getPayTradeNo());
68 76
69 // save 77 // save
70 - commonCreate(mallBizOrder, mallBizPayment); 78 + commonCreate(mallBizOrders, mallBizPayment);
71 return new OrderSuccessVO(mallBizPayment.getPayTradeNo(), mallBizPayment.getCashierUrl()); 79 return new OrderSuccessVO(mallBizPayment.getPayTradeNo(), mallBizPayment.getCashierUrl());
72 } 80 }
73 81
@@ -77,10 +85,10 @@ public class MallBizOrderServiceImpl implements MallBizOrderService { @@ -77,10 +85,10 @@ public class MallBizOrderServiceImpl implements MallBizOrderService {
77 */ 85 */
78 @Override 86 @Override
79 public OrderPaymentVO info(OrderInfoCO orderInfoCo) { 87 public OrderPaymentVO info(OrderInfoCO orderInfoCo) {
80 - MallBizPayment mallBizPayment = new MallBizPayment();  
81 - BeanUtils.copyProperties(orderInfoCo, mallBizPayment);  
82 - mallBizPayment = mallBizPaymentService.paymentInfo(mallBizPayment);  
83 - return mallBizPayment.ofOrderPaymentVO(); 88 + MallBizPaymentOrder mallBizPaymentOrder = new MallBizPaymentOrder();
  89 + BeanUtils.copyProperties(orderInfoCo, mallBizPaymentOrder);
  90 + mallBizPaymentOrder = mallBizPaymentService.paymentOrderInfo(mallBizPaymentOrder);
  91 + return mallBizPaymentOrder.ofOrderPaymentVO();
84 } 92 }
85 93
86 /** 94 /**
@@ -98,10 +106,10 @@ public class MallBizOrderServiceImpl implements MallBizOrderService { @@ -98,10 +106,10 @@ public class MallBizOrderServiceImpl implements MallBizOrderService {
98 throw new RtMartMallException(RtMarkErrorCode.E5004); 106 throw new RtMartMallException(RtMarkErrorCode.E5004);
99 } 107 }
100 108
101 - MallBizPayment mallBizPayment = new MallBizPayment();  
102 - BeanUtils.copyProperties(orderStatusCallback, mallBizPayment);  
103 - mallBizPayment = mallBizPaymentService.paymentInfo(mallBizPayment);  
104 - return new OrderStatusCallbackVO(mallBizPayment.getPayTradeNo()); 109 + MallBizPaymentOrder mallBizPaymentOrder = new MallBizPaymentOrder();
  110 + BeanUtils.copyProperties(orderStatusCallback, mallBizPaymentOrder);
  111 + mallBizPaymentOrder = mallBizPaymentService.paymentOrderInfo(mallBizPaymentOrder);
  112 + return new OrderStatusCallbackVO(mallBizPaymentOrder.getPayTradeNo());
105 } 113 }
106 114
107 /** 115 /**
@@ -119,20 +127,39 @@ public class MallBizOrderServiceImpl implements MallBizOrderService { @@ -119,20 +127,39 @@ public class MallBizOrderServiceImpl implements MallBizOrderService {
119 127
120 /** 128 /**
121 * commonCreate 129 * commonCreate
122 - *  
123 */ 130 */
124 - public void commonCreate(MallBizOrder mallBizOrder, MallBizPayment mallBizPayment) {  
125 - mallBizOrderDao.insertSelective(mallBizOrder);  
126 - Optional.ofNullable(mallBizOrder.getMallBizOrderAddress()) 131 + public void commonCreate(final List<MallBizOrder> mallBizOrders,
  132 + final MallBizPayment mallBizPayment) {
  133 + // order
  134 + Optional.of(mallBizOrders)
  135 + .ifPresent(mallBizOrderDao::batchInsert);
  136 +
  137 + // mall_biz_order_address
  138 + List<MallBizOrderAddress> mallBizOrderAddresses = mallBizOrders.stream().map(MallBizOrder::getMallBizOrderAddress).toList();
  139 + Optional.of(mallBizOrderAddresses)
127 .ifPresent(mallBizOrderAddress -> { 140 .ifPresent(mallBizOrderAddress -> {
128 - mallBizOrderAddressDao.insertSelective(mallBizOrderAddress); 141 + mallBizOrderAddressDao.batchInsert(mallBizOrderAddress);
129 }); 142 });
130 143
131 - Optional.ofNullable(mallBizOrder.getMallBizOrderItems()).ifPresent(mallBizOrderItems -> {  
132 - mallBizOrderItemDao.batchInsert(mallBizOrderItems);  
133 - }); 144 + // mall_biz_order_item
  145 + List<MallBizOrderItem> orderItems = mallBizOrders.stream().flatMap(vo -> vo.getMallBizOrderItems().stream()).toList();
  146 + Optional.of(orderItems)
  147 + .ifPresent(mallBizOrderItems -> {
  148 + mallBizOrderItemDao.batchInsert(mallBizOrderItems);
  149 + });
134 150
  151 + // mall_biz_payment
135 Optional.ofNullable(mallBizPayment).ifPresent(mallBizPaymentService::save); 152 Optional.ofNullable(mallBizPayment).ifPresent(mallBizPaymentService::save);
  153 +
  154 + // mall_biz_payment_order
  155 + List<MallBizPaymentOrder> bizPaymentOrders = mallBizOrders.stream().flatMap(vo -> vo.getMallBizPaymentOrders().stream()).toList();
  156 + Optional.of(bizPaymentOrders)
  157 + .ifPresent(paymentOrders -> {
  158 + paymentOrders.forEach(vo -> {
  159 + vo.setPayPaymentId(mallBizPayment.getPayPaymentId());
  160 + });
  161 + mallBizPaymentOrderDao.batchInsert(paymentOrders);
  162 + });
136 } 163 }
137 164
138 /** 165 /**
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/impl/MallBizPaymentServiceImpl.java
1 package com.diligrp.cashier.mall.service.biz.impl; 1 package com.diligrp.cashier.mall.service.biz.impl;
2 2
3 import com.diligrp.cashier.mall.dao.MallBizPaymentDao; 3 import com.diligrp.cashier.mall.dao.MallBizPaymentDao;
  4 +import com.diligrp.cashier.mall.dao.MallBizPaymentOrderDao;
4 import com.diligrp.cashier.mall.domain.rtmall.co.OrderInfoCO; 5 import com.diligrp.cashier.mall.domain.rtmall.co.OrderInfoCO;
5 import com.diligrp.cashier.mall.domain.rtmall.vo.OrderPaymentVO; 6 import com.diligrp.cashier.mall.domain.rtmall.vo.OrderPaymentVO;
6 import com.diligrp.cashier.mall.model.MallBizPayment; 7 import com.diligrp.cashier.mall.model.MallBizPayment;
  8 +import com.diligrp.cashier.mall.model.MallBizPaymentOrder;
7 import com.diligrp.cashier.mall.service.biz.MallBizPaymentService; 9 import com.diligrp.cashier.mall.service.biz.MallBizPaymentService;
8 import jakarta.annotation.Resource; 10 import jakarta.annotation.Resource;
9 import org.slf4j.Logger; 11 import org.slf4j.Logger;
@@ -25,6 +27,8 @@ public class MallBizPaymentServiceImpl implements MallBizPaymentService { @@ -25,6 +27,8 @@ public class MallBizPaymentServiceImpl implements MallBizPaymentService {
25 27
26 @Resource 28 @Resource
27 private MallBizPaymentDao mallBizPaymentDao; 29 private MallBizPaymentDao mallBizPaymentDao;
  30 + @Resource
  31 + private MallBizPaymentOrderDao mallBizPaymentOrderDao;
28 32
29 /** 33 /**
30 * save 34 * save
@@ -41,7 +45,7 @@ public class MallBizPaymentServiceImpl implements MallBizPaymentService { @@ -41,7 +45,7 @@ public class MallBizPaymentServiceImpl implements MallBizPaymentService {
41 * 45 *
42 */ 46 */
43 @Override 47 @Override
44 - public MallBizPayment paymentInfo(MallBizPayment mallBizPayment) {  
45 - return mallBizPaymentDao.getMallBizPayment(mallBizPayment); 48 + public MallBizPaymentOrder paymentOrderInfo(MallBizPaymentOrder mallBizPaymentOrder) {
  49 + return mallBizPaymentOrderDao.getMallBizPaymentOrder(mallBizPaymentOrder);
46 } 50 }
47 } 51 }
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/impl/MallBizRefundServiceImpl.java
@@ -3,12 +3,14 @@ package com.diligrp.cashier.mall.service.biz.impl; @@ -3,12 +3,14 @@ package com.diligrp.cashier.mall.service.biz.impl;
3 import com.diligrp.cashier.mall.context.MallInitializeContext; 3 import com.diligrp.cashier.mall.context.MallInitializeContext;
4 import com.diligrp.cashier.mall.dao.MallBizOrderDao; 4 import com.diligrp.cashier.mall.dao.MallBizOrderDao;
5 import com.diligrp.cashier.mall.dao.MallBizRefundDao; 5 import com.diligrp.cashier.mall.dao.MallBizRefundDao;
6 -import com.diligrp.cashier.mall.dao.MallBizRefundItemDao;  
7 import com.diligrp.cashier.mall.domain.rtmall.co.RefundCO; 6 import com.diligrp.cashier.mall.domain.rtmall.co.RefundCO;
  7 +import com.diligrp.cashier.mall.domain.rtmall.co.RefundStatusCO;
  8 +import com.diligrp.cashier.mall.domain.rtmall.vo.RefundVO;
8 import com.diligrp.cashier.mall.domain.rtmall.vo.RefundSuccessVO; 9 import com.diligrp.cashier.mall.domain.rtmall.vo.RefundSuccessVO;
9 import com.diligrp.cashier.mall.exception.RtMartMallException; 10 import com.diligrp.cashier.mall.exception.RtMartMallException;
10 import com.diligrp.cashier.mall.model.MallBizOrder; 11 import com.diligrp.cashier.mall.model.MallBizOrder;
11 import com.diligrp.cashier.mall.model.MallBizPayment; 12 import com.diligrp.cashier.mall.model.MallBizPayment;
  13 +import com.diligrp.cashier.mall.model.MallBizPaymentOrder;
12 import com.diligrp.cashier.mall.model.MallBizRefund; 14 import com.diligrp.cashier.mall.model.MallBizRefund;
13 import com.diligrp.cashier.mall.service.biz.MallBizPaymentService; 15 import com.diligrp.cashier.mall.service.biz.MallBizPaymentService;
14 import com.diligrp.cashier.mall.service.biz.MallBizRefundService; 16 import com.diligrp.cashier.mall.service.biz.MallBizRefundService;
@@ -16,6 +18,7 @@ import com.diligrp.cashier.mall.type.RtMarkErrorCode; @@ -16,6 +18,7 @@ import com.diligrp.cashier.mall.type.RtMarkErrorCode;
16 import jakarta.annotation.Resource; 18 import jakarta.annotation.Resource;
17 import org.slf4j.Logger; 19 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory; 20 import org.slf4j.LoggerFactory;
  21 +import org.springframework.beans.BeanUtils;
19 import org.springframework.stereotype.Service; 22 import org.springframework.stereotype.Service;
20 import org.springframework.transaction.annotation.Transactional; 23 import org.springframework.transaction.annotation.Transactional;
21 24
@@ -51,13 +54,35 @@ public class MallBizRefundServiceImpl implements MallBizRefundService { @@ -51,13 +54,35 @@ public class MallBizRefundServiceImpl implements MallBizRefundService {
51 } 54 }
52 55
53 /** 56 /**
  57 + * info
  58 + */
  59 + @Override
  60 + public RefundVO info(RefundStatusCO refundStatusCo) {
  61 + MallBizRefund mallBizRefund = new MallBizRefund();
  62 + BeanUtils.copyProperties(refundStatusCo, mallBizRefund);
  63 + MallBizRefund refund = getRefund(mallBizRefund);
  64 + return refund.ofRefundVO();
  65 + }
  66 +
  67 + /**
54 * getPayment 68 * getPayment
55 */ 69 */
56 - private MallBizPayment getPayment(RefundCO refundCo) {  
57 - MallBizPayment mallBizPayment = mallBizPaymentService.paymentInfo(new MallBizPayment(refundCo.getOrderId(), null));  
58 - if (Objects.isNull(mallBizPayment)) { 70 + private MallBizPaymentOrder getPayment(RefundCO refundCo) {
  71 + MallBizPaymentOrder mallBizPaymentOrder = mallBizPaymentService.paymentOrderInfo(new MallBizPaymentOrder(refundCo.getOrderId(), null));
  72 + if (Objects.isNull(mallBizPaymentOrder)) {
  73 + throw new RtMartMallException(RtMarkErrorCode.E5004);
  74 + }
  75 + return mallBizPaymentOrder;
  76 + }
  77 +
  78 + /**
  79 + * getRefund
  80 + */
  81 + private MallBizRefund getRefund(MallBizRefund refund) {
  82 + MallBizRefund mallBizRefund = mallBizRefundDao.getMallBizRefund(refund);
  83 + if (Objects.isNull(mallBizRefund)) {
59 throw new RtMartMallException(RtMarkErrorCode.E5004); 84 throw new RtMartMallException(RtMarkErrorCode.E5004);
60 } 85 }
61 - return mallBizPayment; 86 + return mallBizRefund;
62 } 87 }
63 } 88 }
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/impl/PayNotifyServiceImpl.java 0 → 100644
  1 +package com.diligrp.cashier.mall.service.biz.impl;
  2 +
  3 +import com.diligrp.cashier.mall.service.biz.PayNotifyService;
  4 +import org.springframework.stereotype.Component;
  5 +
  6 +/**
  7 + * @ClassName PayNotifyServiceImpl.java
  8 + * @author dengwei
  9 + * @version 1.0.0
  10 + * @Description PayNotifyServiceImpl
  11 + * 支付回调
  12 + */
  13 +@Component
  14 +public class PayNotifyServiceImpl implements PayNotifyService {
  15 +}
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/sourcechannel/AbstractSourceChannel.java
@@ -10,14 +10,16 @@ import com.diligrp.cashier.mall.domain.rtmall.co.RefundCO; @@ -10,14 +10,16 @@ import com.diligrp.cashier.mall.domain.rtmall.co.RefundCO;
10 import com.diligrp.cashier.mall.domain.rtmall.vo.UserInfoVO; 10 import com.diligrp.cashier.mall.domain.rtmall.vo.UserInfoVO;
11 import com.diligrp.cashier.mall.exception.RtMartMallException; 11 import com.diligrp.cashier.mall.exception.RtMartMallException;
12 import com.diligrp.cashier.mall.model.MallBizOrder; 12 import com.diligrp.cashier.mall.model.MallBizOrder;
13 -import com.diligrp.cashier.mall.model.MallBizPayment; 13 +import com.diligrp.cashier.mall.model.MallBizPaymentOrder;
14 import com.diligrp.cashier.mall.model.MallBizRefund; 14 import com.diligrp.cashier.mall.model.MallBizRefund;
15 import com.diligrp.cashier.mall.property.RtMallDynamicProperty; 15 import com.diligrp.cashier.mall.property.RtMallDynamicProperty;
16 import com.diligrp.cashier.mall.service.biz.MallBizPaymentService; 16 import com.diligrp.cashier.mall.service.biz.MallBizPaymentService;
  17 +import com.diligrp.cashier.mall.type.PayState;
17 import com.diligrp.cashier.mall.type.RtMarkErrorCode; 18 import com.diligrp.cashier.mall.type.RtMarkErrorCode;
18 import com.diligrp.cashier.shared.util.DateUtils; 19 import com.diligrp.cashier.shared.util.DateUtils;
19 import com.diligrp.cashier.shared.util.JsonUtils; 20 import com.diligrp.cashier.shared.util.JsonUtils;
20 import jakarta.annotation.Resource; 21 import jakarta.annotation.Resource;
  22 +import org.apache.commons.lang3.ObjectUtils;
21 import org.slf4j.Logger; 23 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory; 24 import org.slf4j.LoggerFactory;
23 import org.springframework.data.redis.core.RedisTemplate; 25 import org.springframework.data.redis.core.RedisTemplate;
@@ -92,10 +94,15 @@ public abstract class AbstractSourceChannel { @@ -92,10 +94,15 @@ public abstract class AbstractSourceChannel {
92 @Transactional(rollbackFor = {Exception.class}) 94 @Transactional(rollbackFor = {Exception.class})
93 public MallBizRefund refund(RefundCO refundCo) { 95 public MallBizRefund refund(RefundCO refundCo) {
94 MallBizOrder mallBizOrder = mallBizOrderDao.getByOrderId(refundCo.getOrderId()); 96 MallBizOrder mallBizOrder = mallBizOrderDao.getByOrderId(refundCo.getOrderId());
95 - MallBizPayment mallBizPayment = getPayment(refundCo); 97 + MallBizPaymentOrder mallBizPaymentOrder = getPayment(refundCo);
  98 +
  99 + // 支付成功才能退款
  100 + if (ObjectUtils.notEqual(mallBizPaymentOrder.getPayState(), PayState.SUCCESS.code)) {
  101 + throw new RtMartMallException(RtMarkErrorCode.E5005);
  102 + }
96 103
97 // TODO 2025/12/30: 调用支付完善信息 104 // TODO 2025/12/30: 调用支付完善信息
98 - MallBizRefund refund = MallBizRefund.of(refundCo, mallBizOrder, mallBizPayment); 105 + MallBizRefund refund = MallBizRefund.of(refundCo, mallBizOrder, mallBizPaymentOrder);
99 106
100 save(refund); 107 save(refund);
101 return refund; 108 return refund;
@@ -119,12 +126,12 @@ public abstract class AbstractSourceChannel { @@ -119,12 +126,12 @@ public abstract class AbstractSourceChannel {
119 /** 126 /**
120 * getPayment 127 * getPayment
121 */ 128 */
122 - private MallBizPayment getPayment(RefundCO refundCo) {  
123 - MallBizPayment mallBizPayment = mallBizPaymentService.paymentInfo(new MallBizPayment(refundCo.getOrderId(), null));  
124 - if (Objects.isNull(mallBizPayment)) { 129 + private MallBizPaymentOrder getPayment(RefundCO refundCo) {
  130 + MallBizPaymentOrder mallBizPaymentOrder = mallBizPaymentService.paymentOrderInfo(new MallBizPaymentOrder(refundCo.getOrderId(), null));
  131 + if (Objects.isNull(mallBizPaymentOrder)) {
125 throw new RtMartMallException(RtMarkErrorCode.E5004); 132 throw new RtMartMallException(RtMarkErrorCode.E5004);
126 } 133 }
127 - return mallBizPayment; 134 + return mallBizPaymentOrder;
128 } 135 }
129 136
130 /** 137 /**
cashier-mall/src/main/java/com/diligrp/cashier/mall/type/RtMarkErrorCode.java
@@ -19,6 +19,7 @@ public enum RtMarkErrorCode { @@ -19,6 +19,7 @@ public enum RtMarkErrorCode {
19 E5002("E5002", "不支持的类型"), 19 E5002("E5002", "不支持的类型"),
20 E5003("E5003", "回调状态不匹配"), 20 E5003("E5003", "回调状态不匹配"),
21 E5004("E5004", "数据异常"), 21 E5004("E5004", "数据异常"),
  22 + E5005("E5005", "支付状态异常"),
22 ; 23 ;
23 24
24 public final String code; 25 public final String code;
cashier-mall/src/main/resources/com/diligrp/cashier/dao/mapper/MallBizOrderAddressDao.xml
@@ -57,7 +57,8 @@ @@ -57,7 +57,8 @@
57 </if> 57 </if>
58 </trim> 58 </trim>
59 </insert> 59 </insert>
60 - <update id="updateByPrimaryKeySelective" parameterType="com.diligrp.cashier.mall.model.MallBizOrderAddress"> 60 +
  61 + <update id="updateByPrimaryKeySelective" parameterType="com.diligrp.cashier.mall.model.MallBizOrderAddress">
61 update mall_biz_order_address 62 update mall_biz_order_address
62 <set> 63 <set>
63 <if test="receiverName != null"> 64 <if test="receiverName != null">
@@ -79,4 +80,14 @@ @@ -79,4 +80,14 @@
79 receiver_address = #{receiverAddress,jdbcType=VARCHAR} 80 receiver_address = #{receiverAddress,jdbcType=VARCHAR}
80 where id = #{id,jdbcType=BIGINT} 81 where id = #{id,jdbcType=BIGINT}
81 </update> 82 </update>
  83 +
  84 + <insert id="batchInsert" parameterType="java.util.List">
  85 + insert into mall_biz_order_address (id, receiver_name, receiver_mobile,
  86 + receiver_address)
  87 + values
  88 + <foreach collection="list" item="item" index="index" separator=",">
  89 + (#{item.id,jdbcType=BIGINT}, #{item.receiverName,jdbcType=VARCHAR}, #{item.receiverMobile,jdbcType=VARCHAR},
  90 + #{item.receiverAddress,jdbcType=VARCHAR})
  91 + </foreach>
  92 + </insert>
82 </mapper> 93 </mapper>
cashier-mall/src/main/resources/com/diligrp/cashier/dao/mapper/MallBizOrderDao.xml
@@ -292,6 +292,35 @@ @@ -292,6 +292,35 @@
292 where id = #{id,jdbcType=BIGINT} 292 where id = #{id,jdbcType=BIGINT}
293 </update> 293 </update>
294 294
  295 + <insert id="batchInsert">
  296 + insert into mall_biz_order (id, order_no, order_id,
  297 + trade_id, channel, mch_id,
  298 + source, order_type, user_code,
  299 + username, company_code, shop_code,
  300 + shop_name, total_amount, freight_fee,
  301 + order_time, order_expire)
  302 + values
  303 + <foreach collection="list" item="item" index="index" separator=",">
  304 + (#{item.id,jdbcType=BIGINT},
  305 + #{item.orderNo,jdbcType=VARCHAR},
  306 + #{item.orderId,jdbcType=VARCHAR},
  307 + #{item.tradeId,jdbcType=VARCHAR},
  308 + #{item.channel,jdbcType=VARCHAR},
  309 + #{item.mchId,jdbcType=VARCHAR},
  310 + #{item.source,jdbcType=TINYINT},
  311 + #{item.orderType,jdbcType=TINYINT},
  312 + #{item.userCode,jdbcType=VARCHAR},
  313 + #{item.username,jdbcType=VARCHAR},
  314 + #{item.companyCode,jdbcType=VARCHAR},
  315 + #{item.shopCode,jdbcType=VARCHAR},
  316 + #{item.shopName,jdbcType=VARCHAR},
  317 + #{item.totalAmount,jdbcType=BIGINT},
  318 + #{item.freightFee,jdbcType=BIGINT},
  319 + #{item.orderTime,jdbcType=TIMESTAMP},
  320 + #{item.orderExpire,jdbcType=INTEGER})
  321 + </foreach>
  322 + </insert>
  323 +
295 <select id="getByOrderId" resultType="com.diligrp.cashier.mall.model.MallBizOrder"> 324 <select id="getByOrderId" resultType="com.diligrp.cashier.mall.model.MallBizOrder">
296 select <include refid="Base_Column_List"/> 325 select <include refid="Base_Column_List"/>
297 from mall_biz_order 326 from mall_biz_order
cashier-mall/src/main/resources/com/diligrp/cashier/dao/mapper/MallBizPaymentDao.xml
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 <mapper namespace="com.diligrp.cashier.mall.dao.MallBizPaymentDao"> 3 <mapper namespace="com.diligrp.cashier.mall.dao.MallBizPaymentDao">
4 - <resultMap id="BaseResultMap" type="com.diligrp.cashier.mall.model.MallBizPayment">  
5 - <id column="id" jdbcType="BIGINT" property="id" />  
6 - <result column="pay_trade_no" jdbcType="VARCHAR" property="payTradeNo" />  
7 - <result column="biz_order_id" jdbcType="BIGINT" property="bizOrderId" />  
8 - <result column="order_id" jdbcType="VARCHAR" property="orderId" />  
9 - <result column="trade_id" jdbcType="VARCHAR" property="tradeId" />  
10 - <result column="pay_payment_id" jdbcType="VARCHAR" property="payPaymentId" />  
11 - <result column="mch_id" jdbcType="VARCHAR" property="mchId" />  
12 - <result column="card_no" jdbcType="VARCHAR" property="cardNo" />  
13 - <result column="username" jdbcType="VARCHAR" property="username" />  
14 - <result column="user_id" jdbcType="BIGINT" property="userId" />  
15 - <result column="account_id" jdbcType="BIGINT" property="accountId" />  
16 - <result column="fund_account_id" jdbcType="BIGINT" property="fundAccountId" />  
17 - <result column="pay_fee" jdbcType="BIGINT" property="payFee" />  
18 - <result column="pay_state" jdbcType="TINYINT" property="payState" />  
19 - <result column="pay_time" jdbcType="TIMESTAMP" property="payTime" />  
20 - <result column="channel_id" jdbcType="TINYINT" property="channelId" />  
21 - <result column="cashier_url" jdbcType="VARCHAR" property="cashierUrl" />  
22 - <result column="payment_callback" jdbcType="VARCHAR" property="paymentCallback" />  
23 - <result column="version" jdbcType="INTEGER" property="version" />  
24 - <result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />  
25 - <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />  
26 - </resultMap>  
27 - <sql id="Base_Column_List">  
28 - id, pay_trade_no, biz_order_id, order_id, trade_id, pay_payment_id, mch_id, card_no,  
29 - username, user_id, account_id, fund_account_id, pay_fee, pay_state, pay_time, channel_id,  
30 - cashier_url, payment_callback, version, created_time, modified_time  
31 - </sql>  
32 - <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">  
33 - select  
34 - <include refid="Base_Column_List" />  
35 - from mall_biz_payment  
36 - where id = #{id,jdbcType=BIGINT}  
37 - </select>  
38 - <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">  
39 - delete from mall_biz_payment  
40 - where id = #{id,jdbcType=BIGINT}  
41 - </delete>  
42 - <insert id="insert" parameterType="com.diligrp.cashier.mall.model.MallBizPayment">  
43 - insert into mall_biz_payment (id, pay_trade_no, biz_order_id,  
44 - order_id, trade_id, pay_payment_id,  
45 - mch_id, card_no, username,  
46 - user_id, account_id, fund_account_id,  
47 - pay_fee, pay_state, pay_time,  
48 - channel_id, cashier_url, payment_callback,  
49 - version, created_time, modified_time  
50 - )  
51 - values (#{id,jdbcType=BIGINT}, #{payTradeNo,jdbcType=VARCHAR}, #{bizOrderId,jdbcType=BIGINT},  
52 - #{orderId,jdbcType=VARCHAR}, #{tradeId,jdbcType=VARCHAR}, #{payPaymentId,jdbcType=VARCHAR},  
53 - #{mchId,jdbcType=VARCHAR}, #{cardNo,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR},  
54 - #{userId,jdbcType=BIGINT}, #{accountId,jdbcType=BIGINT}, #{fundAccountId,jdbcType=BIGINT},  
55 - #{payFee,jdbcType=BIGINT}, #{payState,jdbcType=TINYINT}, #{payTime,jdbcType=TIMESTAMP},  
56 - #{channelId,jdbcType=TINYINT}, #{cashierUrl,jdbcType=VARCHAR}, #{paymentCallback,jdbcType=VARCHAR},  
57 - #{version,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, #{modifiedTime,jdbcType=TIMESTAMP}  
58 - )  
59 - </insert>  
60 - <insert id="insertSelective" parameterType="com.diligrp.cashier.mall.model.MallBizPayment">  
61 - insert into mall_biz_payment  
62 - <trim prefix="(" suffix=")" suffixOverrides=",">  
63 - <if test="id != null">  
64 - id,  
65 - </if>  
66 - <if test="payTradeNo != null">  
67 - pay_trade_no,  
68 - </if>  
69 - <if test="bizOrderId != null">  
70 - biz_order_id,  
71 - </if>  
72 - <if test="orderId != null">  
73 - order_id,  
74 - </if>  
75 - <if test="tradeId != null">  
76 - trade_id,  
77 - </if>  
78 - <if test="payPaymentId != null">  
79 - pay_payment_id,  
80 - </if>  
81 - <if test="mchId != null">  
82 - mch_id,  
83 - </if>  
84 - <if test="cardNo != null">  
85 - card_no,  
86 - </if>  
87 - <if test="username != null">  
88 - username,  
89 - </if>  
90 - <if test="userId != null">  
91 - user_id,  
92 - </if>  
93 - <if test="accountId != null">  
94 - account_id,  
95 - </if>  
96 - <if test="fundAccountId != null">  
97 - fund_account_id,  
98 - </if>  
99 - <if test="payFee != null">  
100 - pay_fee,  
101 - </if>  
102 - <if test="payState != null">  
103 - pay_state,  
104 - </if>  
105 - <if test="payTime != null">  
106 - pay_time,  
107 - </if>  
108 - <if test="channelId != null">  
109 - channel_id,  
110 - </if>  
111 - <if test="cashierUrl != null">  
112 - cashier_url,  
113 - </if>  
114 - <if test="paymentCallback != null">  
115 - payment_callback,  
116 - </if>  
117 - <if test="version != null">  
118 - version,  
119 - </if>  
120 - <if test="createdTime != null">  
121 - created_time,  
122 - </if>  
123 - <if test="modifiedTime != null">  
124 - modified_time,  
125 - </if>  
126 - </trim>  
127 - <trim prefix="values (" suffix=")" suffixOverrides=",">  
128 - <if test="id != null">  
129 - #{id,jdbcType=BIGINT},  
130 - </if>  
131 - <if test="payTradeNo != null">  
132 - #{payTradeNo,jdbcType=VARCHAR},  
133 - </if>  
134 - <if test="bizOrderId != null">  
135 - #{bizOrderId,jdbcType=BIGINT},  
136 - </if>  
137 - <if test="orderId != null">  
138 - #{orderId,jdbcType=VARCHAR},  
139 - </if>  
140 - <if test="tradeId != null">  
141 - #{tradeId,jdbcType=VARCHAR},  
142 - </if>  
143 - <if test="payPaymentId != null">  
144 - #{payPaymentId,jdbcType=VARCHAR},  
145 - </if>  
146 - <if test="mchId != null">  
147 - #{mchId,jdbcType=VARCHAR},  
148 - </if>  
149 - <if test="cardNo != null">  
150 - #{cardNo,jdbcType=VARCHAR},  
151 - </if>  
152 - <if test="username != null">  
153 - #{username,jdbcType=VARCHAR},  
154 - </if>  
155 - <if test="userId != null">  
156 - #{userId,jdbcType=BIGINT},  
157 - </if>  
158 - <if test="accountId != null">  
159 - #{accountId,jdbcType=BIGINT},  
160 - </if>  
161 - <if test="fundAccountId != null">  
162 - #{fundAccountId,jdbcType=BIGINT},  
163 - </if>  
164 - <if test="payFee != null">  
165 - #{payFee,jdbcType=BIGINT},  
166 - </if>  
167 - <if test="payState != null">  
168 - #{payState,jdbcType=TINYINT},  
169 - </if>  
170 - <if test="payTime != null">  
171 - #{payTime,jdbcType=TIMESTAMP},  
172 - </if>  
173 - <if test="channelId != null">  
174 - #{channelId,jdbcType=TINYINT},  
175 - </if>  
176 - <if test="cashierUrl != null">  
177 - #{cashierUrl,jdbcType=VARCHAR},  
178 - </if>  
179 - <if test="paymentCallback != null">  
180 - #{paymentCallback,jdbcType=VARCHAR},  
181 - </if>  
182 - <if test="version != null">  
183 - #{version,jdbcType=INTEGER},  
184 - </if>  
185 - <if test="createdTime != null">  
186 - #{createdTime,jdbcType=TIMESTAMP},  
187 - </if>  
188 - <if test="modifiedTime != null">  
189 - #{modifiedTime,jdbcType=TIMESTAMP},  
190 - </if>  
191 - </trim>  
192 - </insert>  
193 - <update id="updateByPrimaryKeySelective" parameterType="com.diligrp.cashier.mall.model.MallBizPayment">  
194 - update mall_biz_payment  
195 - <set>  
196 - <if test="payTradeNo != null">  
197 - pay_trade_no = #{payTradeNo,jdbcType=VARCHAR},  
198 - </if>  
199 - <if test="bizOrderId != null">  
200 - biz_order_id = #{bizOrderId,jdbcType=BIGINT},  
201 - </if>  
202 - <if test="orderId != null">  
203 - order_id = #{orderId,jdbcType=VARCHAR},  
204 - </if>  
205 - <if test="tradeId != null">  
206 - trade_id = #{tradeId,jdbcType=VARCHAR},  
207 - </if>  
208 - <if test="payPaymentId != null">  
209 - pay_payment_id = #{payPaymentId,jdbcType=VARCHAR},  
210 - </if>  
211 - <if test="mchId != null">  
212 - mch_id = #{mchId,jdbcType=VARCHAR},  
213 - </if>  
214 - <if test="cardNo != null">  
215 - card_no = #{cardNo,jdbcType=VARCHAR},  
216 - </if>  
217 - <if test="username != null">  
218 - username = #{username,jdbcType=VARCHAR},  
219 - </if>  
220 - <if test="userId != null">  
221 - user_id = #{userId,jdbcType=BIGINT},  
222 - </if>  
223 - <if test="accountId != null">  
224 - account_id = #{accountId,jdbcType=BIGINT},  
225 - </if>  
226 - <if test="fundAccountId != null">  
227 - fund_account_id = #{fundAccountId,jdbcType=BIGINT},  
228 - </if>  
229 - <if test="payFee != null">  
230 - pay_fee = #{payFee,jdbcType=BIGINT},  
231 - </if>  
232 - <if test="payState != null">  
233 - pay_state = #{payState,jdbcType=TINYINT},  
234 - </if>  
235 - <if test="payTime != null">  
236 - pay_time = #{payTime,jdbcType=TIMESTAMP},  
237 - </if>  
238 - <if test="channelId != null">  
239 - channel_id = #{channelId,jdbcType=TINYINT},  
240 - </if>  
241 - <if test="cashierUrl != null">  
242 - cashier_url = #{cashierUrl,jdbcType=VARCHAR},  
243 - </if>  
244 - <if test="paymentCallback != null">  
245 - payment_callback = #{paymentCallback,jdbcType=VARCHAR},  
246 - </if>  
247 - <if test="version != null">  
248 - version = #{version,jdbcType=INTEGER},  
249 - </if>  
250 - <if test="createdTime != null">  
251 - created_time = #{createdTime,jdbcType=TIMESTAMP},  
252 - </if>  
253 - <if test="modifiedTime != null">  
254 - modified_time = #{modifiedTime,jdbcType=TIMESTAMP},  
255 - </if>  
256 - </set>  
257 - where id = #{id,jdbcType=BIGINT}  
258 - </update>  
259 - <update id="updateByPrimaryKey" parameterType="com.diligrp.cashier.mall.model.MallBizPayment">  
260 - update mall_biz_payment  
261 - set pay_trade_no = #{payTradeNo,jdbcType=VARCHAR},  
262 - biz_order_id = #{bizOrderId,jdbcType=BIGINT},  
263 - order_id = #{orderId,jdbcType=VARCHAR},  
264 - trade_id = #{tradeId,jdbcType=VARCHAR},  
265 - pay_payment_id = #{payPaymentId,jdbcType=VARCHAR},  
266 - mch_id = #{mchId,jdbcType=VARCHAR},  
267 - card_no = #{cardNo,jdbcType=VARCHAR},  
268 - username = #{username,jdbcType=VARCHAR},  
269 - user_id = #{userId,jdbcType=BIGINT},  
270 - account_id = #{accountId,jdbcType=BIGINT},  
271 - fund_account_id = #{fundAccountId,jdbcType=BIGINT},  
272 - pay_fee = #{payFee,jdbcType=BIGINT},  
273 - pay_state = #{payState,jdbcType=TINYINT},  
274 - pay_time = #{payTime,jdbcType=TIMESTAMP},  
275 - channel_id = #{channelId,jdbcType=TINYINT},  
276 - cashier_url = #{cashierUrl,jdbcType=VARCHAR},  
277 - payment_callback = #{paymentCallback,jdbcType=VARCHAR},  
278 - version = #{version,jdbcType=INTEGER},  
279 - created_time = #{createdTime,jdbcType=TIMESTAMP},  
280 - modified_time = #{modifiedTime,jdbcType=TIMESTAMP}  
281 - where id = #{id,jdbcType=BIGINT}  
282 - </update>  
283 -  
284 - <select id="getMallBizPayment" resultType="com.diligrp.cashier.mall.model.MallBizPayment"> 4 + <resultMap id="BaseResultMap" type="com.diligrp.cashier.mall.model.MallBizPayment">
  5 + <id column="id" jdbcType="BIGINT" property="id" />
  6 + <result column="pay_trade_no" jdbcType="VARCHAR" property="payTradeNo" />
  7 + <result column="biz_order_id" jdbcType="VARCHAR" property="bizOrderId" />
  8 + <result column="order_id" jdbcType="VARCHAR" property="orderId" />
  9 + <result column="trade_id" jdbcType="VARCHAR" property="tradeId" />
  10 + <result column="pay_payment_id" jdbcType="VARCHAR" property="payPaymentId" />
  11 + <result column="mch_id" jdbcType="VARCHAR" property="mchId" />
  12 + <result column="card_no" jdbcType="VARCHAR" property="cardNo" />
  13 + <result column="username" jdbcType="VARCHAR" property="username" />
  14 + <result column="user_id" jdbcType="BIGINT" property="userId" />
  15 + <result column="account_id" jdbcType="BIGINT" property="accountId" />
  16 + <result column="fund_account_id" jdbcType="BIGINT" property="fundAccountId" />
  17 + <result column="open_id" jdbcType="VARCHAR" property="openId" />
  18 + <result column="pay_fee" jdbcType="BIGINT" property="payFee" />
  19 + <result column="pay_state" jdbcType="TINYINT" property="payState" />
  20 + <result column="pay_time" jdbcType="TIMESTAMP" property="payTime" />
  21 + <result column="channel_id" jdbcType="TINYINT" property="channelId" />
  22 + <result column="cashier_url" jdbcType="VARCHAR" property="cashierUrl" />
  23 + <result column="payment_callback" jdbcType="VARCHAR" property="paymentCallback" />
  24 + <result column="version" jdbcType="INTEGER" property="version" />
  25 + <result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
  26 + <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
  27 + </resultMap>
  28 + <sql id="Base_Column_List">
  29 + id, pay_trade_no, biz_order_id, order_id, trade_id, pay_payment_id, mch_id, card_no,
  30 + username, user_id, account_id, fund_account_id, open_id, pay_fee, pay_state, pay_time,
  31 + channel_id, cashier_url, payment_callback, version, created_time, modified_time
  32 + </sql>
  33 + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
285 select 34 select
286 <include refid="Base_Column_List" /> 35 <include refid="Base_Column_List" />
287 from mall_biz_payment 36 from mall_biz_payment
288 - where order_id = #{orderId}  
289 - <if test="tradeId != null and tradeId != ''">  
290 - and trade_id = #{tradeId}  
291 - </if> 37 + where id = #{id,jdbcType=BIGINT}
292 </select> 38 </select>
  39 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  40 + delete
  41 + from mall_biz_payment
  42 + where id = #{id,jdbcType=BIGINT}
  43 + </delete>
  44 + <insert id="insert" parameterType="com.diligrp.cashier.mall.model.MallBizPayment">
  45 + insert into mall_biz_payment (id, pay_trade_no, biz_order_id,
  46 + order_id, trade_id, pay_payment_id,
  47 + mch_id, card_no, username,
  48 + user_id, account_id, fund_account_id,
  49 + open_id, pay_fee, pay_state,
  50 + pay_time, channel_id, cashier_url,
  51 + payment_callback, version, created_time,
  52 + modified_time)
  53 + values (#{id,jdbcType=BIGINT}, #{payTradeNo,jdbcType=VARCHAR}, #{bizOrderId,jdbcType=VARCHAR},
  54 + #{orderId,jdbcType=VARCHAR}, #{tradeId,jdbcType=VARCHAR}, #{payPaymentId,jdbcType=VARCHAR},
  55 + #{mchId,jdbcType=VARCHAR}, #{cardNo,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR},
  56 + #{userId,jdbcType=BIGINT}, #{accountId,jdbcType=BIGINT}, #{fundAccountId,jdbcType=BIGINT},
  57 + #{openId,jdbcType=VARCHAR}, #{payFee,jdbcType=BIGINT}, #{payState,jdbcType=TINYINT},
  58 + #{payTime,jdbcType=TIMESTAMP}, #{channelId,jdbcType=TINYINT}, #{cashierUrl,jdbcType=VARCHAR},
  59 + #{paymentCallback,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP},
  60 + #{modifiedTime,jdbcType=TIMESTAMP})
  61 + </insert>
  62 + <insert id="insertSelective" parameterType="com.diligrp.cashier.mall.model.MallBizPayment">
  63 + insert into mall_biz_payment
  64 + <trim prefix="(" suffix=")" suffixOverrides=",">
  65 + <if test="id != null">
  66 + id,
  67 + </if>
  68 + <if test="payTradeNo != null">
  69 + pay_trade_no,
  70 + </if>
  71 + <if test="bizOrderId != null">
  72 + biz_order_id,
  73 + </if>
  74 + <if test="orderId != null">
  75 + order_id,
  76 + </if>
  77 + <if test="tradeId != null">
  78 + trade_id,
  79 + </if>
  80 + <if test="payPaymentId != null">
  81 + pay_payment_id,
  82 + </if>
  83 + <if test="mchId != null">
  84 + mch_id,
  85 + </if>
  86 + <if test="cardNo != null">
  87 + card_no,
  88 + </if>
  89 + <if test="username != null">
  90 + username,
  91 + </if>
  92 + <if test="userId != null">
  93 + user_id,
  94 + </if>
  95 + <if test="accountId != null">
  96 + account_id,
  97 + </if>
  98 + <if test="fundAccountId != null">
  99 + fund_account_id,
  100 + </if>
  101 + <if test="openId != null">
  102 + open_id,
  103 + </if>
  104 + <if test="payFee != null">
  105 + pay_fee,
  106 + </if>
  107 + <if test="payState != null">
  108 + pay_state,
  109 + </if>
  110 + <if test="payTime != null">
  111 + pay_time,
  112 + </if>
  113 + <if test="channelId != null">
  114 + channel_id,
  115 + </if>
  116 + <if test="cashierUrl != null">
  117 + cashier_url,
  118 + </if>
  119 + <if test="paymentCallback != null">
  120 + payment_callback,
  121 + </if>
  122 + <if test="version != null">
  123 + version,
  124 + </if>
  125 + <if test="createdTime != null">
  126 + created_time,
  127 + </if>
  128 + <if test="modifiedTime != null">
  129 + modified_time,
  130 + </if>
  131 + </trim>
  132 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  133 + <if test="id != null">
  134 + #{id,jdbcType=BIGINT},
  135 + </if>
  136 + <if test="payTradeNo != null">
  137 + #{payTradeNo,jdbcType=VARCHAR},
  138 + </if>
  139 + <if test="bizOrderId != null">
  140 + #{bizOrderId,jdbcType=VARCHAR},
  141 + </if>
  142 + <if test="orderId != null">
  143 + #{orderId,jdbcType=VARCHAR},
  144 + </if>
  145 + <if test="tradeId != null">
  146 + #{tradeId,jdbcType=VARCHAR},
  147 + </if>
  148 + <if test="payPaymentId != null">
  149 + #{payPaymentId,jdbcType=VARCHAR},
  150 + </if>
  151 + <if test="mchId != null">
  152 + #{mchId,jdbcType=VARCHAR},
  153 + </if>
  154 + <if test="cardNo != null">
  155 + #{cardNo,jdbcType=VARCHAR},
  156 + </if>
  157 + <if test="username != null">
  158 + #{username,jdbcType=VARCHAR},
  159 + </if>
  160 + <if test="userId != null">
  161 + #{userId,jdbcType=BIGINT},
  162 + </if>
  163 + <if test="accountId != null">
  164 + #{accountId,jdbcType=BIGINT},
  165 + </if>
  166 + <if test="fundAccountId != null">
  167 + #{fundAccountId,jdbcType=BIGINT},
  168 + </if>
  169 + <if test="openId != null">
  170 + #{openId,jdbcType=VARCHAR},
  171 + </if>
  172 + <if test="payFee != null">
  173 + #{payFee,jdbcType=BIGINT},
  174 + </if>
  175 + <if test="payState != null">
  176 + #{payState,jdbcType=TINYINT},
  177 + </if>
  178 + <if test="payTime != null">
  179 + #{payTime,jdbcType=TIMESTAMP},
  180 + </if>
  181 + <if test="channelId != null">
  182 + #{channelId,jdbcType=TINYINT},
  183 + </if>
  184 + <if test="cashierUrl != null">
  185 + #{cashierUrl,jdbcType=VARCHAR},
  186 + </if>
  187 + <if test="paymentCallback != null">
  188 + #{paymentCallback,jdbcType=VARCHAR},
  189 + </if>
  190 + <if test="version != null">
  191 + #{version,jdbcType=INTEGER},
  192 + </if>
  193 + <if test="createdTime != null">
  194 + #{createdTime,jdbcType=TIMESTAMP},
  195 + </if>
  196 + <if test="modifiedTime != null">
  197 + #{modifiedTime,jdbcType=TIMESTAMP},
  198 + </if>
  199 + </trim>
  200 + </insert>
  201 + <update id="updateByPrimaryKeySelective" parameterType="com.diligrp.cashier.mall.model.MallBizPayment">
  202 + update mall_biz_payment
  203 + <set>
  204 + <if test="payTradeNo != null">
  205 + pay_trade_no = #{payTradeNo,jdbcType=VARCHAR},
  206 + </if>
  207 + <if test="bizOrderId != null">
  208 + biz_order_id = #{bizOrderId,jdbcType=VARCHAR},
  209 + </if>
  210 + <if test="orderId != null">
  211 + order_id = #{orderId,jdbcType=VARCHAR},
  212 + </if>
  213 + <if test="tradeId != null">
  214 + trade_id = #{tradeId,jdbcType=VARCHAR},
  215 + </if>
  216 + <if test="payPaymentId != null">
  217 + pay_payment_id = #{payPaymentId,jdbcType=VARCHAR},
  218 + </if>
  219 + <if test="mchId != null">
  220 + mch_id = #{mchId,jdbcType=VARCHAR},
  221 + </if>
  222 + <if test="cardNo != null">
  223 + card_no = #{cardNo,jdbcType=VARCHAR},
  224 + </if>
  225 + <if test="username != null">
  226 + username = #{username,jdbcType=VARCHAR},
  227 + </if>
  228 + <if test="userId != null">
  229 + user_id = #{userId,jdbcType=BIGINT},
  230 + </if>
  231 + <if test="accountId != null">
  232 + account_id = #{accountId,jdbcType=BIGINT},
  233 + </if>
  234 + <if test="fundAccountId != null">
  235 + fund_account_id = #{fundAccountId,jdbcType=BIGINT},
  236 + </if>
  237 + <if test="openId != null">
  238 + open_id = #{openId,jdbcType=VARCHAR},
  239 + </if>
  240 + <if test="payFee != null">
  241 + pay_fee = #{payFee,jdbcType=BIGINT},
  242 + </if>
  243 + <if test="payState != null">
  244 + pay_state = #{payState,jdbcType=TINYINT},
  245 + </if>
  246 + <if test="payTime != null">
  247 + pay_time = #{payTime,jdbcType=TIMESTAMP},
  248 + </if>
  249 + <if test="channelId != null">
  250 + channel_id = #{channelId,jdbcType=TINYINT},
  251 + </if>
  252 + <if test="cashierUrl != null">
  253 + cashier_url = #{cashierUrl,jdbcType=VARCHAR},
  254 + </if>
  255 + <if test="paymentCallback != null">
  256 + payment_callback = #{paymentCallback,jdbcType=VARCHAR},
  257 + </if>
  258 + <if test="version != null">
  259 + version = #{version,jdbcType=INTEGER},
  260 + </if>
  261 + <if test="createdTime != null">
  262 + created_time = #{createdTime,jdbcType=TIMESTAMP},
  263 + </if>
  264 + <if test="modifiedTime != null">
  265 + modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
  266 + </if>
  267 + </set>
  268 + where id = #{id,jdbcType=BIGINT}
  269 + </update>
  270 + <update id="updateByPrimaryKey" parameterType="com.diligrp.cashier.mall.model.MallBizPayment">
  271 + update mall_biz_payment
  272 + set pay_trade_no = #{payTradeNo,jdbcType=VARCHAR},
  273 + biz_order_id = #{bizOrderId,jdbcType=VARCHAR},
  274 + order_id = #{orderId,jdbcType=VARCHAR},
  275 + trade_id = #{tradeId,jdbcType=VARCHAR},
  276 + pay_payment_id = #{payPaymentId,jdbcType=VARCHAR},
  277 + mch_id = #{mchId,jdbcType=VARCHAR},
  278 + card_no = #{cardNo,jdbcType=VARCHAR},
  279 + username = #{username,jdbcType=VARCHAR},
  280 + user_id = #{userId,jdbcType=BIGINT},
  281 + account_id = #{accountId,jdbcType=BIGINT},
  282 + fund_account_id = #{fundAccountId,jdbcType=BIGINT},
  283 + open_id = #{openId,jdbcType=VARCHAR},
  284 + pay_fee = #{payFee,jdbcType=BIGINT},
  285 + pay_state = #{payState,jdbcType=TINYINT},
  286 + pay_time = #{payTime,jdbcType=TIMESTAMP},
  287 + channel_id = #{channelId,jdbcType=TINYINT},
  288 + cashier_url = #{cashierUrl,jdbcType=VARCHAR},
  289 + payment_callback = #{paymentCallback,jdbcType=VARCHAR},
  290 + version = #{version,jdbcType=INTEGER},
  291 + created_time = #{createdTime,jdbcType=TIMESTAMP},
  292 + modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
  293 + where id = #{id,jdbcType=BIGINT}
  294 + </update>
293 </mapper> 295 </mapper>
cashier-mall/src/main/resources/com/diligrp/cashier/dao/mapper/MallBizPaymentOrderDao.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.diligrp.cashier.mall.dao.MallBizPaymentOrderDao">
  4 + <resultMap id="BaseResultMap" type="com.diligrp.cashier.mall.model.MallBizPaymentOrder">
  5 + <id column="id" jdbcType="BIGINT" property="id" />
  6 + <result column="biz_payment_id" jdbcType="BIGINT" property="bizPaymentId" />
  7 + <result column="pay_trade_no" jdbcType="VARCHAR" property="payTradeNo" />
  8 + <result column="biz_order_id" jdbcType="BIGINT" property="bizOrderId" />
  9 + <result column="order_id" jdbcType="VARCHAR" property="orderId" />
  10 + <result column="trade_id" jdbcType="VARCHAR" property="tradeId" />
  11 + <result column="pay_payment_id" jdbcType="VARCHAR" property="payPaymentId" />
  12 + <result column="pay_status" jdbcType="INTEGER" property="payState" />
  13 + <result column="pay_fee" jdbcType="BIGINT" property="payFee" />
  14 + <result column="pay_time" jdbcType="TIMESTAMP" property="payTime" />
  15 + </resultMap>
  16 + <sql id="Base_Column_List">
  17 + id, biz_payment_id, pay_trade_no, biz_order_id, order_id, trade_id, pay_payment_id,
  18 + pay_state, pay_fee, pay_time
  19 + </sql>
  20 + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  21 + select
  22 + <include refid="Base_Column_List" />
  23 + from mall_biz_payment_order
  24 + where id = #{id,jdbcType=BIGINT}
  25 + </select>
  26 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  27 + delete from mall_biz_payment_order
  28 + where id = #{id,jdbcType=BIGINT}
  29 + </delete>
  30 + <insert id="insert" parameterType="com.diligrp.cashier.mall.model.MallBizPaymentOrder">
  31 + insert into mall_biz_payment_order (id, biz_payment_id, pay_trade_no,
  32 + biz_order_id, order_id, trade_id,
  33 + pay_payment_id, pay_fee, pay_time
  34 + )
  35 + values (#{id,jdbcType=BIGINT}, #{bizPaymentId,jdbcType=BIGINT}, #{payTradeNo,jdbcType=VARCHAR},
  36 + #{bizOrderId,jdbcType=BIGINT}, #{orderId,jdbcType=VARCHAR}, #{tradeId,jdbcType=VARCHAR},
  37 + #{payPaymentId,jdbcType=VARCHAR}, #{payFee,jdbcType=BIGINT}, #{payTime,jdbcType=TIMESTAMP}
  38 + )
  39 + </insert>
  40 + <insert id="insertSelective" parameterType="com.diligrp.cashier.mall.model.MallBizPaymentOrder">
  41 + insert into mall_biz_payment_order
  42 + <trim prefix="(" suffix=")" suffixOverrides=",">
  43 + <if test="id != null">
  44 + id,
  45 + </if>
  46 + <if test="bizPaymentId != null">
  47 + biz_payment_id,
  48 + </if>
  49 + <if test="payTradeNo != null">
  50 + pay_trade_no,
  51 + </if>
  52 + <if test="bizOrderId != null">
  53 + biz_order_id,
  54 + </if>
  55 + <if test="orderId != null">
  56 + order_id,
  57 + </if>
  58 + <if test="tradeId != null">
  59 + trade_id,
  60 + </if>
  61 + <if test="payPaymentId != null">
  62 + pay_payment_id,
  63 + </if>
  64 + <if test="payFee != null">
  65 + pay_fee,
  66 + </if>
  67 + <if test="payTime != null">
  68 + pay_time,
  69 + </if>
  70 + </trim>
  71 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  72 + <if test="id != null">
  73 + #{id,jdbcType=BIGINT},
  74 + </if>
  75 + <if test="bizPaymentId != null">
  76 + #{bizPaymentId,jdbcType=BIGINT},
  77 + </if>
  78 + <if test="payTradeNo != null">
  79 + #{payTradeNo,jdbcType=VARCHAR},
  80 + </if>
  81 + <if test="bizOrderId != null">
  82 + #{bizOrderId,jdbcType=BIGINT},
  83 + </if>
  84 + <if test="orderId != null">
  85 + #{orderId,jdbcType=VARCHAR},
  86 + </if>
  87 + <if test="tradeId != null">
  88 + #{tradeId,jdbcType=VARCHAR},
  89 + </if>
  90 + <if test="payPaymentId != null">
  91 + #{payPaymentId,jdbcType=VARCHAR},
  92 + </if>
  93 + <if test="payFee != null">
  94 + #{payFee,jdbcType=BIGINT},
  95 + </if>
  96 + <if test="payTime != null">
  97 + #{payTime,jdbcType=TIMESTAMP},
  98 + </if>
  99 + </trim>
  100 + </insert>
  101 + <update id="updateByPrimaryKeySelective" parameterType="com.diligrp.cashier.mall.model.MallBizPaymentOrder">
  102 + update mall_biz_payment_order
  103 + <set>
  104 + <if test="bizPaymentId != null">
  105 + biz_payment_id = #{bizPaymentId,jdbcType=BIGINT},
  106 + </if>
  107 + <if test="payTradeNo != null">
  108 + pay_trade_no = #{payTradeNo,jdbcType=VARCHAR},
  109 + </if>
  110 + <if test="bizOrderId != null">
  111 + biz_order_id = #{bizOrderId,jdbcType=BIGINT},
  112 + </if>
  113 + <if test="orderId != null">
  114 + order_id = #{orderId,jdbcType=VARCHAR},
  115 + </if>
  116 + <if test="tradeId != null">
  117 + trade_id = #{tradeId,jdbcType=VARCHAR},
  118 + </if>
  119 + <if test="payPaymentId != null">
  120 + pay_payment_id = #{payPaymentId,jdbcType=VARCHAR},
  121 + </if>
  122 + <if test="payFee != null">
  123 + pay_fee = #{payFee,jdbcType=BIGINT},
  124 + </if>
  125 + <if test="payTime != null">
  126 + pay_time = #{payTime,jdbcType=TIMESTAMP},
  127 + </if>
  128 + </set>
  129 + where id = #{id,jdbcType=BIGINT}
  130 + </update>
  131 + <update id="updateByPrimaryKey" parameterType="com.diligrp.cashier.mall.model.MallBizPaymentOrder">
  132 + update mall_biz_payment_order
  133 + set biz_payment_id = #{bizPaymentId,jdbcType=BIGINT},
  134 + pay_trade_no = #{payTradeNo,jdbcType=VARCHAR},
  135 + biz_order_id = #{bizOrderId,jdbcType=BIGINT},
  136 + order_id = #{orderId,jdbcType=VARCHAR},
  137 + trade_id = #{tradeId,jdbcType=VARCHAR},
  138 + pay_payment_id = #{payPaymentId,jdbcType=VARCHAR},
  139 + pay_fee = #{payFee,jdbcType=BIGINT},
  140 + pay_time = #{payTime,jdbcType=TIMESTAMP}
  141 + where id = #{id,jdbcType=BIGINT}
  142 + </update>
  143 +
  144 + <insert id="batchInsert" parameterType="java.util.List">
  145 + insert into mall_biz_payment_order (id, biz_payment_id, pay_trade_no,
  146 + biz_order_id, order_id, trade_id,
  147 + pay_payment_id, pay_fee, pay_time
  148 + )
  149 + values
  150 + <foreach collection="list" item="item" index="index" separator=",">
  151 + (#{item.id,jdbcType=BIGINT}, #{item.bizPaymentId,jdbcType=BIGINT}, #{item.payTradeNo,jdbcType=VARCHAR},
  152 + #{item.bizOrderId,jdbcType=BIGINT}, #{item.orderId,jdbcType=VARCHAR}, #{item.tradeId,jdbcType=VARCHAR},
  153 + #{item.payPaymentId,jdbcType=VARCHAR}, #{item.payFee,jdbcType=BIGINT}, #{item.payTime,jdbcType=TIMESTAMP}
  154 + )
  155 + </foreach>
  156 + </insert>
  157 +
  158 + <select id="getMallBizPaymentOrder" resultType="com.diligrp.cashier.mall.model.MallBizPaymentOrder">
  159 + select
  160 + <include refid="Base_Column_List" />
  161 + from mall_biz_payment_order
  162 + <where>
  163 + and order_id = #{orderId}
  164 + <if test="tradeId != null and tradeId != ''">
  165 + and trade_id = #{tradeId}
  166 + </if>
  167 + </where>
  168 + </select>
  169 +</mapper>
cashier-mall/src/main/resources/com/diligrp/cashier/dao/mapper/MallBizRefundDao.xml
@@ -293,4 +293,19 @@ @@ -293,4 +293,19 @@
293 refuse_reason = #{refuseReason,jdbcType=VARCHAR} 293 refuse_reason = #{refuseReason,jdbcType=VARCHAR}
294 where id = #{id,jdbcType=BIGINT} 294 where id = #{id,jdbcType=BIGINT}
295 </update> 295 </update>
  296 +
  297 + <select id="getMallBizRefund" resultType="com.diligrp.cashier.mall.model.MallBizRefund">
  298 + select <include refid="Base_Column_List"/>
  299 + from mall_biz_refund
  300 + <where>
  301 + and order_id = #{orderId}
  302 + <if test="tradeId != null and tradeId != ''">
  303 + and trade_id = #{tradeId}
  304 + </if>
  305 + <if test="refundBn != null and refundBn != ''">
  306 + and refund_bn = #{refundBn}
  307 + </if>
  308 + </where>
  309 + </select>
  310 +
296 </mapper> 311 </mapper>