package com.zc.business.controller; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.zc.business.domain.DcEmergencyPlans; import com.zc.business.domain.DcEvent; import com.zc.business.domain.DcEventAnDcEmergencyPlans; import com.zc.business.domain.DcWarning; import com.zc.business.service.DcEmergencyPlansService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.List; /** * 事件预案Controller * * @author wangjiabao * @date 2024-02-21 */ @Api(tags = "事件预案") @RestController @RequestMapping("/business/plans") public class DcEmergencyPlansController extends BaseController { @Autowired private DcEmergencyPlansService dcEmergencyPlansService; /** * 查询事件预案列表 */ @ApiOperation("查询事件预案列表") // @PreAuthorize("@ss.hasPermi('business:plans:list')") @GetMapping("/list") public TableDataInfo list(DcEmergencyPlans dcEmergencyPlans) { startPage(); List list = dcEmergencyPlansService.selectDcEmergencyPlansList(dcEmergencyPlans); return getDataTable(list); } /** * 根据事件预案id查询事件预案列表 */ @ApiOperation("根据事件预案id查询事件预案列表") // @PreAuthorize("@ss.hasPermi('business:plans:list')") @GetMapping("/list/{id}") public AjaxResult list(@PathVariable @ApiParam(name = "id", value = "事件预案id", required = true) Integer id) { DcEmergencyPlans dcEmergencyPlans = dcEmergencyPlansService.selectDcEmergencyPlans(id); return AjaxResult.success(dcEmergencyPlans); } /** * 交通事件-根据事件数据查询事件预案列表 */ @ApiOperation("交通事件-根据事件数据查询事件预案列表") @PreAuthorize("@ss.hasPermi('business:plans:list')") @PostMapping("/list/event/type") public AjaxResult listByEventType(@RequestBody DcEvent dcEvent) { List dcEmergencyPlansList = dcEmergencyPlansService.selectDcEmergencyPlansByEventType(dcEvent); dcEmergencyPlansService.dispositionDeviceContent(dcEmergencyPlansList,dcEvent); return AjaxResult.success(dcEmergencyPlansList); } /** * 感知事件-根据事件数据查询事件预案列表 */ // @ApiOperation("感知事件-根据事件数据查询事件预案列表") @PreAuthorize("@ss.hasPermi('business:plans:list')") @PostMapping("/list/warning/type") public AjaxResult listByEventType(@RequestBody DcWarning dcWarning) { List dcEmergencyPlansList = dcEmergencyPlansService.selectDcEmergencyPlansByWarningType(dcWarning); return AjaxResult.success(dcEmergencyPlansList); } /** * 交通事件-情报板确认回显原始模板 */ @ApiOperation("交通事件-情报板确认回显原始模板") @PreAuthorize("@ss.hasPermi('business:plans:list')") @PostMapping("/event/board/confirm") public AjaxResult eventBoardConfirm(@RequestBody DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) { return AjaxResult.success(dcEmergencyPlansService.eventBoardConfirm(dcEventAnDcEmergencyPlans)); } /** * 感知事件-情报板确认回显原始模板 */ // @ApiOperation("感知事件-情报板确认回显原始模板") @PreAuthorize("@ss.hasPermi('business:plans:list')") @PostMapping("/warning/board/confirm") public AjaxResult warningBoardConfirm(@RequestBody DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) { return AjaxResult.success(dcEmergencyPlansService.warningBoardConfirm(dcEventAnDcEmergencyPlans)); } /** * 感知事件-情报板自动生成文字 */ // @ApiOperation("感知事件-情报板自动生成文字") @PostMapping("/warning/automatic") public AjaxResult warningAutomaticGeneration(@RequestBody DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) { return AjaxResult.success(dcEmergencyPlansService.warningAutomaticGeneration(dcEventAnDcEmergencyPlans)); } /** * 交通事件-情报板自动生成文字 */ // @ApiOperation("交通事件-情报板自动生成文字") @PostMapping("/event/automatic") public AjaxResult eventAutomaticGeneration(@RequestBody DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) { return AjaxResult.success(dcEmergencyPlansService.eventAutomaticGeneration(dcEventAnDcEmergencyPlans)); } /** * 交通事件确定 */ @ApiOperation("交通事件确定") @PreAuthorize("@ss.hasPermi('business:plans:edit')") @PostMapping("/event/confirm") public AjaxResult eventConfirm(@RequestBody DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) { return AjaxResult.success(dcEmergencyPlansService.executionEventConfirmation(dcEventAnDcEmergencyPlans)); } /** * 根据事件id-查询预案事件关联表 */ @ApiOperation("根据事件id-查询预案事件关联表") @GetMapping("/event/assoc/{id}") public AjaxResult eventConfirm(@PathVariable("id") String id) { return AjaxResult.success(dcEmergencyPlansService.selectEventPlanAssocByEventId(id)); } /** * 根据id-查询预案事件关联表 */ @ApiOperation("根据id-查询预案事件关联表") @GetMapping("/event/assoc/{assocId}") public AjaxResult eventConfirmById(@PathVariable("assocId") Long assocId) { return AjaxResult.success(dcEmergencyPlansService.selectEventPlanAssocById(assocId)); } /** * 感知事件确定 */ // @ApiOperation("感知事件确认") @PreAuthorize("@ss.hasPermi('business:plans:edit')") @PostMapping("/warning/confirm") public AjaxResult warningConfirm(@RequestBody DcEventAnDcEmergencyPlans dcEventAnDcEmergencyPlans) { return AjaxResult.success(dcEmergencyPlansService.executionWarningConfirmation(dcEventAnDcEmergencyPlans)); } /** * 新增事件预案 */ @ApiOperation("新增预案") @PreAuthorize("@ss.hasPermi('business:plans:add')") @PostMapping public AjaxResult add(@RequestBody DcEmergencyPlans dcEmergencyPlans) { return toAjax(dcEmergencyPlansService.insertDcEmergencyPlans(dcEmergencyPlans)); } /** * 修改事件预案 */ @ApiOperation("修改预案") @PreAuthorize("@ss.hasPermi('business:plans:edit')") @PutMapping public AjaxResult update(@RequestBody DcEmergencyPlans dcEmergencyPlans) { return toAjax(dcEmergencyPlansService.updateDcEmergencyPlans(dcEmergencyPlans)); } /** * 批量删除事件预案 */ @ApiOperation("批量删除预案") @PreAuthorize("@ss.hasPermi('business:plans:remove')") @DeleteMapping("/{ids}") public AjaxResult update(@PathVariable String[] ids) { return toAjax(dcEmergencyPlansService.deleteDcEmergencyPlans(ids)); } }