Merge remote-tracking branch 'origin/test-training2' into test-training2

This commit is contained in:
joylink_zhangsai 2023-02-08 14:10:20 +08:00
commit b13b2e6cbb
43 changed files with 820 additions and 110 deletions

12
sql/20230206-zhou.sql Normal file
View 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);

View File

@ -62,7 +62,7 @@ public class DistributeController {
* 从权限分发直接分发给指定主体
*
* @param pdId 权限分发id
* @param subjectType 主体类型其值为(user,org)user-一般用户org-组织
* @param subjectType 主体类型其值为(user,org,project)user-一般用户org-组织project - 项目
*
*/
@PostMapping("/{pdId}/to/{subjectType}/{subjectId}")

View File

@ -6,6 +6,7 @@ import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
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.web.bind.annotation.*;
@ -69,7 +70,7 @@ public class SimulationTrainingV2Controller {
* 结束实训
*/
@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);
}

View File

@ -511,12 +511,13 @@ public class SimulationV1Controller {
/**
* 仿真创建接口
*/
/*@Deprecated
@PostMapping("/new/{mapId}")
public String createSimulation(@PathVariable long mapId, @RequestBody @Validated SimulationWorkParamVO paramVO,
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY)
LoginUserInfoVO loginUserInfoVO) {
return simulationService.createSimulation(mapId, null, paramVO, loginUserInfoVO);
}
}*/
/**
* 根据地图功能id创建仿真

View File

@ -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 = '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," +
" 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 " +
" 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 " +

View File

@ -2,8 +2,6 @@ package club.joylink.rtss.dao.permission;
import club.joylink.rtss.entity.permission.RtsPermissionDistributeRef;
import club.joylink.rtss.entity.permission.RtsPermissionDistributeRefExample;
import java.util.List;
import club.joylink.rtss.vo.permission.distribute.DistributeDataVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
@ -11,10 +9,21 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
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 " +
" 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}" +

View File

@ -19,6 +19,11 @@ public class PaperUserQuestion implements Serializable {
*/
private Long puId;
/**
* 试卷规则rts_paper_rule的id
*/
private Long ruleId;
/**
* 组织id
*/
@ -29,6 +34,11 @@ public class PaperUserQuestion implements Serializable {
*/
private Integer type;
/**
* 规则类型理论题(1-单选题2-多选题3-判断题);实训题(4-单操实训5-场景实训)
*/
private Integer subType;
/**
* 试题id
*/

View File

@ -244,6 +244,66 @@ public class PaperUserQuestionExample {
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() {
addCriterion("org_id is null");
return (Criteria) this;
@ -364,6 +424,66 @@ public class PaperUserQuestionExample {
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() {
addCriterion("question_id is null");
return (Criteria) this;

View File

@ -68,7 +68,11 @@ public class PaperUserCreateService {
pu.setStatus(false);
example.createCriteria().andIdIn(idList);
this.paperUserDAO.updateByExampleSelective(pu,example);*/
PaperUserExample paperUserExample = new PaperUserExample();
paperUserExample.createCriteria().andIdIn(idList);
this.paperUserDAO.deleteByExample(paperUserExample);
this.deletePaperUserQuestion(idList);
}
}
@ -128,7 +132,7 @@ public class PaperUserCreateService {
* 根据试卷蓝图和规则来为用户试卷分配题目
*/
@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) {
String tags = rule.getTags();//规则标签list json
PaperQType.GroupType type = PaperQType.GroupType.getItem(rule.getType());
@ -138,7 +142,7 @@ public class PaperUserCreateService {
this.dispatcherTrainingQuestion(pu, pc, rule);
}
}
}
}*/
/**
* 根据试卷蓝图和规则来为用户试卷分配题目处理重复问题
@ -149,18 +153,20 @@ public class PaperUserCreateService {
List<PaperCompositionWithRuleVo.PaperRuleVo> voList = this.sortPaperRule(rule);
Map<Integer,List<Long>> ruleVOMapList = Maps.newHashMap();
for (PaperCompositionWithRuleVo.PaperRuleVo ruleVO : voList) {
if(ruleVO.getType() == PaperQType.GroupType.Common){
List<Long> mapIdList = ruleVOMapList.get(ruleVO.getSubtype().getValue());
List<Long> createQuestionIdList = this.dispatcherCommonQuestion2(pu, pc, ruleVO,mapIdList);
if(Objects.isNull(mapIdList)){
ruleVOMapList.put(ruleVO.getSubtype().getValue(),createQuestionIdList);
}else{
mapIdList.addAll(createQuestionIdList);
mapIdList = Lists.newArrayList();
ruleVOMapList.put(ruleVO.getSubtype().getValue(),mapIdList);
}
List<Long> createQuestionIdList = null;
if(ruleVO.getType() == PaperQType.GroupType.Common){
createQuestionIdList = this.dispatcherCommonQuestion2(pu, pc, ruleVO,mapIdList);
}else if(ruleVO.getType() == PaperQType.GroupType.Training){
PaperRule rule2 = PaperRuleConvertor.convert(ruleVO);
this.dispatcherTrainingQuestion(pu, pc, rule2);
createQuestionIdList = this.dispatcherTrainingQuestion(pu, pc, rule2,mapIdList);
}
if(!CollectionUtils.isEmpty(createQuestionIdList)){
mapIdList.addAll(createQuestionIdList);
}
}
}
@ -196,8 +202,10 @@ public class PaperUserCreateService {
puq.setState(PaperQuestionState.Undo.getValue());
puq.setPuId(pu.getId());
puq.setOrgId(pc.getOrgId());
puq.setRuleId(ruleVO.getId());
puq.setType(ruleVO.getType().getValue());
puq.setQuestionId(q.getId());
puq.setSubType(ruleVO.getSubtype().getValue());
paperUserQuestionDAO.insertSelective(puq);
});
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();//该类型问题个数
//
PublishedTraining2Example questionExample = this.trainingQuestionExample(pu, pc, rule);
PublishedTraining2Example questionExample = this.trainingQuestionExample(pu, pc, rule,existTrainIds);
//符合条件的题目数目
long count = trainingDAO.countByExample(questionExample);
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
@ -252,30 +260,34 @@ public class PaperUserCreateService {
//校验最终查询到的题目数目
PaperExceptionAssert.PqEnough.assertTrue(findRand.size() == qSum, "没有足够的符合条件的实训题目");
//将题目与试卷关联
findRand.forEach(q -> {
PaperUserQuestion puq = new PaperUserQuestion();
puq.setState(PaperQuestionState.Undo.getValue());
puq.setPuId(pu.getId());
puq.setOrgId(pc.getOrgId());
puq.setRuleId(rule.getId());
puq.setType(PaperQType.GroupType.getItem(rule.getType()).getValue());
puq.setQuestionId(q.getId());
puq.setSubType(rule.getSubtype());
paperUserQuestionDAO.insertSelective(puq);
});
return findRand.stream().map(d->d.getId()).collect(Collectors.toList());
}
/**
* 生成根据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
List<String> tagArray = null != tags && tags.length() > 0 ? JsonUtils.readCollection(tags, ArrayList.class, String.class) : null;
PaperQType.SubType subType = PaperQType.SubType.getItem(rule.getSubtype());
String subTypeStr = this.paperUserService.getTrainingType(subType);
PublishedTraining2Example questionExample = new PublishedTraining2Example();
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);
if(!CollectionUtils.isEmpty(tagArray)){
for (String tag : tagArray) {

View File

@ -26,6 +26,7 @@ import org.springframework.util.StringUtils;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@ -158,20 +159,23 @@ public class PaperUserService {
//统计最终结果
PaperComposition composition = compositionDAO.selectByPrimaryKey(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 -> {
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);
int scoreCommon = 0;
int scoreTraining = 0;
long paperTime = Duration.between(paper.getStartTime(), now).toMinutes();//实际做题时长min
for (PaperUserQuestion uq : userQuestionList) {
PaperRule rule = ruleIdMap.get(uq.getRuleId());
switch (PaperQType.GroupType.getItem(uq.getType())) {
case Common:
scoreCommon += calculateCommonScore(uq, ruleMap);break;
scoreCommon += calculateCommonScore(uq, rule);break;
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) {
PaperQuestionExample example = new PaperQuestionExample();
example.createCriteria().andIdEqualTo(puq.getQuestionId());
PaperQuestion question = pagerQuestionDAO.selectByExample(example).get(0);
private int calculateCommonScore(PaperUserQuestion puq, PaperRule rule) {
// PaperQuestionExample example = new PaperQuestionExample();
// example.createCriteria().andIdEqualTo(puq.getQuestionId());
// PaperQuestion question = pagerQuestionDAO.selectByExample(example).get(0);
if (PaperQuestionState.Right.equals(PaperQuestionState.getItem(puq.getState()))) {//题答对时
PaperRule rule = ruleMap.get(this.getPaperQuestionType(question));
// PaperRule rule = ruleMap.get(this.getPaperQuestionType(question));
return rule.getScore();
}
return 0;
@ -213,12 +217,12 @@ public class PaperUserService {
/**
* 获取题的最终得分
*/
private int calculateTrainingScore(PaperUserQuestion puq, Map<PaperQType.SubType, PaperRule> ruleMap) {
PublishedTraining2Example example = new PublishedTraining2Example();
example.createCriteria().andIdEqualTo(puq.getQuestionId());
PublishedTraining2 training = trainingDAO.selectByExample(example).get(0);
private int calculateTrainingScore(PaperUserQuestion puq,PaperRule rule) {
// PublishedTraining2Example example = new PublishedTraining2Example();
// example.createCriteria().andIdEqualTo(puq.getQuestionId());
// PublishedTraining2 training = trainingDAO.selectByExample(example).get(0);
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 0;

View File

@ -10,22 +10,33 @@ import club.joylink.rtss.entity.paper.PaperUserQuestion;
import club.joylink.rtss.entity.paper.PaperUserQuestionExample;
import club.joylink.rtss.entity.paper.question.PaperQuestion;
import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
import club.joylink.rtss.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.services.training2.Training2PublishService;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.paper.PaperQuestionState;
import club.joylink.rtss.vo.paper.PaperSubmitAnswerReqVo;
import club.joylink.rtss.vo.paper.PaperSubmitAnswerRspVo;
import club.joylink.rtss.vo.client.training2.Step2VO;
import club.joylink.rtss.vo.paper.*;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.List;
import java.util.TreeSet;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 用户提交答案业务处理
*/
@Slf4j
@Service
public class PaperUserSubmitAnswerService {
@Autowired
@ -36,7 +47,8 @@ public class PaperUserSubmitAnswerService {
private PaperUserDAO paperUserDAO;
@Autowired
private PaperCompositionDAO paperCompositionDAO;
@Autowired
private Training2PublishService training2PublishService;
/**
* 用户提交答案
*/
@ -69,11 +81,14 @@ public class PaperUserSubmitAnswerService {
rsp.setResult(submitCommonAnswer(puq, req));
tmpAnswer = this.getAnswerFromSubmit(req);
break;
case Training:
rsp.setResult(submitTrainingAnswer(puq, req));
tmpAnswer = req.getTrainingSuccess().toString();
case Training:{
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue((req.getSubType() != PaperQType.SubType.Single && req.getSubType() != PaperQType.SubType.Scene),String.format("未知答题类型[%s]",req.getSubType()));
TrainAnswerVO answerVO = this.submitTrainingAnswer(req);
rsp.setResult(answerVO.getState());
tmpAnswer = JsonUtils.writeValueAsString(answerVO.getDetail());
break;
}
}
//记录用户答题情况
PaperUserQuestion record = new PaperUserQuestion();
record.setId(puq.getId());
@ -97,14 +112,50 @@ public class PaperUserSubmitAnswerService {
// PaperExceptionAssert.PuqCanSubmit.assertTrue(PaperQuestionState.Undo.equals(PaperQuestionState.getItem(puq.getState())), "只有未做的题才能提交答案");
}
/**
* 处理实训题答案
*/
private PaperQuestionState submitTrainingAnswer(PaperUserQuestion puq, PaperSubmitAnswerReqVo req) {
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不能为空");
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;
}
/**
* 处理理论题答案
*/

View File

@ -6,7 +6,6 @@ import club.joylink.rtss.dao.permission.AcPermissionDAO;
import club.joylink.rtss.dao.permission.PermissionSubjectDAO;
import club.joylink.rtss.dao.permission.RtsPermissionDistributeDAO;
import club.joylink.rtss.dao.permission.RtsPermissionDistributeRefDAO;
import club.joylink.rtss.dao.project.ProjectDAO;
import club.joylink.rtss.entity.permission.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.QRCodeManager;
@ -57,6 +56,12 @@ public class DistributeService implements IDistributeService{
/* @Autowired
private ProjectDAO projectDAO;*/
/* @Override
public List<RtsPermissionDistributeRef> findDistrbuteDetailForPermission(List<PermissionRefParamVO> refParamVOS){
List<RtsPermissionDistributeRef> refList = this.distributeRefDAO.selectByDistributeIdAndPermissionId(refParamVOS);
return refList;
}*/
@Override
public PageVO<DistributeDataVO> paging(DistributeQueryVO vo) {
PageHelper.startPage(vo.getPageNum(),vo.getPageSize());

View File

@ -3,7 +3,6 @@ package club.joylink.rtss.services.permission;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
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.distribute.DistributeDataVO;
import club.joylink.rtss.vo.permission.distribute.DistributeQueryVO;
@ -13,6 +12,8 @@ import java.util.List;
public interface IDistributeService {
// List<RtsPermissionDistributeRef> findDistrbuteDetailForPermission(List<PermissionRefParamVO> refParamVOS);
/**
* 分页显示
* @param vo

View File

@ -246,7 +246,7 @@ public class Training2RuleService {
// 需要删除的列表
List<Long> delTrainingIdList = publishedTraining2DAO.selectTrainingIdByRuleNameAndMapId(ruleNameMapList, k);
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));
} catch (Exception e) {
log.error("创建仿真失败", e);
@ -272,7 +272,7 @@ public class Training2RuleService {
List<RtsMapFunction> entities = getRtsMapFunctions(mapInfo.getId());
if (!CollectionUtils.isEmpty(entities) && !CollectionUtils.isEmpty(lineCodeRuleMap.get(mapInfo.getLineCode()))) {
try {
Simulation simulation = simulationService.createSimulationPojo(entities.get(0).getId(), loginUserInfoVO);
Simulation simulation = simulationService.createSimulationPojo(entities.get(0).getId(), loginUserInfoVO, false);
if (CollectionUtils.isEmpty(deleteTrainingIdMap)) {
errorMsgList.addAll(generateTraining(simulation, lineCodeRuleMap.get(mapInfo.getLineCode()), null, delPublishTrainingByMapId));
} else {

View File

@ -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.script.ScriptBO;
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.Training2;
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.factory.SocketMessageFactory;
import club.joylink.rtss.vo.client.training2.ScoringRuleVO;
import club.joylink.rtss.vo.paper.PaperTrainAnswerDetail;
import club.joylink.rtss.websocket.StompMessageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -241,7 +243,7 @@ public class Training2Service {
* <p>
* 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);
if (simulation == null) {
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "仿真不存在");
@ -253,11 +255,20 @@ public class Training2Service {
training2.finish();
removeTrainingJob(simulation);
}
}
if (CollectionUtils.isEmpty(scoreList)) {
return 0f;
} 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();
}
}

View File

@ -8,8 +8,10 @@ import club.joylink.rtss.simulation.event.SimulationFaultRemoveEvent;
import club.joylink.rtss.simulation.event.SimulationMemberPlayChangeEvent;
import club.joylink.rtss.simulation.messaging.websocket.DefaultMessageSender;
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.CacheBuilder;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
@ -21,6 +23,7 @@ import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Slf4j
@ -85,6 +88,60 @@ public class SimulationManager {
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 需要销毁的仿真

View File

@ -233,6 +233,27 @@ public class Operation {
* 区段分路不良设置
*/
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),
//--------------------------- 信号机 ---------------------------
/**
* 封锁

View File

@ -13,6 +13,8 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@OperateHandler
@ -177,4 +179,40 @@ public class SectionOperateHandler {
public void defectiveShunting(Simulation simulation, String sectionCode, List<Section.ShuntingType> 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<>());
}
}

View File

@ -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, "非道岔区段");
}
}
/**
* 区段分路不良类型
*

View File

@ -475,6 +475,26 @@ public class StationDirection extends MayOutOfOrderDevice implements Cloneable {
&& 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);
}
}
/**
* 设置默认属性
*/

View File

@ -10,6 +10,8 @@ import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@Slf4j
@Component
@ -177,19 +179,22 @@ public class CiService {
return level;
// 大铁情况下做判断
if (simulation.getRepository().getConfig().isRailway() && !route.isShutting()) {
Map<DirectionLabelEnum, StationDirection> stationDirectionMap = route.getStart().getStation().getStationDirectionMap();
// 无出入口数据为空时不做判断
boolean isCanHandle = stationDirectionMap.isEmpty();
if (!isCanHandle) {
Optional<StationDirection> stationDirectionOptional = stationDirectionMap.values().stream()
.filter(stationDirection -> Objects.equals(stationDirection.getSignal(), route.getStart())
|| Objects.equals(stationDirection.getSignal(), route.getDestination()))
.findFirst();
if (stationDirectionOptional.isPresent()) {
StationDirection stationDirection = stationDirectionOptional.get();
// 如果当前进路在列表中不存在则信号灯不开放
boolean isCanHandle = simulation.getRepository().getStationList().stream()
.filter(station -> station.getCode().equals(route.getStart().getStation().getCode())
|| station.getCode().equals(route.getDestination().getStation().getCode()))
.anyMatch(station -> {
Map<DirectionLabelEnum, StationDirection> stationDirectionMap = station.getStationDirectionMap();
if (CollectionUtils.isEmpty(stationDirectionMap)) {
return true;
isCanHandle = Objects.equals(stationDirection.currentRight(), route.isRight())
&& (stationDirection.getChangeDirectionTime() == null || route.getSettingStartTime().isAfter(stationDirection.getChangeDirectionTime()))
&& stationDirection.getCurrentRouteList().contains(route);
}
}
return stationDirectionMap.values().stream()
.filter(stationDirection -> !CollectionUtils.isEmpty(stationDirection.getCurrentRouteList()))
.anyMatch(stationDirection -> stationDirection.getCurrentRouteList().contains(route));
});
if (!isCanHandle) {
return level;
}

View File

@ -68,6 +68,15 @@ public class ControlFloodSignInfo {
return stationDetailInfoMap.getOrDefault(stationCode, new LinkedList<>());
}
/**
* 获取所有信息
*/
public List<DetailInfo> getAllDetailInfo() {
List<DetailInfo> allList = new LinkedList<>();
stationDetailInfoMap.forEach((k, v) -> allList.addAll(v));
return allList;
}
/**
* 详情信息
*/

View File

@ -48,6 +48,12 @@ public class EquipmentConstructionInfo {
return stationDetailInfoMap.getOrDefault(stationCode, new LinkedList<>());
}
public List<ConstructionInfo> getAllDetailInfo() {
List<ConstructionInfo> allList = new LinkedList<>();
stationDetailInfoMap.forEach((k, v) -> allList.addAll(v));
return allList;
}
/**
* 施工登记信息

View File

@ -5,7 +5,6 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.springframework.util.CollectionUtils;
import org.springframework.util.IdGenerator;
import org.springframework.util.StringUtils;
import java.util.*;
@ -70,6 +69,15 @@ public class KeyLinkControlInfo {
return stationDetailInfoMap.getOrDefault(stationCode, new LinkedList<>());
}
/**
* 获取全量信息
*/
public List<DetailInfo> getAllDetailInfo() {
List<DetailInfo> allDetailList = new LinkedList<>();
stationDetailInfoMap.forEach((k, v) -> allDetailList.addAll(v));
return allDetailList;
}
/**
* 表详情
*/

View File

@ -53,6 +53,12 @@ public class SupervisorHandOverInfo {
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;
}
/**
* 一些公共属性
*/

View File

@ -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.Simulation;
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.stereotype.Component;
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) {
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();
if (station == null)
station = route.getStart().getDeviceStation();

View File

@ -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.CTC.data.CtcRepository;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
import club.joylink.rtss.simulation.cbtc.command.VoiceCommandBO;
import club.joylink.rtss.simulation.cbtc.competition.CompetitionBO;
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.vo.AccountVO;
import club.joylink.rtss.vo.client.fault.FaultRuleVO;
import club.joylink.rtss.vo.permission.PermissionSubjectTypeEnum;
import club.joylink.rtss.vo.project.ProjectVO;
import lombok.Getter;
import lombok.Setter;
@ -63,6 +65,10 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
*/
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);
}
public boolean isAdmin(AccountVO user) {
SimulationUser simulationUser = this.querySimulationUserById(user.getId().toString());
if (Objects.nonNull(simulationUser) && simulationUser.isTeacher()) {

View File

@ -4,6 +4,7 @@ import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
import club.joylink.rtss.vo.permission.PermissionSubjectTypeEnum;
import lombok.NonNull;
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);
@ -59,9 +60,17 @@ public interface SimulationService {
*/
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);
}

View File

@ -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.runplan.RunPlanVO;
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.subject.PermissionSubjectVO;
import club.joylink.rtss.websocket.StompMessageService;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -34,6 +36,7 @@ import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service
@ -64,8 +67,8 @@ public class SimulationServiceImpl implements SimulationService {
@Autowired
private ISysUserService iSysUserService;
@Override
public String createSimulation(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO) {
return createSimulationPojo(mapId, mapFunctionId, workParamVO, loginUserInfoVO).getId();
public String createSimulation(long mapId, Long mapFunctionId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO,Map<String,Boolean> createUserType) {
return createSimulationPojo(mapId, mapFunctionId, workParamVO, loginUserInfoVO, createUserType).getId();
}
//只获取所有与该功能相关的权限信息
@ -97,9 +100,9 @@ public class SimulationServiceImpl implements SimulationService {
* @param loginInfo
*/
private void checkUserPermission(RtsMapFunctionVO functionVO,LoginUserInfoVO loginInfo){
private Map<String,Boolean> checkUserPermission(RtsMapFunctionVO functionVO,LoginUserInfoVO loginInfo){
if(loginInfo.getAccountVO().isAdmin()){
return;
return Collections.emptyMap();
}
LoginUserInfoVO newLoginUser = loginInfo;
if(loginInfo.getAccountVO().isThirdChildAccount()){
@ -112,20 +115,88 @@ public class SimulationServiceImpl implements SimulationService {
}
List<PermissionSubjectVO> subjectVOList = this.subjectService.findPermissionWithMapIdAndUserInfo(functionVO.getMapId(),newLoginUser);
List<PermissionSubjectVO> newVOLIst = this.filterUserPermission(subjectVOList,functionVO);
if(CollectionUtils.isEmpty(newVOLIst)){
log.error("未找到对应的权限数据mapId[{}],functionId[{}],userId[{}]",functionVO.getMapId(),functionVO.getId(),newLoginUser.getAccountVO().getId());
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()));
if(Objects.equals(false,isForever)){
boolean timeOver = newVOLIst.stream().allMatch(d->Objects.nonNull(d.getEndTime()) && d.getEndTime().isBefore(LocalDateTime.now()));
if(timeOver){
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
@ -133,7 +204,7 @@ public class SimulationServiceImpl implements SimulationService {
RtsMapFunctionVO rtsMapFunctionVO = rtsMapFunctionService.get(mapFunctionId);
Long mapId = rtsMapFunctionVO.getMapId();
this.checkUserPermission(rtsMapFunctionVO,loginInfo);
Map<String,Boolean> createUserType = this.checkUserPermission(rtsMapFunctionVO,loginInfo);
SimulationWorkParamVO workParamVO = rtsMapFunctionVO.getParamVO();
if (workParamVO.containsRealDeviceItem()) {
@ -145,7 +216,7 @@ public class SimulationServiceImpl implements SimulationService {
oldSimulationOptional.ifPresent(simulation -> simulationManager.destroy(simulation.getId()));
}
return createSimulation(mapId, mapFunctionId, workParamVO, loginInfo);
return createSimulation(mapId, mapFunctionId, workParamVO, loginInfo,createUserType);
}
@Override
@ -229,13 +300,14 @@ public class SimulationServiceImpl implements SimulationService {
}
@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());
//创建仿真
String simulationId = SimulationIdGenerator.generateGroup(loginUserInfoVO.getAccountVO().getId(), mapId);
Simulation simulation = initService.create(mapId, workParamVO, loginUserInfoVO, simulationId);
simulation.setMapFunctionId(mapFunctionId);
simulation.setCreateUserType(createUserType);
LoginUserInfoVO loginUserInfo = simulation.getBuildParams().getLoginUserInfo();
if (Objects.nonNull(loginUserInfo)) {
simulation.setCreatorId(loginUserInfo.getAccountVO().getIdStr());
@ -261,10 +333,13 @@ public class SimulationServiceImpl implements SimulationService {
}
@Override
public Simulation createSimulationPojo(Long mapFunctionId, LoginUserInfoVO loginInfo) {
public Simulation createSimulationPojo(Long mapFunctionId, LoginUserInfoVO loginInfo, boolean checkAuth) {
RtsMapFunctionVO rtsMapFunctionVO = rtsMapFunctionService.get(mapFunctionId);
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();
if (workParamVO.containsRealDeviceItem()) {
@ -276,7 +351,7 @@ public class SimulationServiceImpl implements SimulationService {
oldSimulationOptional.ifPresent(simulation -> simulationManager.destroy(simulation.getId()));
}
return createSimulationPojo(mapId, mapFunctionId, workParamVO, loginInfo);
return createSimulationPojo(mapId, mapFunctionId, workParamVO, loginInfo, createUserType);
}
@Override

View File

@ -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.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 lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -71,6 +77,26 @@ public class StorageSimulationCtcDataRepository {
*/
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.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) {
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() {

View File

@ -23,4 +23,9 @@ public class MapTotalGuideLockButtonVO {
private String stationCode;
private Point position;
/**
* 引导锁方向
*/
private String direction;
}

View File

@ -32,6 +32,7 @@ public class PaperQType {
* 实训题
*/
Training(2),
;
private Integer type;

View File

@ -26,6 +26,10 @@ public enum PaperQuestionState {
* 4-时间到结束
*/
TimeOut(4),
/**
* 5-没有全部回答正确针对实训场景使用
*/
Not_All_Right(5),
;
private Integer state;

View File

@ -1,11 +1,13 @@
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.ser.std.ToStringSerializer;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
@Data
public class PaperSubmitAnswerReqVo {
@ -40,8 +42,12 @@ public class PaperSubmitAnswerReqVo {
* 理论试题答案
*/
private List<String> answer;
/**
* 训题完成结果,true-实训题成功完成false-实训题未成功完成
*
*/
private Boolean trainingSuccess;
private List<PaperTrainAnswerDetail> trainDetail;
private String cosplayMemberId;
}

View File

@ -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{
}
}

View File

@ -24,6 +24,12 @@ public class PaperUserQuestionVo {
@NotNull
@JsonSerialize(using = ToStringSerializer.class)
private Long puId;
/**
* 试卷规则 rts_paper_rule 的id
*/
@NotNull
@JsonSerialize(using = ToStringSerializer.class)
private Long ruleId;
/**
* 组织id

View 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;
}

View File

@ -5,11 +5,14 @@ import club.joylink.rtss.vo.paper.PaperQType;
import club.joylink.rtss.vo.paper.PaperQuestionState;
import club.joylink.rtss.vo.paper.PaperUserQuestionVo;
import java.text.Normalizer;
public class PaperUserQuestionConvertor {
public static PaperUserQuestionVo convert(PaperUserQuestion from){
PaperUserQuestionVo to = new PaperUserQuestionVo();
to.setId(from.getId());
to.setPuId(from.getPuId());
to.setRuleId(from.getRuleId());
to.setOrgId(from.getOrgId());
to.setType(PaperQType.GroupType.getItem(from.getType()));
to.setQuestionId(from.getQuestionId());

View File

@ -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;
}
}
*/

View File

@ -7,5 +7,7 @@ public enum PermissionSubjectTypeEnum {
user,//用户
org,//组织
project,//项目
;
public final static PermissionSubjectTypeEnum[] SORT_ENUM = new PermissionSubjectTypeEnum[]{user,project,org};
}

View File

@ -97,4 +97,6 @@ public class PermissionDistributeConvertor {
permissionSubject.setParentId(permissionDistribute.getSourceSubjectId());
return permissionSubject;
}
}

View File

@ -4,8 +4,10 @@
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.paper.PaperUserQuestion">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="pu_id" jdbcType="BIGINT" property="puId" />
<result column="rule_id" jdbcType="BIGINT" property="ruleId" />
<result column="org_id" jdbcType="BIGINT" property="orgId" />
<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="state" jdbcType="INTEGER" property="state" />
<result column="tmp_answer" jdbcType="VARCHAR" property="tmpAnswer" />
@ -69,7 +71,7 @@
</where>
</sql>
<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>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestionExample" resultMap="BaseResultMap">
select
@ -109,29 +111,32 @@
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion">
insert into rts_paper_user_question (id, pu_id, org_id,
`type`, question_id, `state`,
tmp_answer)
values (#{id,jdbcType=BIGINT}, #{puId,jdbcType=BIGINT}, #{orgId,jdbcType=BIGINT},
#{type,jdbcType=INTEGER}, #{questionId,jdbcType=BIGINT}, #{state,jdbcType=INTEGER},
#{tmpAnswer,jdbcType=VARCHAR})
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion" useGeneratedKeys="true">
insert into rts_paper_user_question (pu_id, rule_id, org_id,
`type`, sub_type, question_id,
`state`, tmp_answer)
values (#{puId,jdbcType=BIGINT}, #{ruleId,jdbcType=BIGINT}, #{orgId,jdbcType=BIGINT},
#{type,jdbcType=INTEGER}, #{subType,jdbcType=INTEGER}, #{questionId,jdbcType=BIGINT},
#{state,jdbcType=INTEGER}, #{tmpAnswer,jdbcType=VARCHAR})
</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
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="puId != null">
pu_id,
</if>
<if test="ruleId != null">
rule_id,
</if>
<if test="orgId != null">
org_id,
</if>
<if test="type != null">
`type`,
</if>
<if test="subType != null">
sub_type,
</if>
<if test="questionId != null">
question_id,
</if>
@ -143,18 +148,21 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="puId != null">
#{puId,jdbcType=BIGINT},
</if>
<if test="ruleId != null">
#{ruleId,jdbcType=BIGINT},
</if>
<if test="orgId != null">
#{orgId,jdbcType=BIGINT},
</if>
<if test="type != null">
#{type,jdbcType=INTEGER},
</if>
<if test="subType != null">
#{subType,jdbcType=INTEGER},
</if>
<if test="questionId != null">
#{questionId,jdbcType=BIGINT},
</if>
@ -181,12 +189,18 @@
<if test="record.puId != null">
pu_id = #{record.puId,jdbcType=BIGINT},
</if>
<if test="record.ruleId != null">
rule_id = #{record.ruleId,jdbcType=BIGINT},
</if>
<if test="record.orgId != null">
org_id = #{record.orgId,jdbcType=BIGINT},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=INTEGER},
</if>
<if test="record.subType != null">
sub_type = #{record.subType,jdbcType=INTEGER},
</if>
<if test="record.questionId != null">
question_id = #{record.questionId,jdbcType=BIGINT},
</if>
@ -205,8 +219,10 @@
update rts_paper_user_question
set id = #{record.id,jdbcType=BIGINT},
pu_id = #{record.puId,jdbcType=BIGINT},
rule_id = #{record.ruleId,jdbcType=BIGINT},
org_id = #{record.orgId,jdbcType=BIGINT},
`type` = #{record.type,jdbcType=INTEGER},
sub_type = #{record.subType,jdbcType=INTEGER},
question_id = #{record.questionId,jdbcType=BIGINT},
`state` = #{record.state,jdbcType=INTEGER},
tmp_answer = #{record.tmpAnswer,jdbcType=VARCHAR}
@ -220,12 +236,18 @@
<if test="puId != null">
pu_id = #{puId,jdbcType=BIGINT},
</if>
<if test="ruleId != null">
rule_id = #{ruleId,jdbcType=BIGINT},
</if>
<if test="orgId != null">
org_id = #{orgId,jdbcType=BIGINT},
</if>
<if test="type != null">
`type` = #{type,jdbcType=INTEGER},
</if>
<if test="subType != null">
sub_type = #{subType,jdbcType=INTEGER},
</if>
<if test="questionId != null">
question_id = #{questionId,jdbcType=BIGINT},
</if>
@ -241,8 +263,10 @@
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.paper.PaperUserQuestion">
update rts_paper_user_question
set pu_id = #{puId,jdbcType=BIGINT},
rule_id = #{ruleId,jdbcType=BIGINT},
org_id = #{orgId,jdbcType=BIGINT},
`type` = #{type,jdbcType=INTEGER},
sub_type = #{subType,jdbcType=INTEGER},
question_id = #{questionId,jdbcType=BIGINT},
`state` = #{state,jdbcType=INTEGER},
tmp_answer = #{tmpAnswer,jdbcType=VARCHAR}

View File

@ -80,7 +80,7 @@ public class PaperApiTestController {
rt.setTags(tags);
System.out.println(JsonUtils.writeValueAsString(rt));
}
public static void paperSubmitAnswerReqVo(){
/* public static void paperSubmitAnswerReqVo(){
PaperSubmitAnswerReqVo rt = new PaperSubmitAnswerReqVo();
rt.setPuId(1L);
rt.setPqId(1L);
@ -92,7 +92,7 @@ public class PaperApiTestController {
rt.setAnswer(answer);
rt.setTrainingSuccess(true);
System.out.println(JsonUtils.writeValueAsString(rt));
}
}*/
public static void findPaperUserForCompositionReqVo(){
FindPaperUserForCompositionReqVo rt = new FindPaperUserForCompositionReqVo();
rt.setPcId(2L);
@ -116,7 +116,7 @@ public class PaperApiTestController {
rt.setAccount("18710717058");
System.out.println(JsonUtils.writeValueAsString(rt));
}
public static void main(String[]args){
/* public static void main(String[]args){
createPaperCompositionReqVo();
paperCompositionBasicVo();
paperCompositionDetailVo();
@ -128,5 +128,5 @@ public class PaperApiTestController {
findPaperCompositionByAccountReqVo();
// findPaperUserForClassReqVo();
findPaperUserForAccountReqVo();
}
}*/
}