济菏高速数据中心代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
6.2 KiB

package com.zc.business.controller;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.zc.business.domain.DcEvent;
import com.zc.business.domain.DcEventProcess;
import com.zc.business.domain.MdEvent;
import com.zc.business.enums.UniversalEnum;
import com.zc.business.service.IDcEventProcessService;
import com.zc.business.service.IDcEventService;
import com.zc.business.service.IMiddleDatabaseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Date;
import java.util.List;
/**
* 事件处理流程Controller
*
* @author ruoyi
* @date 2024-01-03
*/
@Api(tags = "事件处置流程")
@RestController
@RequestMapping("/system/process")
public class DcEventProcessController extends BaseController
{
@Autowired
private IDcEventProcessService dcEventProcessService;
11 months ago
@Autowired
private IDcEventService dcEventService;
@Autowired
private IMiddleDatabaseService middleDatabaseService;
/**
* 查询事件处理流程列表
*/
@ApiOperation("查询事件处理流程列表")
@GetMapping("/list")
public List<DcEventProcess> list(DcEventProcess dcEventProcess)
{
return dcEventProcessService.selectDcEventProcessList(dcEventProcess);
}
/**
* 分页查询事件处理流程列表
*/
@ApiOperation("分页查询事件处理流程列表")
@GetMapping("/page")
public TableDataInfo page(DcEventProcess dcEventProcess)
{
startPage();
List<DcEventProcess> list = dcEventProcessService.selectDcEventProcessList(dcEventProcess);
return getDataTable(list);
}
/**
* 导出事件处理流程列表
*/
@ApiOperation("导出事件处理流程列表")
// @PreAuthorize("@ss.hasPermi('system:process:export')")
@Log(title = "事件处理流程", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DcEventProcess dcEventProcess)
{
List<DcEventProcess> list = dcEventProcessService.selectDcEventProcessList(dcEventProcess);
ExcelUtil<DcEventProcess> util = new ExcelUtil<>(DcEventProcess.class);
util.exportExcel(response, list, UniversalEnum.EVENT_PROCESSING_FLOW_DATA.getValue());
}
/**
* 获取事件处理流程详细信息
*/
@ApiOperation("获取事件处理流程详细信息")
// @PreAuthorize("@ss.hasPermi('system:process:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(dcEventProcessService.selectDcEventProcessById(id));
}
/**
* 新增事件处理流程
*/
@ApiOperation("新增事件处理流程")
// @PreAuthorize("@ss.hasPermi('system:process:add')")
@Log(title = "事件处理流程", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody @Valid DcEventProcess dcEventProcess){
11 months ago
DcEvent dcEvent = dcEventService.selectDcEventById(dcEventProcess.getEventId());
if (dcEvent == null){
return AjaxResult.error(UniversalEnum.INCORRECT_EVENT_INFORMATION.getValue());
}
if (dcEvent.getEventState() == UniversalEnum.TWO.getNumber()){
return AjaxResult.error(UniversalEnum.THE_EVENT_ENDED_NO_OPERATION_CAN_BE_PERFORMED.getValue());
11 months ago
}
if (dcEventProcess.getProcessType() != null && dcEventProcess.getProcessType() == UniversalEnum.ONE.getNumber()){
int status = dcEventProcessService.selectPreviousNodeStatus(dcEventProcess.getEventId(),dcEventProcess.getProcessId());
if (status < UniversalEnum.ONE.getNumber()){
return AjaxResult.error(UniversalEnum.THE_FRONT_NODE_IS_NOT_LIT.getValue());
}
}
if (dcEvent.getEventType() == 1 || dcEvent.getEventType() == 2 || dcEvent.getEventType() == 6){
if (dcEventProcess.getProcessId() != null && dcEventProcess.getProcessId() == 3) {
//中间库 更新清障到达时间
MdEvent mdEvent = new MdEvent();
mdEvent.setFusionId(dcEventProcess.getEventId());
mdEvent.setClearArriveTime(new Date());
middleDatabaseService.updateMiddleDatabaseEvent(mdEvent);
} else if (dcEventProcess.getProcessId() != null && dcEventProcess.getProcessId() == 6){
//中间库 更新清障结束时间
MdEvent mdEvent = new MdEvent();
mdEvent.setFusionId(dcEventProcess.getEventId());
mdEvent.setClearEndTime(new Date());
middleDatabaseService.updateMiddleDatabaseEvent(mdEvent);
}
}
return toAjax(dcEventProcessService.insertDcEventProcess(dcEventProcess));
}
/**
* 修改事件处理流程
*/
@ApiOperation("修改事件处理流程")
// @PreAuthorize("@ss.hasPermi('system:process:edit')")
@Log(title = "事件处理流程", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DcEventProcess dcEventProcess)
{
return toAjax(dcEventProcessService.updateDcEventProcess(dcEventProcess));
}
/**
* 删除事件处理流程
*/
@ApiOperation("删除事件处理流程")
// @PreAuthorize("@ss.hasPermi('system:process:remove')")
@Log(title = "事件处理流程", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(dcEventProcessService.deleteDcEventProcessByIds(ids));
}
/**
* 根据事件id查询处理流程
*/
@GetMapping("/eventProcessById/{id}")
@ApiOperation("根据事件id查询处理流程")
public TableDataInfo eventProcessById(@PathVariable String id){
return getDataTable(dcEventProcessService.selectDcEventProcessListById(id));
}
}