deason vor 5 Jahren
Ursprung
Commit
841ff683fa

+ 5 - 5
examcloud-core-questions-base/src/main/java/cn/com/qmth/examcloud/core/questions/base/StringSimilarityUtils.java

@@ -50,7 +50,7 @@ public class StringSimilarityUtils {
         List<String> w1 = segmentText(seg1);
         List<String> w2 = segmentText(seg2);
         if (w1 != null && (size1 = w1.size()) != 0 && w2 != null && (size2 = w2.size()) != 0) {
-            Map<String, int[]> countMap = new HashMap<String, int[]>();
+            Map<String, int[]> countMap = new HashMap<>();
             String index = null;
             // 将w1与w2分词出现频次统计入coutMap中
             for (int i = 0; i < size1; i++) {
@@ -113,7 +113,7 @@ public class StringSimilarityUtils {
         w1 = stringFilter(w1);
         w2 = stringFilter(w2);
         if (w1 != null && (size1 = w1.length()) != 0 && w2 != null && (size2 = w2.length()) != 0) {
-            Map<Character, int[]> countMap = new HashMap<Character, int[]>();
+            Map<Character, int[]> countMap = new HashMap<>();
             char index;
             // 将w1与w2所有字符出现频次统计入countMap中
             for (int i = 0; i < size1; i++) {
@@ -239,8 +239,8 @@ public class StringSimilarityUtils {
             }
             w1 = stringFilter(w1);
             w2 = stringFilter(w2);
-            Set<String> nx = new HashSet<String>();
-            Set<String> ny = new HashSet<String>();
+            Set<String> nx = new HashSet<>();
+            Set<String> ny = new HashSet<>();
 
             for (int i = 0; i < w1.length() - 1; i++) {
                 char x1 = w1.charAt(i);
@@ -254,7 +254,7 @@ public class StringSimilarityUtils {
                 String tmp = "" + y1 + y2;
                 ny.add(tmp);
             }
-            Set<String> intersection = new HashSet<String>(nx);
+            Set<String> intersection = new HashSet<>(nx);
             intersection.retainAll(ny);
             double totcombigrams = intersection.size();
             similarity = (2 * totcombigrams) / (nx.size() + ny.size());

+ 1 - 1
examcloud-core-questions-base/src/main/java/cn/com/qmth/examcloud/core/questions/base/word/DocxProcessUtil.java

@@ -181,7 +181,7 @@ public final class DocxProcessUtil {
      */
     public static WordprocessingMLPackage getTmpPackage(WordprocessingMLPackage wordMLPackage) throws Exception {
         // 添加关系样式信息
-        Set<String> relationshipTypes = new HashSet<String>();
+        Set<String> relationshipTypes = new HashSet<>();
         relationshipTypes.add(wordMLPackage.getMainDocumentPart().getRelationshipType());
         // 深拷贝
         WordprocessingMLPackage tmpWordMlPackage = (WordprocessingMLPackage) PartialDeepCopy

+ 1 - 1
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExamFileServiceImpl.java

@@ -72,7 +72,7 @@ public class ExamFileServiceImpl implements ExamFileService {
 			exportContentList.remove(ExamFileType.PAPER_STRUCTURE_SUBJECTIVE.name());
 		}*/
         if (exportContentList.size() > 0) {
-            List<String> examFileTypes = new ArrayList<String>();
+            List<String> examFileTypes = new ArrayList<>();
             for (int i = 0; i < exportContentList.size(); i++) {
                 examFileTypes.add(exportContentList.get(i));
             }

+ 2 - 2
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExtractConfigFileServiceImpl.java

@@ -509,7 +509,7 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
             List<PaperDetailExp> objectiveDetails = exportPaperAbstractService.getAllObjectiveDetails(paperExp);
             //得到补齐后的客观题大题
             List<PaperDetailExp> paperDetailExps = exportPaperAbstractService.fillObjectiveQuestions(objectiveDetails, questionTypeNums);
-            List<ObjectiveQuestionStructure> objectiveList = new ArrayList<ObjectiveQuestionStructure>();
+            List<ObjectiveQuestionStructure> objectiveList = new ArrayList<>();
             for (PaperDetailExp paperDetailExp : paperDetailExps) {
                 for (PaperDetailUnitExp unit : paperDetailExp.getPaperDetailUnits()) {
                     objectiveList.add(new ObjectiveQuestionStructure(paperExp, paperDetailExp, unit, paperType));
@@ -520,7 +520,7 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
             //添加主观题
             logger.info("处理主观题...");
             List<PaperDetailExp> subjectiveDetails = exportPaperAbstractService.getAllSubjectiveDetails(paperExp);
-            List<SubjectiveQuestionStructure> subjectiveList = new ArrayList<SubjectiveQuestionStructure>();
+            List<SubjectiveQuestionStructure> subjectiveList = new ArrayList<>();
             for (PaperDetailExp paperDetailExp : subjectiveDetails) {
                 for (PaperDetailUnitExp unit : paperDetailExp.getPaperDetailUnits()) {
                     subjectiveList.add(new SubjectiveQuestionStructure(paperExp, paperDetailExp, unit, paperType));

+ 3 - 3
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExtractConfigServiceImpl.java

@@ -468,7 +468,7 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
             //单选或多选
             if (question.getQuestionType() == QuesStructType.SINGLE_ANSWER_QUESTION ||
                     question.getQuestionType() == QuesStructType.MULTIPLE_ANSWER_QUESTION) {
-                List<String> numberList = new ArrayList<String>();
+                List<String> numberList = new ArrayList<>();
                 List<QuesOption> options = question.getQuesOptions();
                 for (int k = 0; k < options.size(); k++) {
                     QuesOption quesOption = options.get(k);
@@ -485,7 +485,7 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
                     Question subQuestion = subQuestions.get(m);
                     if (subQuestion.getQuestionType() == QuesStructType.SINGLE_ANSWER_QUESTION ||
                             subQuestion.getQuestionType() == QuesStructType.MULTIPLE_ANSWER_QUESTION) {
-                        List<String> numberList = new ArrayList<String>();
+                        List<String> numberList = new ArrayList<>();
                         List<QuesOption> options = subQuestion.getQuesOptions();
                         for (int n = 0; n < options.size(); n++) {
                             QuesOption quesOption = options.get(n);
@@ -505,7 +505,7 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
     public List<String> getExamPaperId(String courseCode, String orgId) {
         Assert.hasLength(courseCode, "courseCode不能为空");
         Assert.hasLength(orgId, "orgId不能为空");
-        List<String> paperIdList = new ArrayList<String>();
+        List<String> paperIdList = new ArrayList<>();
         Query query = new Query();
         query.addCriteria(Criteria.where("courseCode").is(courseCode));
         query.addCriteria(Criteria.where("orgId").is(orgId));

+ 2 - 2
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/PaperProviderServiceImpl.java

@@ -132,7 +132,7 @@ public class PaperProviderServiceImpl implements PaperProviderService {
      * @return
      */
     private List<PaperDetailUnit> buildUnits(Paper paper, PaperDetail paperDetail, List<Question> questions, Map<String, PaperK12Bean> map) {
-        List<PaperDetailUnit> paperDetailUnits = new ArrayList<PaperDetailUnit>();
+        List<PaperDetailUnit> paperDetailUnits = new ArrayList<>();
         int j = 0;
         double score = 0;
         double sum = 0;
@@ -214,7 +214,7 @@ public class PaperProviderServiceImpl implements PaperProviderService {
         examPaper.setGroupCode("K");
         examPaper.setWeight(100);
         examPaper.setPaper(paper);
-        List<ExamPaper> examPaperList = new ArrayList<ExamPaper>();
+        List<ExamPaper> examPaperList = new ArrayList<>();
         examPaperList.add(examPaper);
         extractConfig.setExamPaperList(examPaperList);
         extractConfig.setScrambling_the_option_order((short) 0);

+ 13 - 13
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/PaperServiceImpl.java

@@ -314,7 +314,7 @@ public class PaperServiceImpl implements PaperService {
      * @return
      */
     public List<Paper> listExamPapers(long id, String courseCode, String groupCode) {
-        List<Paper> papers = new ArrayList<Paper>();
+        List<Paper> papers = new ArrayList<>();
         ExamPaper examPaper = new ExamPaper();
         examPaper.setExamId(id);
         examPaper.setCourseCode(courseCode);
@@ -494,7 +494,7 @@ public class PaperServiceImpl implements PaperService {
         paperExp.setCourse(paper.getCourse());
         // 获取大题
         List<PaperDetail> paperDetails = paperDetailRepo.findByPaperOrderByNumber(paper);
-        List<PaperDetailExp> paperDetailExps = new ArrayList<PaperDetailExp>();
+        List<PaperDetailExp> paperDetailExps = new ArrayList<>();
         for (PaperDetail paperDetail : paperDetails) {
             PaperDetailExp paperDetailExp = new PaperDetailExp();
             BeanUtils.copyProperties(paperDetail, paperDetailExp);
@@ -504,7 +504,7 @@ public class PaperServiceImpl implements PaperService {
         for (int i = 0; i < paperDetailExps.size(); i++) {
             List<PaperDetailUnit> paperDetailUnits = paperDetailUnitRepo.findByPaperDetailOrderByNumber(paperDetails.get(i));
             if (paperDetailUnits != null && paperDetailUnits.size() > 0) {
-                List<PaperDetailUnitExp> paperDetailUnitExps = new ArrayList<PaperDetailUnitExp>();
+                List<PaperDetailUnitExp> paperDetailUnitExps = new ArrayList<>();
                 for (PaperDetailUnit paperDetailUnit : paperDetailUnits) {
                     PaperDetailUnitExp paperDetailUnitExp = new PaperDetailUnitExp();
                     BeanUtils.copyProperties(paperDetailUnit, paperDetailUnitExp);
@@ -553,7 +553,7 @@ public class PaperServiceImpl implements PaperService {
     }
 
     private List<QuesOption> reorderOptionCore(List<QuesOption> quesOptions, String optionOrder) {
-        List<QuesOption> newQuesOptions = new ArrayList<QuesOption>();
+        List<QuesOption> newQuesOptions = new ArrayList<>();
         if (StringUtil.isBlank(optionOrder) || quesOptions.isEmpty()) {
             return null;
         }
@@ -878,7 +878,7 @@ public class PaperServiceImpl implements PaperService {
      * @return
      */
     public List<String> getPaperNamesByQuestionId(String questionId) {
-        List<String> paperNames = new ArrayList<String>();
+        List<String> paperNames = new ArrayList<>();
         List<PaperDetailUnit> pdus = paperDetailUnitRepo.findByQuestion(Model.of(quesRepo.findById(questionId)));
         for (PaperDetailUnit pdu : pdus) {
             paperNames.add(pdu.getPaper().getName());
@@ -1413,7 +1413,7 @@ public class PaperServiceImpl implements PaperService {
         //客观题中如果有套题,要拆开
         List<PaperDetailExp> newObjectiveDetails = buildPaperDetailExp(objectiveDetails);
         //生成客观题数集合
-        List<ObjectiveQuestionStructure> objectiveQuestionStructureList = new ArrayList<ObjectiveQuestionStructure>();
+        List<ObjectiveQuestionStructure> objectiveQuestionStructureList = new ArrayList<>();
         for (PaperDetailExp paperDetailExp : newObjectiveDetails) {
             for (PaperDetailUnitExp unit : paperDetailExp.getPaperDetailUnits()) {
                 objectiveQuestionStructureList.add(new ObjectiveQuestionStructure(paperExp, paperDetailExp, unit, null));
@@ -1423,7 +1423,7 @@ public class PaperServiceImpl implements PaperService {
         //得到试卷中的主观大题
         List<PaperDetailExp> subjectiveDetails = exportPaperAbstractService.getAllSubjectiveDetails(paperExp);
         //生成主观题数集合
-        List<SubjectiveQuestionStructure> subjectiveQuestionStructureList = new ArrayList<SubjectiveQuestionStructure>();
+        List<SubjectiveQuestionStructure> subjectiveQuestionStructureList = new ArrayList<>();
         for (PaperDetailExp paperDetailExp : subjectiveDetails) {
             for (PaperDetailUnitExp unit : paperDetailExp.getPaperDetailUnits()) {
                 subjectiveQuestionStructureList.add(new SubjectiveQuestionStructure(paperExp, paperDetailExp, unit, null));
@@ -1445,14 +1445,14 @@ public class PaperServiceImpl implements PaperService {
             types.add(QuesStructType.getQuesStructTypeById(paperDetailExp.getSortNumber()));
         }
         //2.生成新的大题集合
-        List<PaperDetailExp> newObjs = new ArrayList<PaperDetailExp>();
+        List<PaperDetailExp> newObjs = new ArrayList<>();
         for (QuesStructType type : types) {
             for (PaperDetailExp paperDetailExp : objectiveDetails) {
-                if (paperDetailExp.getSortNumber() == type.getId()) {
+                if (paperDetailExp.getSortNumber().equals(type.getId())) {
                     //生成新的大题
                     PaperDetailExp newPaperDetailExp = new PaperDetailExp();
                     //生成新的小题
-                    List<PaperDetailUnitExp> newPaperDetailUnits = new ArrayList<PaperDetailUnitExp>();
+                    List<PaperDetailUnitExp> newPaperDetailUnits = new ArrayList<>();
                     //得到旧大题下的所有小题
                     List<PaperDetailUnitExp> paperDetailUnits = paperDetailExp.getPaperDetailUnits();
                     for (PaperDetailUnitExp paperDetailUnitExp : paperDetailUnits) {
@@ -1480,7 +1480,7 @@ public class PaperServiceImpl implements PaperService {
         int num = 0;
         for (QuesStructType type : types) {
             for (int i = 0; i < newObjs.size(); i++) {
-                if (newObjs.get(i).getSortNumber() == type.getId()) {
+                if (newObjs.get(i).getSortNumber().equals(type.getId())) {
                     List<PaperDetailUnitExp> exps = newObjs.get(i).getPaperDetailUnits();
                     for (int j = 0; j < exps.size(); j++) {
                         num++;
@@ -1502,7 +1502,7 @@ public class PaperServiceImpl implements PaperService {
         paperExp.setCourse(paper.getCourse());
         // 获取大题
         List<PaperDetail> paperDetails = paperDetailRepo.findByPaperOrderByNumber(paper);
-        List<PaperDetailExp> paperDetailExps = new ArrayList<PaperDetailExp>();
+        List<PaperDetailExp> paperDetailExps = new ArrayList<>();
         for (PaperDetail paperDetail : paperDetails) {
             PaperDetailExp paperDetailExp = new PaperDetailExp();
             BeanUtils.copyProperties(paperDetail, paperDetailExp);
@@ -1515,7 +1515,7 @@ public class PaperServiceImpl implements PaperService {
         for (int i = 0; i < paperDetailExps.size(); i++) {
             List<PaperDetailUnit> paperDetailUnits = paperDetailUnitRepo.findByPaperDetailOrderByNumber(paperDetails.get(i));
             if (paperDetailUnits != null && paperDetailUnits.size() > 0) {
-                List<PaperDetailUnitExp> paperDetailUnitExps = new ArrayList<PaperDetailUnitExp>();
+                List<PaperDetailUnitExp> paperDetailUnitExps = new ArrayList<>();
                 for (PaperDetailUnit paperDetailUnit : paperDetailUnits) {
                     PaperDetailUnitExp paperDetailUnitExp = new PaperDetailUnitExp();
                     BeanUtils.copyProperties(paperDetailUnit, paperDetailUnitExp);

+ 5 - 5
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/QuesServiceImpl.java

@@ -615,11 +615,11 @@ public class QuesServiceImpl implements QuesService {
         if (questionList == null || questionList.size() < 1) {
             return count;
         }
-        List<String> oIds = new ArrayList<String>();
+        List<String> oIds = new ArrayList<>();
         for (Question unit : questionList) {
             oIds.add(unit.getId());
         }
-        List<ObjectId> objectIds = new ArrayList<ObjectId>();
+        List<ObjectId> objectIds = new ArrayList<>();
         for (String id : oIds) {
             objectIds.add(new ObjectId(id));
         }
@@ -639,7 +639,7 @@ public class QuesServiceImpl implements QuesService {
 
     @Override
     public void updateProByPapers(List<String> paperList, Double difficultyDegree, Boolean publicity, User user) {
-        List<Paper> papers = new ArrayList<Paper>();
+        List<Paper> papers = new ArrayList<>();
         String difficulty = "";
         if (difficultyDegree > 0 && difficultyDegree < 0.4) {
             difficulty = "难";
@@ -648,8 +648,8 @@ public class QuesServiceImpl implements QuesService {
         } else {
             difficulty = "易";
         }
-        List<String> quesIds = new ArrayList<String>();
-        List<Question> subQues = new ArrayList<Question>();
+        List<String> quesIds = new ArrayList<>();
+        List<Question> subQues = new ArrayList<>();
         for (String id : paperList) {
             Paper paper = Model.of(paperRepo.findById(id));
             List<PaperDetailUnit> paperDetailUnits = unitRepo.findByPaper(paper);