"拉卡拉进件支付代码"

This commit is contained in:
hankaikai 2023-06-01 17:14:02 +08:00
parent 6f6938daa4
commit c29c10c193
19 changed files with 741 additions and 203 deletions

View File

@ -6,6 +6,7 @@ import cn.pluss.platform.channel.ys.YSAuditServiceV3;
import cn.pluss.platform.entity.RyxAccessModel;
import cn.pluss.platform.klk.service.impl.LaKalaInterfaceImpl;
import cn.pluss.platform.ryx.RyxService;
import cn.pluss.platform.sxf.audit.LklMerAuditServiceImpl;
import cn.pluss.platform.ys.impl.v20210929.YsConfigV2;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
@ -44,6 +45,9 @@ public class AuditCallbackController {
@Setter(onMethod_ = {@Autowired})
private MerchantAuditService ysAuditServiceExtensionV2;
@Setter(onMethod_ = {@Autowired})
private LklMerAuditServiceImpl lklMerAuditService;
@Autowired
private RyxService ryxService;
@ -145,7 +149,6 @@ public class AuditCallbackController {
LaKalaInterfaceImpl laKalaInterface;
@PostMapping("lklCallBack")
public String lklCallBack(@RequestBody Map<String, Object> map) throws Exception {
String str ="data -> hplFXwPU1gbHYwraQM/fKEcoIkBfHD07VSH99OnKTZk9HJRFAvZyOm9nsdeSi8t/UdGPn+LXldrjZ7wiY+F5MzGlIdEma7agKZyHJ+UO6CrDJfYFMwlPUOgO+Pq5ljg6QOdZBxBLEHkRMkQnC/CTv9vQnPDqeCv4MvAbHJspADGRRPvmjxtzf0J4OQgP3hj9+ZqH+btsuX+W+YZRXRMYL+uOQkSJhMUv31hc9MAC/1Sp0C9cBcHKxr+idS+0CCjvD8WzLbXv2QuOSQccIKQw+Je8RMeuKs8f64MibCkf+RkilTCVCEd5apL1MkhYJZoUVzqPXmDBLjaJgr987X1wBAzQMS8+F34Vl/BonKPuJ4RRwdE/M3WJ+ZfM2WiLawpU7ZqUQdVY2bwJO801TcmFCswLoz2qxHHsBsjXtQPqMOj3pw3Kvz3WH3oWmcFRZjHKIbDSy9Jh2STEFRbvVWarjksBVjXkcbletDtOtY0T8XCdiiNoQNlVNj5kH5QkAWmt";
return laKalaInterface.tuoKeCallBack(map);
return lklMerAuditService.merchantAuditCallback(map);
}
}

View File

@ -610,6 +610,11 @@ public class DateUtils {
int hours = (int) ((date2.getTime() - date1.getTime()) / (1000*3600));
return Math.abs(hours);
}
private final static SimpleDateFormat sdfTimes = new SimpleDateFormat("yyyyMMddHHmmss");
public static String getSdfTimes() {
return sdfTimes.format(new Date());
}
public static void main(String[] args) throws ParseException {
//List<String> last6Months = getLast6Months();

View File

@ -161,6 +161,18 @@ getui:
express:
USERID: 1778214
APIKEY: 63e75d64-e8fd-4dcc-93fa-17dc710cdf04
lkl:
privateKey: MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAK870Q31bo4bvLvZVRZmKWLibwOUP5Myh+AiX3o49f19EFLshyDegirGZTbTEVuKzAnZwJTojWBsTsYMzXgKKEtB3brFblP/xOYcJpUUXLVv0BYc0ruxbdo13YorU8jeHiBLfw0PyOq92v/xhlII0XYo6g57cXXsWpV5wF2r7VVlAgMBAAECgYAFDkSWUq30DgB7KlE7pQqYTpslrx8fHUFGqgc3ggbgNOhbKXWD8ReFVMBdKBLN9tUIiw6fh+QdqOekQYCjcCZAarcZ5c3VyKqmM6NJe4KZ7jQxtIhwa2UDYPW7yRyqu8CqktNDTCd2R/RBVcwd4wvhjO9ZJZF8s3qbuncicUzjgQJBANT8TCGQLU3UOlfLhI5epnuspSCh9JgO3TR3xtYg1Km29PJ8Wy6ZtCznf+odr/RM3MKFEd84/Mz/wIic44bo50ECQQDSn69ej8smC8/azzaBVSrZCyaxY/vyQJ+5sXsCo94aFU3w5SnHW4Rb8Ok+EVOlCHqCxbwElpPvLof8PI8vGqklAkAdtqEMYafgXsZQ70Sr9Ap34Isc9VtBR3mW00r7HpNspeigV7cE1k6roRRYXhHpHDwEKzpmEPY7x0ZeCL05Wg7BAkBoFSVSc3iOapPiqzdiHjY4X3xVePVON4U2/G+vVE8zUIfdnUFSFPWJgbmhRGqzSUdRTGmnUsn0DmiAy2RugJxJAkBGCmZzkXmCA844EjwdDllJFY0hhjNguqUJXnm90v245Fyx86ox0rFOMS0WoZY7/8r/AQx2VUsrAKDyxajtUbR2
appid: OP00000462 #接入方唯一编号
mchSerialNo: 00dfba8194c41b84cf #证书序列号
merchantNo: 8221210594300JY #商户号
vposId: 491612871013605376 #vpos_id
termNo: A0073841 #终端号
apiUrl: https://test.wsmsd.cn/
privateKeyPath: "classpath:lakalaConf/OP00000003_private_key.pem"
certificatePath: "classpath:lakalaConf/OP00000003_cert"
pubKey: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvO9EN9W6OG7y72VUWZili4m8DlD+TMofgIl96OPX9fRBS7Icg3oIqxmU20xFbiswJ2cCU6I1gbE7GDM14CihLQd26xW5T/8TmHCaVFFy1b9AWHNK7sW3aNd2KK1PI3h4gS38ND8jqvdr/8YZSCNF2KOoOe3F17FqVecBdq+1VZQIDAQAB

View File

@ -1,11 +0,0 @@
lkl:
private_key: MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDvDBZyHUDndAGxrIcsCV2njhNO3vCEZotTaWYSYwtDvkcAb1EjsBFabXZaKigpqFXk5XXNI3NIHP9M8XKzIgGvc65NpLAfRjVql8JiTvLyYd1gIUcOXMInabu+oX7dQSI1mS8XzqaoVRhDZQWhXcJW9bxMulgnzvk0Ggw07AjGF7si+hP/Va8SJmN7EJwfQq6TpSxR+WdIHpbWdhZ+NHwitnQwAJTLBFvfk28INM39G7XOsXdVLfsooFdglVTOHpNuRiQAj9gShCCNrpGsNQxDiJIxE43qRsNsRwigyo6DPJk/klgDJa417E2wgP8VrwiXparO4FMzOGK15quuoD7DAgMBAAECggEBANhmWOt1EAx3OBFf3f4/fEjylQgRSiqRqg8Ymw6KGuh4mE4Md6eW/B6geUOmZjVP7nIIR1wte28M0REWgn8nid8LGf+v1sB5DmIwgAf+8G/7qCwd8/VMg3aqgQtRp0ckb5OV2Mv0h2pbnltkWHR8LDIMwymyh5uCApbn/aTrCAZKNXcPOyAn9tM8Bu3FHk3Pf24Er3SN+bnGxgpzDrFjsDSHjDFT9UMIc2WdA3tuMv9X3DDn0bRCsHnsIw3WrwY6HQ8mumdbURk+2Ey3eRFfMYxyS96kOgBC2hqZOlDwVPAKTPtS4hoq+cQ0sRaJQ4T0UALJrBVHa+EESgRaTvrXqAECgYEA+WKmy9hcvp6IWZlk9Q1JZ+dgIVxrO65zylK2FnD1/vcTx2JMn73WKtQb6vdvTuk+Ruv9hY9PEsf7S8gHSTTmzHOUgo5x0F8yCxXFnfji2juoUnDdpkjtQK5KySDcpQb5kcCJWEVi9v+zObM0Zr1Nu5/NreE8EqUl3+7MtHOu1TMCgYEA9WM9P6m4frHPW7h4gs/GISA9LuOdtjLvAtgCK4cW2mhtGNAMttD8zOBQrRuafcbFAyU9de6nhGwetOhkW9YSV+xRNa7HWTeIRgXJuJBrluq5e1QGTIwZU/GujpNaR4Qiu0B8TodM/FME7htsyxjmCwEfT6SDYlkeMzTbMa9Q0DECgYBqsR/2+dvD2YMwAgZFKKgNAdoIq8dcwyfamUQ5mZ5EtGQL2yw48zibHh/LiIxgUD1Kjk/qQgNsX45NP4iOc0mCkrgomtRqdy+rumbPTNmQ0BEVJCBPscd+8pIgNiTvnWpMRvj7gMP0NDTzLI3wnnCRIq8WAtR2jZ0Ejt+ZHBziLQKBgQDibEe/zqNmhDuJrpXEXmO7fTv3YB/OVwEj5p1Z/LSho2nHU3Hn3r7lbLYEhUvwctCnLl2fzC7Wic1rsGOqOcWDS5NDrZpUQGGF+yE/JEOiZcPwgH+vcjaMtp0TAfRzuQEzNzV8YGwxB4mtC7E/ViIuVULHAk4ZGZI8PbFkDxjKgQKBgG8jEuLTI1tsP3kyaF3jAylnw7SkBc4gfe9knsYlw44YlrDSKr8AOp/zSgwvMYvqT+fygaJ3yf9uIBdrIilqCHKXccZ9uA/bT5JfIi6jbg3EoE9YhB0+1aGAS1O2dBvUiD8tJ+BjAT4OB0UDpmM6QsFLQgFyXgvDnzr/o+hQJelW
appid: OP00000462 #接入方唯一编号
mchSerialNo: 00dfba8194c41b84cf #证书序列号
merchantNo: 8221210594300JY #商户号
vposId: 491612871013605376 #vpos_id
termNo: A0073841 #终端号
apiUrl: https://test.wsmsd.cn/
privateKeyPath: "classpath:lakalaConf/OP00000003_private_key.pem"
certificatePath: "classpath:lakalaConf/OP00000003_cert"

View File

@ -0,0 +1,9 @@
package cn.pluss.platform.mapper;
import cn.pluss.platform.entity.MerchantBackLkl;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MerchantBackLklMapper extends BaseMapper<MerchantBackLkl> {
}

View File

@ -1,16 +1,16 @@
spring:
# datasource:
# druid:
# url: jdbc:mysql://60.205.224.68:3306/chaozhanggui?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&noAccessToProcedureBodies=true&allowMultiQueries=true
# username: root
# password: CZGmysqlroot@123
# driver-class-name: com.mysql.jdbc.Driver
datasource:
druid:
url: jdbc:mysql://rm-bp19ib8x213kh9t450o.rwlb.rds.aliyuncs.com:3306/chaozhanggui?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
username: root
password: prodCZGmysqlroot@123
url: jdbc:mysql://127.0.0.1:3306/chaozhanggui?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8&noAccessToProcedureBodies=true&allowMultiQueries=true
username: chaozhanggui
password: CZGmysqlroot@123
driver-class-name: com.mysql.jdbc.Driver
# datasource:
# druid:
# url: jdbc:mysql://rm-bp19ib8x213kh9t450o.rwlb.rds.aliyuncs.com:3306/chaozhanggui?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
# username: root
# password: prodCZGmysqlroot@123
# driver-class-name: com.mysql.jdbc.Driver
logging:
config: classpath:log4j2-dev.xml

View File

@ -571,7 +571,7 @@
minWidth: 160,
templet: '#extensionThirdStatus',
rowspan: 1,
colspan: 3
colspan: 4
}
, {
title: 'D1微信子商户号<hr/>支付宝子商户号',
@ -671,7 +671,17 @@
templet: function (r) {
return thirdStatus(r.channelStatusList, r.ppStatus, r.ppThirdStatus, 4);
}
}
},
{
field: 'mcs4Status',
title: '拉卡拉',
align: "left",
width: 190,
rowspan: 1,
templet: function (r) {
return thirdStatus(r.channelStatusList, r.ppStatus, r.ppThirdStatus, 5);
}
}
]
],
done: function (index, layero) {

View File

@ -0,0 +1,44 @@
package cn.pluss.platform.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
@Data
@TableName("tb_pluss_merchant_back_lkl")
public class MerchantBackLkl {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableField("merchant_code")
private String merchantCode;
@TableField("merchant_id")
private String merchantId;
@TableField("channel")
private String channel;
@TableField("user_no")
private String userNo;
@TableField("customer_no")
private String customerNo;
@TableField("external_customer_no")
private String externalCustomerNo;
@TableField("term_nos")
private String termNos;
@TableField("agency_no")
private String agencyNo;
@TableField("active_no")
private String activeNo;
@TableField("contract_id")
private String contractId;
@TableField("core_term_ids")
private String coreTermIds;
@TableField("create_time")
private Date createTime;
@TableField("update_time")
private Date updateTime;
}

View File

@ -13,12 +13,6 @@ public class LaKaLaUtility {
//测试公钥
private static String pubKey="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvO9EN9W6OG7y72VUWZili4m8DlD+TMofgIl96OPX9fRBS7Icg3oIqxmU20xFbiswJ2cCU6I1gbE7GDM14CihLQd26xW5T/8TmHCaVFFy1b9AWHNK7sW3aNd2KK1PI3h4gS38ND8jqvdr/8YZSCNF2KOoOe3F17FqVecBdq+1VZQIDAQAB";
public static void main(String[] args) throws Exception {
String data="TOykml1JtGtrNL8rS+Aj/FOaq87eERTCUt9uZJk/ObFvuX5TRstQSl9fP3J2UTjSPO0b/p3Sh8Sxi1w9a6YuDQL9rrZ9orpWpEU+vg8H99fVZnvFjozB4HJf7NE5S9z7Mah93zW7TY1TFS55pIDv4go/fOtGTUcReUY0uFpZQote41m9KHvcjv5HiyCKaT/4cOoSMzHrsRiThwsU+rCDTzI4C32obwrXDOiaMd45wU4GL9/YMfHSpPOqgcsRZIWSBi2Pgt4nJX/s4uxVLzzKG00A8Jxa+yo0JZEgWRuHkOgcrV2Mxg8WmnXug8KeZBSeqYyvPXG9hy32q2phEwd1c6AYEOAKRu3QVhXEyDWjXkn86nvPimn8aohxYaAjky4E66LTnNIPNKOkwC5KVG27H9Fv27ZgqpDzRpYvaRExBT3RjJxXssLBRQ/eejOf7uuq0RgDUqFfwqOICqIUb8qbos6qu+QIsY2tvkbsMB1ZmD3s1SviHmvxWisD0VE/ZTDVQwDLUiORTwaMExirkc0s5bcB51FHHs2TFDa1raa/kSQwL/ADS0yAWNctiQGQtymErEmiD9iFdGXMvgjbqJ7KsDTAotKuYh9VzIA/RuAy+lpajvCIG6NOy428VHHin+RcXe/Ztx1UUHVk3xrHWNYG2aI4yyTLcz0EbG7rcOgWFwI=";
// String data ="hplFXwPU1gbHYwraQM/fKEcoIkBfHD07VSH99OnKTZk9HJRFAvZyOm9nsdeSi8t/UdGPn+LXldrjZ7wiY+F5MzGlIdEma7agKZyHJ+UO6CrDJfYFMwlPUOgO+Pq5ljg6QOdZBxBLEHkRMkQnC/CTv9vQnPDqeCv4MvAbHJspADGRRPvmjxtzf0J4OQgP3hj9+ZqH+btsuX+W+YZRXRMYL+uOQkSJhMUv31hc9MAC/1Sp0C9cBcHKxr+idS+0CCjvD8WzLbXv2QuOSQccIKQw+Je8RMeuKs8f64MibCkf+RkilTCVCEd5apL1MkhYJZoUVzqPXmDBLjaJgr987X1wBAzQMS8+F34Vl/BonKPuJ4RRwdE/M3WJ+ZfM2WiLawpU7ZqUQdVY2bwJO801TcmFCswLoz2qxHHsBsjXtQPqMOj3pw3Kvz3WH3oWmcFRZjHKIbDSy9Jh2STEFRbvVWarjksBVjXkcbletDtOtY0T8XCdiiNoQNlVNj5kH5QkAWmt";
String decrypt = LaKaLaUtility.decrypt(data);
System.out.println("解密结果:" + decrypt);
}
/**
* 公钥解密
* @param pubKey Base64 公钥
@ -26,7 +20,7 @@ public class LaKaLaUtility {
* @return 解密字符串
* @throws Exception 解密异常
*/
public static String decrypt(String data){
public static String decrypt(String pubKey,String data){
try {
Base64.Decoder decoder = Base64.getDecoder();
byte[] keyBytes = decoder.decode(pubKey.getBytes());

View File

@ -1,14 +1,33 @@
package cn.pluss.platform.klk;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "lkl")
@Data
@Component
@ConfigurationProperties(prefix = "lkl1")
public class LakalaConfig {
@Value("private_key")
private String privateKey;
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 pubKey;
@Bean
public void init(){
System.out.println("qqqqqqq");
}
}

View File

@ -31,15 +31,11 @@ public class LaKaLaController {
}
@PostMapping("/jjkls")
public void jjkls(){
laKalaInterface.ff();
}
@PostMapping("/tuoke")
public void jjklss(){
laKalaInterface.createTuoKeInfo("244");
}
@PostMapping("/callBackToke")

View File

@ -1,6 +1,12 @@
package cn.pluss.platform.klk.service;
import cn.pluss.platform.entity.MerchantBaseInfo;
import cn.pluss.platform.entity.MerchantChannelStatus;
import cn.pluss.platform.entity.MerchantOrder;
import cn.pluss.platform.klk.LakalaConfig;
import cn.pluss.platform.util.DateUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.IOUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
@ -14,6 +20,7 @@ import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.net.ssl.SSLContext;
@ -63,12 +70,54 @@ public class LklPayService {
String apiPath = "/api/v2/saas/query/wx_openid_query";
// private String apiUrl="https://s2.lakala.com";
@Autowired
LakalaConfig lakalaConfig;
@Test
public void test1() {
LaKaLaVO laVO = new LaKaLaVO();
createOrder(laVO, "127.0.0.1");
}
public JSONObject tradePay(MerchantOrder order, MerchantChannelStatus channel, MerchantBaseInfo merchant){
String req_time= DateUtils.getSdfTimes();
String body="{\n" +
" \"req_time\": \""+req_time+"\",\n" +
" \"version\": \"3.0\",\n" +
" \"req_data\": {\n" +
" \"merchant_no\": \"822290070111135\",\n" +
" \"term_no\": \"29034705\",\n" +
" \"out_trade_no\": \"FD660E1FAA3A4470933CDEDAE1EC1D8E\",\n" +
" \"auth_code\": \"135178236713755038\",\n" +
" \"total_amount\": \"123\",\n" +
" \"location_info\": {\n" +
" \"request_ip\": \"10.176.1.192\",\n" +
" \"location\": \"+37.123456789,-121.123456789\"\n" +
" }\n" +
" }\n" +
"}";
return new JSONObject();
}
public String createOrder(LaKaLaVO laVO, String ip) {
//public String createOrder(String body,String apiPath,String ip) {
// String apiPath = "/api/v2/mms/openApi/addMer";

View File

@ -0,0 +1,7 @@
package cn.pluss.platform.klk.service;
import cn.pluss.platform.entity.MerchantBackLkl;
import com.baomidou.mybatisplus.extension.service.IService;
public interface MerchantBackLklService extends IService<MerchantBackLkl> {
}

View File

@ -1,7 +1,9 @@
package cn.pluss.platform.klk.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.pluss.platform.BankCardService;
import cn.pluss.platform.IdCardService;
import cn.pluss.platform.MerchantAuditRecordService;
import cn.pluss.platform.channel.ys.impl.YSAuditServiceV3;
import cn.pluss.platform.dto.AccountDTO;
import cn.pluss.platform.entity.*;
@ -10,11 +12,13 @@ import cn.pluss.platform.klk.LaKaLaUtility;
import cn.pluss.platform.klk.service.*;
import cn.pluss.platform.klk.vo.*;
import cn.pluss.platform.mapper.MerchantChannelStatusMapper;
import cn.pluss.platform.mcc.MccReflectService;
import cn.pluss.platform.merchant.AccountService;
import cn.pluss.platform.merchant.MerchantBaseInfoService;
import cn.pluss.platform.merchantChannelStatus.MerchantChannelStatusService;
import cn.pluss.platform.userApp.UserAppService;
import cn.pluss.platform.util.StringUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -28,6 +32,8 @@ 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.util.StringUtils;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
@ -63,6 +69,13 @@ public class LaKalaInterfaceImpl implements LaKalaInterface {
@Resource
AccountService accountService;
@Autowired
protected MerchantAuditRecordService merchAuditRecService;
@Resource
private MerchantChannelStatusMapper merchantChannelStatusMapper;
@Lazy
@Resource
private MerchantChannelStatusService mcsService;
@ -75,50 +88,52 @@ public class LaKalaInterfaceImpl implements LaKalaInterface {
MccReflectService service;
@Resource
PlussMerchantLklService merchantLklService;
// 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 userNo = "22241007";
// /**
// * 商户进件
// */
// private static final String tuoKeMerchat = "https://htkactvi.lakala.com/registration/merchant";
// /**
// * 获取地区信息
// */
// private static final String organparentCode = "https://htkactvi.lakala.com/registration/organization/";
// /**
// * 获取银行地区信息
// */
// private static final String organizationBank = "https://htkactvi.lakala.com/registration/organization/bank/";
// /**
// * 文件上传
// */
// private static final String fileUpload = "https://htkactvi.lakala.com/registration/file/upload";
// private static final String tuoKeToken = "https://tkapi.lakala.com/auth/oauth/token";
/************************************************测试信息***************************************************/
private static final String client_id = "testsit";
private static final String client_secret = "EguwEckByf2I6u6z";
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 userNo = "20000101";
private static final String userNo = "22241007";
/**
* 商户进件
*/
private static final String tuoKeMerchat = "https://test.wsmsd.cn/sit/htkregistration/merchant";
private static final String tuoKeMerchat = "https://htkactvi.lakala.com/registration/merchant";
/**
* 获取地区信息
*/
private static final String organparentCode = "https://test.wsmsd.cn/sit/htkregistration/organization/";
private static final String organparentCode = "https://htkactvi.lakala.com/registration/organization/";
/**
* 获取银行地区信息
*/
private static final String organizationBank = "https://test.wsmsd.cn/sit/htkregistration/organization/bank/";
private static final String organizationBank = "https://htkactvi.lakala.com/registration/organization/bank/";
/**
* 文件上传
*/
private static final String fileUpload = "https://test.wsmsd.cn/sit//htkregistration/file/upload";
private static final String tuoKeToken = "https://test.wsmsd.cn/sit/htkauth/oauth/token";
private static final String fileUpload = "https://htkactvi.lakala.com/registration/file/upload";
private static final String tuoKeToken = "https://tkapi.lakala.com/auth/oauth/token";
/************************************************测试信息***************************************************/
// private static final String client_id = "testsit";
// private static final String client_secret = "EguwEckByf2I6u6z";
// private static final String grant_type = "client_credentials";
// private static final String userNo = "20000101";
// /**
// * 商户进件
// */
// private static final String tuoKeMerchat = "https://test.wsmsd.cn/sit/htkregistration/merchant";
// /**
// * 获取地区信息
// */
// private static final String organparentCode = "https://test.wsmsd.cn/sit/htkregistration/organization/";
// /**
// * 获取银行地区信息
// */
// private static final String organizationBank = "https://test.wsmsd.cn/sit/htkregistration/organization/bank/";
// /**
// * 文件上传
// */
// private static final String fileUpload = "https://test.wsmsd.cn/sit//htkregistration/file/upload";
//
//
// private static final String tuoKeToken = "https://test.wsmsd.cn/sit/htkauth/oauth/token";
@ -170,147 +185,229 @@ public class LaKalaInterfaceImpl implements LaKalaInterface {
/**
* 拉卡拉拓客进件
* */
public TuoKeVo createTuoKeInfo(String userId) {
public void createTuoKeInfo(String userId) {
// UserApp userapp=userAppService.getById(userId);
// MsgException.checkNull(userapp,"商户基础信息不完整");
//
// MsgException.checkBlank(userapp.getEmail(),"商户邮箱不允许为空");
MerchantBaseInfo merchantBaseInfo = mbiService.getMerchantBaseInfoByUserId(userId);
TuoKeVo tuoKeVo = new TuoKeVo();
tuoKeVo.setBusiCode(""); //业务类型
tuoKeVo.setEmail("chaozhanggui2023@163.com");
tuoKeVo.setMerchantCode(merchantBaseInfo.getMerchantCode());
tuoKeVo.setMerRegName(merchantBaseInfo.getMerchantName());//商户注册名称
if (merchantBaseInfo.getMerchantType().equals("1") || merchantBaseInfo.getMerchantType().equals("2")) { //商户类型/营业执照类型 可选值1:小微2:个体3:企业
tuoKeVo.setMerType("TP_PERSONAL");//商户注册类型 TP_MERCHANT:企业 TP_PERSONAL:微个
} else {
tuoKeVo.setMerType("TP_MERCHANT");//商户注册类型
IdCard idCard = idCardService.getCertIdCard(userId); //获取法人身份证信息
MsgException.checkNull(idCard,"商户基本信息不完整");
MerchantChannelStatus mcs = mcsService.getByMerchantCodeNoChannel(merchantBaseInfo.getMerchantCode());
String status=mcs.getStatus();
String thirdStatus=mcs.getThirdStatus();
MsgException.checkNull(mcs,"商户未提交审核");
if (status.equals(MerchantChannelStatus.AUDIT_STATUS_EXAMINING) && !thirdStatus.equals(MerchantChannelStatus.AUDIT_THIRD_STATUS_WAITING)) {
MsgException.throwException("进件审核中,请等待审核结果");
}
tuoKeVo.setMerName(merchantBaseInfo.getMerchantName()); //商户名称(经营名称
tuoKeVo.setMerAddr(merchantBaseInfo.getAddress()); //市区后的详细地址
List<OrganVo> proOrganCode = getOrganCode("1");
System.out.println("proOrganCode :" + proOrganCode);
String cityCode = null;
for (OrganVo organVo : proOrganCode) { //省code
if (organVo.getName().equals(merchantBaseInfo.getProvince())) {
QueryWrapper<TbPlussRegionLklEntity> wrapper = new QueryWrapper<>();
wrapper.eq("name", merchantBaseInfo.getProvince()).last("limit 1");
TbPlussRegionLklEntity one = tbPlussRegionLklService.getOne(wrapper);
tuoKeVo.setProvinceCode(one.getCode());
cityCode = one.getCode();
break;
}
}
List<OrganVo> cityOrganCode = getOrganCode(cityCode); //市code
for (OrganVo organVo : cityOrganCode) {
if (organVo.getName().equals(merchantBaseInfo.getCity())) {
QueryWrapper<TbPlussRegionLklEntity> wrapper = new QueryWrapper<>();
wrapper.eq("name", merchantBaseInfo.getCity()).last("limit 1");
TbPlussRegionLklEntity one = tbPlussRegionLklService.getOne(wrapper);
tuoKeVo.setCityCode(one.getCode());
cityCode = one.getCode();
break;
}
if (MerchantChannelStatus.isAudited(mcs)) {
MsgException.throwException("商户已进件成功,请勿重复进件");
}
List<OrganVo> countyOrganCode = getOrganCode(cityCode); //区code
for (OrganVo organVo : countyOrganCode) {
if (organVo.getName().equals(merchantBaseInfo.getDistrict())) {
QueryWrapper<TbPlussRegionLklEntity> wrapper = new QueryWrapper<>();
wrapper.eq("name", merchantBaseInfo.getDistrict()).last("limit 1");
TbPlussRegionLklEntity one = tbPlussRegionLklService.getOne(wrapper);
tuoKeVo.setCountyCode(one.getCode());
cityCode = one.getCode();
break;
}
}
if (!merchantBaseInfo.getMerchantType().equals("1")) {// 非小微商户类型
tuoKeVo.setLicenseName(merchantBaseInfo.getBussAuthName()); //营业执照名称
tuoKeVo.setLicenseNo(merchantBaseInfo.getBussAuthNum());//营业执照号码 微商户可不传 其他必传
tuoKeVo.setLicenseDtStart(merchantBaseInfo.getBussAuthStartTime());//营业执照开始时间微商户可不传 其他必传格式yyyy-MM-dd
tuoKeVo.setLicenseDtEnd(merchantBaseInfo.getBussAuthEndTime());//微商户可不传 其他必传格式yyyy-MM-dd
}
tuoKeVo.setLatitude("");//经度 进件所在地址经度
tuoKeVo.setLongtude("");//纬度 进件所在地址纬度
tuoKeVo.setSource("APP"); //进件来源 APP: app H5: h5
tuoKeVo.setBusinessContent(merchantBaseInfo.getMccName()); //商户经营内容
IdCard one = idCardService.getLegalIdCard(userId); //获取法人身份证信息
tuoKeVo.setLarName(one.getCertName());
tuoKeVo.setLarIdType("01");
tuoKeVo.setLarIdCard(one.getCertNo());
tuoKeVo.setLarIdCardStart(birthdayDate(one.getCertStartTime()));
tuoKeVo.setLarIdCardEnd(birthdayDate(one.getCertEndTime()));
tuoKeVo.setContactMobile(merchantBaseInfo.getContactMobile());
tuoKeVo.setContactName(merchantBaseInfo.getContactName());
JSONObject object1 = new JSONObject();
JSONObject object2 = new JSONObject();
object1.put("userNo", userNo); //合作机构信息 由拓客SAAS提供
object1.put("email", "chaozhanggui2023@163.com"); //商户邮箱
object1.put("busiCode", "PAPER_CODE");//业务类型 BPOS:传统POS, ZPOS:电签,ZPOS4G4G电签,SUPER_POS:智能pos,B_WIZARD:蓝精灵,PAPER_CODE:码牌,WECHAT_PAY:专业化扫码,KLYX:云音箱,QRCODE:收款王,MONEY_BOX:收钱宝盒根据业务开放取值
object1.put("merRegName", merchantBaseInfo.getMerchantName()); //商户注册名称 不能少于七个中文
object1.put("merType", (merchantBaseInfo.getMerchantType().equals(1)||merchantBaseInfo.getMerchantType().equals("2"))?"TP_PERSONAL":"TP_MERCHANT"); //商户注册类型 TP_MERCHANT:企业 TP_PERSONAL:微个
object1.put("merName", merchantBaseInfo.getMerchantName()); //商户名称(经营名称) 不能少于七个中文
object1.put("merAddr", merchantBaseInfo.getAddress()); //去掉省市区后的详细地址
object1.put("provinceCode", tbPlussRegionLklService.getOne(new QueryWrapper<TbPlussRegionLklEntity>().likeRight("name",merchantBaseInfo.getProvince()).last("limit 1")).getCode()); //省代码 通过地区信息获取地区查询接口获取 对应 code字段
object1.put("cityCode", tbPlussRegionLklService.getOne(new QueryWrapper<TbPlussRegionLklEntity>().likeRight("name",merchantBaseInfo.getCity()).last("limit 1")).getCode()); // 市代码 通过地区信息获取地区查询接口获取 对应 code字段
object1.put("countyCode", tbPlussRegionLklService.getOne(new QueryWrapper<TbPlussRegionLklEntity>().likeRight("name",merchantBaseInfo.getDistrict()).last("limit 1")).getCode()); // 区县代码 通过地区信息获取地区查询接口获取 对应 code字段
if(!merchantBaseInfo.getMerchantType().equals("1")){
object1.put("licenseName", merchantBaseInfo.getBussAuthName()); //营业执照名称
object1.put("licenseNo", merchantBaseInfo.getBussAuthNum()); //营业执照号码 微商户可不传 其他必传
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));
}
if(ObjectUtil.isEmpty(merchantBaseInfo.getBuslicType()) ||"长期".equals(merchantBaseInfo.getBuslicType())){
endSb.append("2099-12-31");
}else {
endSb.append(merchantBaseInfo.getBussAuthStartTime().substring(0,4));
endSb.append("-");
endSb.append(merchantBaseInfo.getBussAuthStartTime().substring(5,7));
endSb.append("-");
endSb.append(merchantBaseInfo.getBussAuthStartTime().substring(8,10));
}
object1.put("licenseDtStart", startSb); //营业执照开始时间微商户可不传 其他必传格式yyyy-MM-dd
object1.put("licenseDtEnd", endSb); //微商户可不传 其他必传格式yyyy-MM-dd
}
object1.put("latitude", "108.94647"); //经度 进件所在地址经度error
object1.put("longtude", "34.34727"); //纬度 进件所在地址纬度 error
object1.put("source", "APP"); //进件来源 APP: app H5: h5
object1.put("businessContent", merchantBaseInfo.getMccName()); //商户经营内容
object1.put("larName", idCard.getCertName()); //姓名
object1.put("larIdType", "01"); //证件类型 01 身份证 暂时只支持身份证
object1.put("larIdCard", idCard.getCertNo()); //证件号码
object1.put("larIdCardStart", birthdayDate(idCard.getCertStartTime())); //证件开始 格式yyyy-MM-dd
object1.put("larIdCardEnd", birthdayDate(idCard.getCertEndTime())); //证件过期时间 格式yyyy-MM-dd
object1.put("contactMobile", merchantBaseInfo.getContactMobile()); //商户联系⼿机号码
object1.put("contactName", merchantBaseInfo.getContactName()); //商户联系姓名
QueryWrapper<Account> accountQueryWrapper1 = new QueryWrapper<>();
accountQueryWrapper1.eq("userId", userId);
accountQueryWrapper1.eq("channelType", "D1");
Account accountServiceOne1 = accountService.getOne(accountQueryWrapper1);
MsgException.checkNull(accountServiceOne1,"结算信息未提交");
QueryWrapper<BankCard> bankCardWrapper = new QueryWrapper<>();
bankCardWrapper.eq("id", accountServiceOne1.getBankCardId());
BankCard userBrakCard = bankCardService.getOne(bankCardWrapper);
MsgException.checkNull(userBrakCard,"结算卡信息未提交");
QueryWrapper<TbPlussBankBranchLklEntity> lklEntityQueryWrapper = new QueryWrapper<>();
lklEntityQueryWrapper.eq("branch_bank_no", userBrakCard.getContactLine());
TbPlussBankBranchLklEntity lakalaBranchInfo = tbPlussBankBranchLklService.getOne(lklEntityQueryWrapper);
tuoKeVo.setOpenningBankCode(lakalaBranchInfo.getBranchBankNo());
tuoKeVo.setOpenningBankName(lakalaBranchInfo.getBranchBankName());
tuoKeVo.setClearingBankCode(lakalaBranchInfo.getClearNo());
MsgException.checkNull(lakalaBranchInfo,"结算卡对应的分行支行信息不存在");
object1.put("openningBankCode", lakalaBranchInfo.getBranchBankNo()); //结算账户开户 通过银行列表查询接口获取 对应 branchBankNo字段
object1.put("openningBankName", lakalaBranchInfo.getBranchBankName()); //结算账户开户名称 通过银行列表查询接口获取 对应 branchBankName字段
object1.put("clearingBankCode", lakalaBranchInfo.getClearNo()); //结算账户清算 通过银行列表查询接口获取 对应 clearNo字段
QueryWrapper<TbPlussBankRegionLklEntity> regionLklEntityQueryWrapper = new QueryWrapper<>();
regionLklEntityQueryWrapper.eq("code", lakalaBranchInfo.getAreaCode());
TbPlussBankRegionLklEntity bankParentCode = regionLklService.getOne(regionLklEntityQueryWrapper); //市code name
MsgException.checkNull(bankParentCode,"结算卡对应的省份信息不存在");
regionLklEntityQueryWrapper.clear();
regionLklEntityQueryWrapper.eq("code", bankParentCode.getParentCode());
TbPlussBankRegionLklEntity parentCode = regionLklService.getOne(regionLklEntityQueryWrapper); //省code 名称
tuoKeVo.setSettleProvinceCode(parentCode.getCode());
tuoKeVo.setSettleProvinceName(parentCode.getName());
tuoKeVo.setSettleCityCode(bankParentCode.getCode());
tuoKeVo.setSettleCityName(bankParentCode.getName());
Account account = new Account().setUserId("userId").setChannelType("D1");
MsgException.checkNull(bankParentCode,"结算卡对应的城市信息不存在");
object1.put("settleProvinceCode", parentCode.getCode()); //结算信息省份名称 通过地区信息获取银行地区查询接口获取 对应 code字段
object1.put("settleProvinceName", parentCode.getName()); //结算信息省份代码 通过地区信息获取银行地区查询接口获取 对应 name字段
object1.put("settleCityCode", bankParentCode.getCode()); //结算信息城市名称 通过地区信息获取银行地区查询接口获取 对应 code字段
object1.put("settleCityName", bankParentCode.getName()); //结算信息城市代码 通过地区信息获取银行地区查询接口获取 对应 name字段
AccountDTO accountV4 = getAccountV4(userId, "D1"); //结算人
MsgException.checkNull(accountV4,"结算信息不存在");
object1.put("accountNo", accountV4.getBankCard().getBankCardNo()); //结算人银行卡号
object1.put("accountName", accountV4.getBankCard().getBranchName()); //结算人账户名称
object1.put("accountType", accountV4.getBankCard().getAccountType().equals("01")?"58":"57"); //结算账户类型 57 对公 58 对私
// object1.put("accountIdType",tuoKeVo.getUserNo()); //结算证件类型 为空同法
object1.put("accountIdCard", accountV4.getIdcard().getCertNo()); //结算证件号码
/**获取结算人**/
Set<FeesSetVo> feesSet = new HashSet<>();
FeesSetVo f = new FeesSetVo();
f.setFeeCode("SCAN_PAY_SECOND");
f.setFeeValue("0.038");
feesSet.add(f);
BankCard bankCard = accountV4.getBankCard();
tuoKeVo.setAccountNo(bankCard.getBankCardNo());
tuoKeVo.setAccountName(bankCard.getBranchName());
if (bankCard.getAccountType().equals("01")) {
tuoKeVo.setAccountType("58"); //结算账户类型 57 对公 58 对私
} else {
tuoKeVo.setAccountType("57");
}
IdCard idcard = accountV4.getIdcard();
tuoKeVo.setAccountIdCard(idcard.getCertNo());//结算人证件号码
tuoKeVo.setTermNum("1");
tuoKeVo.setFeeCode("SCAN_PAY_SECOND"); //费率类型 参考 附录 费率类型表
tuoKeVo.setFeeValue("0.038"); //费率值 百分比费率
MerchantBaseInfo merchantBaseInfoByUserId = baseInfoService.getMerchantBaseInfoByUserId(userId);
object2.put("termNum", "1"); //终端数量 1-5 5个终端
object2.put("fees", feesSet); //费率集合
QueryWrapper<MccReflect> userAppQueryWrapper = new QueryWrapper();
userAppQueryWrapper.eq("standard_mcc_code", merchantBaseInfoByUserId.getMcc()).eq("channel_id", "5").last("limit 1");
userAppQueryWrapper.eq("standard_mcc_code", merchantBaseInfo.getMcc()).eq("channel_id", "5").last("limit 1");
MccReflect mccReflect = service.getOne(userAppQueryWrapper);
if (null != mccReflect) {
tuoKeVo.setMcc("11010"); //商户MCC编号 通过 商户类别查询查询小类接口获取 对应 code字段
// tuoKeVo.setMcc(mccReflect.getMccCode()); //商户MCC编号 通过 商户类别查询查询小类接口获取 对应 code字段
} else {
tuoKeVo.setMcc("18001");
}
object2.put("mcc", ObjectUtils.isEmpty(mccReflect)?"18001":"11010"); //商户MCC编号 通过 商户类别查询查询小类接口获取 对应 code字段
object2.put("activityId","37"); //归属活动信息 由拓客SAAS分配
object1.put("bizContent", object2); //业务扩展信息 业务扩展信息
tuoKeVo.setActivityId("12"); //归属活动信息 由拓客SAAS分配
Set<Object> attchmentsVoSet = new HashSet<>();
AttchmentsVo frontLegalPerson = new AttchmentsVo(); //图片set
frontLegalPerson.setId(laKaLaFileUpload(idcard.getImgPositive()));//法人身份证图片地址
frontLegalPerson.setId(laKaLaFileUpload(accountV4.getIdcard().getImgPositive()));//法人身份证图片地址
frontLegalPerson.setType("ID_CARD_FRONT");//身份证正
AttchmentsVo reverseLegalPerson = new AttchmentsVo();
reverseLegalPerson.setId(idcard.getImgNegative()); //法人身份证图片地址
reverseLegalPerson.setId(accountV4.getIdcard().getImgNegative()); //法人身份证图片地址
reverseLegalPerson.setType("ID_CARD_BEHIND");//身份证反
attchmentsVoSet.add(reverseLegalPerson);
tuoKeVo.setSet(attchmentsVoSet);
tuoKeVo.setSettleType("D1"); //结算类型 D0秒到 D1次日结算
tuoKeAddMer(tuoKeVo);
return tuoKeVo;
object1.put("attchments", attchmentsVoSet); //附件信息集合 附件信息
object1.put("settleType", "D1"); //结算类型 D0秒到 D1次日结算
System.out.println("请求报文: " + object1);
/**获取拓客accessToken**/
Map map = getToken();
String result="";
try{
result = cn.hutool.http.HttpRequest.post(tuoKeMerchat)
.header("Authorization", "bearer " + map.get("access_token")).header("content-type", "application/json")
.body(object1.toString()).execute().body();
System.out.println("返回结果:"+result);
Map arry = (Map) JSONArray.parse(result);
if (String.valueOf(arry.get("status")).equals("WAIT_AUDI")){
PlussMerchantLklEntity plussMerchantLklEntity =new PlussMerchantLklEntity();
plussMerchantLklEntity.setMerchantId(merchantBaseInfo.getMerchantCode());
plussMerchantLklEntity.setMerchantlkl(String.valueOf(arry.get("merchantNo")));
plussMerchantLklEntity.setType("0");
merchantLklService.save(plussMerchantLklEntity);
mcs.setChannel(5);
mcs.setUpdateTime(new Date());
mcs.setMerchantCode(merchantBaseInfo.getMerchantCode());
mcs.setStatus("1");
mcs.setThirdStatus("");
mcs.setCallbackStatus("0");
mcs.setRemark("拉卡拉审核中");
mcs.setMerchantId(String.valueOf(arry.get("merchantNo")));
MerchantAuditRecord merchantAuditRecord = new MerchantAuditRecord();
merchantAuditRecord.setStatus("1");
merchantAuditRecord.setMerchantCode(merchantBaseInfo.getMerchantCode());
merchantAuditRecord.setChannel(5);
merchantAuditRecord.setThirdStatus("");
merchantAuditRecord.setMerchantId(String.valueOf(arry.get("merchantNo")));
merchAuditRecService.save(merchantAuditRecord);
if (StringUtil.isNotEmpty(mcs.getId())) {
merchantChannelStatusMapper.updateById(mcs);
} else {
// 保存进件信息
merchantChannelStatusMapper.insert(mcs);
}
System.out.println(">>>>>>>>>>>>>>>");
}else {
}
}catch (Exception e){
e.printStackTrace();
Map arry = (Map) JSONArray.parse(result);
new MsgException(String.valueOf(arry.get("message")));
}
}
/**
@ -418,24 +515,24 @@ public class LaKalaInterfaceImpl implements LaKalaInterface {
* 进件回调
* */
public String tuoKeCallBack(Map<String,Object> map){
String data = LaKaLaUtility.decrypt(map.get("data").toString());
Map arryMap = (Map) JSONArray.parse(data);
System.out.println(arryMap);
if (String.valueOf(arryMap.get("status")).equals("SUCCESS")){
CallBackVo callBackVo =new CallBackVo();
callBackVo.setStatus("00");
callBackVo.setNote(String.valueOf(arryMap.get("remark")));
callBackVo.setSysFlowId(String.valueOf(arryMap.get("customerNo")));
callBackVo.setJsoon(data);
auditServiceV3.lklResultHandle(callBackVo);
} else if (String.valueOf(arryMap.get("status")).equals("FAILURE")) {
CallBackVo callBackVo =new CallBackVo();
callBackVo.setStatus("90");
callBackVo.setNote(String.valueOf(arryMap.get("remark")));
callBackVo.setSysFlowId(String.valueOf(arryMap.get("customerNo")));
callBackVo.setJsoon(data);
auditServiceV3.lklResultHandle(callBackVo);
}
// String data = LaKaLaUtility.decrypt(map.get("data").toString());
// Map arryMap = (Map) JSONArray.parse(data);
// System.out.println(arryMap);
// if (String.valueOf(arryMap.get("status")).equals("SUCCESS")){
// CallBackVo callBackVo =new CallBackVo();
// callBackVo.setStatus("00");
// callBackVo.setNote(String.valueOf(arryMap.get("remark")));
// callBackVo.setSysFlowId(String.valueOf(arryMap.get("customerNo")));
// callBackVo.setJsoon(data);
// auditServiceV3.lklResultHandle(callBackVo);
// } else if (String.valueOf(arryMap.get("status")).equals("FAILURE")) {
// CallBackVo callBackVo =new CallBackVo();
// callBackVo.setStatus("90");
// callBackVo.setNote(String.valueOf(arryMap.get("remark")));
// callBackVo.setSysFlowId(String.valueOf(arryMap.get("customerNo")));
// callBackVo.setJsoon(data);
// auditServiceV3.lklResultHandle(callBackVo);
// }
return "200";
}
@ -496,19 +593,25 @@ public class LaKalaInterfaceImpl implements LaKalaInterface {
* 获取结算人信息
*/
public AccountDTO getAccountV4(String userId, String type) {
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.set("token", "admin");
headers.set("myLoginName", "admin");
HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<MultiValueMap<String, Object>>(headers);
UserApp userApp= userAppService.getById(userId);
if (type == null) {
ResponseEntity<String> exchange = restTemplate.exchange("http://127.0.0.1:7004/api/account/v4?userId=" + userId + "&channelType=" + type, HttpMethod.GET, formEntity, String.class);
JSONObject jsonArray = JSONArray.parseObject(exchange.getBody());
AccountDTO accountDTO = JSONArray.parseObject(jsonArray.get("data").toString(), AccountDTO.class);
System.out.println(accountDTO);
MerchantChannelStatus mcs = mcsService.getValidData(userApp.getMerchantCode());
if (mcs == null || !Objects.equals(mcs.getChannel(), 4)) {
type=Account.CHANNEL_TYPE_D1;
} else {
type=Account.CHANNEL_TYPE_D0;
}
}
AccountDTO accountDTO = accountService.getRealAccount(userId);
if (accountDTO == null) {
accountDTO = new AccountDTO();
}
if (accountDTO.getIdcard() == null && accountDTO.getBankCard() == null) {
accountDTO.setIdcard(new IdCard());
accountDTO.setBankCard(new BankCard());
}
return accountDTO;
}

View File

@ -0,0 +1,11 @@
package cn.pluss.platform.klk.service.impl;
import cn.pluss.platform.entity.MerchantBackLkl;
import cn.pluss.platform.klk.service.MerchantBackLklService;
import cn.pluss.platform.mapper.MerchantBackLklMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@Service
public class MerchantBackLklServiceImpl extends ServiceImpl<MerchantBackLklMapper, MerchantBackLkl> implements MerchantBackLklService {
}

View File

@ -12,6 +12,7 @@ import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.exception.PayRiskException;
import cn.pluss.platform.fans.FansService;
import cn.pluss.platform.ipLocation.IpLocationService;
import cn.pluss.platform.klk.service.LklPayService;
import cn.pluss.platform.leshua.LeshuaSignature;
import cn.pluss.platform.mapper.*;
import cn.pluss.platform.memberOrder.MemberOrderService;
@ -143,6 +144,9 @@ public class MerchantServiceImpl implements MerchantService {
@Setter(onMethod_ = {@Autowired, @Lazy})
private UserVoiceService userVoiceService;
@Setter(onMethod_ = {@Autowired, @Lazy})
private LklPayService lklPayService;
@Override
public String appRefundCallback(HttpServletRequest request) {
@ -419,7 +423,11 @@ public class MerchantServiceImpl implements MerchantService {
result = ryxPayService.tradePay(order, channel,merchant);
} else if (channel.getChannel() == 4) {
result = ysPayOldService.tradePay(order, channel,merchant);
} else {
}else if(channel.getChannel()==5){
//拉卡拉的主扫接口
result=lklPayService.tradePay(order,channel,merchant);
}
else {
MsgException.throwException("未知通道");
}
if (ResultCode.SUCCESS.code() != result.getInteger("code")) {
@ -1394,7 +1402,11 @@ public class MerchantServiceImpl implements MerchantService {
unionInfo = ryxPayService.getUnionInfo(userAuthCode,payMentApp,channel.getMerchantId());
}else if(channel.getChannel() == 4){
unionInfo = ysPayOldService.getUnionInfo(userAuthCode, payMentApp,null);
}else {
}else if(channel.getChannel()==5){
//拉卡拉的被扫接口
}
else {
view.addObject("error", "未知通道类型");
return view;
}

View File

@ -0,0 +1,57 @@
package cn.pluss.platform.sxf.audit;
import cn.hutool.json.JSONUtil;
import cn.pluss.platform.klk.LaKaLaUtility;
import cn.pluss.platform.klk.LakalaConfig;
import cn.pluss.platform.task.LklMerAuditHandler;
import cn.pluss.platform.task.SxfMerAuditHandler;
import com.alibaba.fastjson.JSONArray;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Map;
@Slf4j
@Service
public class LklMerAuditServiceImpl {
@Lazy
@Autowired
private LklMerAuditHandler lklMerAuditHandler;
@Lazy
@Autowired
private LakalaConfig lakalaConfig;
public String merchantAuditCallback(Map<String,Object> map){
log.info("拉卡拉进件回调:{}", JSONUtil.toJsonStr(map));
try {
String data = LaKaLaUtility.decrypt(lakalaConfig.getPubKey(),map.get("data").toString());
Map arryMap = (Map) JSONArray.parse(data);
// 异步处理
lklMerAuditHandler.auditHandler(arryMap);
return "{\n" +
"\t\"code\": \"SUCCESS\",\n" +
"\t\"msg\": \"成功\"\n" +
"}";
} catch (Exception e) {
log.error("入驻回调异步任务启动失败!");
e.printStackTrace();
}
return "{\n" +
"\t\"code\": \"FAIL\",\n" +
"\t\"msg\": \"失败\"\n" +
"}";
}
}

View File

@ -0,0 +1,217 @@
package cn.pluss.platform.task;
import cn.hutool.core.util.ObjectUtil;
import cn.pluss.platform.MerchantAuditRecordService;
import cn.pluss.platform.entity.*;
import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.mapper.*;
import cn.pluss.platform.merchant.MerchantBaseInfoService;
import cn.pluss.platform.merchant.MerchantCashPlaceService;
import cn.pluss.platform.util.IpUtils;
import cn.pluss.platform.util.LogExceptionUtils;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Date;
import java.util.Map;
@Slf4j
@Component
@RequiredArgsConstructor
public class LklMerAuditHandler{
@Setter(onMethod_ = {@Lazy, @Autowired})
private MerchantChannelStatusMapper mcsMapper;
@Setter(onMethod_ = {@Lazy, @Autowired})
private MerchantBackLklMapper backLklMapper;
@Autowired
@Lazy
private LklMerAuditHandler self;
@Setter(onMethod_ = {@Lazy, @Autowired})
private MerchantBaseInfoService merchantBaseInfoService;
@Setter(onMethod_ = {@Autowired, @Lazy})
private MerchantCashPlaceService cashPlaceService;
@Setter(onMethod_ = {@Autowired})
private MerchantAuditRecordService merchantAuditRecordService;
private final UserAppMapper userAppMapper;
private final UserInfoMapper userInfoMapper;
private final MerchantStoreMapper merchantStoreMapper;
private final MerchantImageMapper merchantImageMapper;
private final RestTemplate restTemplate;
public void auditHandler(Map<String,Object> map) {
execute(map);
}
public void execute(Map<String,Object> map) {
if(ObjectUtil.isEmpty(map)||!map.containsKey("status")){
log.error("回调数据为空");
return;
}
if("SUCCESS".equals(map.get("status").toString())||"REVIEW_PASS".equals(map.get("status").toString())){
MerchantChannelStatus mcs = self.auditCallback(map);
try {
log.info("===================>进件回调,创建店铺开始,商户编号mno为:{}<=====================", map.get("customerNo").toString());
self.createStore(mcs);
} catch (Exception e) {
e.printStackTrace();
log.info("创建店铺信息异常,异常信息:{}", e.getMessage());
}
try {
MerchantBaseInfo merchantBaseInfo = merchantBaseInfoService.getMerchantBaseInfoByMerchantCode(mcs.getMerchantCode());
if (StringUtils.isNotBlank(merchantBaseInfo.getUserId())) {
cashPlaceService.createDefaultCashPlace(Long.parseLong(merchantBaseInfo.getUserId()));
}
} catch (Exception e) {
LogExceptionUtils.printStack(log, e, "创建默认收银点失败,异常信息:{}");
}
}
}
@Transactional(rollbackFor = Exception.class)
public MerchantChannelStatus auditCallback(Map<String,Object> map) {
MerchantChannelStatus merchantChannelStatus = new MerchantChannelStatus()
.setChannel(5)
.setMerchantId(map.get("customerNo").toString());
merchantChannelStatus = mcsMapper.selectOne(new QueryWrapper<>(merchantChannelStatus));
if(merchantChannelStatus.getStatus().equals("3")){
log.error("此商户已经审核完成");
return merchantChannelStatus;
}
merchantChannelStatus.setApplicationId(map.get("contractId").toString());
merchantChannelStatus.setStatus("3");
merchantChannelStatus.setExtra(JSONObject.parseObject("{\n" +
"\t\"code\": \"SUCCESS\",\n" +
"\t\"msg\": \"成功\"\n" +
"}"));
merchantChannelStatus.setUpdateTime(new Date());
QueryWrapper<MerchantBackLkl> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("merchant_code",merchantChannelStatus.getMerchantCode());
queryWrapper.eq("merchant_id",map.get("customerNo").toString());
queryWrapper.eq("channel","5");
queryWrapper.eq("user_no",map.get("userNo").toString());
MerchantBackLkl merchantBackLkl= backLklMapper.selectOne(queryWrapper);
if(ObjectUtil.isEmpty(merchantBackLkl)){
merchantBackLkl=new MerchantBackLkl();
merchantBackLkl.setMerchantCode(merchantChannelStatus.getMerchantCode());
merchantBackLkl.setMerchantId(map.get("customerNo").toString());
merchantBackLkl.setChannel("5");
merchantBackLkl.setUserNo(map.get("userNo").toString());
merchantBackLkl.setCustomerNo(map.get("customerNo").toString());
merchantBackLkl.setExternalCustomerNo(map.get("externalCustomerNo").toString());
merchantBackLkl.setTermNos(map.get("termNos").toString());
merchantBackLkl.setAgencyNo(map.get("agencyNo").toString());
merchantBackLkl.setActiveNo(map.get("activeNo").toString());
merchantBackLkl.setContractId(map.get("contractId").toString());
merchantBackLkl.setCoreTermIds(map.get("coreTermIds").toString());
merchantBackLkl.setCreateTime(new Date());
backLklMapper.insert(merchantBackLkl);
}
MerchantAuditRecord lastRecord = merchantAuditRecordService.getLastRecord(merchantChannelStatus.getMerchantCode());
if (lastRecord != null) {
lastRecord.setStatus(merchantChannelStatus.getStatus());
lastRecord.setThirdStatus("1");
lastRecord.setRemark("成功");
merchantAuditRecordService.updateById(lastRecord);
mcsMapper.updateById(merchantChannelStatus);
}
return merchantChannelStatus;
}
public void createStore(MerchantChannelStatus merchantChannelStatus) {
// if (!"4".equals(merchantChannelStatus.getStatus()) && !"3".equals(merchantChannelStatus.getStatus())) {
// return;
// }
UserApp userApp = userAppMapper.selectByMerchantCode(merchantChannelStatus.getMerchantCode());
UserInfo userInfo = userInfoMapper.selectById(userApp.getUserId());
log.info("==============>当前需要同步的用户进件数据为::{}<===================", JSONObject.toJSONString(merchantChannelStatus));
if (userInfo != null) {
MerchantStore merchantStore = new MerchantStore().setMerchantCode(merchantChannelStatus.getMerchantCode());
merchantStore = merchantStoreMapper.selectOne(new QueryWrapper<>(merchantStore));
MerchantBaseInfo merchantBaseInfo = merchantBaseInfoService.getMerchantBaseInfoByMerchantCode(merchantChannelStatus.getMerchantCode());
QueryWrapper<MerchantImage> queryWrapper = new QueryWrapper<MerchantImage>()
.eq("merchantCode", merchantChannelStatus.getMerchantCode()).eq("photoType", "06");
MerchantImage merchantImage = merchantImageMapper.selectOne(queryWrapper);
//String baseUrl = "https://life.sxczgkj.cn/web/wmerchant.php?c=site&a=entry&ctrl=store&ac=oauth&op=add_merchan&do=web&m=we7_wmall&i=1";
String baseUrl = "https://kysh.sxczgkj.cn/javaApi/java-api/add-store";
StringBuilder sb = new StringBuilder(baseUrl);
sb.append("?title=").append(merchantBaseInfo.getAlias());
sb.append("&password=").append(userInfo.getPassword().toLowerCase());
sb.append("&mobile=").append(userInfo.getLoginName());
sb.append("&syb_m_id=").append(merchantStore.getId());
sb.append("&addressNo=").append(merchantBaseInfo.getAddressNo());
String address = merchantBaseInfo.getProvince() + merchantBaseInfo.getCity() + merchantBaseInfo.getDistrict() + merchantBaseInfo.getAddress();
String area = merchantBaseInfo.getProvince() +"-"+ merchantBaseInfo.getCity() +"-"+ merchantBaseInfo.getDistrict();
try {
String decodeAddress = URLEncoder.encode(address, "UTF-8");
sb.append("&address=").append(decodeAddress);
String decodeArea = URLEncoder.encode(area, "UTF-8");
sb.append("&area=").append(decodeArea);
String logo = URLEncoder.encode(merchantImage.getPicUrl(), "GBK");
sb.append("&logo=").append(logo);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
log.error("=============>请求生成店铺logo门头照转码异常,异常信息:{}<===============", e.getMessage());
}
Map<String, String> lnxMap = IpUtils.getLocationByAddress(address);
if (lnxMap != null) {
sb.append("&location_x=").append(lnxMap.get("x"));
sb.append("&location_y=").append(lnxMap.get("y"));
}
// 请求生成店铺j
String result = restTemplate.getForObject(sb.toString(), String.class);
log.info("=============>请求生成店铺URL{},请求响应返回的参数为:{}<===============", sb.toString(), result);
}
}
}

View File

@ -806,6 +806,7 @@ public class UserAppServiceImpl extends ServiceImpl<UserAppMapper, UserApp> impl
break;
case "5":
laKalaInterface.createTuoKeInfo(userId);
break;
default:
MsgException.throwException("未知的进件通道");
}