Merge remote-tracking branch 'origin/liujun-2024-04-12一公司人员定位' into pet

liujun-2024-05-23-接口漏洞修复
liujun 2024-04-17 10:04:42 +08:00
commit b93c59b0c9
14 changed files with 413 additions and 5 deletions

View File

@ -67,7 +67,7 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>

View File

@ -0,0 +1,84 @@
package com.zcloud.controller.dw;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.PageData;
import com.zcloud.entity.Page;
import com.zcloud.service.dw.DwService;
import com.zcloud.service.dw.dto.*;
import com.zcloud.util.Jurisdiction;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
@RequestMapping(value = "/dingWei")
public class DwController extends BaseController {
@Resource
private DwService dwService;
@RequestMapping(value = "getTrace")
public Object getTrace() throws Exception {
PageData pd = this.getPageData();
TraceGet traceGet = JSONObject.parseObject(JSONObject.toJSONString(pd), TraceGet.class);
return dwService.getTrace(traceGet);
}
@RequestMapping(value = "getMapList")
public Object getMapList(Page page) throws Exception {
PageData pd = this.getPageData();
MapGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), MapGet.class);
if (mapGet.getPage() == null){
mapGet.setPage(new com.zcloud.service.dw.dto.Page());
}
mapGet.setCorpId(Jurisdiction.getCORPINFO_ID());
mapGet.getPage().setCurrent(String.valueOf(page.getCurrentPage()));
mapGet.getPage().setSize(String.valueOf(page.getShowCount()));
return dwService.getMapList(mapGet);
}
@RequestMapping(value = "saveOrUpdateMap")
public Object saveOrUpdateMap() throws Exception {
PageData pd = this.getPageData();
MapInfo mapGet = JSONObject.parseObject(pd.getString("data"), MapInfo.class);
return dwService.saveOrUpdateMap(mapGet);
}
@RequestMapping(value = "deleteMap")
public Object deleteMap() throws Exception {
PageData pd = this.getPageData();
DeleteDto deleteDto = new DeleteDto();
deleteDto.setId(pd.getString("id"));
deleteDto.setOperatorId(Jurisdiction.getUSER_ID());
deleteDto.setOperatorName(Jurisdiction.getName());
return dwService.deleteMap(deleteDto);
}
@RequestMapping(value = "getAlarmList")
public Object getAlarmList(Page page) throws Exception {
PageData pd = this.getPageData();
AlarmGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), AlarmGet.class);
if (mapGet.getPage() == null){
mapGet.setPage(new com.zcloud.service.dw.dto.Page());
}
mapGet.getPage().setCurrent(String.valueOf(page.getUrlCurrentPage()));
mapGet.getPage().setSize(String.valueOf(page.getShowCount()));
return dwService.getAlarmList(mapGet);
}
@RequestMapping(value = "manageAlarm")
public Object manageAlarm() throws Exception {
PageData pd = this.getPageData();
AlarmManageDto mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), AlarmManageDto.class);
mapGet.setAlarmId(pd.getString("DW_ALARM_ID"));
return dwService.manageAlarm(mapGet);
}
@RequestMapping(value = "getDictionary")
public Object getDictionary() throws Exception {
return dwService.getDictionary();
}
}

View File

@ -1,9 +1,15 @@
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.*;
import com.zcloud.service.map.util.ReturnMap;
@ -24,6 +30,7 @@ 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.*;
/**
@ -73,6 +80,8 @@ public class MapController extends BaseController {
@Autowired
private WeatherUtil weatherUtil;
@Resource
private DwService dwService;
@ResponseBody
@RequestMapping("/getCorpInfo")
@ -864,11 +873,53 @@ public class MapController extends BaseController {
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);
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);
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;
}
}
/**
* (使

View File

@ -0,0 +1,16 @@
package com.zcloud.service.dw;
import com.zcloud.service.dw.dto.*;
public interface DwService {
Object getMapInfo(MapGet param) throws Exception;
Object getMapList(MapGet param) throws Exception;
Object saveOrUpdateMap(MapInfo param) throws Exception;
Object getTrace(TraceGet param) throws Exception;
Object getAlarmList(AlarmGet param) throws Exception;
Object manageAlarm(AlarmManageDto param) throws Exception;
Object getDictionary() throws Exception;
Object deleteMap(DeleteDto deleteDto);
}

View File

@ -0,0 +1,13 @@
package com.zcloud.service.dw.dto;
import lombok.Data;
@Data
public class AlarmGet {
private String startTime;
private String endTime;
private String status;
private Page page;
}

View File

@ -0,0 +1,12 @@
package com.zcloud.service.dw.dto;
import lombok.Data;
@Data
public class AlarmManageDto {
private String status;
private String alarmId;
private String opinion;
private String operator;
private String operatorName;
}

View File

@ -0,0 +1,14 @@
package com.zcloud.service.dw.dto;
import lombok.Data;
import java.util.List;
@Data
public class DeleteDto {
private String id;
private List<String> ids;
private String operatorId;
private String operatorName;
}

View File

@ -0,0 +1,18 @@
package com.zcloud.service.dw.dto;
import lombok.Data;
@Data
public class MapGet {
private String departmentId;
private String userId;
private String userName;
private String corpId;
private String userCardId;
private String userPhone;
private String deviceId;
private String deviceName;
private String type;
private String id;
private Page page;
}

View File

@ -0,0 +1,14 @@
package com.zcloud.service.dw.dto;
import lombok.Data;
@Data
public class MapInfo {
private MapRequired required;
//其他系统备注
private String idRemark;
//备注
private String remark;
private String dwUserMapId;
}

View File

@ -0,0 +1,40 @@
package com.zcloud.service.dw.dto;
import lombok.Data;
@Data
public class MapRequired {
//映射类型0-人员1-设备)
private String type;
private String typeName;
//人员id
private String userId;
//人员姓名
private String userName;
//身份证号
private String userCardId;
//手机号
private String userPhone;
//设备id
private String deviceId;
//设备名称
private String deviceName;
//部门id
private String departmentId;
//部门名称
private String departmentName;
//企业id名称
private String corpId;
//企业名称
private String corpName;
//其他系统id
private String id;
//数据创建人id
private String creatorId;
//数据创建人名称
private String creatorName;
//数据更新时间
private String operatorId;
//数据更新人id
private String operatorName;
}

View File

@ -0,0 +1,10 @@
package com.zcloud.service.dw.dto;
import lombok.Data;
@Data
public class Page {
private String page;
private String size;
private String current;
}

View File

@ -0,0 +1,11 @@
package com.zcloud.service.dw.dto;
import lombok.Data;
@Data
public class TraceGet {
private String user_id;
private String id;
private String startTime;
private String endTime;
}

View File

@ -0,0 +1,70 @@
package com.zcloud.service.dw.impl;
import com.zcloud.entity.PageData;
import com.zcloud.service.bus.CorpInfoService;
import com.zcloud.service.dw.DwService;
import com.zcloud.service.dw.dto.*;
import com.zcloud.util.HttpUtil;
import com.zcloud.util.Jurisdiction;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class DwServiceImpl implements DwService {
@Value("${dw.url}")
private String url;
@Resource
private CorpInfoService corpInfoService;
@Override
public Object getMapInfo(MapGet param) throws Exception {
return HttpUtil.post(url + "dw/getMapInfo", param);
}
@Override
public Object getMapList(MapGet param) throws Exception {
return HttpUtil.post(url + "dw/getMapList", param);
}
@Override
public Object saveOrUpdateMap(MapInfo param) throws Exception {
param.getRequired().setCreatorId(Jurisdiction.getUSER_ID());
param.getRequired().setCreatorName(Jurisdiction.getName());
param.getRequired().setOperatorId(Jurisdiction.getUSER_ID());
param.getRequired().setOperatorName(Jurisdiction.getName());
param.getRequired().setCorpId(Jurisdiction.getCORPINFO_ID());
PageData condition = new PageData();
condition.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
param.getRequired().setCorpName(corpInfoService.findById(condition).getString("CORP_NAME"));
return HttpUtil.post(url + "dw/saveOrUpdateMap", param);
}
@Override
public Object getTrace(TraceGet param) throws Exception {
return HttpUtil.post(url + "dw/getTrace", param);
}
@Override
public Object getAlarmList(AlarmGet param) throws Exception {
return HttpUtil.post(url + "dw/getAlarmList", param);
}
@Override
public Object manageAlarm(AlarmManageDto param) throws Exception {
return HttpUtil.post(url + "dw/manageAlarm", param);
}
@Override
public Object getDictionary() throws Exception {
return HttpUtil.post(url + "dw/getDictionary", "");
}
@Override
public Object deleteMap(DeleteDto deleteDto) {
return HttpUtil.post(url + "dw/deleteMap", deleteDto);
}
}

View File

@ -0,0 +1,55 @@
package com.zcloud.util;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import org.apache.poi.ss.formula.functions.T;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.Map;
public class HttpUtil<K,V> {
private static final Logger LOGGER = LoggerFactory.getLogger(HttpUtil.class);
/**
*
*/
private static final int SUCCESS_CODE = 200;
public HashMap<K,V> doPost(String url, HashMap<String, String> info) {
RestTemplate restTemplate = new RestTemplate();
String result = restTemplate.postForEntity(url, info, String.class).getBody();
return JSONObject.parseObject(result, new TypeReference<HashMap<K, V>>() {});
}
public HashMap<K,V> doPost(String url, Object info) {
RestTemplate restTemplate = new RestTemplate();
String result = restTemplate.postForEntity(url, info, String.class).getBody();
return JSONObject.parseObject(result, new TypeReference<HashMap<K, V>>() {});
}
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, 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) {
RestTemplate restTemplate = new RestTemplate();
String result = restTemplate.postForEntity(url, info, String.class).getBody();
return JSONObject.parseObject(result, Map.class);
}
public static Object post(String url) {
RestTemplate restTemplate = new RestTemplate();
String result = restTemplate.getForObject(url, String.class);
return JSONObject.parseObject(result, Map.class);
}
}