Parcourir la source

得分报告代码提交

wangchangsheng il y a 1 an
Parent
commit
d8ea309df7

+ 3 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/entity/dto/response/EvaluationScoreInfoResDTO.java

@@ -21,7 +21,9 @@ public class EvaluationScoreInfoResDTO {
 	private String quantifiedValue;
 	private String nonQuantifiedValue;
 	private String indicatorId;
-	private String  indicatorName;
+	private String indicatorName;
+	private String evaluateRuleId;
+	private String  evaluateRuleInfoId;
 
 
 

+ 1 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/EvaluateRuleInfoServiceImpl.java

@@ -39,6 +39,7 @@ public class EvaluateRuleInfoServiceImpl extends ServiceImpl<EvaluateRuleInfoMap
 			throw new CustomException("获取规则明细参数空");
 		}
 		qw.lambda().in(EvaluateRuleInfo::getEvaluateRuleId, evaluateRuleIds);
+		qw.lambda().orderByAsc(EvaluateRuleInfo::getOrderNum);
 		List<EvaluateRuleInfo> list = baseMapper.selectList(qw);
 		return list;
 	}

+ 159 - 29
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationEvaluationServiceImpl.java

@@ -9,6 +9,8 @@ import com.ims.eval.config.CustomException;
 import com.ims.eval.dao.ResponsibilityIndicatorInfoMapper;
 import com.ims.eval.entity.*;
 import com.ims.eval.dao.OrganizationEvaluationMapper;
+import com.ims.eval.entity.dto.request.IndicatorDTO;
+import com.ims.eval.entity.dto.request.IndicatorDictionaryDTO;
 import com.ims.eval.entity.dto.response.*;
 import com.ims.eval.service.*;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -79,6 +81,9 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
 	@Resource
 	private IResponsibilityIndicatorInfoService responsibilityIndicatorInfoService;
 
