|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected String commandTypeOuter = CommandType.outerCommand; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 存储实例化的 CompletableFuture<Data> 对象 | 
|---|
|  |  |  | protected static Map<Long, Object> features = new HashMap<>(); | 
|---|
|  |  |  | //protected static Boolean setuped = false; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private RestTemplate restTemplate; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | protected BaseResponse<Data> dealWithCallBack(Long comId, Command com) { | 
|---|
|  |  |  | CompletableFuture<JSONObject> feature = new CompletableFuture<>(); | 
|---|
|  |  |  | features.put(comId, feature); | 
|---|
|  |  |  | ComResultWait.put(comId, feature); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | // 发送命令 | 
|---|
|  |  |  | JSONObject response_SendCom = (JSONObject) JSON.toJSON(sendCom2Mw(com)); | 
|---|
|  |  |  | if (response_SendCom == null || !response_SendCom.getString("code").equals("0001")) { | 
|---|
|  |  |  | // 请求失败,RTU未上线,清除feature | 
|---|
|  |  |  | features.remove(comId); | 
|---|
|  |  |  | ComResultWait.remove(comId); | 
|---|
|  |  |  | JSONObject job_param = response_SendCom.getJSONObject("content").getJSONObject("param"); | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg(job_param.getString("message")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | JSONObject resultData = feature.get(180, TimeUnit.SECONDS); | 
|---|
|  |  |  | features.remove(comId); | 
|---|
|  |  |  | ComResultWait.remove(comId); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Long commandId = resultData.getLong("commandId"); | 
|---|
|  |  |  | if (commandId.equals(comId)) { | 
|---|
|  |  |  | 
|---|
|  |  |  | rmCommandHistory.setResult((byte) 1); | 
|---|
|  |  |  | rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(openType == 1) { | 
|---|
|  |  |  | if(openType != null && openType == 1) { | 
|---|
|  |  |  | irIntakeOperateMapper.updateByCommandId(comId, (byte)1, null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|