|
@@ -1,20 +1,12 @@
|
|
|
package com.pj.project.app_user;
|
|
|
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Random;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
import cn.dev33.satoken.spring.SpringMVCUtil;
|
|
|
-import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
-import cn.hutool.log.StaticLog;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.pj.api.client.admin.AdminInterface;
|
|
|
+import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.pj.api.client.level_one_server.LevelOneServerInterface;
|
|
|
import com.pj.api.client.level_two_server.LevelTwoServerInterface;
|
|
|
import com.pj.api.client.transport.TransportInterface;
|
|
@@ -26,7 +18,6 @@ import com.pj.current.satoken.StpAPPUserUtil;
|
|
|
import com.pj.current.satoken.StpUserUtil;
|
|
|
import com.pj.enummj.DeleteStatus;
|
|
|
import com.pj.enummj.IsLock;
|
|
|
-import com.pj.enummj.Status;
|
|
|
import com.pj.project.app_user.dto.ForgetPasswordDto;
|
|
|
import com.pj.project.app_user.dto.LoginDto;
|
|
|
import com.pj.project.app_user.dto.PassDto;
|
|
@@ -37,23 +28,23 @@ import com.pj.project.app_user_login_log.AppUserLoginLogService;
|
|
|
import com.pj.project.re_role_menu.ReRoleMenu;
|
|
|
import com.pj.project.re_role_menu.ReRoleMenuMapper;
|
|
|
import com.pj.retry.SmsRetryService;
|
|
|
-import com.pj.sms.factory.SmsFactory;
|
|
|
+import com.pj.utils.Aes;
|
|
|
import com.pj.utils.cache.RedisUtil;
|
|
|
import com.pj.utils.sg.AjaxError;
|
|
|
import com.pj.utils.sg.AjaxJson;
|
|
|
import com.pj.utils.sg.WebNbUtil;
|
|
|
import com.pj.utils.so.SoMap;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -215,6 +206,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
*/
|
|
|
boolean register(RegisterDto registerDto) {
|
|
|
if (registerDto == null) return false;
|
|
|
+ registerDto.setPhone(Aes.aesDecrypt(registerDto.getPhone()));
|
|
|
//手机号去重
|
|
|
String phone = registerDto.getPhone();
|
|
|
if (appUserMapper.selectList(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, phone).eq(AppUser::getDeleteStatus, DeleteStatus.DELETE_STATUS_ON.getCode())).size() != 0)
|
|
@@ -240,7 +232,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
//注册身份
|
|
|
appUser.setUserType(registerDto.getType());
|
|
|
//加密并设置登陆密码
|
|
|
- String password = registerDto.getPassword();
|
|
|
+ String password =Aes.aesDecrypt(registerDto.getPassword());
|
|
|
String encode = passwordEncoder.encode(password);
|
|
|
appUser.setPassword(encode);
|
|
|
//创建单位
|
|
@@ -261,6 +253,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
* 用户登录
|
|
|
*/
|
|
|
AjaxJson login(LoginDto dto) {
|
|
|
+ dto.setPhone(Aes.aesDecrypt(dto.getPhone()));
|
|
|
//登陆日志信息
|
|
|
AppUserLoginLog loginLog = new AppUserLoginLog();
|
|
|
BeanUtils.copyProperties(dto, loginLog);
|
|
@@ -286,7 +279,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
|
|
|
AppUser appUser = userList.get(0);
|
|
|
//比对密码
|
|
|
String userPassword = appUser.getPassword();
|
|
|
- boolean matches = passwordEncoder.matches(dto.getPassword(), userPassword);
|
|
|
+ boolean matches = passwordEncoder.matches(Aes.aesDecrypt(dto.getPassword()),userPassword);
|
|
|
if (!matches) {
|
|
|
loginLog.setStatus("1");
|
|
|
appUserLoginLogService.save(loginLog);
|