From 5b8a52d6cef6f6b1032cc576471b505e69304331 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期五, 08 十一月 2024 15:47:38 +0800 Subject: [PATCH] 上传RTU升级文件接收端增加判断重名文件,重名文件不允许上传 --- pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskCtrl.java | 86 ++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 81 insertions(+), 5 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskCtrl.java index 38822a4..59ab39b 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuTaskCtrl.java @@ -25,7 +25,6 @@ import org.springframework.web.bind.annotation.RestController; import java.io.UnsupportedEncodingException; -import java.util.Date; import java.util.List; import java.util.Objects; @@ -137,9 +136,7 @@ } UgRtuTask po = new UgRtuTask(); vo.toPo(po); - po.dt = new Date(); - po.isOver = 0 ; - po.deleted = 0 ; + po.init(); int count; try { count = this.sv.save(po); @@ -192,6 +189,85 @@ /** + * 鎵цRTU鍗囩骇浠诲姟 + * @param id RTU鍗囩骇浠诲姟ID + * @return 鏄惁鎴愬姛 + */ + @Operation(summary = "鎵цRTU鍗囩骇浠诲姟", description = "鎻愪氦RTU鍗囩骇浠诲姟ID锛岃繘琛屾墽琛�") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = Boolean.class))} + ) + }) + @GetMapping(path = "execute") + @SsoAop() + public BaseResponse<Boolean> execute(Long id){ + if(id == null){ + return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖") ; + } + int count; + try { + count = this.sv.isOver(id) ; + if(count > 0){ + return BaseResponseUtils.buildError("浠诲姟宸茬粡缁撴潫锛屼笉鑳藉啀鎵ц") ; + } + count = this.sv.isExecute(id) ; + if(count > 0){ + return BaseResponseUtils.buildError("浠诲姟宸茬粡鎵ц锛屼笉鑳藉啀鎵ц") ; + } + count = this.sv.execute(id); + } catch (Exception e) { + log.error("缁撴潫RTU鍗囩骇浠诲姟寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + if(count <= 0){ + return BaseResponseUtils.buildFail("鏁版嵁搴撴搷浣滃け璐�") ; + }else{ + return BaseResponseUtils.buildSuccess(true) ; + } + } + + /** + * 缁撴潫RTU鍗囩骇浠诲姟 + * @param id RTU鍗囩骇浠诲姟ID + * @return 鏄惁鎴愬姛 + */ + @Operation(summary = "缁撴潫RTU鍗囩骇浠诲姟", description = "鎻愪氦RTU鍗囩骇浠诲姟ID锛岃繘琛岀粨鏉�") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = Boolean.class))} + ) + }) + @GetMapping(path = "over") + @SsoAop() + public BaseResponse<Boolean> over(Long id){ + if(id == null){ + return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖") ; + } + int count; + try {count = this.sv.isOver(id) ; + if(count > 0){ + return BaseResponseUtils.buildError("浠诲姟宸茬粡缁撴潫锛屼笉鐢ㄥ啀缁撴潫") ; + } + count = this.sv.over(id); + } catch (Exception e) { + log.error("缁撴潫RTU鍗囩骇浠诲姟寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + if(count <= 0){ + return BaseResponseUtils.buildFail("鏁版嵁搴撴搷浣滃け璐�") ; + }else{ + return BaseResponseUtils.buildSuccess(true) ; + } + } + + /** * 鍒犻櫎RTU鍗囩骇浠诲姟 * @param id RTU鍗囩骇浠诲姟ID * @return 鏄惁鎴愬姛 @@ -219,7 +295,7 @@ return BaseResponseUtils.buildException(e.getMessage()) ; } if(count <= 0){ - return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ; + return BaseResponseUtils.buildFail("鏁版嵁搴撴搷浣滃け璐�") ; }else{ return BaseResponseUtils.buildSuccess(true) ; } -- Gitblit v1.8.0