fix
This commit is contained in:
parent
e077ea54a3
commit
929a439b89
@ -39,6 +39,8 @@ public interface EvaluationGroupMapper extends BaseMapper<EvaluationGroup> {
|
||||
|
||||
List<EvaluationGroup> selectEvaluationGroupByIds(@Param("ids") List<Long> ids);
|
||||
|
||||
List<EvaluationGroup> selectEvaluationGroupByNotIds(@Param("ids") List<Long> ids);
|
||||
|
||||
EvaluationGroup selectEvaluationGroupByName(@Param("name") String name);
|
||||
|
||||
void deleteByCopyIds(@Param("ids") List<Long> ids);
|
||||
|
||||
@ -60,6 +60,10 @@ public class EvaluationGroup implements java.io.Serializable {
|
||||
@ApiModelProperty(value = "是否评分 0 :未通知 1:已通知", name = "score")
|
||||
private int score;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "是否确认变更组 0 :首次否 1:确认", name = "confirm")
|
||||
private int confirm;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
|
||||
@ -44,11 +44,13 @@ public interface EvaluationGroupService extends IService<EvaluationGroup> {
|
||||
|
||||
List<EvaluationGroup> selectEvaluationGroupByIds(List<Long> ids);
|
||||
|
||||
List<EvaluationGroup> selectEvaluationGroupByNotIds(List<Long> ids);
|
||||
|
||||
EvaluationGroup selectEvaluationGroupByName(String name);
|
||||
//获取考核组里面所有参与的人员信息,去除重复,去除离职
|
||||
List<StaffSimpleInfo> selectAllStaffSimpleInfoByGroupId(EvaluationGroup evaluationGroup);
|
||||
|
||||
void deleteByCopyIds(List<Long> ids);
|
||||
|
||||
List<CheckStaffDto> checkStaff(EvaluationGroup evaluationGroup);
|
||||
R checkStaff(EvaluationGroup evaluationGroup);
|
||||
}
|
||||
@ -3,10 +3,12 @@ package com.lz.modules.flow.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.lz.common.utils.ISelect;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.dto.StaffSimpleDto;
|
||||
import com.lz.modules.app.entity.DepartmentsEntity;
|
||||
import com.lz.modules.app.entity.StaffSimpleInfo;
|
||||
import com.lz.modules.app.service.DepartmentsService;
|
||||
@ -26,10 +28,13 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 考评组表 服务类
|
||||
@ -178,6 +183,12 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
|
||||
return evaluationGroupMapper.selectEvaluationGroupByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<EvaluationGroup> selectEvaluationGroupByNotIds(List<Long> ids){
|
||||
return evaluationGroupMapper.selectEvaluationGroupByNotIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EvaluationGroup selectEvaluationGroupByName(String name){
|
||||
return evaluationGroupMapper.selectEvaluationGroupByName(name);
|
||||
@ -261,25 +272,66 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
|
||||
|
||||
|
||||
@Override
|
||||
public List<CheckStaffDto> checkStaff(EvaluationGroup evaluationGroup) {
|
||||
List<CheckStaffDto> staffs= new ArrayList<>();
|
||||
public R checkStaff(EvaluationGroup evaluationGroup) {
|
||||
//本次参加人员
|
||||
List<String> staffIdsByGroup = getStaffIdsByGroup(evaluationGroup);
|
||||
//其他组全部成员
|
||||
List<String> allStaffIdsByGroup = new ArrayList<>();
|
||||
|
||||
//获取之前
|
||||
List<EvaluationGroup> evaluationGroups = evaluationGroupMapper.selectList(new QueryWrapper<EvaluationGroup>()
|
||||
.eq("is_delete", 0).eq("copy_id", 0));
|
||||
|
||||
if(CollectionUtils.isEmpty(evaluationGroups)){
|
||||
return staffs;
|
||||
//获取其他组成员
|
||||
List<Long> ids = new ArrayList<>();
|
||||
if(evaluationGroup.getId()!=null){
|
||||
ids.add(evaluationGroup.getId());
|
||||
}
|
||||
evaluationGroups.stream().map(new Function<EvaluationGroup, CheckStaffDto>() {
|
||||
@Override
|
||||
public CheckStaffDto apply(EvaluationGroup evaluationGroup) {
|
||||
//evaluationGroupService.
|
||||
return null;
|
||||
List<EvaluationGroup> evaluationGroups = evaluationGroupMapper.selectEvaluationGroupByNotIds(ids);
|
||||
//根据组id成员分组
|
||||
Map<Long,List<String>> map = Maps.newHashMap();
|
||||
if(CollectionUtils.isNotEmpty(evaluationGroups)){
|
||||
evaluationGroups.forEach(evaluationGroup1 -> {
|
||||
List<String> staffIds = getStaffIdsByGroup(evaluationGroup1);
|
||||
allStaffIdsByGroup.addAll(staffIds);
|
||||
map.put(evaluationGroup1.getId(),staffIds);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//是否存在其他组成员
|
||||
staffIdsByGroup.retainAll(allStaffIdsByGroup);
|
||||
if(CollectionUtils.isNotEmpty(staffIdsByGroup)){
|
||||
List<Long> collect = staffIdsByGroup.stream().map(s -> Long.valueOf(s)).distinct().collect(toList());
|
||||
List<StaffSimpleDto> staffSimpleDtos = staffService.selectStaffSimpleInfoByIds(collect);
|
||||
String notInGroupNames = StringUtil.EMPTY;
|
||||
for(StaffSimpleDto dto:staffSimpleDtos){
|
||||
notInGroupNames = notInGroupNames + dto.getName() + " ";
|
||||
}
|
||||
});
|
||||
return null;
|
||||
|
||||
if(evaluationGroup.getConfirm()==0){
|
||||
return R.error(notInGroupNames + "已在其他类型为月度的考评组中,是否改为到此考评组中进行考核");
|
||||
}
|
||||
evaluationGroups.forEach(evaluationGroup12 -> {
|
||||
List<String> staffs = map.get(evaluationGroup12.getId());
|
||||
staffs.retainAll(collect);
|
||||
if(CollectionUtils.isNotEmpty(staffs)){
|
||||
//直接添加
|
||||
addStaffsToAssessGroup(collect,evaluationGroup12.getId());
|
||||
removeStaffsToAssessGroup(collect,evaluationGroup12.getId());
|
||||
}
|
||||
|
||||
});
|
||||
return R.ok();
|
||||
|
||||
}
|
||||
//直接添加
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
private int addStaffsToAssessGroup(List<Long> ids,Long id) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int removeStaffsToAssessGroup(List<Long> ids,Long id) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,4 +23,7 @@ public class AssessChangeReq {
|
||||
@ApiModelProperty(value = "变动人员ids",name = "staffIds")
|
||||
private String staffIds;
|
||||
|
||||
@ApiModelProperty(value = "确认变更考核组 0 :首次不确认 1:确认",name = "confirm")
|
||||
private int confirm;
|
||||
|
||||
}
|
||||
|
||||
@ -31,11 +31,16 @@ import com.lz.modules.sys.dao.app.ResultRecordMapper;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import com.sun.org.apache.regexp.internal.RE;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@ -48,6 +53,7 @@ import static java.util.stream.Collectors.toList;
|
||||
* @Date: 2020/10/22 17:28
|
||||
*/
|
||||
@Service("assessManagerService")
|
||||
@Slf4j
|
||||
public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
@Autowired
|
||||
private FlowStartMapper flowStartMapper;
|
||||
@ -133,7 +139,7 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
String[] split = flowStart.getGroupIds().split(",");
|
||||
List<String> strings = Arrays.asList(split);
|
||||
List<Long> ids = strings.stream().map(s -> Long.valueOf(s)).collect(toList());
|
||||
List<EvaluationGroup> evaluationGroups = evaluationGroupService.selectEvaluationGroupByIds(ids);
|
||||
List<EvaluationGroup> otheEvaluationGroups = evaluationGroupService.selectEvaluationGroupByNotIds(ids);
|
||||
|
||||
//获取变更人员
|
||||
String[] changeStaffIds = req.getStaffIds().split(",");
|
||||
@ -145,7 +151,7 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
|
||||
//根据组id成员分组
|
||||
Map<Long,List<String>> map = Maps.newHashMap();
|
||||
for(EvaluationGroup group:evaluationGroups){
|
||||
for(EvaluationGroup group:otheEvaluationGroups){
|
||||
List<String> staff = evaluationGroupService.selectAllStaffIdsByGroupId(group.getId());
|
||||
all.addAll(staff);
|
||||
map.put(group.getId(),staff);
|
||||
@ -162,7 +168,9 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
for(StaffSimpleDto dto:staffSimpleDtos){
|
||||
notInGroupNames = notInGroupNames + dto.getName() + " ";
|
||||
}
|
||||
throw new RRException(notInGroupNames + "已在其他类型为月度的考评组中,是否改为到此考评组中进行考核");
|
||||
|
||||
throw new RRException(notInGroupNames + "未加入月度类型考评组,被考核人需要加入月度考评组后才能参与当前月度考核。");
|
||||
|
||||
}
|
||||
|
||||
//初始化添加用户的数据
|
||||
@ -171,13 +179,12 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
//排除已发起过的
|
||||
List<Long> longs = evaluationStartStaffMapper.selectStaffIdsByStart(req.getStartId());
|
||||
|
||||
for(EvaluationGroup group:evaluationGroups){
|
||||
for(EvaluationGroup group:otheEvaluationGroups){
|
||||
GroupStaffs groupStaffs = new GroupStaffs();
|
||||
groupStaffs.setEvaluationGroup(group);
|
||||
|
||||
List<String> staffs = map.get(group.getId());
|
||||
staffs.retainAll(change);
|
||||
|
||||
List<Long> collect = staffs.stream().map(s -> Long.valueOf(s)).collect(toList());
|
||||
collect.removeAll(longs);
|
||||
groupStaffs.setStaffIds(collect);
|
||||
@ -210,39 +217,42 @@ public class AssessManagerServiceImpl implements AssessManagerService {
|
||||
Long evaluation = Long.valueOf(s);
|
||||
//更新评分
|
||||
int i = evaluationStartStaffService.updateBatchToScore(req.getStartId(), evaluation);
|
||||
log.info("更新evaluationStartStaff 数据 为已评分 " + i);
|
||||
|
||||
List<Long> longs = resultRecordMapper.selectToScoreList(req.getStartId(), evaluation);
|
||||
//更新流程绩效
|
||||
ApprovalDto approvalDto = new ApprovalDto();
|
||||
approvalDto.setStatus(1);
|
||||
approvalDto.setResultRecordId(1L);
|
||||
approvalDto.setMenuName("开始评分");
|
||||
try {
|
||||
resultRecordService.newApproval(approvalDto);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
List<Long> recordIds = resultRecordMapper.selectToScoreList(req.getStartId(), evaluation);
|
||||
if(CollectionUtils.isEmpty(recordIds)){
|
||||
continue;
|
||||
}
|
||||
recordIds.forEach(aLong -> {
|
||||
//更新流程绩效
|
||||
ApprovalDto approvalDto = new ApprovalDto();
|
||||
approvalDto.setStatus(1);
|
||||
approvalDto.setResultRecordId(1L);
|
||||
approvalDto.setMenuName("开始评分");
|
||||
try {
|
||||
resultRecordService.newApproval(approvalDto);
|
||||
} catch (Exception e) {
|
||||
log.error("执行中状态跳过失败 recorId:" + aLong,e);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private List<EvaluationStartStaff> buildStartStaffList(List<String> staffIds){
|
||||
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
|
||||
staffIds.forEach(new Consumer<String>() {
|
||||
@Override
|
||||
public void accept(String s) {
|
||||
EvaluationStartStaff startStaff = new EvaluationStartStaff();
|
||||
startStaff.setStaffId(Long.valueOf(s));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return evaluationStartStaffs;
|
||||
|
||||
public static void main(String[] args) {
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(10);
|
||||
CompletableFuture<List<Long>> future = CompletableFuture.supplyAsync(()-> Arrays.asList(1L,2L),executorService);
|
||||
try {
|
||||
List<Long> longs = future.get();
|
||||
System.out.println();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -79,7 +79,7 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
|
||||
|
||||
List<ResultRecord> selectChartDetailList(@Param("page") IPage page, @Param("staffIds") List<String> staffIds, @Param("startId")Long startId,@Param("scoreLevel")Long scoreLevel);
|
||||
|
||||
void batchDeleteByStartId(@Param("startId")Long startId);
|
||||
int batchDeleteByStartId(@Param("startId")Long startId);
|
||||
|
||||
int countStartAndGroupNum(@Param("startId")Long startId);
|
||||
|
||||
|
||||
@ -118,6 +118,18 @@
|
||||
)
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectEvaluationGroupByNotIds" resultType="EvaluationGroup" >
|
||||
select * from lz_evaluation_group where is_delete = 0 and copy_id = 0
|
||||
<if test="ids!=null and ids.size()!=0">
|
||||
and id not in (
|
||||
<foreach collection="ids" item="id" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectEvaluationGroupByName" resultType="EvaluationGroup" >
|
||||
select * from lz_evaluation_group where name=#{name} and is_delete = 0 limit 1
|
||||
</select>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user