Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

wangyangyang 4 gadi atpakaļ
vecāks
revīzija
b077ba412d

+ 9 - 0
operation_manager/src/main/java/com/huaxu/common/Beijing54.java

@@ -0,0 +1,9 @@
+package com.huaxu.common;
+
+public class Beijing54 extends GaussPrjBase {
+	  public Beijing54()
+      {
+          _a = 6378245.0;
+          _f = 1.0 / 298.3;
+      }
+}

+ 144 - 0
operation_manager/src/main/java/com/huaxu/common/ConvertXY.java

@@ -0,0 +1,144 @@
+package com.huaxu.common;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+public class ConvertXY {
+	
+	private static double a = 0, e2, e1, C0, C1, C2, C3, Ro0, Ro2;
+
+	public ConvertXY() {
+		a = 6378245.0;
+
+		e2 = 0.00669342162297;
+		e1 = 0.00673852541468;
+
+		C0 = 6367558.49686;
+		C1 = 32005.79642;
+		C2 = 133.86115;
+		C3 = 0.7031;
+		Ro0 = 180 / 3.1415926535897932;
+		Ro2 = 3600 * Ro0;
+	}
+
+	private MyPoint JWtoXY(WTDFM J, WTDFM W, double Lo) {
+		double L, B, T, ng2, N, Mo, X0, X1, X2, X3, X4, X5, X6, X7, X8;
+		L = J.m_DEGREE;// 计算°数
+		B = W.m_RADIAN;// 计算弧°已将°数转换为弧°
+		T = Math.tan(B);
+		ng2 = e1 * Math.pow(Math.cos(B), 2.0);
+		N = a / Math.pow((1.0 - e2 * Math.pow(Math.sin(B), 2.0)), (1.0 / 2.0));
+		Mo = (L - Lo) * Math.cos(B) / Ro0;
+		X0 = C0 * B
+				- Math.cos(B) * (C1 * Math.sin(B) + C2 * Math.pow(Math.sin(B), 3.0) + C3 * Math.pow(Math.sin(B), 5.0));
+		X1 = N * Mo;
+		X2 = C0 * B;
+		X3 = Math.cos(B) * (C1 * Math.sin(B) + C2 * Math.pow(Math.sin(B), 3.0) + C3 * Math.pow(Math.sin(B), 5.0));
+		X4 = N * T * Math.pow(Mo, 2.0) / 2.0;
+		X5 = (5.0 - Math.pow(T, 2.0) + 9.0 * ng2 + 4.0 * Math.pow(ng2, 2.0)) * N * T * Math.pow(Mo, 4.0) / 24.0;
+		X6 = (61.0 - 58.0 * Math.pow(T, 2.0) + Math.pow(T, 4.0)) * N * T * Math.pow(Mo, 6.0) / 720.0;
+		X7 = (1.0 - Math.pow(T, 2.0) + ng2) * N * Math.pow(Mo, 3.0) / 6.0;
+		X8 = (5.0 - 18.0 * Math.pow(T, 2.0) + Math.pow(T, 4.0) + 14.0 * ng2 - 58.0 * ng2 * Math.pow(T, 2.0)) * N
+				* Math.pow(Mo, 5.0) / 120.0;
+		double dblX = X2 - X3 + X4 + X5 + X6;// 计算式
+		double dblY = X1 + X7 + X8;// +500000.0;//计算式
+		MyPoint pPoint = new MyPoint();
+		pPoint.Y = (int) (dblX) + (int) ((dblX - (int) (dblX)) * 1000.0) / 1000.0;
+		pPoint.X = (int) (dblY) + (int) ((dblY - (int) (dblY)) * 1000.0) / 1000.0 + 500000.0;
+		return pPoint;
+	}
+
+	public MyPoint Convert(String x, String y) {
+		WTDFM J = new WTDFM();
+		WTDFM W = new WTDFM();
+		J.m_DEGREE = Double.valueOf(x);
+		W.m_DEGREE = Double.valueOf(y);
+		J.DEGtoDFM();
+		W.DEGtoDFM();
+		// 中央子午线
+		MyPoint pPoint = JWtoXY(J, W, 116.3502518055556);
+		// pPoint.X = pPoint.X - 400000;
+		// Y坐标偏移
+		pPoint.Y = pPoint.Y - 4114702.5;
+		// 坐标校正
+		// X - 50
+		// Y - 32
+		pPoint.X = pPoint.X - 50;
+		pPoint.Y = pPoint.Y - 32;
+		return pPoint;
+	}
+
+	/* 经纬度转西安80坐标 */
+	public static MyPoint ConvertXYToXian80(String x, String y,String moveXY) {
+		MyPoint pPoint = new MyPoint();
+		double dblLon = Double.parseDouble(x), dblLat = Double.parseDouble(y);
+		StringBuilder dblX80 = new StringBuilder();
+		StringBuilder dblY80 = new StringBuilder();
+		ICoordinate pCoordinate = CoordinateFactory.CreateCoordinate(Spheroid.Xian80);
+		pCoordinate.GaussPrjCalculate(dblLon, dblLat, dblX80, dblY80);
+		double X80 = Double.parseDouble(String.format("%.4f", Double.parseDouble(dblX80.toString())));
+		double Y80 = Double.parseDouble(String.format("%.4f", Double.parseDouble(dblY80.toString())));
+		X80 += -196600;
+		Y80 += 270;
+		int moveX=0,moveY=0;
+		if(!StringUtils.isEmpty(moveXY)){
+			moveX=Integer.parseInt(moveXY.split(",")[0]);
+			moveY=Integer.parseInt(moveXY.split(",")[1]);
+		}
+		pPoint.X = X80+moveX;
+		pPoint.Y = Y80+moveY;
+		return pPoint;
+	}
+
+	/* 经纬度转墨卡托投影坐标 */
+	public static MyPoint ConvertXYToMercato(String x, String y,String moveXY) {
+		MyPoint mercator = new MyPoint();
+		double dblLon = Double.parseDouble(x) * 20037508.34 / 180;
+		double dblLat = Math.log(Math.tan((90 + Double.parseDouble(y)) * Math.PI / 360)) / (Math.PI / 180);
+		dblLat = dblLat * 20037508.34 / 180;
+		int moveX=0,moveY=0;
+		if(!StringUtils.isEmpty(moveXY)){
+			moveX=Integer.parseInt(moveXY.split(",")[0]);
+			moveY=Integer.parseInt(moveXY.split(",")[1]);
+		}
+		mercator.X = dblLon+moveX;
+		mercator.Y = dblLat+moveY;
+		return mercator;
+	}
+	
+	
+
+
+	public static void main(String[] args) {
+
+		//String password = MD5Util.md5Encode("a83c71250a7363ea492aed2640d402ef");
+		//System.out.println(password);
+		//93.011981,43.601386
+		ConvertXY convert = new ConvertXY();//93.024905,43.597244
+		MyPoint pt = convert.ConvertXYToMercato("93.024905", "43.597244",null);
+		//pt = convert.LonlatToMercator("93.011981", "43.601386");
+		BigDecimal bdX= new BigDecimal(pt.X);
+		BigDecimal bdY= new BigDecimal(pt.Y);
+		
+		System.out.println("latitude,longtitude:" + String.valueOf(bdX.toPlainString()) + "," + String.valueOf(bdY.toPlainString()));
+		
+//		 pt = convert.LonlatToMercator("121.398804", "29.944973");
+//			
+//		 bdX= new BigDecimal(pt.X);
+//		 bdY= new BigDecimal(pt.Y);
+//			
+//	     System.out.println("latitude,longtitude:" + String.valueOf(bdX.toPlainString()) + "," + String.valueOf(bdY.toPlainString()));
+//
+//			
+//	     pt = convert.LonlatToMercator("121.746342", "29.823072");
+//				
+//		bdX= new BigDecimal(pt.X);
+//	    bdY= new BigDecimal(pt.Y);
+//				
+//		 System.out.println("latitude,longtitude:" + String.valueOf(bdX.toPlainString()) + "," + String.valueOf(bdY.toPlainString()));
+
+	}
+
+}

+ 31 - 0
operation_manager/src/main/java/com/huaxu/common/CoordinateFactory.java

@@ -0,0 +1,31 @@
+package com.huaxu.common;
+
+public class CoordinateFactory {
+	
+	   public static ICoordinate CreateCoordinate(Spheroid s)
+       {
+           ICoordinate coordinate;
+           switch (s)
+           {
+               case Beijing54:
+                   coordinate = new Beijing54();
+                   break;
+               case WGS84:
+                   coordinate = new WGS84();
+                   break;
+               case Xian80:
+                   coordinate = new Xian80();
+                   break;
+               default:
+                   coordinate = null;
+                   break;
+           }
+           return coordinate;
+       }
+
+       public static ICoordinate CreateCoordinate()
+       {
+           return new WGS84();
+       }
+
+}

+ 97 - 0
operation_manager/src/main/java/com/huaxu/common/GaussPrjBase.java

@@ -0,0 +1,97 @@
+package com.huaxu.common;
+
+public class GaussPrjBase implements ICoordinate {
+
+	protected double _a;
+	protected double _f;
+	private int ZoneWide = 3;
+	protected final double PI = 3.14159265353846;
+
+	@Override
+	public void DD2DMS(double DecimalDegree, int Degree, int Minute, double Second) {
+		// TODO Auto-generated method stub
+		Degree = (int) DecimalDegree;
+		Minute = (int) ((DecimalDegree - Degree) * 60.0);
+		Second = Math.round((DecimalDegree * 60 - Degree * 60 - Minute) * 60 * 100) / 100.0;
+	}
+
+	@Override
+	public void DMS2DD(int Degree, int Minute, double Second, double DecimalDegree) {
+		// TODO Auto-generated method stub
+		DecimalDegree = Degree + Minute / 60.0 + Second / 60.0 / 60.0;
+	}
+
+	@Override
+	public void GaussPrjCalculate(double longitude, double latitude, StringBuilder X, StringBuilder Y) {
+		// TODO Auto-generated method stub
+		int ProjNo = 0;
+		double longitude1, latitude1, longitude0, latitude0, X0, Y0, xval, yval;
+		double e2, ee, NN, T, C, A, M, iPI;
+		iPI = 0.0174532925199433; // 3.1415926535898/180.0;
+		// ZoneWide = 6; //6度带宽
+		ProjNo = (int) (longitude / ZoneWide);
+		longitude0 = ProjNo * ZoneWide + ZoneWide / 2;
+		longitude0 = longitude0 * iPI;
+		latitude0 = 0;
+		longitude1 = longitude * iPI; // 经度转换为弧度
+		latitude1 = latitude * iPI; // 纬度转换为弧度
+		e2 = 2 * _f - _f * _f;
+		ee = e2 * (1.0 - e2);
+		NN = _a / Math.sqrt(1.0 - e2 * Math.sin(latitude1) * Math.sin(latitude1));
+		T = Math.tan(latitude1) * Math.tan(latitude1);
+		C = ee * Math.cos(latitude1) * Math.cos(latitude1);
+		A = (longitude1 - longitude0) * Math.cos(latitude1);
+		M = _a * ((1 - e2 / 4 - 3 * e2 * e2 / 64 - 5 * e2 * e2 * e2 / 256) * latitude1
+				- (3 * e2 / 8 + 3 * e2 * e2 / 32 + 45 * e2 * e2 * e2 / 1024) * Math.sin(2 * latitude1)
+				+ (15 * e2 * e2 / 256 + 45 * e2 * e2 * e2 / 1024) * Math.sin(4 * latitude1)
+				- (35 * e2 * e2 * e2 / 3072) * Math.sin(6 * latitude1));
+		xval = NN
+				* (A + (1 - T + C) * A * A * A / 6 + (5 - 18 * T + T * T + 72 * C - 58 * ee) * A * A * A * A * A / 120);
+		yval = M + NN * Math.tan(latitude1) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24
+				+ (61 - 58 * T + T * T + 600 * C - 330 * ee) * A * A * A * A * A * A / 720);
+		X0 = 1000000L * (ProjNo + 1) + 500000L;
+		Y0 = 0;
+		X.append(String.valueOf(Math.round((xval + X0) * 100) / 100.0));
+		Y.append(String.valueOf(Math.round((yval + Y0) * 100) / 100.0));
+	}
+
+	@Override
+	public void GaussPrjInvCalculate(double X, double Y, StringBuilder longitude, StringBuilder latitude) {
+		// TODO Auto-generated method stub
+
+		int ProjNo;
+		double longitude1, latitude1, longitude0, latitude0, X0, Y0, xval, yval;
+		double e1, e2, ee, NN, T, C, M, D, R, u, fai, iPI;
+		iPI = 0.0174532925199433; // 3.1415926535898/180.0;
+		ProjNo = (int) (X / 1000000L); // 查找带号
+		longitude0 = (ProjNo - 1) * ZoneWide + ZoneWide / 2;
+		longitude0 = longitude0 * iPI; // 中央经线
+		X0 = ProjNo * 1000000L + 500000L;
+		Y0 = 0;
+		xval = X - X0;
+		yval = Y - Y0; // 带内大地坐标
+		e2 = 2 * _f - _f * _f;
+		e1 = (1.0 - Math.sqrt(1 - e2)) / (1.0 + Math.sqrt(1 - e2));
+		ee = e2 / (1 - e2);
+		M = yval;
+		u = M / (_a * (1 - e2 / 4 - 3 * e2 * e2 / 64 - 5 * e2 * e2 * e2 / 256));
+		fai = u + (3 * e1 / 2 - 27 * e1 * e1 * e1 / 32) * Math.sin(2 * u)
+				+ (21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32) * Math.sin(4 * u)
+				+ (151 * e1 * e1 * e1 / 96) * Math.sin(6 * u) + (1097 * e1 * e1 * e1 * e1 / 512) * Math.sin(8 * u);
+		C = ee * Math.cos(fai) * Math.cos(fai);
+		T = Math.tan(fai) * Math.tan(fai);
+		NN = _a / Math.sqrt(1.0 - e2 * Math.sin(fai) * Math.sin(fai));
+		R = _a * (1 - e2) / Math.sqrt((1 - e2 * Math.sin(fai) * Math.sin(fai))
+				* (1 - e2 * Math.sin(fai) * Math.sin(fai)) * (1 - e2 * Math.sin(fai) * Math.sin(fai)));
+		D = xval / NN;
+		// 计算经度(Longitude) 纬度(Latitude)
+		longitude1 = longitude0 + (D - (1 + 2 * T + C) * D * D * D / 6
+				+ (5 - 2 * C + 28 * T - 3 * C * C + 8 * ee + 24 * T * T) * D * D * D * D * D / 120) / Math.cos(fai);
+		latitude1 = fai
+				- (NN * Math.tan(fai) / R) * (D * D / 2 - (5 + 3 * T + 10 * C - 4 * C * C - 9 * ee) * D * D * D * D / 24
+						+ (61 + 90 * T + 298 * C + 45 * T * T - 256 * ee - 3 * C * C) * D * D * D * D * D * D / 720);
+		// 转换为度 DD
+		longitude.append(String.valueOf(Math.round((longitude1 / iPI) * 1000000) / 1000000.0));
+		latitude.append(String.valueOf( Math.round((latitude1 / iPI) * 1000000) / 1000000.0));
+	}
+}

