From af60c185099ae3afc87d821da56acff12b9c0683 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Tue, 12 Mar 2019 00:43:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=20pay=20=E7=9A=84?= =?UTF-8?q?=E8=A1=A8=EF=BC=88=E6=94=AF=E4=BB=98=E9=83=A8=E5=88=86=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E5=8C=85=E6=8B=AC=E9=80=80=E6=AC=BE=E7=AD=89=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/pay/api/constant/PayChannel.java | 43 ++++ .../iocoder/mall/pay/dataobject/PayAppDO.java | 15 ++ .../iocoder/mall/pay/dataobject/PayLogDO.java | 24 ++ .../pay/dataobject/PayNotifyAppLogDO.java | 7 + .../mall/pay/dataobject/PayRefundDO.java | 4 + .../dataobject/PayRepeatTransactionDO.java | 7 + .../mall/pay/dataobject/PayTransactionDO.java | 215 ++++++++++++++++++ .../dataobject/PayTransactionExtensionDO.java | 106 +++++++++ 8 files changed, 421 insertions(+) create mode 100644 pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/constant/PayChannel.java create mode 100644 pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayAppDO.java create mode 100644 pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayLogDO.java create mode 100644 pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayNotifyAppLogDO.java create mode 100644 pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayRefundDO.java create mode 100644 pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayRepeatTransactionDO.java create mode 100644 pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayTransactionDO.java create mode 100644 pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayTransactionExtensionDO.java diff --git a/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/constant/PayChannel.java b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/constant/PayChannel.java new file mode 100644 index 000000000..0939b203c --- /dev/null +++ b/pay/pay-service-api/src/main/java/cn/iocoder/mall/pay/api/constant/PayChannel.java @@ -0,0 +1,43 @@ +package cn.iocoder.mall.pay.api.constant; + +/** + * 支付通道 + */ +public enum PayChannel { + + WEIXIN_APP(100, "wx", "微信 App 支付"), + WEIXIN_PUB(100, "wx", "微信 JS API 支付"), + + ALIPAY(200, "alipay", "微信支付"); + + /** + * 渠道编号 + */ + private Integer id; + /** + * 编码 + */ + private String code; + /** + * 渠道名 + */ + private String name; + + PayChannel(Integer id, String code, String name) { + this.id = id; + this.code = code; + this.name = name; + } + + public Integer getId() { + return id; + } + + public String getCode() { + return code; + } + + public String getName() { + return name; + } +} \ No newline at end of file diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayAppDO.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayAppDO.java new file mode 100644 index 000000000..8604cb2e9 --- /dev/null +++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayAppDO.java @@ -0,0 +1,15 @@ +package cn.iocoder.mall.pay.dataobject; + +import cn.iocoder.common.framework.dataobject.BaseDO; + +/** + * TODO 支付应用(业务线)DO + */ +public class PayAppDO extends BaseDO { + + /** + * 应用编号 + */ + private String id; + +} \ No newline at end of file diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayLogDO.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayLogDO.java new file mode 100644 index 000000000..d9aa2ef99 --- /dev/null +++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayLogDO.java @@ -0,0 +1,24 @@ +package cn.iocoder.mall.pay.dataobject; + +/** + * 交易日志 DO + * + * 通过该日志,我们可以追溯整个执行过程 + * + * TODO 芋艿,后面在捉摸 + */ +public class PayLogDO { + + /** + * 编号,自增 + */ + private Integer id; + /** + * 应用编号 + */ + private String appId; + /** + * 业务线订单编号 + */ + private Integer orderId; +} \ No newline at end of file diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayNotifyAppLogDO.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayNotifyAppLogDO.java new file mode 100644 index 000000000..7eb38d46a --- /dev/null +++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayNotifyAppLogDO.java @@ -0,0 +1,7 @@ +package cn.iocoder.mall.pay.dataobject; + +/** + * + */ +public class PayNotifyAppLogDO { +} diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayRefundDO.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayRefundDO.java new file mode 100644 index 000000000..39f2fe0d6 --- /dev/null +++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayRefundDO.java @@ -0,0 +1,4 @@ +package cn.iocoder.mall.pay.dataobject; + +public class PayRefundDO { +} diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayRepeatTransactionDO.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayRepeatTransactionDO.java new file mode 100644 index 000000000..04bb30132 --- /dev/null +++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayRepeatTransactionDO.java @@ -0,0 +1,7 @@ +package cn.iocoder.mall.pay.dataobject; + +/** + * TODO 重复支付的交易 + */ +public class PayRepeatTransactionDO { +} diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayTransactionDO.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayTransactionDO.java new file mode 100644 index 000000000..8398b64fe --- /dev/null +++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayTransactionDO.java @@ -0,0 +1,215 @@ +package cn.iocoder.mall.pay.dataobject; + +import cn.iocoder.common.framework.dataobject.BaseDO; + +import java.util.Date; + +/** + * 支付交易 DO + */ +public class PayTransactionDO extends BaseDO { + + /** + * 编号,自增 + */ + private Integer id; + /** + * 应用编号 + * + * 不同业务线分配不同的 appId + * 举个例子, + * 1. 电商系统的订单,appId = 1024 + * 2. 活动系统的订单,appId = 2048 + */ + private String appId; + /** + * 发起交易的 IP + */ + private String createIp; + /** + * 业务线的订单编号 + * + * 1. 使用 String 的原因是,业务线可能使用 String 做为编号 + * 2. 每个 appId 下,orderId 唯一 + */ + private String orderId; + /** + * 订单状态 + * + * 0 : 等待支付 + * 1 : 待付款完成 + * 2 : 该笔交易已关闭 TODO 交易关闭,是不是订单系统触发 + * -1 : 支付失败 TODO 怎么触发 + */ + private Integer orderStatus; + /** + * 订单商品名 + */ + private String orderSubject; + /** + * 订单商品描述 + */ + private String orderDescription; + /** + * 订单备注 + */ + private String orderMemo; + /** + * 支付金额,单位:分。 + * + * TODO 暂时不考虑货币类型。 + */ + private Integer price; + /** + * 交易过期时间 + */ + private Integer expireTime; + + // TODO return url + // TODO notify url + + /** + * 支付成功的支付渠道 + */ + private Integer payChannel; + /** + * 第三方支付成功的时间 + */ + private Date paymentTime; + /** + * 收到第三方系统通知的时间 + * + * 一般情况下,即第三方系统的异步通知 + */ + private Date notifyTime; + /** + * 第三方的流水号 + */ + private String tradeNo; + + public Integer getId() { + return id; + } + + public PayTransactionDO setId(Integer id) { + this.id = id; + return this; + } + + public String getAppId() { + return appId; + } + + public PayTransactionDO setAppId(String appId) { + this.appId = appId; + return this; + } + + public String getCreateIp() { + return createIp; + } + + public PayTransactionDO setCreateIp(String createIp) { + this.createIp = createIp; + return this; + } + + public String getOrderId() { + return orderId; + } + + public PayTransactionDO setOrderId(String orderId) { + this.orderId = orderId; + return this; + } + + public Integer getOrderStatus() { + return orderStatus; + } + + public PayTransactionDO setOrderStatus(Integer orderStatus) { + this.orderStatus = orderStatus; + return this; + } + + public Integer getPrice() { + return price; + } + + public PayTransactionDO setPrice(Integer price) { + this.price = price; + return this; + } + + public Integer getPayChannel() { + return payChannel; + } + + public PayTransactionDO setPayChannel(Integer payChannel) { + this.payChannel = payChannel; + return this; + } + + public Integer getExpireTime() { + return expireTime; + } + + public PayTransactionDO setExpireTime(Integer expireTime) { + this.expireTime = expireTime; + return this; + } + + public Date getPaymentTime() { + return paymentTime; + } + + public PayTransactionDO setPaymentTime(Date paymentTime) { + this.paymentTime = paymentTime; + return this; + } + + public Date getNotifyTime() { + return notifyTime; + } + + public PayTransactionDO setNotifyTime(Date notifyTime) { + this.notifyTime = notifyTime; + return this; + } + + public String getTradeNo() { + return tradeNo; + } + + public PayTransactionDO setTradeNo(String tradeNo) { + this.tradeNo = tradeNo; + return this; + } + + public String getOrderSubject() { + return orderSubject; + } + + public PayTransactionDO setOrderSubject(String orderSubject) { + this.orderSubject = orderSubject; + return this; + } + + public String getOrderDescription() { + return orderDescription; + } + + public PayTransactionDO setOrderDescription(String orderDescription) { + this.orderDescription = orderDescription; + return this; + } + + public String getOrderMemo() { + return orderMemo; + } + + public PayTransactionDO setOrderMemo(String orderMemo) { + this.orderMemo = orderMemo; + return this; + } +} \ No newline at end of file diff --git a/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayTransactionExtensionDO.java b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayTransactionExtensionDO.java new file mode 100644 index 000000000..43cc8f3c2 --- /dev/null +++ b/pay/pay-service-impl/src/main/java/cn/iocoder/mall/pay/dataobject/PayTransactionExtensionDO.java @@ -0,0 +1,106 @@ +package cn.iocoder.mall.pay.dataobject; + +import cn.iocoder.common.framework.dataobject.BaseDO; + +/** + * 交易扩展表 + */ +public class PayTransactionExtensionDO extends BaseDO { + + /** + * 编号,自增 + */ + private Integer id; + /** + * 交易编号 {@link PayTransactionDO#getId()} + */ + private Integer transactionId; + /** + * 选择的支付渠道 + */ + private Integer payChannel; + /** + * 生成传输给第三方的订单号 + */ + private String transactionCode; + /** + * 发起调用的次数 + * + * TODO 芋艿,需要去请教下 + */ + private Integer callNum; + /** + * 扩展内容 + * + * 异步通知的时候填充回调的数据 + */ + private String extensionData; + /** + * 发起交易的 IP + */ + private String createIp; + + public Integer getId() { + return id; + } + + public PayTransactionExtensionDO setId(Integer id) { + this.id = id; + return this; + } + + public Integer getTransactionId() { + return transactionId; + } + + public PayTransactionExtensionDO setTransactionId(Integer transactionId) { + this.transactionId = transactionId; + return this; + } + + public Integer getPayChannel() { + return payChannel; + } + + public PayTransactionExtensionDO setPayChannel(Integer payChannel) { + this.payChannel = payChannel; + return this; + } + + public String getTransactionCode() { + return transactionCode; + } + + public PayTransactionExtensionDO setTransactionCode(String transactionCode) { + this.transactionCode = transactionCode; + return this; + } + + public Integer getCallNum() { + return callNum; + } + + public PayTransactionExtensionDO setCallNum(Integer callNum) { + this.callNum = callNum; + return this; + } + + public String getExtensionData() { + return extensionData; + } + + public PayTransactionExtensionDO setExtensionData(String extensionData) { + this.extensionData = extensionData; + return this; + } + + public String getCreateIp() { + return createIp; + } + + public PayTransactionExtensionDO setCreateIp(String createIp) { + this.createIp = createIp; + return this; + } + +} \ No newline at end of file