From ca299d110d087e1bf5b8ce1476097bbf7784de93 Mon Sep 17 00:00:00 2001 From: liujun Date: Wed, 17 Apr 2024 08:57:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E5=85=AC=E5=8F=B8=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E5=9C=B0=E5=9B=BE=E5=8A=9F=E8=83=BD=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zcloud/controller/map/MapController.java | 28 +++++++++++++++---- src/main/java/com/zcloud/util/HttpUtil.java | 9 ++++-- 2 files changed, 30 insertions(+), 7 deletions(-) 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) {