技术监督用户信息迁移

This commit is contained in:
wr
2026-03-05 19:32:03 +08:00
parent 94037d588b
commit eec2560fd2
45 changed files with 1127 additions and 212 deletions

View File

@@ -2,7 +2,7 @@ package com.njcn.supervision.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.supervision.api.fallback.UserLedgerFeignClientFallbackFactory;
import com.njcn.supervision.api.fallback.UserLedgerOldFeignClientFallbackFactory;
import com.njcn.supervision.pojo.param.user.UserReportParam;
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
@@ -19,8 +19,8 @@ import java.util.List;
* 流程实例 Api 接口
*
*/
@FeignClient(value = ServerInfo.SUPERVISION, path = "/userReport", fallbackFactory = UserLedgerFeignClientFallbackFactory.class)
public interface UserLedgerFeignClient {
@FeignClient(value = ServerInfo.SUPERVISION, path = "/userReport", fallbackFactory = UserLedgerOldFeignClientFallbackFactory.class)
public interface UserLedgerOldFeignClient {
@PostMapping("/selectUserList")

View File

@@ -2,7 +2,7 @@ package com.njcn.supervision.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.supervision.api.fallback.UserReportFeignClientFallbackFactory;
import com.njcn.supervision.api.fallback.UserReportOldFeignClientFallbackFactory;
import com.njcn.supervision.pojo.param.SensitiveUserParam;
import com.njcn.supervision.pojo.po.user.UserReportPO;
import io.swagger.annotations.ApiOperation;
@@ -18,8 +18,8 @@ import java.util.List;
*
* @author 徐扬
*/
@FeignClient(value = ServerInfo.SUPERVISION, path = "/userReport", fallbackFactory = UserReportFeignClientFallbackFactory.class)
public interface UserReportManageFeignClient {
@FeignClient(value = ServerInfo.SUPERVISION, path = "/userReport", fallbackFactory = UserReportOldFeignClientFallbackFactory.class)
public interface UserReportManageOldFeignClient {
@PostMapping("/getSensitiveUserByDept")

View File

@@ -1,57 +0,0 @@
package com.njcn.supervision.api.fallback;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.supervision.api.UserLedgerFeignClient;
import com.njcn.supervision.pojo.param.user.UserReportParam;
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
import com.njcn.supervision.pojo.vo.user.UserLedgerVO;
import com.njcn.supervision.utils.SupervisionEnumUtil;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
@Slf4j
@Component
public class UserLedgerFeignClientFallbackFactory implements FallbackFactory<UserLedgerFeignClient> {
@Override
public UserLedgerFeignClient create(Throwable throwable) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) throwable.getCause();
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new UserLedgerFeignClient() {
@Override
public HttpResult<List<UserLedgerVO>> selectUserList(UserReportParam userReportParam) {
log.error("{}异常,降级处理,异常为:{}", "查询用户台账", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<UserLedgerVO> selectUserInfo(String id) {
log.error("{}异常,降级处理,异常为:{}", "查询用户台账详情", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<UserLedgerVO>> bindUserStation(String userId, String stationId) {
log.error("{}异常,降级处理,异常为:{}", "用户电站信息绑定", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<NewUserReportVO>> getUserReportByIds(List<String> ids) {
log.error("{}异常,降级处理,异常为:{}", "根据ids获取非电网侧用户信息", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -3,7 +3,7 @@ package com.njcn.supervision.api.fallback;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.supervision.api.UserReportManageFeignClient;
import com.njcn.supervision.api.UserReportManageOldFeignClient;
import com.njcn.supervision.pojo.param.SensitiveUserParam;
import com.njcn.supervision.pojo.po.user.UserReportPO;
import com.njcn.supervision.utils.SupervisionEnumUtil;
@@ -16,9 +16,9 @@ import java.util.List;
@Slf4j
@Component
public class UserReportFeignClientFallbackFactory implements FallbackFactory<UserReportManageFeignClient> {
public class UserReportOldFeignClientFallbackFactory implements FallbackFactory<UserReportManageOldFeignClient> {
@Override
public UserReportManageFeignClient create(Throwable throwable) {
public UserReportManageOldFeignClient create(Throwable throwable) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
@@ -26,7 +26,7 @@ public class UserReportFeignClientFallbackFactory implements FallbackFactory<Use
exceptionEnum = SupervisionEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new UserReportManageFeignClient() {
return new UserReportManageOldFeignClient() {
@Override
public HttpResult<List<UserReportPO>> getSensitiveUserByDept(SensitiveUserParam param) {