【项目前端设置请求修改】
This commit is contained in:
parent
f2ab1f945d
commit
e6721d69ac
@ -60,6 +60,8 @@ public class WebConfig implements WebMvcConfigurer {
|
|||||||
whiteList.add("/api/projectServer/project/{project}");
|
whiteList.add("/api/projectServer/project/{project}");
|
||||||
whiteList.add("/test/simulation/**");
|
whiteList.add("/test/simulation/**");
|
||||||
whiteList.add("/api/test/**");
|
whiteList.add("/api/test/**");
|
||||||
|
whiteList.add("/api/project/viewSetting/simple/all");
|
||||||
|
whiteList.add("/api/project/viewSetting/project/{project}");
|
||||||
registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList);
|
registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目设备管理接口(新)
|
* 项目设备管理接口(新)
|
||||||
@ -55,7 +54,7 @@ public class ProjectInfoController {
|
|||||||
public List<Project.SimpleProject> queryProjectSimpleInfo() {
|
public List<Project.SimpleProject> queryProjectSimpleInfo() {
|
||||||
return projectService.getSimpleProjectList();
|
return projectService.getSimpleProjectList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/viewSetting/page")
|
@GetMapping("/viewSetting/page")
|
||||||
public PageVO<ProjectView> projectViewPagingQuery(PageQueryVO queryVO) {
|
public PageVO<ProjectView> projectViewPagingQuery(PageQueryVO queryVO) {
|
||||||
return projectService.projectViewPagingQuery(queryVO);
|
return projectService.projectViewPagingQuery(queryVO);
|
||||||
@ -87,8 +86,13 @@ public class ProjectInfoController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/viewSetting/project/{project}")
|
@GetMapping("/viewSetting/project/{project}")
|
||||||
public Map<String, Object> queryProjectViewSetting(@PathVariable String project) {
|
public ProjectView.SimpleProjectView queryProjectViewSetting(@PathVariable String project) {
|
||||||
return projectService.getProjectViewSetting(project);
|
return projectService.getProjectViewSetting(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/viewSetting/simple/all")
|
||||||
|
public List<ProjectView.SimpleProjectView> queryViewAll() {
|
||||||
|
return projectService.queryViewAll();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package club.joylink.rtss.entity.project;
|
package club.joylink.rtss.entity.project;
|
||||||
|
|
||||||
|
import club.joylink.rtss.util.JsonUtils;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
@ -21,4 +25,30 @@ public class ProjectView {
|
|||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
private String viewSetting;
|
private String viewSetting;
|
||||||
|
|
||||||
|
public SimpleProjectView simplifyProjectView() {
|
||||||
|
return new SimpleProjectView(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
|
||||||
|
public static class SimpleProjectView {
|
||||||
|
private String markKey;
|
||||||
|
|
||||||
|
private String project;
|
||||||
|
|
||||||
|
private Map<String, Object> viewSetting;
|
||||||
|
|
||||||
|
public SimpleProjectView(ProjectView projectView) {
|
||||||
|
this.markKey = projectView.getMarkKey();
|
||||||
|
this.project = projectView.getProject();
|
||||||
|
if (StringUtils.isEmpty(projectView.getViewSetting())) {
|
||||||
|
this.viewSetting = new HashMap<>();
|
||||||
|
} else {
|
||||||
|
this.viewSetting = JsonUtils.read(projectView.getViewSetting(), Map.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -6,7 +6,6 @@ import club.joylink.rtss.vo.client.PageQueryVO;
|
|||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目基本信息管理
|
* 项目基本信息管理
|
||||||
@ -86,10 +85,15 @@ public interface ProjectService {
|
|||||||
/**
|
/**
|
||||||
* 更新项目的前端设置信息
|
* 更新项目的前端设置信息
|
||||||
*/
|
*/
|
||||||
Map<String, Object> getProjectViewSetting(String project);
|
ProjectView.SimpleProjectView getProjectViewSetting(String project);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取项目的简要信息,前端关联时使用
|
* 获取项目的简要信息,前端关联时使用
|
||||||
*/
|
*/
|
||||||
List<Project.SimpleProject> getSimpleProjectList();
|
List<Project.SimpleProject> getSimpleProjectList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前端请求所有设置信息
|
||||||
|
*/
|
||||||
|
List<ProjectView.SimpleProjectView> queryViewAll();
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import club.joylink.rtss.entity.project.ProjectView;
|
|||||||
import club.joylink.rtss.entity.project.ProjectViewExample;
|
import club.joylink.rtss.entity.project.ProjectViewExample;
|
||||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||||
import club.joylink.rtss.util.JsonUtils;
|
|
||||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
@ -23,7 +22,6 @@ import org.springframework.util.StringUtils;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -68,7 +66,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(cacheNames = "project", keyGenerator = "projectKeyGenerator")
|
@Cacheable(cacheNames = "project", keyGenerator = "projectKeyGenerator", unless = "#result == null")
|
||||||
public Project queryLoginProjectByCode(String code) {
|
public Project queryLoginProjectByCode(String code) {
|
||||||
String codeKey = Project.isDefault(code) ? Project.DEFAULT_PROJECT_CODE : code;
|
String codeKey = Project.isDefault(code) ? Project.DEFAULT_PROJECT_CODE : code;
|
||||||
ProjectExample projectExample = new ProjectExample();
|
ProjectExample projectExample = new ProjectExample();
|
||||||
@ -170,7 +168,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getProjectViewSetting(String project) {
|
public ProjectView.SimpleProjectView getProjectViewSetting(String project) {
|
||||||
String markKey = Project.isDefault(project) ? Project.DEFAULT_PROJECT_MARK_KEY : project;
|
String markKey = Project.isDefault(project) ? Project.DEFAULT_PROJECT_MARK_KEY : project;
|
||||||
ProjectViewExample projectViewExample = new ProjectViewExample();
|
ProjectViewExample projectViewExample = new ProjectViewExample();
|
||||||
projectViewExample.createCriteria().andStatusEqualTo(Project.EFFECT_PROJECT_STATUS).andMarkKeyEqualTo(markKey);
|
projectViewExample.createCriteria().andStatusEqualTo(Project.EFFECT_PROJECT_STATUS).andMarkKeyEqualTo(markKey);
|
||||||
@ -179,7 +177,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
|
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
|
||||||
}
|
}
|
||||||
ProjectView projectInfo = projectList.get(0);
|
ProjectView projectInfo = projectList.get(0);
|
||||||
return JsonUtils.read(projectInfo.getViewSetting(), Map.class);
|
return projectInfo.simplifyProjectView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -190,4 +188,10 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
List<Project> projectList = projectDAO.selectWithBLOBsByExample(projectExample);
|
List<Project> projectList = projectDAO.selectWithBLOBsByExample(projectExample);
|
||||||
return projectList.stream().map(Project::generateSimpleProject).collect(Collectors.toList());
|
return projectList.stream().map(Project::generateSimpleProject).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ProjectView.SimpleProjectView> queryViewAll() {
|
||||||
|
List<ProjectView> projectList = projectViewDAO.selectWithBLOBsByExample(new ProjectViewExample());
|
||||||
|
return projectList.stream().map(ProjectView::simplifyProjectView).collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user