Commit d3712f23f04d9e41aacb78e9a4c1ad8b36b3a797

Authored by guantingwei
1 parent 65220cfe

扫码下单接口和分摊回调接口初步实现

cashier-mall/src/main/java/com/diligrp/cashier/mall/MallConfiguration.java
1 1 package com.diligrp.cashier.mall;
2 2  
  3 +import com.diligrp.cashier.mall.client.RtMallHttpClient;
  4 +import com.diligrp.cashier.mall.property.RtMallDynamicProperty;
3 5 import com.diligrp.cashier.shared.mybatis.MybatisMapperSupport;
4 6 import org.mybatis.spring.annotation.MapperScan;
  7 +import org.springframework.beans.factory.annotation.Value;
  8 +import org.springframework.context.annotation.Bean;
5 9 import org.springframework.context.annotation.ComponentScan;
6 10 import org.springframework.context.annotation.Configuration;
7 11  
... ... @@ -10,4 +14,14 @@ import org.springframework.context.annotation.Configuration;
10 14 @MapperScan(basePackages = {"com.diligrp.cashier.mall.dao"}, markerInterface = MybatisMapperSupport.class)
11 15 public class MallConfiguration {
12 16  
  17 + /**
  18 + * 创建大润发HTTP客户端
  19 + * 用于调用大润发订单详情接口
  20 + */
  21 + @Bean
  22 + public RtMallHttpClient rtMallHttpClient(@Value("${rtmall.api.url:https://em-shop.feiniugo.com/api/externalapi/scanbuy/process}") String apiUrl,
  23 + RtMallDynamicProperty rtMallDynamicProperty) {
  24 + RtMallDynamicProperty.AppSecretDynamicProperty config = rtMallDynamicProperty.getAppSecrets().getFirst();
  25 + return new RtMallHttpClient(apiUrl, config.getAppKey(), config.getAppSecret());
  26 + }
13 27 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/api/RtMallOrderPaymentApi.java 0 → 100644
  1 +package com.diligrp.cashier.mall.api;
  2 +
  3 +import com.diligrp.cashier.mall.domain.rtmall.RtMarkMessage;
  4 +import com.diligrp.cashier.mall.domain.rtmall.co.OrderPaymentCO;
  5 +import com.diligrp.cashier.mall.domain.rtmall.co.PaymentAllocateCO;
  6 +import com.diligrp.cashier.mall.domain.rtmall.vo.OrderSuccessVO;
  7 +import com.diligrp.cashier.mall.service.biz.MallBizPaymentService;
  8 +import com.diligrp.cashier.mall.sign.RtMallSign;
  9 +import com.diligrp.cashier.mall.util.RtMallValidateUtils;
  10 +import com.diligrp.cashier.shared.annotation.ParamLogPrint;
  11 +import com.diligrp.cashier.shared.annotation.RepeatSubmit;
  12 +import com.diligrp.cashier.shared.annotation.Sign;
  13 +import com.diligrp.cashier.shared.handler.duplication.SpelDuplicationSubmit;
  14 +import com.diligrp.cashier.shared.util.JsonUtils;
  15 +import jakarta.annotation.Resource;
  16 +import jakarta.validation.Valid;
  17 +import org.springframework.validation.annotation.Validated;
  18 +import org.springframework.web.bind.annotation.PostMapping;
  19 +import org.springframework.web.bind.annotation.RequestBody;
  20 +import org.springframework.web.bind.annotation.RequestMapping;
  21 +import org.springframework.web.bind.annotation.RestController;
  22 +
  23 +/**
  24 + * 扫码下单接口
  25 + * Pos扫支付码后,推送订单信息到商户,商户返回收银台链接
  26 + */
  27 +@RestController
  28 +@RequestMapping(path = {"/api/rt/mall/scan", "/rt/mall/scan"})
  29 +@Validated
  30 +public class RtMallOrderPaymentApi {
  31 +
  32 + @Resource
  33 + private MallBizPaymentService mallBizPaymentService;
  34 +
  35 + /**
  36 + * 扫码下单接口
  37 + * Pos扫支付码后,推送订单信息到商户,商户返回收银台链接
  38 + */
  39 + @PostMapping("/order/v1")
  40 + @ParamLogPrint(outPrint = true)
  41 + @Sign(sign = RtMallSign.class)
  42 + @RepeatSubmit(prefix = "order_payment_sync:", value = "#req['trade_id']", duplicationSubmit = SpelDuplicationSubmit.class)
  43 + 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));
  47 + }
  48 +
  49 + /**
  50 + * 支付分摊回调接口
  51 + * POS完成支付分摊后,调用此接口通知商户商品信息已就绪
  52 + */
  53 + @PostMapping("/status/callback")
  54 + @ParamLogPrint(outPrint = true)
  55 + @Sign(sign = RtMallSign.class)
  56 + @RepeatSubmit(prefix = "payment_allocate_callback:", value = {
  57 + "#req['trade_list'].![trade_id].![#root + #this]",}, duplicationSubmit = SpelDuplicationSubmit.class)
  58 + public RtMarkMessage<?> handlePaymentAllocate(@Valid @RequestBody Object req) {
  59 + PaymentAllocateCO allocateCO = JsonUtils.convertValue(req, PaymentAllocateCO.class);
  60 + RtMallValidateUtils.valid(allocateCO);
  61 + mallBizPaymentService.handlePaymentAllocate(allocateCO);
  62 + return RtMarkMessage.success();
  63 + }
  64 +}
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/client/RtMallHttpClient.java 0 → 100644
  1 +package com.diligrp.cashier.mall.client;
  2 +
  3 +import com.diligrp.cashier.mall.domain.rtmall.vo.OrderDetailResponseVO;
  4 +import com.diligrp.cashier.mall.exception.RtMartMallException;
  5 +import com.diligrp.cashier.mall.util.HttpClientUtils;
  6 +import com.diligrp.cashier.mall.util.RtMallSignMd5Utils;
  7 +import com.diligrp.cashier.mall.type.RtMarkErrorCode;
  8 +import com.diligrp.cashier.shared.util.JsonUtils;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +
  12 +import java.util.HashMap;
  13 +import java.util.Map;
  14 +
  15 +/**
  16 + * 大润发HTTP客户端
  17 + * 调用大润发订单详情接口
  18 + */
  19 +public class RtMallHttpClient {
  20 + private static final Logger log = LoggerFactory.getLogger(RtMallHttpClient.class);
  21 +
  22 + private final String apiUrl;
  23 + private final String appKey;
  24 + private final String appSecret;
  25 +
  26 + public RtMallHttpClient(String apiUrl, String appKey, String appSecret) {
  27 + this.apiUrl = apiUrl;
  28 + this.appKey = appKey;
  29 + this.appSecret = appSecret;
  30 + }
  31 +
  32 + /**
  33 + * 查询订单详情
  34 + *
  35 + * @param orderId 订单号
  36 + * @param tradeId 支付流水号
  37 + * @param userCode 会员编号
  38 + * @return 订单详情
  39 + */
  40 + public OrderDetailResponseVO getOrderDetail(String orderId, String tradeId, String userCode) {
  41 + log.info("调用大润发订单详情接口: order_id={}, trade_id={}, user_code={}", orderId, tradeId, userCode);
  42 +
  43 + //构建请求参数
  44 + Map<String, Object> params = new HashMap<>();
  45 + params.put("app_key", appKey);
  46 + params.put("version", "v1");
  47 + params.put("timestamp", System.currentTimeMillis() / 1000);
  48 + params.put("method", "scanbuy.order.detail");
  49 + params.put("user_code", userCode);
  50 + params.put("order_id", orderId);
  51 + params.put("trade_id", tradeId);
  52 +
  53 + //生成签名
  54 + String sign = RtMallSignMd5Utils.generateSign(params, appSecret);
  55 + params.put("sign", sign);
  56 +
  57 + //发送HTTP请求
  58 + String responseBody = HttpClientUtils.postJson(apiUrl, params, null, "大润发订单详情");
  59 +
  60 + //解析响应
  61 + OrderDetailResponseVO detailResponse = JsonUtils.fromJsonString(responseBody, OrderDetailResponseVO.class);
  62 + if (detailResponse == null) {
  63 + log.error("解析大润发响应失败");
  64 + throw new RtMartMallException(RtMarkErrorCode.E4004);
  65 + }
  66 +
  67 + //检查响应状态
  68 + if (!"success".equals(detailResponse.getResult()) || !"E0000".equals(detailResponse.getCode())) {
  69 + log.error("调用大润发订单详情接口失败: code={}, msg={}",
  70 + detailResponse.getCode(), detailResponse.getMsg());
  71 + throw new RtMartMallException(detailResponse.getCode(), detailResponse.getMsg());
  72 + }
  73 +
  74 + log.info("订单详情查询成功: order_id={}, item_count={}", orderId,
  75 + detailResponse.getData() != null && detailResponse.getData().getItemList() != null
  76 + ? detailResponse.getData().getItemList().size() : 0);
  77 +
  78 + return detailResponse;
  79 + }
  80 +}
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/dao/MallBizOrderDao.java
... ... @@ -30,4 +30,6 @@ public interface MallBizOrderDao extends MybatisMapperSupport {
30 30 MallBizOrder getByOrderId(@Param("orderId") String orderId);
31 31  
32 32 void batchInsert(@Param("list") List<MallBizOrder> mallBizOrders);
  33 +
  34 + MallBizOrder findByOrderIdAndTradeId(String orderId, String tradeId);
33 35 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/dao/MallBizPaymentDao.java
... ... @@ -20,4 +20,6 @@ public interface MallBizPaymentDao extends MybatisMapperSupport {
20 20 int updateByPrimaryKeySelective(MallBizPayment record);
21 21  
22 22 int updateByPrimaryKey(MallBizPayment record);
  23 +
  24 + MallBizPayment findByOrderIdAndTradeId(String orderId, String tradeId);
23 25 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/co/OrderPaymentCO.java 0 → 100644
  1 +package com.diligrp.cashier.mall.domain.rtmall.co;
  2 +
  3 +import com.diligrp.cashier.mall.domain.rtmall.RtMarkBaseCO;
  4 +import com.diligrp.cashier.mall.util.TimestampToLocalDateTimeDeserializer;
  5 +import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
  6 +import jakarta.validation.constraints.NotBlank;
  7 +import jakarta.validation.constraints.NotNull;
  8 +
  9 +import java.time.LocalDateTime;
  10 +
  11 +/**
  12 + * 扫码下单支付CO
  13 + */
  14 +public class OrderPaymentCO extends RtMarkBaseCO {
  15 +
  16 + /**
  17 + * 中台订单号
  18 + */
  19 + @NotBlank(message = "order_id is required")
  20 + private String orderId;
  21 +
  22 + /**
  23 + * 中台支付流水号
  24 + */
  25 + @NotBlank(message = "trade_id is required")
  26 + private String tradeId;
  27 +
  28 + /**
  29 + * 会员编号
  30 + */
  31 + @NotBlank(message = "user_code is required")
  32 + private String userCode;
  33 +
  34 + /**
  35 + * 企业组编号
  36 + */
  37 + @NotBlank(message = "company_code is required")
  38 + private String companyCode;
  39 +
  40 + /**
  41 + * 应付金额
  42 + */
  43 + @NotNull(message = "total_amount is required")
  44 + private Long totalAmount;
  45 +
  46 + /**
  47 + * 支付单创建时间
  48 + */
  49 + @NotNull(message = "order_time is required")
  50 + @JsonDeserialize(using = TimestampToLocalDateTimeDeserializer.class)
  51 + private LocalDateTime orderTime;
  52 +
  53 + /**
  54 + * 支付单类型: 1 线下扫码购,2 接口扫码购
  55 + */
  56 + @NotNull(message = "order_type is required")
  57 + private Integer orderType;
  58 +
  59 + /**
  60 + * 门店编号
  61 + */
  62 + @NotBlank(message = "shop_code is required")
  63 + private String shopCode;
  64 +
  65 + /**
  66 + * 门店名称
  67 + */
  68 + @NotBlank(message = "shop_name is required")
  69 + private String shopName;
  70 +
  71 + /**
  72 + * 动态码,order_type=2时必填
  73 + */
  74 + private String dynamicCode;
  75 +
  76 +
  77 + public String getOrderId() {
  78 + return orderId;
  79 + }
  80 +
  81 + public void setOrderId(String orderId) {
  82 + this.orderId = orderId;
  83 + }
  84 +
  85 + public String getTradeId() {
  86 + return tradeId;
  87 + }
  88 +
  89 + public void setTradeId(String tradeId) {
  90 + this.tradeId = tradeId;
  91 + }
  92 +
  93 + public String getUserCode() {
  94 + return userCode;
  95 + }
  96 +
  97 + public void setUserCode(String userCode) {
  98 + this.userCode = userCode;
  99 + }
  100 +
  101 + public String getCompanyCode() {
  102 + return companyCode;
  103 + }
  104 +
  105 + public void setCompanyCode(String companyCode) {
  106 + this.companyCode = companyCode;
  107 + }
  108 +
  109 + public Long getTotalAmount() {
  110 + return totalAmount;
  111 + }
  112 +
  113 + public void setTotalAmount(Long totalAmount) {
  114 + this.totalAmount = totalAmount;
  115 + }
  116 +
  117 + public LocalDateTime getOrderTime() {
  118 + return orderTime;
  119 + }
  120 +
  121 + public void setOrderTime(LocalDateTime orderTime) {
  122 + this.orderTime = orderTime;
  123 + }
  124 +
  125 + public Integer getOrderType() {
  126 + return orderType;
  127 + }
  128 +
  129 + public void setOrderType(Integer orderType) {
  130 + this.orderType = orderType;
  131 + }
  132 +
  133 + public String getShopCode() {
  134 + return shopCode;
  135 + }
  136 +
  137 + public void setShopCode(String shopCode) {
  138 + this.shopCode = shopCode;
  139 + }
  140 +
  141 + public String getShopName() {
  142 + return shopName;
  143 + }
  144 +
  145 + public void setShopName(String shopName) {
  146 + this.shopName = shopName;
  147 + }
  148 +
  149 + public String getDynamicCode() {
  150 + return dynamicCode;
  151 + }
  152 +
  153 + public void setDynamicCode(String dynamicCode) {
  154 + this.dynamicCode = dynamicCode;
  155 + }
  156 +}
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/co/PaymentAllocateCO.java 0 → 100644
  1 +package com.diligrp.cashier.mall.domain.rtmall.co;
  2 +
  3 +import com.diligrp.cashier.mall.domain.rtmall.RtMarkBaseCO;
  4 +import com.fasterxml.jackson.annotation.JsonProperty;
  5 +import jakarta.validation.Valid;
  6 +import jakarta.validation.constraints.NotEmpty;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * 支付分摊回调请求对象
  12 + * POS完成支付分摊后,调用此接口通知商户
  13 + */
  14 +public class PaymentAllocateCO extends RtMarkBaseCO {
  15 + /**
  16 + * 支付流水列表
  17 + */
  18 + @NotEmpty(message = "trade_list is required")
  19 + @Valid
  20 + private List<TradeInfo> tradeList;
  21 +
  22 + public List<TradeInfo> getTradeList() {
  23 + return tradeList;
  24 + }
  25 +
  26 + public void setTradeList(List<TradeInfo> tradeList) {
  27 + this.tradeList = tradeList;
  28 + }
  29 +
  30 + /**
  31 + * 支付流水信息
  32 + */
  33 + public static class TradeInfo {
  34 + /**
  35 + * 订单号
  36 + */
  37 + @JsonProperty("order_id")
  38 + @NotEmpty(message = "order_id is required")
  39 + private String orderId;
  40 +
  41 + /**
  42 + * 支付流水号
  43 + */
  44 + @JsonProperty("trade_id")
  45 + @NotEmpty(message = "trade_id is required")
  46 + private String tradeId;
  47 +
  48 + /**
  49 + * 会员编号
  50 + */
  51 + @JsonProperty("user_code")
  52 + @NotEmpty(message = "user_code is required")
  53 + private String userCode;
  54 +
  55 + /**
  56 + * 企业组编号
  57 + */
  58 + @JsonProperty("company_code")
  59 + @NotEmpty(message = "company_code is required")
  60 + private String companyCode;
  61 +
  62 + public String getOrderId() {
  63 + return orderId;
  64 + }
  65 +
  66 + public void setOrderId(String orderId) {
  67 + this.orderId = orderId;
  68 + }
  69 +
  70 + public String getTradeId() {
  71 + return tradeId;
  72 + }
  73 +
  74 + public void setTradeId(String tradeId) {
  75 + this.tradeId = tradeId;
  76 + }
  77 +
  78 + public String getUserCode() {
  79 + return userCode;
  80 + }
  81 +
  82 + public void setUserCode(String userCode) {
  83 + this.userCode = userCode;
  84 + }
  85 +
  86 + public String getCompanyCode() {
  87 + return companyCode;
  88 + }
  89 +
  90 + public void setCompanyCode(String companyCode) {
  91 + this.companyCode = companyCode;
  92 + }
  93 + }
  94 +}
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/domain/rtmall/vo/OrderDetailResponseVO.java 0 → 100644
  1 +package com.diligrp.cashier.mall.domain.rtmall.vo;
  2 +
  3 +import com.fasterxml.jackson.databind.PropertyNamingStrategies;
  4 +import com.fasterxml.jackson.databind.annotation.JsonNaming;
  5 +
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * 大润发订单详情接口响应
  10 + */
  11 +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
  12 +public class OrderDetailResponseVO {
  13 + /**
  14 + * 接口状态
  15 + */
  16 + private String result;
  17 +
  18 + /**
  19 + * 状态码
  20 + */
  21 + private String code;
  22 +
  23 + /**
  24 + * 状态描述
  25 + */
  26 + private String msg;
  27 +
  28 + /**
  29 + * 返回数据
  30 + */
  31 + private OrderDetailData data;
  32 +
  33 + public String getResult() {
  34 + return result;
  35 + }
  36 +
  37 + public void setResult(String result) {
  38 + this.result = result;
  39 + }
  40 +
  41 + public String getCode() {
  42 + return code;
  43 + }
  44 +
  45 + public void setCode(String code) {
  46 + this.code = code;
  47 + }
  48 +
  49 + public String getMsg() {
  50 + return msg;
  51 + }
  52 +
  53 + public void setMsg(String msg) {
  54 + this.msg = msg;
  55 + }
  56 +
  57 + public OrderDetailData getData() {
  58 + return data;
  59 + }
  60 +
  61 + public void setData(OrderDetailData data) {
  62 + this.data = data;
  63 + }
  64 +
  65 + /**
  66 + * 订单详情数据
  67 + */
  68 + @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
  69 + public static class OrderDetailData {
  70 + /**
  71 + * 订单号
  72 + */
  73 + private String orderId;
  74 +
  75 + /**
  76 + * 支付流水号
  77 + */
  78 + private String tradeId;
  79 +
  80 + /**
  81 + * 店铺编号
  82 + */
  83 + private String shopCode;
  84 +
  85 + /**
  86 + * 店铺名称
  87 + */
  88 + private String shopName;
  89 +
  90 + /**
  91 + * 订单金额(分)
  92 + */
  93 + private Long totalAmount;
  94 +
  95 + /**
  96 + * 会员手机号
  97 + */
  98 + private String mobile;
  99 +
  100 + /**
  101 + * 商户会员编号
  102 + */
  103 + private String userCode;
  104 +
  105 + /**
  106 + * 订单状态
  107 + */
  108 + private String orderStatus;
  109 +
  110 + /**
  111 + * 订单创建时间
  112 + */
  113 + private String createTime;
  114 +
  115 + /**
  116 + * 订单修改时间
  117 + */
  118 + private String updateTime;
  119 +
  120 + /**
  121 + * 支付流水号
  122 + */
  123 + private String transactionId;
  124 +
  125 + /**
  126 + * 支付状态
  127 + */
  128 + private String payStatus;
  129 +
  130 + /**
  131 + * 商品列表
  132 + */
  133 + private List<OrderItem> itemList;
  134 +
  135 + public String getOrderId() {
  136 + return orderId;
  137 + }
  138 +
  139 + public void setOrderId(String orderId) {
  140 + this.orderId = orderId;
  141 + }
  142 +
  143 + public String getTradeId() {
  144 + return tradeId;
  145 + }
  146 +
  147 + public void setTradeId(String tradeId) {
  148 + this.tradeId = tradeId;
  149 + }
  150 +
  151 + public String getShopCode() {
  152 + return shopCode;
  153 + }
  154 +
  155 + public void setShopCode(String shopCode) {
  156 + this.shopCode = shopCode;
  157 + }
  158 +
  159 + public String getShopName() {
  160 + return shopName;
  161 + }
  162 +
  163 + public void setShopName(String shopName) {
  164 + this.shopName = shopName;
  165 + }
  166 +
  167 + public Long getTotalAmount() {
  168 + return totalAmount;
  169 + }
  170 +
  171 + public void setTotalAmount(Long totalAmount) {
  172 + this.totalAmount = totalAmount;
  173 + }
  174 +
  175 + public String getMobile() {
  176 + return mobile;
  177 + }
  178 +
  179 + public void setMobile(String mobile) {
  180 + this.mobile = mobile;
  181 + }
  182 +
  183 + public String getUserCode() {
  184 + return userCode;
  185 + }
  186 +
  187 + public void setUserCode(String userCode) {
  188 + this.userCode = userCode;
  189 + }
  190 +
  191 + public String getOrderStatus() {
  192 + return orderStatus;
  193 + }
  194 +
  195 + public void setOrderStatus(String orderStatus) {
  196 + this.orderStatus = orderStatus;
  197 + }
  198 +
  199 + public String getCreateTime() {
  200 + return createTime;
  201 + }
  202 +
  203 + public void setCreateTime(String createTime) {
  204 + this.createTime = createTime;
  205 + }
  206 +
  207 + public String getUpdateTime() {
  208 + return updateTime;
  209 + }
  210 +
  211 + public void setUpdateTime(String updateTime) {
  212 + this.updateTime = updateTime;
  213 + }
  214 +
  215 + public String getTransactionId() {
  216 + return transactionId;
  217 + }
  218 +
  219 + public void setTransactionId(String transactionId) {
  220 + this.transactionId = transactionId;
  221 + }
  222 +
  223 + public String getPayStatus() {
  224 + return payStatus;
  225 + }
  226 +
  227 + public void setPayStatus(String payStatus) {
  228 + this.payStatus = payStatus;
  229 + }
  230 +
  231 + public List<OrderItem> getItemList() {
  232 + return itemList;
  233 + }
  234 +
  235 + public void setItemList(List<OrderItem> itemList) {
  236 + this.itemList = itemList;
  237 + }
  238 + }
  239 +
  240 + /**
  241 + * 订单商品项
  242 + */
  243 + @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
  244 + public static class OrderItem {
  245 + /**
  246 + * 子订单ID
  247 + */
  248 + private String subOrderId;
  249 +
  250 + /**
  251 + * SKU编号
  252 + */
  253 + private String itemBn;
  254 +
  255 + /**
  256 + * 品名
  257 + */
  258 + private String itemName;
  259 +
  260 + /**
  261 + * 商品金额(分)
  262 + */
  263 + private Long amount;
  264 +
  265 + /**
  266 + * 税则分类编码
  267 + */
  268 + private String taxCategoryCode;
  269 +
  270 + /**
  271 + * 销项税率
  272 + */
  273 + private String taxOutputRate;
  274 +
  275 + /**
  276 + * 税则分类名称
  277 + */
  278 + private String taxCategoryName;
  279 +
  280 + /**
  281 + * 税则分类简称
  282 + */
  283 + private String taxCategoryShortName;
  284 +
  285 + /**
  286 + * 是否纯称重品(0=否,1=是)
  287 + */
  288 + private Integer isWeight;
  289 +
  290 + /**
  291 + * 商品数量(纯称重品时单位为kg)
  292 + */
  293 + private Double num;
  294 +
  295 + public String getSubOrderId() {
  296 + return subOrderId;
  297 + }
  298 +
  299 + public void setSubOrderId(String subOrderId) {
  300 + this.subOrderId = subOrderId;
  301 + }
  302 +
  303 + public String getItemBn() {
  304 + return itemBn;
  305 + }
  306 +
  307 + public void setItemBn(String itemBn) {
  308 + this.itemBn = itemBn;
  309 + }
  310 +
  311 + public String getItemName() {
  312 + return itemName;
  313 + }
  314 +
  315 + public void setItemName(String itemName) {
  316 + this.itemName = itemName;
  317 + }
  318 +
  319 + public Long getAmount() {
  320 + return amount;
  321 + }
  322 +
  323 + public void setAmount(Long amount) {
  324 + this.amount = amount;
  325 + }
  326 +
  327 + public String getTaxCategoryCode() {
  328 + return taxCategoryCode;
  329 + }
  330 +
  331 + public void setTaxCategoryCode(String taxCategoryCode) {
  332 + this.taxCategoryCode = taxCategoryCode;
  333 + }
  334 +
  335 + public String getTaxOutputRate() {
  336 + return taxOutputRate;
  337 + }
  338 +
  339 + public void setTaxOutputRate(String taxOutputRate) {
  340 + this.taxOutputRate = taxOutputRate;
  341 + }
  342 +
  343 + public String getTaxCategoryName() {
  344 + return taxCategoryName;
  345 + }
  346 +
  347 + public void setTaxCategoryName(String taxCategoryName) {
  348 + this.taxCategoryName = taxCategoryName;
  349 + }
  350 +
  351 + public String getTaxCategoryShortName() {
  352 + return taxCategoryShortName;
  353 + }
  354 +
  355 + public void setTaxCategoryShortName(String taxCategoryShortName) {
  356 + this.taxCategoryShortName = taxCategoryShortName;
  357 + }
  358 +
  359 + public Integer getIsWeight() {
  360 + return isWeight;
  361 + }
  362 +
  363 + public void setIsWeight(Integer isWeight) {
  364 + this.isWeight = isWeight;
  365 + }
  366 +
  367 + public Double getNum() {
  368 + return num;
  369 + }
  370 +
  371 + public void setNum(Double num) {
  372 + this.num = num;
  373 + }
  374 + }
  375 +}
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/MallBizPaymentService.java
1 1 package com.diligrp.cashier.mall.service.biz;
2 2  
  3 +import com.diligrp.cashier.mall.domain.rtmall.co.OrderPaymentCO;
  4 +import com.diligrp.cashier.mall.domain.rtmall.co.PaymentAllocateCO;
  5 +import com.diligrp.cashier.mall.domain.rtmall.vo.OrderSuccessVO;
3 6 import com.diligrp.cashier.mall.model.MallBizPayment;
4 7 import com.diligrp.cashier.mall.model.MallBizPaymentOrder;
5 8  
... ... @@ -14,4 +17,21 @@ public interface MallBizPaymentService {
14 17 void save(MallBizPayment mallBizPayment);
15 18  
16 19 MallBizPaymentOrder paymentOrderInfo(MallBizPaymentOrder mallBizPaymentOrder);
  20 +
  21 + /**
  22 + * 扫码下单接口
  23 + * Pos扫支付码后,推送订单信息到商户,商户返回收银台链接
  24 + *
  25 + * @param orderPaymentCO 扫码下单请求
  26 + * @return 商户支付单号和收银台链接
  27 + */
  28 + OrderSuccessVO createOrderPayment(OrderPaymentCO orderPaymentCO);
  29 +
  30 + /**
  31 + * 支付分摊回调接口
  32 + * POS完成支付分摊后,调用此接口通知商户商品信息已就绪
  33 + *
  34 + * @param allocateCO 分摊回调请求
  35 + */
  36 + void handlePaymentAllocate(PaymentAllocateCO allocateCO);
17 37 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/impl/MallBizOrderServiceImpl.java
... ... @@ -72,7 +72,6 @@ public class MallBizOrderServiceImpl implements MallBizOrderService {
72 72 MallBizPayment mallBizPayment = MallBizPayment.of(mallBizOrders);
73 73  
74 74 // TODO 2025/12/30: 预支付信息 收银台地址信息
75   - mallBizPayment.setPayTradeId(IdUtil.simpleUUID());
76 75 mallBizPayment.setCashierUrl("https://cashier.test.gszdtop.com?payTradeNo=" + mallBizPayment.getPayTradeNo());
77 76  
78 77 // save
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/service/biz/impl/MallBizPaymentServiceImpl.java
1 1 package com.diligrp.cashier.mall.service.biz.impl;
2 2  
  3 +import com.diligrp.cashier.mall.MallConstants;
  4 +import com.diligrp.cashier.mall.client.RtMallHttpClient;
  5 +import com.diligrp.cashier.mall.dao.MallBizOrderDao;
  6 +import com.diligrp.cashier.mall.dao.MallBizOrderItemDao;
3 7 import com.diligrp.cashier.mall.dao.MallBizPaymentDao;
4 8 import com.diligrp.cashier.mall.dao.MallBizPaymentOrderDao;
  9 +import com.diligrp.cashier.mall.domain.rtmall.co.AuthLoginCO;
5 10 import com.diligrp.cashier.mall.domain.rtmall.co.OrderInfoCO;
  11 +import com.diligrp.cashier.mall.domain.rtmall.co.OrderPaymentCO;
  12 +import com.diligrp.cashier.mall.domain.rtmall.co.PaymentAllocateCO;
  13 +import com.diligrp.cashier.mall.domain.rtmall.vo.OrderDetailResponseVO;
6 14 import com.diligrp.cashier.mall.domain.rtmall.vo.OrderPaymentVO;
  15 +import com.diligrp.cashier.mall.domain.rtmall.vo.OrderSuccessVO;
  16 +import com.diligrp.cashier.mall.exception.RtMartMallException;
  17 +import com.diligrp.cashier.mall.model.MallBizOrder;
  18 +import com.diligrp.cashier.mall.model.MallBizOrderItem;
7 19 import com.diligrp.cashier.mall.model.MallBizPayment;
8 20 import com.diligrp.cashier.mall.model.MallBizPaymentOrder;
  21 +import com.diligrp.cashier.mall.property.MallDynamicProperty;
  22 +import com.diligrp.cashier.mall.property.RtMallDynamicProperty;
9 23 import com.diligrp.cashier.mall.service.biz.MallBizPaymentService;
  24 +import com.diligrp.cashier.mall.type.OrderState;
  25 +import com.diligrp.cashier.mall.type.PayState;
  26 +import com.diligrp.cashier.mall.type.RtMarkErrorCode;
  27 +import com.diligrp.cashier.mall.util.MallSnowflakeKeyManager;
  28 +import com.diligrp.cashier.shared.util.JsonUtils;
  29 +import com.diligrp.cashier.shared.util.SpringContextUtils;
  30 +import com.diligrp.cashier.trade.type.SnowflakeKey;
10 31 import jakarta.annotation.Resource;
11 32 import org.slf4j.Logger;
12 33 import org.slf4j.LoggerFactory;
13 34 import org.springframework.beans.BeanUtils;
  35 +import org.springframework.dao.DuplicateKeyException;
  36 +import org.springframework.data.redis.core.RedisTemplate;
14 37 import org.springframework.stereotype.Service;
15 38 import org.springframework.transaction.annotation.Transactional;
16 39  
  40 +import java.util.ArrayList;
  41 +import java.util.List;
  42 +import java.util.Objects;
  43 +
17 44 /**
18 45 * @ClassName MallBizPaymentServiceImpl.java
19 46 * @author dengwei
... ... @@ -29,6 +56,16 @@ public class MallBizPaymentServiceImpl implements MallBizPaymentService {
29 56 private MallBizPaymentDao mallBizPaymentDao;
30 57 @Resource
31 58 private MallBizPaymentOrderDao mallBizPaymentOrderDao;
  59 + @Resource
  60 + private MallSnowflakeKeyManager mallSnowflakeKeyManager;
  61 + @Resource
  62 + private RedisTemplate<String, Object> redisTemplate;
  63 + @Resource
  64 + private RtMallHttpClient rtMallHttpClient;
  65 + @Resource
  66 + private MallBizOrderDao mallBizOrderDao;
  67 + @Resource
  68 + private MallBizOrderItemDao mallBizOrderItemDao;
32 69  
33 70 /**
34 71 * save
... ... @@ -48,4 +85,282 @@ public class MallBizPaymentServiceImpl implements MallBizPaymentService {
48 85 public MallBizPaymentOrder paymentOrderInfo(MallBizPaymentOrder mallBizPaymentOrder) {
49 86 return mallBizPaymentOrderDao.getMallBizPaymentOrder(mallBizPaymentOrder);
50 87 }
  88 +
  89 + /**
  90 + * 扫码下单接口
  91 + * Pos扫支付码后,推送订单信息到商户,商户返回收银台链接
  92 + * 创建订单(商品为空,待分摊后同步)+ 支付记录
  93 + *
  94 + * @param co 扫码下单请求
  95 + * @return 支付单号和收银台链接
  96 + */
  97 + @Override
  98 + @Transactional(rollbackFor = {Exception.class})
  99 + public OrderSuccessVO createOrderPayment(OrderPaymentCO co) {
  100 + log.info("开始处理扫码下单请求, order_id={}, trade_id={}, order_type={}",
  101 + co.getOrderId(), co.getTradeId(), co.getOrderType());
  102 +
  103 + //获取用户信息
  104 + AuthLoginCO authLogin = getAuthLogin(co.getUserCode());
  105 +
  106 + //创建订单(商品列表为空,待分摊后同步)
  107 + MallBizOrder order = buildOrderFromCO(co, authLogin);
  108 +
  109 + //创建支付记录
  110 + MallBizPayment payment = buildPaymentFromCO(co, order);
  111 +
  112 + //保存订单和支付记录
  113 + try {
  114 + mallBizOrderDao.insertSelective(order);
  115 + mallBizPaymentDao.insertSelective(payment);
  116 + log.info("扫码下单保存成功, order_no={}, out_trade_no={}, trade_id={}",
  117 + order.getOrderNo(), payment.getPayTradeNo(), co.getTradeId());
  118 + } catch (DuplicateKeyException e) {
  119 + // 如果 order_id+trade_id 已存在,返回错误
  120 + log.warn("扫码下单重复请求, trade_id={}", co.getTradeId());
  121 + throw new RtMartMallException(RtMarkErrorCode.E4003);
  122 + }
  123 +
  124 + //返回结果
  125 + log.info("扫码下单处理完成, out_trade_no={}, cashier_url={}", payment.getPayTradeNo(), payment.getCashierUrl());
  126 + return new OrderSuccessVO(payment.getPayTradeNo(), payment.getCashierUrl());
  127 + }
  128 +
  129 + /**
  130 + * 获取用户登录信息
  131 + */
  132 + private AuthLoginCO getAuthLogin(String userCode) {
  133 + Object cache = redisTemplate.opsForValue().get(MallConstants.MALL_USER_INFO + userCode);
  134 + if (Objects.isNull(cache)) {
  135 + throw new RtMartMallException(RtMarkErrorCode.E5001);
  136 + }
  137 + AuthLoginCO authLogin = JsonUtils.fromJsonString(Objects.requireNonNull(cache).toString(), AuthLoginCO.class);
  138 + log.info("获取用户登录信息: userCode={}, username={}", userCode, authLogin.getUsername());
  139 + return authLogin;
  140 + }
  141 +
  142 + /**
  143 + * 构建扫码订单(商品为空,待分摊后同步)
  144 + */
  145 + private MallBizOrder buildOrderFromCO(OrderPaymentCO co, AuthLoginCO authLogin) {
  146 + MallBizOrder order = new MallBizOrder();
  147 + order.setId(mallSnowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_ORDER_ID));
  148 + order.setOrderNo(mallSnowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_ORDER_ID).toString());
  149 + order.setOrderId(co.getOrderId());
  150 + order.setTradeId(co.getTradeId());
  151 + order.setOrderType(co.getOrderType());
  152 + order.setUserCode(co.getUserCode());
  153 + order.setCompanyCode(co.getCompanyCode());
  154 + order.setShopCode(co.getShopCode());
  155 + order.setShopName(co.getShopName());
  156 + order.setTotalAmount(co.getTotalAmount());
  157 + order.setOrderTime(co.getOrderTime());
  158 + order.setOrderExpire(60); // 默认订单有效期60分钟
  159 + order.setState(OrderState.NOT_PAY.getCode()); // 初始状态:未支付
  160 +
  161 + //从用户信息中获取
  162 + order.setUsername(authLogin.getUsername());
  163 + order.setMchId(authLogin.getMchId());
  164 + order.setChannel(authLogin.getChannel());
  165 + order.setSource(authLogin.getSource());
  166 +
  167 + //商品信息暂时为空,等待分摊后同步
  168 + order.setMallBizOrderItems(null);
  169 + order.setMallBizOrderAddress(null);
  170 + order.setFreightFee(0L); // 扫码下单无运费
  171 +
  172 + return order;
  173 + }
  174 +
  175 + /**
  176 + * 构建支付记录
  177 + */
  178 + private MallBizPayment buildPaymentFromCO(OrderPaymentCO co, MallBizOrder order) {
  179 + MallBizPayment payment = new MallBizPayment();
  180 + payment.setId(mallSnowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_PAYMENT_ID));
  181 + payment.setPayTradeNo(mallSnowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_PAYMENT_ID).toString());
  182 + payment.setBizOrderId(order.getId().toString()); // 关联订单
  183 + payment.setOrderId(co.getOrderId());
  184 + payment.setTradeId(co.getTradeId());
  185 + payment.setPayFee(co.getTotalAmount());
  186 + payment.setPayState(PayState.PENDING.getCode());
  187 + payment.setMchId(order.getMchId());
  188 +
  189 + //获取大润发配置,设置回调地址
  190 + RtMallDynamicProperty rtMallDynamicProperty = SpringContextUtils.getBean(RtMallDynamicProperty.class);
  191 + RtMallDynamicProperty.AppSecretDynamicProperty property =
  192 + rtMallDynamicProperty.getBySourceAndType(order.getSource(), order.getOrderType());
  193 + payment.setPaymentCallback(property.getCallbackDomain());
  194 +
  195 + //根据 order_type 决定是否生成收银台URL
  196 + if (co.getOrderType() == 2) {
  197 + //接口扫码购:生成收银台链接
  198 + String cashierUrl = SpringContextUtils.getBean(MallDynamicProperty.class).getUrl();
  199 + if (!cashierUrl.endsWith("/")) {
  200 + cashierUrl = cashierUrl + "/";
  201 + }
  202 + payment.setCashierUrl(cashierUrl + "?payTradeNo=" + payment.getPayTradeNo());
  203 + }
  204 +
  205 +
  206 + return payment;
  207 + }
  208 +
  209 + /**
  210 + * 支付分摊回调接口
  211 + * POS完成支付分摊后,调用此接口通知商户商品信息已就绪
  212 + *
  213 + * @param allocateCO 分摊回调请求
  214 + */
  215 + @Override
  216 + @Transactional(rollbackFor = {Exception.class})
  217 + public void handlePaymentAllocate(PaymentAllocateCO allocateCO) {
  218 + log.info("收到支付分摊回调通知, trade_count={}", allocateCO.getTradeList().size());
  219 +
  220 + for (PaymentAllocateCO.TradeInfo trade : allocateCO.getTradeList()) {
  221 + handleSingleTradeAllocate(trade);
  222 + }
  223 +
  224 + log.info("支付分摊回调处理完成");
  225 + }
  226 +
  227 + /**
  228 + * 处理单个支付流水的分摊通知
  229 + * 1. 调用大润发订单详情接口获取商品信息
  230 + * 2. 更新订单状态
  231 + * 3. 插入商品明细
  232 + */
  233 + private void handleSingleTradeAllocate(PaymentAllocateCO.TradeInfo trade) {
  234 + log.info("处理支付分摊: order_id={}, trade_id={}, user_code={}",
  235 + trade.getOrderId(), trade.getTradeId(), trade.getUserCode());
  236 +
  237 + //调用大润发订单详情接口
  238 + OrderDetailResponseVO detailResponse = rtMallHttpClient.getOrderDetail(
  239 + trade.getOrderId(),
  240 + trade.getTradeId(),
  241 + trade.getUserCode()
  242 + );
  243 +
  244 + OrderDetailResponseVO.OrderDetailData orderDetail = detailResponse.getData();
  245 + if (orderDetail == null || orderDetail.getItemList() == null || orderDetail.getItemList().isEmpty()) {
  246 + log.warn("订单详情中没有商品信息: order_id={}", trade.getOrderId());
  247 + return;
  248 + }
  249 +
  250 + //查询订单
  251 + MallBizOrder order = mallBizOrderDao.findByOrderIdAndTradeId(trade.getOrderId(), trade.getTradeId());
  252 + if (order == null) {
  253 + log.error("找不到订单: order_id={}, trade_id={}", trade.getOrderId(), trade.getTradeId());
  254 + throw new RtMartMallException(RtMarkErrorCode.E5000);
  255 + }
  256 +
  257 + //更新订单状态
  258 + updateOrderState(order, orderDetail);
  259 +
  260 + //更新支付记录
  261 + updatePaymentInfo(trade.getOrderId(), trade.getTradeId(), orderDetail);
  262 +
  263 + //插入商品明细
  264 + insertOrderItems(order, orderDetail.getItemList());
  265 +
  266 + log.info("支付分摊处理成功: trade_id={}, item_count={}", trade.getTradeId(), orderDetail.getItemList().size());
  267 + }
  268 +
  269 + /**
  270 + * 更新支付记录
  271 + */
  272 + private void updatePaymentInfo(String orderId, String tradeId, OrderDetailResponseVO.OrderDetailData orderDetail) {
  273 + //查询支付记录
  274 + MallBizPayment payment = mallBizPaymentDao.findByOrderIdAndTradeId(orderId, tradeId);
  275 + if (payment == null) {
  276 + log.error("找不到支付记录: order_id={}, trade_id={}", orderId, tradeId);
  277 + throw new RtMartMallException(RtMarkErrorCode.E5000);
  278 + }
  279 +
  280 + //更新交易流水号
  281 + if (orderDetail.getTransactionId() != null && !orderDetail.getTransactionId().equals(payment.getPayTradeId())) {
  282 + payment.setPayTradeId(orderDetail.getTransactionId());
  283 + mallBizPaymentDao.updateByPrimaryKeySelective(payment);
  284 + log.info("支付记录已更新: trade_id={}, pay_payment_id={}", tradeId, orderDetail.getTransactionId());
  285 + }
  286 + }
  287 +
  288 + /**
  289 + * 更新订单状态
  290 + */
  291 + private void updateOrderState(MallBizOrder order, OrderDetailResponseVO.OrderDetailData orderDetail) {
  292 + Integer newState = mapOrderState(orderDetail.getOrderStatus());
  293 + if (newState != null && !newState.equals(order.getState())) {
  294 + order.setState(newState);
  295 + mallBizOrderDao.updateByPrimaryKeySelective(order);
  296 + log.info("订单状态已更新: order_id={}, old_state={}, new_state={}",
  297 + order.getOrderId(), order.getState(), newState);
  298 + }
  299 + }
  300 +
  301 + /**
  302 + * 大润发状态 -> 本系统状态
  303 + */
  304 + private Integer mapOrderState(String rtMallStatus) {
  305 + if (rtMallStatus == null) {
  306 + return null;
  307 + }
  308 + return switch (rtMallStatus) {
  309 + case "DONE" -> OrderState.PAYED.getCode(); // 订单分摊完成 -> 已支付
  310 + case "PAYED" -> OrderState.PAYED.getCode(); // 已支付
  311 + case "NOTPAY" -> OrderState.NOT_PAY.getCode(); // 未支付
  312 + case "CANCEL" -> OrderState.NOT_PAY_CANCEL.getCode(); // 已取消
  313 + default -> null;
  314 + };
  315 + }
  316 +
  317 + /**
  318 + * 插入商品明细
  319 + */
  320 + private void insertOrderItems(MallBizOrder order, List<OrderDetailResponseVO.OrderItem> items) {
  321 + List<MallBizOrderItem> orderItems = new ArrayList<>();
  322 +
  323 + for (OrderDetailResponseVO.OrderItem item : items) {
  324 + MallBizOrderItem orderItem = new MallBizOrderItem();
  325 + orderItem.setId(mallSnowflakeKeyManager.nextId(SnowflakeKey.MALL_BIZ_ORDER_ID));
  326 + orderItem.setBizOrderId(order.getId());
  327 + orderItem.setOrderId(order.getOrderId());
  328 + orderItem.setSubOrderId(item.getSubOrderId() != null ? Long.parseLong(item.getSubOrderId()) : null);
  329 + orderItem.setShopCode(order.getShopCode());
  330 + orderItem.setShopName(order.getShopName());
  331 + orderItem.setItemBn(item.getItemBn());
  332 + orderItem.setItemName(item.getItemName());
  333 + orderItem.setAmount(item.getAmount());
  334 + orderItem.setTaxOutputRate(item.getTaxOutputRate());
  335 + orderItem.setTaxClassificationCode(item.getTaxCategoryCode());
  336 + orderItem.setTaxClassificationName(item.getTaxCategoryName());
  337 +
  338 + if (item.getNum() != null && item.getNum() > 0) {
  339 + //判断是否为纯称重品
  340 + if (item.getIsWeight() == 1) {
  341 + //纯称重品:num单位为kg,转换为克存储(*1000)
  342 + orderItem.setNum((int) (item.getNum() * 1000));
  343 + //单价 = 金额 / 重量(kg),单位:分/kg
  344 + orderItem.setPrice((long) (item.getAmount() / item.getNum()));
  345 + } else {
  346 + //非称重品:num为件数,直接转为Integer
  347 + orderItem.setNum(item.getNum().intValue());
  348 + //单价 = 金额 / 件数,单位:分/件
  349 + orderItem.setPrice((long) (item.getAmount() / item.getNum()));
  350 + }
  351 + } else {
  352 + //数量为空或0时,设置默认值
  353 + orderItem.setNum(0);
  354 + orderItem.setPrice(0L);
  355 + }
  356 +
  357 + orderItems.add(orderItem);
  358 + }
  359 +
  360 + // 批量插入商品明细
  361 + if (!orderItems.isEmpty()) {
  362 + mallBizOrderItemDao.batchInsert(orderItems);
  363 + log.info("商品明细插入成功: order_id={}, count={}", order.getOrderId(), orderItems.size());
  364 + }
  365 + }
51 366 }
... ...
cashier-mall/src/main/java/com/diligrp/cashier/mall/util/TimestampToLocalDateTimeDeserializer.java 0 → 100644
  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
... ... @@ -383,4 +383,12 @@
383 383 </if>
384 384 and version = #{version}
385 385 </update>
  386 + <select id="findByOrderIdAndTradeId" resultMap="BaseResultMap">
  387 + select
  388 + <include refid="Base_Column_List" />
  389 + from mall_biz_order
  390 + where order_id = #{orderId,jdbcType=VARCHAR}
  391 + and trade_id = #{tradeId,jdbcType=VARCHAR}
  392 + limit 1
  393 + </select>
386 394 </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="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">
34   - select
35   - <include refid="Base_Column_List" />
36   - from mall_biz_payment
37   - where id = #{id,jdbcType=BIGINT}
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>
  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 + <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_payment_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}, #{payPaymentId,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="payPaymentId != null">
  87 + pay_payment_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="payPaymentId != null">
  152 + #{payPaymentId,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="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="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_payment_id = #{payPaymentId,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>
295 291 </mapper>
... ...