package com.zc.business.controller; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletResponse; import com.zc.business.domain.DcEvent; import com.zc.business.service.IDcEventService; import com.zc.common.core.websocket.WebSocketService; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 事件信息Controller * * @author ruoyi * @date 2024-01-03 */ @Api(tags = "事件信息") @RestController @RequestMapping("/dc/system/event") public class DcEventController extends BaseController { @Autowired private IDcEventService dcEventService; /** * 查询事件信息列表 */ @ApiOperation("查询事件信息列表") // @PreAuthorize("@ss.hasPermi('system:event:list')") @GetMapping("/list") public TableDataInfo list(DcEvent dcEvent) { startPage(); List list = dcEventService.selectDcEventList(dcEvent); return getDataTable(list); } /** * 无分页根据桩号查询事件信息列表 */ @ApiOperation("无分页根据桩号查询事件信息列表") // @PreAuthorize("@ss.hasPermi('system:event:query')") @PostMapping("/query") public AjaxResult query(@RequestBody Map parameter) { return AjaxResult.success(dcEventService.eventPileNumberQueryEvent(parameter)); } /**调度记录-事件列表 按时间展示交通事件。默认当天时间 。可查询条件 交通事件状态 ,时间范围 * */ @ApiOperation("调度记录-事件列表 按时间展示交通事件,默认当天时间 。可查询条件 交通事件状态 ,时间范围") @GetMapping("/dispatchEventList") public TableDataInfo dispatchEventList(DcEvent dcEvent){ List list = dcEventService.selectDispatchEventList(dcEvent); return getDataTable(list); } /** * 导出事件信息列表 */ @ApiOperation("导出事件信息列表") //@PreAuthorize("@ss.hasPermi('system:event:export')") @Log(title = "事件信息", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, DcEvent dcEvent) { List list = dcEventService.selectDcEventList(dcEvent); ExcelUtil util = new ExcelUtil(DcEvent.class); util.exportExcel(response, list, "事件信息数据"); } /** * 获取事件信息详细信息 */ @ApiOperation("获取事件信息详细信息") //@PreAuthorize("@ss.hasPermi('system:event:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") String id) { DcEvent dcEvent = dcEventService.selectDcEventById(id); return AjaxResult.success(dcEvent); } /** * 获取事件以及子类详细信息 */ @ApiOperation("获取事件以及子类详细信息") //@PreAuthorize("@ss.hasPermi('system:event:query')") @GetMapping( "/eventSubclass/{id}") @ApiImplicitParams(@ApiImplicitParam(name = "id", value = "事件id", dataType = "String")) public AjaxResult getEventById(@PathVariable("id") String id) { DcEvent dcEvent = dcEventService.selectEventSubclassById(id); return AjaxResult.success(dcEvent); } /** * 新增事件信息 */ @ApiOperation("新增事件信息") //@PreAuthorize("@ss.hasPermi('system:event:add')") @Log(title = "事件信息", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody DcEvent dcEvent) { return toAjax(dcEventService.insertDcEvent(dcEvent)); } /** * 修改事件信息 */ @ApiOperation("修改事件信息") // @PreAuthorize("@ss.hasPermi('system:event:edit')") @Log(title = "事件信息", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody DcEvent dcEvent) { return toAjax(dcEventService.updateDcEvent(dcEvent)); } /** * 删除事件信息 */ @ApiOperation("删除事件信息") // @PreAuthorize("@ss.hasPermi('system:event:remove')") @Log(title = "事件信息", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable String[] ids ) { return toAjax(dcEventService.deleteDcEventByIds(ids)); } @ApiOperation("事件数量统计") // @PreAuthorize("@ss.hasPermi('system:event:list')") @GetMapping("/count") public Map count() { Map map = dcEventService.selectCount(); return map; } @ApiOperation("根据事件id修改事件状态") // @PreAuthorize("@ss.hasPermi('system:event:edit')") @Log(title = "事件信息", businessType = BusinessType.UPDATE) @PutMapping("/dcEventState/{id}/{state}") public AjaxResult dcEventState(@PathVariable("id") String id,@PathVariable("state") int state) { return toAjax(dcEventService.updateDcEventState(id,state)); } /** * @Description 查询事件流程状态 * * @author liuwenge * @date 2024/4/11 11:19 * @param eventId 事件id * @return com.ruoyi.common.core.domain.AjaxResult */ @ApiOperation("查询事件流程状态") @GetMapping( "/getProcessNode/{eventId}") public AjaxResult getProcessNode(@ApiParam(name = "eventId", value = "事件id", required = true) @PathVariable("eventId") String eventId){ return dcEventService.getProcessNode(eventId); } /** * @Description 解除事件 * * @author liuwenge * @date 2024/4/11 14:12 * @param eventId * @return com.ruoyi.common.core.domain.AjaxResult */ @ApiOperation("解除事件") @PostMapping("/completeEvent") public AjaxResult completeEvent(@ApiParam(value="事件id", name="eventId", required=true) @RequestParam("eventId") String eventId){ return dcEventService.completeEvent(eventId); } /** * @Description 解除事件 * * @author liuwenge * @date 2024/4/11 14:12 * @param eventId * @return com.ruoyi.common.core.domain.AjaxResult */ @ApiOperation("无需清障") @PostMapping("/skipClear") public AjaxResult skipClear(@ApiParam(value="事件id", name="eventId", required=true) @RequestParam ("eventId") String eventId){ return dcEventService.skipClear(eventId); } @ApiOperation("调度记录") @GetMapping("/dispatchRecordEventList") public TableDataInfo dispatchRecordEventList(DcEvent dcEvent){ startPage(); List list = dcEventService.dispatchRecordEventList(dcEvent); return getDataTable(list); } /** * @Description 查询关联事件 * * @author liuwenge * @date 2024/5/30 14:27 * @param eventId * @return com.ruoyi.common.core.domain.AjaxResult */ @ApiOperation("查询关联事件") @GetMapping( "/getLinkEvent/{eventId}") public AjaxResult getLinkEvent(@ApiParam(name = "eventId", value = "事件id", required = true) @PathVariable("eventId") String eventId){ return dcEventService.getLinkEvent(eventId); } /** * @Description 获取事件数量 * * @author liuwenge * @date 2024/6/6 18:45 * @param type * @return com.ruoyi.common.core.domain.AjaxResult */ @ApiOperation("获取事件数量") @GetMapping( "/getCountNum/{type}") public AjaxResult getCountNum(@ApiParam(name = "type", value = "类型 1:告警 2:待确认 3:处置中", required = true) @PathVariable("type") String type){ return dcEventService.getCountNum(type); } }