ソースを参照

Merge remote-tracking branch 'origin/master'

wangchangsheng 3 年 前
コミット
abcc1a5312

+ 27 - 3
src/main/java/com/gyee/frame/common/feign/IAdapterService.java

@@ -1,13 +1,11 @@
 package com.gyee.frame.common.feign;
 
 import com.alibaba.fastjson.JSONObject;
+import com.gyee.frame.common.domain.AjaxResult;
 import com.gyee.frame.model.custom.export.TsPointData;
-import com.gyee.frame.util.golden.timeseries.TsData;
 import feign.Headers;
 import feign.Param;
 import feign.RequestLine;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
 
@@ -34,4 +32,30 @@ public interface IAdapterService {
     @RequestLine("GET /ts/history/section?tagNames={tagNames}&ts={ts}")
     List<TsPointData> getHistorySection(@Param(value = "tagNames") String tagNames, @Param(value = "ts") long ts);
 
+    @Headers({"Content-Type: application/json", "Accept: application/json"})
+    @RequestLine("GET /alarm/count/query/new2?stationid={stationid}&startdate={startdate}&enddate={enddate}")
+     AjaxResult getEarlyWarning(@Param(value = "stationid") String stationid, @Param(value = "startdate") String startdate,
+                                        @Param(value = "enddate") String enddate);
+
+    @Headers({"Content-Type: application/json", "Accept: application/json"})
+    @RequestLine("GET /shutdown/list?stId={stId}&endDate={endDate}&startDate={startDate}")
+    AjaxResult getHith(@Param(value = "stId") String stId, @Param(value = "endDate") String endDate,
+                                    @Param(value = "startDate") String startDate);
+
+    @Headers({"Content-Type: application/json", "Accept: application/json"})
+    @RequestLine("GET /alarm/history/page2?pagenum={pagenum}&pagesize={pagesize}&stationid={stationid}&windturbineid={windturbineid}" +
+            "&category1={category1}&category2={category2}&rank={rank}&modelid={modelid}&snapid={snapid}&messagetype={messagetype}" +
+            "&keyword={keyword}&starttime={starttime}&endtime={endtime}")
+    AjaxResult getPage(@Param(value = "pagenum") Integer pagenum, @Param(value = "pagesize") Integer pagesize,
+                                    @Param(value = "stationid") String stationid,
+                                    @Param(value = "windturbineid") String windturbineid,
+                                    @Param(value = "category1") String category1,
+                                    @Param(value = "category2") String category2,
+                                    @Param(value = "rank") String rank,
+                                    @Param(value = "modelid") String modelid,
+                                    @Param(value = "snapid") Long snapid,
+                                    @Param(value = "messagetype") Integer messagetype,
+                                    @Param(value = "keyword") String keyword,
+                                    @Param(value = "starttime") String starttime,
+                                    @Param(value = "endtime") String endtime);
 }

+ 11 - 0
src/main/java/com/gyee/frame/common/feign/RemoteServiceBuilder.java

@@ -27,4 +27,15 @@ public class RemoteServiceBuilder {
                 .retryer(new Retryer.Default(10000, 10000, 3))
                 .target(IAdapterService.class, shardingUrlString);
     }
+
+    @Bean
+    public IAdapterService earlyService() {
+        return Feign.builder()
+                .encoder(new JacksonEncoder())
+                .decoder(new JacksonDecoder())
+                .options(new Request.Options(5000, 600000))
+                .retryer(new Retryer.Default(10000, 10000, 3))
+                .target(IAdapterService.class, "http://192.168.1.18:8075");
+    }
+
 }

+ 44 - 0
src/main/java/com/gyee/frame/controller/photovoltaic/PhotovoltaicController.java

