From c8ae875dcfb55ac27a434f6b8ca40a5c80a5f9ee Mon Sep 17 00:00:00 2001 From: wuzeyu <1223318623@qq.com> Date: 星期二, 24 十二月 2024 15:03:47 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java | 102 +++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 83 insertions(+), 19 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java index 54646cf..2afc76d 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/command/ComSupport.java @@ -5,6 +5,7 @@ import com.dy.common.mw.protocol.Command; import com.dy.common.mw.protocol.CommandType; import com.dy.common.mw.protocol.Data; +import com.dy.common.mw.protocol.p206V1.CodeV1; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import com.dy.pipIrrGlobal.command.dto.Param; @@ -29,12 +30,11 @@ import org.springframework.web.client.RestTemplate; import org.springframework.web.util.UriComponentsBuilder; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.Random; +import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; @@ -328,32 +328,96 @@ * 濡傛灉鏄紑鍏抽榾锛氭洿鏀硅櫄鎷熷崱鐘舵�侊細鏄惁浣跨敤涓�佹渶鍚庢搷浣溿�佹渶鍚庢搷浣滄椂闂� * 鏇存柊鎵ц缁撴灉銆佽繑鍥炵粨鏋滄椂闂淬�佺粨鏋滃唴瀹� * 杩斿洖鍥炶皟鍐呭 + * ***************************** 铏氭嫙鍗′娇鐢ㄧ姸鎬佷笉渚濊禆寮�鍏抽榾鎰忔効锛屼緷璧栧紑鍏抽榾鎴愬姛涓庡惁 */ - if (comType != null) { - SeVirtualCard virtualCard = new SeVirtualCard(); - virtualCard.setId(vcId); - if (comType == 1) { - virtualCard.setInUse((byte) 1); - } else { - virtualCard.setInUse((byte) 0); - } - virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode()); - virtualCard.setLastOperateTime(new Date()); - seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard); - } + //if (comType != null) { + // SeVirtualCard virtualCard = new SeVirtualCard(); + // virtualCard.setId(vcId); + // if (comType == 1) { + // virtualCard.setInUse((byte) 1); + // } else { + // virtualCard.setInUse((byte) 0); + // } + // virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode()); + // virtualCard.setLastOperateTime(new Date()); + // seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard); + //} // 濡傛灉鏄紑鍙戝懡浠わ紙92-骞冲彴寮�闃�锛�91-灏忕▼搴忓紑闃�锛夛紝杩斿洖缁撴灉涓坊鍔犻榾鎺у櫒鍦板潃銆佽櫄鎷熷崱缂栧彿銆佽鍗曞彿 - if(commandCode.equals("92") || commandCode.equals("97")) { + //if(commandCode.equals("92") || commandCode.equals("97")) { + if(commandCode.equals(CodeV1.cd_92) || commandCode.equals(CodeV1.cd_97) + || commandCode.equals(CodeV1.cd_99) || commandCode.equals(CodeV1.cd_A0) + || commandCode.equals(CodeV1.cd_A1) || commandCode.equals(CodeV1.cd_A2)) { JSONObject job_response = (JSONObject) JSON.toJSON(response_CallBack); JSONObject job_param = (JSONObject) JSON.toJSON(param); JSONObject job_data = job_response.getJSONObject("content").getJSONObject("data"); if(!job_data.getBoolean("success")) { - // 寮�鍏抽榾澶辫触 + // 寮�鍏抽榾澶辫触锛屾洿鏂板懡浠ゆ墽琛岀姸鎬佸強铏氭嫙鍗$姸鎬� + + rmCommandHistory = new RmCommandHistory(); + rmCommandHistory.setComId(comId); + rmCommandHistory.setResult((byte) 0); + rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory); + + // 寮�闃�澶辫触鍒欒В闄ゅ崰鐢紝鍏抽榾澶辫触鍒欏崰鐢� + if (comType != null) { + SeVirtualCard virtualCard = new SeVirtualCard(); + virtualCard.setId(vcId); + if (comType == 1) { + virtualCard.setInUse((byte) 0); + virtualCard.setIntakeId(null); + virtualCard.setOpenTime(null); + } else { + virtualCard.setInUse((byte) 1); + virtualCard.setIntakeId(intakeId); + } + virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode()); + virtualCard.setLastOperateTime(new Date()); + seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard); + } + response_CallBack.setCode("10003"); response_CallBack.setMsg(CommandResultCode.OPEN_CLOSE_FAIL.getMessage()); response_CallBack.setSuccess(false); }else { - // 寮�鍏抽榾鎴愬姛 + // 寮�鍏抽榾鎴愬姛锛屾洿鏂板懡浠ゆ墽琛岀姸鎬佸強铏氭嫙鍗$姸鎬� + + rmCommandHistory = new RmCommandHistory(); + rmCommandHistory.setComId(comId); + rmCommandHistory.setResult((byte) 1); + rmCommandHistoryMapper.updateByPrimaryKeySelective(rmCommandHistory); + + // 寮�闃�鎴愬姛鍒欏崰鐢紝鍏抽榾鎴愬姛涓嶅崰鐢� + if (comType != null) { + SeVirtualCard virtualCard = new SeVirtualCard(); + virtualCard.setId(vcId); + if (comType == 1) { + virtualCard.setInUse((byte) 1); + virtualCard.setIntakeId(intakeId); + + // 濡傛灉鏄鍒掑紑闃�锛屼粠鍛戒护鏃ュ織涓幏鍙栬鍒掓椂闂达紝鍚﹀垯鍙栧綋鍓嶆椂闂� + if(commandCode.equals(CodeV1.cd_A1) || commandCode.equals(CodeV1.cd_A2)) { + // 璁″垝寮�闃� + Date openTime = null; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + try { + openTime = sdf.parse(rmCommandHistoryMapper.getTimeByCommId(comId)); + }catch (ParseException e) { + } + virtualCard.setOpenTime(openTime); + }else { + // 闈炶鍒掑紑闃� + virtualCard.setOpenTime(new Date()); + } + } else { + virtualCard.setInUse((byte) 0); + virtualCard.setIntakeId(null); + } + virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode()); + virtualCard.setLastOperateTime(new Date()); + seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard); + } + job_data.remove("success"); job_data.put("intakeId", intakeId); job_data.put("rtuAddr", rtuAddr); -- Gitblit v1.8.0