|
@@ -142,7 +142,7 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
|
|
|
public boolean saveOrUpdate(OrganizationEvaluation entity) {
|
|
|
//获取指定部门的规则
|
|
|
List<OrganizationEvaluationRule> list = organizationEvaluationRuleService.listByIsCheck(entity.getOrganizationType(), entity.getCheckCycle(), true, false);
|
|
|
- if (!"YDKP".equals(entity.getCheckCycle()) && (null == list || list.size() <= 0)) {
|
|
|
+ if (!"JDKP".equals(entity.getCheckCycle()) && (null == list || list.size() <= 0)) {
|
|
|
throw new CustomException("不存在单位权重配置");
|
|
|
}
|
|
|
//获取组织id;
|
|
@@ -207,6 +207,66 @@ public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationE
|
|
|
return b;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ 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
|
|
|
@Override
|
|
|
public boolean generateUnitEvaluationInfo(List<String> ids) {
|