提交修改

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

View File

@ -308,11 +308,17 @@
</select>
<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 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>
<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>