发起考评时保存拷贝考核组id

This commit is contained in:
wulin 2021-06-01 21:06:02 +08:00
parent 2c07bed2cb
commit 4295254080
5 changed files with 40 additions and 8 deletions

View File

@ -52,4 +52,5 @@ public interface EvaluationGroupMapper extends BaseMapper<EvaluationGroup> {
EvaluationGroup selectEvaluationGroupByCopyId(@Param("copyId")Long copyId,@Param("startId")Long startId);
List<EvaluationGroup> selectEvaluationGroupByCopyIds(@Param("ids") List<Long> ids);
}

View File

@ -59,4 +59,6 @@ public interface EvaluationGroupService extends IService<EvaluationGroup> {
String getEvaluationCopyIdsByEvaluationIds(String evaluationIds,Long startId);
EvaluationGroup selectEvaluationGroupByCopyId(Long copyId, Long startId);
List<EvaluationGroup> selectEvaluationGroupByCopyIds(List<Long> ids);
}

View File

@ -424,4 +424,9 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
public EvaluationGroup selectEvaluationGroupByCopyId(Long copyId, Long startId){
return evaluationGroupMapper.selectEvaluationGroupByCopyId(copyId, startId);
}
@Override
public List<EvaluationGroup> selectEvaluationGroupByCopyIds(List<Long> ids){
return evaluationGroupMapper.selectEvaluationGroupByCopyIds(ids);
}
}

View File

@ -206,16 +206,33 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
}else{
flowStart.setName(startDate + "绩效考核");
}
List<String> newIds = new ArrayList<>();
FlowStart flowStart1 = selectFlowStartByName(flowStart.getName());
if(flowStart1 == null){
insertFlowStart(flowStart);
flowStart1 = flowStart;
}else{
List<String> ids1= Arrays.stream(flowStart1.getGroupIds().split(",")).map(new Function<String, String>() {
//因为保存的时拷贝后的组所以这里查询原来的组
List<Long> lIds= Arrays.stream(flowStart1.getGroupIds().split(",")).map(new Function<String, Long>() {
@Override
public String apply(String s) {
return s;
public Long apply(String s) {
newIds.add(s);
return Long.valueOf(s);
}
}).collect(Collectors.toList());
List<EvaluationGroup> evaluationGroups = evaluationGroupService.selectEvaluationGroupByCopyIds(lIds);
List<String> ids1= evaluationGroups.stream().map(new Function<EvaluationGroup, String>() {
@Override
public String apply(EvaluationGroup evaluationGroup) {
return evaluationGroup.getId().toString();
}
}).collect(Collectors.toList());
//查询拷贝后的
Map<String, String> maps = ids1.stream().collect(Collectors.toMap(e->e, e->e));
//求差集发起但是历史记录怎么搞
@ -234,9 +251,6 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
i++;
}
if(ids.size() == 0){
/*return R.ok("发起成功,该任务已经发起过")
.put("data", flowStart1);*/
@ -246,8 +260,8 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
}else{
log.info("有新增组");
ids1.addAll(ids);
flowStart1.setGroupIds(ids1.stream().collect(Collectors.joining(",")));//把新的组信息加入
updateFlowStartById(flowStart1);//更新组信息到记录里面
flowStart1.setGroupIds(ids1.stream().collect(Collectors.joining(",")));//把新的组信息加入把拷贝前的组信息保存下来
flowStart.setGroupIds(ids.stream().collect(Collectors.joining(",")));//过滤后的考核组
flowStart.setId(flowStart1.getId());
@ -315,12 +329,16 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
case 5:
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
case 0:
newIds.add(evaluationGroup.getId().toString());
noticeStaff.addAll(staffIds);
startStartDtos.add(startDto);
break;
}
}
flowStart1.setGroupIds(newIds.stream().collect(Collectors.joining(",")));
updateFlowStartById(flowStart1);//更新组信息到记录里面
initFlowRecordAnsy(startStartDtos, noticeStaff);
//dingtalkBusiness.sendWorkMSGWithAsyn(noticeStaff, WorkMsgTypeEnum.START_WORK.getType());
return R.ok("发起成功").put("data", flowStart);
}

View File

@ -165,5 +165,11 @@
<select id="selectEvaluationGroupByCopyId" resultType="EvaluationGroup" >
select * from lz_evaluation_group where is_delete = 0 and copy_id = #{copyId} and start_id = #{startId} limit 1
</select>
<select id="selectEvaluationGroupByCopyIds" resultType="EvaluationGroup" >
select * from lz_evaluation_group join ( select copy_id from lz_evaluation_group where is_delete = 0 and id in (
<foreach collection="ids" item="item" separator=",">#{item}</foreach>
)) as b on lz_evaluation_group.id = b.copy_id
</select>
</mapper>