|
@@ -0,0 +1,314 @@
|
|
|
+package com.qmth.cqb.paper.service.impl;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
+
|
|
|
+import cn.com.qmth.examcloud.common.dto.question.enums.QuesStructType;
|
|
|
+
|
|
|
+import com.qmth.cqb.paper.dao.PaperDetailInfoStructBlueprintRepo;
|
|
|
+import com.qmth.cqb.paper.dao.PaperDetailInfoUnitStructBlueprintRepo;
|
|
|
+import com.qmth.cqb.paper.dao.PaperDetailStructBlueprintRepo;
|
|
|
+import com.qmth.cqb.paper.dao.PropertyRepo;
|
|
|
+import com.qmth.cqb.paper.dto.PaperDetailInfoStructBlueprintDto;
|
|
|
+import com.qmth.cqb.paper.dto.PaperDetailInfoUnitStructBlueprintDto;
|
|
|
+import com.qmth.cqb.paper.model.PaperDetailInfoStructBlueprint;
|
|
|
+import com.qmth.cqb.paper.model.PaperDetailInfoUnitStructBlueprint;
|
|
|
+import com.qmth.cqb.paper.model.PaperDetailStructBlueprint;
|
|
|
+import com.qmth.cqb.paper.model.Property;
|
|
|
+import com.qmth.cqb.paper.service.PaperDetailInfoStructBlueprintService;
|
|
|
+import com.qmth.cqb.utils.enums.PropertyDifficulty;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @describle 蓝图试卷结构大题详情 paperDetailInfoStructBlueprintServiceImpl
|
|
|
+ * @author weiwenhai
|
|
|
+ * @date 2017.11.20
|
|
|
+ */
|
|
|
+@Service("paperDetailInfoStructBlueprintService")
|
|
|
+public class PaperDetailInfoStructBlueprintServiceImpl implements PaperDetailInfoStructBlueprintService{
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PaperDetailInfoStructBlueprintRepo paperDetailInfoStructBlueprintRepo;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PaperDetailInfoUnitStructBlueprintRepo paperDetailInfoUnitStructBlueprintRepo;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PropertyRepo propertyRepo;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PaperDetailStructBlueprintRepo paperDetailStructBlueprintRepo;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PaperDetailInfoStructBlueprint saveSingle(PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint) {
|
|
|
+ if(!StringUtils.isEmpty(paperDetailInfoStructBlueprint.getQuestionType()) && !StringUtils.isEmpty(paperDetailInfoStructBlueprint.getQuesNames())){
|
|
|
+ PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint2 = paperDetailInfoStructBlueprintRepo.save(paperDetailInfoStructBlueprint);
|
|
|
+ return paperDetailInfoStructBlueprint2;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void saveDto(PaperDetailInfoStructBlueprintDto paperDetailInfoStructBlueprintDto) {
|
|
|
+ //保存 蓝图试卷结构大题详情 paperDetailInfoStructBlueprint 对象
|
|
|
+ PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint = new PaperDetailInfoStructBlueprint(paperDetailInfoStructBlueprintDto);
|
|
|
+ paperDetailInfoStructBlueprint.setQuestionType(paperDetailInfoStructBlueprintDto.getQuestionType());
|
|
|
+ paperDetailInfoStructBlueprint.setQuesNames(org.apache.commons.lang.StringUtils.join(paperDetailInfoStructBlueprintDto.getQuesNames(), ","));//集合转换成字符串
|
|
|
+ paperDetailInfoStructBlueprint = saveSingle(paperDetailInfoStructBlueprint);
|
|
|
+ List<PaperDetailInfoUnitStructBlueprintDto> paperDetailInfoUnitStructBlueprintDtos = paperDetailInfoStructBlueprintDto.getPaperDetailInfoUnitStructBlueprintDtos();
|
|
|
+ if(paperDetailInfoUnitStructBlueprintDtos != null && paperDetailInfoUnitStructBlueprintDtos.size() >0){
|
|
|
+ for(PaperDetailInfoUnitStructBlueprintDto paperDetailInfoUnitStructBlueprintDto:paperDetailInfoUnitStructBlueprintDtos){
|
|
|
+ if(paperDetailInfoStructBlueprintDto != null && paperDetailInfoStructBlueprintDto.getId() != null){
|
|
|
+ //修改保存
|
|
|
+ updatePaperDetailInfoUnitStructBlueprint(paperDetailInfoUnitStructBlueprintDto,paperDetailInfoStructBlueprint);
|
|
|
+ }else{
|
|
|
+ //新增保存 蓝图试卷结构大题详情属性数量 paperDetailInfoUnitStructBlueprint 对象
|
|
|
+ savePaperDetailInfoUnitStructBlueprint(paperDetailInfoUnitStructBlueprintDto,paperDetailInfoStructBlueprint);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //保存完整的大题
|
|
|
+ PaperDetailStructBlueprint paperDetailStructBlueprint = paperDetailStructBlueprintRepo.findOne(paperDetailInfoStructBlueprintDto.getPaperDetailStructBlueprintId());
|
|
|
+ paperDetailStructBlueprint.setDetailUnitCount(paperDetailInfoStructBlueprintDto.getCount());
|
|
|
+ paperDetailStructBlueprint.setScore(paperDetailInfoStructBlueprintDto.getTotalScore());
|
|
|
+ paperDetailStructBlueprint.setType(paperDetailInfoStructBlueprintDto.getQuestionType());
|
|
|
+ paperDetailStructBlueprintRepo.save(paperDetailStructBlueprint);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 跟新
|
|
|
+ * 根据蓝图试卷结构大题详情属性数量 dto保存多个小题详情对象
|
|
|
+ * @param paperDetailInfoUnitStructBlueprintDto
|
|
|
+ * @param paperDetailInfoStructBlueprint
|
|
|
+ */
|
|
|
+ private void updatePaperDetailInfoUnitStructBlueprint(PaperDetailInfoUnitStructBlueprintDto paperDetailInfoUnitStructBlueprintDto,PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint) {
|
|
|
+ //查询已经保存的六个对象,并更新
|
|
|
+ //公开简单
|
|
|
+ if(paperDetailInfoUnitStructBlueprintDto.getPublicSimple() != null){
|
|
|
+ PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
|
|
|
+ (paperDetailInfoStructBlueprint.getId(), paperDetailInfoStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprintDto.getPropertyId(), true, PropertyDifficulty.SIMPLE.name());
|
|
|
+ paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getPublicSimple());
|
|
|
+ paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
|
|
|
+ }
|
|
|
+ //公开中等
|
|
|
+ if(paperDetailInfoUnitStructBlueprintDto.getPublicMedium() != null){
|
|
|
+ PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
|
|
|
+ (paperDetailInfoStructBlueprint.getId(), paperDetailInfoStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprintDto.getPropertyId(), true, PropertyDifficulty.MEDIUM.name());
|
|
|
+ paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getPublicMedium());
|
|
|
+ paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
|
|
|
+ }
|
|
|
+ //公开困难
|
|
|
+ if(paperDetailInfoUnitStructBlueprintDto.getPublicDifficulty() != null){
|
|
|
+ PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
|
|
|
+ (paperDetailInfoStructBlueprint.getId(), paperDetailInfoStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprintDto.getPropertyId(), true, PropertyDifficulty.DIFFICULTY.name());
|
|
|
+ paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getPublicDifficulty());
|
|
|
+ paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
|
|
|
+ }
|
|
|
+ //非公开简单
|
|
|
+ if(paperDetailInfoUnitStructBlueprintDto.getNoPublicSimple() != null){
|
|
|
+ PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
|
|
|
+ (paperDetailInfoStructBlueprint.getId(), paperDetailInfoStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprintDto.getPropertyId(), false, PropertyDifficulty.SIMPLE.name());
|
|
|
+ paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getNoPublicSimple());
|
|
|
+ paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
|
|
|
+ }
|
|
|
+ //非公开中等
|
|
|
+ if(paperDetailInfoUnitStructBlueprintDto.getNoPublicMedium() != null){
|
|
|
+ PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
|
|
|
+ (paperDetailInfoStructBlueprint.getId(), paperDetailInfoStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprintDto.getPropertyId(), false, PropertyDifficulty.MEDIUM.name());
|
|
|
+ paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getNoPublicMedium());
|
|
|
+ paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
|
|
|
+ }
|
|
|
+ //非公开困难
|
|
|
+ if(paperDetailInfoUnitStructBlueprintDto.getNoPublicDifficulty() != null){
|
|
|
+ PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
|
|
|
+ (paperDetailInfoStructBlueprint.getId(), paperDetailInfoStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprintDto.getPropertyId(), false, PropertyDifficulty.DIFFICULTY.name());
|
|
|
+ paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getNoPublicDifficulty());
|
|
|
+ paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**新增
|
|
|
+ * 根据蓝图试卷结构大题详情属性数量 dto保存多个小题详情对象
|
|
|
+ * @param paperDetailInfoUnitStructBlueprintDto
|
|
|
+ */
|
|
|
+ private void savePaperDetailInfoUnitStructBlueprint(PaperDetailInfoUnitStructBlueprintDto paperDetailInfoUnitStructBlueprintDto, PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint) {
|
|
|
+ //公开简单
|
|
|
+ if(paperDetailInfoUnitStructBlueprintDto.getPublicSimple() != null){
|
|
|
+ PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = new PaperDetailInfoUnitStructBlueprint(paperDetailInfoUnitStructBlueprintDto, paperDetailInfoStructBlueprint);
|
|
|
+ paperDetailInfoUnitStructBlueprint.setIsPublic(true);
|
|
|
+ paperDetailInfoUnitStructBlueprint.setPropertyDifficulty(PropertyDifficulty.SIMPLE.name());
|
|
|
+ paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getPublicSimple());
|
|
|
+ paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
|
|
|
+ }
|
|
|
+ //公开中等
|
|
|
+ if(paperDetailInfoUnitStructBlueprintDto.getPublicMedium() != null){
|
|
|
+ PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = new PaperDetailInfoUnitStructBlueprint(paperDetailInfoUnitStructBlueprintDto, paperDetailInfoStructBlueprint);
|
|
|
+ paperDetailInfoUnitStructBlueprint.setIsPublic(true);
|
|
|
+ paperDetailInfoUnitStructBlueprint.setPropertyDifficulty(PropertyDifficulty.MEDIUM.name());
|
|
|
+ paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getPublicMedium());
|
|
|
+ paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
|
|
|
+ }
|
|
|
+ //公开困难
|
|
|
+ if(paperDetailInfoUnitStructBlueprintDto.getPublicDifficulty() != null){
|
|
|
+ PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = new PaperDetailInfoUnitStructBlueprint(paperDetailInfoUnitStructBlueprintDto, paperDetailInfoStructBlueprint);
|
|
|
+ paperDetailInfoUnitStructBlueprint.setIsPublic(true);
|
|
|
+ paperDetailInfoUnitStructBlueprint.setPropertyDifficulty(PropertyDifficulty.DIFFICULTY.name());
|
|
|
+ paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getPublicDifficulty());
|
|
|
+ paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
|
|
|
+ }
|
|
|
+ //非公开简单
|
|
|
+ if(paperDetailInfoUnitStructBlueprintDto.getNoPublicSimple() != null){
|
|
|
+ PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = new PaperDetailInfoUnitStructBlueprint(paperDetailInfoUnitStructBlueprintDto, paperDetailInfoStructBlueprint);
|
|
|
+ paperDetailInfoUnitStructBlueprint.setIsPublic(false);
|
|
|
+ paperDetailInfoUnitStructBlueprint.setPropertyDifficulty(PropertyDifficulty.SIMPLE.name());
|
|
|
+ paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getNoPublicSimple());
|
|
|
+ paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
|
|
|
+ }
|
|
|
+ //非公开中等
|
|
|
+ if(paperDetailInfoUnitStructBlueprintDto.getNoPublicMedium() != null){
|
|
|
+ PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = new PaperDetailInfoUnitStructBlueprint(paperDetailInfoUnitStructBlueprintDto, paperDetailInfoStructBlueprint);
|
|
|
+ paperDetailInfoUnitStructBlueprint.setIsPublic(false);
|
|
|
+ paperDetailInfoUnitStructBlueprint.setPropertyDifficulty(PropertyDifficulty.MEDIUM.name());
|
|
|
+ paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getNoPublicMedium());
|
|
|
+ paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
|
|
|
+ }
|
|
|
+ //非公开困难
|
|
|
+ if(paperDetailInfoUnitStructBlueprintDto.getNoPublicDifficulty() != null){
|
|
|
+ PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint = new PaperDetailInfoUnitStructBlueprint(paperDetailInfoUnitStructBlueprintDto, paperDetailInfoStructBlueprint);
|
|
|
+ paperDetailInfoUnitStructBlueprint.setIsPublic(false);
|
|
|
+ paperDetailInfoUnitStructBlueprint.setPropertyDifficulty(PropertyDifficulty.DIFFICULTY.name());
|
|
|
+ paperDetailInfoUnitStructBlueprint.setNumber(paperDetailInfoUnitStructBlueprintDto.getNoPublicDifficulty());
|
|
|
+ paperDetailInfoUnitStructBlueprintRepo.save(paperDetailInfoUnitStructBlueprint);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PaperDetailInfoStructBlueprintDto findByPaperDetailStructBlueprintId(Long paperDetailStructBlueprintId) {
|
|
|
+ //查询蓝图试卷结构大题详情
|
|
|
+ PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint = paperDetailInfoStructBlueprintRepo.findByPaperDetailStructBlueprintId(paperDetailStructBlueprintId);
|
|
|
+ if(paperDetailInfoStructBlueprint == null){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ PaperDetailInfoStructBlueprintDto paperDetailInfoStructBlueprintDto = new PaperDetailInfoStructBlueprintDto(paperDetailInfoStructBlueprint);
|
|
|
+ String[] strsStrings = paperDetailInfoStructBlueprint.getQuesNames().split(",");
|
|
|
+ List<String> quesNames = Arrays.asList(strsStrings);
|
|
|
+ paperDetailInfoStructBlueprintDto.setQuesNames(quesNames);
|
|
|
+ //查询蓝图试卷结构大题详情属性数量
|
|
|
+ List<PaperDetailInfoUnitStructBlueprintDto> paperDetailInfoUnitStructBlueprintDtos = new ArrayList<PaperDetailInfoUnitStructBlueprintDto>();
|
|
|
+ //查询属性树
|
|
|
+ List<PaperDetailInfoUnitStructBlueprint> paperDetailInfoUnitStructBlueprints = paperDetailInfoUnitStructBlueprintRepo.findGroupByPropertyId(paperDetailInfoStructBlueprint.getId(), paperDetailInfoStructBlueprint.getPaperDetailStructBlueprintId());
|
|
|
+ for(PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint:paperDetailInfoUnitStructBlueprints){
|
|
|
+ //根据属性树包装成 PaperDetailInfoUnitStructBlueprintDto 对象
|
|
|
+ PaperDetailInfoUnitStructBlueprintDto paperDetailInfoUnitStructBlueprintDto = buildPaperDetailInfoUnitStructBlueprintDto(paperDetailInfoUnitStructBlueprint);
|
|
|
+ paperDetailInfoUnitStructBlueprintDtos.add(paperDetailInfoUnitStructBlueprintDto);
|
|
|
+ }
|
|
|
+ paperDetailInfoStructBlueprintDto.setPaperDetailInfoUnitStructBlueprintDtos(paperDetailInfoUnitStructBlueprintDtos);
|
|
|
+ return paperDetailInfoStructBlueprintDto;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据蓝图试卷结构大题详情属性数量包装成前端需要对象
|
|
|
+ * @param paperDetailInfoUnitStructBlueprint
|
|
|
+ */
|
|
|
+ private PaperDetailInfoUnitStructBlueprintDto buildPaperDetailInfoUnitStructBlueprintDto(PaperDetailInfoUnitStructBlueprint paperDetailInfoUnitStructBlueprint) {
|
|
|
+ Property property = propertyRepo.findOne(paperDetailInfoUnitStructBlueprint.getPropertyId());
|
|
|
+ PaperDetailInfoUnitStructBlueprintDto paperDetailInfoUnitStructBlueprintDto = new PaperDetailInfoUnitStructBlueprintDto();
|
|
|
+ paperDetailInfoUnitStructBlueprintDto.setPropertyId(property.getId());
|
|
|
+ paperDetailInfoUnitStructBlueprintDto.setPropertyName(property.getName());
|
|
|
+ paperDetailInfoUnitStructBlueprintDto.setPropertyParentId(property.getParentId());
|
|
|
+ //公开简单
|
|
|
+ paperDetailInfoUnitStructBlueprintDto.setPublicSimple(paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
|
|
|
+ (paperDetailInfoUnitStructBlueprint.getPaperDetailInfoStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPropertyId(),
|
|
|
+ true, PropertyDifficulty.SIMPLE.name()).getNumber());
|
|
|
+ //公开中等
|
|
|
+ paperDetailInfoUnitStructBlueprintDto.setPublicMedium(paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
|
|
|
+ (paperDetailInfoUnitStructBlueprint.getPaperDetailInfoStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPropertyId(),
|
|
|
+ true, PropertyDifficulty.MEDIUM.name()).getNumber());
|
|
|
+ //公开困难
|
|
|
+ paperDetailInfoUnitStructBlueprintDto.setPublicDifficulty(paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
|
|
|
+ (paperDetailInfoUnitStructBlueprint.getPaperDetailInfoStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPropertyId(),
|
|
|
+ true, PropertyDifficulty.DIFFICULTY.name()).getNumber());
|
|
|
+ //非公开简单
|
|
|
+ paperDetailInfoUnitStructBlueprintDto.setNoPublicSimple(paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
|
|
|
+ (paperDetailInfoUnitStructBlueprint.getPaperDetailInfoStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPropertyId(),
|
|
|
+ false, PropertyDifficulty.SIMPLE.name()).getNumber());
|
|
|
+ //非公开中等
|
|
|
+ paperDetailInfoUnitStructBlueprintDto.setNoPublicMedium(paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
|
|
|
+ (paperDetailInfoUnitStructBlueprint.getPaperDetailInfoStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPropertyId(),
|
|
|
+ false, PropertyDifficulty.MEDIUM.name()).getNumber());
|
|
|
+ //非公开困难
|
|
|
+ paperDetailInfoUnitStructBlueprintDto.setNoPublicDifficulty(paperDetailInfoUnitStructBlueprintRepo.findByPaperDetailInfoStructBlueprintIdAndPaperDetailStructBlueprintIdAndPropertyIdAndIsPublicAndPropertyDifficulty
|
|
|
+ (paperDetailInfoUnitStructBlueprint.getPaperDetailInfoStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPaperDetailStructBlueprintId(), paperDetailInfoUnitStructBlueprint.getPropertyId(),
|
|
|
+ false, PropertyDifficulty.DIFFICULTY.name()).getNumber());
|
|
|
+ paperDetailInfoUnitStructBlueprintDto.setNumber(paperDetailInfoUnitStructBlueprintDto.getPublicSimple() + paperDetailInfoUnitStructBlueprintDto.getPublicMedium()
|
|
|
+ +paperDetailInfoUnitStructBlueprintDto.getPublicDifficulty() + paperDetailInfoUnitStructBlueprintDto.getNoPublicSimple()
|
|
|
+ +paperDetailInfoUnitStructBlueprintDto.getNoPublicMedium() + paperDetailInfoUnitStructBlueprintDto.getNoPublicDifficulty());
|
|
|
+ //判断这条记录在页面上是否置灰
|
|
|
+ boolean disable = setDisable(property);
|
|
|
+ paperDetailInfoUnitStructBlueprintDto.setDisable(disable);
|
|
|
+ return paperDetailInfoUnitStructBlueprintDto;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 如果父节点下面没有子节点,就置灰
|
|
|
+ * @param property
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private boolean setDisable(Property property) {
|
|
|
+ //如果是父节点
|
|
|
+ if(property.getParentId() == 0L){
|
|
|
+ //取到子节点
|
|
|
+ List<Property> propertySonsList = propertyRepo.findByParentIdOrderByNumber(property.getId());
|
|
|
+ if(propertySonsList != null && propertySonsList.size() >0){
|
|
|
+ return true;
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public PaperDetailInfoStructBlueprint getPaperDetailInfoStructBlueprint(Long paperDetailStructBlueprintId) {
|
|
|
+ PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint = paperDetailInfoStructBlueprintRepo.findByPaperDetailStructBlueprintId(paperDetailStructBlueprintId);
|
|
|
+ return paperDetailInfoStructBlueprint;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void deleteSingle(PaperDetailInfoStructBlueprint paperDetailInfoStructBlueprint) {
|
|
|
+ paperDetailInfoStructBlueprintRepo.delete(paperDetailInfoStructBlueprint);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|