浏览代码

异常处理

wangfeng 6 年之前
父节点
当前提交
53ff99b57b
共有 1 个文件被更改,包括 11 次插入9 次删除
  1. 11 9
      diagbotman-service/src/main/java/com/diagbot/web/ProductOrderController.java

+ 11 - 9
diagbotman-service/src/main/java/com/diagbot/web/ProductOrderController.java

@@ -24,6 +24,8 @@ import com.diagbot.dto.WaitExamOrderCouDTO;
 import com.diagbot.entity.OpenedProducts;
 import com.diagbot.entity.wrapper.OrderDetailsWapper;
 import com.diagbot.entity.wrapper.ProductOrderWrapper;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.facade.LantoneProductFacade;
 import com.diagbot.facade.OpenedProductsFacade;
 import com.diagbot.facade.ProductOrderFacade;
@@ -128,10 +130,10 @@ public class ProductOrderController {
 		openedProducts.setGmtCreate(DateUtil.now());
 		openedProducts.setServiceStatus(startAndendByUserIdVO.getServiceStatus());
 		boolean res =openedProductsFacade.startAndendByuserId(openedProducts);
-		if(res !=true  ){
-			return RespDTO.onSuc("操作失败!");
+		if (!res){
+			throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
 		}
-		return RespDTO.onSuc("操作成功!");
+		return RespDTO.onSuc(res);
 	}
 
 	@ApiOperation(value = "根据用户id和产品id,删除开通信息[by:wangfeng]", notes = "删除开通信息")
@@ -145,10 +147,10 @@ public class ProductOrderController {
 		openedProducts.setCreator(UserUtils.getCurrentPrincipleID());
 		openedProducts.setGmtCreate(DateUtil.now());
 		boolean res =openedProductsFacade.delInformationAvailable(openedProducts);
-		if(res !=true  ){
-			return RespDTO.onSuc("操作失败!");
+		if (!res){
+			throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
 		}
-		return RespDTO.onSuc("操作成功!");
+		return RespDTO.onSuc(res);
 	}
 
 	@ApiOperation(value = "根据用户id和产品id,修改开通时间[by:wangfeng]", notes = "修改开通时间")
@@ -164,10 +166,10 @@ public class ProductOrderController {
 		//TODO wangfeng openedProducts.setCreator(UserUtils.getCurrentPrincipleID());
 		openedProducts.setGmtCreate(DateUtil.now());
 		boolean res = openedProductsFacade.modifyOpeningTime(openedProducts);
-		if(res !=true  ){
-			return RespDTO.onSuc("操作失败!");
+		if (!res){
+			throw new CommonException(CommonErrorCode.UPDATE_INFO_FAIL);
 		}
-		return RespDTO.onSuc("操作成功!");
+		return RespDTO.onSuc(res);
 	}
 
 	@ApiOperation(value = "查询所有订单明细[by:wangyu]",