| New file | 
|  |  |  | 
|---|
|  |  |  | 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.pipIrrGlobal.command.ComResultWait; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.command.ComSupport; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.http.MediaType; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PostMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.concurrent.CompletableFuture; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author ZhuBaoMin | 
|---|
|  |  |  | * @date 2024-05-30 16:07 | 
|---|
|  |  |  | * @LastEditTime 2024-05-30 16:07 | 
|---|
|  |  |  | * @Description | 
|---|
|  |  |  | */ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping(path="comRes") | 
|---|
|  |  |  | public class CommandResultCtrl extends ComSupport { | 
|---|
|  |  |  | @PostMapping(path = "receive", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | 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"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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>) ComResultWait.get(job_data.getLong("commandId")); | 
|---|
|  |  |  | if(feature != null) { | 
|---|
|  |  |  | feature.complete(job_response); | 
|---|
|  |  |  | }//else{ | 
|---|
|  |  |  | //   feature.complete(new JSONObject()); | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|