|  |  | 
 |  |  | package com.doumee.biz.system.impl; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSONObject; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
 |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
 |  |  | import com.doumee.biz.system.SystemUserBiz; | 
 |  |  | import com.doumee.config.jwt.JwtProperties; | 
 |  |  | import com.doumee.core.annotation.excel.ExcelImporter; | 
 |  |  | import com.doumee.core.exception.BusinessException; | 
 |  |  | import com.doumee.core.constants.ResponseStatus; | 
 |  |  | 
 |  |  | import com.doumee.dao.system.dto.UpdatePwdDto; | 
 |  |  | import com.doumee.dao.system.model.*; | 
 |  |  | import com.doumee.service.system.*; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.apache.commons.lang3.RandomStringUtils; | 
 |  |  | import org.apache.commons.lang3.StringUtils; | 
 |  |  | import org.apache.shiro.SecurityUtils; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.data.redis.core.RedisTemplate; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  | 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.concurrent.TimeUnit; | 
 |  |  | import java.util.stream.Collectors; | 
 |  |  |  | 
 |  |  | @Service | 
 |  |  | @Slf4j | 
 |  |  | public class SystemUserBizImpl implements SystemUserBiz { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private RedisTemplate<String,Object> redisTemplate; | 
 |  |  |     @Autowired | 
 |  |  |     private JwtProperties jwtProperties; | 
 |  |  |     @Autowired | 
 |  |  |     private SystemUserService systemUserService; | 
 |  |  |  | 
 |  |  | 
 |  |  |         if(StringUtils.isBlank(dto.getNewPwd()) | 
 |  |  |                 ||dto.getNewPwd().length()>20 | 
 |  |  |                 ||dto.getNewPwd().length()<6 | 
 |  |  |                 ||PwdCheckUtil.checkPassword(dto.getNewPwd())){ | 
 |  |  |                 ||!PwdCheckUtil.checkPassword(dto.getNewPwd())){ | 
 |  |  |             throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "对不起,密码复杂度不满足要求:6-20个字符,至少包含字母、数字及特殊字符2种"); | 
 |  |  |         } | 
 |  |  |         SystemUser user = systemUserService.findById(dto.getUserId()); | 
 |  |  | 
 |  |  |         newUser.setPassword(Utils.Secure.encryptPassword(dto.getNewPwd(), user.getSalt())); | 
 |  |  |         newUser.setNeedChangePwd(Constants.ONE); | 
 |  |  |         systemUserService.updateById(newUser); | 
 |  |  |  | 
 |  |  |         log.info("===================更新信息"); | 
 |  |  |         try { | 
 |  |  | //            log.error("redisTemplate:["+redisTemplate+"]\njwtProperties=:["+jwtProperties+"]\n"+"token:["+dto.getToken()+"]\nuser:"+dto.getLoginUserInfo()); | 
 |  |  |             if(redisTemplate!=null&&dto.getToken() !=null &&dto.getLoginUserInfo()!=null && jwtProperties!=null){ | 
 |  |  |                 dto.getLoginUserInfo().setNeedChangePwd(Constants.ONE); | 
 |  |  |                 redisTemplate.opsForValue().set(Constants.REDIS_TOKEN_KEY+dto.getToken(),JSONObject.toJSONString(dto.getLoginUserInfo()),jwtProperties.getExpiration(), TimeUnit.MILLISECONDS); | 
 |  |  |             } | 
 |  |  |         }catch (Exception e){ | 
 |  |  | //            log.error("redisTemplate:["+redisTemplate+"]\njwtProperties=:["+jwtProperties+"]\n"+"token:["+dto.getToken()+"]\nuser:"+dto.getLoginUserInfo()); | 
 |  |  |             e.printStackTrace(); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override |