|
@@ -1,13 +1,21 @@
|
|
|
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.PerformanceBenchmarkInfo;
|
|
|
-import com.ims.eval.service.IPerformanceBenchmarkInfoService;
|
|
|
+import com.ims.eval.entity.*;
|
|
|
+import com.ims.eval.service.*;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* @author hlf
|
|
|
* @date 2024/3/28 14:07
|
|
@@ -16,14 +24,90 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
public class PerformanceBenchmarkInfoServiceImpl extends ServiceImpl<PerformanceBenchmarkInfoMapper, PerformanceBenchmarkInfo> implements IPerformanceBenchmarkInfoService {
|
|
|
|
|
|
+ @Resource
|
|
|
+ private IEvaluateRuleService evaluateRuleService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IEvaluateRuleInfoService evaluateRuleInfoService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IIndicatorDictionaryService indicatorDictionaryService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IOrganizationEvaluationInfoService organizationEvaluationInfoService;
|
|
|
+
|
|
|
@Override
|
|
|
- public IPage<PerformanceBenchmarkInfo> listPage(Integer pageNum, Integer pageSize, Integer year, Integer quarter, Integer monthly, String manageCategory) {
|
|
|
+ public IPage<PerformanceBenchmarkInfo> listPage(Integer pageNum, Integer pageSize, String toolCategory, String manageCategory, String checkCycle) {
|
|
|
if (null == pageNum || null == pageSize) {
|
|
|
throw new RuntimeException("分页参数为空");
|
|
|
}
|
|
|
//构造分页构造器
|
|
|
Page<PerformanceBenchmarkInfo> page = new Page<>(pageNum, pageSize);
|
|
|
- return baseMapper.selectListPage(page, year, quarter, monthly, manageCategory);
|
|
|
+ //寻标
|
|
|
+ xb("", checkCycle, manageCategory);
|
|
|
+ return baseMapper.selectListPage(page, manageCategory, checkCycle);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 寻标
|
|
|
+ */
|
|
|
+ private void xb(String year, 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ super.saveBatch(performanceBenchmarkInfoList);
|
|
|
}
|
|
|
|
|
|
}
|