Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2-xzb1
This commit is contained in:
commit
fabaff59fb
@ -1,3 +1,3 @@
|
|||||||
-- 新实训标添加组织id
|
-- 新实训标添加组织id
|
||||||
alter table published_training2 add column org_id bigint;
|
alter table rts_published_training2 add column org_id bigint;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
-- 新题库
|
-- 新题库
|
||||||
DROP TABLE IF EXISTS `paper_question`;
|
DROP TABLE IF EXISTS `rts_paper_question`;
|
||||||
CREATE TABLE `paper_question` (
|
CREATE TABLE `rts_paper_question` (
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||||
`type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '类型 选择题=select,判断题=judge,多选题=multi',
|
`type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '类型 选择题=select,判断题=judge,多选题=multi',
|
||||||
`question` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '问题内容',
|
`question` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '问题内容',
|
||||||
|
2
sql/20221015-wei-projectDefaultOrg.sql
Normal file
2
sql/20221015-wei-projectDefaultOrg.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
alter table `joylink`.`project`
|
||||||
|
ADD COLUMN `default_org` bigint NULL comment '默认组织ID' AFTER `server_setting`;
|
@ -20,7 +20,7 @@ public class OrgProjectController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
public List<OrgProjectVO> queryOrgList(@RequestAttribute LoginUserInfoVO loginInfo) {
|
public List<OrgProjectVO> queryOrgList(@RequestAttribute LoginUserInfoVO loginInfo) {
|
||||||
return orgProjectService.queryOrgProjectListByProjectAndUid(loginInfo.getProject(), loginInfo.getAccountVO().getId());
|
return orgProjectService.queryOrgProjectListByProjectAndUid(loginInfo.getProjectInfo(), loginInfo.getAccountVO().getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package club.joylink.rtss.controller.project;
|
package club.joylink.rtss.controller.project;
|
||||||
|
|
||||||
|
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
||||||
import club.joylink.rtss.entity.project.Project;
|
import club.joylink.rtss.entity.project.Project;
|
||||||
import club.joylink.rtss.entity.project.ProjectView;
|
import club.joylink.rtss.entity.project.ProjectView;
|
||||||
import club.joylink.rtss.services.project.ProjectService;
|
import club.joylink.rtss.services.project.ProjectService;
|
||||||
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
import club.joylink.rtss.vo.project.ProjectQueryVO;
|
import club.joylink.rtss.vo.client.org.CompanyVO;
|
||||||
import club.joylink.rtss.vo.project.ProjectVO;
|
import club.joylink.rtss.vo.project.*;
|
||||||
import club.joylink.rtss.vo.project.ProjectViewQueryVO;
|
|
||||||
import club.joylink.rtss.vo.project.ProjectViewVO;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -24,12 +24,12 @@ public class ProjectInfoController {
|
|||||||
private ProjectService projectService;
|
private ProjectService projectService;
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public PageVO<Project> pagingQuery(ProjectQueryVO queryVO) {
|
public PageVO<ProjectInfoVO> pagingQuery(ProjectQueryVO queryVO) {
|
||||||
return projectService.pagingQuery(queryVO);
|
return projectService.pagingQuery(queryVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/all")
|
||||||
public List<Project> getAllProject() {
|
public List<ProjectInfoVO> getAllProject() {
|
||||||
return projectService.getAllProject();
|
return projectService.getAllProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,6 +58,22 @@ public class ProjectInfoController {
|
|||||||
return projectService.checkProjectCode(code);
|
return projectService.checkProjectCode(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping("/setDefaultOrg")
|
||||||
|
public void setProjectDefaultOrg(Long id, Long orgId) {
|
||||||
|
projectService.setProjectDefaultOrg(id, orgId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}/orgList")
|
||||||
|
public List<CompanyVO> orgList(@PathVariable Long id) {
|
||||||
|
return projectService.projectOrgList(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/{id}/createDefaultOrg")
|
||||||
|
public ProjectInfoVO quickCreateDefaultOrg(@PathVariable Long id, String name
|
||||||
|
, @RequestAttribute(AuthenticateInterceptor.LOGIN_USER_KEY) AccountVO user) {
|
||||||
|
return projectService.quickCreateDefaultOrg(id, name, user);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/viewSetting/page")
|
@GetMapping("/viewSetting/page")
|
||||||
public PageVO<ProjectView> projectViewPagingQuery(ProjectViewQueryVO queryVO) {
|
public PageVO<ProjectView> projectViewPagingQuery(ProjectViewQueryVO queryVO) {
|
||||||
return projectService.projectViewPagingQuery(queryVO);
|
return projectService.projectViewPagingQuery(queryVO);
|
||||||
|
@ -15,7 +15,7 @@ import java.util.List;
|
|||||||
@Repository
|
@Repository
|
||||||
public interface PaperQuestionDAO {
|
public interface PaperQuestionDAO {
|
||||||
@Select("<script>" +
|
@Select("<script>" +
|
||||||
"select * from paper_question where 1 = 1 " +
|
"select * from rts_paper_question where 1 = 1 " +
|
||||||
// "<choose>" +
|
// "<choose>" +
|
||||||
// "<when test=\"projectCode == '"+ Project.DEFAULT_PROJECT_CODE +"'\">"+
|
// "<when test=\"projectCode == '"+ Project.DEFAULT_PROJECT_CODE +"'\">"+
|
||||||
// " and project_code is null" +
|
// " and project_code is null" +
|
||||||
|
@ -60,16 +60,16 @@ public class Project {
|
|||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否供前端选择
|
|
||||||
*/
|
|
||||||
private Integer viewShow;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 后端服务设置
|
* 后端服务设置
|
||||||
*/
|
*/
|
||||||
private String serverSetting;
|
private String serverSetting;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认组织ID
|
||||||
|
*/
|
||||||
|
private Long defaultOrg;
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public static boolean isDefault(String code) {
|
public static boolean isDefault(String code) {
|
||||||
return StringUtils.isEmpty(code) || DEFAULT_PROJECT_LABEL.contains(code);
|
return StringUtils.isEmpty(code) || DEFAULT_PROJECT_LABEL.contains(code);
|
||||||
|
@ -61,7 +61,7 @@ public class MinioServiceImpl implements MinioService {
|
|||||||
criteria.andDirectoryEqualTo(queryVO.getDirectory());
|
criteria.andDirectoryEqualTo(queryVO.getDirectory());
|
||||||
}
|
}
|
||||||
if (!StringUtils.isEmpty(queryVO.getTitle())) {
|
if (!StringUtils.isEmpty(queryVO.getTitle())) {
|
||||||
criteria.andTitleLike(queryVO.getTitle());
|
criteria.andTitleLike(String.format("%%%s%%", queryVO.getTitle()));
|
||||||
}
|
}
|
||||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||||
Page<MinioFileInfo> minioFileInfoPage = (Page<MinioFileInfo>) this.minioFileInfoDao.selectByExample(example);
|
Page<MinioFileInfo> minioFileInfoPage = (Page<MinioFileInfo>) this.minioFileInfoDao.selectByExample(example);
|
||||||
|
@ -31,7 +31,6 @@ import club.joylink.rtss.util.VoiceFileUtils;
|
|||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
|
|
||||||
import club.joylink.rtss.vo.client.competition.*;
|
import club.joylink.rtss.vo.client.competition.*;
|
||||||
import club.joylink.rtss.vo.client.order.OrderCreateVO;
|
import club.joylink.rtss.vo.client.order.OrderCreateVO;
|
||||||
import club.joylink.rtss.vo.client.order.OrderDetailCreateVO;
|
import club.joylink.rtss.vo.client.order.OrderDetailCreateVO;
|
||||||
@ -41,6 +40,7 @@ import club.joylink.rtss.vo.client.permission.PermissionVO;
|
|||||||
import club.joylink.rtss.vo.client.script.ScriptActionVO;
|
import club.joylink.rtss.vo.client.script.ScriptActionVO;
|
||||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||||
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
|
||||||
|
import club.joylink.rtss.vo.client.voice.VoiceRecognitionResult;
|
||||||
import club.joylink.rtss.vo.map.MapVO;
|
import club.joylink.rtss.vo.map.MapVO;
|
||||||
import club.joylink.rtss.vo.project.ProjectVO;
|
import club.joylink.rtss.vo.project.ProjectVO;
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
|
@ -4,6 +4,7 @@ import club.joylink.rtss.entity.org.OrgProject;
|
|||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.client.org.OrgProjectVO;
|
import club.joylink.rtss.vo.client.org.OrgProjectVO;
|
||||||
|
import club.joylink.rtss.vo.project.ProjectVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ public interface IOrgProjectService {
|
|||||||
/**
|
/**
|
||||||
* 根据项目获取组织列表
|
* 根据项目获取组织列表
|
||||||
*/
|
*/
|
||||||
List<OrgProjectVO> queryOrgProjectListByProjectAndUid(String project, Long uid);
|
List<OrgProjectVO> queryOrgProjectListByProjectAndUid(ProjectVO projectInfo, Long uid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 选择登入项目
|
* 选择登入项目
|
||||||
|
@ -15,6 +15,7 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
|||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.client.org.OrgProjectVO;
|
import club.joylink.rtss.vo.client.org.OrgProjectVO;
|
||||||
|
import club.joylink.rtss.vo.project.ProjectVO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -46,71 +47,53 @@ public class OrgProjectService implements IOrgProjectService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OrgProjectVO> queryOrgProjectListByProjectAndUid(String project, Long uid) {
|
public List<OrgProjectVO> queryOrgProjectListByProjectAndUid(ProjectVO projectInfo, Long uid) {
|
||||||
// 查询项目关联顶级组织
|
// 查询项目关联顶级组织
|
||||||
OrgProjectExample orgProjectExample = new OrgProjectExample();
|
List<OrgProject> orgProjectList = queryOrgProjectList(projectInfo.getValue());
|
||||||
orgProjectExample.createCriteria().andProjectCodeEqualTo(project);
|
|
||||||
List<OrgProject> orgProjectList = orgProjectDao.selectByExample(orgProjectExample);
|
|
||||||
if (CollectionUtils.isEmpty(orgProjectList)) {
|
if (CollectionUtils.isEmpty(orgProjectList)) {
|
||||||
return List.of();
|
throw new SimulationException(SimulationExceptionType.System_Fault, "项目无关联组织");
|
||||||
}
|
}
|
||||||
// 获取人员关联组织
|
// 获取人员关联组织
|
||||||
OrgUserExample example = new OrgUserExample();
|
List<OrgUser> orgUserList = queryOrgUser(uid);
|
||||||
example.createCriteria().andUserIdEqualTo(uid);
|
List<Long> orgIdList = null;
|
||||||
List<OrgUser> orgUserList = orgUserDAO.selectByExample(example);
|
if (!CollectionUtils.isEmpty(orgUserList)) {
|
||||||
if (CollectionUtils.isEmpty(orgUserList)) {
|
|
||||||
return List.of();
|
|
||||||
}
|
|
||||||
// 用户关联组织ID列表
|
// 用户关联组织ID列表
|
||||||
List<Long> orgIdList = orgUserList.stream().map(OrgUser::getOrgId).distinct().collect(Collectors.toList());
|
List<Long> userOrgIdList = orgUserList.stream().map(OrgUser::getOrgId).distinct().collect(Collectors.toList());
|
||||||
// 用户关联组织信息
|
List<Org> orgList = queryOrgInfoList(userOrgIdList); // 用户组织信息
|
||||||
OrgExample orgExample = new OrgExample();
|
|
||||||
orgExample.createCriteria().andStatusEqualTo(BusinessConsts.Org.Status.VALID).andIdIn(orgIdList);
|
|
||||||
List<Org> orgList = orgDAO.selectByExample(orgExample);
|
|
||||||
if (CollectionUtils.isEmpty(orgUserList)) {
|
|
||||||
return List.of();
|
|
||||||
}
|
|
||||||
List<Long> userOrgTopIdList = orgList.stream().map(Org::getRootId).distinct().collect(Collectors.toList());
|
List<Long> userOrgTopIdList = orgList.stream().map(Org::getRootId).distinct().collect(Collectors.toList());
|
||||||
// 有权限的组织ID
|
// 有权限的组织ID
|
||||||
List<Long> authOrgIdList = orgProjectList.stream().filter(orgProject -> userOrgTopIdList.contains(orgProject.getOrgId()))
|
orgIdList = orgProjectList.stream().filter(orgProject -> userOrgTopIdList.contains(orgProject.getOrgId()))
|
||||||
.map(OrgProject::getOrgId).collect(Collectors.toList());
|
.map(OrgProject::getOrgId).collect(Collectors.toList());
|
||||||
orgExample = new OrgExample();
|
}
|
||||||
orgExample.createCriteria().andStatusEqualTo(BusinessConsts.Org.Status.VALID).andIdIn(authOrgIdList);
|
if (CollectionUtils.isEmpty(orgIdList)) { // 用户没有分配组织
|
||||||
orgList = orgDAO.selectByExample(orgExample);
|
if (projectInfo.getDefaultOrg() != null) { // 存在默认组织
|
||||||
|
orgIdList = List.of(projectInfo.getDefaultOrg());
|
||||||
|
} else { // 没有默认,则获取第一个
|
||||||
|
orgIdList = List.of(orgProjectList.get(0).getOrgId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<Org> orgList = queryOrgInfoList(orgIdList);
|
||||||
return orgList.stream().map(OrgProjectVO::new).collect(Collectors.toList());
|
return orgList.stream().map(OrgProjectVO::new).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void signInOrg(Long orgId, LoginUserInfoVO loginInfo) {
|
public void signInOrg(Long orgId, LoginUserInfoVO loginInfo) {
|
||||||
// 查询项目关联顶级组织
|
// TODO 验证权限
|
||||||
OrgProjectExample orgProjectExample = new OrgProjectExample();
|
|
||||||
orgProjectExample.createCriteria().andProjectCodeEqualTo(loginInfo.getProject()).andOrgIdEqualTo(orgId);
|
Org topOrg = orgDAO.selectByPrimaryKey(orgId);
|
||||||
List<OrgProject> orgProjectList = orgProjectDao.selectByExample(orgProjectExample);
|
|
||||||
if (CollectionUtils.isEmpty(orgProjectList)) {
|
|
||||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
|
|
||||||
}
|
|
||||||
OrgExample orgExample = new OrgExample();
|
|
||||||
orgExample.createCriteria().andStatusEqualTo(BusinessConsts.Org.Status.VALID).andRootIdEqualTo(orgId);
|
|
||||||
List<Org> orgList = orgDAO.selectByExample(orgExample);
|
|
||||||
// 没有顶级项目
|
|
||||||
Org topOrg = orgList.stream().filter(o -> o.getId().equals(o.getRootId())).findFirst().orElse(null);
|
|
||||||
if (topOrg == null) {
|
if (topOrg == null) {
|
||||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
|
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
|
||||||
}
|
}
|
||||||
List<Long> orgIdList = orgList.stream().map(Org::getId).distinct().collect(Collectors.toList());
|
|
||||||
// 检验用户是否有组织信息
|
|
||||||
OrgUserExample example = new OrgUserExample();
|
|
||||||
example.createCriteria().andUserIdEqualTo(loginInfo.getAccountVO().getId()).andOrgIdIn(orgIdList);
|
|
||||||
List<OrgUser> orgUserList = orgUserDAO.selectByExample(example);
|
|
||||||
if (CollectionUtils.isEmpty(orgUserList)) {
|
|
||||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
|
|
||||||
}
|
|
||||||
// 是否是顶级组织的管理员
|
// 是否是顶级组织的管理员
|
||||||
OrgUser orgUser = orgUserList.stream().filter(o -> loginInfo.getAccountVO().getId().longValue() == o.getUserId().longValue()
|
OrgUserExample example = new OrgUserExample();
|
||||||
&& o.getOrgId().longValue() == orgId.longValue()).findFirst().orElse(null);
|
example.createCriteria().andUserIdEqualTo(loginInfo.getAccountVO().getId()).andOrgIdEqualTo(orgId);
|
||||||
|
List<OrgUser> orgUserList = orgUserDAO.selectByExample(example);
|
||||||
OrgProjectVO orgProjectVO = new OrgProjectVO(topOrg);
|
OrgProjectVO orgProjectVO = new OrgProjectVO(topOrg);
|
||||||
if (orgUser != null) {
|
if (!CollectionUtils.isEmpty(orgUserList)) {
|
||||||
orgProjectVO.setRole(orgUser.getRole());
|
List<String> roleList = orgUserList.stream().map(OrgUser::getRole).collect(Collectors.toList());
|
||||||
|
orgProjectVO.setRole(roleList);
|
||||||
|
} else {
|
||||||
|
orgProjectVO.setRole(List.of());
|
||||||
}
|
}
|
||||||
loginInfo.setOrgProjectVO(orgProjectVO);
|
loginInfo.setOrgProjectVO(orgProjectVO);
|
||||||
}
|
}
|
||||||
@ -171,4 +154,31 @@ public class OrgProjectService implements IOrgProjectService {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据项目编码获取组织与项目的关联信息
|
||||||
|
*/
|
||||||
|
private List<OrgProject> queryOrgProjectList(String projectCode) {
|
||||||
|
OrgProjectExample orgProjectExample = new OrgProjectExample();
|
||||||
|
orgProjectExample.createCriteria().andProjectCodeEqualTo(projectCode);
|
||||||
|
return orgProjectDao.selectByExample(orgProjectExample);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID获取组织与用户的信息
|
||||||
|
*/
|
||||||
|
private List<OrgUser> queryOrgUser(Long uid) {
|
||||||
|
OrgUserExample example = new OrgUserExample();
|
||||||
|
example.createCriteria().andUserIdEqualTo(uid);
|
||||||
|
return orgUserDAO.selectByExample(example);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据组织ID获取组织信息
|
||||||
|
*/
|
||||||
|
private List<Org> queryOrgInfoList(List<Long> orgIdList) {
|
||||||
|
OrgExample orgExample = new OrgExample();
|
||||||
|
orgExample.createCriteria().andStatusEqualTo(BusinessConsts.Org.Status.VALID).andIdIn(orgIdList);
|
||||||
|
return orgDAO.selectByExample(orgExample);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,8 @@ public class PagerQuestionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询列表
|
* 查询列表
|
||||||
* @param queryVO
|
* @param queryVO
|
||||||
* @param isPaging
|
* @param isPaging
|
||||||
* @param companyIdCanNull 是否允许公司组织id可以为空,true=管理使用,false = 组织使用
|
* @param companyIdCanNull 是否允许公司组织id可以为空,true=管理使用,false = 组织使用
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -68,7 +68,7 @@ public class PagerQuestionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取题库分页列表
|
* 获取题库分页列表
|
||||||
* @param queryVO
|
* @param queryVO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public PageVO<PaperQuestionVO> pagingQueryQuestions(QuestionQueryVO queryVO,boolean companyIdCanNull) {
|
public PageVO<PaperQuestionVO> pagingQueryQuestions(QuestionQueryVO queryVO,boolean companyIdCanNull) {
|
||||||
@ -80,7 +80,7 @@ public class PagerQuestionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取题型列表
|
* 获取题型列表
|
||||||
* @param queryVO
|
* @param queryVO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<PaperQuestionVO> queryQuestions(QuestionQueryVO queryVO,boolean companyIdCanNull) {
|
public List<PaperQuestionVO> queryQuestions(QuestionQueryVO queryVO,boolean companyIdCanNull) {
|
||||||
@ -92,7 +92,7 @@ public class PagerQuestionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取题型所有数据
|
* 获取题型所有数据
|
||||||
* @param questionId
|
* @param questionId
|
||||||
* @param doNotCheckDel 是否检测数据状态是否删除 true = 不检测,false=检测
|
* @param doNotCheckDel 是否检测数据状态是否删除 true = 不检测,false=检测
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -166,8 +166,8 @@ public class PagerQuestionService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据公司id和标签或类型查询
|
* 根据公司id和标签或类型查询
|
||||||
* @param companyId
|
* @param companyId
|
||||||
* @param queryVO
|
* @param queryVO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<PaperQuestionVO> queryQuestionsForRaceLable(Long companyId, PagerLableQueryVO queryVO) {
|
public List<PaperQuestionVO> queryQuestionsForRaceLable(Long companyId, PagerLableQueryVO queryVO) {
|
||||||
@ -185,8 +185,8 @@ public class PagerQuestionService {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 添加修改
|
* 添加修改
|
||||||
* @param questionVO
|
* @param questionVO
|
||||||
* @param accountVO
|
* @param accountVO
|
||||||
*/
|
*/
|
||||||
public void saveOrUpdate(PaperQuestionVO questionVO, AccountVO accountVO) {
|
public void saveOrUpdate(PaperQuestionVO questionVO, AccountVO accountVO) {
|
||||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.isNull(questionVO.getOrgId()),"组织id不能为空");
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.isNull(questionVO.getOrgId()),"组织id不能为空");
|
||||||
|
@ -2,11 +2,10 @@ package club.joylink.rtss.services.project;
|
|||||||
|
|
||||||
import club.joylink.rtss.entity.project.Project;
|
import club.joylink.rtss.entity.project.Project;
|
||||||
import club.joylink.rtss.entity.project.ProjectView;
|
import club.joylink.rtss.entity.project.ProjectView;
|
||||||
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
import club.joylink.rtss.vo.project.ProjectQueryVO;
|
import club.joylink.rtss.vo.client.org.CompanyVO;
|
||||||
import club.joylink.rtss.vo.project.ProjectVO;
|
import club.joylink.rtss.vo.project.*;
|
||||||
import club.joylink.rtss.vo.project.ProjectViewQueryVO;
|
|
||||||
import club.joylink.rtss.vo.project.ProjectViewVO;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -18,12 +17,12 @@ public interface ProjectService {
|
|||||||
/**
|
/**
|
||||||
* 分页
|
* 分页
|
||||||
*/
|
*/
|
||||||
PageVO<Project> pagingQuery(ProjectQueryVO queryVO);
|
PageVO<ProjectInfoVO> pagingQuery(ProjectQueryVO queryVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
*/
|
*/
|
||||||
List<Project> getAllProject();
|
List<ProjectInfoVO> getAllProject();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目Id请求项目信息
|
* 项目Id请求项目信息
|
||||||
@ -50,6 +49,21 @@ public interface ProjectService {
|
|||||||
*/
|
*/
|
||||||
boolean checkProjectCode(String code);
|
boolean checkProjectCode(String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置项目默认组织
|
||||||
|
*/
|
||||||
|
void setProjectDefaultOrg(Long id, Long orgId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据项目ID获取与项目关联的所有组织信息
|
||||||
|
*/
|
||||||
|
List<CompanyVO> projectOrgList(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快速创建默认组织
|
||||||
|
*/
|
||||||
|
ProjectInfoVO quickCreateDefaultOrg(Long id, String name, AccountVO user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 前端设置信息分页
|
* 前端设置信息分页
|
||||||
*/
|
*/
|
||||||
|
@ -1,18 +1,24 @@
|
|||||||
package club.joylink.rtss.services.project;
|
package club.joylink.rtss.services.project;
|
||||||
|
|
||||||
|
import club.joylink.rtss.dao.OrgDAO;
|
||||||
|
import club.joylink.rtss.dao.org.OrgProjectDao;
|
||||||
import club.joylink.rtss.dao.project.ProjectDAO;
|
import club.joylink.rtss.dao.project.ProjectDAO;
|
||||||
import club.joylink.rtss.dao.project.ProjectViewDAO;
|
import club.joylink.rtss.dao.project.ProjectViewDAO;
|
||||||
|
import club.joylink.rtss.entity.Org;
|
||||||
|
import club.joylink.rtss.entity.OrgExample;
|
||||||
|
import club.joylink.rtss.entity.org.OrgProject;
|
||||||
|
import club.joylink.rtss.entity.org.OrgProjectExample;
|
||||||
import club.joylink.rtss.entity.project.Project;
|
import club.joylink.rtss.entity.project.Project;
|
||||||
import club.joylink.rtss.entity.project.ProjectExample;
|
import club.joylink.rtss.entity.project.ProjectExample;
|
||||||
import club.joylink.rtss.entity.project.ProjectView;
|
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.services.org.OrgService;
|
||||||
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.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
import club.joylink.rtss.vo.project.ProjectQueryVO;
|
import club.joylink.rtss.vo.client.org.CompanyVO;
|
||||||
import club.joylink.rtss.vo.project.ProjectVO;
|
import club.joylink.rtss.vo.project.*;
|
||||||
import club.joylink.rtss.vo.project.ProjectViewQueryVO;
|
|
||||||
import club.joylink.rtss.vo.project.ProjectViewVO;
|
|
||||||
import com.github.pagehelper.Page;
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -24,7 +30,9 @@ import org.springframework.util.CollectionUtils;
|
|||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -40,8 +48,17 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ProjectViewDAO projectViewDAO;
|
private ProjectViewDAO projectViewDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrgProjectDao orgProjectDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrgDAO orgDAO;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrgService orgService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageVO<Project> pagingQuery(ProjectQueryVO queryVO) {
|
public PageVO<ProjectInfoVO> pagingQuery(ProjectQueryVO queryVO) {
|
||||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||||
ProjectExample projectExample = new ProjectExample();
|
ProjectExample projectExample = new ProjectExample();
|
||||||
ProjectExample.Criteria criteria = projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS);
|
ProjectExample.Criteria criteria = projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS);
|
||||||
@ -49,17 +66,19 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
criteria.andCodeEqualTo(queryVO.getCode());
|
criteria.andCodeEqualTo(queryVO.getCode());
|
||||||
}
|
}
|
||||||
if (!StringUtils.isEmpty(queryVO.getName())) {
|
if (!StringUtils.isEmpty(queryVO.getName())) {
|
||||||
criteria.andNameLike(queryVO.getName());
|
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
|
||||||
}
|
}
|
||||||
Page<Project> page = (Page<Project>) projectDAO.selectWithBLOBsByExample(projectExample);
|
Page<Project> page = (Page<Project>) projectDAO.selectWithBLOBsByExample(projectExample);
|
||||||
return PageVO.convert(page, page.getResult());
|
List<ProjectInfoVO> projectVOList = handleProjectOrgInfo(page.getResult());
|
||||||
|
return PageVO.convert(page, projectVOList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Project> getAllProject() {
|
public List<ProjectInfoVO> getAllProject() {
|
||||||
ProjectExample projectExample = new ProjectExample();
|
ProjectExample projectExample = new ProjectExample();
|
||||||
projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS);
|
projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS);
|
||||||
return projectDAO.selectByExample(projectExample);
|
List<Project> projectList = projectDAO.selectWithBLOBsByExample(projectExample);
|
||||||
|
return handleProjectOrgInfo(projectList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -119,6 +138,55 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
return num > 0;
|
return num > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@CacheEvict(cacheNames = "project", allEntries = true)
|
||||||
|
public void setProjectDefaultOrg(Long id, Long orgId) {
|
||||||
|
Project project = new Project();
|
||||||
|
project.setId(id);
|
||||||
|
project.setDefaultOrg(orgId);
|
||||||
|
projectDAO.updateByPrimaryKeySelective(project);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CompanyVO> projectOrgList(Long id) {
|
||||||
|
Project project = projectDAO.selectByPrimaryKey(id);
|
||||||
|
if (project == null) {
|
||||||
|
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "项目不存在");
|
||||||
|
}
|
||||||
|
List<OrgProject> orgProjectList = getOrgProjectList(List.of(project.getCode()));
|
||||||
|
if (!CollectionUtils.isEmpty(orgProjectList)) {
|
||||||
|
List<Long> orgIdList = orgProjectList.stream().map(OrgProject::getOrgId).distinct().collect(Collectors.toList());
|
||||||
|
List<Org> orgList = getOrgList(orgIdList);
|
||||||
|
return orgList.stream().map(CompanyVO::simpleInfoVO).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@CacheEvict(cacheNames = "project", allEntries = true)
|
||||||
|
public ProjectInfoVO quickCreateDefaultOrg(Long id, String name, AccountVO user) {
|
||||||
|
Project project = projectDAO.selectByPrimaryKey(id);
|
||||||
|
if (project == null) {
|
||||||
|
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "项目不存在");
|
||||||
|
}
|
||||||
|
List<OrgProject> orgProjectList = getOrgProjectList(List.of(project.getCode()));
|
||||||
|
if (!CollectionUtils.isEmpty(orgProjectList)) {
|
||||||
|
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "存在关联组织,请设置");
|
||||||
|
}
|
||||||
|
// 保存默认组织
|
||||||
|
CompanyVO companyVO = new CompanyVO();
|
||||||
|
companyVO.setName(name);
|
||||||
|
companyVO.setProjectCodes(List.of(project.getCode()));
|
||||||
|
CompanyVO resultCompany = orgService.createTopOrg(companyVO, user);
|
||||||
|
// 修改项目信息
|
||||||
|
setProjectDefaultOrg(id, resultCompany.getId());
|
||||||
|
ProjectInfoVO projectVO = new ProjectInfoVO(project);
|
||||||
|
projectVO.setOrgList(List.of(name));
|
||||||
|
projectVO.setDefaultOrgName(name);
|
||||||
|
return projectVO;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageVO<ProjectView> projectViewPagingQuery(ProjectViewQueryVO queryVO) {
|
public PageVO<ProjectView> projectViewPagingQuery(ProjectViewQueryVO queryVO) {
|
||||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||||
@ -208,7 +276,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
@Override
|
@Override
|
||||||
public List<ProjectVO> getSimpleProjectList() {
|
public List<ProjectVO> getSimpleProjectList() {
|
||||||
ProjectExample projectExample = new ProjectExample();
|
ProjectExample projectExample = new ProjectExample();
|
||||||
projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS).andViewShowEqualTo(1);
|
projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS);
|
||||||
List<Project> projectList = projectDAO.selectWithBLOBsByExample(projectExample);
|
List<Project> projectList = projectDAO.selectWithBLOBsByExample(projectExample);
|
||||||
return projectList.stream().map(project -> new ProjectVO(project)).collect(Collectors.toList());
|
return projectList.stream().map(project -> new ProjectVO(project)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
@ -242,4 +310,51 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
List<ProjectView> projectList = projectViewDAO.selectWithBLOBsByExample(new ProjectViewExample());
|
List<ProjectView> projectList = projectViewDAO.selectWithBLOBsByExample(new ProjectViewExample());
|
||||||
return projectList.stream().map(projectView -> new ProjectViewVO(projectView)).collect(Collectors.toList());
|
return projectList.stream().map(projectView -> new ProjectViewVO(projectView)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<OrgProject> getOrgProjectList(List<String> projectCodeList) {
|
||||||
|
OrgProjectExample orgProjectExample = new OrgProjectExample();
|
||||||
|
orgProjectExample.createCriteria().andProjectCodeIn(projectCodeList);
|
||||||
|
return orgProjectDao.selectByExample(orgProjectExample);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Org> getOrgList(List<Long> orgIdList) {
|
||||||
|
OrgExample orgExample = new OrgExample();
|
||||||
|
orgExample.createCriteria().andIdIn(orgIdList);
|
||||||
|
return orgDAO.selectByExample(orgExample);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询项目列表时,关联组织信息
|
||||||
|
*/
|
||||||
|
private List<ProjectInfoVO> handleProjectOrgInfo(List<Project> projectList) {
|
||||||
|
List<String> projectCodeList = projectList.stream().map(Project::getCode).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(projectCodeList)) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
List<OrgProject> orgProjectList = getOrgProjectList(projectCodeList);
|
||||||
|
Map<Long, Org> orgMap = new HashMap<>();
|
||||||
|
Map<String, List<Long>> orgProjectMap = new HashMap<>(orgProjectList.size());
|
||||||
|
if (!CollectionUtils.isEmpty(orgProjectList)) {
|
||||||
|
List<Long> orgIdList = orgProjectList.stream().map(OrgProject::getOrgId).distinct().collect(Collectors.toList());
|
||||||
|
List<Org> orgList = getOrgList(orgIdList);
|
||||||
|
orgMap.putAll(orgList.stream().collect(Collectors.toMap(Org::getId, o -> o)));
|
||||||
|
orgProjectMap.putAll(orgProjectList.stream().collect(Collectors.groupingBy(OrgProject::getProjectCode, Collectors.mapping(OrgProject::getOrgId, Collectors.toList()))));
|
||||||
|
}
|
||||||
|
// 包装projectVO
|
||||||
|
List<ProjectInfoVO> projectVOList = projectList.stream().map(p -> {
|
||||||
|
ProjectInfoVO projectVO = new ProjectInfoVO(p);
|
||||||
|
if (orgProjectMap.containsKey(p.getCode())) {
|
||||||
|
List<String> orgNameList = orgProjectMap.get(p.getCode()).stream().filter(id -> orgMap.containsKey(id))
|
||||||
|
.map(id -> orgMap.get(id).getName()).sorted().collect(Collectors.toList());
|
||||||
|
projectVO.setOrgList(orgNameList);
|
||||||
|
} else {
|
||||||
|
projectVO.setOrgList(List.of());
|
||||||
|
}
|
||||||
|
if (p.getDefaultOrg() != null && orgMap.containsKey(p.getDefaultOrg())) {
|
||||||
|
projectVO.setDefaultOrgName(orgMap.get(p.getDefaultOrg()).getName());
|
||||||
|
}
|
||||||
|
return projectVO;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return projectVOList;
|
||||||
|
}
|
||||||
}
|
}
|
@ -740,42 +740,70 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
/** 地铁 */
|
/**
|
||||||
|
* 地铁
|
||||||
|
*/
|
||||||
METRO,
|
METRO,
|
||||||
/** 铁路/大铁 */
|
/**
|
||||||
|
* 铁路/大铁
|
||||||
|
*/
|
||||||
RAILWAY,
|
RAILWAY,
|
||||||
/** 应急调度(Emergency dispatching command system) */
|
/**
|
||||||
|
* 应急调度(Emergency dispatching command system)
|
||||||
|
*/
|
||||||
EMERGENCY,
|
EMERGENCY,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Usage {
|
public enum Usage {
|
||||||
/** 单角色仿真 */
|
/**
|
||||||
|
* 单角色仿真
|
||||||
|
*/
|
||||||
SINGLE_MEMBER,
|
SINGLE_MEMBER,
|
||||||
/** 单客户端仿真 */
|
/**
|
||||||
|
* 单客户端仿真
|
||||||
|
*/
|
||||||
SINGLE_CLIENT,
|
SINGLE_CLIENT,
|
||||||
/** 综合演练 */
|
/**
|
||||||
|
* 综合演练
|
||||||
|
*/
|
||||||
JOINT,
|
JOINT,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Function {
|
public enum Function {
|
||||||
/** 大客流(Large passenger flow) */
|
/**
|
||||||
|
* 大客流(Large passenger flow)
|
||||||
|
*/
|
||||||
LPF,
|
LPF,
|
||||||
/** 实训室 */
|
/**
|
||||||
|
* 实训室
|
||||||
|
*/
|
||||||
TRAINING_ROOM,
|
TRAINING_ROOM,
|
||||||
/** 实训设计 */
|
/**
|
||||||
|
* 实训设计
|
||||||
|
*/
|
||||||
TRAINING_DESIGN,
|
TRAINING_DESIGN,
|
||||||
/** 实训 */
|
/**
|
||||||
|
* 实训
|
||||||
|
*/
|
||||||
TRAINING,
|
TRAINING,
|
||||||
/** 考试 */
|
/**
|
||||||
|
* 考试
|
||||||
|
*/
|
||||||
EXAM,
|
EXAM,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Client {
|
public enum Client {
|
||||||
/** 联锁 */
|
/**
|
||||||
|
* 联锁
|
||||||
|
*/
|
||||||
INTERLOCK,
|
INTERLOCK,
|
||||||
/** 大屏 */
|
/**
|
||||||
|
* 大屏
|
||||||
|
*/
|
||||||
BIG_SCREEN,
|
BIG_SCREEN,
|
||||||
/** 综合监控 */
|
/**
|
||||||
|
* 综合监控
|
||||||
|
*/
|
||||||
ISCS,
|
ISCS,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,9 @@ public class CompanyVO {
|
|||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
private String code;
|
private String code;
|
||||||
/**公司名称*/
|
/**
|
||||||
|
* 公司名称
|
||||||
|
*/
|
||||||
@NotBlank(message = "公司名称不能为空")
|
@NotBlank(message = "公司名称不能为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ -39,6 +41,13 @@ public class CompanyVO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CompanyVO simpleInfoVO(Org entity) {
|
||||||
|
CompanyVO companyVO = new CompanyVO();
|
||||||
|
companyVO.setId(entity.getId());
|
||||||
|
companyVO.setName(entity.getName());
|
||||||
|
return companyVO;
|
||||||
|
}
|
||||||
|
|
||||||
public static List<CompanyVO> convert2VOList(List<Org> dataList) {
|
public static List<CompanyVO> convert2VOList(List<Org> dataList) {
|
||||||
List<CompanyVO> voList = new ArrayList<>();
|
List<CompanyVO> voList = new ArrayList<>();
|
||||||
for (Org entity : dataList) {
|
for (Org entity : dataList) {
|
||||||
|
@ -4,6 +4,8 @@ import club.joylink.rtss.entity.Org;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class OrgProjectVO {
|
public class OrgProjectVO {
|
||||||
@ -13,7 +15,7 @@ public class OrgProjectVO {
|
|||||||
|
|
||||||
private Long topOrgId;
|
private Long topOrgId;
|
||||||
|
|
||||||
private String role;
|
private List<String> role;
|
||||||
|
|
||||||
public OrgProjectVO(Org org) {
|
public OrgProjectVO(Org org) {
|
||||||
this.orgId = org.getId();
|
this.orgId = org.getId();
|
||||||
|
@ -0,0 +1,74 @@
|
|||||||
|
package club.joylink.rtss.vo.project;
|
||||||
|
|
||||||
|
import club.joylink.rtss.entity.project.Project;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目信息管理展示实体
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
public class ProjectInfoVO {
|
||||||
|
/**
|
||||||
|
* 数据库唯一ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目编码,后端使用
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 后端服务设置
|
||||||
|
*/
|
||||||
|
private String serverSetting;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联组织名称
|
||||||
|
*/
|
||||||
|
private List<String> orgList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认组织ID
|
||||||
|
*/
|
||||||
|
private Long defaultOrg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认组织名称
|
||||||
|
*/
|
||||||
|
private String defaultOrgName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否可以创建默认组织
|
||||||
|
*/
|
||||||
|
private boolean createDefaultOrg;
|
||||||
|
|
||||||
|
public ProjectInfoVO(Project project) {
|
||||||
|
this.id = project.getId();
|
||||||
|
this.code = project.getCode();
|
||||||
|
this.name = project.getName();
|
||||||
|
this.description = project.getDescription();
|
||||||
|
this.serverSetting = project.getServerSetting();
|
||||||
|
this.defaultOrg = project.getDefaultOrg();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrgList(List<String> orgList) {
|
||||||
|
this.orgList = orgList;
|
||||||
|
this.createDefaultOrg = CollectionUtils.isEmpty(orgList);
|
||||||
|
}
|
||||||
|
}
|
@ -24,9 +24,13 @@ public class ProjectVO {
|
|||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private ProjectServerConfig projectServerConfig;
|
private ProjectServerConfig projectServerConfig;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
private Long defaultOrg;
|
||||||
|
|
||||||
public ProjectVO(Project project) {
|
public ProjectVO(Project project) {
|
||||||
this.label = project.getName();
|
this.label = project.getName();
|
||||||
this.value = project.getCode();
|
this.value = project.getCode();
|
||||||
|
this.defaultOrg = project.getDefaultOrg();
|
||||||
if (StringUtils.isEmpty(project.getServerSetting())) {
|
if (StringUtils.isEmpty(project.getServerSetting())) {
|
||||||
this.projectServerConfig = null;
|
this.projectServerConfig = null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -87,7 +87,7 @@
|
|||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
,
|
,
|
||||||
<include refid="Blob_Column_List" />
|
<include refid="Blob_Column_List" />
|
||||||
from paper_question
|
from rts_paper_question
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Example_Where_Clause" />
|
<include refid="Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
@ -109,7 +109,7 @@
|
|||||||
distinct
|
distinct
|
||||||
</if>
|
</if>
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
from paper_question
|
from rts_paper_question
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Example_Where_Clause" />
|
<include refid="Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
@ -130,21 +130,21 @@
|
|||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
,
|
,
|
||||||
<include refid="Blob_Column_List" />
|
<include refid="Blob_Column_List" />
|
||||||
from paper_question
|
from rts_paper_question
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</select>
|
</select>
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||||
delete from paper_question
|
delete from rts_paper_question
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</delete>
|
</delete>
|
||||||
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionExample">
|
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionExample">
|
||||||
delete from paper_question
|
delete from rts_paper_question
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Example_Where_Clause" />
|
<include refid="Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs">
|
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs">
|
||||||
insert into paper_question (id, `type`, create_user_id,
|
insert into rts_paper_question (id, `type`, create_user_id,
|
||||||
create_time, org_id, tags,
|
create_time, org_id, tags,
|
||||||
question_answer, is_del, question,
|
question_answer, is_del, question,
|
||||||
question_option)
|
question_option)
|
||||||
@ -154,7 +154,7 @@
|
|||||||
#{questionOption,jdbcType=LONGVARCHAR})
|
#{questionOption,jdbcType=LONGVARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs">
|
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs">
|
||||||
insert into paper_question
|
insert into rts_paper_question
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
id,
|
id,
|
||||||
@ -221,13 +221,13 @@
|
|||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<select id="countByExample" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionExample" resultType="java.lang.Long">
|
<select id="countByExample" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionExample" resultType="java.lang.Long">
|
||||||
select count(*) from paper_question
|
select count(*) from rts_paper_question
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Example_Where_Clause" />
|
<include refid="Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<update id="updateByExampleSelective" parameterType="map">
|
<update id="updateByExampleSelective" parameterType="map">
|
||||||
update paper_question
|
update rts_paper_question
|
||||||
<set>
|
<set>
|
||||||
<if test="record.id != null">
|
<if test="record.id != null">
|
||||||
id = #{record.id,jdbcType=BIGINT},
|
id = #{record.id,jdbcType=BIGINT},
|
||||||
@ -265,7 +265,7 @@
|
|||||||
</if>
|
</if>
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByExampleWithBLOBs" parameterType="map">
|
<update id="updateByExampleWithBLOBs" parameterType="map">
|
||||||
update paper_question
|
update rts_paper_question
|
||||||
set id = #{record.id,jdbcType=BIGINT},
|
set id = #{record.id,jdbcType=BIGINT},
|
||||||
`type` = #{record.type,jdbcType=VARCHAR},
|
`type` = #{record.type,jdbcType=VARCHAR},
|
||||||
create_user_id = #{record.createUserId,jdbcType=BIGINT},
|
create_user_id = #{record.createUserId,jdbcType=BIGINT},
|
||||||
@ -281,7 +281,7 @@
|
|||||||
</if>
|
</if>
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByExample" parameterType="map">
|
<update id="updateByExample" parameterType="map">
|
||||||
update paper_question
|
update rts_paper_question
|
||||||
set id = #{record.id,jdbcType=BIGINT},
|
set id = #{record.id,jdbcType=BIGINT},
|
||||||
`type` = #{record.type,jdbcType=VARCHAR},
|
`type` = #{record.type,jdbcType=VARCHAR},
|
||||||
create_user_id = #{record.createUserId,jdbcType=BIGINT},
|
create_user_id = #{record.createUserId,jdbcType=BIGINT},
|
||||||
@ -295,7 +295,7 @@
|
|||||||
</if>
|
</if>
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs">
|
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs">
|
||||||
update paper_question
|
update rts_paper_question
|
||||||
<set>
|
<set>
|
||||||
<if test="type != null">
|
<if test="type != null">
|
||||||
`type` = #{type,jdbcType=VARCHAR},
|
`type` = #{type,jdbcType=VARCHAR},
|
||||||
@ -328,7 +328,7 @@
|
|||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs">
|
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs">
|
||||||
update paper_question
|
update rts_paper_question
|
||||||
set `type` = #{type,jdbcType=VARCHAR},
|
set `type` = #{type,jdbcType=VARCHAR},
|
||||||
create_user_id = #{createUserId,jdbcType=BIGINT},
|
create_user_id = #{createUserId,jdbcType=BIGINT},
|
||||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
@ -341,7 +341,7 @@
|
|||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestion">
|
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.paper.question.PaperQuestion">
|
||||||
update paper_question
|
update rts_paper_question
|
||||||
set `type` = #{type,jdbcType=VARCHAR},
|
set `type` = #{type,jdbcType=VARCHAR},
|
||||||
create_user_id = #{createUserId,jdbcType=BIGINT},
|
create_user_id = #{createUserId,jdbcType=BIGINT},
|
||||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||||
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
||||||
<result column="status" property="status" jdbcType="INTEGER"/>
|
<result column="status" property="status" jdbcType="INTEGER"/>
|
||||||
<result column="view_show" property="viewShow" jdbcType="INTEGER"/>
|
<result column="default_org" property="defaultOrg" jdbcType="BIGINT"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.project.Project" extends="BaseResultMap">
|
<resultMap id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.project.Project" extends="BaseResultMap">
|
||||||
<result column="description" property="description" jdbcType="LONGVARCHAR"/>
|
<result column="description" property="description" jdbcType="LONGVARCHAR"/>
|
||||||
@ -75,7 +75,7 @@
|
|||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, code, name, create_time, update_time, status, view_show
|
id, code, name, create_time, update_time, status, default_org
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
description,server_setting
|
description,server_setting
|
||||||
@ -146,10 +146,10 @@
|
|||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<insert id="insert" parameterType="club.joylink.rtss.entity.project.Project">
|
<insert id="insert" parameterType="club.joylink.rtss.entity.project.Project">
|
||||||
insert into project ( code, name, description, create_time, update_time, status, server_setting,view_show)
|
insert into project ( code, name, description, create_time, update_time, status, server_setting,default_org)
|
||||||
values (#{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR},
|
values (#{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR},
|
||||||
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER},
|
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER},
|
||||||
#{serverSetting,jdbcType=LONGVARCHAR},#{viewShow,jdbcType=INTEGER})
|
#{serverSetting,jdbcType=LONGVARCHAR}, #{defaultOrg, jdbcType=BIGINT})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.project.Project">
|
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.project.Project">
|
||||||
@ -179,8 +179,8 @@
|
|||||||
<if test="serverSetting != null">
|
<if test="serverSetting != null">
|
||||||
server_setting,
|
server_setting,
|
||||||
</if>
|
</if>
|
||||||
<if test="viewShow != null">
|
<if test="defaultOrg != null">
|
||||||
view_show,
|
default_org,
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
@ -208,8 +208,8 @@
|
|||||||
<if test="serverSetting != null">
|
<if test="serverSetting != null">
|
||||||
#{serverSetting,jdbcType=LONGVARCHAR},
|
#{serverSetting,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="viewShow != null">
|
<if test="defaultOrg != null">
|
||||||
#{viewShow,jdbcType=INTEGER},
|
#{defaultOrg, jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
@ -238,8 +238,8 @@
|
|||||||
<if test="serverSetting != null">
|
<if test="serverSetting != null">
|
||||||
server_setting = #{serverSetting,jdbcType=LONGVARCHAR},
|
server_setting = #{serverSetting,jdbcType=LONGVARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="viewShow != null">
|
<if test="defaultOrg != null">
|
||||||
view_show = #{viewShow,jdbcType=INTEGER},
|
default_org = #{defaultOrg, jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
</set>
|
</set>
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
@ -254,7 +254,7 @@
|
|||||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||||
status = #{status,jdbcType=INTEGER},
|
status = #{status,jdbcType=INTEGER},
|
||||||
server_setting = #{serverSetting,jdbcType=LONGVARCHAR},
|
server_setting = #{serverSetting,jdbcType=LONGVARCHAR},
|
||||||
view_show = #{viewShow,jdbcType=INTEGER}
|
default_org = #{defaultOrg, jdbcType=BIGINT}
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
@ -266,7 +266,7 @@
|
|||||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||||
status = #{status,jdbcType=INTEGER},
|
status = #{status,jdbcType=INTEGER},
|
||||||
server_setting = #{serverSetting,jdbcType=LONGVARCHAR}
|
default_org = #{defaultOrg, jdbcType=BIGINT}
|
||||||
where id = #{id,jdbcType=BIGINT}
|
where id = #{id,jdbcType=BIGINT}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user