pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/CommandResultCtrl.java
@@ -1,8 +1,8 @@
package com.dy.pipIrrRemote.common;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.dy.common.mw.protocol.Data;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pipIrrGlobal.command.ComSupport;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
@@ -25,18 +25,21 @@
@RequestMapping(path="comRes")
public class CommandResultCtrl extends ComSupport {
    @PostMapping(path = "receive", consumes = MediaType.APPLICATION_JSON_VALUE)
    public BaseResponse<String> receive(@RequestBody Data data) {
        Long comId = 0L;
        if(data.getCommandId() != null) {
            comId = Long.parseLong(data.getCommandId());
        }
    public void receive(@RequestBody Data data) {
        JSONObject job_data = (JSONObject) JSON.toJSON(data);
        String job_dataS = job_data.toJSONString();
        JSONObject job_subData = job_data.getJSONObject("subData").getJSONObject("subData");
        CompletableFuture<Data> feature = (CompletableFuture<Data>) features.get(comId);
        JSONObject job_response = new JSONObject();
        job_response.put("data", job_subData);
        job_response.put("commandCode", job_data.getString("code"));
        job_response.put("commandId", job_data.getString("commandId"));
        CompletableFuture<JSONObject> feature = (CompletableFuture<JSONObject>) features.get(job_data.getLong("commandId"));
        if(feature != null) {
            feature.complete(data);
            feature.complete(job_response);
        }else{
            log.error("feature is null");
            feature.complete(new JSONObject());
        }
        return BaseResponseUtils.buildSuccess("ok");
    }
}