|
@@ -20,29 +20,24 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
+import me.zhengjie.application.admin.controller.vo.UserReq;
|
|
|
|
|
+import me.zhengjie.application.admin.service.UserService;
|
|
|
import me.zhengjie.application.admin.service.dto.*;
|
|
import me.zhengjie.application.admin.service.dto.*;
|
|
|
|
|
+import me.zhengjie.application.admin.service.mapstruct.UserMapper;
|
|
|
import me.zhengjie.base.AppBaseResponse;
|
|
import me.zhengjie.base.AppBaseResponse;
|
|
|
import me.zhengjie.base.AppResultData;
|
|
import me.zhengjie.base.AppResultData;
|
|
|
-import me.zhengjie.base.util.BeanCopyUtils;
|
|
|
|
|
-import me.zhengjie.base.util.FileUploadUtil;
|
|
|
|
|
import me.zhengjie.base.ResultCode;
|
|
import me.zhengjie.base.ResultCode;
|
|
|
|
|
+import me.zhengjie.base.util.*;
|
|
|
import me.zhengjie.config.FileProperties;
|
|
import me.zhengjie.config.FileProperties;
|
|
|
import me.zhengjie.dao.mybatis.entity.*;
|
|
import me.zhengjie.dao.mybatis.entity.*;
|
|
|
import me.zhengjie.dao.mybatis.mapper.*;
|
|
import me.zhengjie.dao.mybatis.mapper.*;
|
|
|
-import me.zhengjie.exception.BadRequestException;
|
|
|
|
|
-import me.zhengjie.exception.EntityExistException;
|
|
|
|
|
-import me.zhengjie.exception.EntityNotFoundException;
|
|
|
|
|
-import me.zhengjie.modules.security.service.OnlineUserService;
|
|
|
|
|
-import me.zhengjie.modules.security.service.UserCacheClean;
|
|
|
|
|
-import me.zhengjie.modules.security.service.dto.JwtUserDto;
|
|
|
|
|
import me.zhengjie.domain.office.NotaryOfficeConstant;
|
|
import me.zhengjie.domain.office.NotaryOfficeConstant;
|
|
|
import me.zhengjie.domain.user.UserConstant;
|
|
import me.zhengjie.domain.user.UserConstant;
|
|
|
import me.zhengjie.domain.user.UserDomain;
|
|
import me.zhengjie.domain.user.UserDomain;
|
|
|
-import me.zhengjie.application.admin.controller.vo.UserReq;
|
|
|
|
|
-import me.zhengjie.application.admin.service.UserService;
|
|
|
|
|
-import me.zhengjie.application.admin.service.mapstruct.UserMapper;
|
|
|
|
|
-import me.zhengjie.base.util.CFCACertUtil;
|
|
|
|
|
-import me.zhengjie.base.util.TencentServiceUtil;
|
|
|
|
|
|
|
+import me.zhengjie.exception.BadRequestException;
|
|
|
|
|
+import me.zhengjie.exception.EntityExistException;
|
|
|
|
|
+import me.zhengjie.exception.EntityNotFoundException;
|
|
|
|
|
+import me.zhengjie.security.service.OnlineUserService;
|
|
|
import me.zhengjie.utils.*;
|
|
import me.zhengjie.utils.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -73,8 +68,8 @@ public class UserServiceImpl implements UserService {
|
|
|
private final UserMapper userMapper;
|
|
private final UserMapper userMapper;
|
|
|
private final FileProperties properties;
|
|
private final FileProperties properties;
|
|
|
private final RedisUtils redisUtils;
|
|
private final RedisUtils redisUtils;
|
|
|
- private final UserCacheClean userCacheClean;
|
|
|
|
|
private final OnlineUserService onlineUserService;
|
|
private final OnlineUserService onlineUserService;
|
|
|
|
|
+ private final ApplicationContextUtil contextUtil;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private NotaryOfficeMapper notaryOfficeMapper;
|
|
private NotaryOfficeMapper notaryOfficeMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -205,7 +200,7 @@ public class UserServiceImpl implements UserService {
|
|
|
*/
|
|
*/
|
|
|
private QueryWrapper<SysUserEntity> getQueryWrapper(UserReq userReq) {
|
|
private QueryWrapper<SysUserEntity> getQueryWrapper(UserReq userReq) {
|
|
|
QueryWrapper<SysUserEntity> qw = new QueryWrapper<>();
|
|
QueryWrapper<SysUserEntity> qw = new QueryWrapper<>();
|
|
|
- JwtUserDto userDto = (JwtUserDto) SecurityUtils.getCurrentUser();
|
|
|
|
|
|
|
+ JwtUserDto userDto = contextUtil.getCurrentUser();
|
|
|
String maxRole = userDomain.getUserMaxRole();
|
|
String maxRole = userDomain.getUserMaxRole();
|
|
|
if ("超级管理员".equals(maxRole)) {
|
|
if ("超级管理员".equals(maxRole)) {
|
|
|
} else if ("公证处管理员".equals(maxRole) || "银行管理员".equals(maxRole)) {
|
|
} else if ("公证处管理员".equals(maxRole) || "银行管理员".equals(maxRole)) {
|
|
@@ -304,7 +299,7 @@ public class UserServiceImpl implements UserService {
|
|
|
*/
|
|
*/
|
|
|
public AppBaseResponse uploadSeal(User resources){
|
|
public AppBaseResponse uploadSeal(User resources){
|
|
|
AppBaseResponse response = new AppBaseResponse();
|
|
AppBaseResponse response = new AppBaseResponse();
|
|
|
- SysUserEntity user = userDao.selectById(SecurityUtils.getCurrentUserId());
|
|
|
|
|
|
|
+ SysUserEntity user = userDao.selectById(contextUtil.getCurrentUserId());
|
|
|
if(UserConstant.USER_TYPE_NOTARY.equals(user.getOrgId().split("_")[0])) {
|
|
if(UserConstant.USER_TYPE_NOTARY.equals(user.getOrgId().split("_")[0])) {
|
|
|
NotaryOfficeEntity entity = notaryOfficeMapper.selectById(user.getOrgId().split("_")[1]);
|
|
NotaryOfficeEntity entity = notaryOfficeMapper.selectById(user.getOrgId().split("_")[1]);
|
|
|
if (NotaryOfficeConstant.NOTARY_AUTO_GENERATE.equals(entity.getAutoGenerate())) {
|
|
if (NotaryOfficeConstant.NOTARY_AUTO_GENERATE.equals(entity.getAutoGenerate())) {
|
|
@@ -429,7 +424,6 @@ public class UserServiceImpl implements UserService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updatePass(String username, String pass) {
|
|
public void updatePass(String username, String pass) {
|
|
|
userRepository.updatePass(username, pass, new Date());
|
|
userRepository.updatePass(username, pass, new Date());
|
|
|
- flushCache(username);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -443,7 +437,7 @@ public class UserServiceImpl implements UserService {
|
|
|
if(fileType != null && !image.contains(fileType)){
|
|
if(fileType != null && !image.contains(fileType)){
|
|
|
throw new BadRequestException("文件格式错误!, 仅支持 " + image +" 格式");
|
|
throw new BadRequestException("文件格式错误!, 仅支持 " + image +" 格式");
|
|
|
}
|
|
}
|
|
|
- User user = userRepository.findByUsername(SecurityUtils.getCurrentUsername());
|
|
|
|
|
|
|
+ User user = userRepository.findByUsername(contextUtil.getCurrentUsername());
|
|
|
String oldPath = user.getAvatarPath();
|
|
String oldPath = user.getAvatarPath();
|
|
|
File file = FileUtil.upload(multipartFile, properties.getPath().getAvatar());
|
|
File file = FileUtil.upload(multipartFile, properties.getPath().getAvatar());
|
|
|
user.setAvatarPath(Objects.requireNonNull(file).getPath());
|
|
user.setAvatarPath(Objects.requireNonNull(file).getPath());
|
|
@@ -453,7 +447,6 @@ public class UserServiceImpl implements UserService {
|
|
|
FileUtil.del(oldPath);
|
|
FileUtil.del(oldPath);
|
|
|
}
|
|
}
|
|
|
@NotBlank String username = user.getUsername();
|
|
@NotBlank String username = user.getUsername();
|
|
|
- flushCache(username);
|
|
|
|
|
return new HashMap<String, String>(1) {{
|
|
return new HashMap<String, String>(1) {{
|
|
|
put("avatar", file.getName());
|
|
put("avatar", file.getName());
|
|
|
}};
|
|
}};
|
|
@@ -463,7 +456,6 @@ public class UserServiceImpl implements UserService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateEmail(String username, String email) {
|
|
public void updateEmail(String username, String email) {
|
|
|
userRepository.updateEmail(username, email);
|
|
userRepository.updateEmail(username, email);
|
|
|
- flushCache(username);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -493,16 +485,6 @@ public class UserServiceImpl implements UserService {
|
|
|
*/
|
|
*/
|
|
|
public void delCaches(Long id, String username) {
|
|
public void delCaches(Long id, String username) {
|
|
|
redisUtils.del(CacheKey.USER_ID + id);
|
|
redisUtils.del(CacheKey.USER_ID + id);
|
|
|
- flushCache(username);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 清理 登陆时 用户缓存信息
|
|
|
|
|
- *
|
|
|
|
|
- * @param username /
|
|
|
|
|
- */
|
|
|
|
|
- private void flushCache(String username) {
|
|
|
|
|
- userCacheClean.cleanUserCache(username);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -526,7 +508,7 @@ public class UserServiceImpl implements UserService {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
throw new EntityNotFoundException(User.class, "安心签接口错误", "验证授权验证码出错");
|
|
throw new EntityNotFoundException(User.class, "安心签接口错误", "验证授权验证码出错");
|
|
|
}
|
|
}
|
|
|
- user = userRepository.findByUsername(SecurityUtils.getCurrentUsername());
|
|
|
|
|
|
|
+ user = userRepository.findByUsername(contextUtil.getCurrentUsername());
|
|
|
user.setAxqIsAuth("1");
|
|
user.setAxqIsAuth("1");
|
|
|
userRepository.save(user);
|
|
userRepository.save(user);
|
|
|
// 清除缓存
|
|
// 清除缓存
|
|
@@ -540,8 +522,8 @@ public class UserServiceImpl implements UserService {
|
|
|
@Override
|
|
@Override
|
|
|
public AppBaseResponse getAuthStatus() {
|
|
public AppBaseResponse getAuthStatus() {
|
|
|
AppBaseResponse response = new AppBaseResponse();
|
|
AppBaseResponse response = new AppBaseResponse();
|
|
|
- SysUserEntity userEntity = userDao.selectById(SecurityUtils.getCurrentUserId());
|
|
|
|
|
- System.out.println(SecurityUtils.getCurrentUserId());
|
|
|
|
|
|
|
+ SysUserEntity userEntity = userDao.selectById(contextUtil.getCurrentUserId());
|
|
|
|
|
+ System.out.println(contextUtil.getCurrentUserId());
|
|
|
String authStatus = StringUtils.isEmpty(userEntity.getAxqIsAuth()) ? "0" : userEntity.getAxqIsAuth();
|
|
String authStatus = StringUtils.isEmpty(userEntity.getAxqIsAuth()) ? "0" : userEntity.getAxqIsAuth();
|
|
|
if ("0".equals(authStatus)) {
|
|
if ("0".equals(authStatus)) {
|
|
|
CFCACertUtil.proxySwitchOn = "dev".equals(systemEnv);
|
|
CFCACertUtil.proxySwitchOn = "dev".equals(systemEnv);
|