|
@@ -2,6 +2,7 @@ package com.rongwei.bscommon.sys.strategy.scoreCalculation;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.rongwei.bscommon.sys.service.JtFjglxmService;
|
|
|
import com.rongwei.bscommon.sys.service.JtXcjhqdService;
|
|
|
import com.rongwei.bsentity.domain.*;
|
|
|
import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
@@ -12,6 +13,7 @@ import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import static com.rongwei.bscommon.sys.utils.JXKHConstant.DefaultSource.TWO_SOURCE;
|
|
|
import static com.rongwei.bscommon.sys.utils.JXKHUtils.CALCULATE_Y3;
|
|
|
|
|
|
|
|
@@ -25,6 +27,8 @@ import static com.rongwei.bscommon.sys.utils.JXKHUtils.CALCULATE_Y3;
|
|
|
public class ScoreCalculationServiceNum27 implements ScoreCalculationService {
|
|
|
@Autowired
|
|
|
private JtXcjhqdService jtXcjhqdService;
|
|
|
+ @Autowired
|
|
|
+ private JtFjglxmService jtFjglxmService;
|
|
|
|
|
|
/**
|
|
|
* ()计算规则
|
|
@@ -38,7 +42,7 @@ public class ScoreCalculationServiceNum27 implements ScoreCalculationService {
|
|
|
* 覆盖率≤60%,扣2分。
|
|
|
* 其他数值线性计算得分,得分取小数点后三位。
|
|
|
* 若项目符合“是否属于新兴业务项目”=是(分级管理-项目清单),巡查计划清单中不存在记录扣1分。
|
|
|
- *TODO: 未完成,待确认覆盖率和计划被巡查单位数量
|
|
|
+ *
|
|
|
* @param khbmList
|
|
|
* @param jtKhxmList
|
|
|
* @param jtGsjtbsj
|
|
@@ -53,25 +57,47 @@ public class ScoreCalculationServiceNum27 implements ScoreCalculationService {
|
|
|
BigDecimal finalScore = jkAssessmentRules.getWeight();
|
|
|
// 扣分细则
|
|
|
String errorMsg = "";
|
|
|
-
|
|
|
List<JtXcjhqd> list = jtXcjhqdService.list(new LambdaQueryWrapper<JtXcjhqd>()
|
|
|
.eq(JtXcjhqd::getDeleted, "0")
|
|
|
.in(JtXcjhqd::getMainid, khbmList.stream().map(JtXmkh::getId)));
|
|
|
- //已巡查项目数量:问题整改日期非空的项目数量。
|
|
|
- long checkedCount = list.stream().filter(info -> ObjectUtil.isNotEmpty(info.getWtzgrq())).count();
|
|
|
- //计划巡查数量:巡查清单的项目数量。
|
|
|
- long planCount = list.size();
|
|
|
- //计划执行率=已巡查项目数量/计划巡查数量 结果取小数点后一位。
|
|
|
- BigDecimal planExecutionRate = new BigDecimal(checkedCount).divide(new BigDecimal(planCount), 1, RoundingMode.HALF_UP);
|
|
|
- if (planExecutionRate.compareTo(new BigDecimal("0.9")) >= 0) {
|
|
|
+ //计划被巡查单位数量:巡查清单中被巡查单位的数量。
|
|
|
+ long count = list.stream().filter(item -> ObjectUtil.isNotEmpty(item.getBxcdw())).distinct().count();
|
|
|
+ Integer planCount = Math.toIntExact(count);
|
|
|
+ //二级单位下属单位数量
|
|
|
+ Integer ssdwfysl = jtGsjtbsj.getSsdwfysl();
|
|
|
+ //覆盖率=本年度考核三级单位数量/二级单位下属单位数量(巡查计划中所属单位/分院数量) 结果取小数点后一位。
|
|
|
+ BigDecimal fgl = new BigDecimal(planCount).divide(new BigDecimal(ssdwfysl), 1, RoundingMode.HALF_UP);
|
|
|
+
|
|
|
+ //计划被巡查单位数量与所属单位/分院数量对比,少一个或者没有对应的巡查计划时间扣2分。
|
|
|
+ long noPlanDateCount = list.stream().filter(item -> ObjectUtil.isEmpty(item.getJhkzsj())).count();
|
|
|
+ if (!planCount.equals(ssdwfysl) || noPlanDateCount > 0) {
|
|
|
+ finalScore = finalScore.subtract(TWO_SOURCE);
|
|
|
+ errorMsg = errorMsg + "公司级:计划被巡查单位数量与所属单位/分院数量对比,少一个或者没有对应的巡查计划时间";
|
|
|
+ return assemblyYcpfhzDetail(jtYcpfhz, jkAssessmentRules, finalScore, errorMsg, currentUser);
|
|
|
+ }
|
|
|
+
|
|
|
+ //覆盖率≥90%,不扣分。
|
|
|
+ if (fgl.compareTo(new BigDecimal("0.9")) >= 0) {
|
|
|
//不扣分
|
|
|
- } else if (planExecutionRate.compareTo(new BigDecimal("0.6")) <= 0) {
|
|
|
+ errorMsg = errorMsg + "公司级:覆盖率≥90%";
|
|
|
+ } else if (fgl.compareTo(new BigDecimal("0.6")) <= 0) {
|
|
|
//扣3分
|
|
|
- finalScore = finalScore.subtract(new BigDecimal(3));
|
|
|
- errorMsg = "公司级:计划执行率小于60%";
|
|
|
+ finalScore = finalScore.subtract(TWO_SOURCE);
|
|
|
+ errorMsg = errorMsg + "公司级:覆盖率≤60%";
|
|
|
} else {
|
|
|
//线性计算得分,得分取小数点后三位。
|
|
|
- finalScore = finalScore.subtract(CALCULATE_Y3(BigDecimal.valueOf(1), BigDecimal.valueOf(3), BigDecimal.valueOf(0.6), BigDecimal.ZERO, planExecutionRate));
|
|
|
+ finalScore = finalScore.subtract(CALCULATE_Y3(BigDecimal.valueOf(0.9), BigDecimal.valueOf(0), BigDecimal.valueOf(0.6), TWO_SOURCE, fgl));
|
|
|
+ errorMsg = errorMsg + "公司级:覆盖率>60%,<90%";
|
|
|
+ }
|
|
|
+
|
|
|
+ //若项目符合“是否属于新兴业务项目”=是(分级管理-项目清单),巡查计划清单中不存在记录扣1分。
|
|
|
+ int xxywxmCount = jtFjglxmService.count(new LambdaQueryWrapper<JtFjglxm>()
|
|
|
+ .eq(JtFjglxm::getDeleted, "0")
|
|
|
+ .eq(JtFjglxm::getSfxxyw, "0")
|
|
|
+ .in(JtFjglxm::getMainid, khbmList.stream().map(JtXmkh::getId)));
|
|
|
+ if (xxywxmCount > 0 && list.isEmpty()) {
|
|
|
+ finalScore = finalScore.subtract(BigDecimal.ONE);
|
|
|
+ errorMsg = errorMsg + "公司级:项目符合“是否属于新兴业务项目”=是(分级管理-项目清单),巡查计划清单中不存在记录";
|
|
|
}
|
|
|
|
|
|
if (finalScore.compareTo(BigDecimal.ZERO) < 0) {
|