master
parent
7eadec0bd7
commit
547fbbbd28
1
pom.xml
1
pom.xml
|
@ -9,7 +9,6 @@
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>com.dragon</groupId>
|
|
||||||
<artifactId>dragon-vehicle-history</artifactId>
|
<artifactId>dragon-vehicle-history</artifactId>
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
|
@ -8,6 +8,8 @@ import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Wenkang Tang
|
* @author Wenkang Tang
|
||||||
* @date 2023/11/20 19:26
|
* @date 2023/11/20 19:26
|
||||||
|
|
|
@ -216,15 +216,17 @@ public class VehicleOperation {
|
||||||
*/
|
*/
|
||||||
private Integer chgStatus;
|
private Integer chgStatus;
|
||||||
/**
|
/**
|
||||||
* 车辆状态 报文
|
* 逻辑删除 0-否 1-是
|
||||||
*/
|
*/
|
||||||
private String vehicleStatusMsg;
|
private Integer isDelete;
|
||||||
/**
|
/**
|
||||||
* 智能硬件 报文
|
* 开始时间
|
||||||
*/
|
*/
|
||||||
private String smartHardwareMsg;
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date startTime;
|
||||||
/**
|
/**
|
||||||
* 电池报文
|
* 结束时间
|
||||||
*/
|
*/
|
||||||
private String batteryMsg;
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date endTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.dragon.vehicle.history.common.domain.req;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Wenkang Tang
|
||||||
|
* @date 2023/11/29 14:46
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class HistoryReq {
|
||||||
|
/**
|
||||||
|
* 当前页数
|
||||||
|
*/
|
||||||
|
private Integer pageNum=1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每页条数
|
||||||
|
*/
|
||||||
|
private Integer pageSize=10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆VIN
|
||||||
|
*/
|
||||||
|
private String carVin;
|
||||||
|
}
|
|
@ -22,6 +22,7 @@
|
||||||
<artifactId>vehicle-history-common</artifactId>
|
<artifactId>vehicle-history-common</artifactId>
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Nacos -->
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package com.dragon.vehicle.history.server.controller;
|
package com.dragon.vehicle.history.server.controller;
|
||||||
|
|
||||||
|
import com.dragon.common.core.domain.Result;
|
||||||
|
import com.dragon.vehicle.history.common.domain.VehicleOperation;
|
||||||
|
import com.dragon.vehicle.history.common.domain.req.HistoryReq;
|
||||||
import com.dragon.vehicle.history.server.service.HistoricalTrackService;
|
import com.dragon.vehicle.history.server.service.HistoricalTrackService;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -17,5 +20,23 @@ public class HistoricalTrackController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private HistoricalTrackService historicalTrackService;
|
private HistoricalTrackService historicalTrackService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 历史轨迹列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/listHistoricalTrack")
|
||||||
|
public Result<List<VehicleOperation>> listHistoricalTrack(@RequestBody HistoryReq historyReq) {
|
||||||
|
return Result.success(historicalTrackService.listHistoricalTrack(historyReq));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除历史轨迹
|
||||||
|
* @param vin
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/delHistoricalTrack")
|
||||||
|
public Result delHistoricalTrack(@RequestParam String vin){
|
||||||
|
historicalTrackService.delHistoricalTrack(vin);
|
||||||
|
return Result.success("删除成功!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.dragon.vehicle.history.server.controller;
|
||||||
|
|
||||||
|
import com.dragon.common.core.domain.Result;
|
||||||
|
import com.dragon.vehicle.history.common.domain.VehicleOperation;
|
||||||
|
import com.dragon.vehicle.history.common.domain.req.ReqCar;
|
||||||
|
import com.dragon.vehicle.history.server.service.LatestTrackService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Wenkang Tang
|
||||||
|
* @date 2023/11/29 15:05
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/latest")
|
||||||
|
public class LatestTrackController {
|
||||||
|
@Autowired
|
||||||
|
private LatestTrackService latestTrackService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实时轨迹
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/listLatestTrack")
|
||||||
|
public Result<List<VehicleOperation>> listLatestTrack() {
|
||||||
|
return Result.success(latestTrackService.listLatestTrack());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.dragon.vehicle.history.server.mapper;
|
||||||
|
|
||||||
|
import com.dragon.vehicle.history.common.domain.VehicleOperation;
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Wenkang Tang
|
||||||
|
* @date 2023/11/29 15:07
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface LatestTrackMapper extends MPJBaseMapper<VehicleOperation> {
|
||||||
|
}
|
|
@ -1,8 +1,24 @@
|
||||||
package com.dragon.vehicle.history.server.service;
|
package com.dragon.vehicle.history.server.service;
|
||||||
|
|
||||||
|
import com.dragon.vehicle.history.common.domain.VehicleOperation;
|
||||||
|
import com.dragon.vehicle.history.common.domain.req.HistoryReq;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Wenkang Tang
|
* @author Wenkang Tang
|
||||||
* @date 2023/11/19 19:55
|
* @date 2023/11/19 19:55
|
||||||
*/
|
*/
|
||||||
public interface HistoricalTrackService {
|
public interface HistoricalTrackService {
|
||||||
|
/**
|
||||||
|
* 历史轨迹列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<VehicleOperation> listHistoricalTrack(HistoryReq historyReq);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除历史轨迹
|
||||||
|
* @param vin
|
||||||
|
*/
|
||||||
|
void delHistoricalTrack(String vin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.dragon.vehicle.history.server.service;
|
||||||
|
|
||||||
|
import com.dragon.vehicle.history.common.domain.VehicleOperation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Wenkang Tang
|
||||||
|
* @date 2023/11/29 15:06
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
public interface LatestTrackService {
|
||||||
|
/**
|
||||||
|
* 实时轨迹
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<VehicleOperation> listLatestTrack();
|
||||||
|
}
|
|
@ -1,10 +1,17 @@
|
||||||
package com.dragon.vehicle.history.server.service.impl;
|
package com.dragon.vehicle.history.server.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.dragon.vehicle.history.common.domain.VehicleOperation;
|
||||||
|
import com.dragon.vehicle.history.common.domain.req.HistoryReq;
|
||||||
import com.dragon.vehicle.history.server.mapper.HistoricalTrackMapper;
|
import com.dragon.vehicle.history.server.mapper.HistoricalTrackMapper;
|
||||||
import com.dragon.vehicle.history.server.service.HistoricalTrackService;
|
import com.dragon.vehicle.history.server.service.HistoricalTrackService;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Wenkang Tang
|
* @author Wenkang Tang
|
||||||
* @date 2023/11/19 19:55
|
* @date 2023/11/19 19:55
|
||||||
|
@ -14,4 +21,31 @@ public class HistoricalTrackServiceImpl implements HistoricalTrackService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private HistoricalTrackMapper historicalTrackMapper;
|
private HistoricalTrackMapper historicalTrackMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 历史轨迹列表
|
||||||
|
*
|
||||||
|
* @param historyReq 历史轨迹请求对象
|
||||||
|
* @return 历史轨迹列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<VehicleOperation> listHistoricalTrack(HistoryReq historyReq) {
|
||||||
|
Page<VehicleOperation> page = new Page<>(historyReq.getPageNum(), historyReq.getPageSize());
|
||||||
|
return historicalTrackMapper.selectJoinPage(page, VehicleOperation.class, new MPJLambdaWrapper<VehicleOperation>()
|
||||||
|
.selectAll(VehicleOperation.class)
|
||||||
|
.eq(historyReq.getCarVin() != null, VehicleOperation::getVin, historyReq.getCarVin()))
|
||||||
|
.getRecords();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除历史轨迹
|
||||||
|
*
|
||||||
|
* @param vin
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void delHistoricalTrack(String vin) {
|
||||||
|
LambdaUpdateWrapper<VehicleOperation> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
LambdaUpdateWrapper<VehicleOperation> wrapper = updateWrapper.eq(VehicleOperation::getVin, vin);
|
||||||
|
historicalTrackMapper.delete(wrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.dragon.vehicle.history.server.service.impl;
|
||||||
|
|
||||||
|
import com.dragon.vehicle.history.common.domain.VehicleOperation;
|
||||||
|
import com.dragon.vehicle.history.server.mapper.LatestTrackMapper;
|
||||||
|
import com.dragon.vehicle.history.server.service.LatestTrackService;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Wenkang Tang
|
||||||
|
* @date 2023/11/29 15:06
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class LatestTrackServiceImpl implements LatestTrackService {
|
||||||
|
@Autowired
|
||||||
|
private LatestTrackMapper latestTrackMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实时轨迹
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<VehicleOperation> listLatestTrack() {
|
||||||
|
return latestTrackMapper.selectList(new MPJLambdaWrapper<VehicleOperation>().selectAll(VehicleOperation.class));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue