分账失败后,写入日志
This commit is contained in:
parent
7adbd801cd
commit
cf2605ae64
@ -88,6 +88,9 @@ public class LklOrderSeparate {
|
||||
@ApiModelProperty(value = "处理状态:ACCEPTED-已受理, PROCESSING-处理中, FAIL-失败, SUCCESS-成功")
|
||||
private String final_status;
|
||||
|
||||
@ApiModelProperty(value = "分账(失败后)的标记")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "新建时间")
|
||||
private Date created_at;
|
||||
|
||||
|
||||
@ -29,4 +29,13 @@ public interface LklOrderSeparateService extends IBaseService<LklOrderSeparate>
|
||||
* @return
|
||||
*/
|
||||
LklOrderSeparate getByOutTradeNo(String logNo, String outSeparateNo);
|
||||
|
||||
/**
|
||||
* 修改备注
|
||||
*
|
||||
* @param id
|
||||
* @param remark
|
||||
* @return
|
||||
*/
|
||||
Boolean updateRemark(Long id, String remark);
|
||||
}
|
||||
|
||||
@ -1601,6 +1601,7 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
String errorMsg = String.format("店铺[%s]订单金额异常或运费过高,跳过分账", shopOrderLkl.getStore_id());
|
||||
log.error(errorMsg);
|
||||
errorMessages.append(errorMsg).append("; ");
|
||||
lklOrderSeparateService.updateRemark(lklOrderSeparateExist.getId(), errorMsg);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1612,13 +1613,16 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
String errorMsg = String.format("店铺[%s]未绑定平台方接收账户,跳过分账", shopOrderLkl.getStore_id());
|
||||
log.error(errorMsg);
|
||||
errorMessages.append(errorMsg).append("; ");
|
||||
lklOrderSeparateService.updateRemark(lklOrderSeparateExist.getId(), errorMsg);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 判断是否可以分账(商家比例非100%)
|
||||
boolean canSplit = splitRatioMch != null && splitRatioMch.compareTo(new BigDecimal("100")) < 0;
|
||||
if (!canSplit) {
|
||||
log.warn("店铺[{}]分账比例为0,仅扣除运费", shopOrderLkl.getStore_id());
|
||||
String errorMsg = String.format("店铺[%s]分账比例为0,仅扣除运费", shopOrderLkl.getStore_id());
|
||||
log.error(errorMsg);
|
||||
lklOrderSeparateService.updateRemark(lklOrderSeparateExist.getId(), errorMsg);
|
||||
}
|
||||
|
||||
// 构建分账请求对象
|
||||
|
||||
@ -81,4 +81,22 @@ public class LklOrderSeparateServiceImpl extends BaseServiceImpl<LklOrderSeparat
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改备注
|
||||
*
|
||||
* @param id
|
||||
* @param remark
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateRemark(Long id, String remark) {
|
||||
if (id == null || id <= 0 || StrUtil.isEmpty(remark)) {
|
||||
return false;
|
||||
}
|
||||
LklOrderSeparate lklOrderSeparate = new LklOrderSeparate();
|
||||
lklOrderSeparate.setId(id);
|
||||
lklOrderSeparate.setRemark(remark);
|
||||
return updateById(lklOrderSeparate);
|
||||
}
|
||||
}
|
||||
|
||||
@ -642,19 +642,22 @@ public class LklTkServiceImpl {
|
||||
String mchMobile = shopEntry.getLogin_mobile();
|
||||
|
||||
try {
|
||||
// 包含了更改 merchEntryInfo 的状态
|
||||
Pair<Integer, String> retPair = shopStoreBaseService.merchEntryInfo2StoreInfo(mchMobile, true);
|
||||
|
||||
if (retPair.getFirst() > 0) {
|
||||
boolean updateSuccess = shopMchEntryService.updateMulStatus(mchMobile, "", 0, 0, 1, 0, 0, 0, CommonConstant.MCH_APPR_STA_LKL_PADDING);
|
||||
if (!updateSuccess) {
|
||||
logger.warn("更新店铺状态失败: mchMobile={}", mchMobile);
|
||||
} else {
|
||||
logger.info("商家进件:初始化店铺成功!mchMobile={}", mchMobile);
|
||||
}
|
||||
} else {
|
||||
logger.warn("初始化店铺失败: mchMobile={}, reason={}", mchMobile, retPair.getSecond());
|
||||
if (retPair.getFirst() <= 0) {
|
||||
logger.error("初始化店铺失败: mchMobile={}, reason={}", mchMobile, retPair.getSecond());
|
||||
}
|
||||
|
||||
logger.info("商家进件:初始化店铺成功!mchMobile={}", mchMobile);
|
||||
|
||||
// boolean updateSuccess = shopMchEntryService.updateMulStatus(mchMobile, "", 0, 0, 1, 0, 0, 0, CommonConstant.MCH_APPR_STA_LKL_PADDING);
|
||||
// if (!updateSuccess) {
|
||||
// logger.warn("更新店铺状态失败: mchMobile={}", mchMobile);
|
||||
// } else {
|
||||
// logger.info("商家进件:初始化店铺成功!mchMobile={}", mchMobile);
|
||||
// }
|
||||
|
||||
} catch (Exception e) {
|
||||
// 捕获所有异常,防止事务中断
|
||||
logger.error("初始化店铺时发生异常", e);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user