顺丰商家id 配置,绑定接收者方法fix bug
This commit is contained in:
parent
a388422df6
commit
3d8999d51e
@ -681,9 +681,9 @@ public class PayUserPayServiceImpl extends BaseServiceImpl<PayUserPayMapper, Pay
|
||||
// 拉卡拉合单预支付返回参数
|
||||
// TODO RMK 这里只有固定一个运费代理商代收运费,以后代理商模块做好了,要动态读取店铺的运费代理商。
|
||||
lakalaRespJSON = lakalaPayService.lklTransMergePreOrder(shopStoreBase.getLkl_merchant_no(), shopStoreBase.getLkl_term_no(),
|
||||
"", "",
|
||||
"822584059990FYP", "N5811590",
|
||||
appId, openId, storeIdStr, out_trade_no, subject, total_amt,
|
||||
"0",
|
||||
Convert.toStr(shippingFee.multiply(BigDecimal.valueOf(100)).intValue()),
|
||||
notifyUrl,
|
||||
requestIP, trade_remark);
|
||||
}
|
||||
|
||||
@ -51,6 +51,14 @@ public interface LklLedgerMerReceiverBindService extends IBaseService<LklLedgerM
|
||||
*/
|
||||
LklLedgerMerReceiverBind getPlatformByMerCupNo(String merCupNo);
|
||||
|
||||
/**
|
||||
* 根据申请编号查询一条平台绑定记录
|
||||
*
|
||||
* @param applyId
|
||||
* @return
|
||||
*/
|
||||
LklLedgerMerReceiverBind getPlatformByApplyId(String applyId);
|
||||
|
||||
/**
|
||||
* 根据商户编号查询一条代理商绑定记录
|
||||
*
|
||||
|
||||
@ -477,11 +477,12 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
ecParams.put("D9", signDate);
|
||||
ecParams.put("D11", signDate);
|
||||
ecParams.put("D12", signDate);
|
||||
ecParams.put("E1", platformName);
|
||||
ecParams.put("E1", platformName + "和代理商");
|
||||
ecParams.put("E2", "小发同城平台商户合作协议");
|
||||
ecParams.put("E3", "2");
|
||||
ecParams.put("E5", platformName);
|
||||
ecParams.put("E6", splitLowestRatio);
|
||||
ecParams.put("E3", "1");
|
||||
ecParams.put("E4", splitLowestRatio);
|
||||
// ecParams.put("E5", platformName);
|
||||
// ecParams.put("E6", splitLowestRatio);
|
||||
ecParams.put("E7", signDate);
|
||||
ecParams.put("E8", shopMchEntry.getAccount_holder_name());
|
||||
|
||||
@ -542,8 +543,8 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
shopMchEntryService.updateMerchEntryEcResultUrlByMchId(mchId, ecResultUrl);
|
||||
|
||||
// 发短信给商家,及时签署合同 SMS_488465246
|
||||
// 【小发同城商家】恭喜您的开店入驻申请已审核通过!请尽快登录APP平台签署电子合同,签署链接24小时内有效(逾期需重新提交申请)。如有疑问请联系客服,感谢您的支持!
|
||||
shopMessageTemplateService.aliyunSmsSend(contractMobile, "SMS_489795044", null);//SMS_479760276
|
||||
// 【小发同城商家】恭喜您的开店入驻申请已审核通过!请尽快登录小发同城商家版APP平台签署电子合同,签署链接24小时内有效(逾期需重新提交申请)。如有疑问请联系客服,感谢您的支持!
|
||||
shopMessageTemplateService.aliyunSmsSend(contractMobile, "SMS_493160417", null);//SMS_479760276
|
||||
|
||||
JSONObject payload = new JSONObject();
|
||||
payload.put("category", CommonConstant.PUSH_MSG_CATE_EC);
|
||||
@ -942,10 +943,10 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
|
||||
// 异步通知返回的数据
|
||||
JSONObject paramsJSON = JSONUtil.parseObj(checkResult.getSecond());
|
||||
log.info("商户分账业务申请回调:paramsJSON={}", paramsJSON);
|
||||
log.info("商户分账业务申请异步回调数据:paramsJSON={}", paramsJSON);
|
||||
|
||||
if (paramsJSON == null) {
|
||||
log.error("商户分账业务申请回调:请求参数为空");
|
||||
log.error("商户分账业务申请异步回调:请求参数为空");
|
||||
return JSONUtil.createObj().put("code", "FAIL").put("message", "请求参数为空");
|
||||
}
|
||||
|
||||
@ -955,27 +956,29 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
String auditStatusText = paramsJSON.getStr("auditStatusText");
|
||||
|
||||
if (StrUtil.isBlank(applyId) || StrUtil.isBlank(auditStatus) || StrUtil.isBlank(merCupNo)) {
|
||||
String errMsg = "商户分账业务申请回调:缺少必要参数(applyId/auditStatus/merCupNo)";
|
||||
String errMsg = "商户分账业务申请异步回调:缺少必要参数(applyId/auditStatus/merCupNo)";
|
||||
log.error(errMsg + ":applyId={}, auditStatus={}, merCupNo={}", applyId, auditStatus, merCupNo);
|
||||
return JSONUtil.createObj().put("code", "FAIL").put("message", errMsg);
|
||||
}
|
||||
|
||||
LklLedgerMember lklLedgerMember = lklLedgerMemberService.getByApplyId(applyId, CommonConstant.Enable);
|
||||
LklLedgerMember lklLedgerMember = lklLedgerMemberService.getByApplyId(applyId, -1);
|
||||
|
||||
// 1:通过,2拒绝
|
||||
if (!auditStatus.equals("1")) {
|
||||
log.warn("商户分账业务申请回调:审核未通过,状态={}", auditStatus);
|
||||
log.warn("商户分账业务申请异步回调:审核未通过,状态={}", auditStatus);
|
||||
if (lklLedgerMember != null) {
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(
|
||||
lklLedgerMember.getMch_id(), CommonConstant.MCH_APPR_STA_NOPASS, "分账业务申请被驳回:" + auditStatusText
|
||||
lklLedgerMember.getMch_id(), CommonConstant.MCH_APPR_STA_NOPASS, "商家分账业务审核未通过:" + auditStatusText
|
||||
);
|
||||
}
|
||||
return JSONUtil.createObj().put("code", "FAIL").put("message", "商户分账申请被驳回!");
|
||||
return JSONUtil.createObj().put("code", "FAIL").put("message", "商家分账业务审核未通过!");
|
||||
}
|
||||
|
||||
if (lklLedgerMember != null && lklLedgerMerReceiverBindService.hasBindReceiver(merCupNo)) {
|
||||
log.debug("商户分账业务申请回调:已处理成功,applyId={}", applyId);
|
||||
return JSONUtil.createObj().put("code", "SUCCESS").put("message", "商户分账申请已处理成功!");
|
||||
if (lklLedgerMember != null && CommonConstant.Enable.equals(lklLedgerMember.getAudit_status())
|
||||
&& lklLedgerMerReceiverBindService.hasBindReceiver(merCupNo)) {
|
||||
log.debug("商户分账业务申请异步回调:已绑定过接收方,applyId={}", applyId);
|
||||
// TODO 已绑定过接收方,可以往下执行更新,绑定关系
|
||||
// return JSONUtil.createObj().put("code", "SUCCESS").put("message", "已绑定过接收方!");
|
||||
}
|
||||
|
||||
String merInnerNo = paramsJSON.getStr("merInnerNo");
|
||||
@ -990,8 +993,8 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
);
|
||||
|
||||
if (!updateSuccess) {
|
||||
log.error("商户分账申请业务回调:更新审核结果失败,applyId={}", applyId);
|
||||
return JSONUtil.createObj().put("code", "FAIL").put("message", "更新审核结果失败");
|
||||
log.error("商户分账业务申请异步回调:系统更新分账业务审核结果失败,applyId={}", applyId);
|
||||
return JSONUtil.createObj().put("code", "FAIL").put("message", "内部程序更新审核结果失败");
|
||||
}
|
||||
|
||||
JSONObject bindParamsJSON = new JSONObject()
|
||||
@ -1000,8 +1003,8 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
|
||||
Pair<Boolean, String> bindResult = innerApplyLedgerMerReceiverBind(bindParamsJSON);
|
||||
if (!bindResult.getFirst()) {
|
||||
String errMsg = "商户分账申请业务回调:预绑定接收方失败 - " + bindResult.getSecond();
|
||||
log.error("商户{}预绑定接收方出错:{}", merCupNo, errMsg);
|
||||
String errMsg = "商户分账业务申请异步回调:预绑定分账接收方失败 - " + bindResult.getSecond();
|
||||
log.error("商户{}预绑定分账接收方失败:{}", merCupNo, errMsg);
|
||||
|
||||
// 更新商户审批状态
|
||||
if (lklLedgerMember != null) { // 防御性判断(理论上此时应为null,但保留安全检查)
|
||||
@ -1024,8 +1027,8 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
// 更新商家分账申请状态为已申请(hasApplySplit=1)
|
||||
shopMchEntryService.updateMulStatus(lklLedgerMember.getMch_id(), "", merCupNo, 0, 0, 0, 1, 0, 0, CommonConstant.MCH_APPR_STA_LKL_PADDING);
|
||||
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(lklLedgerMember.getMch_id(), null, "分账业务开通成功");
|
||||
log.debug("商户分账业务申请回调:处理成功,applyId={}", applyId);
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(lklLedgerMember.getMch_id(), null, "商户分账业务申请已审核通过");
|
||||
log.debug("商户分账业务申请异步回调:处理成功,applyId={}", applyId);
|
||||
return JSONUtil.createObj().put("code", "SUCCESS").put("message", "操作成功!");
|
||||
}
|
||||
|
||||
@ -1200,7 +1203,7 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
return CommonResult.failed(retPair.getSecond());
|
||||
}
|
||||
|
||||
return CommonResult.success(null, "接收方绑定成功!");
|
||||
return CommonResult.success(null, "商家绑定分账接收方成功!");
|
||||
}
|
||||
|
||||
|
||||
@ -1219,6 +1222,8 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
* @return 操作结果及提示信息
|
||||
*/
|
||||
public Pair<Boolean, String> innerApplyLedgerMerReceiverBind(JSONObject paramsJSON) {
|
||||
log.debug("商家绑定分账接收方申请开始:{}", paramsJSON);
|
||||
|
||||
// 1. 参数校验(提前失败)
|
||||
if (paramsJSON == null) {
|
||||
return Pair.of(false, I18nUtil._("绑定参数为空"));
|
||||
@ -1235,11 +1240,13 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
return Pair.of(false, I18nUtil._("商户入驻记录不存在"));
|
||||
}
|
||||
|
||||
// 进件记录
|
||||
LklLedgerMember lklLedgerMember = lklLedgerMemberService.getByMerCupNo(merCupNo);
|
||||
if (lklLedgerMember == null || !CommonConstant.Enable.equals(lklLedgerMember.getAudit_status())) {
|
||||
return Pair.of(false, I18nUtil._("商家尚未申请分账业务"));
|
||||
}
|
||||
|
||||
// 分账接收方列表
|
||||
List<LklLedgerReceiver> receiverList = lklLedgerReceiverService.selectPlatformAnDistributorList();
|
||||
if (CollectionUtil.isEmpty(receiverList)) {
|
||||
return Pair.of(false, I18nUtil._("分账接收方信息为空"));
|
||||
@ -1255,7 +1262,7 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
// 给拉卡拉通知的回调地址
|
||||
String retUrl = domain + "/mobile/shop/lakala/ledger/applyLedgerMerReceiverBindNotify";
|
||||
String entrustFileName = "小发同城合作协议书.pdf";
|
||||
String entrustFilePath = shopMchEntry.getLkl_ec_file_path();
|
||||
String entrustFilePath = shopMchEntry.getLkl_ec_file_path(); // 拉卡拉的文件路径
|
||||
|
||||
int successCount = 0;
|
||||
int totalCount = receiverList.size();
|
||||
@ -1286,7 +1293,7 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
request.setRetUrl(retUrl);
|
||||
|
||||
// 7. 记录请求参数
|
||||
log.debug("绑定接收方参数:{}", JSONUtil.toJsonStr(request));
|
||||
log.debug("商家绑定分账接收方参数:{}", JSONUtil.toJsonStr(request));
|
||||
|
||||
// 8. 发送请求并处理响应
|
||||
String responseStr = LKLSDK.httpPost(request);
|
||||
@ -1327,14 +1334,14 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
if (successCount == 0) {
|
||||
if (lklLedgerMember != null) {
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(
|
||||
lklLedgerMember.getMch_id(), CommonConstant.MCH_APPR_STA_NOPASS, "分账接收方绑定失败:"
|
||||
lklLedgerMember.getMch_id(), CommonConstant.MCH_APPR_STA_NOPASS, "商家绑定分账接收方失败:"
|
||||
);
|
||||
}
|
||||
return Pair.of(false, "分账接收方绑定失败");
|
||||
return Pair.of(false, "商家绑定分账接收方失败");
|
||||
} else if (successCount < totalCount) {
|
||||
return Pair.of(true, "分账接收方绑定,部分提交成功(" + successCount + "/" + totalCount + "),待审核中");
|
||||
return Pair.of(true, "商家绑定分账接收方,部分提交成功(" + successCount + "/" + totalCount + "),待审核通知");
|
||||
} else {
|
||||
return Pair.of(true, "分账接收方绑定,全部提交成功,待审核中");
|
||||
return Pair.of(true, "商家绑定分账接收方,全部提交成功,待审核通知");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1363,7 +1370,7 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
// 2. 解析回调参数
|
||||
JSONObject paramsJSON = JSONUtil.parseObj(checkResult.getSecond());
|
||||
|
||||
log.info("##### 商家绑定接收方回调参数:{} ####", paramsJSON);
|
||||
log.debug("##### 商家绑定接收方回调参数:{} ####", paramsJSON);
|
||||
|
||||
if (paramsJSON == null || StrUtil.isBlank(paramsJSON.getStr("applyId"))) {
|
||||
// https://o.lakala.com/#/home/document/detail?id=386 返回的数据结果有歧义,需处理
|
||||
@ -1414,8 +1421,17 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
return JSONUtil.createObj().put("code", "FAIL").put("message", "更新状态失败");
|
||||
}
|
||||
|
||||
// 7. 成功后更新商户绑定状态为已绑定
|
||||
shopMchEntryService.updateMulStatus(0L, "", merCupNo, 0, 0, 0, 0, 0, 1, CommonConstant.MCH_APPR_STA_PASS);
|
||||
LklLedgerMerReceiverBind lklLedgerMerReceiverBind = lklLedgerMerReceiverBindService.getPlatformByApplyId(applyId);
|
||||
if (lklLedgerMerReceiverBind != null) {
|
||||
// shopMchEntryService.updateMerchEntryApprovalByMchId(
|
||||
// lklLedgerMerReceiverBind.getMch_id(), CommonConstant.MCH_APPR_STA_PASS, "商家绑定分账接收方成功"
|
||||
// );
|
||||
|
||||
// 7. 成功后更新商户绑定状态为已绑定
|
||||
shopMchEntryService.updateMulStatus(lklLedgerMerReceiverBind.getMch_id(), "", merCupNo, 0, 0, 0, 0, 0, 1, CommonConstant.MCH_APPR_STA_PASS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 8. 检查商户绑定状态是否完成, 更改总的审核状态
|
||||
shopMchEntryService.checkMerchEntryFinished("", merCupNo);
|
||||
|
||||
@ -58,7 +58,9 @@ public class LklLedgerMemberServiceImpl extends BaseServiceImpl<LklLedgerMemberM
|
||||
}
|
||||
QueryWrapper<LklLedgerMember> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("apply_id", applyId);
|
||||
queryWrapper.eq("audit_status", auditStatus);
|
||||
if (auditStatus >= 0) {
|
||||
queryWrapper.eq("audit_status", auditStatus);
|
||||
}
|
||||
return getOne(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ public class LklLedgerMerReceiverBindServiceImpl extends BaseServiceImpl<LklLedg
|
||||
.eq("receiver_no", receiverNo)
|
||||
.eq("audit_status", CommonConstant.Enable);
|
||||
|
||||
return getOne(queryWrapper);
|
||||
return findOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,6 +115,24 @@ public class LklLedgerMerReceiverBindServiceImpl extends BaseServiceImpl<LklLedg
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据申请编号查询一条平台绑定记录
|
||||
*
|
||||
* @param applyId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public LklLedgerMerReceiverBind getPlatformByApplyId(String applyId) {
|
||||
if (StrUtil.isBlank(applyId)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
QueryWrapper<LklLedgerMerReceiverBind> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("apply_id", applyId).orderByAsc("id");
|
||||
|
||||
return findOne(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商户编号查询一条代理商绑定记录
|
||||
*
|
||||
|
||||
@ -318,7 +318,8 @@ public class LklTkServiceImpl {
|
||||
}
|
||||
|
||||
/**
|
||||
* (重要) 请求拉卡拉进件
|
||||
* (重要) 请求拉卡拉进件,
|
||||
* TODO 已经进件过了,一般不涉及更改企业(小微)的信息,可以不要重新进件了
|
||||
* <p>
|
||||
* 参考拉卡拉给的独立文档:2、拓客SAAS商户管理接口(新).docx
|
||||
*
|
||||
@ -661,7 +662,7 @@ public class LklTkServiceImpl {
|
||||
logger.info("初始化店铺成功!mchId={}", mchId);
|
||||
}
|
||||
|
||||
// 1、(电子合同)给商家申请分账功能使用;务必检查是否申请过?申请过忽略
|
||||
// 1、(电子合同)给商家申请分账业务;务必检查是否申请过?申请过忽略
|
||||
Pair<Boolean, String> retPair = lakalaApiService.innerApplyLedgerMer(merCupNo);
|
||||
|
||||
// 2:新增一个接收方记录,起码要一个平台方,代理商根据入驻信息新增
|
||||
@ -669,7 +670,7 @@ public class LklTkServiceImpl {
|
||||
|
||||
// 统一处理分账申请结果
|
||||
if (retPair.getFirst() && genSuccess) {
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(shopMchEntry.getId(), CommonConstant.MCH_APPR_STA_LKL_PADDING, "成功申请分账功能");
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(shopMchEntry.getId(), CommonConstant.MCH_APPR_STA_LKL_PADDING, "已向拉卡拉提交分账业务申请");
|
||||
return new JSONObject().put("code", "200").put("message", "处理成功");
|
||||
}
|
||||
|
||||
|
||||
@ -1572,10 +1572,14 @@ public class ShopMchEntryServiceImpl extends BaseServiceImpl<ShopMchEntryMapper,
|
||||
// 2. 构建 UpdateWrapper 对象,用于构建更新条件
|
||||
UpdateWrapper<ShopMchEntry> updateWrapper = new UpdateWrapper<>();
|
||||
|
||||
// 3. 设置查询条件:优先使用商户手机号,如果为空则使用商户号
|
||||
if (CheckUtil.isEmpty(mchId)) {
|
||||
updateWrapper.eq("id", mchId);
|
||||
}
|
||||
// 3. 设置查询条件:优先 mchId
|
||||
// if (CheckUtil.isEmpty(mchId)) {
|
||||
// updateWrapper.eq("id", mchId);
|
||||
// }
|
||||
|
||||
Optional.ofNullable(mchId)
|
||||
.filter(CheckUtil::isNotEmpty)
|
||||
.ifPresent(id -> updateWrapper.eq("id", id));
|
||||
|
||||
Optional.ofNullable(merchantMobile)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
|
||||
@ -139,7 +139,8 @@ feieyun:
|
||||
sf-express:
|
||||
# 顺丰同城 api 接口配置
|
||||
appid: 1711573316
|
||||
supplier_id: 0
|
||||
# 桂平顺丰平台商家id
|
||||
supplier_id: 2273453450129
|
||||
appkey: cd57608baa9c00fe1cda5f652b14240d
|
||||
dev_id: 1711573316
|
||||
enable: 2
|
||||
|
||||
@ -139,7 +139,8 @@ feieyun:
|
||||
sf-express:
|
||||
# 顺丰同城 api 接口配置
|
||||
appid: 1711573316
|
||||
supplier_id: 2280784732353
|
||||
# 桂平顺丰平台商家id
|
||||
supplier_id: 2273453450129
|
||||
appkey: cd57608baa9c00fe1cda5f652b14240d
|
||||
dev_id: 1711573316
|
||||
enable: 2
|
||||
|
||||
@ -145,7 +145,8 @@ feieyun:
|
||||
sf-express:
|
||||
# 顺丰同城 api 接口配置
|
||||
dev_id: 1711573316
|
||||
supplier_id: 2280784732353
|
||||
# 桂平顺丰平台商家id
|
||||
supplier_id: 2273453450129
|
||||
appid: 1711573316
|
||||
appkey: cd57608baa9c00fe1cda5f652b14240d
|
||||
# dev_id: 1715091463
|
||||
|
||||
@ -143,7 +143,8 @@ feieyun:
|
||||
sf-express:
|
||||
# 顺丰同城 api 接口配置
|
||||
appid: 1711573316
|
||||
supplier_id: 2280784732353
|
||||
# 桂平顺丰平台商家id
|
||||
supplier_id: 2273453450129
|
||||
appkey: cd57608baa9c00fe1cda5f652b14240d
|
||||
dev_id: 1711573316
|
||||
enable: 2
|
||||
|
||||
@ -143,7 +143,8 @@ feieyun:
|
||||
sf-express:
|
||||
# 顺丰同城 api 接口配置
|
||||
appid: 1711573316
|
||||
supplier_id: 2280784732353
|
||||
# 桂平顺丰平台商家id
|
||||
supplier_id: 2273453450129
|
||||
appkey: cd57608baa9c00fe1cda5f652b14240d
|
||||
dev_id: 1711573316
|
||||
enable: 2
|
||||
|
||||
Loading…
Reference in New Issue
Block a user