|
|
|
@ -168,11 +168,14 @@ public class KpiRuleServiceImpl extends BaseServiceImpl<KpiRuleDao, KpiRuleEntit |
|
|
|
} |
|
|
|
KpiRuleEntity entity = ConvertUtils.sourceToTarget(dto, KpiRuleEntity.class); |
|
|
|
insert(entity); |
|
|
|
List<KpiRuleParamDTO> ruleParamList = dto.getRuleParamList(); |
|
|
|
for (KpiRuleParamDTO kpiRuleParamDTO : ruleParamList) { |
|
|
|
kpiRuleParamDTO.setRuleId(entity.getId()); |
|
|
|
KpiRuleParamEntity kpiRuleParamEntity = ConvertUtils.sourceToTarget(kpiRuleParamDTO, KpiRuleParamEntity.class); |
|
|
|
kpiRuleParamDao.insert(kpiRuleParamEntity); |
|
|
|
//logger.info("规则表主键="+entity.getId());
|
|
|
|
// 元公式需要设置参数
|
|
|
|
if ("0".equals(dto.getRuleMode())) { |
|
|
|
for (KpiRuleParamDTO kpiRuleParamDTO : dto.getRuleParamList()) { |
|
|
|
kpiRuleParamDTO.setRuleId(entity.getId()); |
|
|
|
KpiRuleParamEntity kpiRuleParamEntity = ConvertUtils.sourceToTarget(kpiRuleParamDTO, KpiRuleParamEntity.class); |
|
|
|
kpiRuleParamDao.insert(kpiRuleParamEntity); |
|
|
|
} |
|
|
|
} |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
@ -193,20 +196,27 @@ public class KpiRuleServiceImpl extends BaseServiceImpl<KpiRuleDao, KpiRuleEntit |
|
|
|
} |
|
|
|
KpiRuleEntity entity = ConvertUtils.sourceToTarget(dto, KpiRuleEntity.class); |
|
|
|
updateById(entity); |
|
|
|
//logger.info("规则表主键="+entity.getId());
|
|
|
|
//全部删除参数记录表
|
|
|
|
int deleteResultNum = kpiRuleParamDao.deleteByRuleId(entity.getId()); |
|
|
|
List<KpiRuleParamDTO> ruleParamList = dto.getRuleParamList(); |
|
|
|
for (KpiRuleParamDTO kpiRuleParamDTO : ruleParamList) { |
|
|
|
kpiRuleParamDTO.setId(null); |
|
|
|
kpiRuleParamDTO.setRuleId(entity.getId()); |
|
|
|
kpiRuleParamService.save(kpiRuleParamDTO); |
|
|
|
if ("0".equals(dto.getRuleMode())) { |
|
|
|
for (KpiRuleParamDTO kpiRuleParamDTO : dto.getRuleParamList()) { |
|
|
|
kpiRuleParamDTO.setId(null); |
|
|
|
kpiRuleParamDTO.setRuleId(entity.getId()); |
|
|
|
kpiRuleParamService.save(kpiRuleParamDTO); |
|
|
|
} |
|
|
|
} |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
public Result checkKpiRuleSaveOrUpdateFormDTO(KpiRuleSaveOrUpdateFormDTO dto) { |
|
|
|
if (("0").equals(dto.getRuleMode())) { |
|
|
|
//是否缺少参数
|
|
|
|
KpiFormulaEntity kpiFormulaEntity = kpiFormulaDao.selectById(dto.getReferenceId()); |
|
|
|
if ((null == dto.getRuleParamList() || dto.getRuleParamList().size() == 0) |
|
|
|
&& kpiFormulaEntity.getParamAmount() > 0) { |
|
|
|
return new Result().error("请选择元公式入参"); |
|
|
|
} |
|
|
|
if (kpiFormulaEntity.getParamAmount() != dto.getRuleParamList().size()) { |
|
|
|
return new Result().error("公式缺少入参"); |
|
|
|
} |
|
|
|
@ -221,4 +231,19 @@ public class KpiRuleServiceImpl extends BaseServiceImpl<KpiRuleDao, KpiRuleEntit |
|
|
|
} |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param referenceIds |
|
|
|
* @return java.util.List<com.elink.esua.epdc.entity.KpiRuleEntity> |
|
|
|
* @Author yinzuomei |
|
|
|
* @Description 根据引用id查询考核规则表记录 |
|
|
|
* @Date 2019/12/2 15:00 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public List<KpiRuleEntity> listKpiRuleEntityByRereferenceId(String[] referenceIds) { |
|
|
|
QueryWrapper<KpiRuleEntity> kpiRuleEntityQueryWrapper = new QueryWrapper<>(); |
|
|
|
kpiRuleEntityQueryWrapper.in("reference_id", referenceIds); |
|
|
|
List<KpiRuleEntity> kpiRuleEntityList = baseDao.selectList(kpiRuleEntityQueryWrapper); |
|
|
|
return kpiRuleEntityList; |
|
|
|
} |
|
|
|
} |
|
|
|
|