Переглянути джерело

提交板块组合指标计算基础类

wangchangsheng 1 рік тому
батько
коміт
a680f3d1e0

+ 20 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/controller/CiteCalculationIndicatorController.java

@@ -0,0 +1,20 @@
+package com.ims.eval.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 板块组合指标计算 前端控制器
+ * </p>
+ *
+ * @author wang
+ * @since 2023-07-12
+ */
+@RestController
+@RequestMapping("//cite-calculation-indicator")
+public class CiteCalculationIndicatorController {
+
+}

+ 16 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/dao/CiteCalculationIndicatorMapper.java

@@ -0,0 +1,16 @@
+package com.ims.eval.dao;
+
+import com.ims.eval.entity.CiteCalculationIndicator;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 板块组合指标计算 Mapper 接口
+ * </p>
+ *
+ * @author wang
+ * @since 2023-07-12
+ */
+public interface CiteCalculationIndicatorMapper extends BaseMapper<CiteCalculationIndicator> {
+
+}

+ 48 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/entity/CiteCalculationIndicator.java

@@ -0,0 +1,48 @@
+package com.ims.eval.entity;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 板块组合指标计算
+ * </p>
+ *
+ * @author wang
+ * @since 2023-07-12
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CiteCalculationIndicator extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id
+     */
+    private String id;
+
+    /**
+     * 指标id;用逗号隔开
+     */
+    private String indicatorIds;
+
+    /**
+     * 指标名称;多个用逗号隔开
+     */
+    private String indicatorNames;
+
+    /**
+     * 描述
+     */
+    private String des;
+
+    /**
+     * 排序
+     */
+    private BigDecimal orderNum;
+
+
+}

+ 16 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/ICiteCalculationIndicatorService.java

@@ -0,0 +1,16 @@
+package com.ims.eval.service;
+
+import com.ims.eval.entity.CiteCalculationIndicator;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 板块组合指标计算 服务类
+ * </p>
+ *
+ * @author wang
+ * @since 2023-07-12
+ */
+public interface ICiteCalculationIndicatorService extends IService<CiteCalculationIndicator> {
+
+}

+ 20 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/CiteCalculationIndicatorServiceImpl.java

@@ -0,0 +1,20 @@
+package com.ims.eval.service.impl;
+
+import com.ims.eval.entity.CiteCalculationIndicator;
+import com.ims.eval.dao.CiteCalculationIndicatorMapper;
+import com.ims.eval.service.ICiteCalculationIndicatorService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 板块组合指标计算 服务实现类
+ * </p>
+ *
+ * @author wang
+ * @since 2023-07-12
+ */
+@Service
+public class CiteCalculationIndicatorServiceImpl extends ServiceImpl<CiteCalculationIndicatorMapper, CiteCalculationIndicator> implements ICiteCalculationIndicatorService {
+
+}

+ 17 - 30
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationEvaluationInfoServiceImpl.java

