Selaa lähdekoodia

业绩对标管理功能开发

hlf 9 kuukautta sitten
vanhempi
commit
dfb9a90e07

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

@@ -113,8 +113,11 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 									performanceBenchmarkInfo.setPlannedValue(jhzObj.getQuantifiedValue());
 									performanceBenchmarkInfo.setCompleteValue(wczObj.getQuantifiedValue());
 									performanceBenchmarkInfo.setIsBg(0);
+									performanceBenchmarkInfo.setBgVal((double) 0);
 									performanceBenchmarkInfo.setIsDb(0);
+									performanceBenchmarkInfo.setDbVal((double) 0);
 									performanceBenchmarkInfo.setIsCb(0);
+									performanceBenchmarkInfo.setCbVal((double) 0);
 									performanceBenchmarkInfoList.add(performanceBenchmarkInfo);
 								}
 							}
@@ -146,12 +149,12 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 				//Map分组
 				Map<String, List<PerformanceBenchmarkInfo>> grouped = performanceBenchmarkInfoList.stream().collect(Collectors.groupingBy(PerformanceBenchmarkInfo::getIndexName));
 				//Map转List
-				List<PbiGroup> pbiGroupList = grouped.entrySet().stream().map(entry -> new PbiGroup(entry.getKey(), entry.getValue())).collect(Collectors.toList());
+				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().mapToDouble(PerformanceBenchmarkInfo::getCompleteValue).sum();
+					double completeValueSum = pbiGroup.getPbis().stream().filter(obj -> obj.getCompleteValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getCompleteValue).sum();
 					//装机容量求和
-					double installCapacitySum = pbiGroup.getPbis().stream().mapToDouble(PerformanceBenchmarkInfo::getInstallCapacity).sum();
+					double installCapacitySum = pbiGroup.getPbis().stream().filter(obj -> obj.getInstallCapacity() >= 0).mapToDouble(PerformanceBenchmarkInfo::getInstallCapacity).sum();
 					//往年全年pbiGroup.getIndexName()指标数据
 					List<PerformanceBenchmarkInfo> wnData = baseMapper.selectListByIndexName(manageCategory, checkCycle, degreeYear - 1, null, pbiGroup.getIndexName());
 					//前年全年pbiGroup.getIndexName()指标数据
