|
@@ -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();
|
|
|
+// DeptResponsibility responsibility = new DeptResponsibility();
|
|
|
//责任书指标详情记录集合
|
|
|
//List<ResponsibilityIndicatorInfo> indicatorInfolist = new ArrayList<>();
|
|
|
|
|
|
- Date newDate;
|
|
|
- //获取当前时间
|
|
|
- if (StringUtils.isEmpty(date)) {
|
|
|
- newDate = DateUtils.getCurrentDate();
|
|
|
- } else {
|
|
|
- newDate = DateUtils.toDate(date);
|
|
|
- }
|
|
|
+// 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));//获取月份
|
|
|
+// 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("已存在该单位目标责任书");
|
|
|
+// }
|
|
|
|
|
|
- //判断该是否存在目标责任书
|
|
|
- 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());//考评组织ID
|
|
|
- responsibility.setOrganizationName(evaluationRule.getOrganizationName());//考评组织名称
|
|
|
- responsibility.setCheckCycle(evaluationRule.getEvaluationCycle());//考评周期
|
|
|
- responsibility.setYear(year);//年份
|
|
|
- responsibility.setMonth(month);//月份
|
|
|
- responsibility.setOrganizationEvaluationRuleId(evaluationRule.getId());//考评规则id
|
|
|
- //responsibility.setBeginDate(null);
|
|
|
- //responsibility.setEndDate(null);
|
|
|
- responsibility.setStage("流程未启动");
|
|
|
- responsibility.setCreateTime(new Date());
|
|
|
- //responsibility.setCreateBy("");
|
|
|
-
|
|
|
- boolean b = super.saveOrUpdate(responsibility);
|
|
|
- if (!b) {
|
|
|
- throw new CustomException("保存目标责任书失败");
|
|
|
- }
|
|
|
+// //保存目标责任书
|
|
|
+// responsibility.setOrganizationId(evaluationRule.getOrganizationId());//考评组织ID
|
|
|
+// responsibility.setOrganizationName(evaluationRule.getOrganizationName());//考评组织名称
|
|
|
+// responsibility.setCheckCycle(evaluationRule.getEvaluationCycle());//考评周期
|
|
|
+// responsibility.setYear(year);//年份
|
|
|
+// responsibility.setMonth(month);//月份
|
|
|
+// responsibility.setOrganizationEvaluationRuleId(evaluationRule.getId());//考评规则id
|
|
|
+// //responsibility.setBeginDate(null);
|
|
|
+// //responsibility.setEndDate(null);
|
|
|
+// responsibility.setStage("流程未启动");
|
|
|
+// responsibility.setCreateTime(new Date());
|
|
|
+// //responsibility.setCreateBy("");
|
|
|
+//
|
|
|
+// 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("不存在此单位权重配置");
|
|
|
+ }
|
|
|
|
|
|
-// DeptResponsibility responsibility = new DeptResponsibility();
|
|
|
-//
|
|
|
-// //获取指定部门的规则
|
|
|
-// OrganizationEvaluationRule evaluationRule = organizationEvaluationRuleService.getById(orgEvalRuleId);
|
|
|
-// if (null == evaluationRule) {
|
|
|
-// throw new CustomException("不存在此单位权重配置");
|
|
|
-// }
|
|
|
-// 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));//获取月份
|
|
|
-// //保存目标责任书
|
|
|
-// responsibility.setOrganizationId(evaluationRule.getOrganizationId());//考评组织ID
|
|
|
-// responsibility.setOrganizationName(evaluationRule.getOrganizationName());//考评组织名称
|
|
|
-// responsibility.setCheckCycle(evaluationRule.getEvaluationCycle());//考评周期
|
|
|
-// responsibility.setYear(year);//年份
|
|
|
-// responsibility.setMonth(month);//月份
|
|
|
-// responsibility.setOrganizationEvaluationRuleId(evaluationRule.getId());//考评规则id
|
|
|
-// //responsibility.setBeginDate(null);
|
|
|
-// //responsibility.setEndDate(null);
|
|
|
-// responsibility.setStage("流程未启动");
|
|
|
-// responsibility.setCreateTime(new Date());
|
|
|
-// //responsibility.setCreateBy("");
|
|
|
-//
|
|
|
-// boolean b = super.saveOrUpdate(responsibility);
|
|
|
-// if (!b) {
|
|
|
-// 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());//考评组织ID
|
|
|
+ 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());//考评组织ID
|
|
|
+ entity.setOrganizationName(evaluationRule.getOrganizationName());//考评组织名称
|
|
|
+ entity.setCheckCycle(evaluationRule.getEvaluationCycle());//考评周期
|
|
|
entity.setUpdateTime(new Date());
|
|
|
}
|
|
|
-
|
|
|
boolean b = super.saveOrUpdate(entity);
|
|
|
-
|
|
|
return b;
|
|
|
}
|
|
|
|