From 8c1f294b7ba20b05753ad274dcb5530a389ea78d Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期五, 29 十一月 2024 14:28:37 +0800 Subject: [PATCH] RTU升级结果判断并数据库存逻辑bug修改 --- pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerCtrl.java | 43 ++++++++++++++++++++++++++++++------------- 1 files changed, 30 insertions(+), 13 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerCtrl.java index 8bc4a6b..32201f0 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerCtrl.java @@ -1,7 +1,6 @@ package com.dy.pipIrrProject.intakeController; -import cn.hutool.core.date.DateTime; import com.dy.common.aop.SsoAop; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; @@ -103,6 +102,7 @@ prController.setIntakeId(intakeId); prController.setRtuAddr(prControllerTramp.getRtuAddr()); prController.setProtocol(prControllerTramp.getProtocol()); + prController.setProtocolVersion(prControllerTramp.getProtocolVersion()); prController.setFindDt(prControllerTramp.getFindDt()); prController.setOrgTag(prControllerTramp.getOrgTag()); prController.setAddWays((byte) 1); @@ -284,16 +284,15 @@ @GetMapping(path = "/getTrampControllers") @SsoAop() public BaseResponse<QueryResultVo<List<PrControllerTramp>>> getTrampControllers(TrampControllerQueryVo vo) { - try { - QueryResultVo<List<PrControllerTramp>> res = intakeControllerSv.getTrampControllers(vo); - if (res.itemTotal != null && res.itemTotal > 0) { - return BaseResponseUtils.buildSuccess(res); - } else { - //璇锋眰鎴愬姛浣嗘暟鎹负绌� - return BaseResponseUtils.buildSuccess(res); - } - //return BaseResponseUtils.buildSuccess(res); + //QueryResultVo<List<PrControllerTramp>> res = intakeControllerSv.getTrampControllers(vo); + //if (res.itemTotal != null && res.itemTotal > 0) { + // return BaseResponseUtils.buildSuccess(res); + //} else { + // //璇锋眰鎴愬姛浣嗘暟鎹负绌� + // return BaseResponseUtils.buildSuccess(res); + //} + return BaseResponseUtils.buildSuccess(intakeControllerSv.getTrampControllers(vo)); } catch (Exception e) { log.error("鑾峰彇娴佹氮鎺у埗鍣ㄨ褰曞紓甯�", e); return BaseResponseUtils.buildException(e.getMessage()); @@ -313,7 +312,7 @@ pct.setFindDt(new Date()); Integer rows = intakeControllerSv.addTrampController(pct); if (rows == 0) { - return BaseResponseUtils.buildFail(ProjectResultCode.ADD_TRAMP_CONTROLLER_FAIL.getMessage()); + return BaseResponseUtils.buildErrorMsg(ProjectResultCode.ADD_TRAMP_CONTROLLER_FAIL.getMessage()); } return BaseResponseUtils.buildSuccess(true); } @@ -330,12 +329,30 @@ public BaseResponse<Boolean> deleteTrampController(Long id) { PrControllerTramp controllerInfo = intakeControllerSv.getTrampControllerInfo(id); if (controllerInfo == null) { - return BaseResponseUtils.buildFail(ProjectResultCode.NO_EXIST_TRAMP_CONTROLLER.getMessage()); + return BaseResponseUtils.buildErrorMsg(ProjectResultCode.NO_EXIST_TRAMP_CONTROLLER.getMessage()); } Integer rows = intakeControllerSv.deleteTrampController(id); if (rows == 0) { - return BaseResponseUtils.buildFail(ProjectResultCode.DELETE_TRAMP_CONTROLLER_FAIL.getMessage()); + return BaseResponseUtils.buildErrorMsg(ProjectResultCode.DELETE_TRAMP_CONTROLLER_FAIL.getMessage()); + } + return BaseResponseUtils.buildSuccess(true); + } + + /** + * 娓呯┖娴佹氮鎺у埗鍣� + * + * @param + * @return + */ + @PostMapping("emptyTrampController") + @Transactional(rollbackFor = Exception.class) + @SsoAop() + public BaseResponse<Boolean> emptyTrampController() { + + Integer rows = intakeControllerSv.emptyTrampController(); + if (rows == 0) { + return BaseResponseUtils.buildErrorMsg(ProjectResultCode.DELETE_TRAMP_CONTROLLER_FAIL.getMessage()); } return BaseResponseUtils.buildSuccess(true); } -- Gitblit v1.8.0