Browse Source

业绩对标管理问题修复

hlf 8 months ago
parent
commit
cbc57ce0a7

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

@@ -21,6 +21,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.util.*;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.stream.Collectors;
 
 /**
@@ -263,9 +264,9 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 						plannedValueQnSum = 0;
 						completeValueWnSum = 0;
 					} else {
-						plannedValueWnSum = 0;
-						plannedValueQnSum = 0;
-						completeValueWnSum = 0;
+						plannedValueWnSum = completeValueSum;
+						plannedValueQnSum = -1;
+						completeValueWnSum = -1;
 					}
 					pbiGroup.getPbis().forEach(PerformanceBenchmarkInfo -> {
 						double A = yearIndexRecommendedValueA(completeValueSum, installCapacitySum, PerformanceBenchmarkInfo.getInstallCapacity());
@@ -296,9 +297,9 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 						//当前年pbiGroup.getIndexName()指标全数据
 						double dnPlannedValueSum = pbiGroup.getPbis().stream().filter(obj -> obj.getPlannedValue() >= 0).mapToDouble(PerformanceBenchmarkInfo::getPlannedValue).sum();
 						if ("JDKP".equals(checkCycle)) {
-							zb = (dnPlannedValueSum / 3) / dnPlannedValueSum;
+							zb = (3 / dnPlannedValueSum) * dnPlannedValueSum;
 						} else {
-							zb = (dnPlannedValueSum / 12) / dnPlannedValueSum;
+							zb = (12 / dnPlannedValueSum) * dnPlannedValueSum;
 						}
 					}
 					double finalZb = zb;
@@ -356,17 +357,21 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 	private void db(String manageCategory, String checkCycle, Integer degreeYear, Integer quarterlyMonth) {
 		List<BenchmarkingRecord> benchmarkingRecordList = benchmarkingRecordService.selectList(manageCategory, checkCycle, degreeYear, quarterlyMonth, "达标");
 		if (benchmarkingRecordList.size() == 0) {
+			boolean flag = false;
 			List<PerformanceBenchmarkInfo> performanceBenchmarkInfoList = baseMapper.selectList(manageCategory, checkCycle, degreeYear, quarterlyMonth);
 			for (PerformanceBenchmarkInfo performanceBenchmarkInfo : performanceBenchmarkInfoList) {
 				if (null != performanceBenchmarkInfo.getCompleteValue() && null != performanceBenchmarkInfo.getScalingValue()) {
 					if (performanceBenchmarkInfo.getCompleteValue() >= performanceBenchmarkInfo.getScalingValue()) {
 						performanceBenchmarkInfo.setIsDb(1);
 						performanceBenchmarkInfo.setDbVal(performanceBenchmarkInfo.getCompleteValue() - performanceBenchmarkInfo.getScalingValue());
+						flag = true;
 					}
+				} else {
+					flag = false;
 				}
 			}
 			super.updateBatchById(performanceBenchmarkInfoList);
-			if (performanceBenchmarkInfoList.size() > 0) {
+			if (performanceBenchmarkInfoList.size() > 0 && flag) {
 				addRecord(manageCategory, checkCycle, degreeYear, quarterlyMonth, "达标");
 			}
 		}
@@ -384,16 +389,20 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 		List<BenchmarkingRecord> benchmarkingRecordList = benchmarkingRecordService.selectList(manageCategory, checkCycle, degreeYear, quarterlyMonth, "超标");
 		if (benchmarkingRecordList.size() == 0) {
 			List<PerformanceBenchmarkInfo> performanceBenchmarkInfoList = baseMapper.selectList(manageCategory, checkCycle, degreeYear, quarterlyMonth);
+			AtomicBoolean flag = new AtomicBoolean(false);
 			performanceBenchmarkInfoList.stream().filter(p -> p.getIsBg().equals(1)).findFirst().ifPresent(performanceBenchmarkInfo -> performanceBenchmarkInfoList.forEach(PerformanceBenchmarkInfo -> {
 				if (null != PerformanceBenchmarkInfo.getCompleteValue() && null != performanceBenchmarkInfo.getScalingValue()) {
 					if (PerformanceBenchmarkInfo.getCompleteValue() > performanceBenchmarkInfo.getScalingValue()) {
 						PerformanceBenchmarkInfo.setIsCb(1);
 						PerformanceBenchmarkInfo.setCbVal(PerformanceBenchmarkInfo.getCompleteValue() - performanceBenchmarkInfo.getScalingValue());
+						flag.set(true);
 					}
+				} else {
+					flag.set(false);
 				}
 			}));
 			super.updateBatchById(performanceBenchmarkInfoList);
-			if (performanceBenchmarkInfoList.size() > 0) {
+			if (performanceBenchmarkInfoList.size() > 0 && flag.get()) {
 				addRecord(manageCategory, checkCycle, degreeYear, quarterlyMonth, "超标");
 			}
 		}
@@ -411,7 +420,9 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 	 */
 	private Double yearIndexRecommendedValueB(double a, double b, double c) {
 		double B;
-		if (b == 0) {
+		if (b == -1) {
+			B = a;
+		} else if (b == 0) {
 			B = a + (a * 0.02);
 		} else {
 			B = (a / b) * c;

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

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