Преглед изворни кода

业绩对标管理功能开发

hlf пре 8 месеци
родитељ
комит
a12396bf27

+ 90 - 5
ims-service/ims-eval/src/main/java/com/ims/eval/controller/PerformanceBenchmarkingManageController.java

@@ -1,19 +1,25 @@
 package com.ims.eval.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.ims.eval.config.CustomException;
 import com.ims.eval.entity.PerformanceBenchmarkInfo;
 import com.ims.eval.entity.dto.result.R;
-import com.ims.eval.service.*;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestParam;
+import com.ims.eval.service.IPerformanceBenchmarkInfoService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 
 /**
+ * 业绩对标管理
+ *
  * @author hlf
  * @date 2024/3/21 15:58
- * 文件说明:业绩对标管理
+ * 文件说明:
  */
+@Slf4j
+@RestController
+@RequestMapping("//evaluation-performance-benchmarking")
 public class PerformanceBenchmarkingManageController {
 
 	@Resource
@@ -35,9 +41,88 @@ public class PerformanceBenchmarkingManageController {
 		@RequestParam(value = "pageSize") Integer pageSize,
 		@RequestParam(value = "toolCategory") String toolCategory,
 		@RequestParam(value = "manageCategory") String manageCategory,
-		@RequestParam(value = "checkCycle", required = false) String checkCycle) {
+		@RequestParam(value = "checkCycle") String checkCycle) {
 		IPage<PerformanceBenchmarkInfo> list = performanceBenchmarkInfoService.listPage(pageNum, pageSize, toolCategory, manageCategory, checkCycle);
 		return R.ok().data(list);
 	}
 
+	/**
+	 * 立标
+	 *
+	 * @param manageCategory 经营类别(火电、水电、新能源(风电、光伏)、煤电、海外、综合)
+	 * @param checkCycle     周期(NDKP、JDKP、YDKP)
+	 * @return 结果
+	 */
+	@PostMapping(value = "/lb")
+	public R lb(
+		@RequestParam(value = "manageCategory") String manageCategory,
+		@RequestParam(value = "checkCycle") String checkCycle) {
+		performanceBenchmarkInfoService.setRecommendedValue(manageCategory, checkCycle);
+		return R.ok();
+	}
+
+	/**
+	 * 标杆
+	 *
+	 * @param manageCategory 经营类别(火电、水电、新能源(风电、光伏)、煤电、海外、综合)
+	 * @param checkCycle     周期(NDKP、JDKP、YDKP)
+	 * @return 结果
+	 */
+	@PostMapping(value = "/bg")
+	public R bg(
+		@RequestParam(value = "manageCategory") String manageCategory,
+		@RequestParam(value = "checkCycle") String checkCycle) {
+		performanceBenchmarkInfoService.bg(manageCategory, checkCycle);
+		return R.ok();
+	}
+
+	/**
+	 * 达标
+	 *
+	 * @param manageCategory 经营类别(火电、水电、新能源(风电、光伏)、煤电、海外、综合)
+	 * @param checkCycle     周期(NDKP、JDKP、YDKP)
+	 * @return 结果
+	 */
+	@PostMapping(value = "/db")
+	public R db(
+		@RequestParam(value = "manageCategory") String manageCategory,
+		@RequestParam(value = "checkCycle") String checkCycle) {
+		performanceBenchmarkInfoService.db(manageCategory, checkCycle);
+		return R.ok();
+	}
+
+	/**
+	 * 超标
+	 *
+	 * @param manageCategory 经营类别(火电、水电、新能源(风电、光伏)、煤电、海外、综合)
+	 * @param checkCycle     周期(NDKP、JDKP、YDKP)
+	 * @return 结果
+	 */
+	@PostMapping(value = "/cb")
+	public R cb(
+		@RequestParam(value = "manageCategory") String manageCategory,
+		@RequestParam(value = "checkCycle") String checkCycle) {
+		performanceBenchmarkInfoService.cb(manageCategory, checkCycle);
+		return R.ok();
+	}
+
+	/**
+	 * 修改业绩对标管理信息
+	 *
+	 * @param performanceBenchmarkInfo 业绩对标管理实体
+	 * @return 结果
+	 */
+	@PostMapping(value = "/update")
+	public R update(@RequestBody PerformanceBenchmarkInfo performanceBenchmarkInfo) {
+		try {
+			boolean b = performanceBenchmarkInfoService.updateById(performanceBenchmarkInfo);
+			if (b) {
+				return R.ok().data(b);
+			} else {
+				return R.error("修改失败!");
+			}
+		} catch (CustomException e) {
+			return R.customError(e.getMessage()).data("失败!");
+		}
+	}
 }

