|
@@ -5,11 +5,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ims.common.utils.DateUtils;
|
|
|
import com.ims.common.utils.StringUtils;
|
|
|
+import com.ims.eval.cache.CacheContext;
|
|
|
import com.ims.eval.config.CustomException;
|
|
|
import com.ims.eval.dao.ResponsibilityIndicatorInfoMapper;
|
|
|
import com.ims.eval.entity.*;
|
|
|
import com.ims.eval.dao.DeptResponsibilityMapper;
|
|
|
import com.ims.eval.entity.dto.response.DeptResponsibilityResDTO;
|
|
|
+import com.ims.eval.entity.dto.response.IndicatorResDTO;
|
|
|
import com.ims.eval.entity.dto.response.ResponsibilityIndicatorInfoResDTO;
|
|
|
import com.ims.eval.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -78,7 +80,7 @@ public class DeptResponsibilityServiceImpl extends ServiceImpl<DeptResponsibilit
|
|
|
private IUserService userService;
|
|
|
|
|
|
@Override
|
|
|
- public IPage<DeptResponsibility> list(Integer pageNum, Integer pageSize, String id, String responsibilityCode,String cycleUnit, List<String> checkCycle, String beginDate, String endDate, String stage, String createBy, String year, String month,String des) {
|
|
|
+ public IPage<DeptResponsibility> list(Integer pageNum, Integer pageSize, String id, String responsibilityCode, String cycleUnit, List<String> checkCycle, String beginDate, String endDate, String stage, String createBy, String year, String month, String des) {
|
|
|
|
|
|
QueryWrapper<DeptResponsibility> qw = new QueryWrapper<>();
|
|
|
if (null == pageNum || null == pageSize) {
|
|
@@ -153,70 +155,99 @@ public class DeptResponsibilityServiceImpl extends ServiceImpl<DeptResponsibilit
|
|
|
if (infcount > 0) {
|
|
|
throw new CustomException("编号" + oriResponsibility.getResponsibilityCode() + "的责任书已启动;不允许重复操作");
|
|
|
}
|
|
|
-
|
|
|
oriResponsibility.setStage("流程启动");
|
|
|
baseMapper.updateById(oriResponsibility);
|
|
|
|
|
|
- List<String> evaluationRuleIds = Arrays.asList(oriResponsibility.getOrganizationEvaluationRuleId().split(","));
|
|
|
-
|
|
|
- for (String ruleId : evaluationRuleIds) {
|
|
|
- //获取指定部门的规则
|
|
|
- OrganizationEvaluationRule evaluationRule = organizationEvaluationRuleService.getById(ruleId);
|
|
|
- if (null == evaluationRule) {
|
|
|
- throw new CustomException("不存在此单位权重配置");
|
|
|
+ String organizationType = oriResponsibility.getOrganizationType();//考评类型 DWKP
|
|
|
+ String checkCycle = oriResponsibility.getCheckCycle();//考评周期-月度、季度
|
|
|
+ String year = oriResponsibility.getYear();//年份
|
|
|
+
|
|
|
+ //查询当前周期下对应的考评权重(需要考评的单位)
|
|
|
+ List<OrganizationEvaluationRule> evaluationRules = organizationEvaluationRuleService.getOrganizationEvaluationRuleByYearAndCycle(organizationType, checkCycle, year, "");
|
|
|
+
|
|
|
+ //遍历考核的单位
|
|
|
+ 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(), "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获取对应的规则明细
|
|
|
+ if (ruleIds.size() <= 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
List<EvaluateRuleInfo> ruleInfos = evaluateRuleInfoService.list(ruleIds);
|
|
|
if (null == ruleInfos || ruleInfos.size() <= 0) {
|
|
|
-// throw new CustomException("规则明细配置为空");
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//获取考评规则中的指标id
|
|
|
List<String> indicatorIds = ruleInfos.stream().map(EvaluateRuleInfo::getIndicatorId).collect(Collectors.toList());
|
|
|
|
|
|
//获取指标对象
|
|
|
- List<Indicator> indicators = iIndicatorService.selectByIds(indicatorIds);
|
|
|
-
|
|
|
- /*** 目标目标责任书默认生成目标值 ZRMB ***/
|
|
|
- indicators.stream().forEach(i -> {
|
|
|
+ List<IndicatorResDTO> indicators = iIndicatorService.getGroupChildCodeByIds(indicatorIds);
|
|
|
+ if (null == indicators || indicators.size() <= 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<ResponsibilityIndicatorInfo> infoList = new ArrayList<>();
|
|
|
+ for (IndicatorResDTO dto : indicators) {
|
|
|
ResponsibilityIndicatorInfo info = new ResponsibilityIndicatorInfo();
|
|
|
info.setDeptResponsibilityId(oriResponsibility.getId());
|
|
|
- info.setOrganizationEvaluationRuleId(ruleId);
|
|
|
- info.setIndicatorId(i.getId());
|
|
|
- info.setIndicatorDictionaryId(null);
|
|
|
- info.setOptionCode("ZRMB");
|
|
|
- info.setIsQuantified(i.getIsQuantified());
|
|
|
- info.setState("-1");
|
|
|
+ info.setOrganizationEvaluationRuleId(evaluationRule.getId());
|
|
|
+ info.setIndicatorId(dto.getIndicatorId());
|
|
|
+ info.setChildCode(dto.getChildCode());
|
|
|
+ info.setDeptId(dto.getDeptId());
|
|
|
+ info.setIndicatorDictionaryId(dto.getId());
|
|
|
+ info.setOptionCode(dto.getOptionCode());
|
|
|
+ info.setIsQuantified(dto.getIsQuantified());
|
|
|
info.setCreateTime(new Date());
|
|
|
- info.setDeptId(i.getDeptId());
|
|
|
- boolean b2 = responsibilityIndicatorInfoService.saveOrUpdate(info);
|
|
|
- if (!b2) {
|
|
|
- throw new CustomException("初始化目标责任书明细失败");
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ info.setState("0");
|
|
|
+ info.setOrganizationId(evaluationRule.getOrganizationId());
|
|
|
+ infoList.add(info);
|
|
|
|
|
|
+ }
|
|
|
+ boolean b2 = responsibilityIndicatorInfoService.saveOrUpdateBatch(infoList);
|
|
|
+ if (!b2) {
|
|
|
+ throw new CustomException("初始化明细失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ oriResponsibility.setStage("流程启动");
|
|
|
+ baseMapper.updateById(oriResponsibility);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
- public DeptResponsibilityResDTO getByidAndInfo(String id, String dept,HttpServletRequest request) {
|
|
|
+ public DeptResponsibilityResDTO getByidAndInfo(String id, String dept, HttpServletRequest request) {
|
|
|
DeptResponsibilityResDTO resDTO = baseMapper.selectById(id);
|
|
|
|
|
|
- Map<String, List<ResponsibilityIndicatorInfoResDTO>> map = responsibilityIndicatorInfoService.planValueList(Arrays.asList(id), dept,request);
|
|
|
- if(null != resDTO){
|
|
|
+ Map<String, List<ResponsibilityIndicatorInfoResDTO>> map = responsibilityIndicatorInfoService.planValueList(Arrays.asList(id), dept, request);
|
|
|
+ if (null != resDTO) {
|
|
|
resDTO.setMap(map);
|
|
|
}
|
|
|
|
|
@@ -233,10 +264,10 @@ public class DeptResponsibilityServiceImpl extends ServiceImpl<DeptResponsibilit
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean editState(String id, String state,String instId) {
|
|
|
+ public boolean editState(String id, String state, String instId) {
|
|
|
DeptResponsibility responsibility = baseMapper.selectById(id);
|
|
|
if (StringUtils.isNotEmpty(state)) {
|
|
|
- if("任务书签订".equals(state)){
|
|
|
+ if ("任务书签订".equals(state)) {
|
|
|
state = "流程结束";
|
|
|
}
|
|
|
responsibility.setStage(state);
|
|
@@ -270,7 +301,7 @@ public class DeptResponsibilityServiceImpl extends ServiceImpl<DeptResponsibilit
|
|
|
if ("NDKP".equals(entity.getCheckCycle())) {
|
|
|
oriList = list("", entity.getCheckCycle(), entity.getYear(), "");
|
|
|
responsibilityCode.append(entity.getYear()).append("_");
|
|
|
- responsibilityCode.append(StringUtils.addZeroForStr(String.valueOf(oriList.size()+1), 4, "l"));
|
|
|
+ responsibilityCode.append(StringUtils.addZeroForStr(String.valueOf(oriList.size() + 1), 4, "l"));
|
|
|
}
|
|
|
if ("JDKP".equals(entity.getCheckCycle())) {
|
|
|
Date newDate = DateUtils.toDate(entity.getYear() + "-" + entity.getMonth() + "-01");
|
|
@@ -279,13 +310,13 @@ public class DeptResponsibilityServiceImpl extends ServiceImpl<DeptResponsibilit
|
|
|
oriList = list("", entity.getCheckCycle(), entity.getYear(), month);
|
|
|
List<DeptResponsibility> 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"));
|
|
|
+ responsibilityCode.append(StringUtils.addZeroForStr(String.valueOf(count.size() + 1), 4, "l"));
|
|
|
}
|
|
|
if ("YDKP".equals(entity.getCheckCycle())) {
|
|
|
oriList = list("", entity.getCheckCycle(), entity.getYear(), entity.getMonth());
|
|
|
responsibilityCode.append(entity.getYear()).append("_").append(entity.getMonth()).append("_");
|
|
|
List<DeptResponsibility> count = list("", entity.getCheckCycle(), entity.getYear(), "");
|
|
|
- responsibilityCode.append(StringUtils.addZeroForStr(String.valueOf(count.size()+1), 4, "l"));
|
|
|
+ responsibilityCode.append(StringUtils.addZeroForStr(String.valueOf(count.size() + 1), 4, "l"));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -361,7 +392,7 @@ public class DeptResponsibilityServiceImpl extends ServiceImpl<DeptResponsibilit
|
|
|
|
|
|
@Override
|
|
|
public DeptResponsibility getDeptResponsibility(String id) {
|
|
|
- if(StringUtils.isEmpty(id)){
|
|
|
+ if (StringUtils.isEmpty(id)) {
|
|
|
return null;
|
|
|
}
|
|
|
DeptResponsibility res = this.getById(id);
|