+ 66 - 0
operation_manager/src/main/java/com/huaxu/common/ICoordinate.java

@@ -0,0 +1,66 @@
+package com.huaxu.common;
+
+public interface ICoordinate {
+	 /// <summary>
+    /// 带宽
+    /// </summary>
+    /// <summary>
+    /// 十进制双精度角度转换成度分秒角度格式
+    /// </summary>
+    /// <param name="Decimal Degree">度,十进制型双精度</param>
+    /// <param name="Degree">度,整型</param>
+    /// <param name="Minute">分,整型</param>
+    /// <param name="Second">秒,双精度型</param>
+    void DD2DMS(double DecimalDegree, int Degree, int Minute, double Second);
+
+    ///// <summary>
+    ///// 求两点之间的距离(根据经纬度)
+    ///// </summary>
+    ///// <param name="lng1">经度1</param>
+    ///// <param name="lat1">纬度1</param>
+    ///// <param name="lng2">经度2</param>
+    ///// <param name="lat2">纬度2</param>
+    ///// <param name="gs">高斯投影中所选用的参考椭球</param>
+    ///// <returns>两点间距离(单位:meters)</returns>
+    //double DistanceOfTwoPoints(double lng1, double lat1, double lng2, double lat2, GaussSphere gs);
+
+    
+    
+    
+
+    /// <summary>
+    /// 求两点之间的距离(大地坐标)
+    /// </summary>
+    /// <param name="x1"></param>
+    /// <param name="y1"></param>
+    /// <param name="x2"></param>
+    /// <param name="y2"></param>
+    /// <returns>单位为meters</returns>
+    //double DistanceOfTwoPoints(double x1, double y1, double x2, double y2);
+
+    /// <summary>
+    /// 度分秒角度格式转换成十进制度双精度角度格式
+    /// </summary>
+    /// <param name="Degree">度,整型</param>
+    /// <param name="Minute">分,整型</param>
+    /// <param name="Second">秒,双精度型</param>
+    /// <param name="Decimal Degree">度,十进制型双精度</param>   
+    void DMS2DD(int Degree, int Minute, double Second, double DecimalDegree);
+
+    /// <summary>
+    /// 高期投影正算
+    /// 由经纬度(单位:Decimal Degree)正算到大地坐标(单位:Metre,含带号)
+    /// </summary>
+    /// <param name="longitude">经度</param>
+    /// <param name="latitude">纬度</param>
+    void GaussPrjCalculate(double longitude, double latitude, StringBuilder X,StringBuilder Y);
+
+    /// <summary>
+    /// 高斯投影反算
+    /// 大地坐标(单位:Metre,含带号)反算到经纬度坐标(单位,Decimal Degree)
+    /// </summary>
+    /// <param name="X">大地坐标X值</param>
+    /// <param name="Y">大地坐标Y值</param>
+    void GaussPrjInvCalculate(double X, double Y, StringBuilder longitude, StringBuilder latitude);
+
+}