@@ -161,14 +164,14 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 					double completeValueWnSum;
 					if (qnData.size() > 0 && wnData.size() > 0) {
 						//往年计划值
-						plannedValueWnSum = wnData.stream().mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
+						plannedValueWnSum = wnData.stream().filter(obj -> obj.getPlannedValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
 						//往年实际完成值
-						completeValueWnSum = wnData.stream().mapToDouble(PerformanceBenchmarkInfo::getCompleteValue).sum();
+						completeValueWnSum = wnData.stream().filter(obj -> obj.getCompleteValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getCompleteValue).sum();
 						//前年计划值
-						plannedValueQnSum = qnData.stream().mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
+						plannedValueQnSum = qnData.stream().filter(obj -> obj.getPlannedValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
 					} else if (wnData.size() > 0) {
 						//往年计划值
-						plannedValueWnSum = wnData.stream().mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
+						plannedValueWnSum = wnData.stream().filter(obj -> obj.getPlannedValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
 						plannedValueQnSum = 0;
 						completeValueWnSum = 0;
 					} else {
@@ -197,13 +200,13 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 						//往年全年pbiGroup.getIndexName()指标数据
 						List<PerformanceBenchmarkInfo> wnhData = baseMapper.selectListByIndexName(manageCategory, checkCycle, degreeYear - 1, null, pbiGroup.getIndexName());
 						//往年全年计划值总和
-						double wnhPlannedValueSum = wnhData.stream().mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
+						double wnhPlannedValueSum = wnhData.stream().filter(obj -> obj.getPlannedValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
 						//往年当前季/月计划值总和
-						double wnfPlannedValueSum = wnfData.stream().mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
+						double wnfPlannedValueSum = wnfData.stream().filter(obj -> obj.getPlannedValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
 						zb = wnfPlannedValueSum / wnhPlannedValueSum;
 					} else {
 						//当前年pbiGroup.getIndexName()指标全数据
-						double dnPlannedValueSum = pbiGroup.getPbis().stream().mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
+						double dnPlannedValueSum = pbiGroup.getPbis().stream().filter(obj -> obj.getPlannedValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
 						if ("JDKP".equals(checkCycle)) {
 							zb = (dnPlannedValueSum / 3) / dnPlannedValueSum;
 						} else {
@@ -212,8 +215,10 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 					}
 					double finalZb = zb;
 					performanceBenchmarkInfoList.forEach(PerformanceBenchmarkInfo -> {
-						PerformanceBenchmarkInfo.setRecommendedValue(quarterlyMonthIndexRecommendedValue(PerformanceBenchmarkInfo.getPlannedValue(), finalZb));
-						updateList.add(PerformanceBenchmarkInfo);
+						if (null != PerformanceBenchmarkInfo.getPlannedValue()) {
+							PerformanceBenchmarkInfo.setRecommendedValue(quarterlyMonthIndexRecommendedValue(PerformanceBenchmarkInfo.getPlannedValue(), finalZb));
+							updateList.add(PerformanceBenchmarkInfo);
+						}
 					});
 				}
 			}
@@ -237,7 +242,9 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 		if (benchmarkingRecordList.size() == 0) {
 			List<PerformanceBenchmarkInfo> performanceBenchmarkInfoList = baseMapper.selectList(manageCategory, checkCycle, degreeYear, quarterlyMonth);
 			performanceBenchmarkInfoList.forEach(PerformanceBenchmarkInfo -> {
-				PerformanceBenchmarkInfo.setBgVal(PerformanceBenchmarkInfo.getInstallCapacity() / PerformanceBenchmarkInfo.getCompleteValue());
+				if (null != PerformanceBenchmarkInfo.getInstallCapacity() && null != PerformanceBenchmarkInfo.getCompleteValue() && 0 != PerformanceBenchmarkInfo.getCompleteValue()) {
+					PerformanceBenchmarkInfo.setBgVal(PerformanceBenchmarkInfo.getInstallCapacity() / PerformanceBenchmarkInfo.getCompleteValue());
+				}
 			});
 			performanceBenchmarkInfoList.sort(Comparator.comparingDouble(PerformanceBenchmarkInfo::getBgVal).reversed());
 			if (!performanceBenchmarkInfoList.isEmpty() && performanceBenchmarkInfoList.get(0).getBgVal() != 0) {
@@ -263,9 +270,11 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 		if (benchmarkingRecordList.size() == 0) {
 			List<PerformanceBenchmarkInfo> performanceBenchmarkInfoList = baseMapper.selectList(manageCategory, checkCycle, degreeYear, quarterlyMonth);
 			for (PerformanceBenchmarkInfo performanceBenchmarkInfo : performanceBenchmarkInfoList) {
-				if (performanceBenchmarkInfo.getCompleteValue() >= performanceBenchmarkInfo.getScalingValue()) {
-					performanceBenchmarkInfo.setIsDb(1);
-					performanceBenchmarkInfo.setDbVal(performanceBenchmarkInfo.getCompleteValue() - performanceBenchmarkInfo.getScalingValue());
+				if (null != performanceBenchmarkInfo.getCompleteValue() && null != performanceBenchmarkInfo.getScalingValue()) {
+					if (performanceBenchmarkInfo.getCompleteValue() >= performanceBenchmarkInfo.getScalingValue()) {
+						performanceBenchmarkInfo.setIsDb(1);
+						performanceBenchmarkInfo.setDbVal(performanceBenchmarkInfo.getCompleteValue() - performanceBenchmarkInfo.getScalingValue());
+					}
 				}
 			}
 			super.updateBatchById(performanceBenchmarkInfoList);
@@ -288,9 +297,11 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 		if (benchmarkingRecordList.size() == 0) {
 			List<PerformanceBenchmarkInfo> performanceBenchmarkInfoList = baseMapper.selectList(manageCategory, checkCycle, degreeYear, quarterlyMonth);
 			performanceBenchmarkInfoList.stream().filter(p -> p.getIsBg().equals(1)).findFirst().ifPresent(performanceBenchmarkInfo -> performanceBenchmarkInfoList.forEach(PerformanceBenchmarkInfo -> {
-				if (PerformanceBenchmarkInfo.getCompleteValue() > performanceBenchmarkInfo.getScalingValue()) {
-					PerformanceBenchmarkInfo.setIsCb(1);
-					PerformanceBenchmarkInfo.setCbVal(PerformanceBenchmarkInfo.getCompleteValue() - performanceBenchmarkInfo.getScalingValue());
+				if (null != PerformanceBenchmarkInfo.getCompleteValue() && null != performanceBenchmarkInfo.getScalingValue()) {
+					if (PerformanceBenchmarkInfo.getCompleteValue() > performanceBenchmarkInfo.getScalingValue()) {
+						PerformanceBenchmarkInfo.setIsCb(1);
+						PerformanceBenchmarkInfo.setCbVal(PerformanceBenchmarkInfo.getCompleteValue() - performanceBenchmarkInfo.getScalingValue());
+					}
 				}
 			}));
 			super.updateBatchById(performanceBenchmarkInfoList);