Selaa lähdekoodia

错误格式返回优化

wangyu 6 vuotta sitten
vanhempi
commit
18da75d269

+ 9 - 9
diagbotman-service/src/main/java/com/diagbot/facade/LantoneProductFacade.java

@@ -88,7 +88,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         lantoneProduct.setGmtCreate(DateUtil.now());
         lantoneProduct.setCreator(UserUtils.getCurrentPrincipleID());
         if (!save(lantoneProduct)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "产品添加失败");
         }
         return true;
@@ -126,7 +126,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
             }
         }
         if (!updateById(lantoneProduct)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "产品修改失败");
         }
         return true;
@@ -184,7 +184,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
             }
         }
         if (!updateById(lantoneProduct)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "产品修改失败");
         }
         return true;
@@ -217,11 +217,11 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         lantoneProduct.setGmtModified(DateUtil.now());
         lantoneProduct.setIsDeleted(IsDeleteEnum.Y.getKey());
         if (!updateById(lantoneProduct)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "产品删除失败");
         }
         if(!productServiceFacade.deleteByProductId(updateProductVO.getId())){
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                         "产品令牌删除失败");
         }
         return true;
@@ -239,7 +239,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         userIdList.add(userId);
         RespDTO<Map<Long, UserOrgDTO>> mapRespDTO = userServiceClient.getUserAndOrg(userIdList);
         if (mapRespDTO == null || !"0".equals(mapRespDTO.code)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取用户机构信息失败");
         }
 
@@ -309,7 +309,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         }
         RespDTO<User> mapRespDTO = userServiceClient.getUserAuthStatus(userId);
         if (mapRespDTO == null || !"0".equals(mapRespDTO.code)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取用户机构信息失败");
         }
         Map map =new HashMap();
@@ -347,7 +347,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         }else{
             RespDTO<List<User>> userInfiList = userServiceClient.getUserAllInfo();
             if(userInfiList == null || !"0".equals(userInfiList.code) ) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                throw new CommonException(CommonErrorCode.RPC_ERROR,
                         "获取用户和机构信息失败");
             }
             List<Long> userIds =new ArrayList<>();
@@ -364,7 +364,7 @@ public class LantoneProductFacade extends LantoneProductServiceImpl {
         }
         RespDTO<Map<Long, UserOrgDTO>> mapRespDTO = userServiceClient.getUserAndOrg(list1);
         if (mapRespDTO == null || !"0".equals(mapRespDTO.code)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.RPC_ERROR,
                     "获取用户和机构信息失败");
         }
         Map<Long, UserOrgDTO> dataMap = mapRespDTO.data;