|
|
@ -3,19 +3,15 @@ package com.huoran.occupationlab.service.impl; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.huoran.api.JudgmentPointClient; |
|
|
|
import com.huoran.api.JudgmentPointClient; |
|
|
|
import com.huoran.common.entity.ProjectManage; |
|
|
|
|
|
|
|
import com.huoran.common.entity.ProjectJudgment; |
|
|
|
import com.huoran.common.entity.ProjectJudgment; |
|
|
|
import com.huoran.occupationlab.mapper.ProjectJudgmentMapper; |
|
|
|
import com.huoran.occupationlab.mapper.ProjectJudgmentMapper; |
|
|
|
import com.huoran.occupationlab.mapper.ProjectManageMapper; |
|
|
|
import com.huoran.occupationlab.mapper.ProjectManageMapper; |
|
|
|
import com.huoran.occupationlab.service.ProjectJudgmentService; |
|
|
|
import com.huoran.occupationlab.service.ProjectJudgmentService; |
|
|
|
import com.huoran.occupationlab.utils.CollectionUtil; |
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.Collection; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -32,6 +28,9 @@ public class ProjectJudgmentServiceImpl extends ServiceImpl<ProjectJudgmentMappe |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private ProjectJudgmentMapper projectJudgmentMapper; |
|
|
|
private ProjectJudgmentMapper projectJudgmentMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private ProjectJudgmentService projectJudgmentService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private ProjectManageMapper projectManageMapper; |
|
|
|
private ProjectManageMapper projectManageMapper; |
|
|
|
|
|
|
|
|
|
|
@ -51,47 +50,56 @@ public class ProjectJudgmentServiceImpl extends ServiceImpl<ProjectJudgmentMappe |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = RuntimeException.class) |
|
|
|
@Transactional(rollbackFor = RuntimeException.class) |
|
|
|
public Integer updateProjectJudgment(Integer projectId, List<ProjectJudgment> projectJudgments) { |
|
|
|
public Integer updateProjectJudgment(Integer projectId, List<ProjectJudgment> projectJudgments) { |
|
|
|
//编辑排序,不影响原本判分点顺序,存在添加绑定关系,不存在解除绑定
|
|
|
|
|
|
|
|
ArrayList<Integer> before = new ArrayList<>(); |
|
|
|
|
|
|
|
ArrayList<Integer> after = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询项目修改前判分点
|
|
|
|
//查询项目修改前判分点
|
|
|
|
QueryWrapper<ProjectJudgment> queryWrapper = new QueryWrapper<ProjectJudgment>().eq("project_id", projectId); |
|
|
|
QueryWrapper<ProjectJudgment> queryWrapper = new QueryWrapper<ProjectJudgment>().eq("project_id", projectId); |
|
|
|
|
|
|
|
|
|
|
|
List<ProjectJudgment> oldJudgmentList = projectJudgmentMapper.selectList(queryWrapper); |
|
|
|
int delete = projectJudgmentMapper.delete(queryWrapper); |
|
|
|
for (ProjectJudgment projectJudgment : oldJudgmentList) { |
|
|
|
if (delete > 0) { |
|
|
|
before.add(projectJudgment.getId()); |
|
|
|
projectJudgmentService.saveBatch(projectJudgments); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//更新判分点内容
|
|
|
|
|
|
|
|
ProjectManage projectManage = projectManageMapper.selectById(projectId); |
|
|
|
|
|
|
|
for (ProjectJudgment judgment : projectJudgments) { |
|
|
|
|
|
|
|
//id为空新增
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(judgment.getId())) { |
|
|
|
|
|
|
|
projectJudgmentMapper.insert(judgment); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
projectJudgmentMapper.updateJudgment(judgment.getId(), judgment.getScore(), judgment.getSort()); |
|
|
|
|
|
|
|
after.add(judgment.getId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//长度变化,表示有删减
|
|
|
|
return delete; |
|
|
|
if (before.size() != after.size()) { |
|
|
|
// //编辑排序,不影响原本判分点顺序,存在添加绑定关系,不存在解除绑定
|
|
|
|
Collection differentNoDuplicate = CollectionUtil.getDifferentNoDuplicate(before, after); |
|
|
|
// ArrayList<Integer> before = new ArrayList<>();
|
|
|
|
differentNoDuplicate.forEach(i -> { |
|
|
|
// ArrayList<Integer> after = new ArrayList<>();
|
|
|
|
//删除项目中的判分点
|
|
|
|
//
|
|
|
|
projectJudgmentMapper.deleteById((Integer) i); |
|
|
|
// //查询项目修改前判分点
|
|
|
|
|
|
|
|
// QueryWrapper<ProjectJudgment> queryWrapper = new QueryWrapper<ProjectJudgment>().eq("project_id", projectId);
|
|
|
|
//解绑
|
|
|
|
//
|
|
|
|
if (projectManage.getSystemId() <= 10) { |
|
|
|
// List<ProjectJudgment> oldJudgmentList = projectJudgmentMapper.selectList(queryWrapper);
|
|
|
|
judgmentPointClient.bcBandingProject((Integer) i, projectId, 0); |
|
|
|
// for (ProjectJudgment projectJudgment : oldJudgmentList) {
|
|
|
|
} else { |
|
|
|
// before.add(projectJudgment.getId());
|
|
|
|
judgmentPointClient.lcBandingProject((Integer) i, projectId, 0); |
|
|
|
// }
|
|
|
|
} |
|
|
|
//
|
|
|
|
}); |
|
|
|
// //更新判分点内容
|
|
|
|
} |
|
|
|
// ProjectManage projectManage = projectManageMapper.selectById(projectId);
|
|
|
|
|
|
|
|
// for (ProjectJudgment judgment : projectJudgments) {
|
|
|
|
|
|
|
|
// //id为空新增
|
|
|
|
return 1; |
|
|
|
// if (ObjectUtils.isEmpty(judgment.getId())) {
|
|
|
|
|
|
|
|
// projectJudgmentMapper.insert(judgment);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// projectJudgmentMapper.updateJudgment(judgment.getId(), judgment.getScore(), judgment.getSort());
|
|
|
|
|
|
|
|
// after.add(judgment.getId());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// //长度变化,表示有删减
|
|
|
|
|
|
|
|
// if (before.size() != after.size()) {
|
|
|
|
|
|
|
|
// Collection differentNoDuplicate = CollectionUtil.getDifferentNoDuplicate(before, after);
|
|
|
|
|
|
|
|
// differentNoDuplicate.forEach(i -> {
|
|
|
|
|
|
|
|
// //删除项目中的判分点
|
|
|
|
|
|
|
|
// projectJudgmentMapper.deleteById((Integer) i);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// //解绑
|
|
|
|
|
|
|
|
// if (projectManage.getSystemId() <= 10) {
|
|
|
|
|
|
|
|
// judgmentPointClient.bcBandingProject((Integer) i, projectId, 0);
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// judgmentPointClient.lcBandingProject((Integer) i, projectId, 0);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// return 1;
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|