Compare commits
1 Commits
master
...
vehicle-xi
Author | SHA1 | Date |
---|---|---|
|
1a943c0ea1 |
|
@ -39,13 +39,10 @@ public class RealTimeDataController {
|
|||
|
||||
@PostMapping("/realTimeDataTwo/{vin}")
|
||||
public ResponseEntity<VehicleData> getRealTimeDataByVin(@PathVariable String vin) {
|
||||
|
||||
vehicleEventCache.addEvent(vin, VehicleEventConstants.SHI_SHI);
|
||||
|
||||
// 假设这里调用实时数据处理服务的某个方法来根据 VIN 获取实时数据
|
||||
// 根据 VIN 获取实时数据
|
||||
VehicleData realTimeData = realTimeDataEvent.getRealTimeDataByVin(vin);
|
||||
System.out.println("VIN为" + vin + "的实时数据为:" + realTimeData);
|
||||
// 实现这个方法需要根据你的具体业务逻辑
|
||||
// 返回实时数据
|
||||
return ResponseEntity.ok().body(realTimeData);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public class FenceAlarmImpl implements VehicleService {
|
|||
|
||||
Car car =vehicleMapper.selectCarList(vin);
|
||||
|
||||
String carFenceId = car.getCarFenceId();
|
||||
String carFenceId = car.getCarMarking();
|
||||
|
||||
String[] split1 = carFenceId.split(",");
|
||||
|
||||
|
|
|
@ -42,9 +42,9 @@ public class Car {
|
|||
*/
|
||||
private String carType;
|
||||
/**
|
||||
* 电子围栏ID
|
||||
* 车辆标识
|
||||
*/
|
||||
private String carFenceId;
|
||||
private String carMarking;
|
||||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
|
@ -92,7 +92,7 @@ public class Car {
|
|||
return Car.builder()
|
||||
.carVin(carAddReq.getCarVin())
|
||||
.carType(carAddReq.getCarType())
|
||||
.carFenceId(carAddReq.getCarFenceId())
|
||||
.carMarking(carAddReq.getCarMarking())
|
||||
.state(carAddReq.getState())
|
||||
.carElectricalmachiney(carAddReq.getCarElectricalmachiney())
|
||||
.carBattery(carAddReq.getCarBattery())
|
||||
|
@ -107,7 +107,7 @@ public class Car {
|
|||
.carId(carUpdateReq.getCarId())
|
||||
.carVin(carUpdateReq.getCarVin())
|
||||
.carType(carUpdateReq.getCarType())
|
||||
.carFenceId(carUpdateReq.getCarFenceId())
|
||||
.carMarking(carUpdateReq.getCarMarking())
|
||||
.state(carUpdateReq.getState())
|
||||
.carElectricalmachiney(carUpdateReq.getCarElectricalmachiney())
|
||||
.carBattery(carUpdateReq.getCarBattery())
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package com.muyu.system.common.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 标识表 marking
|
||||
* @ProjectName: cloud-vehicles
|
||||
* @PackageName: com.muyu.system.common.domain
|
||||
* @Description TODO
|
||||
* @Author XiaoFan
|
||||
* @Date 2024/4/10 19:58
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Marking {
|
||||
/**
|
||||
* 标识ID
|
||||
*/
|
||||
private Integer markingId;
|
||||
/**
|
||||
* 标识名称
|
||||
*/
|
||||
private String markingName;
|
||||
/**
|
||||
* 电子围栏ID
|
||||
*/
|
||||
private String markingFenceIds;
|
||||
}
|
|
@ -39,12 +39,12 @@ public class CarAddReq {
|
|||
@ApiModelProperty(value = "车辆类型")
|
||||
private String carType;
|
||||
/**
|
||||
* 电子围栏ID
|
||||
* 车辆标识
|
||||
*/
|
||||
@NotNull
|
||||
@Length(max = 255)
|
||||
@ApiModelProperty(value = "电子围栏ID")
|
||||
private String carFenceId;
|
||||
@ApiModelProperty(value = "车辆标识")
|
||||
private String carMarking;
|
||||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
|
|
|
@ -46,12 +46,12 @@ public class CarUpdateReq {
|
|||
@ApiModelProperty(value = "车辆类型")
|
||||
private String carType;
|
||||
/**
|
||||
* 电子围栏ID
|
||||
* 车辆标识
|
||||
*/
|
||||
@NotNull
|
||||
@Length(max = 255)
|
||||
@ApiModelProperty(value = "电子围栏ID")
|
||||
private String carFenceId;
|
||||
@ApiModelProperty(value = "车辆标识")
|
||||
private String carMarking;
|
||||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.muyu.common.core.domain.Result;
|
|||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.system.common.domain.Car;
|
||||
import com.muyu.business.domain.Fence;
|
||||
import com.muyu.system.common.domain.Marking;
|
||||
import com.muyu.system.common.domain.req.CarAddReq;
|
||||
import com.muyu.system.common.domain.req.CarUpdateReq;
|
||||
import com.muyu.system.common.domain.vo.CarVo;
|
||||
|
@ -118,6 +119,19 @@ public class CarController extends BaseController
|
|||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询标识表
|
||||
*/
|
||||
@GetMapping("selectMarking")
|
||||
@RequiresPermissions("system:car:query")
|
||||
@Log(title = "查询标识表")
|
||||
public Result<List<Marking>> selectMarking(){
|
||||
List<Marking> list=carService.selectMarking();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 车辆上线(连接车联模拟数据)
|
||||
* @param carVin
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.system.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.system.common.domain.Car;
|
||||
import com.muyu.business.domain.Fence;
|
||||
import com.muyu.system.common.domain.Marking;
|
||||
import com.muyu.system.common.domain.req.CarInfoAddReq;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -59,4 +60,8 @@ public interface CarMapper extends BaseMapper<Car>
|
|||
|
||||
|
||||
int deleteByVin(String carVin);
|
||||
|
||||
List<Marking> selectMarking();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.muyu.common.core.domain.PageResult;
|
|||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.system.common.domain.Car;
|
||||
import com.muyu.business.domain.Fence;
|
||||
import com.muyu.system.common.domain.Marking;
|
||||
import com.muyu.system.common.domain.vo.CarVo;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -70,4 +71,6 @@ public interface CarService extends IService<Car>
|
|||
int deleteByVin(String carVin);
|
||||
|
||||
|
||||
List<Marking> selectMarking();
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.muyu.common.security.utils.SecurityUtils;
|
|||
import com.muyu.system.common.VehicleCreateAddReq;
|
||||
import com.muyu.system.common.domain.Car;
|
||||
import com.muyu.business.domain.Fence;
|
||||
import com.muyu.system.common.domain.Marking;
|
||||
import com.muyu.system.common.domain.req.CarInfoAddReq;
|
||||
import com.muyu.system.common.domain.vo.CarVo;
|
||||
import com.muyu.system.feign.RecordsFeign;
|
||||
|
@ -136,7 +137,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper,Car> implements CarSer
|
|||
//使用RestTemplate发送post请求
|
||||
Result<String> result=restTemplate.postForObject(url,vehicleCreateAddReq,Result.class);
|
||||
|
||||
if (null!=car.getCarFenceId()){
|
||||
if (null!=car.getCarMarking()){
|
||||
|
||||
// redisTemplate.opsForSet().add(car.getCarVin(),"fenceAlarm");
|
||||
|
||||
|
@ -168,7 +169,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper,Car> implements CarSer
|
|||
car.setUpdateTime(DateUtils.getNowDate());
|
||||
|
||||
|
||||
if (null!=car.getCarFenceId()){
|
||||
if (null!=car.getCarMarking()){
|
||||
vehicleEventCache.addEvent(car.getCarVin(), VehicleEventConstants.WEI_LAN);
|
||||
|
||||
}else {
|
||||
|
@ -279,16 +280,13 @@ public class CarServiceImpl extends ServiceImpl<CarMapper,Car> implements CarSer
|
|||
public int deleteByVin(String carVin) {
|
||||
String url="http://127.0.0.1:81/vehicle/" +carVin;
|
||||
restTemplate.delete(url);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return carMapper.deleteByVin(carVin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Marking> selectMarking() {
|
||||
return carMapper.selectMarking();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<mapper namespace="com.muyu.system.mapper.CarMapper">
|
||||
|
||||
<sql id="list">
|
||||
select car_id,car_vin,car_type,car_fence_id,state,
|
||||
select car_id,car_vin,car_type,car_marking,state,
|
||||
car_electricalmachiney,car_battery,
|
||||
car_electricalmachiney_id,car_battery_id,
|
||||
create_by,create_time,update_by,update_time,
|
||||
|
@ -48,4 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectFenceList" resultType="com.muyu.business.domain.Fence">
|
||||
select * from fence where fence_state=0
|
||||
</select>
|
||||
<select id="selectMarking" resultType="com.muyu.system.common.domain.Marking">
|
||||
select marking_id,marking_name from marking
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue