权限注解,excel依赖
This commit is contained in:
12
pom.xml
12
pom.xml
@@ -137,6 +137,15 @@
|
|||||||
<artifactId>minio</artifactId>
|
<artifactId>minio</artifactId>
|
||||||
<version>8.6.0</version>
|
<version>8.6.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!--excel处理-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.idev.excel</groupId>
|
||||||
|
<artifactId>fastexcel</artifactId>
|
||||||
|
<version>1.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@@ -162,17 +171,14 @@
|
|||||||
</testResource>
|
</testResource>
|
||||||
</testResources>
|
</testResources>
|
||||||
<plugins>
|
<plugins>
|
||||||
<!-- maven打包插件 -> 将整个工程打成一个 fatjar -->
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<!-- 作用:项目打成jar,同时把本地jar包也引入进去 -->
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<includeSystemScope>true</includeSystemScope>
|
<includeSystemScope>true</includeSystemScope>
|
||||||
<mainClass>com.dc.dc_project.DcProjectApplication</mainClass>
|
<mainClass>com.dc.dc_project.DcProjectApplication</mainClass>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!--添加配置跳过测试-->
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.dc.dc_project.common.aop;
|
package com.dc.dc_project.common.aop;
|
||||||
|
|
||||||
import cn.dev33.satoken.SaManager;
|
|
||||||
import cn.dev33.satoken.annotation.handler.SaAnnotationHandlerInterface;
|
import cn.dev33.satoken.annotation.handler.SaAnnotationHandlerInterface;
|
||||||
import cn.dev33.satoken.context.SaHolder;
|
|
||||||
import cn.dev33.satoken.exception.SaTokenException;
|
import cn.dev33.satoken.exception.SaTokenException;
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import com.dc.dc_project.utils.PermissionUtils;
|
import com.dc.dc_project.utils.PermissionUtils;
|
||||||
|
|||||||
@@ -1,20 +1,28 @@
|
|||||||
package com.dc.dc_project.config;
|
package com.dc.dc_project.config;
|
||||||
|
|
||||||
import cn.dev33.satoken.SaManager;
|
|
||||||
import cn.dev33.satoken.context.SaHolder;
|
|
||||||
import cn.dev33.satoken.interceptor.SaInterceptor;
|
import cn.dev33.satoken.interceptor.SaInterceptor;
|
||||||
import cn.dev33.satoken.router.SaRouter;
|
import cn.dev33.satoken.router.SaRouter;
|
||||||
|
import cn.dev33.satoken.strategy.SaAnnotationStrategy;
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import com.dc.dc_project.common.aop.CheckPermission;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
|
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
|
||||||
public class SaTokenConfigure implements WebMvcConfigurer {
|
public class SaTokenConfigure implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void registerAnnotationHandler() {
|
||||||
|
// 注册自定义权限注解处理器
|
||||||
|
SaAnnotationStrategy.instance.registerAnnotationHandler(new CheckPermission());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
System.out.println("----- SaToken 拦截器启动成功!");
|
System.out.println("----- SaToken 拦截器启动成功!");
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ public class PersonnelServiceImpl extends ServiceImpl<PersonnelMapper, Personnel
|
|||||||
|
|
||||||
Personnel personnel = this.getOneByUserId(userId);
|
Personnel personnel = this.getOneByUserId(userId);
|
||||||
Long pOrgId = orgMapper.getOrgIdByPersonnelId(personnel.getId());
|
Long pOrgId = orgMapper.getOrgIdByPersonnelId(personnel.getId());
|
||||||
|
if (pOrgId == null) {
|
||||||
|
return ResponseResult.error("无归属组织,无");
|
||||||
|
}
|
||||||
List<Long> orgIds = null;
|
List<Long> orgIds = null;
|
||||||
if (dataScopeType != null) {
|
if (dataScopeType != null) {
|
||||||
orgIds = switch (dataScopeType) {
|
orgIds = switch (dataScopeType) {
|
||||||
@@ -88,13 +91,6 @@ public class PersonnelServiceImpl extends ServiceImpl<PersonnelMapper, Personnel
|
|||||||
personnel.setStatus(1);
|
personnel.setStatus(1);
|
||||||
personnel.setCreatedBy(userId);
|
personnel.setCreatedBy(userId);
|
||||||
|
|
||||||
if(personnelDto.getOrgId() != null){
|
|
||||||
PersonnelOrg personnelOrg = new PersonnelOrg();
|
|
||||||
personnelOrg.setPersonnelId(personnel.getId());
|
|
||||||
personnelOrg.setOrgId(personnelDto.getOrgId());
|
|
||||||
personnelOrg.setCreatedBy(userId);
|
|
||||||
personnelOrgService.save(personnelOrg);
|
|
||||||
}
|
|
||||||
if(personnelDto.getIsUser() == 1){
|
if(personnelDto.getIsUser() == 1){
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.setUsername(personnel.getName());
|
user.setUsername(personnel.getName());
|
||||||
@@ -103,13 +99,18 @@ public class PersonnelServiceImpl extends ServiceImpl<PersonnelMapper, Personnel
|
|||||||
user.setPhone(personnel.getContactPhone());
|
user.setPhone(personnel.getContactPhone());
|
||||||
user.setStatus(1);
|
user.setStatus(1);
|
||||||
user.setRemark(personnel.getRemark());
|
user.setRemark(personnel.getRemark());
|
||||||
userMapper.insert( user);
|
userMapper.insert(user);
|
||||||
personnel.setUserId(user.getId());
|
personnel.setUserId(user.getId());
|
||||||
}
|
}
|
||||||
if (this.save(personnel)){
|
this.save(personnel);
|
||||||
return ResponseResult.success();
|
if(personnelDto.getOrgId() != null){
|
||||||
|
PersonnelOrg personnelOrg = new PersonnelOrg();
|
||||||
|
personnelOrg.setPersonnelId(personnel.getId());
|
||||||
|
personnelOrg.setOrgId(personnelDto.getOrgId());
|
||||||
|
personnelOrg.setCreatedBy(userId);
|
||||||
|
personnelOrgService.save(personnelOrg);
|
||||||
}
|
}
|
||||||
return ResponseResult.error();
|
return ResponseResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user