package com.fzzy.sys.controller.security; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.EventInfo; import com.fzzy.sys.manager.common.CommonManager; import com.fzzy.sys.manager.security.EventInfoManager; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; 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/eventInfo"; @Resource private EventInfoManager eventInfoManager; @Resource private CommonManager commonManager; /** * AI事件管理页面 * * @author sgj * @date 2025/12/10 * @param model */ @GetMapping public String getEventInfo( Model model) { IgdsBaseParam param = new IgdsBaseParam(); param.setPage(1); param.setLimit(6); Page events = eventInfoManager.pageData(param); model.addAttribute("eventInfoList", events.getRecords()); model.addAttribute("currentPage", events.getCurrent()); model.addAttribute("totalItems", events.getTotal()); model.addAttribute("pageSize", events.getSize()); //设备数据 model.addAttribute("cameraList", commonManager.listCameraData()); //库区数据 model.addAttribute("deptList", commonManager.listDeptData()); //业务类型数据 List> bizTypeList = new ArrayList<>(); for (WarnType type : WarnType.values()) { Map item = new HashMap<>(); item.put("code", type.getCode()); item.put("msg", type.getMsg()); bizTypeList.add(item); } model.addAttribute("bizTypeList", bizTypeList); //公司数据 model.addAttribute("companyList", commonManager.listCompanyData()); return prefix + "/eventInfo"; } /** * 分页获取数据 * * @param param * @return */ @RequestMapping("/pageData") @ResponseBody public PageResponse> pageData(@RequestBody IgdsBaseParam param) { Page 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); } }