+ 6 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/dao/PerformanceBenchmarkInfoMapper.java

@@ -13,6 +13,11 @@ import org.apache.ibatis.annotations.Param;
  */
 public interface PerformanceBenchmarkInfoMapper extends BaseMapper<PerformanceBenchmarkInfo> {
 
-	IPage<PerformanceBenchmarkInfo> selectListPage(Page<PerformanceBenchmarkInfo> page, @Param("manageCategory") String manageCategory, @Param("checkCycle") String checkCycle);
+	IPage<PerformanceBenchmarkInfo> selectListPage(Page<PerformanceBenchmarkInfo> page,
+												   @Param("manageCategory") String manageCategory,
+												   @Param("checkCycle") String checkCycle,
+												   @Param("isBg") Integer isBg,
+												   @Param("isDb") Integer isDb,
+												   @Param("isCb") Integer isCb);
 
 }

+ 26 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/entity/PerformanceBenchmarkInfo.java

@@ -88,6 +88,31 @@ public class PerformanceBenchmarkInfo extends Model {
 	/**
 	 * 是否标杆(1是 0否)
 	 */
-	private String isPole;
+	private Integer isBg;
+
+	/**
+	 * 标杆值
+	 */
+	private Double bgVal;
+
+	/**
+	 * 是否达标(1是 0否)
+	 */
+	private Integer isDb;
+
+	/**
+	 * 达标值
+	 */
+	private Double dbVal;
+
+	/**
+	 * 是否超标(1是 0否)
+	 */
+	private Integer isCb;
+
+	/**
+	 * 超标值
+	 */
+	private Double cbVal;
 
 }

+ 7 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/IPerformanceBenchmarkInfoService.java

@@ -13,4 +13,11 @@ public interface IPerformanceBenchmarkInfoService extends IService<PerformanceBe
 
 	IPage<PerformanceBenchmarkInfo> listPage(Integer pageNum, Integer pageSize, String toolCategory, String manageCategory, String checkCycle);
 
+	void setRecommendedValue(String manageCategory, String checkCycle);
+
+	void bg(String manageCategory, String checkCycle);
+
+	void db(String manageCategory, String checkCycle);
+
+	void cb(String manageCategory, String checkCycle);
 }

+ 240 - 52
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/PerformanceBenchmarkInfoServiceImpl.java

@@ -14,7 +14,10 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @author hlf
@@ -43,64 +46,64 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 		}
 		//构造分页构造器
 		Page<PerformanceBenchmarkInfo> page = new Page<>(pageNum, pageSize);
-		//寻标
-		xb("", checkCycle, manageCategory);
-		return baseMapper.selectListPage(page, manageCategory, checkCycle);
+		int isBg = 0;
+		int isDb = 0;
+		int isCb = 0;
+		if ("寻标".equals(toolCategory)) {
+			xb(checkCycle, manageCategory);
+		} else if ("标杆".equals(toolCategory)) {
+			isBg = 1;
+		} else if ("达标".equals(toolCategory)) {
+			isDb = 2;
+		} else if ("超标".equals(toolCategory)) {
+			isCb = 3;
+		}
+		return baseMapper.selectListPage(page, manageCategory, checkCycle, isBg, isDb, isCb);
 	}
 
 	/**
 	 * 寻标
 	 */
