提交修改

This commit is contained in:
quyixiao 2020-11-23 16:36:37 +08:00
commit 248912ffdc
5 changed files with 44 additions and 22 deletions

View File

@ -86,7 +86,9 @@ public interface FlowRecordMapper extends BaseMapper<FlowRecord> {
List<FlowRecord> selectLastFlowRecordsById(@Param("recordId") Long recordId); List<FlowRecord> selectLastFlowRecordsById(@Param("recordId") Long recordId);
List<FlowRecord> selectLastFlowRecordsByIdAndFlowIndex(@Param("recordId") Long recordId, @Param("flowIndex") int flowIndex); List<FlowRecord> selectLastFlowRecordsByIdAndFlowIndex(@Param("recordId") Long recordId, @Param("flowIndex") int flowIndex, @Param("status") int status);
List<FlowRecord> selectSkipFlowRecordsById(@Param("recordId") Long recordId); List<FlowRecord> selectSkipFlowRecordsById(@Param("recordId") Long recordId);
List<FlowRecord> selectFirstFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status);
} }

View File

@ -81,7 +81,9 @@ public interface FlowRecordService extends IService<FlowRecord> {
//获取最后流程同一个小节点的所有数据 //获取最后流程同一个小节点的所有数据
List<FlowRecord> selectLastFlowRecordsById(Long recordId); List<FlowRecord> selectLastFlowRecordsById(Long recordId);
//获取制定步骤一个小节点的所有数据 //获取制定步骤一个小节点的所有数据
List<FlowRecord> selectLastFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex); List<FlowRecord> selectLastFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status);
List<FlowRecord> selectSkipFlowRecordsById(Long recordId); List<FlowRecord> selectSkipFlowRecordsById(Long recordId);
List<FlowRecord> selectFirstFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status);
} }

View File

@ -217,8 +217,8 @@ public class FlowRecordServiceImpl extends ServiceImpl<FlowRecordMapper, FlowRec
} }
@Override @Override
public List<FlowRecord> selectLastFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex){ public List<FlowRecord> selectLastFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status){
return flowRecordMapper.selectLastFlowRecordsByIdAndFlowIndex(recordId, flowIndex); return flowRecordMapper.selectLastFlowRecordsByIdAndFlowIndex(recordId, flowIndex, status);
} }
@Override @Override
@ -226,4 +226,9 @@ public class FlowRecordServiceImpl extends ServiceImpl<FlowRecordMapper, FlowRec
return flowRecordMapper.selectSkipFlowRecordsById(recordId); return flowRecordMapper.selectSkipFlowRecordsById(recordId);
} }
@Override
public List<FlowRecord> selectFirstFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status){
return flowRecordMapper.selectFirstFlowRecordsByIdAndFlowIndex(recordId, flowIndex, status);
}
} }

View File

@ -522,35 +522,42 @@ public class DingtalkBusiness {
}else{ }else{
if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.REJECT.getType()){//被拒 if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.REJECT.getType()){//被拒
logger.info("任务驳回"); logger.info("任务驳回");
cancelRecords = flowRecordService.selectLastFlowRecordsByIdAndFlowIndex(fromStaff.getResultRecord().getId() cancelRecords = flowRecordService.selectFirstFlowRecordsByIdAndFlowIndex(fromStaff.getResultRecord().getId()
, flowRecords.get(0).getFlowIndex().intValue() + 1);//获取下一步的数据 , flowRecords.get(0).getFlowIndex().intValue() + 1, 0);//获取下一步的数据
}else{ }else{
logger.info("任务流转下一步"); logger.info("任务流转下一步");
cancelRecords = flowRecordService.selectLastFlowRecordsByIdAndFlowIndex(fromStaff.getResultRecord().getId() cancelRecords = flowRecordService.selectLastFlowRecordsByIdAndFlowIndex(fromStaff.getResultRecord().getId()
, flowRecords.get(0).getFlowIndex().intValue() - 1);//获取上一步的数据 , flowRecords.get(0).getFlowIndex().intValue() - 1, 0);//获取上一步的数据
} }
} }
logger.info("查询到可能需要更新的待办任务数量{}", cancelRecords.size()); logger.info("查询到可能需要更新的待办任务数量{}", cancelRecords.size());
if(cancelRecords.size() > 0){ if(cancelRecords.size() > 0){
int flowIndex = cancelRecords.get(0).getFlowIndex().intValue();
for (FlowRecord flowRecord:cancelRecords for (FlowRecord flowRecord:cancelRecords
) { ) {
if(flowRecord.getStatus().intValue() == 1 if(flowRecord.getFlowIndex() == flowIndex){//同一个小结点的才进来
|| flowRecord.getStatus().intValue() == 3 if(flowRecord.getStatus().intValue() == 1
|| flowRecord.getStatus().intValue() == 4 || flowRecord.getStatus().intValue() == 3
|| workMsgTypeEnum.getType() == WorkMsgTypeEnum.REJECT.getType()){ || flowRecord.getStatus().intValue() == 4
logger.info("将要更新人员的待办任务人员id:{}, 姓名:{}", flowRecord.getApprovalStaffId(), || workMsgTypeEnum.getType() == WorkMsgTypeEnum.REJECT.getType()){
flowRecord.getApprovalStaffName()); logger.info("将要更新人员的待办任务人员id:{}, 姓名:{}", flowRecord.getApprovalStaffId(),
ThirdMsgSendRecord thirdMsgSendRecord = flowRecord.getApprovalStaffName());
thirdMsgSendRecordService.selectThirdMsgSendRecordByWorkIdAndStaffIdAndTypeAndStatus( ThirdMsgSendRecord thirdMsgSendRecord =
fromStaff.getResultRecord().getId(), thirdMsgSendRecordService.selectThirdMsgSendRecordByWorkIdAndStaffIdAndTypeAndStatus(
flowRecord.getApprovalStaffId(), 1, 1); fromStaff.getResultRecord().getId(),
if(thirdMsgSendRecord != null){//把原来的任务更新掉 flowRecord.getApprovalStaffId(), 1, 1);
dingTalkUtil.updateWorkMSG(thirdMsgSendRecord, token); if(thirdMsgSendRecord != null){//把原来的任务更新掉
}else{ dingTalkUtil.updateWorkMSG(thirdMsgSendRecord, token);
logger.info("无需更新待办任务"); }else{
logger.info("无需更新待办任务");
}
} }
}else{
logger.info("已经取消完毕");
break;
} }
} }
} }
//给下一步需要处理的人员发送待办任务 //给下一步需要处理的人员发送待办任务

View File

@ -308,11 +308,17 @@
</select> </select>
<select id="selectLastFlowRecordsByIdAndFlowIndex" resultType="com.lz.modules.flow.entity.FlowRecord"> <select id="selectLastFlowRecordsByIdAndFlowIndex" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and flow_index = #{flowIndex} and record_id = #{recordId} select * from lz_flow_record where is_delete = 0 and flow_index <![CDATA[<=]]> #{flowIndex}
and record_id = #{recordId} and status=#{status} order by flow_index desc
</select> </select>
<select id="selectSkipFlowRecordsById" resultType="com.lz.modules.flow.entity.FlowRecord"> <select id="selectSkipFlowRecordsById" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and (status=4 or status=3) and record_id = #{recordId} select * from lz_flow_record where is_delete = 0 and (status=4 or status=3) and record_id = #{recordId}
</select> </select>
<select id="selectFirstFlowRecordsByIdAndFlowIndex" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and flow_index <![CDATA[>=]]> #{flowIndex}
and record_id = #{recordId} and status=#{status} order by flow_index asc
</select>
</mapper> </mapper>