|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  | 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()); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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))); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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;//默认不禁用 | 
|---|
|  |  |  | 
|---|
|  |  |  | } 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); | 
|---|
|  |  |  | 
|---|
|  |  |  | po.supperAdmin = null;//设置为null,不做更新 | 
|---|
|  |  |  | po.deleted = null;//设置为null,不做更新 | 
|---|
|  |  |  | po.orgTag = null;//设置为null,不做更新 | 
|---|
|  |  |  | po.password =  MD5.encrypt(po.password);//进行加密 | 
|---|
|  |  |  | count = this.sv.update(po); | 
|---|
|  |  |  | this.sv.setRoles(po.id, po.roleIds); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | 
|---|
|  |  |  | 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) { | 
|---|
|  |  |  | 
|---|
|  |  |  | 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) { | 
|---|
|  |  |  | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (count <= 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail("数据库存储失败"); | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(SystemResultCode.USER_NOT_EXIST.getMessage()); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(true); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @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) { | 
|---|