|
@@ -1,9 +1,12 @@
|
|
package com.huaxu.track.controller;
|
|
package com.huaxu.track.controller;
|
|
|
|
|
|
|
|
+import com.huaxu.common.ConvertXY;
|
|
|
|
+import com.huaxu.common.MyPoint;
|
|
import com.huaxu.entity.Message;
|
|
import com.huaxu.entity.Message;
|
|
import com.huaxu.model.AjaxMessage;
|
|
import com.huaxu.model.AjaxMessage;
|
|
import com.huaxu.model.LoginUser;
|
|
import com.huaxu.model.LoginUser;
|
|
import com.huaxu.model.ResultStatus;
|
|
import com.huaxu.model.ResultStatus;
|
|
|
|
+import com.huaxu.track.dto.GpsDataHisDto;
|
|
import com.huaxu.track.entity.GpsDataHis;
|
|
import com.huaxu.track.entity.GpsDataHis;
|
|
import com.huaxu.track.entity.TaskTrack;
|
|
import com.huaxu.track.entity.TaskTrack;
|
|
import com.huaxu.track.service.GpsDataHisService;
|
|
import com.huaxu.track.service.GpsDataHisService;
|
|
@@ -12,9 +15,11 @@ import com.huaxu.util.UserUtil;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@@ -35,7 +40,7 @@ public class TaskTrackController {
|
|
* @param
|
|
* @param
|
|
* @return Response对象
|
|
* @return Response对象
|
|
*/
|
|
*/
|
|
- @RequestMapping(value = "startTrack", method = RequestMethod.POST)
|
|
|
|
|
|
+ @RequestMapping(value = "startTrack", method = RequestMethod.GET)
|
|
@ApiOperation(value = "开始轨迹")
|
|
@ApiOperation(value = "开始轨迹")
|
|
public AjaxMessage<Integer> startTrack(@ApiParam(value = "任务id", required = true) @RequestParam Integer taskId) {
|
|
public AjaxMessage<Integer> startTrack(@ApiParam(value = "任务id", required = true) @RequestParam Integer taskId) {
|
|
TaskTrack taskTrack=new TaskTrack();
|
|
TaskTrack taskTrack=new TaskTrack();
|
|
@@ -59,7 +64,7 @@ public class TaskTrackController {
|
|
* @param
|
|
* @param
|
|
* @return Response对象
|
|
* @return Response对象
|
|
*/
|
|
*/
|
|
- @RequestMapping(value = "endTrack", method = RequestMethod.POST)
|
|
|
|
|
|
+ @RequestMapping(value = "endTrack", method = RequestMethod.GET)
|
|
@ApiOperation(value = "结束轨迹")
|
|
@ApiOperation(value = "结束轨迹")
|
|
public AjaxMessage<Boolean> endTrack( @ApiParam(value = "任务id", required = true) @RequestParam Integer taskId) {
|
|
public AjaxMessage<Boolean> endTrack( @ApiParam(value = "任务id", required = true) @RequestParam Integer taskId) {
|
|
TaskTrack taskTrack=new TaskTrack();
|
|
TaskTrack taskTrack=new TaskTrack();
|
|
@@ -78,15 +83,40 @@ public class TaskTrackController {
|
|
* @param
|
|
* @param
|
|
* @return Response对象
|
|
* @return Response对象
|
|
*/
|
|
*/
|
|
- @RequestMapping(value = "selectTaskTrack", method = RequestMethod.POST)
|
|
|
|
|
|
+ @RequestMapping(value = "selectTaskTrack", method = RequestMethod.GET)
|
|
@ApiOperation(value = "查询任务轨迹")
|
|
@ApiOperation(value = "查询任务轨迹")
|
|
- public AjaxMessage<List<GpsDataHis>> selectTaskTrack(
|
|
|
|
|
|
+ public AjaxMessage<List<GpsDataHisDto>> selectTaskTrack(
|
|
@ApiParam(value = "任务id", required = true) @RequestParam Integer taskId,
|
|
@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();
|
|
LoginUser currentUser = UserUtil.getCurrentUser();
|
|
userId=userId==null?currentUser.getId():userId;
|
|
userId=userId==null?currentUser.getId():userId;
|
|
TaskTrack track=taskTrackService.selectTaskTrack(taskId,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);
|
|
return new AjaxMessage<>(ResultStatus.OK, result);
|
|
}
|
|
}
|
|
}
|
|
}
|