|
@@ -0,0 +1,464 @@
|
|
|
+package com.ims.eval.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+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.config.CustomException;
|
|
|
+import com.ims.eval.dao.ResponsibilityIndicatorInfoMapper;
|
|
|
+import com.ims.eval.entity.*;
|
|
|
+import com.ims.eval.dao.OrganizationEvaluationMapper;
|
|
|
+import com.ims.eval.entity.dto.response.IndicatorResDTO;
|
|
|
+import com.ims.eval.service.*;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 单位/部门考评记录 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author wang
|
|
|
+ * @since 2023-03-16
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class OrganizationEvaluationServiceImpl extends ServiceImpl<OrganizationEvaluationMapper, OrganizationEvaluation> implements IOrganizationEvaluationService {
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 指标主业务类
|
|
|
+ */
|
|
|
+ @Autowired
|
|
|
+ private IIndicatorService iIndicatorService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 指标子业务类
|
|
|
+ */
|
|
|
+ @Autowired
|
|
|
+ private IIndicatorDictionaryService indicatorDictionaryService;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 单位/部门考评配置业务类
|
|
|
+ */
|
|
|
+ @Autowired
|
|
|
+ private IOrganizationEvaluationRuleService organizationEvaluationRuleService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 考评规则业务类
|
|
|
+ */
|
|
|
+ @Autowired
|
|
|
+ private IEvaluateRuleService evaluateRuleService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 考评规则明细业务类
|
|
|
+ */
|
|
|
+ @Autowired
|
|
|
+ private IEvaluateRuleInfoService evaluateRuleInfoService;
|
|
|
+
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ResponsibilityIndicatorInfoMapper responsibilityIndicatorInfoMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IOrganizationEvaluationInfoService organizationEvaluationInfoService;
|
|
|
+
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IDeptResponsibilityService deptResponsibilityService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IResponsibilityIndicatorInfoService responsibilityIndicatorInfoService;
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IPage<OrganizationEvaluation> list(Integer pageNum, Integer pageSize, String id, String organizationEvaluationCode, List<String> checkCycle, String beginDate, String endDate, String stage, String createBy, String year, String month, String des) {
|
|
|
+ QueryWrapper<OrganizationEvaluation> qw = new QueryWrapper<>();
|
|
|
+ if (null == pageNum || null == pageSize) {
|
|
|
+ throw new CustomException("分页参数为空");
|
|
|
+ }
|
|
|
+ //构造分页构造器
|
|
|
+ Page<OrganizationEvaluation> page = new Page<>(pageNum, pageSize);
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(id)) {
|
|
|
+ qw.lambda().eq(OrganizationEvaluation::getId, id);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(organizationEvaluationCode)) {
|
|
|
+ qw.lambda().like(OrganizationEvaluation::getOrganizationEvaluationCode, organizationEvaluationCode);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(checkCycle)) {
|
|
|
+ qw.lambda().in(OrganizationEvaluation::getCheckCycle, checkCycle);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(beginDate) && StringUtils.isNotEmpty(endDate)) {
|
|
|
+ qw.lambda().ge(OrganizationEvaluation::getBeginDate, beginDate);
|
|
|
+ qw.lambda().le(OrganizationEvaluation::getEndDate, endDate);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(stage)) {
|
|
|
+ qw.lambda().eq(OrganizationEvaluation::getStage, stage);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(createBy)) {
|
|
|
+ qw.lambda().eq(OrganizationEvaluation::getCreateBy, createBy);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(createBy)) {
|
|
|
+ qw.lambda().eq(OrganizationEvaluation::getCreateBy, createBy);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(year)) {
|
|
|
+ qw.lambda().eq(OrganizationEvaluation::getYear, year);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(month)) {
|
|
|
+ qw.lambda().eq(OrganizationEvaluation::getMonth, month);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(des)) {
|
|
|
+ qw.lambda().like(OrganizationEvaluation::getDes, des);
|
|
|
+ }
|
|
|
+
|
|
|
+ qw.lambda().orderByDesc(OrganizationEvaluation::getCreateTime);
|
|
|
+
|
|
|
+ IPage<OrganizationEvaluation> list = baseMapper.selectPage(page, qw);
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ 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)) {
|
|
|
+ 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 ("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"));
|
|
|
+ }
|
|
|
+ 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 ("YDKP".equals(entity.getCheckCycle())) {
|
|
|
+ oriList = list("", entity.getCheckCycle(), entity.getYear(), entity.getMonth());
|
|
|
+ responsibilityCode.append(entity.getYear()).append("_").append(entity.getMonth()).append("_");
|
|
|
+ List<OrganizationEvaluation> count = list("", entity.getCheckCycle(), entity.getYear(), "");
|
|
|
+ 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) {
|
|
|
+
|
|
|
+ for (String id :ids) {
|
|
|
+ OrganizationEvaluation organizationEvaluation = baseMapper.selectById(id);
|
|
|
+ if (null == organizationEvaluation) {
|
|
|
+ throw new CustomException("不存在考评记录");
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询对应年度的目标责任书
|
|
|
+ List<DeptResponsibility> responsibilities = deptResponsibilityService.list("", organizationEvaluation.getCheckCycle(), organizationEvaluation.getYear(), "");
|
|
|
+ if (null == responsibilities || responsibilities.size() <= 0) {
|
|
|
+ throw new CustomException("该年度的目标责任书不存在");
|
|
|
+ }
|
|
|
+ DeptResponsibility deptResponsibility = responsibilities.get(0);
|
|
|
+
|
|
|
+ //检查是否已经启动考评
|
|
|
+ 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(","));
|
|
|
+
|
|
|
+ for (String ruleId : evaluationRuleIds) {
|
|
|
+
|
|
|
+ //获取指定部门的规则
|
|
|
+ OrganizationEvaluationRule evaluationRule = organizationEvaluationRuleService.getById(ruleId);
|
|
|
+ if (null == evaluationRule) {
|
|
|
+ throw new CustomException("不存在此单位规则权重配置");
|
|
|
+ }
|
|
|
+ //获取对应的考评规(至少存在一条)
|
|
|
+ List<String> evaluateRuleIds = Arrays.asList(evaluationRule.getEvaluateRuleId().split(","));
|
|
|
+ List<EvaluateRule> evaluateRuleList = evaluateRuleService.listAll(evaluateRuleIds);
|
|
|
+ if (null == evaluateRuleList || evaluateRuleList.size() <= 0) {
|
|
|
+ throw new CustomException("未获取到配置的规则");
|
|
|
+ }
|
|
|
+ //获取考评规则的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("规则明细配置为空");
|
|
|
+ }
|
|
|
+ //获取考评规则中的指标id
|
|
|
+ List<String> indicatorIds = ruleInfos.stream().map(EvaluateRuleInfo::getIndicatorId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //获取指标对象
|
|
|
+ List<Indicator> indicators = iIndicatorService.selectByIds(indicatorIds);
|
|
|
+ //通过指标id获取指标明细项
|
|
|
+ List<IndicatorResDTO> resDTOS = iIndicatorService.listByIds(indicatorIds);
|
|
|
+ if (null == resDTOS || resDTOS.size() <= 0) {
|
|
|
+ throw new CustomException("指标规则明细项为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ //对应指标的目标值
|
|
|
+ Map<String, Object> objectMap = responsibilityIndicatorInfoService.getResponsibilityIdMap(deptResponsibility.getId());
|
|
|
+
|
|
|
+ resDTOS.stream().forEach(r -> {
|
|
|
+ OrganizationEvaluationInfo info = new OrganizationEvaluationInfo();
|
|
|
+ info.setOrganizationEvaluationId(organizationEvaluation.getId());
|
|
|
+ info.setIndicatorId(r.getId());
|
|
|
+ info.setIndicatorDictionaryId(r.getIndicatorDictionaryID());
|
|
|
+ info.setOptionCode(r.getOptionCode());
|
|
|
+ info.setIsQuantified(r.getIsQuantified());
|
|
|
+ //
|
|
|
+ if ("JHZ".equals(r.getOptionCode()) || "MBZ".equals(r.getOptionCode()) || "DBZ".equals(r.getOptionCode())) {
|
|
|
+ if(null != objectMap.get(r.getId())){
|
|
|
+ if ("是".equals(r.getIsQuantified())) {
|
|
|
+ info.setQuantifiedValue(null == objectMap.get(r.getId()) ? null :Double.valueOf(objectMap.get(r.getId()).toString()));
|
|
|
+ } else {
|
|
|
+ info.setNonQuantifiedValue(null == objectMap.get(r.getId()) ?null :objectMap.get(r.getId()).toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ info.setCreateTime(new Date());
|
|
|
+ boolean b2 = organizationEvaluationInfoService.saveOrUpdate(info);
|
|
|
+ if (!b2) {
|
|
|
+ throw new CustomException("初始化目标责任书明细失败");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public boolean generateUnitMonthEvaluation(List<String> ids) {
|
|
|
+
|
|
|
+ for (String id :ids) {
|
|
|
+ OrganizationEvaluation organizationEvaluation = baseMapper.selectById(id);
|
|
|
+ if (null == organizationEvaluation) {
|
|
|
+ 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(","));
|
|
|
+
|
|
|
+ for (String ruleId : evaluationRuleIds) {
|
|
|
+
|
|
|
+ //获取指定部门的规则
|
|
|
+ OrganizationEvaluationRule evaluationRule = organizationEvaluationRuleService.getById(ruleId);
|
|
|
+ if (null == evaluationRule) {
|
|
|
+ throw new CustomException("不存在此单位规则权重配置");
|
|
|
+ }
|
|
|
+ //获取对应的考评规(至少存在一条)
|
|
|
+ List<String> evaluateRuleIds = Arrays.asList(evaluationRule.getEvaluateRuleId().split(","));
|
|
|
+ List<EvaluateRule> evaluateRuleList = evaluateRuleService.listAll(evaluateRuleIds);
|
|
|
+ if (null == evaluateRuleList || evaluateRuleList.size() <= 0) {
|
|
|
+ throw new CustomException("未获取到配置的规则");
|
|
|
+ }
|
|
|
+ //获取考评规则的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("规则明细配置为空");
|
|
|
+ }
|
|
|
+ //获取考评规则中的指标id
|
|
|
+ List<String> indicatorIds = ruleInfos.stream().map(EvaluateRuleInfo::getIndicatorId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //通过指标id获取指标明细项
|
|
|
+ List<IndicatorResDTO> resDTOS = iIndicatorService.listByIds(indicatorIds);
|
|
|
+ if (null == resDTOS || resDTOS.size() <= 0) {
|
|
|
+ throw new CustomException("指标规则明细项为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ resDTOS.stream().forEach(r -> {
|
|
|
+ OrganizationEvaluationInfo info = new OrganizationEvaluationInfo();
|
|
|
+ info.setOrganizationEvaluationId(organizationEvaluation.getId());
|
|
|
+ info.setIndicatorId(r.getId());
|
|
|
+ info.setIndicatorDictionaryId(r.getIndicatorDictionaryID());
|
|
|
+ info.setOptionCode(r.getOptionCode());
|
|
|
+ info.setIsQuantified(r.getIsQuantified());
|
|
|
+ info.setCreateTime(new Date());
|
|
|
+ boolean b2 = organizationEvaluationInfoService.saveOrUpdate(info);
|
|
|
+ if (!b2) {
|
|
|
+ throw new CustomException("初始化目标责任书明细失败");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public boolean generateUnitSeasonEvaluation(List<String> ids) {
|
|
|
+
|
|
|
+
|
|
|
+ for (String id :ids) {
|
|
|
+ OrganizationEvaluation organizationEvaluation = baseMapper.selectById(id);
|
|
|
+ if (null == organizationEvaluation) {
|
|
|
+ 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(","));
|
|
|
+
|
|
|
+ for (String ruleId : evaluationRuleIds) {
|
|
|
+
|
|
|
+ //获取指定部门的规则
|
|
|
+ OrganizationEvaluationRule evaluationRule = organizationEvaluationRuleService.getById(ruleId);
|
|
|
+ if (null == evaluationRule) {
|
|
|
+ throw new CustomException("不存在此单位规则权重配置");
|
|
|
+ }
|
|
|
+ //获取对应的考评规(至少存在一条)
|
|
|
+ List<String> evaluateRuleIds = Arrays.asList(evaluationRule.getEvaluateRuleId().split(","));
|
|
|
+ List<EvaluateRule> evaluateRuleList = evaluateRuleService.listAll(evaluateRuleIds);
|
|
|
+ if (null == evaluateRuleList || evaluateRuleList.size() <= 0) {
|
|
|
+ throw new CustomException("未获取到配置的规则");
|
|
|
+ }
|
|
|
+ //获取考评规则的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("规则明细配置为空");
|
|
|
+ }
|
|
|
+ //获取考评规则中的指标id
|
|
|
+ List<String> indicatorIds = ruleInfos.stream().map(EvaluateRuleInfo::getIndicatorId).collect(Collectors.toList());
|
|
|
+
|
|
|
+
|
|
|
+ //通过指标id获取指标明细项
|
|
|
+ List<IndicatorResDTO> resDTOS = iIndicatorService.listByIds(indicatorIds);
|
|
|
+ if (null == resDTOS || resDTOS.size() <= 0) {
|
|
|
+ throw new CustomException("指标规则明细项为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ resDTOS.stream().forEach(r -> {
|
|
|
+ OrganizationEvaluationInfo info = new OrganizationEvaluationInfo();
|
|
|
+ info.setOrganizationEvaluationId(organizationEvaluation.getId());
|
|
|
+ info.setIndicatorId(r.getId());
|
|
|
+ info.setIndicatorDictionaryId(r.getIndicatorDictionaryID());
|
|
|
+ info.setOptionCode(r.getOptionCode());
|
|
|
+ info.setIsQuantified(r.getIsQuantified());
|
|
|
+ info.setCreateTime(new Date());
|
|
|
+ boolean b2 = organizationEvaluationInfoService.saveOrUpdate(info);
|
|
|
+ if (!b2) {
|
|
|
+ throw new CustomException("初始化目标责任书明细失败");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<OrganizationEvaluation> list(String organizationId, String checkCycle, String year, String month) {
|
|
|
+ QueryWrapper<OrganizationEvaluation> qw = new QueryWrapper<>();
|
|
|
+ if (StringUtils.isNotEmpty(organizationId)) {
|
|
|
+ qw.lambda().eq(OrganizationEvaluation::getOrganizationId, organizationId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(checkCycle)) {
|
|
|
+ qw.lambda().eq(OrganizationEvaluation::getCheckCycle, checkCycle);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(year)) {
|
|
|
+ qw.lambda().eq(OrganizationEvaluation::getYear, year);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(month)) {
|
|
|
+ qw.lambda().in(OrganizationEvaluation::getMonth, month);
|
|
|
+ }
|
|
|
+ List<OrganizationEvaluation> list = baseMapper.selectList(qw);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+}
|