|
@@ -2,11 +2,9 @@ package com.ims.eval.service.impl;
|
|
|
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.ims.common.utils.StringUtils;
|
|
|
import com.ims.eval.dao.PerformanceBenchmarkInfoMapper;
|
|
|
import com.ims.eval.entity.*;
|
|
|
import com.ims.eval.service.*;
|
|
@@ -16,8 +14,6 @@ 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
|
|
@@ -28,6 +24,9 @@ import java.util.stream.Collectors;
|
|
|
public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<PerformanceBenchmarkInfoMapper, PerformanceBenchmarkInfo> implements IPerformanceBenchmarkInfoService {
|
|
|
|
|
|
@Resource
|
|
|
+ private IBenchmarkingRecordService benchmarkingRecordService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
private IEvaluateRuleService evaluateRuleService;
|
|
|
|
|
|
@Resource
|
|
@@ -40,68 +39,79 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
|
|
|
private IOrganizationEvaluationInfoService organizationEvaluationInfoService;
|
|
|
|
|
|
@Override
|
|
|
- public IPage<PerformanceBenchmarkInfo> listPage(Integer pageNum, Integer pageSize, String toolCategory, String manageCategory, String checkCycle) {
|
|
|
+ public IPage<PerformanceBenchmarkInfo> listPage(Integer pageNum, Integer pageSize, String toolCategory, String manageCategory, String checkCycle, Integer degreeYear, Integer quarterlyMonth) {
|
|
|
if (null == pageNum || null == pageSize) {
|
|
|
throw new RuntimeException("分页参数为空");
|
|
|
}
|
|
|
- //构造分页构造器
|
|
|
- Page<PerformanceBenchmarkInfo> page = new Page<>(pageNum, pageSize);
|
|
|
int isBg = 0;
|
|
|
int isDb = 0;
|
|
|
int isCb = 0;
|
|
|
if ("寻标".equals(toolCategory)) {
|
|
|
- xb(checkCycle, manageCategory);
|
|
|
+ xb(manageCategory, checkCycle, degreeYear, quarterlyMonth);
|
|
|
+ } else if ("立标".equals(toolCategory)) {
|
|
|
+ lb(manageCategory, checkCycle, degreeYear, quarterlyMonth);
|
|
|
} else if ("标杆".equals(toolCategory)) {
|
|
|
+ bg(manageCategory, checkCycle, degreeYear, quarterlyMonth);
|
|
|
isBg = 1;
|
|
|
} else if ("达标".equals(toolCategory)) {
|
|
|
+ db(manageCategory, checkCycle, degreeYear, quarterlyMonth);
|
|
|
isDb = 2;
|
|
|
} else if ("超标".equals(toolCategory)) {
|
|
|
+ cb(manageCategory, checkCycle, degreeYear, quarterlyMonth);
|
|
|
isCb = 3;
|
|
|
}
|
|
|
- return baseMapper.selectListPage(page, manageCategory, checkCycle, isBg, isDb, isCb);
|
|
|
+ //构造分页构造器
|
|
|
+ Page<PerformanceBenchmarkInfo> page = new Page<>(pageNum, pageSize);
|
|
|
+ return baseMapper.selectListPage(page, manageCategory, checkCycle, degreeYear, quarterlyMonth, isBg, isDb, isCb);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 寻标
|
|
|
+ *
|
|
|
+ * @param manageCategory 经营类别(火电、水电、新能源(风电、光伏)、煤电、海外、综合)
|
|
|
+ * @param checkCycle 周期(NDKP、JDKP、YDKP)
|
|
|
+ * @param degreeYear 年度
|
|
|
+ * @param quarterlyMonth 季/月度
|
|
|
*/
|
|
|
- private void xb(String checkCycle, String manageCategory) {
|
|
|
- List<PerformanceBenchmarkInfo> performanceBenchmarkInfoList = new ArrayList<>();
|
|
|
- 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)) {
|
|
|
+ private void xb(String manageCategory, String checkCycle, Integer degreeYear, Integer quarterlyMonth) {
|
|
|
+ List<BenchmarkingRecord> benchmarkingRecordList = benchmarkingRecordService.selectList(manageCategory, checkCycle, degreeYear, quarterlyMonth, "寻标");
|
|
|
+ if (benchmarkingRecordList.size() == 0) {
|
|
|
+ List<PerformanceBenchmarkInfo> performanceBenchmarkInfoList = new ArrayList<>();
|
|
|
+ EvaluateRule evaluateRule = evaluateRuleService.getEvaluateRuleListByYear(String.valueOf(degreeYear), 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(), String.valueOf(degreeYear), String.valueOf(quarterlyMonth));
|
|
|
+ List<OrganizationEvaluationInfo> wczList = organizationEvaluationInfoService.getOrganizationEvaluationInfoListByIndicatorDictionaryId(wcz.getId(), String.valueOf(degreeYear), String.valueOf(quarterlyMonth));
|
|
|
+ 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(degreeYear);
|
|
|
+ if (!"NDKP".equals(checkCycle)) {
|
|
|
+ performanceBenchmarkInfo.setQuarterlyMonth(quarterlyMonth);
|
|
|
+ }
|
|
|
+ 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);
|
|
|
performanceBenchmarkInfoList.add(performanceBenchmarkInfo);
|
|
|
}
|
|
|
}
|
|
@@ -109,140 +119,110 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ super.saveBatch(performanceBenchmarkInfoList);
|
|
|
+ addRecord(manageCategory, checkCycle, degreeYear, quarterlyMonth, "寻标");
|
|
|
}
|
|
|
- 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);
|
|
|
- });
|
|
|
+ /**
|
|
|
+ * 立标
|
|
|
+ *
|
|
|
+ * @param manageCategory 经营类别(火电、水电、新能源(风电、光伏)、煤电、海外、综合)
|
|
|
+ * @param checkCycle 周期(NDKP、JDKP、YDKP)
|
|
|
+ * @param degreeYear 年度
|
|
|
+ * @param quarterlyMonth 季/月度
|
|
|
+ */
|
|
|
+ private void lb(String manageCategory, String checkCycle, Integer degreeYear, Integer quarterlyMonth) {
|
|
|
+ List<BenchmarkingRecord> benchmarkingRecordList = benchmarkingRecordService.selectList(manageCategory, checkCycle, degreeYear, quarterlyMonth, "立标");
|
|
|
+ if (benchmarkingRecordList.size() == 0) {
|
|
|
+ if ("NDKP".equals(checkCycle)) {
|
|
|
+ List<PerformanceBenchmarkInfo> performanceBenchmarkInfoList = baseMapper.selectList(manageCategory, checkCycle, degreeYear, null);
|
|
|
+ double completeValueSum = performanceBenchmarkInfoList.stream().mapToDouble(PerformanceBenchmarkInfo::getCompleteValue).sum();
|
|
|
+ double installCapacitySum = performanceBenchmarkInfoList.stream().mapToDouble(PerformanceBenchmarkInfo::getInstallCapacity).sum();
|
|
|
+ List<PerformanceBenchmarkInfo> updateList = new ArrayList<>();
|
|
|
+ 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 -> {
|
|
|
+ super.updateBatchById(updateList);
|
|
|
+ } else if ("JDKP".equals(checkCycle) || "YDKP".equals(checkCycle)) {
|
|
|
+ List<PerformanceBenchmarkInfo> performanceBenchmarkInfoList = baseMapper.selectList(manageCategory, checkCycle, degreeYear, quarterlyMonth);
|
|
|
+ List<PerformanceBenchmarkInfo> updateList = new ArrayList<>();
|
|
|
|
|
|
- });
|
|
|
- });
|
|
|
- });
|
|
|
- });
|
|
|
+
|
|
|
+ }
|
|
|
+ addRecord(manageCategory, checkCycle, degreeYear, quarterlyMonth, "立标");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @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);
|
|
|
+ /**
|
|
|
+ * 标杆
|
|
|
+ *
|
|
|
+ * @param manageCategory 经营类别(火电、水电、新能源(风电、光伏)、煤电、海外、综合)
|
|
|
+ * @param checkCycle 周期(NDKP、JDKP、YDKP)
|
|
|
+ * @param degreeYear 年度
|
|
|
+ * @param quarterlyMonth 季/月度
|
|
|
+ */
|
|
|
+ private void bg(String manageCategory, String checkCycle, Integer degreeYear, Integer quarterlyMonth) {
|
|
|
+ List<BenchmarkingRecord> benchmarkingRecordList = benchmarkingRecordService.selectList(manageCategory, checkCycle, degreeYear, quarterlyMonth, "标杆");
|
|
|
+ if (benchmarkingRecordList.size() == 0) {
|
|
|
+ List<PerformanceBenchmarkInfo> performanceBenchmarkInfoList = baseMapper.selectList(manageCategory, checkCycle, degreeYear, quarterlyMonth);
|
|
|
+ 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);
|
|
|
+ addRecord(manageCategory, checkCycle, degreeYear, quarterlyMonth, "标杆");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- @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());
|
|
|
+ /**
|
|
|
+ * 达标
|
|
|
+ *
|
|
|
+ * @param manageCategory 经营类别(火电、水电、新能源(风电、光伏)、煤电、海外、综合)
|
|
|
+ * @param checkCycle 周期(NDKP、JDKP、YDKP)
|
|
|
+ * @param degreeYear 年度
|
|
|
+ * @param quarterlyMonth 季/月度
|
|
|
+ */
|
|
|
+ private void db(String manageCategory, String checkCycle, Integer degreeYear, Integer quarterlyMonth) {
|
|
|
+ List<BenchmarkingRecord> benchmarkingRecordList = benchmarkingRecordService.selectList(manageCategory, checkCycle, degreeYear, quarterlyMonth, "达标");
|
|
|
+ if (benchmarkingRecordList.size() == 0) {
|
|
|
+ List<PerformanceBenchmarkInfo> performanceBenchmarkInfoList = baseMapper.selectList(manageCategory, checkCycle, degreeYear, quarterlyMonth);
|
|
|
+ for (PerformanceBenchmarkInfo performanceBenchmarkInfo : performanceBenchmarkInfoList) {
|
|
|
+ if (performanceBenchmarkInfo.getCompleteValue() >= performanceBenchmarkInfo.getScalingValue()) {
|
|
|
+ performanceBenchmarkInfo.setIsDb(1);
|
|
|
+ performanceBenchmarkInfo.setDbVal(performanceBenchmarkInfo.getCompleteValue() - performanceBenchmarkInfo.getScalingValue());
|
|
|
+ }
|
|
|
}
|
|
|
+ super.updateBatchById(performanceBenchmarkInfoList);
|
|
|
+ addRecord(manageCategory, checkCycle, degreeYear, quarterlyMonth, "达标");
|
|
|
}
|
|
|
- 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);
|
|
|
+ /**
|
|
|
+ * 超标
|
|
|
+ *
|
|
|
+ * @param manageCategory 经营类别(火电、水电、新能源(风电、光伏)、煤电、海外、综合)
|
|
|
+ * @param checkCycle 周期(NDKP、JDKP、YDKP)
|
|
|
+ * @param degreeYear 年度
|
|
|
+ * @param quarterlyMonth 季/月度
|
|
|
+ */
|
|
|
+ private void cb(String manageCategory, String checkCycle, Integer degreeYear, Integer quarterlyMonth) {
|
|
|
+ List<BenchmarkingRecord> benchmarkingRecordList = benchmarkingRecordService.selectList(manageCategory, checkCycle, degreeYear, quarterlyMonth, "超标");
|
|
|
+ if (benchmarkingRecordList.size() == 0) {
|
|
|
+ List<PerformanceBenchmarkInfo> performanceBenchmarkInfoList = baseMapper.selectList(manageCategory, checkCycle, degreeYear, quarterlyMonth);
|
|
|
+ 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);
|
|
|
+ addRecord(manageCategory, checkCycle, degreeYear, quarterlyMonth, "超标");
|
|
|
}
|
|
|
- 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);
|
|
|
- });
|
|
|
- });
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -272,30 +252,14 @@ public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<Performance
|
|
|
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;
|
|
|
+ private void addRecord(String manageCategory, String checkCycle, Integer degreeYear, Integer quarterlyMonth, String toolCategory) {
|
|
|
+ BenchmarkingRecord benchmarkingRecord = new BenchmarkingRecord();
|
|
|
+ benchmarkingRecord.setId(Convert.toStr(IdUtil.getSnowflake(1, 1).nextId()));
|
|
|
+ benchmarkingRecord.setManageCategory(manageCategory);
|
|
|
+ benchmarkingRecord.setCheckCycle(checkCycle);
|
|
|
+ benchmarkingRecord.setDegreeYear(degreeYear);
|
|
|
+ benchmarkingRecord.setQuarterlyMonth(quarterlyMonth);
|
|
|
+ benchmarkingRecord.setTagType(toolCategory);
|
|
|
+ benchmarkingRecordService.save(benchmarkingRecord);
|
|
|
}
|
|
|
}
|