From b218f31bb202cffa656fa4ee09bdd8d67f8ed0ef Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期二, 13 五月 2025 17:29:42 +0800 Subject: [PATCH] 1、根据江海调整,功能码92、A2的应答中的日期时间去除; 2、表阀一体机的开关阀上行数据(84、85)处理逻辑进行修改。 --- pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd93/CdCtrl.java | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 151 insertions(+), 0 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd93/CdCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd93/CdCtrl.java new file mode 100644 index 0000000..3c26d0a --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd93/CdCtrl.java @@ -0,0 +1,151 @@ +package com.dy.pipIrrRemote.monitor.p202404V201.cd93; + +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.dy.common.aop.SsoAop; +import com.dy.common.mw.protocol.Command; +import com.dy.common.mw.protocol.p206V202404.upVos.DataCd93_A3Vo; +import com.dy.common.util.Callback; +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.pipIrrGlobal.voRm.VoUnclosedParam; +import com.dy.pipIrrRemote.common.dto.DtoBase; +import com.dy.pipIrrRemote.monitor.common.ComCtrl; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.http.MediaType; +import org.springframework.validation.BindingResult; +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; + +/** + * @Author: liurunyu + * @Date: 2025/5/13 09:38 + * @Description + */ +@Slf4j +@Tag(name = "杩滅▼鍛戒护", description = "骞冲彴杩滅▼鍏抽榾") +@RestController("cd93Ctrl") +@RequestMapping(path = "p202404V201/cd93") +@RequiredArgsConstructor +@Scope("prototype") //鍥犱负鏈夊璞$被灞炴�э紝鎵�浠ラ噰鐢ㄥ師鍨嬫ā寮忥紝姣忔璇锋眰鏂板缓涓�涓疄渚嬪璞� +public class CdCtrl extends ComCtrl { + + private static final String RtuSuccessMsg = "鎺у埗鍣ㄦ帴鏀跺苟鎵ц鍛戒护鎴愬姛锛屾棤杩斿洖鏁版嵁"; + + private static final String ComCode = "93" ; + + @Autowired + private CdSv sv ; + /** + * 鍚戣澶囷紙鎺у埗鍣級鍙戦�佸懡浠� + * @param dto 鍓嶇鍙戞潵鐨勫�煎璞� + * @param bindingResult 瀵筪to楠岃瘉鐨勭粨鏋� + * @return 杩斿洖鍓嶇 + */ + @PostMapping(path = "send", consumes = MediaType.APPLICATION_JSON_VALUE) + @SsoAop() + public BaseResponse<Object> send(@RequestBody @Valid CdDto dto, BindingResult bindingResult) { + BaseResponse<Object> res ; + //鍙戦�佸懡浠ゅ墠-1锛氶獙璇� + res = super.pre1(sv, ComCode, dto, bindingResult); + if(res == null) { + //鍙戦�佸懡浠ゅ墠-2锛氳幏寰楁暟鎹� + res = super.pre2(sv, ComCode, dto, bindingResult); + if (res == null) { + //鑾峰彇寮�闃�鍛戒护鍙傛暟 + VoUnclosedParam opPa = sv.selectUncloseParam(dto.getIntakeId(), ctrlPo.getRtuAddr()); + if(opPa == null) { + return BaseResponseUtils.buildFail("璇ュ彇姘村彛涓婃棤鎮ㄦ渶杩戠殑寮�闃�鎿嶄綔"); + } + Long vcId = sv.getVcIdByNum(opPa.getVcNum()) ; + if(vcId == null) { + return BaseResponseUtils.buildFail("鏈嶅姟绔嚭閿欙紝鏈緱鍒拌櫄鎷熷崱ID"); + } + //鍙戦�佸懡浠ゅ墠-3锛氫繚瀛樺懡浠ゆ棩蹇� + CdParam comParam = CdParam.builder().commandCode(ComCode).projectNo(projectNo).controllerType(controllerType) + .icCardNo(opPa.getVcNum())//鐢ㄦ埛鍗″簭鍒楀彿锛�17浣嶆暟瀛楋級锛�6瀛楄妭BCD锛�2瀛楄妭HEX锛� + .orderNo(opPa.getOrderNo())//璁㈠崟鍙凤紙16浣嶆暟瀛楋級 + .build(); + res = super.pre3(sv, dto.getIntakeId(), dto.getOperator(), ComCode, comParam); + if (res == null) { + //鍙戦�佸懡浠ゅ墠-4锛氬噯澶嘑eature + super.pre4(); + try { + //鍒涘缓澶栭儴鍛戒护锛堝彂缁欐帶鍒跺櫒锛� + Command com = sv.createOuterCommand(ctrlPo.getRtuAddr(), "" + comId, ComCode); + com.rtuResultSendWebUrl = rtuResultSendWebUrl; + com.param = comParam; + //鍙戦�佸懡浠� + res = super.doSend(sv, com); + if (res == null) { + //鍙戦�佸懡浠ゅ悗 + res = super.after(ComCode, new Callback() { + @Override + public void call(Object obj) { + Boolean success = (Boolean) obj; + if(success){ + //鍏抽榾鎴愬姛锛岃В闄よ櫄鎷熷崱琚崰鐢� + sv.setVcNoUsed(vcId); + } + } + @Override + public void call(Object... objs) { + } + @Override + public void exception(Exception e) { + } + }); + } + } catch (Exception e) { + res = BaseResponseUtils.buildFail("鏈嶅姟绔瀯閫犲苟鍚戦�氫俊涓棿浠跺彂閫佽姹傛椂寮傚父" + (e.getMessage() == null ? "" : e.getMessage())); + } finally { + //鏈�缁� + super.end(); + } + } + } + } + return res ; + } + + @Override + protected String checkDto(DtoBase dto) { + return null; + } + + @Override + protected String dealComResult(String code, JSONObject resultData, Callback callback){ + String msg; + if(resultData != null){ + JSONObject codeData = resultData.getJSONObject("data") ; + if(codeData == null){ + msg = RtuSuccessMsg ; + }else { + String json = codeData.toJSONString(); + DataCd93_A3Vo cvo = JSON.parseObject(json, DataCd93_A3Vo.class) ; + if(cvo != null){ + if(callback != null){ + if(cvo.clResult != null && cvo.clResult == 0){ + callback.call(true);//鍏抽榾鎴愬姛 + }else{ + callback.call(false);//鍏抽榾澶辫触 + } + } + msg = cvo.toStr(false) ; + }else{ + msg = RtuSuccessMsg ; + } + } + }else{ + msg = RtuSuccessMsg ; + } + return msg; + } +} -- Gitblit v1.8.0