+	@Resource
+	private IEvaluationScoreCountService evaluationScoreCountService;
+
 
 	@Override
 	public IPage<OrganizationEvaluation> list(Integer pageNum, Integer pageSize, String id, String organizationEvaluationCode, List<String> checkCycle, String beginDate, String endDate, String stage, String createBy, String year, String month, String des) {
@@ -588,48 +593,173 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
 
 	@Override
 	public Map getEvaluationScoreInfo(String id, String binSection, String indicatorId, String organizationEvaluationRuleId) {
+
+
+
 		Map map = new HashMap();
+		String title1 = "";
+		List<Object> indicatorNamelist = new ArrayList<>();
+		Map<String, Object> indicatorName = new LinkedHashMap<>();
+		List<Object> bodylist = new ArrayList<>();
+
+		//获取到数据
+		List<EvaluationScoreInfoResDTO> listdt = baseMapper.selectEvaluationScoreInfoList(id, binSection, indicatorId, organizationEvaluationRuleId);
+
+
+		//1.指标id是否为空(有值显示当前指标打分)
+		if (!StringUtils.isNotEmpty(indicatorId)) {
+			IndicatorDTO indicator = iIndicatorService.getById(indicatorId);
+			title1 = indicator.getIndicatorName()+"打分表";
+
+			List<Object> childlist = new ArrayList<>();
+			List<IndicatorDictionaryDTO> indicatorDictionaryDTOList = indicator.getDtoList();
+			for(IndicatorDictionaryDTO dto:indicatorDictionaryDTOList){
+				Map<String, Object> childName = new LinkedHashMap<>();
+				List<Object> oplist = new ArrayList<>();
+				for(IndicatorDictionary ids : dto.getList()){
+					if(!ids.getIsShow()){
+						continue;
+					}
+					Map<String, Object> opmap = new HashMap<>();
+					opmap.put("key", dto.getChildCode() + "_" + ids.getOptionCode());
+					opmap.put("name", ids.getOptionName());
+					oplist.add(opmap);
+				}
+				//有子指标和没有子指标区别
+				if(indicatorDictionaryDTOList.size()>1){
+					childName.put(dto.getChildName(),oplist);
+					childlist.add(childName);
+				}else {
+					childlist.addAll(oplist);
+				}
 
+			}
 
-		Map<String, Object> indicatorNam = new LinkedHashMap<>();
-		//判断是
-		if (StringUtils.isNotEmpty(indicatorId)) {
-
-			List<EvaluationScoreInfoResDTO> listdt = baseMapper.selectEvaluationScoreInfoList(id, binSection, indicatorId, organizationEvaluationRuleId);
-
-			Boolean flag = true;
-			// 添加标题
-			if (flag) {
-				Map<String, List<EvaluationScoreInfoResDTO>> indicatorNamMap = listdt.stream().collect(Collectors.groupingBy(EvaluationScoreInfoResDTO::getIndicatorName));
-				Map<String, List<EvaluationScoreInfoResDTO>> childNameMap = listdt.stream().collect(Collectors.groupingBy(dto -> dto.getChildCode() + "," + dto.getChildName()));
-				for (Map.Entry<String, List<EvaluationScoreInfoResDTO>> indicatorNamEntry : indicatorNamMap.entrySet()) {
-					List<Object> onlist = new ArrayList<>();
-					for (Map.Entry<String, List<EvaluationScoreInfoResDTO>> childNameEntry : childNameMap.entrySet()) {
-						String[] zb = childNameEntry.getKey().split(",");
-						List<EvaluationScoreInfoResDTO> listdto = childNameEntry.getValue();
-						List<Object> oplist = new ArrayList<>();
-						for (EvaluationScoreInfoResDTO dto : listdto) {
-							Map<String, Object> opmap = new HashMap<>();
-							opmap.put("key", zb[0] + "_" + dto.getOptionCode());
-							opmap.put("name", dto.getOptionName());
-							oplist.add(oplist);
+			indicatorName.put(indicator.getIndicatorName(),childlist);
+
+			//按照公司分组
+			Map<String, List<EvaluationScoreInfoResDTO>> organizationScoreMap = listdt.stream().collect(Collectors.groupingBy(score->score.getOrganizationId()+","+score.getOrganizationShortName()));
+			for (Map.Entry<String, List<EvaluationScoreInfoResDTO>> organizationScoreEntry : organizationScoreMap.entrySet()) {
+				Map<String, Object> opmap = new HashMap<>();
+				//公司名
+				opmap.put("organizationShortName",organizationScoreEntry.getKey().split(",")[1]);
+				//按照子指标分组
+				Map<String, List<EvaluationScoreInfoResDTO>> childNameMap = organizationScoreEntry.getValue().stream().collect(Collectors.groupingBy(EvaluationScoreInfoResDTO::getChildCode));
+				for (Map.Entry<String, List<EvaluationScoreInfoResDTO>> childNameEntry : childNameMap.entrySet()) {
+					List<EvaluationScoreInfoResDTO> listdto = childNameEntry.getValue();
+					Boolean zhdfflg = true;
+					for (EvaluationScoreInfoResDTO dto : listdto) {
+						//综合得分
+						if(zhdfflg && (childNameMap.size()>1 || dto.getChildName().equals("净利润"))){
+							List<EvaluationScoreCount> scoreCounts = evaluationScoreCountService.getEvaluationScoreCountList(id,dto.getOrganizationEvaluationRuleId(),dto.getIndicatorId());
+							opmap.put("zhdf",scoreCounts.get(0).getObversionScore());
+							zhdfflg = false;
 						}
-						Map<String, Object> onmap = new HashMap<>();
-						onmap.put("key", zb[1]);
-						onmap.put("value", oplist);
-						onlist.add(onmap);
+						opmap.put(dto.getChildCode()+"_"+dto.getOptionCode(),dto.getQuantifiedValue());
 					}
-					indicatorNam.put(indicatorNamEntry.getKey(), onlist);
-					map.put("title",indicatorNam);
 				}
-				flag = false;
+				bodylist.add(opmap);
 			}
+			map.put("title1",title1);
+			map.put("title2",indicatorName);
+			map.put("values",bodylist);
 
 		} else {
+			//2.指标id为空(显示所有指标打分)
 
+			List<String> ruleIds = listdt.stream().map(EvaluationScoreInfoResDTO::getEvaluateRuleId).collect(Collectors.toList());
+			ruleIds = ruleIds.stream().distinct().collect(Collectors.toList());
+			if(ruleIds.size()>1){
+				return null;
+			}
+			List<EvaluateRuleInfo> ruleInfos = evaluateRuleInfoService.list(ruleIds);
+			List<String> indicatorIds = ruleInfos.stream().map(EvaluateRuleInfo::getIndicatorId).distinct().collect(Collectors.toList());
+			for (String i : indicatorIds) {
+				Map<String, Object> indicatorName2 = new LinkedHashMap<>();
+				IndicatorDTO indicator = iIndicatorService.getById(i);
+
+				List<Object> childlist = new ArrayList<>();
+				List<IndicatorDictionaryDTO> indicatorDictionaryDTOList = indicator.getDtoList();
+				Boolean zhdfflg = true;
+				int count = 0;
+				for (IndicatorDictionaryDTO dto : indicatorDictionaryDTOList) {
+					count++;
+					if(count>1){
+						continue;
+					}
+					List<Object> oplist = new ArrayList<>();
+					for (IndicatorDictionary ids : dto.getList()) {
+						if (!ids.getIsShow() || ids.getOptionCode().equals("CZ")) {
+							continue;
+						}
+						Map<String, Object> opmap = new HashMap<>();
+						opmap.put("key", dto.getChildCode() + "_" + ids.getOptionCode());
+						opmap.put("name", ids.getOptionName());
+
+						oplist.add(opmap);
+					}
+					//有子指标和没有子指标区别
+					if (zhdfflg && (dto.getChildName().equals("净利润"))) {
+						Map<String, Object> zhdf = new HashMap<>();
+						zhdf.put("key", "zhdf");
+						zhdf.put("name", "综合得分");
+						zhdfflg = false;
+						oplist.add(zhdf);
+					}
+
+					childlist.addAll(oplist);
+
+				}
+
+				indicatorName2.put(indicator.getIndicatorName(), childlist);
+				indicatorNamelist.add(indicatorName2);
+			}
+
+
+			List<Object> bodylist2 = new ArrayList<>();
+			//按照公司分组
+			Map<String, List<EvaluationScoreInfoResDTO>> organizationScoreMap = listdt.stream().collect(Collectors.groupingBy(score->score.getOrganizationId()+","+score.getOrganizationShortName()));
+
+
+			for (Map.Entry<String, List<EvaluationScoreInfoResDTO>> organizationScoreEntry : organizationScoreMap.entrySet()) {
+				Map<String, Object> opmap = new HashMap<>();
+				//公司名
+				opmap.put("organizationShortName",organizationScoreEntry.getKey().split(",")[1]);
+				//按照子指标分组
+				Map<String, List<EvaluationScoreInfoResDTO>> indicatorIdMap = organizationScoreEntry.getValue().stream().collect(Collectors.groupingBy(EvaluationScoreInfoResDTO::getIndicatorId));
+
+
+				Boolean zhdfflg2 = true;
+				for (Map.Entry<String, List<EvaluationScoreInfoResDTO>> indicatorIdEntry : indicatorIdMap.entrySet()) {
+					Map<String, List<EvaluationScoreInfoResDTO>> iChildCodeMap = indicatorIdEntry.getValue().stream().collect(Collectors.groupingBy(EvaluationScoreInfoResDTO::getChildCode));
+
+					for (EvaluationScoreInfoResDTO dto : indicatorIdEntry.getValue()) {
+						if(iChildCodeMap.size()>1 && dto.getOptionCode().equals("DF")){
+							List<EvaluationScoreCount> scoreCounts = evaluationScoreCountService.getEvaluationScoreCountList(id,dto.getOrganizationEvaluationRuleId(),dto.getIndicatorId());
+							opmap.put(dto.getChildCode()+"_"+dto.getOptionCode(),scoreCounts.get(0).getObversionScore());
+						}else {
+							opmap.put(dto.getChildCode()+"_"+dto.getOptionCode(),dto.getQuantifiedValue());
+						}
+
+						//综合得分
+						if(zhdfflg2 && (dto.getChildName().equals("净利润"))){
+							List<EvaluationScoreCount> scoreCounts = evaluationScoreCountService.getEvaluationScoreCountList(id,dto.getOrganizationEvaluationRuleId(),dto.getIndicatorId());
+							opmap.put("zhdf",scoreCounts.get(0).getObversionScore());
+							zhdfflg2 = false;
+						}
+					}
+
+				}
+
+				bodylist2.add(opmap);
+			}
+
+			map.put("title",indicatorNamelist);
+			map.put("values",bodylist2);
 		}
 
 
+
 		return map;
 	}
 }

+ 3 - 1
ims-service/ims-eval/src/main/resources/mappers/OrganizationEvaluationMapper.xml

@@ -99,7 +99,9 @@
         oi.option_code,
         d.option_name,
         oi.quantified_value,
-        oi.non_quantified_value
+        oi.non_quantified_value,
+        ei.evaluate_rule_id,
+        oi.evaluate_rule_info_id
 
     from organization_evaluation oe
     left join organization_evaluation_info oi on oe.id = oi.organization_evaluation_id