|
@@ -3,10 +3,13 @@ package com.ims.eval.service.impl;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ims.common.utils.FormulaUtils;
|
|
|
import com.ims.common.utils.StringUtils;
|
|
|
+import com.ims.eval.cache.CacheContext;
|
|
|
import com.ims.eval.config.CustomException;
|
|
|
import com.ims.eval.dao.CalculateIndicatorItemInfoMapper;
|
|
|
import com.ims.eval.entity.*;
|
|
|
import com.ims.eval.dao.OrganizationEvaluationInfoMapper;
|
|
|
+import com.ims.eval.entity.dto.request.AddEvaluationInfoDTO;
|
|
|
+import com.ims.eval.entity.dto.response.IndicatorResDTO;
|
|
|
import com.ims.eval.entity.dto.response.OrganizationEvaluationInfoResDTO;
|
|
|
import com.ims.eval.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -61,6 +64,20 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
|
@Autowired
|
|
|
private CalculateIndicatorItemInfoMapper calculateIndicatorItemInfoMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IIndicatorService indicatorService;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IOrganizationEvaluationService organizationEvaluationService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IOrganizationEvaluationRuleService organizationEvaluationRuleService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public Map finishValueList(String organizationEvaluationId, String dept, HttpServletRequest request) {
|
|
|
|
|
@@ -336,7 +353,24 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
|
|
|
|
@Override
|
|
|
public List<Map> getEvaluationIndicatorList(String organizationEvaluationId, String binSection, String binStage, HttpServletRequest request) {
|
|
|
- List<Map> indicatorMap = baseMapper.selectEvaluationIndicatorList(organizationEvaluationId,binSection,binStage);
|
|
|
+ //判断是否是(重点专项和管理事项)
|
|
|
+ List<Map> indicatorMap = new ArrayList<>();
|
|
|
+ if("ZDZX".equals(CacheContext.bseIdObject.get(binStage).getStageCode()) || "GLSX".equals(CacheContext.bseIdObject.get(binStage).getStageCode())){
|
|
|
+
|
|
|
+ List<Indicator> indicatorList = indicatorService.listAll("","","",binSection,binStage,"","");
|
|
|
+ if(null != indicatorList && indicatorList.size()>0){
|
|
|
+ for (Indicator i : indicatorList){
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("id",i.getId());
|
|
|
+ map.put("indicator_name",i.getIndicatorName());
|
|
|
+ indicatorMap.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }else {
|
|
|
+ indicatorMap = baseMapper.selectEvaluationIndicatorList(organizationEvaluationId,binSection,binStage);
|
|
|
+ }
|
|
|
+
|
|
|
return indicatorMap;
|
|
|
}
|
|
|
|
|
@@ -352,6 +386,38 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
|
Map<String, List<OrganizationEvaluationInfoResDTO>> groupedData = infoResDTOList.stream()
|
|
|
.collect(Collectors.groupingBy(OrganizationEvaluationInfoResDTO::getOrganizationId));
|
|
|
List<Map> mapList = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
+ //设置数据标题
|
|
|
+ //将子指标分组
|
|
|
+ Map<String, List<IndicatorDictionary>> groupedChildCode = dictionaryList.stream()
|
|
|
+ .collect(Collectors.groupingBy(d -> d.getChildCode() + "," + d.getChildName()));
|
|
|
+
|
|
|
+ if (titlemark) {
|
|
|
+ Map title = new LinkedHashMap();
|
|
|
+ for (Map.Entry<String, List<IndicatorDictionary>> childCodeEntry : groupedChildCode.entrySet()) {
|
|
|
+
|
|
|
+
|
|
|
+ List<Map> titleArray = new ArrayList<>();
|
|
|
+ for (IndicatorDictionary d : childCodeEntry.getValue()) {
|
|
|
+ Map titlemap = new LinkedHashMap();
|
|
|
+ if (!d.getIsShow()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ titlemap.put("key", d.getOptionName());//名称
|
|
|
+ titlemap.put("code",d.getChildCode()+"_"+d.getOptionCode());//名称
|
|
|
+ titleArray.add(titlemap);
|
|
|
+
|
|
|
+ }
|
|
|
+ title.put(childCodeEntry.getKey().split(",")[1], titleArray);
|
|
|
+
|
|
|
+ }
|
|
|
+ titlemark = false;
|
|
|
+ data.put("title", title);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //获取行数据
|
|
|
//遍历按照公司分组后的数据
|
|
|
for (Map.Entry<String, List<OrganizationEvaluationInfoResDTO>> entry : groupedData.entrySet()) {
|
|
|
|
|
@@ -365,34 +431,6 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
|
(oldValue, newValue) -> oldValue)); // 解决键重复的情况
|
|
|
boolean mark = true;//标记给公司名赋值
|
|
|
|
|
|
- //将子指标分组
|
|
|
- Map<String, List<IndicatorDictionary>> groupedChildCode = dictionaryList.stream()
|
|
|
- .collect(Collectors.groupingBy(d -> d.getChildCode() + "," + d.getChildName()));
|
|
|
-
|
|
|
-
|
|
|
- if (titlemark) {
|
|
|
- Map title = new LinkedHashMap();
|
|
|
- for (Map.Entry<String, List<IndicatorDictionary>> childCodeEntry : groupedChildCode.entrySet()) {
|
|
|
-
|
|
|
-
|
|
|
- List<Map> titleArray = new ArrayList<>();
|
|
|
- for (IndicatorDictionary d : childCodeEntry.getValue()) {
|
|
|
- Map titlemap = new LinkedHashMap();
|
|
|
- if (!d.getIsShow()) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- titlemap.put("key", d.getOptionName());//名称
|
|
|
- titlemap.put("code",d.getChildCode()+"_"+d.getOptionCode());//名称
|
|
|
- titleArray.add(titlemap);
|
|
|
-
|
|
|
- }
|
|
|
- title.put(childCodeEntry.getKey().split(",")[1], titleArray);
|
|
|
-
|
|
|
- }
|
|
|
- titlemark = false;
|
|
|
- data.put("title", title);
|
|
|
- }
|
|
|
-
|
|
|
for (IndicatorDictionary d : dictionaryList) {
|
|
|
if (!d.getIsShow()) {
|
|
|
continue;
|
|
@@ -631,7 +669,7 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
|
Map<String, Object> dataMap = new LinkedHashMap<>();
|
|
|
|
|
|
// 遍历每一列数据
|
|
|
- for (int j = 1; j < totalColumns; j++) {
|
|
|
+ for (int j = 2; j < totalColumns; j++) {
|
|
|
Cell headerCell = headerRow.getCell(j);
|
|
|
Cell cell = row.getCell(j);
|
|
|
|
|
@@ -730,6 +768,70 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public boolean addEvaluationInfo(AddEvaluationInfoDTO addEvaluationInfoDTO) {
|
|
|
+ //1.获取考评id(获取此考评记录)
|
|
|
+ String organizationEvaluationId = addEvaluationInfoDTO.getOrganizationEvaluationId();
|
|
|
+
|
|
|
+ if (StringUtils.isEmpty(organizationEvaluationId)) {
|
|
|
+ throw new CustomException("保存失败");
|
|
|
+ }
|
|
|
+ OrganizationEvaluation organizationEvaluation = organizationEvaluationService.getById(organizationEvaluationId);
|
|
|
+
|
|
|
+ if (null == organizationEvaluation) {
|
|
|
+ throw new CustomException("保存失败");
|
|
|
+ }
|
|
|
+ organizationEvaluation.getCheckCycle();
|
|
|
+
|
|
|
+ //2.获取组织id 和所属板块(判断该板块下是否有此组织的考核)
|
|
|
+ String organizationType = organizationEvaluation.getOrganizationType();//考评类型 DWKP
|
|
|
+ String checkCycle = organizationEvaluation.getCheckCycle();//考评周期-月度、季度
|
|
|
+ String year = organizationEvaluation.getYear();//年份
|
|
|
+
|
|
|
+ //3.查询当前对应的考评权重(需要考评的单位)
|
|
|
+ List<OrganizationEvaluationRule> evaluationRules = organizationEvaluationRuleService.getOrganizationEvaluationRuleByYearAndCycle(organizationType, checkCycle, year, addEvaluationInfoDTO.getOrganizationId());
|
|
|
+ if (null == evaluationRules || evaluationRules.size() <= 0) {
|
|
|
+ throw new CustomException("当前组织没有参与考评");
|
|
|
+ }
|
|
|
+ OrganizationEvaluationRule evaluationRule = evaluationRules.get(0);
|
|
|
+
|
|
|
+ //4.获取指标信息
|
|
|
+ List<String> indicatorIds = Arrays.asList(addEvaluationInfoDTO.getIndicatorId().split(","));
|
|
|
+ List<IndicatorResDTO> dictionaryList = indicatorService.listByIds(indicatorIds);
|
|
|
+ Map<String, List<IndicatorResDTO>> groupedChildCode = dictionaryList.stream()
|
|
|
+ .collect(Collectors.groupingBy(d -> d.getChildCode() + "," + d.getChildName()));
|
|
|
+ Map<String, Object> optionMap = addEvaluationInfoDTO.getOptionMap();
|
|
|
+
|
|
|
+ //5.保存指标
|
|
|
+ for (Map.Entry<String, List<IndicatorResDTO>> childCodeEntry : groupedChildCode.entrySet()) {
|
|
|
+
|
|
|
+ for (IndicatorResDTO d : childCodeEntry.getValue()) {
|
|
|
+ OrganizationEvaluationInfo info = new OrganizationEvaluationInfo();
|
|
|
+ info.setOrganizationEvaluationId(addEvaluationInfoDTO.getOrganizationEvaluationId());
|
|
|
+ info.setOrganizationEvaluationRuleId(evaluationRule.getId());
|
|
|
+ info.setIndicatorId(addEvaluationInfoDTO.getIndicatorId());
|
|
|
+ info.setIndicatorDictionaryId(d.getId());
|
|
|
+ info.setOptionCode(d.getOptionCode());
|
|
|
+ info.setIsQuantified(d.getIsQuantified());
|
|
|
+ if (null != optionMap.get(d.getChildCode()+"_"+d.getOptionCode())) {
|
|
|
+ String value = String.valueOf(optionMap.get(d.getOptionCode()));
|
|
|
+ info.setNonQuantifiedValue(value);
|
|
|
+ if (d.getIsQuantified2()) {
|
|
|
+ info.setQuantifiedValue(Double.valueOf(value));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ info.setChildCode(d.getChildCode());
|
|
|
+ info.setDeptId(d.getDeptId());
|
|
|
+ info.setCreateTime(new Date());
|
|
|
+ this.saveOrUpdate(info);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
//todo 后续添加需要计算的指标项
|
|
|
public boolean calculateIdicatorItem(List<OrganizationEvaluationInfo> organizationEvaluationInfos){
|
|
|
|