增加拉卡拉银行接口进去
This commit is contained in:
parent
59473c5dc7
commit
1e5c8145c4
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
|
||||
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
|
||||
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
|
||||
* Vestibulum commodo. Ut rhoncus gravida arcu.
|
||||
*/
|
||||
|
||||
package com.suisung.mall.common.modules.lakala;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("lkl_banks")
|
||||
@ApiModel(value = "拉卡拉银行信息(包含账户行号、结清行号)", description = "拉卡拉银行信息(包含账户行号、结清行号)")
|
||||
public class LklBanks implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
@ApiModelProperty(value = "自增ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "地区号")
|
||||
private String area_code;
|
||||
|
||||
@ApiModelProperty(value = "总行号")
|
||||
private String bank_no;
|
||||
|
||||
@ApiModelProperty(value = "银行名称")
|
||||
private String branch_bank_name;
|
||||
|
||||
@ApiModelProperty(value = "支行行号")
|
||||
private String branch_bank_no;
|
||||
|
||||
@ApiModelProperty(value = "结清行号")
|
||||
private String clear_no;
|
||||
|
||||
@ApiModelProperty(value = "记录状态:1-有效;2-无效;")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "记录创建时间")
|
||||
private Date created_at;
|
||||
|
||||
@ApiModelProperty(value = "记录更新时间")
|
||||
private Date updated_at;
|
||||
}
|
||||
@ -9,17 +9,18 @@
|
||||
package com.suisung.mall.shop.lakala.controller.mobile;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.modules.lakala.LklBanks;
|
||||
import com.suisung.mall.common.service.impl.BaseControllerImpl;
|
||||
import com.suisung.mall.shop.lakala.service.LklBanksService;
|
||||
import com.suisung.mall.shop.lakala.service.impl.LklTkServiceImpl;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -33,6 +34,26 @@ public class LklTkController extends BaseControllerImpl {
|
||||
@Resource
|
||||
private LklTkServiceImpl lklTkService;
|
||||
|
||||
@Resource
|
||||
private LklBanksService lklBanksService;
|
||||
|
||||
@ApiOperation(value = "搜索国内银行(支行)分页列表", notes = "搜索国内银行(支行)分页列表,数据包含有效的收款结清行号")
|
||||
@RequestMapping(value = "/bank/search", method = RequestMethod.POST)
|
||||
public CommonResult searchLklBanksPageList(@RequestBody JSONObject paramsJSON) {
|
||||
Page<LklBanks> list = lklBanksService.searchBranchBanksPageList(paramsJSON.getStr("keyword"), paramsJSON.getInt("pageNum"), paramsJSON.getInt("pageSize"));
|
||||
return CommonResult.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "拉卡拉进件申请", notes = "拉卡拉进件申请")
|
||||
@RequestMapping(value = "/registrationMerchant", method = {RequestMethod.POST, RequestMethod.GET})
|
||||
public CommonResult registrationMerchant(@RequestBody JSONObject paramsJSON) {
|
||||
Pair<Boolean, String> resp = lklTkService.registrationMerchant(paramsJSON.getStr("mchMobile"));
|
||||
if (resp.getFirst()) {
|
||||
return CommonResult.success(null, resp.getSecond());
|
||||
}
|
||||
|
||||
return CommonResult.failed(resp.getSecond());
|
||||
}
|
||||
|
||||
// https://mall.gpxscs.cn/api/mobile/shop/lakala/ledger/applyLedgerMerReceiverBindNotify
|
||||
@ApiOperation(value = "拉卡拉进件申请异步回调通知", notes = "拉卡拉进件申请异步回调通知")
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
|
||||
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
|
||||
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
|
||||
* Vestibulum commodo. Ut rhoncus gravida arcu.
|
||||
*/
|
||||
|
||||
package com.suisung.mall.shop.lakala.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.suisung.mall.common.modules.lakala.LklBanks;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
||||
@Repository
|
||||
public interface LklBanksMapper extends BaseMapper<LklBanks> {
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
|
||||
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
|
||||
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
|
||||
* Vestibulum commodo. Ut rhoncus gravida arcu.
|
||||
*/
|
||||
|
||||
package com.suisung.mall.shop.lakala.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.suisung.mall.common.modules.lakala.LklBanks;
|
||||
|
||||
public interface LklBanksService {
|
||||
|
||||
/**
|
||||
* 根据关键字查询有效记录分页列表
|
||||
*
|
||||
* @param keyword
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
Page<LklBanks> searchBranchBanksPageList(String keyword, Integer pageNum, Integer pageSize);
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2025. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
|
||||
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
|
||||
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
|
||||
* Vestibulum commodo. Ut rhoncus gravida arcu.
|
||||
*/
|
||||
|
||||
package com.suisung.mall.shop.lakala.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.suisung.mall.common.constant.CommonConstant;
|
||||
import com.suisung.mall.common.modules.lakala.LklBanks;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import com.suisung.mall.shop.lakala.mapper.LklBanksMapper;
|
||||
import com.suisung.mall.shop.lakala.service.LklBanksService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class LklBanksServiceImpl extends BaseServiceImpl<LklBanksMapper, LklBanks> implements LklBanksService {
|
||||
|
||||
|
||||
/**
|
||||
* 根据关键字查询有效记录分页列表
|
||||
*
|
||||
* @param keyword
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<LklBanks> searchBranchBanksPageList(String keyword, Integer pageNum, Integer pageSize) {
|
||||
if (pageNum == null || pageNum < 1) {
|
||||
pageNum = 1;
|
||||
}
|
||||
if (pageSize == null || pageSize < 1) {
|
||||
pageSize = 10;
|
||||
}
|
||||
|
||||
QueryWrapper<LklBanks> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
queryWrapper.eq("status", CommonConstant.Enable).orderByAsc("branch_bank_no");
|
||||
if (StrUtil.isNotBlank(keyword)) {
|
||||
queryWrapper.and(wrapper -> wrapper
|
||||
.like("branch_bank_name", keyword)
|
||||
.or()
|
||||
.like("branch_bank_no", keyword)
|
||||
.or()
|
||||
.like("clear_no", keyword)
|
||||
.or()
|
||||
.like("bank_no", keyword));
|
||||
}
|
||||
|
||||
return lists(queryWrapper, pageNum, pageSize);
|
||||
}
|
||||
}
|
||||
@ -43,7 +43,6 @@ import javax.annotation.Resource;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.PublicKey;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
@ -199,24 +198,28 @@ public class LklTkServiceImpl {
|
||||
requestBody.put("sourcechnl", "0"); // 来源: 0:PC,1:安卓,2:IOS
|
||||
requestBody.put("isOcr", "true");
|
||||
|
||||
ResponseEntity<JSONObject> updResponse = RestTemplateHttpUtil.sendPostBodyBackEntity(buildLklTkUrl(updUrlPath), header, requestBody, JSONObject.class);
|
||||
if (ObjectUtil.isEmpty(updResponse)
|
||||
|| updResponse.getStatusCode() != HttpStatus.OK
|
||||
|| ObjectUtil.isEmpty(updResponse.getBody())) {
|
||||
return CommonResult.failed("上传文件返回值有误");
|
||||
try {
|
||||
ResponseEntity<JSONObject> updResponse = RestTemplateHttpUtil.sendPostBodyBackEntity(buildLklTkUrl(updUrlPath), header, requestBody, JSONObject.class);
|
||||
if (ObjectUtil.isEmpty(updResponse)
|
||||
|| updResponse.getStatusCode() != HttpStatus.OK
|
||||
|| ObjectUtil.isEmpty(updResponse.getBody())) {
|
||||
return CommonResult.failed("上传文件返回值有误");
|
||||
}
|
||||
|
||||
// {batchNo,status,url,showUrl,result{} }
|
||||
JSONObject updObj = updResponse.getBody();
|
||||
String batchNo = updObj.getStr("batchNo");
|
||||
if (StrUtil.isBlank(batchNo)) {
|
||||
return CommonResult.failed("上传文件返回值有误");
|
||||
}
|
||||
|
||||
updObj.put("cosURL", imgURL);
|
||||
|
||||
return CommonResult.success(updObj);
|
||||
} catch (Exception e) {
|
||||
logger.error("上传文件失败: ", e.getMessage());
|
||||
return CommonResult.failed("上传文件失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
// {batchNo,status,url,showUrl,result{} }
|
||||
JSONObject updObj = updResponse.getBody();
|
||||
String batchNo = updObj.getStr("batchNo");
|
||||
if (StrUtil.isBlank(batchNo)) {
|
||||
return CommonResult.failed("上传文件返回值有误");
|
||||
}
|
||||
|
||||
updObj.put("cosURL", imgURL);
|
||||
|
||||
return CommonResult.success(updObj);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -256,23 +259,26 @@ public class LklTkServiceImpl {
|
||||
JSONObject ocrRequestBody = new JSONObject();
|
||||
ocrRequestBody.put("batchNo", batchNo);
|
||||
ocrRequestBody.put("imgType", imgType);
|
||||
logger.info("ocr请求参数:{}", ocrRequestBody);
|
||||
try {
|
||||
ResponseEntity<JSONObject> ocrResponse = RestTemplateHttpUtil.sendPostBodyBackEntity(buildLklTkUrl(ocrUrlPath), header, ocrRequestBody, JSONObject.class);
|
||||
if (ObjectUtil.isEmpty(ocrResponse)
|
||||
|| ocrResponse.getStatusCode() != HttpStatus.OK
|
||||
|| ObjectUtil.isEmpty(ocrResponse.getBody())) {
|
||||
return CommonResult.failed("OCR响应数据有误");
|
||||
}
|
||||
|
||||
ResponseEntity<JSONObject> ocrResponse = RestTemplateHttpUtil.sendPostBodyBackEntity(buildLklTkUrl(ocrUrlPath), header, ocrRequestBody, JSONObject.class);
|
||||
if (ObjectUtil.isEmpty(ocrResponse)
|
||||
|| ocrResponse.getStatusCode() != HttpStatus.OK
|
||||
|| ObjectUtil.isEmpty(ocrResponse.getBody())) {
|
||||
return CommonResult.failed("OCR响应数据有误");
|
||||
JSONObject ocrObj = ocrResponse.getBody().get("result", JSONObject.class);
|
||||
logger.info("ocr返回结果:{}", ocrResponse);
|
||||
if (ObjectUtil.isEmpty(ocrObj)) {
|
||||
return CommonResult.failed("OCR返回结果有误");
|
||||
}
|
||||
|
||||
return CommonResult.success(ocrObj);
|
||||
} catch (Exception e) {
|
||||
logger.error("OCR识别失败: ", e.getMessage());
|
||||
return CommonResult.failed("OCR识别失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
JSONObject ocrObj = ocrResponse.getBody().get("result", JSONObject.class);
|
||||
if (ObjectUtil.isEmpty(ocrObj)) {
|
||||
return CommonResult.failed("OCR返回结果有误");
|
||||
}
|
||||
|
||||
|
||||
return CommonResult.success(ocrObj);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -310,6 +316,8 @@ public class LklTkServiceImpl {
|
||||
|
||||
/**
|
||||
* (重要) 请求拉卡拉进件
|
||||
* <p>
|
||||
* 参考拉卡拉给的独立文档:2、拓客SAAS商户管理接口(新).docx
|
||||
*
|
||||
* @param mchMobile 商家手机号
|
||||
* @return
|
||||
@ -341,12 +349,6 @@ public class LklTkServiceImpl {
|
||||
Boolean isQy = CommonConstant.MCH_ENTITY_TYPE_QY.equals(shopMchEntry.getEntity_type());
|
||||
formData.put("merType", isQy ? "TP_MERCHANT" : "TP_PERSONAL");
|
||||
|
||||
Map<String, String> areaCode = getAreaCode(shopMchEntry.getStore_area(), false);
|
||||
if (ObjectUtil.isNotEmpty(areaCode)) {
|
||||
formData.put("provinceCode", areaCode.get("provinceCode"));
|
||||
formData.put("cityCode", areaCode.get("cityCode"));
|
||||
formData.put("countyCode", areaCode.get("countyCode"));
|
||||
}
|
||||
|
||||
formData.put("longtude", shopMchEntry.getStore_longitude()); //longitude 经度
|
||||
formData.put("latitude", shopMchEntry.getStore_latitude());
|
||||
@ -390,9 +392,18 @@ public class LklTkServiceImpl {
|
||||
formData.put("accountIdCard", shopMchEntry.getLegal_person_id_number());//结算⼈证件号码(身份证)
|
||||
|
||||
formData.put("settleType", "D1"); //结算类型,D0秒到,D1次日结算
|
||||
formData.put("settlementType", "AUTOMATIC"); // 结算方式:MANUAL:手动结算(结算至拉卡拉APP钱包),AUTOMATIC:自动结算到银行卡,REGULAR:定时结算(仅企业商户支持)
|
||||
// formData.put("settlementType", "AUTOMATIC"); // 结算方式:MANUAL:手动结算(结算至拉卡拉APP钱包),AUTOMATIC:自动结算到银行卡,REGULAR:定时结算(仅企业商户支持)
|
||||
|
||||
//结算信息省份代码
|
||||
|
||||
// 店铺省市区信息
|
||||
Map<String, String> areaCode = getAreaCode(shopMchEntry.getStore_area(), false);
|
||||
if (ObjectUtil.isNotEmpty(areaCode)) {
|
||||
formData.put("provinceCode", areaCode.get("provinceCode"));
|
||||
formData.put("cityCode", areaCode.get("cityCode"));
|
||||
formData.put("countyCode", areaCode.get("countyCode"));
|
||||
}
|
||||
|
||||
//结算信息省市信息
|
||||
Map<String, String> bankAreaCode = getAreaCode(shopMchEntry.getBank_area(), true);
|
||||
if (ObjectUtil.isNotEmpty(bankAreaCode)) {
|
||||
formData.put("settleProvinceCode", bankAreaCode.get("provinceCode"));
|
||||
@ -404,6 +415,7 @@ public class LklTkServiceImpl {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO 咨询拉卡拉清楚
|
||||
JSONObject bizContent = new JSONObject();
|
||||
bizContent.put("activityId", 687);
|
||||
@ -412,7 +424,7 @@ public class LklTkServiceImpl {
|
||||
bizContent.put("fees", new JSONArray() {{
|
||||
put(new JSONObject() {{
|
||||
put("feeCode", "WECHAT");
|
||||
put("feeValue", 0.25);
|
||||
put("feeValue", 0.38);
|
||||
}});
|
||||
}});
|
||||
formData.put("bizContent", bizContent);
|
||||
@ -429,14 +441,14 @@ public class LklTkServiceImpl {
|
||||
attachments.put(ID_CARD_BEHIND); // 身份证国徽面
|
||||
}
|
||||
|
||||
JSONObject SETTLE_ID_CARD_FRONT = updatePhoto(shopMchEntry.getLegal_person_id_images(), "SETTLE_ID_CARD_FRONT", false);
|
||||
JSONObject SETTLE_ID_CARD_FRONT = updatePhoto(shopMchEntry.getLegal_person_id_images(), "FR_ID_CARD_FRONT", false);
|
||||
if (SETTLE_ID_CARD_FRONT != null) {
|
||||
attachments.put(SETTLE_ID_CARD_FRONT); // 结算人身份证正面
|
||||
attachments.put(SETTLE_ID_CARD_FRONT); // 法人身份证正面
|
||||
}
|
||||
|
||||
JSONObject SETTLE_ID_CARD_BEHIND = updatePhoto(shopMchEntry.getLegal_person_id_images2(), "SETTLE_ID_CARD_BEHIND", false);
|
||||
JSONObject SETTLE_ID_CARD_BEHIND = updatePhoto(shopMchEntry.getLegal_person_id_images2(), "FR_ID_CARD_BEHIND", false);
|
||||
if (SETTLE_ID_CARD_BEHIND != null) {
|
||||
attachments.put(SETTLE_ID_CARD_BEHIND); // 结算人身份证国徽面
|
||||
attachments.put(SETTLE_ID_CARD_BEHIND); // 法人身份证国徽面
|
||||
}
|
||||
|
||||
JSONObject BUSINESS_LICENCE = updatePhoto(shopMchEntry.getBiz_license_image(), "BUSINESS_LICENCE", false);
|
||||
@ -462,21 +474,28 @@ public class LklTkServiceImpl {
|
||||
// 附件文件相关结束
|
||||
|
||||
String urlPath = isProd() ? "/registration/merchant" : "/sit/htkregistration/merchant";
|
||||
ResponseEntity<JSONObject> response = RestTemplateHttpUtil.sendPostFormDataBackEntity(buildLklTkUrl(urlPath), header, formData, JSONObject.class);
|
||||
if (ObjectUtil.isEmpty(response) || response.getStatusCode() != HttpStatus.OK) {
|
||||
String errMsg = "进件返回空或请求状态异常";
|
||||
if (ObjectUtil.isNotEmpty(response.getBody()) && ObjectUtil.isNotEmpty(response.getBody().getStr("message"))) {
|
||||
errMsg = response.getBody().getStr("message");
|
||||
}
|
||||
return Pair.of(false, "进件失败:" + errMsg);
|
||||
}
|
||||
try {
|
||||
logger.info("进件请求参数:{}", JSONUtil.toJsonStr(formData));
|
||||
|
||||
// 更改入驻记录的拉卡拉内部商户号和进件请求参数
|
||||
String lklMerCupNo = response.getBody().getStr("merchantNo"); //拉卡拉内部商户号
|
||||
// 表中的内部外部商户号暂时都传同一个内部商户号,以便异步通知更改记录
|
||||
Boolean success = shopMchEntryService.updateMerchEntryLklMerCupNo(mchMobile, CommonConstant.Disable2, lklMerCupNo, lklMerCupNo, formData.toString());
|
||||
if (!success) {
|
||||
return Pair.of(false, "提交进件成功,但更新商户号失败!");
|
||||
ResponseEntity<JSONObject> response = RestTemplateHttpUtil.sendPostBodyBackEntity(buildLklTkUrl(urlPath), header, formData, JSONObject.class);
|
||||
if (ObjectUtil.isEmpty(response) || response.getStatusCode() != HttpStatus.OK) {
|
||||
String errMsg = "进件返回空或请求状态异常";
|
||||
if (ObjectUtil.isNotEmpty(response.getBody()) && ObjectUtil.isNotEmpty(response.getBody().getStr("message"))) {
|
||||
errMsg = response.getBody().getStr("message");
|
||||
}
|
||||
return Pair.of(false, "进件失败:" + errMsg);
|
||||
}
|
||||
|
||||
// 更改入驻记录的拉卡拉内部商户号和进件请求参数
|
||||
String lklMerCupNo = response.getBody().getStr("merchantNo"); //拉卡拉内部商户号
|
||||
// 表中的内部外部商户号暂时都传同一个内部商户号,以便异步通知更改记录
|
||||
Boolean success = shopMchEntryService.updateMerchEntryLklMerCupNo(mchMobile, CommonConstant.Disable2, lklMerCupNo, lklMerCupNo, formData.toString());
|
||||
if (!success) {
|
||||
return Pair.of(false, "提交进件成功,但更新商户号失败!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("拉卡拉进件异常:{}", e.getMessage());
|
||||
return Pair.of(false, "进件失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
return Pair.of(true, "提交进件成功,请等待审核!");
|
||||
@ -520,7 +539,6 @@ public class LklTkServiceImpl {
|
||||
return new JSONObject().set("code", "500").set("message", "参数解析出错");
|
||||
}
|
||||
|
||||
|
||||
// 给商家入驻表增加拉卡拉的商户号和拉卡拉返回的数据
|
||||
String merCupNo = dataJSON.getStr("externalCustomerNo"); //拉卡拉外部商户号
|
||||
String merInnerNo = dataJSON.getStr("customerNo"); //拉卡拉内部商户号
|
||||
@ -564,6 +582,10 @@ public class LklTkServiceImpl {
|
||||
}
|
||||
|
||||
String provinceName = areaNames[0];
|
||||
// 因为5个自治区需要简称,所以去掉 壮族,回族,维吾尔族
|
||||
provinceName = StrUtil.replace(provinceName, "壮族", "")
|
||||
.replace("回族", "")
|
||||
.replace("维吾尔族", "").replace("自治区", "");
|
||||
String cityName = areaNames[1];
|
||||
String countryName = "";
|
||||
if (areaNames.length >= 3) {
|
||||
@ -592,6 +614,7 @@ public class LklTkServiceImpl {
|
||||
|
||||
JSONArray jsonArray = response.getBody();
|
||||
if (CollUtil.isNotEmpty(jsonArray)) {
|
||||
// logger.info("省份列表:{}", jsonArray.toString());
|
||||
// 省份列表
|
||||
for (JSONObject jsonObject : jsonArray.jsonIter()) {
|
||||
if (StrUtil.contains(jsonObject.getStr("name"), provinceName)) {
|
||||
@ -606,6 +629,7 @@ public class LklTkServiceImpl {
|
||||
response = RestTemplateHttpUtil.sendGetWithHeader(buildLklTkUrl(urlPath + "/" + provinceCode), header, JSONArray.class);
|
||||
jsonArray = response.getBody();
|
||||
if (CollUtil.isNotEmpty(jsonArray)) {
|
||||
// logger.info("城市列表:{}", jsonArray.toString());
|
||||
for (JSONObject jsonObject : jsonArray.jsonIter()) {
|
||||
if (StrUtil.contains(jsonObject.getStr("name"), cityName)) {
|
||||
cityCode = jsonObject.getStr("code");
|
||||
@ -621,6 +645,7 @@ public class LklTkServiceImpl {
|
||||
response = RestTemplateHttpUtil.sendGetWithHeader(buildLklTkUrl(urlPath + "/" + cityCode), header, JSONArray.class);
|
||||
jsonArray = response.getBody();
|
||||
if (CollUtil.isNotEmpty(jsonArray)) {
|
||||
// logger.info("区列表:{}", jsonArray.toString());
|
||||
for (JSONObject jsonObject : jsonArray.jsonIter()) {
|
||||
if (StrUtil.contains(jsonObject.getStr("name"), countryName)) {
|
||||
countyCode = jsonObject.getStr("code");
|
||||
@ -642,6 +667,8 @@ public class LklTkServiceImpl {
|
||||
* @param fileUrl
|
||||
* @param imgType ID_CARD_FRONT 身份证正⾯
|
||||
* ID_CARD_BEHIND 身份证反⾯
|
||||
* FR_ID_CARD_FRONT 身份证正⾯
|
||||
* FR_ID_CARD_BEHIND 身份证反⾯
|
||||
* BUSINESS_LICENCE 营业执照照⽚
|
||||
* BANK_CARD 银行卡(企业对公不需要传)
|
||||
* AGREE_MENT 协议
|
||||
@ -664,25 +691,38 @@ public class LklTkServiceImpl {
|
||||
JSONObject header = new JSONObject();
|
||||
header.put("Authorization", getLklTkAuthorization());
|
||||
|
||||
JSONObject formData = new JSONObject();
|
||||
File file = UploadUtil.downloadImageFromUrl(fileUrl);
|
||||
formData.put("file", file);
|
||||
formData.put("imgType", imgType);
|
||||
formData.put("sourcechnl", "0");
|
||||
formData.put("isOcr", isOcr);
|
||||
|
||||
String urlPath = isProd() ? "/registration/file/upload" : "/sit/htkregistration/file/upload";
|
||||
|
||||
ResponseEntity<JSONObject> response = RestTemplateHttpUtil.sendPostFormDataBackEntity(buildLklTkUrl(urlPath), header, formData, JSONObject.class);
|
||||
if (ObjectUtil.isEmpty(response) || response.getStatusCode() != HttpStatus.OK) {
|
||||
String updUrlPath = isProd() ? "/registration/file/base/upload" : "/sit/htkregistration/file/base/upload";
|
||||
String fileBase64 = UploadUtil.fileUrlToBase64(fileUrl);
|
||||
if (StrUtil.isBlank(fileBase64)) {
|
||||
logger.error("文件转换失败");
|
||||
return null;
|
||||
}
|
||||
JSONObject result = response.getBody();
|
||||
if (ObjectUtil.isEmpty(result)) {
|
||||
// Base64Utils.encodeToString(file.getBytes());
|
||||
|
||||
JSONObject requestBody = new JSONObject();
|
||||
requestBody.put("fileBase64", fileBase64);
|
||||
requestBody.put("imgType", imgType);
|
||||
requestBody.put("sourcechnl", "0"); // 来源: 0:PC,1:安卓,2:IOS
|
||||
requestBody.put("isOcr", "true");
|
||||
|
||||
try {
|
||||
ResponseEntity<JSONObject> updResponse = RestTemplateHttpUtil.sendPostBodyBackEntity(buildLklTkUrl(updUrlPath), header, requestBody, JSONObject.class);
|
||||
if (ObjectUtil.isEmpty(updResponse)
|
||||
|| updResponse.getStatusCode() != HttpStatus.OK) {
|
||||
logger.error("上传文件返回值有误");
|
||||
return null;
|
||||
}
|
||||
|
||||
JSONObject result = updResponse.getBody();
|
||||
if (ObjectUtil.isEmpty(result)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new JSONObject().put("id", result.get("url")).put("type", imgType);
|
||||
} catch (Exception e) {
|
||||
logger.error("上传文件异常:{}", e.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
return new JSONObject().put("id", result.get("url")).put("type", imgType);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.suisung.mall.shop.lakala.mapper.LklBanksMapper">
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
*
|
||||
</sql>
|
||||
</mapper>
|
||||
@ -1,4 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.suisung.mall.shop.lakala.mapper.LklLedgerMemberMapper">
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
*
|
||||
</sql>
|
||||
</mapper>
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.suisung.mall.shop.lakala.mapper.LklLedgerMerReceiverBindMapper">
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
*
|
||||
</sql>
|
||||
</mapper>
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.suisung.mall.shop.lakala.mapper.LklLedgerReceiverMapper">
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
*
|
||||
</sql>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user