package com.hxzk.gps.controller.Warning; import cn.dev33.satoken.annotation.SaCheckLogin; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.hxzk.gps.controller.Warning.dto.TableSearchResult.TableSearchResult; import com.hxzk.gps.entity.Person.TbPerson; import com.hxzk.gps.entity.Warning.TbWarning; import com.hxzk.gps.mapper.Warning.TbWarningMapper; import com.hxzk.gps.result.ListDataResult; import com.hxzk.gps.result.ResultTable; import com.hxzk.gps.result.table; import com.hxzk.gps.service.Company.TbCompanyService; import com.hxzk.gps.service.Person.TbPersonService; import com.hxzk.gps.service.Warning.TbWarningService; import com.hxzk.gps.util.GetUser.UserInfoUtil; import com.hxzk.gps.util.MessageUtils.MessageUtils; import com.hxzk.gps.util.Result.ReturnMessage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** *

* 前端控制器 *

* * @author YuZhiTong * @since 2025-05-23 */ @RestController @RequestMapping("/Warning") @Api("告警管理") public class TbWarningController { @Autowired TbWarningService warningService; @Autowired TbWarningMapper warningMapper; @Autowired TbPersonService personService; @Autowired TbCompanyService companyService; @SaCheckLogin @ApiOperation(value = "平台告警列表接口", notes = "该接口提供了平台告警列表的信息查询功能") @PostMapping("FindWarningInfo") public ResultTable FindWarningInfo(@RequestBody TableSearchResult TableSearchResult){ return warningService.FindWarningInfo(TableSearchResult); } @SaCheckLogin @ApiOperation(value = "平台公司未处理告警列表接口", notes = "该接口提供了平台公司未处理告警列表的信息查询功能") @PostMapping("FindWarningUntreated") public ResultTable FindWarningUntreated(@RequestBody TableSearchResult TableSearchResult){ return warningService.FindWarningUntreated(TableSearchResult); } @SaCheckLogin @ApiOperation(value = "告警全部处理接口", notes = "该接口提供了平台告警全部处理功能") @PostMapping("AllHandle") public ReturnMessage AllHandle(){ return warningService.AllHandle(); } @SaCheckLogin @ApiOperation(value = "告警处理接口", notes = "该接口提供了平台告警处理功能") @PostMapping("Handle") public ReturnMessage Handle(@RequestBody TbWarning warning){ return warningService.Handle(warning); } @SaCheckLogin @ApiOperation(value = "平台统计分析告警接口", notes = "该接口提供了平台统计分析告警功能") @PostMapping("FindWarningAll") public List FindWarningAll(){ return warningMapper.FindWarningAll(UserInfoUtil.getUserCompany()); } @SaCheckLogin @ApiOperation(value = "平台根据告警类型查询接口", notes = "该接口提供了平台根据告警类型查询功能") @PostMapping("FindWarningInfoType") public ResultTable FindWarningInfoType(@RequestBody TableSearchResult TableSearchResult){ QueryWrapper queryWrapper = new QueryWrapper<>(); PageHelper.startPage(TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize()); PageInfo infoNoPerson = new PageInfo<>(); List list = companyService.getChildCompanyIds(UserInfoUtil.getUserCompanyId()); switch (TableSearchResult.getWarning().getType()){ case "SOS报警": PageInfo infoNoWarningSOS = new PageInfo<>(warningMapper.FindWarningInfoType(list,"SOS")); table infoWarningSOS = new table<>(infoNoWarningSOS.getList(),TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize(),infoNoPerson.getTotal()); return ListDataResult.resultTableSuccess(infoWarningSOS, MessageUtils.getMessage("Success")); case "聚集报警": PageInfo infoNoWarningJuJi = new PageInfo<>(warningMapper.FindWarningInfoType(list,"聚集告警")); table infoWarningJuJi = new table<>(infoNoWarningJuJi.getList(),TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize(),infoNoPerson.getTotal()); return ListDataResult.resultTableSuccess(infoWarningJuJi, MessageUtils.getMessage("Success")); case "越界报警": PageInfo infoNoWarningChuQu = new PageInfo<>(warningMapper.FindWarningInfoType(list,"出去告警")); table infoWarningChuQu = new table<>(infoNoWarningChuQu.getList(),TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize(),infoNoPerson.getTotal()); return ListDataResult.resultTableSuccess(infoWarningChuQu, MessageUtils.getMessage("Success")); case "进入报警": PageInfo infoNoWarningJinRu = new PageInfo<>(warningMapper.FindWarningInfoType(list,"进入告警")); table infoWarningJinRu = new table<>(infoNoWarningJinRu.getList(),TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize(),infoNoPerson.getTotal()); return ListDataResult.resultTableSuccess(infoWarningJinRu, MessageUtils.getMessage("Success")); case "离线人员": queryWrapper.eq("p_online","0"); queryWrapper.in("companyid", list); infoNoPerson = new PageInfo<>(personService.getBaseMapper().selectList(queryWrapper)); table infoPersons = new table<>(infoNoPerson.getList(),TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize(),infoNoPerson.getTotal()); return ListDataResult.resultTableSuccess(infoPersons, MessageUtils.getMessage("Success")); case "在线人员": queryWrapper.eq("p_online","1"); queryWrapper.in("companyid", list); infoNoPerson = new PageInfo<>(personService.getBaseMapper().selectList(queryWrapper)); table achortable = new table<>(infoNoPerson.getList(),TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize(),infoNoPerson.getTotal()); return ListDataResult.resultTableSuccess(achortable, MessageUtils.getMessage("Success")); } return null; } }