|
@@ -93,44 +93,30 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
|
|
|
|
@Override
|
|
|
public List<OrganizationEvaluationRule> listAll(String id, String organizationName, String organizationId, String organizationType, String binSection, String binStage, String evaluationCycle) {
|
|
|
- QueryWrapper<OrganizationEvaluationRule> qw = new QueryWrapper<>();
|
|
|
-
|
|
|
- if (StringUtils.isNotEmpty(id)) {
|
|
|
- qw.lambda().eq(OrganizationEvaluationRule::getId, id);
|
|
|
- }
|
|
|
-
|
|
|
- if (StringUtils.isNotEmpty(organizationName)) {
|
|
|
- qw.lambda().like(OrganizationEvaluationRule::getOrganizationName, organizationName);
|
|
|
- }
|
|
|
-
|
|
|
- if (StringUtils.isNotEmpty(organizationId)) {
|
|
|
- qw.lambda().like(OrganizationEvaluationRule::getOrganizationId, organizationId);
|
|
|
- }
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(organizationType)) {
|
|
|
- qw.lambda().eq(OrganizationEvaluationRule::getOrganizationType, organizationType);
|
|
|
- }
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(binSection)) {
|
|
|
- qw.lambda().eq(OrganizationEvaluationRule::getBinSection, binSection);
|
|
|
- }
|
|
|
+ List<OrganizationEvaluationRule> list = baseMapper.selectListAll(id, organizationName, organizationId, organizationType, binSection, binStage, evaluationCycle);
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(binStage)) {
|
|
|
- qw.lambda().eq(OrganizationEvaluationRule::getBinStage, binStage);
|
|
|
- }
|
|
|
+ list().stream().forEach(l->{
|
|
|
+ l.setBinSectionName(null == CacheContext.ddNameMap.get(l.getBinSection()) ? "" :CacheContext.ddNameMap.get(l.getBinSection()));
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(evaluationCycle)) {
|
|
|
- qw.lambda().eq(OrganizationEvaluationRule::getEvaluationCycle, evaluationCycle);
|
|
|
- }
|
|
|
+ StringBuilder binStageName = new StringBuilder();
|
|
|
+ for (String stage : l.getBinStage().split(",")){
|
|
|
+ binStageName.append(null == CacheContext.ddNameMap.get(stage) ? "" :CacheContext.ddNameMap.get(stage)).append(",");
|
|
|
+ }
|
|
|
|
|
|
- qw.lambda().eq(OrganizationEvaluationRule::getDelFlag, false);
|
|
|
+ l.setBinStageName(binStageName.toString().length()>0?binStageName.toString().substring(0,binStageName.toString().length()-1):"");
|
|
|
|
|
|
- qw.lambda().orderByAsc(OrganizationEvaluationRule::getOrderNum);
|
|
|
+ StringBuilder ruleName = new StringBuilder();
|
|
|
+ for (String ruleId :l.getEvaluateRuleId().split(",")){
|
|
|
+ EvaluateRule rulebyid = evaluateRuleService.getById(ruleId);
|
|
|
+ if(null != rulebyid){
|
|
|
+ ruleName.append(rulebyid.getRuleName()).append(",");
|
|
|
+ }
|
|
|
|
|
|
- List<OrganizationEvaluationRule> list = baseMapper.selectList(qw);
|
|
|
+ }
|
|
|
+ l.setEvaluateRuleName(ruleName.toString().length()>0?ruleName.toString().substring(0,ruleName.toString().length()-1):"");
|
|
|
|
|
|
- list.stream().forEach(l->{
|
|
|
- l.setBinSectionName(null == CacheContext.ddNameMap.get(l.getBinSection()) ? "" :CacheContext.ddNameMap.get(l.getBinSection()));
|
|
|
});
|
|
|
|
|
|
return list;
|
|
@@ -141,18 +127,21 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
|
Page<OrganizationEvaluationRule> page = new Page<>(pageNum, pageSize);
|
|
|
IPage<OrganizationEvaluationRule> list = baseMapper.list(page, id, organizationName, organizationId, organizationType, binSection, binStage, evaluationCycle);
|
|
|
list.getRecords().stream().forEach(l->{
|
|
|
- l.setBinSectionName(null == CacheContext.ddNameMap.get(l.getBinSection()) ? "" :CacheContext.ddNameMap.get(l.getBinSection()));
|
|
|
|
|
|
StringBuilder binStageName = new StringBuilder();
|
|
|
for (String stage : l.getBinStage().split(",")){
|
|
|
- binStageName.append(null == CacheContext.ddNameMap.get(stage) ? "" :CacheContext.ddNameMap.get(stage)).append(",");
|
|
|
+ binStageName.append(null == CacheContext.bseIdMap.get(stage) ? "" :CacheContext.bseIdMap.get(stage)).append(",");
|
|
|
}
|
|
|
|
|
|
l.setBinStageName(binStageName.toString().length()>0?binStageName.toString().substring(0,binStageName.toString().length()-1):"");
|
|
|
|
|
|
StringBuilder ruleName = new StringBuilder();
|
|
|
for (String ruleId :l.getEvaluateRuleId().split(",")){
|
|
|
- ruleName.append(evaluateRuleService.getById(ruleId).getRuleName()).append(",");
|
|
|
+ EvaluateRule rulebyid = evaluateRuleService.getById(ruleId);
|
|
|
+ if(null != rulebyid){
|
|
|
+ ruleName.append(rulebyid.getRuleName()).append(",");
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
l.setEvaluateRuleName(ruleName.toString().length()>0?ruleName.toString().substring(0,ruleName.toString().length()-1):"");
|
|
|
|
|
@@ -164,19 +153,32 @@ public class OrganizationEvaluationRuleServiceImpl extends ServiceImpl<Organizat
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public boolean saveOrUpdate(OrganizationEvaluationRule entity) {
|
|
|
- if (null != entity && (null == entity.getId() || "".equals(entity.getId().trim()))) {
|
|
|
- QueryWrapper<OrganizationEvaluationRule> qw = new QueryWrapper<>();
|
|
|
- qw.lambda().eq(OrganizationEvaluationRule::getOrganizationId, entity.getOrganizationId());
|
|
|
- qw.lambda().eq(OrganizationEvaluationRule::getEvaluationCycle, entity.getEvaluationCycle());
|
|
|
- List<OrganizationEvaluationRule> list = baseMapper.selectList(qw);
|
|
|
- if (null != list && list.size() > 0) {
|
|
|
- throw new CustomException("已存在同期考评配置");
|
|
|
- }
|
|
|
- entity.setCreateTime(new Date());
|
|
|
- } else {
|
|
|
- entity.setUpdateTime(new Date());
|
|
|
+ //如果是存在主键 则修改
|
|
|
+ if (null != entity && (null != entity.getId() && !"".equals(entity.getId().trim()))) {
|
|
|
+ OrganizationEvaluationRule update = baseMapper.selectById(entity.getId());
|
|
|
+ update.setDelFlag(true);
|
|
|
+ update.setUpdateTime(new Date());
|
|
|
+ baseMapper.updateById(update);
|
|
|
+ }
|
|
|
+
|
|
|
+ //型增时判断当前组织是否存在同期考评配置
|
|
|
+ QueryWrapper<OrganizationEvaluationRule> qw = new QueryWrapper<>();
|
|
|
+ qw.lambda().eq(OrganizationEvaluationRule::getOrganizationId, entity.getOrganizationId());
|
|
|
+ qw.lambda().eq(OrganizationEvaluationRule::getEvaluationCycle, entity.getEvaluationCycle());
|
|
|
+ List<OrganizationEvaluationRule> list = baseMapper.selectList(qw);
|
|
|
+ if (null != list && list.size() > 0) {
|
|
|
+ throw new CustomException("已存在同期考评配置");
|
|
|
}
|
|
|
|
|
|
+ //判断排序字段是否有值
|
|
|
+ if(null==entity.getOrderNum()){
|
|
|
+ int count = baseMapper.selectCount(null);
|
|
|
+ entity.setOrderNum(count);
|
|
|
+ }
|
|
|
+ //处理id为空
|
|
|
+ entity.setId(null);
|
|
|
+ //默认未删除
|
|
|
+ entity.setDelFlag(false);
|
|
|
return super.saveOrUpdate(entity);
|
|
|
}
|
|
|
|