diff --git a/src/main/java/com/zcloud/controller/map/MapController.java b/src/main/java/com/zcloud/controller/map/MapController.java index c6369ffd..ed9544f0 100644 --- a/src/main/java/com/zcloud/controller/map/MapController.java +++ b/src/main/java/com/zcloud/controller/map/MapController.java @@ -1,11 +1,14 @@ 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.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.*; @@ -871,11 +874,26 @@ public class MapController extends BaseController { Map map = new HashMap(); PageData pd = this.getPageData(); // TODO 判断是否是公司人员定位 - if (true){ - MapGet mapInfo = new MapGet(); - mapInfo.setId(pd.getString("CARDNO")); - return dwService.getMapInfo(mapInfo); - }else { + 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>() { + }); + 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); + PageData condition = new PageData(); + condition.put("USER_ID", info.getRequired().getUserId()); + PageData userInfo = usersService.findById(condition); + HashMap otherInfo = new HashMap<>(); + otherInfo.put("postName", userInfo.getString("postName")); + otherInfo.put("personnelTypeName", userInfo.getString("personnelTypeName")); + map.put("otherInfo", otherInfo); + return map; + } + } else { PageData value = usersService.getPersonByCardNo(pd); map.put("result", "success"); map.put("pd", value); diff --git a/src/main/java/com/zcloud/util/HttpUtil.java b/src/main/java/com/zcloud/util/HttpUtil.java index 2cac2b63..ba804ad4 100644 --- a/src/main/java/com/zcloud/util/HttpUtil.java +++ b/src/main/java/com/zcloud/util/HttpUtil.java @@ -30,10 +30,15 @@ public class HttpUtil { return JSONObject.parseObject(result, new TypeReference>() {}); } - public T doPost(String url, Object info, Class tClass) { + public T doPost(String url, Object info, Class responseType) { RestTemplate restTemplate = new RestTemplate(); String result = restTemplate.postForEntity(url, info, String.class).getBody(); - return JSONObject.parseObject(result, tClass); + return JSONObject.parseObject(result, responseType); + } + + public static T post(String url, Object info, Class responseType) { + RestTemplate restTemplate = new RestTemplate(); + return restTemplate.postForEntity(url, info, responseType).getBody(); } public static Object post(String url, Object info) {