济菏高速数据中心代码
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.

153 lines
5.1 KiB

package com.zc.business.controller;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.zc.business.domain.DcEvent;
import com.zc.business.service.IDcEventService;
import io.swagger.annotations.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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<DcEvent> list = dcEventService.selectDcEventList(dcEvent);
return getDataTable(list);
}
/**调度记录-事件列表 按时间展示交通事件默认当天时间 可查询条件 交通事件状态 时间范围
*
*/
@ApiOperation("调度记录-事件列表 按时间展示交通事件,默认当天时间 。可查询条件 交通事件状态 ,时间范围")
@GetMapping("/dispatchEventList")
public TableDataInfo dispatchEventList(DcEvent dcEvent){
List<DcEvent> 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<DcEvent> list = dcEventService.selectDcEventList(dcEvent);
ExcelUtil<DcEvent> util = new ExcelUtil<DcEvent>(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/{eventType}/{id}")
@ApiImplicitParams({
@ApiImplicitParam(name = "eventType", value = "事件类型", dataType = "int"),
@ApiImplicitParam(name = "id", value = "事件id", dataType = "String"),
})
public AjaxResult getEventById(@PathVariable int eventType,@PathVariable("id") String id)
{
DcEvent dcEvent = dcEventService.selectEventSubclassById(eventType,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("/{eventType}/{ids}")
public AjaxResult remove(@PathVariable int eventType,@PathVariable String[] ids )
{
return toAjax(dcEventService.deleteDcEventByIds(eventType,ids));
}
}