|
@@ -221,7 +221,7 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
- public boolean generateUnitEvaluationInfo(List<String> ids) {
|
|
|
|
|
|
+ public boolean generateUnitEvaluationInfo(List<String> ids,String indicatorId,String organizationId) {
|
|
|
|
|
|
for (String id : ids) {
|
|
for (String id : ids) {
|
|
OrganizationEvaluation organizationEvaluation = baseMapper.selectById(id);
|
|
OrganizationEvaluation organizationEvaluation = baseMapper.selectById(id);
|
|
@@ -235,7 +235,7 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
|
|
throw new CustomException("该年度的目标责任书不存在");
|
|
throw new CustomException("该年度的目标责任书不存在");
|
|
}
|
|
}
|
|
DeptResponsibility deptResponsibility = responsibilities.get(0);
|
|
DeptResponsibility deptResponsibility = responsibilities.get(0);
|
|
-
|
|
|
|
|
|
+//
|
|
//检查是否已经启动考评
|
|
//检查是否已经启动考评
|
|
QueryWrapper<OrganizationEvaluationInfo> infoqw = new QueryWrapper<>();
|
|
QueryWrapper<OrganizationEvaluationInfo> infoqw = new QueryWrapper<>();
|
|
infoqw.lambda().eq(OrganizationEvaluationInfo::getOrganizationEvaluationId, id);
|
|
infoqw.lambda().eq(OrganizationEvaluationInfo::getOrganizationEvaluationId, id);
|
|
@@ -244,58 +244,106 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
|
|
throw new CustomException("编号" + organizationEvaluation.getOrganizationEvaluationCode() + "的考评已启动;不允许重复操作");
|
|
throw new CustomException("编号" + organizationEvaluation.getOrganizationEvaluationCode() + "的考评已启动;不允许重复操作");
|
|
}
|
|
}
|
|
|
|
|
|
- organizationEvaluation.setStage("流程启动");
|
|
|
|
- baseMapper.updateById(organizationEvaluation);
|
|
|
|
|
|
+ String organizationType = organizationEvaluation.getOrganizationType();//考评类型 DWKP
|
|
|
|
+ String checkCycle = organizationEvaluation.getCheckCycle();//考评周期-年度
|
|
|
|
+ String year = organizationEvaluation.getYear();//年份
|
|
|
|
|
|
- List<String> evaluationRuleIds = Arrays.asList(organizationEvaluation.getOrganizationEvaluationRuleId().split(","));
|
|
|
|
|
|
+ //查询当前周期下对应的考评权重(需要考评的单位)
|
|
|
|
+ List<OrganizationEvaluationRule> evaluationRules = organizationEvaluationRuleService.getOrganizationEvaluationRuleByYearAndCycle(organizationType,checkCycle,year,"");
|
|
|
|
|
|
- for (String ruleId : evaluationRuleIds) {
|
|
|
|
|
|
+ //判断组织id 是否有值;不为空只生成当前组织的数据
|
|
|
|
+ if(StringUtils.isNotEmpty(organizationId)){
|
|
|
|
+ evaluationRules = evaluationRules.stream().filter(rule -> rule.getOrganizationId().equals(organizationId)).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
|
|
- //获取指定部门的规则
|
|
|
|
- OrganizationEvaluationRule evaluationRule = organizationEvaluationRuleService.getByIdIsCheck(ruleId, true, false);
|
|
|
|
- if (null == evaluationRule) {
|
|
|
|
- throw new CustomException("不存在此单位规则权重配置");
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //遍历考核的单位
|
|
|
|
+ for(OrganizationEvaluationRule evaluationRule : evaluationRules){
|
|
|
|
+ //规则集合
|
|
|
|
+ List<EvaluateRule> evaluateRuleList = new ArrayList<>();
|
|
|
|
+ //根据权重获取对应的考评规则
|
|
|
|
+ //生产经营
|
|
|
|
+ double scjyWeight = evaluationRule.getScjyWeight();
|
|
|
|
+ if(scjyWeight>0){
|
|
|
|
+ List<EvaluateRule> scjyevaluateRuleList = evaluateRuleService.getEvaluateRuleByYear(evaluationRule.getBinSection(),CacheContext.bseCodeObject.get("SCJY").getId(),"NDKP",evaluationRule.getYear());
|
|
|
|
+ if(null!=scjyevaluateRuleList &&scjyevaluateRuleList.size()>0){
|
|
|
|
+ evaluateRuleList.addAll(scjyevaluateRuleList);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- //获取对应的考评规(至少存在一条)
|
|
|
|
- List<String> evaluateRuleIds = Arrays.asList(evaluationRule.getEvaluateRuleId().split(","));
|
|
|
|
- List<EvaluateRule> evaluateRuleList = evaluateRuleService.listAll(evaluateRuleIds);
|
|
|
|
- if (null == evaluateRuleList || evaluateRuleList.size() <= 0) {
|
|
|
|
- throw new CustomException("未获取到配置的规则");
|
|
|
|
|
|
+ //前期
|
|
|
|
+ double qqWeight = evaluationRule.getQqWeight();
|
|
|
|
+ if(qqWeight>0){
|
|
|
|
+ List<EvaluateRule> qqevaluateRuleList = evaluateRuleService.getEvaluateRuleByYear(CacheContext.bsnCodeObject.get("QQ").getId(),CacheContext.bseCodeObject.get("QQXM").getId(),"NDKP",evaluationRule.getYear());
|
|
|
|
+ if(null!=qqevaluateRuleList &&qqevaluateRuleList.size()>0){
|
|
|
|
+ evaluateRuleList.addAll(qqevaluateRuleList);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //基建
|
|
|
|
+ double jjWeight = evaluationRule.getJjWeight();
|
|
|
|
+ if(jjWeight>0){
|
|
|
|
+ List<EvaluateRule> jjevaluateRuleList = evaluateRuleService.getEvaluateRuleByYear(CacheContext.bsnCodeObject.get("JJ").getId(),CacheContext.bseCodeObject.get("JJXM").getId(),"NDKP",evaluationRule.getYear());
|
|
|
|
+ if(null!=jjevaluateRuleList &&jjevaluateRuleList.size()>0){
|
|
|
|
+ evaluateRuleList.addAll(jjevaluateRuleList);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//获取考评规则的id
|
|
//获取考评规则的id
|
|
List<String> ruleIds = evaluateRuleList.stream().map(EvaluateRule::getId).collect(Collectors.toList());
|
|
List<String> ruleIds = evaluateRuleList.stream().map(EvaluateRule::getId).collect(Collectors.toList());
|
|
//通过规则id获取对应的规则明细
|
|
//通过规则id获取对应的规则明细
|
|
|
|
+ if(ruleIds.size()<=0){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
List<EvaluateRuleInfo> ruleInfos = evaluateRuleInfoService.list(ruleIds);
|
|
List<EvaluateRuleInfo> ruleInfos = evaluateRuleInfoService.list(ruleIds);
|
|
if (null == ruleInfos || ruleInfos.size() <= 0) {
|
|
if (null == ruleInfos || ruleInfos.size() <= 0) {
|
|
- throw new CustomException("规则明细配置为空");
|
|
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ //获取考评规则中的规则明细id
|
|
|
|
+ List<String> ruleInfoIds = ruleInfos.stream().map(EvaluateRuleInfo::getId).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ //通过规则id获取指标明细项
|
|
|
|
+ List<EvaluateRuleInfoIndicatorDTO> resDTOS = evaluateRuleInfoService.listByIndicatorInfo(ruleInfoIds);
|
|
|
|
+
|
|
|
|
+ //判断指标id和组织id s是否为空
|
|
|
|
+ if(StringUtils.isNotEmpty(indicatorId) ) {
|
|
|
|
+
|
|
|
|
+ resDTOS = resDTOS.stream().filter(dto -> dto.getIndicatorId().equals(indicatorId)).collect(Collectors.toList());
|
|
|
|
+ if (resDTOS.size() <= 0) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<OrganizationEvaluationInfo> oriEvaluationInfoList = organizationEvaluationInfoService.getEvaluationInfoByOptionCodeList(id, indicatorId, organizationId, "");
|
|
|
|
+ if (oriEvaluationInfoList.size() > 0) {
|
|
|
|
+ List<String> oriEvaluationInfoIdList = oriEvaluationInfoList.stream().map(OrganizationEvaluationInfo::getId).collect(Collectors.toList());
|
|
|
|
+ organizationEvaluationInfoService.removeByIds(oriEvaluationInfoIdList);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- //获取考评规则中的指标id
|
|
|
|
- List<String> indicatorIds = ruleInfos.stream().map(EvaluateRuleInfo::getIndicatorId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
- //获取指标对象
|
|
|
|
-// List<Indicator> indicators = iIndicatorService.selectByIds(indicatorIds);
|
|
|
|
- //通过指标id获取指标明细项
|
|
|
|
- List<IndicatorResDTO> resDTOS = iIndicatorService.listByIds(indicatorIds);
|
|
|
|
if (null == resDTOS || resDTOS.size() <= 0) {
|
|
if (null == resDTOS || resDTOS.size() <= 0) {
|
|
- throw new CustomException("指标规则明细项为空");
|
|
|
|
|
|
+// throw new CustomException("指标规则明细项为空");
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
|
|
|
|
//对应指标的目标值
|
|
//对应指标的目标值
|
|
Map<String, Object> objectMap = responsibilityIndicatorInfoService.getResponsibilityIdMap(deptResponsibility.getId());
|
|
Map<String, Object> objectMap = responsibilityIndicatorInfoService.getResponsibilityIdMap(deptResponsibility.getId());
|
|
|
|
|
|
- resDTOS.stream().forEach(r -> {
|
|
|
|
|
|
+ List<OrganizationEvaluationInfo> organizationEvaluationInfos = new ArrayList<>();
|
|
|
|
+ for (EvaluateRuleInfoIndicatorDTO r : resDTOS) {
|
|
|
|
+ if (null == r.getIndicatorDictionaryID()) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
OrganizationEvaluationInfo info = new OrganizationEvaluationInfo();
|
|
OrganizationEvaluationInfo info = new OrganizationEvaluationInfo();
|
|
info.setOrganizationEvaluationId(organizationEvaluation.getId());
|
|
info.setOrganizationEvaluationId(organizationEvaluation.getId());
|
|
- info.setOrganizationEvaluationRuleId(ruleId);
|
|
|
|
|
|
+ info.setOrganizationEvaluationRuleId(evaluationRule.getId());
|
|
|
|
+ info.setEvaluateRuleInfoId(r.getId());
|
|
info.setIndicatorId(r.getIndicatorId());
|
|
info.setIndicatorId(r.getIndicatorId());
|
|
- info.setDeptId(r.getDeptId());
|
|
|
|
info.setChildCode(r.getChildCode());
|
|
info.setChildCode(r.getChildCode());
|
|
- info.setIndicatorDictionaryId(r.getId());
|
|
|
|
|
|
+ info.setDeptId(r.getDeptId());
|
|
|
|
+ info.setIndicatorDictionaryId(r.getIndicatorDictionaryID());
|
|
info.setOptionCode(r.getOptionCode());
|
|
info.setOptionCode(r.getOptionCode());
|
|
info.setIsQuantified(r.getIsQuantified());
|
|
info.setIsQuantified(r.getIsQuantified());
|
|
|
|
+ info.setCreateTime(new Date());
|
|
info.setState("0");
|
|
info.setState("0");
|
|
- info.setOrganizationId(evaluationRule.getOrganizationId());
|
|
|
|
- //
|
|
|
|
|
|
+
|
|
if ("JHZ".equals(r.getOptionCode()) || "MBZ".equals(r.getOptionCode()) || "DBZ".equals(r.getOptionCode())) {
|
|
if ("JHZ".equals(r.getOptionCode()) || "MBZ".equals(r.getOptionCode()) || "DBZ".equals(r.getOptionCode())) {
|
|
if (null != objectMap.get(r.getIndicatorId())) {
|
|
if (null != objectMap.get(r.getIndicatorId())) {
|
|
if ("是".equals(r.getIsQuantified())) {
|
|
if ("是".equals(r.getIsQuantified())) {
|
|
@@ -305,13 +353,17 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- info.setCreateTime(new Date());
|
|
|
|
- boolean b2 = organizationEvaluationInfoService.saveOrUpdate(info);
|
|
|
|
- if (!b2) {
|
|
|
|
- throw new CustomException("初始化目标责任书明细失败");
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+
|
|
|
|
+ info.setOrganizationId(evaluationRule.getOrganizationId());
|
|
|
|
+ organizationEvaluationInfos.add(info);
|
|
|
|
+ }
|
|
|
|
+ boolean b2 = organizationEvaluationInfoService.saveBatch(organizationEvaluationInfos);
|
|
|
|
+ if (!b2) {
|
|
|
|
+ throw new CustomException("初始化明细失败");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ organizationEvaluation.setStage("流程启动");
|
|
|
|
+ baseMapper.updateById(organizationEvaluation);
|
|
}
|
|
}
|
|
|
|
|
|
return true;
|
|
return true;
|