|
@@ -770,66 +770,69 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public boolean addEvaluationInfo(AddEvaluationInfoDTO addEvaluationInfoDTO) {
|
|
|
- //1.获取考评id(获取此考评记录)
|
|
|
- String organizationEvaluationId = addEvaluationInfoDTO.getOrganizationEvaluationId();
|
|
|
+ public boolean addEvaluationInfo(List<AddEvaluationInfoDTO> addEvaluationInfoDTOs) {
|
|
|
|
|
|
- if (StringUtils.isEmpty(organizationEvaluationId)) {
|
|
|
- throw new CustomException("保存失败");
|
|
|
- }
|
|
|
- OrganizationEvaluation organizationEvaluation = organizationEvaluationService.getById(organizationEvaluationId);
|
|
|
+ for (AddEvaluationInfoDTO addEvaluationInfoDTO : addEvaluationInfoDTOs) {
|
|
|
|
|
|
- if (null == organizationEvaluation) {
|
|
|
- throw new CustomException("保存失败");
|
|
|
- }
|
|
|
- organizationEvaluation.getCheckCycle();
|
|
|
+ //1.获取考评id(获取此考评记录)
|
|
|
+ String organizationEvaluationId = addEvaluationInfoDTO.getOrganizationEvaluationId();
|
|
|
|
|
|
- //2.获取组织id 和所属板块(判断该板块下是否有此组织的考核)
|
|
|
- String organizationType = organizationEvaluation.getOrganizationType();//考评类型 DWKP
|
|
|
- String checkCycle = organizationEvaluation.getCheckCycle();//考评周期-月度、季度
|
|
|
- String year = organizationEvaluation.getYear();//年份
|
|
|
+ if (StringUtils.isEmpty(organizationEvaluationId)) {
|
|
|
+ throw new CustomException("保存失败");
|
|
|
+ }
|
|
|
+ OrganizationEvaluation organizationEvaluation = organizationEvaluationService.getById(organizationEvaluationId);
|
|
|
|
|
|
- //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);
|
|
|
+ if (null == organizationEvaluation) {
|
|
|
+ throw new CustomException("保存失败");
|
|
|
+ }
|
|
|
+ organizationEvaluation.getCheckCycle();
|
|
|
|
|
|
- //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();
|
|
|
+ //2.获取组织id 和所属板块(判断该板块下是否有此组织的考核)
|
|
|
+ String organizationType = organizationEvaluation.getOrganizationType();//考评类型 DWKP
|
|
|
+ String checkCycle = organizationEvaluation.getCheckCycle();//考评周期-月度、季度
|
|
|
+ String year = organizationEvaluation.getYear();//年份
|
|
|
|
|
|
- //5.保存指标
|
|
|
- for (Map.Entry<String, List<IndicatorResDTO>> childCodeEntry : groupedChildCode.entrySet()) {
|
|
|
+ //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);
|
|
|
|
|
|
- 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));
|
|
|
+ //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);
|
|
|
}
|
|
|
- info.setChildCode(d.getChildCode());
|
|
|
- info.setDeptId(d.getDeptId());
|
|
|
- info.setCreateTime(new Date());
|
|
|
- this.saveOrUpdate(info);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- return false;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
//todo 后续添加需要计算的指标项
|