Selaa lähdekoodia

错误格式返回优化

wangyu 6 vuotta sitten
vanhempi
commit
238aa5c045

+ 1 - 1
diagbotman-service/src/main/java/com/diagbot/facade/OpenedProductsFacade.java

@@ -279,7 +279,7 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
         }
         for (OpenedProducts openedProducts1 :opendList) {
             if(beforeTime(openedProducts1.getEndTime(),modifyOpeningTimeVO.getEndTime())){
-                throw new CommonException(CommonErrorCode.NOT_EXISTS, "输入有误,续费时间需大于到期时间");
+                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "输入有误,续费时间需大于到期时间");
             }
         }
         openedProducts.setEndTime(DateUtil.parseDateTime(DateUtil.formatDateTime(DateUtil.getLastTimeOfDay(DateUtil.parseDate(modifyOpeningTimeVO.getEndTime())))));

+ 3 - 3
diagbotman-service/src/main/java/com/diagbot/facade/OrderDetailsFacade.java

@@ -99,14 +99,14 @@ public class OrderDetailsFacade extends OrderDetailsServiceImpl {
                 orderDetails.setRejectType(auditStatusVO.getRejectType());
             }
             if(!this.updateById(orderDetails)){
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                         "审核状态修改失败");
             }
             return productOrderFacade.updateProductOrderStatus(orderDetails.getOrderNum());
         }
         orderDetails.setStatus(PaymentMethodEnum.PAY.getKey());
         if(!this.updateById(orderDetails)){
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "审核状态修改失败");
         }
         Long userId =Long.parseLong(UserUtils.getCurrentPrincipleID());
@@ -164,7 +164,7 @@ public class OrderDetailsFacade extends OrderDetailsServiceImpl {
         }
         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;

+ 8 - 8
diagbotman-service/src/main/java/com/diagbot/facade/ProductOrderFacade.java

@@ -143,7 +143,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
         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,
                     "获取用户机构信息失败");
         }
         Map<Long, UserOrgDTO> dataMap =mapRespDTO.data;
@@ -172,7 +172,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
         productOrder.setUserId(userId);
         productOrder.setTime(DateUtil.now());
         if (!save(productOrder)) {
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "添加订单失败");
+            throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "添加订单失败");
         }
         OrderDetails orderDetails = null;
         List<OrderDetails> list =new ArrayList();
@@ -191,7 +191,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "获取产品信息失败");
         }
         if(orderDetailsFacade.saveOrderDetails(list)){
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "添加订单失败");
+            throw new CommonException(CommonErrorCode.INSERT_DATA_FAILED, "添加订单失败");
         }
         return true;
     }
@@ -217,7 +217,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
         WaitExamOrderCouDTO waitExamOrderCouDTO = new WaitExamOrderCouDTO();
         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<>();
@@ -244,7 +244,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
         if(productOrderVO.getOrgName()!=null&&productOrderVO.getOrgName()!=""){
             RespDTO<List<Long>> rlist = userServiceClient.getUserByOrgName(productOrderVO.getOrgName());
             if(rlist == null || !"0".equals(rlist.code) ) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+                throw new CommonException(CommonErrorCode.RPC_ERROR,
                         "获取用户和机构信息失败");
             }
             if(rlist.data.size() == 0){
@@ -254,7 +254,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
         }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<>();
@@ -277,7 +277,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
 		List<OrderDetialsDTO> orderDetilList = orderDetailsFacade.getAllOrderDetials(orderDetialsVO);
 		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;
@@ -331,7 +331,7 @@ public class ProductOrderFacade extends ProductOrderServiceImpl {
         productOrder.setGmtModified(DateUtil.now());
         productOrder.setModifier(UserUtils.getCurrentPrincipleID());
         if(!this.updateById(productOrder)){
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "用户订单审核状态修改失败");
         }
         return true;

+ 4 - 4
diagbotman-service/src/main/java/com/diagbot/facade/UserRenewalsFacade.java

@@ -103,7 +103,7 @@ public class UserRenewalsFacade extends UserRenewalsServiceImpl {
         }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<>();
@@ -123,7 +123,7 @@ public class UserRenewalsFacade extends UserRenewalsServiceImpl {
         List<OpenedProducts> opendList = openedProductsFacade.getOpendInfos();
         RespDTO<Map<Long, UserOrgDTO>> mapRespDTO = userServiceClient.getUserAndOrg(userIds);
         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;
@@ -165,7 +165,7 @@ public class UserRenewalsFacade extends UserRenewalsServiceImpl {
         userRenewals.setModifier(UserUtils.getCurrentPrincipleID());
         userRenewals.setGmtModified(DateUtil.now());
         if(!this.updateById(userRenewals)){
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "删除失败");
         }
         return true;
@@ -189,7 +189,7 @@ public class UserRenewalsFacade extends UserRenewalsServiceImpl {
             throw new CommonException(CommonErrorCode.NOT_EXISTS, "续费单已审核,请刷新重试");
         }
         if(!this.updateById(userRenewals)){
-            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+            throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL,
                     "取消失败");
         }
         return true;