Merge remote-tracking branch 'origin/test-training2' into test-training2
This commit is contained in:
commit
b13b2e6cbb
12
sql/20230206-zhou.sql
Normal file
12
sql/20230206-zhou.sql
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
-- 用户答题生成对应的规则id
|
||||||
|
ALTER TABLE `rts_paper_user_question`
|
||||||
|
ADD COLUMN `rule_id` bigint not NULL COMMENT '试卷规则rts_paper_rule的id' AFTER `pu_id`;
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE `rts_paper_user_question`
|
||||||
|
ADD COLUMN `sub_type` bigint not NULL COMMENT '规则类型:理论题(1-单选题,2-多选题,3-判断题);实训题(4-单操实训,5-场景实训)' AFTER `type`;
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE `rts_paper_user_question` MODIFY COLUMN tmp_answer VARCHAR(1000);
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ public class DistributeController {
|
|||||||
* 从权限分发,直接分发给指定主体
|
* 从权限分发,直接分发给指定主体
|
||||||
*
|
*
|
||||||
* @param pdId 权限分发id
|
* @param pdId 权限分发id
|
||||||
* @param subjectType 主体类型,其值为(user,org),user-一般用户,org-组织
|
* @param subjectType 主体类型,其值为(user,org,project),user-一般用户,org-组织,project - 项目
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@PostMapping("/{pdId}/to/{subjectType}/{subjectId}")
|
@PostMapping("/{pdId}/to/{subjectType}/{subjectId}")
|
||||||
|
@ -6,6 +6,7 @@ import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
|||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.client.training2.ScoringRuleVO;
|
import club.joylink.rtss.vo.client.training2.ScoringRuleVO;
|
||||||
|
import club.joylink.rtss.vo.paper.PaperTrainAnswerDetail;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ public class SimulationTrainingV2Controller {
|
|||||||
* 结束实训
|
* 结束实训
|
||||||
*/
|
*/
|
||||||
@PutMapping("/{group}/finish")
|
@PutMapping("/{group}/finish")
|
||||||
public Float finishTraining2(@PathVariable String group, @RequestAttribute AccountVO user, @RequestBody List<ScoringRuleVO.DetailVO> scoreList) {
|
public Double finishTraining2(@PathVariable String group, @RequestAttribute AccountVO user, @RequestBody List<PaperTrainAnswerDetail> scoreList) {
|
||||||
return training2Service.finishTraining2(group, user, scoreList);
|
return training2Service.finishTraining2(group, user, scoreList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,12 +511,13 @@ public class SimulationV1Controller {
|
|||||||
/**
|
/**
|
||||||
* 仿真创建接口(新)
|
* 仿真创建接口(新)
|
||||||
*/
|
*/
|
||||||
|
/*@Deprecated
|
||||||
@PostMapping("/new/{mapId}")
|
@PostMapping("/new/{mapId}")
|
||||||
public String createSimulation(@PathVariable long mapId, @RequestBody @Validated SimulationWorkParamVO paramVO,
|
public String createSimulation(@PathVariable long mapId, @RequestBody @Validated SimulationWorkParamVO paramVO,
|
||||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY)
|
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY)
|
||||||
LoginUserInfoVO loginUserInfoVO) {
|
LoginUserInfoVO loginUserInfoVO) {
|
||||||
return simulationService.createSimulation(mapId, null, paramVO, loginUserInfoVO);
|
return simulationService.createSimulation(mapId, null, paramVO, loginUserInfoVO);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据地图功能id创建仿真
|
* 根据地图功能id创建仿真
|
||||||
|
@ -21,7 +21,7 @@ public interface PermissionSubjectDAO {
|
|||||||
"(case when A.subject_type = 'user' then B.nickname else '' end) as nick_name," +
|
"(case when A.subject_type = 'user' then B.nickname else '' end) as nick_name," +
|
||||||
"(case when A.subject_type = 'project' then E.code else '' end ) as project_code,"+
|
"(case when A.subject_type = 'project' then E.code else '' end ) as project_code,"+
|
||||||
" A.amount,A.remains,A.status,A.forever,A.start_time,A.end_time,A.create_time," +
|
" A.amount,A.remains,A.status,A.forever,A.start_time,A.end_time,A.create_time," +
|
||||||
" D.name as permission_name,A.permission_id,A.distribute_id,D.map_id,D.project_code,D.map_id,D.permission_type " +
|
" D.name as permission_name,A.permission_id,A.distribute_id,D.map_id,D.project_code,D.permission_type " +
|
||||||
" from rts_permission_subject A left join sys_account B on A.subject_type = 'user' and A.subject_id = B.id " +
|
" from rts_permission_subject A left join sys_account B on A.subject_type = 'user' and A.subject_id = B.id " +
|
||||||
" left join org C on A.subject_type = 'org' and A.subject_id = C.id " +
|
" left join org C on A.subject_type = 'org' and A.subject_id = C.id " +
|
||||||
" left join rts_project E on A.subject_type = 'project' and A.subject_id = E.id " +
|
" left join rts_project E on A.subject_type = 'project' and A.subject_id = E.id " +
|
||||||
@ -34,7 +34,7 @@ public interface PermissionSubjectDAO {
|
|||||||
" and (C.id = #{orgId} or B.id = #{userId} or E.code = #{projectCode}) " +
|
" and (C.id = #{orgId} or B.id = #{userId} or E.code = #{projectCode}) " +
|
||||||
" and A.status = #{status}" +
|
" and A.status = #{status}" +
|
||||||
"</script>")
|
"</script>")
|
||||||
List<PermissionSubjectVO> findPermissionWithMapIdAndUserInfo(/*@Param("mapId") Long mapId,*/@Param("orgId") Long orgId,@Param("userId") Long userId,@Param("status") Integer status,@Param("projectCode") String projectCode);
|
List<PermissionSubjectVO> findPermissionWithMapIdAndUserInfo(/*@Param("mapId") Long mapId,*/@Param("orgId") Long orgId,@Param("userId") Long userId,@Param("status") Integer status,@Param("projectCode") String projectCode);
|
||||||
@Select("<script>" +
|
@Select("<script>" +
|
||||||
"select A.id,A.subject_type,A.subject_id, " +
|
"select A.id,A.subject_type,A.subject_id, " +
|
||||||
"(case when A.subject_type = 'user' then B.name when A.subject_type = 'org' then C.name when A.subject_type = 'project' then E.name end) as named," +
|
"(case when A.subject_type = 'user' then B.name when A.subject_type = 'org' then C.name when A.subject_type = 'project' then E.name end) as named," +
|
||||||
|
@ -2,8 +2,6 @@ package club.joylink.rtss.dao.permission;
|
|||||||
|
|
||||||
import club.joylink.rtss.entity.permission.RtsPermissionDistributeRef;
|
import club.joylink.rtss.entity.permission.RtsPermissionDistributeRef;
|
||||||
import club.joylink.rtss.entity.permission.RtsPermissionDistributeRefExample;
|
import club.joylink.rtss.entity.permission.RtsPermissionDistributeRefExample;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import club.joylink.rtss.vo.permission.distribute.DistributeDataVO;
|
import club.joylink.rtss.vo.permission.distribute.DistributeDataVO;
|
||||||
import org.apache.ibatis.annotations.Insert;
|
import org.apache.ibatis.annotations.Insert;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
@ -11,10 +9,21 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@Repository
|
@Repository
|
||||||
public interface RtsPermissionDistributeRefDAO {
|
public interface RtsPermissionDistributeRefDAO {
|
||||||
|
|
||||||
|
/* @Select("<script>" +
|
||||||
|
"select A.permission_id,B.name as permissionName,A.amount,A.remains " +
|
||||||
|
" from rts_permission_distribute_ref A where 1 = 1 " +
|
||||||
|
"<foreach collection=\"list\" item=\"item\" open=\" or (\" close=\")\" separator=\" and \"> " +
|
||||||
|
" distribute_id=#{item.distributeId} and permission_id = #{item.permissionId} " +
|
||||||
|
"</foreach>" +
|
||||||
|
"</script>")
|
||||||
|
List<RtsPermissionDistributeRef> selectByDistributeIdAndPermissionId(@Param("list") List<PermissionRefParamVO> refList);*/
|
||||||
|
|
||||||
@Select("<script>select A.permission_id,B.name as permissionName,A.amount,A.remains " +
|
@Select("<script>select A.permission_id,B.name as permissionName,A.amount,A.remains " +
|
||||||
" from rts_permission_distribute_ref A left join rts_permission B on A.permission_id = B.id " +
|
" from rts_permission_distribute_ref A left join rts_permission B on A.permission_id = B.id " +
|
||||||
" where 1 = 1 and A.distribute_id = #{disId}" +
|
" where 1 = 1 and A.distribute_id = #{disId}" +
|
||||||
|
@ -19,6 +19,11 @@ public class PaperUserQuestion implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long puId;
|
private Long puId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试卷规则rts_paper_rule的id
|
||||||
|
*/
|
||||||
|
private Long ruleId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组织id
|
* 组织id
|
||||||
*/
|
*/
|
||||||
@ -29,6 +34,11 @@ public class PaperUserQuestion implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则类型:理论题(1-单选题,2-多选题,3-判断题);实训题(4-单操实训,5-场景实训)
|
||||||
|
*/
|
||||||
|
private Integer subType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 试题id
|
* 试题id
|
||||||
*/
|
*/
|
||||||
|
@ -244,6 +244,66 @@ public class PaperUserQuestionExample {
|
|||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andRuleIdIsNull() {
|
||||||
|
addCriterion("rule_id is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andRuleIdIsNotNull() {
|
||||||
|
addCriterion("rule_id is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andRuleIdEqualTo(Long value) {
|
||||||
|
addCriterion("rule_id =", value, "ruleId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andRuleIdNotEqualTo(Long value) {
|
||||||
|
addCriterion("rule_id <>", value, "ruleId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andRuleIdGreaterThan(Long value) {
|
||||||
|
addCriterion("rule_id >", value, "ruleId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andRuleIdGreaterThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("rule_id >=", value, "ruleId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andRuleIdLessThan(Long value) {
|
||||||
|
addCriterion("rule_id <", value, "ruleId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andRuleIdLessThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("rule_id <=", value, "ruleId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andRuleIdIn(List<Long> values) {
|
||||||
|
addCriterion("rule_id in", values, "ruleId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andRuleIdNotIn(List<Long> values) {
|
||||||
|
addCriterion("rule_id not in", values, "ruleId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andRuleIdBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("rule_id between", value1, value2, "ruleId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andRuleIdNotBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("rule_id not between", value1, value2, "ruleId");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
public Criteria andOrgIdIsNull() {
|
public Criteria andOrgIdIsNull() {
|
||||||
addCriterion("org_id is null");
|
addCriterion("org_id is null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
@ -364,6 +424,66 @@ public class PaperUserQuestionExample {
|
|||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andSubTypeIsNull() {
|
||||||
|
addCriterion("sub_type is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andSubTypeIsNotNull() {
|
||||||
|
addCriterion("sub_type is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andSubTypeEqualTo(Integer value) {
|
||||||
|
addCriterion("sub_type =", value, "subType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andSubTypeNotEqualTo(Integer value) {
|
||||||
|
addCriterion("sub_type <>", value, "subType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andSubTypeGreaterThan(Integer value) {
|
||||||
|
addCriterion("sub_type >", value, "subType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andSubTypeGreaterThanOrEqualTo(Integer value) {
|
||||||
|
addCriterion("sub_type >=", value, "subType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andSubTypeLessThan(Integer value) {
|
||||||
|
addCriterion("sub_type <", value, "subType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andSubTypeLessThanOrEqualTo(Integer value) {
|
||||||
|
addCriterion("sub_type <=", value, "subType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andSubTypeIn(List<Integer> values) {
|
||||||
|
addCriterion("sub_type in", values, "subType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andSubTypeNotIn(List<Integer> values) {
|
||||||
|
addCriterion("sub_type not in", values, "subType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andSubTypeBetween(Integer value1, Integer value2) {
|
||||||
|
addCriterion("sub_type between", value1, value2, "subType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andSubTypeNotBetween(Integer value1, Integer value2) {
|
||||||
|
addCriterion("sub_type not between", value1, value2, "subType");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
public Criteria andQuestionIdIsNull() {
|
public Criteria andQuestionIdIsNull() {
|
||||||
addCriterion("question_id is null");
|
addCriterion("question_id is null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
|
@ -68,7 +68,11 @@ public class PaperUserCreateService {
|
|||||||
pu.setStatus(false);
|
pu.setStatus(false);
|
||||||
example.createCriteria().andIdIn(idList);
|
example.createCriteria().andIdIn(idList);
|
||||||
this.paperUserDAO.updateByExampleSelective(pu,example);*/
|
this.paperUserDAO.updateByExampleSelective(pu,example);*/
|
||||||
|
PaperUserExample paperUserExample = new PaperUserExample();
|
||||||
|
paperUserExample.createCriteria().andIdIn(idList);
|
||||||
|
this.paperUserDAO.deleteByExample(paperUserExample);
|
||||||
this.deletePaperUserQuestion(idList);
|
this.deletePaperUserQuestion(idList);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +132,7 @@ public class PaperUserCreateService {
|
|||||||
* 根据试卷蓝图和规则来为用户试卷分配题目
|
* 根据试卷蓝图和规则来为用户试卷分配题目
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
private void dispatcherQuestion(PaperUser pu, PaperComposition pc, List<PaperRule> ruleList) {
|
/* private void dispatcherQuestion(PaperUser pu, PaperComposition pc, List<PaperRule> ruleList) {
|
||||||
for (PaperRule rule : ruleList) {
|
for (PaperRule rule : ruleList) {
|
||||||
String tags = rule.getTags();//规则标签,list json
|
String tags = rule.getTags();//规则标签,list json
|
||||||
PaperQType.GroupType type = PaperQType.GroupType.getItem(rule.getType());
|
PaperQType.GroupType type = PaperQType.GroupType.getItem(rule.getType());
|
||||||
@ -138,7 +142,7 @@ public class PaperUserCreateService {
|
|||||||
this.dispatcherTrainingQuestion(pu, pc, rule);
|
this.dispatcherTrainingQuestion(pu, pc, rule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据试卷蓝图和规则来为用户试卷分配题目,处理重复问题
|
* 根据试卷蓝图和规则来为用户试卷分配题目,处理重复问题
|
||||||
@ -149,18 +153,20 @@ public class PaperUserCreateService {
|
|||||||
List<PaperCompositionWithRuleVo.PaperRuleVo> voList = this.sortPaperRule(rule);
|
List<PaperCompositionWithRuleVo.PaperRuleVo> voList = this.sortPaperRule(rule);
|
||||||
Map<Integer,List<Long>> ruleVOMapList = Maps.newHashMap();
|
Map<Integer,List<Long>> ruleVOMapList = Maps.newHashMap();
|
||||||
for (PaperCompositionWithRuleVo.PaperRuleVo ruleVO : voList) {
|
for (PaperCompositionWithRuleVo.PaperRuleVo ruleVO : voList) {
|
||||||
|
List<Long> mapIdList = ruleVOMapList.get(ruleVO.getSubtype().getValue());
|
||||||
|
if(Objects.isNull(mapIdList)){
|
||||||
|
mapIdList = Lists.newArrayList();
|
||||||
|
ruleVOMapList.put(ruleVO.getSubtype().getValue(),mapIdList);
|
||||||
|
}
|
||||||
|
List<Long> createQuestionIdList = null;
|
||||||
if(ruleVO.getType() == PaperQType.GroupType.Common){
|
if(ruleVO.getType() == PaperQType.GroupType.Common){
|
||||||
List<Long> mapIdList = ruleVOMapList.get(ruleVO.getSubtype().getValue());
|
createQuestionIdList = this.dispatcherCommonQuestion2(pu, pc, ruleVO,mapIdList);
|
||||||
List<Long> createQuestionIdList = this.dispatcherCommonQuestion2(pu, pc, ruleVO,mapIdList);
|
|
||||||
if(Objects.isNull(mapIdList)){
|
|
||||||
ruleVOMapList.put(ruleVO.getSubtype().getValue(),createQuestionIdList);
|
|
||||||
}else{
|
|
||||||
mapIdList.addAll(createQuestionIdList);
|
|
||||||
}
|
|
||||||
}else if(ruleVO.getType() == PaperQType.GroupType.Training){
|
}else if(ruleVO.getType() == PaperQType.GroupType.Training){
|
||||||
PaperRule rule2 = PaperRuleConvertor.convert(ruleVO);
|
PaperRule rule2 = PaperRuleConvertor.convert(ruleVO);
|
||||||
|
createQuestionIdList = this.dispatcherTrainingQuestion(pu, pc, rule2,mapIdList);
|
||||||
this.dispatcherTrainingQuestion(pu, pc, rule2);
|
}
|
||||||
|
if(!CollectionUtils.isEmpty(createQuestionIdList)){
|
||||||
|
mapIdList.addAll(createQuestionIdList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -196,8 +202,10 @@ public class PaperUserCreateService {
|
|||||||
puq.setState(PaperQuestionState.Undo.getValue());
|
puq.setState(PaperQuestionState.Undo.getValue());
|
||||||
puq.setPuId(pu.getId());
|
puq.setPuId(pu.getId());
|
||||||
puq.setOrgId(pc.getOrgId());
|
puq.setOrgId(pc.getOrgId());
|
||||||
|
puq.setRuleId(ruleVO.getId());
|
||||||
puq.setType(ruleVO.getType().getValue());
|
puq.setType(ruleVO.getType().getValue());
|
||||||
puq.setQuestionId(q.getId());
|
puq.setQuestionId(q.getId());
|
||||||
|
puq.setSubType(ruleVO.getSubtype().getValue());
|
||||||
paperUserQuestionDAO.insertSelective(puq);
|
paperUserQuestionDAO.insertSelective(puq);
|
||||||
});
|
});
|
||||||
return findIdList;
|
return findIdList;
|
||||||
@ -238,10 +246,10 @@ public class PaperUserCreateService {
|
|||||||
/**
|
/**
|
||||||
* 随机选择实训题目
|
* 随机选择实训题目
|
||||||
*/
|
*/
|
||||||
private void dispatcherTrainingQuestion(PaperUser pu, PaperComposition pc, PaperRule rule) {
|
private List<Long> dispatcherTrainingQuestion(PaperUser pu, PaperComposition pc, PaperRule rule,List<Long> existTrainIds) {
|
||||||
final int qSum = rule.getAmount();//该类型问题个数
|
final int qSum = rule.getAmount();//该类型问题个数
|
||||||
//
|
//
|
||||||
PublishedTraining2Example questionExample = this.trainingQuestionExample(pu, pc, rule);
|
PublishedTraining2Example questionExample = this.trainingQuestionExample(pu, pc, rule,existTrainIds);
|
||||||
//符合条件的题目数目
|
//符合条件的题目数目
|
||||||
long count = trainingDAO.countByExample(questionExample);
|
long count = trainingDAO.countByExample(questionExample);
|
||||||
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
|
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
|
||||||
@ -252,30 +260,34 @@ public class PaperUserCreateService {
|
|||||||
//校验最终查询到的题目数目
|
//校验最终查询到的题目数目
|
||||||
PaperExceptionAssert.PqEnough.assertTrue(findRand.size() == qSum, "没有足够的符合条件的实训题目");
|
PaperExceptionAssert.PqEnough.assertTrue(findRand.size() == qSum, "没有足够的符合条件的实训题目");
|
||||||
//将题目与试卷关联
|
//将题目与试卷关联
|
||||||
|
|
||||||
findRand.forEach(q -> {
|
findRand.forEach(q -> {
|
||||||
PaperUserQuestion puq = new PaperUserQuestion();
|
PaperUserQuestion puq = new PaperUserQuestion();
|
||||||
puq.setState(PaperQuestionState.Undo.getValue());
|
puq.setState(PaperQuestionState.Undo.getValue());
|
||||||
puq.setPuId(pu.getId());
|
puq.setPuId(pu.getId());
|
||||||
puq.setOrgId(pc.getOrgId());
|
puq.setOrgId(pc.getOrgId());
|
||||||
|
puq.setRuleId(rule.getId());
|
||||||
puq.setType(PaperQType.GroupType.getItem(rule.getType()).getValue());
|
puq.setType(PaperQType.GroupType.getItem(rule.getType()).getValue());
|
||||||
puq.setQuestionId(q.getId());
|
puq.setQuestionId(q.getId());
|
||||||
|
puq.setSubType(rule.getSubtype());
|
||||||
paperUserQuestionDAO.insertSelective(puq);
|
paperUserQuestionDAO.insertSelective(puq);
|
||||||
});
|
});
|
||||||
|
return findRand.stream().map(d->d.getId()).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成根据tag查询的条件
|
* 生成根据tag查询的条件
|
||||||
*/
|
*/
|
||||||
private PublishedTraining2Example trainingQuestionExample(PaperUser pu, PaperComposition pc, PaperRule rule) {
|
private PublishedTraining2Example trainingQuestionExample(PaperUser pu, PaperComposition pc, PaperRule rule,List<Long> existTrainIds) {
|
||||||
String tags = rule.getTags();//规则标签,list json
|
String tags = rule.getTags();//规则标签,list json
|
||||||
List<String> tagArray = null != tags && tags.length() > 0 ? JsonUtils.readCollection(tags, ArrayList.class, String.class) : null;
|
List<String> tagArray = null != tags && tags.length() > 0 ? JsonUtils.readCollection(tags, ArrayList.class, String.class) : null;
|
||||||
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
|
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
|
||||||
String subTypeStr = this.paperUserService.getTrainingType(subType);
|
String subTypeStr = this.paperUserService.getTrainingType(subType);
|
||||||
|
|
||||||
|
|
||||||
PublishedTraining2Example questionExample = new PublishedTraining2Example();
|
PublishedTraining2Example questionExample = new PublishedTraining2Example();
|
||||||
PublishedTraining2Example.Criteria criteria = questionExample.createCriteria();
|
PublishedTraining2Example.Criteria criteria = questionExample.createCriteria();
|
||||||
|
if(!CollectionUtils.isEmpty(existTrainIds)){
|
||||||
|
criteria.andIdNotIn(existTrainIds);
|
||||||
|
}
|
||||||
this.training2PublishService.basicQueryCriteria(criteria,pc.getMapId(),pc.getOrgId(), StringUtils.hasText(subTypeStr) ? subTypeStr.toUpperCase():null);
|
this.training2PublishService.basicQueryCriteria(criteria,pc.getMapId(),pc.getOrgId(), StringUtils.hasText(subTypeStr) ? subTypeStr.toUpperCase():null);
|
||||||
if(!CollectionUtils.isEmpty(tagArray)){
|
if(!CollectionUtils.isEmpty(tagArray)){
|
||||||
for (String tag : tagArray) {
|
for (String tag : tagArray) {
|
||||||
|
@ -26,6 +26,7 @@ import org.springframework.util.StringUtils;
|
|||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -158,20 +159,23 @@ public class PaperUserService {
|
|||||||
//统计最终结果
|
//统计最终结果
|
||||||
PaperComposition composition = compositionDAO.selectByPrimaryKey(paper.getPcId());
|
PaperComposition composition = compositionDAO.selectByPrimaryKey(paper.getPcId());
|
||||||
List<PaperRule> ruleList = compositionService.findRuleByPcId(paper.getPcId());
|
List<PaperRule> ruleList = compositionService.findRuleByPcId(paper.getPcId());
|
||||||
Map<PaperQType.SubType, PaperRule> ruleMap = new HashMap<>(ruleList.size());
|
/* Map<PaperQType.SubType, PaperRule> ruleMap = new HashMap<>(ruleList.size());
|
||||||
ruleList.forEach(r -> {
|
ruleList.forEach(r -> {
|
||||||
ruleMap.put(PaperQType.SubType.getItem(r.getSubtype()), r);
|
ruleMap.put(PaperQType.SubType.getItem(r.getSubtype()), r);
|
||||||
});
|
});*/
|
||||||
|
Map<Long, PaperRule> ruleIdMap = ruleList.stream().collect(Collectors.toMap(d->d.getId(),Function.identity()));
|
||||||
|
|
||||||
List<PaperUserQuestion> userQuestionList = findUserSortedQuestions(puId);
|
List<PaperUserQuestion> userQuestionList = findUserSortedQuestions(puId);
|
||||||
int scoreCommon = 0;
|
int scoreCommon = 0;
|
||||||
int scoreTraining = 0;
|
int scoreTraining = 0;
|
||||||
long paperTime = Duration.between(paper.getStartTime(), now).toMinutes();//实际做题时长min
|
long paperTime = Duration.between(paper.getStartTime(), now).toMinutes();//实际做题时长min
|
||||||
for (PaperUserQuestion uq : userQuestionList) {
|
for (PaperUserQuestion uq : userQuestionList) {
|
||||||
|
PaperRule rule = ruleIdMap.get(uq.getRuleId());
|
||||||
switch (PaperQType.GroupType.getItem(uq.getType())) {
|
switch (PaperQType.GroupType.getItem(uq.getType())) {
|
||||||
case Common:
|
case Common:
|
||||||
scoreCommon += calculateCommonScore(uq, ruleMap);break;
|
scoreCommon += calculateCommonScore(uq, rule);break;
|
||||||
case Training:
|
case Training:
|
||||||
scoreTraining += calculateTrainingScore(uq, ruleMap);break;
|
scoreTraining += calculateTrainingScore(uq, rule);break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,12 +202,12 @@ public class PaperUserService {
|
|||||||
/**
|
/**
|
||||||
* 获取题的最终得分
|
* 获取题的最终得分
|
||||||
*/
|
*/
|
||||||
private int calculateCommonScore(PaperUserQuestion puq, Map<PaperQType.SubType, PaperRule> ruleMap) {
|
private int calculateCommonScore(PaperUserQuestion puq, PaperRule rule) {
|
||||||
PaperQuestionExample example = new PaperQuestionExample();
|
// PaperQuestionExample example = new PaperQuestionExample();
|
||||||
example.createCriteria().andIdEqualTo(puq.getQuestionId());
|
// example.createCriteria().andIdEqualTo(puq.getQuestionId());
|
||||||
PaperQuestion question = pagerQuestionDAO.selectByExample(example).get(0);
|
// PaperQuestion question = pagerQuestionDAO.selectByExample(example).get(0);
|
||||||
if (PaperQuestionState.Right.equals(PaperQuestionState.getItem(puq.getState()))) {//题答对时
|
if (PaperQuestionState.Right.equals(PaperQuestionState.getItem(puq.getState()))) {//题答对时
|
||||||
PaperRule rule = ruleMap.get(this.getPaperQuestionType(question));
|
// PaperRule rule = ruleMap.get(this.getPaperQuestionType(question));
|
||||||
return rule.getScore();
|
return rule.getScore();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -213,12 +217,12 @@ public class PaperUserService {
|
|||||||
/**
|
/**
|
||||||
* 获取题的最终得分
|
* 获取题的最终得分
|
||||||
*/
|
*/
|
||||||
private int calculateTrainingScore(PaperUserQuestion puq, Map<PaperQType.SubType, PaperRule> ruleMap) {
|
private int calculateTrainingScore(PaperUserQuestion puq,PaperRule rule) {
|
||||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
// PublishedTraining2Example example = new PublishedTraining2Example();
|
||||||
example.createCriteria().andIdEqualTo(puq.getQuestionId());
|
// example.createCriteria().andIdEqualTo(puq.getQuestionId());
|
||||||
PublishedTraining2 training = trainingDAO.selectByExample(example).get(0);
|
// PublishedTraining2 training = trainingDAO.selectByExample(example).get(0);
|
||||||
if (PaperQuestionState.Right.equals(PaperQuestionState.getItem(puq.getState()))) {//题答对时
|
if (PaperQuestionState.Right.equals(PaperQuestionState.getItem(puq.getState()))) {//题答对时
|
||||||
PaperRule rule = ruleMap.get(this.getTrainingType(training));
|
// PaperRule rule = ruleMap.get(this.getTrainingType(training));
|
||||||
return rule.getScore();
|
return rule.getScore();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -10,22 +10,33 @@ import club.joylink.rtss.entity.paper.PaperUserQuestion;
|
|||||||
import club.joylink.rtss.entity.paper.PaperUserQuestionExample;
|
import club.joylink.rtss.entity.paper.PaperUserQuestionExample;
|
||||||
import club.joylink.rtss.entity.paper.question.PaperQuestion;
|
import club.joylink.rtss.entity.paper.question.PaperQuestion;
|
||||||
import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
|
import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
|
||||||
|
import club.joylink.rtss.entity.training2.PublishedTraining2;
|
||||||
|
import club.joylink.rtss.exception.BusinessExceptionAssert;
|
||||||
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.exception.PaperExceptionAssert;
|
import club.joylink.rtss.exception.PaperExceptionAssert;
|
||||||
|
import club.joylink.rtss.services.training2.Training2PublishService;
|
||||||
|
import club.joylink.rtss.util.JsonUtils;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.paper.PaperQuestionState;
|
import club.joylink.rtss.vo.client.training2.Step2VO;
|
||||||
import club.joylink.rtss.vo.paper.PaperSubmitAnswerReqVo;
|
import club.joylink.rtss.vo.paper.*;
|
||||||
import club.joylink.rtss.vo.paper.PaperSubmitAnswerRspVo;
|
import club.joylink.rtss.vo.training2.publish.PublishedTraining2DetailRspVo;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.TreeSet;
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户提交答案业务处理
|
* 用户提交答案业务处理
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class PaperUserSubmitAnswerService {
|
public class PaperUserSubmitAnswerService {
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -36,7 +47,8 @@ public class PaperUserSubmitAnswerService {
|
|||||||
private PaperUserDAO paperUserDAO;
|
private PaperUserDAO paperUserDAO;
|
||||||
@Autowired
|
@Autowired
|
||||||
private PaperCompositionDAO paperCompositionDAO;
|
private PaperCompositionDAO paperCompositionDAO;
|
||||||
|
@Autowired
|
||||||
|
private Training2PublishService training2PublishService;
|
||||||
/**
|
/**
|
||||||
* 用户提交答案
|
* 用户提交答案
|
||||||
*/
|
*/
|
||||||
@ -69,10 +81,13 @@ public class PaperUserSubmitAnswerService {
|
|||||||
rsp.setResult(submitCommonAnswer(puq, req));
|
rsp.setResult(submitCommonAnswer(puq, req));
|
||||||
tmpAnswer = this.getAnswerFromSubmit(req);
|
tmpAnswer = this.getAnswerFromSubmit(req);
|
||||||
break;
|
break;
|
||||||
case Training:
|
case Training:{
|
||||||
rsp.setResult(submitTrainingAnswer(puq, req));
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue((req.getSubType() != PaperQType.SubType.Single && req.getSubType() != PaperQType.SubType.Scene),String.format("未知答题类型[%s]",req.getSubType()));
|
||||||
tmpAnswer = req.getTrainingSuccess().toString();
|
TrainAnswerVO answerVO = this.submitTrainingAnswer(req);
|
||||||
|
rsp.setResult(answerVO.getState());
|
||||||
|
tmpAnswer = JsonUtils.writeValueAsString(answerVO.getDetail());
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//记录用户答题情况
|
//记录用户答题情况
|
||||||
PaperUserQuestion record = new PaperUserQuestion();
|
PaperUserQuestion record = new PaperUserQuestion();
|
||||||
@ -97,14 +112,50 @@ public class PaperUserSubmitAnswerService {
|
|||||||
// PaperExceptionAssert.PuqCanSubmit.assertTrue(PaperQuestionState.Undo.equals(PaperQuestionState.getItem(puq.getState())), "只有未做的题才能提交答案");
|
// PaperExceptionAssert.PuqCanSubmit.assertTrue(PaperQuestionState.Undo.equals(PaperQuestionState.getItem(puq.getState())), "只有未做的题才能提交答案");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private TrainAnswerVO submitTrainingAnswer(PaperSubmitAnswerReqVo reqVo){
|
||||||
* 处理实训题答案
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotTrue(Strings.isNullOrEmpty(reqVo.getCosplayMemberId()),"实训考试没有对应的角色");
|
||||||
*/
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotTrue(reqVo.getTrainDetail().stream().anyMatch(d->Objects.isNull(d.getStepId())),"实训步骤id不能为空");
|
||||||
private PaperQuestionState submitTrainingAnswer(PaperUserQuestion puq, PaperSubmitAnswerReqVo req) {
|
|
||||||
|
|
||||||
return req.getTrainingSuccess() ? PaperQuestionState.Right : PaperQuestionState.Wrong;
|
PublishedTraining2DetailRspVo detailVO = this.training2PublishService.findTrainingAllInfoById(reqVo.getPqId());
|
||||||
|
log.debug("查找对应的实训数据 type:[{}],id[{}]",reqVo.getSubType(),reqVo.getPqId());
|
||||||
|
if(CollectionUtils.isEmpty(reqVo.getTrainDetail())){
|
||||||
|
return new TrainAnswerVO(PaperQuestionState.Undo, Collections.EMPTY_LIST);
|
||||||
|
}
|
||||||
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(detailVO),String.format("未找到对应的实训数据[%s]",reqVo.getPqId()));
|
||||||
|
List<Step2VO> stepList = JsonUtils.readCollection(detailVO.getStepJson(), Step2VO.class);
|
||||||
|
|
||||||
|
Map<Long,PaperTrainAnswerDetail> stepMapper = reqVo.getTrainDetail().stream().collect(Collectors.toMap(d->d.getStepId(), Function.identity(),(v1,v2)->v1));
|
||||||
|
|
||||||
|
stepList = stepList.stream().filter(d->Objects.equals(d.getMemberId(),reqVo.getCosplayMemberId())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if(stepMapper.values().size() != stepList.size()){
|
||||||
|
return new TrainAnswerVO(PaperQuestionState.Wrong, reqVo.getTrainDetail());
|
||||||
|
}
|
||||||
|
if(reqVo.getSubType() == PaperQType.SubType.Single){
|
||||||
|
return this.submitTrainingAnswerForSingle(reqVo,stepMapper);
|
||||||
|
}else if(reqVo.getSubType() == PaperQType.SubType.Scene){
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(false,String.format("目前不支持场景实训"));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理实训题答案
|
||||||
|
* @param req
|
||||||
|
* @param stepMapper
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private TrainAnswerVO submitTrainingAnswerForSingle(PaperSubmitAnswerReqVo req,Map<Long,PaperTrainAnswerDetail> stepMapper) {
|
||||||
|
if(stepMapper.values().stream().allMatch(d->d.isSuccess())){
|
||||||
|
return new TrainAnswerVO(PaperQuestionState.Right, req.getTrainDetail());
|
||||||
|
}
|
||||||
|
return new TrainAnswerVO(PaperQuestionState.Wrong, req.getTrainDetail());
|
||||||
|
}
|
||||||
|
|
||||||
|
private TrainAnswerVO submitTrainingAnswerForScene(PublishedTraining2DetailRspVo trainVO,PaperSubmitAnswerReqVo req,List<Step2VO> stepList){
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(false,String.format("目前不支持场景实训"));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 处理理论题答案
|
* 处理理论题答案
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,6 @@ import club.joylink.rtss.dao.permission.AcPermissionDAO;
|
|||||||
import club.joylink.rtss.dao.permission.PermissionSubjectDAO;
|
import club.joylink.rtss.dao.permission.PermissionSubjectDAO;
|
||||||
import club.joylink.rtss.dao.permission.RtsPermissionDistributeDAO;
|
import club.joylink.rtss.dao.permission.RtsPermissionDistributeDAO;
|
||||||
import club.joylink.rtss.dao.permission.RtsPermissionDistributeRefDAO;
|
import club.joylink.rtss.dao.permission.RtsPermissionDistributeRefDAO;
|
||||||
import club.joylink.rtss.dao.project.ProjectDAO;
|
|
||||||
import club.joylink.rtss.entity.permission.*;
|
import club.joylink.rtss.entity.permission.*;
|
||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.services.QRCodeManager;
|
import club.joylink.rtss.services.QRCodeManager;
|
||||||
@ -57,6 +56,12 @@ public class DistributeService implements IDistributeService{
|
|||||||
/* @Autowired
|
/* @Autowired
|
||||||
private ProjectDAO projectDAO;*/
|
private ProjectDAO projectDAO;*/
|
||||||
|
|
||||||
|
/* @Override
|
||||||
|
public List<RtsPermissionDistributeRef> findDistrbuteDetailForPermission(List<PermissionRefParamVO> refParamVOS){
|
||||||
|
List<RtsPermissionDistributeRef> refList = this.distributeRefDAO.selectByDistributeIdAndPermissionId(refParamVOS);
|
||||||
|
return refList;
|
||||||
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageVO<DistributeDataVO> paging(DistributeQueryVO vo) {
|
public PageVO<DistributeDataVO> paging(DistributeQueryVO vo) {
|
||||||
PageHelper.startPage(vo.getPageNum(),vo.getPageSize());
|
PageHelper.startPage(vo.getPageNum(),vo.getPageSize());
|
||||||
|
@ -3,7 +3,6 @@ package club.joylink.rtss.services.permission;
|
|||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.client.PageVO;
|
import club.joylink.rtss.vo.client.PageVO;
|
||||||
import club.joylink.rtss.vo.permission.PermissionDistributeStatusEnum;
|
|
||||||
import club.joylink.rtss.vo.permission.PermissionSubjectTypeEnum;
|
import club.joylink.rtss.vo.permission.PermissionSubjectTypeEnum;
|
||||||
import club.joylink.rtss.vo.permission.distribute.DistributeDataVO;
|
import club.joylink.rtss.vo.permission.distribute.DistributeDataVO;
|
||||||
import club.joylink.rtss.vo.permission.distribute.DistributeQueryVO;
|
import club.joylink.rtss.vo.permission.distribute.DistributeQueryVO;
|
||||||
@ -13,6 +12,8 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface IDistributeService {
|
public interface IDistributeService {
|
||||||
|
|
||||||
|
|
||||||
|
// List<RtsPermissionDistributeRef> findDistrbuteDetailForPermission(List<PermissionRefParamVO> refParamVOS);
|
||||||
/**
|
/**
|
||||||
* 分页显示
|
* 分页显示
|
||||||
* @param vo
|
* @param vo
|
||||||
|
@ -246,7 +246,7 @@ public class Training2RuleService {
|
|||||||
// 需要删除的列表
|
// 需要删除的列表
|
||||||
List<Long> delTrainingIdList = publishedTraining2DAO.selectTrainingIdByRuleNameAndMapId(ruleNameMapList, k);
|
List<Long> delTrainingIdList = publishedTraining2DAO.selectTrainingIdByRuleNameAndMapId(ruleNameMapList, k);
|
||||||
try {
|
try {
|
||||||
Simulation simulation = simulationService.createSimulationPojo(entities.get(0).getId(), loginUserInfoVO);
|
Simulation simulation = simulationService.createSimulationPojo(entities.get(0).getId(), loginUserInfoVO, false);
|
||||||
errorMsgList.addAll(generateTraining(simulation, ruleList, delTrainingIdList, delPublishTrainingByIds));
|
errorMsgList.addAll(generateTraining(simulation, ruleList, delTrainingIdList, delPublishTrainingByIds));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("创建仿真失败", e);
|
log.error("创建仿真失败", e);
|
||||||
@ -272,7 +272,7 @@ public class Training2RuleService {
|
|||||||
List<RtsMapFunction> entities = getRtsMapFunctions(mapInfo.getId());
|
List<RtsMapFunction> entities = getRtsMapFunctions(mapInfo.getId());
|
||||||
if (!CollectionUtils.isEmpty(entities) && !CollectionUtils.isEmpty(lineCodeRuleMap.get(mapInfo.getLineCode()))) {
|
if (!CollectionUtils.isEmpty(entities) && !CollectionUtils.isEmpty(lineCodeRuleMap.get(mapInfo.getLineCode()))) {
|
||||||
try {
|
try {
|
||||||
Simulation simulation = simulationService.createSimulationPojo(entities.get(0).getId(), loginUserInfoVO);
|
Simulation simulation = simulationService.createSimulationPojo(entities.get(0).getId(), loginUserInfoVO, false);
|
||||||
if (CollectionUtils.isEmpty(deleteTrainingIdMap)) {
|
if (CollectionUtils.isEmpty(deleteTrainingIdMap)) {
|
||||||
errorMsgList.addAll(generateTraining(simulation, lineCodeRuleMap.get(mapInfo.getLineCode()), null, delPublishTrainingByMapId));
|
errorMsgList.addAll(generateTraining(simulation, lineCodeRuleMap.get(mapInfo.getLineCode()), null, delPublishTrainingByMapId));
|
||||||
} else {
|
} else {
|
||||||
|
@ -24,6 +24,7 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
|||||||
import club.joylink.rtss.simulation.cbtc.member.MemberManager;
|
import club.joylink.rtss.simulation.cbtc.member.MemberManager;
|
||||||
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
||||||
import club.joylink.rtss.simulation.cbtc.training2.Operation2;
|
import club.joylink.rtss.simulation.cbtc.training2.Operation2;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.training2.ScoringRule2;
|
||||||
import club.joylink.rtss.simulation.cbtc.training2.Step2;
|
import club.joylink.rtss.simulation.cbtc.training2.Step2;
|
||||||
import club.joylink.rtss.simulation.cbtc.training2.Training2;
|
import club.joylink.rtss.simulation.cbtc.training2.Training2;
|
||||||
import club.joylink.rtss.simulation.cbtc.training2.index.Index;
|
import club.joylink.rtss.simulation.cbtc.training2.index.Index;
|
||||||
@ -35,6 +36,7 @@ import club.joylink.rtss.vo.client.SocketMessageVO;
|
|||||||
import club.joylink.rtss.vo.client.WebSocketMessageType;
|
import club.joylink.rtss.vo.client.WebSocketMessageType;
|
||||||
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
|
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
|
||||||
import club.joylink.rtss.vo.client.training2.ScoringRuleVO;
|
import club.joylink.rtss.vo.client.training2.ScoringRuleVO;
|
||||||
|
import club.joylink.rtss.vo.paper.PaperTrainAnswerDetail;
|
||||||
import club.joylink.rtss.websocket.StompMessageService;
|
import club.joylink.rtss.websocket.StompMessageService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -241,7 +243,7 @@ public class Training2Service {
|
|||||||
* <p>
|
* <p>
|
||||||
* 2022-08-30 完成实训后取消仿真暂停
|
* 2022-08-30 完成实训后取消仿真暂停
|
||||||
*/
|
*/
|
||||||
public Float finishTraining2(String group, AccountVO user, List<ScoringRuleVO.DetailVO> scoreList) {
|
public Double finishTraining2(String group, AccountVO user, List<PaperTrainAnswerDetail> scoreDetailList) {
|
||||||
Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
|
Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
|
||||||
if (simulation == null) {
|
if (simulation == null) {
|
||||||
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "仿真不存在");
|
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "仿真不存在");
|
||||||
@ -253,11 +255,20 @@ public class Training2Service {
|
|||||||
training2.finish();
|
training2.finish();
|
||||||
removeTrainingJob(simulation);
|
removeTrainingJob(simulation);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (CollectionUtils.isEmpty(scoreList)) {
|
|
||||||
return 0f;
|
|
||||||
} else {
|
} else {
|
||||||
return (float) scoreList.stream().mapToDouble(ScoringRuleVO.DetailVO::getScore).sum();
|
return 0D;
|
||||||
|
}
|
||||||
|
List<ScoringRule2> scoringRules = training2.getScoringRules();
|
||||||
|
if (CollectionUtils.isEmpty(scoreDetailList) || CollectionUtils.isEmpty(scoringRules)) {
|
||||||
|
return 0D;
|
||||||
|
} else {
|
||||||
|
List<Long> rightStepList = scoreDetailList.stream().filter(PaperTrainAnswerDetail::isSuccess)
|
||||||
|
.map(PaperTrainAnswerDetail::getStepId).collect(Collectors.toList());
|
||||||
|
return scoringRules.stream().mapToDouble(rules ->
|
||||||
|
rules.getDetails().stream()
|
||||||
|
.filter(detail -> rightStepList.contains(detail.getStep().getId()))
|
||||||
|
.mapToDouble(ScoringRule2.Detail::getScore).sum()
|
||||||
|
).sum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,8 +8,10 @@ import club.joylink.rtss.simulation.event.SimulationFaultRemoveEvent;
|
|||||||
import club.joylink.rtss.simulation.event.SimulationMemberPlayChangeEvent;
|
import club.joylink.rtss.simulation.event.SimulationMemberPlayChangeEvent;
|
||||||
import club.joylink.rtss.simulation.messaging.websocket.DefaultMessageSender;
|
import club.joylink.rtss.simulation.messaging.websocket.DefaultMessageSender;
|
||||||
import club.joylink.rtss.simulation.vo.SimulationFaultVO;
|
import club.joylink.rtss.simulation.vo.SimulationFaultVO;
|
||||||
|
import club.joylink.rtss.vo.permission.PermissionSubjectTypeEnum;
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
@ -21,6 +23,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -85,6 +88,60 @@ public class SimulationManager {
|
|||||||
return ROAD_TYPE_CACHE.getIfPresent(type);
|
return ROAD_TYPE_CACHE.getIfPresent(type);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public List<club.joylink.rtss.simulation.cbtc.Simulation> finder2(/*String projectCode, Long orgId,*/ String createUserTypeKey){
|
||||||
|
List<club.joylink.rtss.simulation.cbtc.Simulation> list = Lists.newArrayList();
|
||||||
|
List<club.joylink.rtss.simulation.cbtc.Simulation> tmpList = simulationCache.values().stream()
|
||||||
|
.filter(d->d instanceof club.joylink.rtss.simulation.cbtc.Simulation)
|
||||||
|
.map(d->(club.joylink.rtss.simulation.cbtc.Simulation)d)
|
||||||
|
.filter(d->Objects.nonNull(d.getCreateUserType()) /*&& Objects.equals(d.getMapFunctionId(),functionId)*/)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
for (club.joylink.rtss.simulation.cbtc.Simulation sim : tmpList) {
|
||||||
|
// Long tmpOrgId = sim.getBuildParams().getLoginUserInfo().getTopOrgId();
|
||||||
|
// String tmpProjectCode = sim.getBuildParams().getLoginUserInfo().getProject();
|
||||||
|
/*if(sim.getCreateUserType().getOrDefault(subjectType,false) && Objects.equals(tmpOrgId, orgId) && Objects.equals(tmpProjectCode,projectCode)){
|
||||||
|
|
||||||
|
list.add(sim);
|
||||||
|
}*/
|
||||||
|
/*if(sim.getCreateUserType().keySet().stream().anyMatch(d->createUserTypeKey.contains(d))){
|
||||||
|
list.add(sim);
|
||||||
|
}*/
|
||||||
|
if(sim.getCreateUserType().getOrDefault(createUserTypeKey,false)){
|
||||||
|
/*if(subjectType == PermissionSubjectTypeEnum.project && Objects.equals(tmpProjectCode,projectCode)){
|
||||||
|
list.add(sim);
|
||||||
|
}else if(subjectType == PermissionSubjectTypeEnum.org && Objects.equals(tmpOrgId, orgId)){
|
||||||
|
list.add(sim);
|
||||||
|
}*/
|
||||||
|
list.add(sim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
public List<club.joylink.rtss.simulation.cbtc.Simulation> finder(String projectCode, Long orgId, /*Long functionId,*/ PermissionSubjectTypeEnum subjectType){
|
||||||
|
List<club.joylink.rtss.simulation.cbtc.Simulation> list = Lists.newArrayList();
|
||||||
|
List<club.joylink.rtss.simulation.cbtc.Simulation> tmpList = simulationCache.values().stream()
|
||||||
|
.filter(d->d instanceof club.joylink.rtss.simulation.cbtc.Simulation)
|
||||||
|
.map(d->(club.joylink.rtss.simulation.cbtc.Simulation)d)
|
||||||
|
.filter(d->Objects.nonNull(d.getCreateUserType()) /*&& Objects.equals(d.getMapFunctionId(),functionId)*/)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
for (club.joylink.rtss.simulation.cbtc.Simulation sim : tmpList) {
|
||||||
|
Long tmpOrgId = sim.getBuildParams().getLoginUserInfo().getTopOrgId();
|
||||||
|
String tmpProjectCode = sim.getBuildParams().getLoginUserInfo().getProject();
|
||||||
|
/*if(sim.getCreateUserType().getOrDefault(subjectType,false) && Objects.equals(tmpOrgId, orgId) && Objects.equals(tmpProjectCode,projectCode)){
|
||||||
|
|
||||||
|
list.add(sim);
|
||||||
|
}*/
|
||||||
|
if(sim.getCreateUserType().getOrDefault(subjectType,false)){
|
||||||
|
if(subjectType == PermissionSubjectTypeEnum.project && Objects.equals(tmpProjectCode,projectCode)){
|
||||||
|
list.add(sim);
|
||||||
|
}else if(subjectType == PermissionSubjectTypeEnum.org && Objects.equals(tmpOrgId, orgId)){
|
||||||
|
list.add(sim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 保存仿真
|
* 保存仿真
|
||||||
* @return 需要销毁的仿真
|
* @return 需要销毁的仿真
|
||||||
|
@ -233,6 +233,27 @@ public class Operation {
|
|||||||
* 区段分路不良设置
|
* 区段分路不良设置
|
||||||
*/
|
*/
|
||||||
Section_Defective_Shunting(new Label[]{Label.CLIENT},true),
|
Section_Defective_Shunting(new Label[]{Label.CLIENT},true),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 岔前分路不良
|
||||||
|
*/
|
||||||
|
Section_Defective_Shunting_Front(new Label[]{Label.CLIENT},true),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定位分路不良
|
||||||
|
*/
|
||||||
|
Section_Defective_Shunting_Fixed(new Label[]{Label.CLIENT},true),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 反位分路不良
|
||||||
|
*/
|
||||||
|
Section_Defective_Shunting_Reverse(new Label[]{Label.CLIENT},true),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区段确认空闲,取消分路不良
|
||||||
|
*/
|
||||||
|
Section_Cancel_Defective_Shunting(new Label[]{Label.CLIENT},true),
|
||||||
|
|
||||||
//--------------------------- 信号机 ---------------------------
|
//--------------------------- 信号机 ---------------------------
|
||||||
/**
|
/**
|
||||||
* 封锁
|
* 封锁
|
||||||
|
@ -13,6 +13,8 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@OperateHandler
|
@OperateHandler
|
||||||
@ -177,4 +179,40 @@ public class SectionOperateHandler {
|
|||||||
public void defectiveShunting(Simulation simulation, String sectionCode, List<Section.ShuntingType> shuntingTypeList) {
|
public void defectiveShunting(Simulation simulation, String sectionCode, List<Section.ShuntingType> shuntingTypeList) {
|
||||||
atsSectionService.defectiveShunting(simulation, sectionCode, shuntingTypeList);
|
atsSectionService.defectiveShunting(simulation, sectionCode, shuntingTypeList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置岔前分路不良
|
||||||
|
*/
|
||||||
|
@OperateHandlerMapping(type = Operation.Type.Section_Defective_Shunting_Front)
|
||||||
|
public void defectiveShuntingFront(Simulation simulation, String sectionCode) {
|
||||||
|
atsSectionService.defectiveShuntingAxleCounter(simulation, sectionCode, Section.ShuntingType.SWITCH_FRONT_SHUNTING);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置定位分路不良
|
||||||
|
*/
|
||||||
|
@OperateHandlerMapping(type = Operation.Type.Section_Defective_Shunting_Fixed)
|
||||||
|
public void defectiveShuntingFixed(Simulation simulation, String sectionCode) {
|
||||||
|
atsSectionService.defectiveShuntingAxleCounter(simulation, sectionCode, Section.ShuntingType.FIXED_POSITION_SHUNTING);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置反位分路不良
|
||||||
|
*/
|
||||||
|
@OperateHandlerMapping(type = Operation.Type.Section_Defective_Shunting_Reverse)
|
||||||
|
public void defectiveShuntingReverse(Simulation simulation, String sectionCode) {
|
||||||
|
atsSectionService.defectiveShuntingAxleCounter(simulation, sectionCode, Section.ShuntingType.REVERSE_POSITION_SHUNTING);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区段确认空闲,取消分路不良
|
||||||
|
*
|
||||||
|
* @param simulation 仿真实体
|
||||||
|
* @param sectionCode 区段编码
|
||||||
|
*/
|
||||||
|
@OperateHandlerMapping(type = Operation.Type.Section_Cancel_Defective_Shunting)
|
||||||
|
public void cancelDefectiveShunting(Simulation simulation, String sectionCode) {
|
||||||
|
atsSectionService.defectiveShunting(simulation, sectionCode, new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -128,6 +128,32 @@ public class AtsSectionService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void defectiveShuntingAxleCounter(Simulation simulation, String sectionCode, Section.ShuntingType type) {
|
||||||
|
// 设置区段的不良类型
|
||||||
|
Section section = simulation.getRepository().getByCode(sectionCode, Section.class);
|
||||||
|
// 是否是计轴区段、道岔区段
|
||||||
|
boolean isSwitchSection = section.isAxleCounter() || section.getParent() != null;
|
||||||
|
if (isSwitchSection) {
|
||||||
|
Section targetSection = section.isAxleCounter() ? section : section.getParent();
|
||||||
|
List<Section.ShuntingType> shuntingTypeList = targetSection.getShuntingTypeList();
|
||||||
|
if (shuntingTypeList.contains(type)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
shuntingTypeList.add(type);
|
||||||
|
Collections.sort(shuntingTypeList);
|
||||||
|
targetSection.getLogicList().forEach(logicSection -> {
|
||||||
|
// 岔前分路不良、定位分路不良、反位分路不良
|
||||||
|
Section.ShuntingType shuntingType = getShuntingType(logicSection);
|
||||||
|
logicSection.setShuntingTypeList(shuntingTypeList);
|
||||||
|
logicSection.setBadShunt(shuntingTypeList.contains(shuntingType));
|
||||||
|
});
|
||||||
|
targetSection.setBadShunt(!CollectionUtils.isEmpty(shuntingTypeList));
|
||||||
|
targetSection.setShuntingTypeList(shuntingTypeList);
|
||||||
|
} else {
|
||||||
|
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "非道岔区段");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区段分路不良类型
|
* 区段分路不良类型
|
||||||
*
|
*
|
||||||
|
@ -475,6 +475,26 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable {
|
|||||||
&& this.assistTime.plusSeconds(DEFAULT_DURATION_TIME).isBefore(currentDateTime);
|
&& this.assistTime.plusSeconds(DEFAULT_DURATION_TIME).isBefore(currentDateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取自动出入口电路方向
|
||||||
|
*/
|
||||||
|
public Boolean currentRight() {
|
||||||
|
if (CollectionUtils.isEmpty(this.currentRouteList)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (DirectionRunModel.A.equals(this.runModel)) {
|
||||||
|
if (assistReadyStatus) { // 辅助模式
|
||||||
|
return this.currentRouteList.stream().anyMatch(Route::isRight);
|
||||||
|
} else if (this.changeDirectionStatus) { // 改方状态
|
||||||
|
return !this.right;
|
||||||
|
} else { // 当前默认状态
|
||||||
|
return this.right;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return this.currentRouteList.stream().anyMatch(Route::isRight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置默认属性
|
* 设置默认属性
|
||||||
*/
|
*/
|
||||||
|
@ -10,6 +10,8 @@ import org.springframework.util.CollectionUtils;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@ -177,19 +179,22 @@ public class CiService {
|
|||||||
return level;
|
return level;
|
||||||
// 大铁情况下做判断
|
// 大铁情况下做判断
|
||||||
if (simulation.getRepository().getConfig().isRailway() && !route.isShutting()) {
|
if (simulation.getRepository().getConfig().isRailway() && !route.isShutting()) {
|
||||||
// 如果当前进路在列表中不存在,则信号灯不开放
|
Map<DirectionLabelEnum, StationDirection> stationDirectionMap = route.getStart().getStation().getStationDirectionMap();
|
||||||
boolean isCanHandle = simulation.getRepository().getStationList().stream()
|
// 无出入口数据为空时,不做判断
|
||||||
.filter(station -> station.getCode().equals(route.getStart().getStation().getCode())
|
boolean isCanHandle = stationDirectionMap.isEmpty();
|
||||||
|| station.getCode().equals(route.getDestination().getStation().getCode()))
|
if (!isCanHandle) {
|
||||||
.anyMatch(station -> {
|
Optional<StationDirection> stationDirectionOptional = stationDirectionMap.values().stream()
|
||||||
Map<DirectionLabelEnum, StationDirection> stationDirectionMap = station.getStationDirectionMap();
|
.filter(stationDirection -> Objects.equals(stationDirection.getSignal(), route.getStart())
|
||||||
if (CollectionUtils.isEmpty(stationDirectionMap)) {
|
|| Objects.equals(stationDirection.getSignal(), route.getDestination()))
|
||||||
return true;
|
.findFirst();
|
||||||
}
|
if (stationDirectionOptional.isPresent()) {
|
||||||
return stationDirectionMap.values().stream()
|
StationDirection stationDirection = stationDirectionOptional.get();
|
||||||
.filter(stationDirection -> !CollectionUtils.isEmpty(stationDirection.getCurrentRouteList()))
|
// 如果当前进路在列表中不存在,则信号灯不开放
|
||||||
.anyMatch(stationDirection -> stationDirection.getCurrentRouteList().contains(route));
|
isCanHandle = Objects.equals(stationDirection.currentRight(), route.isRight())
|
||||||
});
|
&& (stationDirection.getChangeDirectionTime() == null || route.getSettingStartTime().isAfter(stationDirection.getChangeDirectionTime()))
|
||||||
|
&& stationDirection.getCurrentRouteList().contains(route);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!isCanHandle) {
|
if (!isCanHandle) {
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,15 @@ public class ControlFloodSignInfo {
|
|||||||
return stationDetailInfoMap.getOrDefault(stationCode, new LinkedList<>());
|
return stationDetailInfoMap.getOrDefault(stationCode, new LinkedList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有信息
|
||||||
|
*/
|
||||||
|
public List<DetailInfo> getAllDetailInfo() {
|
||||||
|
List<DetailInfo> allList = new LinkedList<>();
|
||||||
|
stationDetailInfoMap.forEach((k, v) -> allList.addAll(v));
|
||||||
|
return allList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 详情信息
|
* 详情信息
|
||||||
*/
|
*/
|
||||||
|
@ -48,6 +48,12 @@ public class EquipmentConstructionInfo {
|
|||||||
return stationDetailInfoMap.getOrDefault(stationCode, new LinkedList<>());
|
return stationDetailInfoMap.getOrDefault(stationCode, new LinkedList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ConstructionInfo> getAllDetailInfo() {
|
||||||
|
List<ConstructionInfo> allList = new LinkedList<>();
|
||||||
|
stationDetailInfoMap.forEach((k, v) -> allList.addAll(v));
|
||||||
|
return allList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 施工登记信息
|
* 施工登记信息
|
||||||
|
@ -5,7 +5,6 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
|||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.IdGenerator;
|
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -70,6 +69,15 @@ public class KeyLinkControlInfo {
|
|||||||
return stationDetailInfoMap.getOrDefault(stationCode, new LinkedList<>());
|
return stationDetailInfoMap.getOrDefault(stationCode, new LinkedList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全量信息
|
||||||
|
*/
|
||||||
|
public List<DetailInfo> getAllDetailInfo() {
|
||||||
|
List<DetailInfo> allDetailList = new LinkedList<>();
|
||||||
|
stationDetailInfoMap.forEach((k, v) -> allDetailList.addAll(v));
|
||||||
|
return allDetailList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表详情
|
* 表详情
|
||||||
*/
|
*/
|
||||||
|
@ -53,6 +53,12 @@ public class SupervisorHandOverInfo {
|
|||||||
return handOverDetailInfoMap.get(stationCode).stream().filter(d -> Objects.equals(clsType, d.getType())).collect(Collectors.toList());
|
return handOverDetailInfoMap.get(stationCode).stream().filter(d -> Objects.equals(clsType, d.getType())).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<CommonInfo> getAllDetailInfo(){
|
||||||
|
List<CommonInfo> allList = new LinkedList<>();
|
||||||
|
handOverDetailInfoMap.forEach((k, v) -> allList.addAll(v));
|
||||||
|
return allList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 一些公共属性
|
* 一些公共属性
|
||||||
*/
|
*/
|
||||||
|
@ -5,6 +5,8 @@ import club.joylink.rtss.simulation.cbtc.CI.CiApiService;
|
|||||||
import club.joylink.rtss.simulation.cbtc.CTC.data.*;
|
import club.joylink.rtss.simulation.cbtc.CTC.data.*;
|
||||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@ -177,6 +179,13 @@ public class CTCService {
|
|||||||
*/
|
*/
|
||||||
public List<String> setRoute(Simulation simulation, String routeCode, String tripNumber, Boolean force, Integer duration) {
|
public List<String> setRoute(Simulation simulation, String routeCode, String tripNumber, Boolean force, Integer duration) {
|
||||||
Route route = simulation.getRepository().getByCode(routeCode, Route.class);
|
Route route = simulation.getRepository().getByCode(routeCode, Route.class);
|
||||||
|
if (force == null || !force) { // 非强制办理
|
||||||
|
// 存在分路不良的区段
|
||||||
|
boolean isBadShut = route.getSectionList().stream().anyMatch(Section::isBadShunt);
|
||||||
|
if (isBadShut) {
|
||||||
|
throw BusinessExceptionAssertEnum.OPERATION_FAIL.exception("进路不能办理,存在分路不良区段");
|
||||||
|
}
|
||||||
|
}
|
||||||
Station station = route.getStart().getStation();
|
Station station = route.getStart().getStation();
|
||||||
if (station == null)
|
if (station == null)
|
||||||
station = route.getStart().getDeviceStation();
|
station = route.getStart().getDeviceStation();
|
||||||
|
@ -6,6 +6,7 @@ import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
|||||||
import club.joylink.rtss.simulation.cbtc.ATS.data.SimulationLog;
|
import club.joylink.rtss.simulation.cbtc.ATS.data.SimulationLog;
|
||||||
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository;
|
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository;
|
||||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
|
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
|
||||||
|
|
||||||
import club.joylink.rtss.simulation.cbtc.command.VoiceCommandBO;
|
import club.joylink.rtss.simulation.cbtc.command.VoiceCommandBO;
|
||||||
import club.joylink.rtss.simulation.cbtc.competition.CompetitionBO;
|
import club.joylink.rtss.simulation.cbtc.competition.CompetitionBO;
|
||||||
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
|
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
|
||||||
@ -30,6 +31,7 @@ import club.joylink.rtss.simulation.cbtc.training2.Training2;
|
|||||||
import club.joylink.rtss.simulation.vo.SimulationInfoVO;
|
import club.joylink.rtss.simulation.vo.SimulationInfoVO;
|
||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.client.fault.FaultRuleVO;
|
import club.joylink.rtss.vo.client.fault.FaultRuleVO;
|
||||||
|
import club.joylink.rtss.vo.permission.PermissionSubjectTypeEnum;
|
||||||
import club.joylink.rtss.vo.project.ProjectVO;
|
import club.joylink.rtss.vo.project.ProjectVO;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@ -63,6 +65,10 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
|
|||||||
*/
|
*/
|
||||||
private SimulationBuildParams buildParams;
|
private SimulationBuildParams buildParams;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仿真创建角色类型
|
||||||
|
*/
|
||||||
|
private Map<String,Boolean> createUserType;
|
||||||
/**
|
/**
|
||||||
* 所属项目
|
* 所属项目
|
||||||
*/
|
*/
|
||||||
@ -269,6 +275,7 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
|
|||||||
return Objects.equals(this.project, project);
|
return Objects.equals(this.project, project);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isAdmin(AccountVO user) {
|
public boolean isAdmin(AccountVO user) {
|
||||||
SimulationUser simulationUser = this.querySimulationUserById(user.getId().toString());
|
SimulationUser simulationUser = this.querySimulationUserById(user.getId().toString());
|
||||||
if (Objects.nonNull(simulationUser) && simulationUser.isTeacher()) {
|
if (Objects.nonNull(simulationUser) && simulationUser.isTeacher()) {
|
||||||
|
@ -4,6 +4,7 @@ import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
|
|||||||
import club.joylink.rtss.vo.AccountVO;
|
import club.joylink.rtss.vo.AccountVO;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
|
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
|
||||||
|
import club.joylink.rtss.vo.permission.PermissionSubjectTypeEnum;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -13,7 +14,7 @@ public interface SimulationService {
|
|||||||
/**
|
/**
|
||||||
* 创建仿真
|
* 创建仿真
|
||||||
*/
|
*/
|
||||||
String createSimulation(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO);
|
String createSimulation(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO,Map<String,Boolean> createUserType);
|
||||||
|
|
||||||
String createSimulation(Long mapFunctionId, LoginUserInfoVO loginInfo);
|
String createSimulation(Long mapFunctionId, LoginUserInfoVO loginInfo);
|
||||||
|
|
||||||
@ -59,9 +60,17 @@ public interface SimulationService {
|
|||||||
*/
|
*/
|
||||||
void monitor(String simulationId, AccountVO user);
|
void monitor(String simulationId, AccountVO user);
|
||||||
|
|
||||||
Simulation createSimulationPojo(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO);
|
Simulation createSimulationPojo(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO,Map<String,Boolean> createUserType);
|
||||||
|
|
||||||
Simulation createSimulationPojo(Long mapFunctionId, LoginUserInfoVO loginInfo);
|
/**
|
||||||
|
* 后台创建仿真
|
||||||
|
*
|
||||||
|
* @param mapFunctionId mapFunctionId 功能ID
|
||||||
|
* @param loginInfo 登录信息
|
||||||
|
* @param checkAuth 是否检查权限
|
||||||
|
* @return 仿真对象
|
||||||
|
*/
|
||||||
|
Simulation createSimulationPojo(Long mapFunctionId, LoginUserInfoVO loginInfo, boolean checkAuth);
|
||||||
|
|
||||||
void loadDraftRunPlan(String simulationId, long draftRunPlanId);
|
void loadDraftRunPlan(String simulationId, long draftRunPlanId);
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,12 @@ import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
|
|||||||
import club.joylink.rtss.vo.client.mapFunction.RtsMapFunctionVO;
|
import club.joylink.rtss.vo.client.mapFunction.RtsMapFunctionVO;
|
||||||
import club.joylink.rtss.vo.client.runplan.RunPlanVO;
|
import club.joylink.rtss.vo.client.runplan.RunPlanVO;
|
||||||
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
|
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
|
||||||
|
import club.joylink.rtss.vo.permission.PermissionSubjectTypeEnum;
|
||||||
import club.joylink.rtss.vo.permission.PermissionSystemAbilityVO;
|
import club.joylink.rtss.vo.permission.PermissionSystemAbilityVO;
|
||||||
import club.joylink.rtss.vo.permission.subject.PermissionSubjectVO;
|
import club.joylink.rtss.vo.permission.subject.PermissionSubjectVO;
|
||||||
import club.joylink.rtss.websocket.StompMessageService;
|
import club.joylink.rtss.websocket.StompMessageService;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -34,6 +36,7 @@ import org.springframework.util.CollectionUtils;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -64,8 +67,8 @@ public class SimulationServiceImpl implements SimulationService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserService iSysUserService;
|
private ISysUserService iSysUserService;
|
||||||
@Override
|
@Override
|
||||||
public String createSimulation(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO) {
|
public String createSimulation(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO,Map<String,Boolean> createUserType) {
|
||||||
return createSimulationPojo(mapId, mapFunctionId, workParamVO, loginUserInfoVO).getId();
|
return createSimulationPojo(mapId, mapFunctionId, workParamVO, loginUserInfoVO, createUserType).getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
//只获取所有与该功能相关的权限信息
|
//只获取所有与该功能相关的权限信息
|
||||||
@ -97,9 +100,9 @@ public class SimulationServiceImpl implements SimulationService {
|
|||||||
* @param loginInfo
|
* @param loginInfo
|
||||||
|
|
||||||
*/
|
*/
|
||||||
private void checkUserPermission(RtsMapFunctionVO functionVO,LoginUserInfoVO loginInfo){
|
private Map<String,Boolean> checkUserPermission(RtsMapFunctionVO functionVO,LoginUserInfoVO loginInfo){
|
||||||
if(loginInfo.getAccountVO().isAdmin()){
|
if(loginInfo.getAccountVO().isAdmin()){
|
||||||
return;
|
return Collections.emptyMap();
|
||||||
}
|
}
|
||||||
LoginUserInfoVO newLoginUser = loginInfo;
|
LoginUserInfoVO newLoginUser = loginInfo;
|
||||||
if(loginInfo.getAccountVO().isThirdChildAccount()){
|
if(loginInfo.getAccountVO().isThirdChildAccount()){
|
||||||
@ -112,20 +115,88 @@ public class SimulationServiceImpl implements SimulationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<PermissionSubjectVO> subjectVOList = this.subjectService.findPermissionWithMapIdAndUserInfo(functionVO.getMapId(),newLoginUser);
|
List<PermissionSubjectVO> subjectVOList = this.subjectService.findPermissionWithMapIdAndUserInfo(functionVO.getMapId(),newLoginUser);
|
||||||
|
|
||||||
List<PermissionSubjectVO> newVOLIst = this.filterUserPermission(subjectVOList,functionVO);
|
List<PermissionSubjectVO> newVOLIst = this.filterUserPermission(subjectVOList,functionVO);
|
||||||
if(CollectionUtils.isEmpty(newVOLIst)){
|
if(CollectionUtils.isEmpty(newVOLIst)){
|
||||||
log.error("未找到对应的权限数据mapId[{}],functionId[{}],userId[{}]",functionVO.getMapId(),functionVO.getId(),newLoginUser.getAccountVO().getId());
|
log.error("未找到对应的权限数据mapId[{}],functionId[{}],userId[{}]",functionVO.getMapId(),functionVO.getId(),newLoginUser.getAccountVO().getId());
|
||||||
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertNotTrue(true,"未找到该权限");
|
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertNotTrue(true,"未找到该权限");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// List<PermissionRefParamVO> refParamVOS = PermissionRefParamVO.convert(newVOLIst);
|
||||||
|
// List<RtsPermissionDistributeRef> refList = this.distributeService.findDistrbuteDetailForPermission(refParamVOS);
|
||||||
|
// Map<String,List<RtsPermissionDistributeRef>> refMapList = refList.stream().collect(Collectors.groupingBy(d->String.format("%s-%s",d.getDistributeId(),d.getPermissionId())));
|
||||||
|
|
||||||
|
// Map<PermissionSubjectTypeEnum,Boolean> resultMap = Maps.newHashMap();
|
||||||
|
Map<String,Boolean> resultMap2 = Maps.newHashMap();
|
||||||
|
/* Map<String,List<PermissionSubjectVO>> subjectMapList = subjectVOList.stream().collect(Collectors.groupingBy(PermissionSubjectVO::getSubjectType));
|
||||||
|
for (PermissionSubjectTypeEnum st : PermissionSubjectTypeEnum.SORT_ENUM) {
|
||||||
|
List<PermissionSubjectVO> tmpSubjectVOList = subjectMapList.get(st.name());
|
||||||
|
if(CollectionUtils.isEmpty(tmpSubjectVOList)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
boolean result = this.checkUserPermissionDetail(tmpSubjectVOList,functionVO,loginInfo);
|
||||||
|
resultMap.put(st,result);
|
||||||
|
if(result){
|
||||||
|
if(st != PermissionSubjectTypeEnum.user){
|
||||||
|
int sumer = tmpSubjectVOList.stream().mapToInt(PermissionSubjectVO::getAmount).sum();
|
||||||
|
List<Simulation> findSimList = this.simulationManager.finder(loginInfo.getProject(),loginInfo.getTopOrgId(),*//*functionVO.getId(),*//*st);
|
||||||
|
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertNotTrue(findSimList.size() +1 > sumer,"仿真生成数量过载");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
Map<String,List<PermissionSubjectVO>> subjectMapList = subjectVOList.stream().collect(Collectors.groupingBy(PermissionSubjectVO::getSubjectType));
|
||||||
|
for (PermissionSubjectTypeEnum st : PermissionSubjectTypeEnum.SORT_ENUM) {
|
||||||
|
List<PermissionSubjectVO> tmpSubjectVOList = subjectMapList.get(st.name());
|
||||||
|
if(CollectionUtils.isEmpty(tmpSubjectVOList)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
List<PermissionSubjectVO> canUseSubjectList = this.checkUserPermissionDetail2(tmpSubjectVOList,functionVO,loginInfo);
|
||||||
|
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertNotTrue(CollectionUtils.isEmpty(canUseSubjectList),"该权限过期");
|
||||||
|
for (PermissionSubjectVO subjectVO : canUseSubjectList) {
|
||||||
|
String key = String.format("%s-%s",st.name(),subjectVO.getId());
|
||||||
|
List<Simulation> findSimList = this.simulationManager.finder2(/*functionVO.getId(),*/key);
|
||||||
|
resultMap2.put(key,false);
|
||||||
|
if(findSimList.size() +1 <= subjectVO.getAmount()){
|
||||||
|
resultMap2.put(key,true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(resultMap2.values().stream().anyMatch(d->Objects.equals(true,d))){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertNotTrue(resultMap2.values().stream().allMatch(d->Objects.equals(false,d)),"仿真生成数量过载");
|
||||||
|
return resultMap2;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<PermissionSubjectVO> checkUserPermissionDetail2(List<PermissionSubjectVO> newVOLIst,RtsMapFunctionVO functionVO,LoginUserInfoVO loginInfo){
|
||||||
|
List<PermissionSubjectVO> canUseSubjectList = newVOLIst.stream().filter(d->Objects.equals(true,d.getForever())).collect(Collectors.toList());
|
||||||
|
if(CollectionUtils.isEmpty(canUseSubjectList)){
|
||||||
|
List<Long> timeOverIdList = newVOLIst.stream().filter(d->Objects.nonNull(d.getEndTime()) && d.getEndTime().isBefore(LocalDateTime.now()))
|
||||||
|
.map(d->d.getId())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
canUseSubjectList = newVOLIst.stream().filter(d->!timeOverIdList.contains(d)).collect(Collectors.toList());
|
||||||
|
if(CollectionUtils.isEmpty(timeOverIdList)){
|
||||||
|
log.error("mapId[{}],functionId[{}] userId[{}] 权限过期",functionVO.getMapId(),functionVO.getId(),loginInfo.getAccountVO().getId());
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return canUseSubjectList;
|
||||||
|
}
|
||||||
|
private boolean checkUserPermissionDetail(List<PermissionSubjectVO> newVOLIst,RtsMapFunctionVO functionVO,LoginUserInfoVO loginInfo){
|
||||||
boolean isForever = newVOLIst.stream().anyMatch(d->Objects.equals(true,d.getForever()));
|
boolean isForever = newVOLIst.stream().anyMatch(d->Objects.equals(true,d.getForever()));
|
||||||
if(Objects.equals(false,isForever)){
|
if(Objects.equals(false,isForever)){
|
||||||
boolean timeOver = newVOLIst.stream().allMatch(d->Objects.nonNull(d.getEndTime()) && d.getEndTime().isBefore(LocalDateTime.now()));
|
boolean timeOver = newVOLIst.stream().allMatch(d->Objects.nonNull(d.getEndTime()) && d.getEndTime().isBefore(LocalDateTime.now()));
|
||||||
if(timeOver){
|
if(timeOver){
|
||||||
log.error("mapId[{}],functionId[{}] userId[{}] 权限过期",functionVO.getMapId(),functionVO.getId(),loginInfo.getAccountVO().getId());
|
log.error("mapId[{}],functionId[{}] userId[{}] 权限过期",functionVO.getMapId(),functionVO.getId(),loginInfo.getAccountVO().getId());
|
||||||
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertNotTrue(timeOver,"该权限过期");
|
// BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertNotTrue(timeOver,"该权限过期");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -133,7 +204,7 @@ public class SimulationServiceImpl implements SimulationService {
|
|||||||
RtsMapFunctionVO rtsMapFunctionVO = rtsMapFunctionService.get(mapFunctionId);
|
RtsMapFunctionVO rtsMapFunctionVO = rtsMapFunctionService.get(mapFunctionId);
|
||||||
Long mapId = rtsMapFunctionVO.getMapId();
|
Long mapId = rtsMapFunctionVO.getMapId();
|
||||||
|
|
||||||
this.checkUserPermission(rtsMapFunctionVO,loginInfo);
|
Map<String,Boolean> createUserType = this.checkUserPermission(rtsMapFunctionVO,loginInfo);
|
||||||
SimulationWorkParamVO workParamVO = rtsMapFunctionVO.getParamVO();
|
SimulationWorkParamVO workParamVO = rtsMapFunctionVO.getParamVO();
|
||||||
|
|
||||||
if (workParamVO.containsRealDeviceItem()) {
|
if (workParamVO.containsRealDeviceItem()) {
|
||||||
@ -145,7 +216,7 @@ public class SimulationServiceImpl implements SimulationService {
|
|||||||
oldSimulationOptional.ifPresent(simulation -> simulationManager.destroy(simulation.getId()));
|
oldSimulationOptional.ifPresent(simulation -> simulationManager.destroy(simulation.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return createSimulation(mapId, mapFunctionId, workParamVO, loginInfo);
|
return createSimulation(mapId, mapFunctionId, workParamVO, loginInfo,createUserType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -229,13 +300,14 @@ public class SimulationServiceImpl implements SimulationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Simulation createSimulationPojo(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO) {
|
public Simulation createSimulationPojo(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO, Map<String,Boolean> createUserType) {
|
||||||
//获取仿真工作服务
|
//获取仿真工作服务
|
||||||
SimulationWorkService initService = simulationWorkServiceManager.getWorkService(workParamVO.getType());
|
SimulationWorkService initService = simulationWorkServiceManager.getWorkService(workParamVO.getType());
|
||||||
//创建仿真
|
//创建仿真
|
||||||
String simulationId = SimulationIdGenerator.generateGroup(loginUserInfoVO.getAccountVO().getId(), mapId);
|
String simulationId = SimulationIdGenerator.generateGroup(loginUserInfoVO.getAccountVO().getId(), mapId);
|
||||||
Simulation simulation = initService.create(mapId, workParamVO, loginUserInfoVO, simulationId);
|
Simulation simulation = initService.create(mapId, workParamVO, loginUserInfoVO, simulationId);
|
||||||
simulation.setMapFunctionId(mapFunctionId);
|
simulation.setMapFunctionId(mapFunctionId);
|
||||||
|
simulation.setCreateUserType(createUserType);
|
||||||
LoginUserInfoVO loginUserInfo = simulation.getBuildParams().getLoginUserInfo();
|
LoginUserInfoVO loginUserInfo = simulation.getBuildParams().getLoginUserInfo();
|
||||||
if (Objects.nonNull(loginUserInfo)) {
|
if (Objects.nonNull(loginUserInfo)) {
|
||||||
simulation.setCreatorId(loginUserInfo.getAccountVO().getIdStr());
|
simulation.setCreatorId(loginUserInfo.getAccountVO().getIdStr());
|
||||||
@ -261,10 +333,13 @@ public class SimulationServiceImpl implements SimulationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Simulation createSimulationPojo(Long mapFunctionId, LoginUserInfoVO loginInfo) {
|
public Simulation createSimulationPojo(Long mapFunctionId, LoginUserInfoVO loginInfo, boolean checkAuth) {
|
||||||
RtsMapFunctionVO rtsMapFunctionVO = rtsMapFunctionService.get(mapFunctionId);
|
RtsMapFunctionVO rtsMapFunctionVO = rtsMapFunctionService.get(mapFunctionId);
|
||||||
Long mapId = rtsMapFunctionVO.getMapId();
|
Long mapId = rtsMapFunctionVO.getMapId();
|
||||||
this.checkUserPermission(rtsMapFunctionVO,loginInfo);
|
Map<String,Boolean> createUserType = Maps.newHashMap();
|
||||||
|
if (checkAuth) {
|
||||||
|
createUserType = this.checkUserPermission(rtsMapFunctionVO,loginInfo);
|
||||||
|
}
|
||||||
SimulationWorkParamVO workParamVO = rtsMapFunctionVO.getParamVO();
|
SimulationWorkParamVO workParamVO = rtsMapFunctionVO.getParamVO();
|
||||||
|
|
||||||
if (workParamVO.containsRealDeviceItem()) {
|
if (workParamVO.containsRealDeviceItem()) {
|
||||||
@ -276,7 +351,7 @@ public class SimulationServiceImpl implements SimulationService {
|
|||||||
oldSimulationOptional.ifPresent(simulation -> simulationManager.destroy(simulation.getId()));
|
oldSimulationOptional.ifPresent(simulation -> simulationManager.destroy(simulation.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return createSimulationPojo(mapId, mapFunctionId, workParamVO, loginInfo);
|
return createSimulationPojo(mapId, mapFunctionId, workParamVO, loginInfo, createUserType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,12 +2,18 @@ package club.joylink.rtss.simulation.cbtc.data.storage.ctc;
|
|||||||
|
|
||||||
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository;
|
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository;
|
||||||
import club.joylink.rtss.simulation.cbtc.CTC.data.Ticket;
|
import club.joylink.rtss.simulation.cbtc.CTC.data.Ticket;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.CTC.data.book.ControlFloodSignInfo;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.CTC.data.book.EquipmentConstructionInfo;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.CTC.data.book.KeyLinkControlInfo;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.CTC.data.book.SupervisorHandOverInfo;
|
||||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -71,6 +77,26 @@ public class StorageSimulationCtcDataRepository {
|
|||||||
*/
|
*/
|
||||||
private StorageDisCmdDb storageDisCmdDb;
|
private StorageDisCmdDb storageDisCmdDb;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 非正常情况接发列车关键环节控制表
|
||||||
|
*/
|
||||||
|
private List<KeyLinkControlInfo.DetailInfo> keyLinkControlInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行车设备施工登记簿
|
||||||
|
*/
|
||||||
|
private List<EquipmentConstructionInfo.ConstructionInfo> equipmentConstructionInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交接班记录登记薄
|
||||||
|
*/
|
||||||
|
private List<SupervisorHandOverInfo.CommonInfo> supervisorHandOverInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 防洪安全上岗签到表
|
||||||
|
*/
|
||||||
|
private List<ControlFloodSignInfo.DetailInfo> controlFloodSignInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存剧本数据
|
* 保存剧本数据
|
||||||
*
|
*
|
||||||
@ -113,6 +139,14 @@ public class StorageSimulationCtcDataRepository {
|
|||||||
}
|
}
|
||||||
// 调度命令
|
// 调度命令
|
||||||
this.storageDisCmdDb = StorageDisCmdDb.convert2Storage(repository.getDisCmdDb());
|
this.storageDisCmdDb = StorageDisCmdDb.convert2Storage(repository.getDisCmdDb());
|
||||||
|
// 非正常情况接发列车关键环节控制表
|
||||||
|
this.keyLinkControlInfo = repository.getKeyLinkControlInfo().getAllDetailInfo();
|
||||||
|
// 行车设备施工登记簿
|
||||||
|
this.equipmentConstructionInfo = repository.getEquipmentConstructionInfo().getAllDetailInfo();
|
||||||
|
// 交接班记录登记薄
|
||||||
|
this.supervisorHandOverInfo = repository.getSupervisorHandOverInfo().getAllDetailInfo();
|
||||||
|
// 防洪安全上岗签到表
|
||||||
|
this.controlFloodSignInfo = repository.getControlFloodSignInfo().getAllDetailInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -168,6 +202,18 @@ public class StorageSimulationCtcDataRepository {
|
|||||||
if (this.storageDisCmdDb != null) {
|
if (this.storageDisCmdDb != null) {
|
||||||
this.storageDisCmdDb.convert(repository.getDisCmdDb());
|
this.storageDisCmdDb.convert(repository.getDisCmdDb());
|
||||||
}
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(this.keyLinkControlInfo)) {
|
||||||
|
this.keyLinkControlInfo.forEach(detailInfo -> repository.getKeyLinkControlInfo().saveDetailInfo(detailInfo));
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(this.equipmentConstructionInfo)) {
|
||||||
|
this.equipmentConstructionInfo.forEach(detailInfo -> repository.getEquipmentConstructionInfo().saveDetailInfo(detailInfo));
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(this.supervisorHandOverInfo)) {
|
||||||
|
this.supervisorHandOverInfo.forEach(detailInfo -> repository.getSupervisorHandOverInfo().saveDetailInfo(detailInfo));
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(this.controlFloodSignInfo)) {
|
||||||
|
this.controlFloodSignInfo.forEach(detailInfo -> repository.getControlFloodSignInfo().saveDetailInfo(detailInfo));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNotEmpty() {
|
public boolean isNotEmpty() {
|
||||||
|
@ -23,4 +23,9 @@ public class MapTotalGuideLockButtonVO {
|
|||||||
private String stationCode;
|
private String stationCode;
|
||||||
|
|
||||||
private Point position;
|
private Point position;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 引导锁方向
|
||||||
|
*/
|
||||||
|
private String direction;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ public class PaperQType {
|
|||||||
* 实训题
|
* 实训题
|
||||||
*/
|
*/
|
||||||
Training(2),
|
Training(2),
|
||||||
|
|
||||||
;
|
;
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
|
@ -26,6 +26,10 @@ public enum PaperQuestionState {
|
|||||||
* 4-时间到结束
|
* 4-时间到结束
|
||||||
*/
|
*/
|
||||||
TimeOut(4),
|
TimeOut(4),
|
||||||
|
/**
|
||||||
|
* 5-没有全部回答正确(针对实训场景使用)
|
||||||
|
*/
|
||||||
|
Not_All_Right(5),
|
||||||
;
|
;
|
||||||
private Integer state;
|
private Integer state;
|
||||||
|
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package club.joylink.rtss.vo.paper;
|
package club.joylink.rtss.vo.paper;
|
||||||
|
|
||||||
|
import club.joylink.rtss.vo.client.training2.Operation2VO;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class PaperSubmitAnswerReqVo {
|
public class PaperSubmitAnswerReqVo {
|
||||||
@ -40,8 +42,12 @@ public class PaperSubmitAnswerReqVo {
|
|||||||
* 理论试题答案
|
* 理论试题答案
|
||||||
*/
|
*/
|
||||||
private List<String> answer;
|
private List<String> answer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实训题完成结果,true-实训题成功完成,false-实训题未成功完成
|
* 实操
|
||||||
*/
|
*/
|
||||||
private Boolean trainingSuccess;
|
private List<PaperTrainAnswerDetail> trainDetail;
|
||||||
|
|
||||||
|
private String cosplayMemberId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
package club.joylink.rtss.vo.paper;
|
||||||
|
|
||||||
|
import club.joylink.rtss.vo.client.training2.Operation2VO;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class PaperTrainAnswerDetail {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实训步骤id
|
||||||
|
*/
|
||||||
|
private Long stepId;
|
||||||
|
/**
|
||||||
|
* 实训是否成功
|
||||||
|
*/
|
||||||
|
private boolean success;
|
||||||
|
|
||||||
|
private Integer score;
|
||||||
|
/**
|
||||||
|
* 客户端操作的实训,对应的id必须要传
|
||||||
|
*/
|
||||||
|
private List<TrainOperations> clientOperations;
|
||||||
|
/**
|
||||||
|
* 原有的操作列表
|
||||||
|
*/
|
||||||
|
// private List<Operation2VO.ClientOperation2VO> sourceOperation;
|
||||||
|
|
||||||
|
|
||||||
|
public static class TrainOperations extends Operation2VO.ClientOperation2VO{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,12 @@ public class PaperUserQuestionVo {
|
|||||||
@NotNull
|
@NotNull
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long puId;
|
private Long puId;
|
||||||
|
/**
|
||||||
|
* 试卷规则 rts_paper_rule 的id
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long ruleId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组织id
|
* 组织id
|
||||||
|
15
src/main/java/club/joylink/rtss/vo/paper/TrainAnswerVO.java
Normal file
15
src/main/java/club/joylink/rtss/vo/paper/TrainAnswerVO.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package club.joylink.rtss.vo.paper;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class TrainAnswerVO {
|
||||||
|
private PaperQuestionState state;
|
||||||
|
private List<PaperTrainAnswerDetail> detail;
|
||||||
|
}
|
@ -5,11 +5,14 @@ import club.joylink.rtss.vo.paper.PaperQType;
|
|||||||
import club.joylink.rtss.vo.paper.PaperQuestionState;
|
import club.joylink.rtss.vo.paper.PaperQuestionState;
|
||||||
import club.joylink.rtss.vo.paper.PaperUserQuestionVo;
|
import club.joylink.rtss.vo.paper.PaperUserQuestionVo;
|
||||||
|
|
||||||
|
import java.text.Normalizer;
|
||||||
|
|
||||||
public class PaperUserQuestionConvertor {
|
public class PaperUserQuestionConvertor {
|
||||||
public static PaperUserQuestionVo convert(PaperUserQuestion from){
|
public static PaperUserQuestionVo convert(PaperUserQuestion from){
|
||||||
PaperUserQuestionVo to = new PaperUserQuestionVo();
|
PaperUserQuestionVo to = new PaperUserQuestionVo();
|
||||||
to.setId(from.getId());
|
to.setId(from.getId());
|
||||||
to.setPuId(from.getPuId());
|
to.setPuId(from.getPuId());
|
||||||
|
to.setRuleId(from.getRuleId());
|
||||||
to.setOrgId(from.getOrgId());
|
to.setOrgId(from.getOrgId());
|
||||||
to.setType(PaperQType.GroupType.getItem(from.getType()));
|
to.setType(PaperQType.GroupType.getItem(from.getType()));
|
||||||
to.setQuestionId(from.getQuestionId());
|
to.setQuestionId(from.getQuestionId());
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
package club.joylink.rtss.vo.permission;
|
||||||
|
|
||||||
|
import club.joylink.rtss.vo.permission.subject.PermissionSubjectVO;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class PermissionRefParamVO {
|
||||||
|
private Long distributeId;
|
||||||
|
private Long permissionId;
|
||||||
|
|
||||||
|
public static List<PermissionRefParamVO> convert(List<PermissionSubjectVO> vo){
|
||||||
|
List<PermissionRefParamVO> list = Lists.newArrayList();
|
||||||
|
for (PermissionSubjectVO subjectVO : vo) {
|
||||||
|
list.add(new PermissionRefParamVO(subjectVO.getDistributeId(),subjectVO.getPermissionId()));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
@ -7,5 +7,7 @@ public enum PermissionSubjectTypeEnum {
|
|||||||
user,//用户
|
user,//用户
|
||||||
org,//组织
|
org,//组织
|
||||||
project,//项目
|
project,//项目
|
||||||
|
;
|
||||||
|
public final static PermissionSubjectTypeEnum[] SORT_ENUM = new PermissionSubjectTypeEnum[]{user,project,org};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -97,4 +97,6 @@ public class PermissionDistributeConvertor {
|
|||||||
permissionSubject.setParentId(permissionDistribute.getSourceSubjectId());
|
permissionSubject.setParentId(permissionDistribute.getSourceSubjectId());
|
||||||
return permissionSubject;
|
return permissionSubject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,10 @@
|
|||||||
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.paper.PaperUserQuestion">
|
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.paper.PaperUserQuestion">
|
||||||
<id column="id" jdbcType="BIGINT" property="id" />
|
<id column="id" jdbcType="BIGINT" property="id" />
|
||||||
<result column="pu_id" jdbcType="BIGINT" property="puId" />
|
<result column="pu_id" jdbcType="BIGINT" property="puId" />
|
||||||
|
<result column="rule_id" jdbcType="BIGINT" property="ruleId" />
|
||||||
<result column="org_id" jdbcType="BIGINT" property="orgId" />
|
<result column="org_id" jdbcType="BIGINT" property="orgId" />
|
||||||
<result column="type" jdbcType="INTEGER" property="type" />
|
<result column="type" jdbcType="INTEGER" property="type" />
|
||||||
|
<result column="sub_type" jdbcType="INTEGER" property="subType" />
|
||||||
<result column="question_id" jdbcType="BIGINT" property="questionId" />
|
<result column="question_id" jdbcType="BIGINT" property="questionId" />
|
||||||
<result column="state" jdbcType="INTEGER" property="state" />
|
<result column="state" jdbcType="INTEGER" property="state" />
|
||||||
<result column="tmp_answer" jdbcType="VARCHAR" property="tmpAnswer" />
|
<result column="tmp_answer" jdbcType="VARCHAR" property="tmpAnswer" />
|
||||||
@ -69,7 +71,7 @@
|
|||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, pu_id, org_id, `type`, question_id, `state`, tmp_answer
|
id, pu_id, rule_id, org_id, `type`, sub_type, question_id, `state`, tmp_answer
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestionExample" resultMap="BaseResultMap">
|
<select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestionExample" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
@ -109,29 +111,32 @@
|
|||||||
<include refid="Example_Where_Clause" />
|
<include refid="Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion">
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion" useGeneratedKeys="true">
|
||||||
insert into rts_paper_user_question (id, pu_id, org_id,
|
insert into rts_paper_user_question (pu_id, rule_id, org_id,
|
||||||
`type`, question_id, `state`,
|
`type`, sub_type, question_id,
|
||||||
tmp_answer)
|
`state`, tmp_answer)
|
||||||
values (#{id,jdbcType=BIGINT}, #{puId,jdbcType=BIGINT}, #{orgId,jdbcType=BIGINT},
|
values (#{puId,jdbcType=BIGINT}, #{ruleId,jdbcType=BIGINT}, #{orgId,jdbcType=BIGINT},
|
||||||
#{type,jdbcType=INTEGER}, #{questionId,jdbcType=BIGINT}, #{state,jdbcType=INTEGER},
|
#{type,jdbcType=INTEGER}, #{subType,jdbcType=INTEGER}, #{questionId,jdbcType=BIGINT},
|
||||||
#{tmpAnswer,jdbcType=VARCHAR})
|
#{state,jdbcType=INTEGER}, #{tmpAnswer,jdbcType=VARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion">
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion" useGeneratedKeys="true">
|
||||||
insert into rts_paper_user_question
|
insert into rts_paper_user_question
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
|
||||||
id,
|
|
||||||
</if>
|
|
||||||
<if test="puId != null">
|
<if test="puId != null">
|
||||||
pu_id,
|
pu_id,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="ruleId != null">
|
||||||
|
rule_id,
|
||||||
|
</if>
|
||||||
<if test="orgId != null">
|
<if test="orgId != null">
|
||||||
org_id,
|
org_id,
|
||||||
</if>
|
</if>
|
||||||
<if test="type != null">
|
<if test="type != null">
|
||||||
`type`,
|
`type`,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="subType != null">
|
||||||
|
sub_type,
|
||||||
|
</if>
|
||||||
<if test="questionId != null">
|
<if test="questionId != null">
|
||||||
question_id,
|
question_id,
|
||||||
</if>
|
</if>
|
||||||
@ -143,18 +148,21 @@
|
|||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
|
||||||
#{id,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="puId != null">
|
<if test="puId != null">
|
||||||
#{puId,jdbcType=BIGINT},
|
#{puId,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="ruleId != null">
|
||||||
|
#{ruleId,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
<if test="orgId != null">
|
<if test="orgId != null">
|
||||||
#{orgId,jdbcType=BIGINT},
|
#{orgId,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="type != null">
|
<if test="type != null">
|
||||||
#{type,jdbcType=INTEGER},
|
#{type,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="subType != null">
|
||||||
|
#{subType,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
<if test="questionId != null">
|
<if test="questionId != null">
|
||||||
#{questionId,jdbcType=BIGINT},
|
#{questionId,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
@ -181,12 +189,18 @@
|
|||||||
<if test="record.puId != null">
|
<if test="record.puId != null">
|
||||||
pu_id = #{record.puId,jdbcType=BIGINT},
|
pu_id = #{record.puId,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.ruleId != null">
|
||||||
|
rule_id = #{record.ruleId,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
<if test="record.orgId != null">
|
<if test="record.orgId != null">
|
||||||
org_id = #{record.orgId,jdbcType=BIGINT},
|
org_id = #{record.orgId,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.type != null">
|
<if test="record.type != null">
|
||||||
`type` = #{record.type,jdbcType=INTEGER},
|
`type` = #{record.type,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.subType != null">
|
||||||
|
sub_type = #{record.subType,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
<if test="record.questionId != null">
|
<if test="record.questionId != null">
|
||||||
question_id = #{record.questionId,jdbcType=BIGINT},
|
question_id = #{record.questionId,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
@ -205,8 +219,10 @@
|
|||||||
update rts_paper_user_question
|
update rts_paper_user_question
|
||||||
set id = #{record.id,jdbcType=BIGINT},
|
set id = #{record.id,jdbcType=BIGINT},
|
||||||
pu_id = #{record.puId,jdbcType=BIGINT},
|
pu_id = #{record.puId,jdbcType=BIGINT},
|
||||||
|
rule_id = #{record.ruleId,jdbcType=BIGINT},
|
||||||
org_id = #{record.orgId,jdbcType=BIGINT},
|
org_id = #{record.orgId,jdbcType=BIGINT},
|
||||||
`type` = #{record.type,jdbcType=INTEGER},
|
`type` = #{record.type,jdbcType=INTEGER},
|
||||||
|
sub_type = #{record.subType,jdbcType=INTEGER},
|
||||||
question_id = #{record.questionId,jdbcType=BIGINT},
|
question_id = #{record.questionId,jdbcType=BIGINT},
|
||||||
`state` = #{record.state,jdbcType=INTEGER},
|
`state` = #{record.state,jdbcType=INTEGER},
|
||||||
tmp_answer = #{record.tmpAnswer,jdbcType=VARCHAR}
|
tmp_answer = #{record.tmpAnswer,jdbcType=VARCHAR}
|
||||||
@ -220,12 +236,18 @@
|
|||||||
<if test="puId != null">
|
<if test="puId != null">
|
||||||
pu_id = #{puId,jdbcType=BIGINT},
|
pu_id = #{puId,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="ruleId != null">
|
||||||
|
rule_id = #{ruleId,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
<if test="orgId != null">
|
<if test="orgId != null">
|
||||||
org_id = #{orgId,jdbcType=BIGINT},
|
org_id = #{orgId,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="type != null">
|
<if test="type != null">
|
||||||
`type` = #{type,jdbcType=INTEGER},
|
`type` = #{type,jdbcType=INTEGER},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="subType != null">
|
||||||
|
sub_type = #{subType,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
<if test="questionId != null">
|
<if test="questionId != null">
|
||||||
question_id = #{questionId,jdbcType=BIGINT},
|
question_id = #{questionId,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
@ -241,8 +263,10 @@
|
|||||||
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion">
|
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion">
|
||||||
update rts_paper_user_question
|
update rts_paper_user_question
|
||||||
set pu_id = #{puId,jdbcType=BIGINT},
|
set pu_id = #{puId,jdbcType=BIGINT},
|
||||||
|
rule_id = #{ruleId,jdbcType=BIGINT},
|
||||||
org_id = #{orgId,jdbcType=BIGINT},
|
org_id = #{orgId,jdbcType=BIGINT},
|
||||||
`type` = #{type,jdbcType=INTEGER},
|
`type` = #{type,jdbcType=INTEGER},
|
||||||
|
sub_type = #{subType,jdbcType=INTEGER},
|
||||||
question_id = #{questionId,jdbcType=BIGINT},
|
question_id = #{questionId,jdbcType=BIGINT},
|
||||||
`state` = #{state,jdbcType=INTEGER},
|
`state` = #{state,jdbcType=INTEGER},
|
||||||
tmp_answer = #{tmpAnswer,jdbcType=VARCHAR}
|
tmp_answer = #{tmpAnswer,jdbcType=VARCHAR}
|
||||||
|
@ -80,7 +80,7 @@ public class PaperApiTestController {
|
|||||||
rt.setTags(tags);
|
rt.setTags(tags);
|
||||||
System.out.println(JsonUtils.writeValueAsString(rt));
|
System.out.println(JsonUtils.writeValueAsString(rt));
|
||||||
}
|
}
|
||||||
public static void paperSubmitAnswerReqVo(){
|
/* public static void paperSubmitAnswerReqVo(){
|
||||||
PaperSubmitAnswerReqVo rt = new PaperSubmitAnswerReqVo();
|
PaperSubmitAnswerReqVo rt = new PaperSubmitAnswerReqVo();
|
||||||
rt.setPuId(1L);
|
rt.setPuId(1L);
|
||||||
rt.setPqId(1L);
|
rt.setPqId(1L);
|
||||||
@ -92,7 +92,7 @@ public class PaperApiTestController {
|
|||||||
rt.setAnswer(answer);
|
rt.setAnswer(answer);
|
||||||
rt.setTrainingSuccess(true);
|
rt.setTrainingSuccess(true);
|
||||||
System.out.println(JsonUtils.writeValueAsString(rt));
|
System.out.println(JsonUtils.writeValueAsString(rt));
|
||||||
}
|
}*/
|
||||||
public static void findPaperUserForCompositionReqVo(){
|
public static void findPaperUserForCompositionReqVo(){
|
||||||
FindPaperUserForCompositionReqVo rt = new FindPaperUserForCompositionReqVo();
|
FindPaperUserForCompositionReqVo rt = new FindPaperUserForCompositionReqVo();
|
||||||
rt.setPcId(2L);
|
rt.setPcId(2L);
|
||||||
@ -116,7 +116,7 @@ public class PaperApiTestController {
|
|||||||
rt.setAccount("18710717058");
|
rt.setAccount("18710717058");
|
||||||
System.out.println(JsonUtils.writeValueAsString(rt));
|
System.out.println(JsonUtils.writeValueAsString(rt));
|
||||||
}
|
}
|
||||||
public static void main(String[]args){
|
/* public static void main(String[]args){
|
||||||
createPaperCompositionReqVo();
|
createPaperCompositionReqVo();
|
||||||
paperCompositionBasicVo();
|
paperCompositionBasicVo();
|
||||||
paperCompositionDetailVo();
|
paperCompositionDetailVo();
|
||||||
@ -128,5 +128,5 @@ public class PaperApiTestController {
|
|||||||
findPaperCompositionByAccountReqVo();
|
findPaperCompositionByAccountReqVo();
|
||||||
// findPaperUserForClassReqVo();
|
// findPaperUserForClassReqVo();
|
||||||
findPaperUserForAccountReqVo();
|
findPaperUserForAccountReqVo();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user