|
|
@@ -6,6 +6,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.nb.app.doctor.controller.vo.DoctorUserVo;
|
|
|
import com.nb.app.doctor.api.entity.AppDoctorUserEntity;
|
|
|
@@ -17,6 +18,8 @@ import com.nb.auth.controller.vo.UserInfoVO;
|
|
|
import com.nb.auth.enums.GrantTypeEnum;
|
|
|
import com.nb.auth.granter.IAccountOperator;
|
|
|
import com.nb.auth.utils.SecurityUtil;
|
|
|
+import com.nb.common.config.annotation.TenantIgnore;
|
|
|
+import com.nb.common.config.context.TenantContextHolder;
|
|
|
import com.nb.core.exception.CustomException;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
@@ -42,9 +45,14 @@ public class AppDoctorUserAccountOperator implements IAccountOperator<DoctorUser
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @TenantIgnore
|
|
|
public UserInfoVO getUserInfo() {
|
|
|
UserInfoVO userInfoVO = new UserInfoVO();
|
|
|
- AppDoctorUserEntity user = doctorUserService.getById(SecurityUtil.getStpLogic().getLoginIdAsString());
|
|
|
+ AppDoctorUserEntity user = doctorUserService.getOne(new LambdaQueryWrapper<AppDoctorUserEntity>()
|
|
|
+ .eq(AppDoctorUserEntity::getUsername, SecurityUtil.getUsername())
|
|
|
+ .eq(AppDoctorUserEntity::getTenantId, SecurityUtil.getTenantId())
|
|
|
+ .last("limit 1")
|
|
|
+ );
|
|
|
if(ObjectUtil.isNull(user)){
|
|
|
StpLogic stpLogic = SecurityUtil.getStpLogic();
|
|
|
stpLogic.logout();
|
|
|
@@ -115,10 +123,14 @@ public class AppDoctorUserAccountOperator implements IAccountOperator<DoctorUser
|
|
|
if (!SecurityUtil.matchesPassword(oldPass, doctorUser.getPassword())) {
|
|
|
throw new CustomException("旧密码不正确");
|
|
|
}
|
|
|
+ String username = SecurityUtil.getUsername();
|
|
|
String encryptPassword = SecurityUtil.encryptPassword(newPass);
|
|
|
- return doctorUserService
|
|
|
+ TenantContextHolder.setIgnore(Boolean.TRUE);
|
|
|
+ doctorUserService
|
|
|
.update(new UpdateWrapper<AppDoctorUserEntity>()
|
|
|
- .lambda().eq(AppDoctorUserEntity::getId,userId)
|
|
|
+ .lambda().eq(AppDoctorUserEntity::getUsername,username)
|
|
|
.set(AppDoctorUserEntity::getPassword,encryptPassword));
|
|
|
+ TenantContextHolder.setIgnore(Boolean.FALSE);
|
|
|
+ return Boolean.TRUE;
|
|
|
}
|
|
|
}
|