+ 9 - 0
operation_manager/src/main/java/com/huaxu/common/MyPoint.java

@@ -0,0 +1,9 @@
+package com.huaxu.common;
+
+import lombok.Data;
+
+@Data
+public class MyPoint {
+	public double X;
+	public double Y;
+}

+ 7 - 0
operation_manager/src/main/java/com/huaxu/common/Spheroid.java

@@ -0,0 +1,7 @@
+package com.huaxu.common;
+
+public enum Spheroid {
+	  Xian80,
+      Beijing54,
+      WGS84,
+}

+ 10 - 0
operation_manager/src/main/java/com/huaxu/common/WGS84.java

@@ -0,0 +1,10 @@
+package com.huaxu.common;
+
+public class WGS84 extends GaussPrjBase {
+	   public WGS84()
+       {
+           _a = 6378137.0;
+           _f = 1.0 / 298.257223563;
+
+       }
+}

+ 47 - 0
operation_manager/src/main/java/com/huaxu/common/WTDFM.java

@@ -0,0 +1,47 @@
+package com.huaxu.common;
+
+public class WTDFM {
+
+	public int m_Degree;// 度
+	public int m_Minute;// 分
+	public double m_Second;// 秒
+	public double m_RADIAN;// 弧度(包含度分秒)
+	public double m_DEGREE;// 度(包含度分秒)]
+	private final double PI = 3.1415926535897932;
+	
+	public WTDFM() {
+		m_Degree = 0;// 度
+		m_Minute = 0;// 分
+		m_Second = 0.0;// 秒
+		m_RADIAN = 0.0;// 弧度(包含度分秒)
+		m_DEGREE = 0.0;// 度(包含度分秒)
+	}
+
+	// 度=>度分秒
+	public void DEGtoDFM() {
+		double Ldu = 0, Lfen = 0, Lmiao = 0;
+		Ldu = m_DEGREE;
+		// 求度
+		m_Degree = (int) (Ldu);
+		// 求分
+		Lfen = (Ldu - m_Degree) * 60; // '计算′
+		m_Minute = (int) (Lfen);
+		// 求秒
+		Lmiao = (Lfen - m_Minute) * 60;// '计算'
+		m_Second = Lmiao;
+		// 求弧度
+		m_RADIAN = m_DEGREE * PI / 180;
+	}
+
+	// 度=>弧度
+	public void DFMtoRAD() {
+		m_DEGREE = m_Degree + m_Minute / 60.0 + m_Second / 3600.0;
+		m_RADIAN = m_DEGREE * PI / 180;
+	}
+
+	// 弧度=>度
+	public void RADtoDFM() {
+		m_DEGREE = m_RADIAN * 180 / PI;
+		DEGtoDFM();
+	}
+}

