فهرست منبع

转换坐标和增加调度中心售水量

yuejiaying 4 سال پیش
والد
کامیت
175e7f2e37

+ 50 - 2
operation_manager/src/main/java/com/huaxu/common/ConvertXY.java

@@ -107,8 +107,56 @@ public class ConvertXY {
 		mercator.Y = dblLat+moveY;
 		return mercator;
 	}
-	
-	
+
+
+	/**
+	 * 西安80坐标转经纬度
+	 *
+	 * @param x
+	 * @param y
+	 * @return
+	 */
+	public static MyPoint ConvertXian80ToXY(String x, String y,String moveXY) {
+		MyPoint pPoint = new MyPoint();
+		double dx = Double.parseDouble(x), dy = Double.parseDouble(y);
+		int moveX=0,moveY=0;
+		if(!StringUtils.isEmpty(moveXY)){
+			moveX=Integer.parseInt(moveXY.split(",")[0]);
+			moveY=Integer.parseInt(moveXY.split(",")[1]);
+		}
+		dx -= moveX;
+		dy -= moveY;
+		StringBuilder dblLon = new StringBuilder();
+		StringBuilder dblLat = new StringBuilder();
+		ICoordinate pCoordinate = CoordinateFactory.CreateCoordinate(Spheroid.WGS84);
+		pCoordinate.GaussPrjInvCalculate(dx, dy, dblLon, dblLat);
+		double X84 = Double.parseDouble(String.format("%.6f", Double.parseDouble(dblLon.toString())));
+		double Y84 = Double.parseDouble(String.format("%.6f", Double.parseDouble(dblLat.toString())));
+
+		X84 +=  2.001201;
+		Y84 +=  0.000155;
+		pPoint.X =X84;
+		pPoint.Y =Y84;
+		return pPoint;
+	}
+
+	// 墨卡托转经纬度
+	public static MyPoint MercatorToXY(String x, String y,String moveXY) {
+		MyPoint lngLat = new MyPoint();
+		double lng = Double.parseDouble(x);
+		double lat = Double.parseDouble(y);
+		int moveX=0,moveY=0;
+		if(!StringUtils.isEmpty(moveXY)){
+			moveX=Integer.parseInt(moveXY.split(",")[0]);
+			moveY=Integer.parseInt(moveXY.split(",")[1]);
+		}
+		lng -= moveX;
+		lat -= moveY;
+		lngLat.X = lng / 20037508.34 * 180;
+		double mmy = lat / 20037508.34 * 180;
+		lngLat.Y = 180 / Math.PI * (2 * Math.atan(Math.exp(mmy * Math.PI / 180)) - Math.PI / 2);
+		return lngLat;
+	}
 
 
 	public static void main(String[] args) {

+ 42 - 0
operation_manager/src/main/java/com/huaxu/track/controller/TaskTrackController.java

@@ -7,6 +7,7 @@ import com.huaxu.model.AjaxMessage;
 import com.huaxu.model.LoginUser;
 import com.huaxu.model.ResultStatus;
 import com.huaxu.track.dto.GpsDataHisDto;
+import com.huaxu.track.dto.XYDto;
 import com.huaxu.track.entity.GpsDataHis;
 import com.huaxu.track.entity.TaskTrack;
 import com.huaxu.track.service.GpsDataHisService;
@@ -119,4 +120,45 @@ public class TaskTrackController {
 
         return new AjaxMessage<>(ResultStatus.OK, result);
     }
+    /**
+     * 转换坐标
+     *
+     * @param
+     * @return Response对象
+     */
+    @RequestMapping(value = "convertXY", method = RequestMethod.POST)
+    @ApiOperation(value = "转换坐标")
+    public AjaxMessage<XYDto> convertXY(@ApiParam(value = "GPS数据", required = true) @RequestBody XYDto xyDto){
+        List<String> convertXY=new ArrayList<>();
+        //经纬度转其他坐标系
+        if(xyDto.getXY()!=null&&xyDto.getXY().size()>0){
+            for (String xy:xyDto.getXY()) {
+                if(!StringUtils.isEmpty(xyDto.getWkid()) && xyDto.getWkid().equals("2360")){
+                    MyPoint myPoint= ConvertXY.ConvertXYToXian80(xy.split(",")[0], xy.split(",")[1]
+                            ,xyDto.getMoveXY());
+                    convertXY.add(myPoint.getX()+","+myPoint.getY());
+                }else if(!StringUtils.isEmpty(xyDto.getWkid()) && xyDto.getWkid().equals("3857")){
+                    MyPoint myPoint= ConvertXY.ConvertXYToMercato(xy.split(",")[0], xy.split(",")[1]
+                            ,xyDto.getMoveXY());
+                    convertXY.add(myPoint.getX()+","+myPoint.getY());
+                }
+            }
+            xyDto.setConvertXY(convertXY);
+        }else{
+            //其他坐标系转经纬度
+            for (String xy:xyDto.getConvertXY()) {
+                if(!StringUtils.isEmpty(xyDto.getWkid()) && xyDto.getWkid().equals("2360")){
+                    MyPoint myPoint= ConvertXY.ConvertXian80ToXY(xy.split(",")[0], xy.split(",")[1]
+                            ,xyDto.getMoveXY());
+                    convertXY.add(myPoint.getX()+","+myPoint.getY());
+                }else if(!StringUtils.isEmpty(xyDto.getWkid()) && xyDto.getWkid().equals("3857")){
+                    MyPoint myPoint= ConvertXY.MercatorToXY(xy.split(",")[0], xy.split(",")[1]
+                            ,xyDto.getMoveXY());
+                    convertXY.add(myPoint.getX()+","+myPoint.getY());
+                }
+            }
+            xyDto.setXY(convertXY);
+        }
+        return new AjaxMessage<>(ResultStatus.OK, xyDto);
+    }
 }

