试卷规则分类只支持一个
This commit is contained in:
parent
987dbbe43c
commit
00b504f7b3
@ -1,5 +1,6 @@
|
||||
package club.joylink.rtss.services.paper;
|
||||
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.vo.paper.PaperCompositionWithRuleVo;
|
||||
import club.joylink.rtss.dao.SysAccountDAO;
|
||||
import club.joylink.rtss.dao.paper.PaperCompositionDAO;
|
||||
@ -91,7 +92,11 @@ public class PaperCompositionService {
|
||||
//
|
||||
PaperQType.assertPaperSubTypeMatchGroupType(req.getSubtype(), req.getType());
|
||||
//
|
||||
if(!CollectionUtils.isEmpty(req.getTags())){
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(req.getTags().size() <= 1 ,String.format("试题规则类型[%s],规则类型[%s],分类%s最多只能有一个", PaperQType.GroupType.getTypeName(req.getType()), PaperQType.SubType.getItemName(req.getSubtype()),req.getTags()));
|
||||
}
|
||||
PaperRule rule = PaperRuleConvertor.convert(req);
|
||||
|
||||
//
|
||||
ruleDAO.insertSelective(rule);
|
||||
});
|
||||
|
@ -44,6 +44,14 @@ public class PaperQType {
|
||||
return map.get(type);
|
||||
}
|
||||
|
||||
public static String getTypeName(GroupType gt){
|
||||
if(gt == GroupType.Common){
|
||||
return "理论题";
|
||||
}else if(gt == GroupType.Training){
|
||||
return "实训题";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@JsonValue
|
||||
public Integer getValue() {
|
||||
return this.type;
|
||||
@ -79,7 +87,18 @@ public class PaperQType {
|
||||
public static SubType getItem(Integer type) {
|
||||
return map.get(type);
|
||||
}
|
||||
|
||||
public static String getItemName(SubType st){
|
||||
switch (st){
|
||||
case Select:
|
||||
return "单选题";
|
||||
case Multi:
|
||||
return "多选题";
|
||||
case Judge:
|
||||
return "判断题";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@JsonValue
|
||||
public Integer getValue() {
|
||||
return this.type;
|
||||
|
Loading…
Reference in New Issue
Block a user