Commit 37d8d3a5475285ad178f01bb07e50389eefdecb2

Authored by dengwei
1 parent e0137e45

feat rt_mark features

Showing 32 changed files with 894 additions and 429 deletions
cashier-mall/src/main/java/com/diligrp/cashier/mall/api/ManualHandlerApi.java 0 → 100644
  1 +package com.diligrp.cashier.mall.api;
  2 +
  3 +import com.diligrp.cashier.shared.domain.Message;
  4 +import com.diligrp.cashier.shared.spi.IPaymentEventListener;
  5 +import com.diligrp.cashier.shared.spi.domain.PaymentResultBO;
  6 +import jakarta.annotation.Resource;
  7 +import org.springframework.validation.annotation.Validated;
  8 +import org.springframework.web.bind.annotation.PostMapping;
  9 +import org.springframework.web.bind.annotation.RequestBody;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RestController;
  12 +
  13 +/**
  14 + * @ClassName ManualHandlerApi.java
  15 + * @author dengwei
  16 + * @version 1.0.0
  17 + * @Description ManualHandlerApi
  18 + * @date 2026-01-06 14:00
  19 + */
  20 +@RestController
  21 +@RequestMapping(path = "/mall/manual")
  22 +@Validated
  23 +public class ManualHandlerApi {
  24 + @Resource
  25 + private IPaymentEventListener paymentEventListener;
  26 +
  27 + @PostMapping("/payment/event")
  28 + public Message<?> handlePaymentEvent(@RequestBody PaymentResultBO payment) {
  29 + paymentEventListener.onEvent(payment);
  30 + return Message.success();
  31 + }
  32 +
  33 +}
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/api/RtMallOrderPaymentApi.java
1 1 package com.diligrp.cashier.mall.api;
2 2  
3 3 import com.diligrp.cashier.mall.domain.rtmall.RtMarkMessage;
4   -import com.diligrp.cashier.mall.domain.rtmall.co.OrderPaymentCO;
  4 +import com.diligrp.cashier.mall.domain.rtmall.co.OrderCO;
5 5 import com.diligrp.cashier.mall.domain.rtmall.co.PaymentAllocateCO;
6 6 import com.diligrp.cashier.mall.domain.rtmall.vo.OrderSuccessVO;
  7 +import com.diligrp.cashier.mall.service.biz.MallBizOrderService;
7 8 import com.diligrp.cashier.mall.service.biz.MallBizPaymentService;
8 9 import com.diligrp.cashier.mall.sign.RtMallSign;
  10 +import com.diligrp.cashier.mall.type.OrderType;
9 11 import com.diligrp.cashier.mall.util.RtMallValidateUtils;
10 12 import com.diligrp.cashier.shared.annotation.ParamLogPrint;
11 13 import com.diligrp.cashier.shared.annotation.RepeatSubmit;
... ... @@ -20,6 +22,8 @@ import org.springframework.web.bind.annotation.RequestBody;
20 22 import org.springframework.web.bind.annotation.RequestMapping;
21 23 import org.springframework.web.bind.annotation.RestController;
22 24  
  25 +import java.util.List;
  26 +
23 27 /**
24 28 * 扫码下单接口
25 29 * Pos扫支付码后,推送订单信息到商户,商户返回收银台链接
... ... @@ -28,9 +32,10 @@ import org.springframework.web.bind.annotation.RestController;
28 32 @RequestMapping(path = {"/api/rt/mall/scan", "/rt/mall/scan"})
29 33 @Validated
30 34 public class RtMallOrderPaymentApi {
31   -
32 35 @Resource
33 36 private MallBizPaymentService mallBizPaymentService;
  37 + @Resource
  38 + private MallBizOrderService mallBizOrderService;
34 39  
35 40 /**
36 41 * 扫码下单接口
... ... @@ -41,9 +46,10 @@ public class RtMallOrderPaymentApi {
41 46 @Sign(sign = RtMallSign.class)
42 47 @RepeatSubmit(prefix = "order_payment_sync:", value = "#req['trade_id']", duplicationSubmit = SpelDuplicationSubmit.class)
43 48 public RtMarkMessage<OrderSuccessVO> createOrderPayment(@Valid @RequestBody Object req) {
44   - OrderPaymentCO orderPaymentCO = JsonUtils.convertValue(req, OrderPaymentCO.class);
45   - RtMallValidateUtils.valid(orderPaymentCO);
46   - return RtMarkMessage.success(mallBizPaymentService.createOrderPayment(orderPaymentCO));
  49 + OrderCO orderCo = JsonUtils.convertValue(req, OrderCO.class);
  50 + orderCo.setOrderType(OrderType.OFFLINE_SCAN.code);
  51 + RtMallValidateUtils.valid(orderCo);
  52 + return RtMarkMessage.success(mallBizOrderService.createOrder(List.of(orderCo)));
47 53 }
48 54  
49 55 /**
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/dao/MallBizOrderDao.java
... ... @@ -32,4 +32,10 @@ public interface MallBizOrderDao extends MybatisMapperSupport {
32 32 void batchInsert(@Param("list") List<MallBizOrder> mallBizOrders);
33 33  
34 34 MallBizOrder findByOrderIdAndTradeId(String orderId, String tradeId);
  35 +
  36 + List<MallBizOrder> listByOrderIds(@Param("list") List<String> list, @Param("source") Integer source);
  37 +
  38 + void batchUpdate(@Param("list") List<MallBizOrder> updateOrders, @Param("source") Integer source);
  39 +
  40 + void updateByIds(@Param("ids") List<Long> bizOrderIds, @Param("state") Integer state);
35 41 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/dao/MallBizPaymentDao.java
... ... @@ -2,6 +2,7 @@ package com.diligrp.cashier.mall.dao;
2 2  
3 3 import com.diligrp.cashier.mall.model.MallBizPayment;
4 4 import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport;
  5 +import org.apache.ibatis.annotations.Param;
5 6  
6 7 /**
7 8 * MallBizPaymentDao
... ... @@ -21,5 +22,7 @@ public interface MallBizPaymentDao extends MybatisMapperSupport {
21 22  
22 23 int updateByPrimaryKey(MallBizPayment record);
23 24  
  25 + MallBizPayment getByPayTradeId(@Param("tradeId") String tradeId);
  26 +
24 27 MallBizPayment findByOrderIdAndTradeId(String orderId, String tradeId);
25 28 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/dao/MallBizPaymentOrderDao.java
1 1 package com.diligrp.cashier.mall.dao;
2 2  
  3 +import com.diligrp.cashier.mall.model.MallBizPayment;
3 4 import com.diligrp.cashier.mall.model.MallBizPaymentOrder;
4 5 import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport;
5 6 import org.apache.ibatis.annotations.Param;
... ... @@ -26,4 +27,8 @@ public interface MallBizPaymentOrderDao extends MybatisMapperSupport {
26 27 void batchInsert(@Param("list") List<MallBizPaymentOrder> mallBizPaymentOrders);
27 28  
28 29 MallBizPaymentOrder getMallBizPaymentOrder(MallBizPaymentOrder mallBizPaymentOrder);
  30 +
  31 + List<MallBizPaymentOrder> listPaymentOrderByBizPaymentId(@Param("bizPaymentId") Long bizPaymentId);
  32 +
  33 + void updateByPayment(MallBizPayment mallBizPayment);
29 34 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/co/AuthLoginCO.java
... ... @@ -33,7 +33,12 @@ public class AuthLoginCO {
33 33 /**
34 34 * 商户编号
35 35 */
36   - @NotBlank(message = "商户编号不能为空!")
  36 + @NotNull(message = "市场不能为空!")
  37 + private Long firmId;
  38 +
  39 + /**
  40 + * 商户id
  41 + */
37 42 private String mchId;
38 43  
39 44 /**
... ... @@ -105,6 +110,14 @@ public class AuthLoginCO {
105 110 this.source = source;
106 111 }
107 112  
  113 + public Long getFirmId() {
  114 + return firmId;
  115 + }
  116 +
  117 + public void setFirmId(Long firmId) {
  118 + this.firmId = firmId;
  119 + }
  120 +
108 121 public String getMchId() {
109 122 return mchId;
110 123 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/co/OrderPaymentCO.java
1 1 package com.diligrp.cashier.mall.domain.rtmall.co;
2 2  
3 3 import com.diligrp.cashier.mall.domain.rtmall.RtMarkBaseCO;
4   -import com.diligrp.cashier.mall.util.TimestampToLocalDateTimeDeserializer;
  4 +import com.diligrp.cashier.shared.jackson.deserializer.SecondToDateDeserializer;
5 5 import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
6 6 import jakarta.validation.constraints.NotBlank;
7 7 import jakarta.validation.constraints.NotNull;
... ... @@ -47,7 +47,7 @@ public class OrderPaymentCO extends RtMarkBaseCO {
47 47 * 支付单创建时间
48 48 */
49 49 @NotNull(message = "order_time is required")
50   - @JsonDeserialize(using = TimestampToLocalDateTimeDeserializer.class)
  50 + @JsonDeserialize(using = SecondToDateDeserializer.class)
51 51 private LocalDateTime orderTime;
52 52  
53 53 /**
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/co/RefundCO.java
... ... @@ -21,6 +21,11 @@ public class RefundCO extends RtMarkBaseCO {
21 21 private String orderId;
22 22  
23 23 /**
  24 + * 支付流水号
  25 + */
  26 + private String tradeId;
  27 +
  28 + /**
24 29 * 业务侧退款单号
25 30 */
26 31 @NotBlank(message = "refund bn is required")
... ... @@ -57,6 +62,14 @@ public class RefundCO extends RtMarkBaseCO {
57 62 this.orderId = orderId;
58 63 }
59 64  
  65 + public String getTradeId() {
  66 + return tradeId;
  67 + }
  68 +
  69 + public void setTradeId(String tradeId) {
  70 + this.tradeId = tradeId;
  71 + }
  72 +