+ 25 - 0
operation_manager/src/main/java/com/huaxu/track/dto/XYDto.java

@@ -0,0 +1,25 @@
+package com.huaxu.track.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@ApiModel(value = "坐标表")
+public class XYDto {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "XY")
+    private List<String> XY ;
+
+    @ApiModelProperty(value = "转换后XY")
+    private List<String> convertXY ;
+
+    @ApiModelProperty(value = "wkid")
+    private String wkid;
+
+    @ApiModelProperty(value = "偏移量(x,y)")
+    private String moveXY;
+}

+ 9 - 0
sms_water/src/main/java/com/huaxu/controller/OnlineMonitorController.java

@@ -11,6 +11,7 @@ import com.huaxu.model.Pagination;
 import com.huaxu.model.ResultStatus;
 import com.huaxu.service.DeviceAttributeSpecsService;
 import com.huaxu.service.OnlineMonitorService;
+import com.huaxu.service.RevenueService;
 import com.huaxu.service.SceneService;
 import com.huaxu.util.ByteArrayUtils;
 import com.huaxu.util.RedisUtil;
@@ -44,6 +45,8 @@ public class OnlineMonitorController {
     private OnlineMonitorService onlineMonitorService;
     @Autowired
     private SceneService sceneService;
+    @Autowired
+    private RevenueService revenueService;
 
     @RequestMapping(value="selectAlarmDetails" , method = RequestMethod.GET)
     @ApiOperation(value = "查询实时报警信息")
@@ -244,6 +247,12 @@ public class OnlineMonitorController {
         MonitorDataCollectDto monitorDataCollectDto=new MonitorDataCollectDto();
         monitorDataCollectDto.setSceneIds(sceneService.findByParentIdsLike(null));
         DispatchSummaryDto result=onlineMonitorService.statsDispatchSummary(monitorDataCollectDto);
+        //售水量
+        List<MonthSellwaterDto>  monthSell= revenueService.selectMonthSell(null);
+        monthSell.removeIf(r->r.getWaterUsage() == null);
+        result.setSellWaterUsage(monthSell.size()>0?monthSell.stream().mapToDouble(MonthSellwaterDto::getWaterUsage).sum():null);
+        result.setNrwRate(result.getYieldWaterUsage()!=null&&result.getYieldWaterUsage()>0&&result.getSellWaterUsage()!=null?
+                (result.getYieldWaterUsage()-result.getSellWaterUsage())/result.getYieldWaterUsage()*100:null);
         return new AjaxMessage<>(ResultStatus.OK, result);
     }
 

+ 11 - 3
sms_water/src/main/java/com/huaxu/dto/DispatchSummaryDto.java

@@ -3,7 +3,7 @@ package com.huaxu.dto;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.huaxu.common.converter.Double1Serializer;
+import com.huaxu.common.converter.Double2Serializer;
 import com.huaxu.common.converter.Double3Serializer;
 import com.huaxu.model.ProgramItem;
 import io.swagger.annotations.ApiModel;
@@ -35,11 +35,11 @@ public class DispatchSummaryDto {
     @ApiModelProperty("总能耗")
     private Double powerUsage;
 
-    @JsonSerialize(using = Double1Serializer.class)
+    @JsonSerialize(using = Double2Serializer.class)
     @ApiModelProperty("压力合格率")
     private Double presQualifiedRate;
 
-   @JsonSerialize(using = Double1Serializer.class)
+    @JsonSerialize(using = Double2Serializer.class)
     @ApiModelProperty("水质合格率")
     private Double waterQualifiedRate;
 
@@ -47,4 +47,12 @@ public class DispatchSummaryDto {
     @ApiModelProperty("已完成计划量")
     private Double invNameRate;
 
+    @JsonSerialize(using = Double3Serializer.class)
+    @ApiModelProperty("售水量")
+    private Double sellWaterUsage;
+
+    @JsonSerialize(using = Double2Serializer.class)
+    @ApiModelProperty("产销差率")
+    private Double NrwRate;
+
 }