diff --git a/pom.xml b/pom.xml index b3ce79c..401d503 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.springnewfiber.dataadapter newfiber-data-adapter - 1.0-SNAPSHOT + 1.0 1.8 diff --git a/pom.xml b/pom.xml index b3ce79c..401d503 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.springnewfiber.dataadapter newfiber-data-adapter - 1.0-SNAPSHOT + 1.0 1.8 diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java index 1c803e8..9bc93a2 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java @@ -36,6 +36,7 @@ @PostConstruct public void loginAction() { + HttpRequest.setGlobalTimeout(300000); if (!bladeRedis.exists(ziguangToken)) { HttpRequest request = HttpUtil.createPost(ziGuangConfig.getLogin().getLoginurl()); request.body(JSONObject.toJSONString(ImmutableMap.of(username, ziGuangConfig.getLogin().getUsername(), password, ziGuangConfig.getLogin().getPassword()))); diff --git a/pom.xml b/pom.xml index b3ce79c..401d503 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.springnewfiber.dataadapter newfiber-data-adapter - 1.0-SNAPSHOT + 1.0 1.8 diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java index 1c803e8..9bc93a2 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java @@ -36,6 +36,7 @@ @PostConstruct public void loginAction() { + HttpRequest.setGlobalTimeout(300000); if (!bladeRedis.exists(ziguangToken)) { HttpRequest request = HttpUtil.createPost(ziGuangConfig.getLogin().getLoginurl()); request.body(JSONObject.toJSONString(ImmutableMap.of(username, ziGuangConfig.getLogin().getUsername(), password, ziGuangConfig.getLogin().getPassword()))); diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java index 77d78cd..08e36f2 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java @@ -12,4 +12,9 @@ public class YlConfig { private String listUrl; private String realUrl; + private String oneHourUrl; + private String threeHourUrl; + private String sixHourUrl; + private String dayUrl; + private String countUrl; } diff --git a/pom.xml b/pom.xml index b3ce79c..401d503 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.springnewfiber.dataadapter newfiber-data-adapter - 1.0-SNAPSHOT + 1.0 1.8 diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java index 1c803e8..9bc93a2 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java @@ -36,6 +36,7 @@ @PostConstruct public void loginAction() { + HttpRequest.setGlobalTimeout(300000); if (!bladeRedis.exists(ziguangToken)) { HttpRequest request = HttpUtil.createPost(ziGuangConfig.getLogin().getLoginurl()); request.body(JSONObject.toJSONString(ImmutableMap.of(username, ziGuangConfig.getLogin().getUsername(), password, ziGuangConfig.getLogin().getPassword()))); diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java index 77d78cd..08e36f2 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java @@ -12,4 +12,9 @@ public class YlConfig { private String listUrl; private String realUrl; + private String oneHourUrl; + private String threeHourUrl; + private String sixHourUrl; + private String dayUrl; + private String countUrl; } diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/core/ZiGuangDataJob.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/core/ZiGuangDataJob.java index 69b9514..f3ff4a3 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/core/ZiGuangDataJob.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/core/ZiGuangDataJob.java @@ -27,12 +27,12 @@ private final HpAction hpAction; private final YlAction ylAction; private final ZsAction zsAction; - @Scheduled(cron = "0 0/2 * * * ?") + @Scheduled(cron = "0 0/1 * * * ?") public void synchronize() { -// bzAction.list(); -// gqAction.list(); -// hdAction.list(); -// hpAction.list(); + bzAction.list(); + gqAction.list(); + hdAction.list(); + hpAction.list(); ylAction.list(); zsAction.list(); } diff --git a/pom.xml b/pom.xml index b3ce79c..401d503 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.springnewfiber.dataadapter newfiber-data-adapter - 1.0-SNAPSHOT + 1.0 1.8 diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java index 1c803e8..9bc93a2 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java @@ -36,6 +36,7 @@ @PostConstruct public void loginAction() { + HttpRequest.setGlobalTimeout(300000); if (!bladeRedis.exists(ziguangToken)) { HttpRequest request = HttpUtil.createPost(ziGuangConfig.getLogin().getLoginurl()); request.body(JSONObject.toJSONString(ImmutableMap.of(username, ziGuangConfig.getLogin().getUsername(), password, ziGuangConfig.getLogin().getPassword()))); diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java index 77d78cd..08e36f2 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java @@ -12,4 +12,9 @@ public class YlConfig { private String listUrl; private String realUrl; + private String oneHourUrl; + private String threeHourUrl; + private String sixHourUrl; + private String dayUrl; + private String countUrl; } diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/core/ZiGuangDataJob.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/core/ZiGuangDataJob.java index 69b9514..f3ff4a3 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/core/ZiGuangDataJob.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/core/ZiGuangDataJob.java @@ -27,12 +27,12 @@ private final HpAction hpAction; private final YlAction ylAction; private final ZsAction zsAction; - @Scheduled(cron = "0 0/2 * * * ?") + @Scheduled(cron = "0 0/1 * * * ?") public void synchronize() { -// bzAction.list(); -// gqAction.list(); -// hdAction.list(); -// hpAction.list(); + bzAction.list(); + gqAction.list(); + hdAction.list(); + hpAction.list(); ylAction.list(); zsAction.list(); } diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/action/YlAction.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/action/YlAction.java index b1afc33..4722f1e 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/action/YlAction.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/action/YlAction.java @@ -16,6 +16,7 @@ import org.springnewfiber.dataadapter.ziguang.common.ZiGuangConfig; import org.springnewfiber.dataadapter.ziguang.yl.dto.YlDto; +import java.util.Date; import java.util.List; import java.util.Map; @@ -81,6 +82,7 @@ YlDto dto = new YlDto(); if ((flag && (dto = bladeRedis.get("yl:" + stcd)) != null && dto.getTM().before(i.getTM())) || !flag) { log.info("雨量redis的数据:{},请求到的最新数据:{}", JSONObject.toJSONString(dto), JSONObject.toJSONString(i.getTM())); + getData(stcd, i.getTM(), i); rabbitTemplate.convertAndSend(JSONObject.toJSONString(YlDto.convert(i))); bladeRedis.set("yl:" + stcd, i); log.info("发送雨量的数据:{},数据:{}", stcd, JSONObject.toJSONString(YlDto.convert(i))); @@ -89,4 +91,36 @@ }); } } + + private void getData(String stcd, Date TM, YlDto dto) { + Float one = gethourData(stcd, TM, ziGuangConfig.getYl().getOneHourUrl()); + Float Three = gethourData(stcd, TM, ziGuangConfig.getYl().getThreeHourUrl()); + Float Six = gethourData(stcd, TM, ziGuangConfig.getYl().getSixHourUrl()); + Float Day = gethourData(stcd, TM, ziGuangConfig.getYl().getDayUrl()); + dto.setP1(one); + dto.setP3(Three); + dto.setP6(Six); + dto.setPd(Day); + //todo 历史每个月查询 + } + + private Float gethourData(String stcd, Date TM, String url) { + Map childPramMap = Maps.newHashMap(); + childPramMap.put("stcd", stcd); + childPramMap.put("addvcd", "420113"); + childPramMap.put("drp", "1"); + childPramMap.put("daydrp", ""); + childPramMap.put("type", ""); + Map listByPramMap = ImmutableMap.of("searchFilters", childPramMap); + HttpRequest request = loginAction.getPostAuthRequest(url); + request.body(JSONObject.toJSONString(listByPramMap)); + HttpResponse response = request.execute(); + log.info("单个雨量小时数据:stcd:{},数据:{}", stcd, response.body()); + List list = JSONObject.parseArray(response.body(), YlDto.class); + log.info("分钟级别时间:{},小时级别时间:{}", list.get(0).getTM(), TM); + if (CollectionUtil.isNotEmpty(list) && list.get(0).getTM().compareTo(TM) == 0) { + return list.get(0).getDRP(); + } + return null; + } } diff --git a/pom.xml b/pom.xml index b3ce79c..401d503 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.springnewfiber.dataadapter newfiber-data-adapter - 1.0-SNAPSHOT + 1.0 1.8 diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java index 1c803e8..9bc93a2 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java @@ -36,6 +36,7 @@ @PostConstruct public void loginAction() { + HttpRequest.setGlobalTimeout(300000); if (!bladeRedis.exists(ziguangToken)) { HttpRequest request = HttpUtil.createPost(ziGuangConfig.getLogin().getLoginurl()); request.body(JSONObject.toJSONString(ImmutableMap.of(username, ziGuangConfig.getLogin().getUsername(), password, ziGuangConfig.getLogin().getPassword()))); diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java index 77d78cd..08e36f2 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java @@ -12,4 +12,9 @@ public class YlConfig { private String listUrl; private String realUrl; + private String oneHourUrl; + private String threeHourUrl; + private String sixHourUrl; + private String dayUrl; + private String countUrl; } diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/core/ZiGuangDataJob.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/core/ZiGuangDataJob.java index 69b9514..f3ff4a3 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/core/ZiGuangDataJob.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/core/ZiGuangDataJob.java @@ -27,12 +27,12 @@ private final HpAction hpAction; private final YlAction ylAction; private final ZsAction zsAction; - @Scheduled(cron = "0 0/2 * * * ?") + @Scheduled(cron = "0 0/1 * * * ?") public void synchronize() { -// bzAction.list(); -// gqAction.list(); -// hdAction.list(); -// hpAction.list(); + bzAction.list(); + gqAction.list(); + hdAction.list(); + hpAction.list(); ylAction.list(); zsAction.list(); } diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/action/YlAction.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/action/YlAction.java index b1afc33..4722f1e 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/action/YlAction.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/action/YlAction.java @@ -16,6 +16,7 @@ import org.springnewfiber.dataadapter.ziguang.common.ZiGuangConfig; import org.springnewfiber.dataadapter.ziguang.yl.dto.YlDto; +import java.util.Date; import java.util.List; import java.util.Map; @@ -81,6 +82,7 @@ YlDto dto = new YlDto(); if ((flag && (dto = bladeRedis.get("yl:" + stcd)) != null && dto.getTM().before(i.getTM())) || !flag) { log.info("雨量redis的数据:{},请求到的最新数据:{}", JSONObject.toJSONString(dto), JSONObject.toJSONString(i.getTM())); + getData(stcd, i.getTM(), i); rabbitTemplate.convertAndSend(JSONObject.toJSONString(YlDto.convert(i))); bladeRedis.set("yl:" + stcd, i); log.info("发送雨量的数据:{},数据:{}", stcd, JSONObject.toJSONString(YlDto.convert(i))); @@ -89,4 +91,36 @@ }); } } + + private void getData(String stcd, Date TM, YlDto dto) { + Float one = gethourData(stcd, TM, ziGuangConfig.getYl().getOneHourUrl()); + Float Three = gethourData(stcd, TM, ziGuangConfig.getYl().getThreeHourUrl()); + Float Six = gethourData(stcd, TM, ziGuangConfig.getYl().getSixHourUrl()); + Float Day = gethourData(stcd, TM, ziGuangConfig.getYl().getDayUrl()); + dto.setP1(one); + dto.setP3(Three); + dto.setP6(Six); + dto.setPd(Day); + //todo 历史每个月查询 + } + + private Float gethourData(String stcd, Date TM, String url) { + Map childPramMap = Maps.newHashMap(); + childPramMap.put("stcd", stcd); + childPramMap.put("addvcd", "420113"); + childPramMap.put("drp", "1"); + childPramMap.put("daydrp", ""); + childPramMap.put("type", ""); + Map listByPramMap = ImmutableMap.of("searchFilters", childPramMap); + HttpRequest request = loginAction.getPostAuthRequest(url); + request.body(JSONObject.toJSONString(listByPramMap)); + HttpResponse response = request.execute(); + log.info("单个雨量小时数据:stcd:{},数据:{}", stcd, response.body()); + List list = JSONObject.parseArray(response.body(), YlDto.class); + log.info("分钟级别时间:{},小时级别时间:{}", list.get(0).getTM(), TM); + if (CollectionUtil.isNotEmpty(list) && list.get(0).getTM().compareTo(TM) == 0) { + return list.get(0).getDRP(); + } + return null; + } } diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/dto/YlDto.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/dto/YlDto.java index d8d4575..44e9dde 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/dto/YlDto.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/dto/YlDto.java @@ -33,7 +33,18 @@ private Float LGTD; // 纬度 private Float LTTD; + //序列 + private String RR; + private String BZ; + private Float p1; + private Float p3; + private Float p6; + private Float pd; + public static String one="p1"; + public static String Three="p3"; + public static String six="p6"; + public static String day="pd"; public static PtReceiveBaseModel convert(YlDto dto){ PtReceiveBaseModel model=new PtReceiveBaseModel(); model.setSt(dto.getSTCD()); @@ -45,8 +56,37 @@ data.setKey("drp"); data.setValue(dto.getDRP()); data.setSn("drp"); + if(dto.getP1()!=null){ + MqNodeData p1= new MqNodeData(); + p1.setKey(YlDto.one); + p1.setValue(dto.getP1()); + p1.setSn(YlDto.one); + dataMap.put(YlDto.one,p1); + } + if(dto.getP3()!=null){ + MqNodeData p1= new MqNodeData(); + p1.setKey(YlDto.Three); + p1.setValue(dto.getP3()); + p1.setSn(YlDto.Three); + dataMap.put(YlDto.Three,p1); + } + if(dto.getP6()!=null){ + MqNodeData p1= new MqNodeData(); + p1.setKey(YlDto.six); + p1.setValue(dto.getP6()); + p1.setSn(YlDto.six); + dataMap.put(YlDto.six,p1); + } + if(dto.getPd()!=null){ + MqNodeData p1= new MqNodeData(); + p1.setKey(YlDto.day); + p1.setValue(dto.getPd()); + p1.setSn(YlDto.day); + dataMap.put(YlDto.day,p1); + } dataMap.put("drp",data); model.setDataMap(dataMap); return model; } + } diff --git a/pom.xml b/pom.xml index b3ce79c..401d503 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ org.springnewfiber.dataadapter newfiber-data-adapter - 1.0-SNAPSHOT + 1.0 1.8 diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java index 1c803e8..9bc93a2 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/LoginAction.java @@ -36,6 +36,7 @@ @PostConstruct public void loginAction() { + HttpRequest.setGlobalTimeout(300000); if (!bladeRedis.exists(ziguangToken)) { HttpRequest request = HttpUtil.createPost(ziGuangConfig.getLogin().getLoginurl()); request.body(JSONObject.toJSONString(ImmutableMap.of(username, ziGuangConfig.getLogin().getUsername(), password, ziGuangConfig.getLogin().getPassword()))); diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java index 77d78cd..08e36f2 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/common/YlConfig.java @@ -12,4 +12,9 @@ public class YlConfig { private String listUrl; private String realUrl; + private String oneHourUrl; + private String threeHourUrl; + private String sixHourUrl; + private String dayUrl; + private String countUrl; } diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/core/ZiGuangDataJob.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/core/ZiGuangDataJob.java index 69b9514..f3ff4a3 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/core/ZiGuangDataJob.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/core/ZiGuangDataJob.java @@ -27,12 +27,12 @@ private final HpAction hpAction; private final YlAction ylAction; private final ZsAction zsAction; - @Scheduled(cron = "0 0/2 * * * ?") + @Scheduled(cron = "0 0/1 * * * ?") public void synchronize() { -// bzAction.list(); -// gqAction.list(); -// hdAction.list(); -// hpAction.list(); + bzAction.list(); + gqAction.list(); + hdAction.list(); + hpAction.list(); ylAction.list(); zsAction.list(); } diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/action/YlAction.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/action/YlAction.java index b1afc33..4722f1e 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/action/YlAction.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/action/YlAction.java @@ -16,6 +16,7 @@ import org.springnewfiber.dataadapter.ziguang.common.ZiGuangConfig; import org.springnewfiber.dataadapter.ziguang.yl.dto.YlDto; +import java.util.Date; import java.util.List; import java.util.Map; @@ -81,6 +82,7 @@ YlDto dto = new YlDto(); if ((flag && (dto = bladeRedis.get("yl:" + stcd)) != null && dto.getTM().before(i.getTM())) || !flag) { log.info("雨量redis的数据:{},请求到的最新数据:{}", JSONObject.toJSONString(dto), JSONObject.toJSONString(i.getTM())); + getData(stcd, i.getTM(), i); rabbitTemplate.convertAndSend(JSONObject.toJSONString(YlDto.convert(i))); bladeRedis.set("yl:" + stcd, i); log.info("发送雨量的数据:{},数据:{}", stcd, JSONObject.toJSONString(YlDto.convert(i))); @@ -89,4 +91,36 @@ }); } } + + private void getData(String stcd, Date TM, YlDto dto) { + Float one = gethourData(stcd, TM, ziGuangConfig.getYl().getOneHourUrl()); + Float Three = gethourData(stcd, TM, ziGuangConfig.getYl().getThreeHourUrl()); + Float Six = gethourData(stcd, TM, ziGuangConfig.getYl().getSixHourUrl()); + Float Day = gethourData(stcd, TM, ziGuangConfig.getYl().getDayUrl()); + dto.setP1(one); + dto.setP3(Three); + dto.setP6(Six); + dto.setPd(Day); + //todo 历史每个月查询 + } + + private Float gethourData(String stcd, Date TM, String url) { + Map childPramMap = Maps.newHashMap(); + childPramMap.put("stcd", stcd); + childPramMap.put("addvcd", "420113"); + childPramMap.put("drp", "1"); + childPramMap.put("daydrp", ""); + childPramMap.put("type", ""); + Map listByPramMap = ImmutableMap.of("searchFilters", childPramMap); + HttpRequest request = loginAction.getPostAuthRequest(url); + request.body(JSONObject.toJSONString(listByPramMap)); + HttpResponse response = request.execute(); + log.info("单个雨量小时数据:stcd:{},数据:{}", stcd, response.body()); + List list = JSONObject.parseArray(response.body(), YlDto.class); + log.info("分钟级别时间:{},小时级别时间:{}", list.get(0).getTM(), TM); + if (CollectionUtil.isNotEmpty(list) && list.get(0).getTM().compareTo(TM) == 0) { + return list.get(0).getDRP(); + } + return null; + } } diff --git a/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/dto/YlDto.java b/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/dto/YlDto.java index d8d4575..44e9dde 100644 --- a/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/dto/YlDto.java +++ b/src/main/java/org/springnewfiber/dataadapter/ziguang/yl/dto/YlDto.java @@ -33,7 +33,18 @@ private Float LGTD; // 纬度 private Float LTTD; + //序列 + private String RR; + private String BZ; + private Float p1; + private Float p3; + private Float p6; + private Float pd; + public static String one="p1"; + public static String Three="p3"; + public static String six="p6"; + public static String day="pd"; public static PtReceiveBaseModel convert(YlDto dto){ PtReceiveBaseModel model=new PtReceiveBaseModel(); model.setSt(dto.getSTCD()); @@ -45,8 +56,37 @@ data.setKey("drp"); data.setValue(dto.getDRP()); data.setSn("drp"); + if(dto.getP1()!=null){ + MqNodeData p1= new MqNodeData(); + p1.setKey(YlDto.one); + p1.setValue(dto.getP1()); + p1.setSn(YlDto.one); + dataMap.put(YlDto.one,p1); + } + if(dto.getP3()!=null){ + MqNodeData p1= new MqNodeData(); + p1.setKey(YlDto.Three); + p1.setValue(dto.getP3()); + p1.setSn(YlDto.Three); + dataMap.put(YlDto.Three,p1); + } + if(dto.getP6()!=null){ + MqNodeData p1= new MqNodeData(); + p1.setKey(YlDto.six); + p1.setValue(dto.getP6()); + p1.setSn(YlDto.six); + dataMap.put(YlDto.six,p1); + } + if(dto.getPd()!=null){ + MqNodeData p1= new MqNodeData(); + p1.setKey(YlDto.day); + p1.setValue(dto.getPd()); + p1.setSn(YlDto.day); + dataMap.put(YlDto.day,p1); + } dataMap.put("drp",data); model.setDataMap(dataMap); return model; } + } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 8d6f43e..7b0b579 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -52,9 +52,11 @@ listurl: http://58.49.51.33:8081/iwp/dynamic/yl/yl_live/list realurl: http://58.49.51.33:8081/iwp/dynamic/yl/yl_daylistmi/list #暂时未使用 - 3hoururl: http://58.49.51.33:8081/iwp/dynamic/yl/yl_3hour/list - 6hoururl: http://58.49.51.33:8081/iwp/dynamic/yl/yl_6hour/list - 24hoururl: http://58.49.51.33:8081/iwp/dynamic/yl/yl_24hour/list + oneHourUrl: http://58.49.51.33:8081/iwp/dynamic/yl/yl_daylisthour/list + threeHourUrl: http://58.49.51.33:8081/iwp/dynamic/yl/yl_3hour/list + sixHourUrl: http://58.49.51.33:8081/iwp/dynamic/yl/yl_6hour/list + dayUrl: http://58.49.51.33:8081/iwp/dynamic/yl/yl_24hour/list + countUrl: http://58.49.51.33:8081/iwp/dynamic/yl/yl_his/list #泵站工情 bz: listurl: http://58.49.51.33:8081/iwp/dynamic/bz/map_pumplive/list