|
|
@ -23,11 +23,15 @@ import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
import com.elink.esua.epdc.dao.KpiManualScoreDao; |
|
|
import com.elink.esua.epdc.dao.KpiManualScoreDao; |
|
|
import com.elink.esua.epdc.dto.KpiManualScoreDTO; |
|
|
import com.elink.esua.epdc.dto.KpiManualScoreDTO; |
|
|
|
|
|
import com.elink.esua.epdc.dto.result.KpiManualScoreDictResultDTO; |
|
|
import com.elink.esua.epdc.entity.KpiManualScoreEntity; |
|
|
import com.elink.esua.epdc.entity.KpiManualScoreEntity; |
|
|
|
|
|
import com.elink.esua.epdc.entity.KpiRuleEntity; |
|
|
import com.elink.esua.epdc.redis.KpiManualScoreRedis; |
|
|
import com.elink.esua.epdc.redis.KpiManualScoreRedis; |
|
|
import com.elink.esua.epdc.service.KpiManualScoreService; |
|
|
import com.elink.esua.epdc.service.KpiManualScoreService; |
|
|
|
|
|
import com.elink.esua.epdc.service.KpiRuleService; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
@ -48,7 +52,8 @@ public class KpiManualScoreServiceImpl extends BaseServiceImpl<KpiManualScoreDao |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private KpiManualScoreRedis kpiManualScoreRedis; |
|
|
private KpiManualScoreRedis kpiManualScoreRedis; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private KpiRuleService kpiRuleService; |
|
|
@Override |
|
|
@Override |
|
|
public PageData<KpiManualScoreDTO> page(Map<String, Object> params) { |
|
|
public PageData<KpiManualScoreDTO> page(Map<String, Object> params) { |
|
|
String scoreName=params.containsKey("scoreName")?params.get("scoreName").toString():null; |
|
|
String scoreName=params.containsKey("scoreName")?params.get("scoreName").toString():null; |
|
|
@ -92,16 +97,39 @@ public class KpiManualScoreServiceImpl extends BaseServiceImpl<KpiManualScoreDao |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void update(KpiManualScoreDTO dto) { |
|
|
public Result update(KpiManualScoreDTO dto) { |
|
|
KpiManualScoreEntity entity = ConvertUtils.sourceToTarget(dto, KpiManualScoreEntity.class); |
|
|
KpiManualScoreEntity entity = ConvertUtils.sourceToTarget(dto, KpiManualScoreEntity.class); |
|
|
|
|
|
//根据id去查询epdc_kpi_rule表,如果存在记录,需要同步更新考核周期、考核部门
|
|
|
|
|
|
String referenceIds[] = new String[1]; |
|
|
|
|
|
referenceIds[0] = dto.getId(); |
|
|
|
|
|
List<KpiRuleEntity> kpiRuleEntityList = kpiRuleService.listKpiRuleEntityByRereferenceId(referenceIds); |
|
|
|
|
|
if (null != kpiRuleEntityList && kpiRuleEntityList.size() > 0) { |
|
|
|
|
|
for (KpiRuleEntity kpiRuleEntity : kpiRuleEntityList) { |
|
|
|
|
|
kpiRuleEntity.setDeptTypeKey(dto.getDeptTypeKey()); |
|
|
|
|
|
kpiRuleEntity.setKpiCycle(dto.getScoreCycle()); |
|
|
|
|
|
kpiRuleService.updateById(kpiRuleEntity); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
updateById(entity); |
|
|
updateById(entity); |
|
|
|
|
|
return new Result(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void delete(String[] ids) { |
|
|
public Result delete(String[] ids) { |
|
|
|
|
|
List<KpiRuleEntity> kpiRuleEntityList = kpiRuleService.listKpiRuleEntityByRereferenceId(ids); |
|
|
|
|
|
if (null != kpiRuleEntityList && kpiRuleEntityList.size() > 0) { |
|
|
|
|
|
return new Result().error("已经制定考核规则,不允许删除"); |
|
|
|
|
|
} |
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
|
|
return new Result(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Result<List<KpiManualScoreDictResultDTO>> listKpiManualScoreDictListDTO() { |
|
|
|
|
|
List<KpiManualScoreDictResultDTO> list=baseDao.selectListKpiManualScoreDictResultDTO(); |
|
|
|
|
|
return new Result<List<KpiManualScoreDictResultDTO>>().ok(list); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|