Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2-zhouyin

This commit is contained in:
tiger_zhou 2022-09-29 09:00:18 +08:00
commit 9dc4a55d17
66 changed files with 1332 additions and 721 deletions

View File

@ -0,0 +1,4 @@
alter table `joylink`.`project`
drop COLUMN `name_en`,
CHANGE COLUMN `simple_name` `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL comment '项目简称' AFTER `code`,
CHANGE COLUMN `name` `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL comment '项目描述' AFTER `name`;

View File

@ -1,7 +1,9 @@
package club.joylink.rtss.controller.paper;
import club.joylink.rtss.services.paper.PaperUserCreateService;
import club.joylink.rtss.services.paper.PaperUserLoadQuestionService;
import club.joylink.rtss.services.paper.PaperUserService;
import club.joylink.rtss.services.paper.PaperUserSubmitAnswerService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.paper.*;
@ -20,6 +22,10 @@ public class PaperUserController {
private PaperUserService paperUserService;
@Autowired
private PaperUserCreateService paperUserCreateService;
@Autowired
private PaperUserLoadQuestionService paperUserLoadQuestionService;
@Autowired
private PaperUserSubmitAnswerService paperUserSubmitAnswerService;
/**
* 根据试卷蓝图生成用户的试卷
@ -71,7 +77,7 @@ public class PaperUserController {
public PaperQuestionLoadRspVo loadQuestion(@PathVariable("groupType") Integer groupType, @PathVariable("qId") Long qId, @RequestAttribute AccountVO user) {
PaperQType.GroupType pgType = PaperQType.GroupType.getItem(groupType);
return null;
return this.paperUserLoadQuestionService.loadQuestion(pgType, qId, user);
}
/**
@ -79,8 +85,7 @@ public class PaperUserController {
*/
@PostMapping("/user/question/answer")
public PaperSubmitAnswerRspVo submitAnswer(@RequestBody PaperSubmitAnswerReqVo req, @RequestAttribute AccountVO user) {
return null;
return this.paperUserSubmitAnswerService.submitAnswer(req, user);
}
/**

View File

@ -5,6 +5,8 @@ import club.joylink.rtss.entity.project.ProjectView;
import club.joylink.rtss.services.project.ProjectService;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.project.ProjectVO;
import club.joylink.rtss.vo.project.ProjectViewVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -50,9 +52,9 @@ public class ProjectInfoController {
projectService.save(project);
}
@GetMapping("/simple")
public List<Project.SimpleProject> queryProjectSimpleInfo() {
return projectService.getSimpleProjectList();
@GetMapping("/check/code")
public boolean checkProjectCode(String code) {
return projectService.checkProjectCode(code);
}
@GetMapping("/viewSetting/page")
@ -85,14 +87,23 @@ public class ProjectInfoController {
projectService.saveProjectView(projectView);
}
@GetMapping("/check/markKey")
public boolean checkProjectViewMarkKey(String markKey) {
return projectService.checkProjectViewMarkKey(markKey);
}
@GetMapping("/simple")
public List<ProjectVO> queryProjectSimpleInfo() {
return projectService.getSimpleProjectList();
}
@GetMapping("/viewSetting/project/{project}")
public ProjectView.SimpleProjectView queryProjectViewSetting(@PathVariable String project) {
public ProjectViewVO queryProjectViewSetting(@PathVariable String project) {
return projectService.getProjectViewSetting(project);
}
@GetMapping("/viewSetting/simple/all")
public List<ProjectView.SimpleProjectView> queryViewAll() {
public List<ProjectViewVO> queryViewAll() {
return projectService.queryViewAll();
}
}

View File

@ -31,4 +31,4 @@ public interface PaperCompositionDAO {
int updateByPrimaryKeySelective(PaperComposition record);
int updateByPrimaryKey(PaperComposition record);
}
}

View File

@ -5,8 +5,8 @@ import java.time.LocalDateTime;
import lombok.Data;
/**
* @author
*
* @author
*
*/
@Data
public class PaperComposition implements Serializable {
@ -26,9 +26,9 @@ public class PaperComposition implements Serializable {
private String profile;
/**
* 项目code
* 组织id
*/
private String projectCode;
private String companyId;
/**
* 启用起始时间
@ -66,9 +66,9 @@ public class PaperComposition implements Serializable {
private LocalDateTime updateTime;
/**
* 试卷蓝图状态1-正在编辑2-封存(不能修改)3-已经被使用(不能修改删除)
* 试卷蓝图状态1-正在编辑2-封存(不能修改)3-已经被使用(不能修改删除)定于见PaperCompositionState
*/
private Integer state;
private static final long serialVersionUID = 1L;
}
}

View File

@ -325,73 +325,73 @@ public class PaperCompositionExample {
return (Criteria) this;
}
public Criteria andProjectCodeIsNull() {
addCriterion("project_code is null");
public Criteria andCompanyIdIsNull() {
addCriterion("company_id is null");
return (Criteria) this;
}
public Criteria andProjectCodeIsNotNull() {
addCriterion("project_code is not null");
public Criteria andCompanyIdIsNotNull() {
addCriterion("company_id is not null");
return (Criteria) this;
}
public Criteria andProjectCodeEqualTo(String value) {
addCriterion("project_code =", value, "projectCode");
public Criteria andCompanyIdEqualTo(String value) {
addCriterion("company_id =", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotEqualTo(String value) {
addCriterion("project_code <>", value, "projectCode");
public Criteria andCompanyIdNotEqualTo(String value) {
addCriterion("company_id <>", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeGreaterThan(String value) {
addCriterion("project_code >", value, "projectCode");
public Criteria andCompanyIdGreaterThan(String value) {
addCriterion("company_id >", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeGreaterThanOrEqualTo(String value) {
addCriterion("project_code >=", value, "projectCode");
public Criteria andCompanyIdGreaterThanOrEqualTo(String value) {
addCriterion("company_id >=", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLessThan(String value) {
addCriterion("project_code <", value, "projectCode");
public Criteria andCompanyIdLessThan(String value) {
addCriterion("company_id <", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLessThanOrEqualTo(String value) {
addCriterion("project_code <=", value, "projectCode");
public Criteria andCompanyIdLessThanOrEqualTo(String value) {
addCriterion("company_id <=", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLike(String value) {
addCriterion("project_code like", value, "projectCode");
public Criteria andCompanyIdLike(String value) {
addCriterion("company_id like", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotLike(String value) {
addCriterion("project_code not like", value, "projectCode");
public Criteria andCompanyIdNotLike(String value) {
addCriterion("company_id not like", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeIn(List<String> values) {
addCriterion("project_code in", values, "projectCode");
public Criteria andCompanyIdIn(List<String> values) {
addCriterion("company_id in", values, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotIn(List<String> values) {
addCriterion("project_code not in", values, "projectCode");
public Criteria andCompanyIdNotIn(List<String> values) {
addCriterion("company_id not in", values, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeBetween(String value1, String value2) {
addCriterion("project_code between", value1, value2, "projectCode");
public Criteria andCompanyIdBetween(String value1, String value2) {
addCriterion("company_id between", value1, value2, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotBetween(String value1, String value2) {
addCriterion("project_code not between", value1, value2, "projectCode");
public Criteria andCompanyIdNotBetween(String value1, String value2) {
addCriterion("company_id not between", value1, value2, "companyId");
return (Criteria) this;
}
@ -970,4 +970,4 @@ public class PaperCompositionExample {
this(condition, value, secondValue, null);
}
}
}
}

View File

@ -30,7 +30,7 @@ public class PaperRule implements Serializable {
private Integer subtype;
/**
* 筛选题目的标签即根据标签来筛选题目
* 筛选题目的标签即根据标签来筛选题目;List<String>的json
*/
private String tags;

View File

@ -26,9 +26,9 @@ public class PaperUser implements Serializable {
private Long pcId;
/**
* 项目code
* 组织id
*/
private String projectCode;
private String companyId;
/**
* 用户最终得分

View File

@ -305,73 +305,73 @@ public class PaperUserExample {
return (Criteria) this;
}
public Criteria andProjectCodeIsNull() {
addCriterion("project_code is null");
public Criteria andCompanyIdIsNull() {
addCriterion("company_id is null");
return (Criteria) this;
}
public Criteria andProjectCodeIsNotNull() {
addCriterion("project_code is not null");
public Criteria andCompanyIdIsNotNull() {
addCriterion("company_id is not null");
return (Criteria) this;
}
public Criteria andProjectCodeEqualTo(String value) {
addCriterion("project_code =", value, "projectCode");
public Criteria andCompanyIdEqualTo(String value) {
addCriterion("company_id =", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotEqualTo(String value) {
addCriterion("project_code <>", value, "projectCode");
public Criteria andCompanyIdNotEqualTo(String value) {
addCriterion("company_id <>", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeGreaterThan(String value) {
addCriterion("project_code >", value, "projectCode");
public Criteria andCompanyIdGreaterThan(String value) {
addCriterion("company_id >", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeGreaterThanOrEqualTo(String value) {
addCriterion("project_code >=", value, "projectCode");
public Criteria andCompanyIdGreaterThanOrEqualTo(String value) {
addCriterion("company_id >=", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLessThan(String value) {
addCriterion("project_code <", value, "projectCode");
public Criteria andCompanyIdLessThan(String value) {
addCriterion("company_id <", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLessThanOrEqualTo(String value) {
addCriterion("project_code <=", value, "projectCode");
public Criteria andCompanyIdLessThanOrEqualTo(String value) {
addCriterion("company_id <=", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLike(String value) {
addCriterion("project_code like", value, "projectCode");
public Criteria andCompanyIdLike(String value) {
addCriterion("company_id like", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotLike(String value) {
addCriterion("project_code not like", value, "projectCode");
public Criteria andCompanyIdNotLike(String value) {
addCriterion("company_id not like", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeIn(List<String> values) {
addCriterion("project_code in", values, "projectCode");
public Criteria andCompanyIdIn(List<String> values) {
addCriterion("company_id in", values, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotIn(List<String> values) {
addCriterion("project_code not in", values, "projectCode");
public Criteria andCompanyIdNotIn(List<String> values) {
addCriterion("company_id not in", values, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeBetween(String value1, String value2) {
addCriterion("project_code between", value1, value2, "projectCode");
public Criteria andCompanyIdBetween(String value1, String value2) {
addCriterion("company_id between", value1, value2, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotBetween(String value1, String value2) {
addCriterion("project_code not between", value1, value2, "projectCode");
public Criteria andCompanyIdNotBetween(String value1, String value2) {
addCriterion("company_id not between", value1, value2, "companyId");
return (Criteria) this;
}

View File

@ -20,9 +20,9 @@ public class PaperUserQuestion implements Serializable {
private Long puId;
/**
* 项目code
* 组织id
*/
private String projectCode;
private String companyId;
/**
* 试题类型1-理论题2-实训题

View File

@ -244,73 +244,73 @@ public class PaperUserQuestionExample {
return (Criteria) this;
}
public Criteria andProjectCodeIsNull() {
addCriterion("project_code is null");
public Criteria andCompanyIdIsNull() {
addCriterion("company_id is null");
return (Criteria) this;
}
public Criteria andProjectCodeIsNotNull() {
addCriterion("project_code is not null");
public Criteria andCompanyIdIsNotNull() {
addCriterion("company_id is not null");
return (Criteria) this;
}
public Criteria andProjectCodeEqualTo(String value) {
addCriterion("project_code =", value, "projectCode");
public Criteria andCompanyIdEqualTo(String value) {
addCriterion("company_id =", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotEqualTo(String value) {
addCriterion("project_code <>", value, "projectCode");
public Criteria andCompanyIdNotEqualTo(String value) {
addCriterion("company_id <>", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeGreaterThan(String value) {
addCriterion("project_code >", value, "projectCode");
public Criteria andCompanyIdGreaterThan(String value) {
addCriterion("company_id >", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeGreaterThanOrEqualTo(String value) {
addCriterion("project_code >=", value, "projectCode");
public Criteria andCompanyIdGreaterThanOrEqualTo(String value) {
addCriterion("company_id >=", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLessThan(String value) {
addCriterion("project_code <", value, "projectCode");
public Criteria andCompanyIdLessThan(String value) {
addCriterion("company_id <", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLessThanOrEqualTo(String value) {
addCriterion("project_code <=", value, "projectCode");
public Criteria andCompanyIdLessThanOrEqualTo(String value) {
addCriterion("company_id <=", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeLike(String value) {
addCriterion("project_code like", value, "projectCode");
public Criteria andCompanyIdLike(String value) {
addCriterion("company_id like", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotLike(String value) {
addCriterion("project_code not like", value, "projectCode");
public Criteria andCompanyIdNotLike(String value) {
addCriterion("company_id not like", value, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeIn(List<String> values) {
addCriterion("project_code in", values, "projectCode");
public Criteria andCompanyIdIn(List<String> values) {
addCriterion("company_id in", values, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotIn(List<String> values) {
addCriterion("project_code not in", values, "projectCode");
public Criteria andCompanyIdNotIn(List<String> values) {
addCriterion("company_id not in", values, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeBetween(String value1, String value2) {
addCriterion("project_code between", value1, value2, "projectCode");
public Criteria andCompanyIdBetween(String value1, String value2) {
addCriterion("company_id between", value1, value2, "companyId");
return (Criteria) this;
}
public Criteria andProjectCodeNotBetween(String value1, String value2) {
addCriterion("project_code not between", value1, value2, "projectCode");
public Criteria andCompanyIdNotBetween(String value1, String value2) {
addCriterion("company_id not between", value1, value2, "companyId");
return (Criteria) this;
}

View File

@ -1,8 +1,6 @@
package club.joylink.rtss.entity.project;
import club.joylink.rtss.util.JsonUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;
@ -17,16 +15,6 @@ import java.util.List;
@Setter
@Getter
public class Project {
/**
* 有效信息标识
*/
public final static Integer EFFECT_PROJECT_STATUS = 1;
/**
* 默认项目的markKey
*/
public final static String DEFAULT_PROJECT_MARK_KEY = "login";
/**
* 默认项目的Code
*/
@ -53,14 +41,9 @@ public class Project {
private String name;
/**
* 项目英文名称
* 描述
*/
private String nameEn;
/**
* 项目简称
*/
private String simpleName;
private String description;
/**
* 创建时间
@ -75,197 +58,20 @@ public class Project {
/**
* 项目标识状态
*/
private int status;
private Integer status;
/**
* 是否供前端选择
*/
private int viewShow;
private Integer viewShow;
/**
* 后端服务设置
*/
private String serverSetting;
/**
* 反序列化设置信息
*/
@JsonIgnore
private ProjectServerConfig projectServerConfig;
public void setServerSetting(String serverSetting) {
this.serverSetting = serverSetting;
if (StringUtils.isEmpty(this.serverSetting)) {
this.projectServerConfig = null;
} else {
this.projectServerConfig = JsonUtils.read(this.serverSetting, ProjectServerConfig.class);
}
}
/**
* 是否默认项目
*/
@JsonIgnore
public boolean isDefault() {
if (this.projectServerConfig == null) {
return false;
}
return this.projectServerConfig.getDefaultProject() == 1;
}
@JsonIgnore
public static boolean isDefault(String code) {
return StringUtils.isEmpty(code) || DEFAULT_PROJECT_LABEL.contains(code);
}
/**
* 是否登录就创建仿真
*/
@JsonIgnore
public boolean isLoginWithCreateSimulation() {
if (this.projectServerConfig == null) {
return false;
}
return this.projectServerConfig.getLoginCreateSimulation() == 1;
}
@JsonIgnore
public boolean isPermissionVail() {
if (this.projectServerConfig == null) {
return false;
}
return this.projectServerConfig.getCreateSimulationPermission() == 1;
}
@JsonIgnore
public boolean isCreateLocalSimulation() {
if (this.projectServerConfig == null) {
return false;
}
return this.projectServerConfig.getCreateLocalSimulation() == 1;
}
@JsonIgnore
public boolean isMapNeedCharge() {
if (this.projectServerConfig == null) {
return false;
}
return this.projectServerConfig.getMapNeedCharge() == 1;
}
/**
* 是否资源免费
*/
@JsonIgnore
public boolean isFreeSource() {
if (this.projectServerConfig == null) {
return false;
}
return this.projectServerConfig.getFreeSource() == 1;
}
@JsonIgnore
public boolean isControlDevice() {
if (this.projectServerConfig == null) {
return false;
}
return this.projectServerConfig.getControlDevice() == 1;
}
@JsonIgnore
public int getDefaultLoadTrain() {
if (this.projectServerConfig == null) {
return 0;
}
return this.projectServerConfig.getDefaultLoadTrain();
}
@JsonIgnore
public String getDefaultMemberId() {
if (this.projectServerConfig == null) {
return null;
}
return this.projectServerConfig.getDefaultMemberId();
}
/**
* 返回项目编码
*/
public String name() {
return this.code;
}
/**
* 生成项目简单信息
*/
public SimpleProject generateSimpleProject() {
return new SimpleProject(this);
}
@Data
public static class SimpleProject {
private String label;
private String value;
public SimpleProject() {
}
public SimpleProject(Project project) {
this.label = project.getSimpleName();
this.value = project.getCode();
}
public String name() {
return this.value;
}
}
@Data
public static class ProjectServerConfig {
/**
* 默认项目
*/
private int defaultProject;
/**
* 登录后创建仿真
*/
private int loginCreateSimulation;
/**
* 登录时创建仿真的权限判断原BJD使用
*/
private int createSimulationPermission;
/**
* 登录时创建仿真判断WJLS创建现地类型
*/
private int createLocalSimulation;
/**
* 地图需要收费DRTS
*/
private int mapNeedCharge;
/**
* 资源免费CGYZZWW
*/
private int freeSource;
/**
* 需要控制装备HEB
*/
private int controlDevice;
/**
* 默认加载列车数
*/
private int defaultLoadTrain;
/**
* 默认加载角色WJLS默认加载2
*/
private String defaultMemberId;
}
}

View File

@ -1,17 +1,18 @@
package club.joylink.rtss.entity.project;
import club.joylink.rtss.util.JsonUtils;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
@Setter
@Getter
public class ProjectView {
/**
* 默认项目的markKey
*/
public final static String DEFAULT_PROJECT_MARK_KEY = "login";
private Long id;
private String markKey;
@ -25,30 +26,4 @@ public class ProjectView {
private Integer status;
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);
}
}
}
}

View File

@ -0,0 +1,10 @@
package club.joylink.rtss.services;
import club.joylink.rtss.util.MinioClientUtil;
public interface MinioService {
/**
* 根据目录获取MINIO客户端
*/
MinioClientUtil createMinioClientUtil(String directory);
}

View File

@ -0,0 +1,27 @@
package club.joylink.rtss.services;
import club.joylink.rtss.configuration.MinioClientConfig;
import club.joylink.rtss.util.MinioClientUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Service
public class MinioServiceImpl implements MinioService {
private Map<String, MinioClientUtil> minioClientMap = new ConcurrentHashMap<>();
@Autowired
private MinioClientConfig minioClientConfig;
@Override
public MinioClientUtil createMinioClientUtil(String directory) {
if (minioClientMap.containsKey(directory)) {
return minioClientMap.get(directory);
}
MinioClientUtil minioClientUtil = MinioClientUtil.getInstance(minioClientConfig, directory);
minioClientMap.put(directory, minioClientUtil);
return minioClientUtil;
}
}

View File

@ -22,6 +22,7 @@ import club.joylink.rtss.vo.client.SocketMessageVO;
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
import club.joylink.rtss.vo.client.project.RelationLoginConfigVO;
import club.joylink.rtss.vo.project.ProjectVO;
import club.joylink.rtss.vo.wx.WmUserSession;
import club.joylink.rtss.websocket.StompMessageService;
import lombok.Getter;
@ -120,25 +121,22 @@ public class AuthenticateService implements IAuthenticateService {
}
}
/**
* TODO 20220922 用于替换上方方法 占位
*/
@Override
public LoginStatusVO getWmLoginUrl(String clientId, String secret, String projectCode, String deviceCode) {
Client client = Client.getByIdAndSecret(clientId, secret);
Project project = projectService.queryLoginProjectByCode(projectCode);
ProjectVO projectVO = projectService.queryLoginProjectByCode(projectCode);
ProjectDeviceVO deviceVO = null;
if (!StringUtils.isEmpty(deviceCode)) {
deviceVO = this.deviceService.getDeviceDetailInfoOf(project.getCode(), deviceCode);
deviceVO = this.deviceService.getDeviceDetailInfoOf(projectVO.name(), deviceCode);
}
String sessionId = RandomGenerator.uuid();
String url = qrCodeManager.getLoginCode(clientId, project.name(), sessionId);
String url = qrCodeManager.getLoginCode(clientId, projectVO.name(), sessionId);
LocalDateTime now = LocalDateTime.now();
LoginStatusVO loginStatusVO = LoginStatusVO.builder()
.url(url)
.sessionId(sessionId)
.client(client)
.projectInfo(project)
.projectVO(projectVO)
.deviceVO(deviceVO)
.time(now)
.lastQueryTime(now)
@ -249,7 +247,7 @@ public class AuthenticateService implements IAuthenticateService {
if (StringUtils.isEmpty(loginStatusVo.getToken())) { //正常扫码登陆
// 构造登陆用户信息
LoginUserInfoVO loginUserInfo = new LoginUserInfoVO(user, loginStatusVo.getClient(),
loginStatusVo.getProjectInfo().name(), loginStatusVo.getDeviceVO());
loginStatusVo.getProjectVO().name(), loginStatusVo.getDeviceVO());
// 设置组织信息
iSysUserService.setOrgInfoOfOrgRelWithTheProject(loginUserInfo.getProjectInfo().name(), user);
// 登陆
@ -354,8 +352,8 @@ public class AuthenticateService implements IAuthenticateService {
@Override
public String loginWithPwd(LoginUserVO loginUser) {
// TODO 20220922
Project project = projectService.queryLoginProjectByCode(loginUser.getProject());
AccountVO user = this.iSysUserService.findUserByAccountAndPassword(loginUser.getAccount(), loginUser.getPassword(), project.name());
ProjectVO projectVO = projectService.queryLoginProjectByCode(loginUser.getProject());
AccountVO user = this.iSysUserService.findUserByAccountAndPassword(loginUser.getAccount(), loginUser.getPassword(), projectVO.name());
BusinessExceptionAssertEnum.LOGIN_INFO_ERROR.assertNotNull(user, "账号或密码不正确!");
if (loginUser.isTeacherLogin()) {
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertEquals(true, user.getCompanyAdmin(), "账号无教师权限");
@ -363,10 +361,10 @@ public class AuthenticateService implements IAuthenticateService {
Client client = Client.getByIdAndSecret(loginUser.getClientId(), loginUser.getSecret());
ProjectDeviceVO deviceVO = null;
if (!StringUtils.isEmpty(loginUser.getDeviceCode())) {
deviceVO = this.deviceService.getDeviceDetailInfoOf(project.name(), loginUser.getDeviceCode());
deviceVO = this.deviceService.getDeviceDetailInfoOf(projectVO.name(), loginUser.getDeviceCode());
}
// 构造登陆用户信息
LoginUserInfoVO loginUserInfo = new LoginUserInfoVO(user, client, project, deviceVO);
LoginUserInfoVO loginUserInfo = new LoginUserInfoVO(user, client, projectVO, deviceVO);
// 执行登录
login(loginUserInfo, true);
return loginUserInfo.getToken();
@ -381,9 +379,9 @@ public class AuthenticateService implements IAuthenticateService {
loginInfo.getAccount());
Client client = Client.getByIdAndSecret(loginInfo.getClientId(), loginInfo.getSecret());
// TODO 20220922
club.joylink.rtss.entity.project.Project project = projectService.queryLoginProjectByCode(loginInfo.getProject());
ProjectVO projectVO = projectService.queryLoginProjectByCode(loginInfo.getProject());
// 构造登陆用户信息
LoginUserInfoVO loginUserInfo = new LoginUserInfoVO(accountVO, client, project, null);
LoginUserInfoVO loginUserInfo = new LoginUserInfoVO(accountVO, client, projectVO, null);
// 执行登录
login(loginUserInfo, true);
return loginUserInfo.getToken();

View File

@ -8,7 +8,6 @@ import club.joylink.rtss.dao.CompetitionDAO;
import club.joylink.rtss.dao.CompetitionRecordDAO;
import club.joylink.rtss.dao.CompetitionVoiceRecordDAO;
import club.joylink.rtss.entity.*;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.*;
import club.joylink.rtss.services.project.ProjectService;
@ -43,6 +42,7 @@ import club.joylink.rtss.vo.client.script.ScriptActionVO;
import club.joylink.rtss.vo.client.script.ScriptVO;
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.project.ProjectVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
@ -386,8 +386,8 @@ public class CompetitionPracticalService implements ICompetitionPracticalService
@Override
public String createSimulationAndLoadCompetition(Long id, LoginUserInfoVO userInfo) {
Project project = projectService.queryLoginProjectByCode("DRTS");
String group = projectSimulationService.createCenterSimulation(userInfo, project);
ProjectVO projectVO = projectService.queryLoginProjectByCode("DRTS");
String group = projectSimulationService.createCenterSimulation(userInfo, projectVO);
loadCompetition(group, id, userInfo);
return group;
}
@ -448,8 +448,8 @@ public class CompetitionPracticalService implements ICompetitionPracticalService
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(monthAmount > 0,
"购买月数需大于0");
MapVO mapInfo = iMapService.getMapInfoById(mapId);
Project project = projectService.queryLoginProjectByCode(mapInfo.getProjectCode());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(project.isMapNeedCharge(), "非国赛地图无需购买权限");
ProjectVO projectVO = projectService.queryLoginProjectByCode(mapInfo.getProjectCode());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(projectVO.isMapNeedCharge(), "非国赛地图无需购买权限");
List<UserPermissionVO> ups = iUserPermissionService.getSimulationUserPermission(user, mapId, MapPrdTypeEnum.JOINT.getCode());
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(ups.size() > 1,
"地图权限数量大于1暂不能购买");

View File

@ -37,12 +37,12 @@ public class PaperCompositionService {
@Transactional(rollbackFor = Exception.class)
public CreatePaperCompositionRspVo createPaperComposition(CreatePaperCompositionReqVo req, AccountVO user) {
//根据项目和名称来查如果存在则结束
List<PaperComposition> pcList = this.findCompositionByProjectAndName(req.getProjectCode(), req.getName());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(CollectionUtils.isEmpty(pcList), "试卷定义已经存在:projectCode=" + req.getProjectCode() + " name=" + req.getName());
List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getCompanyId(), req.getName());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(CollectionUtils.isEmpty(pcList), "试卷定义已经存在:companyId=" + req.getCompanyId() + " name=" + req.getName());
//
PaperComposition newPc = new PaperComposition();
newPc.setName(req.getName());
newPc.setProjectCode(req.getProjectCode());
newPc.setCompanyId(req.getCompanyId());
newPc.setProfile(req.getProfile());
newPc.setCreateTime(LocalDateTime.now());
newPc.setUpdateTime(LocalDateTime.now());
@ -51,14 +51,14 @@ public class PaperCompositionService {
int newRt = compositionDAO.insertSelective(newPc);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(newRt > 0, "存储试卷定义失败");
//
pcList = this.findCompositionByProjectAndName(req.getProjectCode(), req.getName());
pcList = this.findCompositionByCompanyIdAndName(req.getCompanyId(), req.getName());
newPc = pcList.get(0);
//
CreatePaperCompositionRspVo rsp = new CreatePaperCompositionRspVo();
rsp.setId(newPc.getId());
rsp.setName(newPc.getName());
rsp.setProfile(newPc.getProfile());
rsp.setProjectCode(newPc.getProjectCode());
rsp.setCompanyId(newPc.getCompanyId());
return rsp;
}
@ -70,17 +70,17 @@ public class PaperCompositionService {
PaperComposition curPc = compositionDAO.selectByPrimaryKey(req.getId());
assertPaperCompositionCanModify(curPc);
//
List<PaperComposition> pcList = this.findCompositionByProjectAndName(req.getProjectCode(), req.getName());
List<PaperComposition> pcList = this.findCompositionByCompanyIdAndName(req.getCompanyId(), req.getName());
if (!CollectionUtils.isEmpty(pcList)) {
boolean exist = pcList.stream().anyMatch(c -> {
return c.getId().compareTo(curPc.getId()) != 0;
});
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(exist, "试卷定义已经存在:projectCode=" + req.getProjectCode() + " name=" + req.getName());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(exist, "试卷定义已经存在:companyId=" + req.getCompanyId() + " name=" + req.getName());
}
//
curPc.setName(req.getName());
curPc.setProfile(req.getProfile());
curPc.setProjectCode(req.getProjectCode());
curPc.setCompanyId(req.getCompanyId());
curPc.setUpdateTime(LocalDateTime.now());
compositionDAO.updateByPrimaryKeySelective(curPc);
}
@ -193,11 +193,11 @@ public class PaperCompositionService {
pcExCriteria.andNameEqualTo(req.getName());
}
}
if (null != req.getProjectCode()) {
if (null != req.getCompanyId()) {
if (req.getProjectCodeLike()) {
pcExCriteria.andProjectCodeLike(req.getProjectCode());
pcExCriteria.andCompanyIdLike(String.format("%%%s%%",req.getCompanyId()));
} else {
pcExCriteria.andProjectCodeEqualTo(req.getProjectCode());
pcExCriteria.andCompanyIdEqualTo(req.getCompanyId());
}
}
if (null != req.getProfile()) {
@ -272,9 +272,9 @@ public class PaperCompositionService {
* 根据试卷蓝图的项目和名称查找项目
*/
@Transactional(readOnly = true)
public List<PaperComposition> findCompositionByProjectAndName(String projectCode, String name) {
public List<PaperComposition> findCompositionByCompanyIdAndName(String companyId, String name) {
PaperCompositionExample example = new PaperCompositionExample();
example.createCriteria().andProjectCodeEqualTo(projectCode).andNameEqualTo(name);
example.createCriteria().andCompanyIdEqualTo(companyId).andNameEqualTo(name);
List<PaperComposition> list = compositionDAO.selectByExample(example);
return list;
}

View File

@ -5,17 +5,25 @@ import club.joylink.rtss.dao.paper.*;
import club.joylink.rtss.entity.paper.PaperComposition;
import club.joylink.rtss.entity.paper.PaperRule;
import club.joylink.rtss.entity.paper.PaperUser;
import club.joylink.rtss.entity.paper.PaperUserQuestion;
import club.joylink.rtss.entity.paper.question.PaperQuestion;
import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
import club.joylink.rtss.entity.training2.PublishedTraining2;
import club.joylink.rtss.entity.training2.PublishedTraining2Example;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.paper.CreatePaperRspVo;
import club.joylink.rtss.vo.paper.PaperCompositionState;
import club.joylink.rtss.vo.paper.PaperQType;
import club.joylink.rtss.vo.paper.PaperQuestionState;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
@ -36,7 +44,7 @@ public class PaperUserCreateService {
@Autowired
private PaperCompositionService compositionService;
@Autowired
private PaperQuestionDAO pagerQuestionDAO;
private PaperQuestionDAO questionDAO;
@Autowired
private PublishedTraining2DAO trainingDAO;
@ -60,14 +68,14 @@ public class PaperUserCreateService {
List<PaperRule> ruleList = compositionService.findRuleByPcId(pcId);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertCollectionNotEmpty(ruleList, "试卷定义没有规则定义无法生成用户试卷pcId = " + pcId);
//
String projectCode = composition.getProjectCode();
String companyId = composition.getCompanyId();
// 标记封存的试卷蓝图已使用
compositionService.usePaperComposition(pcId);
// 创建用户试卷
PaperUser paper = new PaperUser();
paper.setUserId(user.getId());
paper.setPcId(pcId);
paper.setProjectCode(projectCode);
paper.setCompanyId(companyId);
paper.setCreateTime(LocalDateTime.now());
paperUserDAO.insertSelective(paper);
paper = paperUserService.findByUserIdAndPcId(user.getId(), pcId);
@ -76,7 +84,7 @@ public class PaperUserCreateService {
//
CreatePaperRspVo rsp = new CreatePaperRspVo();
rsp.setPaperName(composition.getName());
rsp.setProjectCode(projectCode);
rsp.setCompanyId(companyId);
rsp.setId(paper.getId());
return rsp;
}
@ -92,35 +100,188 @@ public class PaperUserCreateService {
this.dispatcherCommonQuestion(pu, pc, rule);
break;
case Training:
this.dispatcherTrainingQuestion(pu, pc, rule);
break;
}
});
}
/**
* 随机选择理论题目
*/
private void dispatcherCommonQuestion(PaperUser pu, PaperComposition pc, PaperRule rule) {
String tags = rule.getTags();//规则标签逗号分隔
String[] tagArray = null != tags && tags.length() > 0 ? tags.split(",") : null;
final int qSum = rule.getSum();//该类型问题个数
//
PaperQuestionExample questionExample = this.commonQuestionExample(pu, pc, rule, null, null);
//符合条件的题目数目
long count = questionDAO.countByExample(questionExample);
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(count >= qSum, "符合条件的理论题数目过少pcId = " + pc.getId() + " pcName = " + pc.getName() + " companyId = " + pc.getCompanyId() + " ruleType = " + subType.name() + " ruleSum = " + qSum);
//引入随机数
//每页记录数
final int pageSize = 5;
//页数
final long pageSum = count / pageSize + count % pageSize > 0 ? 1 : 0;
//随机生成页码
int pageNum = (int) (Math.random() * pageSum) + 1;
//在页内随机选择一条在该条前后连续取够qSum个问题
long startIndex = (pageNum - 1) * pageSize;
final String orderBy = "id";
questionExample.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, startIndex, pageSize));
List<PaperQuestion> page = questionDAO.selectByExample(questionExample);
final int randomIndex = (int) (Math.random() * page.size());
//选择该题目后边连续qSum个
PaperQuestion randomQuestion = page.get(randomIndex);
final List<PaperQuestion> questionList = new ArrayList<>(qSum);
questionList.add(randomQuestion);
final int questionSum = qSum - 1;
PaperQuestionExample greaterExample = this.commonQuestionExample(pu, pc, rule, true, randomQuestion.getId());
greaterExample.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, 0, questionSum));
List<PaperQuestion> greaterList = questionDAO.selectByExample(greaterExample);
if (!CollectionUtils.isEmpty(greaterList)) {
questionList.addAll(greaterList);
}
final int lessSum = questionSum - questionList.size();
if (lessSum > 0) {
PaperQuestionExample lessExample = this.commonQuestionExample(pu, pc, rule, false, randomQuestion.getId());
lessExample.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, 0, lessSum));
List<PaperQuestion> lessList = questionDAO.selectByExample(lessExample);
questionList.addAll(lessList);
}
//校验最终查询到的题目数目
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(questionList.size() == qSum, "没有足够的符合条件的理论题目");
//将题目与试卷关联
questionList.forEach(q -> {
PaperUserQuestion puq = new PaperUserQuestion();
puq.setState(PaperQuestionState.Undo.getValue());
puq.setPuId(pu.getId());
puq.setCompanyId(pc.getCompanyId());
puq.setType(PaperQType.GroupType.getItem(rule.getType()).getValue());
puq.setQuestionId(q.getId());
paperUserQuestionDAO.insertSelective(puq);
});
}
/**
* 随机选择实训题目
*/
private void dispatcherTrainingQuestion(PaperUser pu, PaperComposition pc, PaperRule rule) {
final int qSum = rule.getSum();//该类型问题个数
//
PublishedTraining2Example questionExample = this.trainingQuestionExample(pu, pc, rule, null, null);
//符合条件的题目数目
long count = trainingDAO.countByExample(questionExample);
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(count >= qSum, "符合条件的实训题数目过少pcId = " + pc.getId() + " pcName = " + pc.getName() + " companyId = " + pc.getCompanyId() + " ruleType = " + subType.name() + " ruleSum = " + qSum);
//引入随机数
//每页记录数
final int pageSize = 5;
//页数
final long pageSum = count / pageSize + count % pageSize > 0 ? 1 : 0;
//随机生成页码
int pageNum = (int) (Math.random() * pageSum) + 1;
//在页内随机选择一条在该条前后连续取够qSum个问题
long startIndex = (pageNum - 1) * pageSize;
final String orderBy = "id";
questionExample.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, startIndex, pageSize));
List<PublishedTraining2> page = trainingDAO.selectByExample(questionExample);
final int randomIndex = (int) (Math.random() * page.size());
//选择该题目后边连续qSum个
PublishedTraining2 randomQuestion = page.get(randomIndex);
final List<PublishedTraining2> questionList = new ArrayList<>(qSum);
questionList.add(randomQuestion);
final int questionSum = qSum - 1;
PublishedTraining2Example greaterExample = this.trainingQuestionExample(pu, pc, rule, true, randomQuestion.getId());
greaterExample.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, 0, questionSum));
List<PublishedTraining2> greaterList = trainingDAO.selectByExample(greaterExample);
if (!CollectionUtils.isEmpty(greaterList)) {
questionList.addAll(greaterList);
}
final int lessSum = questionSum - questionList.size();
if (lessSum > 0) {
PublishedTraining2Example lessExample = this.trainingQuestionExample(pu, pc, rule, false, randomQuestion.getId());
lessExample.setOrderByClause(String.format("%s desc limit %s,%s", orderBy, 0, lessSum));
List<PublishedTraining2> lessList = trainingDAO.selectByExample(lessExample);
questionList.addAll(lessList);
}
//校验最终查询到的题目数目
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(questionList.size() == qSum, "没有足够的符合条件的实训题目");
//将题目与试卷关联
questionList.forEach(q -> {
PaperUserQuestion puq = new PaperUserQuestion();
puq.setState(PaperQuestionState.Undo.getValue());
puq.setPuId(pu.getId());
puq.setCompanyId(pc.getCompanyId());
puq.setType(PaperQType.GroupType.getItem(rule.getType()).getValue());
puq.setQuestionId(q.getId());
paperUserQuestionDAO.insertSelective(puq);
});
}
/**
* 生成根据tag查询的条件
*/
private PublishedTraining2Example trainingQuestionExample(PaperUser pu, PaperComposition pc, PaperRule rule, Boolean isGreaterThan, Long id) {
String tags = rule.getTags();//规则标签list json
List<String> tagArray = null != tags && tags.length() > 0 ? JsonUtils.readCollection(tags, ArrayList.class, String.class) : null;
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
//
PublishedTraining2Example questionExample = new PublishedTraining2Example();
if (null == tagArray) {
PublishedTraining2Example.Criteria c = questionExample.createCriteria().andTypeEqualTo(this.paperUserService.getTrainingType(subType)).andStateEqualTo(1);//1-上架
if (null != isGreaterThan && null != id) {
if (isGreaterThan) {
c.andIdGreaterThan(id);
} else {
c.andIdLessThan(id);
}
}
} else {
for (String tag : tagArray) {
PublishedTraining2Example.Criteria c = questionExample.or().andTypeEqualTo(this.paperUserService.getTrainingType(subType)).andStateEqualTo(1).andLabelJsonLike(String.format("%%%s%%", tag));
if (null != isGreaterThan && null != id) {
if (isGreaterThan) {
c.andIdGreaterThan(id);
} else {
c.andIdLessThan(id);
}
}
}
}
return questionExample;
}
/**
* 生成根据tag查询的条件
*/
private PaperQuestionExample commonQuestionExample(PaperUser pu, PaperComposition pc, PaperRule rule, Boolean isGreaterThan, Long id) {
String tags = rule.getTags();//规则标签list json
List<String> tagArray = null != tags && tags.length() > 0 ? JsonUtils.readCollection(tags, ArrayList.class, String.class) : null;
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
int qSum = rule.getSum();//该类型问题个数
//
PaperQuestionExample questionExample = new PaperQuestionExample();
if (null == tagArray) {
questionExample.createCriteria().andProjectCodeEqualTo(pc.getProjectCode()).andTypeEqualTo(this.paperUserService.getPaperQuestionType(subType)).andIsDelEqualTo(0);
PaperQuestionExample.Criteria c = questionExample.createCriteria().andProjectCodeEqualTo(pc.getCompanyId()).andTypeEqualTo(this.paperUserService.getPaperQuestionType(subType)).andIsDelEqualTo(0);
if (null != isGreaterThan && null != id) {
if (isGreaterThan) {
c.andIdGreaterThan(id);
} else {
c.andIdLessThan(id);
}
}
} else {
for (String tag : tagArray) {
questionExample.or().andProjectCodeEqualTo(pc.getProjectCode()).andTypeEqualTo(this.paperUserService.getPaperQuestionType(subType)).andIsDelEqualTo(0).andRaceLableLike(tag);
PaperQuestionExample.Criteria c = questionExample.or().andProjectCodeEqualTo(pc.getCompanyId()).andTypeEqualTo(this.paperUserService.getPaperQuestionType(subType)).andIsDelEqualTo(0).andRaceLableLike(String.format("%%%s%%", tag));
if (null != isGreaterThan && null != id) {
if (isGreaterThan) {
c.andIdGreaterThan(id);
} else {
c.andIdLessThan(id);
}
}
}
}
//符合条件的题目数目
long count = pagerQuestionDAO.countByExample(questionExample);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(count >= qSum, "符合条件的理论题数目过少pcId = " + pc.getId() + " pcName = " + pc.getName() + " projectCode = " + pc.getProjectCode() + " ruleType = " + subType.name() + " ruleSum = " + qSum);
//引入随机数
//每页10条一共页数
long pageSum = count/10+count%10>0?1:0;
//随机生成页码
int pageNum = (int) (Math.random()*pageSum);
//在页内随机选择一条在该条前后连续取够qSum个问题
return questionExample;
}
}

View File

@ -0,0 +1,76 @@
package club.joylink.rtss.services.paper;
import club.joylink.rtss.dao.PublishedTraining2DAO;
import club.joylink.rtss.dao.paper.PaperQuestionDAO;
import club.joylink.rtss.entity.paper.question.PaperQuestionWithBLOBs;
import club.joylink.rtss.entity.training2.PublishedTraining2;
import club.joylink.rtss.entity.training2.PublishedTraining2Example;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.paper.PaperCommonQuestionVo;
import club.joylink.rtss.vo.paper.PaperQType;
import club.joylink.rtss.vo.paper.PaperQuestionLoadRspVo;
import club.joylink.rtss.vo.paper.PaperTrainingQuestionVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
@Service
public class PaperUserLoadQuestionService {
@Autowired
private PaperUserService paperUserService;
@Autowired
private PaperQuestionDAO questionDAO;
@Autowired
private PublishedTraining2DAO trainingDAO;
/**
* 加载用户试卷试题
*
* @param groupType 试卷试题大类型:1-理论题2-实训题
* @param qId 试题id
*/
@Transactional(readOnly = true)
public PaperQuestionLoadRspVo loadQuestion(PaperQType.GroupType groupType, Long qId, AccountVO user) {
PaperQuestionLoadRspVo rsp = new PaperQuestionLoadRspVo();
rsp.setId(qId);
rsp.setType(groupType);
switch (groupType) {
case Training:
rsp.setTraining(loadTrainingQuestion(qId, user));
break;
case Common:
rsp.setCommon(loadCommonQuestion(qId, user));
break;
}
return rsp;
}
private PaperTrainingQuestionVo loadTrainingQuestion(Long qId, AccountVO user) {
PublishedTraining2Example example = new PublishedTraining2Example();
example.createCriteria().andIdEqualTo(qId);
PublishedTraining2 training = trainingDAO.selectByExample(example).get(0);
PaperTrainingQuestionVo rt = new PaperTrainingQuestionVo();
rt.setId(training.getId());
rt.setType(paperUserService.getTrainingType(training));
rt.setName(training.getName());
rt.setDescription(training.getDescription());
return rt;
}
private PaperCommonQuestionVo loadCommonQuestion(Long qId, AccountVO user) {
PaperCommonQuestionVo q = new PaperCommonQuestionVo();
PaperQuestionWithBLOBs question = questionDAO.selectByPrimaryKey(qId);
q.setId(question.getId());
q.setType(paperUserService.getPaperQuestionType(question));
q.setCreateUserId(question.getCreateUserId());
q.setCreateTime(question.getCreateTime());
q.setProjectCode(question.getProjectCode());
q.setCompanyId(question.getCompanyId());
q.setRaceLable(question.getRaceLable());
q.setQuestion(question.getQuestion());
q.setOptionList(JsonUtils.readCollection(question.getQuestionOption(), ArrayList.class, PaperCommonQuestionVo.OptionVo.class));
return q;
}
}

View File

@ -9,7 +9,10 @@ import club.joylink.rtss.entity.training2.PublishedTraining2;
import club.joylink.rtss.entity.training2.PublishedTraining2Example;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.paper.*;
import club.joylink.rtss.vo.paper.PaperQType;
import club.joylink.rtss.vo.paper.PaperQuestionState;
import club.joylink.rtss.vo.paper.PaperSubmitRspVo;
import club.joylink.rtss.vo.paper.PaperUserWholeVo;
import club.joylink.rtss.vo.paper.convertor.PaperCompositionConvertor;
import club.joylink.rtss.vo.paper.convertor.PaperUserConvertor;
import club.joylink.rtss.vo.paper.convertor.PaperUserQuestionConvertor;
@ -46,10 +49,6 @@ public class PaperUserService {
@Autowired
private PublishedTraining2DAO trainingDAO;
/**
* 获取用户试卷完整信息
*
@ -73,19 +72,6 @@ public class PaperUserService {
return rsp;
}
/**
* 加载用户试卷试题
*
* @param groupType 试卷试题大类型:1-理论题2-实训题
* @param qId 试题id
*/
@Transactional(readOnly = true)
public PaperQuestionLoadRspVo loadQuestion(PaperQType.GroupType groupType, Long qId, AccountVO user) {
return null;
}
/**
* 开始答题
*
@ -142,7 +128,7 @@ public class PaperUserService {
PaperSubmitRspVo rsp = new PaperSubmitRspVo();
rsp.setPuId(puId);
rsp.setName(composition.getName());
rsp.setProjectCode(composition.getProjectCode());
rsp.setCompanyId(composition.getCompanyId());
rsp.setDuration(paperTime);
rsp.setScore(scoreCommon + scoreTraining);
rsp.setCommonScore(scoreCommon);
@ -159,14 +145,13 @@ public class PaperUserService {
example.createCriteria().andIdEqualTo(puq.getQuestionId());
PaperQuestion question = pagerQuestionDAO.selectByExample(example).get(0);
if (PaperQuestionState.Right.equals(PaperQuestionState.getItem(puq.getState()))) {//题答对时
PaperRule rule = ruleMap.get(this.getPaperQuestionType(question));
return rule.getScore();
PaperRule rule = ruleMap.get(this.getPaperQuestionType(question));
return rule.getScore();
}
return 0;
}
/**
* 获取题的最终得分
*/
@ -231,36 +216,50 @@ public class PaperUserService {
return list.get(0);
}
}
public PaperQType.SubType getPaperQuestionType(PaperQuestion question) {
switch (question.getType()) {
case "select": return PaperQType.SubType.Select;
case "judge":return PaperQType.SubType.Judge;
case "multi":return PaperQType.SubType.Multi;
case "select":
return PaperQType.SubType.Select;
case "judge":
return PaperQType.SubType.Judge;
case "multi":
return PaperQType.SubType.Multi;
}
return null;
}
public String getPaperQuestionType(PaperQType.SubType qt){
switch (qt){
case Judge:return "judge";
case Select:return "select";
case Multi:return "multi";
public String getPaperQuestionType(PaperQType.SubType qt) {
switch (qt) {
case Judge:
return "judge";
case Select:
return "select";
case Multi:
return "multi";
}
return null;
}
/**
* 实训类型单操 single场景scene
*/
public PaperQType.SubType getTrainingType(PublishedTraining2 training){
switch (training.getType()){
case "single":return PaperQType.SubType.Single;
case "scene":return PaperQType.SubType.Scene;
public PaperQType.SubType getTrainingType(PublishedTraining2 training) {
switch (training.getType()) {
case "single":
return PaperQType.SubType.Single;
case "scene":
return PaperQType.SubType.Scene;
}
return null;
}
public String getTrainingType(PaperQType.SubType training){
switch(training){
case Single:return "single";
case Scene:return "scene";
public String getTrainingType(PaperQType.SubType training) {
switch (training) {
case Single:
return "single";
case Scene:
return "scene";
}
return null;
}

View File

@ -0,0 +1,149 @@
package club.joylink.rtss.services.paper;
import club.joylink.rtss.dao.paper.PaperCompositionDAO;
import club.joylink.rtss.dao.paper.PaperQuestionDAO;
import club.joylink.rtss.dao.paper.PaperUserDAO;
import club.joylink.rtss.dao.paper.PaperUserQuestionDAO;
import club.joylink.rtss.entity.paper.PaperComposition;
import club.joylink.rtss.entity.paper.PaperUser;
import club.joylink.rtss.entity.paper.PaperUserQuestion;
import club.joylink.rtss.entity.paper.PaperUserQuestionExample;
import club.joylink.rtss.entity.paper.question.PaperQuestion;
import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.paper.PaperQuestionState;
import club.joylink.rtss.vo.paper.PaperSubmitAnswerReqVo;
import club.joylink.rtss.vo.paper.PaperSubmitAnswerRspVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.TreeSet;
/**
* 用户提交答案业务处理
*/
@Service
public class PaperUserSubmitAnswerService {
@Autowired
private PaperUserQuestionDAO paperUserQuestionDAO;
@Autowired
private PaperQuestionDAO paperQuestionDAO;
@Autowired
private PaperUserDAO paperUserDAO;
@Autowired
private PaperCompositionDAO paperCompositionDAO;
/**
* 用户提交答案
*/
@Transactional(rollbackFor = Exception.class)
public PaperSubmitAnswerRspVo submitAnswer(PaperSubmitAnswerReqVo req, AccountVO user) {
//用户试卷题目
final PaperUserQuestionExample puqExample = new PaperUserQuestionExample();
puqExample.createCriteria().andPuIdEqualTo(req.getPuId()).andQuestionIdEqualTo(req.getPqId());
final PaperUserQuestion puq = paperUserQuestionDAO.selectByExample(puqExample).get(0);
//用户试卷
final PaperUser pu = paperUserDAO.selectByPrimaryKey(req.getPuId());
//生成试卷的试卷蓝图
final PaperComposition pc =paperCompositionDAO.selectByPrimaryKey(pu.getPcId());
//校验
this.assertCanSubmitAnswer(pc,pu,puq,user);
//
final PaperSubmitAnswerRspVo rsp = new PaperSubmitAnswerRspVo();
rsp.setPuId(req.getPuId());
rsp.setPqId(req.getPqId());
rsp.setType(req.getType());
rsp.setSubType(req.getSubType());
//处理用户提交的答案
switch (req.getType()) {
case Common:
rsp.setResult(submitCommonAnswer(puq, req));
break;
case Training:
rsp.setResult(submitTrainingAnswer(puq, req));
;
break;
}
//记录用户答题情况
PaperUserQuestion record = new PaperUserQuestion();
record.setId(puq.getId());
record.setState(rsp.getResult().getValue());
paperUserQuestionDAO.updateByPrimaryKeySelective(record);
//
return rsp;
}
/**
* 校验用户此时能否提交答案
*/
private void assertCanSubmitAnswer(PaperComposition pc, PaperUser pu,PaperUserQuestion puq,AccountVO user) {
final LocalDateTime now = LocalDateTime.now();
final LocalDateTime start = pu.getStartTime();
final LocalDateTime dead = start.plusMinutes(pc.getValidDuration());
//校验时间
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(now.isAfter(dead),"剩余答题时间为0");
//校验重复做题
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(PaperQuestionState.Undo.equals(PaperQuestionState.getItem(puq.getState())), "只有未做的题才能提交答案");
}
/**
* 处理实训题答案
*/
private PaperQuestionState submitTrainingAnswer(PaperUserQuestion puq, PaperSubmitAnswerReqVo req) {
//todo
return PaperQuestionState.Wrong;
}
/**
* 处理理论题答案
*/
private PaperQuestionState submitCommonAnswer(PaperUserQuestion puq, PaperSubmitAnswerReqVo req) {
//题目
PaperQuestionExample pqExample = new PaperQuestionExample();
pqExample.createCriteria().andIdEqualTo(puq.getQuestionId());
PaperQuestion pq = paperQuestionDAO.selectByExample(pqExample).get(0);
//
final String qAn = this.getAnswerFromQuestion(pq);
final String sAn = this.getAnswerFromSubmit(req);
//
return qAn.equals(sAn) ? PaperQuestionState.Right : PaperQuestionState.Wrong;
}
private String getAnswerFromQuestion(PaperQuestion pq) {
String dan = pq.getQuestionAnswer().trim();
String[] ans = dan.split(",");
TreeSet<String> set = new TreeSet<>();
for (String an : ans) {
set.add(an.trim());
}
StringBuilder sb = new StringBuilder();
set.forEach(an -> {
if (sb.length() <= 0) {
sb.append(an);
} else {
sb.append(",").append(an);
}
});
return sb.toString();
}
private String getAnswerFromSubmit(PaperSubmitAnswerReqVo req) {
TreeSet<String> set = new TreeSet<>();
for (String an : req.getAnswer()) {
set.add(an.trim());
}
StringBuilder sb = new StringBuilder();
set.forEach(an -> {
if (sb.length() <= 0) {
sb.append(an);
} else {
sb.append(",").append(an);
}
});
return sb.toString();
}
}

View File

@ -2,7 +2,6 @@ package club.joylink.rtss.services.pay.wechat;
import club.joylink.rtss.constants.MapPrdTypeEnum;
import club.joylink.rtss.constants.ServicePath;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.event.OrderPaySuccessEvent;
import club.joylink.rtss.exception.BusinessException;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
@ -24,6 +23,7 @@ import club.joylink.rtss.vo.client.permission.PermissionVO;
import club.joylink.rtss.vo.client.permissionDistribute.DistributeVO;
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.project.ProjectVO;
import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder;
import com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier;
import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner;
@ -310,8 +310,8 @@ public class WechatPayService {
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(permission.getName().contains("综合演练"),
String.format("支付的[%s]中的商品不是综合演练权限", orderVO.logStr()));
MapVO mapInfo = iMapService.getMapInfoById(permission.getMapId());
Project project = projectService.queryLoginProjectByCode(mapInfo.getProjectCode());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(project.isMapNeedCharge(),
ProjectVO projectVO = projectService.queryLoginProjectByCode(mapInfo.getProjectCode());
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(projectVO.isMapNeedCharge(),
String.format("支付的[%s]中的商品不是国赛的权限", orderVO.logStr()));
AccountVO user = iSysUserService.getUserById(orderVO.getCreatorId());

View File

@ -32,6 +32,7 @@ import club.joylink.rtss.vo.map.graph.MapSectionNewVO;
import club.joylink.rtss.vo.map.graph.MapSignalNewVO;
import club.joylink.rtss.vo.map.graph.MapSwitchVO;
import club.joylink.rtss.vo.map.graph.MapTrainVO;
import club.joylink.rtss.vo.project.ProjectVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
@ -722,10 +723,10 @@ public class DeviceServiceImpl implements DeviceService {
return list;
}
private ProjectDevice buildIm(Project project, Long creatorId) {
private ProjectDevice buildIm(ProjectVO projectVO, Long creatorId) {
ProjectDevice im = new ProjectDevice();
im.setProjectCode(project.name());
im.setCode(project.name().toLowerCase() + "-" + "im");
im.setProjectCode(projectVO.name());
im.setCode(projectVO.name().toLowerCase() + "-" + "im");
im.setType(ProjectDeviceType.IM.name());
im.setCreator(creatorId);
im.setCreateTime(LocalDateTime.now());

View File

@ -4,6 +4,8 @@ import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.entity.project.ProjectView;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.project.ProjectVO;
import club.joylink.rtss.vo.project.ProjectViewVO;
import java.util.List;
@ -17,83 +19,94 @@ public interface ProjectService {
*/
PageVO<Project> pagingQuery(PageQueryVO queryVO);
/**
* 前端设置信息分页
*/
PageVO<ProjectView> projectViewPagingQuery(PageQueryVO queryVO);
/**
* 列表
*/
List<Project> getAllProject();
/**
* 获取所有的前端配置
*/
List<ProjectView> getAllProjectView();
/**
* 前端通过项目编码前端请求项目信息
*/
Project queryLoginProjectByCode(String code);
/**
* 前端通过项目编码前端请求项目信息
*/
ProjectView queryLoginProjectByMarkKey(String project);
/**
* 项目Id请求项目信息
*/
Project queryProjectById(Long id);
/**
* 配置ID获取前端配置信息
*/
ProjectView queryProjectViewById(Long id);
/**
* 修改项目信息
*/
void updateProject(Project project);
/**
* 修改项目前端配置信息
*/
void updateProjectView(ProjectView projectView);
/**
* 删除项目信息
*/
void deleteProject(Long id);
/**
* 删除项目前端配置信息
*/
void deleteProjectView(Long id);
/**
* 保存项目信息
*/
void save(Project project);
/**
* 检查项目编码是否存在
*/
boolean checkProjectCode(String code);
/**
* 前端设置信息分页
*/
PageVO<ProjectView> projectViewPagingQuery(PageQueryVO queryVO);
/**
* 获取所有的前端配置
*/
List<ProjectView> getAllProjectView();
/**
* 配置ID获取前端配置信息
*/
ProjectView queryProjectViewById(Long id);
/**
* 修改项目前端配置信息
*/
void updateProjectView(ProjectView projectView);
/**
* 删除项目前端配置信息
*/
void deleteProjectView(Long id);
/**
* 保存前端配置信息
*/
void saveProjectView(ProjectView projectView);
/**
* 更新项目的前端设置信息
* 检查项目编码是否存在
*/
ProjectView.SimpleProjectView getProjectViewSetting(String project);
boolean checkProjectViewMarkKey(String markKey);
/************************** runtime ***************************/
/**
* 前端通过项目编码前端请求项目信息
*/
ProjectVO queryLoginProjectByCode(String code);
/**
* 获取项目的简要信息前端关联时使用
*/
List<Project.SimpleProject> getSimpleProjectList();
List<ProjectVO> getSimpleProjectList();
/**
* 前端通过项目编码前端请求项目信息
*/
ProjectViewVO queryLoginProjectByMarkKey(String project);
/**
* 更新项目的前端设置信息
*/
ProjectViewVO getProjectViewSetting(String project);
/**
* 前端请求所有设置信息
*/
List<ProjectView.SimpleProjectView> queryViewAll();
List<ProjectViewVO> queryViewAll();
}

View File

@ -10,6 +10,8 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.project.ProjectVO;
import club.joylink.rtss.vo.project.ProjectViewVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
@ -26,6 +28,10 @@ import java.util.stream.Collectors;
@Service
public class ProjectServiceImpl implements ProjectService {
/**
* 有效信息标识
*/
public final static Integer EFFECT_PROJECT_STATUS = 1;
@Autowired
private ProjectDAO projectDAO;
@ -37,63 +43,22 @@ public class ProjectServiceImpl implements ProjectService {
public PageVO<Project> pagingQuery(PageQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andStatusEqualTo(Project.EFFECT_PROJECT_STATUS);
Page<Project> page = (Page<Project>) projectDAO.selectByExample(projectExample);
return PageVO.convert(page, page.getResult());
}
@Override
public PageVO<ProjectView> projectViewPagingQuery(PageQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
ProjectViewExample projectViewExample = new ProjectViewExample();
projectViewExample.createCriteria().andStatusEqualTo(Project.EFFECT_PROJECT_STATUS);
Page<ProjectView> page = (Page<ProjectView>) projectViewDAO.selectByExample(projectViewExample);
projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS);
Page<Project> page = (Page<Project>) projectDAO.selectWithBLOBsByExample(projectExample);
return PageVO.convert(page, page.getResult());
}
@Override
public List<Project> getAllProject() {
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andStatusEqualTo(Project.EFFECT_PROJECT_STATUS);
projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS);
return projectDAO.selectByExample(projectExample);
}
@Override
public List<ProjectView> getAllProjectView() {
ProjectViewExample projectViewExample = new ProjectViewExample();
projectViewExample.createCriteria().andStatusEqualTo(Project.EFFECT_PROJECT_STATUS);
return projectViewDAO.selectByExample(projectViewExample);
}
@Override
@Cacheable(cacheNames = "project", keyGenerator = "projectKeyGenerator", unless = "#result == null")
public Project queryLoginProjectByCode(String code) {
String codeKey = Project.isDefault(code) ? Project.DEFAULT_PROJECT_CODE : code;
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andStatusEqualTo(Project.EFFECT_PROJECT_STATUS).andCodeEqualTo(codeKey);
List<Project> projectList = projectDAO.selectWithBLOBsByExample(projectExample);
if (CollectionUtils.isEmpty(projectList)) { // 未找到项目则获取默认信息
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
}
return projectList.get(0);
}
@Override
public ProjectView queryLoginProjectByMarkKey(String project) {
String markKey = StringUtils.isEmpty(project) ? Project.DEFAULT_PROJECT_MARK_KEY : project;
ProjectViewExample projectViewExample = new ProjectViewExample();
projectViewExample.createCriteria().andStatusEqualTo(Project.EFFECT_PROJECT_STATUS).andMarkKeyEqualTo(markKey);
List<ProjectView> projectList = projectViewDAO.selectWithBLOBsByExample(projectViewExample);
if (CollectionUtils.isEmpty(projectList)) { // 未找到项目则获取默认信息
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
}
return projectList.get(0);
}
@Override
public Project queryProjectById(Long id) {
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andStatusEqualTo(Project.EFFECT_PROJECT_STATUS).andIdEqualTo(id);
projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS).andIdEqualTo(id);
List<Project> projectList = projectDAO.selectWithBLOBsByExample(projectExample);
if (CollectionUtils.isEmpty(projectList)) {
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
@ -101,23 +66,12 @@ public class ProjectServiceImpl implements ProjectService {
return projectList.get(0);
}
@Override
public ProjectView queryProjectViewById(Long id) {
ProjectViewExample projectViewExample = new ProjectViewExample();
projectViewExample.createCriteria().andStatusEqualTo(Project.EFFECT_PROJECT_STATUS).andIdEqualTo(id);
List<ProjectView> projectList = projectViewDAO.selectWithBLOBsByExample(projectViewExample);
if (CollectionUtils.isEmpty(projectList)) { // 未找到项目则获取默认信息
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
}
return projectList.get(0);
}
@Override
@Transactional(rollbackFor = Exception.class)
@CacheEvict(cacheNames = "project", allEntries = true)
public void updateProject(Project project) {
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andStatusEqualTo(Project.EFFECT_PROJECT_STATUS).andIdEqualTo(project.getId());
projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS).andIdEqualTo(project.getId());
List<Project> projectList = projectDAO.selectByExample(projectExample);
if (CollectionUtils.isEmpty(projectList)) {
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
@ -126,11 +80,70 @@ public class ProjectServiceImpl implements ProjectService {
projectDAO.updateByPrimaryKeySelective(project);
}
@Override
@CacheEvict(cacheNames = "project", allEntries = true)
public void deleteProject(Long id) {
Project project = new Project();
project.setId(id);
project.setStatus(0);
projectDAO.updateByPrimaryKeySelective(project);
}
@Override
@CacheEvict(cacheNames = "project", allEntries = true)
public void save(Project project) {
if (checkProjectCode(project.getCode())) {
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "项目已存在");
}
project.setCreateTime(LocalDateTime.now());
project.setUpdateTime(LocalDateTime.now());
project.setStatus(EFFECT_PROJECT_STATUS);
projectDAO.insert(project);
}
@Override
public boolean checkProjectCode(String code) {
if (Project.isDefault(code)) {
return true;
}
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS).andCodeEqualTo(code);
long num = projectDAO.countByExample(projectExample);
return num > 0;
}
@Override
public PageVO<ProjectView> projectViewPagingQuery(PageQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
ProjectViewExample projectViewExample = new ProjectViewExample();
projectViewExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS);
Page<ProjectView> page = (Page<ProjectView>) projectViewDAO.selectWithBLOBsByExample(projectViewExample);
return PageVO.convert(page, page.getResult());
}
@Override
public List<ProjectView> getAllProjectView() {
ProjectViewExample projectViewExample = new ProjectViewExample();
projectViewExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS);
return projectViewDAO.selectByExample(projectViewExample);
}
@Override
public ProjectView queryProjectViewById(Long id) {
ProjectViewExample projectViewExample = new ProjectViewExample();
projectViewExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS).andIdEqualTo(id);
List<ProjectView> projectList = projectViewDAO.selectWithBLOBsByExample(projectViewExample);
if (CollectionUtils.isEmpty(projectList)) { // 未找到项目则获取默认信息
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
}
return projectList.get(0);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateProjectView(ProjectView projectView) {
ProjectViewExample projectViewExample = new ProjectViewExample();
projectViewExample.createCriteria().andStatusEqualTo(Project.EFFECT_PROJECT_STATUS).andIdEqualTo(projectView.getId());
projectViewExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS).andIdEqualTo(projectView.getId());
List<ProjectView> projectList = projectViewDAO.selectWithBLOBsByExample(projectViewExample);
if (CollectionUtils.isEmpty(projectList)) { // 未找到项目则获取默认信息
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
@ -139,59 +152,81 @@ public class ProjectServiceImpl implements ProjectService {
projectViewDAO.updateByPrimaryKeySelective(projectView);
}
@Override
@CacheEvict(cacheNames = "project", allEntries = true)
public void deleteProject(Long id) {
projectDAO.deleteByPrimaryKey(id);
}
@Override
public void deleteProjectView(Long id) {
projectViewDAO.deleteByPrimaryKey(id);
}
@Override
@CacheEvict(cacheNames = "project", allEntries = true)
public void save(Project project) {
project.setCreateTime(LocalDateTime.now());
project.setUpdateTime(LocalDateTime.now());
project.setStatus(Project.EFFECT_PROJECT_STATUS);
projectDAO.insert(project);
ProjectView projectView = new ProjectView();
projectView.setId(id);
projectView.setStatus(0);
projectViewDAO.updateByPrimaryKeySelective(projectView);
}
@Override
public void saveProjectView(ProjectView projectView) {
if (checkProjectViewMarkKey(projectView.getMarkKey())) {
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "项目已存在");
}
projectView.setCreateTime(LocalDateTime.now());
projectView.setUpdateTime(LocalDateTime.now());
projectView.setStatus(Project.EFFECT_PROJECT_STATUS);
projectView.setStatus(EFFECT_PROJECT_STATUS);
projectViewDAO.insert(projectView);
}
@Override
public ProjectView.SimpleProjectView getProjectViewSetting(String project) {
String markKey = Project.isDefault(project) ? Project.DEFAULT_PROJECT_MARK_KEY : project;
public boolean checkProjectViewMarkKey(String markKey) {
ProjectViewExample projectExample = new ProjectViewExample();
projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS).andMarkKeyEqualTo(markKey);
long num = projectViewDAO.countByExample(projectExample);
return num > 0;
}
@Override
@Cacheable(cacheNames = "project", keyGenerator = "projectKeyGenerator", unless = "#result == null")
public ProjectVO queryLoginProjectByCode(String code) {
String codeKey = ProjectVO.isDefault(code) ? Project.DEFAULT_PROJECT_CODE : code;
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS).andCodeEqualTo(codeKey);
List<Project> projectList = projectDAO.selectWithBLOBsByExample(projectExample);
if (CollectionUtils.isEmpty(projectList)) { // 未找到项目则获取默认信息
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
}
return new ProjectVO(projectList.get(0));
}
@Override
public List<ProjectVO> getSimpleProjectList() {
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS).andViewShowEqualTo(1);
List<Project> projectList = projectDAO.selectWithBLOBsByExample(projectExample);
return projectList.stream().map(project -> new ProjectVO(project)).collect(Collectors.toList());
}
@Override
public ProjectViewVO queryLoginProjectByMarkKey(String project) {
String markKey = StringUtils.isEmpty(project) ? ProjectView.DEFAULT_PROJECT_MARK_KEY : project;
ProjectViewExample projectViewExample = new ProjectViewExample();
projectViewExample.createCriteria().andStatusEqualTo(Project.EFFECT_PROJECT_STATUS).andMarkKeyEqualTo(markKey);
projectViewExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS).andMarkKeyEqualTo(markKey);
List<ProjectView> projectList = projectViewDAO.selectWithBLOBsByExample(projectViewExample);
if (CollectionUtils.isEmpty(projectList)) { // 未找到项目则获取默认信息
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
}
ProjectView projectInfo = projectList.get(0);
return projectInfo.simplifyProjectView();
}
@Override
public List<Project.SimpleProject> getSimpleProjectList() {
ProjectExample projectExample = new ProjectExample();
projectExample.createCriteria().andStatusEqualTo(Project.EFFECT_PROJECT_STATUS).andViewShowEqualTo(1);
List<Project> projectList = projectDAO.selectWithBLOBsByExample(projectExample);
return projectList.stream().map(Project::generateSimpleProject).collect(Collectors.toList());
return new ProjectViewVO(projectList.get(0));
}
@Override
public List<ProjectView.SimpleProjectView> queryViewAll() {
public ProjectViewVO getProjectViewSetting(String project) {
String markKey = Project.isDefault(project) ? ProjectView.DEFAULT_PROJECT_MARK_KEY : project;
ProjectViewExample projectViewExample = new ProjectViewExample();
projectViewExample.createCriteria().andStatusEqualTo(EFFECT_PROJECT_STATUS).andMarkKeyEqualTo(markKey);
List<ProjectView> projectList = projectViewDAO.selectWithBLOBsByExample(projectViewExample);
if (CollectionUtils.isEmpty(projectList)) { // 未找到项目则获取默认信息
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
}
return new ProjectViewVO(projectList.get(0));
}
@Override
public List<ProjectViewVO> queryViewAll() {
List<ProjectView> projectList = projectViewDAO.selectWithBLOBsByExample(new ProjectViewExample());
return projectList.stream().map(ProjectView::simplifyProjectView).collect(Collectors.toList());
return projectList.stream().map(projectView -> new ProjectViewVO(projectView)).collect(Collectors.toList());
}
}
}

View File

@ -1,7 +1,7 @@
package club.joylink.rtss.services.simulation;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.project.ProjectVO;
/**
* 项目综合演练仿真服务
@ -14,5 +14,5 @@ public interface ProjectSimulationService {
* @param project
* @return
*/
String createCenterSimulation(LoginUserInfoVO loginUserInfo, Project project);
String createCenterSimulation(LoginUserInfoVO loginUserInfo, ProjectVO project);
}

View File

@ -1,7 +1,6 @@
package club.joylink.rtss.services.simulation;
import club.joylink.rtss.constants.MapPrdTypeEnum;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.IMapService;
import club.joylink.rtss.services.IUserPermissionService;
@ -13,6 +12,7 @@ import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.project.ProjectVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -41,17 +41,17 @@ public class ProjectSimulationServiceImpl implements ProjectSimulationService {
private RtSimulationService rtSimulationService;
@Override
public String createCenterSimulation(LoginUserInfoVO loginUserInfo, Project project) {
public String createCenterSimulation(LoginUserInfoVO loginUserInfo, ProjectVO projectVO) {
AccountVO accountVO = loginUserInfo.getAccountVO();
// 查询用户综合演练配置
// 查询项目地图默认取第一个暂时这样处理后面考虑配置实训室-地图对应
List<MapVO> mapList = this.iMapService.findOnlineMapByProjectCode(project.name());
BusinessExceptionAssertEnum.INVALID_OPERATION.assertCollectionNotEmpty(mapList, String.format("项目[%s]无地图", project.name()));
List<MapVO> mapList = this.iMapService.findOnlineMapByProjectCode(projectVO.name());
BusinessExceptionAssertEnum.INVALID_OPERATION.assertCollectionNotEmpty(mapList, String.format("项目[%s]无地图", projectVO.name()));
Long mapId = mapList.get(0).getId();
// 权限判断 : Project.BJD.equals(project)
if (project.isPermissionVail()) {
if (projectVO.isPermissionVail()) {
List<UserPermissionVO> userPermissionList = this.iUserPermissionService
.getSimulationUserPermission(accountVO, mapId, MapPrdTypeEnum.CENTER.getCode());
BusinessExceptionAssertEnum.SIMULATION_PERMISSION_NOT_EXIST
@ -66,7 +66,7 @@ public class ProjectSimulationServiceImpl implements ProjectSimulationService {
.assertNotTrue(CollectionUtils.isEmpty(collect), "用户仿真权限当前时间不可用");
}
// Project.WJLS.equals(project)
if (project.isCreateLocalSimulation()) {
if (projectVO.isCreateLocalSimulation()) {
return rtSimulationService.create(loginUserInfo.getAccountVO(), mapId, MapPrdTypeEnum.LOCAL).getId();
}
// 构建仿真

View File

@ -52,8 +52,8 @@ public class RailCtcDcmdOperateHandler {
* 保存调度命令,保存到发送方缓存箱(保存到仓库)
*/
@OperateHandlerMapping(type = Operation.Type.CTC_SAVE_DIS_COMMAND)
public void save(Simulation simulation, DisCmd disCmdVo) {
this.disCmdCrudService.save(simulation, disCmdVo);
public void save(Simulation simulation, DisCmd disCmdVo,SimulationMember curMember) {
this.disCmdCrudService.save(simulation, disCmdVo,curMember);
}
/**

View File

@ -30,6 +30,14 @@ public class DisCmdCompanyState {
* </p>
*/
private Status state = Status.Undefined;
/**
* 操作人的id(仿真角色的id)
*/
private String operatorId;
/**
* 如果状态是签收是否是代签
*/
private Boolean signedByProxy;
/**
* 状态改变时的仿真时间
*/

View File

@ -7,6 +7,7 @@ import club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd.data.DisCmdCompanyState;
import club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd.data.DisCmdDb;
import club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd.vo.DisCmdCreateRspVo;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -120,7 +121,7 @@ public class DisCmdCrudService {
/**
* 保存调度命令
*/
public void save(Simulation simulation, DisCmd cmd) {
public void save(Simulation simulation, DisCmd cmd, SimulationMember curMember) {
//参数校验
this.saveParamValid(cmd);
DisCmdDb db = commonService.getCmdDb(simulation);
@ -138,6 +139,7 @@ public class DisCmdCrudService {
send.setCpId(cmd.getSendCompany().getId());
send.setState(DisCmdCompanyState.Status.Cache);
send.setTime(commonService.getNow(simulation));
send.setOperatorId(curMember.getId());
db.getUnSafeCmdStateMap().put(send.getCpId(), send);
//
cmd.getRcvCompanies().forEach(rc -> {

View File

@ -93,6 +93,7 @@ public class DisCmdSendService {
if (haveUnSend) {//有未发送的受令
sendState.setState(DisCmdCompanyState.Status.Sent);
sendState.setTime(commonService.getNow(simulation));
sendState.setOperatorId(sender.getId());
//记录发令方发送的回执
db.addCmdReceipt(DisCmdReceipt.Status.Sent, cmd, cmd.getSendCompany(), sender);
//

View File

@ -32,6 +32,7 @@ public class DisCmdSimpleService {
DisCmdCompanyState rcState = db.getUnSafeCmdStateMap().get(rcId);
rcState.setState(DisCmdCompanyState.Status.Received);//阅读后进入收件箱
rcState.setTime(commonService.getNow(simulation));
rcState.setOperatorId(reader.getId());
// 记录回执
DisCmdCompany rc = db.findCmdCompany(cmdId, rcId);
db.addCmdReceipt(DisCmdReceipt.Status.Received, cmd, rc, reader);
@ -57,6 +58,8 @@ public class DisCmdSimpleService {
DisCmdCompanyState rcState = db.getUnSafeCmdStateMap().get(rcId);
rcState.setState(DisCmdCompanyState.Status.Signed);//签收后进入收件箱
rcState.setTime(commonService.getNow(simulation));
rcState.setOperatorId(signer.getId());
rcState.setSignedByProxy(proxySign);
// 记录回执
DisCmdCompany rc = db.findCmdCompany(cmdId, rcId);
db.addCmdReceipt(proxySign ? DisCmdReceipt.Status.ProxySigned : DisCmdReceipt.Status.Signed, cmd, rc, signer);
@ -84,6 +87,7 @@ public class DisCmdSimpleService {
DisCmdCompanyState rcState = db.getUnSafeCmdStateMap().get(rcId);
rcState.setState(DisCmdCompanyState.Status.Reject);//
rcState.setTime(commonService.getNow(simulation));
rcState.setOperatorId(reject.getId());
// 记录回执
DisCmdCompany rc = db.findCmdCompany(cmdId, rcId);
db.addCmdReceipt(DisCmdReceipt.Status.Rejected, cmd, rc, reject);

View File

@ -4,7 +4,6 @@ import club.joylink.rtss.configuration.configProp.OtherConfig;
import club.joylink.rtss.configuration.configProp.WeChatConfig;
import club.joylink.rtss.constants.MapPrdTypeEnum;
import club.joylink.rtss.constants.ProjectDeviceType;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.*;
import club.joylink.rtss.services.org.IOrgService;
@ -71,6 +70,7 @@ import club.joylink.rtss.vo.client.training.TrainingNewVO;
import club.joylink.rtss.vo.client.userPermission.UserPermissionVO;
import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.map.graph.MapStationNewVO;
import club.joylink.rtss.vo.project.ProjectVO;
import club.joylink.rtss.websocket.StompMessageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -1066,8 +1066,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
@Override
public boolean hasPermission(AccountVO accountVO, Long mapId, String prdType) {
MapVO mapDetail = iMapService.getMapDetail(mapId);
Project project = projectService.queryLoginProjectByCode(mapDetail.getProjectCode());
if (project.isFreeSource()) { //成都工业,郑州共赢所有资源免费
ProjectVO projectVO = projectService.queryLoginProjectByCode(mapDetail.getProjectCode());
if (projectVO.isFreeSource()) { //成都工业,郑州共赢所有资源免费
return true;
}
List<UserPermissionVO> ups = iUserPermissionService.getSimulationUserPermission(accountVO, mapId, prdType);

View File

@ -2,7 +2,6 @@ package club.joylink.rtss.simulation.cbtc;
import club.joylink.rtss.constants.MapPrdTypeEnum;
import club.joylink.rtss.constants.ProjectDeviceType;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.ATS.data.SimulationLog;
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository;
@ -31,6 +30,7 @@ import club.joylink.rtss.simulation.cbtc.training2.Training2;
import club.joylink.rtss.simulation.vo.SimulationInfoVO;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.fault.FaultRuleVO;
import club.joylink.rtss.vo.project.ProjectVO;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
@ -68,7 +68,7 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
*/
private String project;
private Project projectInfo;
private ProjectVO projectVO;
/**
* 数据仓库

View File

@ -48,7 +48,7 @@ public class SimulationBuilder {
if (Objects.nonNull(buildParams.getLoginUserInfo())) {
simulation.setCreatorId(buildParams.getLoginUserInfo().getAccountVO().getIdStr());
simulation.setProject(buildParams.getLoginUserInfo().getProject());
simulation.setProjectInfo(buildParams.getLoginUserInfo().getProjectInfo());
simulation.setProjectVO(buildParams.getLoginUserInfo().getProjectInfo());
}
// 线路配置参数
simulation.getRepository().setConfig(buildConfig(buildParams.getMap().getConfigVO(),

View File

@ -70,7 +70,7 @@ public class SimulationRealDeviceThread {
public void controlDevice(Simulation simulation) {
List<RealDeviceConfig> realDeviceList = simulation.getRealDeviceList();
if (!CollectionUtils.isEmpty(realDeviceList)) {
if (simulation.getProjectInfo().isControlDevice()) {
if (simulation.getProjectVO().isControlDevice()) {
Set<VirtualRealityScreenDoor> vrPsdSet = new HashSet<>();
Set<VirtualRealitySwitch> vrSwitchSet = new HashSet<>();
for (RealDeviceConfig realDevice : realDeviceList) {

View File

@ -1,7 +1,6 @@
package club.joylink.rtss.simulation.rt;
import club.joylink.rtss.constants.MapPrdTypeEnum;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.IDailyRunPlanService;
import club.joylink.rtss.services.ILoadPlanService;
@ -28,6 +27,7 @@ import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.runplan.RunPlanLoadVO;
import club.joylink.rtss.vo.client.runplan.RunPlanVO;
import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.project.ProjectVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
@ -82,8 +82,8 @@ public class RtSimulationService {
}
rtSimulation.init();
// 郑州共赢驾驶默认加载一辆列车
Project project = projectService.queryLoginProjectByCode(mapVO.getProjectCode());
if (project.getDefaultLoadTrain() > 0 && Objects.equals(MapPrdTypeEnum.DRIVER, prdTypeEnum)) {
ProjectVO projectVO = projectService.queryLoginProjectByCode(mapVO.getProjectCode());
if (projectVO.getDefaultLoadTrain() > 0 && Objects.equals(MapPrdTypeEnum.DRIVER, prdTypeEnum)) {
this.srTrainOperationHandler.loadTrain(rtSimulation, "001", true, "T21");
}
simulationManager.start(rtSimulation.getId());
@ -122,10 +122,10 @@ public class RtSimulationService {
private void initCreatorPlayMember(RtSimulation rtSimulation, MapVO mapVO) {
// RtSimulationMember simulationMember = rtSimulation.querySimulationMemberById("2");
// List<RtSimulationMember> memberList = rtSimulation.querySimulationMembersOfRole(RtSimulationMember.Role.LOWS);
Project project = projectService.queryLoginProjectByCode(mapVO.getProjectCode());
if (!StringUtils.isEmpty(project.getDefaultMemberId())) {
ProjectVO projectVO = projectService.queryLoginProjectByCode(mapVO.getProjectCode());
if (!StringUtils.isEmpty(projectVO.getDefaultMemberId())) {
// 大铁微机联锁项目默认新绛站值班员
this.simulationManager.memberPlayedByUser(rtSimulation.getId(), project.getDefaultMemberId(), rtSimulation.getCreator().getId());
this.simulationManager.memberPlayedByUser(rtSimulation.getId(), projectVO.getDefaultMemberId(), rtSimulation.getCreator().getId());
} else {
String memberId = rtSimulation.getSimulationMembers().stream().filter(r -> Objects.equals("001", r.deviceId))
.map(RtSimulationMember::getId).findFirst().orElse("1");

View File

@ -5,6 +5,7 @@ import club.joylink.rtss.entity.SysAccountLogin;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.util.EncryptUtil;
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
import club.joylink.rtss.vo.project.ProjectVO;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@ -29,7 +30,7 @@ public class LoginUserInfoVO {
private String project;
//TODO 20220922 添加
private Project projectInfo;
private ProjectVO projectInfo;
private ProjectDeviceVO deviceVO;
@ -59,10 +60,10 @@ public class LoginUserInfoVO {
this.token = buildToken();
}
public LoginUserInfoVO(AccountVO accountVO, Client client, Project projectInfo, ProjectDeviceVO deviceVO) {
public LoginUserInfoVO(AccountVO accountVO, Client client, ProjectVO projectVO, ProjectDeviceVO deviceVO) {
this.accountVO = accountVO;
this.client = client;
this.projectInfo = projectInfo;
this.projectInfo = projectVO;
this.project = projectInfo.name();
this.deviceVO = deviceVO;
LocalDateTime now = LocalDateTime.now();

View File

@ -1,8 +1,8 @@
package club.joylink.rtss.vo.client;
import club.joylink.rtss.constants.Client;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
import club.joylink.rtss.vo.project.ProjectVO;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Builder;
import lombok.Getter;
@ -28,7 +28,7 @@ public class LoginStatusVO {
private String project;
@JsonIgnore
private Project projectInfo;
private ProjectVO projectVO;
private ProjectDeviceVO deviceVO;

View File

@ -18,8 +18,8 @@ public class CreatePaperCompositionReqVo {
private String profile;
/**
* 项目code
* 组织id
*/
@NotNull
private String projectCode;
private String companyId;
}

View File

@ -22,7 +22,7 @@ public class CreatePaperCompositionRspVo {
private String profile;
/**
* 项目code
* 组织id
*/
private String projectCode;
private String companyId;
}

View File

@ -18,9 +18,9 @@ public class CreatePaperRspVo {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 项目code
* 组织id
*/
private String projectCode;
private String companyId;
/**
* 试卷名称
*/

View File

@ -5,6 +5,8 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
@Data
public class CreatePaperRuleReqVo {
@ -28,7 +30,7 @@ public class CreatePaperRuleReqVo {
/**
* 筛选题目的标签即根据标签来筛选题目
*/
private String tags;
private List<String> tags;
/**
* 该类型题目数量

View File

@ -32,10 +32,10 @@ public class FindPaperCompositionPageReqVo extends PageQueryVO {
*/
private Boolean nameLike = true;
/**
* 项目code<br>
* 组织id<br>
* 选填<br>
*/
private String projectCode;
private String companyId;
/**
* 项目code--是否模糊查询,默认false<br>
* 选填<br>

View File

@ -0,0 +1,71 @@
package club.joylink.rtss.vo.paper;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class PaperCommonQuestionVo {
/**
* 理论题id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 类型 选择题=select,判断题=judge,多选题=multi
*/
private PaperQType.SubType type;
/**
* 创建者id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long createUserId;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 项目code
*/
private String projectCode;
/**
* 公司组织id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long companyId;
/**
* 标签
*/
private String raceLable;
/**
*题目
*/
private String question;
/**
*选项列表
*/
private List<OptionVo> optionList;
/**
* 题目选项
*/
@Data
public static class OptionVo{
/**
* 选项编号
*/
private int id;
/**
* 选项内容
*/
private String content;
}
}

View File

@ -25,7 +25,7 @@ public class PaperCompositionBasicVo {
private String profile;
/**
* 项目code
* 组织id
*/
private String projectCode;
private String companyId;
}

View File

@ -30,7 +30,7 @@ public class PaperCompositionVo {
/**
* 项目code
*/
private String projectCode;
private String companyId;
/**
* 启用起始时间

View File

@ -21,6 +21,14 @@ public class PaperQuestionLoadRspVo {
* 试题类型1-理论题2-实训题
*/
private PaperQType.GroupType type;
/**
* 加载到的实训试题
*/
private PaperTrainingQuestionVo training;
/**
* 加载到的理论试题
*/
private PaperCommonQuestionVo common;
}

View File

@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
public class PaperRuleVo {
@ -35,7 +36,7 @@ public class PaperRuleVo {
/**
* 筛选题目的标签即根据标签来筛选题目
*/
private String tags;
private List<String> tags;
/**
* 该类型题目数量

View File

@ -5,15 +5,22 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
public class PaperSubmitAnswerReqVo {
/**
* 用户试卷id
*/
@NotNull
@JsonSerialize(using = ToStringSerializer.class)
private Long puId;
/**
* 用户试卷试题id
*/
@NotNull
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
private Long pqId;
/**
* 试题类型1-理论题2-实训题
*/
@ -27,5 +34,5 @@ public class PaperSubmitAnswerReqVo {
/**
* 答案
*/
private String answer;
private List<String> answer;
}

View File

@ -8,12 +8,18 @@ import javax.validation.constraints.NotNull;
@Data
public class PaperSubmitAnswerRspVo {
/**
* 用户试卷id
*/
@NotNull
@JsonSerialize(using = ToStringSerializer.class)
private Long puId;
/**
* 用户试卷试题id
*/
@NotNull
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
private Long pqId;
/**
* 试题类型1-理论题2-实训题
*/

View File

@ -23,9 +23,9 @@ public class PaperSubmitRspVo {
*/
private String name;
/**
* 项目code
* 组织id
*/
private String projectCode;
private String companyId;
/**
* 及格分
*/

View File

@ -0,0 +1,26 @@
package club.joylink.rtss.vo.paper;
import lombok.Data;
/**
* 响应实训试题
*/
@Data
public class PaperTrainingQuestionVo {
/**
* 已发布的实训的id
*/
private Long id;
/**
* 实训名称
*/
private String name;
/**
* 实训类型单操 single场景scene
*/
private PaperQType.SubType type;
/**
* 实训描述
*/
private String description;
}

View File

@ -26,9 +26,9 @@ public class PaperUserQuestionVo {
private Long puId;
/**
* 项目code
* 组织id
*/
private String projectCode;
private String companyId;
/**
* 试题类型1-理论题2-实训题

View File

@ -34,9 +34,9 @@ public class PaperUserVo {
private Long pcId;
/**
* 项目code
* 组织id
*/
private String projectCode;
private String companyId;
/**
* 用户最终得分

View File

@ -14,7 +14,7 @@ public class PaperCompositionConvertor {
to.setId(from.getId());
to.setName(from.getName());
to.setProfile(from.getProfile());
to.setProjectCode(from.getProjectCode());
to.setCompanyId(from.getCompanyId());
to.setStartTime(from.getStartTime());
to.setEndTime(from.getEndTime());
to.setValidDuration(from.getValidDuration());

View File

@ -1,40 +1,54 @@
package club.joylink.rtss.vo.paper.convertor;
import club.joylink.rtss.entity.paper.PaperRule;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.paper.CreatePaperRuleReqVo;
import club.joylink.rtss.vo.paper.PaperQType;
import club.joylink.rtss.vo.paper.PaperRuleVo;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
public class PaperRuleConvertor {
public static PaperRuleVo convert(PaperRule from){
public static PaperRuleVo convert(PaperRule from) {
PaperRuleVo to = new PaperRuleVo();
to.setId(from.getId());
to.setPcId(from.getPcId());
to.setType(PaperQType.GroupType.getItem(from.getType()));
to.setSubtype(PaperQType.SubType.getItem(from.getSubtype()));
to.setTags(from.getTags());
to.setTags(JsonUtils.readCollection(from.getTags(),ArrayList.class,String.class));
to.setScore(from.getScore());
to.setSum(from.getSum());
return to;
}
public static PaperRule convert(PaperRuleVo from){
public static PaperRule convert(PaperRuleVo from) {
PaperRule to = new PaperRule();
to.setId(from.getId());
to.setPcId(from.getPcId());
to.setType(from.getType().getValue());
to.setSubtype(from.getSubtype().getValue());
to.setTags(from.getTags());
if (!CollectionUtils.isEmpty(from.getTags())) {
to.setTags(JsonUtils.writeValueAsString(from.getTags()));
} else {
to.setTags(JsonUtils.writeValueAsString(new ArrayList<String>()));
}
to.setScore(from.getScore());
to.setSum(from.getSum());
return to;
}
public static PaperRule convert(CreatePaperRuleReqVo from){
public static PaperRule convert(CreatePaperRuleReqVo from) {
PaperRule to = new PaperRule();
to.setPcId(from.getPcId());
to.setType(from.getType().getValue());
to.setSubtype(from.getSubtype().getValue());
to.setTags(from.getTags());
if (!CollectionUtils.isEmpty(from.getTags())) {
to.setTags(JsonUtils.writeValueAsString(from.getTags()));
} else {
to.setTags(JsonUtils.writeValueAsString(new ArrayList<String>()));
}
to.setScore(from.getScore());
to.setSum(from.getSum());
return to;

View File

@ -10,7 +10,7 @@ public class PaperUserConvertor {
to.setId(from.getId());
to.setUserId(from.getUserId());
to.setPcId(from.getPcId());
to.setProjectCode(from.getProjectCode());
to.setCompanyId(from.getCompanyId());
to.setScore(from.getScore());
to.setStartTime(from.getStartTime());
to.setEndTime(from.getEndTime());

View File

@ -10,7 +10,7 @@ public class PaperUserQuestionConvertor {
PaperUserQuestionVo to = new PaperUserQuestionVo();
to.setId(from.getId());
to.setPuId(from.getPuId());
to.setProjectCode(from.getProjectCode());
to.setCompanyId(from.getCompanyId());
to.setType(PaperQType.GroupType.getItem(from.getType()));
to.setQuestionId(from.getQuestionId());
to.setState(PaperQuestionState.getItem(from.getState()));

View File

@ -0,0 +1,178 @@
package club.joylink.rtss.vo.project;
import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.util.JsonUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.springframework.util.StringUtils;
@Data
public class ProjectVO {
/**
* 项目简称
*/
private String label;
/**
* 项目Code
*/
private String value;
/**
* 反序列化设置信息
*/
@JsonIgnore
private ProjectServerConfig projectServerConfig;
public ProjectVO(Project project) {
this.label = project.getName();
this.value = project.getCode();
if (StringUtils.isEmpty(project.getServerSetting())) {
this.projectServerConfig = null;
} else {
this.projectServerConfig = JsonUtils.read(project.getServerSetting(), ProjectServerConfig.class);
}
}
/**
* 返回项目编码
*/
public String name() {
return this.value;
}
/**
* 是否默认项目
*/
@JsonIgnore
public boolean isDefault() {
if (this.projectServerConfig == null) {
return false;
}
return this.projectServerConfig.getDefaultProject() == 1;
}
@JsonIgnore
public static boolean isDefault(String code) {
return Project.isDefault(code);
}
/**
* 是否登录就创建仿真
*/
@JsonIgnore
public boolean isLoginWithCreateSimulation() {
if (this.projectServerConfig == null) {
return false;
}
return this.projectServerConfig.getLoginCreateSimulation() == 1;
}
@JsonIgnore
public boolean isPermissionVail() {
if (this.projectServerConfig == null) {
return false;
}
return this.projectServerConfig.getCreateSimulationPermission() == 1;
}
@JsonIgnore
public boolean isCreateLocalSimulation() {
if (this.projectServerConfig == null) {
return false;
}
return this.projectServerConfig.getCreateLocalSimulation() == 1;
}
@JsonIgnore
public boolean isMapNeedCharge() {
if (this.projectServerConfig == null) {
return false;
}
return this.projectServerConfig.getMapNeedCharge() == 1;
}
/**
* 是否资源免费
*/
@JsonIgnore
public boolean isFreeSource() {
if (this.projectServerConfig == null) {
return false;
}
return this.projectServerConfig.getFreeSource() == 1;
}
@JsonIgnore
public boolean isControlDevice() {
if (this.projectServerConfig == null) {
return false;
}
return this.projectServerConfig.getControlDevice() == 1;
}
@JsonIgnore
public int getDefaultLoadTrain() {
if (this.projectServerConfig == null) {
return 0;
}
return this.projectServerConfig.getDefaultLoadTrain();
}
@JsonIgnore
public String getDefaultMemberId() {
if (this.projectServerConfig == null) {
return null;
}
return this.projectServerConfig.getDefaultMemberId();
}
@Data
public static class ProjectServerConfig {
/**
* 默认项目
*/
private int defaultProject;
/**
* 登录后创建仿真
*/
private int loginCreateSimulation;
/**
* 登录时创建仿真的权限判断原BJD使用
*/
private int createSimulationPermission;
/**
* 登录时创建仿真判断WJLS创建现地类型
*/
private int createLocalSimulation;
/**
* 地图需要收费DRTS
*/
private int mapNeedCharge;
/**
* 资源免费CGYZZWW
*/
private int freeSource;
/**
* 需要控制装备HEB
*/
private int controlDevice;
/**
* 默认加载列车数
*/
private int defaultLoadTrain;
/**
* 默认加载角色WJLS默认加载2
*/
private String defaultMemberId;
}
}

View File

@ -0,0 +1,28 @@
package club.joylink.rtss.vo.project;
import club.joylink.rtss.entity.project.ProjectView;
import club.joylink.rtss.util.JsonUtils;
import lombok.Data;
import org.springframework.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
@Data
public class ProjectViewVO {
private String markKey;
private String project;
private Map<String, Object> viewSetting;
public ProjectViewVO(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);
}
}
}

View File

@ -5,7 +5,7 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="profile" jdbcType="VARCHAR" property="profile" />
<result column="project_code" jdbcType="VARCHAR" property="projectCode" />
<result column="company_id" jdbcType="VARCHAR" property="companyId" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="valid_duration" jdbcType="INTEGER" property="validDuration" />
@ -74,7 +74,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, profile, project_code, start_time, end_time, valid_duration, pass_score,
id, `name`, profile, company_id, start_time, end_time, valid_duration, pass_score,
creator_id, create_time, update_time, `state`
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperCompositionExample" resultMap="BaseResultMap">
@ -100,7 +100,7 @@
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
select
<include refid="Base_Column_List" />
from paper_composition
where id = #{id,jdbcType=BIGINT}
@ -116,16 +116,16 @@
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.PaperComposition">
insert into paper_composition (id, `name`, profile,
project_code, start_time, end_time,
valid_duration, pass_score, creator_id,
create_time, update_time, `state`
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{profile,jdbcType=VARCHAR},
#{projectCode,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
#{validDuration,jdbcType=INTEGER}, #{passScore,jdbcType=INTEGER}, #{creatorId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{state,jdbcType=INTEGER}
)
insert into paper_composition (id, `name`, profile,
company_id, start_time, end_time,
valid_duration, pass_score, creator_id,
create_time, update_time, `state`
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{profile,jdbcType=VARCHAR},
#{companyId,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
#{validDuration,jdbcType=INTEGER}, #{passScore,jdbcType=INTEGER}, #{creatorId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{state,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.paper.PaperComposition">
insert into paper_composition
@ -139,8 +139,8 @@
<if test="profile != null">
profile,
</if>
<if test="projectCode != null">
project_code,
<if test="companyId != null">
company_id,
</if>
<if test="startTime != null">
start_time,
@ -177,8 +177,8 @@
<if test="profile != null">
#{profile,jdbcType=VARCHAR},
</if>
<if test="projectCode != null">
#{projectCode,jdbcType=VARCHAR},
<if test="companyId != null">
#{companyId,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP},
@ -224,8 +224,8 @@
<if test="record.profile != null">
profile = #{record.profile,jdbcType=VARCHAR},
</if>
<if test="record.projectCode != null">
project_code = #{record.projectCode,jdbcType=VARCHAR},
<if test="record.companyId != null">
company_id = #{record.companyId,jdbcType=VARCHAR},
</if>
<if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=TIMESTAMP},
@ -259,17 +259,17 @@
<update id="updateByExample" parameterType="map">
update paper_composition
set id = #{record.id,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR},
profile = #{record.profile,jdbcType=VARCHAR},
project_code = #{record.projectCode,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
valid_duration = #{record.validDuration,jdbcType=INTEGER},
pass_score = #{record.passScore,jdbcType=INTEGER},
creator_id = #{record.creatorId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
`state` = #{record.state,jdbcType=INTEGER}
`name` = #{record.name,jdbcType=VARCHAR},
profile = #{record.profile,jdbcType=VARCHAR},
company_id = #{record.companyId,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
valid_duration = #{record.validDuration,jdbcType=INTEGER},
pass_score = #{record.passScore,jdbcType=INTEGER},
creator_id = #{record.creatorId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
`state` = #{record.state,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -283,8 +283,8 @@
<if test="profile != null">
profile = #{profile,jdbcType=VARCHAR},
</if>
<if test="projectCode != null">
project_code = #{projectCode,jdbcType=VARCHAR},
<if test="companyId != null">
company_id = #{companyId,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIMESTAMP},
@ -316,16 +316,16 @@
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.paper.PaperComposition">
update paper_composition
set `name` = #{name,jdbcType=VARCHAR},
profile = #{profile,jdbcType=VARCHAR},
project_code = #{projectCode,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
valid_duration = #{validDuration,jdbcType=INTEGER},
pass_score = #{passScore,jdbcType=INTEGER},
creator_id = #{creatorId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
`state` = #{state,jdbcType=INTEGER}
profile = #{profile,jdbcType=VARCHAR},
company_id = #{companyId,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
valid_duration = #{validDuration,jdbcType=INTEGER},
pass_score = #{passScore,jdbcType=INTEGER},
creator_id = #{creatorId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
`state` = #{state,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
</mapper>

View File

@ -5,7 +5,7 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="pc_id" jdbcType="BIGINT" property="pcId" />
<result column="project_code" jdbcType="VARCHAR" property="projectCode" />
<result column="company_id" jdbcType="VARCHAR" property="companyId" />
<result column="score" jdbcType="INTEGER" property="score" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
@ -71,7 +71,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, user_id, pc_id, project_code, score, start_time, end_time, cause, create_time
id, user_id, pc_id, company_id, score, start_time, end_time, cause, create_time
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperUserExample" resultMap="BaseResultMap">
select
@ -113,11 +113,11 @@
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.PaperUser">
insert into paper_user (id, user_id, pc_id,
project_code, score, start_time,
company_id, score, start_time,
end_time, cause, create_time
)
values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{pcId,jdbcType=BIGINT},
#{projectCode,jdbcType=VARCHAR}, #{score,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP},
#{companyId,jdbcType=VARCHAR}, #{score,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP},
#{endTime,jdbcType=TIMESTAMP}, #{cause,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
)
</insert>
@ -133,8 +133,8 @@
<if test="pcId != null">
pc_id,
</if>
<if test="projectCode != null">
project_code,
<if test="companyId != null">
company_id,
</if>
<if test="score != null">
score,
@ -162,8 +162,8 @@
<if test="pcId != null">
#{pcId,jdbcType=BIGINT},
</if>
<if test="projectCode != null">
#{projectCode,jdbcType=VARCHAR},
<if test="companyId != null">
#{companyId,jdbcType=VARCHAR},
</if>
<if test="score != null">
#{score,jdbcType=INTEGER},
@ -200,8 +200,8 @@
<if test="record.pcId != null">
pc_id = #{record.pcId,jdbcType=BIGINT},
</if>
<if test="record.projectCode != null">
project_code = #{record.projectCode,jdbcType=VARCHAR},
<if test="record.companyId != null">
company_id = #{record.companyId,jdbcType=VARCHAR},
</if>
<if test="record.score != null">
score = #{record.score,jdbcType=INTEGER},
@ -228,7 +228,7 @@
set id = #{record.id,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
pc_id = #{record.pcId,jdbcType=BIGINT},
project_code = #{record.projectCode,jdbcType=VARCHAR},
company_id = #{record.companyId,jdbcType=VARCHAR},
score = #{record.score,jdbcType=INTEGER},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
@ -247,8 +247,8 @@
<if test="pcId != null">
pc_id = #{pcId,jdbcType=BIGINT},
</if>
<if test="projectCode != null">
project_code = #{projectCode,jdbcType=VARCHAR},
<if test="companyId != null">
company_id = #{companyId,jdbcType=VARCHAR},
</if>
<if test="score != null">
score = #{score,jdbcType=INTEGER},
@ -272,7 +272,7 @@
update paper_user
set user_id = #{userId,jdbcType=BIGINT},
pc_id = #{pcId,jdbcType=BIGINT},
project_code = #{projectCode,jdbcType=VARCHAR},
company_id = #{companyId,jdbcType=VARCHAR},
score = #{score,jdbcType=INTEGER},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},

View File

@ -4,7 +4,7 @@
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.paper.PaperUserQuestion">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="pu_id" jdbcType="BIGINT" property="puId" />
<result column="project_code" jdbcType="VARCHAR" property="projectCode" />
<result column="company_id" jdbcType="VARCHAR" property="companyId" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="question_id" jdbcType="BIGINT" property="questionId" />
<result column="state" jdbcType="INTEGER" property="state" />
@ -68,7 +68,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, pu_id, project_code, `type`, question_id, `state`
id, pu_id, company_id, `type`, question_id, `state`
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestionExample" resultMap="BaseResultMap">
select
@ -109,10 +109,10 @@
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion">
insert into paper_user_question (id, pu_id, project_code,
insert into paper_user_question (id, pu_id, company_id,
`type`, question_id, `state`
)
values (#{id,jdbcType=BIGINT}, #{puId,jdbcType=BIGINT}, #{projectCode,jdbcType=VARCHAR},
values (#{id,jdbcType=BIGINT}, #{puId,jdbcType=BIGINT}, #{companyId,jdbcType=VARCHAR},
#{type,jdbcType=INTEGER}, #{questionId,jdbcType=BIGINT}, #{state,jdbcType=INTEGER}
)
</insert>
@ -125,8 +125,8 @@
<if test="puId != null">
pu_id,
</if>
<if test="projectCode != null">
project_code,
<if test="companyId != null">
company_id,
</if>
<if test="type != null">
`type`,
@ -145,8 +145,8 @@
<if test="puId != null">
#{puId,jdbcType=BIGINT},
</if>
<if test="projectCode != null">
#{projectCode,jdbcType=VARCHAR},
<if test="companyId != null">
#{companyId,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=INTEGER},
@ -174,8 +174,8 @@
<if test="record.puId != null">
pu_id = #{record.puId,jdbcType=BIGINT},
</if>
<if test="record.projectCode != null">
project_code = #{record.projectCode,jdbcType=VARCHAR},
<if test="record.companyId != null">
company_id = #{record.companyId,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=INTEGER},
@ -195,7 +195,7 @@
update paper_user_question
set id = #{record.id,jdbcType=BIGINT},
pu_id = #{record.puId,jdbcType=BIGINT},
project_code = #{record.projectCode,jdbcType=VARCHAR},
company_id = #{record.companyId,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=INTEGER},
question_id = #{record.questionId,jdbcType=BIGINT},
`state` = #{record.state,jdbcType=INTEGER}
@ -209,8 +209,8 @@
<if test="puId != null">
pu_id = #{puId,jdbcType=BIGINT},
</if>
<if test="projectCode != null">
project_code = #{projectCode,jdbcType=VARCHAR},
<if test="companyId != null">
company_id = #{companyId,jdbcType=VARCHAR},
</if>
<if test="type != null">
`type` = #{type,jdbcType=INTEGER},
@ -227,7 +227,7 @@
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion">
update paper_user_question
set pu_id = #{puId,jdbcType=BIGINT},
project_code = #{projectCode,jdbcType=VARCHAR},
company_id = #{companyId,jdbcType=VARCHAR},
`type` = #{type,jdbcType=INTEGER},
question_id = #{questionId,jdbcType=BIGINT},
`state` = #{state,jdbcType=INTEGER}

View File

@ -5,14 +5,13 @@
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="code" property="code" jdbcType="VARCHAR"/>
<result column="name" property="name" jdbcType="VARCHAR"/>
<result column="name_en" property="nameEn" jdbcType="VARCHAR"/>
<result column="simple_name" property="simpleName" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="status" property="status" jdbcType="INTEGER"/>
<result column="view_show" property="viewShow" jdbcType="INTEGER"/>
</resultMap>
<resultMap id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.project.Project" extends="BaseResultMap">
<result column="description" property="description" jdbcType="LONGVARCHAR"/>
<result column="server_setting" property="serverSetting" jdbcType="LONGVARCHAR"/>
</resultMap>
<sql id="Example_Where_Clause">
@ -76,10 +75,10 @@
</where>
</sql>
<sql id="Base_Column_List">
id, code, name, name_en, simple_name, create_time, update_time, status, view_show
id, code, name, create_time, update_time, status, view_show
</sql>
<sql id="Blob_Column_List">
server_setting
description,server_setting
</sql>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.project.ProjectExample"
@ -147,12 +146,8 @@
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.project.Project">
insert into project ( code,
name, name_en, simple_name,
create_time, update_time, status,
server_setting,view_show)
values (#{code,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{nameEn,jdbcType=VARCHAR}, #{simpleName,jdbcType=VARCHAR},
insert into project ( code, name, description, create_time, update_time, status, server_setting,view_show)
values (#{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER},
#{serverSetting,jdbcType=LONGVARCHAR},#{viewShow,jdbcType=INTEGER})
</insert>
@ -169,11 +164,8 @@
<if test="name != null">
name,
</if>
<if test="nameEn != null">
name_en,
</if>
<if test="simpleName != null">
simple_name,
<if test="description != null">
description,
</if>
<if test="createTime != null">
create_time,
@ -201,11 +193,8 @@
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="nameEn != null">
#{nameEn,jdbcType=VARCHAR},
</if>
<if test="simpleName != null">
#{simpleName,jdbcType=VARCHAR},
<if test="description != null">
#{description,jdbcType=LONGVARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
@ -234,11 +223,8 @@
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="nameEn != null">
name_en = #{nameEn,jdbcType=VARCHAR},
</if>
<if test="simpleName != null">
simple_name = #{simpleName,jdbcType=VARCHAR},
<if test="description != null">
description = #{description,jdbcType=LONGVARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
@ -263,8 +249,7 @@
update project
set code = #{code,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
name_en = #{nameEn,jdbcType=VARCHAR},
simple_name = #{simpleName,jdbcType=VARCHAR},
description = #{description,jdbcType=LONGVARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER},
@ -277,8 +262,7 @@
update project
set code = #{code,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
name_en = #{nameEn,jdbcType=VARCHAR},
simple_name = #{simpleName,jdbcType=VARCHAR},
description = #{description,jdbcType=LONGVARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER},