qa-prevention-gwj/src/main/java/com/zcloud/controller/map/MapController.java

1088 lines
40 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package com.zcloud.controller.map;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.bus.CorpInfoService;
import com.zcloud.service.dw.DwService;
import com.zcloud.service.dw.dto.AlarmGet;
import com.zcloud.service.dw.dto.MapGet;
import com.zcloud.service.dw.dto.MapInfo;
import com.zcloud.service.dw.dto.TraceGet;
import com.zcloud.service.keyProjects.VideoManagerService;
import com.zcloud.service.map.*;
import com.zcloud.service.map.util.ReturnMap;
import com.zcloud.service.map.util.WeatherUtil;
import com.zcloud.service.system.DepartmentService;
import com.zcloud.service.system.UsersService;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.Tools;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.util.*;
/**
* 说明:实时地图
* 官网www.zcloudchina.com
*/
@Controller
@RequestMapping("/map")
public class MapController extends BaseController {
@Autowired
private VideoManagerService videomanagerService;
@Autowired
private CorpInfoService corpInfoService;
@Autowired
private UsersService usersService;
@Autowired
private MeteorologicalinfoService meteorologicalinfoService;
@Autowired
private MeteorologicalService meteorologicalService;
@Autowired
private RestTemplate restTemplate;
@Value("${preventionxgf.api.url}")
private String url;
@Value("${preventionxgf.api.url}")
private String xgfUrl;
@Value("${cfd.prevention.api.url}")
private String cfdUrl;
@Autowired
private BiMapService biMapService;
@Autowired
private FireResourcesService fireResourcesService;
@Autowired
private DepartmentService departmentService;
@Autowired
private GateMachineService gateMachineService;
@Autowired
private WeatherUtil weatherUtil;
@Resource
private DwService dwService;
@ResponseBody
@RequestMapping("/getCorpInfo")
public Object getCorpInfo() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
PageData condition = new PageData();
condition.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
PageData entity = corpInfoService.findById(condition);
PageData info = new PageData();
info.put("CORP_INFO_ID",entity.get("CORPINFO_ID"));
info.put("longitude",entity.get("LONGITUDE"));
info.put("latitude",entity.get("LATITUDE"));
map.put("info", info);
map.put("result", "success");
return map;
}
/**
* @Description: 单位基础信息
* @Author: dearLin
* @Date: 2023/9/21/021 16:14
* @Param: AREA
* @Return: java.lang.Object
*/
@RequestMapping(value = "/basicInformation")
@ResponseBody
public Object basicInformation() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
// 分公司数量
PageData numberCountData = corpInfoService.listAllByArea(pd);
// 相关方单位数
// 0 ->分公司企业数
// 1 ->相关方单位数
// 2 ->员工数
Map<String, Object> result = restTemplate.getForObject(url + "/api/corpinfo/unitCorpInfo", Map.class);
List<PageData> unitCorp = (List<PageData>) result.get("unitCorp");
int size = unitCorp != null ? unitCorp.size() : 0;
// 员工数
PageData userCountData = usersService.countAllByArea(pd);
PageData resData = new PageData();
resData.put("UNITCOUNT", size);
resData.putAll(numberCountData);
resData.putAll(userCountData);
map.put("data", resData);
map.put("result", errInfo);
return map;
}
/**
* @Description: 风险区域统计
* @Author: dearLin
* @Date: 2023/9/21/021 16:14
* @Param: AREA
* @Return: 重大风险区域数
* @Return: 较大风险区域数
* @Return: 一般风险区域数
* @Return: 低风险区域数
*/
@RequestMapping(value = "/getRiskAreaCount")
@ResponseBody
public Object getRiskAreaCount() {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
List<PageData> riskIndex = biMapService.getRiskIndex(pd);
PageData pageData = new PageData();
riskIndex.forEach(item -> {
pageData.put(item.getString("TYPE"), item.getString("COUNT"));
});
map.put("pd", pageData);
map.put("result", errInfo);
return map;
}
/**
* listRetrieval
*
* @Description: 单位人员信息统计
* @Author: dearLin
* @Date: 2023/9/21/021 17:48
* @Param: [] []
* @Return: java.lang.Object
*/
@RequestMapping(value = "/getUnitPersonnel")
@ResponseBody
public Object getUnitPersonnel(Page page) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
page.setPd(pd);
if (pd.getString("INDEX").equals("0")) {
List<PageData> varList = corpInfoService.listRetrieval(page);
map.put("varList", varList);
map.put("page", page);
} else {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("showCount", page.getShowCount());
paramMap.add("currentPage", pd.get("currentPage"));
// Map result = HttpClientService.doPost(xgfUrl + "/api/corpinfo/list", pd);
Map result = restTemplate.postForObject(xgfUrl + "/api/corpinfo/list", paramMap, Map.class);
map.put("varList", result.get("varList"));
map.put("page", result.get("page"));
}
map.put("result", errInfo);
return map;
}
@RequestMapping(value = "/corpsForMap")
@ResponseBody
public Object corpsForMap() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> varList = corpInfoService.listAllForMap(pd); //根据ID读取
for (PageData pageData : varList) {
if (StringUtils.isBlank(pageData.getString("CORP_NAME"))) {
pageData.put("MAP_POINT_NAME", "");
} else {
pageData.put("MAP_POINT_NAME", pageData.getString("CORP_NAME"));
}
}
map.put("varList", varList);
map.put("result", errInfo);
return map;
}
/**
* 列表
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/listbymeteorological")
@ResponseBody
public Object listbymeteorological() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
//根据条件增加参数或减少参数 都没有 直接返回空
if (StringUtils.isBlank(pd.getString("CORPINFO_ID"))) {
List<String> ArrayDATA_IDS = biMapService.getCorpinfoIds(pd);
if (ArrayDATA_IDS.size() == 0) {
map.put("result", errInfo);
return map;
}
pd.put("ids", ArrayDATA_IDS);
pd.remove("CORPINFO_ID");
}
pd = meteorologicalinfoService.listbymeteorological(pd); //列出meteorological列表
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**
* 列表
*
* @param page
* @throws Exception
*/
@RequestMapping(value = "/listbyType")
@ResponseBody
public Object listbyType(Page page) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
//根据条件增加参数或减少参数 都没有 直接返回空
if (StringUtils.isBlank(pd.getString("CORPINFO_ID"))) {
List<String> ArrayDATA_IDS = biMapService.getCorpinfoIds(pd);
if (ArrayDATA_IDS.size() == 0) {
map.put("result", errInfo);
return map;
}
pd.put("ids", ArrayDATA_IDS);
pd.remove("CORPINFO_ID");
}
page.setPd(pd);
if (pd.getString("INDEX").equals("0") || "".equals(pd.getString("INDEX"))) {
List<PageData> varList = meteorologicalService.listbyType(page);
for (PageData data : varList) {
data.put("MAP_POINT_NAME", data.getString("NAME"));
}
map.put("varList", varList);
map.put("page", page);
}
// List<PageData> varList = meteorologicalService.listbyType(page); //列出electronic列表
// map.put("varList", varList);
// map.put("page", page);
map.put("result", errInfo);
return map;
}
/**
* 设备数量
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/listbyequipmentcount")
@ResponseBody
public Object listbyequipmentcount() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
//根据条件增加参数或减少参数 都没有 直接返回空
if (StringUtils.isBlank(pd.getString("CORPINFO_ID"))) {
List<String> ArrayDATA_IDS = biMapService.getCorpinfoIds(pd);
if (ArrayDATA_IDS.size() == 0) {
map.put("result", errInfo);
return map;
}
pd.put("ids", ArrayDATA_IDS);
pd.remove("CORPINFO_ID");
}
pd = meteorologicalService.listbyequipmentcount(pd); //列出electronic列表
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**
* 根据id以及类型获取气象监测信息数据
*
* @param id 数据id
* @param type 数据类型 气象站 等等
* @return
*/
@RequestMapping(value = "/getById")
@ResponseBody
public Object getById(@RequestParam(value = "id") String id, @RequestParam("TYPE") String type) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
String typeStr = pd.getString("TYPE");
String idStr = pd.getString("id");
List<PageData> pageDataList = new ArrayList<>();
if (StringUtils.equals(typeStr, "293187ddfd984c9ab3fd716aef58da0e")) {
pd.put("METEOROLOGICAL_ID", idStr);
pd = biMapService.listbymeteorological(pd);
} else if (StringUtils.equals(typeStr, "561347f0cff641dba8b2b22c0f443348")) {
pd.put("METEOROLOGICAL_ID", idStr);
pd = biMapService.listbymeteorological(pd);
} else if (StringUtils.equals(typeStr, "2da29f00852a4653ba3e760b9de57412")) {
pd.put("METEOROLOGICAL_ID", idStr);
pd = biMapService.listbymeteorological(pd);
} else if (StringUtils.equals(typeStr, "732fe73933b845c6b1e2aee06a38ed31")) {
pd.put("METEOROLOGICAL_ID", idStr);
pd = biMapService.listbymeteorological(pd);
}
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
@RequestMapping(value = "/getWeatherInfo")
@ResponseBody
public Object getWeatherInfo() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
map.put("data", WeatherUtil.getWeatherInfo());
map.put("result", errInfo);
return map;
}
@RequestMapping(value = "/getPointsInfo")
@ResponseBody
public Object getPointsInfo() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
List<PageData> pointsList = videomanagerService.getPointsInfo(pd); //根据ID读取
map.put("pointsList", pointsList);
map.put("result", errInfo);
return map;
}
/*************************************************/
/**
* @Description: 风险辨识管控
* 风险单元数
* 辨识部位数
* 风险因素数
* @Author: dearLin
* @Date: 2023/9/19/019 16:14
* @Param: CORPINFO_ID
* @Return: java.lang.Object
*/
@RequestMapping("/getRiskIdentificationCount")
@ResponseBody
public Object getRiskIdentificationCount() {
Map<String, Object> map = new HashMap<String, Object>();
PageData pageData = this.getPageData();
// bus_riskunit
// bus_identificationparts
if ("00004".equals(pageData.getString("GANGKOU"))) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/ObtainDisplayData/getRiskList", paramMap, Map.class);
return result;
}
PageData data = biMapService.getRiskIdentificationCount(pageData);
map.put("result", "success");
map.put("riskIdentificationCount", data);
return map;
}
// 人员定位信息
/**
* @Description: 人员定位信息
* @Author: dearLin
* @Date: 2023/9/20/020 11:06
* @Param: [] []
* @Return: java.lang.Object
*/
@RequestMapping("/getPersonPositioningCount")
@ResponseBody
public Object getPersonPositioningCount() {
Map<String, Object> map = new HashMap<String, Object>();
PageData pageData = this.getPageData();
if ("00004".equals(pageData.getString("GANGKOU"))) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
Map<String, Object> result = new HashMap<String, Object>();
try {
result = restTemplate.postForObject(cfdUrl + "/sync/ObtainDisplayData/getUsersCount", paramMap, Map.class);
} catch (Exception e) {
result.put("regulatoryUsersInfo", 0);
result.put("preventionUsersInfo", 0);
}
try {
Map<String, Object> perResult = restTemplate.postForObject(cfdUrl + "/sync/UserPosition/getCurrentLocationOnlineCount", paramMap, Map.class);
result.put("perCount", perResult.get("perCount"));
} catch (Exception e) {
result.put("perCount", 0);
}
return result;
}
// bus_riskunit
// bus_identificationparts
PageData data = biMapService.getPersonPositioningCount(pageData);
map.put("result", "success");
map.put("personPositioningCount", data);
return map;
}
/**
* @Description: 口门管理 Gate management
* @Author: dearLin
* @Date: 2023/9/20/020 11:07
* @Param: [] []
* @Return: java.lang.Object
*/
@RequestMapping("/getDoorManagement")
@ResponseBody
public Object getDoorManagement() {
Map<String, Object> map = new HashMap<String, Object>();
PageData pageData = this.getPageData();
if ("00004".equals(pageData.getString("GANGKOU"))) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("id", pageData.get("id"));
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/map/getPerpleCarGateMachineCount", paramMap, Map.class);
return result;
}
List<PageData> data = new ArrayList<>();
PageData riskIndex = new PageData();
riskIndex.put("title", "风险指数");
riskIndex.put("list", biMapService.getRiskIndex(pageData));
data.add(riskIndex);
// 今日情况
/*
* todo
* 是否也按照公司来进行统计
* bus_carduser 人员进出
* bus_foreigncar 车辆进出
*
* */
PageData today = new PageData();
today.put("title", "今日情况");
today.put("list", biMapService.inAndoutPeoCarToday(pageData));
data.add(today);
map.put("result", "success");
map.put("varList", data);
return map;
}
@RequestMapping("/getPointInfoADeviceByPid")
@ResponseBody
public Object getPointInfoADeviceByPid() {
PageData pd = this.getPageData();
if ("00004".equals(pd.getString("GANGKOU"))) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("FIRE_POINT_ID", pd.getString("FIRE_POINT_ID"));
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/map/getPointInfoADeviceByPid", paramMap, Map.class);
return result;
}
PageData map = fireResourcesService.getPointInfoADeviceByPid(pd);
map.put("result", "success");
return map;
}
@RequestMapping("/getPointQualifiedPhotos")
@ResponseBody
public Object getPointQualifiedPhotos() {
Map<String, Object> map = new HashMap<String, Object>();
PageData pd = this.getPageData();
if ("00004".equals(pd.getString("GANGKOU"))) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("FIRE_POINT_ID", pd.getString("FIRE_POINT_ID"));
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/map/getPointQualifiedPhotos", paramMap, Map.class);
return result;
}
map.put("result", "success");
map.put("varList", fireResourcesService.getPointQualifiedPhotos(pd));
return map;
}
//股份公司部门数量 所有的
@RequestMapping(value = "/getRegulatoryDepartmentCount")
@ResponseBody
public Object getRegulatoryDepartmentCount() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
List<PageData> pageData = (List<PageData>) departmentService.listAll(pd);
int size = pageData.size();
map.put("regulatoryDepartmentCount", size);
map.put("result", errInfo);
return map;
}
/**
* @Description: 消防管控
* @Author: dearLin
* @Date: 2023/9/20/020 15:30
* @Param: [] []
* @Return: java.lang.Object
*/
@RequestMapping("/getFireControl")
@ResponseBody
public Object getFireControl() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
PageData pageData = this.getPageData();
if ("00004".equals(pageData.getString("GANGKOU"))) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("TYPE", pageData.getString("TYPE"));
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/map/getFireControl", paramMap, Map.class);
return result;
}
LinkedList<PageData> value = biMapService.getFireControl(pageData);
for (PageData data : value) {
data.put("MAP_POINT_NAME", data.getString("NAME"));
}
map.put("result", "success");
map.put("varList", value);
return map;
}
/**
* @Description: 消防资源
* @Author: dearLin
* @Date: 2023/9/26/026 17:36
* @Param: [] []
* @Return: java.lang.Object
*/
@RequestMapping("/getFireResourceById")
@ResponseBody
public Object getFireResourceById() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pddata = this.getPageData();
//获取当前人的公司id
PageData pd = fireResourcesService.getDataById(pddata);
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
/**
* @Description: 消防救援队
* @Author: dearLin
* @Date: 2023/9/20/020 15:30
* @Param: [] []
* @Return: java.lang.Object
*/
@RequestMapping("/getFireRescueTeam")
@ResponseBody
public Object getFireRescueTeam() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
PageData pageData = this.getPageData();
LinkedList<PageData> data = biMapService.getFireRescueTeam(pageData);
map.put("result", "success");
map.put("varList", data);
return map;
}
/**
* 气象信息对接接口
*
* @return
* @throws Exception
*/
@RequestMapping(value = "/tongMeteorologicalinfoList")
@ResponseBody
public ReturnMap tongMeteorologicalinfoList(@RequestBody List<PageData> list) throws Exception {
ReturnMap r = new ReturnMap();
r = meteorologicalinfoService.tongbuMeteorologicalinfo(list);
return r;
}
/**
* @Description: 闸机设备在线情况 只有人车闸机
* @Author: dearLin
* @Date: 2023/9/23/023 9:04
* @Param:
* @Return:
*/
@RequestMapping("/getOnlineGateEquipment")
@ResponseBody
public ReturnMap getOnlineGateEquipment() {
ReturnMap returnMap = new ReturnMap();
PageData pageData = this.getPageData();
if ("00004".equals(pageData.getString("GANGKOU"))) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/map/listMapSluiceCount", paramMap, Map.class);
return ReturnMap.ok(result);
}
PageData value = gateMachineService.getOnlineGateMachine(pageData);
returnMap.put("pd", value);
return returnMap;
}
/**
* @Description: 闸机位置
* @Author: dearLin
* @Date: 2023/9/23/023 9:04
* @Param:
* @Return:
*/
@RequestMapping("/getGatePosition")
@ResponseBody
public ReturnMap getGatePosition() {
ReturnMap returnMap = new ReturnMap();
PageData pageData = this.getPageData();
if ("00004".equals(pageData.getString("GANGKOU"))) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
if ("CAMERA".equals(pageData.getString("TYPE"))) {
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/ObtainDisplayData/listAllCameraForMapToBayonet", paramMap, Map.class);
return ReturnMap.ok(result);
} else {
paramMap.add("TYPE", pageData.getString("TYPE"));
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/map/getGatePosition", paramMap, Map.class);
return ReturnMap.ok(result);
}
}
//
List<PageData> value = gateMachineService.getGatePosition(pageData);
// 添加标点上的统一的title
for (PageData data : value) {
if (Tools.notEmpty(data.getString("GATE_AREA_NAME"))) {
data.put("MAP_POINT_NAME", data.getString("GATE_AREA_NAME"));
} else {
data.put("MAP_POINT_NAME", data.getString("NAME"));
}
}
returnMap.put("varList", value);
return returnMap;
}
/**
* @Description: 口门进出记录列表
* @Author: dearLin
* @Date: 2023/9/23/023 9:04
* @Param:
* @Return:
*/
@RequestMapping("/getDoorWayRecords")
@ResponseBody
public ReturnMap getDoorWayRecords(Page page) {
ReturnMap returnMap = new ReturnMap();
PageData pageData = this.getPageData();
page.setPd(pageData);
if ("0".equals(pageData.getString("INDEX"))) {
// 人
List<PageData> value = biMapService.getDoorWayPeopleRecords(page);
returnMap.put("varList", value);
return returnMap;
} else {
// 车
List<PageData> value = biMapService.getDoorWayCarRecords(page);
returnMap.put("varList", value);
return returnMap;
}
}
/**
* @Description: 口门进出记录列表
* @Author: dearLin
* @Date: 2023/9/23/023 9:04
* @Param:
* @Return:
*/
@RequestMapping("/getCfdDoorWayRecords")
@ResponseBody
public ReturnMap getCfdDoorWayRecords() {
ReturnMap returnMap = new ReturnMap();
PageData pageData = this.getPageData();
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("TYPE", pageData.get("TYPE"));
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/map/listPerpleCarGateMachine", paramMap, Map.class);
return ReturnMap.ok(result);
}
/**
* @Description: 闸机进出车、人的数量
* @Author: dearLin
* @Date: 2023/9/23/023 9:04
* @Param:
* @Return:
*/
@RequestMapping("/getGatesInAndOutNumById")
@ResponseBody
public ReturnMap getGatesInAndOutNumById() {
ReturnMap returnMap = new ReturnMap();
PageData pageData = this.getPageData();
if ("00004".equals(pageData.getString("GANGKOU"))) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("id", pageData.get("id"));
paramMap.add("TYPE", pageData.get("TYPE"));
paramMap.add("status", pageData.get("status"));
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/map/getGatesInAndOutNumById", paramMap, Map.class);
return ReturnMap.ok(result);
}
PageData data = biMapService.getGatesInAndOutNumById(pageData);
returnMap.put("pd", data);
return returnMap;
}
/**
* 人员进出记录列表
*
* @return
*/
@RequestMapping("/getGatesInAndOutListById")
@ResponseBody
public ReturnMap getGatesInAndOutListById(Page page) {
ReturnMap returnMap = new ReturnMap();
PageData pd = this.getPageData();
page.setPd(pd);
List<PageData> recordAllList = gateMachineService.getPersonRecordListAllByEId(page);
returnMap.put("recordAllList", recordAllList);
return returnMap;
}
@RequestMapping(value = "/fireResource/list")
@ResponseBody
public Object page(Page page) {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
//获取当前人的公司id
page.setPd(pd);
List<PageData> varList = fireResourcesService.datalistPage(page);
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
@RequestMapping(value = "/fireDevice/listByMap")
@ResponseBody
public Object devicelistByMap(Page page) {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
//获取当前人的公司id
page.setPd(pd);
if ("00004".equals(pd.getString("GANGKOU"))) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("FIRE_DEVICE_TYPE_ID", pd.getString("FIRE_DEVICE_TYPE_ID"));
paramMap.add("FIRE_POINT_NAME", pd.getString("FIRE_POINT_NAME"));
paramMap.add("showCount", page.getShowCount());
paramMap.add("currentPage", pd.get("currentPage"));
// /sync/map/fireDevice/listByMap?showCount=&currentPage=
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/map/fireDevice/listByMap", paramMap, Map.class);
return result;
}
List<PageData> varList = fireResourcesService.devicelistPage(page);
map.put("varList", varList);
map.put("page", page);
map.put("result", errInfo);
return map;
}
/**
* 获取人员、车辆进出记录
*
* @param
* @return
*/
@RequestMapping(value = "/getPerpleCarGateMachineCount")
@ResponseBody
public Object getPerpleCarGateMachineCount() {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
if ("00004".equals(pd.getString("GANGKOU"))) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("id", pd.get("id"));
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/map/getPerpleCarGateMachineCount", paramMap, Map.class);
return result;
}
map.put("result", errInfo);
return map;
}
@RequestMapping(value = "/getMachineTodayInOutCount")
@ResponseBody
public Object getMachineTodayInOutCount() {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
List<PageData> value = gateMachineService.getTodayInOutCount(pd);
map.put("varList", value);
map.put("result", errInfo);
return map;
}
/**
* 获取人员、车辆进出记录
*
* @param
* @return
*/
@RequestMapping(value = "/getCurrentLocationOnline")
@ResponseBody
public Object getCurrentLocationOnline() {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
if ("00004".equals(pd.getString("GANGKOU")) && pd.getString("TYPE").equals("peoplePosition")) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/UserPosition/getCurrentLocationOnline", paramMap, Map.class);
return result;
} else if ("00004".equals(pd.getString("GANGKOU")) && pd.getString("TYPE").equals("carPosition")) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/UserPosition/getCarCurrentLocationOnline", paramMap, Map.class);
return result;
} else if ("00004".equals(pd.getString("GANGKOU")) && pd.getString("TYPE").equals("CAMERA")) {
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/ObtainDisplayData/listAllCameraForMap", paramMap, Map.class);
return result;
}
map.put("result", errInfo);
return map;
}
// 获取人员定位信息 根据定位卡编码
@RequestMapping(value = "/getPersonByCardNo")
@ResponseBody
public Object getPersonByCardNo() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
PageData pd = this.getPageData();
// TODO 判断是否是公司人员定位
if (pd.get("corpId") != null && "035958e685cf4850bc40151c5e0617a6".equals(pd.getString("corpId"))) {
MapGet mapGet = new MapGet();
mapGet.setId(pd.getString("CARDNO"));
Object message = dwService.getMapInfo(mapGet);
map = JSONObject.parseObject(JSONObject.toJSONString(message), new TypeReference<Map<String, Object>>() {
});
if (map.get("code") == null || 200 != Integer.parseInt(map.get("code").toString())) {
return map;
} else {
MapInfo info = JSONObject.parseObject(JSONObject.toJSONString(map.get("info")), MapInfo.class);
if (org.apache.commons.lang3.StringUtils.isNotBlank(info.getRequired().getUserId())){
PageData condition = new PageData();
condition.put("USER_ID", info.getRequired().getUserId());
PageData userInfo = usersService.findById(condition);
HashMap<String, String> otherInfo = new HashMap<>();
otherInfo.put("postName", userInfo.getString("postName"));
otherInfo.put("personType", userInfo.getString("PERSON_TYPE"));
map.put("otherInfo", otherInfo);
}
return map;
}
} else {
PageData value = usersService.getPersonByCardNo(pd);
map.put("result", "success");
map.put("pd", value);
return map;
}
}
@RequestMapping(value = "/getPersonTrace")
@ResponseBody
public Object getPersonTrace() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
PageData pd = this.getPageData();
// TODO 判断是否是公司人员定位
if (true){
TraceGet mapInfo = new TraceGet();
mapInfo.setId(pd.getString("id"));
return dwService.getTrace(mapInfo);
}else {
PageData value = usersService.getPersonByCardNo(pd);
map.put("result", "success");
map.put("pd", value);
return map;
}
}
@RequestMapping(value = "/getAllDwMessage")
@ResponseBody
public Object getAlarmList() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
PageData pd = this.getPageData();
// TODO 判断是否是公司人员定位
if (pd.get("corpId") != null && "035958e685cf4850bc40151c5e0617a6".equals(pd.getString("corpId"))) {
AlarmGet alarmGet = new AlarmGet();
alarmGet.setPage(new com.zcloud.service.dw.dto.Page());
alarmGet.getPage().setCurrent("1");
alarmGet.getPage().setSize("20");
alarmGet.setCorpId(pd.getString("corpId"));
map.put("result", "success");
map.put("alarmList",dwService.getAlarmList(alarmGet));
map.put("orthermessage",dwService.getAllMessage());
return map;
}else {
PageData value = usersService.getPersonByCardNo(pd);
map.put("result", "success");
map.put("pd", value);
return map;
}
}
/**
* 获取摄像头播放路径(曹妃甸使用)
*
* @throws Exception
*/
@RequestMapping(value = "/getHlsPath")
@ResponseBody
public Object getHlsPath() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
PageData pd = this.getPageData();
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("INDEXCODE", pd.get("INDEXCODE"));
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/map/getHlsPath", paramMap, Map.class);
return result;
}
/**
* 查询人员在线及统计数据(曹妃甸使用)
*
* @throws Exception
*/
@RequestMapping(value = "/getCurrentPersonnelData")
@ResponseBody
public Object getCurrentPersonnelData() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
PageData pd = this.getPageData();
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("route", pd.get("route"));
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/UserPosition/getCurrentPersonnelData", paramMap, Map.class);
return result;
}
/**
* 查询告警数据甸使用)
*
* @throws Exception
*/
@RequestMapping(value = "/getCfdAlarmNum")
@ResponseBody
public Object getCfdAlarmNum() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
PageData pd = this.getPageData();
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/map/getAlarmNum", paramMap, Map.class);
return result;
}
/**
* 车辆在线及统计数据(曹妃甸使用)
*
* @throws Exception
*/
@RequestMapping(value = "/getCurrentCarData")
@ResponseBody
public Object getCurrentCarData() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
PageData pd = this.getPageData();
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("route", pd.get("route"));
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/UserPosition/getCurrentCarData", paramMap, Map.class);
return result;
}
/**
* 车辆在线及统计数据(曹妃甸使用)
*
* @throws Exception
*/
@RequestMapping(value = "/carPositioningStatistics")
@ResponseBody
public Object carPositioningStatistics() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
PageData pd = this.getPageData();
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("route", pd.get("route"));
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/UserPosition/carPositioningStatistics", paramMap, Map.class);
return result;
}
/**
* 获取人员定位统计列表(曹妃甸使用)
*
* @throws Exception
*/
@RequestMapping(value = "/personPositioningStatistics")
@ResponseBody
public Object personPositioningStatistics() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
PageData pd = this.getPageData();
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
paramMap.add("route", pd.get("route"));
Map<String, Object> result =
restTemplate.postForObject(cfdUrl + "/sync/UserPosition/personPositioningStatistics", paramMap, Map.class);
return result;
}
@RequestMapping("/getUserMapInfo")
@ResponseBody
public ReturnMap getUserMapInfo() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
pd = usersService.findByCardNo(pd); //列出HotWorkApplicationDelayed列表
ReturnMap r = ReturnMap.ok();
r.put("pd", pd);
return r;
}
/**
* 企业端地图优化
* 原有的地图查询速度太慢,达到5s以上,通过索引的方式暂时无法解决,所有使用业务优化sql,提升速度
*
* @param
* @throws Exception
*/
@RequestMapping(value = "/listbymeteorologicalByCorpinfo")
@ResponseBody
public Object listbymeteorologicalByCorpinfo() throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
PageData pd = this.getPageData();
//根据条件增加参数或减少参数 都没有 直接返回空
if (StringUtils.isBlank(pd.getString("CORPINFO_ID"))) {
map.put("result", errInfo);
return map;
}
pd = meteorologicalinfoService.listbymeteorologicalByCorpinfoId(pd); //列出meteorological列表
map.put("pd", pd);
map.put("result", errInfo);
return map;
}
}