Browse Source

事件处置前置节点状态验证

develop
lau572 7 months ago
parent
commit
19a0369e6d
  1. 7
      zc-business/src/main/java/com/zc/business/controller/DcEventProcessController.java
  2. 12
      zc-business/src/main/java/com/zc/business/mapper/DcEventProcessMapper.java
  3. 12
      zc-business/src/main/java/com/zc/business/service/IDcEventProcessService.java
  4. 15
      zc-business/src/main/java/com/zc/business/service/impl/DcEventProcessServiceImpl.java
  5. 5
      zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml

7
zc-business/src/main/java/com/zc/business/controller/DcEventProcessController.java

@ -2,6 +2,7 @@ package com.zc.business.controller;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.config.RuoYiConfig;
@ -100,6 +101,12 @@ public class DcEventProcessController extends BaseController
@Log(title = "事件处理流程", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DcEventProcess dcEventProcess){
if (dcEventProcess.getProcessType() != null && dcEventProcess.getProcessType() == 1){
int status = dcEventProcessService.selectPreviousNodeStatus(dcEventProcess.getEventId(),dcEventProcess.getProcessId());
if (status < 1){
return AjaxResult.error("前置节点未点亮!");
}
}
return toAjax(dcEventProcessService.insertDcEventProcess(dcEventProcess));
}

12
zc-business/src/main/java/com/zc/business/mapper/DcEventProcessMapper.java

@ -2,6 +2,7 @@ package com.zc.business.mapper;
import java.util.List;
import com.zc.business.domain.DcEventProcess;
import org.apache.ibatis.annotations.Param;
/**
* 事件处理流程Mapper接口
@ -75,4 +76,15 @@ public interface DcEventProcessMapper
List<DcEventProcess> selectDcDispatchByEventId(String id);
int selectFinalNode(String eventId);
/**
* @Description 查询前置节点状态
*
* @author liuwenge
* @date 2024/5/13 16:08
* @param eventId 事件id
* @param processId 节点id
* @return 状态 0未完成 1已完成
*/
int selectPreviousNodeStatus(@Param("eventId") String eventId, @Param("processId") Long processId);
}

12
zc-business/src/main/java/com/zc/business/service/IDcEventProcessService.java

@ -2,6 +2,7 @@ package com.zc.business.service;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import com.ruoyi.common.exception.file.InvalidExtensionException;
import com.zc.business.domain.DcEventProcess;
@ -71,4 +72,15 @@ public interface IDcEventProcessService
int deleteDcEventProcessById(Long id);
List<DcEventProcess> selectDcEventProcessListById(String id);
/**
* @Description 查询前置节点状态
*
* @author liuwenge
* @date 2024/5/13 15:57
* @param eventId 事件id
* @param processId 节点id
* @return status 0未完成 1已完成
*/
int selectPreviousNodeStatus(String eventId, Long processId);
}

15
zc-business/src/main/java/com/zc/business/service/impl/DcEventProcessServiceImpl.java

@ -148,4 +148,19 @@ public class DcEventProcessServiceImpl implements IDcEventProcessService
public List<DcEventProcess> selectDcEventProcessListById(String id) {
return dcEventProcessMapper.selectDcDispatchByEventId(id);
}
/**
* @Description 查询前置节点状态
*
* @author liuwenge
* @date 2024/5/13 16:07
* @param eventId 事件id
* @param processId 节点id
* @return 状态 0未完成 1已完成
*/
@Override
public int selectPreviousNodeStatus(String eventId, Long processId){
return dcEventProcessMapper.selectPreviousNodeStatus(eventId,processId);
}
}

5
zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml

@ -145,4 +145,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where t1.id = #{eventId};
</select>
<select id="selectPreviousNodeStatus" resultType="java.lang.Integer">
select count(*) from dc_event_process
where event_id = #{eventId} and process_type = '1' and process_id = #{processId} - 1
</select>
</mapper>
Loading…
Cancel
Save