60 73 public String getRefundBn() {
61 74 return refundBn;
62 75 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/co/RefundStatusCO.java
... ... @@ -18,6 +18,11 @@ public class RefundStatusCO extends RtMarkBaseCO {
18 18 private String orderId;
19 19  
20 20 /**
  21 + * 支付流水号
  22 + */
  23 + private String tradeId;
  24 +
  25 + /**
21 26 * 业务侧退款单号
22 27 */
23 28 @NotBlank(message = "refund bn is required")
... ... @@ -43,6 +48,14 @@ public class RefundStatusCO extends RtMarkBaseCO {
43 48 this.orderId = orderId;
44 49 }
45 50  
  51 + public String getTradeId() {
  52 + return tradeId;
  53 + }
  54 +
  55 + public void setTradeId(String tradeId) {
  56 + this.tradeId = tradeId;
  57 + }
  58 +
46 59 public String getUserCode() {
47 60 return userCode;
48 61 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/dto/HourlyRefundCallbackDTO.java
... ... @@ -5,8 +5,8 @@ import com.diligrp.cashier.mall.domain.rtmall.RtMarkBaseCO;
5 5 import com.diligrp.cashier.mall.model.MallBizOrder;
6 6 import com.diligrp.cashier.mall.model.MallBizRefund;
7 7 import com.diligrp.cashier.mall.property.RtMallDynamicProperty;
8   -import com.diligrp.cashier.mall.type.RefundState;
9 8 import com.diligrp.cashier.shared.jackson.serialization.DateToSecondSerializer;
  9 +import com.diligrp.cashier.trade.type.TradeState;
10 10 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
11 11  
12 12 import java.time.LocalDateTime;
... ... @@ -73,7 +73,7 @@ public class HourlyRefundCallbackDTO extends RtMarkBaseCO {
73 73 dto.setRefundBn(mallBizRefund.getRefundBn());
74 74 dto.setRefundId(mallBizRefund.getRefundTradeId());
75 75 dto.setPayFee(mallBizRefund.getRefundFee());
76   - if (Objects.equals(mallBizRefund.getRefundState(), RefundState.SUCCESS.code)) {
  76 + if (Objects.equals(mallBizRefund.getRefundState(), TradeState.SUCCESS.getCode())) {
77 77 dto.setRefundStatus("SUCCESS");
78 78 } else {
79 79 dto.setRefundStatus("ERROR");
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/vo/RefundVO.java
... ... @@ -27,6 +27,7 @@ public class RefundVO {
27 27  
28 28 /**
29 29 * 退款状态
  30 + * @see com.diligrp.cashier.trade.type.TradeState
30 31 */
31 32 private Integer refundStatus;
32 33  
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/exception/MallExceptionHandler.java
... ... @@ -29,6 +29,6 @@ public class MallExceptionHandler {
29 29 @ExceptionHandler(Exception.class)
30 30 public RtMarkMessage<?> exception(Exception ex) {
31 31 LOG.warn("exception", ex);
32   - return RtMarkMessage.failure(RtMarkErrorCode.E5000.getCode());
  32 + return RtMarkMessage.failure(RtMarkErrorCode.E5000.getCode(), RtMarkErrorCode.E5000.getMessage());
33 33 }
34 34 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/model/MallBizOrder.java
... ... @@ -49,6 +49,11 @@ public class MallBizOrder extends BaseDO {
49 49 private String channel;
50 50  
51 51 /**
  52 + * 市场id
  53 + */
  54 + private Long firmId;
  55 +
  56 + /**
52 57 * 商户ID
53 58 */
54 59 private String mchId;
... ... @@ -179,6 +184,14 @@ public class MallBizOrder extends BaseDO {
179 184 this.channel = channel;
180 185 }
181 186  
  187 + public Long getFirmId() {
  188 + return firmId;
  189 + }
  190 +
  191 + public void setFirmId(Long firmId) {
  192 + this.firmId = firmId;
  193 + }
  194 +
182 195 public String getMchId() {
183 196 return mchId;
184 197 }
... ... @@ -346,6 +359,7 @@ public class MallBizOrder extends BaseDO {
346 359  
347 360 mallBizOrder.setId(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_ORDER_ID));
348 361 mallBizOrder.setOrderNo(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_ORDER_ID).toString());
  362 + mallBizOrder.setOrderExpire(Optional.ofNullable(orderCo.getOrderExpire()).orElse(10));
349 363 BeanUtils.copyProperties(authLogin, mallBizOrder);
350 364  
351 365 // 订单地址
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/model/MallBizPayment.java
... ... @@ -2,14 +2,16 @@ package com.diligrp.cashier.mall.model;
2 2  
3 3 import com.diligrp.cashier.mall.domain.rtmall.vo.OrderPaymentVO;
4 4 import com.diligrp.cashier.mall.property.RtMallDynamicProperty;
5   -import com.diligrp.cashier.mall.type.PayState;
  5 +import com.diligrp.cashier.mall.type.OrderType;
6 6 import com.diligrp.cashier.mall.util.MallSnowflakeKeyManager;
7 7 import com.diligrp.cashier.shared.domain.BaseDO;
  8 +import com.diligrp.cashier.shared.spi.domain.PaymentResultBO;
8 9 import com.diligrp.cashier.shared.util.SpringContextUtils;
9 10 import com.diligrp.cashier.trade.type.SnowflakeKey;
10 11  
11 12 import java.time.LocalDateTime;
12 13 import java.util.List;
  14 +import java.util.Objects;
13 15 import java.util.stream.Collectors;
14 16  
15 17 /**
... ... @@ -39,11 +41,21 @@ public class MallBizPayment extends BaseDO {
39 41 private String tradeId;
40 42  
41 43 /**
  44 + * 用户code
  45 + */
  46 + private String userCode;
  47 +
  48 + /**
42 49 * dili交易流水号
43 50 */
44 51 private String payTradeId;
45 52  
46 53 /**
  54 + * 市场id
  55 + */
  56 + private Long firmId;
  57 +
  58 + /**
47 59 * 商户code
48 60 */
49 61 private String mchId;
... ... @@ -85,7 +97,7 @@ public class MallBizPayment extends BaseDO {
85 97  
86 98 /**
87 99 * 支付状态
88   - * @see PayState
  100 + * @see com.diligrp.cashier.trade.type.TradeState
89 101 */
90 102 private Integer payState;
91 103  
... ... @@ -107,7 +119,12 @@ public class MallBizPayment extends BaseDO {
107 119 private String cashierUrl;
108 120  
109 121 /**
110   - * 支付回调url
  122 + * 三方支付成功回调页面
  123 + */
  124 + private String cashierResultUrl;
  125 +
  126 + /**
  127 + * 支付成功回调外部url
111 128 */
112 129 private String paymentCallback;
113 130  
... ... @@ -136,7 +153,9 @@ public class MallBizPayment extends BaseDO {
136 153 mallBizPayment.setBizOrderId(mallBizOrder.stream().map(vo -> vo.getId().toString()).collect(Collectors.joining(",")));
137 154 mallBizPayment.setOrderId(mallBizOrder.stream().map(MallBizOrder::getOrderId).collect(Collectors.joining(",")));
138 155 mallBizPayment.setTradeId(mallBizOrder.stream().flatMap(vo -> vo.getMallBizPaymentOrders().stream().map(MallBizPaymentOrder::getTradeId)).collect(Collectors.joining(",")));
  156 + mallBizPayment.setFirmId(mallBizOrder.getFirst().getFirmId());
139 157 mallBizPayment.setMchId(mallBizOrder.getFirst().getMchId());
  158 + mallBizPayment.setUserCode(mallBizOrder.getFirst().getUserCode());
140 159  
141 160 long sum = mallBizOrder.stream().flatMap(vo -> vo.getMallBizPaymentOrders().stream().map(MallBizPaymentOrder::getPayFee)).mapToLong(vo -> vo).sum();
142 161 mallBizPayment.setPayFee(sum);
... ... @@ -146,6 +165,11 @@ public class MallBizPayment extends BaseDO {
146 165 RtMallDynamicProperty.AppSecretDynamicProperty property = rtMallDynamicProperty.getBySourceAndType(mallBizOrder.getFirst().getSource(), mallBizOrder.getFirst().getOrderType());
147 166 mallBizPayment.setPaymentCallback(property.getCallbackDomain());
148 167  
  168 + // 大润发只支持一个订单单独结算 后期如何支持多订单组合支付
  169 + if (Objects.equals(mallBizOrder.getFirst().getOrderType(), OrderType.MINI_PROGRAM.code)) {
  170 + mallBizPayment.setCashierResultUrl(String.format(property.getCashierResultUrl(), mallBizOrder.getFirst().getOrderId()));
  171 + }
  172 +
149 173 // 完善mall_biz_payment_order
150 174 List<MallBizPaymentOrder> bizPaymentOrders = mallBizOrder.stream()
151 175 .flatMap(vo -> vo.getMallBizPaymentOrders().stream())
... ... @@ -189,6 +213,14 @@ public class MallBizPayment extends BaseDO {
189 213 this.tradeId = tradeId;
190 214 }
191 215  
  216 + public String getUserCode() {
  217 + return userCode;
  218 + }
  219 +
  220 + public void setUserCode(String userCode) {
  221 + this.userCode = userCode;
  222 + }
  223 +
192 224 public String getPayTradeId() {
193 225 return payTradeId;
194 226 }
... ... @@ -197,6 +229,14 @@ public class MallBizPayment extends BaseDO {
197 229 this.payTradeId = payTradeId;
198 230 }
199 231  
  232 + public Long getFirmId() {
  233 + return firmId;
  234 + }
  235 +
  236 + public void setFirmId(Long firmId) {
  237 + this.firmId = firmId;
  238 + }
  239 +
200 240 public String getMchId() {
201 241 return mchId;
202 242 }
... ... @@ -293,6 +333,14 @@ public class MallBizPayment extends BaseDO {
293 333 this.cashierUrl = cashierUrl;
294 334 }
295 335  
  336 + public String getCashierResultUrl() {
  337 + return cashierResultUrl;
  338 + }
  339 +
  340 + public void setCashierResultUrl(String cashierResultUrl) {
  341 + this.cashierResultUrl = cashierResultUrl;
  342 + }
  343 +
296 344 public String getPaymentCallback() {
297 345 return paymentCallback;
298 346 }
... ... @@ -322,4 +370,18 @@ public class MallBizPayment extends BaseDO {
322 370 orderPaymentVO.setTransactionId(payTradeId);
323 371 return orderPaymentVO;
324 372 }
  373 +
  374 + /**
  375 + * payCallBack
  376 + */
  377 + public void payCallBack(PaymentResultBO event) {
  378 + this.setPayState(event.getState());
  379 + this.setPayTime(event.getWhen());
  380 + // TODO 2026/1/6: 先固定
  381 + this.setUsername("人工");
  382 + this.setExt(event.getPayerId());
  383 + this.setChannelId(event.getOutPayType());
  384 +
  385 + // TODO 2026/1/6: 其它信息
  386 + }
325 387 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/model/MallBizPaymentOrder.java
1 1 package com.diligrp.cashier.mall.model;
2 2  
3 3 import com.diligrp.cashier.mall.domain.rtmall.vo.OrderPaymentVO;
  4 +import com.diligrp.cashier.mall.type.PayState;
4 5 import com.diligrp.cashier.shared.domain.BaseDO;
  6 +import com.diligrp.cashier.trade.type.TradeState;
5 7  
6 8 import java.time.LocalDateTime;
7 9  
... ... @@ -47,7 +49,7 @@ public class MallBizPaymentOrder extends BaseDO {
47 49  
48 50 /**
49 51 * 支付状态
50   - * @see com.diligrp.cashier.mall.type.PayState
  52 + * @see TradeState
51 53 */
52 54 private Integer payState;
53 55  
... ... @@ -143,7 +145,7 @@ public class MallBizPaymentOrder extends BaseDO {
143 145 public OrderPaymentVO ofOrderPaymentVO() {
144 146 OrderPaymentVO orderPaymentVO = new OrderPaymentVO();
145 147 orderPaymentVO.setOutTradeNo(payTradeNo);
146   - orderPaymentVO.setPayStatus(payState);
  148 + orderPaymentVO.setPayStatus(PayState.convertState(payState));
147 149 orderPaymentVO.setPayFee(payFee);
148 150 orderPaymentVO.setPayTime(payTime);
149 151 orderPaymentVO.setTransactionId(payTradeId);
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/model/MallBizRefund.java
... ... @@ -3,7 +3,7 @@ package com.diligrp.cashier.mall.model;
3 3 import com.diligrp.cashier.mall.domain.rtmall.co.RefundCO;
4 4 import com.diligrp.cashier.mall.domain.rtmall.vo.RefundVO;
5 5 import com.diligrp.cashier.mall.property.RtMallDynamicProperty;
6   -import com.diligrp.cashier.mall.type.RefundState;
  6 +import com.diligrp.cashier.mall.type.PayState;
7 7 import com.diligrp.cashier.mall.util.MallSnowflakeKeyManager;
8 8 import com.diligrp.cashier.shared.domain.BaseDO;
9 9 import com.diligrp.cashier.shared.util.SpringContextUtils;
... ... @@ -46,6 +46,17 @@ public class MallBizRefund extends BaseDO {
46 46 private String tradeId;
47 47  
48 48 /**
  49 + * 市场id
  50 + */
  51 + private Long firmId;
  52 +
  53 + /**
  54 + * 商户code
  55 + */
  56 + private String mchId;
  57 +
  58 +
  59 + /**
49 60 * dili退款流水号
50 61 */
51 62 private String refundTradeId;
... ... @@ -92,7 +103,7 @@ public class MallBizRefund extends BaseDO {
92 103  
93 104 /**
94 105 * 退款状态
95   - * @see RefundState
  106 + * @see com.diligrp.cashier.trade.type.TradeState
96 107 */
97 108 private Integer refundState;
98 109  
... ... @@ -161,6 +172,23 @@ public class MallBizRefund extends BaseDO {
161 172 this.tradeId = tradeId;
162 173 }
163 174  
  175 + public Long getFirmId() {
  176 + return firmId;
  177 + }
  178 +
  179 + public void setFirmId(Long firmId) {
  180 + this.firmId = firmId;
  181 + }
  182 +
  183 + public String getMchId() {
  184 + return mchId;
  185 + }
  186 +
  187 + public void setMchId(String mchId) {
  188 + this.mchId = mchId;
  189 + }
  190 +
  191 +
164 192 public String getRefundTradeId() {
165 193 return refundTradeId;
166 194 }
... ... @@ -293,6 +321,8 @@ public class MallBizRefund extends BaseDO {
293 321 BeanUtils.copyProperties(refundCo, mallBizRefund);
294 322  
295 323 mallBizRefund.setOrderId(mallBizOrder.getOrderId());
  324 + mallBizRefund.setFirmId(mallBizOrder.getFirmId());
  325 + mallBizRefund.setMchId(mallBizOrder.getMchId());
296 326 mallBizRefund.setRefundTradeNo(snowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_REFUND_ID).toString());
297 327 mallBizRefund.setTradeId(mallBizPaymentOrder.getTradeId());
298 328 mallBizRefund.setPayTradeNo(mallBizPaymentOrder.getPayTradeNo());
... ... @@ -326,7 +356,7 @@ public class MallBizRefund extends BaseDO {
326 356 refundVO.setOutRefundNo(this.getRefundTradeNo());
327 357 refundVO.setOutTradeNo(this.getPayTradeNo());
328 358 refundVO.setRefundFee(this.getRefundFee());
329   - refundVO.setRefundStatus(this.getRefundState());
  359 + refundVO.setRefundStatus(PayState.convertState(this.getRefundState()));
330 360 refundVO.setRefundTime(this.getRefundTime());
331 361 refundVO.setRefuseReason(this.getRefuseReason());
332 362 return refundVO;
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/property/RtMallDynamicProperty.java
... ... @@ -30,6 +30,9 @@ public class RtMallDynamicProperty {
30 30 @Value("${source:1}")
31 31 private Integer source;
32 32  
  33 + @Value("${mchId:}")
  34 + private String mchId;
  35 +
33 36 @Value("${orderType:3}")
34 37 private Integer orderType;
35 38  
... ... @@ -62,6 +65,14 @@ public class RtMallDynamicProperty {
62 65 this.source = source;
63 66 }
64 67  
  68 + public String getMchId() {
  69 + return mchId;
  70 + }
  71 +
  72 + public void setMchId(String mchId) {
  73 + this.mchId = mchId;
  74 + }
  75 +
65 76 public String getAppKey() {
66 77 return appKey;
67 78 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/MallBizOrderService.java
... ... @@ -37,4 +37,11 @@ public interface MallBizOrderService {
37 37 * getByOrderId
38 38 */
39 39 MallBizOrder getByOrderId(String orderId);
  40 +
  41 + /**
  42 + * 通过业务获取订单ID
  43 + *
  44 + * @param bizOrderId 商务订单ID
  45 + */
  46 + MallBizOrder getById(Long bizOrderId);
40 47 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/MallBizPaymentService.java
... ... @@ -6,18 +6,23 @@ import com.diligrp.cashier.mall.domain.rtmall.vo.OrderSuccessVO;
6 6 import com.diligrp.cashier.mall.model.MallBizPayment;
7 7 import com.diligrp.cashier.mall.model.MallBizPaymentOrder;
8 8  
  9 +import java.util.List;
  10 +
9 11 /**
10 12 * @ClassName MallBizPaymentService.java
11 13 * @author dengwei
12 14 * @version 1.0.0
13 15 * @Description MallBizPaymentService
14   - * @date 2025-12-26 14:46
15 16 */
16 17 public interface MallBizPaymentService {
17 18 void save(MallBizPayment mallBizPayment);
18 19  
19 20 MallBizPaymentOrder paymentOrderInfo(MallBizPaymentOrder mallBizPaymentOrder);
20 21  
  22 + MallBizPayment getByPayTradeId(String tradeId);
  23 +
  24 + List<MallBizPaymentOrder> listPaymentOrderByBizPaymentId(Long bizPaymentId);
  25 +
21 26 /**
22 27 * 扫码下单接口
23 28 * Pos扫支付码后,推送订单信息到商户,商户返回收银台链接
... ... @@ -34,4 +39,6 @@ public interface MallBizPaymentService {
34 39 * @param allocateCO 分摊回调请求
35 40 */
36 41 void handlePaymentAllocate(PaymentAllocateCO allocateCO);
  42 +
  43 + void updateByPay(MallBizPayment mallBizPayment);
37 44 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/PayNotifyService.java
1 1 package com.diligrp.cashier.mall.service.biz;
2 2  
  3 +import com.diligrp.cashier.shared.spi.IPaymentEventListener;
  4 +
3 5 /**
4 6 * @ClassName PayNotifyService.java
5 7 * @author dengwei
6 8 * @version 1.0.0
7 9 * @Description PayNotifyService
8 10 */
9   -public interface PayNotifyService {
  11 +public interface PayNotifyService extends IPaymentEventListener {
10 12 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/impl/MallBizOrderServiceImpl.java
1 1 package com.diligrp.cashier.mall.service.biz.impl;
2 2  
3   -import cn.hutool.core.util.IdUtil;
4 3 import com.diligrp.cashier.mall.MallConstants;
5 4 import com.diligrp.cashier.mall.dao.MallBizOrderAddressDao;
6 5 import com.diligrp.cashier.mall.dao.MallBizOrderDao;
... ... @@ -19,8 +18,12 @@ import com.diligrp.cashier.mall.service.biz.MallBizOrderService;
19 18 import com.diligrp.cashier.mall.service.biz.MallBizPaymentService;
20 19 import com.diligrp.cashier.mall.type.OrderState;
21 20 import com.diligrp.cashier.mall.type.RtMarkErrorCode;
  21 +import com.diligrp.cashier.shared.spi.ICashierDeskManager;
  22 +import com.diligrp.cashier.shared.spi.domain.CashierOrderBO;
  23 +import com.diligrp.cashier.shared.spi.domain.PaymentUrlBO;
22 24 import com.diligrp.cashier.shared.util.JsonUtils;
23 25 import jakarta.annotation.Resource;
  26 +import org.apache.commons.collections4.CollectionUtils;
24 27 import org.slf4j.Logger;
25 28 import org.slf4j.LoggerFactory;
26 29 import org.springframework.beans.BeanUtils;
... ... @@ -29,8 +32,10 @@ import org.springframework.stereotype.Service;
29 32 import org.springframework.transaction.annotation.Transactional;
30 33  
31 34 import java.util.List;
  35 +import java.util.Map;
32 36 import java.util.Objects;
33 37 import java.util.Optional;
  38 +import java.util.stream.Collectors;
34 39  
35 40 /**
36 41 * @ClassName MallBizOrderServiceImpl.java
... ... @@ -55,6 +60,8 @@ public class MallBizOrderServiceImpl implements MallBizOrderService {
55 60 private MallBizOrderAddressDao mallBizOrderAddressDao;
56 61 @Resource
57 62 private MallBizOrderItemDao mallBizOrderItemDao;
  63 + @Resource
  64 + private ICashierDeskManager cashierDeskManager;
58 65  
59 66 /**
60 67 * createOrder
... ... @@ -71,8 +78,8 @@ public class MallBizOrderServiceImpl implements MallBizOrderService {
71 78 // payment
72 79 MallBizPayment mallBizPayment = MallBizPayment.of(mallBizOrders);
73 80  
74   - // TODO 2025/12/30: 预支付信息 收银台地址信息
75   - mallBizPayment.setCashierUrl("https://cashier.test.gszdtop.com?payTradeNo=" + mallBizPayment.getPayTradeNo());
  81 + // 预支付信息 收银台地址信息
  82 + submitOrder(mallBizPayment, mallBizOrders);
76 83  
77 84 // save
78 85 commonCreate(mallBizOrders, mallBizPayment);
... ... @@ -137,16 +144,18 @@ public class MallBizOrderServiceImpl implements MallBizOrderService {
137 144 */
138 145 public void commonCreate(final List<MallBizOrder> mallBizOrders,
139 146 final MallBizPayment mallBizPayment) {
140   - // order
141   - Optional.of(mallBizOrders)
142   - .ifPresent(mallBizOrderDao::batchInsert);
143   -
144   - // mall_biz_order_address
145   - List<MallBizOrderAddress> mallBizOrderAddresses = mallBizOrders.stream().map(MallBizOrder::getMallBizOrderAddress).toList();
146   - Optional.of(mallBizOrderAddresses)
147   - .ifPresent(mallBizOrderAddress -> {
148   - mallBizOrderAddressDao.batchInsert(mallBizOrderAddress);
149   - });
  147 + if (CollectionUtils.isEmpty(mallBizOrders)) {
  148 + return;
  149 + }
  150 +
  151 + // order - 扫码购存在相同订单重复扫码下单接口
  152 + List<MallBizOrder> existOrders = mallBizOrderDao.listByOrderIds(mallBizOrders.stream().map(MallBizOrder::getOrderId).toList(), mallBizOrders.getFirst().getSource());
  153 +
  154 + // save
  155 + batchInsert(mallBizOrders, existOrders);
  156 +
  157 + // update
  158 + batchUpdate(mallBizOrders, existOrders);
150 159  
151 160 // mall_biz_order_item
152 161 List<MallBizOrderItem> orderItems = mallBizOrders.stream().flatMap(vo -> vo.getMallBizOrderItems().stream()).toList();
... ... @@ -181,4 +190,71 @@ public class MallBizOrderServiceImpl implements MallBizOrderService {
181 190 }
182 191 return mallBizOrder;
183 192 }
  193 +
  194 + @Override
  195 + public MallBizOrder getById(Long bizOrderId) {
  196 + MallBizOrder mallBizOrder = mallBizOrderDao.selectByPrimaryKey(bizOrderId);
  197 + if (Objects.isNull(mallBizOrder)) {
  198 + throw new RtMartMallException(RtMarkErrorCode.E5004);
  199 + }
  200 + return mallBizOrder;
  201 + }
  202 +
  203 +
  204 + /**
  205 + * batchInsert
  206 + */
  207 + private void batchInsert(List<MallBizOrder> mallBizOrders,
  208 + List<MallBizOrder> existOrders) {
  209 + List<String> existOrderIds = existOrders.stream().map(MallBizOrder::getOrderId).toList();
  210 +
  211 + List<MallBizOrder> saveOrders = mallBizOrders.stream().filter(vo -> !existOrderIds.contains(vo.getOrderId())).toList();
  212 + if (CollectionUtils.isNotEmpty(saveOrders)) {
  213 + mallBizOrderDao.batchInsert(saveOrders);
  214 +
  215 + // mall_biz_order_address
  216 + List<MallBizOrderAddress> mallBizOrderAddresses = mallBizOrders.stream().map(MallBizOrder::getMallBizOrderAddress).toList();
  217 + Optional.of(mallBizOrderAddresses)
  218 + .ifPresent(mallBizOrderAddress -> {
  219 + mallBizOrderAddressDao.batchInsert(mallBizOrderAddress);
  220 + });
  221 + }
  222 + }
  223 +
  224 + /**
  225 + * batchUpdate
  226 + */
  227 + private void batchUpdate(final List<MallBizOrder> mallBizOrders,
  228 + final List<MallBizOrder> existOrders) {
  229 + List<String> existOrderIds = existOrders.stream().map(MallBizOrder::getOrderId).toList();
  230 +
  231 + List<MallBizOrder> updateOrders = mallBizOrders.stream().filter(vo -> existOrderIds.contains(vo.getOrderId())).toList();
  232 + if (CollectionUtils.isNotEmpty(updateOrders)) {
  233 + mallBizOrderDao.batchUpdate(updateOrders, mallBizOrders.getFirst().getSource());
  234 + }
  235 + }
  236 +
  237 + /**
  238 + * submitOrder
  239 + */
  240 + private void submitOrder(final MallBizPayment mallBizPayment,
  241 + final List<MallBizOrder> mallBizOrders) {
  242 + CashierOrderBO cashierOrderBO = new CashierOrderBO();
  243 + cashierOrderBO.setMchId(Long.valueOf(mallBizPayment.getMchId()));
  244 + cashierOrderBO.setUserId(mallBizPayment.getUserCode());
  245 + cashierOrderBO.setCashierType(2);
  246 + cashierOrderBO.setGoods("大润发支付");
  247 + cashierOrderBO.setAmount(mallBizPayment.getPayFee());
  248 + cashierOrderBO.setOutTradeNo(mallBizPayment.getPayTradeNo());
  249 + // 支付成功跳转页面
  250 + cashierOrderBO.setRedirectUrl(mallBizPayment.getCashierResultUrl());
  251 + cashierOrderBO.setDescription("大润发在线支付");
  252 + cashierOrderBO.setAttach("大润发在线支付");
  253 + cashierOrderBO.setTimeout(mallBizOrders.getFirst().getOrderExpire() * 1000);
  254 + PaymentUrlBO paymentUrlBO = cashierDeskManager.submitOrder(cashierOrderBO);
  255 + Optional.ofNullable(paymentUrlBO).ifPresent(vo -> {
  256 + mallBizPayment.setCashierUrl(vo.paymentUrl());
  257 + mallBizPayment.setPayTradeId(vo.tradeId());
  258 + });
  259 + }
184 260 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/impl/MallBizPaymentServiceImpl.java
... ... @@ -6,6 +6,7 @@ import com.diligrp.cashier.mall.dao.MallBizOrderDao;
6 6 import com.diligrp.cashier.mall.dao.MallBizOrderItemDao;
7 7 import com.diligrp.cashier.mall.dao.MallBizPaymentDao;
8 8 import com.diligrp.cashier.mall.dao.MallBizPaymentOrderDao;
  9 +import com.diligrp.cashier.mall.exception.RtMartMallException;
9 10 import com.diligrp.cashier.mall.domain.rtmall.co.AuthLoginCO;
10 11 import com.diligrp.cashier.mall.domain.rtmall.co.OrderInfoCO;
11 12 import com.diligrp.cashier.mall.domain.rtmall.co.OrderPaymentCO;
... ... @@ -21,6 +22,7 @@ import com.diligrp.cashier.mall.model.MallBizPaymentOrder;
21 22 import com.diligrp.cashier.mall.property.MallDynamicProperty;
22 23 import com.diligrp.cashier.mall.property.RtMallDynamicProperty;
23 24 import com.diligrp.cashier.mall.service.biz.MallBizPaymentService;
  25 +import com.diligrp.cashier.mall.type.RtMarkErrorCode;
24 26 import com.diligrp.cashier.mall.type.OrderState;
25 27 import com.diligrp.cashier.mall.type.PayState;
26 28 import com.diligrp.cashier.mall.type.RtMarkErrorCode;
... ... @@ -37,6 +39,9 @@ import org.springframework.data.redis.core.RedisTemplate;
37 39 import org.springframework.stereotype.Service;
38 40 import org.springframework.transaction.annotation.Transactional;
39 41  
  42 +import java.util.List;
  43 +import java.util.Objects;
  44 +
40 45 import java.util.ArrayList;
41 46 import java.util.List;
42 47 import java.util.Objects;
... ... @@ -87,6 +92,26 @@ public class MallBizPaymentServiceImpl implements MallBizPaymentService {
87 92 }
88 93  
89 94 /**
  95 + * getByPayTradeId
  96 + */
  97 + @Override
  98 + public MallBizPayment getByPayTradeId(String tradeId) {
  99 + MallBizPayment mallBizPayment = mallBizPaymentDao.getByPayTradeId(tradeId);
  100 + if (Objects.isNull(mallBizPayment)) {
  101 + throw new RtMartMallException(RtMarkErrorCode.E5004);
  102 + }
  103 + return mallBizPayment;
  104 + }
  105 +
  106 + /**
  107 + * getMallBizPaymentOrderByBizPaymentId
  108 + */
  109 + @Override
  110 + public List<MallBizPaymentOrder> listPaymentOrderByBizPaymentId(Long bizPaymentId) {
  111 + return mallBizPaymentOrderDao.listPaymentOrderByBizPaymentId(bizPaymentId);
  112 + }
  113 +
  114 + /**
90 115 * 扫码下单接口
91 116 * Pos扫支付码后,推送订单信息到商户,商户返回收银台链接
92 117 * 创建订单(商品为空,待分摊后同步)+ 支付记录
... ... @@ -225,6 +250,15 @@ public class MallBizPaymentServiceImpl implements MallBizPaymentService {
225 250 }
226 251  
227 252 /**
  253 + * updateByPayment
  254 + */
  255 + @Override
  256 + public void updateByPay(MallBizPayment mallBizPayment) {
  257 + mallBizPaymentDao.updateByPrimaryKeySelective(mallBizPayment);
  258 + mallBizPaymentOrderDao.updateByPayment(mallBizPayment);
  259 + }
  260 +
  261 + /**
228 262 * 处理单个支付流水的分摊通知
229 263 * 1. 调用大润发订单详情接口获取商品信息
230 264 * 2. 更新订单状态
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/impl/PayNotifyServiceImpl.java
1 1 package com.diligrp.cashier.mall.service.biz.impl;
2 2  
  3 +import com.diligrp.cashier.mall.context.MallInitializeContext;
  4 +import com.diligrp.cashier.mall.model.MallBizOrder;
  5 +import com.diligrp.cashier.mall.model.MallBizPayment;
  6 +import com.diligrp.cashier.mall.service.biz.MallBizOrderService;
  7 +import com.diligrp.cashier.mall.service.biz.MallBizPaymentService;
3 8 import com.diligrp.cashier.mall.service.biz.PayNotifyService;
  9 +import com.diligrp.cashier.shared.annotation.ParamLogPrint;
  10 +import com.diligrp.cashier.shared.spi.domain.PaymentResultBO;
  11 +import com.diligrp.cashier.shared.spi.domain.RefundResultBO;
  12 +import jakarta.annotation.Resource;
  13 +import org.slf4j.Logger;
  14 +import org.slf4j.LoggerFactory;
4 15 import org.springframework.stereotype.Component;
5 16  
6 17 /**
... ... @@ -12,4 +23,36 @@ import org.springframework.stereotype.Component;
12 23 */
13 24 @Component
14 25 public class PayNotifyServiceImpl implements PayNotifyService {
  26 + private static final Logger log = LoggerFactory.getLogger(PayNotifyServiceImpl.class);
  27 +
  28 + @Resource
  29 + private MallBizOrderService mallBizOrderService;
  30 + @Resource
  31 + private MallBizPaymentService mallBizPaymentService;
  32 +
  33 + /**
  34 + * onEvent
  35 + * 支付成功回调
  36 + */
  37 + @Override
  38 + @ParamLogPrint(desc = "PaymentResultBO")
  39 + public void onEvent(PaymentResultBO event) {
  40 + String tradeId = event.getTradeId();
  41 + MallBizPayment mallBizPayment = mallBizPaymentService.getByPayTradeId(tradeId);
  42 +
  43 + Long bizOrderId = Long.valueOf(mallBizPayment.getBizOrderId().split(",")[0]);
  44 + MallBizOrder mallBizOrder = mallBizOrderService.getById(bizOrderId);
  45 +
  46 + MallInitializeContext.getBySource(mallBizOrder.getSource()).paymentOnEvent(event, mallBizPayment);
  47 + }
  48 +
  49 + /**
  50 + * onEvent
  51 + * 退款成功回调
  52 + */
  53 + @Override
  54 + @ParamLogPrint(desc = "RefundResultBO")
  55 + public void onEvent(RefundResultBO event) {
  56 +
  57 + }
15 58 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/sourcechannel/AbstractSourceChannel.java
... ... @@ -16,8 +16,8 @@ import com.diligrp.cashier.mall.model.MallBizRefund;
16 16 import com.diligrp.cashier.mall.property.RtMallDynamicProperty;
17 17 import com.diligrp.cashier.mall.service.biz.MallBizPaymentService;
18 18 import com.diligrp.cashier.mall.type.PayState;
19   -import com.diligrp.cashier.mall.type.RefundState;
20 19 import com.diligrp.cashier.mall.type.RtMarkErrorCode;
  20 +import com.diligrp.cashier.shared.spi.domain.PaymentResultBO;
21 21 import com.diligrp.cashier.shared.util.DateUtils;
22 22 import com.diligrp.cashier.shared.util.JsonUtils;
23 23 import jakarta.annotation.Resource;
... ... @@ -27,6 +27,8 @@ import org.slf4j.LoggerFactory;
27 27 import org.springframework.data.redis.core.RedisTemplate;
28 28 import org.springframework.transaction.annotation.Transactional;
29 29  
  30 +import java.util.Arrays;
  31 +import java.util.List;
30 32 import java.util.Objects;
31 33 import java.util.Optional;
32 34 import java.util.concurrent.TimeUnit;
... ... @@ -101,7 +103,7 @@ public abstract class AbstractSourceChannel {
101 103 MallBizRefund refund = MallBizRefund.of(refundCo, mallBizOrder, mallBizPaymentOrder);
102 104 // 售前取消 需不需要通知支付进行取消预支付信息
103 105 if (ObjectUtils.notEqual(mallBizPaymentOrder.getPayState(), PayState.PENDING.code)) {
104   - refund.setRefundState(RefundState.SUCCESS.code);
  106 + refund.setRefundState(PayState.SUCCESS.code);
105 107 } else {
106 108 // 支付成功才能退款
107 109 if (ObjectUtils.notEqual(mallBizPaymentOrder.getPayState(), PayState.SUCCESS.code)) {
... ... @@ -117,6 +119,25 @@ public abstract class AbstractSourceChannel {
117 119 }
118 120  
119 121 /**
  122 + * paymentOnEvent
  123 + * 支付成功回调
  124 + */
  125 + @Transactional(rollbackFor = {Exception.class})
  126 + public void paymentOnEvent(PaymentResultBO event, MallBizPayment mallBizPayment) {
  127 + log.info("paymentOnEvent event: {} mallBizPayment: {}", JsonUtils.toJsonString(event), JsonUtils.toJsonString(mallBizPayment));
  128 + // update mall_biz_order
  129 + List<Long> bizOrderIds = Arrays.stream(mallBizPayment.getBizOrderId().split(",")).map(Long::valueOf).toList();
  130 + mallBizOrderDao.updateByIds(bizOrderIds, PayState.SUCCESS.code);
  131 +
  132 + // update mall_biz_payment
  133 + mallBizPayment.payCallBack(event);
  134 + mallBizPaymentService.updateByPay(mallBizPayment);
  135 +
  136 + // notify other channel
  137 + payCallBack(event, mallBizPayment);
  138 + }
  139 +
  140 + /**
120 141 * 渠道
121 142 */
122 143 public abstract Integer source();
... ... @@ -134,7 +155,7 @@ public abstract class AbstractSourceChannel {
134 155 /**
135 156 * payCallBack
136 157 */
137   - public abstract void payCallBack(MallBizOrder mallBizOrder, MallBizPayment mallBizPayment, MallBizPaymentOrder mallBizPaymentOrder);
  158 + public abstract void payCallBack(PaymentResultBO event, MallBizPayment mallBizPayment);
138 159  
139 160 /**
140 161 * refundCallBack
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/sourcechannel/RtMallChannel.java
... ... @@ -14,14 +14,17 @@ import com.diligrp.cashier.mall.property.RtMallDynamicProperty;
14 14 import com.diligrp.cashier.mall.type.OrderSource;
15 15 import com.diligrp.cashier.mall.util.HttpClientUtils;
16 16 import com.diligrp.cashier.mall.util.RtMallSignMd5Utils;
  17 +import com.diligrp.cashier.shared.spi.domain.PaymentResultBO;
17 18 import com.diligrp.cashier.shared.util.DateUtils;
18 19 import com.diligrp.cashier.shared.util.JsonUtils;
19 20 import com.diligrp.cashier.shared.util.UrlParamParserUtils;
20 21 import com.fasterxml.jackson.core.type.TypeReference;
  22 +import org.apache.commons.collections4.CollectionUtils;
21 23 import org.slf4j.Logger;
22 24 import org.slf4j.LoggerFactory;
23 25 import org.springframework.stereotype.Component;
24 26  
  27 +import java.util.List;
25 28 import java.util.Map;
26 29  
27 30 /**
... ... @@ -40,6 +43,7 @@ public class RtMallChannel extends AbstractSourceChannel {
40 43 public String authUrl(AuthLoginCO authLogin, String token, long timestamp) {
41 44 RtMallDynamicProperty.AppSecretDynamicProperty property = rtMallDynamicProperty.getBySourceAndType(authLogin.getSource(), authLogin.getOrderType());
42 45 log.info("authUrl property: {}", JsonUtils.toJsonString(property));
  46 + authLogin.setMchId(property.getMchId());
43 47  
44 48 // 替换参数
45 49 String authUrl = property.getAuthUrl();
... ... @@ -68,19 +72,38 @@ public class RtMallChannel extends AbstractSourceChannel {
68 72  
69 73 /**
70 74 * payCallBack
  75 + */
  76 + @Override
  77 + public void payCallBack(PaymentResultBO event, MallBizPayment mallBizPayment) {
  78 + Long bizOrderId = Long.valueOf(mallBizPayment.getBizOrderId().split(",")[0]);
  79 + MallBizOrder mallBizOrder = mallBizOrderDao.selectByPrimaryKey(bizOrderId);
  80 +
  81 + List<MallBizPaymentOrder> mallBizPaymentOrders = mallBizPaymentService.listPaymentOrderByBizPaymentId(mallBizPayment.getId());
  82 + if (CollectionUtils.isNotEmpty(mallBizPaymentOrders)) {
  83 + payCallBack(mallBizOrder, mallBizPayment, mallBizPaymentOrders.get(0));
  84 + }
  85 + }
  86 +
  87 + /**
  88 + * payCallBack
71 89 * @see https://shopex.yuque.com/hl0rrx/vlp0m4/nkwt5yrhdfzoy78s?singleDoc#RtKpF
72 90 * 支付回调接口
73 91 *
74 92 */
75   - @Override
76 93 public void payCallBack(final MallBizOrder mallBizOrder,
77 94 final MallBizPayment mallBizPayment,
78 95 final MallBizPaymentOrder mallBizPaymentOrder) {
79 96 RtMallDynamicProperty.AppSecretDynamicProperty property = getProperty(mallBizOrder);
80 97 HourlyPaymentCallbackDTO hourlyPaymentCallback = HourlyPaymentCallbackDTO.of(mallBizPaymentOrder, property);
81 98 hourlyPaymentCallback.setSign(sign(hourlyPaymentCallback, property));
82   - RtMarkMessage<?> message = HttpClientUtils.postJson(mallBizPayment.getPaymentCallback(), hourlyPaymentCallback, null, new TypeReference<>() {
83   - }, "rt-mall");
  99 + RtMarkMessage<?> message = null;
  100 + try {
  101 + message = HttpClientUtils.postJson(mallBizPayment.getPaymentCallback(), hourlyPaymentCallback, null, new TypeReference<>() {
  102 + }, "rt-mall");
  103 + } catch (Exception e) {
  104 + // 失败-前期未考虑重试 人工补偿重试!!
  105 + log.warn("payCallBack failed: {}", JsonUtils.toJsonString(hourlyPaymentCallback), e);
  106 + }
84 107 log.info("payCallBack message: {}", JsonUtils.toJsonString(message));
85 108 }
86 109  
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/type/PayState.java
1 1 package com.diligrp.cashier.mall.type;
2 2  
  3 +import com.diligrp.cashier.mall.exception.RtMartMallException;
  4 +import com.diligrp.cashier.trade.type.TradeState;
  5 +
  6 +import java.util.Arrays;
  7 +import java.util.Objects;
  8 +
3 9 /**
4 10 * @ClassName PayStatus.java
5 11 * @author dengwei
... ... @@ -8,17 +14,19 @@ package com.diligrp.cashier.mall.type;
8 14 * @date 2025-12-26 11:01
9 15 */
10 16 public enum PayState {
11   - PENDING(0, "待支付"),
12   - SUCCESS(1, "成功"),
13   - FAILED(2, "失败"),
  17 + PENDING(0, "待支付", TradeState.PENDING),
  18 + SUCCESS(1, "成功", TradeState.SUCCESS),
  19 + FAILED(2, "失败", TradeState.FAILED),
14 20 ;
15 21  
16 22 public final int code;
17 23 public final String description;
  24 + public final TradeState tradeState;
18 25  
19   - PayState(int code, String description) {
  26 + PayState(int code, String description, TradeState tradeState) {
20 27 this.code = code;
21 28 this.description = description;
  29 + this.tradeState = tradeState;
22 30 }
23 31  
24 32 public int getCode() {
... ... @@ -28,4 +36,18 @@ public enum PayState {
28 36 public String getDescription() {
29 37 return description;
30 38 }
  39 +
  40 + public TradeState getTradeState() {
  41 + return tradeState;
  42 + }
  43 +
  44 + /**
  45 + * 根据支付返回code转换为三方业务系统code
  46 + */
  47 + public static Integer convertState(Integer tradeState) {
  48 + return Arrays.stream(values()).filter(vo -> Objects.equals(tradeState, vo.getTradeState().getCode()))
  49 + .map(PayState::getCode)
  50 + .findFirst()
  51 + .orElseThrow(() -> new RtMartMallException(RtMarkErrorCode.E5003));
  52 + }
31 53 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/type/RefundState.java deleted 100644 → 0
1   -package com.diligrp.cashier.mall.type;
2   -
3   -/**
4   - * @ClassName RefundStatus.java
5   - * @author dengwei
6   - * @version 1.0.0
7   - * @Description RefundStatus
8   - * @date 2025-12-26 11:08
9   - */
10   -public enum RefundState {
11   - PENDING(0, "待退款"),
12   - SUCCESS(1, "成功"),
13   - FAILED(2, "失败"),
14   - ;
15   -
16   - public final int code;
17   - public final String description;
18   -
19   - RefundState(int code, String description) {
20   - this.code = code;
21   - this.description = description;
22   - }
23   -
24   - public int getCode() {
25   - return code;
26   - }
27   -
28   - public String getDescription() {
29   - return description;
30   - }
31   -}
cashier-mall/src/main/java/com/diligrp/cashier/mall/util/TimestampToLocalDateTimeDeserializer.java deleted 100644 → 0
1   -package com.diligrp.cashier.mall.util;
2   -
3   -import com.fasterxml.jackson.core.JsonParser;
4   -import com.fasterxml.jackson.databind.DeserializationContext;
5   -import com.fasterxml.jackson.databind.JsonDeserializer;
6   -
7   -import java.io.IOException;
8   -import java.time.Instant;
9   -import java.time.LocalDateTime;
10   -import java.time.ZoneId;
11   -
12   -/**
13   - * 时间戳转LocalDateTime
14   - */
15   -public class TimestampToLocalDateTimeDeserializer extends JsonDeserializer<LocalDateTime> {
16   - @Override
17   - public LocalDateTime deserialize(JsonParser p, DeserializationContext ctx)
18   - throws IOException {
19   - long epochSecond = p.getLongValue();
20   -
21   - return LocalDateTime.ofInstant(
22   - Instant.ofEpochSecond(epochSecond),
23   - ZoneId.systemDefault());
24   - }
25   -}
cashier-mall/src/main/resources/com/diligrp/cashier/dao/mapper/MallBizOrderDao.xml
... ... @@ -7,6 +7,7 @@
7 7 <result column="order_id" jdbcType="VARCHAR" property="orderId" />
8 8 <result column="trade_id" jdbcType="VARCHAR" property="tradeId" />
9 9 <result column="channel" jdbcType="VARCHAR" property="channel" />
  10 + <result column="firm_id" jdbcType="VARCHAR" property="firmId" />
10 11 <result column="mch_id" jdbcType="VARCHAR" property="mchId" />
11 12 <result column="source" jdbcType="TINYINT" property="source" />
12 13 <result column="order_type" jdbcType="TINYINT" property="orderType" />
... ... @@ -28,7 +29,7 @@
28 29 <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
29 30 </resultMap>
30 31 <sql id="Base_Column_List">
31   - id, order_no, order_id, trade_id, channel, mch_id, source, order_type, user_code,
  32 + id, order_no, order_id, trade_id, channel, firm_id, mch_id, source, order_type, user_code,
32 33 username, company_code, shop_code, shop_name, total_amount, freight_fee, discount_fee, state,
33 34 rtmart_state, order_time, order_expire, version, created_time, modifier_name, modified_time
34 35 </sql>
... ... @@ -263,15 +264,9 @@
263 264 <if test="orderExpire != null">
264 265 order_expire = #{orderExpire,jdbcType=INTEGER},
265 266 </if>
266   - <if test="createdTime != null">
267   - created_time = #{createdTime,jdbcType=TIMESTAMP},
268   - </if>
269 267 <if test="modifierName != null">
270 268 modifier_name = #{modifierName,jdbcType=VARCHAR},
271 269 </if>
272   - <if test="modifiedTime != null">
273   - modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
274   - </if>
275 270 version = version + 1,
276 271 </set>
277 272 where id = #{id,jdbcType=BIGINT}
... ... @@ -305,7 +300,7 @@
305 300  
306 301 <insert id="batchInsert">
307 302 insert into mall_biz_order (id, order_no, order_id,
308   - trade_id, channel, mch_id,
  303 + trade_id, channel, firm_id, mch_id,
309 304 source, order_type, user_code,
310 305 username, company_code, shop_code,
311 306 shop_name, total_amount, freight_fee,
... ... @@ -317,6 +312,7 @@
317 312 #{item.orderId,jdbcType=VARCHAR},
318 313 #{item.tradeId,jdbcType=VARCHAR},
319 314 #{item.channel,jdbcType=VARCHAR},
  315 + #{item.firmId,jdbcType=VARCHAR},
320 316 #{item.mchId,jdbcType=VARCHAR},
321 317 #{item.source,jdbcType=TINYINT},
322 318 #{item.orderType,jdbcType=TINYINT},
... ... @@ -391,4 +387,41 @@
391 387 and trade_id = #{tradeId,jdbcType=VARCHAR}
392 388 limit 1
393 389 </select>
  390 +
  391 + <select id="listByOrderIds" resultType="com.diligrp.cashier.mall.model.MallBizOrder">
  392 + select <include refid="Base_Column_List"/>
  393 + from mall_biz_order
  394 + where order_id in
  395 + <foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
  396 + #{item}
  397 + </foreach>
  398 + and source = #{source}
  399 + </select>
  400 +
  401 + <update id="batchUpdate">
  402 + update mall_biz_order
  403 + <trim prefix="set" suffixOverrides=",">
  404 + <trim prefix="total_amount = case" suffix="end,">
  405 + <foreach collection="list" item="item" index="index">
  406 + when id = #{item.id} then total_amount + #{item.totalAmount}
  407 + </foreach>
  408 + </trim>
  409 + </trim>
  410 + <where>
  411 + and id in
  412 + <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
  413 + #{item.id}
  414 + </foreach>
  415 + and source = #{source}
  416 + </where>
  417 + </update>
  418 +
  419 + <update id="updateByIds">
  420 + update mall_biz_order
  421 + set state = #{state}
  422 + where id in
  423 + <foreach collection="ids" item="item" index="index" open="(" close=")" separator=",">
  424 + #{item}
  425 + </foreach>
  426 + </update>
394 427 </mapper>
... ...
cashier-mall/src/main/resources/com/diligrp/cashier/dao/mapper/MallBizPaymentDao.xml
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 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_trade_id" jdbcType="VARCHAR" property="payTradeId" />
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_trade_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   - <select id="findByOrderIdAndTradeId" resultMap="BaseResultMap">
39   - select
40   - <include refid="Base_Column_List" />
41   - from mall_biz_payment
42   - where order_id = #{orderId,jdbcType=VARCHAR}
43   - and trade_id = #{tradeId,jdbcType=VARCHAR}
44   - limit 1
45   - </select>
46   - <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
47   - delete from mall_biz_payment
48   - where id = #{id,jdbcType=BIGINT}
49   - </delete>
50   - <insert id="insert" parameterType="com.diligrp.cashier.mall.model.MallBizPayment">
51   - insert into mall_biz_payment (id, pay_trade_no, biz_order_id,
52   - order_id, trade_id, pay_trade_id,
53   - mch_id, card_no, username,
54   - user_id, account_id, fund_account_id,
55   - pay_fee, pay_state, pay_time,
56   - channel_id, cashier_url, payment_callback,
57   - version, created_time, modified_time
58   - )
59   - values (#{id,jdbcType=BIGINT}, #{payTradeNo,jdbcType=VARCHAR}, #{bizOrderId,jdbcType=BIGINT},
60   - #{orderId,jdbcType=VARCHAR}, #{tradeId,jdbcType=VARCHAR}, #{payTradeId,jdbcType=VARCHAR},
61   - #{mchId,jdbcType=VARCHAR}, #{cardNo,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR},
62   - #{userId,jdbcType=BIGINT}, #{accountId,jdbcType=BIGINT}, #{fundAccountId,jdbcType=BIGINT},
63   - #{payFee,jdbcType=BIGINT}, #{payState,jdbcType=TINYINT}, #{payTime,jdbcType=TIMESTAMP},
64   - #{channelId,jdbcType=TINYINT}, #{cashierUrl,jdbcType=VARCHAR}, #{paymentCallback,jdbcType=VARCHAR},
65   - #{version,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, #{modifiedTime,jdbcType=TIMESTAMP}
66   - )
67   - </insert>
68   - <insert id="insertSelective" parameterType="com.diligrp.cashier.mall.model.MallBizPayment">
69   - insert into mall_biz_payment
70   - <trim prefix="(" suffix=")" suffixOverrides=",">
71   - <if test="id != null">
72   - id,
73   - </if>
74   - <if test="payTradeNo != null">
75   - pay_trade_no,
76   - </if>
77   - <if test="bizOrderId != null">
78   - biz_order_id,
79   - </if>
80   - <if test="orderId != null">
81   - order_id,
82   - </if>
83   - <if test="tradeId != null">
84   - trade_id,
85   - </if>
86   - <if test="payTradeId != null">
87   - pay_trade_id,
88   - </if>
89   - <if test="mchId != null">
90   - mch_id,
91   - </if>
92   - <if test="cardNo != null">
93   - card_no,
94   - </if>
95   - <if test="username != null">
96   - username,
97   - </if>
98   - <if test="userId != null">
99   - user_id,
100   - </if>
101   - <if test="accountId != null">
102   - account_id,
103   - </if>
104   - <if test="fundAccountId != null">
105   - fund_account_id,
106   - </if>
107   - <if test="payFee != null">
108   - pay_fee,
109   - </if>
110   - <if test="payState != null">
111   - pay_state,
112   - </if>
113   - <if test="payTime != null">
114   - pay_time,
115   - </if>
116   - <if test="channelId != null">
117   - channel_id,
118   - </if>
119   - <if test="cashierUrl != null">
120   - cashier_url,
121   - </if>
122   - <if test="paymentCallback != null">
123   - payment_callback,
124   - </if>
125   - <if test="version != null">
126   - version,
127   - </if>
128   - <if test="createdTime != null">
129   - created_time,
130   - </if>
131   - <if test="modifiedTime != null">
132   - modified_time,
133   - </if>
134   - </trim>
135   - <trim prefix="values (" suffix=")" suffixOverrides=",">
136   - <if test="id != null">
137   - #{id,jdbcType=BIGINT},
138   - </if>
139   - <if test="payTradeNo != null">
140   - #{payTradeNo,jdbcType=VARCHAR},
141   - </if>
142   - <if test="bizOrderId != null">
143   - #{bizOrderId,jdbcType=BIGINT},
144   - </if>
145   - <if test="orderId != null">
146   - #{orderId,jdbcType=VARCHAR},
147   - </if>
148   - <if test="tradeId != null">
149   - #{tradeId,jdbcType=VARCHAR},
150   - </if>
151   - <if test="payTradeId != null">
152   - #{payTradeId,jdbcType=VARCHAR},
153   - </if>
154   - <if test="mchId != null">
155   - #{mchId,jdbcType=VARCHAR},
156   - </if>
157   - <if test="cardNo != null">
158   - #{cardNo,jdbcType=VARCHAR},
159   - </if>
160   - <if test="username != null">
161   - #{username,jdbcType=VARCHAR},
162   - </if>
163   - <if test="userId != null">
164   - #{userId,jdbcType=BIGINT},
165   - </if>
166   - <if test="accountId != null">
167   - #{accountId,jdbcType=BIGINT},
168   - </if>
169   - <if test="fundAccountId != null">
170   - #{fundAccountId,jdbcType=BIGINT},
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=BIGINT},
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="payTradeId != null">
217   - pay_trade_id = #{payTradeId,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="payFee != null">
238   - pay_fee = #{payFee,jdbcType=BIGINT},
239   - </if>
240   - <if test="payState != null">
241   - pay_state = #{payState,jdbcType=TINYINT},
242   - </if>
243   - <if test="payTime != null">
244   - pay_time = #{payTime,jdbcType=TIMESTAMP},
245   - </if>
246   - <if test="channelId != null">
247   - channel_id = #{channelId,jdbcType=TINYINT},
248   - </if>
249   - <if test="cashierUrl != null">
250   - cashier_url = #{cashierUrl,jdbcType=VARCHAR},
251   - </if>
252   - <if test="paymentCallback != null">
253   - payment_callback = #{paymentCallback,jdbcType=VARCHAR},
254   - </if>
255   - <if test="version != null">
256   - version = #{version,jdbcType=INTEGER},
257   - </if>
258   - <if test="createdTime != null">
259   - created_time = #{createdTime,jdbcType=TIMESTAMP},
260   - </if>
261   - <if test="modifiedTime != null">
262   - modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
263   - </if>
264   - </set>
265   - where id = #{id,jdbcType=BIGINT}
266   - </update>
267   - <update id="updateByPrimaryKey" parameterType="com.diligrp.cashier.mall.model.MallBizPayment">
268   - update mall_biz_payment
269   - set pay_trade_no = #{payTradeNo,jdbcType=VARCHAR},
270   - biz_order_id = #{bizOrderId,jdbcType=BIGINT},
271   - order_id = #{orderId,jdbcType=VARCHAR},
272   - trade_id = #{tradeId,jdbcType=VARCHAR},
273   - pay_trade_id = #{payTradeId,jdbcType=VARCHAR},
274   - mch_id = #{mchId,jdbcType=VARCHAR},
275   - card_no = #{cardNo,jdbcType=VARCHAR},
276   - username = #{username,jdbcType=VARCHAR},
277   - user_id = #{userId,jdbcType=BIGINT},
278   - account_id = #{accountId,jdbcType=BIGINT},
279   - fund_account_id = #{fundAccountId,jdbcType=BIGINT},
280   - pay_fee = #{payFee,jdbcType=BIGINT},
281   - pay_state = #{payState,jdbcType=TINYINT},
282   - pay_time = #{payTime,jdbcType=TIMESTAMP},
283   - channel_id = #{channelId,jdbcType=TINYINT},
284   - cashier_url = #{cashierUrl,jdbcType=VARCHAR},
285   - payment_callback = #{paymentCallback,jdbcType=VARCHAR},
286   - version = #{version,jdbcType=INTEGER},
287   - created_time = #{createdTime,jdbcType=TIMESTAMP},
288   - modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
289   - where id = #{id,jdbcType=BIGINT}
290   - </update>
  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="user_code" jdbcType="VARCHAR" property="userCode" />
  11 + <result column="pay_trade_id" jdbcType="VARCHAR" property="payTradeId" />
  12 + <result column="firm_id" jdbcType="VARCHAR" property="firmId" />
  13 + <result column="mch_id" jdbcType="VARCHAR" property="mchId" />
  14 + <result column="card_no" jdbcType="VARCHAR" property="cardNo" />
  15 + <result column="username" jdbcType="VARCHAR" property="username" />
  16 + <result column="user_id" jdbcType="BIGINT" property="userId" />
  17 + <result column="account_id" jdbcType="BIGINT" property="accountId" />
  18 + <result column="fund_account_id" jdbcType="BIGINT" property="fundAccountId" />
  19 + <result column="open_id" jdbcType="VARCHAR" property="openId" />
  20 + <result column="pay_fee" jdbcType="BIGINT" property="payFee" />
  21 + <result column="pay_state" jdbcType="TINYINT" property="payState" />
  22 + <result column="pay_time" jdbcType="TIMESTAMP" property="payTime" />
  23 + <result column="channel_id" jdbcType="TINYINT" property="channelId" />
  24 + <result column="cashier_url" jdbcType="VARCHAR" property="cashierUrl" />
  25 + <result column="payment_callback" jdbcType="VARCHAR" property="paymentCallback" />
  26 + <result column="version" jdbcType="INTEGER" property="version" />
  27 + <result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
  28 + <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
  29 + </resultMap>
  30 + <sql id="Base_Column_List">
  31 + id, pay_trade_no, biz_order_id, order_id, trade_id, pay_trade_id, firm_id, mch_id, card_no,
  32 + username, user_id, account_id, fund_account_id, open_id, pay_fee, pay_state, pay_time,
  33 + channel_id, cashier_url, payment_callback, version, created_time, modified_time
  34 + </sql>
  35 + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  36 + select
  37 + <include refid="Base_Column_List" />
  38 + from mall_biz_payment
  39 + where id = #{id,jdbcType=BIGINT}
  40 + </select>
  41 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  42 + delete
  43 + from mall_biz_payment
  44 + where id = #{id,jdbcType=BIGINT}
  45 + </delete>
  46 + <insert id="insert" parameterType="com.diligrp.cashier.mall.model.MallBizPayment">
  47 + insert into mall_biz_payment (id, pay_trade_no, biz_order_id,
  48 + order_id, trade_id, pay_trade_id,
  49 + firm_id, mch_id, card_no, username,
  50 + user_id, account_id, fund_account_id,
  51 + open_id, pay_fee, pay_state,
  52 + pay_time, channel_id, cashier_url,
  53 + payment_callback, version, created_time,
  54 + modified_time)
  55 + values (#{id,jdbcType=BIGINT}, #{payTradeNo,jdbcType=VARCHAR}, #{bizOrderId,jdbcType=VARCHAR},
  56 + #{orderId,jdbcType=VARCHAR}, #{tradeId,jdbcType=VARCHAR}, #{payTradeId,jdbcType=VARCHAR},
  57 + #{firmId,jdbcType=VARCHAR}, #{mchId,jdbcType=VARCHAR}, #{cardNo,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR},
  58 + #{userId,jdbcType=BIGINT}, #{accountId,jdbcType=BIGINT}, #{fundAccountId,jdbcType=BIGINT},
  59 + #{openId,jdbcType=VARCHAR}, #{payFee,jdbcType=BIGINT}, #{payState,jdbcType=TINYINT},
  60 + #{payTime,jdbcType=TIMESTAMP}, #{channelId,jdbcType=TINYINT}, #{cashierUrl,jdbcType=VARCHAR},
  61 + #{paymentCallback,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP},
  62 + #{modifiedTime,jdbcType=TIMESTAMP})
  63 + </insert>
  64 + <insert id="insertSelective" parameterType="com.diligrp.cashier.mall.model.MallBizPayment">
  65 + insert into mall_biz_payment
  66 + <trim prefix="(" suffix=")" suffixOverrides=",">
  67 + <if test="id != null">
  68 + id,
  69 + </if>
  70 + <if test="payTradeNo != null">
  71 + pay_trade_no,
  72 + </if>
  73 + <if test="bizOrderId != null">
  74 + biz_order_id,
  75 + </if>
  76 + <if test="orderId != null">
  77 + order_id,
  78 + </if>
  79 + <if test="tradeId != null">
  80 + trade_id,
  81 + </if>
  82 + <if test="userCode != null">
  83 + user_code,
  84 + </if>
  85 + <if test="payTradeId != null">
  86 + pay_trade_id,
  87 + </if>
  88 + <if test="firmId != null">
  89 + firm_id,
  90 + </if>
  91 + <if test="mchId != null">
  92 + mch_id,
  93 + </if>
  94 + <if test="cardNo != null">
  95 + card_no,
  96 + </if>
  97 + <if test="username != null">
  98 + username,
  99 + </if>
  100 + <if test="userId != null">
  101 + user_id,
  102 + </if>
  103 + <if test="accountId != null">
  104 + account_id,
  105 + </if>
  106 + <if test="fundAccountId != null">
  107 + fund_account_id,
  108 + </if>
  109 + <if test="openId != null">
  110 + open_id,
  111 + </if>
  112 + <if test="payFee != null">
  113 + pay_fee,
  114 + </if>
  115 + <if test="payState != null">
  116 + pay_state,
  117 + </if>
  118 + <if test="payTime != null">
  119 + pay_time,
  120 + </if>
  121 + <if test="channelId != null">
  122 + channel_id,
  123 + </if>
  124 + <if test="cashierUrl != null">
  125 + cashier_url,
  126 + </if>
  127 + <if test="paymentCallback != null">
  128 + payment_callback,
  129 + </if>
  130 + <if test="version != null">
  131 + version,
  132 + </if>
  133 + <if test="createdTime != null">
  134 + created_time,
  135 + </if>
  136 + <if test="modifiedTime != null">
  137 + modified_time,
  138 + </if>
  139 + </trim>
  140 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  141 + <if test="id != null">
  142 + #{id,jdbcType=BIGINT},
  143 + </if>
  144 + <if test="payTradeNo != null">
  145 + #{payTradeNo,jdbcType=VARCHAR},
  146 + </if>
  147 + <if test="bizOrderId != null">
  148 + #{bizOrderId,jdbcType=VARCHAR},
  149 + </if>
  150 + <if test="orderId != null">
  151 + #{orderId,jdbcType=VARCHAR},
  152 + </if>
  153 + <if test="tradeId != null">
  154 + #{tradeId,jdbcType=VARCHAR},
  155 + </if>
  156 + <if test="userCode != null">
  157 + #{userCode,jdbcType=VARCHAR},
  158 + </if>
  159 + <if test="payTradeId != null">
  160 + #{payTradeId,jdbcType=VARCHAR},
  161 + </if>
  162 + <if test="firmId != null">
  163 + #{firmId,jdbcType=VARCHAR},
  164 + </if>
  165 + <if test="mchId != null">
  166 + #{mchId,jdbcType=VARCHAR},
  167 + </if>
  168 + <if test="cardNo != null">
  169 + #{cardNo,jdbcType=VARCHAR},
  170 + </if>
  171 + <if test="username != null">
  172 + #{username,jdbcType=VARCHAR},
  173 + </if>
  174 + <if test="userId != null">
  175 + #{userId,jdbcType=BIGINT},
  176 + </if>
  177 + <if test="accountId != null">
  178 + #{accountId,jdbcType=BIGINT},
  179 + </if>
  180 + <if test="fundAccountId != null">
  181 + #{fundAccountId,jdbcType=BIGINT},
  182 + </if>
  183 + <if test="openId != null">
  184 + #{openId,jdbcType=VARCHAR},
  185 + </if>
  186 + <if test="payFee != null">
  187 + #{payFee,jdbcType=BIGINT},
  188 + </if>
  189 + <if test="payState != null">
  190 + #{payState,jdbcType=TINYINT},
  191 + </if>
  192 + <if test="payTime != null">
  193 + #{payTime,jdbcType=TIMESTAMP},
  194 + </if>
  195 + <if test="channelId != null">
  196 + #{channelId,jdbcType=TINYINT},
  197 + </if>
  198 + <if test="cashierUrl != null">
  199 + #{cashierUrl,jdbcType=VARCHAR},
  200 + </if>
  201 + <if test="paymentCallback != null">
  202 + #{paymentCallback,jdbcType=VARCHAR},
  203 + </if>
  204 + <if test="version != null">
  205 + #{version,jdbcType=INTEGER},
  206 + </if>
  207 + <if test="createdTime != null">
  208 + #{createdTime,jdbcType=TIMESTAMP},
  209 + </if>
  210 + <if test="modifiedTime != null">
  211 + #{modifiedTime,jdbcType=TIMESTAMP},
  212 + </if>
  213 + </trim>
  214 + </insert>
  215 + <update id="updateByPrimaryKeySelective" parameterType="com.diligrp.cashier.mall.model.MallBizPayment">
  216 + update mall_biz_payment
  217 + <set>
  218 + <if test="payTradeNo != null">
  219 + pay_trade_no = #{payTradeNo,jdbcType=VARCHAR},
  220 + </if>
  221 + <if test="bizOrderId != null">
  222 + biz_order_id = #{bizOrderId,jdbcType=VARCHAR},
  223 + </if>
  224 + <if test="orderId != null">
  225 + order_id = #{orderId,jdbcType=VARCHAR},
  226 + </if>
  227 + <if test="tradeId != null">
  228 + trade_id = #{tradeId,jdbcType=VARCHAR},
  229 + </if>
  230 + <if test="payTradeId != null">
  231 + pay_trade_id = #{payTradeId,jdbcType=VARCHAR},
  232 + </if>
  233 + <if test="firmId != null">
  234 + firm_id = #{firmId,jdbcType=VARCHAR},
  235 + </if>
  236 + <if test="mchId != null">
  237 + mch_id = #{mchId,jdbcType=VARCHAR},
  238 + </if>
  239 + <if test="cardNo != null">
  240 + card_no = #{cardNo,jdbcType=VARCHAR},
  241 + </if>
  242 + <if test="username != null">
  243 + username = #{username,jdbcType=VARCHAR},
  244 + </if>
  245 + <if test="userId != null">
  246 + user_id = #{userId,jdbcType=BIGINT},
  247 + </if>
  248 + <if test="accountId != null">
  249 + account_id = #{accountId,jdbcType=BIGINT},
  250 + </if>
  251 + <if test="fundAccountId != null">
  252 + fund_account_id = #{fundAccountId,jdbcType=BIGINT},
  253 + </if>
  254 + <if test="openId != null">
  255 + open_id = #{openId,jdbcType=VARCHAR},
  256 + </if>
  257 + <if test="payFee != null">
  258 + pay_fee = #{payFee,jdbcType=BIGINT},
  259 + </if>
  260 + <if test="payState != null">
  261 + pay_state = #{payState,jdbcType=TINYINT},
  262 + </if>
  263 + <if test="payTime != null">
  264 + pay_time = #{payTime,jdbcType=TIMESTAMP},
  265 + </if>
  266 + <if test="channelId != null">
  267 + channel_id = #{channelId,jdbcType=TINYINT},
  268 + </if>
  269 + <if test="cashierUrl != null">
  270 + cashier_url = #{cashierUrl,jdbcType=VARCHAR},
  271 + </if>
  272 + <if test="paymentCallback != null">
  273 + payment_callback = #{paymentCallback,jdbcType=VARCHAR},
  274 + </if>
  275 + version = version + 1,
  276 + </set>
  277 + where id = #{id}
  278 + and version = #{version}
  279 + </update>
  280 + <update id="updateByPrimaryKey" parameterType="com.diligrp.cashier.mall.model.MallBizPayment">
  281 + update mall_biz_payment
  282 + set pay_trade_no = #{payTradeNo,jdbcType=VARCHAR},
  283 + biz_order_id = #{bizOrderId,jdbcType=VARCHAR},
  284 + order_id = #{orderId,jdbcType=VARCHAR},
  285 + trade_id = #{tradeId,jdbcType=VARCHAR},
  286 + pay_trade_id = #{payTradeId,jdbcType=VARCHAR},
  287 + firm_id = #{firmId,jdbcType=VARCHAR},
  288 + mch_id = #{mchId,jdbcType=VARCHAR},
  289 + card_no = #{cardNo,jdbcType=VARCHAR},
  290 + username = #{username,jdbcType=VARCHAR},
  291 + user_id = #{userId,jdbcType=BIGINT},
  292 + account_id = #{accountId,jdbcType=BIGINT},
  293 + fund_account_id = #{fundAccountId,jdbcType=BIGINT},
  294 + open_id = #{openId,jdbcType=VARCHAR},
  295 + pay_fee = #{payFee,jdbcType=BIGINT},
  296 + pay_state = #{payState,jdbcType=TINYINT},
  297 + pay_time = #{payTime,jdbcType=TIMESTAMP},
  298 + channel_id = #{channelId,jdbcType=TINYINT},
  299 + cashier_url = #{cashierUrl,jdbcType=VARCHAR},
  300 + payment_callback = #{paymentCallback,jdbcType=VARCHAR},
  301 + version = #{version,jdbcType=INTEGER},
  302 + created_time = #{createdTime,jdbcType=TIMESTAMP},
  303 + modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
  304 + where id = #{id,jdbcType=BIGINT}
  305 + </update>
  306 +
  307 + <select id="getByPayTradeId" resultType="com.diligrp.cashier.mall.model.MallBizPayment">
  308 + select
  309 + <include refid="Base_Column_List" />
  310 + from mall_biz_payment
  311 + where pay_trade_id = #{tradeId,jdbcType=VARCHAR}
  312 + </select>
  313 +
291 314 </mapper>
... ...
cashier-mall/src/main/resources/com/diligrp/cashier/dao/mapper/MallBizPaymentOrderDao.xml
... ... @@ -8,13 +8,13 @@
8 8 <result column="biz_order_id" jdbcType="BIGINT" property="bizOrderId" />
9 9 <result column="order_id" jdbcType="VARCHAR" property="orderId" />
10 10 <result column="trade_id" jdbcType="VARCHAR" property="tradeId" />
11   - <result column="pay_payment_id" jdbcType="VARCHAR" property="payPaymentId" />
  11 + <result column="pay_trade_id" jdbcType="VARCHAR" property="payTradeId" />
12 12 <result column="pay_status" jdbcType="INTEGER" property="payState" />
13 13 <result column="pay_fee" jdbcType="BIGINT" property="payFee" />
14 14 <result column="pay_time" jdbcType="TIMESTAMP" property="payTime" />
15 15 </resultMap>
16 16 <sql id="Base_Column_List">
17   - id, biz_payment_id, pay_trade_no, biz_order_id, order_id, trade_id, pay_payment_id,
  17 + id, biz_payment_id, pay_trade_no, biz_order_id, order_id, trade_id, pay_trade_id,
18 18 pay_state, pay_fee, pay_time
19 19 </sql>
20 20 <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
... ... @@ -30,11 +30,11 @@
30 30 <insert id="insert" parameterType="com.diligrp.cashier.mall.model.MallBizPaymentOrder">
31 31 insert into mall_biz_payment_order (id, biz_payment_id, pay_trade_no,
32 32 biz_order_id, order_id, trade_id,
33   - pay_payment_id, pay_fee, pay_time
  33 + pay_trade_id, pay_fee, pay_time
34 34 )
35 35 values (#{id,jdbcType=BIGINT}, #{bizPaymentId,jdbcType=BIGINT}, #{payTradeNo,jdbcType=VARCHAR},
36 36 #{bizOrderId,jdbcType=BIGINT}, #{orderId,jdbcType=VARCHAR}, #{tradeId,jdbcType=VARCHAR},
37   - #{payPaymentId,jdbcType=VARCHAR}, #{payFee,jdbcType=BIGINT}, #{payTime,jdbcType=TIMESTAMP}
  37 + #{payTradeId,jdbcType=VARCHAR}, #{payFee,jdbcType=BIGINT}, #{payTime,jdbcType=TIMESTAMP}
38 38 )
39 39 </insert>
40 40 <insert id="insertSelective" parameterType="com.diligrp.cashier.mall.model.MallBizPaymentOrder">
... ... @@ -58,8 +58,8 @@
58 58 <if test="tradeId != null">
59 59 trade_id,
60 60 </if>
61   - <if test="payPaymentId != null">
62   - pay_payment_id,
  61 + <if test="payTradeId != null">
  62 + pay_trade_id,
63 63 </if>
64 64 <if test="payFee != null">
65 65 pay_fee,
... ... @@ -87,8 +87,8 @@
87 87 <if test="tradeId != null">
88 88 #{tradeId,jdbcType=VARCHAR},
89 89 </if>
90   - <if test="payPaymentId != null">
91   - #{payPaymentId,jdbcType=VARCHAR},
  90 + <if test="payTradeId != null">
  91 + #{payTradeId,jdbcType=VARCHAR},
92 92 </if>
93 93 <if test="payFee != null">
94 94 #{payFee,jdbcType=BIGINT},
... ... @@ -116,8 +116,8 @@
116 116 <if test="tradeId != null">
117 117 trade_id = #{tradeId,jdbcType=VARCHAR},
118 118 </if>
119   - <if test="payPaymentId != null">
120   - pay_payment_id = #{payPaymentId,jdbcType=VARCHAR},
  119 + <if test="payTradeId != null">
  120 + pay_trade_id = #{payTradeId,jdbcType=VARCHAR},
121 121 </if>
122 122 <if test="payFee != null">
123 123 pay_fee = #{payFee,jdbcType=BIGINT},
... ... @@ -135,22 +135,21 @@
135 135 biz_order_id = #{bizOrderId,jdbcType=BIGINT},
136 136 order_id = #{orderId,jdbcType=VARCHAR},
137 137 trade_id = #{tradeId,jdbcType=VARCHAR},
138   - pay_payment_id = #{payPaymentId,jdbcType=VARCHAR},
  138 + pay_trade_id = #{payTradeId,jdbcType=VARCHAR},
139 139 pay_fee = #{payFee,jdbcType=BIGINT},
140 140 pay_time = #{payTime,jdbcType=TIMESTAMP}
141 141 where id = #{id,jdbcType=BIGINT}
142 142 </update>
143   -
144 143 <insert id="batchInsert" parameterType="java.util.List">
145 144 insert into mall_biz_payment_order (id, biz_payment_id, pay_trade_no,
146 145 biz_order_id, order_id, trade_id,
147   - pay_payment_id, pay_fee, pay_time
  146 + pay_trade_id, pay_fee, pay_time
148 147 )
149 148 values
150 149 <foreach collection="list" item="item" index="index" separator=",">
151 150 (#{item.id,jdbcType=BIGINT}, #{item.bizPaymentId,jdbcType=BIGINT}, #{item.payTradeNo,jdbcType=VARCHAR},
152 151 #{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}
  152 + #{item.payTradeId,jdbcType=VARCHAR}, #{item.payFee,jdbcType=BIGINT}, #{item.payTime,jdbcType=TIMESTAMP}
154 153 )
155 154 </foreach>
156 155 </insert>
... ... @@ -166,4 +165,21 @@
166 165 </if>
167 166 </where>
168 167 </select>
  168 +
  169 + <select id="listPaymentOrderByBizPaymentId"
  170 + resultType="com.diligrp.cashier.mall.model.MallBizPaymentOrder">
  171 + select
  172 + <include refid="Base_Column_List" />
  173 + from mall_biz_payment_order
  174 + where biz_payment_id = #{bizPaymentId}
  175 + </select>
  176 +
  177 + <update id="updateByPayment">
  178 + update mall_biz_payment_order
  179 + set
  180 + pay_state = #{payState},
  181 + pay_time = #{payTime}
  182 + where biz_payment_id = #{id}
  183 + </update>
  184 +
169 185 </mapper>
... ...
cashier-mall/src/main/resources/com/diligrp/cashier/dao/mapper/MallBizRefundDao.xml
... ... @@ -8,8 +8,10 @@
8 8 <result column="refund_bn" jdbcType="VARCHAR" property="refundBn" />
9 9 <result column="order_id" jdbcType="VARCHAR" property="orderId" />
10 10 <result column="trade_id" jdbcType="VARCHAR" property="tradeId" />
11   - <result column="refund_payment_id" jdbcType="VARCHAR" property="refundPaymentId" />
12   - <result column="pay_payment_id" jdbcType="VARCHAR" property="payPaymentId" />
  11 + <result column="firm_id" jdbcType="VARCHAR" property="firmId" />
  12 + <result column="mch_id" jdbcType="VARCHAR" property="mchId" />
  13 + <result column="refund_trade_id" jdbcType="VARCHAR" property="refundTradeId" />
  14 + <result column="pay_trade_id" jdbcType="VARCHAR" property="payTradeId" />
13 15 <result column="refund_card_no" jdbcType="VARCHAR" property="refundCardNo" />
14 16 <result column="refund_user_id" jdbcType="BIGINT" property="refundUserId" />
15 17 <result column="refund_username" jdbcType="VARCHAR" property="refundUsername" />
... ... @@ -26,8 +28,8 @@
26 28 <result column="refuse_reason" jdbcType="VARCHAR" property="refuseReason" />
27 29 </resultMap>
28 30 <sql id="Base_Column_List">
29   - id, refund_trade_no, pay_trade_no, refund_bn, order_id, trade_id, refund_payment_id,
30   - pay_payment_id, refund_card_no, refund_user_id, refund_username, refund_account_id,
  31 + id, refund_trade_no, pay_trade_no, refund_bn, order_id, trade_id, refund_trade_id,
  32 + pay_trade_id, refund_card_no, refund_user_id, refund_username, refund_account_id,
31 33 refund_time, refund_fee, freight_fee, refund_state, refund_reason, refund_callback,
32 34 version, creater_name, created_time, refuse_reason
33 35 </sql>
... ... @@ -44,7 +46,7 @@
44 46 <insert id="insert" parameterType="com.diligrp.cashier.mall.model.MallBizRefund">
45 47 insert into mall_biz_refund (id, refund_trade_no, pay_trade_no,
46 48 refund_bn, order_id, trade_id,
47   - refund_payment_id, pay_payment_id, refund_card_no,
  49 + refund_trade_id, pay_trade_id, refund_card_no,
48 50 refund_user_id, refund_username, refund_account_id,
49 51 refund_time, refund_fee, freight_fee,
50 52 refund_state, refund_reason, refund_callback,
... ... @@ -52,7 +54,7 @@
52 54 refuse_reason)
53 55 values (#{id,jdbcType=BIGINT}, #{refundTradeNo,jdbcType=VARCHAR}, #{payTradeNo,jdbcType=VARCHAR},
54 56 #{refundBn,jdbcType=VARCHAR}, #{orderId,jdbcType=VARCHAR}, #{tradeId,jdbcType=VARCHAR},
55   - #{refundPaymentId,jdbcType=VARCHAR}, #{payPaymentId,jdbcType=VARCHAR}, #{refundCardNo,jdbcType=VARCHAR},
  57 + #{refundTradeId,jdbcType=VARCHAR}, #{payTradeId,jdbcType=VARCHAR}, #{refundCardNo,jdbcType=VARCHAR},
56 58 #{refundUserId,jdbcType=BIGINT}, #{refundUsername,jdbcType=VARCHAR}, #{refundAccountId,jdbcType=BIGINT},
57 59 #{refundTime,jdbcType=TIMESTAMP}, #{refundFee,jdbcType=BIGINT}, #{freightFee,jdbcType=BIGINT},
58 60 #{refundState,jdbcType=TINYINT}, #{refundReason,jdbcType=VARCHAR}, #{refundCallback,jdbcType=VARCHAR},
... ... @@ -81,11 +83,11 @@
81 83 <if test="tradeId != null">
82 84 trade_id,
83 85 </if>
84   - <if test="refundPaymentId != null">
85   - refund_payment_id,
  86 + <if test="refundTradeId != null">
  87 + refund_trade_id,
86 88 </if>
87   - <if test="payPaymentId != null">
88   - pay_payment_id,
  89 + <if test="payTradeId != null">
  90 + pay_trade_id,
89 91 </if>
90 92 <if test="refundCardNo != null">
91 93 refund_card_no,
... ... @@ -149,11 +151,11 @@
149 151 <if test="tradeId != null">
150 152 #{tradeId,jdbcType=VARCHAR},
151 153 </if>
152   - <if test="refundPaymentId != null">
153   - #{refundPaymentId,jdbcType=VARCHAR},
  154 + <if test="refundTradeId != null">
  155 + #{refundTradeId,jdbcType=VARCHAR},
154 156 </if>
155   - <if test="payPaymentId != null">
156   - #{payPaymentId,jdbcType=VARCHAR},
  157 + <if test="payTradeId != null">
  158 + #{payTradeId,jdbcType=VARCHAR},
157 159 </if>
158 160 <if test="refundCardNo != null">
159 161 #{refundCardNo,jdbcType=VARCHAR},
... ... @@ -217,11 +219,11 @@
217 219 <if test="tradeId != null">
218 220 trade_id = #{tradeId,jdbcType=VARCHAR},
219 221 </if>
220   - <if test="refundPaymentId != null">
221   - refund_payment_id = #{refundPaymentId,jdbcType=VARCHAR},
  222 + <if test="refundTradeId != null">
  223 + refund_trade_id = #{refundTradeId,jdbcType=VARCHAR},
222 224 </if>
223   - <if test="payPaymentId != null">
224   - pay_payment_id = #{payPaymentId,jdbcType=VARCHAR},
  225 + <if test="payTradeId != null">
  226 + pay_trade_id = #{payTradeId,jdbcType=VARCHAR},
225 227 </if>
226 228 <if test="refundCardNo != null">
227 229 refund_card_no = #{refundCardNo,jdbcType=VARCHAR},
... ... @@ -275,8 +277,8 @@
275 277 refund_bn = #{refundBn,jdbcType=VARCHAR},
276 278 order_id = #{orderId,jdbcType=VARCHAR},
277 279 trade_id = #{tradeId,jdbcType=VARCHAR},
278   - refund_payment_id = #{refundPaymentId,jdbcType=VARCHAR},
279   - pay_payment_id = #{payPaymentId,jdbcType=VARCHAR},
  280 + refund_trade_id = #{refundTradeId,jdbcType=VARCHAR},
  281 + pay_trade_id = #{payTradeId,jdbcType=VARCHAR},
280 282 refund_card_no = #{refundCardNo,jdbcType=VARCHAR},
281 283 refund_user_id = #{refundUserId,jdbcType=BIGINT},
282 284 refund_username = #{refundUsername,jdbcType=VARCHAR},
... ...