| | |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.support.Kv; |
| | | import org.springblade.core.tool.utils.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.DigestUtils; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | import static com.vci.ubcs.common.constant.CommonConstant.DEFAULT_PARAM_PASSWORD; |
| | | |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean submit(User user) { |
| | | if (StringUtil.isBlank(user.getTenantId())) { |
| | | // user.setTenantId(BladeConstant.ADMIN_TENANT_ID); |
| | | // user.setTenantId(nacosConfigCache.getAdminUserInfo().getTenantId()); |
| | | // 默认设置为管理组下的用户 |
| | | user.setTenantId(nacosConfigCache.getAdminUserInfo().getTenantId()); |
| | | } |
| | |
| | | Boolean flag = true; |
| | | for (User user : users){ |
| | | if (StringUtil.isBlank(user.getTenantId())) { |
| | | user.setTenantId(BladeConstant.ADMIN_TENANT_ID); |
| | | user.setTenantId(nacosConfigCache.getAdminUserInfo().getTenantId()); |
| | | } |
| | | String tenantId = user.getTenantId(); |
| | | if (Func.isNotEmpty(user.getPassword())) { |
| | |
| | | @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(BladeConstant.ADMIN_TENANT_ID) ? StringPool.EMPTY : AuthUtil.getTenantId())); |
| | | List<User> users = baseMapper.selectUserPage(user, deptIdList, (AuthUtil.getTenantId().equals(nacosConfigCache.getAdminUserInfo().getTenantId()) ? StringPool.EMPTY : AuthUtil.getTenantId())); |
| | | return users; |
| | | } |
| | | |
| | |
| | | pwdupdateday = dateToDay(pwdUpdateTime); |
| | | } |
| | | Strategy strategy = sysClient.getByUserId(userId).getData(); |
| | | if(Func.isNotEmpty(strategy)){ |
| | | throw new ServiceException("密码策略查询为空,请检查当前租户下是否存在默认密码策略!"); |
| | | } |
| | | //是否提醒通过最后一次修改密码的时间加上过期时间减去当前时间,如果小于过期提醒时间就进行提醒,如果<=0就提醒必须修改密码 |
| | | long reminder = pwdupdateday+strategy.getExpirationTime()-dateToDay(new Date()); |
| | | //提醒用户必须修改密码 |
| | |
| | | return list.stream().distinct().collect(Collectors.toList()); |
| | | } |
| | | |
| | | /*** |
| | | * 更新用户启用停用状态 |
| | | * @param userIds |
| | | * @param status |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean updateUserStatus(String userIds, boolean status) { |
| | | Integer userStatus = 0; |
| | | if(!status){ |
| | | userStatus = 1; |
| | | } |
| | | return this.update(Wrappers.<User>lambdaUpdate().in(User::getId, Func.toLongList(userIds)).set(User::getUserStatus,userStatus)); |
| | | } |
| | | |
| | | /** |
| | | * 日期时间格式转天 |
| | | * @param date |