Commit a7400e7705eca628447233ccbeefd71c0caff7d7
1 parent
b8d862d4
gps数据接入,车辆轨迹回放
Showing
15 changed files
with
1051 additions
and
2 deletions
trash-common/src/main/java/com/trash/common/core/redis/RedisCache.java
| ... | ... | @@ -130,6 +130,17 @@ public class RedisCache |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | + * 获得缓存的list对象 | |
| 134 | + * | |
| 135 | + * @param key 缓存的键值 | |
| 136 | + * @return 缓存键值对应的数据 | |
| 137 | + */ | |
| 138 | + public <T> T getCacheListRight(final String key) | |
| 139 | + { | |
| 140 | + return (T) redisTemplate.opsForList().rightPop(key); | |
| 141 | + } | |
| 142 | + | |
| 143 | + /** | |
| 133 | 144 | * 缓存Set |
| 134 | 145 | * |
| 135 | 146 | * @param key 缓存键值 | ... | ... |
trash-common/src/main/java/com/trash/common/utils/DateUtils.java
| ... | ... | @@ -48,6 +48,21 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils |
| 48 | 48 | return dateTimeNow(YYYY_MM_DD); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | + public static String getYear() | |
| 52 | + { | |
| 53 | + return dateTimeNow(YYYY); | |
| 54 | + } | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 获取date的年月 | |
| 58 | + * @param date 日期 | |
| 59 | + * @return 结果 | |
| 60 | + */ | |
| 61 | + public static String getYearMonth(Date date) | |
| 62 | + { | |
| 63 | + return parseDateToStr(YYYY_MM,date); | |
| 64 | + } | |
| 65 | + | |
| 51 | 66 | public static final String getTime() |
| 52 | 67 | { |
| 53 | 68 | return dateTimeNow(YYYY_MM_DD_HH_MM_SS); |
| ... | ... | @@ -152,4 +167,20 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils |
| 152 | 167 | // long sec = diff % nd % nh % nm / ns; |
| 153 | 168 | return day + "天" + hour + "小时" + min + "分钟"; |
| 154 | 169 | } |
| 170 | + | |
| 171 | + /** | |
| 172 | + * 判断两个时间是否是同一个月 | |
| 173 | + * @param beginDate 开始日期 | |
| 174 | + * @param endDate 结束日期 | |
| 175 | + * @return 结果 | |
| 176 | + */ | |
| 177 | + public static boolean isSameMonth(Date beginDate, Date endDate) { | |
| 178 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); | |
| 179 | + String format1 = sdf.format(beginDate); | |
| 180 | + String format2 = sdf.format(endDate); | |
| 181 | + if(format1.equals(format2)){ | |
| 182 | + return true; | |
| 183 | + } | |
| 184 | + return false; | |
| 185 | + } | |
| 155 | 186 | } | ... | ... |
trash-quartz/pom.xml
trash-quartz/src/main/java/com/trash/quartz/task/GpsTask.java
0 → 100644
| 1 | +package com.trash.quartz.task; | |
| 2 | + | |
| 3 | +import com.alibaba.fastjson.JSONObject; | |
| 4 | +import com.trash.common.core.redis.RedisCache; | |
| 5 | +import com.trash.common.utils.DateUtils; | |
| 6 | +import com.trash.gps.domain.GpsOrientation; | |
| 7 | +import com.trash.gps.mapper.GpsOrientationMapper; | |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | +import org.springframework.stereotype.Component; | |
| 10 | + | |
| 11 | +import java.util.ArrayList; | |
| 12 | +import java.util.Collection; | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 15 | +@Component("GpsTask") | |
| 16 | +public class GpsTask { | |
| 17 | + | |
| 18 | + @Autowired | |
| 19 | + private RedisCache redisCache; | |
| 20 | + | |
| 21 | + @Autowired | |
| 22 | + private GpsOrientationMapper gpsOrientationMapper; | |
| 23 | + | |
| 24 | + //30秒执行一次 | |
| 25 | + | |
| 26 | + public void insertGps() { | |
| 27 | + Collection<String> keys = redisCache.keys("GPS:*"); | |
| 28 | + for (String key : keys) { | |
| 29 | + for(int i=0;i<10;i++){ | |
| 30 | + JSONObject jsonObject = redisCache.getCacheListRight(key); | |
| 31 | + if(jsonObject==null){ | |
| 32 | + break; | |
| 33 | + } | |
| 34 | + String terminalNumber = key.replaceAll("GPS:",""); | |
| 35 | + GpsOrientation gps = new GpsOrientation(); | |
| 36 | + gps.setTerminalNumber(terminalNumber); | |
| 37 | + gps.setLongitude(jsonObject.getString("lng")); | |
| 38 | + gps.setLatitude(jsonObject.getString("lat")); | |
| 39 | + gps.setCreateTime(DateUtils.parseDate(jsonObject.getString("time").replaceAll("T"," "))); | |
| 40 | + gps.setYearMonth(jsonObject.getString("time").substring(0,7).replace("-","")); | |
| 41 | + gps.setCarCode(jsonObject.getString("carCode")); | |
| 42 | + gpsOrientationMapper.insertGpsOrientation(gps); | |
| 43 | + } | |
| 44 | + | |
| 45 | + } | |
| 46 | + } | |
| 47 | +} | ... | ... |
trash-ui/src/api/gps/trajectory.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 查询gps数据轨迹回放列表 | |
| 4 | +export function listTrajectory(query) { | |
| 5 | + return request({ | |
| 6 | + url: '/gps/trajectory/list', | |
| 7 | + method: 'get', | |
| 8 | + params: query | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 查询gps车牌号列表 | |
| 13 | +export function getCarCodeList() { | |
| 14 | + return request({ | |
| 15 | + url: '/gps/trajectory/carCodeList', | |
| 16 | + method: 'get' | |
| 17 | + }) | |
| 18 | +} | |
| 19 | + | |
| 20 | +// 查询gps数据轨迹回放详细 | |
| 21 | +export function getTrajectory(id) { | |
| 22 | + return request({ | |
| 23 | + url: '/gps/trajectory/' + id, | |
| 24 | + method: 'get' | |
| 25 | + }) | |
| 26 | +} | |
| 27 | + | |
| 28 | +// 新增gps数据轨迹回放 | |
| 29 | +export function addTrajectory(data) { | |
| 30 | + return request({ | |
| 31 | + url: '/gps/trajectory', | |
| 32 | + method: 'post', | |
| 33 | + data: data | |
| 34 | + }) | |
| 35 | +} | |
| 36 | + | |
| 37 | +// 修改gps数据轨迹回放 | |
| 38 | +export function updateTrajectory(data) { | |
| 39 | + return request({ | |
| 40 | + url: '/gps/trajectory', | |
| 41 | + method: 'put', | |
| 42 | + data: data | |
| 43 | + }) | |
| 44 | +} | |
| 45 | + | |
| 46 | +// 删除gps数据轨迹回放 | |
| 47 | +export function delTrajectory(id) { | |
| 48 | + return request({ | |
| 49 | + url: '/gps/trajectory/' + id, | |
| 50 | + method: 'delete' | |
| 51 | + }) | |
| 52 | +} | |
| 53 | + | |
| 54 | +// 导出gps数据轨迹回放 | |
| 55 | +export function exportTrajectory(query) { | |
| 56 | + return request({ | |
| 57 | + url: '/gps/trajectory/export', | |
| 58 | + method: 'get', | |
| 59 | + params: query | |
| 60 | + }) | |
| 61 | +} | ... | ... |
trash-ui/src/assets/image/car.png
0 → 100644
9.08 KB
trash-ui/src/assets/image/car1.png
0 → 100644
5.58 KB
trash-ui/src/views/gps/trajectory/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="app-container"> | |
| 3 | + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> | |
| 4 | + <el-form-item label="车牌号" prop="trashType"> | |
| 5 | + <treeselect v-model="queryParams.carCode" :options="options" placeholder="请选择" style="width:200px;"/> | |
| 6 | + </el-form-item> | |
| 7 | + <el-form-item label="时间段" prop="latitude"> | |
| 8 | + <el-date-picker | |
| 9 | + v-model="createTime" | |
| 10 | + type="datetimerange" | |
| 11 | + range-separator="至" | |
| 12 | + start-placeholder="开始日期" | |
| 13 | + end-placeholder="结束日期"> | |
| 14 | + </el-date-picker> | |
| 15 | + </el-form-item> | |
| 16 | + <el-form-item> | |
| 17 | + <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> | |
| 18 | + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> | |
| 19 | + </el-form-item> | |
| 20 | + </el-form> | |
| 21 | + | |
| 22 | + <el-row :gutter="10" class="mb8"> | |
| 23 | + <el-col :span="1.5"> | |
| 24 | + <el-button | |
| 25 | + type="primary" | |
| 26 | + size="mini" | |
| 27 | + @click="startAnimation" | |
| 28 | + v-hasPermi="['gps:trajectory:add']" | |
| 29 | + >开始回放 | |
| 30 | + </el-button> | |
| 31 | + </el-col> | |
| 32 | + <el-col :span="1.5"> | |
| 33 | + <el-button | |
| 34 | + type="success" | |
| 35 | + size="mini" | |
| 36 | + @click="resumeAnimation" | |
| 37 | + v-hasPermi="['gps:trajectory:remove']" | |
| 38 | + >继续 | |
| 39 | + </el-button> | |
| 40 | + </el-col> | |
| 41 | + <el-col :span="1.5"> | |
| 42 | + <el-button | |
| 43 | + type="danger" | |
| 44 | + size="mini" | |
| 45 | + @click="pauseAnimation" | |
| 46 | + v-hasPermi="['gps:trajectory:edit']" | |
| 47 | + >暂停 | |
| 48 | + </el-button> | |
| 49 | + </el-col> | |
| 50 | + <el-col :span="1.5"> | |
| 51 | + <el-button | |
| 52 | + type="primary" | |
| 53 | + size="mini" | |
| 54 | + @click="accelerate" | |
| 55 | + v-hasPermi="['gps:trajectory:edit']" | |
| 56 | + >{{ speed }}倍速 | |
| 57 | + </el-button> | |
| 58 | + </el-col> | |
| 59 | + <el-col :span="1.5"> | |
| 60 | + <el-tooltip class="item" effect="light" placement="right"> | |
| 61 | + <div slot="content" class="tooltipsContent1"> | |
| 62 | + 选择倍速后,需重新开始回放 | |
| 63 | + </div> | |
| 64 | + <div class="tips"> | |
| 65 | + <span class="tipsSpan"> | |
| 66 | + 倍速提示 | |
| 67 | + </span> | |
| 68 | + <i class="el-icon-question"></i> | |
| 69 | + </div> | |
| 70 | + </el-tooltip> | |
| 71 | + </el-col> | |
| 72 | + <!-- <el-col :span="1.5">--> | |
| 73 | + <!-- <el-button--> | |
| 74 | + <!-- type="warning"--> | |
| 75 | + <!-- icon="el-icon-download"--> | |
| 76 | + <!-- size="mini"--> | |
| 77 | + <!-- @click="stopAnimation"--> | |
| 78 | + <!-- v-hasPermi="['gps:trajectory:export']"--> | |
| 79 | + <!-- >暂停</el-button>--> | |
| 80 | + <!-- </el-col>--> | |
| 81 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | |
| 82 | + </el-row> | |
| 83 | + <el-row> | |
| 84 | + <el-col :span="24"> | |
| 85 | + <div id="trajectoryMap" class="am-map" style="width:100%;height: 750px"></div> | |
| 86 | + </el-col> | |
| 87 | + </el-row> | |
| 88 | + </div> | |
| 89 | +</template> | |
| 90 | + | |
| 91 | +<script> | |
| 92 | +import {listTrajectory} from "@/api/gps/trajectory"; | |
| 93 | +import {listCarInfo} from "@/api/unit/carInfo"; | |
| 94 | +import AMapLoader from '@amap/amap-jsapi-loader'; | |
| 95 | +import Treeselect from "@riophae/vue-treeselect"; | |
| 96 | +import '@riophae/vue-treeselect/dist/vue-treeselect.css' | |
| 97 | + | |
| 98 | +export default { | |
| 99 | + name: "Trajectory", | |
| 100 | + components: {Treeselect}, | |
| 101 | + data() { | |
| 102 | + return { | |
| 103 | + // 遮罩层 | |
| 104 | + loading: true, | |
| 105 | + // 选中数组 | |
| 106 | + ids: [], | |
| 107 | + // 非单个禁用 | |
| 108 | + single: true, | |
| 109 | + // 非多个禁用 | |
| 110 | + multiple: true, | |
| 111 | + // 显示搜索条件 | |
| 112 | + showSearch: true, | |
| 113 | + // 总条数 | |
| 114 | + total: 0, | |
| 115 | + // gps数据轨迹回放表格数据 | |
| 116 | + trajectoryList: [], | |
| 117 | + // 弹出层标题 | |
| 118 | + title: "", | |
| 119 | + // 是否显示弹出层 | |
| 120 | + open: false, | |
| 121 | + // 查询参数 | |
| 122 | + queryParams: { | |
| 123 | + terminalNumber: null, | |
| 124 | + longitude: null, | |
| 125 | + latitude: null, | |
| 126 | + createTime: null, | |
| 127 | + createTimeStart: null, | |
| 128 | + createTimeEnd: null, | |
| 129 | + carCode: null | |
| 130 | + }, | |
| 131 | + createTime: null, | |
| 132 | + // 表单参数 | |
| 133 | + form: {}, | |
| 134 | + // 表单校验 | |
| 135 | + rules: {}, | |
| 136 | + map: null, | |
| 137 | + marker: null, | |
| 138 | + polyline: null, | |
| 139 | + options: [],//车牌号 | |
| 140 | + speed: 1, | |
| 141 | + lineArr: [] | |
| 142 | + }; | |
| 143 | + }, | |
| 144 | + created() { | |
| 145 | + listCarInfo(null).then(res => { | |
| 146 | + //将res.rows转换成options | |
| 147 | + this.options = res.rows.map(item => { | |
| 148 | + return { | |
| 149 | + id: item.carCode, | |
| 150 | + label: item.carCode | |
| 151 | + } | |
| 152 | + }) | |
| 153 | + }) | |
| 154 | + }, | |
| 155 | + mounted() { | |
| 156 | + this.initMap(); | |
| 157 | + }, | |
| 158 | + methods: { | |
| 159 | + getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) { | |
| 160 | + var R = 6371; // 地球的半径,单位是千米 | |
| 161 | + var dLat = this.deg2rad(lat2 - lat1); | |
| 162 | + var dLon = this.deg2rad(lon2 - lon1); | |
| 163 | + var a = | |
| 164 | + Math.sin(dLat / 2) * Math.sin(dLat / 2) + | |
| 165 | + Math.cos(this.deg2rad(lat1)) * Math.cos(this.deg2rad(lat2)) * | |
| 166 | + Math.sin(dLon / 2) * Math.sin(dLon / 2) | |
| 167 | + ; | |
| 168 | + var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); | |
| 169 | + var d = R * c; // 距离(千米) | |
| 170 | + return d; | |
| 171 | + }, | |
| 172 | + | |
| 173 | + deg2rad(deg) { | |
| 174 | + return deg * (Math.PI / 180) | |
| 175 | + }, | |
| 176 | + getList() { | |
| 177 | + | |
| 178 | + console.log(this.queryParams) | |
| 179 | + if (this.queryParams.carCode != null && this.createTime != null) { | |
| 180 | + this.queryParams.createTimeStart = this.parseTime(this.createTime[0], '{y}-{m}-{d} {h}:{i}:{s}'); | |
| 181 | + this.queryParams.createTimeEnd = this.parseTime(this.createTime[1], '{y}-{m}-{d} {h}:{i}:{s}'); | |
| 182 | + listTrajectory(this.queryParams).then(res => { | |
| 183 | + this.lineArr = []; | |
| 184 | + this.lineArr = res.map(item => { | |
| 185 | + return [item.longitude, item.latitude] | |
| 186 | + }).filter((item, index, array) => { | |
| 187 | + if (index === 0) return true; // 永远保持第一点 | |
| 188 | + const prevItem = array[index - 1]; | |
| 189 | + const distance = this.getDistanceFromLatLonInKm(prevItem[1], prevItem[0], item[1], item[0]); | |
| 190 | + return distance <= 10; // 最大允许距离10km | |
| 191 | + }), | |
| 192 | + this.initMap(); | |
| 193 | + }) | |
| 194 | + } else { | |
| 195 | + this.$message.warning("请选择车牌号和时间段"); | |
| 196 | + } | |
| 197 | + | |
| 198 | + }, | |
| 199 | + startAnimation() { | |
| 200 | + this.marker.moveAlong(this.lineArr, 500 * this.speed); | |
| 201 | + }, | |
| 202 | + pauseAnimation() { | |
| 203 | + this.marker.pauseMove(); | |
| 204 | + }, | |
| 205 | + resumeAnimation() { | |
| 206 | + this.marker.resumeMove(); | |
| 207 | + }, | |
| 208 | + accelerate() { | |
| 209 | + this.speed = this.speed * 2; | |
| 210 | + if (this.speed > 16) { | |
| 211 | + this.speed = 1; | |
| 212 | + } | |
| 213 | + }, | |
| 214 | + initMap() { | |
| 215 | + const _this = this | |
| 216 | + // 加载高德地图 | |
| 217 | + AMapLoader.load({ | |
| 218 | + key: _this.$aMapKey, //设置高德地图申请的key | |
| 219 | + version: "1.4.15", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15 | |
| 220 | + plugins: ['AMap.ToolBar', 'AMap.PolygonEditor', 'AMap.Polyline', 'AMap.Marker', 'AMap.MoveAnimation'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等 | |
| 221 | + AMapUI: { | |
| 222 | + version: "1.1", | |
| 223 | + plugins: [] | |
| 224 | + }, | |
| 225 | + Loca: { | |
| 226 | + version: "1.4.15" | |
| 227 | + }, | |
| 228 | + }).then(async (AMap) => { | |
| 229 | + _this.map = await new AMap.Map("trajectoryMap", { //设置地图容器id | |
| 230 | + center: [113.01814545605467, 28.201039299894283], // 初始化地图中心点位置 | |
| 231 | + zoom: 11, //初始化地图层级 | |
| 232 | + resizeEnable: true, | |
| 233 | + }); | |
| 234 | + if (_this.lineArr.length !== 0) { | |
| 235 | + _this.marker = new AMap.Marker({ | |
| 236 | + map: _this.map, | |
| 237 | + position: _this.lineArr[0], | |
| 238 | + icon: require("../../../assets/image/car2.png"), | |
| 239 | + offset: new AMap.Pixel(-26, -13), | |
| 240 | + autoRotaton: true, | |
| 241 | + // angle: -90, | |
| 242 | + }) | |
| 243 | + | |
| 244 | + // 绘制轨迹 | |
| 245 | + _this.polyline = new AMap.Polyline({ | |
| 246 | + map: _this.map, | |
| 247 | + path: _this.lineArr, | |
| 248 | + showDir: true, | |
| 249 | + strokeColor: "#28F", //线颜色 | |
| 250 | + // strokeOpacity: 1, //线透明度 | |
| 251 | + strokeWeight: 6, //线宽 | |
| 252 | + // strokeStyle: "solid" //线样式 | |
| 253 | + }); | |
| 254 | + | |
| 255 | + _this.passedPolyline = new AMap.Polyline({ | |
| 256 | + map: _this.map, | |
| 257 | + // path: lineArr, | |
| 258 | + strokeColor: "#AF5", //线颜色 | |
| 259 | + // strokeOpacity: 1, //线透明度 | |
| 260 | + strokeWeight: 6, //线宽 | |
| 261 | + // strokeStyle: "solid" //线样式 | |
| 262 | + }); | |
| 263 | + _this.marker.on('moving', function (e) { | |
| 264 | + _this.passedPolyline.setPath(e.passedPath); | |
| 265 | + }); | |
| 266 | + } | |
| 267 | + _this.map.setFitView(); | |
| 268 | + | |
| 269 | + | |
| 270 | + }).catch(e => { | |
| 271 | + console.log(e); | |
| 272 | + }); | |
| 273 | + }, | |
| 274 | + // 取消按钮 | |
| 275 | + cancel() { | |
| 276 | + this.open = false; | |
| 277 | + this.reset(); | |
| 278 | + }, | |
| 279 | + // 表单重置 | |
| 280 | + reset() { | |
| 281 | + this.form = { | |
| 282 | + id: null, | |
| 283 | + terminalNumber: null, | |
| 284 | + longitude: null, | |
| 285 | + latitude: null, | |
| 286 | + createTime: null | |
| 287 | + }; | |
| 288 | + this.resetForm("form"); | |
| 289 | + }, | |
| 290 | + /** 搜索按钮操作 */ | |
| 291 | + handleQuery() { | |
| 292 | + this.queryParams.pageNum = 1; | |
| 293 | + this.getList(); | |
| 294 | + }, | |
| 295 | + /** 重置按钮操作 */ | |
| 296 | + resetQuery() { | |
| 297 | + this.resetForm("queryForm"); | |
| 298 | + this.handleQuery(); | |
| 299 | + }, | |
| 300 | + } | |
| 301 | +}; | |
| 302 | +</script> | ... | ... |
trash-ui/src/views/unit/carInfo/info.vue
| ... | ... | @@ -148,7 +148,9 @@ |
| 148 | 148 | </el-col> |
| 149 | 149 | <el-col :span="7"> |
| 150 | 150 | <el-form-item label="车辆设备" prop="carEquipment"> |
| 151 | - <el-input v-model="form.carEquipment" placeholder="请输入车辆设备" /> | |
| 151 | + <el-select v-model="form.carEquipment" placeholder="请选择车辆设备" clearable style="width: 100%;"> | |
| 152 | + <el-option v-for="(item,index) in gpsList" :label="item.carCode" :value="item.terminalNumber" :key="index"/> | |
| 153 | + </el-select> | |
| 152 | 154 | </el-form-item> |
| 153 | 155 | </el-col> |
| 154 | 156 | <el-col :span="7"> |
| ... | ... | @@ -421,6 +423,7 @@ import Treeselect from "@riophae/vue-treeselect"; |
| 421 | 423 | import '@riophae/vue-treeselect/dist/vue-treeselect.css' |
| 422 | 424 | import {getAreaList} from "@/api/casefile/remoteServer"; |
| 423 | 425 | import { listDriverByCompanyId } from "@/api/unit/driver"; |
| 426 | +import {getCarCodeList} from "@/api/gps/trajectory"; | |
| 424 | 427 | |
| 425 | 428 | export default { |
| 426 | 429 | name: "DisposalSite", |
| ... | ... | @@ -493,7 +496,8 @@ export default { |
| 493 | 496 | driverList:[], |
| 494 | 497 | options:[], |
| 495 | 498 | volumeOrLWH:"体积", |
| 496 | - drivers:[] | |
| 499 | + drivers:[], | |
| 500 | + gpsList:[], | |
| 497 | 501 | }; |
| 498 | 502 | }, |
| 499 | 503 | created() { |
| ... | ... | @@ -506,6 +510,9 @@ export default { |
| 506 | 510 | listEnterprise(this.queryParams).then(response => { |
| 507 | 511 | this.enterpriseList = response.rows; |
| 508 | 512 | }); |
| 513 | + getCarCodeList().then(res => { | |
| 514 | + this.gpsList = res; | |
| 515 | + }) | |
| 509 | 516 | this.initData(); |
| 510 | 517 | }, |
| 511 | 518 | watch: { | ... | ... |
trash-unit/src/main/java/com/trash/gps/controller/GpsOrientationController.java
0 → 100644
| 1 | +package com.trash.gps.controller; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 6 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 7 | +import org.springframework.web.bind.annotation.PostMapping; | |
| 8 | +import org.springframework.web.bind.annotation.PutMapping; | |
| 9 | +import org.springframework.web.bind.annotation.DeleteMapping; | |
| 10 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 11 | +import org.springframework.web.bind.annotation.RequestBody; | |
| 12 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 13 | +import org.springframework.web.bind.annotation.RestController; | |
| 14 | +import com.trash.common.annotation.Log; | |
| 15 | +import com.trash.common.core.controller.BaseController; | |
| 16 | +import com.trash.common.core.domain.AjaxResult; | |
| 17 | +import com.trash.common.enums.BusinessType; | |
| 18 | +import com.trash.gps.domain.GpsOrientation; | |
| 19 | +import com.trash.gps.service.IGpsOrientationService; | |
| 20 | +import com.trash.common.utils.poi.ExcelUtil; | |
| 21 | +import com.trash.common.core.page.TableDataInfo; | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * gps数据轨迹回放Controller | |
| 25 | + * | |
| 26 | + * @author trash | |
| 27 | + * @date 2023-12-13 | |
| 28 | + */ | |
| 29 | +@RestController | |
| 30 | +@RequestMapping("/gps/trajectory") | |
| 31 | +public class GpsOrientationController extends BaseController | |
| 32 | +{ | |
| 33 | + @Autowired | |
| 34 | + private IGpsOrientationService gpsOrientationService; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 查询gps数据轨迹回放列表 | |
| 38 | + */ | |
| 39 | + @PreAuthorize("@ss.hasPermi('gps:trajectory:list')") | |
| 40 | + @GetMapping("/list") | |
| 41 | + public List<GpsOrientation> list(GpsOrientation gpsOrientation) | |
| 42 | + { | |
| 43 | + List<GpsOrientation> list = gpsOrientationService.selectGpsOrientationList(gpsOrientation); | |
| 44 | + return list; | |
| 45 | + } | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * 查询gps车牌号列表 | |
| 49 | + * @return 结果 | |
| 50 | + */ | |
| 51 | + @GetMapping("/carCodeList") | |
| 52 | + public List<GpsOrientation> getCarCodeList() | |
| 53 | + { | |
| 54 | + return gpsOrientationService.selectCarCodeList(); | |
| 55 | + } | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 导出gps数据轨迹回放列表 | |
| 59 | + */ | |
| 60 | + @PreAuthorize("@ss.hasPermi('gps:trajectory:export')") | |
| 61 | + @Log(title = "gps数据轨迹回放", businessType = BusinessType.EXPORT) | |
| 62 | + @GetMapping("/export") | |
| 63 | + public AjaxResult export(GpsOrientation gpsOrientation) | |
| 64 | + { | |
| 65 | + List<GpsOrientation> list = gpsOrientationService.selectGpsOrientationList(gpsOrientation); | |
| 66 | + ExcelUtil<GpsOrientation> util = new ExcelUtil<GpsOrientation>(GpsOrientation.class); | |
| 67 | + return util.exportExcel(list, "trajectory"); | |
| 68 | + } | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * 获取gps数据轨迹回放详细信息 | |
| 72 | + */ | |
| 73 | + @PreAuthorize("@ss.hasPermi('gps:trajectory:query')") | |
| 74 | + @GetMapping(value = "/{id}") | |
| 75 | + public AjaxResult getInfo(@PathVariable("id") Long id) | |
| 76 | + { | |
| 77 | + String year = "2023"; | |
| 78 | + return AjaxResult.success(gpsOrientationService.selectGpsOrientationById(id,year)); | |
| 79 | + } | |
| 80 | + | |
| 81 | + /** | |
| 82 | + * 新增gps数据轨迹回放 | |
| 83 | + */ | |
| 84 | + @PreAuthorize("@ss.hasPermi('gps:trajectory:add')") | |
| 85 | + @Log(title = "gps数据轨迹回放", businessType = BusinessType.INSERT) | |
| 86 | + @PostMapping | |
| 87 | + public AjaxResult add(@RequestBody GpsOrientation gpsOrientation) | |
| 88 | + { | |
| 89 | + return toAjax(gpsOrientationService.insertGpsOrientation(gpsOrientation)); | |
| 90 | + } | |
| 91 | + | |
| 92 | + /** | |
| 93 | + * 修改gps数据轨迹回放 | |
| 94 | + */ | |
| 95 | + @PreAuthorize("@ss.hasPermi('gps:trajectory:edit')") | |
| 96 | + @Log(title = "gps数据轨迹回放", businessType = BusinessType.UPDATE) | |
| 97 | + @PutMapping | |
| 98 | + public AjaxResult edit(@RequestBody GpsOrientation gpsOrientation) | |
| 99 | + { | |
| 100 | + return toAjax(gpsOrientationService.updateGpsOrientation(gpsOrientation)); | |
| 101 | + } | |
| 102 | + | |
| 103 | + /** | |
| 104 | + * 删除gps数据轨迹回放 | |
| 105 | + */ | |
| 106 | + @PreAuthorize("@ss.hasPermi('gps:trajectory:remove')") | |
| 107 | + @Log(title = "gps数据轨迹回放", businessType = BusinessType.DELETE) | |
| 108 | + @DeleteMapping("/{ids}") | |
| 109 | + public AjaxResult remove(@PathVariable Long[] ids) | |
| 110 | + { | |
| 111 | + return toAjax(gpsOrientationService.deleteGpsOrientationByIds(ids)); | |
| 112 | + } | |
| 113 | +} | ... | ... |
trash-unit/src/main/java/com/trash/gps/domain/GpsOrientation.java
0 → 100644
| 1 | +package com.trash.gps.domain; | |
| 2 | + | |
| 3 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
| 4 | +import org.apache.commons.lang3.builder.ToStringBuilder; | |
| 5 | +import org.apache.commons.lang3.builder.ToStringStyle; | |
| 6 | +import com.trash.common.annotation.Excel; | |
| 7 | +import com.trash.common.core.domain.BaseEntity; | |
| 8 | + | |
| 9 | +import java.util.Date; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * gps数据轨迹回放对象 gps_orientation_2023 | |
| 13 | + * | |
| 14 | + * @author trash | |
| 15 | + * @date 2023-12-13 | |
| 16 | + */ | |
| 17 | +public class GpsOrientation extends BaseEntity | |
| 18 | +{ | |
| 19 | + private static final long serialVersionUID = 1L; | |
| 20 | + | |
| 21 | + /** $column.columnComment */ | |
| 22 | + private Long id; | |
| 23 | + | |
| 24 | + /** 终端手机号 */ | |
| 25 | + @Excel(name = "终端手机号") | |
| 26 | + private String terminalNumber; | |
| 27 | + | |
| 28 | + /** 经度 */ | |
| 29 | + @Excel(name = "经度") | |
| 30 | + private String longitude; | |
| 31 | + | |
| 32 | + /** 纬度 */ | |
| 33 | + @Excel(name = "纬度") | |
| 34 | + private String latitude; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 表名后缀 | |
| 38 | + */ | |
| 39 | + private String yearMonth; | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 车牌号 | |
| 43 | + */ | |
| 44 | + private String carCode; | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 开始时间 | |
| 48 | + */ | |
| 49 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |
| 50 | + private String createTimeStart; | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * 结束时间 | |
| 54 | + */ | |
| 55 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |
| 56 | + private String createTimeEnd; | |
| 57 | + | |
| 58 | + public String getCreateTimeStart() { | |
| 59 | + return createTimeStart; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public void setCreateTimeStart(String createTimeStart) { | |
| 63 | + this.createTimeStart = createTimeStart; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public String getCreateTimeEnd() { | |
| 67 | + return createTimeEnd; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public void setCreateTimeEnd(String createTimeEnd) { | |
| 71 | + this.createTimeEnd = createTimeEnd; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public String getCarCode() { | |
| 75 | + return carCode; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public void setCarCode(String carCode) { | |
| 79 | + this.carCode = carCode; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public String getYearMonth() { | |
| 83 | + return yearMonth; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public void setYearMonth(String yearMonth) { | |
| 87 | + this.yearMonth = yearMonth; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public void setId(Long id) | |
| 91 | + { | |
| 92 | + this.id = id; | |
| 93 | + } | |
| 94 | + | |
| 95 | + public Long getId() | |
| 96 | + { | |
| 97 | + return id; | |
| 98 | + } | |
| 99 | + public void setTerminalNumber(String terminalNumber) | |
| 100 | + { | |
| 101 | + this.terminalNumber = terminalNumber; | |
| 102 | + } | |
| 103 | + | |
| 104 | + public String getTerminalNumber() | |
| 105 | + { | |
| 106 | + return terminalNumber; | |
| 107 | + } | |
| 108 | + public void setLongitude(String longitude) | |
| 109 | + { | |
| 110 | + this.longitude = longitude; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public String getLongitude() | |
| 114 | + { | |
| 115 | + return longitude; | |
| 116 | + } | |
| 117 | + public void setLatitude(String latitude) | |
| 118 | + { | |
| 119 | + this.latitude = latitude; | |
| 120 | + } | |
| 121 | + | |
| 122 | + public String getLatitude() | |
| 123 | + { | |
| 124 | + return latitude; | |
| 125 | + } | |
| 126 | + | |
| 127 | + @Override | |
| 128 | + public String toString() { | |
| 129 | + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |
| 130 | + .append("id", getId()) | |
| 131 | + .append("terminalNumber", getTerminalNumber()) | |
| 132 | + .append("longitude", getLongitude()) | |
| 133 | + .append("latitude", getLatitude()) | |
| 134 | + .append("createTime", getCreateTime()) | |
| 135 | + .toString(); | |
| 136 | + } | |
| 137 | +} | ... | ... |
trash-unit/src/main/java/com/trash/gps/mapper/GpsOrientationMapper.java
0 → 100644
| 1 | +package com.trash.gps.mapper; | |
| 2 | + | |
| 3 | +import com.trash.gps.domain.GpsOrientation; | |
| 4 | +import org.apache.ibatis.annotations.Param; | |
| 5 | + | |
| 6 | +import java.util.List; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * gps数据轨迹回放Mapper接口 | |
| 10 | + * | |
| 11 | + * @author trash | |
| 12 | + * @date 2023-12-13 | |
| 13 | + */ | |
| 14 | +public interface GpsOrientationMapper { | |
| 15 | + /** | |
| 16 | + * 查询gps数据轨迹回放 | |
| 17 | + * | |
| 18 | + * @param id gps数据轨迹回放ID | |
| 19 | + * @param year | |
| 20 | + * @return gps数据轨迹回放 | |
| 21 | + */ | |
| 22 | + GpsOrientation selectGpsOrientationById(Long id, String year); | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 查询gps数据轨迹回放列表 | |
| 26 | + * | |
| 27 | + * @param gpsOrientation gps数据轨迹回放 | |
| 28 | + * @return gps数据轨迹回放集合 | |
| 29 | + */ | |
| 30 | + List<GpsOrientation> selectGpsOrientationList(GpsOrientation gpsOrientation); | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 新增gps数据轨迹回放 | |
| 34 | + * | |
| 35 | + * @param gpsOrientation gps数据轨迹回放 | |
| 36 | + * @return 结果 | |
| 37 | + */ | |
| 38 | + int insertGpsOrientation(GpsOrientation gpsOrientation); | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 修改gps数据轨迹回放 | |
| 42 | + * | |
| 43 | + * @param gpsOrientation gps数据轨迹回放 | |
| 44 | + * @return 结果 | |
| 45 | + */ | |
| 46 | + int updateGpsOrientation(GpsOrientation gpsOrientation); | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 删除gps数据轨迹回放 | |
| 50 | + * | |
| 51 | + * @param id gps数据轨迹回放ID | |
| 52 | + * @return 结果 | |
| 53 | + */ | |
| 54 | + int deleteGpsOrientationById(Long id); | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 批量删除gps数据轨迹回放 | |
| 58 | + * | |
| 59 | + * @param ids 需要删除的数据ID | |
| 60 | + * @return 结果 | |
| 61 | + */ | |
| 62 | + int deleteGpsOrientationByIds(Long[] ids); | |
| 63 | + | |
| 64 | + | |
| 65 | + List<GpsOrientation> selectCarCodeList(String yearMonth); | |
| 66 | +} | ... | ... |
trash-unit/src/main/java/com/trash/gps/service/IGpsOrientationService.java
0 → 100644
| 1 | +package com.trash.gps.service; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import com.trash.gps.domain.GpsOrientation; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * gps数据轨迹回放Service接口 | |
| 8 | + * | |
| 9 | + * @author trash | |
| 10 | + * @date 2023-12-13 | |
| 11 | + */ | |
| 12 | +public interface IGpsOrientationService | |
| 13 | +{ | |
| 14 | + /** | |
| 15 | + * 查询gps数据轨迹回放 | |
| 16 | + * | |
| 17 | + * @param id gps数据轨迹回放ID | |
| 18 | + * @return gps数据轨迹回放 | |
| 19 | + */ | |
| 20 | + GpsOrientation selectGpsOrientationById(Long id,String year); | |
| 21 | + | |
| 22 | + List<GpsOrientation> selectCarCodeList(); | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 查询gps数据轨迹回放列表 | |
| 26 | + * | |
| 27 | + * @param gpsOrientation gps数据轨迹回放 | |
| 28 | + * @return gps数据轨迹回放集合 | |
| 29 | + */ | |
| 30 | + List<GpsOrientation> selectGpsOrientationList(GpsOrientation gpsOrientation); | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * 新增gps数据轨迹回放 | |
| 34 | + * | |
| 35 | + * @param gpsOrientation gps数据轨迹回放 | |
| 36 | + * @return 结果 | |
| 37 | + */ | |
| 38 | + int insertGpsOrientation(GpsOrientation gpsOrientation); | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 修改gps数据轨迹回放 | |
| 42 | + * | |
| 43 | + * @param gpsOrientation gps数据轨迹回放 | |
| 44 | + * @return 结果 | |
| 45 | + */ | |
| 46 | + int updateGpsOrientation(GpsOrientation gpsOrientation); | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 批量删除gps数据轨迹回放 | |
| 50 | + * | |
| 51 | + * @param ids 需要删除的gps数据轨迹回放ID | |
| 52 | + * @return 结果 | |
| 53 | + */ | |
| 54 | + int deleteGpsOrientationByIds(Long[] ids); | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 删除gps数据轨迹回放信息 | |
| 58 | + * | |
| 59 | + * @param id gps数据轨迹回放ID | |
| 60 | + * @return 结果 | |
| 61 | + */ | |
| 62 | + int deleteGpsOrientationById(Long id); | |
| 63 | +} | ... | ... |
trash-unit/src/main/java/com/trash/gps/service/impl/GpsOrientationServiceImpl.java
0 → 100644
| 1 | +package com.trash.gps.service.impl; | |
| 2 | + | |
| 3 | +import com.trash.carInfo.domain.CarInfo; | |
| 4 | +import com.trash.carInfo.domain.vo.CarInfoVo; | |
| 5 | +import com.trash.carInfo.mapper.CarInfoMapper; | |
| 6 | +import com.trash.common.utils.DateUtils; | |
| 7 | +import com.trash.gps.domain.GpsOrientation; | |
| 8 | +import com.trash.gps.mapper.GpsOrientationMapper; | |
| 9 | +import com.trash.gps.service.IGpsOrientationService; | |
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 11 | +import org.springframework.stereotype.Service; | |
| 12 | + | |
| 13 | +import java.text.SimpleDateFormat; | |
| 14 | +import java.util.Date; | |
| 15 | +import java.util.List; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * gps数据轨迹回放Service业务层处理 | |
| 19 | + * | |
| 20 | + * @author trash | |
| 21 | + * @date 2023-12-13 | |
| 22 | + */ | |
| 23 | +@Service | |
| 24 | +public class GpsOrientationServiceImpl implements IGpsOrientationService { | |
| 25 | + @Autowired | |
| 26 | + private GpsOrientationMapper gpsOrientationMapper; | |
| 27 | + @Autowired | |
| 28 | + private CarInfoMapper carInfoMapper; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 查询gps数据轨迹回放 | |
| 32 | + * | |
| 33 | + * @param id gps数据轨迹回放ID | |
| 34 | + * @return gps数据轨迹回放 | |
| 35 | + */ | |
| 36 | + @Override | |
| 37 | + public GpsOrientation selectGpsOrientationById(Long id, String year) { | |
| 38 | + return gpsOrientationMapper.selectGpsOrientationById(id, year); | |
| 39 | + } | |
| 40 | + | |
| 41 | + @Override | |
| 42 | + public List<GpsOrientation> selectCarCodeList() { | |
| 43 | + String yearMonth = DateUtils.parseDateToStr("yyyyMM", new Date()); | |
| 44 | + List<GpsOrientation> list = gpsOrientationMapper.selectCarCodeList(yearMonth); | |
| 45 | + List<CarInfoVo> carList = carInfoMapper.selectCarInfoList(null); | |
| 46 | + //剔除已经绑定的车辆 | |
| 47 | + for (CarInfoVo carInfoVo : carList) { | |
| 48 | + for (GpsOrientation gpsOrientation : list) { | |
| 49 | + if (carInfoVo.getCarEquipment().equals(gpsOrientation.getTerminalNumber())) { | |
| 50 | + list.remove(gpsOrientation); | |
| 51 | + break; | |
| 52 | + } | |
| 53 | + } | |
| 54 | + } | |
| 55 | + return list; | |
| 56 | + } | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * 查询gps数据轨迹回放列表 | |
| 60 | + * | |
| 61 | + * @param gpsOrientation gps数据轨迹回放 | |
| 62 | + * @return gps数据轨迹回放 | |
| 63 | + */ | |
| 64 | + @Override | |
| 65 | + public List<GpsOrientation> selectGpsOrientationList(GpsOrientation gpsOrientation) { | |
| 66 | + String startDate = gpsOrientation.getCreateTimeStart().substring(0,7).replace("-",""); | |
| 67 | + String endDate = gpsOrientation.getCreateTimeEnd().substring(0,7).replace("-",""); | |
| 68 | + gpsOrientation.setYearMonth(startDate); | |
| 69 | + //判断createTimeStart和createTimeEnd是否在同一个月,不在同一个月则跨表查询 | |
| 70 | + if (startDate.equals(endDate)) { | |
| 71 | + return gpsOrientationMapper.selectGpsOrientationList(gpsOrientation); | |
| 72 | + } else { | |
| 73 | + //先查开始时间月份数据 | |
| 74 | + List<GpsOrientation> list = gpsOrientationMapper.selectGpsOrientationList(gpsOrientation); | |
| 75 | + //再把结束时间月份数据查出来 | |
| 76 | + gpsOrientation.setYearMonth(endDate); | |
| 77 | + list.addAll(gpsOrientationMapper.selectGpsOrientationList(gpsOrientation)); | |
| 78 | + return list; | |
| 79 | + } | |
| 80 | + | |
| 81 | + } | |
| 82 | + | |
| 83 | + /** | |
| 84 | + * 新增gps数据轨迹回放 | |
| 85 | + * | |
| 86 | + * @param gpsOrientation gps数据轨迹回放 | |
| 87 | + * @return 结果 | |
| 88 | + */ | |
| 89 | + @Override | |
| 90 | + public int insertGpsOrientation(GpsOrientation gpsOrientation) { | |
| 91 | + gpsOrientation.setCreateTime(DateUtils.getNowDate()); | |
| 92 | + return gpsOrientationMapper.insertGpsOrientation(gpsOrientation); | |
| 93 | + } | |
| 94 | + | |
| 95 | + /** | |
| 96 | + * 修改gps数据轨迹回放 | |
| 97 | + * | |
| 98 | + * @param gpsOrientation gps数据轨迹回放 | |
| 99 | + * @return 结果 | |
| 100 | + */ | |
| 101 | + @Override | |
| 102 | + public int updateGpsOrientation(GpsOrientation gpsOrientation) { | |
| 103 | + return gpsOrientationMapper.updateGpsOrientation(gpsOrientation); | |
| 104 | + } | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * 批量删除gps数据轨迹回放 | |
| 108 | + * | |
| 109 | + * @param ids 需要删除的gps数据轨迹回放ID | |
| 110 | + * @return 结果 | |
| 111 | + */ | |
| 112 | + @Override | |
| 113 | + public int deleteGpsOrientationByIds(Long[] ids) { | |
| 114 | + return gpsOrientationMapper.deleteGpsOrientationByIds(ids); | |
| 115 | + } | |
| 116 | + | |
| 117 | + /** | |
| 118 | + * 删除gps数据轨迹回放信息 | |
| 119 | + * | |
| 120 | + * @param id gps数据轨迹回放ID | |
| 121 | + * @return 结果 | |
| 122 | + */ | |
| 123 | + @Override | |
| 124 | + public int deleteGpsOrientationById(Long id) { | |
| 125 | + return gpsOrientationMapper.deleteGpsOrientationById(id); | |
| 126 | + } | |
| 127 | +} | ... | ... |
trash-unit/src/main/resources/mapper/unit/GpsOrientationMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
| 2 | +<!DOCTYPE mapper | |
| 3 | +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
| 4 | +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 5 | +<mapper namespace="com.trash.gps.mapper.GpsOrientationMapper"> | |
| 6 | + | |
| 7 | + <resultMap type="GpsOrientation" id="GpsOrientationResult"> | |
| 8 | + <result property="id" column="id" /> | |
| 9 | + <result property="terminalNumber" column="terminal_number" /> | |
| 10 | + <result property="longitude" column="longitude" /> | |
| 11 | + <result property="latitude" column="latitude" /> | |
| 12 | + <result property="createTime" column="create_time" /> | |
| 13 | + <result property="carCode" column="car_code" /> | |
| 14 | + </resultMap> | |
| 15 | + | |
| 16 | + <sql id="selectGpsOrientationVo"> | |
| 17 | + select id, terminal_number, longitude, latitude, create_time,car_code from gps_orientation_${yearMonth} | |
| 18 | + </sql> | |
| 19 | + | |
| 20 | + <select id="selectGpsOrientationList" parameterType="GpsOrientation" resultMap="GpsOrientationResult"> | |
| 21 | + <include refid="selectGpsOrientationVo"/> | |
| 22 | + <where> | |
| 23 | + <if test="terminalNumber != null and terminalNumber != ''"> and terminal_number = #{terminalNumber}</if> | |
| 24 | + <if test="createTimeStart!=null and createTimeEnd!=null">create_time between #{createTimeStart} and #{createTimeEnd}</if> | |
| 25 | + <if test="carCode!=null and carCode != ''">and car_code = #{carCode}</if> | |
| 26 | + </where> | |
| 27 | + </select> | |
| 28 | + | |
| 29 | + <select id="selectGpsOrientationById" parameterType="Long" resultMap="GpsOrientationResult"> | |
| 30 | + <include refid="selectGpsOrientationVo"/> | |
| 31 | + where id = #{id} | |
| 32 | + </select> | |
| 33 | + | |
| 34 | + <insert id="insertGpsOrientation" parameterType="GpsOrientation" useGeneratedKeys="true" keyProperty="id"> | |
| 35 | + insert into gps_orientation_${yearMonth} | |
| 36 | + <trim prefix="(" suffix=")" suffixOverrides=","> | |
| 37 | + <if test="terminalNumber != null">terminal_number,</if> | |
| 38 | + <if test="longitude != null">longitude,</if> | |
| 39 | + <if test="latitude != null">latitude,</if> | |
| 40 | + <if test="createTime != null">create_time,</if> | |
| 41 | + <if test="carCode != null">car_code,</if> | |
| 42 | + </trim> | |
| 43 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | |
| 44 | + <if test="terminalNumber != null">#{terminalNumber},</if> | |
| 45 | + <if test="longitude != null">#{longitude},</if> | |
| 46 | + <if test="latitude != null">#{latitude},</if> | |
| 47 | + <if test="createTime != null">#{createTime},</if> | |
| 48 | + <if test="carCode != null">#{carCode},</if> | |
| 49 | + </trim> | |
| 50 | + </insert> | |
| 51 | + | |
| 52 | + <update id="updateGpsOrientation" parameterType="GpsOrientation"> | |
| 53 | + update gps_orientation_${yearMonth} | |
| 54 | + <trim prefix="SET" suffixOverrides=","> | |
| 55 | + <if test="terminalNumber != null">terminal_number = #{terminalNumber},</if> | |
| 56 | + <if test="longitude != null">longitude = #{longitude},</if> | |
| 57 | + <if test="latitude != null">latitude = #{latitude},</if> | |
| 58 | + <if test="createTime != null">create_time = #{createTime},</if> | |
| 59 | + <if test="carCode != null">car_code = #{carCode},</if> | |
| 60 | + </trim> | |
| 61 | + where id = #{id} | |
| 62 | + </update> | |
| 63 | + | |
| 64 | + <delete id="deleteGpsOrientationById" parameterType="Long"> | |
| 65 | + delete from gps_orientation_${yearMonth} where id = #{id} | |
| 66 | + </delete> | |
| 67 | + | |
| 68 | + <delete id="deleteGpsOrientationByIds" parameterType="String"> | |
| 69 | + delete from gps_orientation_${yearMonth} where id in | |
| 70 | + <foreach item="id" collection="array" open="(" separator="," close=")"> | |
| 71 | + #{id} | |
| 72 | + </foreach> | |
| 73 | + </delete> | |
| 74 | + | |
| 75 | + <select id="selectCarCodeList" parameterType="String" resultMap="GpsOrientationResult"> | |
| 76 | + select terminal_number,car_code from gps_orientation_${yearMonth} | |
| 77 | + group by terminal_number,car_code | |
| 78 | + </select> | |
| 79 | + | |
| 80 | +</mapper> | |
| 0 | 81 | \ No newline at end of file | ... | ... |