fix:打标失败处理

This commit is contained in:
wangff
2025-11-18 18:44:10 +08:00
parent 9ae993c248
commit ac5a06bdad
8 changed files with 52 additions and 5 deletions

View File

@@ -154,8 +154,13 @@ public class WalletHttpClientRest {
if (code != 200) {
String msg = (String) responseMap.get("msg");
throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR,
"code: " + code + ", msg: " + msg);
// TODO: 等营帐通确认错误码
if (code == 400) {
throw new ServiceException(ErrorCodeEnum.WALLET_API_ERROR, msg);
} else {
throw new ServiceException(ErrorCodeEnum.THIRD_API_ERROR,
"code: " + code + ", msg: " + msg);
}
}
}
} catch (ServiceException e) {

View File

@@ -3,6 +3,7 @@ package com.cool.store.service.wallet.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.constants.RedisConstant;
import com.cool.store.dao.LineInfoDAO;
import com.cool.store.dao.RegionDao;
import com.cool.store.dao.ShopInfoDAO;
@@ -22,6 +23,7 @@ import com.cool.store.request.wallet.*;
import com.cool.store.service.wallet.WalletApiService;
import com.cool.store.service.wallet.WalletService;
import com.cool.store.utils.BeanUtil;
import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.UUIDUtils;
import com.cool.store.vo.wallet.*;
import com.github.pagehelper.PageHelper;
@@ -32,8 +34,8 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.sql.Date;
import java.text.MessageFormat;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
@@ -42,6 +44,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* <p>
@@ -62,6 +65,7 @@ public class WalletServiceImpl implements WalletService {
private final RegionDao regionDao;
private final WalletPaymentOrderDAO walletPaymentOrderDAO;
private final LineInfoDAO lineInfoDAO;
private final RedisUtilPool redisUtilPool;
private final static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@@ -179,6 +183,11 @@ public class WalletServiceImpl implements WalletService {
AddTagDTO addTagDTO = walletApiService.addTag(tagRequest);
log.info("打标接口调用成功response:{}", JSONObject.toJSONString(addTagDTO));
}
} catch (ServiceException e) {
// 平安打标 签约人和法人一致时同步返回失败原因从msg中取
String key = MessageFormat.format(RedisConstant.WALLET_OPEN_FAIL, storeId, "1");
redisUtilPool.setString(key, e.getErrorCode().equals(1620003) ? e.getMessage() : "系统异常");
log.info("营业执照已上传,接口异常", e);
} catch (Exception e) {
log.error("营业执照已上传,打标失败", e);
}
@@ -195,6 +204,16 @@ public class WalletServiceImpl implements WalletService {
@Override
public Boolean addTagCallback(AddTagCallbackNoticeRequest request) {
try {
String key = MessageFormat.format(RedisConstant.WALLET_OPEN_FAIL, request.getOutStoreId(), "1");
if (Integer.valueOf(2).equals(request.getStatus())) {
redisUtilPool.setString(key, request.getErrorMsg());
} else {
redisUtilPool.delKey(key);
}
} catch (Exception e) {
log.info("回调失败", e);
}
return Boolean.TRUE;
}
@@ -212,7 +231,14 @@ public class WalletServiceImpl implements WalletService {
public List<AccountInfoVO> getAccountList(StoreShopRequest request) {
String storeId = getStoreId(request);
List<AccountInfoDTO> accountInfo = walletApiService.getAccountInfo(new OutStoreIdRequest(storeId));
return BeanUtil.toList(accountInfo, AccountInfoVO.class);
return accountInfo.stream()
.filter(v -> Objects.isNull(request.getWalletType()) || request.getWalletType().equals(v.getWalletType()))
.map(v -> {
AccountInfoVO vo = BeanUtil.toBean(v, AccountInfoVO.class);
String key = MessageFormat.format(RedisConstant.WALLET_OPEN_FAIL, storeId, String.valueOf(v.getWalletType()));
vo.setFailReason(redisUtilPool.getString(key));
return vo;
}).collect(Collectors.toList());
}
@Override