@@ -0,0 +1,44 @@
+package com.gyee.frame.controller.photovoltaic;
+
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.service.photovoltaic.PhotovoltaicService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+@Controller
+@RequestMapping("//photovoltaic")
+public class PhotovoltaicController {
+    @Resource
+    private PhotovoltaicService photovoltaicService;
+
+    @GetMapping("/query")
+    @ResponseBody
+    @ApiOperation(value = "", notes = "")
+    public AjaxResult query(@RequestParam(value = "pagenum")Integer pageNum,
+                            @RequestParam(value = "pagesize")Integer pageSize,
+                            @RequestParam(value = "stationid", required = false) String stId,
+                            @RequestParam(value = "windturbineid",required = false) String wtId,
+                            @RequestParam(value = "category1",required = false) String category1,
+                            @RequestParam(value = "category2",required = false) String category2,
+                            @RequestParam(value = "rank",required = false) String rank,
+                            @RequestParam(value = "modelid",required = false) String modelId,
+                            @RequestParam(value = "snapid",required = false) Long snapId,
+                            @RequestParam(value = "messagetype",required = false) Integer messageType,
+                            @RequestParam(value = "keyword",required = false) String keyWord,
+                            @RequestParam(value = "starttime", required = false) String starttime,
+                            @RequestParam(value = "endtime", required = false) String endtime)
+
+    {
+        List<Map> ph = photovoltaicService.qy(pageNum,pageSize,stId,wtId,category1,category2,rank,modelId,snapId,messageType,keyWord,starttime,endtime);
+
+        return AjaxResult.successData(200, ph);
+    }
+}

+ 9 - 13
src/main/java/com/gyee/frame/controller/radar/RadarController.java

@@ -6,25 +6,25 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
+
 import javax.annotation.Resource;
 import java.util.List;
 import java.util.Map;
 
 @Controller
 @RequestMapping("//radar")
