|
@@ -1,23 +1,27 @@
|
|
package com.ims.eval.service.impl;
|
|
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.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.ims.common.utils.StringUtils;
|
|
import com.ims.common.utils.StringUtils;
|
|
|
|
+import com.ims.eval.cache.CacheContext;
|
|
import com.ims.eval.config.CustomException;
|
|
import com.ims.eval.config.CustomException;
|
|
import com.ims.eval.dao.EvaluationRevisionMapper;
|
|
import com.ims.eval.dao.EvaluationRevisionMapper;
|
|
-import com.ims.eval.entity.DeptResponsibility;
|
|
|
|
|
|
+import com.ims.eval.dao.ResponsibilityIndicatorInfoMapper;
|
|
import com.ims.eval.entity.EvaluationRevision;
|
|
import com.ims.eval.entity.EvaluationRevision;
|
|
-import com.ims.eval.service.IDeptResponsibilityService;
|
|
|
|
|
|
+import com.ims.eval.entity.Indicator;
|
|
|
|
+import com.ims.eval.entity.dto.response.IndicatorResDTO;
|
|
|
|
+import com.ims.eval.entity.dto.response.ResponsibilityIndicatorInfoResDTO;
|
|
import com.ims.eval.service.IEvaluationRevisionService;
|
|
import com.ims.eval.service.IEvaluationRevisionService;
|
|
|
|
+import com.ims.eval.service.IIndicatorService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author hlf
|
|
* @author hlf
|
|
@@ -28,7 +32,10 @@ import java.util.List;
|
|
public class EvaluationRevisionServiceImpl extends ServiceImpl<EvaluationRevisionMapper, EvaluationRevision> implements IEvaluationRevisionService {
|
|
public class EvaluationRevisionServiceImpl extends ServiceImpl<EvaluationRevisionMapper, EvaluationRevision> implements IEvaluationRevisionService {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private IDeptResponsibilityService deptResponsibilityService;
|
|
|
|
|
|
+ private IIndicatorService indicatorService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private ResponsibilityIndicatorInfoMapper responsibilityIndicatorInfoMapper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public IPage<EvaluationRevision> listPage(Integer pageNum, Integer pageSize, String id, String responsibilityCode, String cycleUnit, List<String> checkCycle, String beginDate, String endDate, String stage, String createBy, String year, String month, String des) {
|
|
public IPage<EvaluationRevision> listPage(Integer pageNum, Integer pageSize, String id, String responsibilityCode, String cycleUnit, List<String> checkCycle, String beginDate, String endDate, String stage, String createBy, String year, String month, String des) {
|
|
@@ -91,56 +98,132 @@ public class EvaluationRevisionServiceImpl extends ServiceImpl<EvaluationRevisio
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public boolean save(String id) {
|
|
|
|
- DeptResponsibility deptResponsibility = deptResponsibilityService.getById(id);
|
|
|
|
- if (null != deptResponsibility) {
|
|
|
|
- EvaluationRevision evaluationRevision = new EvaluationRevision();
|
|
|
|
- evaluationRevision.setId(deptResponsibility.getId());
|
|
|
|
- String responsibilityCode = deptResponsibility.getResponsibilityCode();
|
|
|
|
- int index = responsibilityCode.indexOf("_");
|
|
|
|
- evaluationRevision.setResponsibilityCode("MBXD" + responsibilityCode.substring(index).toUpperCase());
|
|
|
|
- evaluationRevision.setOrganizationId(deptResponsibility.getOrganizationId());
|
|
|
|
- evaluationRevision.setOrganizationName(deptResponsibility.getOrganizationName());
|
|
|
|
- evaluationRevision.setOrganizationType(deptResponsibility.getOrganizationType());
|
|
|
|
- evaluationRevision.setCycleUnit(deptResponsibility.getCycleUnit());
|
|
|
|
- evaluationRevision.setCheckCycle(deptResponsibility.getCheckCycle());
|
|
|
|
- evaluationRevision.setYear(deptResponsibility.getYear());
|
|
|
|
- evaluationRevision.setMonth(deptResponsibility.getMonth());
|
|
|
|
- evaluationRevision.setOrganizationEvaluationRuleId(deptResponsibility.getOrganizationEvaluationRuleId());
|
|
|
|
- evaluationRevision.setBeginDate(deptResponsibility.getBeginDate());
|
|
|
|
- evaluationRevision.setEndDate(deptResponsibility.getEndDate());
|
|
|
|
- evaluationRevision.setStage("流程未启动");
|
|
|
|
- evaluationRevision.setDes(deptResponsibility.getDes());
|
|
|
|
- evaluationRevision.setCreateTime(new Date());
|
|
|
|
- evaluationRevision.setReviewPeople(deptResponsibility.getReviewPeople());
|
|
|
|
- evaluationRevision.setReviewPeopleTime(deptResponsibility.getReviewPeopleTime());
|
|
|
|
- evaluationRevision.setReviewOpinion(deptResponsibility.getReviewOpinion());
|
|
|
|
- evaluationRevision.setFinalReviewPeople(deptResponsibility.getFinalReviewPeople());
|
|
|
|
- evaluationRevision.setFinalReviewPeopleTime(deptResponsibility.getFinalReviewPeopleTime());
|
|
|
|
- evaluationRevision.setFinalReviewOpinion(deptResponsibility.getFinalReviewOpinion());
|
|
|
|
- evaluationRevision.setRemark(deptResponsibility.getRemark());
|
|
|
|
- evaluationRevision.setCreateOrgId(deptResponsibility.getCreateOrgId());
|
|
|
|
- evaluationRevision.setCreateOrgName(deptResponsibility.getCreateOrgName());
|
|
|
|
- evaluationRevision.setStandbyId(Convert.toStr(IdUtil.getSnowflake(1, 1).nextId()));
|
|
|
|
- return super.save(evaluationRevision);
|
|
|
|
- }
|
|
|
|
- return false;
|
|
|
|
|
|
+ public boolean removeByIds(List<String> ids) {
|
|
|
|
+ for (String id : ids) {
|
|
|
|
+ EvaluationRevision evaluationRevision = super.getById(id);
|
|
|
|
+ if ("流程未启动".equals(evaluationRevision.getStage())) {
|
|
|
|
+ baseMapper.deleteById(id);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public boolean editState(String id, String state, String instId) {
|
|
public boolean editState(String id, String state, String instId) {
|
|
- QueryWrapper<EvaluationRevision> qw = new QueryWrapper<>();
|
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
|
- qw.lambda().eq(EvaluationRevision::getStandbyId, id);
|
|
|
|
- }
|
|
|
|
- EvaluationRevision evaluationRevision = baseMapper.selectOne(qw);
|
|
|
|
|
|
+ EvaluationRevision evaluationRevision = baseMapper.selectById(id);
|
|
if (StringUtils.isNotEmpty(state)) {
|
|
if (StringUtils.isNotEmpty(state)) {
|
|
evaluationRevision.setStage(state);
|
|
evaluationRevision.setStage(state);
|
|
}
|
|
}
|
|
if (StringUtils.isNotEmpty(instId)) {
|
|
if (StringUtils.isNotEmpty(instId)) {
|
|
evaluationRevision.setInstId(instId);
|
|
evaluationRevision.setInstId(instId);
|
|
}
|
|
}
|
|
- boolean b = super.saveOrUpdate(evaluationRevision);
|
|
|
|
- return b;
|
|
|
|
|
|
+ return super.saveOrUpdate(evaluationRevision);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Map getResponsibilityIndicatorInfoList(String reviseId, String indicatorId, String organizationShortName, String binSection, String binStage, HttpServletRequest request) {
|
|
|
|
+ Map data = new HashMap();
|
|
|
|
+ //设置数据头
|
|
|
|
+ //获取指标名称
|
|
|
|
+ boolean titlemark = true;//标记生成标题
|
|
|
|
+ List<Map> indicatorMap = getResponsibilityIndicatorList(reviseId, binSection, binStage, request);
|
|
|
|
+ List<String> idList = indicatorMap.stream()
|
|
|
|
+ .map(map -> String.valueOf(map.get("id"))) // 提取每个Map中key为"id"的值,并转换成String
|
|
|
|
+ .collect(Collectors.toList()); // 将提取的值收集到List中
|
|
|
|
+ if (null == idList || idList.size() <= 0) {
|
|
|
|
+ //throw new CustomException("未查询到数据");
|
|
|
|
+ data.put("title", null);
|
|
|
|
+ return data;
|
|
|
|
+ }
|
|
|
|
+ List<IndicatorResDTO> indicatorResDTOS = indicatorService.getGroupChildCodeByIds(idList);
|
|
|
|
+ if (titlemark) {
|
|
|
|
+ // 遍历分组后的Map
|
|
|
|
+ Map title = new LinkedHashMap();//保存所有的指标名
|
|
|
|
+ for (IndicatorResDTO dto : indicatorResDTOS) {
|
|
|
|
+ List<Map> titleArray = new ArrayList<>();
|
|
|
|
+ // 处理每个分组中的元素
|
|
|
|
+ Map titlemap = new LinkedHashMap();
|
|
|
|
+ titlemap.put("childName", dto.getChildName());//子指标名
|
|
|
|
+ titlemap.put("key", dto.getDeptName());//名称
|
|
|
|
+ titlemap.put("code", dto.getChildCode() + "_" + dto.getOptionCode());//名称
|
|
|
|
+ titlemap.put("flag", dto.getIsQuantified());//是否量化
|
|
|
|
+ titleArray.add(titlemap);
|
|
|
|
+ title.put(dto.getChildName(), titleArray);
|
|
|
|
+ }
|
|
|
|
+ //状态标题头
|
|
|
|
+ Map deptstateMap = new LinkedHashMap();
|
|
|
|
+ List<Map> titlestateArray = new ArrayList<>();
|
|
|
|
+ deptstateMap.put("key", "填报状态");//名称
|
|
|
|
+ deptstateMap.put("code", "state");//名称
|
|
|
|
+ deptstateMap.put("flag", false);//是否编辑
|
|
|
|
+ titlestateArray.add(deptstateMap);
|
|
|
|
+ title.put("状态", titlestateArray);
|
|
|
|
+
|
|
|
|
+ data.put("title", title);
|
|
|
|
+ titlemark = false;
|
|
|
|
+ }
|
|
|
|
+ //获取数据
|
|
|
|
+ List<Map> datamapList = new ArrayList<>();
|
|
|
|
+ if (null != organizationShortName) {
|
|
|
|
+ organizationShortName = organizationShortName.trim();
|
|
|
|
+ }
|
|
|
|
+ if (null != organizationShortName) {
|
|
|
|
+ organizationShortName = organizationShortName.trim();
|
|
|
|
+ }
|
|
|
|
+ List<ResponsibilityIndicatorInfoResDTO> dataList = responsibilityIndicatorInfoMapper.getResponsibilityInfoList("", indicatorId, organizationShortName, binSection, binStage, reviseId);
|
|
|
|
+ Map<String, List<ResponsibilityIndicatorInfoResDTO>> groupeddataMap = dataList.stream().collect(Collectors.groupingBy(ResponsibilityIndicatorInfoResDTO::getOrganizationId)); // 根据organizationId进行分组
|
|
|
|
+ // 遍历分组后的Map
|
|
|
|
+ for (Map.Entry<String, List<ResponsibilityIndicatorInfoResDTO>> entry : groupeddataMap.entrySet()) {
|
|
|
|
+ List<ResponsibilityIndicatorInfoResDTO> groupedList = entry.getValue(); // 获取分组后的List
|
|
|
|
+ Map<String, ResponsibilityIndicatorInfoResDTO> resultMap = groupedList.stream()
|
|
|
|
+ .collect(Collectors.toMap(
|
|
|
|
+ dto -> dto.getChildCode() + "_" + dto.getOptionCode(),
|
|
|
|
+ dto -> dto,
|
|
|
|
+ (oldValue, newValue) -> oldValue)); // 解决键重复的情况
|
|
|
|
+ Map indicatormap = new HashMap();
|
|
|
|
+ // 进一步处理每个分组
|
|
|
|
+ for (IndicatorResDTO d : indicatorResDTOS) {
|
|
|
|
+ boolean mark = true;//标记给公司名赋值
|
|
|
|
+ if (mark) {
|
|
|
|
+ indicatormap.put("organizationShortName", resultMap.get(d.getChildCode() + "_" + d.getOptionCode()).getOrganizationShortName());//公司名
|
|
|
|
+ indicatormap.put("organizationId", resultMap.get(d.getChildCode() + "_" + d.getOptionCode()).getOrganizationId());//公司id
|
|
|
|
+ indicatormap.put("state", resultMap.get(d.getChildCode() + "_" + d.getOptionCode()).getState());
|
|
|
|
+ indicatormap.put("IS_LH_state", "3");
|
|
|
|
+ mark = false;
|
|
|
|
+ }
|
|
|
|
+ //指标属性
|
|
|
|
+ indicatormap.put(d.getChildCode() + "_" + d.getOptionCode(), null == resultMap.get(d.getChildCode() + "_" + d.getOptionCode()).getNonQuantifiedValue() ? "" : resultMap.get(d.getChildCode() + "_" + d.getOptionCode()).getNonQuantifiedValue());
|
|
|
|
+ //指标id
|
|
|
|
+ indicatormap.put("ID_" + d.getChildCode() + "_" + d.getOptionCode(), resultMap.get(d.getChildCode() + "_" + d.getOptionCode()).getId());
|
|
|
|
+ //是否量化
|
|
|
|
+ indicatormap.put("IS_LH_" + d.getChildCode() + "_" + d.getOptionCode(), resultMap.get(d.getChildCode() + "_" + d.getOptionCode()).getIsQuantified() ? "1" : "2");
|
|
|
|
+ }
|
|
|
|
+ datamapList.add(indicatormap);
|
|
|
|
+ }
|
|
|
|
+ data.put("value", datamapList);
|
|
|
|
+ return data;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private List<Map> getResponsibilityIndicatorList(String reviseId, String binSection, String binStage, HttpServletRequest request) {
|
|
|
|
+ //判断是否是(重点专项和管理事项)
|
|
|
|
+ List<Map> indicatorMap = new ArrayList<>();
|
|
|
|
+ if ("ZDZX".equals(CacheContext.bseIdObject.get(binStage).getStageCode()) || "KJCX".equals(CacheContext.bseIdObject.get(binStage).getStageCode())) {
|
|
|
|
+ EvaluationRevision dby = baseMapper.selectById(reviseId);
|
|
|
|
+ if (null == dby) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ List<Indicator> indicatorList = indicatorService.listAll("", "", "", binSection, binStage, "", "", dby.getCheckCycle());
|
|
|
|
+ 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 = responsibilityIndicatorInfoMapper.selectResponsibilityIndicatorList("", binSection, binStage, reviseId);
|
|
|
|
+ }
|
|
|
|
+ return indicatorMap;
|
|
}
|
|
}
|
|
}
|
|
}
|