|
|
|
|
@ -161,7 +161,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|
|
|
|
Map<Long, List<FlowChartRole>> mustRole = new HashMap<>();
|
|
|
|
|
Map<Long, List<FlowChartRole>> selfMustRole = new HashMap<>();
|
|
|
|
|
List<StaffSimpleInfo> noticeStaff = new ArrayList<>();
|
|
|
|
|
List<ResultRecord> resultRecords = new ArrayList<>();
|
|
|
|
|
List<StartStartDto> resultRecords = new ArrayList<>();
|
|
|
|
|
for (GroupStaffs groupStaffs:startGroupStaffIds.getGroups()
|
|
|
|
|
) {
|
|
|
|
|
List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(groupStaffs.getStaffIds());
|
|
|
|
|
@ -187,7 +187,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|
|
|
|
return R.error(groupStaffs.getEvaluationGroup().getName() + "——初始化考核流程失败");
|
|
|
|
|
case 0:
|
|
|
|
|
noticeStaff.addAll(staffSimpleInfos);
|
|
|
|
|
resultRecords.addAll(startDto.getResultRecordList());
|
|
|
|
|
resultRecords.add(startDto);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -276,7 +276,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|
|
|
|
Map<Long, List<FlowChartRole>> mustRole = new HashMap<>();
|
|
|
|
|
Map<Long, List<FlowChartRole>> selfMustRole = new HashMap<>();
|
|
|
|
|
List<StaffSimpleInfo> noticeStaff = new ArrayList<>();
|
|
|
|
|
List<ResultRecord> resultRecords = new ArrayList<>();
|
|
|
|
|
List<StartStartDto> resultRecords = new ArrayList<>();
|
|
|
|
|
for (int n = 0; n < evaluationGroups.size(); n++
|
|
|
|
|
) {
|
|
|
|
|
EvaluationGroup evaluationGroup = evaluationGroups.get(n);
|
|
|
|
|
@ -323,7 +323,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|
|
|
|
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
|
|
|
|
|
case 0:
|
|
|
|
|
noticeStaff.addAll(staffIds);
|
|
|
|
|
resultRecords.addAll(startDto.getResultRecordList());
|
|
|
|
|
resultRecords.add(startDto);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -379,6 +379,9 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|
|
|
|
return startStartDto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<ResultRecord> resultRecords = new ArrayList<>();
|
|
|
|
|
List<Flow> flows;
|
|
|
|
|
List<FlowApprovalRole> flowApprovalRoles;
|
|
|
|
|
//下面拷贝一份考评组信息发起后所使用的考评组id为复制后的id
|
|
|
|
|
if(!isInsert){
|
|
|
|
|
evaluationGroup.setCopyId(evaluationGroup.getId());
|
|
|
|
|
@ -450,12 +453,10 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|
|
|
|
|
|
|
|
|
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
|
|
|
|
|
List<ResultDetail> resultDetails = new ArrayList();
|
|
|
|
|
|
|
|
|
|
//下面初始化参与人员
|
|
|
|
|
for (StaffSimpleInfo staffInfo:staffIds
|
|
|
|
|
) {
|
|
|
|
|
staffInfo.setStartId(flowStart.getId());
|
|
|
|
|
|
|
|
|
|
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
|
|
|
|
|
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
|
|
|
|
|
evaluationStartStaff.setEvaluationName(evaluationGroup.getName());
|
|
|
|
|
@ -482,9 +483,9 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|
|
|
|
resultRecord.setCurrentApprovalStaffId(staffInfo.getId());
|
|
|
|
|
//设置当前审批员工姓名 current_approval_staff_name
|
|
|
|
|
resultRecord.setCurrentApprovalStaffName(staffInfo.getName());
|
|
|
|
|
resultRecords.add(resultRecord);
|
|
|
|
|
resultRecordService.insertResultRecord(resultRecord);
|
|
|
|
|
|
|
|
|
|
startStartDto.getResultRecordList().add(resultRecord);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//resultRecordService.initFlowRecord(resultRecord.getId());
|
|
|
|
|
@ -521,22 +522,35 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
evaluationStartStaffService.saveBatch(evaluationStartStaffs);
|
|
|
|
|
startStartDto.setResultRecordList(resultRecords);
|
|
|
|
|
flows = flowService.selectByFlowId(evaluationGroup.getId(),flowStart.getId());
|
|
|
|
|
List<Long> flowIds = flows.stream().map(new Function<Flow, Long>() {
|
|
|
|
|
@Override
|
|
|
|
|
public Long apply(Flow flow) {
|
|
|
|
|
return flow.getId();
|
|
|
|
|
}
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
flowApprovalRoles =flowApprovalRoleService.selectFlowApprovalRoleList(flowIds);
|
|
|
|
|
startStartDto.setFlows(flows);
|
|
|
|
|
startStartDto.setFlowApprovalRoles(flowApprovalRoles);
|
|
|
|
|
startStartDto.setStatus(0);
|
|
|
|
|
return startStartDto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//下面初始化lz_flow流程表 lz_flow_approval_role流程审批表
|
|
|
|
|
List<FlowApprovalRole> flowApprovalRoles = new ArrayList<>();
|
|
|
|
|
flows = new ArrayList<>();
|
|
|
|
|
flowApprovalRoles = new ArrayList<>();
|
|
|
|
|
int stepIndex = 0;
|
|
|
|
|
for (FlowChartDetailRecord flowChartDetailRecord:flowChartDetailRecords
|
|
|
|
|
) {
|
|
|
|
|
) {//初始化考评组对应的的flow
|
|
|
|
|
Flow flow = new Flow();
|
|
|
|
|
flow.setFlowId(evaluationGroup.getId());
|
|
|
|
|
flow.setOpt("+");
|
|
|
|
|
flow.setStartId(flowStart.getId());
|
|
|
|
|
flow.setChartId(flowChartDetailRecord.getChartId());
|
|
|
|
|
flow.setOptDesc(chartNameMaps.get(flowChartDetailRecord.getChartId()));
|
|
|
|
|
|
|
|
|
|
flows.add(flow);
|
|
|
|
|
flowService.insertFlow(flow);
|
|
|
|
|
FlowApprovalRole flowApprovalRole = null;
|
|
|
|
|
List<FlowChartRole> flowChartRoles = null;
|
|
|
|
|
@ -564,7 +578,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|
|
|
|
|
|
|
|
|
String[] optIds = flowChartDetailRecord.getOptIds().split(",");
|
|
|
|
|
for (String id:optIds
|
|
|
|
|
) {
|
|
|
|
|
) {//初始化考评组对应的的FlowApprovalRole
|
|
|
|
|
|
|
|
|
|
flowApprovalRole = new FlowApprovalRole();
|
|
|
|
|
flowApprovalRole.setFlowId(flow.getId());
|
|
|
|
|
@ -637,7 +651,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|
|
|
|
List<ResultDetail> resultDetails = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
|
|
|
|
|
List<ResultRecord> resultRecords = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
//下面初始化参与人员
|
|
|
|
|
for (StaffSimpleInfo staffInfo:staffIds
|
|
|
|
|
) {
|
|
|
|
|
@ -746,9 +760,11 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|
|
|
|
roleJSON += "]";
|
|
|
|
|
roleJSON = roleJSON.replace(",]", "]");
|
|
|
|
|
resultRecord.setFlowStaffIdRole(roleJSON);
|
|
|
|
|
|
|
|
|
|
resultRecords.add(resultRecord);
|
|
|
|
|
resultRecordService.insertResultRecord(resultRecord);
|
|
|
|
|
startStartDto.getResultRecordList().add(resultRecord);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//startStartDto.getResultRecordList().add(resultRecord);
|
|
|
|
|
staffInfo.setRecordId(resultRecord.getId());
|
|
|
|
|
//下面生成实际的考核流程
|
|
|
|
|
|
|
|
|
|
@ -782,6 +798,9 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
startStartDto.setResultRecordList(resultRecords);
|
|
|
|
|
startStartDto.setFlowApprovalRoles(flowApprovalRoles);
|
|
|
|
|
startStartDto.setFlows(flows);
|
|
|
|
|
//如果有数据插入lz_result_detail表
|
|
|
|
|
if(resultDetails.size() > 0){
|
|
|
|
|
//
|
|
|
|
|
@ -794,6 +813,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|
|
|
|
startStartDto.setStatus(5);
|
|
|
|
|
return startStartDto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
startStartDto.setStatus(0);
|
|
|
|
|
return startStartDto;
|
|
|
|
|
}
|
|
|
|
|
@ -807,7 +827,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|
|
|
|
return R.ok().put("data",staffEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initFlowRecordAnsy(List<ResultRecord> resultRecords, List<StaffSimpleInfo> noticeStaff){
|
|
|
|
|
private void initFlowRecordAnsy(List<StartStartDto> resultRecords, List<StaffSimpleInfo> noticeStaff){
|
|
|
|
|
if(resultRecords.size() > 0){
|
|
|
|
|
ThreadInitFlowRecord threadInitFlowRecord = new ThreadInitFlowRecord(resultRecords, noticeStaff);
|
|
|
|
|
|
|
|
|
|
@ -819,14 +839,13 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ThreadInitFlowRecord implements Runnable{
|
|
|
|
|
List<ResultRecord> resultRecords = new ArrayList<>();
|
|
|
|
|
List<StaffSimpleInfo> noticeStaff = new ArrayList<>();
|
|
|
|
|
List<StartStartDto> resultRecords;
|
|
|
|
|
List<StaffSimpleInfo> noticeStaff;
|
|
|
|
|
|
|
|
|
|
public ThreadInitFlowRecord(List<ResultRecord> resultRecords, List<StaffSimpleInfo> noticeStaff){
|
|
|
|
|
//CollectionUtils.addAll(this.resultRecords, new Object[resultRecords.size()]);
|
|
|
|
|
//Collections.copy(resultRecords, resultRecords);
|
|
|
|
|
this.resultRecords.addAll(resultRecords);
|
|
|
|
|
this.noticeStaff.addAll(noticeStaff);
|
|
|
|
|
public ThreadInitFlowRecord(List<StartStartDto> resultRecords, List<StaffSimpleInfo> noticeStaff){
|
|
|
|
|
|
|
|
|
|
this.resultRecords = resultRecords;
|
|
|
|
|
this.noticeStaff = noticeStaff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ -836,9 +855,13 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|
|
|
|
//ch.qos.logback.classic.Logger.threadLocalNo.set(newNo);
|
|
|
|
|
log.info("开始批量初始化流程,数量{}", resultRecords.size());
|
|
|
|
|
|
|
|
|
|
for (ResultRecord resultRecord:resultRecords
|
|
|
|
|
for (StartStartDto startStartDto:resultRecords
|
|
|
|
|
) {
|
|
|
|
|
resultRecordService.initFlowRecord(resultRecord.getId());
|
|
|
|
|
for (ResultRecord resultRecord:startStartDto.getResultRecordList()
|
|
|
|
|
) {
|
|
|
|
|
resultRecordService.initFlowRecord(resultRecord, startStartDto.getFlows(), startStartDto.getFlowApprovalRoles());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|