Przeglądaj źródła

http通讯问题异常报错处理,新增判定处理

anderx 2 lat temu
rodzic
commit
6e94a5a0c0

+ 2 - 1
src/main/java/com/goafanti/common/utils/HttpUtils.java

@@ -2,6 +2,7 @@ package com.goafanti.common.utils;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.goafanti.common.error.BusinessException;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
 import org.apache.http.ParseException;
@@ -85,7 +86,7 @@ public class HttpUtils {
 			try {
 				resultString = EntityUtils.toString(response.getEntity());
 			} catch (ParseException | IOException e) {
-				e.printStackTrace();
+				throw new BusinessException("网路通讯异常,请稍后再试。");
 			}
 			JSONObject jsonObj = JSONObject.parseObject(resultString);
 			return jsonObj;

+ 4 - 4
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -123,17 +123,17 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                 eae.setAuditorname(examineName);
                 ea.setExamineName(examineName);
             }else if (i==2){
-                if (dep.getManagerId()==null|| StringUtils.isBlank(dep.getManagerId())){
+                if (StringUtils.isBlank(dep.getManagerName())){
                     throw new BusinessException("报销申请部门管理员不存在。");
                 }
                     eae.setAuditor(dep.getManagerId());
                     eae.setAuditorname(dep.getManagerName());
             }else if (i==3){
-                if (dep.getExpenseFinanceId()==null)throw new BusinessException("报销部门财务审核人不存在。");
+                if (StringUtils.isBlank(dep.getExpenseFinanceName()))throw new BusinessException("报销部门财务审核人不存在。");
                 eae.setAuditor(dep.getExpenseFinanceId());
                 eae.setAuditorname(dep.getExpenseFinanceName());
             }else if (i==4){
-                if (dep.getExpenseRetrialFinanceId()==null)throw new BusinessException("报销部门财务复审人不存在。");
+                if (StringUtils.isBlank(dep.getExpenseRetrialFinanceId()))throw new BusinessException("报销部门财务复审人不存在。");
                 eae.setAuditor(dep.getExpenseRetrialFinanceId());
                 eae.setAuditorname(dep.getExpenseRetrialFinanceName());
             }else if (i==6){
@@ -149,7 +149,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
                     eae.setAuditorname(admin.getName());
                 }
             }else if (i==8){
-                if (dep.getCashierId()==null)throw new BusinessException("报销部门出纳不存在。");
+                if (StringUtils.isBlank(dep.getCashierName()))throw new BusinessException("报销部门出纳不存在。");
                     eae.setAuditor(dep.getCashierId());
                     eae.setAuditorname(dep.getCashierName());
             }