|
|
|
@ -5,6 +5,8 @@ import cn.hutool.core.lang.Assert;
|
|
|
|
|
import cn.hutool.core.util.ArrayUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.ReflectUtil;
|
|
|
|
|
import com.ibeetl.jlw.enums.ResourcesQuestionTypeEnum;
|
|
|
|
|
import lombok.Data;
|
|
|
|
|
|
|
|
|
|
import javax.validation.constraints.NotBlank;
|
|
|
|
|
import javax.validation.constraints.NotEmpty;
|
|
|
|
@ -23,6 +25,7 @@ import static org.apache.commons.lang3.StringUtils.upperCase;
|
|
|
|
|
*/
|
|
|
|
|
public class ResourcesQuestionOptionEntity {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final Map<String, Boolean> optionTextMap = new HashMap(6);
|
|
|
|
|
|
|
|
|
|
public void put(String optionText, Boolean value) {
|
|
|
|
@ -125,8 +128,8 @@ public class ResourcesQuestionOptionEntity {
|
|
|
|
|
// 答案和选项ABCDEF..对应
|
|
|
|
|
Map<String, String> answerMap = new HashMap<>(6);
|
|
|
|
|
// 判断题目是否有重复的值
|
|
|
|
|
Assert.isTrue(optionTextList.size() == lastLetterFieldNameList.size(),
|
|
|
|
|
"答案中有重复的值,请检查!");
|
|
|
|
|
// Assert.isTrue(optionTextList.size() == lastLetterFieldNameList.size(),
|
|
|
|
|
// "答案中有重复的值,请检查!");
|
|
|
|
|
|
|
|
|
|
// 乱序集合处理
|
|
|
|
|
for (int i = 0; i < lastLetterFieldNameList.size(); i++) {
|
|
|
|
@ -172,4 +175,51 @@ public class ResourcesQuestionOptionEntity {
|
|
|
|
|
Field[] fields = ReflectUtil.getFieldsDirectly(clazz, false);
|
|
|
|
|
verifyFieldExists(fields, answerFieldName, prefix);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 横表结构转纵表结构
|
|
|
|
|
* 题目选项获取
|
|
|
|
|
* @param obj
|
|
|
|
|
* @param stemFieldName 题干属性名
|
|
|
|
|
* @param optionFieldName 选项属性名
|
|
|
|
|
* @param trueOptionFieldName 答案的属性名
|
|
|
|
|
* @param lastIsUppercase 选项属性名是否结尾大写
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
// public static List<QuestionInfo> getQuestionList(Object obj, final String stemFieldName,
|
|
|
|
|
// final String optionFieldName,
|
|
|
|
|
// final String trueOptionFieldName, Boolean lastIsUppercase) {
|
|
|
|
|
// ReflectUtil.getFields(obj, field -> {
|
|
|
|
|
// field.getName().
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
@Data
|
|
|
|
|
public static class QuestionInfo {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 题干
|
|
|
|
|
*/
|
|
|
|
|
private String questionStem;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 题目选项
|
|
|
|
|
*/
|
|
|
|
|
private String optionText;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 选项字母
|
|
|
|
|
*/
|
|
|
|
|
private String optionLetter;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 是否正确答案
|
|
|
|
|
*/
|
|
|
|
|
private boolean isTrue;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 题型
|
|
|
|
|
*/
|
|
|
|
|
private ResourcesQuestionTypeEnum questionType;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|