Kaynağa Gözat

feature 代码提交

xiahan 7 ay önce
ebeveyn
işleme
c5dcf1f976

+ 11 - 1
jsglkh-common/src/main/java/com/rongwei/bscommon/sys/strategy/scoreCalculation/ScoreCalculationServiceNum27.java

@@ -67,7 +67,7 @@ public class ScoreCalculationServiceNum27 implements ScoreCalculationService {
         //二级单位下属单位数量
         Integer ssdwfysl = jtGsjtbsj.getSsdwfysl();
         //覆盖率=本年度考核三级单位数量/二级单位下属单位数量(巡查计划中所属单位/分院数量) 结果取小数点后一位。
-        BigDecimal fgl = new BigDecimal(planCount).divide(new BigDecimal(ssdwfysl), 1, RoundingMode.HALF_UP);
+        BigDecimal fgl = calculateApprovalRate(ssdwfysl, planCount);
 
         //计划被巡查单位数量与所属单位/分院数量对比,少一个或者没有对应的巡查计划时间扣2分。
         long noPlanDateCount = list.stream().filter(item -> ObjectUtil.isEmpty(item.getJhkzsj())).count();
@@ -106,4 +106,14 @@ public class ScoreCalculationServiceNum27 implements ScoreCalculationService {
         }
         return assemblyYcpfhzDetail(jtYcpfhz, jkAssessmentRules, finalScore, errorMsg, currentUser);
     }
+
+    public BigDecimal calculateApprovalRate(Integer denominator, Integer numerator) {
+        if (denominator == null || denominator == 0) {
+            return BigDecimal.ZERO;
+        }
+        if (numerator == null || numerator == 0) {
+            return BigDecimal.ZERO;
+        }
+        return BigDecimal.valueOf(numerator).divide(BigDecimal.valueOf(denominator), 6, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(3, RoundingMode.HALF_UP);
+    }
 }

+ 11 - 2
jsglkh-common/src/main/java/com/rongwei/bscommon/sys/strategy/scoreCalculation/ScoreCalculationServiceNum28.java

@@ -11,7 +11,6 @@ import org.springframework.stereotype.Service;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.List;
-import java.util.stream.Collectors;
 
 import static com.rongwei.bscommon.sys.utils.JXKHUtils.CALCULATE_Y3;
 
@@ -62,7 +61,7 @@ public class ScoreCalculationServiceNum28 implements ScoreCalculationService {
         //计划巡查数量:巡查清单的项目数量。
         long planCount = list.size();
         //计划执行率=已巡查项目数量/计划巡查数量 结果取小数点后一位。
-        BigDecimal planExecutionRate = new BigDecimal(checkedCount).divide(new BigDecimal(planCount), 1, RoundingMode.HALF_UP);
+        BigDecimal planExecutionRate = calculateApprovalRate((int) planCount, (int) checkedCount);
         if (planExecutionRate.compareTo(new BigDecimal("0.9")) >= 0) {
             //不扣分
         } else if (planExecutionRate.compareTo(new BigDecimal("0.6")) <= 0) {
@@ -79,4 +78,14 @@ public class ScoreCalculationServiceNum28 implements ScoreCalculationService {
         }
         return assemblyYcpfhzDetail(jtYcpfhz, jkAssessmentRules, finalScore, errorMsg, currentUser);
     }
+
+    public BigDecimal calculateApprovalRate(int denominator, int numerator) {
+        if (denominator == 0) {
+            return BigDecimal.ZERO;
+        }
+        if (numerator == 0) {
+            return BigDecimal.ZERO;
+        }
+        return BigDecimal.valueOf(numerator).divide(BigDecimal.valueOf(denominator), 6, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(3, RoundingMode.HALF_UP);
+    }
 }

+ 10 - 2
jsglkh-common/src/main/java/com/rongwei/bscommon/sys/strategy/scoreCalculation/ScoreCalculationServiceNum31.java

@@ -49,7 +49,7 @@ public class ScoreCalculationServiceNum31 implements ScoreCalculationService {
         //二级单位下属单位数量
         Integer ssdwfysl = jtGsjtbsj.getSsdwfysl();
         //覆盖率=本年度考核三级单位数量/二级单位下属单位数量(巡查计划中所属单位/分院数量) 结果取小数点后一位。
-        BigDecimal fgl = new BigDecimal(bndkhsjdwsl).divide(new BigDecimal(ssdwfysl), 1, RoundingMode.HALF_UP);
+        BigDecimal fgl = calculateApprovalRate(ssdwfysl,bndkhsjdwsl);
         if (fgl.compareTo(new BigDecimal("0.9")) >= 0) {
             //不扣分
             errorMsg = "公司级:覆盖率≥90%";
@@ -71,5 +71,13 @@ public class ScoreCalculationServiceNum31 implements ScoreCalculationService {
         }
         return assemblyYcpfhzDetail(jtYcpfhz, jkAssessmentRules, finalScore, errorMsg, currentUser);
     }
-
+    public BigDecimal calculateApprovalRate(Integer denominator, Integer numerator) {
+        if (denominator == null || denominator == 0) {
+            return BigDecimal.ZERO;
+        }
+        if (numerator == null || numerator == 0) {
+            return BigDecimal.ZERO;
+        }
+        return BigDecimal.valueOf(numerator).divide(BigDecimal.valueOf(denominator), 6, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(3, RoundingMode.HALF_UP);
+    }
 }