From eaca1716355faff23f8b913828e6e778f81a549f Mon Sep 17 00:00:00 2001 From: Administrator <zhubaomin> Date: 星期三, 26 六月 2024 15:22:04 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/user/UserCtrl.java | 43 +++++++++++++++++++++++++++++-------------- 1 files changed, 29 insertions(+), 14 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 1d7f0ab..2ac39f3 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 @@ -9,6 +9,7 @@ import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; import com.dy.common.webUtil.ResultCodeMsg; +import com.dy.pipIrrBase.result.SystemResultCode; import com.dy.pipIrrGlobal.pojoBa.BaUser; import com.dy.pipIrrGlobal.util.Constant; import com.dy.pipIrrGlobal.voBa.VoUserInfo; @@ -87,12 +88,19 @@ schema = @Schema(implementation = BaUser.class))} ) }) - @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) + @GetMapping(path = "some") + //@PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) @SsoAop() - public BaseResponse<QueryResultVo<List<BaUser>>> some(@RequestBody @Valid QueryVo vo) { + public BaseResponse<QueryResultVo<List<VoUserInfo>>> some(QueryVo vo) { try { - QueryResultVo<List<BaUser>> res = this.sv.selectSome(vo); - return BaseResponseUtils.buildSuccess(res); + QueryResultVo<List<VoUserInfo>> res = this.sv.selectSome(vo); + if(res.itemTotal == 0) { + return BaseResponseUtils.buildFail(SystemResultCode.THE_USER_NOT_EXIST.getMessage()); + }else { + return BaseResponseUtils.buildSuccess(res); + } + + } catch (Exception e) { log.error("鏌ヨ鐢ㄦ埛寮傚父", e); return BaseResponseUtils.buildException(e.getMessage()); @@ -113,7 +121,8 @@ schema = @Schema(implementation = BaUser.class))} ) }) - @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) + //@GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) + @GetMapping(path = "one") @SsoAop() public BaseResponse<BaUser> one(String id) { return BaseResponseUtils.buildSuccess(this.sv.selectById(Long.parseLong(id))); @@ -141,7 +150,7 @@ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } po.id = null; - int count; + Long userId; try { po.supperAdmin = Constant.no.byteValue() ; po.disabled = Disabled.NO;//榛樿涓嶇鐢� @@ -156,13 +165,13 @@ } else { po.password = MD5.encrypt(defaultPassword); } - count = this.sv.save(po); - this.sv.setRoles(po.id, po.roleIds); + userId = this.sv.save(po); + this.sv.setRoles(userId, po.roleIds); } catch (Exception e) { log.error("淇濆瓨鐢ㄦ埛寮傚父", e); return BaseResponseUtils.buildException(e.getMessage()); } - if (count <= 0) { + if (userId <= 0) { return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); } else { return BaseResponseUtils.buildSuccess(true); @@ -198,6 +207,7 @@ po.supperAdmin = null;//璁剧疆涓簄ull锛屼笉鍋氭洿鏂� po.deleted = null;//璁剧疆涓簄ull锛屼笉鍋氭洿鏂� po.orgTag = null;//璁剧疆涓簄ull锛屼笉鍋氭洿鏂� + po.password = MD5.encrypt(po.password);//杩涜鍔犲瘑 count = this.sv.update(po); this.sv.setRoles(po.id, po.roleIds); } catch (Exception e) { @@ -227,7 +237,8 @@ schema = @Schema(implementation = Boolean.class))} ) }) - @GetMapping(path = "changePassword", consumes = MediaType.TEXT_PLAIN_VALUE) + //@GetMapping(path = "changePassword", consumes = MediaType.TEXT_PLAIN_VALUE) + @GetMapping(path = "changePassword") @SsoAop() public BaseResponse<Boolean> changePassword(String id, String oldPassword, String newPassword) throws Exception { if (id == null) { @@ -452,7 +463,8 @@ schema = @Schema(implementation = Boolean.class))} ) }) - @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) + //@GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) + @GetMapping(path = "delete") @SsoAop() public BaseResponse<Boolean> delete(String id) { if (id == null) { @@ -466,7 +478,7 @@ return BaseResponseUtils.buildException(e.getMessage()); } if (count <= 0) { - return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + return BaseResponseUtils.buildFail(SystemResultCode.USER_NOT_EXIST.getMessage()); } else { return BaseResponseUtils.buildSuccess(true); } @@ -488,9 +500,12 @@ }) @GetMapping("/getUserInfos/{userId}") @SsoAop() - public BaseResponse<QueryResultVo<List<VoUserInfo>>> getUserInfos(@PathVariable("userId") Long userId) { + public BaseResponse<QueryResultVo<VoUserInfo>> getUserInfos(@PathVariable("userId") Long userId) { try { - List<VoUserInfo> res = this.sv.getUserInfos(userId); + VoUserInfo res = this.sv.getUserInfos(userId); + if(res == null) { + return BaseResponseUtils.buildException(SystemResultCode.THE_USER_NOT_EXIST.getMessage()); + } System.out.println(" :" + res); return BaseResponseUtils.buildSuccess(res); } catch (Exception e) { -- Gitblit v1.8.0