@@ -208,27 +208,28 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 			Map<String, List<OrganizationEvaluationInfoResDTO>> binSectionGropList = list.stream().collect(Collectors.groupingBy(OrganizationEvaluationInfoResDTO::getBinSection));
 
 			for (Map.Entry<String, List<OrganizationEvaluationInfoResDTO>> binSectionGropEntry : binSectionGropList.entrySet()){
+
 				if (binSectionGropEntry.getValue().size() > 0){
 					//按照指标分组
 					Map<String, List<OrganizationEvaluationInfoResDTO>> indicatorGropList = binSectionGropEntry.getValue().stream().collect(Collectors.groupingBy(OrganizationEvaluationInfoResDTO::getIndicatorId));
 
 
 					//计算前置属性(差值、利润贡献、单位千瓦利润)的最大最小值
-					for (Map.Entry<String, List<OrganizationEvaluationInfoResDTO>> indicatorGropListEntry : indicatorGropList.entrySet()){
+					for (Map.Entry<String, List<OrganizationEvaluationInfoResDTO>> indicatorGropListEntry : indicatorGropList.entrySet()) {
 
-						if (indicatorGropListEntry.getValue().size() > 0){
+						if (indicatorGropListEntry.getValue().size() > 0) {
 							//按照公司规则分组
 							Map<String, List<OrganizationEvaluationInfoResDTO>> ruleIdGropList = indicatorGropListEntry.getValue().stream().collect(Collectors.groupingBy(OrganizationEvaluationInfoResDTO::getOrganizationEvaluationRuleId));
 
 							//遍历公司指标
-							for (Map.Entry<String, List<OrganizationEvaluationInfoResDTO>> ruleIdGropListEntry : ruleIdGropList.entrySet()){
+							for (Map.Entry<String, List<OrganizationEvaluationInfoResDTO>> ruleIdGropListEntry : ruleIdGropList.entrySet()) {
 								if (ruleIdGropListEntry.getValue().size() > 0) {
 
 									List<OrganizationEvaluationInfoResDTO> indicator = ruleIdGropListEntry.getValue();
 									Map<String, List<OrganizationEvaluationInfoResDTO>> childCodeGropList = indicator.stream().collect(Collectors.groupingBy(OrganizationEvaluationInfoResDTO::getChildCode));
 
 									double totalScore = 0.00;
-									for (Map.Entry<String, List<OrganizationEvaluationInfoResDTO>> childCodeGropListEntry : childCodeGropList.entrySet()){
+									for (Map.Entry<String, List<OrganizationEvaluationInfoResDTO>> childCodeGropListEntry : childCodeGropList.entrySet()) {
 										for (OrganizationEvaluationInfoResDTO dto : childCodeGropListEntry.getValue()) {
 
 											if ((!dto.getOptionCode().equals("CZ") && !dto.getOptionCode().equals("LRGXL") && !dto.getOptionCode().equals("DWQWLR")) || StringUtils.isEmpty(dto.getFormula())) {
@@ -242,16 +243,16 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 											if (StringUtils.inStringIgnoreCase("DF", dto.getOptionCode())) {
 												totalScore = totalScore + score;
 											}
-											log.info(dto.getOrganizationShortName() + "|" + dto.getChildName()+"|"+dto.getOptionCode() + "----------" + dto.getFormula() + "=" + score);
+											log.info(dto.getOrganizationShortName() + "|" + dto.getChildName() + "|" + dto.getOptionCode() + "----------" + dto.getFormula() + "=" + score);
 											OrganizationEvaluationInfo info = baseMapper.selectById(dto.getId());
 											//将计算结果保存
 											info.setQuantifiedValue(score);
-											info.setNonQuantifiedValue(score+"");
+											info.setNonQuantifiedValue(score + "");
 											dto.setQuantifiedValue(score);
-											dto.setNonQuantifiedValue(score+"");
+											dto.setNonQuantifiedValue(score + "");
 											this.saveOrUpdate(info);
 										}
-								}
+									}
 								}
 							}
 						}
@@ -260,7 +261,7 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 					}
 
 
-//					//计算前置属性(差值、利润贡献、单位千瓦利润)的最大最小值
+					//计算前置属性(差值、利润贡献、单位千瓦利润)的最大最小值
 					for (Map.Entry<String, List<OrganizationEvaluationInfoResDTO>> indicatorGropListEntry : indicatorGropList.entrySet()){
 						for (OrganizationEvaluationInfoResDTO d : indicatorGropListEntry.getValue()){
 							System.out.println(d.getOrganizationShortName()+"|"+d.getIndicatorName()+"|"+d.getOptionName()+"|"+d.getQuantifiedValue());
@@ -390,13 +391,13 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 		Map data = new HashMap();
 
 		//编辑标记
-		OrganizationEvaluation evaluation =  organizationEvaluationService.getById(organizationEvaluationId);
-		boolean editFlag = false;
-		if(StringUtils.isNotEmpty(evaluation.getInstId())){
-			editFlag = workflowService.todoTaskList2(evaluation.getInstId(),request);
-
-		}
-		data.put("editFlag",editFlag);
+//		OrganizationEvaluation evaluation =  organizationEvaluationService.getById(organizationEvaluationId);
+//		boolean editFlag = false;
+//		if(StringUtils.isNotEmpty(evaluation.getInstId())){
+//			editFlag = workflowService.todoTaskList2(evaluation.getInstId(),request);
+//
+//		}
+//		data.put("editFlag",editFlag);
 
 
 
@@ -420,17 +421,13 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 			.collect(Collectors.groupingBy(OrganizationEvaluationInfoResDTO::getOrganizationId));
 		List<Map> mapList = new ArrayList<>();
 
-
 		//设置数据标题
 		//将子指标分组
 		Map<String, List<IndicatorDictionary>> groupedChildCode = dictionaryList.stream()
 			.collect(Collectors.groupingBy(d -> d.getChildCode() + "," + d.getChildName()));
-
 		if (titlemark) {
 			Map title = new LinkedHashMap();
 			for (Map.Entry<String, List<IndicatorDictionary>> childCodeEntry : groupedChildCode.entrySet()) {
-
-
 				List<Map> titleArray = new ArrayList<>();
 				for (IndicatorDictionary d : childCodeEntry.getValue()) {
 					Map titlemap = new LinkedHashMap();
@@ -444,7 +441,6 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 
 				}
 				title.put(childCodeEntry.getKey().split(",")[1], titleArray);
-
 			}
 			Map deptstateMap = new LinkedHashMap();
 			List<Map> titlestateArray = new ArrayList<>();
@@ -457,11 +453,9 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 			data.put("title", title);
 		}
 
-
 		//获取行数据
 		//遍历按照公司分组后的数据
 		for (Map.Entry<String, List<OrganizationEvaluationInfoResDTO>> entry : groupedData.entrySet()) {
-
 			Map indicatormap = new HashMap();
 			List<OrganizationEvaluationInfoResDTO> dtoList = entry.getValue();
 
@@ -471,12 +465,10 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 					dto -> dto,
 					(oldValue, newValue) -> oldValue)); // 解决键重复的情况
 			boolean mark = true;//标记给公司名赋值
-
 			for (IndicatorDictionary d : dictionaryList) {
 				if (!d.getIsShow()) {
 					continue;
 				}
-
 				if (mark) {
 					indicatormap.put("organizationShortName", resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getOrganizationShortName());//公司名
 					indicatormap.put("organizationId", resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getOrganizationId());//公司id
@@ -485,7 +477,6 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 
 					mark = false;
 				}
-
 				//指标属性
 				indicatormap.put(d.getChildCode() + "_" + d.getOptionCode(), null == resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getNonQuantifiedValue() ? "" : resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getNonQuantifiedValue());
 				//指标id
@@ -493,13 +484,9 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
 				//是否量化
 				indicatormap.put("IS_LH_" +d.getChildCode() + "_" + d.getOptionCode(),resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getIsQuantified2()?"1":"2");
 
-
-
 			}
-
 			mapList.add(indicatormap);
 		}
-
 		data.put("value", mapList);
 		return data;
 	}

+ 12 - 4
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationEvaluationServiceImpl.java

@@ -701,7 +701,7 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
 						oplist.add(opmap);
 					}
 					//有子指标和没有子指标区别
-					if (zhdfflg && (dto.getChildName().equals("净利润"))) {
+					if (zhdfflg && (dto.getChildCode().endsWith("LRZE"))) {
 						Map<String, Object> zhdf = new HashMap<>();
 						zhdf.put("key", dto.getChildCode()+"_zhdf");
 						zhdf.put("name", "综合得分");
@@ -738,13 +738,21 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
 					for (EvaluationScoreInfoResDTO dto : indicatorIdEntry.getValue()) {
 						if(iChildCodeMap.size()>1 && dto.getOptionCode().equals("DF")){
 							List<EvaluationScoreCount> scoreCounts = evaluationScoreCountService.getEvaluationScoreCountList(id,dto.getOrganizationEvaluationRuleId(),dto.getIndicatorId(),binSection);
-							opmap.put(dto.getChildCode()+"_"+dto.getOptionCode(),scoreCounts.get(0).getObversionScore());
-						}else {
+							if(null != scoreCounts && scoreCounts.size()>0){
+								opmap.put(dto.getChildCode()+"_"+dto.getOptionCode(),scoreCounts.get(0).getObversionScore());
+							}else {
+								opmap.put(dto.getChildCode()+"_"+dto.getOptionCode(),0.0);
+							}
+
+
+						}else if(iChildCodeMap.size()==1 && dto.getOptionCode().equals("DF")) {
 							opmap.put(dto.getChildCode()+"_"+dto.getOptionCode(),dto.getQuantifiedValue());
+						}else {
+							opmap.put(dto.getChildCode()+"_"+dto.getOptionCode(),0.0);
 						}
 
 						//综合得分
-						if(zhdfflg2 && (dto.getChildName().equals("净利润"))){
+						if(zhdfflg2 && (dto.getChildCode().endsWith("LRZE"))){
 							List<EvaluationScoreCount> scoreCounts = evaluationScoreCountService.getEvaluationScoreCountList(id,dto.getOrganizationEvaluationRuleId(),dto.getIndicatorId(),binSection);
 							if (null != scoreCounts && scoreCounts.size() > 0) {
 								opmap.put(dto.getChildCode()+"_zhdf",scoreCounts.get(0).getObversionScore());

+ 8 - 0
ims-service/ims-eval/src/main/resources/mappers/CiteCalculationIndicatorMapper.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ims.eval.dao.CiteCalculationIndicatorMapper">
+
+
+
+
+</mapper>

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

@@ -267,7 +267,7 @@
     </select>
     <select id="selectEvaluationIndicatorList" resultType="java.util.Map">
 
-        select  DISTINCT i.id,i.indicator_name from organization_evaluation_info   ei
+        select  DISTINCT i.id,i.indicator_name,ri.order_num from organization_evaluation_info   ei
         LEFT JOIN evaluate_rule_info ri on ei.evaluate_rule_info_id = ri.id
         LEFT JOIN evaluate_rule er on er.id = ri.evaluate_rule_id
         INNER JOIN indicator i on i.id = ri.indicator_id
@@ -287,6 +287,8 @@
 
         </where>
 
+        order by  ri.order_num asc
+
     </select>