From 18fc70a0c4f2bd6c69ccfd58c1b01edc03d87e73 Mon Sep 17 00:00:00 2001 From: Administrator <zhubaomin> Date: 星期二, 23 七月 2024 15:45:45 +0800 Subject: [PATCH] 2024-07-23 朱宝民 PC端及小程序自动关阀(定时、定量),项目信息移入配置文件 --- pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandResultCtrl.java | 25 +++++++++++++++---------- 1 files changed, 15 insertions(+), 10 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandResultCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandResultCtrl.java index e5e2113..493625f 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandResultCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandResultCtrl.java @@ -1,8 +1,8 @@ package com.dy.pipIrrWechat.command; +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,16 +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{ + feature.complete(new JSONObject()); } - return BaseResponseUtils.buildSuccess("ok"); } } -- Gitblit v1.8.0