ludc
2023-10-31 885d8364166b6e952e0af2eb4cf4e44c59544b96
Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java
@@ -22,6 +22,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.vci.ubcs.starter.web.util.VciBaseUtil;
import com.vci.ubcs.system.cache.DictCache;
import com.vci.ubcs.system.cache.NacosConfigCache;
import com.vci.ubcs.system.cache.ParamCache;
@@ -77,16 +78,13 @@
   private final IUserOauthService userOauthService;
   private final ISysClient sysClient;
   private final BladeTenantProperties tenantProperties;
   //拿到配置的超管
   private final NacosConfigCache nacosConfigCache;
   @Override
   @Transactional(rollbackFor = Exception.class)
   public boolean submit(User user) {
      if (StringUtil.isBlank(user.getTenantId())) {
         // user.setTenantId(nacosConfigCache.getAdminUserInfo().getTenantId());
         // 默认设置为管理组下的用户
         user.setTenantId(nacosConfigCache.getAdminUserInfo().getTenantId());
         user.setTenantId(NacosConfigCache.getAdminUserInfo().getTenantId());
      }
      String tenantId = user.getTenantId();
      //Tenant tenant = SysCache.getTenant(tenantId);
@@ -106,7 +104,7 @@
      Boolean flag = true;
      for (User user : users){
         if (StringUtil.isBlank(user.getTenantId())) {
            user.setTenantId(nacosConfigCache.getAdminUserInfo().getTenantId());
            user.setTenantId(NacosConfigCache.getAdminUserInfo().getTenantId());
         }
         String tenantId = user.getTenantId();
         if (Func.isNotEmpty(user.getPassword())) {
@@ -166,7 +164,7 @@
   @Override
   public List<User> selectAllUser(User user, Long deptId){
      List<Long> deptIdList = SysCache.getDeptChildIds(deptId);
      List<User> users = baseMapper.selectUserPage(user, deptIdList, (AuthUtil.getTenantId().equals(nacosConfigCache.getAdminUserInfo().getTenantId()) ? StringPool.EMPTY : AuthUtil.getTenantId()));
      List<User> users = baseMapper.selectUserPage(user, deptIdList, (VciBaseUtil.checkAdminTenant() ? StringPool.EMPTY : AuthUtil.getTenantId()));
      return users;
   }
@@ -514,7 +512,7 @@
   @Override
   public Long checkRenAndExpr(Long userId) {
      //超级管理员直接返回不需要提醒密码修改
      if(nacosConfigCache.getAdminUserInfo().getUserId().equals(userId)){
      if(NacosConfigCache.getAdminUserInfo().getUserId().equals(userId)){
         return 0L;
      }
      QueryWrapper<User> wrapper = Wrappers.<User>query().eq("ID", userId);
@@ -526,7 +524,7 @@
         pwdupdateday = dateToDay(pwdUpdateTime);
      }
      Strategy strategy = sysClient.getByUserId(userId).getData();
      if(Func.isNotEmpty(strategy)){
      if(Func.isEmpty(strategy)){
         throw new ServiceException("密码策略查询为空,请检查当前租户下是否存在默认密码策略!");
      }
      //是否提醒通过最后一次修改密码的时间加上过期时间减去当前时间,如果小于过期提醒时间就进行提醒,如果<=0就提醒必须修改密码
@@ -581,11 +579,11 @@
    */
   @Override
   public boolean updateUserStatus(String userIds, boolean status) {
      Integer user_status=0;
      Integer userStatus = 0;
      if(!status){
         user_status=1;
         userStatus = 1;
      }
      return this.update(Wrappers.<User>lambdaUpdate().in(User::getId, Func.toLongList(userIds)).set(User::getUserStatus,user_status));
      return this.update(Wrappers.<User>lambdaUpdate().in(User::getId, Func.toLongList(userIds)).set(User::getUserStatus,userStatus));
   }
   /**