fix: 模块补丁
This commit is contained in:
parent
32cfac1525
commit
1d78d147ac
@ -6,6 +6,7 @@ import com.jsl.oa.services.UserService;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
||||||
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@ -25,13 +26,7 @@ public class ShiroConfiguration {
|
|||||||
shiroFilterFactoryBean.setSecurityManager(securityManager);
|
shiroFilterFactoryBean.setSecurityManager(securityManager);
|
||||||
|
|
||||||
// 配置过滤器规则
|
// 配置过滤器规则
|
||||||
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
|
Map<String, String> filterChainDefinitionMap = setFilterChain();
|
||||||
filterChainDefinitionMap.put("/auth/**/**", "anon"); // 登录接口允许匿名访问
|
|
||||||
filterChainDefinitionMap.put("/unauthorized", "anon"); // 未授权接口允许匿名访问
|
|
||||||
filterChainDefinitionMap.put("/", "anon"); // 首页允许匿名访问
|
|
||||||
filterChainDefinitionMap.put("/info/header-image/get", "anon"); // 信息接口允许匿名访问
|
|
||||||
filterChainDefinitionMap.put("/info/header-user/get", "anon"); // 信息接口允许匿名访问
|
|
||||||
filterChainDefinitionMap.put("/**/**", "authc"); // 其他接口一律拦截(需要Token)
|
|
||||||
|
|
||||||
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
|
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
|
||||||
|
|
||||||
@ -57,4 +52,18 @@ public class ShiroConfiguration {
|
|||||||
public MyRealm myRealm() {
|
public MyRealm myRealm() {
|
||||||
return new MyRealm();
|
return new MyRealm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private static Map<String, String> setFilterChain() {
|
||||||
|
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
|
||||||
|
filterChainDefinitionMap.put("/auth/**/**", "anon"); // 登录接口允许匿名访问
|
||||||
|
filterChainDefinitionMap.put("/unauthorized", "anon"); // 未授权接口允许匿名访问
|
||||||
|
filterChainDefinitionMap.put("/", "anon"); // 首页允许匿名访问
|
||||||
|
filterChainDefinitionMap.put("/info/header-image/get", "anon"); // 信息接口允许匿名访问
|
||||||
|
filterChainDefinitionMap.put("/info/header-user/get", "anon"); // 信息接口允许匿名访问
|
||||||
|
filterChainDefinitionMap.put("/project/header/get", "anon"); // 信息接口允许匿名访问
|
||||||
|
filterChainDefinitionMap.put("/project/get", "anon"); // 信息接口允许匿名访问
|
||||||
|
filterChainDefinitionMap.put("/**/**", "authc"); // 其他接口一律拦截(需要Token)
|
||||||
|
return filterChainDefinitionMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.jsl.oa.controllers;
|
package com.jsl.oa.controllers;
|
||||||
|
|
||||||
import com.jsl.oa.model.doData.info.ProjectShowDO;
|
|
||||||
import com.jsl.oa.model.voData.ProjectInfoVO;
|
import com.jsl.oa.model.voData.ProjectInfoVO;
|
||||||
import com.jsl.oa.model.voData.business.info.CarouselVO;
|
|
||||||
import com.jsl.oa.model.voData.business.info.ProjectShowVO;
|
import com.jsl.oa.model.voData.business.info.ProjectShowVO;
|
||||||
import com.jsl.oa.services.ProjectService;
|
import com.jsl.oa.services.ProjectService;
|
||||||
import com.jsl.oa.utils.BaseResponse;
|
import com.jsl.oa.utils.BaseResponse;
|
||||||
@ -32,7 +30,7 @@ public class ProjectController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/project/get")
|
@GetMapping("/project/get")
|
||||||
public BaseResponse projectGet(){
|
public BaseResponse projectGet() {
|
||||||
return projectService.get();
|
return projectService.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +52,7 @@ public class ProjectController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/project/header/edit")
|
@PutMapping("/project/header/edit")
|
||||||
public BaseResponse projectEditHeader(@RequestBody @Validated ProjectShowVO projectShowVO,@RequestParam Integer id,HttpServletRequest request,@NotNull BindingResult bindingResult) {
|
public BaseResponse projectEditHeader(@RequestBody @Validated ProjectShowVO projectShowVO, @RequestParam Integer id, HttpServletRequest request, @NotNull BindingResult bindingResult) {
|
||||||
log.info("请求接口[PUT]: /project/header/del");
|
log.info("请求接口[PUT]: /project/header/del");
|
||||||
// 参数校验
|
// 参数校验
|
||||||
if (bindingResult.hasErrors()) {
|
if (bindingResult.hasErrors()) {
|
||||||
@ -70,13 +68,14 @@ public class ProjectController {
|
|||||||
|
|
||||||
|
|
||||||
@DeleteMapping("/project/header/del")
|
@DeleteMapping("/project/header/del")
|
||||||
public BaseResponse projectDelHeader(@RequestParam Integer id,HttpServletRequest request) {
|
public BaseResponse projectDelHeader(@RequestParam Integer id, HttpServletRequest request) {
|
||||||
log.info("请求接口[Delete]: /project/header/del");
|
log.info("请求接口[Delete]: /project/header/del");
|
||||||
return projectService.delHeader(id,request);
|
return projectService.delHeader(id, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/project/add")
|
@PostMapping("/project/add")
|
||||||
public BaseResponse projectAdd(@RequestBody @Validated ProjectInfoVO projectAdd, BindingResult bindingResult){
|
public BaseResponse projectAdd(@RequestBody @Validated ProjectInfoVO projectAdd, @NotNull BindingResult bindingResult) {
|
||||||
|
log.info("请求接口[PUT]: /project/header/del");
|
||||||
// 判断是否有参数错误
|
// 判断是否有参数错误
|
||||||
if (bindingResult.hasErrors()) {
|
if (bindingResult.hasErrors()) {
|
||||||
return ResultUtil.error(ErrorCode.REQUEST_BODY_ERROR, Processing.getValidatedErrorList(bindingResult));
|
return ResultUtil.error(ErrorCode.REQUEST_BODY_ERROR, Processing.getValidatedErrorList(bindingResult));
|
||||||
@ -85,7 +84,8 @@ public class ProjectController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/project/edit")
|
@PutMapping("/project/edit")
|
||||||
public BaseResponse projectEdit(@RequestBody @Validated ProjectInfoVO projectEdit, BindingResult bindingResult){
|
public BaseResponse projectEdit(@RequestBody @Validated ProjectInfoVO projectEdit, @NotNull BindingResult bindingResult) {
|
||||||
|
log.info("请求接口[PUT]: /project/header/del");
|
||||||
// 判断是否有参数错误
|
// 判断是否有参数错误
|
||||||
if (bindingResult.hasErrors()) {
|
if (bindingResult.hasErrors()) {
|
||||||
return ResultUtil.error(ErrorCode.REQUEST_BODY_ERROR, Processing.getValidatedErrorList(bindingResult));
|
return ResultUtil.error(ErrorCode.REQUEST_BODY_ERROR, Processing.getValidatedErrorList(bindingResult));
|
||||||
@ -94,7 +94,8 @@ public class ProjectController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/project/cut/user")
|
@GetMapping("/project/cut/user")
|
||||||
public BaseResponse projectGetUserInCutting(@RequestParam Long uid){
|
public BaseResponse projectGetUserInCutting(@RequestParam Long uid) {
|
||||||
|
log.info("请求接口[PUT]: /project/header/del");
|
||||||
// 判断是否有参数错误
|
// 判断是否有参数错误
|
||||||
if (uid == null) {
|
if (uid == null) {
|
||||||
return ResultUtil.error(ErrorCode.PARAMETER_ERROR);
|
return ResultUtil.error(ErrorCode.PARAMETER_ERROR);
|
||||||
@ -103,11 +104,12 @@ public class ProjectController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/project/cut/user/add")
|
@PostMapping("/project/cut/user/add")
|
||||||
public BaseResponse projectAddUserForCutting(@RequestParam Long uid,@RequestParam Long pid){
|
public BaseResponse projectAddUserForCutting(@RequestParam Long uid, @RequestParam Long pid) {
|
||||||
|
log.info("请求接口[PUT]: /project/header/del");
|
||||||
// 判断是否有参数错误
|
// 判断是否有参数错误
|
||||||
if (uid == null || pid == null) {
|
if (uid == null || pid == null) {
|
||||||
return ResultUtil.error(ErrorCode.PARAMETER_ERROR);
|
return ResultUtil.error(ErrorCode.PARAMETER_ERROR);
|
||||||
}
|
}
|
||||||
return projectService.projectAddUserForCutting(uid,pid);
|
return projectService.projectAddUserForCutting(uid, pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class InfoDAO {
|
|||||||
public CarouselDO getCarousel() {
|
public CarouselDO getCarousel() {
|
||||||
String getCarouselSql = infoMapper.getCarousel();
|
String getCarouselSql = infoMapper.getCarousel();
|
||||||
CarouselDO getCarousel = null;
|
CarouselDO getCarousel = null;
|
||||||
if (!getCarouselSql.equals("{}")) {
|
if (getCarouselSql != null && !getCarouselSql.equals("{}")) {
|
||||||
getCarousel = gson.fromJson(getCarouselSql, CarouselDO.class);
|
getCarousel = gson.fromJson(getCarouselSql, CarouselDO.class);
|
||||||
}
|
}
|
||||||
if (getCarousel == null) {
|
if (getCarousel == null) {
|
||||||
|
@ -4,7 +4,6 @@ import com.google.gson.Gson;
|
|||||||
import com.jsl.oa.mapper.ProjectMapper;
|
import com.jsl.oa.mapper.ProjectMapper;
|
||||||
import com.jsl.oa.model.doData.ProjectCuttingDO;
|
import com.jsl.oa.model.doData.ProjectCuttingDO;
|
||||||
import com.jsl.oa.model.doData.ProjectDO;
|
import com.jsl.oa.model.doData.ProjectDO;
|
||||||
import com.jsl.oa.model.doData.info.CarouselDO;
|
|
||||||
import com.jsl.oa.model.doData.info.ProjectShowDO;
|
import com.jsl.oa.model.doData.info.ProjectShowDO;
|
||||||
import com.jsl.oa.model.voData.ProjectInfoVO;
|
import com.jsl.oa.model.voData.ProjectInfoVO;
|
||||||
import com.jsl.oa.utils.BaseResponse;
|
import com.jsl.oa.utils.BaseResponse;
|
||||||
@ -33,9 +32,7 @@ public class ProjectDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExistProject(Long id) {
|
public boolean isExistProject(Long id) {
|
||||||
if(projectMapper.getProjectById(id)==null) {
|
return projectMapper.getProjectById(id) != null;
|
||||||
return false;
|
|
||||||
}else return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ProjectCuttingDO> projectGetUserInCutting(Long uid) {
|
public List<ProjectCuttingDO> projectGetUserInCutting(Long uid) {
|
||||||
@ -43,28 +40,28 @@ public class ProjectDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void projectAddUserForCutting(Long uid, Long pid) {
|
public void projectAddUserForCutting(Long uid, Long pid) {
|
||||||
projectMapper.projectAddUserInCutting(uid,pid);
|
projectMapper.projectAddUserInCutting(uid, pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectShowDO getHeader() {
|
public ProjectShowDO getHeader() {
|
||||||
String getProjectShowSql = projectMapper.getHeader();
|
String getProjectShowSql = projectMapper.getHeader();
|
||||||
ProjectShowDO getProjectShow = null;
|
ProjectShowDO getProjectShow = null;
|
||||||
if (!getProjectShowSql.equals("{}")) {
|
if (getProjectShowSql != null && !getProjectShowSql.equals("{}")) {
|
||||||
getProjectShow = gson.fromJson(getProjectShowSql, ProjectShowDO.class);
|
getProjectShow = gson.fromJson(getProjectShowSql, ProjectShowDO.class);
|
||||||
|
}
|
||||||
|
if (getProjectShow == null) {
|
||||||
|
// 初始化
|
||||||
|
getProjectShow = new ProjectShowDO();
|
||||||
|
getProjectShow.setOrder("desc");
|
||||||
|
getProjectShow.setData(new ArrayList<>());
|
||||||
|
try {
|
||||||
|
projectMapper.insertProjectShow();
|
||||||
|
} catch (DuplicateKeyException ignored) {
|
||||||
}
|
}
|
||||||
if (getProjectShow == null) {
|
}
|
||||||
// 初始化
|
// 获取排序
|
||||||
getProjectShow = new ProjectShowDO();
|
sortProject(getProjectShow);
|
||||||
getProjectShow.setOrder("desc");
|
return getProjectShow;
|
||||||
getProjectShow.setData(new ArrayList<>());
|
|
||||||
try {
|
|
||||||
projectMapper.insertProjectShow();
|
|
||||||
} catch (DuplicateKeyException ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 获取排序
|
|
||||||
sortProject(getProjectShow);
|
|
||||||
return getProjectShow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sortProject(ProjectShowDO projectShowDO) {
|
private void sortProject(ProjectShowDO projectShowDO) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user