355 lines
14 KiB
Java
355 lines
14 KiB
Java
package com.zcloud.controller.map;
|
||
|
||
import com.zcloud.controller.base.BaseController;
|
||
import com.zcloud.entity.Page;
|
||
import com.zcloud.entity.PageData;
|
||
import com.zcloud.service.map.MapEightService;
|
||
import com.zcloud.service.map.util.ReturnMap;
|
||
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.RequestMapping;
|
||
import org.springframework.web.bind.annotation.RequestParam;
|
||
import org.springframework.web.bind.annotation.ResponseBody;
|
||
import org.springframework.web.client.RestTemplate;
|
||
|
||
import java.util.ArrayList;
|
||
import java.util.HashMap;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
|
||
/**
|
||
* 说明:实时地图八项工作内容
|
||
* 官网:www.zcloudchina.com
|
||
*/
|
||
@Controller
|
||
@RequestMapping("/czksmap/Eight")
|
||
public class MapEightController extends BaseController {
|
||
|
||
@Autowired
|
||
private MapEightService mapEightService;
|
||
@Value("${cfd.prevention.api.url}")
|
||
private String cfdUrl;
|
||
@Autowired
|
||
private RestTemplate restTemplate;
|
||
|
||
/**
|
||
* @return
|
||
* @throws Exception
|
||
*/
|
||
@RequestMapping(value = "/getEcharts")
|
||
@ResponseBody
|
||
public Object getEcharts() throws Exception {
|
||
PageData pd = new PageData();
|
||
pd = this.getPageData();
|
||
if (StringUtils.equals("035958e685cf4850bc40151c5e0617a6", pd.getString("CORPINFO_ID"))) { //一公司
|
||
return mapEightService.getEcharts(pd);
|
||
}else if (StringUtils.equals("8854edee3aa94be496cee676b6d4845a", pd.getString("CORPINFO_ID"))) { //曹妃甸东
|
||
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
|
||
//paramMap.add("CORPINFO_ID", pd.getString("CORPINFO_ID"));
|
||
Map<String, Object> result =
|
||
restTemplate.postForObject(cfdUrl + "/sync/map/Eight/getEcharts", paramMap, Map.class);
|
||
return result;
|
||
} else {
|
||
return mapEightService.getEchartsOrder(pd);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 可视化首页统计数据
|
||
*
|
||
* @param
|
||
* @throws Exception
|
||
*/
|
||
@RequestMapping(value = "/findFormCount")
|
||
@ResponseBody
|
||
public Object findFormCount() throws Exception {
|
||
Map<String, Object> map = new HashMap<String, Object>();
|
||
String errInfo = "success";
|
||
PageData pd = new PageData();
|
||
pd = this.getPageData();
|
||
if (StringUtils.equals("035958e685cf4850bc40151c5e0617a6", pd.getString("CORPINFO_ID"))) { // 一公司
|
||
/*风险管控 数据统计*/
|
||
//获取高危作业统计数据(申请数[COUNTAPPLY],审批中[COUNTAPPROVE],归档[COUNTARCHIVE])
|
||
PageData data = mapEightService.statisticsHighRiskWorkByState(pd);
|
||
map.put("pd", data);
|
||
}else if (StringUtils.equals("8854edee3aa94be496cee676b6d4845a", pd.getString("CORPINFO_ID"))) { //曹妃甸东
|
||
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
|
||
//paramMap.add("CORPINFO_ID", pd.getString("CORPINFO_ID"));
|
||
Map<String, Object> result =
|
||
restTemplate.postForObject(cfdUrl + "/sync/map/Eight/findFormCount", paramMap, Map.class);
|
||
return result;
|
||
} else {
|
||
PageData data = mapEightService.statisticsHighRiskWorkByStateOrder(pd);
|
||
map.put("pd", data);
|
||
}
|
||
//pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
|
||
map.put("result", errInfo);
|
||
return map;
|
||
}
|
||
|
||
/**
|
||
* 作业实时情况展示(最新18条)
|
||
*
|
||
* @param
|
||
* @throws Exception
|
||
*/
|
||
@RequestMapping(value = "/listHighRiskWork")
|
||
@ResponseBody
|
||
public Object listHighRiskWork(Page page) throws Exception {
|
||
Map<String, Object> map = new HashMap<String, Object>();
|
||
String errInfo = "success";
|
||
PageData pd = new PageData();
|
||
pd = this.getPageData();
|
||
List<PageData> varList = new ArrayList<>();
|
||
//根据条件增加参数或减少参数 都没有 直接返回空
|
||
if (StringUtils.isBlank(pd.getString("CORPINFO_ID"))) {
|
||
List<String> ArrayDATA_IDS = mapEightService.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 (StringUtils.equals("035958e685cf4850bc40151c5e0617a6", pd.getString("CORPINFO_ID"))) { //一公司
|
||
//pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); // 企业
|
||
varList = mapEightService.listHighRiskWork(page);
|
||
} else if (StringUtils.equals("8854edee3aa94be496cee676b6d4845a", pd.getString("CORPINFO_ID"))) { //曹妃甸
|
||
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
|
||
//paramMap.add("CORPINFO_ID", pd.getString("CORPINFO_ID"));
|
||
Map<String, Object> result =
|
||
restTemplate.postForObject(cfdUrl + "/sync/map/Eight/listHighRiskWork", paramMap, Map.class);
|
||
return result;
|
||
} else {
|
||
varList = mapEightService.listHighRiskWorkOrder(page);
|
||
}
|
||
map.put("varList", varList);
|
||
map.put("result", errInfo);
|
||
return map;
|
||
}
|
||
|
||
/**
|
||
* 获取所有高危作业的位置坐标(有坐标数据)
|
||
*
|
||
* @param
|
||
* @throws Exception
|
||
*/
|
||
@RequestMapping(value = "/listAllHighRiskWorkLocation")
|
||
@ResponseBody
|
||
public Object listAllHighRiskWorkLocation(@RequestParam(value = "CORPINFO_ID") String CORPINFO_ID, @RequestParam("TYPE") String type, @RequestParam("GANGKOU") String GANGKOU, @RequestParam("AREA") String AREA) throws Exception {
|
||
Map<String, Object> map = new HashMap<String, Object>();
|
||
String errInfo = "success";
|
||
PageData pd = new PageData();
|
||
pd = this.getPageData();
|
||
//pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); // 企业
|
||
List<PageData> varList = new ArrayList<>();
|
||
//根据条件增加参数或减少参数 都没有 直接返回空
|
||
if (StringUtils.isBlank(pd.getString("CORPINFO_ID"))) {
|
||
List<String> ArrayDATA_IDS = mapEightService.getCorpinfoIds(pd);
|
||
if (ArrayDATA_IDS.size() == 0) {
|
||
map.put("result", errInfo);
|
||
return map;
|
||
}
|
||
pd.put("ids", ArrayDATA_IDS);
|
||
pd.remove("CORPINFO_ID");
|
||
}
|
||
if (StringUtils.equals("8854edee3aa94be496cee676b6d4845a", pd.getString("CORPINFO_ID"))) { //曹妃甸
|
||
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
|
||
paramMap.add("TYPE", pd.getString("TYPE"));
|
||
if (StringUtils.equals("CAMERA", pd.getString("TYPE"))) {
|
||
Map<String, Object> result =
|
||
restTemplate.postForObject(cfdUrl + "/sync/ObtainDisplayData/listAllCameraForMap", paramMap, Map.class);
|
||
List<Map<String, String>> pageDataList = (List<Map<String, String>>) result.get("varList");
|
||
if(pageDataList.size()>0){
|
||
for(int i = 0;i<pageDataList.size();i++){
|
||
Map<String, String> stringMap = pageDataList.get(i);
|
||
stringMap.put("CORPINFO_ID","635917e77af8461691d5da5507b56347");
|
||
}
|
||
}
|
||
result.put("varList",pageDataList);
|
||
return result;
|
||
} else {
|
||
Map<String, Object> result =
|
||
restTemplate.postForObject(cfdUrl + "/sync/map/Eight/listAllHighRiskWorkLocation", paramMap, Map.class);
|
||
List<Map<String, String>> pageDataList = (List<Map<String, String>>) result.get("varList");
|
||
if(pageDataList.size()>0){
|
||
for(int i = 0;i<pageDataList.size();i++){
|
||
Map<String, String> stringMap = pageDataList.get(0);
|
||
stringMap.put("CORPINFO_ID","635917e77af8461691d5da5507b56347");
|
||
}
|
||
}
|
||
result.put("varList",pageDataList);
|
||
return result;
|
||
}
|
||
}
|
||
if (StringUtils.equals("035958e685cf4850bc40151c5e0617a6", pd.getString("CORPINFO_ID"))) { //一公司
|
||
varList = mapEightService.listAllHighRiskWorkLocation(pd);
|
||
} else {
|
||
varList = mapEightService.listAllHighRiskWorkLocationOrder(pd);
|
||
}
|
||
map.put("varList", varList);
|
||
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 {
|
||
PageData pd = this.getPageData();
|
||
return mapEightService.getById(pd);
|
||
|
||
}
|
||
|
||
/**
|
||
* 根据id以及类型获取数据 其他公司
|
||
*
|
||
* @param id 数据id
|
||
* @param type 数据类型 动火 等等
|
||
* @return
|
||
*/
|
||
@RequestMapping(value = "/getByIdOrder")
|
||
@ResponseBody
|
||
public Object getByIdOrder(@RequestParam(value = "id") String id, @RequestParam("TYPE") String type) throws Exception {
|
||
PageData pd = new PageData();
|
||
pd = this.getPageData();
|
||
return mapEightService.getByIdOrder(pd);
|
||
|
||
}
|
||
|
||
/**
|
||
* 列表
|
||
*
|
||
* @param page
|
||
* @throws Exception
|
||
*/
|
||
@RequestMapping(value = "/list")
|
||
@ResponseBody
|
||
public Object list(Page page) throws Exception {
|
||
Map<String, Object> map = new HashMap<String, Object>();
|
||
String errInfo = "success";
|
||
PageData pd = new PageData();
|
||
pd = this.getPageData();
|
||
List<PageData> varList = mapEightService.listAll(pd); //列出HotWorkApplicationDelayed列表
|
||
map.put("varList", varList);
|
||
map.put("page", page);
|
||
map.put("result", errInfo);
|
||
return map;
|
||
}
|
||
|
||
/**
|
||
* 获取动火防护措施
|
||
*
|
||
* @param
|
||
* @throws Exception
|
||
*/
|
||
@RequestMapping(value = "/listAllMeasures")
|
||
@ResponseBody
|
||
public Object listAllMeasures() throws Exception {
|
||
Map<String, Object> map = new HashMap<String, Object>();
|
||
String errInfo = "success";
|
||
PageData pd = new PageData();
|
||
pd = this.getPageData();
|
||
// 港口04消防点东港
|
||
if ("00004".equals(pd.getString("GANGKOU"))) {
|
||
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
|
||
paramMap.add("HOTWORKAPPLICATION_ID", pd.getString("HOTWORKAPPLICATION_ID"));
|
||
Map<String, Object> result =
|
||
restTemplate.postForObject(cfdUrl + "/sync/map/Eight/listAllMeasures", paramMap, Map.class);
|
||
return result;
|
||
}
|
||
List<PageData> varList = mapEightService.listAllMeasures(pd); //根据ID读取
|
||
map.put("varList", varList);
|
||
map.put("result", errInfo);
|
||
return map;
|
||
}
|
||
|
||
|
||
/**
|
||
* 根据id以及类型获取数据 //曹妃甸东
|
||
*
|
||
* @param id 数据id
|
||
* @param type 数据类型 动火 等等
|
||
* @return
|
||
*/
|
||
@RequestMapping(value = "/getByIdCfdD")
|
||
@ResponseBody
|
||
public Object getByIdCfdD(@RequestParam(value = "id") String id, @RequestParam("TYPE") String type) throws Exception {
|
||
PageData pd = this.getPageData();
|
||
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
|
||
paramMap.add("id", pd.getString("id"));
|
||
paramMap.add("TYPE", pd.getString("TYPE"));
|
||
paramMap.add("HOTWORK_ID", pd.getString("HOTWORK_ID"));
|
||
Map<String, Object> result =
|
||
restTemplate.postForObject(cfdUrl + "/sync/map/Eight/getByIdOrder", paramMap, Map.class);
|
||
return result;
|
||
}
|
||
|
||
/*曹妃甸专用接口-开始*/
|
||
|
||
/**
|
||
* @Description: 获取八项作业所有作业人员
|
||
* @Date: 2023/9/23/023 9:04
|
||
* @Param:
|
||
* @Return:
|
||
*/
|
||
@RequestMapping("/getAllWorkUserCards")
|
||
@ResponseBody
|
||
public ReturnMap getAllWorkUserCards() {
|
||
PageData pageData = this.getPageData();
|
||
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
|
||
Map<String, Object> result =
|
||
restTemplate.postForObject(cfdUrl + "/sync/map/Eight/getAllWorkUserCards", paramMap, Map.class);
|
||
return ReturnMap.ok(result);
|
||
}
|
||
|
||
/**
|
||
* @Description: 获取八项作业所有作业人员
|
||
* @Date: 2023/9/23/023 9:04
|
||
* @Param:
|
||
* @Return:
|
||
*/
|
||
@RequestMapping("/getAllTickets")
|
||
@ResponseBody
|
||
public ReturnMap getAllTickets() {
|
||
PageData pageData = this.getPageData();
|
||
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
|
||
Map<String, Object> result =
|
||
restTemplate.postForObject(cfdUrl + "/sync/map/Eight/getAllTickets", paramMap, Map.class);
|
||
return ReturnMap.ok(result);
|
||
}
|
||
|
||
/**
|
||
* @Description: 获取八项作业所有作业人员
|
||
* @Date: 2023/9/23/023 9:04
|
||
* @Param:
|
||
* @Return:
|
||
*/
|
||
@RequestMapping("/findEightsByUserId")
|
||
@ResponseBody
|
||
public ReturnMap findEightsByUserId() {
|
||
PageData pageData = this.getPageData();
|
||
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
|
||
paramMap.add("empNo", pageData.getString("empNo"));
|
||
paramMap.add("TYPE", pageData.getString("TYPE"));
|
||
Map<String, Object> result =
|
||
restTemplate.postForObject(cfdUrl + "/sync/map/Eight/findEightsByUserId", paramMap, Map.class);
|
||
return ReturnMap.ok(result);
|
||
}
|
||
|
||
|
||
/*曹妃甸专用接口-结束*/
|
||
|
||
}
|