|
@@ -1,5 +1,6 @@
|
|
package com.ims.eval.service.impl;
|
|
package com.ims.eval.service.impl;
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.ims.common.utils.StringUtils;
|
|
import com.ims.common.utils.StringUtils;
|
|
import com.ims.eval.cache.CacheContext;
|
|
import com.ims.eval.cache.CacheContext;
|
|
import com.ims.eval.config.CustomException;
|
|
import com.ims.eval.config.CustomException;
|
|
@@ -48,16 +49,6 @@ public class OrganizationEvaluationCommonInfoServiceImpl extends ServiceImpl<Org
|
|
public boolean addEvaluationCommonInfo(List<AddEvaluationInfoDTO> addEvaluationInfoDTOs) {
|
|
public boolean addEvaluationCommonInfo(List<AddEvaluationInfoDTO> addEvaluationInfoDTOs) {
|
|
for (AddEvaluationInfoDTO addEvaluationInfoDTO : addEvaluationInfoDTOs) {
|
|
for (AddEvaluationInfoDTO addEvaluationInfoDTO : addEvaluationInfoDTOs) {
|
|
|
|
|
|
- List<OrganizationEvaluationCommonInfo> infoResDTOList = baseMapper.selectListAll(addEvaluationInfoDTO.getOrganizationEvaluationId(),addEvaluationInfoDTO.getIndicatorId(),addEvaluationInfoDTO.getOrganizationId(),addEvaluationInfoDTO.getDeptName());
|
|
|
|
- //判断是否已存在记录
|
|
|
|
- if(null != infoResDTOList && infoResDTOList.size()>0){
|
|
|
|
- //当前部门存在记录;移除保存
|
|
|
|
- List<String> commonIds = infoResDTOList.stream().map(OrganizationEvaluationCommonInfo::getId).collect(Collectors.toList());
|
|
|
|
- boolean b = this.removeByIds(commonIds);
|
|
|
|
- if(!b){
|
|
|
|
- throw new CustomException("保存失败");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
//1.获取考评id(获取此考评记录)
|
|
//1.获取考评id(获取此考评记录)
|
|
String organizationEvaluationId = addEvaluationInfoDTO.getOrganizationEvaluationId();
|
|
String organizationEvaluationId = addEvaluationInfoDTO.getOrganizationEvaluationId();
|
|
@@ -91,7 +82,21 @@ public class OrganizationEvaluationCommonInfoServiceImpl extends ServiceImpl<Org
|
|
.collect(Collectors.groupingBy(d -> d.getChildCode() + "," + d.getChildName()));
|
|
.collect(Collectors.groupingBy(d -> d.getChildCode() + "," + d.getChildName()));
|
|
Map<String, Object> optionMap = addEvaluationInfoDTO.getOptionMap();
|
|
Map<String, Object> optionMap = addEvaluationInfoDTO.getOptionMap();
|
|
|
|
|
|
- //5.保存指标
|
|
|
|
|
|
+
|
|
|
|
+ //5.删除原有记录
|
|
|
|
+ List<OrganizationEvaluationCommonInfo> infoResDTOList = baseMapper.selectListAll(addEvaluationInfoDTO.getOrganizationEvaluationId(),addEvaluationInfoDTO.getIndicatorId(),addEvaluationInfoDTO.getOrganizationId(),optionMap.get("deptName").toString());
|
|
|
|
+ //判断是否已存在记录
|
|
|
|
+ if(null != infoResDTOList && infoResDTOList.size()>0){
|
|
|
|
+ //当前部门存在记录;移除保存
|
|
|
|
+ List<String> commonIds = infoResDTOList.stream().map(OrganizationEvaluationCommonInfo::getId).collect(Collectors.toList());
|
|
|
|
+ boolean b = this.removeByIds(commonIds);
|
|
|
|
+ if(!b){
|
|
|
|
+ throw new CustomException("保存失败");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //6.保存指标
|
|
for (Map.Entry<String, List<IndicatorResDTO>> childCodeEntry : groupedChildCode.entrySet()) {
|
|
for (Map.Entry<String, List<IndicatorResDTO>> childCodeEntry : groupedChildCode.entrySet()) {
|
|
|
|
|
|
for (IndicatorResDTO d : childCodeEntry.getValue()) {
|
|
for (IndicatorResDTO d : childCodeEntry.getValue()) {
|
|
@@ -119,13 +124,12 @@ public class OrganizationEvaluationCommonInfoServiceImpl extends ServiceImpl<Org
|
|
info.setChildCode(d.getChildCode());
|
|
info.setChildCode(d.getChildCode());
|
|
CacheContext.ddSuperKeyMap.containsKey("BM0001");
|
|
CacheContext.ddSuperKeyMap.containsKey("BM0001");
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(addEvaluationInfoDTO.getDeptName()) && CacheContext.ddSuperKeyMap.containsKey("BM0001")){
|
|
|
|
- Optional<DataDictionary> any = CacheContext.ddSuperKeyMap.get("BM0001").stream().filter(t -> t.getKeyName().equals(addEvaluationInfoDTO.getDeptName())).findAny();
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(optionMap.get("deptName").toString()) && CacheContext.ddSuperKeyMap.containsKey("BM0001")){
|
|
|
|
+ Optional<DataDictionary> any = CacheContext.ddSuperKeyMap.get("BM0001").stream().filter(t -> t.getKeyName().equals(optionMap.get("deptName").toString())).findAny();
|
|
DataDictionary di = any.isPresent() ? any.get() : null;
|
|
DataDictionary di = any.isPresent() ? any.get() : null;
|
|
info.setDeptId(di.getDataKey());
|
|
info.setDeptId(di.getDataKey());
|
|
- info.setDeptName(addEvaluationInfoDTO.getDeptName());
|
|
|
|
|
|
+ info.setDeptName(optionMap.get("deptName").toString());
|
|
}
|
|
}
|
|
-
|
|
|
|
saveOrUpdate(info);
|
|
saveOrUpdate(info);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -185,6 +189,7 @@ public class OrganizationEvaluationCommonInfoServiceImpl extends ServiceImpl<Org
|
|
|
|
|
|
if (mark) {
|
|
if (mark) {
|
|
indicatormap.put("deptName", resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getDeptName());//公司名
|
|
indicatormap.put("deptName", resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getDeptName());//公司名
|
|
|
|
+ indicatormap.put("deptId", resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getDeptId());//公司名
|
|
indicatormap.put("organizationId", resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getOrganizationId());//公司id
|
|
indicatormap.put("organizationId", resultMap.get(d.getChildCode()+"_"+d.getOptionCode()).getOrganizationId());//公司id
|
|
mark = false;
|
|
mark = false;
|
|
}
|
|
}
|
|
@@ -204,4 +209,29 @@ public class OrganizationEvaluationCommonInfoServiceImpl extends ServiceImpl<Org
|
|
|
|
|
|
return data;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean removeCommonInfos(String organizationEvaluationId, String indicatorId, String organizationId, List<String> deptId) {
|
|
|
|
+ QueryWrapper<OrganizationEvaluationCommonInfo> qw = new QueryWrapper<>();
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotEmpty(organizationEvaluationId)) {
|
|
|
|
+ qw.lambda().eq(OrganizationEvaluationCommonInfo::getOrganizationEvaluationId, organizationEvaluationId);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(indicatorId)) {
|
|
|
|
+ qw.lambda().eq(OrganizationEvaluationCommonInfo::getIndicatorId, indicatorId);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(organizationId)) {
|
|
|
|
+ qw.lambda().eq(OrganizationEvaluationCommonInfo::getOrganizationId, organizationId);
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(deptId)) {
|
|
|
|
+ qw.lambda().in(OrganizationEvaluationCommonInfo::getDeptId, deptId);
|
|
|
|
+ }
|
|
|
|
+ List<OrganizationEvaluationCommonInfo> list = baseMapper.selectList(qw);
|
|
|
|
+
|
|
|
|
+ //获取
|
|
|
|
+ List<String> commonIds = list.stream().map(OrganizationEvaluationCommonInfo::getId).collect(Collectors.toList());
|
|
|
|
+ boolean b = this.removeByIds(commonIds);
|
|
|
|
+
|
|
|
|
+ return b;
|
|
|
|
+ }
|
|
}
|
|
}
|