|
@@ -770,66 +770,69 @@ public class OrganizationEvaluationInfoServiceImpl extends ServiceImpl<Organizat
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public boolean addEvaluationInfo(AddEvaluationInfoDTO addEvaluationInfoDTO) {
|
|
|
-
|
|
|
- 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();
|
|
|
+
|
|
|
+ String organizationEvaluationId = addEvaluationInfoDTO.getOrganizationEvaluationId();
|
|
|
|
|
|
-
|
|
|
- String organizationType = organizationEvaluation.getOrganizationType();
|
|
|
- String checkCycle = organizationEvaluation.getCheckCycle();
|
|
|
- String year = organizationEvaluation.getYear();
|
|
|
+ if (StringUtils.isEmpty(organizationEvaluationId)) {
|
|
|
+ throw new CustomException("保存失败");
|
|
|
+ }
|
|
|
+ OrganizationEvaluation organizationEvaluation = organizationEvaluationService.getById(organizationEvaluationId);
|
|
|
|
|
|
-
|
|
|
- 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();
|
|
|
|
|
|
-
|
|
|
- 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();
|
|
|
+
|
|
|
+ String organizationType = organizationEvaluation.getOrganizationType();
|
|
|
+ String checkCycle = organizationEvaluation.getCheckCycle();
|
|
|
+ String year = organizationEvaluation.getYear();
|
|
|
|
|
|
-
|
|
|
- for (Map.Entry<String, List<IndicatorResDTO>> childCodeEntry : groupedChildCode.entrySet()) {
|
|
|
+
|
|
|
+ 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));
|
|
|
+
|
|
|
+ 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();
|
|
|
+
|
|
|
+
|
|
|
+ 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;
|
|
|
}
|
|
|
|
|
|
|