Browse Source

修改机场接口调用,异常提醒

tags/v1.1.0
wanghaoran 2 years ago
parent
commit
3ecd2cbc4f
2 changed files with 8 additions and 6 deletions
  1. +7
    -5
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ThInspectionServiceImpl.java
  2. +1
    -1
      tuoheng-common/src/main/java/com/tuoheng/common/utils/HttpUtils.java

+ 7
- 5
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/ThInspectionServiceImpl.java View File

import com.tuoheng.common.common.BaseServiceImpl; import com.tuoheng.common.common.BaseServiceImpl;
import com.tuoheng.common.config.CommonConfig; import com.tuoheng.common.config.CommonConfig;
import com.tuoheng.common.exception.ServiceException; import com.tuoheng.common.exception.ServiceException;
import com.tuoheng.common.utils.HttpUtils;
import com.tuoheng.common.utils.JacksonUtil;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.common.utils.RedisUtils;
import com.tuoheng.common.utils.*;
import com.tuoheng.system.utils.ShiroUtils; import com.tuoheng.system.utils.ShiroUtils;
import groovy.util.logging.Slf4j; import groovy.util.logging.Slf4j;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
jsonObject.put("taskId", taskId); jsonObject.put("taskId", taskId);


String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST"); String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST");
JsonResult jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class);
JsonResult jsonResult = null;
try {
jsonResult = JacksonUtil.json2pojo(airPortStr, JsonResult.class);
} catch (Exception e) {
return JsonResult.error(airPortStr);
}
if (ObjectUtil.isEmpty(jsonResult) || (!ObjectUtil.isEmpty(Objects.requireNonNull(jsonResult).getData()) && jsonResult.getCode() != 0)) { if (ObjectUtil.isEmpty(jsonResult) || (!ObjectUtil.isEmpty(Objects.requireNonNull(jsonResult).getData()) && jsonResult.getCode() != 0)) {
assert jsonResult != null; assert jsonResult != null;
return JsonResult.error(JSONObject.parseArray(JSONObject.parseObject(JSONObject.toJSONString(jsonResult.getData())).get("data").toString(), AirExecuteTaskVO.class), "执行任务失败!"); return JsonResult.error(JSONObject.parseArray(JSONObject.parseObject(JSONObject.toJSONString(jsonResult.getData())).get("data").toString(), AirExecuteTaskVO.class), "执行任务失败!");

+ 1
- 1
tuoheng-common/src/main/java/com/tuoheng/common/utils/HttpUtils.java View File

return result.toString(); return result.toString();
} catch (Exception e) { } catch (Exception e) {
log.error("post请求失败,{}",e.getMessage()); log.error("post请求失败,{}",e.getMessage());
return "post请求失败!";
return "接口异常:" + e.getMessage();
} }
} }



Loading…
Cancel
Save