|
@@ -1,19 +1,18 @@
|
|
|
-package cn.com.qmth.examcloud.core.questions.service.temp.vo;
|
|
|
+package cn.com.qmth.examcloud.core.questions.service.temp;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
import org.springframework.data.mongodb.core.query.Query;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import cn.com.qmth.examcloud.core.questions.base.enums.GenPaperType;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.PaperStructRepo;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetailStruct;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.PaperDetailUnitStruct;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.PaperStruct;
|
|
|
+import cn.com.qmth.examcloud.core.questions.dao.entity.dto.PaperDetailUnitStructDto;
|
|
|
|
|
|
/**
|
|
|
* @author weiwenhai
|
|
@@ -35,31 +34,37 @@ public class UpdatePaperStruct {
|
|
|
//根据orgId查询所有精确试卷结构
|
|
|
Query query = new Query();
|
|
|
query.addCriteria(Criteria.where("orgId").is(orgId));
|
|
|
- query.addCriteria(Criteria.where("id").nin("BLUEPRINT"));
|
|
|
+ query.addCriteria(Criteria.where("type").is("EXACT"));
|
|
|
List<PaperStruct> paperStructList = this.mongoTemplate.find(query, PaperStruct.class);
|
|
|
+ int i = 0;
|
|
|
if(paperStructList!=null && paperStructList.size()>0){
|
|
|
for(PaperStruct paperStruct:paperStructList){
|
|
|
- //1.跟新type
|
|
|
- if(StringUtils.isBlank(paperStruct.getType())){
|
|
|
- paperStruct.setType("EXACT");
|
|
|
- }
|
|
|
- //2.跟新genPaperType
|
|
|
- if(paperStruct.getGenPaperType() == null){
|
|
|
- paperStruct.setGenPaperType(GenPaperType.COMMON);
|
|
|
- }
|
|
|
+ //获取大题集合
|
|
|
List<PaperDetailStruct> paperDetailStructs = paperStruct.getPaperDetailStructs();
|
|
|
- for(PaperDetailStruct paperDetailStruct:paperDetailStructs){
|
|
|
- //得到以前的小题
|
|
|
- List<PaperDetailUnitStruct> unitStructs = paperDetailStruct.getPaperDetailUnitStructs();
|
|
|
- for(PaperDetailUnitStruct unitStruct:unitStructs){
|
|
|
+ for(PaperDetailStruct paperDetailStruct:paperDetailStructs){
|
|
|
+ //获取小题类型统计
|
|
|
+ List<PaperDetailUnitStructDto> unitStructs = paperDetailStruct.getUnitStructs();
|
|
|
+ for(PaperDetailUnitStructDto dto:unitStructs){
|
|
|
+ dto.setPublicDifficulty(0);
|
|
|
+ dto.setPublicMedium(dto.getCount());
|
|
|
+ dto.setPublicSimple(0);
|
|
|
+ dto.setNoPublicDifficulty(0);
|
|
|
+ dto.setNoPublicMedium(0);
|
|
|
+ dto.setNoPublicSimple(0);
|
|
|
+ }
|
|
|
+ List<PaperDetailUnitStruct> units = paperDetailStruct.getPaperDetailUnitStructs();
|
|
|
+ for(PaperDetailUnitStruct unitStruct:units){
|
|
|
unitStruct.setDifficulty("中");
|
|
|
unitStruct.setPublicity(true);
|
|
|
unitStruct.setPropertyGroup(buildGroup(unitStruct));
|
|
|
}
|
|
|
}
|
|
|
+ i++;
|
|
|
}
|
|
|
}
|
|
|
+ System.out.println("更新精确试卷结构的数量为:"+ i + "------个");
|
|
|
paperStructRepo.save(paperStructList);
|
|
|
+ System.out.println("更新成功!----");
|
|
|
}
|
|
|
|
|
|
/**
|