mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 12:18:42 +08:00 
			
		
		
		
	!44 增加 yudao-user-server 服务
Merge pull request !44 from 芋道源码/feature/user-admin-server
This commit is contained in:
		@@ -0,0 +1,39 @@
 | 
			
		||||
package cn.iocoder.yudao.adminserver.framework.security;
 | 
			
		||||
 | 
			
		||||
import cn.iocoder.yudao.framework.web.config.WebProperties;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Value;
 | 
			
		||||
import org.springframework.context.annotation.Bean;
 | 
			
		||||
import org.springframework.context.annotation.Configuration;
 | 
			
		||||
import org.springframework.security.config.Customizer;
 | 
			
		||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
 | 
			
		||||
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
 | 
			
		||||
@Configuration
 | 
			
		||||
public class SecurityConfiguration {
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private WebProperties webProperties;
 | 
			
		||||
 | 
			
		||||
    @Value("${spring.boot.admin.context-path:''}")
 | 
			
		||||
    private String adminSeverContextPath;
 | 
			
		||||
 | 
			
		||||
    @Bean
 | 
			
		||||
    public Customizer<ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry> authorizeRequestsCustomizer() {
 | 
			
		||||
        return registry -> {
 | 
			
		||||
            // 通用的接口,可匿名访问 TODO 芋艿:需要抽象出去
 | 
			
		||||
            registry.antMatchers(api("/system/captcha/**")).anonymous();
 | 
			
		||||
            // Spring Boot Admin Server 的安全配置 TODO 芋艿:需要抽象出去
 | 
			
		||||
            registry.antMatchers(adminSeverContextPath).anonymous()
 | 
			
		||||
                    .antMatchers(adminSeverContextPath + "/**").anonymous();
 | 
			
		||||
            // 短信回调 API
 | 
			
		||||
            registry.antMatchers(api("/system/sms/callback/**")).anonymous();
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private String api(String url) {
 | 
			
		||||
        return webProperties.getApiPrefix() + url;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -32,10 +32,9 @@ public class InfApiAccessLogServiceImpl implements InfApiAccessLogService {
 | 
			
		||||
    @Override
 | 
			
		||||
    @Async
 | 
			
		||||
    public Future<Boolean> createApiAccessLogAsync(ApiAccessLogCreateDTO createDTO) {
 | 
			
		||||
        // 插入
 | 
			
		||||
        InfApiAccessLogDO apiAccessLog = InfApiAccessLogConvert.INSTANCE.convert(createDTO);
 | 
			
		||||
        int insert = apiAccessLogMapper.insert(apiAccessLog);
 | 
			
		||||
        return new AsyncResult<>(insert == 1);
 | 
			
		||||
        return new AsyncResult<>(insert > 1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
 
 | 
			
		||||
@@ -167,7 +167,7 @@ public class SysUserController {
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('system:user:import')")
 | 
			
		||||
    public CommonResult<SysUserImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
 | 
			
		||||
             @RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
 | 
			
		||||
        List<SysUserImportExcelVO> list = ExcelUtils.raed(file, SysUserImportExcelVO.class);
 | 
			
		||||
        List<SysUserImportExcelVO> list = ExcelUtils.read(file, SysUserImportExcelVO.class);
 | 
			
		||||
        return success(userService.importUsers(list, updateSupport));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user