|  |  |  | 
|---|
|  |  |  | import com.doumee.core.annotation.excel.ExcelImporter; | 
|---|
|  |  |  | import com.doumee.core.exception.BusinessException; | 
|---|
|  |  |  | import com.doumee.core.constants.ResponseStatus; | 
|---|
|  |  |  | import com.doumee.core.model.LoginUserInfo; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.core.utils.PwdCheckUtil; | 
|---|
|  |  |  | import com.doumee.core.utils.Utils; | 
|---|
|  |  |  | import com.doumee.dao.system.SystemDepartmentUserMapper; | 
|---|
|  |  |  | import com.doumee.core.utils.*; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.LoginUserInfo; | 
|---|
|  |  |  | import com.doumee.dao.system.dto.*; | 
|---|
|  |  |  | import com.doumee.dao.system.dto.UpdatePwdDto; | 
|---|
|  |  |  | import com.doumee.dao.system.model.*; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.util.CollectionUtils; | 
|---|
|  |  |  | import org.springframework.web.multipart.MultipartFile; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | import java.util.Objects; | 
|---|
|  |  |  | import java.util.concurrent.TimeUnit; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | public void updatePwd(UpdatePwdDto dto) { | 
|---|
|  |  |  | //登录密码复杂度校验:6-20个字符,至少包含字母、数字及特殊字符2种 | 
|---|
|  |  |  | if(StringUtils.isBlank(dto.getNewPwd()) | 
|---|
|  |  |  | ||dto.getNewPwd().length()>20 | 
|---|
|  |  |  | ||dto.getNewPwd().length()<6 | 
|---|
|  |  |  | ||!PwdCheckUtil.checkPassword(dto.getNewPwd())){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,密码复杂度不满足要求:6-20个字符,至少包含字母、数字及特殊字符2种"); | 
|---|
|  |  |  | //                ||dto.getNewPwd().length()>20 | 
|---|
|  |  |  | //                ||dto.getNewPwd().length()<8 | 
|---|
|  |  |  | // ||!PwdCheckUtil.checkPassword(dto.getNewPwd()) | 
|---|
|  |  |  | ){ | 
|---|
|  |  |  | //throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,密码复杂度不满足要求:6-20个字符,至少包含字母、数字及特殊字符2种"); | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | PasswordGenerator.getPasswordTypeCount(dto.getNewPwd()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SystemUser user = systemUserService.findById(dto.getUserId()); | 
|---|
|  |  |  | if (user.getDeleted()) { | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "用户不存在或已被删除"); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (systemUser == null || systemUser.getDeleted()) { | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "用户不存在或已被删除"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | PasswordGenerator.getPasswordTypeCount(dto.getPassword()); | 
|---|
|  |  |  | // 修改密码 | 
|---|
|  |  |  | SystemUser updateUserDto = new SystemUser(); | 
|---|
|  |  |  | updateUserDto.setId(dto.getId()); | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "手机号【"+systemUser.getMobile()+"】已存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String password = PasswordGenerator.generatePassword(); | 
|---|
|  |  |  | // 生成密码盐 | 
|---|
|  |  |  | String salt = RandomStringUtils.randomAlphabetic(6); | 
|---|
|  |  |  | // 生成密码 | 
|---|
|  |  |  | systemUser.setPassword(Utils.Secure.encryptPassword(systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.INITIAL_PASSWORD).getCode(), salt)); | 
|---|
|  |  |  | systemUser.setPassword(Utils.Secure.encryptPassword(password, salt)); | 
|---|
|  |  |  | systemUser.setSalt(salt); | 
|---|
|  |  |  | systemUser.setFirstPassword(password); | 
|---|
|  |  |  | systemUser.setSource(Constants.ZERO); | 
|---|
|  |  |  | systemUser.setNeedChangePwd(Constants.ZERO); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | }*/ | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void updUserProhibitStatus(SystemUser user,LoginUserInfo loginUserInfo) { | 
|---|
|  |  |  | if(Objects.isNull(user) | 
|---|
|  |  |  | || Objects.isNull(user.getId()) | 
|---|
|  |  |  | || Objects.isNull(user.getProhibitStatus())){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.BAD_REQUEST); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | SystemUser updUser = new SystemUser(); | 
|---|
|  |  |  | updUser.setId(user.getId()); | 
|---|
|  |  |  | updUser.setProhibitStatus(user.getProhibitStatus()); | 
|---|
|  |  |  | updUser.setProhibitRemark(Constants.equalsInteger(user.getProhibitStatus(),Constants.ZERO)? | 
|---|
|  |  |  | "于"+ DateUtil.getCurrDateTime()+"【"+loginUserInfo.getRealname()+"】操作手动解除禁止登录!": | 
|---|
|  |  |  | "于"+ DateUtil.getCurrDateTime()+"【"+loginUserInfo.getRealname()+"】操作手动开启禁止登录!"); | 
|---|
|  |  |  | systemUserService.updateById(updUser); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Transactional(rollbackFor = {Exception.class,BusinessException.class}) | 
|---|
|  |  |  | public void createUserRole(CreateUserRoleDTO dto) { | 
|---|