feat:台站/GPS

This commit is contained in:
nieziyan 2024-02-27 19:26:52 +08:00
parent 6666e74a98
commit 8ad0d9db38
9 changed files with 155 additions and 1 deletions

View File

@ -0,0 +1,44 @@
package org.jeecg.modules.base.entity.original;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("ORIGINAL.GARDS_GPS_DATA")
public class GardsGPSData implements Serializable {
@TableField(value = "STATION_ID")
private Integer stationId;
@TableField(value = "STATION_CODE")
private String stationCode;
@TableField(value = "GPS_ID")
private Integer gpsId;
@TableField(value = "LON")
private Double lon;
@TableField(value = "LAT")
private Double lat;
@TableField(value = "RECORD_TIME")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date recordTime;
@TableField(value = "TIME_SPAN")
private Integer timeSpan;
@TableField(value = "MODDATE")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date moddate;
}

View File

@ -7,10 +7,12 @@ import org.jeecg.modules.entity.StationOperation;
import org.jeecg.modules.entity.SysUserFocusStationStation; import org.jeecg.modules.entity.SysUserFocusStationStation;
import org.jeecg.modules.feignclient.StationService; import org.jeecg.modules.feignclient.StationService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List; import java.util.List;
@RestController @RestController
@ -84,6 +86,14 @@ public class StationController {
return result; return result;
} }
// /stationOperation/getSelfStationGPS
@GetMapping("/stationOperation/getSelfStationGPS")
@ApiOperation(value = "查询台站运行轨迹", notes = "查询台站运行轨迹")
public Result getSelfStationGPS(String stationCode,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate) {
Result result = stationService.getSelfStationGPS(stationCode, startDate, endDate);
return result;
}
} }

View File

@ -4,10 +4,12 @@ import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.StationOperation; import org.jeecg.modules.entity.StationOperation;
import org.jeecg.modules.entity.SysUserFocusStationStation; import org.jeecg.modules.entity.SysUserFocusStationStation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.Date;
import java.util.List; import java.util.List;
@Component @Component
@ -35,4 +37,8 @@ public interface StationService {
@GetMapping("/sysUserFocusStation/findUserFocusByUserIdApp") @GetMapping("/sysUserFocusStation/findUserFocusByUserIdApp")
Result findUserFocusByUserId(@RequestParam String userId); Result findUserFocusByUserId(@RequestParam String userId);
@GetMapping("/stationOperation/getSelfStationGPS")
Result getSelfStationGPS(@RequestParam("stationCode") String stationCode,
@RequestParam("startDate") @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@RequestParam("endDate") @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate);
} }

View File

@ -8,8 +8,10 @@ import org.jeecg.modules.entity.data.StationOperation;
import org.jeecg.modules.service.IStationOperationService; import org.jeecg.modules.service.IStationOperationService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List; import java.util.List;
@RestController @RestController
@ -97,4 +99,13 @@ public class StationOperationController {
result.setResult(mapUrl); result.setResult(mapUrl);
return result; return result;
} }
@GetMapping("getSelfStationGPS")
@ApiOperation(value = "查询自建台站运行轨迹", notes = "查询自建台站运行轨迹")
public Result getSelfStationGPS(@RequestParam("stationCode") String stationCode,
@RequestParam("startDate") @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@RequestParam("endDate") @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate) {
return stationOperationService.getSelfStationGPS(stationCode, startDate, endDate);
}
} }

View File

@ -0,0 +1,28 @@
package org.jeecg.modules.entity.data;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
public class SelfStationGPSData implements Serializable {
private String stationCode;
private Double lon;
private Double lat;
/**
* 时间间隔 单位是秒
*/
private Integer timeSpan;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date recordDate;
}

View File

@ -1,7 +1,14 @@
package org.jeecg.modules.mapper; package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.entity.data.SelfStationGPSData;
import org.jeecg.modules.entity.data.StationOperation; import org.jeecg.modules.entity.data.StationOperation;
import java.util.List;
public interface StationOperationMapper extends BaseMapper<StationOperation> { public interface StationOperationMapper extends BaseMapper<StationOperation> {
List<SelfStationGPSData> getSelfStationGPS(@Param(value = "stationCode") String stationCode, @Param(value = "startTime") String startTime, @Param(value = "endTime") String endTime);
} }

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.StationOperationMapper">
<select id="getSelfStationGPS" resultType="org.jeecg.modules.entity.data.SelfStationGPSData">
SELECT
STATION_CODE as stationCode,
LON as lon,
LAT as lat,
RECORD_TIME as recordDate,
TIME_SPAN as timeSpan
FROM
ORIGINAL.GARDS_GPS_DATA
WHERE
STATION_CODE = #{stationCode}
AND RECORD_TIME BETWEEN TO_DATE(#{startTime}, 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE(#{endTime}, 'YYYY-MM-DD HH24:MI:SS')
ORDER BY
RECORD_TIME
</select>
</mapper>

View File

@ -5,6 +5,7 @@ import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.data.PointVo; import org.jeecg.modules.entity.data.PointVo;
import org.jeecg.modules.entity.data.StationOperation; import org.jeecg.modules.entity.data.StationOperation;
import java.util.Date;
import java.util.List; import java.util.List;
public interface IStationOperationService extends IService<StationOperation> { public interface IStationOperationService extends IService<StationOperation> {
@ -57,4 +58,6 @@ public interface IStationOperationService extends IService<StationOperation> {
*/ */
Result getDataProvisionEfficiency(); Result getDataProvisionEfficiency();
Result getSelfStationGPS(String stationCode, Date startDate, Date endDate);
} }

View File

@ -491,4 +491,28 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
return Result.OK(stationInfoList); return Result.OK(stationInfoList);
} }
@Override
@DS("ora")
public Result getSelfStationGPS(String stationCode, Date startDate, Date endDate) {
Result result = new Result();
if (StringUtils.isBlank(stationCode)) {
result.error500("Station Code cannot be null");
return result;
}
if (Objects.isNull(startDate)){
result.error500("The start time cannot be empty");
return result;
}
String startTime = DateUtils.formatDate(startDate, "yyyy-MM-dd") + " 00:00:00";
if (Objects.isNull(endDate)) {
result.error500("The end time cannot be empty");
return result;
}
String endTime = DateUtils.formatDate(endDate, "yyyy-MM-dd") + " 23:59:59";
List<SelfStationGPSData> stationGPSDataList = this.baseMapper.getSelfStationGPS(stationCode, startTime, endTime);
result.setSuccess(true);
result.setResult(stationGPSDataList);
return result;
}
} }