From e6e00e19bc4288d6c64c7ef595967c26bb0ddd22 Mon Sep 17 00:00:00 2001 From: hupeng Date: Fri, 17 Aug 2018 13:09:32 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=94=AF=E4=BB=98][=E6=96=B0=E5=A2=9E]:?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E8=B4=A6=E6=9C=8D=E5=8A=A1,?= =?UTF-8?q?=E6=9C=AA=E5=AE=8C,=E5=BE=85=E6=B7=BB=E5=8A=A0=E5=88=86?= =?UTF-8?q?=E8=B4=A6=E6=8E=A5=E5=8F=97=E8=80=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/simple/common/ErrorCode.java | 4 + .../domain/po/WxProfitSharingOrder.java | 222 ++++++++++++++++++ .../domain/po/WxProfitSharingReceiver.java | 202 ++++++++++++++++ .../domain/po/WxProfitSharingResult.java | 182 ++++++++++++++ .../java/com/simple/enums/EnumPayDomain.java | 35 +++ .../simple/enums/EnumProfitSharingStatus.java | 40 ++++ .../mapper/WxProfitSharingOrderMapper.java | 17 ++ .../mapper/WxProfitSharingReceiverMapper.java | 17 ++ .../mapper/WxProfitSharingResultMapper.java | 17 ++ .../java/com/simple/pay/WxProfitSharing.java | 48 ++++ .../java/com/simple/pay/WxProfitSharingP.java | 89 +++++++ .../service/WxProfitSharingOrderService.java | 53 +++++ .../WxProfitSharingReceiverService.java | 48 ++++ .../service/WxProfitSharingResultService.java | 48 ++++ .../impl/WxProfitSharingOrderServiceImpl.java | 168 +++++++++++++ .../WxProfitSharingReceiverServiceImpl.java | 54 +++++ .../WxProfitSharingResultServiceImpl.java | 54 +++++ .../mapper/WxProfitSharingOrderMapper.xml | 110 +++++++++ .../mapper/WxProfitSharingReceiverMapper.xml | 98 ++++++++ .../mapper/WxProfitSharingResultMapper.xml | 86 +++++++ 20 files changed, 1592 insertions(+) create mode 100644 mallinkService/src/main/java/com/simple/domain/po/WxProfitSharingOrder.java create mode 100644 mallinkService/src/main/java/com/simple/domain/po/WxProfitSharingReceiver.java create mode 100644 mallinkService/src/main/java/com/simple/domain/po/WxProfitSharingResult.java create mode 100644 mallinkService/src/main/java/com/simple/enums/EnumPayDomain.java create mode 100644 mallinkService/src/main/java/com/simple/enums/EnumProfitSharingStatus.java create mode 100644 mallinkService/src/main/java/com/simple/mapper/WxProfitSharingOrderMapper.java create mode 100644 mallinkService/src/main/java/com/simple/mapper/WxProfitSharingReceiverMapper.java create mode 100644 mallinkService/src/main/java/com/simple/mapper/WxProfitSharingResultMapper.java create mode 100644 mallinkService/src/main/java/com/simple/pay/WxProfitSharing.java create mode 100644 mallinkService/src/main/java/com/simple/pay/WxProfitSharingP.java create mode 100644 mallinkService/src/main/java/com/simple/service/WxProfitSharingOrderService.java create mode 100644 mallinkService/src/main/java/com/simple/service/WxProfitSharingReceiverService.java create mode 100644 mallinkService/src/main/java/com/simple/service/WxProfitSharingResultService.java create mode 100644 mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingOrderServiceImpl.java create mode 100644 mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingReceiverServiceImpl.java create mode 100644 mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingResultServiceImpl.java create mode 100644 mallinkService/src/main/resources/mapper/WxProfitSharingOrderMapper.xml create mode 100644 mallinkService/src/main/resources/mapper/WxProfitSharingReceiverMapper.xml create mode 100644 mallinkService/src/main/resources/mapper/WxProfitSharingResultMapper.xml diff --git a/mallinkService/src/main/java/com/simple/common/ErrorCode.java b/mallinkService/src/main/java/com/simple/common/ErrorCode.java index fef937081..e00c3bee2 100644 --- a/mallinkService/src/main/java/com/simple/common/ErrorCode.java +++ b/mallinkService/src/main/java/com/simple/common/ErrorCode.java @@ -114,6 +114,10 @@ public enum ErrorCode{ API_KEY_NOT_FOUND(12023, "支付密钥未配置"), CERT_PATH_NOT_FOUND(12024, "双向证书未配置"), + PROFIT_SHARING_REQUEST_FAILED(12030, "分账请求失败"), + PROFIT_SHARING_APPLY_FAILED(12031, "分账请求业务失败"), + PROFIT_SHARING_RETURN_INVALID(12022, "分账请求返回校验失败"), + /** * 核销 */ diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxProfitSharingOrder.java b/mallinkService/src/main/java/com/simple/domain/po/WxProfitSharingOrder.java new file mode 100644 index 000000000..f25c11f52 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/domain/po/WxProfitSharingOrder.java @@ -0,0 +1,222 @@ +package com.simple.domain.po; + +import javax.persistence.*; +import java.util.*; +import java.math.*; +import javax.persistence.Transient; +import java.util.List; +import javax.persistence.Id; +import java.io.Serializable; + +@Table(name = "wx_profit_sharing_order") +public class WxProfitSharingOrder implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + protected Long id; + + @Transient + protected List ids; + @Transient + protected String sortColumns; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSortColumns() { + return sortColumns; + } + + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } + + + + /*接收方(商场租户id)**/ + @io.swagger.annotations.ApiModelProperty(value="接收方(商场租户id)",name="tenantId") + private String tenantId; + /*商户ID**/ + @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") + private String merchantId; + /*订单ID**/ + @io.swagger.annotations.ApiModelProperty(value="订单ID",name="orderId") + private String orderId; + /*分账总金额(分)**/ + @io.swagger.annotations.ApiModelProperty(value="分账总金额(分)",name="payAmount") + private Integer payAmount; + /*分账结束时间(秒)**/ + @io.swagger.annotations.ApiModelProperty(value="分账结束时间(秒)",name="payTimeEnd") + private Date payTimeEnd; + /*分账发起时间(秒)**/ + @io.swagger.annotations.ApiModelProperty(value="分账发起时间(秒)",name="payTimeStart") + private Date payTimeStart; + /*微信生成的支付单号**/ + @io.swagger.annotations.ApiModelProperty(value="微信生成的支付单号",name="transactionId") + private String transactionId; + /*微信生成分账单号**/ + @io.swagger.annotations.ApiModelProperty(value="微信生成分账单号",name="sharingOrderId") + private String sharingOrderId; + /*分账申请失败原因**/ + @io.swagger.annotations.ApiModelProperty(value="分账申请失败原因",name="errorMsg") + private String errorMsg; + /*分账状态:1=提交订单失败, 2=提交业务失败,3=受理成功,4=处理中,5=处理完成,6=处理失败, 已关单,(1-2)为API返回,2具体信息在error_des中,(2-6)为查询返回**/ + @io.swagger.annotations.ApiModelProperty(value="分账状态:1=提交订单失败, 2=提交业务失败,3=受理成功,4=处理中,5=处理完成,6=处理失败, 已关单,(1-2)为API返回,2具体信息在error_des中,(2-6)为查询返回",name="sharingStatus") + private Integer sharingStatus; + /*更新时间**/ + @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime") + private Date updateTime; + /*创建时间**/ + @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") + private Date createTime; + public String getTenantId() { + return tenantId; + } + public void setTenantId(String _tenantId) { + tenantId = _tenantId; + } + public String getMerchantId() { + return merchantId; + } + public void setMerchantId(String _merchantId) { + merchantId = _merchantId; + } + public String getOrderId() { + return orderId; + } + public void setOrderId(String _orderId) { + orderId = _orderId; + } + public Integer getPayAmount() { + return payAmount; + } + public void setPayAmount(Integer _payAmount) { + payAmount = _payAmount; + } + public Date getPayTimeEnd() { + return payTimeEnd; + } + public void setPayTimeEnd(Date _payTimeEnd) { + payTimeEnd = _payTimeEnd; + } + public Date getPayTimeStart() { + return payTimeStart; + } + public void setPayTimeStart(Date _payTimeStart) { + payTimeStart = _payTimeStart; + } + public String getTransactionId() { + return transactionId; + } + public void setTransactionId(String _transactionId) { + transactionId = _transactionId; + } + public String getSharingOrderId() { + return sharingOrderId; + } + public void setSharingOrderId(String _sharingOrderId) { + sharingOrderId = _sharingOrderId; + } + public String getErrorMsg() { + return errorMsg; + } + public void setErrorMsg(String _errorMsg) { + errorMsg = _errorMsg; + } + public Integer getSharingStatus() { + return sharingStatus; + } + public void setSharingStatus(Integer _sharingStatus) { + sharingStatus = _sharingStatus; + } + public Date getUpdateTime() { + return updateTime; + } + public void setUpdateTime(Date _updateTime) { + updateTime = _updateTime; + } + public Date getCreateTime() { + return createTime; + } + public void setCreateTime(Date _createTime) { + createTime = _createTime; + } + + + + public static enum Field + { + Id_ASC("`id` ASC"),Id_DESC("`id` DESC") + ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") + ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") + ,OrderId_ASC("`orderId` ASC"),OrderId_DESC("`orderId` DESC") + ,PayAmount_ASC("`payAmount` ASC"),PayAmount_DESC("`payAmount` DESC") + ,PayTimeEnd_ASC("`payTimeEnd` ASC"),PayTimeEnd_DESC("`payTimeEnd` DESC") + ,PayTimeStart_ASC("`payTimeStart` ASC"),PayTimeStart_DESC("`payTimeStart` DESC") + ,TransactionId_ASC("`transactionId` ASC"),TransactionId_DESC("`transactionId` DESC") + ,SharingOrderId_ASC("`sharingOrderId` ASC"),SharingOrderId_DESC("`sharingOrderId` DESC") + ,ErrorMsg_ASC("`errorMsg` ASC"),ErrorMsg_DESC("`errorMsg` DESC") + ,SharingStatus_ASC("`sharingStatus` ASC"),SharingStatus_DESC("`sharingStatus` DESC") + ,UpdateTime_ASC("`updateTime` ASC"),UpdateTime_DESC("`updateTime` DESC") + ,CreateTime_ASC("`createTime` ASC"),CreateTime_DESC("`createTime` DESC") + ; + private String value; + Field(String value){ + this.value = value; + } + public String getValue() { + return value; + } + public void setCol(String value) { + this.value = value; + } + @Override + public String toString() { + return this.getValue(); + } + } + + public void setSortColumns(WxProfitSharingOrder.Field... fields) + { + if (fields == null || fields.length == 0) { + return; + } + for (int k = 0; k < fields.length; k++) { + if (fields[k] == null) { + return; + } + } + StringBuilder sb = new StringBuilder(fields[0].toString()); + for (int k = 1; k < fields.length; k++) { + sb.append(","); + sb.append(fields[k].toString()); + } + + } + + public void setSortColumns(String sortColumns) + { + if (sortColumns == null || "".equals(sortColumns.trim())) { + return; + } + if (sortColumns.contains(",")) { + String[] cols = sortColumns.split(","); + java.util.List fList = new java.util.ArrayList(); + for (int k = 0; k < cols.length; k++) { + fList.add(Field.valueOf(cols[k])); + } + this.setSortColumns(fList.toArray(new Field[fList.size()])); + } else { + this.setSortColumns(Field.valueOf(sortColumns)); + } + } +} diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxProfitSharingReceiver.java b/mallinkService/src/main/java/com/simple/domain/po/WxProfitSharingReceiver.java new file mode 100644 index 000000000..57f8e7f64 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/domain/po/WxProfitSharingReceiver.java @@ -0,0 +1,202 @@ +package com.simple.domain.po; + +import javax.persistence.*; +import java.util.*; +import java.math.*; +import javax.persistence.Transient; +import java.util.List; +import javax.persistence.Id; +import java.io.Serializable; + +@Table(name = "wx_profit_sharing_receiver") +public class WxProfitSharingReceiver implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + protected Long id; + + @Transient + protected List ids; + @Transient + protected String sortColumns; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSortColumns() { + return sortColumns; + } + + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } + + + + /*商户ID**/ + @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") + private String merchantId; + /*分账接收方类型,1 = MERCHANT_ID(商户 ID) 2 = PERSONAL_WECHATID(个人微信号) 3 = PERSONAL_OPENID(个人openid(由父商 户 APPID 转换得到) 4 = PERSONAL_SUB_OPENID(个人 sub_openid(由子商户 APPID 转换得到))**/ + @io.swagger.annotations.ApiModelProperty(value="分账接收方类型,1 = MERCHANT_ID(商户 ID) 2 = PERSONAL_WECHATID(个人微信号) 3 = PERSONAL_OPENID(个人openid(由父商 户 APPID 转换得到) 4 = PERSONAL_SUB_OPENID(个人 sub_openid(由子商户 APPID 转换得到))",name="receiverType") + private Integer receiverType; + /*分账接收方账号,见接收方类型**/ + @io.swagger.annotations.ApiModelProperty(value="分账接收方账号,见接收方类型",name="receiverAccount") + private String receiverAccount; + /*分款接受方说明**/ + @io.swagger.annotations.ApiModelProperty(value="分款接受方说明",name="receiverComments") + private String receiverComments; + /***/ + @io.swagger.annotations.ApiModelProperty(value="",name="createTime") + private Date createTime; + /***/ + @io.swagger.annotations.ApiModelProperty(value="",name="updateTime") + private Date updateTime; + /*分账类型:1-服务商户分账,2-商户转入银行卡**/ + @io.swagger.annotations.ApiModelProperty(value="分账类型:1-服务商户分账,2-商户转入银行卡",name="sharingType") + private Integer sharingType; + /***/ + @io.swagger.annotations.ApiModelProperty(value="",name="bankNo") + private String bankNo; + /***/ + @io.swagger.annotations.ApiModelProperty(value="",name="trueName") + private String trueName; + /***/ + @io.swagger.annotations.ApiModelProperty(value="",name="bankCode") + private String bankCode; + public String getMerchantId() { + return merchantId; + } + public void setMerchantId(String _merchantId) { + merchantId = _merchantId; + } + public Integer getReceiverType() { + return receiverType; + } + public void setReceiverType(Integer _receiverType) { + receiverType = _receiverType; + } + public String getReceiverAccount() { + return receiverAccount; + } + public void setReceiverAccount(String _receiverAccount) { + receiverAccount = _receiverAccount; + } + public String getReceiverComments() { + return receiverComments; + } + public void setReceiverComments(String _receiverComments) { + receiverComments = _receiverComments; + } + public Date getCreateTime() { + return createTime; + } + public void setCreateTime(Date _createTime) { + createTime = _createTime; + } + public Date getUpdateTime() { + return updateTime; + } + public void setUpdateTime(Date _updateTime) { + updateTime = _updateTime; + } + public Integer getSharingType() { + return sharingType; + } + public void setSharingType(Integer _sharingType) { + sharingType = _sharingType; + } + public String getBankNo() { + return bankNo; + } + public void setBankNo(String _bankNo) { + bankNo = _bankNo; + } + public String getTrueName() { + return trueName; + } + public void setTrueName(String _trueName) { + trueName = _trueName; + } + public String getBankCode() { + return bankCode; + } + public void setBankCode(String _bankCode) { + bankCode = _bankCode; + } + + + + public static enum Field + { + Id_ASC("`id` ASC"),Id_DESC("`id` DESC") + ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") + ,ReceiverType_ASC("`receiverType` ASC"),ReceiverType_DESC("`receiverType` DESC") + ,ReceiverAccount_ASC("`receiverAccount` ASC"),ReceiverAccount_DESC("`receiverAccount` DESC") + ,ReceiverComments_ASC("`receiverComments` ASC"),ReceiverComments_DESC("`receiverComments` DESC") + ,CreateTime_ASC("`createTime` ASC"),CreateTime_DESC("`createTime` DESC") + ,UpdateTime_ASC("`updateTime` ASC"),UpdateTime_DESC("`updateTime` DESC") + ,SharingType_ASC("`sharingType` ASC"),SharingType_DESC("`sharingType` DESC") + ,BankNo_ASC("`bankNo` ASC"),BankNo_DESC("`bankNo` DESC") + ,TrueName_ASC("`trueName` ASC"),TrueName_DESC("`trueName` DESC") + ,BankCode_ASC("`bankCode` ASC"),BankCode_DESC("`bankCode` DESC") + ; + private String value; + Field(String value){ + this.value = value; + } + public String getValue() { + return value; + } + public void setCol(String value) { + this.value = value; + } + @Override + public String toString() { + return this.getValue(); + } + } + + public void setSortColumns(WxProfitSharingReceiver.Field... fields) + { + if (fields == null || fields.length == 0) { + return; + } + for (int k = 0; k < fields.length; k++) { + if (fields[k] == null) { + return; + } + } + StringBuilder sb = new StringBuilder(fields[0].toString()); + for (int k = 1; k < fields.length; k++) { + sb.append(","); + sb.append(fields[k].toString()); + } + + } + + public void setSortColumns(String sortColumns) + { + if (sortColumns == null || "".equals(sortColumns.trim())) { + return; + } + if (sortColumns.contains(",")) { + String[] cols = sortColumns.split(","); + java.util.List fList = new java.util.ArrayList(); + for (int k = 0; k < cols.length; k++) { + fList.add(Field.valueOf(cols[k])); + } + this.setSortColumns(fList.toArray(new Field[fList.size()])); + } else { + this.setSortColumns(Field.valueOf(sortColumns)); + } + } +} diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxProfitSharingResult.java b/mallinkService/src/main/java/com/simple/domain/po/WxProfitSharingResult.java new file mode 100644 index 000000000..23b40c987 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/domain/po/WxProfitSharingResult.java @@ -0,0 +1,182 @@ +package com.simple.domain.po; + +import javax.persistence.*; +import java.util.*; +import java.math.*; +import javax.persistence.Transient; +import java.util.List; +import javax.persistence.Id; +import java.io.Serializable; + +@Table(name = "wx_profit_sharing_result") +public class WxProfitSharingResult implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + protected Long id; + + @Transient + protected List ids; + @Transient + protected String sortColumns; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSortColumns() { + return sortColumns; + } + + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } + + + + /*分账订单号**/ + @io.swagger.annotations.ApiModelProperty(value="分账订单号",name="sharingOrderId") + private String sharingOrderId; + /*分账接收方id**/ + @io.swagger.annotations.ApiModelProperty(value="分账接收方id",name="sharingReceiverId") + private String sharingReceiverId; + /*分账金额(分)**/ + @io.swagger.annotations.ApiModelProperty(value="分账金额(分)",name="payAmount") + private Integer payAmount; + /*更新时间**/ + @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime") + private Date updateTime; + /*创建时间**/ + @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") + private Date createTime; + /*分账结果状态:1-PENDING:待分账 2-SUCCESS:分账成功 3-ADJUST:分账失败待调账 4-RETURNED:已转回分账方 5-CLOSED: 已关闭 **/ + @io.swagger.annotations.ApiModelProperty(value="分账结果状态:1-PENDING:待分账 2-SUCCESS:分账成功 3-ADJUST:分账失败待调账 4-RETURNED:已转回分账方 5-CLOSED: 已关闭 ",name="sharingStatus") + private Integer sharingStatus; + /*微信返回的分账完成时间**/ + @io.swagger.annotations.ApiModelProperty(value="微信返回的分账完成时间",name="finishTime") + private String finishTime; + /*微信返回的失败原因**/ + @io.swagger.annotations.ApiModelProperty(value="微信返回的失败原因",name="failedReason") + private String failedReason; + public String getSharingOrderId() { + return sharingOrderId; + } + public void setSharingOrderId(String _sharingOrderId) { + sharingOrderId = _sharingOrderId; + } + public String getSharingReceiverId() { + return sharingReceiverId; + } + public void setSharingReceiverId(String _sharingReceiverId) { + sharingReceiverId = _sharingReceiverId; + } + public Integer getPayAmount() { + return payAmount; + } + public void setPayAmount(Integer _payAmount) { + payAmount = _payAmount; + } + public Date getUpdateTime() { + return updateTime; + } + public void setUpdateTime(Date _updateTime) { + updateTime = _updateTime; + } + public Date getCreateTime() { + return createTime; + } + public void setCreateTime(Date _createTime) { + createTime = _createTime; + } + public Integer getSharingStatus() { + return sharingStatus; + } + public void setSharingStatus(Integer _sharingStatus) { + sharingStatus = _sharingStatus; + } + public String getFinishTime() { + return finishTime; + } + public void setFinishTime(String _finishTime) { + finishTime = _finishTime; + } + public String getFailedReason() { + return failedReason; + } + public void setFailedReason(String _failedReason) { + failedReason = _failedReason; + } + + + + public static enum Field + { + Id_ASC("`id` ASC"),Id_DESC("`id` DESC") + ,SharingOrderId_ASC("`sharingOrderId` ASC"),SharingOrderId_DESC("`sharingOrderId` DESC") + ,SharingReceiverId_ASC("`sharingReceiverId` ASC"),SharingReceiverId_DESC("`sharingReceiverId` DESC") + ,PayAmount_ASC("`payAmount` ASC"),PayAmount_DESC("`payAmount` DESC") + ,UpdateTime_ASC("`updateTime` ASC"),UpdateTime_DESC("`updateTime` DESC") + ,CreateTime_ASC("`createTime` ASC"),CreateTime_DESC("`createTime` DESC") + ,SharingStatus_ASC("`sharingStatus` ASC"),SharingStatus_DESC("`sharingStatus` DESC") + ,FinishTime_ASC("`finishTime` ASC"),FinishTime_DESC("`finishTime` DESC") + ,FailedReason_ASC("`failedReason` ASC"),FailedReason_DESC("`failedReason` DESC") + ; + private String value; + Field(String value){ + this.value = value; + } + public String getValue() { + return value; + } + public void setCol(String value) { + this.value = value; + } + @Override + public String toString() { + return this.getValue(); + } + } + + public void setSortColumns(WxProfitSharingResult.Field... fields) + { + if (fields == null || fields.length == 0) { + return; + } + for (int k = 0; k < fields.length; k++) { + if (fields[k] == null) { + return; + } + } + StringBuilder sb = new StringBuilder(fields[0].toString()); + for (int k = 1; k < fields.length; k++) { + sb.append(","); + sb.append(fields[k].toString()); + } + + } + + public void setSortColumns(String sortColumns) + { + if (sortColumns == null || "".equals(sortColumns.trim())) { + return; + } + if (sortColumns.contains(",")) { + String[] cols = sortColumns.split(","); + java.util.List fList = new java.util.ArrayList(); + for (int k = 0; k < cols.length; k++) { + fList.add(Field.valueOf(cols[k])); + } + this.setSortColumns(fList.toArray(new Field[fList.size()])); + } else { + this.setSortColumns(Field.valueOf(sortColumns)); + } + } +} diff --git a/mallinkService/src/main/java/com/simple/enums/EnumPayDomain.java b/mallinkService/src/main/java/com/simple/enums/EnumPayDomain.java new file mode 100644 index 000000000..a8bbe060b --- /dev/null +++ b/mallinkService/src/main/java/com/simple/enums/EnumPayDomain.java @@ -0,0 +1,35 @@ +package com.simple.enums; + +/** + * Created by Stormeye on 2018/08/09. + */ +public enum EnumPayDomain { + + PAY_DOMAIN_MASTER_ACCOUNT_ID(8, ""), + PAY_DOMAIN_MASTER_APPINFO_ID(8, ""); + + public static EnumPayDomain getEnum(Integer code) { + for (EnumPayDomain value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumPayDomain(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/simple/enums/EnumProfitSharingStatus.java b/mallinkService/src/main/java/com/simple/enums/EnumProfitSharingStatus.java new file mode 100644 index 000000000..39f40f88e --- /dev/null +++ b/mallinkService/src/main/java/com/simple/enums/EnumProfitSharingStatus.java @@ -0,0 +1,40 @@ +package com.simple.enums; + +/** + * Created by Stormeye on 2018/08/09. + */ +public enum EnumProfitSharingStatus { + PROFIT_SHARING_UNKNOWN(-1, "未知"), + PROFIT_SHARING_REQ_FAILED(1, "提交订单失败"), + PROFIT_SHARING_APPLY_FAILED(2, "提交业务失败"), + PROFIT_SHARING_ACCEPTED(3, "受理成功"), + PROFIT_SHARING_PROCESSING(4, "处理中"), + PROFIT_SHARING_DONE(5, "处理完成"), + PROFIT_SHARING_FAILED(6, "处理失败"), + ; + + public static EnumProfitSharingStatus getEnum(Integer code) { + for (EnumProfitSharingStatus value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + private Integer code; + private String message; + + EnumProfitSharingStatus(Integer code, String message) { + this.code = code; + this.message = message; + } + + public Integer getCode() { + return code; + } + + public String getMessage() { + return message; + } +} diff --git a/mallinkService/src/main/java/com/simple/mapper/WxProfitSharingOrderMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxProfitSharingOrderMapper.java new file mode 100644 index 000000000..924bf871a --- /dev/null +++ b/mallinkService/src/main/java/com/simple/mapper/WxProfitSharingOrderMapper.java @@ -0,0 +1,17 @@ +package com.simple.mapper; + +import java.util.*; +import com.simple.common.CommonMapper; +import org.apache.ibatis.annotations.Param; +import com.simple.domain.po.WxProfitSharingOrder; + +public interface WxProfitSharingOrderMapper extends CommonMapper { + + List findList(WxProfitSharingOrder wxProfitSharingOrder); + + + + + + +} diff --git a/mallinkService/src/main/java/com/simple/mapper/WxProfitSharingReceiverMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxProfitSharingReceiverMapper.java new file mode 100644 index 000000000..ecfc3c5b3 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/mapper/WxProfitSharingReceiverMapper.java @@ -0,0 +1,17 @@ +package com.simple.mapper; + +import java.util.*; +import com.simple.common.CommonMapper; +import org.apache.ibatis.annotations.Param; +import com.simple.domain.po.WxProfitSharingReceiver; + +public interface WxProfitSharingReceiverMapper extends CommonMapper { + + List findList(WxProfitSharingReceiver wxProfitSharingReceiver); + + + + + + +} diff --git a/mallinkService/src/main/java/com/simple/mapper/WxProfitSharingResultMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxProfitSharingResultMapper.java new file mode 100644 index 000000000..7ee92d407 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/mapper/WxProfitSharingResultMapper.java @@ -0,0 +1,17 @@ +package com.simple.mapper; + +import java.util.*; +import com.simple.common.CommonMapper; +import org.apache.ibatis.annotations.Param; +import com.simple.domain.po.WxProfitSharingResult; + +public interface WxProfitSharingResultMapper extends CommonMapper { + + List findList(WxProfitSharingResult wxProfitSharingResult); + + + + + + +} diff --git a/mallinkService/src/main/java/com/simple/pay/WxProfitSharing.java b/mallinkService/src/main/java/com/simple/pay/WxProfitSharing.java new file mode 100644 index 000000000..348761f4f --- /dev/null +++ b/mallinkService/src/main/java/com/simple/pay/WxProfitSharing.java @@ -0,0 +1,48 @@ +package com.simple.pay; + +import java.util.HashMap; +import java.util.Map; + +import com.simple.utils.HttpUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class WxProfitSharing { + protected static Logger log = LoggerFactory.getLogger(WxProfitSharing.class); + + // 分账接口 + private static final String PROFIT_SHARING_URL = "https://api.mch.weixin.qq.com/secapi/pay/profitsharing "; + // 查询接口 + private static final String PROFIT_SHARING_QUERY_URL = "https://api.mch.weixin.qq.com/pay/profitsharingquery"; + // 添加分账账户 + private static final String RPOFIT_SHARING_ADD_RECEIVER_URL = "https://api.mch.weixin.qq.com/pay/profitsharingaddreceiver"; + // 删除分账账户 + private static final String RPOFIT_SHARING_REMOVE_RECEIVER_URL = "https://api.mch.weixin.qq.com/pay/profitsharingremovereceiver"; + + + private WxProfitSharing() { + } + + /** + * 分账下单 + * @param params + * @return + */ + public static String pushOrder(Map params) { + return doPost(PROFIT_SHARING_URL, params); + } + + /** + * 分账查询 + * @param params 请求参数 + * @return + */ + public static String queryOrder(Map params) { + return doPost(PROFIT_SHARING_URL, params); + } + + + public static String doPost(String url, Map params) { + return HttpUtil.payPost(url, WxPayment.toXml(params)); + } +} diff --git a/mallinkService/src/main/java/com/simple/pay/WxProfitSharingP.java b/mallinkService/src/main/java/com/simple/pay/WxProfitSharingP.java new file mode 100644 index 000000000..25b53909f --- /dev/null +++ b/mallinkService/src/main/java/com/simple/pay/WxProfitSharingP.java @@ -0,0 +1,89 @@ +package com.simple.pay; + +import java.io.Serializable; + +/** + * Created by Peng on 2018/8/10. + */ +public class WxProfitSharingP implements Serializable { + private static final long serialVersionUID = 1L; + + private String mch_id; // 商户号 + private String sub_mch_id; // 子商户号 + private String appid; // 公众账号ID + private String sub_appid; // 子公众账号ID + private String nonce_str; // 随机字符串 + private String sign; // 签名 + private String transaction_id ; // 支付订单号 + private String out_trade_no; // 商户订单号 + private String receivers; // 分账接收方 + + public String getMch_id() { + return mch_id; + } + + public void setMch_id(String mch_id) { + this.mch_id = mch_id; + } + + public String getSub_mch_id() { return sub_mch_id; } + + public void setSub_mch_id(String sub_mch_id) { + this.sub_mch_id = sub_mch_id; + } + + public String getAppid() { + return appid; + } + + public void setAppid(String appid) { + this.appid = appid; + } + + public String getSub_appid() { + return sub_appid; + } + + public void setSub_appid(String sub_appid) { + this.sub_appid = sub_appid; + } + + public String getNonce_str() { + return nonce_str; + } + + public void setNonce_str(String nonce_str) { + this.nonce_str = nonce_str; + } + + public String getSign() { + return sign; + } + + public void setSign(String sign) { + this.sign = sign; + } + + public String getTransaction_id() { + return transaction_id; + } + + public void setTransaction_id(String transaction_id) { + this.transaction_id = transaction_id; + } + + public String getOut_trade_no() { return out_trade_no; } + + public void setOut_trade_no(String out_trade_no) { + this.out_trade_no = out_trade_no; + } + + public String setReceivers() { + return receivers; + } + + public void getReceivers(String receivers) { + this.receivers = receivers; + } + +} diff --git a/mallinkService/src/main/java/com/simple/service/WxProfitSharingOrderService.java b/mallinkService/src/main/java/com/simple/service/WxProfitSharingOrderService.java new file mode 100644 index 000000000..776bf4e3a --- /dev/null +++ b/mallinkService/src/main/java/com/simple/service/WxProfitSharingOrderService.java @@ -0,0 +1,53 @@ +package com.simple.service; + +import java.util.*; +import com.github.pagehelper.PageInfo; +import com.simple.common.ResultData; +import com.simple.domain.po.WxAppinfo; +import com.simple.domain.po.WxOrder; +import com.simple.domain.po.WxProfitSharingOrder; + +public interface WxProfitSharingOrderService { + + /** + * 根据实体查询分页列表 + * + * @param record + * @param offset + * @param limit + * @return + */ + PageInfo listAsPage(WxProfitSharingOrder record, Integer pageIndex, Integer pageSize); + + /** + * 根据Id获得实体 + * + * @param id + * @return + */ + WxProfitSharingOrder getById(Long id); + + /** + * 保存或更新实体 + * + * @param record + */ + void saveOrUpdate(WxProfitSharingOrder record); + + /** + * 根据Id删除实体 + * + * @param id + */ + void deleteById(Long id); + + + /** + * 创建分账订单 + */ + public ResultData createSharingOrder(WxAppinfo appInfo, WxOrder wxOrder); + + + + +} diff --git a/mallinkService/src/main/java/com/simple/service/WxProfitSharingReceiverService.java b/mallinkService/src/main/java/com/simple/service/WxProfitSharingReceiverService.java new file mode 100644 index 000000000..49ec0d3ed --- /dev/null +++ b/mallinkService/src/main/java/com/simple/service/WxProfitSharingReceiverService.java @@ -0,0 +1,48 @@ +package com.simple.service; + +import java.util.*; +import com.github.pagehelper.PageInfo; +import com.simple.domain.po.WxProfitSharingReceiver; + +public interface WxProfitSharingReceiverService { + + /** + * 根据实体查询分页列表 + * + * @param record + * @param offset + * @param limit + * @return + */ + PageInfo listAsPage(WxProfitSharingReceiver record, Integer pageIndex, Integer pageSize); + + /** + * 根据Id获得实体 + * + * @param id + * @return + */ + WxProfitSharingReceiver getById(Long id); + + /** + * 保存或更新实体 + * + * @param record + */ + void saveOrUpdate(WxProfitSharingReceiver record); + + /** + * 根据Id删除实体 + * + * @param id + */ + void deleteById(Long id); + + + + + + + + +} diff --git a/mallinkService/src/main/java/com/simple/service/WxProfitSharingResultService.java b/mallinkService/src/main/java/com/simple/service/WxProfitSharingResultService.java new file mode 100644 index 000000000..808391d69 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/service/WxProfitSharingResultService.java @@ -0,0 +1,48 @@ +package com.simple.service; + +import java.util.*; +import com.github.pagehelper.PageInfo; +import com.simple.domain.po.WxProfitSharingResult; + +public interface WxProfitSharingResultService { + + /** + * 根据实体查询分页列表 + * + * @param record + * @param offset + * @param limit + * @return + */ + PageInfo listAsPage(WxProfitSharingResult record, Integer pageIndex, Integer pageSize); + + /** + * 根据Id获得实体 + * + * @param id + * @return + */ + WxProfitSharingResult getById(Long id); + + /** + * 保存或更新实体 + * + * @param record + */ + void saveOrUpdate(WxProfitSharingResult record); + + /** + * 根据Id删除实体 + * + * @param id + */ + void deleteById(Long id); + + + + + + + + +} diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingOrderServiceImpl.java new file mode 100644 index 000000000..a7554af99 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingOrderServiceImpl.java @@ -0,0 +1,168 @@ +package com.simple.service.impl; + +import java.util.*; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.simple.common.ErrorCode; +import com.simple.common.ResultData; +import com.simple.domain.po.WxAppinfo; +import com.simple.domain.po.WxOrder; +import com.simple.domain.po.WxPayAccount; +import com.simple.domain.po.WxProfitSharingOrder; +import com.simple.enums.EnumPayDomain; +import com.simple.enums.EnumProfitSharingStatus; +import com.simple.exception.MallinkException; +import com.simple.mapper.WxAppinfoMapper; +import com.simple.mapper.WxPayAccountMapper; +import com.simple.mapper.WxProfitSharingOrderMapper; +import com.simple.pay.WxPayment; +import com.simple.pay.WxProfitSharing; +import com.simple.pay.WxProfitSharingP; +import com.simple.service.WxProfitSharingOrderService; +import com.simple.utils.BeanUtils; +import com.simple.utils.Utility; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.simple.common.IdWorker; + + + +@Service +public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderService { + + @Autowired + WxProfitSharingOrderMapper wxProfitSharingOrderMapper; + + @Autowired + WxAppinfoMapper wxAppinfoMapper; + + @Autowired + WxPayAccountMapper wxPayAccountMapper; + + @Autowired + WxProfitSharingOrderMapper wxOrderMapper; + + + JSONObject errorMap = JSON.parseObject( + "{\"SYSTEMERROR\":{\"detail\":\"接口返回错误\",\"reason\":\"系统超时\",\"resolution\":\"系统异常,请用相同参数重新调用\"}," + + "\"AMOUNT_OVERDUE\":{\"detail\":\"分账金额超限\",\"reason\":\"分账金额大于可分金额 或大于分账最大比例 \",\"resolution\":\"请调整分账金额\"}," + + "\"RECEIVER_INVALID\":{\"detail\":\"分账接收方非法 \",\"reason\":\"未配置分账接收方\",\"resolution\":\"分账接收方在分账之前需要进行添加\"}," + + "\"INVALID_TRANSACTIONID\":{\"detail\":\"无效的微信支付订单号\",\"reason\":\"请求参数未按指引进行填写\",\"resolution\":\"检查原交易单号是否存在\"}," + + "\"PARAM_ERROR\":{\"detail\":\"参数错误\t\",\"reason\":\"请求参数未按指引进行填写\",\"resolution\":\"请求参数错误,请重新检查再调用分账接口\"}," + + "\"INVALID_REQUEST\":{\"detail\":\"请求不合法\",\"reason\":\"参数中APPID或MCHID不存在等 \",\"resolution\":\"请重新检查再调用分账接口\"}," + + "\"OPENID_MISMATCH\":{\"detail\":\"Openid错误\",\"reason\":\"Openid与Appid不匹配\",\"resolution\":\"请检查openid是否正确\"}," + + "\"FREQUENCY_LIMITED\":{\"detail\":\"频率限制\",\"reason\":\"请求过多被频率限制\",\"resolution\":\"该被请求未受理,请降低频率后原单重试,请勿更换商户分账单号\"}," + + "\"ORDER_NOT_READY\":{\"detail\":\"订单处理中\",\"reason\":\"订单处理中暂时无法分账\",\"resolution\":\"订单处理中暂时无法分账,请稍后再试\"}," + + "\"NOAUTH \":{\"detail\":\"无分账权限\",\"reason\":\"未开通分账权限\",\"resolution\":\"请先开通分账权限\"}," + + "\"NOT_SHARE_ORDER\":{\"detail\":\"非分账订单\t\",\"reason\":\"不是分账订单,无法分账\",\"resolution\":\"下单时请用合适的参数\"}}"); + + @Override + public PageInfo listAsPage(WxProfitSharingOrder record, Integer pageIndex, Integer pageSize) { + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxProfitSharingOrderMapper.findList(record)); + } + + @Override + public WxProfitSharingOrder getById(Long id) { + return wxProfitSharingOrderMapper.selectByPrimaryKey(id); + } + + @Override + public void saveOrUpdate(WxProfitSharingOrder record) { + if (record.getId() == null) { + //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); + final IdWorker idWorker = IdWorker.get(); + record.setId(idWorker.nextId()); + wxProfitSharingOrderMapper.insertSelective(record); + } else { + wxProfitSharingOrderMapper.updateByPrimaryKeySelective(record); + } + } + + @Override + public void deleteById(Long id) { + wxProfitSharingOrderMapper.deleteByPrimaryKey(id); + } + + @Override + public ResultData createSharingOrder(WxAppinfo subAppInfo, WxOrder wxOrder) { + final IdWorker idworker = IdWorker.get(); + WxProfitSharingOrder record = new WxProfitSharingOrder(); + try { + //是否已创建分账订单 + Date currentDate = new Date(); + record.setOrderId(wxOrder.getId().toString()); + record = wxProfitSharingOrderMapper.selectOne(record); + if (record == null) { + //创建分账订单 + record.setId(idworker.nextId()); + record.setTenantId(wxOrder.getTenantId()); + record.setOrderId(wxOrder.getId().toString()); + record.setPayAmount(wxOrder.getPayment()); + //record.setMerchantId(); + record.setCreateTime(currentDate); + record.setUpdateTime(currentDate); + record.setPayTimeStart(currentDate); + record.setPayTimeEnd(currentDate); + + if (wxProfitSharingOrderMapper.insertSelective(record) != 1) { + throw new MallinkException(ErrorCode.DB_FAIL); + } + } + + WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(subAppInfo.getPayId()); + WxPayAccount mainPayAccount = wxPayAccountMapper.selectByPrimaryKey(EnumPayDomain.PAY_DOMAIN_MASTER_ACCOUNT_ID.getCode()); + WxAppinfo mainAppInfo = wxAppinfoMapper.selectByPrimaryKey(EnumPayDomain.PAY_DOMAIN_MASTER_APPINFO_ID.getCode()); + + //分账提交 + WxProfitSharingP wxProfitSharingP = new WxProfitSharingP(); + wxProfitSharingP.setAppid(mainAppInfo.getAppId()); + wxProfitSharingP.setMch_id(mainPayAccount.getMchId()); + wxProfitSharingP.setSub_appid(subAppInfo.getAppId()); + wxProfitSharingP.setMch_id(payAccount.getMchId()); + wxProfitSharingP.setSub_mch_id(payAccount.getMchId()); + wxProfitSharingP.setNonce_str(Utility.generate32UUID()); + wxProfitSharingP.setTransaction_id(wxOrder.getTenantId()); + wxProfitSharingP.setOut_trade_no(record.getId().toString()); + + //添加分账接受方 + + + + wxProfitSharingP.setSign(WxPayment.createSign(BeanUtils.toStringMap(wxProfitSharingP), payAccount.getApiKey())); + String response = WxProfitSharing.pushOrder(BeanUtils.toStringMap(wxProfitSharingP)); + + Map returnMap = WxPayment.xmlToMap(response); + String return_code = returnMap.get("return_code"); + if (!"SUCCESS".equals(return_code)) { + record.setSharingStatus(EnumProfitSharingStatus.PROFIT_SHARING_REQ_FAILED.getCode()); + wxProfitSharingOrderMapper.updateByPrimaryKey(record); + throw new MallinkException(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(), returnMap.get("return_msg")); + } + + if (!WxPayment.verifyNotify(returnMap,payAccount.getApiKey())){ + throw new MallinkException(ErrorCode.PROFIT_SHARING_RETURN_INVALID.getCode(), ErrorCode.PROFIT_SHARING_RETURN_INVALID.getMessage()); + } + + String result_code = returnMap.get("result_code"); + if (!"SUCCESS".equals(result_code)) { + record.setSharingStatus(EnumProfitSharingStatus.PROFIT_SHARING_APPLY_FAILED.getCode()); + wxProfitSharingOrderMapper.updateByPrimaryKey(record); + throw new MallinkException(ErrorCode.PROFIT_SHARING_APPLY_FAILED.getCode(), returnMap.get("result_msg")); + } + + record.setSharingOrderId(returnMap.get("order_id")); + record.setSharingStatus(EnumProfitSharingStatus.PROFIT_SHARING_ACCEPTED.getCode()); + wxProfitSharingOrderMapper.updateByPrimaryKey(record); + + return new ResultData(200, "分账申请成功", returnMap); + + } catch (RuntimeException e) { + throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); + } catch (Exception e) { + throw new MallinkException(ErrorCode.PAY_ORDER_ERROR.getCode(), e.getMessage()); + } + } +} diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingReceiverServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingReceiverServiceImpl.java new file mode 100644 index 000000000..bc96d5222 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingReceiverServiceImpl.java @@ -0,0 +1,54 @@ +package com.simple.service.impl; + +import java.util.*; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.simple.domain.po.WxProfitSharingReceiver; +import com.simple.mapper.WxProfitSharingReceiverMapper; +import com.simple.service.WxProfitSharingReceiverService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.simple.common.IdWorker; + +@Service +public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiverService { + + @Autowired + WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; + + + @Override + public PageInfo listAsPage(WxProfitSharingReceiver record, Integer pageIndex, Integer pageSize) { + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxProfitSharingReceiverMapper.findList(record)); + } + + @Override + public WxProfitSharingReceiver getById(Long id) { + return wxProfitSharingReceiverMapper.selectByPrimaryKey(id); + } + + @Override + public void saveOrUpdate(WxProfitSharingReceiver record) { + if (record.getId() == null) { + //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); + final IdWorker idWorker = IdWorker.get(); + record.setId(idWorker.nextId()); + wxProfitSharingReceiverMapper.insertSelective(record); + } else { + wxProfitSharingReceiverMapper.updateByPrimaryKeySelective(record); + } + } + + @Override + public void deleteById(Long id) { + wxProfitSharingReceiverMapper.deleteByPrimaryKey(id); + } + + + + + + + + +} diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingResultServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingResultServiceImpl.java new file mode 100644 index 000000000..bdc71de07 --- /dev/null +++ b/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingResultServiceImpl.java @@ -0,0 +1,54 @@ +package com.simple.service.impl; + +import java.util.*; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.simple.domain.po.WxProfitSharingResult; +import com.simple.mapper.WxProfitSharingResultMapper; +import com.simple.service.WxProfitSharingResultService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.simple.common.IdWorker; + +@Service +public class WxProfitSharingResultServiceImpl implements WxProfitSharingResultService { + + @Autowired + WxProfitSharingResultMapper wxProfitSharingResultMapper; + + + @Override + public PageInfo listAsPage(WxProfitSharingResult record, Integer pageIndex, Integer pageSize) { + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxProfitSharingResultMapper.findList(record)); + } + + @Override + public WxProfitSharingResult getById(Long id) { + return wxProfitSharingResultMapper.selectByPrimaryKey(id); + } + + @Override + public void saveOrUpdate(WxProfitSharingResult record) { + if (record.getId() == null) { + //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); + final IdWorker idWorker = IdWorker.get(); + record.setId(idWorker.nextId()); + wxProfitSharingResultMapper.insertSelective(record); + } else { + wxProfitSharingResultMapper.updateByPrimaryKeySelective(record); + } + } + + @Override + public void deleteById(Long id) { + wxProfitSharingResultMapper.deleteByPrimaryKey(id); + } + + + + + + + + +} diff --git a/mallinkService/src/main/resources/mapper/WxProfitSharingOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxProfitSharingOrderMapper.xml new file mode 100644 index 000000000..832c2c2a1 --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxProfitSharingOrderMapper.xml @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + `id`,`tenant_id`,`merchant_id`,`order_id`,`pay_amount`,`pay_time_end`,`pay_time_start`,`transaction_id`,`sharing_order_id`,`error_msg`,`sharing_status`,`update_time`,`create_time` + + + + where 1 = 1 + + + and `id` = #{id} + + + + + and `tenant_id` = #{tenantId} + + + + + and `merchant_id` = #{merchantId} + + + + + and `order_id` = #{orderId} + + + + + and `pay_amount` = #{payAmount} + + + + + and `pay_time_end` = #{payTimeEnd} + + + + + and `pay_time_start` = #{payTimeStart} + + + + + and `transaction_id` like concat('%', #{transactionId},'%') + + + + + and `sharing_order_id` like concat('%', #{sharingOrderId},'%') + + + + + and `error_msg` like concat('%', #{errorMsg},'%') + + + + + and `sharing_status` like concat('%', #{sharingStatus},'%') + + + + + and `update_time` = #{updateTime} + + + + + and `create_time` = #{createTime} + + + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + + + + + diff --git a/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverMapper.xml b/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverMapper.xml new file mode 100644 index 000000000..caa6c998e --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverMapper.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + `id`,`merchant_id`,`receiver_type`,`receiver_account`,`receiver_comments`,`create_time`,`update_time`,`sharing_type`,`bank_no`,`true_name`,`bank_code` + + + + where 1 = 1 + + + and `id` = #{id} + + + + + and `merchant_id` = #{merchantId} + + + + + and `receiver_type` = #{receiverType} + + + + + and `receiver_account` like concat('%', #{receiverAccount},'%') + + + + + and `receiver_comments` like concat('%', #{receiverComments},'%') + + + + + and `create_time` = #{createTime} + + + + + and `update_time` = #{updateTime} + + + + + and `sharing_type` = #{sharingType} + + + + + and `bank_no` like concat('%', #{bankNo},'%') + + + + + and `true_name` like concat('%', #{trueName},'%') + + + + + and `bank_code` like concat('%', #{bankCode},'%') + + + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + + + + + diff --git a/mallinkService/src/main/resources/mapper/WxProfitSharingResultMapper.xml b/mallinkService/src/main/resources/mapper/WxProfitSharingResultMapper.xml new file mode 100644 index 000000000..f361df0e6 --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxProfitSharingResultMapper.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + `id`,`sharing_order_id`,`sharing_receiver_id`,`pay_amount`,`update_time`,`create_time`,`sharing_status`,`finish_time`,`failed_reason` + + + + where 1 = 1 + + + and `id` = #{id} + + + + + and `sharing_order_id` = #{sharingOrderId} + + + + + and `sharing_receiver_id` = #{sharingReceiverId} + + + + + and `pay_amount` = #{payAmount} + + + + + and `update_time` = #{updateTime} + + + + + and `create_time` = #{createTime} + + + + + and `sharing_status` = #{sharingStatus} + + + + + and `finish_time` like concat('%', #{finishTime},'%') + + + + + and `failed_reason` like concat('%', #{failedReason},'%') + + + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + + + + +