| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.zy.acs.common.utils.News; |
| | | import com.zy.acs.conveyor.common.utils.HttpHandler; |
| | | import com.zy.acs.conveyor.controller.requestParam.StationRequestParam; |
| | | import com.zy.acs.conveyor.controller.vo.OpenBusSubmitParam; |
| | |
| | | @Value("${ctu.station}") |
| | | private String station; |
| | | |
| | | @Value("${ctu.checkTakeComplete}") |
| | | private String checkTakeComplete; |
| | | |
| | | @Value("${ctu.sendTask}") |
| | | private String sendTask; |
| | | |
| | |
| | | |
| | | private Integer codeValue = 200; |
| | | |
| | | private Integer timeout = 1200; |
| | | private Integer timeout = 10; |
| | | |
| | | |
| | | @Transactional |
| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 检查站点状态 |
| | | * |
| | | * @param seqNum 任务号 |
| | | * @return 站点是否可通行 |
| | | */ |
| | | public Boolean checkComplete(String seqNum) { |
| | | StationRequestParam stationRequestParam = new StationRequestParam(); |
| | | stationRequestParam.setSeqNum(seqNum); |
| | | String response = ""; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(ctuUrl) |
| | | .setPath(checkTakeComplete) |
| | | .setTimeout(timeout, TimeUnit.SECONDS) |
| | | .setJson(JSON.toJSONString(stationRequestParam)) |
| | | .build() |
| | | .doPost(); |
| | | News.info("RCS返回数据:{}", response); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger(code).equals(codeValue)) { |
| | | if (jsonObject.getBoolean(dataCode)) { |
| | | return true; |
| | | } |
| | | } else { |
| | | log.error("调用下发任务接口报错,参数:{},响应内容:{}", seqNum, response); |
| | | //throw new CoolException("调用下发任务接口报错,响应码:" + jsonObject.getInteger(code)); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("检查站点状态失败,任务编号:{},{}", seqNum,e.getMessage()); |
| | | } |
| | | return false; |
| | | } |
| | | } |