-	private void xb(String year, String checkCycle, String manageCategory) {
+	private void xb(String checkCycle, String manageCategory) {
 		List<PerformanceBenchmarkInfo> performanceBenchmarkInfoList = new ArrayList<>();
-		EvaluateRule evaluateRule = evaluateRuleService.getEvaluateRuleListByYear(year, checkCycle, manageCategory);
-		List<EvaluateRuleInfo> evaluateRuleInfoList = evaluateRuleInfoService.getEvaluateRuleInfoByEvaluateRuleId(evaluateRule.getId());
-		for (EvaluateRuleInfo evaluateRuleInfo : evaluateRuleInfoList) {
-			List<IndicatorDictionary> indicatorDictionaryList = indicatorDictionaryService.getIndicatorDictionaryList(evaluateRuleInfo.getIndicatorId());
-			if (indicatorDictionaryList.size() > 0) {
-				//计划值
-				IndicatorDictionary jhz = indicatorDictionaryList.stream().filter(p -> !p.getOptionCode().equals("WCZ")).findFirst().orElse(null);
-				//实际完成值
-				IndicatorDictionary wcz = indicatorDictionaryList.stream().filter(p -> p.getOptionCode().equals("WCZ")).findFirst().orElse(null);
-				if (jhz != null && wcz != null) {
-					List<OrganizationEvaluationInfo> jhzList = organizationEvaluationInfoService.getOrganizationEvaluationInfoListByIndicatorDictionaryId(jhz.getId());
-					List<OrganizationEvaluationInfo> wczList = organizationEvaluationInfoService.getOrganizationEvaluationInfoListByIndicatorDictionaryId(wcz.getId());
-					if (jhzList.size() == wczList.size()) {
-						for (int i = 0; i < wczList.size(); i++) {
-							OrganizationEvaluationInfo jhzObj = jhzList.get(i);
-							OrganizationEvaluationInfo wczObj = wczList.get(i);
-							PerformanceBenchmarkInfo performanceBenchmarkInfo = new PerformanceBenchmarkInfo();
-							performanceBenchmarkInfo.setId(Convert.toStr(IdUtil.getSnowflake(1, 1).nextId()));
-							performanceBenchmarkInfo.setCheckCycle(wczObj.getCheckCycle());
-							performanceBenchmarkInfo.setDegreeYear(Integer.valueOf(wczObj.getDegreeYear()));
-							performanceBenchmarkInfo.setQuarterlyMonth(Integer.valueOf(wczObj.getQuarterlyMonth()));
-							performanceBenchmarkInfo.setManageCategory(manageCategory);
-							performanceBenchmarkInfo.setCompanyId(wczObj.getOrganizationId());
-							performanceBenchmarkInfo.setCompanyName(wczObj.getCompanyName());
-							performanceBenchmarkInfo.setCompanyShort(wczObj.getCompanyShort());
-							performanceBenchmarkInfo.setInstallCapacity(wczObj.getInstallCapacity());
-							performanceBenchmarkInfo.setIndexName(evaluateRuleInfo.getDes());
-							performanceBenchmarkInfo.setPlannedValue(jhzObj.getQuantifiedValue());
-							performanceBenchmarkInfo.setCompleteValue(wczObj.getQuantifiedValue());
-							QueryWrapper<PerformanceBenchmarkInfo> qw = new QueryWrapper<>();
-							if (StringUtils.isNotEmpty(performanceBenchmarkInfo.getCheckCycle())) {
-								qw.lambda().eq(PerformanceBenchmarkInfo::getCheckCycle, performanceBenchmarkInfo.getCheckCycle());
-							}
-							if (null != performanceBenchmarkInfo.getDegreeYear()) {
-								qw.lambda().eq(PerformanceBenchmarkInfo::getDegreeYear, performanceBenchmarkInfo.getDegreeYear());
-							}
-							if (null != performanceBenchmarkInfo.getQuarterlyMonth()) {
-								qw.lambda().eq(PerformanceBenchmarkInfo::getQuarterlyMonth, performanceBenchmarkInfo.getQuarterlyMonth());
-							}
-							if (StringUtils.isNotEmpty(performanceBenchmarkInfo.getManageCategory())) {
-								qw.lambda().eq(PerformanceBenchmarkInfo::getManageCategory, performanceBenchmarkInfo.getManageCategory());
-							}
-							if (StringUtils.isNotEmpty(performanceBenchmarkInfo.getCompanyId())) {
-								qw.lambda().eq(PerformanceBenchmarkInfo::getCompanyId, performanceBenchmarkInfo.getCompanyId());
-							}
-							PerformanceBenchmarkInfo obj = baseMapper.selectOne(qw);
-							if (null == obj) {
-								performanceBenchmarkInfoList.add(performanceBenchmarkInfo);
+		EvaluateRule evaluateRule = evaluateRuleService.getEvaluateRuleListByYear("", checkCycle, manageCategory);
+		if (null != evaluateRule) {
+			List<EvaluateRuleInfo> evaluateRuleInfoList = evaluateRuleInfoService.getEvaluateRuleInfoByEvaluateRuleId(evaluateRule.getId());
+			for (EvaluateRuleInfo evaluateRuleInfo : evaluateRuleInfoList) {
+				List<IndicatorDictionary> indicatorDictionaryList = indicatorDictionaryService.getIndicatorDictionaryList(evaluateRuleInfo.getIndicatorId());
+				if (indicatorDictionaryList.size() > 0) {
+					//计划值
+					IndicatorDictionary jhz = indicatorDictionaryList.stream().filter(p -> !p.getOptionCode().equals("WCZ")).findFirst().orElse(null);
+					//实际完成值
+					IndicatorDictionary wcz = indicatorDictionaryList.stream().filter(p -> p.getOptionCode().equals("WCZ")).findFirst().orElse(null);
+					if (jhz != null && wcz != null) {
+						List<OrganizationEvaluationInfo> jhzList = organizationEvaluationInfoService.getOrganizationEvaluationInfoListByIndicatorDictionaryId(jhz.getId());
+						List<OrganizationEvaluationInfo> wczList = organizationEvaluationInfoService.getOrganizationEvaluationInfoListByIndicatorDictionaryId(wcz.getId());
+						if (jhzList.size() == wczList.size()) {
+							for (int i = 0; i < wczList.size(); i++) {
+								OrganizationEvaluationInfo jhzObj = jhzList.get(i);
+								OrganizationEvaluationInfo wczObj = wczList.get(i);
+								PerformanceBenchmarkInfo performanceBenchmarkInfo = new PerformanceBenchmarkInfo();
+								performanceBenchmarkInfo.setId(Convert.toStr(IdUtil.getSnowflake(1, 1).nextId()));
+								performanceBenchmarkInfo.setCheckCycle(wczObj.getCheckCycle());
+								performanceBenchmarkInfo.setDegreeYear(Integer.valueOf(wczObj.getDegreeYear()));
+								if (!"NDKP".equals(checkCycle)) {
+									performanceBenchmarkInfo.setQuarterlyMonth(Integer.valueOf(wczObj.getQuarterlyMonth()));
+								}
+								performanceBenchmarkInfo.setManageCategory(manageCategory);
+								performanceBenchmarkInfo.setCompanyId(wczObj.getOrganizationId());
+								performanceBenchmarkInfo.setCompanyName(wczObj.getCompanyName());
+								performanceBenchmarkInfo.setCompanyShort(wczObj.getCompanyShort());
+								performanceBenchmarkInfo.setInstallCapacity(wczObj.getInstallCapacity());
+								performanceBenchmarkInfo.setIndexName(evaluateRuleInfo.getIndicatorName());
+								performanceBenchmarkInfo.setPlannedValue(jhzObj.getQuantifiedValue());
+								performanceBenchmarkInfo.setCompleteValue(wczObj.getQuantifiedValue());
+								performanceBenchmarkInfo.setIsBg(0);
+								performanceBenchmarkInfo.setIsDb(0);
+								performanceBenchmarkInfo.setIsCb(0);
+								if (uniquenessCheck(performanceBenchmarkInfo)) {
+									performanceBenchmarkInfoList.add(performanceBenchmarkInfo);
+								}
 							}
 						}
 					}
@@ -110,4 +113,189 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
 		super.saveBatch(performanceBenchmarkInfoList);
 	}
 
+	@Override
+	public void setRecommendedValue(String manageCategory, String checkCycle) {
+		QueryWrapper<PerformanceBenchmarkInfo> qw = new QueryWrapper<>();
+		if (StringUtils.isNotEmpty(manageCategory)) {
+			qw.lambda().eq(PerformanceBenchmarkInfo::getManageCategory, manageCategory);
+		}
+		if (StringUtils.isNotEmpty(checkCycle)) {
+			qw.lambda().eq(PerformanceBenchmarkInfo::getCheckCycle, checkCycle);
+		}
+		if ("NDKP".equals(checkCycle)) {
+			Map<Integer, Map<String, List<PerformanceBenchmarkInfo>>> grouped = baseMapper.selectList(qw).stream()
+				.collect(Collectors.groupingBy(
+					PerformanceBenchmarkInfo::getDegreeYear,
+					Collectors.groupingBy(
+						PerformanceBenchmarkInfo::getIndexName
+					)
+				));
+			List<PerformanceBenchmarkInfo> updateList = new ArrayList<>();
+			grouped.forEach((degreeYear, indexNameMap) -> {
+				indexNameMap.forEach((indexName, performanceBenchmarkInfoList) -> {
+					double completeValueSum = performanceBenchmarkInfoList.stream().mapToDouble(PerformanceBenchmarkInfo::getCompleteValue).sum();
+					double installCapacitySum = performanceBenchmarkInfoList.stream().mapToDouble(PerformanceBenchmarkInfo::getInstallCapacity).sum();
+					performanceBenchmarkInfoList.forEach(PerformanceBenchmarkInfo -> {
+						PerformanceBenchmarkInfo.setRecommendedValue(yearIndexRecommendedValueA(completeValueSum, installCapacitySum, PerformanceBenchmarkInfo.getInstallCapacity()));
+						updateList.add(PerformanceBenchmarkInfo);
+					});
+				});
+			});
+			super.updateBatchById(updateList);
+		} else if ("JDKP".equals(checkCycle) || "YDKP".equals(checkCycle)) {
+			Map<Integer, Map<Integer, Map<String, List<PerformanceBenchmarkInfo>>>> grouped = baseMapper.selectList(qw).stream()
+				.collect(Collectors.groupingBy(
+					PerformanceBenchmarkInfo::getDegreeYear,
+					Collectors.groupingBy(
+						PerformanceBenchmarkInfo::getQuarterlyMonth,
+						Collectors.groupingBy(
+							PerformanceBenchmarkInfo::getIndexName,
+							Collectors.toList()
+						)
+					)
+				));
+			List<PerformanceBenchmarkInfo> updateList = new ArrayList<>();
+			grouped.forEach((degreeYear, quarterlyMonthMap) -> {
+				quarterlyMonthMap.forEach((quarterlyMonth, indexNameMap) -> {
+					indexNameMap.forEach((indexName, performanceBenchmarkInfoList) -> {
+						performanceBenchmarkInfoList.forEach(PerformanceBenchmarkInfo -> {
+
+						});
+					});
+				});
+			});
+		}
+	}
+
+	@Override
+	public void bg(String manageCategory, String checkCycle) {
+		QueryWrapper<PerformanceBenchmarkInfo> qw = new QueryWrapper<>();
+		if (StringUtils.isNotEmpty(manageCategory)) {
+			qw.lambda().eq(PerformanceBenchmarkInfo::getManageCategory, manageCategory);
+		}
+		if (StringUtils.isNotEmpty(checkCycle)) {
+			qw.lambda().eq(PerformanceBenchmarkInfo::getCheckCycle, checkCycle);
+		}
+		Map<Integer, Map<String, List<PerformanceBenchmarkInfo>>> grouped = baseMapper.selectList(qw).stream()
+			.collect(Collectors.groupingBy(
+				PerformanceBenchmarkInfo::getDegreeYear,
+				Collectors.groupingBy(
+					PerformanceBenchmarkInfo::getIndexName
+				)
+			));
+		grouped.forEach((degreeYear, indexNameMap) -> {
+			indexNameMap.forEach((indexName, performanceBenchmarkInfoList) -> {
+				performanceBenchmarkInfoList.forEach(PerformanceBenchmarkInfo -> {
+					PerformanceBenchmarkInfo.setBgVal(PerformanceBenchmarkInfo.getInstallCapacity() / PerformanceBenchmarkInfo.getCompleteValue());
+				});
+				performanceBenchmarkInfoList.sort(Comparator.comparingDouble(PerformanceBenchmarkInfo::getBgVal).reversed());
+				if (!performanceBenchmarkInfoList.isEmpty() && performanceBenchmarkInfoList.get(0).getBgVal() != 0) {
+					performanceBenchmarkInfoList.get(0).setIsBg(1);
+				}
+				super.updateBatchById(performanceBenchmarkInfoList);
+			});
+		});
+	}
+
+	@Override
+	public void db(String manageCategory, String checkCycle) {
+		QueryWrapper<PerformanceBenchmarkInfo> qw = new QueryWrapper<>();
+		if (StringUtils.isNotEmpty(manageCategory)) {
+			qw.lambda().eq(PerformanceBenchmarkInfo::getManageCategory, manageCategory);
+		}
+		if (StringUtils.isNotEmpty(checkCycle)) {
+			qw.lambda().eq(PerformanceBenchmarkInfo::getCheckCycle, checkCycle);
+		}
+		List<PerformanceBenchmarkInfo> performanceBenchmarkInfoList = baseMapper.selectList(qw);
+		for (PerformanceBenchmarkInfo performanceBenchmarkInfo : performanceBenchmarkInfoList) {
+			if (performanceBenchmarkInfo.getCompleteValue() >= performanceBenchmarkInfo.getScalingValue()) {
+				performanceBenchmarkInfo.setIsDb(1);
+				performanceBenchmarkInfo.setDbVal(performanceBenchmarkInfo.getCompleteValue() - performanceBenchmarkInfo.getScalingValue());
+			}
+		}
+		super.updateBatchById(performanceBenchmarkInfoList);
+	}
+
+	@Override
+	public void cb(String manageCategory, String checkCycle) {
+		QueryWrapper<PerformanceBenchmarkInfo> qw = new QueryWrapper<>();
+		if (StringUtils.isNotEmpty(manageCategory)) {
+			qw.lambda().eq(PerformanceBenchmarkInfo::getManageCategory, manageCategory);
+		}
+		if (StringUtils.isNotEmpty(checkCycle)) {
+			qw.lambda().eq(PerformanceBenchmarkInfo::getCheckCycle, checkCycle);
+		}
+		Map<Integer, Map<String, List<PerformanceBenchmarkInfo>>> grouped = baseMapper.selectList(qw).stream()
+			.collect(Collectors.groupingBy(
+				PerformanceBenchmarkInfo::getDegreeYear,
+				Collectors.groupingBy(
+					PerformanceBenchmarkInfo::getIndexName
+				)
+			));
+		grouped.forEach((degreeYear, indexNameMap) -> {
+			indexNameMap.forEach((indexName, performanceBenchmarkInfoList) -> {
+				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());
+					}
+				}));
+				super.updateBatchById(performanceBenchmarkInfoList);
+			});
+		});
+	}
+
+	/**
+	 * 年度指标推荐值A
+	 */
+	private Double yearIndexRecommendedValueA(double a, double b, double c) {
+		return (a / b) * c;
+	}
+
+	/**
+	 * 年度指标推荐值B
+	 */
+	private Double yearIndexRecommendedValueB(double a, double b, double c) {
+		double B;
+		if (b == 0) {
+			B = a * 0.02;
+		} else {
+			B = (a / b) * c;
+		}
+		return B;
+	}
+
+	/**
+	 * 季/月度指标推荐值
+	 */
+	private Double quarterlyMonthIndexRecommendedValue(double a, double b) {
+		return a * b;
+	}
+
+	private boolean uniquenessCheck(PerformanceBenchmarkInfo performanceBenchmarkInfo) {
+		QueryWrapper<PerformanceBenchmarkInfo> qw = new QueryWrapper<>();
+		if (StringUtils.isNotEmpty(performanceBenchmarkInfo.getCheckCycle())) {
+			qw.lambda().eq(PerformanceBenchmarkInfo::getCheckCycle, performanceBenchmarkInfo.getCheckCycle());
+		}
+		if (null != performanceBenchmarkInfo.getDegreeYear()) {
+			qw.lambda().eq(PerformanceBenchmarkInfo::getDegreeYear, performanceBenchmarkInfo.getDegreeYear());
+		}
+		if (null != performanceBenchmarkInfo.getQuarterlyMonth()) {
+			qw.lambda().eq(PerformanceBenchmarkInfo::getQuarterlyMonth, performanceBenchmarkInfo.getQuarterlyMonth());
+		}
+		if (StringUtils.isNotEmpty(performanceBenchmarkInfo.getManageCategory())) {
+			qw.lambda().eq(PerformanceBenchmarkInfo::getManageCategory, performanceBenchmarkInfo.getManageCategory());
+		}
+		if (StringUtils.isNotEmpty(performanceBenchmarkInfo.getCompanyId())) {
+			qw.lambda().eq(PerformanceBenchmarkInfo::getCompanyId, performanceBenchmarkInfo.getCompanyId());
+		}
+		if (null != performanceBenchmarkInfo.getPlannedValue()) {
+			qw.lambda().eq(PerformanceBenchmarkInfo::getPlannedValue, performanceBenchmarkInfo.getPlannedValue());
+		}
+		if (null != performanceBenchmarkInfo.getCompleteValue()) {
+			qw.lambda().eq(PerformanceBenchmarkInfo::getCompleteValue, performanceBenchmarkInfo.getCompleteValue());
+		}
+		List<PerformanceBenchmarkInfo> objList = baseMapper.selectList(qw);
+		return objList.size() == 0;
+	}
 }

+ 19 - 18
ims-service/ims-eval/src/main/resources/mappers/EvaluateRuleInfoMapper.xml

@@ -4,23 +4,24 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.ims.eval.entity.EvaluateRuleInfo">
-        <id column="id" property="id" />
-        <result column="evaluate_rule_id" property="evaluateRuleId" />
-        <result column="indicator_id" property="indicatorId" />
-        <result column="des" property="des" />
-        <result column="create_time" property="createTime" />
-        <result column="create_by" property="createBy" />
-        <result column="update_time" property="updateTime" />
-        <result column="update_by" property="updateBy" />
-        <result column="order_num" property="orderNum" />
-        <result column="min_score" property="minScore" />
-        <result column="max_score" property="maxScore" />
-        <result column="standard_score" property="standardScore" />
+        <id column="id" property="id"/>
+        <result column="evaluate_rule_id" property="evaluateRuleId"/>
+        <result column="indicator_id" property="indicatorId"/>
+        <result column="des" property="des"/>
+        <result column="create_time" property="createTime"/>
+        <result column="create_by" property="createBy"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="update_by" property="updateBy"/>
+        <result column="order_num" property="orderNum"/>
+        <result column="min_score" property="minScore"/>
+        <result column="max_score" property="maxScore"/>
+        <result column="standard_score" property="standardScore"/>
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, evaluate_rule_id, indicator_id, des, create_time, create_by, update_time, update_by, order_num, min_score, max_score, standard_score
+        id
+        , evaluate_rule_id, indicator_id, des, create_time, create_by, update_time, update_by, order_num, min_score, max_score, standard_score
     </sql>
 
     <select id="selectListAll" resultType="com.ims.eval.entity.EvaluateRuleInfo">
@@ -34,12 +35,12 @@
         LEFT JOIN evaluate_rule r ON ri.evaluate_rule_id = r.ID
         LEFT JOIN indicator i on ri.indicator_id = i.id
         <where>
-            and  delete_time is  null
+            and delete_time is null
             <if test="id !=null and id !=''">
                 AND ri.id = #{id}
             </if>
             <if test="des !=null and des !=''">
-                AND ri.des like   CONCAT('%',#{des},'%')
+                AND ri.des like CONCAT('%',#{des},'%')
             </if>
 
             <if test="indicatorId !=null and indicatorId !=''">
@@ -47,7 +48,7 @@
             </if>
 
             <if test="indicatorName !=null and indicatorName !=''">
-                AND i.indicator_name  like   CONCAT('%',#{indicatorName},'%')
+                AND i.indicator_name like CONCAT('%',#{indicatorName},'%')
             </if>
 
             <if test="evaluateRuleId !=null and evaluateRuleId !=''">
@@ -55,7 +56,6 @@
             </if>
 
 
-
         </where>
 
         order by ri.order_num asc
@@ -85,7 +85,8 @@
     </select>
 
     <select id="getEvaluateRuleInfoByEvaluateRuleId" resultType="com.ims.eval.entity.EvaluateRuleInfo">
-        select * from evaluate_rule_info eri
+        select eri.*, i.indicator_name indicatorName
+        from evaluate_rule_info eri
         left join indicator i on i.id = eri.indicator_id
         where eri.evaluate_rule_id = #{evaluateRuleId} and i.is_quantified = '是'
     </select>

+ 1 - 1
ims-service/ims-eval/src/main/resources/mappers/EvaluateRuleMapper.xml

@@ -131,7 +131,7 @@
             <if test="checkCycle != null and checkCycle != ''">
                 AND check_cycle = #{checkCycle}
             </if>
-            <if test="des != null and des != ''">
+            <if test="manageCategory != null and manageCategory != ''">
                 AND des like CONCAT('%',#{manageCategory},'%')
             </if>
         </where>

+ 7 - 1
ims-service/ims-eval/src/main/resources/mappers/IndicatorDicatonaryMapper.xml

@@ -22,7 +22,13 @@
 
     <select id="getIndicatorDictionaryList" resultType="com.ims.eval.entity.IndicatorDictionary">
         select * from indicator_dictionary
-        where indicator_id = #{indicatorId} and is_show = 't' and is_quantified = 't' and option_name not like CONCAT('%','差值','%') and option_name not like CONCAT('%','得分','%')
+        where indicator_id = #{indicatorId}
+          and is_show = 't'
+          and is_quantified = 't'
+          and (option_name = '完成值'
+          or option_name = '计划值'
+          or option_name = '对标值'
+          or option_name = '目标值')
     </select>
 
 

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

@@ -18,12 +18,36 @@
         <result column="complete_value" property="completeValue"/>
         <result column="recommended_value" property="recommendedValue"/>
         <result column="scaling_value" property="scalingValue"/>
-        <result column="is_pole" property="isPole"/>
+        <result column="is_bg" property="isBg"/>
+        <result column="bg_val" property="bgVal"/>
+        <result column="is_db" property="isDb"/>
+        <result column="db_val" property="dbVal"/>
+        <result column="is_cb" property="isCb"/>
+        <result column="cb_val" property="cbVal"/>
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="selectPerformanceBenchmarkInfoVo">
-        select id, check_cycle, degree_year, quarterly_month, manage_category, company_id, company_name, company_short, install_capacity, index_name, planned_value, complete_value, recommended_value, scaling_value, is_pole
+        select id,
+               check_cycle,
+               degree_year,
+               quarterly_month,
+               manage_category,
+               company_id,
+               company_name,
+               company_short,
+               install_capacity,
+               index_name,
+               planned_value,
+               complete_value,
+               recommended_value,
+               scaling_value,
+               is_bg,
+               bg_val,
+               is_db,
+               db_val,
+               is_cb,
+               cb_val
         from performance_benchmark_info
     </sql>
 
@@ -36,8 +60,16 @@
             <if test="checkCycle != null and checkCycle != ''">
                 AND check_cycle = #{checkCycle}
             </if>
+            <if test="isBg == 1">
+                AND is_bg = 1 order by bg_val desc
+            </if>
+            <if test="isDb == 2">
+                AND is_db = 1 AND is_cb = 1 order by cb_val, db_val desc
+            </if>
+            <if test="isCb == 3">
+                AND is_cb = 1 order by cb_val desc
+            </if>
         </where>
     </select>
 
-
 </mapper>