| | |
| | | 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; |
| | |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> changePassword(String id, String oldPassword, String newPassword) throws Exception { |
| | | if (id == null) { |
| | | return BaseResponseUtils.buildFail("id不能为空"); |
| | | return BaseResponseUtils.buildErrorMsg("id不能为空"); |
| | | } |
| | | if (StringUtils.isNullOrEmpty(oldPassword)) { |
| | | return BaseResponseUtils.buildFail("旧密码不能为空"); |
| | | return BaseResponseUtils.buildErrorMsg("旧密码不能为空"); |
| | | } |
| | | if (StringUtils.isNullOrEmpty(newPassword)) { |
| | | return BaseResponseUtils.buildFail("新密码不能为空"); |
| | | return BaseResponseUtils.buildErrorMsg("新密码不能为空"); |
| | | } |
| | | /* |
| | | 如果前端进行了base64加密 |
| | |
| | | try { |
| | | BaUser po = this.sv.selectById(idLg); |
| | | if (Objects.isNull(po)) { |
| | | return BaseResponseUtils.buildFail("未得到用户,请求失败"); |
| | | return BaseResponseUtils.buildErrorMsg("未得到用户,请求失败"); |
| | | } else { |
| | | if (!po.password.equalsIgnoreCase(oldPassword)) { |
| | | return BaseResponseUtils.buildFail("旧密码不正确,请求失败"); |
| | | return BaseResponseUtils.buildErrorMsg("旧密码不正确,请求失败"); |
| | | } else { |
| | | count = this.sv.changePassword(idLg, newPassword); |
| | | } |
| | |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | if (count <= 0) { |
| | | return BaseResponseUtils.buildFail("数据库存储失败"); |
| | | return BaseResponseUtils.buildErrorMsg("数据库存储失败"); |
| | | } else { |
| | | return BaseResponseUtils.buildSuccess(true); |
| | | } |
| | |
| | | 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()); |
| | | } |
| | | } |
| | | } |