|
@@ -1,27 +1,30 @@
|
|
|
package com.ims.eval.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.ims.common.utils.Constant;
|
|
|
+import com.ims.eval.cache.CacheContext;
|
|
|
import com.ims.eval.config.CustomException;
|
|
|
import com.ims.eval.dao.ResponsibilityIndicatorInfoMapper;
|
|
|
import com.ims.eval.entity.Indicator;
|
|
|
+import com.ims.eval.entity.OrganizationEvaluationInfo;
|
|
|
import com.ims.eval.entity.ResponsibilityIndicatorInfo;
|
|
|
import com.ims.eval.entity.dto.request.ResponsibilityIndicatorInfoUpdateDTO;
|
|
|
+import com.ims.eval.entity.dto.response.IndicatorResDTO;
|
|
|
import com.ims.eval.entity.dto.response.MyuserResDTO;
|
|
|
+import com.ims.eval.entity.dto.response.OrganizationEvaluationInfoResDTO;
|
|
|
import com.ims.eval.entity.dto.response.ResponsibilityIndicatorInfoResDTO;
|
|
|
import com.ims.eval.service.IIndicatorService;
|
|
|
import com.ims.eval.service.IResponsibilityIndicatorInfoService;
|
|
|
import com.ims.eval.service.IUserService;
|
|
|
+import com.ims.eval.util.MathCalculatorUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@@ -45,24 +48,24 @@ public class ResponsibilityIndicatorInfoServiceImpl extends ServiceImpl<Responsi
|
|
|
private IIndicatorService indicatorService;
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, List<ResponsibilityIndicatorInfoResDTO>> planValueList(List<String> deptResponsibilityIds, String dept, HttpServletRequest request) {
|
|
|
+ public Map<Object, List<ResponsibilityIndicatorInfoResDTO>> planValueList(List<String> deptResponsibilityIds, String dept, HttpServletRequest request) {
|
|
|
|
|
|
List<ResponsibilityIndicatorInfoResDTO> list = baseMapper.listByresponsibilityId(deptResponsibilityIds, dept, "ZRMB", "");
|
|
|
|
|
|
- Map<String, List<ResponsibilityIndicatorInfoResDTO>> map = list.stream().collect(Collectors.groupingBy(ResponsibilityIndicatorInfoResDTO::getIsQuantified));
|
|
|
- map.put("quantifiedList", map.remove("是"));
|
|
|
- map.put("nonQuantifiedList", map.remove("否"));
|
|
|
+ Map<Object, List<ResponsibilityIndicatorInfoResDTO>> map = list.stream().collect(Collectors.groupingBy(ResponsibilityIndicatorInfoResDTO::getIsQuantified));
|
|
|
+ map.put("quantifiedList", map.remove(true));
|
|
|
+ map.put("nonQuantifiedList", map.remove(false));
|
|
|
return map;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, List<ResponsibilityIndicatorInfoResDTO>> selectResponsibilityIndicatorInfoList(String deptResponsibilityId, String isQuantified, String dataState) {
|
|
|
+ public Map<Object, List<ResponsibilityIndicatorInfoResDTO>> selectResponsibilityIndicatorInfoList(String deptResponsibilityId, String isQuantified, String dataState) {
|
|
|
List<ResponsibilityIndicatorInfoResDTO> list = baseMapper.selectResponsibilityIndicatorInfoList(deptResponsibilityId, isQuantified, dataState);
|
|
|
- Map<String, List<ResponsibilityIndicatorInfoResDTO>> map = list.stream().collect(Collectors.groupingBy(ResponsibilityIndicatorInfoResDTO::getIsQuantified));
|
|
|
- map.put("quantifiedList", map.remove("是"));
|
|
|
- map.put("nonQuantifiedList", map.remove("否"));
|
|
|
+ Map<Object, List<ResponsibilityIndicatorInfoResDTO>> map = list.stream().collect(Collectors.groupingBy(ResponsibilityIndicatorInfoResDTO::getIsQuantified));
|
|
|
+ map.put("quantifiedList", map.remove(true));
|
|
|
+ map.put("nonQuantifiedList", map.remove(false));
|
|
|
return map;
|
|
|
}
|
|
|
|
|
@@ -176,16 +179,159 @@ public class ResponsibilityIndicatorInfoServiceImpl extends ServiceImpl<Responsi
|
|
|
|
|
|
@Override
|
|
|
public List<Map> getResponsibilityIndicatorList(String responsibilityId, String binSection, String binStage, HttpServletRequest request) {
|
|
|
- List<Map> list = baseMapper.selectResponsibilityIndicatorList(responsibilityId, binSection, binStage);
|
|
|
- return list;
|
|
|
+
|
|
|
+
|
|
|
+ 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.selectResponsibilityIndicatorList(responsibilityId, binSection, binStage);
|
|
|
+ }
|
|
|
+
|
|
|
+ return indicatorMap;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Map getResponsibilityInfoList(String responsibilityId, String indicatorId, String organizationShortName, String binSection, String binStage, HttpServletRequest request) {
|
|
|
+ Map data = new HashMap();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ boolean titlemark = true;
|
|
|
+
|
|
|
+ List<Map> indicatorMap = getResponsibilityIndicatorList(responsibilityId, binSection, binStage,request);
|
|
|
+
|
|
|
+ List<String> idList = indicatorMap.stream()
|
|
|
+ .map(map -> String.valueOf(map.get("id")))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if(null == idList || idList.size()<=0){
|
|
|
+ throw new CustomException("未查询导数据");
|
|
|
+ }
|
|
|
+ List<IndicatorResDTO> indicatorResDTOS = indicatorService.getGroupChildCodeByIds(idList);
|
|
|
+
|
|
|
+
|
|
|
+ Map<String, List<IndicatorResDTO>> groupedMap = indicatorResDTOS.stream()
|
|
|
+ .collect(Collectors.groupingBy(dto -> dto.getIndicatorId() + "," + dto.getIndicatorName()));
|
|
|
+
|
|
|
+ if (titlemark) {
|
|
|
+
|
|
|
+ Map title = new LinkedHashMap();
|
|
|
+ for (Map.Entry<String, List<IndicatorResDTO>> entry : groupedMap.entrySet()) {
|
|
|
+
|
|
|
+ List<IndicatorResDTO> groupedList = entry.getValue();
|
|
|
+ if(null == groupedList || groupedList.size()<=0){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map> titleArray = new ArrayList<>();
|
|
|
+ for (IndicatorResDTO dto : groupedList) {
|
|
|
+
|
|
|
+ Map titlemap = new LinkedHashMap();
|
|
|
+ titlemap.put("childName",dto.getChildName());
|
|
|
+ titlemap.put("key", dto.getOptionName());
|
|
|
+ titlemap.put("code",dto.getChildCode()+"_"+dto.getOptionCode());
|
|
|
+ titlemap.put("flag", dto.getIsQuantified());
|
|
|
+ titleArray.add(titlemap);
|
|
|
+ }
|
|
|
+ title.put(entry.getKey().split(",")[1], titleArray);
|
|
|
+ }
|
|
|
+
|
|
|
+ data.put("title",title);
|
|
|
+ titlemark = false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+ List<Map> datamapList = new ArrayList<>();
|
|
|
+ List<ResponsibilityIndicatorInfoResDTO> dataList = baseMapper.getResponsibilityInfoList(responsibilityId, indicatorId,organizationShortName, binSection, binStage);
|
|
|
+
|
|
|
+ Map<String, List<ResponsibilityIndicatorInfoResDTO>> groupeddataMap = dataList.stream().collect(Collectors.groupingBy(ResponsibilityIndicatorInfoResDTO::getOrganizationId));
|
|
|
|
|
|
- return null;
|
|
|
+
|
|
|
+ for (Map.Entry<String, List<ResponsibilityIndicatorInfoResDTO>> entry : groupeddataMap.entrySet()) {
|
|
|
+ List<ResponsibilityIndicatorInfoResDTO> groupedList = entry.getValue();
|
|
|
+
|
|
|
+
|
|
|
+ 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());
|
|
|
+ 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());
|
|
|
+
|
|
|
+ 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;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean updateResponsibilityIndicatorInfo(List<JSONObject> jsonObjects) {
|
|
|
+
|
|
|
+ for (JSONObject json :jsonObjects){
|
|
|
+
|
|
|
+ Map<String,Object > idMap = new HashMap();
|
|
|
+ Map valueMap = new HashMap();
|
|
|
+ for (String key : json.keySet()) {
|
|
|
+ Object value = json.get(key);
|
|
|
+ if(key.startsWith("ID_")){
|
|
|
+ idMap.put(key,value);
|
|
|
+ }else {
|
|
|
+ valueMap.put(key,value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ResponsibilityIndicatorInfo> responsibilityInfos =new ArrayList<>();
|
|
|
+ for (Map.Entry<String,Object > entry : idMap.entrySet()) {
|
|
|
+ ResponsibilityIndicatorInfo info = new ResponsibilityIndicatorInfo();
|
|
|
+ info.setId(entry.getValue().toString());
|
|
|
+ String quantified = valueMap.get(entry.getKey().replace("ID_","IS_LH_")).toString();
|
|
|
+ if ("1".equals(quantified)) {
|
|
|
+
|
|
|
+ if (MathCalculatorUtil.isNumber(String.valueOf(valueMap.get(entry.getKey().replace("ID_", "")).toString()))) {
|
|
|
+ info.setQuantifiedValue(Double.valueOf(valueMap.get(entry.getKey().replace("ID_", "")).toString()));
|
|
|
+ } else {
|
|
|
+ info.setQuantifiedValue(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ info.setNonQuantifiedValue(valueMap.get(entry.getKey().replace("ID_","")).toString());
|
|
|
+ info.setState(valueMap.get("state").toString());
|
|
|
+ responsibilityInfos.add(info);
|
|
|
+ }
|
|
|
+ return this.saveOrUpdateBatch(responsibilityInfos);
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|