fix:打标失败处理
This commit is contained in:
@@ -289,4 +289,9 @@ public class RedisConstant {
|
||||
public static final String HUO_MA_STORE_ID = "huo_ma_store_id";
|
||||
|
||||
public static final String HUO_MA_TOKEN= "huo_ma_token:{0}";
|
||||
|
||||
/**
|
||||
* 钱包开通失败原因 wallet_open_fail:storeId:1/2 1平安/2网商
|
||||
*/
|
||||
public static final String WALLET_OPEN_FAIL = "wallet_open_fail:{0}:{1}";
|
||||
}
|
||||
|
||||
@@ -317,6 +317,7 @@ public enum ErrorCodeEnum {
|
||||
|
||||
WALLET_OPEN_ACCOUNT_FAIL(1620001,"钱包开通失败",null),
|
||||
WALLET_WITH_DRAWER_FAIL(1620002,"提现失败",null),
|
||||
WALLET_API_ERROR(1620003,"{0}",null),
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -71,4 +71,7 @@ public class AccountInfoDTO {
|
||||
|
||||
@ApiModelProperty("工商类型 1.企业 2.个体工商户 3.小微商户(自然人)")
|
||||
private Integer businessType;
|
||||
|
||||
@ApiModelProperty("钱包类型 1平安 2网商")
|
||||
private Integer walletType;
|
||||
}
|
||||
|
||||
@@ -17,5 +17,6 @@ public class AddTagCallbackNoticeRequest {
|
||||
private Integer status;
|
||||
@ApiModelProperty(name = "1.法人 2.非法人", required = true)
|
||||
private Integer addTagType;
|
||||
|
||||
@ApiModelProperty(name = "失败原因")
|
||||
private String errorMsg;
|
||||
}
|
||||
|
||||
@@ -18,4 +18,7 @@ public class StoreShopRequest {
|
||||
|
||||
@ApiModelProperty("门店id,两者取一")
|
||||
private String storeId;
|
||||
|
||||
@ApiModelProperty("钱包类型 1平安 2网商")
|
||||
private Integer walletType;
|
||||
}
|
||||
|
||||
@@ -36,4 +36,7 @@ public class AccountInfoVO {
|
||||
|
||||
@ApiModelProperty(value = "打标状态 0 未打标 1 已打标")
|
||||
private Integer labelingStatus;
|
||||
|
||||
@ApiModelProperty("账户升级失败原因")
|
||||
private String failReason;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user