| | |
| | | package cn.gistack.nky.service.impl; |
| | | |
| | | import cn.gistack.common.utils.SpringContextUtil; |
| | | import cn.gistack.nky.resultpojo.DataBigResultPojo; |
| | | import cn.gistack.nky.resultpojo.DataResChildrenPo; |
| | | import cn.gistack.nky.resultpojo.DataResPo; |
| | | import cn.gistack.nky.resultpojo.ZtResultPo; |
| | | import cn.gistack.nky.service.IZtApiService; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.tool.utils.ObjectUtil; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | |
| | | * @DATE: 2023/7/28 17:16 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class ZtApiServiceImpl implements IZtApiService { |
| | | |
| | | //本地测试 |
| | |
| | | /** |
| | | * 实时渗压监测 |
| | | */ |
| | | private static final String LASTEST_OSMOTIC_PRESSURE =ONLINE + "/services/1234567890ABCDEFGHIJKLMN/monitor/lastest_osmotic_pressure/api?res_nm=&cd=&city_cd=&county_cd=&pageNo=1&pageSize=9999"; |
| | | private static final String LASTEST_OSMOTIC_PRESSURE = "/services/1234567890ABCDEFGHIJKLMN/monitor/lastest_osmotic_pressure/api?res_nm=&cd=&city_cd=&county_cd=&pageNo=1&pageSize=9999"; |
| | | |
| | | /** |
| | | * 位移监测 |
| | | */ |
| | | private static final String WY_API =ONLINE+ "/services/1234567890ABCDEFGHIJKLMN/monitor/wy/api?res_nm=&cd=&city_cd=&county_cd=&pageNo=1&pageSize=9999"; |
| | | private static final String WY_API ="/services/1234567890ABCDEFGHIJKLMN/monitor/wy/api?res_nm=&cd=&city_cd=&county_cd=&pageNo=1&pageSize=9999"; |
| | | |
| | | /** |
| | | * 渗流监测 |
| | | */ |
| | | private static final String SL_API =ONLINE + "/services/1234567890ABCDEFGHIJKLMN/monitor/sl/api?res_nm=&cd=&city_cd=&county_cd=&pageNo=1&pageSize=9999"; |
| | | private static final String SL_API ="/services/1234567890ABCDEFGHIJKLMN/monitor/sl/api?res_nm=&cd=&city_cd=&county_cd=&pageNo=1&pageSize=9999"; |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | private List<DataResChildrenPo> getData(String url, String type, Map<String, Object> params) { |
| | | // 获取环境 |
| | | String activeProfile = SpringContextUtil.getActiveProfile(); |
| | | if (activeProfile.equals("dev")) { |
| | | url = LOCAL+ url ; |
| | | } |
| | | if (activeProfile.equals("prod")) { |
| | | url = ONLINE+ url ; |
| | | } |
| | | if (activeProfile.equals("test")) { |
| | | url = ONLINE + url; |
| | | } |
| | | |
| | | HttpMethod method; |
| | | if (type.toLowerCase().equals("get".toLowerCase())) { |
| | | method = HttpMethod.GET; |
| | |
| | | HttpEntity<String> httpEntity = new HttpEntity(null, headers); |
| | | |
| | | RestTemplate template = new RestTemplate(); |
| | | log.info("请求的url为:{}", url); |
| | | ResponseEntity<ZtResultPo> ztResultPojoResponseEntity = template.exchange(url, method,httpEntity, ZtResultPo.class,params); |
| | | if (ztResultPojoResponseEntity.getStatusCodeValue() == 200) { |
| | | List<DataResChildrenPo> children = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | private List<DataResPo> getResData(String url, String type, Map<String, Object> params){ |
| | | |
| | | // 获取环境 |
| | | String activeProfile = SpringContextUtil.getActiveProfile(); |
| | | if (activeProfile.equals("dev")) { |
| | | url = LOCAL+ url ; |
| | | } |
| | | if (activeProfile.equals("prod")) { |
| | | url = ONLINE+ url ; |
| | | } |
| | | if (activeProfile.equals("test")) { |
| | | url = ONLINE + url; |
| | | } |
| | | |
| | | |
| | | HttpMethod method; |
| | | if (type.toLowerCase().equals("get".toLowerCase())) { |
| | | method = HttpMethod.GET; |