修改代理商表结构

This commit is contained in:
Jack 2025-05-04 23:33:26 +08:00
parent 0f563493ef
commit 2ed235f8fb
12 changed files with 308 additions and 14 deletions

View File

@ -47,6 +47,9 @@ public class EsignPlatformInfo implements Serializable {
@ApiModelProperty(value = "平台方营业执照公司名称") @ApiModelProperty(value = "平台方营业执照公司名称")
private String license_company; private String license_company;
@ApiModelProperty(value = "平台方营业执照上的经营内容")
private String license_content;
@ApiModelProperty(value = "代理商的省/市/区,如:广东省/深圳市/福田区") @ApiModelProperty(value = "代理商的省/市/区,如:广东省/深圳市/福田区")
private String license_area; private String license_area;

View File

@ -47,6 +47,10 @@ public class LklLedgerMember implements Serializable {
private String audit_resp; private String audit_resp;
private String remark; private String remark;
private Long mch_id; private Long mch_id;
private Integer has_esigned;
private Integer has_apply_split;
private Integer has_receiver;
private Integer has_bind_receiver;
private String version; private String version;
private Date created_at; private Date created_at;
private Date updated_at; private Date updated_at;

View File

@ -114,6 +114,9 @@ public class ShopMchEntry implements Serializable {
@ApiModelProperty(value = "入驻商家营业执照图片的存储路径") @ApiModelProperty(value = "入驻商家营业执照图片的存储路径")
private String biz_license_image; private String biz_license_image;
@ApiModelProperty(value = "入驻商家营业执照的经营范围")
private String biz_license_content;
@ApiModelProperty(value = "入驻商家的许可证类型1-许可证2-特许证件3-其他证件") @ApiModelProperty(value = "入驻商家的许可证类型1-许可证2-特许证件3-其他证件")
private Integer license_type; private Integer license_type;

View File

@ -11,6 +11,8 @@ package com.suisung.mall.shop.esign.service;
import com.suisung.mall.common.modules.esign.EsignPlatformInfo; import com.suisung.mall.common.modules.esign.EsignPlatformInfo;
import org.springframework.data.util.Pair; import org.springframework.data.util.Pair;
import java.util.List;
/** /**
* 平台方详细信息接口 * 平台方详细信息接口
*/ */
@ -24,14 +26,29 @@ public interface EsignPlatformInfoService {
*/ */
EsignPlatformInfo getDistributorInfoById(Long id); EsignPlatformInfo getDistributorInfoById(Long id);
/**
* 根据ID获取代理商信息
*
* @param ids
* @return
*/
List<EsignPlatformInfo> getDistributorInfoByIds(Long... ids);
/** /**
* 根据分类和营业执照号获取平台方信息 * 根据分类和营业执照号获取平台方信息
* *
* @param type 分类必选类型:0-平台方(只能一条记录)1-一级代理2-二级代理3-三级代理4-四级代理 * @param level 分类必选类型:0-平台方(只能一条记录)1-一级代理2-二级代理3-三级代理4-四级代理
* @param licenseNumber 营业执照号码可选 * @param licenseNumber 营业执照号码可选
* @return * @return
*/ */
EsignPlatformInfo getEsignPlatformInfo(Integer type, String licenseNumber); EsignPlatformInfo getEsignPlatformInfo(Integer level, String licenseNumber);
/**
* 是否存在平台方的相关记录信息
*
* @return
*/
EsignPlatformInfo hasPlatformMch();
/** /**

View File

@ -33,35 +33,51 @@ public class EsignPlatformInfoServiceImpl extends BaseServiceImpl<EsignPlatformI
*/ */
@Override @Override
public EsignPlatformInfo getDistributorInfoById(Long id) { public EsignPlatformInfo getDistributorInfoById(Long id) {
if (ObjectUtils.isEmpty(id)) { List<EsignPlatformInfo> list = getDistributorInfoByIds(id);
if (CollectionUtil.isEmpty(list)) {
return null;
}
return list.get(0);
}
/**
* 根据ID获取代理商信息
*
* @param ids
* @return
*/
@Override
public List<EsignPlatformInfo> getDistributorInfoByIds(Long... ids) {
if (ids == null || ids.length == 0) {
return null; return null;
} }
QueryWrapper<EsignPlatformInfo> queryWrapper = new QueryWrapper<>(); QueryWrapper<EsignPlatformInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", id).gt("type", 0).eq("status", CommonConstant.Enable); queryWrapper.in("id", ids).eq("status", CommonConstant.Enable);
List<EsignPlatformInfo> esignPlatformInfos = list(queryWrapper); List<EsignPlatformInfo> esignPlatformInfos = list(queryWrapper);
if (CollectionUtil.isEmpty(esignPlatformInfos)) { if (CollectionUtil.isEmpty(esignPlatformInfos)) {
return null; return null;
} }
return esignPlatformInfos.get(0); return esignPlatformInfos;
} }
/** /**
* 根据分类和营业执照号获取平台方信息 * 根据分类和营业执照号获取平台方信息
* *
* @param type 分类可选类型:0-平台方(只能一条记录)1-一级代理2-二级代理3-三级代理4-四级代理 * @param level 分类可选类型:0-平台方(只能一条记录)1-一级代理2-二级代理3-三级代理4-四级代理
* @param licenseNumber 营业执照号码可选 * @param licenseNumber 营业执照号码可选
* @return * @return
*/ */
@Override @Override
public EsignPlatformInfo getEsignPlatformInfo(Integer type, String licenseNumber) { public EsignPlatformInfo getEsignPlatformInfo(Integer level, String licenseNumber) {
QueryWrapper<EsignPlatformInfo> queryWrapper = new QueryWrapper<>(); QueryWrapper<EsignPlatformInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status", CommonConstant.Enable); queryWrapper.eq("status", CommonConstant.Enable);
if (!ObjectUtils.isEmpty(type)) { if (!ObjectUtils.isEmpty(level)) {
queryWrapper.eq("type", type); queryWrapper.eq("level", level);
} else { } else {
queryWrapper.eq("type", 0); queryWrapper.eq("level", 0);
} }
if (StrUtil.isNotBlank(licenseNumber)) { if (StrUtil.isNotBlank(licenseNumber)) {
@ -76,6 +92,24 @@ public class EsignPlatformInfoServiceImpl extends BaseServiceImpl<EsignPlatformI
return esignPlatformInfos.get(0); return esignPlatformInfos.get(0);
} }
/**
* 是否存在平台方的相关记录信息
*
* @return
*/
@Override
public EsignPlatformInfo hasPlatformMch() {
QueryWrapper<EsignPlatformInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("level", 0).eq("status", CommonConstant.Enable);
EsignPlatformInfo esignPlatformInfo = getOne(queryWrapper);
if (ObjectUtils.isEmpty(esignPlatformInfo)) {
return null;
}
return esignPlatformInfo;
}
/** /**
* 获取平台方手机号和营业执照号 * 获取平台方手机号和营业执照号
* *
@ -84,7 +118,7 @@ public class EsignPlatformInfoServiceImpl extends BaseServiceImpl<EsignPlatformI
@Override @Override
public Pair<String, String> getEsignPlatformMobileAndLicenseNumber() { public Pair<String, String> getEsignPlatformMobileAndLicenseNumber() {
QueryWrapper<EsignPlatformInfo> queryWrapper = new QueryWrapper(); QueryWrapper<EsignPlatformInfo> queryWrapper = new QueryWrapper();
queryWrapper.eq("type", 0).select("telephone", "license_number", "legal_person_mobile"); queryWrapper.eq("level", 0).select("telephone", "license_number", "legal_person_mobile");
List<EsignPlatformInfo> esignPlatformInfos = list(queryWrapper); List<EsignPlatformInfo> esignPlatformInfos = list(queryWrapper);
if (CollectionUtil.isEmpty(esignPlatformInfos)) { if (CollectionUtil.isEmpty(esignPlatformInfos)) {
return null; return null;

View File

@ -53,4 +53,5 @@ public interface LklLedgerMemberService extends IBaseService<LklLedgerMember> {
* @return * @return
*/ */
Boolean updateAuditResult(String applyId, String merInnerNo, String merCupNo, String entrustFileName, String entrustFilePath, String auditStatus, String auditStatusText, String remark); Boolean updateAuditResult(String applyId, String merInnerNo, String merCupNo, String entrustFileName, String entrustFilePath, String auditStatus, String auditStatusText, String remark);
} }

View File

@ -8,6 +8,7 @@
package com.suisung.mall.shop.lakala.service; package com.suisung.mall.shop.lakala.service;
import cn.hutool.json.JSONArray;
import com.suisung.mall.common.modules.lakala.LklLedgerReceiver; import com.suisung.mall.common.modules.lakala.LklLedgerReceiver;
import com.suisung.mall.core.web.service.IBaseService; import com.suisung.mall.core.web.service.IBaseService;
@ -29,6 +30,37 @@ public interface LklLedgerReceiverService extends IBaseService<LklLedgerReceiver
*/ */
LklLedgerReceiver getByReceiverNo(String receiverNo); LklLedgerReceiver getByReceiverNo(String receiverNo);
/**
* 通过平台方代理商 ID 查询记录
*
* @param platformId
* @return
*/
LklLedgerReceiver getByPlatformId(Long platformId);
/**
* 通过平台方代理商记录信息构建申请分账接收方的请求参数
*
* @param platformId
* @return
*/
JSONArray buildApplyLedgerReceiverReqParams(Long platformId);
/**
* 内部调用申请分账接收方
*
* @param platformId
* @return
*/
Boolean innerApplyLedgerReceiver(Long platformId);
/**
* 是否存在平台方的相关记录信息
*
* @return
*/
LklLedgerReceiver hasPlatformMch();
/** /**
* 根据条件查询记录 * 根据条件查询记录
* *

View File

@ -58,6 +58,7 @@ public class LakalaApiServiceImpl implements LakalaApiService {
public String merchantNo; // 拉卡拉分配的商户号 public String merchantNo; // 拉卡拉分配的商户号
@Value("${lakala.term_no}") @Value("${lakala.term_no}")
public String termNo; // 拉卡拉分配的终端号码 public String termNo; // 拉卡拉分配的终端号码
@Value("${lakala.server_url}") @Value("${lakala.server_url}")
private String serverUrl; //服务地址 private String serverUrl; //服务地址
@Value("${lakala.app_id}") @Value("${lakala.app_id}")

View File

@ -11,18 +11,35 @@ package com.suisung.mall.shop.lakala.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.suisung.mall.common.api.CommonResult;
import com.suisung.mall.common.constant.CommonConstant; import com.suisung.mall.common.constant.CommonConstant;
import com.suisung.mall.common.modules.esign.EsignPlatformInfo;
import com.suisung.mall.common.modules.lakala.LklLedgerReceiver; import com.suisung.mall.common.modules.lakala.LklLedgerReceiver;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl; import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import com.suisung.mall.shop.esign.service.EsignPlatformInfoService;
import com.suisung.mall.shop.lakala.mapper.LklLedgerReceiverMapper; import com.suisung.mall.shop.lakala.mapper.LklLedgerReceiverMapper;
import com.suisung.mall.shop.lakala.service.LakalaApiService;
import com.suisung.mall.shop.lakala.service.LklLedgerReceiverService; import com.suisung.mall.shop.lakala.service.LklLedgerReceiverService;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Service @Service
public class LklLedgerReceiverServiceImpl extends BaseServiceImpl<LklLedgerReceiverMapper, LklLedgerReceiver> implements LklLedgerReceiverService { public class LklLedgerReceiverServiceImpl extends BaseServiceImpl<LklLedgerReceiverMapper, LklLedgerReceiver> implements LklLedgerReceiverService {
@Resource
private EsignPlatformInfoService esignPlatformInfoService;
@Lazy
@Resource
private LakalaApiService lakalaApiService;
/** /**
* 根据接收方编号新增或更新记录 * 根据接收方编号新增或更新记录
* *
@ -52,7 +69,7 @@ public class LklLedgerReceiverServiceImpl extends BaseServiceImpl<LklLedgerRecei
if (CollectionUtil.isNotEmpty(existsRecordList) if (CollectionUtil.isNotEmpty(existsRecordList)
&& existsRecordList.get(0) != null && existsRecordList.get(0) != null
&& existsRecordList.get(0).getId() > 0) { && existsRecordList.get(0).getId() > 0) {
// update // 更新记录
record.setId(existsRecordList.get(0).getId()); record.setId(existsRecordList.get(0).getId());
return updateById(record); return updateById(record);
} }
@ -60,6 +77,7 @@ public class LklLedgerReceiverServiceImpl extends BaseServiceImpl<LklLedgerRecei
return add(record); return add(record);
} }
/** /**
* 根据接收方编号查询记录 * 根据接收方编号查询记录
* *
@ -79,6 +97,142 @@ public class LklLedgerReceiverServiceImpl extends BaseServiceImpl<LklLedgerRecei
return getOne(queryWrapper); return getOne(queryWrapper);
} }
/**
* 通过平台方代理商 ID 查询记录
*
* @param platformId
* @return
*/
@Override
public LklLedgerReceiver getByPlatformId(Long platformId) {
if (ObjectUtil.isEmpty(platformId)) {
return null;
}
QueryWrapper<LklLedgerReceiver> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("platform_id", platformId).eq("status", CommonConstant.Enable).orderByAsc("id");
List<LklLedgerReceiver> lklLedgerReceivers = list(queryWrapper);
if (CollectionUtil.isEmpty(lklLedgerReceivers)) {
return null;
}
return lklLedgerReceivers.get(0);
}
/**
* 通过平台方代理商 ID 记录信息转成 Lakala 接收方记录
* 平台方一定要获取如果有代理商也要获取
*
* @param platformId
* @return
*/
@Override
public JSONArray buildApplyLedgerReceiverReqParams(Long platformId) {
List<Long> ids = new ArrayList<>();
ids.add(0L);
if (ObjectUtil.isNotEmpty(platformId)) {
ids.add(platformId);
}
List<EsignPlatformInfo> esignPlatformInfoList = esignPlatformInfoService.getDistributorInfoByIds(ids.toArray(new Long[0]));
if (CollectionUtil.isEmpty(esignPlatformInfoList)) {
return null;
}
JSONArray reqParams = new JSONArray();
for (EsignPlatformInfo esignPlatformInfo : esignPlatformInfoList) {
JSONObject reqParam = new JSONObject();
reqParam.put("receiverName", esignPlatformInfo.getLicense_company());
reqParam.put("contactMobile", esignPlatformInfo.getLegal_person_mobile());
reqParam.put("licenseNo", esignPlatformInfo.getLicense_number());
reqParam.put("licenseName", esignPlatformInfo.getLicense_company());
reqParam.put("legalPersonName", esignPlatformInfo.getLegal_person_name());
reqParam.put("legalPersonCertificateType", "17");
reqParam.put("legalPersonCertificateNo", esignPlatformInfo.getLegal_person_id_card());
reqParam.put("acctNo", esignPlatformInfo.getRec_acc_card_no());
reqParam.put("acctName", esignPlatformInfo.getRec_acc_bank_name());
reqParam.put("acctTypeCode", "57");
reqParam.put("acctCertificateType", "17");
reqParam.put("acctCertificateNo", esignPlatformInfo.getLegal_person_id_card());
reqParam.put("acctOpenBankCode", esignPlatformInfo.getRec_acc_bank_no());
reqParam.put("acctOpenBankName", esignPlatformInfo.getRec_acc_bank_name());
reqParam.put("acctClearBankCode", esignPlatformInfo.getRec_acc_clear_bank_no());
JSONArray attachList = new JSONArray();
if (StrUtil.isNotBlank(esignPlatformInfo.getLicense_image())) {
JSONObject BUSINESS_LICENCE = new JSONObject();
BUSINESS_LICENCE.put("attachType", "BUSINESS_LICENCE").put("attachName", "营业执照")
.put("attachStoreFile", esignPlatformInfo.getLicense_image());
attachList.add(BUSINESS_LICENCE);
}
if (StrUtil.isNotBlank(esignPlatformInfo.getLegal_person_id_card_image1())) {
JSONObject FR_ID_CARD_FRONT = new JSONObject();
FR_ID_CARD_FRONT.put("attachType", "FR_ID_CARD_FRONT").put("attachName", "法人身份证正面")
.put("attachStoreFile", esignPlatformInfo.getLegal_person_id_card_image1());
attachList.add(FR_ID_CARD_FRONT);
}
if (StrUtil.isNotBlank(esignPlatformInfo.getLegal_person_id_card_image2())) {
JSONObject FR_ID_CARD_BEHIND = new JSONObject();
FR_ID_CARD_BEHIND.put("attachType", "FR_ID_CARD_BEHIND").put("attachName", "法人身份证反面")
.put("attachStoreFile", esignPlatformInfo.getLegal_person_id_card_image2());
attachList.add(FR_ID_CARD_BEHIND);
}
if (CollectionUtil.isNotEmpty(attachList)) {
reqParam.put("attachList", attachList);
}
}
return reqParams;
}
/**
* 内部调用申请分账接收方
*
* @param platformId
* @return
*/
@Override
public Boolean innerApplyLedgerReceiver(Long platformId) {
JSONArray buildApplyLedgerReceiverReqParams = buildApplyLedgerReceiverReqParams(platformId);
if (CollectionUtil.isEmpty(buildApplyLedgerReceiverReqParams)) {
return false;
}
int success = 0;
for (JSONObject reqParam : buildApplyLedgerReceiverReqParams.jsonIter()) {
CommonResult result = lakalaApiService.applyLedgerReceiver(reqParam);
if (result == null || result.getCode() != 200) {
continue;
}
success += 1;
}
return success > 0;
}
/**
* @return
*/
@Override
public LklLedgerReceiver hasPlatformMch() {
QueryWrapper<LklLedgerReceiver> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("platform_id", 0).eq("status", CommonConstant.Enable).orderByAsc("id");
List<LklLedgerReceiver> lklLedgerReceivers = list(queryWrapper);
if (CollectionUtil.isEmpty(lklLedgerReceivers)) {
return null;
}
return lklLedgerReceivers.get(0);
}
/** /**
* 根据条件查询记录 * 根据条件查询记录
* *

View File

@ -20,12 +20,14 @@ import com.suisung.mall.common.utils.RestTemplateHttpUtil;
import com.suisung.mall.common.utils.StringUtils; import com.suisung.mall.common.utils.StringUtils;
import com.suisung.mall.common.utils.UploadUtil; import com.suisung.mall.common.utils.UploadUtil;
import com.suisung.mall.core.web.service.RedisService; import com.suisung.mall.core.web.service.RedisService;
import com.suisung.mall.shop.lakala.service.LklLedgerReceiverService;
import com.suisung.mall.shop.lakala.utils.LakalaUtil; import com.suisung.mall.shop.lakala.utils.LakalaUtil;
import com.suisung.mall.shop.store.service.ShopMchEntryService; import com.suisung.mall.shop.store.service.ShopMchEntryService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.util.Pair; import org.springframework.data.util.Pair;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
@ -71,6 +73,10 @@ public class LklTkServiceImpl {
@Resource @Resource
private ShopMchEntryService shopMchEntryService; private ShopMchEntryService shopMchEntryService;
@Lazy
@Resource
private LklLedgerReceiverService lklLedgerReceiverService;
@Autowired @Autowired
private RedisService redisService; private RedisService redisService;
@ -412,7 +418,15 @@ public class LklTkServiceImpl {
return new JSONObject().set("code", "500").set("message", "更新商户号失败"); return new JSONObject().set("code", "500").set("message", "更新商户号失败");
} }
// 根据入驻商家的代理商或平台方顺便新增一个接收方记录 ShopMchEntry shopMchEntry = shopMchEntryService.getShopMerchEntryByMerCupNo(merCupNo);
if (ObjectUtil.isEmpty(shopMchEntry)) {
return new JSONObject().set("code", "500").set("message", "商户入驻信息不存在");
}
// 1发起E签宝合同签署2立即给商家申请分账功能权限3新增一个接收方记录起码要一个平台方代理商根据入驻信息新增
//3
lklLedgerReceiverService.innerApplyLedgerReceiver(shopMchEntry.getDistributor_id());
return new JSONObject().set("code", "200").set("message", "成功"); return new JSONObject().set("code", "200").set("message", "成功");
} }

View File

@ -108,6 +108,15 @@ public interface ShopMchEntryService {
*/ */
ShopMchEntry getShopMerchEntryByCondition(String loginMobile, String bizLicenseNumber, Integer approvalStatus); ShopMchEntry getShopMerchEntryByCondition(String loginMobile, String bizLicenseNumber, Integer approvalStatus);
/**
* 根据拉卡拉外部商户号获取有效的商家入驻申请记录
*
* @param merCupNo
* @return
*/
ShopMchEntry getShopMerchEntryByMerCupNo(String merCupNo);
/** /**
* 根据商家注册的手机号更新合同签署状态和合同下载地址 * 根据商家注册的手机号更新合同签署状态和合同下载地址
* *

View File

@ -640,6 +640,28 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
return recordList.get(0); return recordList.get(0);
} }
/**
* 根据拉卡拉外部商户号获取有效的商家入驻申请记录
*
* @param merCupNo
* @return
*/
@Override
public ShopMchEntry getShopMerchEntryByMerCupNo(String merCupNo) {
if (StrUtil.isBlank(merCupNo)) {
return null;
}
QueryWrapper<ShopMchEntry> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("mer_cup_no", merCupNo).eq("status", CommonConstant.Enable).orderByAsc("id");
List<ShopMchEntry> recordList = list(queryWrapper);
if (CollectionUtil.isEmpty(recordList)) {
return null;
}
return recordList.get(0);
}
/** /**
* 根据商家注册的手机号更新合同签署状态和合同下载地址 * 根据商家注册的手机号更新合同签署状态和合同下载地址
* *