|  |  |  | 
|---|
|  |  |  | 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.service.business.third.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.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; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private RedisTemplate<String,Object> redisTemplate; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private JwtProperties jwtProperties; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemUserService systemUserService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private JwtProperties jwtProperties; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemUserRoleService systemUserRoleService; | 
|---|
|  |  |  | 
|---|
|  |  |  | updateUserDto.setId(dto.getId()); | 
|---|
|  |  |  | updateUserDto.setUpdateUser(dto.getOperaUserId()); | 
|---|
|  |  |  | updateUserDto.setPassword(Utils.Secure.encryptPassword(dto.getPassword(), systemUser.getSalt())); | 
|---|
|  |  |  | updateUserDto.setNeedChangePwd(Constants.ZERO); | 
|---|
|  |  |  | updateUserDto.setNeedChangePwd(dto.getNeedChangePwd()); | 
|---|
|  |  |  | systemUserService.updateById(updateUserDto); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | user = systemUserService.findOne(queryUserDto); | 
|---|
|  |  |  | if (user != null) { | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "工号【"+systemUser.getEmpNo()+"】已存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //验证手机号 | 
|---|
|  |  |  | if (StringUtils.isNotBlank(systemUser.getMobile())) { | 
|---|
|  |  |  | queryUserDto = new SystemUser(); | 
|---|
|  |  |  | queryUserDto.setDeleted(Boolean.FALSE); | 
|---|
|  |  |  | queryUserDto.setMobile(systemUser.getMobile()); | 
|---|
|  |  |  | user = systemUserService.findOne(queryUserDto); | 
|---|
|  |  |  | if (user != null) { | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "手机号【"+systemUser.getMobile()+"】已存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 生成密码盐 | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "工号【"+systemUser.getEmpNo()+"】已存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //验证手机号 | 
|---|
|  |  |  | if (StringUtils.isNotBlank(systemUser.getMobile())) { | 
|---|
|  |  |  | queryUserDto = new SystemUser(); | 
|---|
|  |  |  | queryUserDto.setMobile(systemUser.getMobile()); | 
|---|
|  |  |  | queryUserDto.setDeleted(Boolean.FALSE); | 
|---|
|  |  |  | user = systemUserService.findOne(queryUserDto); | 
|---|
|  |  |  | if (user != null && !user.getId().equals(systemUser.getId())) { | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "手机号【"+systemUser.getMobile()+"】已存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 修改用户 | 
|---|
|  |  |  | systemUserService.updateById(systemUser); | 
|---|
|  |  |  | // 设置部门 | 
|---|