Explorar el Código

实名认证更换手机号返回值调整

shuiqilin
houyi hace 1 año
padre
commit
d7c44e0fd8

+ 1
- 1
application.pid Ver fichero

@@ -1 +1 @@
34940
45260

+ 51
- 0
src/main/java/com/qtzl/alterSales/manager/enums/CenterAccountMobileChangeStatusEnum.java Ver fichero

@@ -0,0 +1,51 @@
package com.qtzl.alterSales.manager.enums;

/***
* <p>
*
* </p>
* @author hou yi
* {@code @date} 2024/7/30 11:10
**/
public enum CenterAccountMobileChangeStatusEnum {
/***
* 枚举具体描述
**/
SUCCESS(1, "更改成功"),
CODE_ERR(2, "验证码错误"),
IDENTIFICATION_ERR(3, "部选装开放平台用户标识错误"),
HANG_IN_THE_AIR(4, "更改手机号前应先完成实名认证"),
;

private final Integer code;

private final String type;

/**
* 根据编码查找枚举
*
* @param code 编码
* @return {@link CenterAccountMobileChangeStatusEnum } 实例
**/
public static CenterAccountMobileChangeStatusEnum find(Integer code) {
for (CenterAccountMobileChangeStatusEnum instance : CenterAccountMobileChangeStatusEnum.values()) {
if (instance.getCode().equals(code)) {
return instance;
}
}
return null;
}

CenterAccountMobileChangeStatusEnum(Integer code, String type) {
this.code = code;
this.type = type;
}

public Integer getCode() {
return this.code;
}

public String getType() {
return this.type;
}
}

+ 8
- 2
src/main/java/com/qtzl/alterSales/manager/service/account/CenterAccountAbstract.java Ver fichero

@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.qtzl.alterSales.config.CenterAccountConfiguration;
import com.qtzl.alterSales.manager.enums.CenterAccountApiEnum;
import com.qtzl.alterSales.manager.enums.CenterAccountMobileChangeStatusEnum;
import com.qtzl.alterSales.manager.model.protocol.UcServiceError;
import com.qtzl.alterSales.manager.model.protocol.account.request.CenterAccountRequest;
import com.qtzl.alterSales.manager.model.protocol.account.response.CenterAccountPublicResponse;
@@ -52,10 +53,10 @@ public abstract class CenterAccountAbstract {
param.put("authToken", request.getAuthToken());
param.put("bizContent", AESTools.encrypt(JSON.toJSONString(request), centerAccountConfiguration.getSecretKey()));
sign(param);
log.info(apiEnum.getDescription() +"...入参...:" + (JSON.toJSONString(param).length() > 1000 ? JSON.toJSONString(param).substring(0, 1000) : JSON.toJSONString(param)));
log.info(apiEnum.getDescription() + "...入参...:" + (JSON.toJSONString(param).length() > 1000 ? JSON.toJSONString(param).substring(0, 1000) : JSON.toJSONString(param)));
final ResponseEntity<CenterAccountPublicResponse> response = restTemplate.postForEntity(centerAccountConfiguration.getUrl() + apiEnum.getApi(), param,
CenterAccountPublicResponse.class);
log.info(apiEnum.getDescription() +"...响应...:" + JSON.toJSONString(response));
log.info(apiEnum.getDescription() + "...响应...:" + JSON.toJSONString(response));
if (null == response.getBody()) {
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("部中心-用户账户体系接口返回为空");
}
@@ -68,6 +69,11 @@ public abstract class CenterAccountAbstract {
}
final K responseResult = JSONObject.parseObject(AESTools.decrypt(body.getBizContent(), centerAccountConfiguration.getSecretKey()), responseClass);
if (null == responseResult.getStatus() || !responseResult.getStatus().equals(1)) {
if (CenterAccountApiEnum.MOBILE_CHANGE.equals(apiEnum)) {
// 更改手机号特殊处理
final CenterAccountMobileChangeStatusEnum statusEnum = CenterAccountMobileChangeStatusEnum.find(responseResult.getStatus());
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException(null == statusEnum ? "部中心-返回错误信息为空" : statusEnum.getType());
}
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException(StringUtils.isEmpty(responseResult.getMsg()) ? "部中心-返回错误信息为空" : responseResult.getMsg());
}
return responseResult;

Cargando…
Cancelar
Guardar