package com.hxzk.gps.controller.WarnTongJi;
|
|
import cn.dev33.satoken.annotation.SaCheckLogin;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.hxzk.gps.controller.Warning.dto.TableSearchResult.TableSearchResult;
|
import com.hxzk.gps.entity.Fence.TbFence;
|
import com.hxzk.gps.entity.User.TbUser;
|
import com.hxzk.gps.entity.WarnTongJi.WarnTongjiCompany;
|
import com.hxzk.gps.entity.Warning.TbWarning;
|
import com.hxzk.gps.mapper.Warning.TbWarningMapper;
|
import com.hxzk.gps.result.ResultTable;
|
import com.hxzk.gps.service.Anchor.TbAchorService;
|
import com.hxzk.gps.service.Company.TbCompanyService;
|
import com.hxzk.gps.service.Department.TbDepartmentService;
|
import com.hxzk.gps.service.Fence.TbFenceService;
|
import com.hxzk.gps.service.Person.TbPersonService;
|
import com.hxzk.gps.service.WarnTongJi.WarnTongjiCompanyService;
|
import com.hxzk.gps.service.Warning.TbWarningService;
|
import com.hxzk.gps.util.GetUser.UserInfoUtil;
|
import com.hxzk.gps.util.Result.ReturnMessage;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.ArrayList;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* <p>
|
* 前端控制器
|
* </p>
|
*
|
* @author YuZhiTong
|
* @since 2025-06-09
|
*/
|
@RestController
|
@RequestMapping("/WarningTongJi")
|
public class WarnTongjiCompanyController {
|
@Autowired
|
WarnTongjiCompanyService warnTongjiCompanyService;
|
@Autowired
|
TbPersonService personService;
|
@Autowired
|
TbFenceService fenceService;
|
@Autowired
|
TbAchorService achorService;
|
@Autowired
|
TbDepartmentService departmentService;
|
@Autowired
|
TbWarningMapper warningMapper;
|
@Autowired
|
TbCompanyService companyService;
|
|
|
|
@SaCheckLogin
|
@ApiOperation(value = "平台告警列表接口", notes = "该接口提供了平台告警列表的信息查询功能")
|
@PostMapping("FindWarningTongJiInfo")
|
public ResultTable FindWarningTongJiInfo(@RequestBody TableSearchResult TableSearchResult){
|
return warnTongjiCompanyService.FindWarningTongJiInfo(TableSearchResult);
|
}
|
|
|
@SaCheckLogin
|
@ApiOperation(value = "平台用户修改接口", notes = "该接口提供了平台用户修改功能")
|
@PostMapping("update")
|
public ReturnMessage update(@RequestBody WarnTongjiCompany warnTongjiCompany){
|
return warnTongjiCompanyService.update(warnTongjiCompany);
|
}
|
|
@SaCheckLogin
|
@ApiOperation(value = "平台实时统计查询接口", notes = "该接口提供了平台实时统计查询功能")
|
@PostMapping("FindDayCountInfo")
|
public List<WarnTongjiCompany> FindDayCountInfo(){
|
return warnTongjiCompanyService.FindDayCountInfo();
|
}
|
|
@SaCheckLogin
|
@ApiOperation(value = "平台统计页面基础数据查询接口", notes = "该接口提供了平台统计页面基础数据查询功能")
|
@PostMapping("FindBSCount")
|
public List FindBSCount(){
|
List<Long> companyids = companyService.getChildCompanyIds(UserInfoUtil.getUserCompanyId());
|
List<Long> companyname = companyService.getChildCompanyNames(UserInfoUtil.getUserCompany());
|
List list = new ArrayList<>();
|
QueryWrapper queryWrapperOnLinePerson = new QueryWrapper<>();
|
queryWrapperOnLinePerson.in("companyid", companyids);
|
queryWrapperOnLinePerson.eq("p_online","1");
|
list.add(personService.getBaseMapper().selectCount(queryWrapperOnLinePerson));
|
QueryWrapper queryWrapperPeronNoLine = new QueryWrapper<>();
|
queryWrapperPeronNoLine.in("companyid", companyids);
|
queryWrapperPeronNoLine.eq("p_online","0");
|
list.add(personService.getBaseMapper().selectCount(queryWrapperPeronNoLine));
|
QueryWrapper queryWrapperFence = new QueryWrapper<>();
|
queryWrapperFence.in("company", companyname);
|
list.add(fenceService.getBaseMapper().selectCount(queryWrapperFence));
|
QueryWrapper queryWrapperAchor = new QueryWrapper<>();
|
queryWrapperAchor.in("company", companyname);
|
list.add(achorService.getBaseMapper().selectCount(queryWrapperAchor));
|
QueryWrapper queryWrapperDepartment = new QueryWrapper<>();
|
queryWrapperDepartment.in("companyid", companyids);
|
list.add(departmentService.getBaseMapper().selectCount(queryWrapperDepartment));
|
return list;
|
}
|
@SaCheckLogin
|
@ApiOperation(value = "平台统计页面告警查询接口", notes = "该接口提供了平台统计页面告警查询功能")
|
@PostMapping("FindBSWarningCount")
|
public List FindBSWarningCount(){
|
List list = new ArrayList<>();
|
List<Long> list1 = companyService.getChildCompanyIds(UserInfoUtil.getUserCompanyId());
|
list.add(warningMapper.FindDayCountInfo("SOS",list1));
|
list.add(warningMapper.FindDayCountInfo("进入告警",list1));
|
list.add(warningMapper.FindDayCountInfo("出去告警",list1));
|
list.add(warningMapper.FindDayCountInfo("聚集告警",list1));
|
list.add(warningMapper.FindDayCountInfo("超员告警",list1));
|
return list;
|
}
|
@SaCheckLogin
|
@ApiOperation(value = "平台统计页面告警查询接口", notes = "该接口提供了平台统计页面告警查询功能")
|
@PostMapping("FindDayWarningCount")
|
public Map FindDayWarningCount(@RequestBody TbWarning warning){
|
Map map = new HashMap<>();
|
map.put("SOS",warningMapper.FindDayDateCountInfo("SOS",UserInfoUtil.getUserCompany(), Integer.valueOf(warning.getTime())));
|
map.put("进入告警",warningMapper.FindDayDateCountInfo("进入告警",UserInfoUtil.getUserCompany(), Integer.valueOf(warning.getTime())));
|
map.put("出去告警",warningMapper.FindDayDateCountInfo("出去告警",UserInfoUtil.getUserCompany(), Integer.valueOf(warning.getTime())));
|
map.put("聚集告警",warningMapper.FindDayDateCountInfo("聚集告警",UserInfoUtil.getUserCompany(), Integer.valueOf(warning.getTime())));
|
map.put("超员告警",warningMapper.FindDayDateCountInfo("超员告警",UserInfoUtil.getUserCompany(), Integer.valueOf(warning.getTime())));
|
return map;
|
}
|
@SaCheckLogin
|
@ApiOperation(value = "引擎更新时间查询", notes = "该接口提供了引擎更新时间查询功能")
|
@PostMapping("FindCSDATE")
|
public String FindCSDATE(){
|
return warningMapper.FindCSDATE();
|
}
|
}
|