1
zhang
21 小时以前 292cf07a04a7b6d72ee0a49dab5b4db712c41603
zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/service/impl/CtuMainServiceImpl.java
@@ -3,6 +3,7 @@
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;
@@ -36,6 +37,9 @@
    @Value("${ctu.station}")
    private String station;
    @Value("${ctu.checkTakeComplete}")
    private String checkTakeComplete;
    @Value("${ctu.sendTask}")
    private String sendTask;
@@ -45,7 +49,7 @@
    private Integer codeValue = 200;
    private Integer timeout = 1200;
    private Integer timeout = 10;
    @Transactional
@@ -119,5 +123,37 @@
        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;
    }
}