+ 11 - 0
operation_manager/src/main/java/com/huaxu/common/Xian80.java

@@ -0,0 +1,11 @@
+package com.huaxu.common;
+
+public class Xian80 extends GaussPrjBase {
+	
+	 public Xian80()
+     {
+         _a = 6378140.0;
+         _f = 1.0 / 298.257;
+     }
+
+}

+ 18 - 5
operation_manager/src/main/java/com/huaxu/order/controller/WorkOrderManageController.java

@@ -3,7 +3,9 @@ package com.huaxu.order.controller;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.huaxu.client.UserCenterClient;
+import com.huaxu.common.ConvertXY;
 import com.huaxu.common.FileUploadUtil;
+import com.huaxu.common.MyPoint;
 import com.huaxu.entity.Message;
 import com.huaxu.model.AjaxMessage;
 import com.huaxu.model.LoginUser;
@@ -231,10 +233,9 @@ public class WorkOrderManageController {
                             return new AjaxMessage<>(ResultStatus.CHILD_ORDER_ING);
                     }
                 }
-
                 //判断父单完成情况后才可以提交
                 WorkOrderManage parentOrder=workOrderManageService.selectByPrimaryKey(order.getOrderPid());
-                if(order.getOrderTypeId()==2&&parentOrder.getOrderStatus()!=2&&parentOrder.getOrderStatus()!=3) {
+                if(parentOrder!=null&&order.getOrderTypeId()==2&&parentOrder.getOrderStatus()!=2&&parentOrder.getOrderStatus()!=3) {
                     return new AjaxMessage<>(ResultStatus.PARENT_ORDER_ING);
                 }
             }
