修复删除考核任务信息时,如果租内人员删除完成,清空组信息的bug

This commit is contained in:
wulin 2021-09-14 16:24:08 +08:00
parent edbf223401
commit 35844251b0
3 changed files with 23 additions and 8 deletions

View File

@ -523,7 +523,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
for (ResultModelDto modelDto:resultModelDtos
) {
log.info("发起考核modelDto:{}, tagetLibsSize:{}", modelDto, modelDto.getTagetLibs().size());
if(modelDto.getTagetLibs() != null && modelDto.getTagetLibs().size() > 0){//模板里面有添加指标
for (ResultTagetLibDto libDto:
modelDto.getTagetLibs()) {
@ -545,6 +545,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
}
//如果有数据插入lz_result_detail表
log.info("发起考核,新增绩效详情个数{}", resultDetails.size());
if(resultDetails.size() > 0){
//
resultDetailService.saveBatch(resultDetails);

View File

@ -273,8 +273,10 @@ public class AssessManagerServiceImpl implements AssessManagerService {
if(req.getChangeType() == 1 && CollectionUtils.isNotEmpty(change)){
//删除钉钉任务
try {
List<ResultRecord> resultRecords = resultRecordMapper.selectResultRecordsByStartIdAndStaffIds(req.getStartId(),change);
List<ResultRecord> resultRecords =
resultRecordMapper.selectResultRecordsByStartIdAndStaffIds(req.getStartId(),change);
Map<Long, Map<Long, Long>> rIdAndStaffIds = new HashMap<>();
List<EvaluationGroup> removeGroup = new ArrayList<>();
List<Long> recordIds = resultRecords.stream().map(new Function<ResultRecord, Long>() {
@Override
public Long apply(ResultRecord resultRecord) {
@ -306,16 +308,28 @@ public class AssessManagerServiceImpl implements AssessManagerService {
//这次全部删除了该考评组下面的人那么删除考评组对应的start里面的信息
for (Long id:ids
) {
if(id == groupResultRecordStaffsCount.getEvaluationId()){
if(id.compareTo(groupResultRecordStaffsCount.getEvaluationId()) == 0 ){
ids.remove(id);
EvaluationGroup evaluationGroup = new EvaluationGroup();
evaluationGroup.setIsDelete(1);
evaluationGroup.setId(id);
evaluationGroup.setGmtModified(new Date());
removeGroup.add(evaluationGroup);
break;
}
}
}
}
if(ids.size() != split.length){//更新考核组信息
flowStart.setGroupIds(String.join(",", ids.toString()));
log.info("ids.size={}与split.length={}", ids.size(), split.length);
log.info("删除的发起中考评组个数", removeGroup.size());
if(removeGroup.size() > 0){//更新考核组信息
String group = String.join(",", ids.toString()).
replace("[", "").
replace("]", "");
flowStart.setGroupIds(group);
log.info("新的start对应的groupId{}", flowStart.getGroupIds());
flowStartService.updateFlowStartById(flowStart);
evaluationGroupService.updateBatchById(removeGroup);
}
} catch (Exception e) {
log.error("调用钉钉清除任务异常,e:" ,e);

View File

@ -663,7 +663,7 @@
)
</select>
<select id="selectResultRecordsByStartIdAndStaffIds" resultType="java.lang.Long">
<select id="selectResultRecordsByStartIdAndStaffIds" resultType="ResultRecord">
select * from lz_result_record where is_delete = 0
and start_id = #{startId}
and staff_id in (
@ -674,13 +674,13 @@
</select>
<select id="selectGroupResultRecordsStaffsCountByStartId" resultType="java.lang.Long">
<select id="selectGroupResultRecordsStaffsCountByStartId" resultType="com.lz.modules.flow.entity.GroupResultRecordStaffsCount">
select evaluation_id, count(evaluation_id) as count from lz_result_record where is_delete = 0
and start_id = #{startId}
group by evaluation_id
</select>
<select id="selectResultRecordByGroupIds" resultType="java.lang.Long">
<select id="selectResultRecordByGroupIds" resultType="ResultRecord">
select * from lz_result_record where is_delete = 0
and evaluation_id in (
<foreach collection="groupIds" item="item" separator=",">