package com.fzzy.security;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.fzzy.common.manager.CommonManager;
|
import com.fzzy.igds.constant.RespCodeEnum;
|
import com.fzzy.igds.constant.WarnType;
|
import com.fzzy.igds.data.IgdsBaseParam;
|
import com.fzzy.igds.data.PageResponse;
|
import com.fzzy.igds.domain.Company;
|
import com.fzzy.igds.domain.EventInfo;
|
import com.fzzy.security.manager.EventInfoManager;
|
import com.ruoyi.common.utils.StringUtils;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.ui.Model;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import java.util.ArrayList;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
@Slf4j
|
@Controller
|
@RequestMapping("/security/eventInfo")
|
public class EventInfoController {
|
|
private static final String prefix = "security";
|
|
@Resource
|
private EventInfoManager eventInfoManager;
|
|
@Resource
|
private CommonManager commonManager;
|
|
/**
|
* AI事件管理页面
|
*
|
* @param model
|
* @author sgj
|
* @date 2025/12/10
|
*/
|
@GetMapping
|
public String getEventInfo(@RequestParam(value = "viewType", required = false) String viewType, Model model) {
|
List<Company> companies = commonManager.listCompanyData();
|
String defaultCompany = "" ;
|
if (companies != null && !companies.isEmpty()) {
|
defaultCompany = companies.get(0).getId();
|
}
|
IgdsBaseParam param = new IgdsBaseParam();
|
param.setPage(1);
|
param.setLimit(6);
|
param.setKey(defaultCompany);
|
Page<EventInfo> events = eventInfoManager.pageData(param);
|
model.addAttribute("eventInfoList", events.getRecords());
|
model.addAttribute("currentPage", events.getCurrent());
|
model.addAttribute("totalItems", events.getTotal());
|
model.addAttribute("pageSize", events.getSize());
|
if (StringUtils.isEmpty(viewType)) {
|
// 1 安防页面 2 监管页面
|
viewType = "1";
|
}
|
//页面展示类型
|
model.addAttribute("viewType", viewType);
|
//设备数据
|
model.addAttribute("cameraList", commonManager.listCameraData());
|
//库区数据
|
model.addAttribute("deptList", commonManager.listDeptData(defaultCompany));
|
//业务类型数据
|
List<Map<String, String>> bizTypeList = new ArrayList<>();
|
for (WarnType type : WarnType.values()) {
|
Map<String, String> item = new HashMap<>();
|
item.put("code", type.getCode());
|
item.put("msg", type.getMsg());
|
bizTypeList.add(item);
|
}
|
model.addAttribute("bizTypeList", bizTypeList);
|
//公司数据
|
model.addAttribute("companyList", companies);
|
return prefix + "/eventInfo";
|
}
|
|
/**
|
* 分页获取数据
|
*
|
* @param param
|
* @return
|
*/
|
@RequestMapping("/pageData")
|
@ResponseBody
|
public PageResponse<Page<EventInfo>> pageData(@RequestBody IgdsBaseParam param) {
|
Page<EventInfo> eventInfoPage = eventInfoManager.pageData(param);
|
// if (null == eventInfoPage.getRecords() || eventInfoPage.getRecords().isEmpty()) {
|
// return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), "获取到数据信息为空");
|
// }
|
return new PageResponse<>(RespCodeEnum.CODE_0000, eventInfoPage);
|
}
|
}
|