2
0

feat: 微信支付对接

This commit is contained in:
caiyuchao
2025-01-20 19:29:12 +08:00
parent d17153ed50
commit 186a095232
5 changed files with 976 additions and 969 deletions

View File

@@ -0,0 +1,18 @@
package org.wfc.payment.domain;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @author: cyc
* @since: 2025-01-20
*/
@Data
@Component
@ConfigurationProperties(prefix = "file")
public class FileBean {
private String domain;
private String path;
private String prefix;
}

View File

@@ -1,5 +1,6 @@
package org.wfc.payment.domain; package org.wfc.payment.domain;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -9,6 +10,7 @@ import org.springframework.stereotype.Component;
* *
* @author cyc * @author cyc
*/ */
@Data
@Component @Component
@ConfigurationProperties(prefix = "wxpay") @ConfigurationProperties(prefix = "wxpay")
public class WxPayBean { public class WxPayBean {
@@ -19,57 +21,4 @@ public class WxPayBean {
private String certPath; private String certPath;
private String domain; private String domain;
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getAppSecret() {
return appSecret;
}
public void setAppSecret(String appSecret) {
this.appSecret = appSecret;
}
public String getMchId() {
return mchId;
}
public void setMchId(String mchId) {
this.mchId = mchId;
}
public String getPartnerKey() {
return partnerKey;
}
public void setPartnerKey(String partnerKey) {
this.partnerKey = partnerKey;
}
public String getCertPath() {
return certPath;
}
public void setCertPath(String certPath) {
this.certPath = certPath;
}
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
@Override
public String toString() {
return "WxPayBean [appId=" + appId + ", appSecret=" + appSecret + ", mchId=" + mchId + ", partnerKey="
+ partnerKey + ", certPath=" + certPath + ", domain=" + domain + "]";
}
} }

View File

@@ -9,12 +9,12 @@ public class AjaxResult implements Serializable {
private static final long serialVersionUID = 6439646269084700779L; private static final long serialVersionUID = 6439646269084700779L;
private int code = 0; private int code = 200;
/** /**
* 返回的中文消息 * 返回的中文消息
*/ */
private String message; private String msg;
/** /**
* 成功时携带的数据 * 成功时携带的数据
@@ -25,8 +25,8 @@ public class AjaxResult implements Serializable {
return code; return code;
} }
public String getMessage() { public String getMsg() {
return message; return msg;
} }
public Object getData() { public Object getData() {
@@ -43,7 +43,7 @@ public class AjaxResult implements Serializable {
* @return * @return
*/ */
public boolean hasError() { public boolean hasError() {
return this.code != 0; return this.code != 200;
} }
/** /**
@@ -53,8 +53,8 @@ public class AjaxResult implements Serializable {
* @return * @return
*/ */
public AjaxResult addError(String message) { public AjaxResult addError(String message) {
this.message = message; this.msg = message;
this.code = 1; this.code = 500;
return this; return this;
} }
@@ -65,7 +65,7 @@ public class AjaxResult implements Serializable {
* @return {AjaxResult} * @return {AjaxResult}
*/ */
public AjaxResult addConfirmError(String message) { public AjaxResult addConfirmError(String message) {
this.message = message; this.msg = message;
this.code = 2; this.code = 2;
return this; return this;
} }
@@ -78,7 +78,7 @@ public class AjaxResult implements Serializable {
*/ */
public AjaxResult success(Object data) { public AjaxResult success(Object data) {
this.data = data; this.data = data;
this.code = 0; this.code = 200;
return this; return this;
} }

View File

@@ -62,5 +62,19 @@ alipay:
aliPayCertPath: \u652F\u4ED8\u5B9D\u516C\u94A5\u8BC1\u4E66 aliPayCertPath: \u652F\u4ED8\u5B9D\u516C\u94A5\u8BC1\u4E66
aliPayRootCertPath: \u652F\u4ED8\u5B9D\u6839\u8BC1\u4E66 aliPayRootCertPath: \u652F\u4ED8\u5B9D\u6839\u8BC1\u4E66
serverUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do serverUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do
domain: http://localhost:8085 domain: http://192.168.9.50/u
testDomain: http://129.204.171.210:8085 testDomain: http://129.204.171.210:8085
wxpay:
appId:
appSecret:
mchId:
partnerKey:
certPath:
domain: http://192.168.9.50/u
# 本地文件上传
file:
domain: http://127.0.0.1:9201
path: D:/wfc/uploadPath
prefix: /statics