优化个别异步通知方法
This commit is contained in:
parent
9d287da156
commit
ba284b945f
@ -52,10 +52,6 @@ public class LklLedgerMember implements Serializable {
|
||||
private String audit_resp;
|
||||
private String remark;
|
||||
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 Date created_at;
|
||||
private Date updated_at;
|
||||
|
||||
@ -54,16 +54,4 @@ public interface LklLedgerMemberService extends IBaseService<LklLedgerMember> {
|
||||
*/
|
||||
Boolean updateAuditResult(String applyId, String merInnerNo, String merCupNo, String entrustFileName, String entrustFilePath, String auditStatus, String auditStatusText, String remark);
|
||||
|
||||
/**
|
||||
* 更新分账多个状态
|
||||
*
|
||||
* @param merCupNo
|
||||
* @param mchMobile
|
||||
* @param hasEsigned
|
||||
* @param hasApplySplit
|
||||
* @param hasReceiver
|
||||
* @param hasBindReceiver
|
||||
* @return
|
||||
*/
|
||||
Boolean updateMulStatus(String merCupNo, String mchMobile, Integer hasEsigned, Integer hasApplySplit, Integer hasReceiver, Integer hasBindReceiver);
|
||||
}
|
||||
|
||||
@ -615,22 +615,22 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
String errMsg = "";
|
||||
ResponseEntity<JSONObject> response = RestTemplateHttpUtil.sendPostBodyBackEntity(reqUrl, header, reqBody, JSONObject.class);
|
||||
if (ObjectUtil.isEmpty(response) || response.getStatusCode() != HttpStatus.OK) {
|
||||
errMsg = "商家入网申请电子合同失败:请求失败";
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(shopMchEntry.getId(), "", CommonConstant.MCH_APPR_STA_NOPASS, errMsg);
|
||||
errMsg = "申请入网电子合同失败,无响应数据!";
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(shopMchEntry.getId(), "", CommonConstant.MCH_APPR_STA_LKL_NOPASS, errMsg);
|
||||
return Pair.of(false, errMsg);
|
||||
}
|
||||
|
||||
JSONObject respBody = response.getBody();
|
||||
if (ObjectUtil.isNotEmpty(respBody) && !lklSuccessCode.equals(respBody.getStr("code"))) {
|
||||
errMsg = "商家入网申请电子合同失败:" + (StrUtil.isBlank(respBody.getStr("msg")) ? "返回状态有误" : respBody.getStr("msg"));
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(shopMchEntry.getId(), "", CommonConstant.MCH_APPR_STA_NOPASS, errMsg);
|
||||
errMsg = "申请入网电子合同失败," + (StrUtil.isBlank(respBody.getStr("msg")) ? "返回状态有误" : respBody.getStr("msg"));
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(shopMchEntry.getId(), "", CommonConstant.MCH_APPR_STA_LKL_NOPASS, errMsg);
|
||||
return Pair.of(false, errMsg);
|
||||
}
|
||||
|
||||
JSONObject respData = respBody.getJSONObject("resp_data");
|
||||
if (respBody.getJSONObject("resp_data") == null) {
|
||||
errMsg = "商家入网申请电子合同失败:返回数据有误";
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(shopMchEntry.getId(), "", CommonConstant.MCH_APPR_STA_NOPASS, errMsg);
|
||||
errMsg = "申请入网电子合同失败,返回数据有误";
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(shopMchEntry.getId(), "", CommonConstant.MCH_APPR_STA_LKL_NOPASS, errMsg);
|
||||
return Pair.of(false, errMsg);
|
||||
}
|
||||
|
||||
@ -646,7 +646,7 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
record.setResp_body(respBody.toString());
|
||||
Boolean success = lklLedgerEcService.saveOrUpdateByMchId(record);
|
||||
if (!success) {
|
||||
errMsg = "商家入网申请电子合同失败:数据保存失败";
|
||||
errMsg = "申请入网电子合同失败,数据保存失败";
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(shopMchEntry.getId(), "", CommonConstant.MCH_APPR_STA_NOPASS, errMsg);
|
||||
return Pair.of(false, errMsg);
|
||||
}
|
||||
@ -794,7 +794,7 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
log.debug("商户入网电子合同申请回调返回requestbody 参数:{}\n authorization参数:{}\n", requestBody, authorization);
|
||||
|
||||
|
||||
String errMsg = "商户入网电子合同申请回调:";
|
||||
String errMsg = "入网电子合同申请回调:";
|
||||
boolean checkSuccess = LakalaUtil.verify(authorization, requestBody, lklNotifyCerPath);
|
||||
if (!checkSuccess) {
|
||||
log.error(errMsg + "验签失败");
|
||||
@ -812,20 +812,20 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
String ecNo = paramsJSON.getStr("ecNo");
|
||||
String ecStatus = paramsJSON.getStr("ecStatus"); // COMPLETED
|
||||
if (ecStatus == null || !ecStatus.equals("COMPLETED")) {
|
||||
log.debug("商户入网电子合同申请状态尚未签署完成!");
|
||||
log.debug("入网电子合同申请未签署完成!");
|
||||
respData.put("message", "商户入网电子合同尚未签署,请稍候!");
|
||||
return respData;
|
||||
}
|
||||
|
||||
if (ecApplyId == null || StrUtil.isBlank(ecNo)) {
|
||||
log.error("商户入网电子合同申请回调:ecApplyId 为空");
|
||||
log.error("入网电子合同申请回调:ecApplyId 为空");
|
||||
respData.put("message", "ecApplyId 返回空值!");
|
||||
return respData;
|
||||
}
|
||||
|
||||
LklLedgerEc lklLedgerEc = lklLedgerEcService.getByApplyId(ecApplyId, "", CommonConstant.Enable);
|
||||
if (lklLedgerEc == null) {
|
||||
log.error("商户入网电子合同申请回调:找不到对应入网lklLedgerEc电子合同记录");
|
||||
log.error("入网电子合同申请回调:找不到对应入网lklLedgerEc电子合同记录");
|
||||
respData.put("message", "找不到对应入网电子合同记录!");
|
||||
// throw new ApiException("找不到对应入网电子合同记录!");
|
||||
return respData;
|
||||
@ -867,13 +867,11 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
if (!resultPair.getFirst()) {
|
||||
errMsg += resultPair.getSecond();
|
||||
log.error(errMsg);
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(lklLedgerEc.getMch_id(), "", CommonConstant.MCH_APPR_STA_NOPASS, errMsg);
|
||||
// respData.put("message", errMsg);
|
||||
// return respData;
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(lklLedgerEc.getMch_id(), "", CommonConstant.MCH_APPR_STA_LKL_NOPASS, errMsg);
|
||||
throw new ApiException(errMsg);
|
||||
}
|
||||
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(lklLedgerEc.getMch_id(), "", CommonConstant.MCH_APPR_STA_LKL_PADDING, errMsg);
|
||||
shopMchEntryService.updateMerchEntryApprovalByMchId(lklLedgerEc.getMch_id(), "", CommonConstant.MCH_APPR_STA_LKL_PADDING, "已提交进件申请,请等待机构审核!");
|
||||
|
||||
respData.put("code", "SUCCESS");
|
||||
respData.put("message", "操作成功!");
|
||||
|
||||
@ -123,60 +123,5 @@ public class LklLedgerMemberServiceImpl extends BaseServiceImpl<LklLedgerMemberM
|
||||
|
||||
return update(updateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新分账多个状态
|
||||
*
|
||||
* @param merCupNo
|
||||
* @param mchMobile
|
||||
* @param hasEsigned
|
||||
* @param hasApplySplit
|
||||
* @param hasReceiver
|
||||
* @param hasBindReceiver
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateMulStatus(String merCupNo, String mchMobile, Integer hasEsigned, Integer hasApplySplit, Integer hasReceiver, Integer hasBindReceiver) {
|
||||
if (StrUtil.isBlank(merCupNo) && StrUtil.isBlank(mchMobile)) {
|
||||
log.error("缺少必要参数:{} 或 {}", "merCupNo", "mchMobile");
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
int i = 0;
|
||||
UpdateWrapper<LklLedgerMember> updateWrapper = new UpdateWrapper<>();
|
||||
if (StrUtil.isNotBlank(mchMobile)) {
|
||||
updateWrapper.eq("contact_mobile", mchMobile);
|
||||
}
|
||||
if (StrUtil.isNotBlank(merCupNo)) {
|
||||
updateWrapper.eq("mer_cup_no", merCupNo);
|
||||
}
|
||||
|
||||
if (hasEsigned != null && hasEsigned > 0) {
|
||||
i++;
|
||||
updateWrapper.set("has_esigned", hasEsigned);
|
||||
}
|
||||
if (hasApplySplit != null && hasApplySplit > 0) {
|
||||
i++;
|
||||
updateWrapper.set("has_apply_split", hasApplySplit);
|
||||
}
|
||||
if (hasReceiver != null && hasReceiver > 0) {
|
||||
i++;
|
||||
updateWrapper.set("has_receiver", hasReceiver);
|
||||
}
|
||||
if (hasBindReceiver != null && hasBindReceiver > 0) {
|
||||
i++;
|
||||
updateWrapper.set("has_bind_receiver", hasBindReceiver);
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return update(updateWrapper);
|
||||
} catch (Exception e) {
|
||||
log.error("更新分账商家多个状态失败", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -25,7 +25,9 @@ import com.suisung.mall.shop.lakala.mapper.LklLedgerReceiverMapper;
|
||||
import com.suisung.mall.shop.lakala.service.LakalaApiService;
|
||||
import com.suisung.mall.shop.lakala.service.LklLedgerMemberService;
|
||||
import com.suisung.mall.shop.lakala.service.LklLedgerReceiverService;
|
||||
import com.suisung.mall.shop.store.service.ShopMchEntryService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -48,6 +50,9 @@ public class LklLedgerReceiverServiceImpl extends BaseServiceImpl<LklLedgerRecei
|
||||
@Resource
|
||||
private LklLedgerMemberService lklLedgerMemberService;
|
||||
|
||||
@Autowired
|
||||
private ShopMchEntryService shopMchEntryService;
|
||||
|
||||
/**
|
||||
* 根据接收方编号新增或更新记录
|
||||
*
|
||||
@ -232,7 +237,7 @@ public class LklLedgerReceiverServiceImpl extends BaseServiceImpl<LklLedgerRecei
|
||||
boolean success = successCnt > 0;
|
||||
if (success) {
|
||||
// 更新多个状态
|
||||
lklLedgerMemberService.updateMulStatus(merCupNo, "", 0, 0, 1, 0);
|
||||
shopMchEntryService.updateMulStatus("", merCupNo, 0, 0, 1, 0);
|
||||
}
|
||||
|
||||
return success;
|
||||
|
||||
@ -506,7 +506,7 @@ public class LklTkServiceImpl {
|
||||
|
||||
ResponseEntity<JSONObject> response = RestTemplateHttpUtil.sendPostBodyBackEntity(buildLklTkUrl(urlPath), header, formData, JSONObject.class);
|
||||
if (ObjectUtil.isEmpty(response)) {
|
||||
return Pair.of(false, "进件失败:进件无返回值");
|
||||
return Pair.of(false, "请求进件服务无返回值");
|
||||
}
|
||||
|
||||
JSONObject respBody = response.getBody();
|
||||
@ -520,7 +520,7 @@ public class LklTkServiceImpl {
|
||||
// 表中的内部外部商户号暂时都传同一个内部商户号,以便异步通知更改记录
|
||||
Boolean success = shopMchEntryService.updateMerchEntryLklMerCupNo(mchMobile, CommonConstant.Disable2, lklMerInnerNo, lklMerInnerNo, formData.toString(), respBody.toString());
|
||||
if (!success) {
|
||||
return Pair.of(false, "提交进件成功,但更新商户号失败!");
|
||||
return Pair.of(false, "请求进件成功,但更新商户号失败!");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -198,7 +198,7 @@ public interface ShopMchEntryService {
|
||||
*
|
||||
* @param mchId 商家入驻申请 ID,mchId和mchMobile至少必填一个
|
||||
* @param mchMobile 商家注册的手机号 mchId和mchMobile至少必填一个
|
||||
* @param approvalStatus 入驻商家的审批状态:1-已通过;2-未通过;3-待审核;4-未申请过;5-已提交拉卡拉审核;
|
||||
* @param approvalStatus 入驻审批状态:1-已通过;2-未通过;3-待审核;4-未申请过;5-已提交拉卡拉审核;21-拉卡拉审核未通过;
|
||||
* @param approvalRemark 审批备注
|
||||
* @return
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user