-@Api(value = "故障与预警分类统计",tags =  "故障与预警分类统计")
+@Api(value = "故障与预警分类统计", tags = "故障与预警分类统计")
 public class RadarController {
     @Resource
     private RedarService RedarService;
 
+
     @GetMapping("/gzfx")
     @ResponseBody
     @ApiOperation(value = "故障分析雷达图", notes = "故障分析雷达图")
-    public AjaxResult gzfx(@RequestParam(value = "stId",required = true)String stId,
-                            @RequestParam(value = "Date",required = true)String Date)
-
-    {
-        List<Map> hitch = RedarService.hitch(stId, Date);
+    public AjaxResult gzfx(@RequestParam(value = "stId", required = true) String stId,
+                           @RequestParam(value = "Date", required = true) String Date) {
+        List<List<Map>> hitch = RedarService.hitch(stId,Date);
 
         return AjaxResult.successData(200, hitch);
     }
@@ -32,15 +32,11 @@ public class RadarController {
     @GetMapping("/yjfx")
     @ResponseBody
     @ApiOperation(value = "预警分析雷达图", notes = "预警分析雷达图")
-    public AjaxResult yjfx(@RequestParam(value = "stationid",required = true)String stationid,
-                            @RequestParam(value = "date",required = true)String date)
-
-    {
-        List<Map> warning = RedarService.warning(stationid, date);
+    public AjaxResult yjfx(@RequestParam(value = "stationid", required = true) String stationid,
+                           @RequestParam(value = "date", required = true) String date){
+        List<List<Map>> warning = RedarService.warning(stationid,date);
 
         return AjaxResult.successData(200, warning);
     }
 
-
-
 }

+ 92 - 0
src/main/java/com/gyee/frame/service/photovoltaic/PhotovoltaicService.java

@@ -0,0 +1,92 @@
+package com.gyee.frame.service.photovoltaic;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.common.feign.RemoteServiceBuilder;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.DecimalFormat;
+import java.util.*;
+
+@Service
+public class PhotovoltaicService {
+    @Resource
+    private RemoteServiceBuilder remoteService;
+
+    public List<Map> qy(Integer pageNum,Integer pageSize,String stId,String wtId, String category1,String category2,String rank,
+                        String modelId,Long snapId,Integer messageType,String keyWord,String starttime,String endtime) {
+
+        AjaxResult alarm = remoteService.earlyService().getPage(pageNum,pageSize,stId,wtId,category1,category2,rank,
+                modelId,snapId,messageType,keyWord,starttime,endtime);
+        String jsonStr = JSON.toJSONString(alarm);
+        List<Map>cate = page(jsonStr);
+        return cate;
+    }
+
+    public List<Map> page(String jsonData1) {
+        JSONObject cate = JSON.parseObject(jsonData1);
+        JSONObject data = cate.getJSONObject("data");
+
+        JSONArray recordList = data.getJSONArray("records");
+
+        int a = 0;
+        int b = 0;
+        int c = 0;
+        int d = 0;
+        int e = 0;
+
+        for (int i = 0; i < recordList.size(); i++) {
+            JSONObject record = recordList.getJSONObject(i);
+
+            String ranks = record.getString("rank");
+
+            if (StringUtils.isBlank(ranks)) {
+                continue;
+            }
+            switch (ranks) {
+                case "1":
+                    a = a + 1;
+                    break;
+                case "2":
+                    b = b + 1;
+                    break;
+                case "3":
+                    c = c + 1;
+                    break;
+                case "4":
+                    d = d + 1;
+                    break;
+                case "5":
+                    e = e + 1;
+                    break;
+                default:
+            }
+        }
+        double size = a + b + c + d + e;
+
+        List<Map> conver = new ArrayList<>();
+        DecimalFormat df = new DecimalFormat("0.00%");
+        Map<String, String> maps = new LinkedHashMap<>();
+        maps.put("rank1", df.format(a/size));
+        maps.put("rank2", df.format(b/size));
+        maps.put("rank3", df.format(c/size));
+        maps.put("rank4", df.format(d/size));
+        maps.put("rank5", df.format(e/size));
+
+        Map<String, Double> map = new LinkedHashMap<>();
+        map.put("rank1", (double) a);
+        map.put("rank2", (double) b);
+        map.put("rank3", (double) c);
+        map.put("rank4", (double) d);
+        map.put("rank5", (double) e);
+        map.put("size",size);
+        conver.add(maps);
+        conver.add(map);
+        return conver;
+    }
+}
+

+ 89 - 226
src/main/java/com/gyee/frame/service/redar/RedarService.java

@@ -5,14 +5,14 @@ import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.common.feign.RemoteServiceBuilder;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
-import java.io.*;
-import java.net.HttpURLConnection;
-import java.net.URL;
+import javax.annotation.Resource;
 import java.text.DecimalFormat;
 import java.util.*;
 
@@ -20,101 +20,53 @@ import java.util.*;
 public class RedarService {
     private static final Logger log = LoggerFactory.getLogger(RedarService.class);
 
-    public List<Map> hitch(String stId, String Date) {
-        String url = "http://192.168.1.18:8075/shutdown/list?stId=MHS_FDC&endDate=2021-11-21&startDate=2021-11-22";
+    @Resource
+    private RemoteServiceBuilder remoteService;
 
-        String str = doGet(url);
-        List<Map> object = parseJSON(str);
+    public List<List<Map>> hitch(String stId, String Date) {
 
+        Map<String, String> TimeMap = new LinkedHashMap<>();
 
-        String[] splitdata = Date.split("-");
-
-        Map<String, String> TimeMap = new HashMap<>();
-        //月份
-        TimeMap.put("monthstarttime", DateUtil.format(DateUtil.beginOfMonth(DateUtil.parseDate(Date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
-        TimeMap.put("monthendtime", DateUtil.format(DateUtil.endOfMonth(DateUtil.parseDate(Date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
         //年份
         TimeMap.put("yearstarttime", DateUtil.format(DateUtil.beginOfYear(DateUtil.parseDate(Date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
         TimeMap.put("yearendtime", DateUtil.format(DateUtil.endOfYear(DateUtil.parseDate(Date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
+        //月份
+        TimeMap.put("monthstarttime", DateUtil.format(DateUtil.beginOfMonth(DateUtil.parseDate(Date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
+        TimeMap.put("monthendtime", DateUtil.format(DateUtil.endOfMonth(DateUtil.parseDate(Date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
         //一天
-        TimeMap.put("daystarttime", DateUtil.format(DateUtil.beginOfDay(DateUtil.parseDate(Date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
+        TimeMap.put("daystarttime", DateUtil.format(DateUtil.beginOfDay(DateUtil.offsetDay(DateUtil.parseDate(Date),-1)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
         TimeMap.put("dayendtime", DateUtil.format(DateUtil.endOfDay(DateUtil.parseDate(Date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
 
-        url = url.replaceAll("startDate=[0-9\\-]*", "startDate=" + TimeMap.get("yearstarttime"))
-                .replaceAll("endDate=[0-9\\-]*", "endDate=" + TimeMap.get("yearendtime"))
-                + "&startmonth=" + TimeMap.get("monthstarttime") + "&endmonth=" + TimeMap.get("monthendtime")
-                + "&beginday=" + TimeMap.get("daystarttime") + "&endday=" + TimeMap.get("dayendtime");
+        AjaxResult year = remoteService.earlyService().getHith(stId,TimeMap.get("yearstarttime"),TimeMap.get("yearendtime"));
 
-        return object;
-    }
+        AjaxResult month = remoteService.earlyService().getHith(stId,TimeMap.get("monthstarttime"),TimeMap.get("monthendtime"));
 
-    /**
-     * Http get请求
-     *
-     * @param httpUrl 连接
-     * @return 响应数据
-     */
-    public String doGet(String httpUrl) {
-        //链接
-        HttpURLConnection connection = null;
-        InputStream is = null;
-        BufferedReader br = null;
-        StringBuffer result = new StringBuffer();
-        try {
-            //创建连接
-            URL url = new URL(httpUrl);
-            connection = (HttpURLConnection) url.openConnection();
-            //设置请求方式
-            connection.setRequestMethod("GET");
-            //设置连接超时时间
-            connection.setReadTimeout(15000);
-            //开始连接
-            connection.connect();
-            //获取响应数据
-            if (connection.getResponseCode() == 200) {
-                //获取返回的数据
-                is = connection.getInputStream();
-                if (null != is) {
-                    br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
-                    String temp = null;
-                    while (null != (temp = br.readLine())) {
-                        result.append(temp);
-                    }
-                }
-            }
-        } catch (IOException e) {
-            e.printStackTrace();
-        } finally {
-            if (null != br) {
-                try {
-                    br.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-            if (null != is) {
-                try {
-                    is.close();
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
-            }
-            //关闭远程连接
-            connection.disconnect();
-        }
-        return result.toString();
+        AjaxResult day = remoteService.earlyService().getHith(stId,TimeMap.get("daystarttime"),TimeMap.get("dayendtime"));
+
+
+        String jsonStr = JSON.toJSONString(year);
+        List<Map> year1 = parseJSON(jsonStr);
+
+        String jsonStr1 = JSON.toJSONString(month);
+        List<Map> month1 = parseJSON(jsonStr1);
+
+        String jsonStr2 = JSON.toJSONString(day);
+        List<Map> day1 = parseJSON(jsonStr2);
+
+        List<List<Map>> ui = new ArrayList<>();
+        ui.add(year1);
+        ui.add(month1);
+        ui.add(day1);
+        return ui;
     }
 
+
     public List<Map> parseJSON(String jsonData) {
         try {
             JSONObject object = JSON.parseObject(jsonData);
             JSONArray data1 = object.getJSONArray("data");
 
             double count = 0;
-            int stationId = 0;
-            int windturbineId = 0;
-            int type = 0;
-            int typeID = 0;
             int time = 0;
 
             int bj = 0;
@@ -174,80 +126,28 @@ public class RedarService {
                     }
                 }
             }
-            JSONObject jsonObject1 = new JSONObject();
-            jsonObject1.put("bj", bj);
-            jsonObject1.put("fjqt", fjqt);
-            jsonObject1.put("fdj", fdj);
-            jsonObject1.put("clx", clx);
-            jsonObject1.put("bpq", bpq);
-            jsonObject1.put("zz", zz);
-            jsonObject1.put("hh", hh);
-            jsonObject1.put("ph", ph);
-            jsonObject1.put("yy", yy);
-            jsonObject1.put("lq", lq);
-            jsonObject1.put("rh", rh);
-            jsonObject1.put("kz", kz);
-            jsonObject1.put("jcjr", jcjr);
-            jsonObject1.put("count", count);
-            jsonObject1.put("time", time);
 
             List<Map> conver = new ArrayList<>();
 
             DecimalFormat df = new DecimalFormat("0.00");
 
-            Map<String, String> year = new HashMap<>();
-            year.put("变桨", df.format(bj / count));
-            year.put("风机其它", df.format(fjqt / count));
-            year.put("齿轮箱", df.format(clx / count));
-            year.put("变频器", df.format(bpq / count));
-            year.put("主轴", df.format(zz / count));
-            year.put("滑环", df.format(hh / count));
-            year.put("偏航", df.format(ph / count));
-            year.put("液压", df.format(yy / count));
-            year.put("冷却", df.format(lq / count));
-            year.put("润滑", df.format(rh / count));
-            year.put("控制", df.format(kz / count));
-            year.put("机舱加热", df.format(jcjr / count));
-
-            JSONObject year1 = new JSONObject();
-            year1.put("year", year);
-            conver.add(year1);
-
-            Map<String, String> month = new HashMap<>();
-            month.put("变桨", df.format(bj / count));
-            month.put("风机其它", df.format(fjqt / count));
-            month.put("齿轮箱", df.format(clx / count));
-            month.put("变频器", df.format(bpq / count));
-            month.put("主轴", df.format(zz / count));
-            month.put("滑环", df.format(hh / count));
-            month.put("偏航", df.format(ph / count));
-            month.put("液压", df.format(yy / count));
-            month.put("冷却", df.format(lq / count));
-            month.put("润滑", df.format(rh / count));
-            month.put("控制", df.format(kz / count));
-            month.put("机舱加热", df.format(jcjr / count));
-            JSONObject month1 = new JSONObject();
-            month1.put("month", month);
-            conver.add(month1);
-
-            Map<String, String> day = new HashMap<>();
-            day.put("变桨", df.format(bj / count));
-            day.put("风机其它", df.format(fjqt / count));
-            day.put("齿轮箱", df.format(clx / count));
-            day.put("变频器", df.format(bpq / count));
-            day.put("主轴", df.format(zz / count));
-            day.put("滑环", df.format(hh / count));
-            day.put("偏航", df.format(ph / count));
-            day.put("液压", df.format(yy / count));
-            day.put("冷却", df.format(lq / count));
-            day.put("润滑", df.format(rh / count));
-            day.put("控制", df.format(kz / count));
-            day.put("机舱加热", df.format(jcjr / count));
-            JSONObject day1 = new JSONObject();
-            day1.put("day", day);
-            conver.add(day1);
-
-            return conver;
+            Map<String, String> year = new LinkedHashMap<>();
+            year.put("bj", count!=0 ?df.format(bj / count):0.0+"");
+            year.put("fjqt", count!=0 ?df.format(fjqt / count):0.0+"");
+            year.put("fdj", count!=0 ?df.format(fdj / count):0.0+"");
+            year.put("clx", count!=0 ?df.format(clx / count):0.0+"");
+            year.put("bpq", count!=0 ?df.format(bpq / count):0.0+"");
+            year.put("zz", count!=0 ?df.format(zz / count):0.0+"");
+            year.put("hh", count!=0 ?df.format(hh / count):0.0+"");
+            year.put("ph", count!=0 ?df.format(ph / count):0.0+"");
+            year.put("yy", count!=0 ?df.format(yy / count):0.0+"");
+            year.put("lq", count!=0 ?df.format(lq / count):0.0+"");
+            year.put("rh", count!=0 ?df.format(rh / count):0.0+"");
+            year.put("kz", count!=0 ?df.format(kz / count):0.0+"");
+            year.put("jcjr", count!=0 ?df.format(jcjr / count):0.0+"");
+
+            conver.add(year);
+            return  conver;
 
         } catch (Exception e) {
             System.out.println(e.getMessage());
@@ -257,30 +157,39 @@ public class RedarService {
     }
 
 
-    public List<Map> warning(String stationid, String date) {
-        String url1 = "http://192.168.1.18:8075/alarm/count/query/new?stationid=MHS_FDC&startdate=2021-11-23&enddate=2021-11-24";
-        String st = doGet(url1);
-        List<Map> object = pron(st);
-
-        String[] splitdata = date.split("-");
+    public List<List<Map>> warning(String stationid, String date) {
 
-        Map<String, String> timeMap = new HashMap<>();
-        //月份
-        timeMap.put("monthstarttime", DateUtil.format(DateUtil.beginOfMonth(DateUtil.parseDate(date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
-        timeMap.put("monthendtime", DateUtil.format(DateUtil.endOfMonth(DateUtil.parseDate(date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
+        Map<String, String> TimeMap = new LinkedHashMap<>();
         //年份
-        timeMap.put("yearstarttime", DateUtil.format(DateUtil.beginOfYear(DateUtil.parseDate(date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
-        timeMap.put("yearendtime", DateUtil.format(DateUtil.endOfYear(DateUtil.parseDate(date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
+        TimeMap.put("yearstarttime", DateUtil.format(DateUtil.beginOfYear(DateUtil.parseDate(date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
+        TimeMap.put("yearendtime", DateUtil.format(DateUtil.endOfYear(DateUtil.parseDate(date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
+        //月份
+        TimeMap.put("monthstarttime", DateUtil.format(DateUtil.beginOfMonth(DateUtil.parseDate(date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
+        TimeMap.put("monthendtime", DateUtil.format(DateUtil.endOfMonth(DateUtil.parseDate(date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
         //一天
-        timeMap.put("daystarttime", DateUtil.format(DateUtil.beginOfDay(DateUtil.parseDate(date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
-        timeMap.put("dayendtime", DateUtil.format(DateUtil.endOfDay(DateUtil.parseDate(date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
+        TimeMap.put("daystarttime", DateUtil.format(DateUtil.beginOfDay(DateUtil.offsetDay(DateUtil.parseDate(date),-1)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
+        TimeMap.put("dayendtime", DateUtil.format(DateUtil.endOfDay(DateUtil.parseDate(date)), DatePattern.NORM_DATETIME_MINUTE_PATTERN));
+
+        AjaxResult year = remoteService.earlyService().getEarlyWarning(stationid,TimeMap.get("yearstarttime"),TimeMap.get("yearendtime"));
+
+        AjaxResult month = remoteService.earlyService().getEarlyWarning(stationid,TimeMap.get("monthstarttime"),TimeMap.get("monthendtime"));
+
+        AjaxResult day = remoteService.earlyService().getEarlyWarning(stationid,TimeMap.get("daystarttime"),TimeMap.get("dayendtime"));
+
+        List<List<Map>> fh = new ArrayList<>();
+        String jsonStr1 = JSON.toJSONString(year);
+        List<Map> year1 = pron(jsonStr1);
+
+        String jsonStr2 = JSON.toJSONString(month);
+        List<Map> month1 = pron(jsonStr2);
 
-        url1 = url1.replaceAll("startdate=[0-9\\-]*", "startdate=" + timeMap.get("yearstarttime"))
-                .replaceAll("enddate=[0-9\\-]*", "enddate=" + timeMap.get("yearendtime"))
-                + "&startmonth=" + timeMap.get("monthstarttime") + "&endmonth=" + timeMap.get("monthendtime")
-                + "&beginday=" + timeMap.get("daystarttime") + "&endday=" + timeMap.get("dayendtime");
+        String jsonStr3 = JSON.toJSONString(day);
+        List<Map> day1 = pron(jsonStr3);
 
-        return object;
+        fh.add(year1);
+        fh.add(month1);
+        fh.add(day1);
+        return fh;
     }
 
     public List<Map> pron(String jsonData1) {
@@ -339,70 +248,24 @@ public class RedarService {
                 }
             }
         }
-        JSONObject jsonObject2 = new JSONObject();
-        jsonObject2.put("CFXT", CFXT);
-        jsonObject2.put("CDL", CDL);
-        jsonObject2.put("FDJ", FDJ);
-        jsonObject2.put("BJXT", BJXT);
-        jsonObject2.put("CLX", CLX);
-        jsonObject2.put("YYXT", YYXT);
-        jsonObject2.put("PHXT", PHXT);
-        jsonObject2.put("JC", JC);
-        jsonObject2.put("QT", QT);
-        jsonObject2.put("TDG", TDG);
-        jsonObject2.put("count", count);
-        jsonObject2.put("time", time);
 
         List<Map> conver = new ArrayList<>();
 
         DecimalFormat df = new DecimalFormat("0.00");
 
-        Map<String, String> year = new HashMap<>();
-        year.put("测风系统", df.format(CFXT / count));
-        year.put("传动链", df.format(CDL / count));
-        year.put("发电机", df.format(FDJ / count));
-        year.put("变桨系统", df.format(BJXT / count));
-        year.put("齿轮箱", df.format(CLX / count));
-        year.put("液压系统", df.format(YYXT / count));
-        year.put("偏航系统", df.format(PHXT / count));
-        year.put("机舱", df.format(JC / count));
-        year.put("其它", df.format(QT / count));
-        year.put("塔底柜", df.format(TDG / count));
-
-        JSONObject year1 = new JSONObject();
-        year1.put("year", year);
-        conver.add(year1);
-
-        Map<String, String> month = new HashMap<>();
-        month.put("测风系统", df.format(CFXT / count));
-        month.put("传动链", df.format(CDL / count));
-        month.put("发电机", df.format(FDJ / count));
-        month.put("变桨系统", df.format(BJXT / count));
-        month.put("齿轮箱", df.format(CLX / count));
-        month.put("液压系统", df.format(YYXT / count));
-        month.put("偏航系统", df.format(PHXT / count));
-        month.put("机舱", df.format(JC / count));
-        month.put("其它", df.format(QT / count));
-        month.put("塔底柜", df.format(TDG / count));
-
-        JSONObject month1 = new JSONObject();
-        month1.put("month", month);
-        conver.add(month1);
-
-        Map<String, String> day = new HashMap<>();
-        day.put("测风系统", df.format(CFXT / count));
-        day.put("传动链", df.format(CDL / count));
-        day.put("发电机", df.format(FDJ / count));
-        day.put("变桨系统", df.format(BJXT / count));
-        day.put("齿轮箱", df.format(CLX / count));
-        day.put("液压系统", df.format(YYXT / count));
-        day.put("偏航系统", df.format(PHXT / count));
-        day.put("机舱", df.format(JC / count));
-        day.put("其它", df.format(QT / count));
-        day.put("塔底柜", df.format(TDG / count));
-        JSONObject day1 = new JSONObject();
-        day1.put("day", day);
-        conver.add(day1);
+        Map<String, String> year = new LinkedHashMap<>();
+        year.put("CFXT",count!=0 ? df.format(CFXT / count):0.0+"");
+        year.put("CDL",count!=0 ? df.format(CDL / count):0.0+"");
+        year.put("FDJ",count!=0 ? df.format(FDJ / count):0.0+"");
+        year.put("BJXT",count!=0 ? df.format(BJXT / count):0.0+"");
+        year.put("CLX",count!=0 ? df.format(CLX / count):0.0+"");
+        year.put("YYXT",count!=0 ? df.format(YYXT / count):0.0+"");
+        year.put("PHXT",count!=0 ? df.format(PHXT / count):0.0+"");
+        year.put("JC",count!=0 ? df.format(JC / count):0.0+"");
+        year.put("QT",count!=0 ? df.format(QT / count):0.0+"");
+        year.put("TDG",count!=0 ? df.format(TDG / count):0.0+"");
+
+        conver.add(year);
 
         return conver;
     }