|
@@ -127,64 +127,68 @@ public class DeptResponsibilityServiceImpl extends ServiceImpl<DeptResponsibilit
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public boolean generateResponsibility(String orgEvalRuleId, String date) {
|
|
|
+ public boolean generateResponsibility(String id) {
|
|
|
|
|
|
|
|
|
- DeptResponsibility responsibility = new DeptResponsibility();
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
- Date newDate;
|
|
|
-
|
|
|
- if (StringUtils.isEmpty(date)) {
|
|
|
- newDate = DateUtils.getCurrentDate();
|
|
|
- } else {
|
|
|
- newDate = DateUtils.toDate(date);
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- String year = String.valueOf(DateUtils.getYear(newDate));
|
|
|
- String season = String.valueOf(DateUtils.getSeason(newDate));
|
|
|
- String month = String.valueOf(DateUtils.getMonth(newDate));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
+ DeptResponsibility oriResponsibility = baseMapper.selectById(id);
|
|
|
+ if (null == oriResponsibility) {
|
|
|
+ throw new CustomException("此目标责任书不存在");
|
|
|
+ }
|
|
|
|
|
|
- OrganizationEvaluationRule evaluationRule = organizationEvaluationRuleService.getById(orgEvalRuleId);
|
|
|
+ OrganizationEvaluationRule evaluationRule = organizationEvaluationRuleService.getById(oriResponsibility.getOrganizationEvaluationRuleId());
|
|
|
if (null == evaluationRule) {
|
|
|
throw new CustomException("不存在此单位权重配置");
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- List<DeptResponsibility> oriList = new ArrayList<>();
|
|
|
- if ("NDKP".equals(evaluationRule.getEvaluationCycle())) {
|
|
|
- oriList = list(evaluationRule.getOrganizationId(), evaluationRule.getEvaluationCycle(), year, "");
|
|
|
- }
|
|
|
- if ("JDKP".equals(evaluationRule.getEvaluationCycle())) {
|
|
|
- month = String.valueOf(Integer.valueOf(month) * Integer.valueOf(season));
|
|
|
- oriList = list(evaluationRule.getOrganizationId(), evaluationRule.getEvaluationCycle(), year, month);
|
|
|
- }
|
|
|
- if ("YDKP".equals(evaluationRule.getEvaluationCycle())) {
|
|
|
- oriList = list(evaluationRule.getOrganizationId(), evaluationRule.getEvaluationCycle(), year, month);
|
|
|
- }
|
|
|
- if (oriList.size() > 0) {
|
|
|
- throw new CustomException("已存在该单位目标责任书");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- responsibility.setOrganizationId(evaluationRule.getOrganizationId());
|
|
|
- responsibility.setOrganizationName(evaluationRule.getOrganizationName());
|
|
|
- responsibility.setCheckCycle(evaluationRule.getEvaluationCycle());
|
|
|
- responsibility.setYear(year);
|
|
|
- responsibility.setMonth(month);
|
|
|
- responsibility.setOrganizationEvaluationRuleId(evaluationRule.getId());
|
|
|
-
|
|
|
-
|
|
|
- responsibility.setStage("流程未启动");
|
|
|
- responsibility.setCreateTime(new Date());
|
|
|
-
|
|
|
-
|
|
|
- boolean b = super.saveOrUpdate(responsibility);
|
|
|
- if (!b) {
|
|
|
- throw new CustomException("保存目标责任书失败");
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
List<String> evaluateRuleIds = Arrays.asList(evaluationRule.getEvaluateRuleId().split(","));
|
|
@@ -210,7 +214,7 @@ public class DeptResponsibilityServiceImpl extends ServiceImpl<DeptResponsibilit
|
|
|
|
|
|
resDTOS.stream().forEach(r -> {
|
|
|
ResponsibilityIndicatorInfo info = new ResponsibilityIndicatorInfo();
|
|
|
- info.setDeptResponsibilityId(responsibility.getId());
|
|
|
+ info.setDeptResponsibilityId(oriResponsibility.getId());
|
|
|
info.setIndicatorId(r.getId());
|
|
|
info.setIndicatorDictionaryId(r.getIndicatorDictionaryID());
|
|
|
info.setOptionCode(r.getOptionCode());
|
|
@@ -228,62 +232,58 @@ public class DeptResponsibilityServiceImpl extends ServiceImpl<DeptResponsibilit
|
|
|
@Override
|
|
|
public boolean saveOrUpdate(DeptResponsibility entity) {
|
|
|
|
|
|
+
|
|
|
+ OrganizationEvaluationRule evaluationRule = organizationEvaluationRuleService.getById(entity.getOrganizationEvaluationRuleId());
|
|
|
+ if (null == evaluationRule) {
|
|
|
+ throw new CustomException("不存在此单位权重配置");
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ StringBuilder responsibilityCode = new StringBuilder();
|
|
|
+ responsibilityCode.append(evaluationRule.getOrganizationType()).append("_");
|
|
|
+ responsibilityCode.append(evaluationRule.getEvaluationCycle()).append("_");
|
|
|
|
|
|
+
|
|
|
+ List<DeptResponsibility> oriList = new ArrayList<>();
|
|
|
+ if ("NDKP".equals(evaluationRule.getEvaluationCycle())) {
|
|
|
+ oriList = list(evaluationRule.getOrganizationId(), evaluationRule.getEvaluationCycle(), entity.getYear(), "");
|
|
|
+ responsibilityCode.append(entity.getYear()).append("_");
|
|
|
+ }
|
|
|
+ if ("JDKP".equals(evaluationRule.getEvaluationCycle())) {
|
|
|
+ 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(evaluationRule.getOrganizationId(), evaluationRule.getEvaluationCycle(), entity.getYear(), month);
|
|
|
+ responsibilityCode.append(entity.getYear()).append("_").append(month).append("_");
|
|
|
+ }
|
|
|
+ if ("YDKP".equals(evaluationRule.getEvaluationCycle())) {
|
|
|
+ oriList = list(evaluationRule.getOrganizationId(), evaluationRule.getEvaluationCycle(), entity.getYear(), entity.getMonth());
|
|
|
+ responsibilityCode.append(entity.getYear()).append("_").append(entity.getMonth()).append("_");
|
|
|
+ }
|
|
|
+ responsibilityCode.append(evaluationRule.getOrganizationId()).append("_");
|
|
|
|
|
|
|
|
|
- QueryWrapper<DeptResponsibility> qw = new QueryWrapper();
|
|
|
if (null != entity && (null == entity.getId() || "".equals(entity.getId().trim()))) {
|
|
|
- qw.lambda().eq(DeptResponsibility::getOrganizationId, entity.getOrganizationId());
|
|
|
- qw.lambda().eq(DeptResponsibility::getCheckCycle, entity.getCheckCycle());
|
|
|
- qw.lambda().eq(DeptResponsibility::getYear, entity.getYear());
|
|
|
- List<DeptResponsibility> list = baseMapper.selectList(qw);
|
|
|
- if (null != list && list.size() > 0) {
|
|
|
+ if (null != oriList && oriList.size() > 0) {
|
|
|
throw new CustomException("此单位在该阶段已存在目标责任书");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ entity.setResponsibilityCode(responsibilityCode.toString());
|
|
|
+ entity.setOrganizationId(evaluationRule.getOrganizationId());
|
|
|
+ entity.setOrganizationName(evaluationRule.getOrganizationName());
|
|
|
+ entity.setCheckCycle(evaluationRule.getEvaluationCycle());
|
|
|
+ entity.setStage("流程未启动");
|
|
|
entity.setCreateTime(new Date());
|
|
|
} else {
|
|
|
+ DeptResponsibility update = baseMapper.selectById(entity.getId());
|
|
|
+ if (null != oriList && oriList.size() > 1 && !update.getId().equals(oriList.get(0).getId())) {
|
|
|
+ throw new CustomException("编辑记录未找到");
|
|
|
+ }
|
|
|
+ entity.setOrganizationId(evaluationRule.getOrganizationId());
|
|
|
+ entity.setOrganizationName(evaluationRule.getOrganizationName());
|
|
|
+ entity.setCheckCycle(evaluationRule.getEvaluationCycle());
|
|
|
entity.setUpdateTime(new Date());
|
|
|
}
|
|
|
-
|
|
|
boolean b = super.saveOrUpdate(entity);
|
|
|
-
|
|
|
return b;
|
|
|
}
|
|
|
|