优化跳过待办代码

This commit is contained in:
wulin 2020-11-20 18:40:27 +08:00
parent c6c4a4ae34
commit 7dcc093843
5 changed files with 18 additions and 11 deletions

View File

@ -87,4 +87,6 @@ public interface FlowRecordMapper extends BaseMapper<FlowRecord> {
List<FlowRecord> selectLastFlowRecordsById(@Param("recordId") Long recordId);
List<FlowRecord> selectLastFlowRecordsByIdAndFlowIndex(@Param("recordId") Long recordId, @Param("flowIndex") int flowIndex);
List<FlowRecord> selectSkipFlowRecordsById(@Param("recordId") Long recordId);
}

View File

@ -82,4 +82,6 @@ public interface FlowRecordService extends IService<FlowRecord> {
List<FlowRecord> selectLastFlowRecordsById(Long recordId);
//获取制定步骤一个小节点的所有数据
List<FlowRecord> selectLastFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex);
List<FlowRecord> selectSkipFlowRecordsById(Long recordId);
}

View File

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

View File

@ -490,16 +490,10 @@ public class DingtalkBusiness {
}else if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.SKIP.getType()){//跳过
//跳过
logger.info("跳过待办任务处理");
FlowChange flowChange = flowChangeService.selectFlowChangeByRecordIdAndToIdAndType(info.getResultRecord().getId(),
info.getId(), 1);
ThirdMsgSendRecord thirdMsgSendRecord =
thirdMsgSendRecordService.selectThirdMsgSendRecordByWorkIdAndStaffIdAndTypeAndStatus(
info.getResultRecord().getId(),
flowChange.getApprovalId(), 1, 1);
if(thirdMsgSendRecord != null){//把原来的任务更新掉
dingTalkUtil.updateWorkMSG(thirdMsgSendRecord, token);
}
List<FlowRecord> flowRecords = flowRecordService.selectAndOrFlowRecordsById(flowChange.getFlowRecordId(), info.getResultRecord().getId());
List<FlowRecord> flowRecords =
flowRecordService.selectSkipFlowRecordsById(info.getResultRecord().getId());//取消所有跳过的人
logger.info("查询到可能需要更新待办任务数量{}", flowRecords.size());
if(flowRecords.size() > 0){
if(flowRecords.get(0).getType().intValue() == 1){
@ -510,7 +504,7 @@ public class DingtalkBusiness {
if(flowRecord.getApprovalStaffId().longValue() != info.getId()){
logger.info("更新非直接跳关人员的待办任务人员id:{}, 姓名:{}", flowRecord.getApprovalStaffId(),
flowRecord.getApprovalStaffName());
thirdMsgSendRecord =
ThirdMsgSendRecord thirdMsgSendRecord =
thirdMsgSendRecordService.selectThirdMsgSendRecordByWorkIdAndStaffIdAndTypeAndStatus(
info.getResultRecord().getId(),
flowRecord.getApprovalStaffId(), 1, 1);

View File

@ -310,5 +310,9 @@
<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>
<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>
</mapper>