package com.zc.business.controller; import com.ruoyi.common.utils.uuid.IdUtils; import com.zc.business.domain.DcWarningBatchConvert; import com.zc.business.service.IDcWarningService; 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.DcWarning; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.HashMap; import java.util.List; /** * 预警信息Controller * * @author ruoyi * @date 2024-01-26 */ @Api(tags = "感知事件") @RestController @RequestMapping("/business/warning") public class DcWarningController extends BaseController { @Autowired private IDcWarningService dcWarningService; /** * 查询预警信息列表 */ @ApiOperation("查询感知事件列表") @PreAuthorize("@ss.hasPermi('business:warning:list')") @GetMapping("/list") public TableDataInfo list(DcWarning dcWarning) { startPage(); List> list = dcWarningService.selectDcWarningList(dcWarning); return getDataTable(list); } /** * 导出预警信息列表 */ @PreAuthorize("@ss.hasPermi('business:warning:export')") @Log(title = "预警信息", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, DcWarning dcWarning) { List list = dcWarningService.export(dcWarning); ExcelUtil util = new ExcelUtil<>(DcWarning.class); util.exportExcel(response, list, "预警信息数据"); } /** * 新增预警信息 */ @PreAuthorize("@ss.hasPermi('business:warning:add')") @Log(title = "预警信息", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody DcWarning dcWarning) { //设置事件Id UUID无下划线格式32 String uuid = IdUtils.fastSimpleUUID(); dcWarning.setId(uuid); return toAjax(dcWarningService.insertDcWarning(dcWarning)); } /** * 修改预警信息 */ @PreAuthorize("@ss.hasPermi('business:warning:edit')") @Log(title = "预警信息", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody DcWarning dcWarning) { return toAjax(dcWarningService.updateDcWarning(dcWarning)); } /** * 删除预警信息 */ @PreAuthorize("@ss.hasPermi('business:warning:remove')") @Log(title = "预警信息", businessType = BusinessType.DELETE) @DeleteMapping("/{id}") public AjaxResult remove(@PathVariable String id) { return toAjax(dcWarningService.deleteDcWarningByIds(id)); } //感知事件转交通事件 @PostMapping("/updateWarningConvert") public AjaxResult updateWarningConvert(@RequestBody DcWarning dcWarning) { return dcWarningService.updateWarningConvert(dcWarning); } //感知事件删除 @PostMapping("/delete") public AjaxResult deleteDcWarningByStringId(@RequestBody DcWarning dcWarning) { if (dcWarning==null){ return AjaxResult.error("参数错误"); } if (StringUtils.isBlank(dcWarning.getId())){ return AjaxResult.error("参数错误"); } return toAjax(dcWarningService.deleteDcWarningByStringId(dcWarning)); } /** *视频AI 上报 条件查询 */ @GetMapping("/selectDcWarningoTherConfiglist") public TableDataInfo selectDcWarningoTherConfig(DcWarning dcWarning) { startPage(); List> list = dcWarningService.selectDcWarningoTherConfig(dcWarning); return getDataTable(list); } @ApiOperation("感知事件批量转换") @PostMapping("/batchConvert") public AjaxResult batchConvert(@RequestBody DcWarningBatchConvert dcWarningBatchConvert){ return dcWarningService.batchConvert(dcWarningBatchConvert); } }