添加功能
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 9091
|
||||
port: 9092
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
package com.ruoyi.cms.constant;
|
||||
|
||||
import reactor.util.function.Tuple2;
|
||||
import reactor.util.function.Tuples;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class CommonConstant {
|
||||
/**
|
||||
* 地铁线路缓存
|
||||
@@ -7,4 +15,34 @@ public class CommonConstant {
|
||||
public static final String SUBWAY_LINE_CACHE = "common_cache:subway";
|
||||
public static final String COMMERICIAL_AREA = "common_cache:comericial_area";
|
||||
public static final String JOB_TITLE = "common_cache:job_titile";
|
||||
|
||||
|
||||
/**
|
||||
* 团场列表
|
||||
*/
|
||||
public static final List<Tuple2<String, String>> AREA_LIST =
|
||||
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(
|
||||
Tuples.of("659001000000", "石河子市"),
|
||||
Tuples.of("659001001000", "新城街道"),
|
||||
Tuples.of("659001002000", "向阳街道"),
|
||||
Tuples.of("659001003000", "红山街道"),
|
||||
Tuples.of("659001004000", "老街街道"),
|
||||
Tuples.of("659001005000", "东城街道"),
|
||||
Tuples.of("659001100000", "北泉镇"),
|
||||
Tuples.of("659001101000", "石河子镇"),
|
||||
Tuples.of("654203503000", "121团"),
|
||||
Tuples.of("654203506000", "133团"),
|
||||
Tuples.of("654203507000", "134团"),
|
||||
Tuples.of("650203530000", "136团"),
|
||||
Tuples.of("654203509000", "141团"),
|
||||
Tuples.of("654203510000", "142团"),
|
||||
Tuples.of("654203511000", "143团"),
|
||||
Tuples.of("654203512000", "144团"),
|
||||
Tuples.of("652324521000", "147团"),
|
||||
Tuples.of("652324522000", "148团"),
|
||||
Tuples.of("652324523000", "149团"),
|
||||
Tuples.of("652324524000", "150团"),
|
||||
Tuples.of("659001500000", "152团")
|
||||
)));
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.ruoyi.cms.constant.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 查询时间类型
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/6/25
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum QueryTimeTypeEnum {
|
||||
|
||||
YEAR("年度"),
|
||||
QUARTER("季度"),
|
||||
MONTH("月度"),
|
||||
;
|
||||
private final String desc;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.ruoyi.cms.controller;
|
||||
|
||||
import com.ruoyi.cms.service.AnalysisCommonService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 分析通用
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/6/25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/analysis/common")
|
||||
@RequiredArgsConstructor
|
||||
public class AnalysisCommonController {
|
||||
|
||||
private final AnalysisCommonService analysisCommonService;
|
||||
|
||||
/**
|
||||
* 查询团场列表
|
||||
*
|
||||
* @return 团场列表
|
||||
*/
|
||||
@GetMapping("/areaList")
|
||||
// @Log(title = "根据枚举名称查询枚举的所有值", businessType = BusinessType.QUERY)
|
||||
public AjaxResult areaList() {
|
||||
return AjaxResult.success(analysisCommonService.areaList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询行业列表
|
||||
*
|
||||
* @return 行业列表
|
||||
*/
|
||||
@GetMapping("/industryList")
|
||||
// @Log(title = "根据枚举名称查询枚举的所有值", businessType = BusinessType.QUERY)
|
||||
public AjaxResult industryList() {
|
||||
return AjaxResult.success(analysisCommonService.industryList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.ruoyi.cms.controller;
|
||||
|
||||
import com.ruoyi.cms.domain.dto.QueryParamDto;
|
||||
import com.ruoyi.cms.service.AnalysisIndustryEmploymentInfoService;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 行业就业情况信息分析
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/6/25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/analysis/industryEmploymentInfo")
|
||||
@RequiredArgsConstructor
|
||||
public class AnalysisIndustryEmploymentInfoController {
|
||||
|
||||
private final AnalysisIndustryEmploymentInfoService analysisIndustryEmploymentInfoService;
|
||||
|
||||
/**
|
||||
* 数据总览
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 数据总览
|
||||
*/
|
||||
@PostMapping("/overview")
|
||||
// @Log(title = "根据枚举名称查询枚举的所有值", businessType = BusinessType.QUERY)
|
||||
public AjaxResult overview(@RequestBody QueryParamDto dto) {
|
||||
return AjaxResult.success(analysisIndustryEmploymentInfoService.overview(dto));
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.ruoyi.cms.controller;
|
||||
|
||||
/**
|
||||
* <类注释内容>
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/6/24
|
||||
*/
|
||||
public class TestController {
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.ruoyi.cms.domain.dto;
|
||||
|
||||
import com.ruoyi.cms.constant.enums.QueryTimeTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 查询参数
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/6/25
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class QueryParamDto implements Serializable {
|
||||
private static final long serialVersionUID = -6817148471100119514L;
|
||||
|
||||
/**
|
||||
* 时间类型
|
||||
*/
|
||||
private QueryTimeTypeEnum queryTimeType;
|
||||
/**
|
||||
* 年份
|
||||
*/
|
||||
private Integer year;
|
||||
/**
|
||||
* 季度
|
||||
*/
|
||||
private Integer quarter;
|
||||
/**
|
||||
* 月份
|
||||
*/
|
||||
private Integer month;
|
||||
/**
|
||||
* 团场
|
||||
*/
|
||||
private String area;
|
||||
/**
|
||||
* 行业
|
||||
*/
|
||||
private String industry;
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.ruoyi.cms.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 字典
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/6/25
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DictVo implements Serializable {
|
||||
private static final long serialVersionUID = 875430729680133136L;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String desc;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.ruoyi.cms.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 行业就业情况信息分析 - 数据总览
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/6/25
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class IndustryEmploymentInfoOverviewVo implements Serializable {
|
||||
private static final long serialVersionUID = -7539147768207113373L;
|
||||
|
||||
/**
|
||||
* 总就业人数
|
||||
*/
|
||||
private Long employmentCount;
|
||||
/**
|
||||
* 总就业人数环比
|
||||
*/
|
||||
private BigDecimal employmentCountMom;
|
||||
/**
|
||||
* 失业率
|
||||
*/
|
||||
private BigDecimal unemploymentRate;
|
||||
/**
|
||||
* 失业率环比
|
||||
*/
|
||||
private BigDecimal unemploymentRateMom;
|
||||
/**
|
||||
* 创业企业总数
|
||||
*/
|
||||
private Long startupCompanyCount;
|
||||
/**
|
||||
* 创业企业总数环比
|
||||
*/
|
||||
private BigDecimal startupCompanyCountMom;
|
||||
/**
|
||||
* 创业带动就业人数
|
||||
*/
|
||||
private Long startupEmploymentCount;
|
||||
/**
|
||||
* 创业带动就业人数环比
|
||||
*/
|
||||
private BigDecimal startupEmploymentCountMom;
|
||||
/**
|
||||
* 灵活就业人数
|
||||
*/
|
||||
private Long flexibleEmploymentCount;
|
||||
/**
|
||||
* 灵活就业人数环比
|
||||
*/
|
||||
private BigDecimal flexibleEmploymentCountMom;
|
||||
/**
|
||||
* 招聘需求
|
||||
*/
|
||||
private Long recruitmentDemand;
|
||||
/**
|
||||
* 招聘需求环比
|
||||
*/
|
||||
private BigDecimal recruitmentDemandMom;
|
||||
/**
|
||||
* 平均薪资
|
||||
*/
|
||||
private BigDecimal averageSalary;
|
||||
/**
|
||||
* 平均薪资环比
|
||||
*/
|
||||
private BigDecimal averageSalaryMom;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.cms.domain.vo.DictVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分析通用
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/6/25
|
||||
*/
|
||||
public interface AnalysisCommonService {
|
||||
|
||||
|
||||
/**
|
||||
* 查询团场列表
|
||||
*
|
||||
* @return 团场列表
|
||||
*/
|
||||
List<DictVo> areaList();
|
||||
|
||||
/**
|
||||
* 查询行业列表
|
||||
*
|
||||
* @return 行业列表
|
||||
*/
|
||||
List<DictVo> industryList();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.cms.domain.dto.QueryParamDto;
|
||||
import com.ruoyi.cms.domain.vo.IndustryEmploymentInfoOverviewVo;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
/**
|
||||
* 行业就业情况信息分析
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/6/25
|
||||
*/
|
||||
public interface AnalysisIndustryEmploymentInfoService {
|
||||
|
||||
|
||||
/**
|
||||
* 数据总览
|
||||
*
|
||||
* @param dto 查询参数
|
||||
* @return 数据总览
|
||||
*/
|
||||
IndustryEmploymentInfoOverviewVo overview(QueryParamDto dto);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.ruoyi.cms.constant.CommonConstant;
|
||||
import com.ruoyi.cms.domain.vo.DictVo;
|
||||
import com.ruoyi.cms.service.AnalysisCommonService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import reactor.util.function.Tuple2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分析通用
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/6/25
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class AnalysisCommonServiceImpl implements AnalysisCommonService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<DictVo> areaList() {
|
||||
List<DictVo> list = new ArrayList<>();
|
||||
for (Tuple2<String, String> area : CommonConstant.AREA_LIST) {
|
||||
list.add(DictVo.builder().code(area.getT1()).desc(area.getT2()).build());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictVo> industryList() {
|
||||
List<DictVo> list = new ArrayList<>();
|
||||
|
||||
list.add(DictVo.builder().code("A").desc("农、林、牧、渔业").build());
|
||||
list.add(DictVo.builder().code("B").desc("采矿业").build());
|
||||
list.add(DictVo.builder().code("C").desc("制造业").build());
|
||||
list.add(DictVo.builder().code("D").desc("电力、热力、燃气及水生产和供应业").build());
|
||||
list.add(DictVo.builder().code("E").desc("建筑业").build());
|
||||
list.add(DictVo.builder().code("F").desc("批发和零售业").build());
|
||||
list.add(DictVo.builder().code("G").desc("交通运输、仓储和邮政业").build());
|
||||
list.add(DictVo.builder().code("H").desc("住宿和餐饮业").build());
|
||||
list.add(DictVo.builder().code("I").desc("信息传输、软件和信息技术服务业").build());
|
||||
list.add(DictVo.builder().code("J").desc("金融业").build());
|
||||
list.add(DictVo.builder().code("K").desc("房地产业").build());
|
||||
list.add(DictVo.builder().code("L").desc("租赁和商务服务业").build());
|
||||
list.add(DictVo.builder().code("M").desc("科学研究和技术服务业").build());
|
||||
list.add(DictVo.builder().code("N").desc("水利、环境和公共设施管理业").build());
|
||||
list.add(DictVo.builder().code("O").desc("居民服务、修理和其他服务业").build());
|
||||
list.add(DictVo.builder().code("P").desc("教育").build());
|
||||
list.add(DictVo.builder().code("Q").desc("卫生和社会工作").build());
|
||||
list.add(DictVo.builder().code("R").desc("文化、体育和娱乐业").build());
|
||||
list.add(DictVo.builder().code("S").desc("公共管理、社会保障和社会组织").build());
|
||||
list.add(DictVo.builder().code("T").desc("国际组织").build());
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.ruoyi.cms.domain.dto.QueryParamDto;
|
||||
import com.ruoyi.cms.domain.vo.IndustryEmploymentInfoOverviewVo;
|
||||
import com.ruoyi.cms.service.AnalysisIndustryEmploymentInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 行业就业情况信息分析
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/6/25
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class AnalysisIndustryEmploymentInfoServiceImpl implements AnalysisIndustryEmploymentInfoService {
|
||||
|
||||
|
||||
@Override
|
||||
public IndustryEmploymentInfoOverviewVo overview(QueryParamDto dto) {
|
||||
return IndustryEmploymentInfoOverviewVo.builder()
|
||||
.employmentCount(100L)
|
||||
.employmentCountMom(BigDecimal.valueOf(10))
|
||||
.unemploymentRate(BigDecimal.valueOf(3.4))
|
||||
.unemploymentRateMom(BigDecimal.valueOf(1.2))
|
||||
.startupCompanyCount(323L)
|
||||
.startupCompanyCountMom(BigDecimal.valueOf(23))
|
||||
.startupEmploymentCount(432L)
|
||||
.startupEmploymentCountMom(BigDecimal.valueOf(-12))
|
||||
.flexibleEmploymentCount(53L)
|
||||
.flexibleEmploymentCountMom(BigDecimal.valueOf(2.3))
|
||||
.recruitmentDemand(2443L)
|
||||
.recruitmentDemandMom(BigDecimal.valueOf(23.3))
|
||||
.averageSalary(BigDecimal.valueOf(3424.3))
|
||||
.averageSalaryMom(BigDecimal.valueOf(-3.3))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.cms.mapper.TestMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.ruoyi.framework.config;
|
||||
|
||||
import com.ruoyi.framework.config.properties.PermitAllUrlProperties;
|
||||
import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter;
|
||||
import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl;
|
||||
import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -16,26 +20,21 @@ import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
import org.springframework.security.web.authentication.logout.LogoutFilter;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
import com.ruoyi.framework.config.properties.PermitAllUrlProperties;
|
||||
import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter;
|
||||
import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl;
|
||||
import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl;
|
||||
|
||||
/**
|
||||
* spring security配置
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableMethodSecurity(prePostEnabled = true, securedEnabled = true)
|
||||
@Configuration
|
||||
public class SecurityConfig
|
||||
{
|
||||
public class SecurityConfig {
|
||||
/**
|
||||
* 自定义用户认证逻辑
|
||||
*/
|
||||
@Autowired
|
||||
private UserDetailsService userDetailsService;
|
||||
|
||||
|
||||
/**
|
||||
* 认证失败处理类
|
||||
*/
|
||||
@@ -53,7 +52,7 @@ public class SecurityConfig
|
||||
*/
|
||||
@Autowired
|
||||
private JwtAuthenticationTokenFilter authenticationTokenFilter;
|
||||
|
||||
|
||||
/**
|
||||
* 跨域过滤器
|
||||
*/
|
||||
@@ -70,8 +69,7 @@ public class SecurityConfig
|
||||
* 身份验证实现
|
||||
*/
|
||||
@Bean
|
||||
public AuthenticationManager authenticationManager()
|
||||
{
|
||||
public AuthenticationManager authenticationManager() {
|
||||
DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();
|
||||
daoAuthenticationProvider.setUserDetailsService(userDetailsService);
|
||||
daoAuthenticationProvider.setPasswordEncoder(bCryptPasswordEncoder());
|
||||
@@ -94,58 +92,51 @@ public class SecurityConfig
|
||||
* authenticated | 用户登录后可访问
|
||||
*/
|
||||
@Bean
|
||||
protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception
|
||||
{
|
||||
protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception {
|
||||
return httpSecurity
|
||||
// CSRF禁用,因为不使用session
|
||||
.csrf(csrf -> csrf.disable())
|
||||
// 禁用HTTP响应标头
|
||||
.headers((headersCustomizer) -> {
|
||||
headersCustomizer.cacheControl(cache -> cache.disable()).frameOptions(options -> options.sameOrigin());
|
||||
})
|
||||
// 认证失败处理类
|
||||
.exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler))
|
||||
// 基于token,所以不需要session
|
||||
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||
// 注解标记允许匿名访问的url
|
||||
.authorizeHttpRequests((requests) -> {
|
||||
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
|
||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
||||
requests.antMatchers("/sso/pc/code/login","/sso/pcms/code/login","/sso/token/login","/sso/code/login","/login","/loginoss",
|
||||
"/register", "/captchaImage","/app/login","/websocket/**","/ws/**","/speech-recognition","/speech-synthesis",
|
||||
"/cms/company/listPage","/cms/appUser/noTmlist","/getTjmhToken","/getWwTjmhToken","/getWwTjmHlwToken",
|
||||
"/cms/notice/noticTotal","/cms/jobApply/zphApply","/cms/jobApply/zphApplyAgree","/cms/policyInfo/list",
|
||||
"/cms/policyInfo/detail","/cms/industry/treeselect").permitAll()
|
||||
// 静态资源,可匿名访问
|
||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||
// 移动端公用查询,可匿名访问
|
||||
.antMatchers("/app/common/**").permitAll()
|
||||
.antMatchers("/app/**").permitAll()
|
||||
// 门户端公开接口,可匿名访问
|
||||
.antMatchers("/portal/**").permitAll()
|
||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||
//放行前端界面
|
||||
.antMatchers("/kashi/job-portal/detail/**").permitAll()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated();
|
||||
})
|
||||
// 添加Logout filter
|
||||
.logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler))
|
||||
// 添加JWT filter
|
||||
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class)
|
||||
// 添加CORS filter
|
||||
.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class)
|
||||
.addFilterBefore(corsFilter, LogoutFilter.class)
|
||||
// websocket
|
||||
.build();
|
||||
// CSRF禁用,因为不使用session
|
||||
.csrf(csrf -> csrf.disable())
|
||||
// 禁用HTTP响应标头
|
||||
.headers((headersCustomizer) -> {
|
||||
headersCustomizer.cacheControl(cache -> cache.disable()).frameOptions(options -> options.sameOrigin());
|
||||
})
|
||||
// 认证失败处理类
|
||||
.exceptionHandling(exception -> exception.authenticationEntryPoint(unauthorizedHandler))
|
||||
// 基于token,所以不需要session
|
||||
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||
// 注解标记允许匿名访问的url
|
||||
.authorizeHttpRequests((requests) -> {
|
||||
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
|
||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
||||
requests.antMatchers("/sso/pc/code/login").permitAll()
|
||||
// 大数据分析先放行
|
||||
.antMatchers("/analysis/**").permitAll()
|
||||
// 静态资源,可匿名访问
|
||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js",
|
||||
"/profile/**").permitAll()
|
||||
// 门户端公开接口,可匿名访问
|
||||
.antMatchers("/portal/**").permitAll()
|
||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs",
|
||||
"/druid/**").permitAll()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated();
|
||||
})
|
||||
// 添加Logout filter
|
||||
.logout(logout -> logout.logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler))
|
||||
// 添加JWT filter
|
||||
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class)
|
||||
// 添加CORS filter
|
||||
.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class)
|
||||
.addFilterBefore(corsFilter, LogoutFilter.class)
|
||||
// websocket
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 强散列哈希加密实现
|
||||
*/
|
||||
@Bean
|
||||
public BCryptPasswordEncoder bCryptPasswordEncoder()
|
||||
{
|
||||
public BCryptPasswordEncoder bCryptPasswordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user