#
vincentlu
4 天以前 5c3f2ceeaead80ce4b12be933ddf759cf8bddefc
zy-acs-manager/src/main/java/com/zy/acs/manager/core/integrate/conveyor/SiemensConveyorStationService.java
@@ -33,20 +33,22 @@
    @PostConstruct
    public void init() {
        int timeoutSeconds = conveyorProperties.getTimeout() / 1000;
        this.http = HttpGo.builder()
                .connectTimeout(Duration.ofSeconds(8))
                .readTimeout(Duration.ofSeconds(15))
                .connectTimeout(Duration.ofSeconds(timeoutSeconds))
                .readTimeout(Duration.ofSeconds(timeoutSeconds))
//                .defaultHeader("User-Agent", "HttpGo/1.0")
                // .trustAllSsl(true) // ONLY if you really need it (self-signed internal)
//                .trustAllSsl(true) // ONLY if you really need it (self-signed internal)
                .build();
    }
    @Override
    public boolean allowAgvWork(Sta sta, Task task, Segment seg, StaReserveType type) {
        final String staNo = sta.getStaNo();
        // url
        String url = this.buildUrl("/station/query");
        String url = this.http.buildUrl(conveyorProperties.getHost(), conveyorProperties.getPort(), "/cv/station/query");
        // headers
        Map<String, String> headers = new HashMap<>();
        // params
@@ -106,16 +108,7 @@
        return true;
    }
    private String buildUrl(String path) {
        String host = conveyorProperties.getHost();
        Integer port = conveyorProperties.getPort();
        String p = (path == null) ? "" : (path.startsWith("/") ? path : ("/" + path));
        return "http://" + host + ":" + port + p;
    }
    private HttpResult<List<ConveyorStaDto>> postForResult(String url
            , Map<String, String> headers, Map<String, Object> params) throws Exception {
    private HttpResult<List<ConveyorStaDto>> postForResult(String url, Map<String, String> headers, Map<String, Object> params) throws Exception {
        String json = JSON.toJSONString(params);
        HttpGo.HttpResponse response = this.http.postJson(url, headers, json);