订单命名-改成_下划线,拉卡拉要求的规则,否则无法分账
This commit is contained in:
parent
9fc880edb1
commit
ab9c68fb8f
@ -88,7 +88,7 @@ public class CommonConstant {
|
|||||||
public static final String PUSH_MSG_CATE_MCH_ORDER_DETAIL = "mchOrderDetail";
|
public static final String PUSH_MSG_CATE_MCH_ORDER_DETAIL = "mchOrderDetail";
|
||||||
public static final String PUSH_MSG_CATE_MCH_ONLINE_ORDER_LIST = "mchOnLineOrderList";
|
public static final String PUSH_MSG_CATE_MCH_ONLINE_ORDER_LIST = "mchOnLineOrderList";
|
||||||
public static final String PUSH_MSG_CATE_MCH_ABNORMAL_ORDER_LIST = "mchAbnormalOrderList";
|
public static final String PUSH_MSG_CATE_MCH_ABNORMAL_ORDER_LIST = "mchAbnormalOrderList";
|
||||||
public static final String PUSH_MSG_CATE_MCH_RETURN_ORDER_LIST = "mchRetrunOrderList";
|
public static final String PUSH_MSG_CATE_MCH_RETURN_ORDER_LIST = "mchReturnOrderList";
|
||||||
|
|
||||||
public static final String CONF_KEY_SAME_CITY_ORDER_EXPIRE_SECONDS = "sameCityOrderExpireSeconds";
|
public static final String CONF_KEY_SAME_CITY_ORDER_EXPIRE_SECONDS = "sameCityOrderExpireSeconds";
|
||||||
|
|
||||||
|
|||||||
@ -34,5 +34,7 @@ public class RedisConstant {
|
|||||||
|
|
||||||
public static final String SF_Order_Proc_Expire_Key = ConstantRedis.Cache_NameSpace + "sf_order_proc_expire_key__";
|
public static final String SF_Order_Proc_Expire_Key = ConstantRedis.Cache_NameSpace + "sf_order_proc_expire_key__";
|
||||||
|
|
||||||
|
public static final String SF_Order_Proc_WillExpire_Key = ConstantRedis.Cache_NameSpace + "sf_order_proc_will_expire_key__";
|
||||||
|
|
||||||
public static final String Order_Pay_Retry_Count_Key = ConstantRedis.Cache_NameSpace + "order_pay_retry_count:";
|
public static final String Order_Pay_Retry_Count_Key = ConstantRedis.Cache_NameSpace + "order_pay_retry_count:";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -471,331 +471,4 @@ public class LakalaPayServiceImpl implements LakalaPayService {
|
|||||||
throw new ApiException(I18nUtil._("文件上传失败!"), e);
|
throw new ApiException(I18nUtil._("文件上传失败!"), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public CommonResult applyLedgerMer(JSONObject paramsJSON) {
|
|
||||||
// // 1. 配置初始化
|
|
||||||
// initLKLSDK();
|
|
||||||
//
|
|
||||||
// //2. 装配数据
|
|
||||||
// V2MmsOpenApiLedgerApplyLedgerMerRequest req = new V2MmsOpenApiLedgerApplyLedgerMerRequest();
|
|
||||||
// req.setVersion("2.0");
|
|
||||||
// String orderNo = StringUtils.genLklOrderNo(8); // 8位随机数
|
|
||||||
// req.setOrderNo(orderNo);
|
|
||||||
// req.setOrgCode(orgCode);
|
|
||||||
// req.setMerInnerNo(paramsJSON.getStr("merInnerNo"));
|
|
||||||
// req.setMerCupNo(paramsJSON.getStr("merCupNo"));
|
|
||||||
// req.setContactMobile(paramsJSON.getStr("contactMobile"));
|
|
||||||
// req.setSplitLowestRatio(new BigDecimal(paramsJSON.getStr("splitLowestRatio")));
|
|
||||||
// String fileName = paramsJSON.getStr("splitEntrustFileName");
|
|
||||||
// req.setSplitEntrustFileName(fileName);
|
|
||||||
//
|
|
||||||
// // 分账结算委托书文件上传到拉卡拉服务器
|
|
||||||
// JSONObject fileUploadResp = uploadFile(orderNo, "SPLIT_ENTRUST_FILE", StringUtils.getFileExt(fileName), paramsJSON.getStr("splitEntrustFile"));
|
|
||||||
// if (fileUploadResp == null || StrUtil.isBlank(fileUploadResp.getStr("attFileId"))) {
|
|
||||||
// throw new ApiException(I18nUtil._("分账结算委托书上传失败!"));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// String splitEntrustFilePath = fileUploadResp.getStr("attFileId");
|
|
||||||
// req.setSplitEntrustFilePath(splitEntrustFilePath); //比如:G1/M00/06/64/CrFdEmBQc-aAGc_XAAAiIbS3WIE960.pdf;
|
|
||||||
//
|
|
||||||
// if (isProdProject()) {
|
|
||||||
// projectDomain = projectDomain + "/api";
|
|
||||||
// }
|
|
||||||
// // 给拉卡拉通知的回调地址
|
|
||||||
// String retUrl = projectDomain + "/mobile/pay/lakala/ledger/applyLedgerMerNotify";
|
|
||||||
// req.setRetUrl(retUrl);
|
|
||||||
//
|
|
||||||
// paramsJSON.set("orderNo", orderNo);
|
|
||||||
// paramsJSON.set("version", "2.0");
|
|
||||||
// paramsJSON.set("ret_url", retUrl);
|
|
||||||
// paramsJSON.set("org_code", orgCode);
|
|
||||||
// paramsJSON.set("split_entrust_file_path", splitEntrustFilePath);
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// //3. 发送请求
|
|
||||||
// String responseStr = LKLSDK.httpPost(req);
|
|
||||||
//
|
|
||||||
// // {'retCode':'000000','retMsg':'申请已受理,请等待审核结果','respData':{'version':'1.0','orderNo':'KFPT20230223181025407788734','orgCode':'1','applyId':681201215598657536}}
|
|
||||||
// JSONObject lakalaRespJSON = JSONUtil.parseObj(responseStr);
|
|
||||||
// if (lakalaRespJSON == null || !lakalaRespJSON.getStr("retCode").equals("000000")) {
|
|
||||||
// throw new ApiException(I18nUtil._(lakalaRespJSON.getStr("retMsg")));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// paramsJSON.set("apply_id", lakalaRespJSON.getByPath("respData.applyId"));
|
|
||||||
// paramsJSON.set("remark", lakalaRespJSON.getStr("retMsg"));
|
|
||||||
// paramsJSON.set("audit_status_text", paramsJSON.get("remark"));
|
|
||||||
//
|
|
||||||
// // 新增数据
|
|
||||||
// // 将 JSON 对象的键名转换为下划线命名
|
|
||||||
// LklLedgerMember lklLedgerMember = JSONUtil.toBean(StringUtils.convertCamelToSnake(paramsJSON.toString()), LklLedgerMember.class);
|
|
||||||
// lklLedgerMemberService.saveOrUpdateByMerCupNo(lklLedgerMember);
|
|
||||||
//
|
|
||||||
// return CommonResult.success(null, "提交成功,待审核中!");
|
|
||||||
// } catch (SDKException e) {
|
|
||||||
// log.error("分账申请失败:", e);
|
|
||||||
// throw new ApiException(I18nUtil._("分账申请失败!"), e);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 商户分账业务开通申请回调
|
|
||||||
// * 参考:https://o.lakala.com/#/home/document/detail?id=379
|
|
||||||
// *
|
|
||||||
// * @param request
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// @Override
|
|
||||||
// public JSONObject applyLedgerMerNotify(HttpServletRequest request) {
|
|
||||||
// // 验签
|
|
||||||
// String authorization = request.getHeader("Authorization");
|
|
||||||
// String requestBody = LakalaUtil.getBody(request);
|
|
||||||
//
|
|
||||||
// boolean checkSuccess = LakalaUtil.verify(authorization, requestBody, lklNotifyCerPath);
|
|
||||||
// if (!checkSuccess) {
|
|
||||||
// return JSONUtil.createObj().set("retCode", "OP90002").set("retMsg", "验签失败!");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// JSONObject paramsJSON = JSONUtil.parseObj(requestBody);
|
|
||||||
//
|
|
||||||
// JSONObject respData = new JSONObject();
|
|
||||||
// respData.put("retCode", "OP90003");
|
|
||||||
// respData.put("retMsg", "响应处理失败!");
|
|
||||||
//
|
|
||||||
// if (paramsJSON != null && paramsJSON.get("respData") != null) {
|
|
||||||
// JSONObject reqData = (JSONObject) paramsJSON.get("respData");
|
|
||||||
//
|
|
||||||
// Boolean success = lklLedgerMemberService.updateAuditResult(reqData.getStr("applyId"),
|
|
||||||
// reqData.getStr("merInnerNo"),
|
|
||||||
// reqData.getStr("merCupNo"),
|
|
||||||
// reqData.getStr("entrustFileName"),
|
|
||||||
// reqData.getStr("entrustFilePath"),
|
|
||||||
// reqData.getStr("auditStatus"),
|
|
||||||
// reqData.getStr("auditStatusText"),
|
|
||||||
// reqData.getStr("remark"));
|
|
||||||
//
|
|
||||||
// if (success) {
|
|
||||||
// respData.put("retCode", "000000");
|
|
||||||
// respData.put("retMsg", "操作成功!");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return respData;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 分账接收方创建申请
|
|
||||||
// * 参考:https://o.lakala.com/#/home/document/detail?id=380
|
|
||||||
// *
|
|
||||||
// * @param paramsJSON
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// @Override
|
|
||||||
// public CommonResult applyLedgerReceiver(JSONObject paramsJSON) {
|
|
||||||
// // 1. 配置初始化
|
|
||||||
// initLKLSDK();
|
|
||||||
//
|
|
||||||
// //2. 装配数据
|
|
||||||
// V2MmsOpenApiLedgerApplyLedgerReceiverRequest req = new V2MmsOpenApiLedgerApplyLedgerReceiverRequest();
|
|
||||||
//
|
|
||||||
// String orderNo = StringUtils.genLklOrderNo(8); // 8位随机数
|
|
||||||
// req.setOrderNo(orderNo);
|
|
||||||
// req.setOrgCode(orgCode);
|
|
||||||
// req.setVersion("2.0");
|
|
||||||
//
|
|
||||||
// req.setReceiverName(paramsJSON.getStr("receiverName"));
|
|
||||||
// req.setContactMobile(paramsJSON.getStr("contactMobile"));
|
|
||||||
//
|
|
||||||
// req.setLicenseNo(paramsJSON.getStr("licenseNo"));
|
|
||||||
// req.setLicenseName(paramsJSON.getStr("licenseName"));
|
|
||||||
// req.setLegalPersonName(paramsJSON.getStr("legalPersonName"));
|
|
||||||
// req.setLegalPersonCertificateType(paramsJSON.getStr("legalPersonCertificateType"));
|
|
||||||
// req.setLegalPersonCertificateNo(paramsJSON.getStr("legalPersonCertificateNo"));
|
|
||||||
//
|
|
||||||
// req.setAcctNo(paramsJSON.getStr("acctNo"));
|
|
||||||
// req.setAcctName(paramsJSON.getStr("acctName"));
|
|
||||||
// req.setAcctTypeCode(paramsJSON.getStr("acctTypeCode"));
|
|
||||||
// req.setAcctCertificateType(paramsJSON.getStr("acctCertificateType"));
|
|
||||||
//
|
|
||||||
// req.setAcctCertificateNo(paramsJSON.getStr("acctCertificateNo"));
|
|
||||||
// req.setAcctOpenBankCode(paramsJSON.getStr("acctOpenBankCode"));
|
|
||||||
// req.setAcctOpenBankName(paramsJSON.getStr("acctOpenBankName"));
|
|
||||||
// req.setAcctClearBankCode(paramsJSON.getStr("acctClearBankCode"));
|
|
||||||
//
|
|
||||||
// if (paramsJSON.getJSONArray("attachList") != null && paramsJSON.getJSONArray("attachList").size() > 0) {
|
|
||||||
// List<V2MmsOpenApiLedgerApplyLedgerReceiverRequest.AttachInfo> attachList = new ArrayList<>();
|
|
||||||
// V2MmsOpenApiLedgerApplyLedgerReceiverRequest.AttachInfo attachInfo = new V2MmsOpenApiLedgerApplyLedgerReceiverRequest.AttachInfo();
|
|
||||||
// for (JSONObject attachJSON : paramsJSON.getJSONArray("attachList").jsonIter()) {
|
|
||||||
// String fileName = attachJSON.getStr("attachName");
|
|
||||||
// String attachType = attachJSON.getStr("attachType");
|
|
||||||
// String fileBase64 = attachJSON.getStr("attachStoreFile");
|
|
||||||
// attachInfo.setAttachName(fileName);
|
|
||||||
// attachInfo.setAttachType(attachType);
|
|
||||||
//
|
|
||||||
// JSONObject fileUploadResp = uploadFile(StringUtils.genLklOrderNo(8), attachType,
|
|
||||||
// StringUtils.getFileExt(fileName), fileBase64);
|
|
||||||
// if (fileUploadResp == null || StrUtil.isBlank(fileUploadResp.getStr("attFileId"))) {
|
|
||||||
// throw new ApiException(I18nUtil._("附件上传失败!"));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// attachInfo.setAttachStorePath(fileUploadResp.getStr("attFileId"));
|
|
||||||
// attachList.add(attachInfo);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// req.setAttachList(attachList);
|
|
||||||
// paramsJSON.set("attach_list", JSONUtil.toJsonStr(attachList));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// paramsJSON.set("orderNo", orderNo);
|
|
||||||
// paramsJSON.set("version", "2.0");
|
|
||||||
// paramsJSON.set("org_code", orgCode);
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// //3. 发送请求,申请创建分账接收方
|
|
||||||
// String responseStr = LKLSDK.httpPost(req);
|
|
||||||
//
|
|
||||||
// JSONObject lakalaRespJSON = JSONUtil.parseObj(responseStr);
|
|
||||||
// if (lakalaRespJSON == null || !lakalaRespJSON.getStr("retCode").equals("000000")) {
|
|
||||||
// throw new ApiException(I18nUtil._(lakalaRespJSON.getStr("retMsg")));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// paramsJSON.set("receiver_no", lakalaRespJSON.getByPath("respData.receiverNo"));
|
|
||||||
// paramsJSON.set("org_id", lakalaRespJSON.getByPath("respData.orgId"));
|
|
||||||
// paramsJSON.set("org_name", lakalaRespJSON.getByPath("respData.orgName"));
|
|
||||||
//
|
|
||||||
// // 新增数据
|
|
||||||
// // 将 JSON 对象的键名转换为下划线命名
|
|
||||||
// LklLedgerReceiver lklLedgerReceiver = JSONUtil.toBean(StringUtils.convertCamelToSnake(paramsJSON.toString()), LklLedgerReceiver.class);
|
|
||||||
//
|
|
||||||
// // 新增或修改本地数据
|
|
||||||
// lklLedgerReceiverService.saveOrUpdateByReceiverNo(lklLedgerReceiver);
|
|
||||||
//
|
|
||||||
// return CommonResult.success(null, "接收方创建成功!");
|
|
||||||
// } catch (SDKException e) {
|
|
||||||
// log.error("接收方创建失败:", e);
|
|
||||||
// throw new ApiException(I18nUtil._("接收方创建失败!"), e);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 分账关系绑定申请
|
|
||||||
// * 参考:https://o.lakala.com/#/home/document/detail?id=386
|
|
||||||
// *
|
|
||||||
// * @param paramsJSON
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// @Override
|
|
||||||
// public CommonResult applyLedgerMerReceiverBind(JSONObject paramsJSON) {
|
|
||||||
// // 1. 配置初始化
|
|
||||||
// initLKLSDK();
|
|
||||||
//
|
|
||||||
// //2. 装配数据
|
|
||||||
// V2MmsOpenApiLedgerApplyBindRequest req = new V2MmsOpenApiLedgerApplyBindRequest();
|
|
||||||
//
|
|
||||||
// String orderNo = StringUtils.genLklOrderNo(8); // 8位随机数
|
|
||||||
// req.setOrderNo(orderNo);
|
|
||||||
// req.setOrgCode(orgCode);
|
|
||||||
// req.setVersion("2.0");
|
|
||||||
//
|
|
||||||
// req.setMerInnerNo(paramsJSON.getStr("merInnerNo"));
|
|
||||||
// req.setMerCupNo(paramsJSON.getStr("merCupNo"));
|
|
||||||
// req.setReceiverNo(paramsJSON.getStr("receiverNo"));
|
|
||||||
//
|
|
||||||
// String fileName = paramsJSON.getStr("entrustFileName");
|
|
||||||
// String splitEntrustFileBase64 = paramsJSON.getStr("entrustFile");
|
|
||||||
// req.setEntrustFileName(fileName);
|
|
||||||
//
|
|
||||||
// String retUrl = projectDomain + "/mobile/pay/lakala/ledger/applyLedgerMerReceiverBindNotify";
|
|
||||||
// req.setRetUrl(retUrl);
|
|
||||||
//
|
|
||||||
// // 文件上传到拉卡拉服务器
|
|
||||||
// JSONObject fileUploadResp = uploadFile(orderNo,
|
|
||||||
// "SPLIT_COOPERATION_FILE",
|
|
||||||
// StringUtils.getFileExt(fileName),
|
|
||||||
// splitEntrustFileBase64);
|
|
||||||
// if (fileUploadResp == null || StrUtil.isBlank(fileUploadResp.getStr("attFileId"))) {
|
|
||||||
// throw new ApiException(I18nUtil._("合作协议上传失败!"));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// String entrustFilePath = fileUploadResp.getStr("attFileId");
|
|
||||||
// req.setEntrustFilePath(entrustFilePath);
|
|
||||||
//
|
|
||||||
// paramsJSON.set("orderNo", orderNo);
|
|
||||||
// paramsJSON.set("version", "2.0");
|
|
||||||
// paramsJSON.set("ret_url", retUrl);
|
|
||||||
// paramsJSON.set("org_code", orgCode);
|
|
||||||
// paramsJSON.set("entrust_file_name", fileName);
|
|
||||||
// paramsJSON.set("entrust_file_path", entrustFilePath);
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// //3. 发送请求
|
|
||||||
// String responseStr = LKLSDK.httpPost(req);
|
|
||||||
//
|
|
||||||
// JSONObject lakalaRespJSON = JSONUtil.parseObj(responseStr);
|
|
||||||
// if (lakalaRespJSON == null || !lakalaRespJSON.getStr("retCode").equals("000000")) {
|
|
||||||
// throw new ApiException(I18nUtil._(lakalaRespJSON.getStr("retMsg")));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// paramsJSON.set("apply_id", lakalaRespJSON.getByPath("respData.applyId"));
|
|
||||||
// paramsJSON.set("remark", lakalaRespJSON.getStr("retMsg"));
|
|
||||||
//
|
|
||||||
// // 新增数据
|
|
||||||
// // 将 JSON 对象的键名转换为下划线命名
|
|
||||||
// LklLedgerMerReceiverBind lklLedgerMerReceiverBind = JSONUtil.toBean(StringUtils.convertCamelToSnake(paramsJSON.toString()), LklLedgerMerReceiverBind.class);
|
|
||||||
// lklLedgerMerReceiverBindService.saveOrUpdateByMerCupNoReceiverNo(lklLedgerMerReceiverBind);
|
|
||||||
//
|
|
||||||
// return CommonResult.success(null, "提交成功,待审核中!");
|
|
||||||
// } catch (SDKException e) {
|
|
||||||
// log.error("分账绑定关系申请失败:", e);
|
|
||||||
// throw new ApiException(I18nUtil._("分账绑定关系申请失败!"), e);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 分账关系绑定申请回调
|
|
||||||
// * 参考:https://o.lakala.com/#/home/document/detail?id=379
|
|
||||||
// *
|
|
||||||
// * @param request
|
|
||||||
// * @return
|
|
||||||
// */
|
|
||||||
// @Override
|
|
||||||
// public JSONObject applyLedgerMerReceiverBindNotify(HttpServletRequest request) {
|
|
||||||
// // 验签
|
|
||||||
// String authorization = request.getHeader("Authorization");
|
|
||||||
// String requestBody = LakalaUtil.getBody(request);
|
|
||||||
//
|
|
||||||
// boolean checkSuccess = LakalaUtil.verify(authorization, requestBody, lklNotifyCerPath);
|
|
||||||
// if (!checkSuccess) {
|
|
||||||
// return JSONUtil.createObj().set("retCode", "OP90002").set("retMsg", "验签失败!");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//// String requestBody = LakalaUtil.getBody(request);
|
|
||||||
//
|
|
||||||
// JSONObject paramsJSON = JSONUtil.parseObj(requestBody);
|
|
||||||
// JSONObject respData = new JSONObject();
|
|
||||||
// respData.put("retCode", "OP90003");
|
|
||||||
// respData.put("retMsg", "响应处理失败!");
|
|
||||||
//
|
|
||||||
// if (paramsJSON != null && paramsJSON.get("respData") != null) {
|
|
||||||
// JSONObject reqData = (JSONObject) paramsJSON.get("respData");
|
|
||||||
//
|
|
||||||
// Boolean success = lklLedgerMerReceiverBindService.updateAuditResult(reqData.getStr("applyId"),
|
|
||||||
// reqData.getStr("merInnerNo"),
|
|
||||||
// reqData.getStr("merCupNo"),
|
|
||||||
// reqData.getStr("receiverNo"),
|
|
||||||
// reqData.getStr("entrustFileName"),
|
|
||||||
// reqData.getStr("entrustFilePath"),
|
|
||||||
// reqData.getStr("auditStatus"),
|
|
||||||
// reqData.getStr("auditStatusText"),
|
|
||||||
// reqData.getStr("remark"));
|
|
||||||
// if (success) {
|
|
||||||
// respData.put("retCode", "000000");
|
|
||||||
// respData.put("retMsg", "操作成功!");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return respData;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1695,7 +1695,8 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
|||||||
// 商家分账
|
// 商家分账
|
||||||
BigDecimal mchRatio = splitRatioMch.divide(new BigDecimal(100)); // 比如:94/100
|
BigDecimal mchRatio = splitRatioMch.divide(new BigDecimal(100)); // 比如:94/100
|
||||||
Integer mchSplitCent = new BigDecimal(splitAmount).multiply(mchRatio).intValue();
|
Integer mchSplitCent = new BigDecimal(splitAmount).multiply(mchRatio).intValue();
|
||||||
if (mchSplitCent > 0) {
|
if (mchSplitCent > 0 || splitAmount >= 1) {
|
||||||
|
// 总分账金额大于1分,商家则分账
|
||||||
V3SacsSeparateRecvDatas receiver = new V3SacsSeparateRecvDatas();
|
V3SacsSeparateRecvDatas receiver = new V3SacsSeparateRecvDatas();
|
||||||
receiver.setRecvMerchantNo(merchantNo);
|
receiver.setRecvMerchantNo(merchantNo);
|
||||||
receiver.setSeparateValue(mchSplitCent.toString());
|
receiver.setSeparateValue(mchSplitCent.toString());
|
||||||
|
|||||||
@ -138,7 +138,7 @@ public class PushMessageServiceImpl implements PushMessageService {
|
|||||||
|
|
||||||
Pair<Boolean, String> result = uniCloudPushService.sendPushMessageBatch(cidList,
|
Pair<Boolean, String> result = uniCloudPushService.sendPushMessageBatch(cidList,
|
||||||
appName + "邀请您签署入驻合同",
|
appName + "邀请您签署入驻合同",
|
||||||
"恭喜您的开店入驻申请已审核通过!请尽快登录APP平台签署电子合同,签署链接24小时内有效(逾期需重新提交申请)。如有疑问请联系客服,感谢您的支持!",
|
"恭喜您的开店入驻申请已审核通过!请尽快登录小发商家 APP 平台签署电子合同,签署链接24小时内有效(逾期需重新提交申请)。如有疑问请联系客服,感谢您的支持!",
|
||||||
payload);
|
payload);
|
||||||
|
|
||||||
if (!result.getFirst()) {
|
if (!result.getFirst()) {
|
||||||
@ -167,7 +167,7 @@ public class PushMessageServiceImpl implements PushMessageService {
|
|||||||
public void noticeMerchantEmployeeOrderAction(Integer storeId, String orderId, String title, String content, JSONObject payload) {
|
public void noticeMerchantEmployeeOrderAction(Integer storeId, String orderId, String title, String content, JSONObject payload) {
|
||||||
try {
|
try {
|
||||||
List<String> cidList = shopStoreEmployeeService.selectEmployeeGeTuiCidByStoreId(storeId, orderId, null);
|
List<String> cidList = shopStoreEmployeeService.selectEmployeeGeTuiCidByStoreId(storeId, orderId, null);
|
||||||
log.debug("[订单推送] cid 列表:{}", cidList);
|
// log.debug("[订单推送] cid 列表:{}", cidList);
|
||||||
// 获取 商家的 cid
|
// 获取 商家的 cid
|
||||||
uniCloudPushService.sendPushMessageBatch(cidList, title, content, payload);
|
uniCloudPushService.sendPushMessageBatch(cidList, title, content, payload);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -183,6 +183,10 @@ public class OrderPayedListener {
|
|||||||
|
|
||||||
// 发送延迟消息 25分钟拣货配送时间(提前5分钟,下单20分钟后,提醒商家及时拣货)
|
// 发送延迟消息 25分钟拣货配送时间(提前5分钟,下单20分钟后,提醒商家及时拣货)
|
||||||
Long mchOrderExpireSeconds = shopOrderBaseService.sameCityOrderExpireSeconds(1500L) - 300;
|
Long mchOrderExpireSeconds = shopOrderBaseService.sameCityOrderExpireSeconds(1500L) - 300;
|
||||||
|
redisService.set(RedisConstant.SF_Order_Proc_WillExpire_Key + String.format("%d&%s", orderInfoOld.getStore_id(), orderId), orderId, mchOrderExpireSeconds);
|
||||||
|
|
||||||
|
// 发送延迟消息 25分钟拣货配送时间(下单25分钟后,提醒商家及时拣货)
|
||||||
|
mchOrderExpireSeconds = shopOrderBaseService.sameCityOrderExpireSeconds(1500L);
|
||||||
redisService.set(RedisConstant.SF_Order_Proc_Expire_Key + String.format("%d&%s", orderInfoOld.getStore_id(), orderId), orderId, mchOrderExpireSeconds);
|
redisService.set(RedisConstant.SF_Order_Proc_Expire_Key + String.format("%d&%s", orderInfoOld.getStore_id(), orderId), orderId, mchOrderExpireSeconds);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -60,13 +60,31 @@ public class RedisKeyExpiredListener implements MessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.info("[Redis过期监听] 处理订单超时消息. 店铺ID: {}, 订单号: {}", args[0], args[1]);
|
log.info("[Redis过期监听] 处理订单超时消息. 店铺ID: {}, 订单号: {}", args[0], args[1]);
|
||||||
boolean result = handleOrderExpiredMessage(args[0], args[1]);
|
boolean result = handleOrderExpiredMessage(args[0], args[1], false);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
log.info("[Redis过期监听] 订单超时事件处理成功. 店铺ID: {}, 订单号: {}", args[0], args[1]);
|
log.info("[Redis过期监听] 订单超时事件处理成功. 店铺ID: {}, 订单号: {}", args[0], args[1]);
|
||||||
} else {
|
} else {
|
||||||
log.error("[Redis过期监听] 订单超时事件处理失败. 店铺ID: {}, 订单号: {}", args[0], args[1]);
|
log.error("[Redis过期监听] 订单超时事件处理失败. 店铺ID: {}, 订单号: {}", args[0], args[1]);
|
||||||
}
|
}
|
||||||
|
} else if (expiredKey.startsWith(RedisConstant.SF_Order_Proc_WillExpire_Key)) {
|
||||||
|
log.debug("[Redis过期监听] 开始处理订单即将(5分钟后)超时事件. 过期键: {}", expiredKey);
|
||||||
|
|
||||||
|
// storeId&orderId
|
||||||
|
String[] args = expiredKey.replace(RedisConstant.SF_Order_Proc_WillExpire_Key, "").split("&");
|
||||||
|
if (ArrayUtil.isEmpty(args) || args.length < 2) {
|
||||||
|
log.error("[Redis过期监听] 订单处理超时键格式错误. 键: {} 不符合预期格式", expiredKey);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("[Redis过期监听] 处理订单即将超时消息. 店铺ID: {}, 订单号: {}", args[0], args[1]);
|
||||||
|
boolean result = handleOrderExpiredMessage(args[0], args[1], true);
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
log.info("[Redis过期监听] 订单即将超时事件处理成功. 店铺ID: {}, 订单号: {}", args[0], args[1]);
|
||||||
|
} else {
|
||||||
|
log.error("[Redis过期监听] 订单即将超时事件处理失败. 店铺ID: {}, 订单号: {}", args[0], args[1]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//log.debug("[Redis过期监听] 忽略非订单超时事件. 过期键: {}", expiredKey);
|
//log.debug("[Redis过期监听] 忽略非订单超时事件. 过期键: {}", expiredKey);
|
||||||
}
|
}
|
||||||
@ -79,44 +97,53 @@ public class RedisKeyExpiredListener implements MessageListener {
|
|||||||
* @param orderId 订单ID
|
* @param orderId 订单ID
|
||||||
* @return 处理结果
|
* @return 处理结果
|
||||||
*/
|
*/
|
||||||
private boolean handleOrderExpiredMessage(String storeId, String orderId) {
|
private boolean handleOrderExpiredMessage(String storeId, String orderId, boolean willExpire) {
|
||||||
try {
|
try {
|
||||||
log.debug("[订单超时处理] 开始处理订单超时消息. 店铺ID: {}, 订单号: {}", storeId, orderId);
|
String addWord = "";
|
||||||
|
if (willExpire) {
|
||||||
|
addWord = "即将";
|
||||||
|
}
|
||||||
|
|
||||||
|
log.debug("[订单{}超时处理] 开始处理订单超时消息. 店铺ID: {}, 订单号: {}", addWord, storeId, orderId);
|
||||||
|
|
||||||
// 参数验证
|
// 参数验证
|
||||||
if (StrUtil.isBlank(orderId) && StrUtil.isBlank(storeId)) {
|
if (StrUtil.isBlank(orderId) && StrUtil.isBlank(storeId)) {
|
||||||
log.warn("[订单超时处理] 订单ID和店铺ID不能同时为空. 店铺ID: {}, 订单号: {}", storeId, orderId);
|
log.warn("[订单{}超时处理] 订单ID和店铺ID不能同时为空. 店铺ID: {}, 订单号: {}", addWord, storeId, orderId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrUtil.isBlank(orderId)) {
|
if (StrUtil.isBlank(orderId)) {
|
||||||
log.warn("[订单超时处理] 订单号为空. 店铺ID: {}", storeId);
|
log.warn("[订单{}超时处理] 订单号为空. 店铺ID: {}", addWord, storeId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrUtil.isBlank(storeId)) {
|
if (StrUtil.isBlank(storeId)) {
|
||||||
log.warn("[订单超时处理] 店铺ID为空. 订单号: {}", orderId);
|
log.warn("[订单{}超时处理] 店铺ID为空. 订单号: {}", addWord, orderId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String title = "有一笔即将超时的订单!";
|
String title = "有一笔" + addWord + "的订单!";
|
||||||
String content = "您有一笔即将超时的订单[" + orderId + "],请及时处理。";
|
String content = "您有一笔" + addWord + "超时的订单[" + orderId + "],请及时处理。";
|
||||||
log.debug("[订单超时处理] 准备推送消息. 标题: {}, 内容: {}", title, content);
|
log.debug("[订单{}超时处理] 准备推送消息. 标题: {}, 内容: {}", addWord, title, content);
|
||||||
|
|
||||||
// 构造推送消息内容
|
// 构造推送消息内容
|
||||||
JSONObject payload = new JSONObject();
|
JSONObject payload = new JSONObject();
|
||||||
payload.put("category", CommonConstant.PUSH_MSG_CATE_MCH_ABNORMAL_ORDER_LIST);
|
if (willExpire) {
|
||||||
|
payload.put("category", CommonConstant.PUSH_MSG_CATE_MCH_ONLINE_ORDER_LIST);
|
||||||
|
} else {
|
||||||
|
payload.put("category", CommonConstant.PUSH_MSG_CATE_MCH_ABNORMAL_ORDER_LIST);
|
||||||
|
}
|
||||||
payload.put("orderId", orderId);
|
payload.put("orderId", orderId);
|
||||||
log.debug("[订单超时处理] 推送消息载荷已准备: {}", payload);
|
log.debug("[订单{}超时处理] 推送消息载荷已准备: {}", addWord, payload);
|
||||||
|
|
||||||
// 发送推送消息给商家员工
|
// 发送推送消息给商家员工
|
||||||
log.debug("[订单超时处理] 发送推送消息给商家员工. 店铺ID: {}, 订单号: {}", storeId, orderId);
|
log.debug("[订单{}超时处理] 发送推送消息给商家员工. 店铺ID: {}, 订单号: {}", addWord, storeId, orderId);
|
||||||
pushMessageService.noticeMerchantEmployeeOrderAction(
|
pushMessageService.noticeMerchantEmployeeOrderAction(
|
||||||
Convert.toInt(storeId), orderId, title,
|
Convert.toInt(storeId), orderId, title,
|
||||||
content, payload);
|
content, payload);
|
||||||
|
|
||||||
log.info("[订单超时处理] 订单超时消息处理完成. 订单号: {}, 店铺ID: {}, 推送类别: {}",
|
log.info("[订单{}超时处理] 订单超时消息处理完成. 订单号: {}, 店铺ID: {}, 推送类别: {}",
|
||||||
orderId, storeId, CommonConstant.PUSH_MSG_CATE_MCH_ABNORMAL_ORDER_LIST);
|
addWord, orderId, storeId, CommonConstant.PUSH_MSG_CATE_MCH_ABNORMAL_ORDER_LIST);
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("[订单超时处理] 处理订单超时消息时发生异常. 订单号: {}, 店铺ID: {}", orderId, storeId, e);
|
log.error("[订单超时处理] 处理订单超时消息时发生异常. 订单号: {}, 店铺ID: {}", orderId, storeId, e);
|
||||||
|
|||||||
@ -9062,38 +9062,6 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 预处理发货订单超时消息(发到 mq 里,触发超时事件,发出推送消息)
|
|
||||||
*
|
|
||||||
* @param storeId 店铺ID
|
|
||||||
* @param orderId 订单ID
|
|
||||||
* @param expireSeconds 过期时间(秒)
|
|
||||||
* @return 是否发送成功
|
|
||||||
*/
|
|
||||||
// @Async
|
|
||||||
// @Override
|
|
||||||
// public Boolean preSendExpiredSFOrderPushMessage(Integer storeId, String orderId, Long expireSeconds) {
|
|
||||||
// try {
|
|
||||||
// // 构建延迟消息内容
|
|
||||||
// JSONObject jsonObject = new JSONObject();
|
|
||||||
// jsonObject.put("category", MqConstant.DEAD_EVENT_CATE_ORDER_EXPIRED); // 消息分类:1-订单超时消息
|
|
||||||
// jsonObject.put("orderId", orderId); // 订单ID
|
|
||||||
// jsonObject.put("storeId", storeId); // 店铺ID
|
|
||||||
// jsonObject.put("title", "有一笔已超时的订单!"); // 消息标题
|
|
||||||
// jsonObject.put("message", "您有一笔已超时的订单[" + orderId + "],请及时处理。"); // 消息内容
|
|
||||||
//
|
|
||||||
// // 发送延迟消息
|
|
||||||
// mqMessageService.sendDelayMessage(jsonObject.toString(), expireSeconds * 1000); // 转换为毫秒
|
|
||||||
//
|
|
||||||
// return true;
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// log.error("发送延迟订单超时消息失败,店铺ID:{},订单ID:{},过期时间:{}秒",
|
|
||||||
// storeId, orderId, expireSeconds, e);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取货单号格式化
|
* 取货单号格式化
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user