修改发起考核接口,

This commit is contained in:
wulin 2020-10-27 11:13:13 +08:00
parent 8ade53dfb1
commit daad5e41f6
9 changed files with 51 additions and 44 deletions

View File

@ -40,4 +40,6 @@ public interface FlowChartMapper extends BaseMapper<FlowChart> {
List<FlowChartRoleDto> selectChartRoleByChartId(Long id);
List<FlowChartDto> selectFlowChartDtoByFlowManagerId(Long id);
List<FlowChart> selectFlowChartsByGroupId(Long groupId);
}

View File

@ -46,7 +46,7 @@ public class FlowApprovalRole implements java.io.Serializable {
private Integer stepType;
//小结点的第几步从0开始如果是多人步数相同
@ApiModelProperty(value = "小结点的第几步从0开始如果是多人步数相同", name = "stepIndex")
@ApiModelProperty(value = "小结点的第几步从0开始如果是多人步数相同", name = "stepIndex")
private Integer stepIndex;
/**
*

View File

@ -53,7 +53,7 @@ public class FlowChartDetailRecord implements java.io.Serializable {
@ApiModelProperty(value = "步骤类型0依次1或签同时通知一人通过或拒绝即可2会签同时通知所有人同意才可以", name = "stepType")
private Integer stepType;
//第几步从0开始按照有小到排序
@ApiModelProperty(value = "第几步从0开始按照有小到排序", name = "stepIndex")
@ApiModelProperty(value = "第几步从0开始按照有小到排序,大节点中的排序", name = "stepIndex")
private Integer stepIndex;
//权重评分时所占权重
@ApiModelProperty(value = "权重,评分时所占权重", name = "weight")

View File

@ -42,7 +42,7 @@ public class FlowChartDetailRecordDto {
@ApiModelProperty(value = "步骤类型0依次1或签同时通知一人通过或拒绝即可2会签同时通知所有人同意才可以", name = "stepType")
private Integer stepType;
//第几步从0开始按照有小到排序
@ApiModelProperty(value = "第几步从0开始按照有小到排序", name = "stepIndex")
@ApiModelProperty(value = "第几步从0开始按照有小到排序,大节点中的排序", name = "stepIndex")
private Integer stepIndex;
//权重评分时所占权重
@ApiModelProperty(value = "权重,评分时所占权重", name = "weight")

View File

@ -62,7 +62,7 @@ public class FlowChartDetailRecordReq implements java.io.Serializable {
@ApiModelProperty(value = "步骤类型0依次1或签同时通知一人通过或拒绝即可2会签同时通知所有人同意才可以", name = "stepType")
private Integer stepType;
//第几步从0开始按照有小到排序
@ApiModelProperty(value = "第几步从0开始按照有小到排序", name = "stepIndex")
@ApiModelProperty(value = "第几步从0开始按照有小到排序,大节点中的排序", name = "stepIndex")
private Integer stepIndex;
//权重评分时所占权重
@ApiModelProperty(value = "权重,评分时所占权重", name = "weight")

View File

@ -39,4 +39,6 @@ public interface FlowChartService extends IService<FlowChart> {
List<FlowChartRoleDto> selectChartRoleByChartId(Long id);
List<FlowChartDto> selectFlowChartDtoByFlowManagerId(Long id);
List<FlowChart> selectFlowChartsByGroupId(Long groupId);
}

View File

@ -77,6 +77,11 @@ public class FlowChartServiceImpl extends ServiceImpl<FlowChartMapper, FlowChart
return flowChartMapper.selectFlowChartDtoByFlowManagerId(id);
}
@Override
public List<FlowChart> selectFlowChartsByGroupId(Long groupId){
return flowChartMapper.selectFlowChartsByGroupId(groupId);
}
}

View File

@ -150,7 +150,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
}
Map<Long, String> chartNameMaps = new HashedMap();//流程节点与流程名称对应map下面多次循环减少数据库查找
Map<String, List<StaffEntity>> staffManages = new HashedMap();//部门(id+几级)和部门几级管理对应关系减少数据库查找
//下面开始初始化流程
List<Long> ids = Arrays.stream(flowStart.getGroupIds().split(",")).map(new Function<String, Long>() {
@ -178,13 +178,25 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
return R.error(evaluationGroup.getName() + "——没有设置考核模板");
}
List<FlowChart> flowCharts = flowChartService.selectFlowChartsByGroupId(evaluationGroup.getId());
if(flowCharts.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
return R.error(evaluationGroup.getName() + "——没有绩效流程节点");
}
List<FlowChartDetailRecord> flowChartDetailRecords = new ArrayList<>();
for (FlowChart chart:flowCharts
) {//按照节点顺序获取正确的流程
List<FlowChartDetailRecord> flowChartDetailRecords1
= flowChartDetailRecordService.selectFlowChartDetailRecordByGroupIdAndChartId(evaluationGroup.getId(), chart.getId());
flowChartDetailRecords.addAll(flowChartDetailRecords1);
}
List<FlowChartDetailRecord> flowChartDetailRecords
= flowChartDetailRecordService.selectFlowChartDetailRecordByGroupId(evaluationGroup.getId());
if(flowChartDetailRecords.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
return R.error(evaluationGroup.getName() + "——没有设置考核流程");
}
Map<Long, String> chartNameMaps =
flowCharts.stream().collect(Collectors.toMap(FlowChart::getId, FlowChart::getName));//流程节点与流程名称对应map下面多次循环减少数据库查找
List<StaffEntity> staffManagers = null;
if(!StringUtil.isEmpty(evaluationGroup.getManagerIds())){
@ -255,34 +267,16 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
flow.setOpt("+");
flow.setStartId(flowStart.getId());
flow.setChartId(flowChartDetailRecord.getChartId());
String optName;
if(chartNameMaps.containsKey(flowChartDetailRecord.getChartId())){//缓存
optName = chartNameMaps.get(flowChartDetailRecord.getChartId());
}else{//查找数据库
FlowChart flowChart = flowChartService.selectFlowChartById(flowChartDetailRecord.getChartId());
chartNameMaps.put(flowChart.getId(), flowChart.getName());
optName = flowChart.getName();
}
flow.setOptDesc(optName);
flowService.insertFlow(flow);
flow.setOptDesc(chartNameMaps.get(flowChartDetailRecord.getChartId()));
flowService.insertFlow(flow);
FlowApprovalRole flowApprovalRole = null;
if(flowChartDetailRecord.getOptType().intValue() == ChartOptType.APPOINT.getCode()){//指定人员的
String[] optIds = flowChartDetailRecord.getOptIds().split(",");
for (String id:optIds
) {
/*String[] roleIds = flowChartDetailRecord.getRoleIds().split(",");
for (String roleId:roleIds
) {
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
flowApprovalRole.setFlowId(flow.getId());
flowApprovalRole.setApprovalId(Long.parseLong(id));
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
flowApprovalRole.setRoleId(roleId);
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
flowApprovalRoles.add(flowApprovalRole);
flowApprovalRole.setStepIndex(stepIndex);
}*/
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
flowApprovalRole = new FlowApprovalRole();
flowApprovalRole.setFlowId(flow.getId());
flowApprovalRole.setApprovalId(Long.parseLong(id));
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
@ -290,29 +284,25 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
flowApprovalRoles.add(flowApprovalRole);
flowApprovalRole.setStepIndex(stepIndex);
if(flowChartDetailRecord.getStepType().intValue() == 0){
//依次
stepIndex++;
}
}
stepIndex++;
//stepIndex++;
if(flowApprovalRole != null){
stepIndex = flowApprovalRole.getStepIndex() + 1;
}
}else{
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
flowApprovalRole = new FlowApprovalRole();
flowApprovalRole.setFlowId(flow.getId());
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
flowApprovalRole.setRoleId(flowChartDetailRecord.getRoleIds());
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
flowApprovalRoles.add(flowApprovalRole);
flowApprovalRole.setStepIndex(stepIndex);
/*String[] roleIds = flowChartDetailRecord.getRoleIds().split(",");
for (String roleId:roleIds
) {
FlowApprovalRole flowApprovalRole = new FlowApprovalRole();
flowApprovalRole.setFlowId(flow.getId());
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
flowApprovalRole.setRoleId(roleId);
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
flowApprovalRoles.add(flowApprovalRole);
flowApprovalRole.setStepIndex(stepIndex);
}*/
stepIndex++;
}

View File

@ -106,5 +106,13 @@
select * from lz_flow_chart where process_id=#{id} and is_delete = 0 order by step_index asc
</select>
<select id="selectFlowChartsByGroupId" resultType="com.lz.modules.flow.entity.FlowChart" >
select * from lz_flow_chart where process_id=(
select chart.process_id from lz_flow_chart as chart
left JOIN lz_flow_chart_detail_record as record on record.chart_id=chart.id
where record.evaluation_group_id=#{groupId} and record.is_delete=0 and chart.is_delete=0 limit 1
) and is_delete=0 order by step_index asc
</select>
</mapper>