From 7e423ad2b34cee92e08f06514e0bbd718a9707d5 Mon Sep 17 00:00:00 2001 From: Administrator <zhubaomin> Date: 星期四, 06 六月 2024 16:52:45 +0800 Subject: [PATCH] 2024-06-06 朱宝民 优化平台远程开阀回调处理 --- pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java | 121 +++++++++++++++++++++++++++++----------- 1 files changed, 88 insertions(+), 33 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java index f79bf18..86043fe 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java @@ -17,11 +17,13 @@ import com.dy.pipIrrGlobal.command.ComSupport; import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper; import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory; +import com.dy.pipIrrGlobal.pojoSe.SeVirtualCard; import com.dy.pipIrrGlobal.voRm.VoUnclosedValve; import com.dy.pipIrrGlobal.voSe.VoVirtualCard; import com.dy.pipIrrRemote.common.CommandSv; import com.dy.pipIrrRemote.common.dto.ValveClose; import com.dy.pipIrrRemote.common.dto.ValveOpen; +import com.dy.pipIrrRemote.common.enums.LastOperateENUM; import com.dy.pipIrrRemote.result.RemoteResultCode; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; @@ -33,6 +35,7 @@ import org.springframework.web.bind.annotation.*; import java.time.format.DateTimeFormatter; +import java.util.Date; import java.util.List; import java.util.Objects; @@ -90,8 +93,6 @@ if(!setuped) { setUp(); } -// 鍙栨按鍙D鎹㈠彇姘村彛瀵硅薄 -// 濡傛灉鍙栨按鍙d负鎵撳紑鐘舵�侊紝鍒欎笉鍏佽琚紑闃� // 铏氭嫙鍗D鎹㈣櫄鎷熷崱瀵硅薄 VoVirtualCard vc = commandSv.getVcById(vcId); @@ -182,8 +183,15 @@ //seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard); // 鍥炶皟杩斿洖鐨勫唴瀹� - Data myData = (Data)response_CallBack.getContent(); - return BaseResponseUtils.buildSuccess(myData) ; + //Data myData = (Data)response_CallBack.getContent(); + //return BaseResponseUtils.buildSuccess(myData); + + JSONObject job_response = new JSONObject(); + job_response.put("rtuAddr", rtuAddr); + job_response.put("vcNum", vc.getVcNum()); + job_response.put("orderNo", orderNo); + //job_response.put("operator", operator); + return BaseResponseUtils.buildSuccess(job_response); } else { // 璇锋眰澶辫触 JSONObject job_param = response_SendCom.getJSONObject("content").getJSONObject("param"); @@ -217,15 +225,38 @@ // 澶勭悊鍥炶皟 BaseResponse response_CallBack = dealWithCallBack(comId); - //鍥炶皟澶辫触 + //鍥炶皟寮傚父 if(!response_CallBack.getCode().equals("0001")) { // 鍛戒护鏃ュ織鎵ц缁撴灉鏀逛负澶辫触 - //rmCommandHistory = new RmCommandHistory(); - //rmCommandHistory.setId(comId); - //rmCommandHistory.setResult((byte)0); - //commandSv.updateCommandResult(rmCommandHistory); - return BaseResponseUtils.buildFail(response_CallBack.getMsg()); - //return BaseResponseUtils.buildFail(response_CallBack.getContent().toString()); + rmCommandHistory = new RmCommandHistory(); + rmCommandHistory.setId(comId); + rmCommandHistory.setResult((byte)0); + commandSv.updateCommandResult(rmCommandHistory); + return BaseResponseUtils.buildFail(response_CallBack.getContent().toString()); + } + + // 鍥炶皟瓒呮椂 + if(response_CallBack.getContent().toString().equals(RemoteResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage())) { + /** + * 绯婃帀瓒呮椂锛屾殏鏃惰涓烘墽琛屾垚鍔� + * 鏇存敼铏氭嫙鍗$姸鎬侊細鏄惁浣跨敤涓�佹渶鍚庢搷浣溿�佹渶鍚庢搷浣滄椂闂� + * 杩斿洖寮�闃�闇�瑕佺殑鍙傛暟 + */ + SeVirtualCard virtualCard = new SeVirtualCard(); + virtualCard.setId(vcId); + virtualCard.setInUse((byte) 1); + virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode()); + virtualCard.setLastOperateTime(new Date()); + seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard); + + JSONObject job_response = new JSONObject(); + job_response.put("message", RemoteResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage()); + job_response.put("rtuAddr", rtuAddr); + job_response.put("vcNum", vc.getVcNum()); + job_response.put("orderNo", orderNo); + //job_response.put("operator", operator); + return BaseResponseUtils.buildSuccess(job_response); + //return BaseResponseUtils.buildSuccess(RemoteResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage()); } // 鍥炶皟鎴愬姛锛屽啀鍒ゆ柇鎵ц鏄惁鎴愬姛 @@ -242,16 +273,25 @@ * 鎵ц鎴愬姛 * 鏇存敼铏氭嫙鍗$姸鎬侊細鏄惁浣跨敤涓�佹渶鍚庢搷浣溿�佹渶鍚庢搷浣滄椂闂� */ - //SeVirtualCard virtualCard = new SeVirtualCard(); - //virtualCard.setId(vcId); - //virtualCard.setInUse((byte) 1); - //virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode()); - //virtualCard.setLastOperateTime(new Date()); - //seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard); + SeVirtualCard virtualCard = new SeVirtualCard(); + virtualCard.setId(vcId); + virtualCard.setInUse((byte) 1); + virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode()); + virtualCard.setLastOperateTime(new Date()); + seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard); // 鍥炶皟杩斿洖鐨勫唴瀹� - Data myData = (Data)response_CallBack.getContent(); - return BaseResponseUtils.buildSuccess(myData) ; + //Data myData = (Data)response_CallBack.getContent(); + //return BaseResponseUtils.buildSuccess(myData) ; + + JSONObject job_response = new JSONObject(); + job_response.put("message", "ok"); + job_response.put("rtuAddr", rtuAddr); + job_response.put("vcNum", vc.getVcNum()); + job_response.put("orderNo", orderNo); + //job_response.put("operator", operator); + return BaseResponseUtils.buildSuccess(job_response); + } else { // 璇锋眰澶辫触 JSONObject job_param = response_SendCom.getJSONObject("content").getJSONObject("param"); @@ -391,15 +431,30 @@ // 澶勭悊鍥炶皟 BaseResponse response_CallBack = dealWithCallBack(comId); - // 鍥炶皟澶辫触 + // 鍥炶皟寮傚父 if(!response_CallBack.getCode().equals("0001")) { // 鍛戒护鏃ュ織鎵ц缁撴灉鏀逛负澶辫触 - //rmCommandHistory = new RmCommandHistory(); - //rmCommandHistory.setId(comId); - //rmCommandHistory.setResult((byte)0); - //commandSv.updateCommandResult(rmCommandHistory); - return BaseResponseUtils.buildFail(response_CallBack.getMsg()); - //return BaseResponseUtils.buildError(WechatResultCode.GET_RESULT_ERROR.getMessage()); + rmCommandHistory = new RmCommandHistory(); + rmCommandHistory.setId(comId); + rmCommandHistory.setResult((byte)0); + commandSv.updateCommandResult(rmCommandHistory); + return BaseResponseUtils.buildFail(response_CallBack.getContent().toString()); + } + + // 鍥炶皟瓒呮椂 + if(response_CallBack.getContent().toString().equals(RemoteResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage())) { + /** + * 绯婃帀瓒呮椂锛屾殏鏃惰涓烘墽琛屾垚鍔� + * 鏇存敼铏氭嫙鍗$姸鎬侊細鏄惁浣跨敤涓�佹渶鍚庢搷浣溿�佹渶鍚庢搷浣滄椂闂� + */ + Long vcId = seVirtualCardMapper.getVcIdByNum(vcNum); + SeVirtualCard virtualCard = new SeVirtualCard(); + virtualCard.setId(vcId); + virtualCard.setInUse((byte) 0); + virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode()); + virtualCard.setLastOperateTime(new Date()); + seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard); + return BaseResponseUtils.buildSuccess(RemoteResultCode.GET_RESULT_IN_ONE_MINUTE.getMessage()); } // 鍥炶皟鎴愬姛锛屽啀鍒ゆ柇鎵ц鏄惁鎴愬姛 @@ -416,13 +471,13 @@ * 鎵ц鎴愬姛 * 鏇存敼铏氭嫙鍗$姸鎬侊細鏄惁浣跨敤涓�佹渶鍚庢搷浣溿�佹渶鍚庢搷浣滄椂闂� */ - //Long vcId = seVirtualCardMapper.getVcIdByNum(vcNum); - //SeVirtualCard virtualCard = new SeVirtualCard(); - //virtualCard.setId(vcId); - //virtualCard.setInUse((byte) 0); - //virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode()); - //virtualCard.setLastOperateTime(new Date()); - //seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard); + Long vcId = seVirtualCardMapper.getVcIdByNum(vcNum); + SeVirtualCard virtualCard = new SeVirtualCard(); + virtualCard.setId(vcId); + virtualCard.setInUse((byte) 0); + virtualCard.setLastOperate(LastOperateENUM.OPEN_VALVE.getCode()); + virtualCard.setLastOperateTime(new Date()); + seVirtualCardMapper.updateByPrimaryKeySelective(virtualCard); // 鍥炶皟杩斿洖鐨勫唴瀹� Data myData = (Data)response_CallBack.getContent(); -- Gitblit v1.8.0