From 3b668f811fce818ce69ac9bca4195976704dc719 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期一, 18 十二月 2023 15:35:59 +0800 Subject: [PATCH] 1、优化ID生成器,方法同步锁改为静态变量同步锁; 2、RTU模拟器中增加TCP连接输出日志信息; 3、RTU模拟器中增加Rmi相关输出日志信息; --- pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java | 82 ++++++++++++++++++++++++++++++++++++++-- 1 files changed, 77 insertions(+), 5 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java index dec9d8a..a6f3675 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java @@ -10,6 +10,7 @@ import com.dy.common.webUtil.QueryResultVo; import com.dy.common.webUtil.ResultCodeMsg; import com.dy.pipIrrGlobal.pojoBa.BaUser; +import com.dy.pipIrrGlobal.util.Constant; import com.mysql.cj.util.StringUtils; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -38,12 +39,39 @@ private UserSv sv; + @Value("${user.defaultTrueRandomFalsePassword:true}") + private Boolean defaultTrueRandomFalsePassword; + @Value("${user.defaultPassword:ABC123}") private String defaultPassword; @Autowired private void setSv(UserSv sv) { this.sv = sv; + } + + + /** + * 瀹㈡埛绔姹傚緱鍒伴粯璁ゅ瘑鐮� + * @return 榛樿瀵嗙爜 + */ + @Operation(summary = "鑾峰緱榛樿瀵嗙爜", description = "鑾峰緱榛樿瀵嗙爜") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "杩斿洖榛樿瀵嗙爜锛圔aseResponse.content:password锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = String.class))} + ) + }) + @GetMapping(path = "defaultPassword") + public BaseResponse<String> defaultPassword(){ + if(defaultTrueRandomFalsePassword){ + return BaseResponseUtils.buildSuccess(defaultPassword) ; + }else{ + String password = this.sv.getStringRandom(6) ; + return BaseResponseUtils.buildSuccess(password) ; + } } /** @@ -116,6 +144,7 @@ po.id = null; int count; try { + po.supperAdmin = Constant.no.byteValue() ; po.disabled = Disabled.NO;//榛樿涓嶇鐢� po.deleted = Deleted.NO;//榛樿涓嶅垹闄� po.orgTag = DataSourceContext.get();//鏈烘瀯鏍囩 @@ -167,6 +196,7 @@ } int count; try { + po.supperAdmin = null;//璁剧疆涓簄ull锛屼笉鍋氭洿鏂� po.deleted = null;//璁剧疆涓簄ull锛屼笉鍋氭洿鏂� po.orgTag = null;//璁剧疆涓簄ull锛屼笉鍋氭洿鏂� count = this.sv.update(po); @@ -245,11 +275,52 @@ } /** + * 閲嶇疆瀵嗙爜 + * @param vo form琛ㄥ崟瀵硅薄 + * @return 鏄惁鎴愬姛 + */ + @Operation(summary = "閲嶇疆瀵嗙爜", description = "鎻愪氦鏁版嵁锛坒orm琛ㄥ崟json鏁版嵁锛夛紝杩涜瀵嗙爜閲嶇疆") + @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))} + ) + }) + @PostMapping(path = "resetPassword", consumes = MediaType.APPLICATION_JSON_VALUE) + @SsoAop("-1")//@SsoAop(power = "-1") + public BaseResponse<Boolean> resetPassword(@RequestBody @Parameter(description = "form琛ㄥ崟json鏁版嵁", required = true) ResetPasswordVo vo) throws Exception { + if (vo.id == null) { + return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖"); + } + String password = MD5.encrypt(vo.password);//杩涜鍔犲瘑鐮� + Long idLg = Long.parseLong(vo.id); + int count; + try { + BaUser po = this.sv.selectById(idLg); + if (Objects.isNull(po)) { + return BaseResponseUtils.buildFail("鏈緱鍒扮敤鎴凤紝璇锋眰澶辫触"); + } else { + count = this.sv.changePassword(idLg, password); + } + } catch (Exception e) { + log.error("淇濆瓨鐢ㄦ埛寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); + } + } + + /* * 閲嶇疆瀵嗙爜涓洪粯璁ゅ�� * * @param id 鐢ㄦ埛ID * @return 鏄惁鎴愬姛 - */ + @Operation(summary = "閲嶇疆瀵嗙爜涓洪粯璁ゅ瘑鐮�", description = "鎻愪氦鐢ㄦ埛ID") @ApiResponses(value = { @ApiResponse( @@ -285,13 +356,14 @@ return BaseResponseUtils.buildSuccess(true); } } + */ - /** + /* * 閲嶇疆瀵嗙爜涓洪殢鏈烘暟瀛楀姞瀛楁瘝 * * @param id 鐢ㄦ埛ID * @return 鏄惁鎴愬姛 - */ + @Operation(summary = "閲嶇疆瀵嗙爜涓洪殢鏈烘暟瀛楀姞瀛楁瘝", description = "鎻愪氦鐢ㄦ埛ID") @ApiResponses(value = { @ApiResponse( @@ -328,9 +400,9 @@ return BaseResponseUtils.buildSuccess(randomPassword); } } + */ - - /** + /* * 2023-12-05 鍦� save鍜寀pdate鏂规硶涓繘琛屼簡瑙掕壊璁剧疆鍏宠仈锛屾湰鏂规硶搴熷純 * 璁剧疆鐢ㄦ埛瑙掕壊 * -- Gitblit v1.8.0