|
@@ -220,62 +220,6 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
|
|
|
}
|
|
|
|
|
|
|
|
|
- public boolean saveOrUpdate2(OrganizationEvaluation entity) {
|
|
|
- //获取指定部门的规则
|
|
|
- List<OrganizationEvaluationRule> list = organizationEvaluationRuleService.listByIsCheck(entity.getOrganizationType(), entity.getCheckCycle(), true, false);
|
|
|
- if (!"JDKP".equals(entity.getCheckCycle()) && (null == list || list.size() <= 0)) {
|
|
|
- throw new CustomException("不存在单位权重配置");
|
|
|
- }
|
|
|
- //获取组织id;
|
|
|
- List<String> organizationIds = list.stream().map(OrganizationEvaluationRule::getOrganizationId).collect(Collectors.toList());
|
|
|
- List<String> organizationNames = list.stream().map(OrganizationEvaluationRule::getOrganizationName).collect(Collectors.toList());
|
|
|
- List<String> evaluationRuleIds = list.stream().map(OrganizationEvaluationRule::getId).collect(Collectors.toList());
|
|
|
-
|
|
|
- StringBuilder responsibilityCode = new StringBuilder();
|
|
|
- responsibilityCode.append(entity.getOrganizationType()).append("_");
|
|
|
- responsibilityCode.append(entity.getCheckCycle()).append("_");
|
|
|
-
|
|
|
- //判断该是否存在目标责任书
|
|
|
- List<OrganizationEvaluation> oriList = new ArrayList<>();
|
|
|
- if ("JDKP".equals(entity.getCheckCycle())) {
|
|
|
- Date newDate = DateUtils.toDate(entity.getYear() + "-" + entity.getMonth() + "-01");
|
|
|
- String season = String.valueOf(DateUtils.getSeason(newDate));//获取季度
|
|
|
- String month = String.valueOf(Integer.valueOf(entity.getMonth()) * Integer.valueOf(season));//季度考评
|
|
|
- oriList = list("", entity.getCheckCycle(), entity.getYear(), month);
|
|
|
- List<OrganizationEvaluation> count = list("", entity.getCheckCycle(), entity.getYear(), "");
|
|
|
- responsibilityCode.append(entity.getYear()).append("_").append(month).append("_");
|
|
|
- responsibilityCode.append(StringUtils.addZeroForStr(String.valueOf(count.size() + 1), 4, "l"));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if (null != entity && (null == entity.getId() || "".equals(entity.getId().trim()))) {
|
|
|
- if (null != oriList && oriList.size() > 0) {
|
|
|
- throw new CustomException("此单位在该阶段已存在目标责任书");
|
|
|
- }
|
|
|
- //保存目标责任书
|
|
|
- entity.setOrganizationEvaluationCode(responsibilityCode.toString().toLowerCase());
|
|
|
-
|
|
|
- entity.setOrganizationId(String.join(",", organizationIds));//考评组织ID
|
|
|
- entity.setOrganizationName(String.join(",", organizationNames));
|
|
|
- entity.setOrganizationEvaluationRuleId(String.join(",", evaluationRuleIds));
|
|
|
- entity.setStage("流程未启动");
|
|
|
- entity.setCreateTime(new Date());
|
|
|
- } else {
|
|
|
- OrganizationEvaluation update = baseMapper.selectById(entity.getId());
|
|
|
- if (null != oriList && oriList.size() > 1 && !update.getId().equals(oriList.get(0).getId())) {
|
|
|
- throw new CustomException("编辑记录未找到");
|
|
|
- }
|
|
|
- if (!"流程未启动".equals(update.getStage())) {
|
|
|
- throw new CustomException("流程已启动不允许修改");
|
|
|
- }
|
|
|
- entity.setOrganizationId(String.join(",", organizationIds));//考评组织ID
|
|
|
- entity.setOrganizationName(String.join(",", organizationNames));
|
|
|
- entity.setOrganizationEvaluationRuleId(String.join(",", evaluationRuleIds));
|
|
|
- entity.setUpdateTime(new Date());
|
|
|
- }
|
|
|
- boolean b = super.saveOrUpdate(entity);
|
|
|
- return b;
|
|
|
- }
|
|
|
|
|
|
|
|
|
@Transactional
|
|
@@ -384,39 +328,47 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
|
|
|
throw new CustomException("不存在考评记录");
|
|
|
}
|
|
|
|
|
|
- //检查是否已经启动考评
|
|
|
- QueryWrapper<OrganizationEvaluationInfo> infoqw = new QueryWrapper<>();
|
|
|
- infoqw.lambda().eq(OrganizationEvaluationInfo::getOrganizationEvaluationId, id);
|
|
|
- int infcount = organizationEvaluationInfoService.count(infoqw);
|
|
|
- if (infcount > 0) {
|
|
|
- throw new CustomException("编号" + organizationEvaluation.getOrganizationEvaluationCode() + "的考评已启动;不允许重复操作");
|
|
|
- }
|
|
|
-
|
|
|
- organizationEvaluation.setStage("流程启动");
|
|
|
- baseMapper.updateById(organizationEvaluation);
|
|
|
-
|
|
|
- List<String> evaluationRuleIds = Arrays.asList(organizationEvaluation.getOrganizationEvaluationRuleId().split(","));
|
|
|
- evaluationRuleIds = evaluationRuleIds.stream().distinct().collect(Collectors.toList());
|
|
|
- for (String ruleId : evaluationRuleIds) {
|
|
|
-
|
|
|
- //获取指定部门的规则
|
|
|
- OrganizationEvaluationRule evaluationRule = organizationEvaluationRuleService.getById(ruleId);
|
|
|
- if (null == evaluationRule || evaluationRule.getDelFlag().equals(true)) {
|
|
|
- throw new CustomException(evaluationRule.getOrganizationShortName() + "不存在此单位规则权重配置");
|
|
|
+ String organizationType = organizationEvaluation.getOrganizationType();//考评类型 DWKP
|
|
|
+ String checkCycle = organizationEvaluation.getCheckCycle();//考评周期-月度、季度
|
|
|
+ String year = organizationEvaluation.getYear();//年份
|
|
|
+
|
|
|
+ //查询当前周期下对应的考评权重(需要考评的单位)
|
|
|
+ List<OrganizationEvaluationRule> evaluationRules = organizationEvaluationRuleService.getOrganizationEvaluationRuleByYearAndCycle(organizationType,checkCycle,year);
|
|
|
+
|
|
|
+ //规则集合
|
|
|
+ List<EvaluateRule> evaluateRuleList = new ArrayList<>();
|
|
|
+ //遍历考核的单位
|
|
|
+ for(OrganizationEvaluationRule evaluationRule : evaluationRules){
|
|
|
+ //根据权重获取对应的考评规则
|
|
|
+ //生产经营
|
|
|
+ double scjyWeight = evaluationRule.getScjyWeight();
|
|
|
+ if(scjyWeight>0){
|
|
|
+ List<EvaluateRule> scjyevaluateRuleList = evaluateRuleService.getEvaluateRuleByYear(evaluationRule.getBinSection(),CacheContext.bseCodeObject.get("SCJY").getId(),"JDKP",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("未获取到配置的规则");
|
|
|
- continue;
|
|
|
+ //前期
|
|
|
+ double qqWeight = evaluationRule.getQqWeight();
|
|
|
+ if(qqWeight>0){
|
|
|
+ List<EvaluateRule> qqevaluateRuleList = evaluateRuleService.getEvaluateRuleByYear(CacheContext.bsnCodeObject.get("QQ").getId(),CacheContext.bseCodeObject.get("QQXM").getId(),"JDKP",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(),"JDKP",evaluationRule.getYear());
|
|
|
+ if(null!=jjevaluateRuleList &&jjevaluateRuleList.size()>0){
|
|
|
+ evaluateRuleList.addAll(jjevaluateRuleList);
|
|
|
+ }
|
|
|
}
|
|
|
//获取考评规则的id
|
|
|
List<String> ruleIds = evaluateRuleList.stream().map(EvaluateRule::getId).collect(Collectors.toList());
|
|
|
//通过规则id获取对应的规则明细
|
|
|
List<EvaluateRuleInfo> ruleInfos = evaluateRuleInfoService.list(ruleIds);
|
|
|
if (null == ruleInfos || ruleInfos.size() <= 0) {
|
|
|
-// throw new CustomException("规则明细配置为空");
|
|
|
continue;
|
|
|
}
|
|
|
//获取考评规则中的规则明细id
|
|
@@ -425,17 +377,17 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
|
|
|
//通过规则id获取指标明细项
|
|
|
List<EvaluateRuleInfoIndicatorDTO> resDTOS = evaluateRuleInfoService.listByIndicatorInfo(ruleInfoIds);
|
|
|
|
|
|
-
|
|
|
if (null == resDTOS || resDTOS.size() <= 0) {
|
|
|
throw new CustomException("指标规则明细项为空");
|
|
|
}
|
|
|
+ List<OrganizationEvaluationInfo> organizationEvaluationInfos = new ArrayList<>();
|
|
|
for (EvaluateRuleInfoIndicatorDTO r : resDTOS) {
|
|
|
if (null == r.getIndicatorDictionaryID()) {
|
|
|
continue;
|
|
|
}
|
|
|
OrganizationEvaluationInfo info = new OrganizationEvaluationInfo();
|
|
|
info.setOrganizationEvaluationId(organizationEvaluation.getId());
|
|
|
- info.setOrganizationEvaluationRuleId(ruleId);
|
|
|
+ info.setOrganizationEvaluationRuleId(evaluationRule.getId());
|
|
|
info.setEvaluateRuleInfoId(r.getId());
|
|
|
info.setIndicatorId(r.getIndicatorId());
|
|
|
info.setChildCode(r.getChildCode());
|
|
@@ -444,14 +396,14 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
|
|
|
info.setOptionCode(r.getOptionCode());
|
|
|
info.setIsQuantified(r.getIsQuantified());
|
|
|
info.setCreateTime(new Date());
|
|
|
- boolean b2 = organizationEvaluationInfoService.saveOrUpdate(info);
|
|
|
- if (!b2) {
|
|
|
- throw new CustomException("初始化目标责任书明细失败");
|
|
|
- }
|
|
|
+ organizationEvaluationInfos.add(info);
|
|
|
+ }
|
|
|
+ boolean b2 = organizationEvaluationInfoService.saveBatch(organizationEvaluationInfos);
|
|
|
+ if (!b2) {
|
|
|
+ throw new CustomException("初始化目标责任书明细失败");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -466,7 +418,7 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
|
|
|
throw new CustomException("不存在考评记录");
|
|
|
}
|
|
|
|
|
|
- //检查是否已经启动改考评
|
|
|
+ //检查是否已经启动考评
|
|
|
QueryWrapper<OrganizationEvaluationInfo> infoqw = new QueryWrapper<>();
|
|
|
infoqw.lambda().eq(OrganizationEvaluationInfo::getOrganizationEvaluationId, id);
|
|
|
int infcount = organizationEvaluationInfoService.count(infoqw);
|
|
@@ -478,42 +430,48 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
|
|
|
baseMapper.updateById(organizationEvaluation);
|
|
|
|
|
|
List<String> evaluationRuleIds = Arrays.asList(organizationEvaluation.getOrganizationEvaluationRuleId().split(","));
|
|
|
-
|
|
|
+ evaluationRuleIds = evaluationRuleIds.stream().distinct().collect(Collectors.toList());
|
|
|
for (String ruleId : evaluationRuleIds) {
|
|
|
|
|
|
//获取指定部门的规则
|
|
|
OrganizationEvaluationRule evaluationRule = organizationEvaluationRuleService.getById(ruleId);
|
|
|
- if (null == evaluationRule) {
|
|
|
- throw new CustomException("不存在此单位规则权重配置");
|
|
|
+ if (null == evaluationRule || evaluationRule.getDelFlag().equals(true)) {
|
|
|
+ throw new CustomException(evaluationRule.getOrganizationShortName() + "不存在此单位规则权重配置");
|
|
|
}
|
|
|
//获取对应的考评规(至少存在一条)
|
|
|
List<String> evaluateRuleIds = Arrays.asList(evaluationRule.getEvaluateRuleId().split(","));
|
|
|
List<EvaluateRule> evaluateRuleList = evaluateRuleService.listAll(evaluateRuleIds);
|
|
|
if (null == evaluateRuleList || evaluateRuleList.size() <= 0) {
|
|
|
- throw new CustomException("未获取到配置的规则");
|
|
|
+ //throw new CustomException("未获取到配置的规则");
|
|
|
+ continue;
|
|
|
}
|
|
|
//获取考评规则的id
|
|
|
List<String> ruleIds = evaluateRuleList.stream().map(EvaluateRule::getId).collect(Collectors.toList());
|
|
|
//通过规则id获取对应的规则明细
|
|
|
List<EvaluateRuleInfo> ruleInfos = evaluateRuleInfoService.list(ruleIds);
|
|
|
if (null == ruleInfos || ruleInfos.size() <= 0) {
|
|
|
- throw new CustomException("规则明细配置为空");
|
|
|
+// throw new CustomException("规则明细配置为空");
|
|
|
+ continue;
|
|
|
}
|
|
|
- //获取考评规则中的指标id
|
|
|
- List<String> indicatorIds = ruleInfos.stream().map(EvaluateRuleInfo::getIndicatorId).collect(Collectors.toList());
|
|
|
+ //获取考评规则中的规则明细id
|
|
|
+ List<String> ruleInfoIds = ruleInfos.stream().map(EvaluateRuleInfo::getId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //通过规则id获取指标明细项
|
|
|
+ List<EvaluateRuleInfoIndicatorDTO> resDTOS = evaluateRuleInfoService.listByIndicatorInfo(ruleInfoIds);
|
|
|
|
|
|
|
|
|
- //通过指标id获取指标明细项
|
|
|
- List<IndicatorResDTO> resDTOS = iIndicatorService.listByIds(indicatorIds);
|
|
|
if (null == resDTOS || resDTOS.size() <= 0) {
|
|
|
throw new CustomException("指标规则明细项为空");
|
|
|
}
|
|
|
-
|
|
|
- resDTOS.stream().forEach(r -> {
|
|
|
+ for (EvaluateRuleInfoIndicatorDTO r : resDTOS) {
|
|
|
+ if (null == r.getIndicatorDictionaryID()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
OrganizationEvaluationInfo info = new OrganizationEvaluationInfo();
|
|
|
info.setOrganizationEvaluationId(organizationEvaluation.getId());
|
|
|
info.setOrganizationEvaluationRuleId(ruleId);
|
|
|
- info.setIndicatorId(r.getId());
|
|
|
+ info.setEvaluateRuleInfoId(r.getId());
|
|
|
+ info.setIndicatorId(r.getIndicatorId());
|
|
|
info.setChildCode(r.getChildCode());
|
|
|
info.setDeptId(r.getDeptId());
|
|
|
info.setIndicatorDictionaryId(r.getIndicatorDictionaryID());
|
|
@@ -524,7 +482,7 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
|
|
|
if (!b2) {
|
|
|
throw new CustomException("初始化目标责任书明细失败");
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|