@@ -479,8 +480,8 @@ public class WorkOrderManageController {
 //                planManage.getTaskType());
         //流程查询, 测试参数:(test1 1 1)
         ProcessDefinition processDefinition = workFlowService.findProcessDefinition(
-                "test1",
-                1,
+                loginUser.getTenantId(),
+                loginUser.getCompanyId(),
                 1);
         if(processDefinition == null){
             new AjaxMessage(ResultStatus.ERROR,"没有创建流程,不能派单!");
@@ -530,7 +531,9 @@ public class WorkOrderManageController {
     @GetMapping("/selectOrderUserByOrgId")
     @ApiOperation(value = "查询派单时的用户信息")
     public AjaxMessage<Object> selectOrderUserByOrgId(
-            @ApiParam(value = "机构ID", required = true) @RequestParam(required = true) String ids){
+            @ApiParam(value = "机构ID", required = true) @RequestParam(required = true) String ids,
+            @ApiParam(value = "wkid", required = false) @RequestParam(required = false) String wkid,
+            @ApiParam(value = "偏移量(x,y)", required = false) @RequestParam(required = false) String moveXY){
         List<Map<String,Object>> result = new ArrayList<>();
         AjaxMessage<List<UserEntity>> listAjaxMessage = userCenterClient.findUserIdsByOrgId(String.format("[%s]",ids));
         for(UserEntity userEntity : listAjaxMessage.getData()){
@@ -544,10 +547,20 @@ public class WorkOrderManageController {
                 if (orderStatusMap != null) {
                     map.put("status", orderStatusMap.get("S").toString());
                     map.put("address", orderStatusMap.get("X") + "," + orderStatusMap.get("Y"));
+                    if(!org.apache.commons.lang3.StringUtils.isEmpty(wkid) && wkid.equals("2360")){
+                        MyPoint myPoint= ConvertXY.ConvertXYToXian80(orderStatusMap.get("X").toString(),
+                                orderStatusMap.get("Y").toString(),moveXY);
+                        map.put("coords",myPoint.getX()+","+myPoint.getY());
+                    }else if(!org.apache.commons.lang3.StringUtils.isEmpty(wkid) && wkid.equals("3857")){
+                        MyPoint myPoint= ConvertXY.ConvertXYToMercato(orderStatusMap.get("X").toString(),
+                                orderStatusMap.get("Y").toString(),moveXY);
+                        map.put("coords",myPoint.getX()+","+myPoint.getY());
+                    }
                 }
                 else {
                     map.put("status", "");
                     map.put("address", "");
+                    map.put("coords","");
                 }
                 map.put("distance", "");
                 result.add(map);

+ 2 - 2
operation_manager/src/main/java/com/huaxu/task/controller/PlanManageController.java

@@ -195,8 +195,8 @@ public class PlanManageController {
 //                planManage.getTaskType());
         //流程查询, 测试参数:(test1 1 1)
         ProcessDefinition processDefinition = workFlowService.findProcessDefinition(
-                "test1",
-                1,
+                loginUser.getTenantId(),
+                loginUser.getCompanyId(),
                 2);
         if(processDefinition == null){
             new AjaxMessage(ResultStatus.ERROR,"没有创建流程,不能提交!");

+ 36 - 6
operation_manager/src/main/java/com/huaxu/track/controller/TaskTrackController.java

@@ -1,9 +1,12 @@
 package com.huaxu.track.controller;
 
+import com.huaxu.common.ConvertXY;
+import com.huaxu.common.MyPoint;
 import com.huaxu.entity.Message;
 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.entity.GpsDataHis;
 import com.huaxu.track.entity.TaskTrack;
 import com.huaxu.track.service.GpsDataHisService;
@@ -12,9 +15,11 @@ import com.huaxu.util.UserUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -35,7 +40,7 @@ public class TaskTrackController {
      * @param
      * @return Response对象
      */
-    @RequestMapping(value = "startTrack", method = RequestMethod.POST)
+    @RequestMapping(value = "startTrack", method = RequestMethod.GET)
     @ApiOperation(value = "开始轨迹")
     public AjaxMessage<Integer> startTrack(@ApiParam(value = "任务id", required = true) @RequestParam Integer taskId) {
         TaskTrack taskTrack=new TaskTrack();
@@ -59,7 +64,7 @@ public class TaskTrackController {
      * @param
      * @return Response对象
      */
-    @RequestMapping(value = "endTrack", method = RequestMethod.POST)
+    @RequestMapping(value = "endTrack", method = RequestMethod.GET)
     @ApiOperation(value = "结束轨迹")
     public AjaxMessage<Boolean> endTrack( @ApiParam(value = "任务id", required = true) @RequestParam Integer taskId) {
         TaskTrack taskTrack=new TaskTrack();
@@ -78,15 +83,40 @@ public class TaskTrackController {
      * @param
      * @return Response对象
      */
-    @RequestMapping(value = "selectTaskTrack", method = RequestMethod.POST)
+    @RequestMapping(value = "selectTaskTrack", method = RequestMethod.GET)
     @ApiOperation(value = "查询任务轨迹")
-    public AjaxMessage<List<GpsDataHis>> selectTaskTrack(
+    public AjaxMessage<List<GpsDataHisDto>> selectTaskTrack(
             @ApiParam(value = "任务id", required = true) @RequestParam Integer taskId,
-            @ApiParam(value = "用户id", required = false) @RequestParam(required = false) Integer userId) {
+            @ApiParam(value = "用户id", required = false) @RequestParam(required = false) Integer userId,
+            @ApiParam(value = "wkid", required = false) @RequestParam(required = false) String wkid,
+            @ApiParam(value = "偏移量(x,y)", required = false) @RequestParam(required = false) String moveXY) {
         LoginUser currentUser = UserUtil.getCurrentUser();
         userId=userId==null?currentUser.getId():userId;
         TaskTrack track=taskTrackService.selectTaskTrack(taskId,userId);
-        List<GpsDataHis> result=gpsDataHisService.selectGpsDataHis(track);
+        List<GpsDataHis> gpsList=gpsDataHisService.selectGpsDataHis(track);
+        List<GpsDataHisDto> result=new ArrayList<>();
+        //转换坐标
+        for (GpsDataHis gpsDataHis:gpsList) {
+            GpsDataHisDto gpsDataHisDto=new GpsDataHisDto();
+            gpsDataHisDto.setId(gpsDataHis.getId());
+            gpsDataHisDto.setUserId(gpsDataHis.getUserId());
+            gpsDataHisDto.setUploadDate(gpsDataHis.getUploadDate());
+            gpsDataHisDto.setLatitude(gpsDataHis.getLatitude());
+            gpsDataHisDto.setLongtitude(gpsDataHis.getLongtitude());
+            if(!StringUtils.isEmpty(wkid) && wkid.equals("2360")){
+                MyPoint myPoint= ConvertXY.ConvertXYToXian80(gpsDataHis.getLongtitude().toString(),
+                        gpsDataHis.getLatitude().toString(),moveXY);
+                gpsDataHisDto.setConvertX(myPoint.getX());
+                gpsDataHisDto.setConvertY(myPoint.getY());
+            }else if(!StringUtils.isEmpty(wkid) && wkid.equals("3857")){
+                MyPoint myPoint= ConvertXY.ConvertXYToMercato(gpsDataHis.getLongtitude().toString(),
+                        gpsDataHis.getLatitude().toString(),moveXY);
+                gpsDataHisDto.setConvertX(myPoint.getX());
+                gpsDataHisDto.setConvertY(myPoint.getY());
+            }
+            result.add(gpsDataHisDto);
+        }
+
         return new AjaxMessage<>(ResultStatus.OK, result);
     }
 }

+ 26 - 0
operation_manager/src/main/java/com/huaxu/track/dto/GpsDataHisDto.java

@@ -0,0 +1,26 @@
+package com.huaxu.track.dto;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.huaxu.track.entity.GpsDataHis;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@ApiModel(value = "用户历史GPS数据扩展表")
+public class GpsDataHisDto extends GpsDataHis {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "转换后X")
+    private double ConvertX;
+
+    @ApiModelProperty(value = "转换后Y")
+    private double ConvertY;
+}

+ 2 - 1
operation_manager/src/main/java/com/huaxu/track/service/GpsDataHisService.java

@@ -8,6 +8,7 @@ import com.huaxu.track.entity.TaskTrack;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
 
 
@@ -37,7 +38,7 @@ public class GpsDataHisService extends ServiceImpl<GpsDataHisMapper, GpsDataHis>
      * @return
      */
     public List<GpsDataHis> selectGpsDataHis(TaskTrack taskTrack) {
-        return this.list(new QueryWrapper<GpsDataHis>().eq("USER_ID",taskTrack.getUserId())
+        return taskTrack==null?new ArrayList<>():this.list(new QueryWrapper<GpsDataHis>().eq("USER_ID",taskTrack.getUserId())
                 .gt("UPLOAD_DATE",taskTrack.getTaskStartDate())
                 .lt("UPLOAD_DATE",taskTrack.getTaskEndDate()));
     }