Browse Source

业绩对标管理问题修复

hlf 8 months ago
parent
commit
91ae3fc5ee

+ 0 - 2
ims-service/ims-eval/src/main/java/com/ims/eval/entity/OrganizationEvaluationInfo.java

@@ -122,8 +122,6 @@ public class OrganizationEvaluationInfo extends Model {
 	 */
 	private String organizationId;
 
-
-
 	@TableField(exist = false)
 	private String checkCycle;
 	@TableField(exist = false)

+ 28 - 28
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/PerformanceBenchmarkInfoServiceImpl.java

@@ -241,30 +241,30 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 				List<PbiGroup> pbiGroupList = grouped.entrySet().stream().map(obj -> new PbiGroup(obj.getKey(), obj.getValue())).collect(Collectors.toList());
 				for (PbiGroup pbiGroup : pbiGroupList) {
 					//指标完成值求和
-					double completeValueSum = pbiGroup.getPbis().stream().filter(obj -> obj.getCompleteValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getCompleteValue).sum();
+					double completeValueSum = pbiGroup.getPbis().stream().filter(obj -> obj.getCompleteValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getCompleteValue).average().orElse(0.0);
 					//装机容量求和
-					double installCapacitySum = pbiGroup.getPbis().stream().filter(obj -> obj.getInstallCapacity() >= 0).mapToDouble(PerformanceBenchmarkInfo::getInstallCapacity).sum();
-					//往年全年pbiGroup.getIndexName()指标数据
+					double installCapacitySum = pbiGroup.getPbis().stream().filter(obj -> obj.getInstallCapacity() >= 0).mapToDouble(PerformanceBenchmarkInfo::getInstallCapacity).average().orElse(0.0);
+					//去年全年指标数据
 					List<PerformanceBenchmarkInfo> wnData = baseMapper.selectListByIndexName(manageCategory, checkCycle, degreeYear - 1, null, pbiGroup.getIndexName());
-					//前年全年pbiGroup.getIndexName()指标数据
+					//前年全年指标数据
 					List<PerformanceBenchmarkInfo> qnData = baseMapper.selectListByIndexName(manageCategory, checkCycle, degreeYear - 2, null, pbiGroup.getIndexName());
 					double plannedValueWnSum;
 					double plannedValueQnSum;
 					double completeValueWnSum;
 					if (qnData.size() > 0 && wnData.size() > 0) {
-						//往年计划值
-						plannedValueWnSum = wnData.stream().filter(obj -> obj.getPlannedValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
-						//往年实际完成值
-						completeValueWnSum = wnData.stream().filter(obj -> obj.getCompleteValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getCompleteValue).sum();
+						//去年计划值
+						plannedValueWnSum = wnData.stream().filter(obj -> obj.getPlannedValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).average().orElse(0.0);
 						//前年计划值
-						plannedValueQnSum = qnData.stream().filter(obj -> obj.getPlannedValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
+						plannedValueQnSum = qnData.stream().filter(obj -> obj.getPlannedValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).average().orElse(0.0);
+						//去年实际完成值
+						completeValueWnSum = wnData.stream().filter(obj -> obj.getCompleteValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getCompleteValue).average().orElse(0.0);
 					} else if (wnData.size() > 0) {
-						//往年计划值
-						plannedValueWnSum = wnData.stream().filter(obj -> obj.getPlannedValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
+						//年计划值
+						plannedValueWnSum = wnData.stream().filter(obj -> obj.getPlannedValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).average().orElse(0.0);
 						plannedValueQnSum = 0;
 						completeValueWnSum = 0;
 					} else {
-						plannedValueWnSum = completeValueSum;
+						plannedValueWnSum = completeValueSum / pbiGroup.getPbis().size();
 						plannedValueQnSum = -1;
 						completeValueWnSum = -1;
 					}
@@ -282,30 +282,30 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 				//Map转List
 				List<PbiGroup> pbiGroupList = grouped.entrySet().stream().map(entry -> new PbiGroup(entry.getKey(), entry.getValue())).collect(Collectors.toList());
 				for (PbiGroup pbiGroup : pbiGroupList) {
-					//往年当前季/月pbiGroup.getIndexName()指标数据
+					//去年1季/月度指标数据
 					List<PerformanceBenchmarkInfo> wnfData = baseMapper.selectListByIndexName(manageCategory, checkCycle, degreeYear - 1, quarterlyMonth, pbiGroup.getIndexName());
 					double zb;
 					if (wnfData.size() > 0) {
-						//往年全年pbiGroup.getIndexName()指标数据
+						//去年全年指标数据
 						List<PerformanceBenchmarkInfo> wnhData = baseMapper.selectListByIndexName(manageCategory, checkCycle, degreeYear - 1, null, pbiGroup.getIndexName());
-						//往年全年计划值总和
-						double wnhPlannedValueSum = wnhData.stream().filter(obj -> obj.getPlannedValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
-						//往年当前季/月计划值总和
-						double wnfPlannedValueSum = wnfData.stream().filter(obj -> obj.getPlannedValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
-						zb = wnfPlannedValueSum / wnhPlannedValueSum;
+						//去年全年发电量总和
+						double wnhCompleteValueSum = wnhData.stream().filter(obj -> obj.getCompleteValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getCompleteValue).sum();
+						//去年1季/月度发电量总和
+						double wnfCompleteValueSum = wnfData.stream().filter(obj -> obj.getCompleteValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getCompleteValue).sum();
+						//每月占比
+						zb = wnfCompleteValueSum / wnhCompleteValueSum;
 					} else {
-						//当前年pbiGroup.getIndexName()指标全数据
-						double dnPlannedValueSum = pbiGroup.getPbis().stream().filter(obj -> obj.getPlannedValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
-						if ("JDKP".equals(checkCycle)) {
-							zb = (3 / dnPlannedValueSum) * dnPlannedValueSum;
-						} else {
-							zb = (12 / dnPlannedValueSum) * dnPlannedValueSum;
-						}
+						//当年全年指标数据
+						List<PerformanceBenchmarkInfo> dnhData = baseMapper.selectListByIndexName(manageCategory, checkCycle, degreeYear, null, pbiGroup.getIndexName());
+						//当年全年计划值总和
+						double dnhCompleteValueSum = dnhData.stream().filter(obj -> obj.getCompleteValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getCompleteValue).sum();
+						//当年1季/月度计划值总和
+						double dnfCompleteValueSum = pbiGroup.getPbis().stream().filter(obj -> obj.getCompleteValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getCompleteValue).sum();
+						zb = dnfCompleteValueSum / dnhCompleteValueSum;
 					}
-					double finalZb = zb;
 					performanceBenchmarkInfoList.forEach(PerformanceBenchmarkInfo -> {
 						if (null != PerformanceBenchmarkInfo.getPlannedValue()) {
-							PerformanceBenchmarkInfo.setRecommendedValue(quarterlyMonthIndexRecommendedValue(PerformanceBenchmarkInfo.getPlannedValue(), finalZb));
+							PerformanceBenchmarkInfo.setRecommendedValue(quarterlyMonthIndexRecommendedValue(PerformanceBenchmarkInfo.getPlannedValue(), zb));
 							updateList.add(PerformanceBenchmarkInfo);
 						}
 					});

+ 4 - 3
ims-service/ims-eval/src/main/resources/mappers/PerformanceBenchmarkInfoMapper.xml

@@ -76,7 +76,7 @@
                 AND is_cb = 1 order by cb_val desc
             </if>
         </where>
-        order by index_name asc
+        order by company_id asc, index_name asc
     </select>
 
     <select id="selectList" resultType="com.ims.eval.entity.PerformanceBenchmarkInfo">
@@ -95,7 +95,7 @@
                 AND quarterly_month = #{quarterlyMonth}
             </if>
         </where>
-        order by index_name asc
+        order by company_id asc, index_name asc
     </select>
 
     <select id="selectListByIndexName" resultType="com.ims.eval.entity.PerformanceBenchmarkInfo">
@@ -117,7 +117,7 @@
                 AND index_name = #{indexName}
             </if>
         </where>
-        order by index_name asc
+        order by company_id asc, index_name asc
     </select>
 
     <select id="getExportExcelData" resultType="com.ims.eval.entity.PerformanceBenchmarkInfo">
@@ -145,6 +145,7 @@
                 AND is_cb = 1 order by cb_val desc
             </if>
         </where>
+        order by company_id asc, index_name asc
     </select>
 
 </mapper>