新增拉卡拉模块
This commit is contained in:
parent
f96b4e1bfe
commit
222c206aca
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,61 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.chaozhanggui.system</groupId>
|
||||||
|
<artifactId>ysk-system</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>lkl-service-api</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.chaozhanggui.system</groupId>
|
||||||
|
<artifactId>common-api</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-test</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.coobird</groupId>
|
||||||
|
<artifactId>thumbnailator</artifactId>
|
||||||
|
<version>0.4.14</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
|
<artifactId>httpcore</artifactId>
|
||||||
|
<version>4.4.14</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
|
<artifactId>httpclient</artifactId>
|
||||||
|
<version>4.5.13</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,252 @@
|
||||||
|
package com.chaozhanggui.system.lkl.config;
|
||||||
|
|
||||||
|
import com.alipay.api.internal.util.file.IOUtils;
|
||||||
|
import com.chaozhanggui.common.system.config.MsgException;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.client.HttpClient;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.conn.ClientConnectionManager;
|
||||||
|
import org.apache.http.conn.scheme.Scheme;
|
||||||
|
import org.apache.http.conn.scheme.SchemeRegistry;
|
||||||
|
import org.apache.http.conn.ssl.SSLSocketFactory;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
import java.io.*;
|
||||||
|
import java.security.*;
|
||||||
|
import java.security.cert.*;
|
||||||
|
import java.security.spec.InvalidKeySpecException;
|
||||||
|
import java.security.spec.PKCS8EncodedKeySpec;
|
||||||
|
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "lkl")
|
||||||
|
@Data
|
||||||
|
@Slf4j
|
||||||
|
public class LakalaConfig {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API schema ,固定 LKLAPI-SHA256withRSA
|
||||||
|
*/
|
||||||
|
public final static String SCHEMA = "LKLAPI-SHA256withRSA";
|
||||||
|
|
||||||
|
private static final String SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
|
||||||
|
private static final SecureRandom RANDOM = new SecureRandom();
|
||||||
|
|
||||||
|
private String privateKey;
|
||||||
|
private String appletsAppid;
|
||||||
|
private String appid;
|
||||||
|
private String mchSerialNo;
|
||||||
|
private String merchantNo;
|
||||||
|
private String vposId;
|
||||||
|
private String termNo;
|
||||||
|
private String apiUrl;
|
||||||
|
private String privateKeyPath;
|
||||||
|
private String certificatePath;
|
||||||
|
private String returncatePath;
|
||||||
|
private String callBackUrl;
|
||||||
|
private String pubKey;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String request(String body,String mothod) {
|
||||||
|
String encode = encode("client_id:client_secret".getBytes());
|
||||||
|
System.out.println("base64:" + encode);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
String authorization = getAuthorization(body, this.getAppid(), this.getMchSerialNo(), this.getPrivateKeyPath());
|
||||||
|
HttpResponse lakalaResponse = post(this.apiUrl + mothod, body, authorization, "utf-8");
|
||||||
|
if (lakalaResponse.getStatusLine().getStatusCode() != 200) {
|
||||||
|
log.error("请求失败,statusCode:{},message:{}", lakalaResponse.getStatusLine(), IOUtils.toString(lakalaResponse.getEntity().getContent(), "utf-8"));
|
||||||
|
MsgException.throwException(IOUtils.toString(lakalaResponse.getEntity().getContent(), "utf-8"));
|
||||||
|
}
|
||||||
|
|
||||||
|
String appid = getHeadValue(lakalaResponse, "Lklapi-Appid");
|
||||||
|
String lklapiSerial = getHeadValue(lakalaResponse, "Lklapi-Serial");
|
||||||
|
String timestamp = getHeadValue(lakalaResponse, "Lklapi-Timestamp");
|
||||||
|
String nonce = getHeadValue(lakalaResponse, "Lklapi-Nonce");
|
||||||
|
String signature = getHeadValue(lakalaResponse, "Lklapi-Signature");
|
||||||
|
String responseStr = IOUtils.toString(lakalaResponse.getEntity().getContent(), "utf-8");
|
||||||
|
log.info("返回的信息为 responseStr:{}", responseStr);
|
||||||
|
|
||||||
|
String source = appid + "\n" + lklapiSerial + "\n" + timestamp + "\n" + nonce + "\n" + responseStr + "\n";
|
||||||
|
log.info("请求的数据为:{}", source);
|
||||||
|
X509Certificate lklCertificate = loadCertificate(new FileInputStream(new File(this.getCertificatePath())));
|
||||||
|
boolean verify = verify(lklCertificate, source.getBytes("utf-8"), signature);
|
||||||
|
|
||||||
|
if (verify) {
|
||||||
|
log.info("验签通过");
|
||||||
|
return responseStr;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static String encode(byte[] content) {
|
||||||
|
return new sun.misc.BASE64Encoder().encode(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getHeadValue(HttpResponse response, String key) {
|
||||||
|
return (response.containsHeader(key)) ? response.getFirstHeader(key).getValue() : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static X509Certificate loadCertificate(InputStream inputStream) {
|
||||||
|
try {
|
||||||
|
CertificateFactory cf = CertificateFactory.getInstance("X509");
|
||||||
|
X509Certificate cert = (X509Certificate) cf.generateCertificate(inputStream);
|
||||||
|
|
||||||
|
cert.checkValidity();
|
||||||
|
return cert;
|
||||||
|
} catch (CertificateExpiredException e) {
|
||||||
|
throw new RuntimeException("证书已过期", e);
|
||||||
|
} catch (CertificateNotYetValidException e) {
|
||||||
|
throw new RuntimeException("证书尚未生效", e);
|
||||||
|
} catch (CertificateException e) {
|
||||||
|
throw new RuntimeException("无效的证书", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean verify(X509Certificate certificate, byte[] message, String signature) {
|
||||||
|
try {
|
||||||
|
Signature sign = Signature.getInstance("SHA256withRSA");
|
||||||
|
sign.initVerify(certificate);
|
||||||
|
sign.update(message);
|
||||||
|
byte[] signatureB = Base64.decodeBase64(signature);
|
||||||
|
return sign.verify(signatureB);
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
throw new RuntimeException("当前Java环境不支持SHA256withRSA", e);
|
||||||
|
} catch (SignatureException e) {
|
||||||
|
throw new RuntimeException("签名验证过程发生了错误", e);
|
||||||
|
} catch (InvalidKeyException e) {
|
||||||
|
throw new RuntimeException("无效的证书", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static HttpResponse post(String url, String message, String authorization, String ENCODING) throws Exception {
|
||||||
|
SSLContext ctx = SSLContext.getInstance("TLS");
|
||||||
|
X509TrustManager tm = new X509TrustManager() {
|
||||||
|
@Override
|
||||||
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkClientTrusted(X509Certificate[] xcs, String str) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkServerTrusted(X509Certificate[] xcs, String str) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
HttpClient http = new DefaultHttpClient();
|
||||||
|
ClientConnectionManager ccm = http.getConnectionManager();
|
||||||
|
ctx.init(null, new TrustManager[]{tm}, null);
|
||||||
|
SSLSocketFactory ssf = new SSLSocketFactory(ctx);
|
||||||
|
ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||||
|
SchemeRegistry registry = ccm.getSchemeRegistry();
|
||||||
|
registry.register(new Scheme("https", ssf, 443));
|
||||||
|
HttpPost post = new HttpPost(url);
|
||||||
|
StringEntity myEntity = new StringEntity(message, ENCODING);
|
||||||
|
post.setEntity(myEntity);
|
||||||
|
post.setHeader("Authorization", SCHEMA + " " + authorization);
|
||||||
|
post.setHeader("Accept", "application/json");
|
||||||
|
post.setHeader("Content-Type", "application/json");
|
||||||
|
return http.execute(post);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static final String getAuthorization(String body, String appid, String mchSerialNo, String merchantPrivateKeyPath) throws IOException {
|
||||||
|
String nonceStr = generateNonceStr();
|
||||||
|
long timestamp = generateTimestamp();
|
||||||
|
|
||||||
|
String message = appid + "\n" + mchSerialNo + "\n" + timestamp + "\n" + nonceStr + "\n" + body + "\n";
|
||||||
|
|
||||||
|
System.out.println("getToken message : " + message);
|
||||||
|
|
||||||
|
PrivateKey merchantPrivateKey = loadPrivateKey(new FileInputStream(new File(merchantPrivateKeyPath)));
|
||||||
|
|
||||||
|
String signature = sign(message.getBytes("utf-8"), merchantPrivateKey);
|
||||||
|
|
||||||
|
String authorization = "appid=\"" + appid + "\"," + "serial_no=\"" + mchSerialNo + "\"," + "timestamp=\""
|
||||||
|
+ timestamp + "\"," + "nonce_str=\"" + nonceStr + "\"," + "signature=\"" + signature + "\"";
|
||||||
|
System.out.println("authorization message :" + authorization);
|
||||||
|
|
||||||
|
return authorization;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static long generateTimestamp() {
|
||||||
|
return System.currentTimeMillis() / 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String generateNonceStr() {
|
||||||
|
char[] nonceChars = new char[32];
|
||||||
|
for (int index = 0; index < nonceChars.length; ++index) {
|
||||||
|
nonceChars[index] = SYMBOLS.charAt(RANDOM.nextInt(SYMBOLS.length()));
|
||||||
|
}
|
||||||
|
return new String(nonceChars);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static PrivateKey loadPrivateKey(InputStream inputStream) {
|
||||||
|
try {
|
||||||
|
ByteArrayOutputStream array = new ByteArrayOutputStream();
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int length;
|
||||||
|
while ((length = inputStream.read(buffer)) != -1) {
|
||||||
|
array.write(buffer, 0, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
String privateKey = array.toString("utf-8").replace("-----BEGIN PRIVATE KEY-----", "")
|
||||||
|
.replace("-----END PRIVATE KEY-----", "").replaceAll("\\s+", "");
|
||||||
|
KeyFactory kf = KeyFactory.getInstance("RSA");
|
||||||
|
return kf.generatePrivate(new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKey)));
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
throw new RuntimeException("当前Java环境不支持RSA", e);
|
||||||
|
} catch (InvalidKeySpecException e) {
|
||||||
|
throw new RuntimeException("无效的密钥格式");
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException("无效的密钥");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static String sign(byte[] message, PrivateKey privateKey) {
|
||||||
|
try {
|
||||||
|
Signature sign = Signature.getInstance("SHA256withRSA");
|
||||||
|
sign.initSign(privateKey);
|
||||||
|
sign.update(message);
|
||||||
|
return new String(Base64.encodeBase64(sign.sign()));
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
throw new RuntimeException("当前Java环境不支持SHA256withRSA", e);
|
||||||
|
} catch (SignatureException e) {
|
||||||
|
throw new RuntimeException("签名计算失败", e);
|
||||||
|
} catch (InvalidKeyException e) {
|
||||||
|
throw new RuntimeException("无效的私钥", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.chaozhanggui.system.lkl.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AccountVO implements Serializable {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String userid;
|
||||||
|
|
||||||
|
private String idcardid;
|
||||||
|
|
||||||
|
private String bankcardid;
|
||||||
|
|
||||||
|
private String certificateurl;
|
||||||
|
|
||||||
|
private String settletype;
|
||||||
|
|
||||||
|
private Date createtime;
|
||||||
|
|
||||||
|
private Date updatetime;
|
||||||
|
|
||||||
|
private String channeltype;
|
||||||
|
|
||||||
|
private Integer valid;
|
||||||
|
|
||||||
|
private String bak;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.chaozhanggui.system.lkl.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AttchmentsVo {
|
||||||
|
private String id;
|
||||||
|
private String type;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.chaozhanggui.system.lkl.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BankBranchLklVO implements Serializable {
|
||||||
|
private String id;
|
||||||
|
private String createTime;
|
||||||
|
private String optimistic;
|
||||||
|
private String updateTime;
|
||||||
|
private String areaCode;
|
||||||
|
private String bankNo;
|
||||||
|
private String branchBankName;
|
||||||
|
private String branchBankNo;
|
||||||
|
private String clearNo;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.chaozhanggui.system.lkl.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BankCardVO implements Serializable {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String userid;
|
||||||
|
|
||||||
|
private String bankholder;
|
||||||
|
|
||||||
|
private String bankcardno;
|
||||||
|
|
||||||
|
private String bankname;
|
||||||
|
|
||||||
|
private String branchname;
|
||||||
|
|
||||||
|
private String accounttype;
|
||||||
|
|
||||||
|
private String contactline;
|
||||||
|
|
||||||
|
private String branchprovince;
|
||||||
|
|
||||||
|
private String branchcity;
|
||||||
|
|
||||||
|
private String brancharea;
|
||||||
|
|
||||||
|
private String bankaddressno;
|
||||||
|
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
private String imgurl;
|
||||||
|
|
||||||
|
private String licenseurl;
|
||||||
|
|
||||||
|
private Date createtime;
|
||||||
|
|
||||||
|
private Date updatetime;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.chaozhanggui.system.lkl.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BankRegionLklVO implements Serializable {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String createTime;
|
||||||
|
private String optimistic;
|
||||||
|
private String updateTime;
|
||||||
|
private String code;
|
||||||
|
private String name;
|
||||||
|
private String parentCode;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,250 @@
|
||||||
|
package com.chaozhanggui.system.lkl.model;
|
||||||
|
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class Constant {
|
||||||
|
|
||||||
|
|
||||||
|
public static String INDUSTRY_TYPE = "industry";
|
||||||
|
public static String VIDEO_TYPE = "video";
|
||||||
|
public static String REQUST_RETIRN_JUMP = "";
|
||||||
|
public static String session_user = "session_user";
|
||||||
|
|
||||||
|
public static String MESSAGE_TYPE_BACK = "back";//回执
|
||||||
|
public static String MESSAGE_TYPE_MESSAGE = "message";//消息
|
||||||
|
public static String MESSAGE_TYPE_PING = "ping";//心跳
|
||||||
|
public static String MESSAGE_TYPE_BIND = "bind";//绑定
|
||||||
|
public static String MESSAGE_TYPE_RECEIVE = "receive";//暂存消息 收取
|
||||||
|
public static String QR_LIMIT_SCENE = "QR_LIMIT_SCENE";//微信创建二维码 永久 int
|
||||||
|
|
||||||
|
public static String RESULT_CODE_SUCCESS = "SUCCESS";//返回结果成功
|
||||||
|
public static String RESULT_CODE_FAIL = "FAIL";//返回结果失败
|
||||||
|
public static String RESULT_CODE_NONE = "NONE";//收到回执 什么不用做
|
||||||
|
public static String RESULT_CODE_OK = "OK";//服务端已接受
|
||||||
|
|
||||||
|
public static String FILE_SAVE_PATH = "/home/trade/talkfile/save";//服务端已接受
|
||||||
|
|
||||||
|
|
||||||
|
public static long MESSAGE_PING_CLOCK = 30;//心跳时钟 单位是秒
|
||||||
|
|
||||||
|
|
||||||
|
//支付状态
|
||||||
|
public static String PAY_RESULT_CODE_SUCCESS = "1";
|
||||||
|
public static String PAY_RESULT_CODE_FAIL = "2";
|
||||||
|
public static String PAY_RESULT_CODE_NONE = "0";
|
||||||
|
|
||||||
|
|
||||||
|
//支付方式
|
||||||
|
public static final String PAY_TYPE_WECHAT = "wechatPay";
|
||||||
|
public static final String PAY_TYPE_NAME_WECHAT = "微信";
|
||||||
|
public static final String PAY_TYPE_ALIPAY = "aliPay";
|
||||||
|
public static final String PAY_TYPE_NAME_ALIPAY = "支付宝";
|
||||||
|
|
||||||
|
public static final String PAY_TYPE_YSFPAY = "bank";
|
||||||
|
|
||||||
|
public static final String PAY_TYPE_NAME_YSFPAY = "云闪付";
|
||||||
|
|
||||||
|
//订单号前缀
|
||||||
|
public final static String PREFIX_ORDER = "11";
|
||||||
|
//日期格式
|
||||||
|
public final static String WECHATDATEFORMAT = "yyyyMMddHHmmss";
|
||||||
|
|
||||||
|
public final static String WEIXIN_PAY_UNIFIED_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder";
|
||||||
|
|
||||||
|
public final static String TENCENT_GET_ADDRESS_URL = "https://apis.map.qq.com/ws/geocoder/v1";
|
||||||
|
|
||||||
|
public static String sync_type_dml = "dml";//同步类型
|
||||||
|
public static String sync_type_ddl = "ddl";//同步类型
|
||||||
|
public static String sync_definition_action_insert = "insert";
|
||||||
|
public static String sync_definition_action_update = "update";
|
||||||
|
public static String sync_definition_action_delete = "delete";
|
||||||
|
public static String sync_definition_action_alter = "alter";
|
||||||
|
public static String sync_definition_action_create = "create";
|
||||||
|
public static String sync_definition_action_save = "save";
|
||||||
|
|
||||||
|
|
||||||
|
public static String sync_definition_entity_MerchantProductCategory = "MerchantProductCategory";
|
||||||
|
public static String sync_definition_entity_MerchantProductCombo = "MerchantProductCombo";
|
||||||
|
public static String sync_definition_entity_MerchantProduct = "MerchantProduct";
|
||||||
|
public static String sync_definition_entity_MerchantRole = "MerchantRole";
|
||||||
|
public static String sync_definition_entity_MerchantRoleMenu = "MerchantRoleMenu";
|
||||||
|
public static String sync_definition_entity_MerchantRoleUser = "MerchantRoleUser";
|
||||||
|
public static String sync_definition_entity_MerchantBaseInfo = "MerchantBaseInfo";
|
||||||
|
public static String sync_definition_entity_MerchantArea = "MerchantArea";
|
||||||
|
public static String sync_definition_entity_MerchantAreaClass = "MerchantAreaClass";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 百度短信模板
|
||||||
|
*/
|
||||||
|
//注册成功
|
||||||
|
public static String baidu_template_regist_success = "smsTpl:6c248ad7-921b-417a-869b-e43a78795700";
|
||||||
|
//带评阅
|
||||||
|
public static String baidu_template_waitfor_read = "smsTpl:e8e3651a-d7b7-4870-a70a-eeefd18f90eb";
|
||||||
|
//参赛成
|
||||||
|
public static String baidu_template_join_batter = "smsTpl:c7bcd897-6bee-4822-8823-be0e506ff334";
|
||||||
|
//中榜
|
||||||
|
public static String baidu_template_on_list = "smsTpl:466d88ca-317e-4af1-875d-d1ebe2258304";
|
||||||
|
//评阅成功
|
||||||
|
public static String baidu_template_read_success = "smsTpl:591e7f62-8a13-49b8-88b9-7dc9f9f6cf8f";
|
||||||
|
/**
|
||||||
|
* 微信公众号模板
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* 注册成功
|
||||||
|
*/
|
||||||
|
public static String wechat_template_regist_success = " UNeuf5QpriPfLVCJvXLhneBq3NVNQi2KKXIhCIjkz8Y";
|
||||||
|
/**
|
||||||
|
* 待评阅
|
||||||
|
*/
|
||||||
|
public static String wechat_template_waitfor_read = "ncbyBjSDhvF3NQ-25OStNS7lohq_ZI_QLBjpS2Bj7NA";
|
||||||
|
/**
|
||||||
|
* 活动报名成功
|
||||||
|
*/
|
||||||
|
public static String wechat_template_join_batter = "OKX7nmg0YPAicELVQn3DXMtHWowVS1jc0ZdAjmuYVqs";
|
||||||
|
/**
|
||||||
|
* 中榜
|
||||||
|
*/
|
||||||
|
public static String wechat_template_on_list = "9TWvGm19CuV1Wk4fuGu-SUfkuKsR9Yi77OXm234w8Tw";
|
||||||
|
/**
|
||||||
|
* 评阅成功
|
||||||
|
*/
|
||||||
|
public static String wechat_template_read_success = "D6eGbZ8GO36KCXCAe6CwNjG7RRHZxcDDxkOCbeYcIRk";
|
||||||
|
/**
|
||||||
|
* 登录成功提醒
|
||||||
|
*/
|
||||||
|
public static String wechat_template_login_success = "iZugTWBgboOdqttfmHvgv_NR_QTFjp88GREmu5JUC7c";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值成功
|
||||||
|
*/
|
||||||
|
public static String wechat_template_pay_success = "3TzSZHbyRMxG3e5x5KxTCMD_BTP8hJHTGllOnSaCpf0";
|
||||||
|
/**
|
||||||
|
* 消费成功
|
||||||
|
*/
|
||||||
|
public static String wechat_consume_success = "JFIaSWscb_KKCHN_3cCO4ctlDrbsRs0MywjScpYk0bA";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图形验证码key
|
||||||
|
* @date: 2021/12/20 10:24
|
||||||
|
*/
|
||||||
|
public static final String LOGIN_VALIDATE_CODE = "login_validate_code";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户最高等级等级LV10
|
||||||
|
* @date: 2022/1/22 15:16
|
||||||
|
*/
|
||||||
|
public static final String USER_MAX_LEVEL_CODE = "LV10";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最小结算底价
|
||||||
|
* @date: 2022/3/9 18:08
|
||||||
|
*/
|
||||||
|
public static final BigDecimal MIX_SETTLE_RATE = BigDecimal.valueOf(21);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缴费通
|
||||||
|
* @date: 2022/3/9 18:08
|
||||||
|
*/
|
||||||
|
public static final BigDecimal JFT_MIX_SETTLE_RATE = BigDecimal.valueOf(28);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认收款商户号
|
||||||
|
*/
|
||||||
|
public static final String DEFUALT_CASHIER_MERCHANT = "M800202207078584958";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认收款商户属性key
|
||||||
|
*/
|
||||||
|
public static final String SYSTEM_MERCHANT_KEY = "cashier_merchant";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认通道
|
||||||
|
*/
|
||||||
|
public static final Integer DEFAULT_CHANNEL = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付宝H5支付前缀
|
||||||
|
*/
|
||||||
|
public static final String ALIPAY_H5_PAY_URL_PRIFIX = "alipays://platformapi/startapp?appId=2021003175619219&url=";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收款通道类型
|
||||||
|
*/
|
||||||
|
public static final String PAYMENT_CHANNEL_TYPE = "payment_channel_type";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原生通道
|
||||||
|
*/
|
||||||
|
public static final Integer PRIMORDIAL_CHANNEL = 5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序默认支付路径
|
||||||
|
*/
|
||||||
|
public static final String DEFAULT_APPLET_PATH = "/pages/pay/index";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序默认支付参数名
|
||||||
|
*/
|
||||||
|
public static final String DEFAULT_APPLET_PARAM_NAME_PREFIX = "orderId=";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分商城用户同步URL
|
||||||
|
*/
|
||||||
|
public static final String JF_SHOP_USER_SYNC_URL = "http://jf.shouyinbei.com/addons/shopro/syb_merchant/sysnmerchant";
|
||||||
|
/**
|
||||||
|
* 会员活动(充值活动)
|
||||||
|
*/
|
||||||
|
public static final String MEMBER_RECHARGE_ACTIVITY = "http://192.168.1.116/javaApi/java-api/get-vip-sdata";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员活动(消费活动)
|
||||||
|
*/
|
||||||
|
public static final String MEMBER_CONSUME_ACTIVITY = "http://192.168.1.116/javaApi/java-api/get-vip-xfdata";
|
||||||
|
/**
|
||||||
|
* 会员活动(激活送)
|
||||||
|
*/
|
||||||
|
public static final String MEMBER_ACTIVATION_ACTIVITY = "http://192.168.1.116/javaApi/java-api/get-vip-jhdata";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生活圈会员卡默认过期时间 5(单位分钟)
|
||||||
|
*/
|
||||||
|
public static final Integer DEFAULT_LIFE_MEMBER_CARD_REFRESH_TIME = 5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缴费通成本费率
|
||||||
|
*/
|
||||||
|
public static final BigDecimal DEFAULT_JFT_COST_RATE = BigDecimal.valueOf(30);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缴费通固定提现费率
|
||||||
|
*/
|
||||||
|
public static final BigDecimal DEFAULT_JFT_CASH_RATE = BigDecimal.valueOf(0.001);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缴费通固定提现费
|
||||||
|
*/
|
||||||
|
public static final BigDecimal DEFAULT_JFT_CASH_FEE = BigDecimal.valueOf(0.01);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 银盛交易回传字段key
|
||||||
|
*/
|
||||||
|
public static final String YS_PAY_ECHO_KEY_NAME = "extra_common_param";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随行付回传字段key
|
||||||
|
*/
|
||||||
|
public static final String SXF_PAY_ECHO_KEY_NAME = "extend";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 瑞银信交易回传字段
|
||||||
|
*/
|
||||||
|
public static final String RYX_PAY_ECHO_KEY_NAME = "extend1";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认秘钥设置
|
||||||
|
*/
|
||||||
|
public static final String DEFAULT_MD5_KEY = "4c8d277b0f274604af68e590cc0b3e6b";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.chaozhanggui.system.lkl.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FeesSetVo {
|
||||||
|
private String feeCode;
|
||||||
|
private Double feeValue;
|
||||||
|
private Double topFee;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.chaozhanggui.system.lkl.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class IdCardVO implements Serializable {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer userid;
|
||||||
|
|
||||||
|
private String usertype;
|
||||||
|
|
||||||
|
private String certtype;
|
||||||
|
|
||||||
|
private String certno;
|
||||||
|
|
||||||
|
private String certname;
|
||||||
|
|
||||||
|
private String certstarttime;
|
||||||
|
|
||||||
|
private String certendtime;
|
||||||
|
|
||||||
|
private String certaddress;
|
||||||
|
|
||||||
|
private Date createtime;
|
||||||
|
|
||||||
|
private Date updatetime;
|
||||||
|
|
||||||
|
private String imgpositive;
|
||||||
|
|
||||||
|
private String imgnegative;
|
||||||
|
|
||||||
|
private String virtypeflag;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.chaozhanggui.system.lkl.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MccReflectVO implements Serializable {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String standardMccCode;
|
||||||
|
|
||||||
|
private String mccCode;
|
||||||
|
|
||||||
|
private Integer channelId;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private Date updateTime;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.chaozhanggui.system.lkl.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MerchantBackLklVO implements Serializable {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
private String merchantCode;
|
||||||
|
private String merchantId;
|
||||||
|
private String channel;
|
||||||
|
private String userNo;
|
||||||
|
private String customerNo;
|
||||||
|
private String externalCustomerNo;
|
||||||
|
private String termNos;
|
||||||
|
private String agencyNo;
|
||||||
|
private String activeNo;
|
||||||
|
private String contractId;
|
||||||
|
private String coreTermIds;
|
||||||
|
private Date createTime;
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
package com.chaozhanggui.system.lkl.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MerchantBaseInfoVO implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String bindingcode;
|
||||||
|
|
||||||
|
private Integer userid;
|
||||||
|
|
||||||
|
private String aliaccount;
|
||||||
|
|
||||||
|
private String merchantcode;
|
||||||
|
|
||||||
|
private String merchantname;
|
||||||
|
|
||||||
|
private String merchanttype;
|
||||||
|
|
||||||
|
private String productdesc;
|
||||||
|
|
||||||
|
private String alimcc;
|
||||||
|
|
||||||
|
private String mcc;
|
||||||
|
|
||||||
|
private String mccname;
|
||||||
|
|
||||||
|
private String alias;
|
||||||
|
|
||||||
|
private String contactmobile;
|
||||||
|
|
||||||
|
private String contactname;
|
||||||
|
|
||||||
|
private String addressno;
|
||||||
|
|
||||||
|
private String province;
|
||||||
|
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
private String district;
|
||||||
|
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
private String principalmobile;
|
||||||
|
|
||||||
|
private String principalcerttype;
|
||||||
|
|
||||||
|
private String principalcertno;
|
||||||
|
|
||||||
|
private String principalperson;
|
||||||
|
|
||||||
|
private String bussauthname;
|
||||||
|
|
||||||
|
private String bussauthnum;
|
||||||
|
|
||||||
|
private String bussauthaddress;
|
||||||
|
|
||||||
|
private String bussauthstarttime;
|
||||||
|
|
||||||
|
private String bussauthendtime;
|
||||||
|
|
||||||
|
private String certorgcode;
|
||||||
|
|
||||||
|
private Date createdt;
|
||||||
|
|
||||||
|
private Date updatedt;
|
||||||
|
|
||||||
|
private String creator;
|
||||||
|
|
||||||
|
private String buslictype;
|
||||||
|
|
||||||
|
private String isvoice;
|
||||||
|
|
||||||
|
private String allowbanklarge;
|
||||||
|
|
||||||
|
private String wxcertstatus;
|
||||||
|
|
||||||
|
private String ispushwxmessage;
|
||||||
|
|
||||||
|
private String isunionpay;
|
||||||
|
|
||||||
|
private String md5key;
|
||||||
|
|
||||||
|
private String limitpay;
|
||||||
|
|
||||||
|
private String subappid;
|
||||||
|
|
||||||
|
private String appid;
|
||||||
|
|
||||||
|
private Date firsttradetime;
|
||||||
|
|
||||||
|
private Date lasttradetime;
|
||||||
|
|
||||||
|
private Byte splitflag;
|
||||||
|
|
||||||
|
private Byte validflag;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
package com.chaozhanggui.system.lkl.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MerchantChannelStatusVO implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
//审核中
|
||||||
|
public static final String AUDIT_STATUS_EXAMINING = "1";
|
||||||
|
|
||||||
|
//三方审核中
|
||||||
|
public static final String AUDIT_THIRD_STATUS_WAITING = "-100";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核通过
|
||||||
|
*/
|
||||||
|
public static final String AUDIT_STATUS_SUCCESS = "3";
|
||||||
|
|
||||||
|
public static final String AUDIT_STATUS_DATA_EDIT = "6";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 秒审通过
|
||||||
|
*/
|
||||||
|
public static final String AUDIT_STATUS_FIRST_TRIAL_SUCCESS = "4";
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer channel;
|
||||||
|
|
||||||
|
private String merchantcode;
|
||||||
|
|
||||||
|
private String merchantid;
|
||||||
|
|
||||||
|
private String settlementtype;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private String thirdstatus;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
private Date createtime;
|
||||||
|
|
||||||
|
private Date updatetime;
|
||||||
|
|
||||||
|
private String applicationid;
|
||||||
|
|
||||||
|
private String callbackstatus;
|
||||||
|
|
||||||
|
private Integer valid;
|
||||||
|
|
||||||
|
private String authorizationstatus;
|
||||||
|
|
||||||
|
private String mercname;
|
||||||
|
|
||||||
|
private String virchannelflag;
|
||||||
|
|
||||||
|
private String virstatusflag;
|
||||||
|
|
||||||
|
private String srcmerchantno;
|
||||||
|
|
||||||
|
private String interfaceversion;
|
||||||
|
|
||||||
|
private String aliauthorizationstatus;
|
||||||
|
|
||||||
|
private String wxcerturl;
|
||||||
|
|
||||||
|
private String alicerturl;
|
||||||
|
|
||||||
|
private Date auditsuccesstime;
|
||||||
|
|
||||||
|
private String extra;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean isAudited(MerchantChannelStatusVO mcs) {
|
||||||
|
if (mcs == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return MerchantChannelStatusVO.AUDIT_STATUS_SUCCESS.equals(mcs.getStatus()) ||
|
||||||
|
MerchantChannelStatusVO.AUDIT_STATUS_DATA_EDIT.equals(mcs.getStatus()) ||
|
||||||
|
MerchantChannelStatusVO.AUDIT_STATUS_FIRST_TRIAL_SUCCESS.equals(mcs.getStatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.chaozhanggui.system.lkl.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MerchantImageVO implements Serializable {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String merchantcode;
|
||||||
|
|
||||||
|
private String phototype;
|
||||||
|
|
||||||
|
private String photourl;
|
||||||
|
|
||||||
|
private String picurl;
|
||||||
|
|
||||||
|
private Date createdt;
|
||||||
|
|
||||||
|
private Date updatedt;
|
||||||
|
|
||||||
|
private String aisleswitch;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
package com.chaozhanggui.system.lkl.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MerchantOrderVO implements Serializable {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String ordernumber;
|
||||||
|
|
||||||
|
private String userimg;
|
||||||
|
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
private String ordertype;
|
||||||
|
|
||||||
|
private String merchantcode;
|
||||||
|
|
||||||
|
private String merchantname;
|
||||||
|
|
||||||
|
private String paytypecode;
|
||||||
|
|
||||||
|
private String paytypename;
|
||||||
|
|
||||||
|
private String thirdtransno;
|
||||||
|
|
||||||
|
private String storeid;
|
||||||
|
|
||||||
|
private String storename;
|
||||||
|
|
||||||
|
private Double consumefee;
|
||||||
|
|
||||||
|
private String transno;
|
||||||
|
|
||||||
|
private String membercode;
|
||||||
|
|
||||||
|
private Date createdt;
|
||||||
|
|
||||||
|
private Date transdt;
|
||||||
|
|
||||||
|
private String staffcode;
|
||||||
|
|
||||||
|
private String staffname;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private Double enterfee;
|
||||||
|
|
||||||
|
private String aisleswitch;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
private Date updatetime;
|
||||||
|
|
||||||
|
private BigDecimal rate;
|
||||||
|
|
||||||
|
private BigDecimal marketamt;
|
||||||
|
|
||||||
|
private String mercorderno;
|
||||||
|
|
||||||
|
private String mercnotifyurl;
|
||||||
|
|
||||||
|
private String mercuserid;
|
||||||
|
|
||||||
|
private String mercnotifystatus;
|
||||||
|
|
||||||
|
private String mercremark;
|
||||||
|
|
||||||
|
private String isrecharge;
|
||||||
|
|
||||||
|
private String snno;
|
||||||
|
|
||||||
|
private Integer cashplaceid;
|
||||||
|
|
||||||
|
private Boolean settlementtype;
|
||||||
|
|
||||||
|
private Double fanssharemoney;
|
||||||
|
|
||||||
|
private Double profitsharemoney;
|
||||||
|
|
||||||
|
private String drtype;
|
||||||
|
|
||||||
|
private BigDecimal channelrate;
|
||||||
|
|
||||||
|
private BigDecimal channelfee;
|
||||||
|
|
||||||
|
private BigDecimal mercfee;
|
||||||
|
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
private String ipaddress;
|
||||||
|
|
||||||
|
private String mercreturnurl;
|
||||||
|
|
||||||
|
private String channeltype;
|
||||||
|
|
||||||
|
private Date createdate;
|
||||||
|
|
||||||
|
private Date updatedate;
|
||||||
|
|
||||||
|
private String preauthstatus;
|
||||||
|
|
||||||
|
private BigDecimal refundamt;
|
||||||
|
|
||||||
|
private String refundNo;
|
||||||
|
|
||||||
|
private BigDecimal cashfee;
|
||||||
|
|
||||||
|
private String thirdsendno;
|
||||||
|
|
||||||
|
private String paydata;
|
||||||
|
|
||||||
|
private String scanType;
|
||||||
|
|
||||||
|
private String authCode;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.chaozhanggui.system.lkl.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RegionLklVO implements Serializable {
|
||||||
|
private String id;
|
||||||
|
private String createTime;
|
||||||
|
private String optimistic;
|
||||||
|
private String updateTime;
|
||||||
|
private String code;
|
||||||
|
private String name;
|
||||||
|
private String parentCode;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,392 @@
|
||||||
|
package com.chaozhanggui.system.lkl.service;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.extra.template.TemplateException;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.chaozhanggui.common.system.config.MsgException;
|
||||||
|
import com.chaozhanggui.common.system.util.DateUtils;
|
||||||
|
import com.chaozhanggui.system.lkl.model.*;
|
||||||
|
import com.chaozhanggui.system.lkl.util.HtmlUtil;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.http.*;
|
||||||
|
import org.springframework.mock.web.MockMultipartFile;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
|
import org.springframework.util.MultiValueMap;
|
||||||
|
import org.springframework.util.ObjectUtils;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class MerchantLklService {
|
||||||
|
|
||||||
|
private static final Logger log= LoggerFactory.getLogger(MerchantLklService.class);
|
||||||
|
public static final String userNo = "22265868";
|
||||||
|
|
||||||
|
|
||||||
|
private static final String client_id = "chaozhanggui";
|
||||||
|
private static final String client_secret = "Y54Gqy6aLpxld3dp";
|
||||||
|
private static final String grant_type = "client_credentials";
|
||||||
|
|
||||||
|
|
||||||
|
//商户进件地址
|
||||||
|
private static final String tuoKeMerchat = "https://htkactvi.lakala.com/registration/merchant";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//进件接口
|
||||||
|
public JSONObject merchantAduit(MerchantBaseInfoVO merchantBaseInfo, MerchantChannelStatusVO merchantChannelStatusVO
|
||||||
|
, ConcurrentMap<String, RegionLklVO> regionLklVOConcurrentMap, AccountVO accountVO, BankCardVO bankCardVO,IdCardVO idCardVO
|
||||||
|
,ConcurrentMap<String,MerchantImageVO> imageVOConcurrentMap,MccReflectVO mccReflectVO,BankBranchLklVO bankBranchLklVO,
|
||||||
|
BankRegionLklVO parentCode,BankRegionLklVO bankParentCode
|
||||||
|
) throws Exception {
|
||||||
|
|
||||||
|
MsgException.checkNull(merchantBaseInfo,"商户基本信息不存在");
|
||||||
|
MsgException.checkNull(merchantChannelStatusVO,"商户未提交审核");
|
||||||
|
if (merchantChannelStatusVO.getStatus().equals(MerchantChannelStatusVO.AUDIT_STATUS_EXAMINING) && !merchantChannelStatusVO.getStatus().equals(MerchantChannelStatusVO.AUDIT_THIRD_STATUS_WAITING)) {
|
||||||
|
MsgException.throwException("进件审核中,请等待审核结果");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (merchantChannelStatusVO.isAudited(merchantChannelStatusVO)) {
|
||||||
|
MsgException.throwException("商户已进件成功,请勿重复进件");
|
||||||
|
}
|
||||||
|
|
||||||
|
MsgException.checkNull(regionLklVOConcurrentMap,"商户地址信息不存在");
|
||||||
|
MsgException.checkNull(regionLklVOConcurrentMap.get("provinceCode"),"商户省份信息不存在");
|
||||||
|
MsgException.checkNull(regionLklVOConcurrentMap.get("cityCode"),"商户城市信息不存在");
|
||||||
|
MsgException.checkNull(regionLklVOConcurrentMap.get("countyCode"),"商户区县细信息不存在");
|
||||||
|
MsgException.checkNull(accountVO,"商户结算信息未提交");
|
||||||
|
MsgException.checkNull(bankCardVO,"商户结算卡信息未提交");
|
||||||
|
MsgException.checkNull(idCardVO,"商户基本信息不完整");
|
||||||
|
MsgException.checkNull(imageVOConcurrentMap,"商户基本信息不完整");
|
||||||
|
MsgException.checkNull(imageVOConcurrentMap.get("BUSINESS_LICENCE"),"商户基本信息不完整");
|
||||||
|
MsgException.checkNull(bankBranchLklVO,"结算卡对应的分行支行信息不存在");
|
||||||
|
|
||||||
|
JSONObject object1 = new JSONObject();
|
||||||
|
JSONObject object2 = new JSONObject();
|
||||||
|
object1.put("userNo", userNo); //合作机构信息 由拓客SAAS提供
|
||||||
|
object1.put("email", "chaozhanggui2023@163.com"); //商户邮箱
|
||||||
|
object1.put("busiCode", "KLYX");//业务类型 BPOS:传统POS, ZPOS:电签,ZPOS4G:4G电签,SUPER_POS:智能pos,B_WIZARD:蓝精灵,PAPER_CODE:码牌,WECHAT_PAY:专业化扫码,KLYX:云音箱,QRCODE:收款王,MONEY_BOX:收钱宝盒根据业务开放取值
|
||||||
|
object1.put("merRegName", merchantBaseInfo.getAlias()); //商户注册名称 不能少于七个中文
|
||||||
|
object1.put("merType", (merchantBaseInfo.getMerchanttype().equals(1) || merchantBaseInfo.getMerchanttype().equals("2")) ? "TP_PERSONAL" : "TP_MERCHANT"); //商户注册类型 TP_MERCHANT:企业 TP_PERSONAL:⼩微个⼈
|
||||||
|
object1.put("merName", merchantBaseInfo.getAlias()); //商户名称(经营名称) 不能少于七个中文
|
||||||
|
object1.put("merAddr", merchantBaseInfo.getAddress()); //去掉省,市区后的详细地址
|
||||||
|
object1.put("provinceCode", regionLklVOConcurrentMap.get("provinceCode").getCode()); //省代码 通过【地区信息→获取地区查询】接口获取 对应 code字段
|
||||||
|
object1.put("cityCode", regionLklVOConcurrentMap.get("cityCode").getCode()); // 市代码 通过【地区信息→获取地区查询】接口获取 对应 code字段
|
||||||
|
object1.put("countyCode", regionLklVOConcurrentMap.get("countyCode").getCode()); // 区县代码 通过【地区信息→获取地区查询】接口获取 对应 code字段
|
||||||
|
Set<Object> attchmentsVoSet = new HashSet<>();
|
||||||
|
|
||||||
|
//企业进件必传资料
|
||||||
|
if(merchantBaseInfo.getMerchanttype().equals("3")){
|
||||||
|
conventIdCardTime(object1,attchmentsVoSet,merchantBaseInfo,idCardVO,bankCardVO,imageVOConcurrentMap.get("BUSINESS_LICENCE").getPicurl(),bankCardVO.getLicenseurl(),mccReflectVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
object1.put("latitude", "108.94647"); //经度 进件所在地址经度
|
||||||
|
object1.put("longtude", "34.34727"); //纬度 进件所在地址纬度
|
||||||
|
object1.put("source", "APP"); //进件来源 APP: app H5: h5
|
||||||
|
object1.put("businessContent", merchantBaseInfo.getMccname()); //商户经营内容
|
||||||
|
object1.put("larName", idCardVO.getCertname()); //法⼈姓名
|
||||||
|
object1.put("larIdType", "01"); //法⼈证件类型 01 身份证 暂时只支持身份证
|
||||||
|
object1.put("larIdCard", idCardVO.getCertno()); //法⼈证件号码
|
||||||
|
object1.put("larIdCardStart", DateUtils.convertString(idCardVO.getCertstarttime())); //法⼈证件开始⽇期 格式yyyy-MM-dd
|
||||||
|
object1.put("larIdCardEnd", DateUtils.convertString(idCardVO.getCertendtime())); //法⼈证件过期时间 格式yyyy-MM-dd
|
||||||
|
object1.put("contactMobile", merchantBaseInfo.getContactmobile()); //商户联系⼈⼿机号码
|
||||||
|
object1.put("contactName", merchantBaseInfo.getContactname()); //商户联系⼈姓名
|
||||||
|
|
||||||
|
|
||||||
|
object1.put("openningBankCode", bankBranchLklVO.getBranchBankNo()); //结算账户开户⾏号 通过【银行列表查询】接口获取 对应 branchBankNo字段
|
||||||
|
object1.put("openningBankName", bankBranchLklVO.getBranchBankName()); //结算账户开户⾏名称 通过【银行列表查询】接口获取 对应 branchBankName字段
|
||||||
|
object1.put("clearingBankCode", bankBranchLklVO.getClearNo()); //结算账户清算⾏号 通过【银行列表查询】接口获取 对应 clearNo字段
|
||||||
|
|
||||||
|
object1.put("settleProvinceCode", parentCode.getCode()); //结算信息省份名称 通过【地区信息→获取银行地区查询】接口获取 对应 code字段
|
||||||
|
object1.put("settleProvinceName", parentCode.getName()); //结算信息省份代码 通过【地区信息→获取银行地区查询】接口获取 对应 name字段
|
||||||
|
object1.put("settleCityCode", bankParentCode.getCode()); //结算信息城市名称 通过【地区信息→获取银行地区查询】接口获取 对应 code字段
|
||||||
|
object1.put("settleCityName", bankParentCode.getName()); //结算信息城市代码 通过【地区信息→获取银行地区查询】接口获取 对应 name字段
|
||||||
|
|
||||||
|
if("02".equals(accountVO.getSettletype())){
|
||||||
|
AttchmentsVo opening_permit = new AttchmentsVo(); //图片set
|
||||||
|
opening_permit.setId(laKaLaFileUpload(accountVO.getCertificateurl(), "LETTER_OF_AUTHORIZATION"));//对私非法人授权函
|
||||||
|
opening_permit.setType("LETTER_OF_AUTHORIZATION");//对私非法人授权函
|
||||||
|
attchmentsVoSet.add(opening_permit);
|
||||||
|
}
|
||||||
|
|
||||||
|
object1.put("accountNo", bankCardVO.getBankcardno()); //结算人银行卡号
|
||||||
|
object1.put("accountName", bankCardVO.getBankholder()); //结算人账户名称
|
||||||
|
object1.put("accountType", bankCardVO.getAccounttype().equals("01") ? "58" : "57"); //结算账户类型 57 对公 58 对私
|
||||||
|
object1.put("accountIdCard", idCardVO.getCertno()); //结算⼈证件号码
|
||||||
|
|
||||||
|
if (bankCardVO.getAccounttype().equals("2")) {
|
||||||
|
//对公收银台照片
|
||||||
|
AttchmentsVo checkstand_img = new AttchmentsVo();
|
||||||
|
checkstand_img.setId(laKaLaFileUpload(idCardVO.getImgnegative(), "CHECKSTAND_IMG")); //收银台照片
|
||||||
|
checkstand_img.setType("CHECKSTAND_IMG");//收银台照片
|
||||||
|
attchmentsVoSet.add(checkstand_img);
|
||||||
|
|
||||||
|
|
||||||
|
//门头照片
|
||||||
|
MerchantImageVO image =imageVOConcurrentMap.get("SHOP_OUTSIDE_IMG");
|
||||||
|
MsgException.checkNull(image, "门头照片不存在");
|
||||||
|
|
||||||
|
AttchmentsVo shop_outside_img = new AttchmentsVo();
|
||||||
|
shop_outside_img.setId(laKaLaFileUpload(image.getPicurl(), "SHOP_OUTSIDE_IMG"));//门头照片
|
||||||
|
shop_outside_img.setType("SHOP_OUTSIDE_IMG");
|
||||||
|
attchmentsVoSet.add(shop_outside_img);
|
||||||
|
|
||||||
|
//商铺内部照片
|
||||||
|
image =imageVOConcurrentMap.get("SHOP_INSIDE_IMG");
|
||||||
|
MsgException.checkNull(image, "商铺内部照片不存在");
|
||||||
|
AttchmentsVo shop_inside_img = new AttchmentsVo();
|
||||||
|
|
||||||
|
shop_inside_img.setId(laKaLaFileUpload(image.getPicurl(), "SHOP_INSIDE_IMG"));//商铺内部照片
|
||||||
|
shop_inside_img.setType("SHOP_INSIDE_IMG");
|
||||||
|
attchmentsVoSet.add(shop_inside_img);
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONArray array = new JSONArray();
|
||||||
|
|
||||||
|
Set<FeesSetVo> feesSet = new HashSet<>();
|
||||||
|
FeesSetVo w = new FeesSetVo();
|
||||||
|
w.setFeeCode("WECHAT");
|
||||||
|
w.setFeeValue(0.38d);
|
||||||
|
array.add(w);
|
||||||
|
|
||||||
|
FeesSetVo a = new FeesSetVo();
|
||||||
|
a.setFeeCode("ALIPAY");
|
||||||
|
a.setFeeValue(0.38d);
|
||||||
|
array.add(a);
|
||||||
|
|
||||||
|
FeesSetVo u = new FeesSetVo();
|
||||||
|
u.setFeeCode("SCAN_PAY_SECOND");
|
||||||
|
u.setFeeValue(0.38d);
|
||||||
|
array.add(u);
|
||||||
|
feesSet.add(w);
|
||||||
|
feesSet.add(a);
|
||||||
|
feesSet.add(u);
|
||||||
|
|
||||||
|
object2.put("termNum", "1"); //终端数量 1-5 最⼤ 5个终端
|
||||||
|
object2.put("fees", feesSet); //费率集合
|
||||||
|
|
||||||
|
object2.put("mcc","12007");
|
||||||
|
// object2.put("mcc", ObjectUtils.isEmpty(mccReflect) ? "7399" : mccReflect.getMccCode()); //商户MCC编号 通过 【商户类别查询→查询小类】接口获取 对应 code字段
|
||||||
|
object2.put("activityId", "37"); //归属活动信息 由拓客SAAS分配
|
||||||
|
object1.put("bizContent", object2); //业务扩展信息 参⻅ 业务扩展信息
|
||||||
|
|
||||||
|
|
||||||
|
AttchmentsVo frontLegalPerson = new AttchmentsVo(); //图片set
|
||||||
|
frontLegalPerson.setId(laKaLaFileUpload(idCardVO.getImgpositive(), "ID_CARD_FRONT"));//法人身份证图片地址
|
||||||
|
frontLegalPerson.setType("ID_CARD_FRONT");//身份证正⾯
|
||||||
|
attchmentsVoSet.add(frontLegalPerson);
|
||||||
|
|
||||||
|
AttchmentsVo reverseLegalPerson = new AttchmentsVo();
|
||||||
|
reverseLegalPerson.setId(laKaLaFileUpload(idCardVO.getImgnegative(), "ID_CARD_BEHIND")); //法人身份证图片地址
|
||||||
|
reverseLegalPerson.setType("ID_CARD_BEHIND");//身份证反⾯
|
||||||
|
attchmentsVoSet.add(reverseLegalPerson);
|
||||||
|
|
||||||
|
|
||||||
|
object1.put("attchments", attchmentsVoSet); //附件信息集合 参⻅ 附件信息
|
||||||
|
object1.put("settleType", "D1"); //结算类型 D0秒到 D1次日结算
|
||||||
|
|
||||||
|
log.info("请求地址:{},请求参数:{},",tuoKeMerchat,object1);
|
||||||
|
|
||||||
|
Map map = getToken();
|
||||||
|
|
||||||
|
String result = cn.hutool.http.HttpRequest.post(tuoKeMerchat)
|
||||||
|
.header("Authorization", "bearer " + map.get("access_token")).header("content-type", "application/json")
|
||||||
|
.body(object1.toString()).execute().body();
|
||||||
|
log.info("拉卡拉返回的进件结果信息:{}",result);
|
||||||
|
if(ObjectUtil.isEmpty(result)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return JSONObject.parseObject(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void conventIdCardTime(JSONObject jsonObject,Set<Object> attchmentsVoSet,MerchantBaseInfoVO merchantBaseInfo,IdCardVO idCardVO,BankCardVO bankCardVO,String businessLicence,String openingPermit,MccReflectVO mccReflect) throws Exception{
|
||||||
|
StringBuffer startSb = new StringBuffer();
|
||||||
|
StringBuffer endSb = new StringBuffer();
|
||||||
|
|
||||||
|
if (merchantBaseInfo.getBussauthstarttime().contains("年")) {
|
||||||
|
startSb.append(merchantBaseInfo.getBussauthstarttime().substring(0, 4));
|
||||||
|
startSb.append("-");
|
||||||
|
startSb.append(merchantBaseInfo.getBussauthstarttime().substring(5, 7));
|
||||||
|
startSb.append("-");
|
||||||
|
startSb.append(merchantBaseInfo.getBussauthstarttime().substring(8, 10));
|
||||||
|
} else {
|
||||||
|
startSb.append(merchantBaseInfo.getBussauthstarttime());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(merchantBaseInfo.getBussauthendtime()) || "长期".equals(merchantBaseInfo.getBuslictype())) {
|
||||||
|
endSb.append("2099-12-31");
|
||||||
|
} else {
|
||||||
|
if (merchantBaseInfo.getBussauthendtime().contains("年")) {
|
||||||
|
endSb.append(merchantBaseInfo.getBussauthendtime().substring(0, 4));
|
||||||
|
endSb.append("-");
|
||||||
|
endSb.append(merchantBaseInfo.getBussauthendtime().substring(5, 7));
|
||||||
|
endSb.append("-");
|
||||||
|
endSb.append(merchantBaseInfo.getBussauthendtime().substring(8, 10));
|
||||||
|
} else {
|
||||||
|
endSb.append(merchantBaseInfo.getBussauthendtime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonObject.put("licenseDtStart", startSb); //营业执照开始时间⼩微商户可不传, 其他必传,格式yyyy-MM-dd
|
||||||
|
jsonObject.put("licenseDtEnd", endSb); //⼩微商户可不传, 其他必传,格式yyyy-MM-dd
|
||||||
|
|
||||||
|
|
||||||
|
AttchmentsVo business_licence = new AttchmentsVo(); //图片set
|
||||||
|
business_licence.setId(laKaLaFileUpload(businessLicence, "BUSINESS_LICENCE"));//营业执照
|
||||||
|
business_licence.setType("BUSINESS_LICENCE");//营业执照
|
||||||
|
attchmentsVoSet.add(business_licence);
|
||||||
|
|
||||||
|
//开户许可证
|
||||||
|
AttchmentsVo opening_permit = new AttchmentsVo(); //图片set
|
||||||
|
|
||||||
|
opening_permit.setId(laKaLaFileUpload(openingPermit, "OPENING_PERMIT"));//开户许可证
|
||||||
|
opening_permit.setType("OPENING_PERMIT");//开户许可证
|
||||||
|
attchmentsVoSet.add(opening_permit);
|
||||||
|
Map<String, Object> data = new HashMap<>();
|
||||||
|
data.put("customerName", merchantBaseInfo.getMerchantname());
|
||||||
|
data.put("licenseNo", merchantBaseInfo.getBussauthnum());
|
||||||
|
data.put("legalName", idCardVO.getCertname());
|
||||||
|
data.put("licenseName", merchantBaseInfo.getMerchantname());
|
||||||
|
data.put("identityNo", idCardVO.getCertno());
|
||||||
|
data.put("address", merchantBaseInfo.getProvince().concat(merchantBaseInfo.getCity()).concat(merchantBaseInfo.getDistrict()));
|
||||||
|
data.put("receiveDetail", merchantBaseInfo.getProvince().concat(merchantBaseInfo.getCity()).concat(merchantBaseInfo.getDistrict()).concat(merchantBaseInfo.getAddress()));
|
||||||
|
data.put("identityNoExpire", endSb);
|
||||||
|
data.put("accountName", bankCardVO.getBankholder());
|
||||||
|
data.put("accountIdCard", idCardVO.getCertno());
|
||||||
|
data.put("accountNo", bankCardVO.getBankcardno());
|
||||||
|
|
||||||
|
data.put("accountIdDtEnd", idCardVO.getCertendtime().equals("长期") ? "2099-12-31" : DateUtils.convertString(idCardVO.getCertendtime()));
|
||||||
|
data.put("bankName", bankCardVO.getBankname());
|
||||||
|
data.put("mail", "chaozhanggui2023@163.com");
|
||||||
|
data.put("contactManName", bankCardVO.getPhone());
|
||||||
|
data.put("channelType", ObjectUtils.isEmpty(mccReflect) ? "7399" : mccReflect.getMccCode());
|
||||||
|
data.put("phone", bankCardVO.getPhone());
|
||||||
|
data.put("agencyName", merchantBaseInfo.getMerchantname());
|
||||||
|
//协议
|
||||||
|
AttchmentsVo agree_ment = new AttchmentsVo(); //图片set
|
||||||
|
agree_ment.setId(laKaLaFileUpload(HtmlUtil.createAgreementPicture(HtmlUtil.writeHtml(data)),"AGREE_MENT"));//协议
|
||||||
|
agree_ment.setType("AGREE_MENT");//协议
|
||||||
|
attchmentsVoSet.add(agree_ment);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public static String laKaLaFileUpload(String url1, String type) {
|
||||||
|
String url = "https://htkactvi.lakala.com/registration/file/upload";
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
URI uri = null;
|
||||||
|
try {
|
||||||
|
uri = new URI(url1);
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
RestTemplate restTemplate1 = new RestTemplate();
|
||||||
|
ResponseEntity<byte[]> exchange = restTemplate1.exchange(uri, HttpMethod.GET, null, byte[].class);
|
||||||
|
MultipartFile file1 = new MockMultipartFile("file", exchange.getBody());
|
||||||
|
File file = convert(file1);
|
||||||
|
|
||||||
|
params.put("file", file);
|
||||||
|
params.put("imgType", type);
|
||||||
|
params.put("sourcechnl", "0");
|
||||||
|
params.put("isOcr", "false");
|
||||||
|
|
||||||
|
Map token = getToken();
|
||||||
|
String result = HttpRequest.post(url)
|
||||||
|
.header("Authorization", "bearer " + token.get("access_token"))
|
||||||
|
.form(params).execute().body();
|
||||||
|
Map parse = (Map) JSONArray.parse(result);
|
||||||
|
log.info("拉卡拉图片上传返回信息:{}", result);
|
||||||
|
return parse.get("url").toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
public static String laKaLaFileUpload(File file, String type) {
|
||||||
|
String url = "https://htkactvi.lakala.com/registration/file/upload";
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
|
||||||
|
params.put("file", file);
|
||||||
|
params.put("imgType", type);
|
||||||
|
params.put("sourcechnl", "0");
|
||||||
|
params.put("isOcr", "false");
|
||||||
|
|
||||||
|
Map token = getToken();
|
||||||
|
String result = HttpRequest.post(url)
|
||||||
|
.header("Authorization", "bearer " + token.get("access_token"))
|
||||||
|
.form(params).execute().body();
|
||||||
|
Map parse = (Map) JSONArray.parse(result);
|
||||||
|
log.info("拉卡拉图片上传返回信息:{}", result);
|
||||||
|
return parse.get("url").toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static File convert(MultipartFile multipartFile) throws IOException {
|
||||||
|
InputStream inputStream = multipartFile.getInputStream();
|
||||||
|
File file = File.createTempFile(ObjectUtil.isEmpty(multipartFile.getOriginalFilename()) ? System.currentTimeMillis() + "" : multipartFile.getOriginalFilename(), ".png");
|
||||||
|
FileOutputStream outputStream = new FileOutputStream(file);
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int bytesRead = 0;
|
||||||
|
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||||
|
outputStream.write(buffer, 0, bytesRead);
|
||||||
|
}
|
||||||
|
outputStream.close();
|
||||||
|
file.deleteOnExit();
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map getToken() {
|
||||||
|
RestTemplate client = new RestTemplate();
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
// 表单提交
|
||||||
|
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
||||||
|
headers.set("Authorization", "Basic " + getBase64());
|
||||||
|
// 封装参数
|
||||||
|
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
|
||||||
|
params.add("grant_type", grant_type);
|
||||||
|
params.add("client_id", client_id);
|
||||||
|
params.add("client_secret", client_secret);
|
||||||
|
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
|
||||||
|
// 执行HTTP请求
|
||||||
|
ResponseEntity<String> response = client.exchange("https://tkapi.lakala.com/auth/oauth/token", HttpMethod.POST, requestEntity, String.class);
|
||||||
|
|
||||||
|
Map map = (Map) JSONArray.parse(response.getBody());
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getBase64() {
|
||||||
|
|
||||||
|
String encodeBase64String = org.apache.commons.codec.binary.Base64.encodeBase64String((client_id + ":" + client_secret).getBytes());
|
||||||
|
|
||||||
|
return encodeBase64String;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,430 @@
|
||||||
|
package com.chaozhanggui.system.lkl.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.chaozhanggui.common.system.config.MsgException;
|
||||||
|
import com.chaozhanggui.common.system.util.DateUtils;
|
||||||
|
import com.chaozhanggui.system.lkl.config.LakalaConfig;
|
||||||
|
import com.chaozhanggui.system.lkl.model.*;
|
||||||
|
import com.chaozhanggui.system.lkl.util.StringUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class OrderPayService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
LakalaConfig lakalaConfig;
|
||||||
|
|
||||||
|
private static long changeY2F(double price) {
|
||||||
|
DecimalFormat df = new DecimalFormat("#.00");
|
||||||
|
price = Double.valueOf(df.format(price));
|
||||||
|
long money = (long)(price * 100);
|
||||||
|
return money;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被扫
|
||||||
|
* @param orderVO
|
||||||
|
* @param statusVO
|
||||||
|
* @param baseInfoVO
|
||||||
|
* @param merchantBackLklVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public JSONObject tradePay(MerchantOrderVO orderVO, MerchantChannelStatusVO statusVO, MerchantBaseInfoVO baseInfoVO, MerchantBackLklVO merchantBackLklVO){
|
||||||
|
|
||||||
|
MsgException.checkNull(orderVO, "订单信息为空");
|
||||||
|
MsgException.checkNull(statusVO, "进件信息为空");
|
||||||
|
MsgException.checkNull(baseInfoVO, "商户基本信息为空");
|
||||||
|
MsgException.checkNull(merchantBackLklVO, "拉卡拉渠道信息为空");
|
||||||
|
String account_type = "WECHAT";
|
||||||
|
if (ObjectUtil.isNotEmpty(orderVO.getScanType()) && "01".equals(orderVO.getScanType())) {
|
||||||
|
account_type = "wechatPay".equals(orderVO.getPaytypecode()) ? "WECHAT" : "aliPay".equals(orderVO.getPaytypecode()) ? "ALIPAY" : "UQRCODEPAY";
|
||||||
|
} else {
|
||||||
|
account_type = "wechatPay".equals(orderVO.getPaytypecode()) ? "WECHAT" : "aliPay".equals(orderVO.getPaytypecode()) ? "ALIPAY" : "UQRCODEPAY";
|
||||||
|
}
|
||||||
|
String transType = account_type.equals("WECHAT") ? "71" : account_type.equals("ALIPAY") ? "41" : "51";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
String req_time = DateUtils.getSdfTimes();
|
||||||
|
|
||||||
|
Long order_amt = changeY2F(orderVO.getConsumefee());
|
||||||
|
String body = null;
|
||||||
|
if (account_type.equals("WECHAT")) {
|
||||||
|
body="{\n" +
|
||||||
|
"\t\"out_org_code\": \""+lakalaConfig.getAppid()+"\",\n" +
|
||||||
|
"\t\"req_data\": {\n" +
|
||||||
|
"\t\t\"acc_busi_fields\": {\n" +
|
||||||
|
"\t\t\t\"user_id\": \""+orderVO.getMercuserid()+"\",\n" +
|
||||||
|
"\t\t\t\"sub_appid\": \""+lakalaConfig.getAppletsAppid()+"\"\n" +
|
||||||
|
"\t\t},\n" +
|
||||||
|
"\t\t\"account_type\": \""+account_type+"\",\n" +
|
||||||
|
"\t\t\"location_info\": {\n" +
|
||||||
|
"\t\t\t\"request_ip\": \""+orderVO.getIp()+"\"\n" +
|
||||||
|
"\t\t},\n" +
|
||||||
|
"\t\t\"merchant_no\": \""+merchantBackLklVO.getExternalCustomerNo()+"\",\n" +
|
||||||
|
"\t\t\"notify_url\": \""+lakalaConfig.getCallBackUrl()+"\",\n" +
|
||||||
|
"\t\t\"out_trade_no\": \""+orderVO.getOrdernumber()+"\",\n" +
|
||||||
|
"\t\t\"term_no\": \""+merchantBackLklVO.getTermNos()+"\",\n" +
|
||||||
|
"\t\t\"total_amount\": \""+order_amt+"\",\n" +
|
||||||
|
"\t\t\"trans_type\": \""+transType+"\"\n" +
|
||||||
|
"\t},\n" +
|
||||||
|
"\t\"req_time\": \""+req_time+"\",\n" +
|
||||||
|
"\t\"version\": \"3.0\"\n" +
|
||||||
|
"}";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (account_type.equals("ALIPAY")) {
|
||||||
|
body = "{\n" +
|
||||||
|
"\t\"out_org_code\": \"" + lakalaConfig.getAppid() + "\",\n" +
|
||||||
|
"\t\"req_data\": {\n" +
|
||||||
|
"\t\t\"account_type\": \"" + account_type + "\",\n" +
|
||||||
|
"\t\t\"location_info\": {\n" +
|
||||||
|
"\t\t\t\"request_ip\": \"" + orderVO.getIp() + "\"\n" +
|
||||||
|
"\t\t},\n" +
|
||||||
|
"\t\t\"merchant_no\": \"" + merchantBackLklVO.getExternalCustomerNo() + "\",\n" +
|
||||||
|
"\t\t\"notify_url\": \"" + lakalaConfig.getCallBackUrl() + "\",\n" +
|
||||||
|
"\t\t\"out_trade_no\": \"" + orderVO.getOrdernumber() + "\",\n" +
|
||||||
|
"\t\t\"term_no\": \"" + merchantBackLklVO.getTermNos() + "\",\n" +
|
||||||
|
"\t\t\"total_amount\": \"" + order_amt + "\",\n" +
|
||||||
|
"\t\t\"trans_type\": \"" + transType + "\"\n" +
|
||||||
|
"\t},\n" +
|
||||||
|
"\t\"req_time\": \"" + req_time + "\",\n" +
|
||||||
|
"\t\"version\": \"3.0\"\n" +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String response = lakalaConfig.request(body, "api/v3/labs/trans/preorder");
|
||||||
|
|
||||||
|
|
||||||
|
JSONObject resp = new JSONObject();
|
||||||
|
if (ObjectUtil.isNotEmpty(response)) {
|
||||||
|
JSONObject payData = new JSONObject();
|
||||||
|
JSONObject object = JSONObject.parseObject(response);
|
||||||
|
|
||||||
|
if (object.containsKey("code") && "BBS00000".equals(object.getString("code"))) {
|
||||||
|
if (!(ObjectUtil.isNotEmpty(orderVO.getScanType()) && "01".equals(orderVO.getScanType()))) {
|
||||||
|
JSONObject acc_resp_fields = object.getJSONObject("resp_data").getJSONObject("acc_resp_fields");
|
||||||
|
if (Constant.PAY_TYPE_ALIPAY.equals(orderVO.getPaytypecode())) {
|
||||||
|
payData.put("source", acc_resp_fields.getString("code"));
|
||||||
|
} else if (Constant.PAY_TYPE_WECHAT.equals(orderVO.getPaytypecode())) {
|
||||||
|
|
||||||
|
payData.put("payAppId", acc_resp_fields.getString("app_id"));
|
||||||
|
payData.put("payTimeStamp", acc_resp_fields.getString("time_stamp"));
|
||||||
|
payData.put("paynonceStr", acc_resp_fields.getString("nonce_str"));
|
||||||
|
payData.put("payPackage", acc_resp_fields.getString("package"));
|
||||||
|
payData.put("paySignType", acc_resp_fields.getString("sign_type"));
|
||||||
|
payData.put("paySign", acc_resp_fields.getString("pay_sign"));
|
||||||
|
} else {
|
||||||
|
payData.put("redirectUrl", acc_resp_fields.containsKey("redirect_url") ? acc_resp_fields.getString("redirect_url") : null);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
payData.put("payUrl", object.get("code"));
|
||||||
|
payData.put("orderNumber", orderVO.getOrdernumber());
|
||||||
|
payData.put("mercOrderNo", orderVO.getMercorderno());
|
||||||
|
}
|
||||||
|
resp.put("code", 200);
|
||||||
|
payData.put("channel", statusVO.getChannel());
|
||||||
|
payData.put("transNo",(object.getJSONObject("resp_data").containsKey("log_no") && ObjectUtil.isNotEmpty(object.getJSONObject("resp_data").getString("log_no"))) ? object.getString("log_no") : "");
|
||||||
|
resp.put("payData", payData);
|
||||||
|
return resp;
|
||||||
|
|
||||||
|
} else if (object.containsKey("code") && "BBS16270".equals(object.getString("code"))) {
|
||||||
|
resp.put("code", 400);
|
||||||
|
resp.put("msg", object.getString("msg"));
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
resp.put("code", 400);
|
||||||
|
resp.put("msg", "失败");
|
||||||
|
return resp;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主扫
|
||||||
|
* @param orderVO
|
||||||
|
* @param baseInfoVO
|
||||||
|
* @param merchantBackLklVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public JSONObject tradePay(MerchantOrderVO orderVO, MerchantBaseInfoVO baseInfoVO, MerchantBackLklVO merchantBackLklVO){
|
||||||
|
|
||||||
|
MsgException.checkNull(orderVO, "订单信息为空");
|
||||||
|
MsgException.checkNull(baseInfoVO, "商户基本信息为空");
|
||||||
|
MsgException.checkNull(merchantBackLklVO, "拉卡拉渠道信息为空");
|
||||||
|
|
||||||
|
JSONObject obj = new JSONObject(6);
|
||||||
|
|
||||||
|
String req_time = DateUtils.getSdfTimes();
|
||||||
|
Long order_amt = changeY2F(orderVO.getConsumefee());
|
||||||
|
|
||||||
|
String body = "{\n" +
|
||||||
|
"\t\"req_data\": {\n" +
|
||||||
|
"\t\t\"merchant_no\": \"" + merchantBackLklVO.getExternalCustomerNo() + "\",\n" +
|
||||||
|
"\t\t\"term_no\": \"" + merchantBackLklVO.getTermNos() + "\",\n" +
|
||||||
|
"\t\t\"out_trade_no\": \"" + orderVO.getOrdernumber() + "\",\n" +
|
||||||
|
"\t\t\"total_amount\": \"" + order_amt + "\",\n" +
|
||||||
|
"\t\t\"subject\": \"" + baseInfoVO.getMccname() + "\",\n" +
|
||||||
|
"\t\t\"acc_busi_fields\": {},\n" +
|
||||||
|
"\t\t\"notify_url\": \"" + lakalaConfig.getCallBackUrl() + "\",\n" +
|
||||||
|
"\t\t\"location_info\": {\n" +
|
||||||
|
"\t\t\t\"request_ip\": \"" + orderVO.getIp() + "\"\n" +
|
||||||
|
"\t\t},\n" +
|
||||||
|
"\t\t\"auth_code\": \"" + orderVO.getAuthCode() + "\"\n" +
|
||||||
|
"\t},\n" +
|
||||||
|
"\t\"out_org_code\": \"" + lakalaConfig.getAppid() + "\",\n" +
|
||||||
|
"\t\"version\": \"3.0\",\n" +
|
||||||
|
"\t\"req_time\": " + req_time + "\n" +
|
||||||
|
"}";
|
||||||
|
|
||||||
|
|
||||||
|
String response = lakalaConfig.request(body, "api/v3/labs/trans/micropay");
|
||||||
|
if (ObjectUtil.isNotEmpty(response)) {
|
||||||
|
JSONObject object = JSON.parseObject(response);
|
||||||
|
if (object.containsKey("code") && "BBS10000".equals(object.get("code"))) {
|
||||||
|
obj.put("code", 202);
|
||||||
|
obj.put("msg", "用户支付中");
|
||||||
|
obj.put("channelOrderNo", object.getJSONObject("resp_data").get("trade_no"));
|
||||||
|
obj.put("transNo", object.getJSONObject("resp_data").get("log_no"));
|
||||||
|
obj.put("payStatus", "7");
|
||||||
|
return obj;
|
||||||
|
} else if (object.containsKey("code") && "BBS00000".equals(object.get("code"))) {
|
||||||
|
obj.put("code", 200);
|
||||||
|
obj.put("msg", "成功");
|
||||||
|
obj.put("channelOrderNo", object.getJSONObject("resp_data").get("trade_no"));
|
||||||
|
obj.put("transNo", object.getJSONObject("resp_data").get("log_no"));
|
||||||
|
obj.put("payStatus", "1");
|
||||||
|
obj.put("payTime", DateUtils.convertDate(object.getJSONObject("resp_data").getString("trade_time")));
|
||||||
|
return obj;
|
||||||
|
} else {
|
||||||
|
obj.put("code", 400);
|
||||||
|
obj.put("msg", object.get("msg"));
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
obj.put("code", 400);
|
||||||
|
obj.put("msg", "失败");
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款
|
||||||
|
* @param orderVO
|
||||||
|
* @param merchantBackLklVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Map<String, Object> refundPay(MerchantOrderVO orderVO,MerchantBackLklVO merchantBackLklVO){
|
||||||
|
|
||||||
|
|
||||||
|
MsgException.checkNull(orderVO, "订单信息为空");
|
||||||
|
MsgException.checkNull(merchantBackLklVO, "拉卡拉渠道信息为空");
|
||||||
|
|
||||||
|
String req_time = DateUtils.getSdfTimes();
|
||||||
|
Long order_amt = changeY2F(orderVO.getConsumefee());
|
||||||
|
|
||||||
|
|
||||||
|
String refundNo = "LKLR" + StringUtil.getBillno();
|
||||||
|
|
||||||
|
String body="{\n" +
|
||||||
|
" \"req_time\":\""+req_time+"\",\n" +
|
||||||
|
" \"version\":\"3.0\",\n" +
|
||||||
|
" \"out_org_code\":\""+lakalaConfig.getAppid()+"\",\n" +
|
||||||
|
" \"req_data\":{\n" +
|
||||||
|
" \"merchant_no\":\""+merchantBackLklVO.getExternalCustomerNo()+"\",\n" +
|
||||||
|
" \"term_no\":\""+merchantBackLklVO.getTermNos()+"\",\n" +
|
||||||
|
" \"out_trade_no\":\""+refundNo+"\",\n" +
|
||||||
|
" \"refund_amount\":\""+order_amt+"\",\n" +
|
||||||
|
" \"refund_reason\":\"退款\",\n" +
|
||||||
|
" \"origin_out_trade_no\":\""+orderVO.getOrdernumber()+"\",\n" +
|
||||||
|
" \"location_info\":{\n" +
|
||||||
|
" \"request_ip\":\""+orderVO.getIp()+"\",\n" +
|
||||||
|
" \"location\":\"+37.123456789,-121.123456789\"\n" +
|
||||||
|
" }\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}\n" +
|
||||||
|
"\n";
|
||||||
|
|
||||||
|
Map<String, Object> result = new HashMap<>(4);
|
||||||
|
result.put("refundNo", refundNo);
|
||||||
|
result.put("status", "3");
|
||||||
|
result.put("code", 400);
|
||||||
|
|
||||||
|
String response = lakalaConfig.request(body, "api/v3/labs/relation/refund");
|
||||||
|
if(ObjectUtil.isNotEmpty(response)){
|
||||||
|
JSONObject object=JSONObject.parseObject(response);
|
||||||
|
if(object.containsKey("code")&&"BBS00000".equals(object.getString("code"))){
|
||||||
|
result.put("msg", "退款成功!");
|
||||||
|
result.put("data", object.getJSONObject("resp_data"));
|
||||||
|
result.put("status", "1");
|
||||||
|
result.put("code", 200);
|
||||||
|
return result;
|
||||||
|
}else {
|
||||||
|
result.put("msg", object.getString("msg"));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.put("msg", "退款失败!");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单查询
|
||||||
|
* @param orderVO
|
||||||
|
* @param merchantBackLklVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public JSONObject tradeQuery(MerchantOrderVO orderVO, MerchantBackLklVO merchantBackLklVO) {
|
||||||
|
|
||||||
|
MsgException.checkNull(orderVO, "订单信息为空");
|
||||||
|
MsgException.checkNull(merchantBackLklVO, "拉卡拉渠道信息为空");
|
||||||
|
|
||||||
|
String req_time = DateUtils.getSdfTimes();
|
||||||
|
|
||||||
|
String body = "{\n" +
|
||||||
|
"\"req_time\":\"" + req_time + "\",\n" +
|
||||||
|
"\"version\":\"3.0\",\n" +
|
||||||
|
"\"out_org_code\":\"" + lakalaConfig.getAppid() + "\",\n" +
|
||||||
|
"\"req_data\":{\n" +
|
||||||
|
"\"merchant_no\":\"" + merchantBackLklVO.getExternalCustomerNo() + "\",\n" +
|
||||||
|
"\"term_no\":\"" + merchantBackLklVO.getTermNos() + "\",\n" +
|
||||||
|
"\"out_trade_no\":\"" + orderVO.getOrdernumber() + "\"\n" +
|
||||||
|
"}\n" +
|
||||||
|
"}\n";
|
||||||
|
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
String response = lakalaConfig.request(body, "api/v3/labs/query/tradequery");
|
||||||
|
if (ObjectUtil.isNotEmpty(response)) {
|
||||||
|
JSONObject object = JSONObject.parseObject(response);
|
||||||
|
if (object.containsKey("code") && "BBS00000".equals(object.getString("code"))) {
|
||||||
|
result.put("channelOrderNo", object.get("trade_no"));
|
||||||
|
result.put("payTime", DateUtils.parse(object.getString("trade_time"), "yyyyMMddHHmmss"));
|
||||||
|
result.put("transNo", object.get("log_no"));
|
||||||
|
result.put("code", 200);
|
||||||
|
result.put("payStatus", "1");
|
||||||
|
result.put("msg", "查询成功!");
|
||||||
|
result.put("buyerId", object.get("user_id1"));
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
result.put("code", 400);
|
||||||
|
result.put("msg", object.getString("msg"));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.error("==============>【拉卡拉】交易订单查询失败<==================");
|
||||||
|
result.put("code", 400);
|
||||||
|
result.put("msg", "订单查询异常");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public JSONObject refundQuery(MerchantOrderVO orderVO,MerchantBackLklVO merchantBackLklVO) {
|
||||||
|
|
||||||
|
MsgException.checkNull(orderVO, "订单信息为空");
|
||||||
|
MsgException.checkNull(merchantBackLklVO, "拉卡拉渠道信息为空");
|
||||||
|
|
||||||
|
|
||||||
|
String req_time = DateUtils.getSdfTimes();
|
||||||
|
|
||||||
|
String body="{\n" +
|
||||||
|
" \"req_time\":\""+req_time+"\",\n" +
|
||||||
|
" \"version\":\"3.0\",\n" +
|
||||||
|
" \"out_org_code\":\""+lakalaConfig.getAppid()+"\",\n" +
|
||||||
|
" \"req_data\":{\n" +
|
||||||
|
" \"merchant_no\":\""+merchantBackLklVO.getExternalCustomerNo()+"\",\n" +
|
||||||
|
" \"term_no\":\""+merchantBackLklVO.getTermNos()+"\",\n" +
|
||||||
|
" \"out_refund_order_no\":\""+orderVO.getRefundNo()+"\"\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}\n" +
|
||||||
|
"\n";
|
||||||
|
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
String response = lakalaConfig.request(body, "api/v3/labs/query/idmrefundquery");
|
||||||
|
if (ObjectUtil.isNotEmpty(response)) {
|
||||||
|
JSONObject object = JSONObject.parseObject(response);
|
||||||
|
if (object.containsKey("code") && "BBS00000".equals(object.getString("code"))) {
|
||||||
|
result.put("refundTime", object.getString("trade_time"));
|
||||||
|
result.put("code", 200);
|
||||||
|
result.put("status", "1");
|
||||||
|
result.put("msg", "查询成功!");
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
result.put("code", 400);
|
||||||
|
result.put("msg", object.getString("msg"));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.error("==============>【拉卡拉】交易订单查询失败<==================");
|
||||||
|
result.put("code", 400);
|
||||||
|
result.put("msg", "退款订单查询异常");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信获取用户标识
|
||||||
|
* @param userAuthCode
|
||||||
|
* @param paymentApp
|
||||||
|
* @param merchantBackLklVO
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public Map<String, Object> getUnionInfo(String userAuthCode, String paymentApp,MerchantBackLklVO merchantBackLklVO) throws Exception {
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
String req_time = DateUtils.getSdfTimes();
|
||||||
|
|
||||||
|
MsgException.checkNull(merchantBackLklVO, "拉卡拉渠道信息为空");
|
||||||
|
|
||||||
|
String body = "{\n" +
|
||||||
|
"\"ver\":\"1.0.0\",\n" +
|
||||||
|
"\"timestamp\":\"" + System.currentTimeMillis() + "\",\n" +
|
||||||
|
"\"reqId\":\"" + req_time + "\",\n" +
|
||||||
|
"\"reqData\":{\n" +
|
||||||
|
"\"mercId\":\"" + merchantBackLklVO.getExternalCustomerNo() + "\",\n" +
|
||||||
|
"\"termNo\":\"" + merchantBackLklVO.getTermNos() + "\",\n" +
|
||||||
|
"\"authCode\":\"" + userAuthCode + "\",\n" +
|
||||||
|
"\"tradeCode\":\"030304\"\n" +
|
||||||
|
"}\n" +
|
||||||
|
"}\n";
|
||||||
|
String response = lakalaConfig.request(body, "api/v2/saas/query/wx_openid_query");
|
||||||
|
if (ObjectUtil.isNotEmpty(response)) {
|
||||||
|
JSONObject object = JSONObject.parseObject(response);
|
||||||
|
if (object.containsKey("retCode") && "BBS00000".equals(object.getString("retCode"))) {
|
||||||
|
|
||||||
|
JSONObject reqData = new JSONObject(2);
|
||||||
|
reqData.put("data", object.getJSONObject("respData").getString("openId"));
|
||||||
|
reqData.put("userAuthCode", userAuthCode);
|
||||||
|
reqData.put("appUpIdentifier", paymentApp);
|
||||||
|
result.put("data", reqData);
|
||||||
|
result.put("code", "1");
|
||||||
|
result.put("msg", "获取成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.put("code","0");
|
||||||
|
result.put("msg", "获取失败");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,129 @@
|
||||||
|
package com.chaozhanggui.system.lkl.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import freemarker.template.Template;
|
||||||
|
import freemarker.template.TemplateException;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.coobird.thumbnailator.Thumbnails;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class HtmlUtil {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
FreeMarkerConfigurer freeMarkerConfigurer;
|
||||||
|
static Template template =null;
|
||||||
|
|
||||||
|
|
||||||
|
public void initHtml(){
|
||||||
|
try {
|
||||||
|
template = freeMarkerConfigurer.getConfiguration().getTemplate("indexHTKWECHAT_PAY.html");
|
||||||
|
|
||||||
|
System.out.println(template.getName());
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//html 替换占位符
|
||||||
|
public static File writeHtml(Map<String, Object> data) throws IOException, TemplateException {
|
||||||
|
String fileName = UUID.randomUUID().toString();
|
||||||
|
File htmlFile = new File(FileUtil.getTmpDir(), fileName + ".html");
|
||||||
|
FileWriter sw = new FileWriter(htmlFile);
|
||||||
|
log.info("生成协议html, 地址:{}, 参数:{} ", htmlFile.getAbsolutePath(), data);
|
||||||
|
template.process(data, sw);
|
||||||
|
return htmlFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//html 转png 示例代码
|
||||||
|
public static File createAgreementPicture(File htmlFile) throws IOException {
|
||||||
|
File outputFile = new File(FileUtil.getTmpDir(), htmlFile.getName() + ".jpg");
|
||||||
|
log.info("生成图片开始, HTML地址 {}, 图片地址:{}", htmlFile.getAbsolutePath(), outputFile.getAbsolutePath());
|
||||||
|
String commandProcess = "wkhtmltoimage --width 400 --quality 94 " + htmlFile.getPath() + " " + outputFile.getPath();
|
||||||
|
log.info("协议执行procommand:{}", commandProcess);
|
||||||
|
long startTime = System.currentTimeMillis(); //获取开始时间
|
||||||
|
Process process = Runtime.getRuntime().exec(commandProcess);
|
||||||
|
try {
|
||||||
|
int exitVal = process.waitFor();
|
||||||
|
log.info("协议html转换png结果:{}", exitVal);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.info("协议html转换png错误:{}", e.getMessage());
|
||||||
|
throw new IOException(e);
|
||||||
|
}
|
||||||
|
long endTime = System.currentTimeMillis(); //获取结束时间
|
||||||
|
log.info("程序运行时间: " + (endTime - startTime) + "ms");
|
||||||
|
log.info("生成图片结束,地址: {}", outputFile.getPath());
|
||||||
|
Thumbnails.of(outputFile).scale(1).outputQuality(0.9).toFile(outputFile);
|
||||||
|
return outputFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 合并两张图片示例代码
|
||||||
|
public BufferedImage mergeImage(BufferedImage img1, BufferedImage img2, boolean isHorizontal) throws IOException {
|
||||||
|
int w1 = img1.getWidth();
|
||||||
|
int h1 = img1.getHeight();
|
||||||
|
int w2 = img2.getWidth();
|
||||||
|
int h2 = img2.getHeight();
|
||||||
|
// 从图片中读取RGB
|
||||||
|
int[] ImageArrayOne = new int[w1 * h1];
|
||||||
|
ImageArrayOne = img1.getRGB(0, 0, w1, h1, ImageArrayOne, 0, w1); // 逐行扫描图像中各个像素的RGB到数组中
|
||||||
|
int[] ImageArrayTwo = new int[w2 * h2];
|
||||||
|
ImageArrayTwo = img2.getRGB(0, 0, w2, h2, ImageArrayTwo, 0, w2);
|
||||||
|
// 生成新图片
|
||||||
|
BufferedImage DestImage = null;
|
||||||
|
if (isHorizontal) { // 水平方向合并
|
||||||
|
// DestImage = new BufferedImage(w1+w2, h1, BufferedImage.TYPE_INT_RGB);
|
||||||
|
Graphics2D g2d = null;
|
||||||
|
if (h1 >= h2) {
|
||||||
|
DestImage = new BufferedImage(w1 + w2, h1, BufferedImage.TYPE_INT_RGB);
|
||||||
|
g2d = DestImage.createGraphics();
|
||||||
|
g2d.setPaint(Color.WHITE);
|
||||||
|
g2d.fillRect(0, 0, w1 + w2, h1);
|
||||||
|
g2d.dispose();
|
||||||
|
} else {
|
||||||
|
DestImage = new BufferedImage(w2, h1, BufferedImage.TYPE_INT_RGB);// TYPE_INT_RGB
|
||||||
|
g2d = DestImage.createGraphics();
|
||||||
|
g2d.setPaint(Color.WHITE);
|
||||||
|
g2d.fillRect(0, 0, w2 + w1, h1);
|
||||||
|
g2d.dispose();
|
||||||
|
}
|
||||||
|
DestImage.setRGB(0, 0, w1, h1, ImageArrayOne, 0, w1); // 设置上半部分或左半部分的RGB
|
||||||
|
DestImage.setRGB(w1, 0, w2, h2, ImageArrayTwo, 0, w2);
|
||||||
|
} else { // 垂直方向合并
|
||||||
|
Graphics2D g2d = null;
|
||||||
|
if (w1 >= w2) {
|
||||||
|
DestImage = new BufferedImage(w1, h1 + h2, BufferedImage.TYPE_INT_RGB);// TYPE_INT_RGB
|
||||||
|
g2d = DestImage.createGraphics();
|
||||||
|
g2d.setPaint(Color.WHITE);
|
||||||
|
g2d.fillRect(0, 0, w1 + w2, h1 + h2);
|
||||||
|
g2d.dispose();
|
||||||
|
} else {
|
||||||
|
DestImage = new BufferedImage(w2, h1 + h2, BufferedImage.TYPE_INT_RGB);// TYPE_INT_RGB
|
||||||
|
g2d = DestImage.createGraphics();
|
||||||
|
g2d.setPaint(Color.WHITE);
|
||||||
|
g2d.fillRect(0, 0, w2 + w1, h1 + h2);
|
||||||
|
g2d.dispose();
|
||||||
|
}
|
||||||
|
DestImage.setRGB(0, 0, w1, h1, ImageArrayOne, 0, w1); // 设置上半部分或左半部分的RGB
|
||||||
|
DestImage.setRGB(0, h1, w2, h2, ImageArrayTwo, 0, w2); // 设置下半部分的RGB
|
||||||
|
}
|
||||||
|
return DestImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,407 @@
|
||||||
|
package com.chaozhanggui.system.lkl.util;
|
||||||
|
|
||||||
|
import cn.hutool.crypto.digest.MD5;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
||||||
|
public class StringUtil extends StringUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据身份证号获取性别
|
||||||
|
*
|
||||||
|
* @param certNo 身份证号
|
||||||
|
* @return 0 男;1 女
|
||||||
|
*/
|
||||||
|
public static String getSexFromCertNo(String certNo) {
|
||||||
|
String in17 = String.valueOf(certNo.charAt(16));
|
||||||
|
int intIn17 = Integer.parseInt(in17);
|
||||||
|
return (intIn17 % 2) >= 1 ? "0" : "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String letterChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
|
||||||
|
public static String random6() {
|
||||||
|
Random random = new Random();
|
||||||
|
String result = "";
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
|
result += random.nextInt(10);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String random6V2() {
|
||||||
|
return new MD5().digestHex(UUID.randomUUID().toString()).substring(0, 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String random(int length) {
|
||||||
|
Random random = new Random();
|
||||||
|
String result = "";
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
result += random.nextInt(10);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//生产随机8位userCode
|
||||||
|
public static String genRandomNum() {
|
||||||
|
int maxNum = 36;
|
||||||
|
int i;
|
||||||
|
int count = 0;
|
||||||
|
char[] str = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
|
||||||
|
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
|
||||||
|
'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
|
||||||
|
StringBuffer pwd = new StringBuffer("");
|
||||||
|
Random r = new Random();
|
||||||
|
while (count < 8) {
|
||||||
|
i = Math.abs(r.nextInt(maxNum));
|
||||||
|
if (i >= 0 && i < str.length) {
|
||||||
|
pwd.append(str[i]);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pwd.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
//生成指定长度的随机数
|
||||||
|
public static String genRandomNum(int length) {
|
||||||
|
int maxNum = 36;
|
||||||
|
int i;
|
||||||
|
int count = 0;
|
||||||
|
char[] str = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
|
||||||
|
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
|
||||||
|
'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
|
||||||
|
StringBuffer pwd = new StringBuffer("");
|
||||||
|
Random r = new Random();
|
||||||
|
while (count < length) {
|
||||||
|
i = Math.abs(r.nextInt(maxNum));
|
||||||
|
pwd.append(str[i]);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
return pwd.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String genUuid(){
|
||||||
|
return UUID.randomUUID().toString().replace("-","").toUpperCase(Locale.ROOT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成订单号
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static synchronized String getBillno() {
|
||||||
|
StringBuilder billno = new StringBuilder();
|
||||||
|
|
||||||
|
// 日期(格式:20080524)
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
||||||
|
billno.append(format.format(new Date()));
|
||||||
|
return billno.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isEmpty(Object content) {
|
||||||
|
if (content == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (content instanceof String) {
|
||||||
|
return "".equals(content);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String replaceNonLegalChar(String str) {
|
||||||
|
if (str == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
str = str.replace("(", "(");
|
||||||
|
str = str.replace(")", ")");
|
||||||
|
str = str.replaceAll("\\s*", "");
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isNotEmpty(Object content) {
|
||||||
|
return !isEmpty(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算分页数量
|
||||||
|
*
|
||||||
|
* @param count
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static int getPageCount(int count, int pageSize) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
int pageCount = 0;
|
||||||
|
if (count == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页长不能为0
|
||||||
|
if (pageSize == 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count % pageSize == 0) {
|
||||||
|
pageCount = count / pageSize;
|
||||||
|
} else {
|
||||||
|
pageCount = count / pageSize + 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
return pageCount;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算分页数量
|
||||||
|
*
|
||||||
|
* @param count
|
||||||
|
* @param pageSize
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static long getPageCount(long count, int pageSize) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
long pageCount = 0;
|
||||||
|
if (count == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 页长不能为0
|
||||||
|
if (pageSize == 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count % pageSize == 0) {
|
||||||
|
pageCount = count / pageSize;
|
||||||
|
} else {
|
||||||
|
pageCount = count / pageSize + 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
return pageCount;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean equals(String str1, String str2) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return str1 == null ? str2 == null : str1.equals(str2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回一个定长的随机纯字母字符串(只包含大小写字母)
|
||||||
|
*
|
||||||
|
* @param length 随机字符串长度
|
||||||
|
* @return 随机字符串
|
||||||
|
*/
|
||||||
|
public static String generateMixStr(int length) {
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
Random random = new Random();
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
sb.append(letterChar.charAt(random.nextInt(letterChar.length())));
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回日时分秒
|
||||||
|
*
|
||||||
|
* @param second
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String secondToTime(long second) {
|
||||||
|
long days = second / 86400;//转换天数
|
||||||
|
second = second % 86400;//剩余秒数
|
||||||
|
long hours = second / 3600;//转换小时数
|
||||||
|
second = second % 3600;//剩余秒数
|
||||||
|
long minutes = second / 60;//转换分钟
|
||||||
|
second = second % 60;//剩余秒数
|
||||||
|
String min = minutes + "";
|
||||||
|
if (minutes < 10) {
|
||||||
|
min = "0" + minutes;
|
||||||
|
}
|
||||||
|
String sec = second + "";
|
||||||
|
if (second < 10) {
|
||||||
|
sec = "0" + second;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 < days) {
|
||||||
|
return days + "";
|
||||||
|
} else {
|
||||||
|
return hours + "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double bigDecimal(Double d) {
|
||||||
|
if (d == null) {
|
||||||
|
return 0d;
|
||||||
|
}
|
||||||
|
return new BigDecimal(d).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double bigDecimal(Double d, RoundingMode roundingMode) {
|
||||||
|
if (d == null) {
|
||||||
|
return 0d;
|
||||||
|
}
|
||||||
|
return new BigDecimal(d).setScale(2, roundingMode).doubleValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String isHideMobile(String mobile) {
|
||||||
|
if (mobile.length() == 11) {
|
||||||
|
mobile = mobile.substring(0, 3) + "****" + mobile.substring(7);
|
||||||
|
}
|
||||||
|
return mobile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isNumber(String str) {
|
||||||
|
String regex = "^([0-9]+(.[0-9]{1,2})?)|(-[0-9]+(.[0-9]{1,2})?)$";
|
||||||
|
Pattern pattern = Pattern.compile(regex);
|
||||||
|
Matcher match = pattern.matcher(str);
|
||||||
|
// match.find()
|
||||||
|
return match.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隐藏隐私信息。
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String hideSecret(String param) {
|
||||||
|
int len = param.length();
|
||||||
|
if (isContainChinese(param)) {
|
||||||
|
String replaceValue = "**";
|
||||||
|
if (param.length() == 2) {
|
||||||
|
replaceValue = "*";
|
||||||
|
}
|
||||||
|
return param.replaceAll("(.{1})(.*)(.{0})", "$1" + replaceValue + "$3");
|
||||||
|
}
|
||||||
|
return param.replaceAll("(.{" + (len < 12 ? 3 : 6) + "})(.*)(.{4})", "$1" + "****" + "$3");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isContainChinese(String str) {
|
||||||
|
Pattern p = Pattern.compile("[\u4e00-\u9fa5]");
|
||||||
|
Matcher m = p.matcher(str);
|
||||||
|
if (m.find()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String buildPostForm(String baseUrl, Map<String, String> parameters) {
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
sb.append("<form name=\"punchout_form\" method=\"post\" action=\"");
|
||||||
|
sb.append(baseUrl);
|
||||||
|
sb.append("\">\n");
|
||||||
|
sb.append(buildHiddenFields(parameters));
|
||||||
|
sb.append("<input type=\"submit\" value=\"pay...\" style=\"display:none\" >\n");
|
||||||
|
sb.append("</form>\n");
|
||||||
|
sb.append("<script>document.forms[0].submit();</script>");
|
||||||
|
String form = sb.toString();
|
||||||
|
return form;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String buildHiddenFields(Map<String, String> parameters) {
|
||||||
|
if (parameters == null || parameters.isEmpty()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
Set<String> keys = parameters.keySet();
|
||||||
|
for (String key : keys) {
|
||||||
|
String value = parameters.get(key);
|
||||||
|
// 除去参数中的空值
|
||||||
|
if (key == null || value == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
sb.append("<input type=\"hidden\" name=\"");
|
||||||
|
sb.append(key);
|
||||||
|
|
||||||
|
sb.append("\" value=\"");
|
||||||
|
// 转义双引号
|
||||||
|
String a = value.replace("\"", """);
|
||||||
|
sb.append(a).append("\">\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param src
|
||||||
|
* @param replaceSrc 需要替换的字符
|
||||||
|
* @param replacementList 替换后的字符
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String replaceOneByOne(String src, String[] replaceSrc, String[] replacementList) {
|
||||||
|
if (replaceSrc == null) {
|
||||||
|
throw new IllegalArgumentException("replaceSrc 不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (replacementList == null) {
|
||||||
|
throw new IllegalArgumentException("replacementList 不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (replaceSrc.length != replacementList.length) {
|
||||||
|
throw new IllegalArgumentException("replaceSrc 和 replacementList的长度必须相等");
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
||||||
|
int start = 0;
|
||||||
|
|
||||||
|
if (replacementList.length == 0) {
|
||||||
|
return src;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < replaceSrc.length; i++) {
|
||||||
|
int position = src.indexOf(replaceSrc[i], start);
|
||||||
|
|
||||||
|
if (position == -1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append(src, start, position);
|
||||||
|
sb.append(replacementList[i]);
|
||||||
|
start = position + 1;
|
||||||
|
}
|
||||||
|
sb.append(src, start, src.length());
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 密码校验
|
||||||
|
* @param password
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String passwordCheck(String password){
|
||||||
|
int length = password.length();
|
||||||
|
if (length >= 7 && length <= 16){
|
||||||
|
return password;
|
||||||
|
}else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 金额校验
|
||||||
|
* @param str
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isMoney(String str) {
|
||||||
|
// 判断小数点后2位的数字的正则表达式
|
||||||
|
Pattern pattern = Pattern.compile("^(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){0,2})?$");
|
||||||
|
Matcher match = pattern.matcher(str);
|
||||||
|
return match.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -19,7 +19,8 @@
|
||||||
<module>oss-service</module>
|
<module>oss-service</module>
|
||||||
<module>admin</module>
|
<module>admin</module>
|
||||||
<module>merchant-service-api</module>
|
<module>merchant-service-api</module>
|
||||||
<!-- <module>order-service</module>-->
|
<module>lkl-service-api</module>
|
||||||
|
<!-- <module>order-service</module>-->
|
||||||
|
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue