一公司获取人员定位系统接口
							parent
							
								
									fadc082584
								
							
						
					
					
						commit
						ba98786e94
					
				|  | @ -0,0 +1,54 @@ | |||
| package com.zcloud.controller.dw; | ||||
| 
 | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import com.zcloud.controller.base.BaseController; | ||||
| import com.zcloud.entity.PageData; | ||||
| import com.zcloud.service.dw.DwService; | ||||
| import com.zcloud.service.dw.dto.*; | ||||
| import org.springframework.stereotype.Controller; | ||||
| import org.springframework.web.bind.annotation.RequestMapping; | ||||
| 
 | ||||
| import javax.annotation.Resource; | ||||
| 
 | ||||
| @Controller | ||||
| @RequestMapping(value = "/dw") | ||||
| 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() throws Exception { | ||||
|         PageData pd = this.getPageData(); | ||||
|         MapGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), MapGet.class); | ||||
|         return dwService.getMapList(mapGet); | ||||
|     } | ||||
| 
 | ||||
|     @RequestMapping(value = "saveOrUpdateMap") | ||||
|     public Object saveOrUpdateMap() throws Exception { | ||||
|         PageData pd = this.getPageData(); | ||||
|         MapInfo mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), MapInfo.class); | ||||
|         return dwService.saveOrUpdateMap(mapGet); | ||||
|     } | ||||
| 
 | ||||
|     @RequestMapping(value = "getAlarmList") | ||||
|     public Object getAlarmList() throws Exception { | ||||
|         PageData pd = this.getPageData(); | ||||
|         AlarmGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), AlarmGet.class); | ||||
|         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); | ||||
|         return dwService.manageAlarm(mapGet); | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,12 @@ | |||
| package com.zcloud.service.dw; | ||||
| 
 | ||||
| import com.zcloud.service.dw.dto.*; | ||||
| 
 | ||||
| public interface DwService { | ||||
| 
 | ||||
|     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; | ||||
| } | ||||
|  | @ -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; | ||||
| 
 | ||||
| } | ||||
|  | @ -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; | ||||
| } | ||||
|  | @ -0,0 +1,15 @@ | |||
| package com.zcloud.service.dw.dto; | ||||
| 
 | ||||
| import lombok.Data; | ||||
| 
 | ||||
| @Data | ||||
| public class MapGet { | ||||
|     private String departmentId; | ||||
|     private String userId; | ||||
|     private String userCardId; | ||||
|     private String userPhone; | ||||
|     private String deviceId; | ||||
|     private String deviceName; | ||||
|     private String type; | ||||
|     private Page page; | ||||
| } | ||||
|  | @ -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; | ||||
| } | ||||
|  | @ -0,0 +1,39 @@ | |||
| package com.zcloud.service.dw.dto; | ||||
| 
 | ||||
| import lombok.Data; | ||||
| 
 | ||||
| @Data | ||||
| public class MapRequired { | ||||
|     //映射类型(0-人员,1-设备)
 | ||||
|     private String type; | ||||
|     //人员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; | ||||
| } | ||||
|  | @ -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; | ||||
| } | ||||
|  | @ -0,0 +1,10 @@ | |||
| package com.zcloud.service.dw.dto; | ||||
| 
 | ||||
| import lombok.Data; | ||||
| 
 | ||||
| @Data | ||||
| public class TraceGet { | ||||
|     private String user_id; | ||||
|     private String startTime; | ||||
|     private String endTime; | ||||
| } | ||||
|  | @ -0,0 +1,40 @@ | |||
| package com.zcloud.service.dw.impl; | ||||
| 
 | ||||
| import com.zcloud.service.dw.DwService; | ||||
| import com.zcloud.service.dw.dto.*; | ||||
| import com.zcloud.util.HttpUtil; | ||||
| import org.springframework.beans.factory.annotation.Value; | ||||
| import org.springframework.stereotype.Service; | ||||
| 
 | ||||
| @Service | ||||
| public class DwServiceImpl implements DwService { | ||||
| 
 | ||||
|     @Value("dw.url") | ||||
|     private String url; | ||||
| 
 | ||||
| 
 | ||||
|     @Override | ||||
|     public Object getMapList(MapGet param) throws Exception { | ||||
|         return HttpUtil.post(url + "dw/getMapList", param); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public Object saveOrUpdateMap(MapInfo param) throws Exception { | ||||
|         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); | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,44 @@ | |||
| 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> tClass) { | ||||
|         RestTemplate restTemplate = new RestTemplate(); | ||||
|         String result = restTemplate.postForEntity(url, info, String.class).getBody(); | ||||
|         return JSONObject.parseObject(result, tClass); | ||||
|     } | ||||
| 
 | ||||
|     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); | ||||
|     } | ||||
| } | ||||
		Loading…
	
		Reference in New Issue