From cebf0cafac47189c48f49ad9dd13cb5894341b4f Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期日, 02 六月 2024 20:26:35 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/ComSupport.java | 34 ++++++++++++++++++---------------- 1 files changed, 18 insertions(+), 16 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/ComSupport.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/ComSupport.java index 7994a33..7a81f76 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/ComSupport.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/common/ComSupport.java @@ -6,7 +6,6 @@ import com.dy.common.mw.protocol.CommandType; import com.dy.common.mw.protocol.Data; import com.dy.common.mw.protocol.p206V202404.CodeV202404; -import com.dy.common.mw.protocol.p206V202404.ProtocolConstantV206V202404; import com.dy.common.mw.protocol.p206V202404.downVos.ComCdXyVo; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; @@ -52,15 +51,14 @@ protected static String controllerType = "57" ;//鎺у埗鍣ㄧ被鍨� protected static Integer projectNo = 100 ;//椤圭洰缂栫爜 - protected static String icCardAddr = "04BEA5BB" ;//IC鍗″湴鍧� - protected static String icCardNo = "37142501020500001" ;//IC鍗$紪鍙凤紙鐢ㄦ埛鍗″簭鍒楀彿锛� - - protected String protocolName = ProtocolConstantV206V202404.protocolName; + //protected static String icCardAddr = "04BEA5BB" ;//IC鍗″湴鍧� + //protected static String icCardNo = "37142501020500001" ;//IC鍗$紪鍙凤紙鐢ㄦ埛鍗″簭鍒楀彿锛� + //protected String protocolName = ProtocolConstantV206V202404.protocolName; protected String commandTypeOuter = CommandType.outerCommand; // 瀛樺偍瀹炰緥鍖栫殑 CompletableFuture<Data> 瀵硅薄 - protected static Map<String, Object> features = new HashMap<>(); + protected static Map<Long, Object> features = new HashMap<>(); protected static Boolean setuped = false; @Autowired @@ -83,7 +81,7 @@ * 鑾峰彇绯荤粺閰嶇疆鍙傛暟 */ public void setUp() { - protocolName = comSupport.baSettingsMapper.getItemValue("protocolName"); + //protocolName = comSupport.baSettingsMapper.getItemValue("protocolName"); controllerType = comSupport.baSettingsMapper.getItemValue("controllerType"); projectNo = Integer.parseInt(comSupport.baSettingsMapper.getItemValue("projectNo")); setuped = true; @@ -98,18 +96,22 @@ /** * 鍒涘缓鍛戒护鏃ュ織瀵硅薄 + * @param comId 涓婚敭 * @param commandCode 鍔熻兘鐮� * @param rtuAddr 闃�鎺у櫒鍦板潃 + * @param protocol 閫氳鍗忚鍚嶇О * @param param 鍙傛暟鏁版嵁 * @param operator 鎿嶄綔鍛� - * @return 闆堕浂鏃ュ織瀵硅薄 + * @return */ - protected RmCommandHistory getComHistory(String commandCode, String rtuAddr, Object param, Long operator ) { + protected RmCommandHistory getComHistory(Long comId, String commandCode, Long intakeId, String rtuAddr, String protocol, Object param, Long operator ) { RmCommandHistory rmCommandHistory = new RmCommandHistory(); + rmCommandHistory.setId(comId); rmCommandHistory.setCommandCode(commandCode); rmCommandHistory.setCommandName(CodeV202404.getCodeName(commandCode)); - rmCommandHistory.setRtuaddr(rtuAddr); - rmCommandHistory.setProtocol(protocolName); + rmCommandHistory.setIntakeId(intakeId); + rmCommandHistory.setRtuAddr(rtuAddr); + rmCommandHistory.setProtocol(protocol); rmCommandHistory.setParam((JSONObject) JSON.toJSON(param)); rmCommandHistory.setSendTime(new Date()); rmCommandHistory.setOperator(operator); @@ -124,13 +126,13 @@ * @param param 鍙傛暟鏁版嵁 * @return 鏋勯�犲ソ鐨勫懡浠ゅ璞� */ - protected Command command(String comId, String commandCode, String rtuAddr, Object param){ + protected Command command(Long comId, String commandCode, String rtuAddr, String protocol, Object param){ Command com = new Command() ; - com.id = comId==null?Command.defaultId:(comId.trim().equals("")?Command.defaultId:comId); + com.id = String.valueOf(comId); com.code = commandCode ; com.rtuAddr = rtuAddr ; - com.protocol = protocolName; + com.protocol = protocol; com.type = commandTypeOuter; com.rtuResultSendWebUrl = rtuResultSendWebUrl ; @@ -144,13 +146,13 @@ * @param comId * @return */ - protected BaseResponse<Data> dealWithCallBack(String comId) { + protected BaseResponse<Data> dealWithCallBack(Long comId) { CompletableFuture<Data> featureObject = new CompletableFuture<>(); features.put(comId, featureObject); try { CompletableFuture<Data> feature = (CompletableFuture<Data>) features.get(comId); System.out.println("receive result ID:" + comId); - Data resultData = feature.get(30, TimeUnit.SECONDS); + Data resultData = feature.get(10, TimeUnit.SECONDS); features.remove(comId); String commandId = resultData.getCommandId(); if(commandId.equals(comId)) { -- Gitblit v1.8.0