| | |
| | | @Value("${ctu.sendTask}") |
| | | private String sendTask; |
| | | |
| | | private String code ="code"; |
| | | |
| | | private String dataCode ="data"; |
| | | |
| | | private Integer codeValue =200; |
| | | |
| | | private Integer timeout = 1200; |
| | | |
| | | |
| | | @Transactional |
| | | public boolean sendTask(OpenBusSubmitParam openBusSubmitParam) { |
| | |
| | | response = new HttpHandler.Builder() |
| | | .setUri(ctuUrl) |
| | | .setPath(sendTask) |
| | | .setTimeout(1200, TimeUnit.SECONDS) |
| | | .setTimeout(timeout, TimeUnit.SECONDS) |
| | | .setJson(JSON.toJSONString(openBusSubmitParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | if (jsonObject.getInteger(code).equals(codeValue)) { |
| | | log.info("下发任务返回数据:{}", response); |
| | | return true; |
| | | } |
| | |
| | | response = new HttpHandler.Builder() |
| | | .setUri(ctuUrl) |
| | | .setPath(station) |
| | | .setTimeout(1200, TimeUnit.SECONDS) |
| | | .setTimeout(timeout, TimeUnit.SECONDS) |
| | | .setJson(JSON.toJSONString(stationRequestParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | if (jsonObject.getInteger(code).equals(codeValue)) { |
| | | log.info("RCS返回数据:{}", response); |
| | | JSONArray data = jsonObject.getJSONArray("data"); |
| | | JSONArray data = jsonObject.getJSONArray(dataCode); |
| | | List<StationStatus> stationStatuses = JSONArray.parseArray(data.toString(), StationStatus.class); |
| | | for (StationStatus object : stationStatuses) { |
| | | if (object.getStaNo().equals(staNo + "")) { |