| | |
| | | import com.dy.pipIrrBase.result.SystemResultCode; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaUser; |
| | | import com.dy.pipIrrGlobal.util.Constant; |
| | | import com.dy.pipIrrGlobal.voBa.VoSimpleUser; |
| | | import com.dy.pipIrrGlobal.voBa.VoUserInfo; |
| | | import com.mysql.cj.util.StringUtils; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | @Value("${user.defaultTrueRandomFalsePassword:true}") |
| | | private Boolean defaultTrueRandomFalsePassword; |
| | | |
| | | @Value("${user.defaultPassword:ABC123}") |
| | | @Value("${user.defaultPassword:abc_123}") |
| | | private String defaultPassword; |
| | | |
| | | @Autowired |
| | |
| | | public BaseResponse<QueryResultVo<List<VoUserInfo>>> some(QueryVo vo) { |
| | | try { |
| | | QueryResultVo<List<VoUserInfo>> res = this.sv.selectSome(vo); |
| | | if(res.itemTotal == 0) { |
| | | return BaseResponseUtils.buildFail(SystemResultCode.THE_USER_NOT_EXIST.getMessage()); |
| | | }else { |
| | | // if(res.itemTotal == 0) { |
| | | // return BaseResponseUtils.buildSuccess(SystemResultCode.THE_USER_NOT_EXIST.getMessage()); |
| | | // }else { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } |
| | | // } |
| | | |
| | | |
| | | } catch (Exception e) { |
| | |
| | | |
| | | /** |
| | | * 重置密码 |
| | | * @param vo form表单对象 |
| | | * @param |
| | | * @return 是否成功 |
| | | */ |
| | | @Operation(summary = "重置密码", description = "提交数据(form表单json数据),进行密码重置") |
| | |
| | | }) |
| | | @PostMapping(path = "resetPassword", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> resetPassword(@RequestBody ResetPasswordVo vo) throws Exception { |
| | | if (vo.id == null) { |
| | | public BaseResponse<Boolean> resetPassword(@RequestBody ResetPasswordVo vo) throws Exception { |
| | | if (vo.id == null || vo.id == "") { |
| | | 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); |
| | | }else { |
| | | String defaultPassword1 = MD5.encrypt(defaultPassword);//进行加密码 |
| | | count = this.sv.changePassword(idLg, defaultPassword1); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("保存用户异常", e); |
| | |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取简单用户数据列表,数据列表查询条件中使用 |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "simple_users") |
| | | @SsoAop() |
| | | public BaseResponse<List<VoSimpleUser>> getSimpleUsers(){ |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(sv.getSimpleUsers()); |
| | | } catch (Exception e) { |
| | | log.error("查询简单用户信息异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | } |