|
@@ -0,0 +1,98 @@
|
|
|
+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.JtNdjhqdService;
|
|
|
+import com.rongwei.bsentity.domain.*;
|
|
|
+import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
|
+import com.rongwei.rwcommon.base.BaseDo;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
+import java.util.LinkedList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import static com.rongwei.bscommon.sys.utils.JXKHConstant.DefaultSource.THREE_SOURCE;
|
|
|
+import static com.rongwei.bscommon.sys.utils.JXKHUtils.CALCULATE_Y3;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * ScoreCalculationServiceNum1 class
|
|
|
+ *
|
|
|
+ * @author XH
|
|
|
+ * @date 2024/12/09
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class ScoreCalculationServiceNum22 implements ScoreCalculationService {
|
|
|
+ @Autowired
|
|
|
+ private JtNdjhqdService jtNdjhqdService;
|
|
|
+ @Autowired
|
|
|
+ private JtFjglxmService jtFjglxmService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 年度计划为空扣3分。
|
|
|
+ * 计划完成时间不为空,实际完成时间为空扣1分/项。
|
|
|
+ * 若存在“是否属于新兴业务项目”=是(分级管理-项目清单),技术类型(是否涵盖技术标准化)字段没有“是”的数据,扣1分。
|
|
|
+ *
|
|
|
+ * @param khbmList
|
|
|
+ * @param jtKhxmList
|
|
|
+ * @param jtGsjtbsj
|
|
|
+ * @param jkAssessmentRules
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public JtYcpfhzDetail soreCalculation(JtYcpfhz jtYcpfhz, List<JtXmkh> khbmList, List<JtKhxm> jtKhxmList, JtGsjtbsj jtGsjtbsj,
|
|
|
+ JkAssessmentRules jkAssessmentRules,
|
|
|
+ SysUserVo currentUser) {
|
|
|
+ // 考核得分
|
|
|
+ BigDecimal finalScore = jkAssessmentRules.getWeight();
|
|
|
+ // 扣分细则
|
|
|
+ String errorMsg = "";
|
|
|
+
|
|
|
+ //年度计划为空扣3分。
|
|
|
+ if (ObjectUtil.isEmpty(jtGsjtbsj.getNdjh())) {
|
|
|
+ finalScore = finalScore.subtract(THREE_SOURCE);
|
|
|
+ errorMsg = "公司级:年度计划为空";
|
|
|
+ return assemblyYcpfhzDetail(jtYcpfhz, jkAssessmentRules, finalScore, errorMsg, currentUser);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<JtNdjhqd> list = jtNdjhqdService.list(new LambdaQueryWrapper<JtNdjhqd>()
|
|
|
+ .eq(JtNdjhqd::getDeleted, "0")
|
|
|
+ .in(JtNdjhqd::getMainid, jtGsjtbsj.getId()));
|
|
|
+ //计划完成时间不为空,实际完成时间为空扣1分/项。
|
|
|
+ List<String> jhmcList = new LinkedList<>();
|
|
|
+ for (JtNdjhqd jtNdjhqd : list) {
|
|
|
+ if (jhmcList.contains(jtNdjhqd.getJhmc())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ jhmcList.add(jtNdjhqd.getJhmc());
|
|
|
+ if (ObjectUtil.isNotEmpty(jtNdjhqd.getJhwcsj()) && ObjectUtil.isEmpty(jtNdjhqd.getSjwcsj())) {
|
|
|
+ finalScore = finalScore.subtract(BigDecimal.ONE);
|
|
|
+ errorMsg = "公司级:" + jtNdjhqd.getJhmc() + "的计划完成时间不为空,实际完成时间为空";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //若存在“是否属于新兴业务项目”=是(分级管理-项目清单),技术类型(是否涵盖技术标准化)字段没有“是”的数据,扣1分。
|
|
|
+ List<JtFjglxm> list2 = jtFjglxmService.list(new LambdaQueryWrapper<JtFjglxm>()
|
|
|
+ .eq(BaseDo::getDeleted, "0")
|
|
|
+ .eq(JtFjglxm::getSfxxyw, "0")
|
|
|
+ .in(JtFjglxm::getMainid, khbmList.stream().map(JtXmkh::getId)));
|
|
|
+ if (!list2.isEmpty()){
|
|
|
+ long count = list.stream().filter(item -> ObjectUtil.isNotEmpty(item.getJhlxsfhgjsbzh()) && item.getJhlxsfhgjsbzh().equals("0")).count();
|
|
|
+ if (count == 0) {
|
|
|
+ finalScore = finalScore.subtract(BigDecimal.ONE);
|
|
|
+ errorMsg = "公司级:存在“是否属于新兴业务项目”=是(分级管理-项目清单),技术类型(是否涵盖技术标准化)字段没有“是”的数据";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (finalScore.compareTo(BigDecimal.ZERO) < 0) {
|
|
|
+ finalScore = BigDecimal.ZERO;
|
|
|
+ }
|
|
|
+ if (finalScore.compareTo(jkAssessmentRules.getWeight()) > 0) {
|
|
|
+ finalScore = jkAssessmentRules.getWeight();
|
|
|
+ }
|
|
|
+ return assemblyYcpfhzDetail(jtYcpfhz, jkAssessmentRules, finalScore, errorMsg, currentUser);
|
|
|
+ }
|
|
|
+}
|