| @@ -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, "分账请求返回校验失败"), | |||
| /** | |||
| * 核销 | |||
| */ | |||
| @@ -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<Long> 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<Long> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<Long> 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<Field> 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)); | |||
| } | |||
| } | |||
| } | |||
| @@ -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<Long> 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<Long> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<Long> 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<Field> 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)); | |||
| } | |||
| } | |||
| } | |||
| @@ -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<Long> 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<Long> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<Long> 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<Field> 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)); | |||
| } | |||
| } | |||
| } | |||
| @@ -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; | |||
| } | |||
| } | |||
| @@ -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; | |||
| } | |||
| } | |||
| @@ -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<WxProfitSharingOrder, Long> { | |||
| List<WxProfitSharingOrder> findList(WxProfitSharingOrder wxProfitSharingOrder); | |||
| } | |||
| @@ -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<WxProfitSharingReceiver, Long> { | |||
| List<WxProfitSharingReceiver> findList(WxProfitSharingReceiver wxProfitSharingReceiver); | |||
| } | |||
| @@ -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<WxProfitSharingResult, Long> { | |||
| List<WxProfitSharingResult> findList(WxProfitSharingResult wxProfitSharingResult); | |||
| } | |||
| @@ -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<String, String> params) { | |||
| return doPost(PROFIT_SHARING_URL, params); | |||
| } | |||
| /** | |||
| * 分账查询 | |||
| * @param params 请求参数 | |||
| * @return | |||
| */ | |||
| public static String queryOrder(Map<String, String> params) { | |||
| return doPost(PROFIT_SHARING_URL, params); | |||
| } | |||
| public static String doPost(String url, Map<String, String> params) { | |||
| return HttpUtil.payPost(url, WxPayment.toXml(params)); | |||
| } | |||
| } | |||
| @@ -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; | |||
| } | |||
| } | |||
| @@ -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<WxProfitSharingOrder> 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); | |||
| } | |||
| @@ -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<WxProfitSharingReceiver> 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); | |||
| } | |||
| @@ -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<WxProfitSharingResult> 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); | |||
| } | |||
| @@ -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<WxProfitSharingOrder> 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<String, String> 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()); | |||
| } | |||
| } | |||
| } | |||
| @@ -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<WxProfitSharingReceiver> 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); | |||
| } | |||
| } | |||
| @@ -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<WxProfitSharingResult> 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); | |||
| } | |||
| } | |||
| @@ -0,0 +1,110 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.simple.mapper.WxProfitSharingOrderMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxProfitSharingOrder"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="merchant_id" jdbcType="VARCHAR" property="merchantId" /> | |||
| <result column="order_id" jdbcType="VARCHAR" property="orderId" /> | |||
| <result column="pay_amount" jdbcType="INTEGER" property="payAmount" /> | |||
| <result column="pay_time_end" jdbcType="TIMESTAMP" property="payTimeEnd" /> | |||
| <result column="pay_time_start" jdbcType="TIMESTAMP" property="payTimeStart" /> | |||
| <result column="transaction_id" jdbcType="VARCHAR" property="transactionId" /> | |||
| <result column="sharing_order_id" jdbcType="VARCHAR" property="sharingOrderId" /> | |||
| <result column="error_msg" jdbcType="VARCHAR" property="errorMsg" /> | |||
| <result column="sharing_status" jdbcType="INTEGER" property="sharingStatus" /> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `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` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test=" null != orderId "> | |||
| and `order_id` = #{orderId} | |||
| </if> | |||
| <if test=" null != payAmount "> | |||
| and `pay_amount` = #{payAmount} | |||
| </if> | |||
| <if test=" null != payTimeEnd "> | |||
| and `pay_time_end` = #{payTimeEnd} | |||
| </if> | |||
| <if test=" null != payTimeStart "> | |||
| and `pay_time_start` = #{payTimeStart} | |||
| </if> | |||
| <if test=" null != transactionId "> | |||
| and `transaction_id` like concat('%', #{transactionId},'%') | |||
| </if> | |||
| <if test=" null != sharingOrderId "> | |||
| and `sharing_order_id` like concat('%', #{sharingOrderId},'%') | |||
| </if> | |||
| <if test=" null != errorMsg "> | |||
| and `error_msg` like concat('%', #{errorMsg},'%') | |||
| </if> | |||
| <if test=" null != sharingStatus "> | |||
| and `sharing_status` like concat('%', #{sharingStatus},'%') | |||
| </if> | |||
| <if test=" null != updateTime "> | |||
| and `update_time` = #{updateTime} | |||
| </if> | |||
| <if test=" null != createTime "> | |||
| and `create_time` = #{createTime} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.WxProfitSharingOrder" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_profit_sharing_order | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| </mapper> | |||
| @@ -0,0 +1,98 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.simple.mapper.WxProfitSharingReceiverMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxProfitSharingReceiver"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="merchant_id" jdbcType="VARCHAR" property="merchantId" /> | |||
| <result column="receiver_type" jdbcType="INTEGER" property="receiverType" /> | |||
| <result column="receiver_account" jdbcType="VARCHAR" property="receiverAccount" /> | |||
| <result column="receiver_comments" jdbcType="VARCHAR" property="receiverComments" /> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||
| <result column="sharing_type" jdbcType="INTEGER" property="sharingType" /> | |||
| <result column="bank_no" jdbcType="VARCHAR" property="bankNo" /> | |||
| <result column="true_name" jdbcType="VARCHAR" property="trueName" /> | |||
| <result column="bank_code" jdbcType="VARCHAR" property="bankCode" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`merchant_id`,`receiver_type`,`receiver_account`,`receiver_comments`,`create_time`,`update_time`,`sharing_type`,`bank_no`,`true_name`,`bank_code` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test=" null != receiverType "> | |||
| and `receiver_type` = #{receiverType} | |||
| </if> | |||
| <if test=" null != receiverAccount "> | |||
| and `receiver_account` like concat('%', #{receiverAccount},'%') | |||
| </if> | |||
| <if test=" null != receiverComments "> | |||
| and `receiver_comments` like concat('%', #{receiverComments},'%') | |||
| </if> | |||
| <if test=" null != createTime "> | |||
| and `create_time` = #{createTime} | |||
| </if> | |||
| <if test=" null != updateTime "> | |||
| and `update_time` = #{updateTime} | |||
| </if> | |||
| <if test=" null != sharingType "> | |||
| and `sharing_type` = #{sharingType} | |||
| </if> | |||
| <if test=" null != bankNo "> | |||
| and `bank_no` like concat('%', #{bankNo},'%') | |||
| </if> | |||
| <if test=" null != trueName "> | |||
| and `true_name` like concat('%', #{trueName},'%') | |||
| </if> | |||
| <if test=" null != bankCode "> | |||
| and `bank_code` like concat('%', #{bankCode},'%') | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.WxProfitSharingReceiver" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_profit_sharing_receiver | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| </mapper> | |||
| @@ -0,0 +1,86 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="com.simple.mapper.WxProfitSharingResultMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxProfitSharingResult"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="sharing_order_id" jdbcType="VARCHAR" property="sharingOrderId" /> | |||
| <result column="sharing_receiver_id" jdbcType="VARCHAR" property="sharingReceiverId" /> | |||
| <result column="pay_amount" jdbcType="INTEGER" property="payAmount" /> | |||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||
| <result column="sharing_status" jdbcType="INTEGER" property="sharingStatus" /> | |||
| <result column="finish_time" jdbcType="VARCHAR" property="finishTime" /> | |||
| <result column="failed_reason" jdbcType="VARCHAR" property="failedReason" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`sharing_order_id`,`sharing_receiver_id`,`pay_amount`,`update_time`,`create_time`,`sharing_status`,`finish_time`,`failed_reason` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != sharingOrderId "> | |||
| and `sharing_order_id` = #{sharingOrderId} | |||
| </if> | |||
| <if test=" null != sharingReceiverId "> | |||
| and `sharing_receiver_id` = #{sharingReceiverId} | |||
| </if> | |||
| <if test=" null != payAmount "> | |||
| and `pay_amount` = #{payAmount} | |||
| </if> | |||
| <if test=" null != updateTime "> | |||
| and `update_time` = #{updateTime} | |||
| </if> | |||
| <if test=" null != createTime "> | |||
| and `create_time` = #{createTime} | |||
| </if> | |||
| <if test=" null != sharingStatus "> | |||
| and `sharing_status` = #{sharingStatus} | |||
| </if> | |||
| <if test=" null != finishTime "> | |||
| and `finish_time` like concat('%', #{finishTime},'%') | |||
| </if> | |||
| <if test=" null != failedReason "> | |||
| and `failed_reason` like concat('%', #{failedReason},'%') | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.WxProfitSharingResult" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_profit_sharing_result | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| </mapper> | |||