一公司人员定位地图功能完善

liujun-2024-05-23-接口漏洞修复
liujun 2024-04-17 08:57:44 +08:00
parent 1da764000c
commit ca299d110d
2 changed files with 30 additions and 7 deletions

View File

@ -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<String, Object> map = new HashMap<String, Object>();
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<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);
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("personnelTypeName", userInfo.getString("personnelTypeName"));
map.put("otherInfo", otherInfo);
return map;
}
} else {
PageData value = usersService.getPersonByCardNo(pd);
map.put("result", "success");
map.put("pd", value);

View File

@ -30,10 +30,15 @@ public class HttpUtil<K,V> {
return JSONObject.parseObject(result, new TypeReference<HashMap<K, V>>() {});
}
public T doPost(String url, Object info, Class<T> tClass) {
public T doPost(String url, Object info, Class<T> 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> T post(String url, Object info, Class<T> responseType) {
RestTemplate restTemplate = new RestTemplate();
return restTemplate.postForEntity(url, info, responseType).getBody();
}
public static Object post(String url, Object info) {