| | |
| | | } |
| | | |
| | | @Trace(withRequestParameters = false) |
| | | @ApiOperation("ä¿®æ¹æ¯å¦ç¦ç¨ç»å½") |
| | | @PostMapping("/updUserProhibitStatus") |
| | | @CloudRequiredPermission("system:user:update") |
| | | public ApiResponse updUserProhibitStatus(@RequestHeader(Constants.HEADER_USER_TOKEN) String token, @RequestBody SystemUser systemUser) { |
| | | systemUserBiz.updUserProhibitStatus(systemUser,this.getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | |
| | | @Trace(withRequestParameters = false) |
| | | @ApiOperation("ä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("system:user:update") |
| | |
| | | import com.doumee.dao.system.dto.CreateUserRoleDTO; |
| | | import com.doumee.dao.system.dto.ResetSystemUserPwdDTO; |
| | | import com.doumee.dao.system.dto.UpdatePwdDto; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | void updateById(CreateSystemUserDTO systemUser); |
| | | |
| | | void updUserProhibitStatus(SystemUser user, LoginUserInfo loginUserInfo); |
| | | /** |
| | | * åå»ºç¨æ·è§è² |
| | | * @author Eva.Caesar Liu |
| | |
| | | import com.doumee.core.annotation.excel.ExcelImporter; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.utils.*; |
| | | 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.dto.*; |
| | | import com.doumee.dao.system.dto.UpdatePwdDto; |
| | | import com.doumee.dao.system.model.*; |
| | |
| | | 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) { |
| | |
| | | package com.doumee.config.jwt; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.dao.system.model.SystemDictData; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.HttpsUtil; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Component |
| | |
| | | .signWith(SignatureAlgorithm.HS512, jwtProperties.getSecret()) |
| | | .compact(); |
| | | redisTemplate.opsForValue().set(Constants.REDIS_TOKEN_KEY+token,JSONObject.toJSONString(userInfo),jwtProperties.getExpiration(), TimeUnit.MILLISECONDS); |
| | | |
| | | String userTokenJsonStr = (String) redisTemplate.opsForValue().get(Constants.REDIS_USER_KEY+userInfo.getId()); |
| | | if(StringUtils.isEmpty(userTokenJsonStr)){ |
| | | redisTemplate.opsForValue().set(Constants.REDIS_USER_KEY+userInfo.getId(),Constants.REDIS_TOKEN_KEY+token); |
| | | }else{ |
| | | List<String> list = Arrays.asList(userTokenJsonStr.split(",")); |
| | | SystemDictData jointAccount = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.OPEN_JOINT_ACCOUNT); |
| | | //å
³éå
±ç¨è´¦æ· éè¦æ¸
空å
¶ä»tokenä¿¡æ¯ |
| | | if(Objects.nonNull(jointAccount)&&Constants.equalsInteger(Integer.valueOf(jointAccount.getCode()),Constants.ONE)){ |
| | | for (String s:list) { |
| | | redisTemplate.delete(s); |
| | | } |
| | | redisTemplate.delete(Constants.REDIS_USER_KEY+userInfo.getId()); |
| | | redisTemplate.opsForValue().set(Constants.REDIS_USER_KEY+userInfo.getId(),Constants.REDIS_TOKEN_KEY+token); |
| | | }else{ |
| | | Boolean isHave = false; |
| | | for (String s:list) { |
| | | if(s.equals(Constants.REDIS_TOKEN_KEY+token)){ |
| | | isHave = true; |
| | | break; |
| | | } |
| | | } |
| | | if(!isHave){ |
| | | redisTemplate.opsForValue().set(Constants.REDIS_USER_KEY+userInfo.getId(),userTokenJsonStr + "," + Constants.REDIS_TOKEN_KEY+token); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return token; |
| | | } |
| | | |
| | |
| | | |
| | | public class Constants { |
| | | public static final String HEADER_USER_TOKEN = "dm_user_token"; |
| | | public static final String REDIS_USER_KEY = "user_token_list_"; |
| | | public static final String REDIS_TOKEN_KEY = "token_"; |
| | | public static final String REDIS_HK_TOKEN_KEY = "hk_token_"; |
| | | public static final String HK_TOKEN_VALIDITY = "HK_TOKEN_VALIDITY"; |
| | |
| | | public static final String PROHIBIT_TIME = "PROHIBIT_TIME"; |
| | | public static final String ERR_TIMES = "ERR_TIMES"; |
| | | public static final String PROHIBIT_LOGIN_OPEN = "PROHIBIT_LOGIN_OPEN"; |
| | | public static final String OPEN_JOINT_ACCOUNT = "OPEN_JOINT_ACCOUNT"; |
| | | |
| | | |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.core.utils; |
| | | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | |
| | | import java.security.SecureRandom; |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * Created by IntelliJ IDEA. |
| | | * |
| | | * @Author : Rk |
| | | * @create 2025/10/27 16:23 |
| | | */ |
| | | public class PasswordGenerator { |
| | | |
| | | private static final String LOWER = "abcdefghijklmnopqrstuvwxyz"; |
| | | private static final String UPPER = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; |
| | | private static final String DIGITS = "0123456789"; |
| | | private static final String SYMBOLS = "!@#$%^&*()_+-=[]{};':|,.<>/?"; |
| | | private static final String PASSWORD_CHARS = LOWER + UPPER + DIGITS + SYMBOLS; |
| | | private static final int PASSWORD_LENGTH = 8; // ä½ å¯ä»¥æ ¹æ®éè¦è°æ´å¯ç é¿åº¦ |
| | | |
| | | public static void getPasswordTypeCount(String password){ |
| | | Set<Integer> typeCount = new HashSet<>(4); |
| | | for (int i = 0; i < password.length(); i++) { |
| | | String key = password.substring(0,i); |
| | | if(LOWER.indexOf(key)>=Constants.ZERO){ |
| | | typeCount.add(Constants.ZERO); |
| | | }else if(UPPER.indexOf(key)>=Constants.ZERO){ |
| | | typeCount.add(Constants.ONE); |
| | | }else if(DIGITS.indexOf(key)>=Constants.ZERO){ |
| | | typeCount.add(Constants.TWO); |
| | | }else if(SYMBOLS.indexOf(key)>=Constants.ZERO){ |
| | | typeCount.add(Constants.THREE); |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"请使ç¨åæ³çå¯ç å
容"); |
| | | } |
| | | } |
| | | if(typeCount.size()<Constants.THREE||password.length()<8){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"å¯ç è³å°å
æ¬æ°åã大å忝ãå°å忝ãç¹æ®å符ä¸çä¸ç§å符ï¼ä¸è³å°8使°"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public static String generatePassword() { |
| | | SecureRandom random = new SecureRandom(); |
| | | StringBuilder password = new StringBuilder(PASSWORD_LENGTH); |
| | | Set<Character> usedChars = new HashSet<>(); |
| | | |
| | | // while (password.length() < PASSWORD_LENGTH) { |
| | | // int index = random.nextInt(PASSWORD_CHARS.length()); |
| | | // char randomChar = PASSWORD_CHARS.charAt(index); |
| | | // // ç¡®ä¿æ¯ç§ç±»åçå符è³å°åºç°ä¸æ¬¡ |
| | | // if (usedChars.add(randomChar)) { |
| | | // password.append(randomChar); |
| | | // } |
| | | // } |
| | | // 妿éè¦ç¡®ä¿æ¯ç§ç±»åé½è³å°åºç°ä¸æ¬¡ï¼å¯ä»¥æ³¨éæä¸é¢ç循ç¯ï¼ä½¿ç¨ä¸é¢ç代ç ï¼ |
| | | for (int i = 0; i < PASSWORD_LENGTH; i++) { |
| | | int type = random.nextInt(4); // 0=lower, 1=upper, 2=digit, 3=symbol |
| | | String charSet; |
| | | switch (type) { |
| | | case 0: charSet = LOWER; break; |
| | | case 1: charSet = UPPER; break; |
| | | case 2: charSet = DIGITS; break; |
| | | default: charSet = SYMBOLS; break; |
| | | } |
| | | int index = random.nextInt(charSet.length()); |
| | | password.append(charSet.charAt(index)); |
| | | } |
| | | // Shuffle the string to avoid predictable patterns (optional) |
| | | password.toString().chars() |
| | | .mapToObj(c -> (char) c) |
| | | .collect(StringBuilder::new, StringBuilder::append, StringBuilder::append) |
| | | .toString(); // This line is a no-op, but it's here to show the method call for completeness. |
| | | return password.toString(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println("Generated Password: " + generatePassword()); |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "å¯ç é误次æ°", example = "1") |
| | | private Integer errTimes; |
| | | |
| | | @ApiModelProperty(value = "åå§åå¯ç ", example = "1") |
| | | private String firstPassword; |
| | | |
| | | @ApiModelProperty(value = "ç¦æ¢æä½æåæ¥å¿", example = "1") |
| | | private String prohibitRemark; |
| | | |
| | | @ApiModelProperty(value = "0 å¯ç¨ 1 ç¦ç¨") |
| | | private Integer status; |
| | |
| | | package com.doumee.service.system; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import com.doumee.dao.system.dto.QuerySystemUserDTO; |
| | |
| | | */ |
| | | long count(SystemUser systemUser); |
| | | |
| | | void jobForOpenProhibitStatus(); |
| | | |
| | | |
| | | } |
| | |
| | | if(!Constants.equalsInteger(user.getSource(),Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.NO_ALLOW_LOGIN); |
| | | } |
| | | if(StringUtils.isNotBlank( pwd)){ |
| | | String pppp = Utils.Secure.encryptPassword(new String(pwd), user.getSalt()); |
| | | // æ¯è¾å¯ç |
| | | if( !StringUtils.equals(pppp, user.getPassword())){ |
| | | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT); |
| | | } |
| | | } |
| | | this.checkPassword(user,pwd); |
| | | // if(StringUtils.isNotBlank( pwd)){ |
| | | // String pppp = Utils.Secure.encryptPassword(new String(pwd), user.getSalt()); |
| | | // // æ¯è¾å¯ç |
| | | // if( !StringUtils.equals(pppp, user.getPassword())){ |
| | | // throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT); |
| | | // } |
| | | // } |
| | | if(StringUtils.isNotBlank(openid)){ |
| | | dealOpenIdBiz(user,openid); |
| | | } |
| | |
| | | |
| | | |
| | | public void checkPassword(SystemUser user,String pwd){ |
| | | //éªè¯æ¯å¦å·²ç¦æ¢ç»å½ |
| | | this.prohibitLogin(user); |
| | | String pppp = Utils.Secure.encryptPassword(new String(pwd), user.getSalt()); |
| | | // æ¯è¾å¯ç |
| | | if( !StringUtils.equals(pppp, user.getPassword())){ |
| | | //æ¯å¦å¼å¯å¯ç éè¯¯ç¦æ¢ç»å½ï¼0=å¦ï¼1=æ¯ï¼ |
| | | SystemDictData prohibitLoginData = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PROHIBIT_LOGIN_OPEN); |
| | | //å¯ç éè¯¯ç¦æ¢ç»å½éå¶æ¶é´ï¼åéï¼ |
| | | SystemDictData prohibitTimeData = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PROHIBIT_TIME); |
| | | updErrTimes(user,prohibitLoginData,prohibitTimeData); |
| | | if(Objects.nonNull(prohibitLoginData)&&"1".equals(prohibitLoginData.getCode())){ |
| | | SystemDictData prohibitErrTimesData = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.ERR_TIMES); |
| | | if(Objects.nonNull(prohibitErrTimesData)){ |
| | | if(Integer.valueOf(prohibitErrTimesData.getCode()) |
| | | -(Constants.formatIntegerNum(user.getErrTimes())+1) == Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT.getCode(),"è´¦å·å¯ç é误ï¼è´¦æ·å·²éå®ï¼è¯·"+prohibitTimeData.getCode()+"åéåéè¯ï¼"); |
| | | } |
| | | |
| | | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT.getCode(),"è´¦å·å¯ç é误ï¼å©ä½å°è¯æ¬¡æ°"+(Integer.valueOf(prohibitErrTimesData.getCode()) |
| | | -(Constants.formatIntegerNum(user.getErrTimes())+1))+"次ï¼è¶
åºé误次æ°å°éå®è´¦å·"); |
| | | } |
| | | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT); |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT); |
| | | } |
| | | }else{ |
| | | systemUserMapper.update(null,new UpdateWrapper<SystemUser>().lambda() |
| | | .set(SystemUser::getProhibitStatus,Constants.ZERO) |
| | | .set(SystemUser::getErrTimes,Constants.ZERO) |
| | | .setSql(" PROHIBIT_TIME = null ") |
| | | .eq(SystemUser::getId,user.getId()) |
| | | ); |
| | | } |
| | | |
| | | } |
| | | |
| | | public void updErrTimes(SystemUser systemUser){ |
| | | public void updErrTimes(SystemUser systemUser,SystemDictData prohibitLoginData,SystemDictData prohibitTimeData){ |
| | | //æå¤§éè¯¯æ¬¡æ° è¿è¡ç»å½éå¶ |
| | | SystemDictData prohibitErrTimesData = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.ERR_TIMES); |
| | | //æ¯å¦å¼å¯å¯ç éè¯¯ç¦æ¢ç»å½ï¼0=å¦ï¼1=æ¯ï¼ |
| | | SystemDictData prohibitLoginData = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PROHIBIT_LOGIN_OPEN); |
| | | //å¯ç éè¯¯ç¦æ¢ç»å½éå¶æ¶é´ï¼åéï¼ |
| | | SystemDictData prohibitTimeData = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PROHIBIT_TIME); |
| | | if(Objects.isNull(prohibitTimeData)||Objects.isNull(prohibitLoginData)||Objects.isNull(prohibitTimeData)){ |
| | | return; |
| | | } |
| | | systemUserMapper.update(null,new UpdateWrapper<SystemUser>().lambda() |
| | | .setSql( " PROHIBIT_STATUS = CASE WHEN "+prohibitLoginData+" = 1 and ( IFNULL(ERR_TIMES,0) + 1 ) > "+prohibitErrTimesData.getCode()+" then 1 else 0 end ") |
| | | .setSql(" PROHIBIT_TIME = CASE WHEN PROHIBIT_STATUS = 1 then DATE_ADD(NOW(), INTERVAL "+prohibitTimeData.getCode()+" MINUTE) else null end , ") |
| | | .setSql( " PROHIBIT_STATUS = CASE WHEN "+prohibitLoginData.getCode()+" = 1 and ( IFNULL(ERR_TIMES,0) + 1 ) >= "+prohibitErrTimesData.getCode()+" then 1 else 0 end ") |
| | | .setSql(" PROHIBIT_TIME = CASE WHEN PROHIBIT_STATUS = 1 then DATE_ADD(NOW(), INTERVAL "+prohibitTimeData.getCode()+" MINUTE) else null end ") |
| | | .setSql(" ERR_TIMES = (ifnull(ERR_TIMES,0) + 1) ") |
| | | .setSql(" PROHIBIT_REMARK = 'äº"+DateUtil.getCurrDateTime()+"ç»å½å¯ç é误次æ°è¿å¤ï¼ç¦æ¢ç»å½ï¼' ") |
| | | .eq(SystemUser::getId,systemUser.getId()) |
| | | ); |
| | | } |
| | | |
| | | public void prohibitLogin(SystemUser systemUser){ |
| | | if(Constants.equalsInteger(systemUser.getProhibitStatus(),Constants.ZERO)){ |
| | | Long betweenMin = DateUtil.getBetweenMin(systemUser.getProhibitTime(),new Date()); |
| | | if(Constants.equalsInteger(systemUser.getProhibitStatus(),Constants.ONE)){ |
| | | Long betweenMin = DateUtil.getBetweenMin(new Date(),systemUser.getProhibitTime()); |
| | | if(betweenMin <= 0L){ |
| | | betweenMin = 0L; |
| | | } |
| | |
| | | if(!Constants.equalsInteger(user.getSource(),Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.NO_ALLOW_LOGIN); |
| | | } |
| | | String pwd = Utils.Secure.encryptPassword(new String(dto.getPassword()), user.getSalt()); |
| | | // æ¯è¾å¯ç |
| | | if( !StringUtils.equals(pwd, user.getPassword())){ |
| | | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT); |
| | | } |
| | | |
| | | // String pwd = Utils.Secure.encryptPassword(new String(dto.getPassword()), user.getSalt()); |
| | | // // æ¯è¾å¯ç |
| | | // if( !StringUtils.equals(pwd, user.getPassword())){ |
| | | // throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT); |
| | | // } |
| | | |
| | | this.checkPassword(user,dto.getPassword()); |
| | | dealOpenIdBiz(user,dto.getOpenid()); |
| | | Company company = new Company(); |
| | | if(Objects.nonNull(user.getCompanyId())){ |
| | |
| | | throw new BusinessException(ResponseStatus.NO_ALLOW_LOGIN.getCode(),"对ä¸èµ·ï¼è¯¥è´¦å·ä¸è½ç»å½å¸æºç«¯å¦ï¼"); |
| | | } |
| | | if(StringUtils.isNotBlank(password)){ |
| | | String pwd = Utils.Secure.encryptPassword(new String(password), user.getSalt()); |
| | | // æ¯è¾å¯ç |
| | | if( !StringUtils.equals(pwd, user.getPassword())){ |
| | | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT); |
| | | } |
| | | // String pwd = Utils.Secure.encryptPassword(new String(password), user.getSalt()); |
| | | // // æ¯è¾å¯ç |
| | | // if( !StringUtils.equals(pwd, user.getPassword())){ |
| | | // throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT); |
| | | // } |
| | | this.checkPassword(user,password); |
| | | } |
| | | dealOpenIdBiz(user,openid); |
| | | Company company = new Company(); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.doumee.biz.system.SystemDictDataBiz; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.dao.business.model.Member; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | |
| | | public void updateById(SystemUser systemUser) { |
| | | systemUserMapper.updateById(systemUser); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void jobForOpenProhibitStatus() { |
| | | systemUserMapper.update(null,new UpdateWrapper<SystemUser>().lambda() |
| | | .set(SystemUser::getProhibitStatus,Constants.ZERO) |
| | | .set(SystemUser::getErrTimes,Constants.ZERO) |
| | | .setSql(" PROHIBIT_REMARK = 'äº"+ DateUtil.getCurrDateTime()+"èªå¨è§£é¤ç¦æ¢ç»å½ï¼' ") |
| | | .eq(SystemUser::getProhibitStatus,Constants.ONE) |
| | | .apply(" now() > PROHIBIT_TIME " ) |
| | | ); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | sd.ID AS DEPARTMENT_ID, sd.`NAME` AS DEPARTMENT_NAME,usr.wechat_name,usr.status,usr.OPENID,usr.type, |
| | | create_user.ID CREATE_USER_ID, create_user.`USERNAME` CREATE_USER_NAME, create_user.`REALNAME` CREATE_REAL_NAME, |
| | | update_user.ID UPDETE_USER_ID, update_user.`USERNAME` UPDATE_USER_NAME, create_user.`REALNAME` UPDATE_REAL_NAME, |
| | | sd.company_name_path as companyName |
| | | sd.company_name_path as companyName, usr.PROHIBIT_STATUS,usr.PROHIBIT_TIME,usr.ERR_TIMES,usr.FIRST_PASSWORD,usr.PROHIBIT_REMARK,usr.NEED_CHANGE_PWD |
| | | FROM `SYSTEM_USER` usr |
| | | LEFT JOIN `SYSTEM_USER` create_user ON create_user.ID = usr.CREATE_USER |
| | | LEFT JOIN `SYSTEM_USER` update_user ON update_user.ID = usr.UPDATE_USER |
| | |
| | | @ApiOperation("ã天æ°ä¿¡æ¯ã宿¶åæ¥å¤©æ°é¢è¦") |
| | | @PostMapping("/timer/weather/syncWeatherInfo") |
| | | ApiResponse syncWeatherInfo(); |
| | | |
| | | @ApiOperation("ãç¨æ·ä¿¡æ¯ãèªå¨éæ¾å·²ç¦ç¨ç»å½ç¨æ·") |
| | | @PostMapping("/timer/systemUserJob/jobForOpenProhibitStatus") |
| | | ApiResponse jobForOpenProhibitStatus(); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.api; |
| | | |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.service.business.PlatformJobService; |
| | | import com.doumee.service.business.third.model.ApiResponse; |
| | | import com.doumee.service.system.SystemUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2023/11/30 15:33 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "æå°ä½ä¸å®æ¶") |
| | | @RestController |
| | | @RequestMapping("/timer/systemUserJob") |
| | | public class SystemUserJobController extends BaseController { |
| | | |
| | | @Autowired |
| | | private SystemUserService systemUserService; |
| | | |
| | | |
| | | @ApiOperation("èªå¨éæ¾å·²ç¦ç¨ç»å½ç¨æ·") |
| | | @PostMapping("/jobForOpenProhibitStatus") |
| | | public ApiResponse jobForOpenProhibitStatus() { |
| | | log.error("========èªå¨éæ¾å·²ç¦ç¨ç»å½ç¨æ·============å¼å§"+System.currentTimeMillis()+""); |
| | | systemUserService.jobForOpenProhibitStatus(); |
| | | log.error("========èªå¨éæ¾å·²ç¦ç¨ç»å½ç¨æ·============å¼å§"+System.currentTimeMillis()+""); |
| | | return ApiResponse.success("èªå¨éæ¾å·²ç¦ç¨ç»å½ç¨æ·"); |
| | | } |
| | | } |
| | |
| | | String fileName = folder+fName; |
| | | boolean r = ftp.uploadInputstream(is,fileName); |
| | | if(r){ |
| | | isFace = null; |
| | | if(Objects.nonNull(isFace) && Constants.equalsInteger(isFace,Constants.ZERO)){ |
| | | //éªè¯äººè¸è¯å |
| | | //人è¸è¯å |
| | |
| | | String fileName = folder+"/"+fName; |
| | | boolean r = ftp.uploadInputstream(is,fileName); |
| | | if(r){ |
| | | isFace = null; |
| | | if(Objects.nonNull(isFace) && Constants.equalsInteger(isFace,Constants.ZERO)){ |
| | | //éªè¯äººè¸è¯å |
| | | //人è¸è¯å |
| | |
| | | // boolean r = ftp.uploadInputstream(compressImg(is),fileName); |
| | | boolean r = ftp.uploadInputstream(is,fileName); |
| | | if(r){ |
| | | isFace = null; |
| | | if(Objects.nonNull(isFace) && Constants.equalsInteger(isFace,Constants.ZERO)){ |
| | | //éªè¯äººè¸è¯å |
| | | //人è¸è¯å |
| | |
| | | String key = folder + tempFileName;// æä»¶å |
| | | ALiYunUtil obs = new ALiYunUtil(endpoint,access_id, access_key); |
| | | if (obs.uploadOnlineObject(file.getInputStream(),bucketName, key,null)) { |
| | | isFace = null; |
| | | // ç§»å¨æå,è¿åæä»¶å |
| | | if(Objects.nonNull(isFace) && Constants.equalsInteger(isFace,Constants.ZERO)){ |
| | | //éªè¯äººè¸è¯å |
| | |
| | | //æ¥è¯¢è½¦è¾ææäººåä¿¡æ¯ |
| | | List<Member> memberList = memberMapper.selectJoinList(Member.class,new MPJLambdaWrapper<Member>() |
| | | .selectAll(Member.class) |
| | | .leftJoin(CarDriver.class,CarDriver::getMemberId,Member::getId) |
| | | .leftJoin(Cars.class,Cars::getMemberId,Member::getId) |
| | | .leftJoin(JkKeys.class,JkKeys::getCarId,Cars::getId) |
| | | .eq(Member::getIsdeleted,Constants.ZERO) |
| | | .eq(CarDriver::getIsdeleted,Constants.ZERO) |
| | | .eq(CarDriver::getStatus,Constants.ZERO) |
| | | .isNotNull(Member::getFaceImg) |
| | | .in(CarDriver::getCarId,carIdList) |
| | | .in(JkKeys::getId,carIdList) |
| | | ); |
| | | if(CollectionUtils.isNotEmpty(memberList)){ |
| | | Set<Member> memberSet = new HashSet<>(memberList); |