Commit 699de055 by 刘宇峰

线上bug处理-旧e盾同步车辆设置设备为试驾设备

1 parent 0e1ae6e5
...@@ -51,12 +51,12 @@ public final class ConstantsDevice { ...@@ -51,12 +51,12 @@ public final class ConstantsDevice {
/** /**
* 试驾设备类型 0:非试驾设备 * 试驾设备类型 0:非试驾设备
*/ */
public static final int NOT_TRIAL_DEVICE_STATUS = 0; public static final int NOT_TRIAL_DEVICE_TYPE = 0;
/** /**
* 试驾设备类型 1:试驾设备 * 试驾设备类型 1:试驾设备
*/ */
public static final int TRIAL_DEVICE_STATUS = 1; public static final int TRIAL_DEVICE_TYPE = 1;
/** /**
* 删除标记 0=正常 -1=删除 * 删除标记 0=正常 -1=删除
......
...@@ -71,9 +71,28 @@ public class VehicleDeviceService { ...@@ -71,9 +71,28 @@ public class VehicleDeviceService {
*/ */
public void saveSnToVehicleId(String sn, Long vehicleId, Long userId) { public void saveSnToVehicleId(String sn, Long vehicleId, Long userId) {
VehicleDevice vehicleDevice = new VehicleDevice(); VehicleDevice vehicleDevice = new VehicleDevice();
vehicleDevice.setVehicleId(vehicleId);
vehicleDevice.setSn(sn); vehicleDevice.setSn(sn);
vehicleDevice.setBindStatus(ConstantsDevice.BIND_VEHICLE_STATUS); vehicleDevice.setBindStatus(ConstantsDevice.BIND_VEHICLE_STATUS);
vehicleDevice.setTrialType(ConstantsDevice.NOT_TRIAL_DEVICE_TYPE);
vehicleDevice.setCreatedBy(userId);
vehicleDevice.setCreatedDate(new Date());
vehicleDeviceMapper.insertSelective(vehicleDevice);
}
/**
* 保存车辆设备绑定关系
*
* @param sn
* @param vehicleId
* @param userId
*/
public void syncSnToVehicleId(String sn, Long vehicleId, Long userId) {
VehicleDevice vehicleDevice = new VehicleDevice();
vehicleDevice.setVehicleId(vehicleId); vehicleDevice.setVehicleId(vehicleId);
vehicleDevice.setSn(sn);
vehicleDevice.setBindStatus(ConstantsDevice.BIND_VEHICLE_STATUS);
vehicleDevice.setTrialType(ConstantsDevice.TRIAL_DEVICE_TYPE);
vehicleDevice.setCreatedBy(userId); vehicleDevice.setCreatedBy(userId);
vehicleDevice.setCreatedDate(new Date()); vehicleDevice.setCreatedDate(new Date());
vehicleDeviceMapper.insertSelective(vehicleDevice); vehicleDeviceMapper.insertSelective(vehicleDevice);
...@@ -153,7 +172,7 @@ public class VehicleDeviceService { ...@@ -153,7 +172,7 @@ public class VehicleDeviceService {
VehicleDevice param = new VehicleDevice(); VehicleDevice param = new VehicleDevice();
param.setSn(sn); param.setSn(sn);
param.setBindStatus(ConstantsDevice.BIND_VEHICLE_STATUS); param.setBindStatus(ConstantsDevice.BIND_VEHICLE_STATUS);
param.setTrialType(ConstantsDevice.TRIAL_DEVICE_STATUS); param.setTrialType(ConstantsDevice.TRIAL_DEVICE_TYPE);
param.setDelFlag(ConstantsDevice.NOT_DEL_FLAG); param.setDelFlag(ConstantsDevice.NOT_DEL_FLAG);
return vehicleDeviceMapper.selectOne(param); return vehicleDeviceMapper.selectOne(param);
} }
...@@ -168,7 +187,7 @@ public class VehicleDeviceService { ...@@ -168,7 +187,7 @@ public class VehicleDeviceService {
VehicleDevice param = new VehicleDevice(); VehicleDevice param = new VehicleDevice();
param.setSn(sn); param.setSn(sn);
param.setBindStatus(ConstantsDevice.BIND_VEHICLE_STATUS); param.setBindStatus(ConstantsDevice.BIND_VEHICLE_STATUS);
param.setTrialType(ConstantsDevice.NOT_TRIAL_DEVICE_STATUS); param.setTrialType(ConstantsDevice.NOT_TRIAL_DEVICE_TYPE);
param.setDelFlag(ConstantsDevice.NOT_DEL_FLAG); param.setDelFlag(ConstantsDevice.NOT_DEL_FLAG);
return vehicleDeviceMapper.selectOne(param); return vehicleDeviceMapper.selectOne(param);
} }
...@@ -183,7 +202,7 @@ public class VehicleDeviceService { ...@@ -183,7 +202,7 @@ public class VehicleDeviceService {
VehicleDevice param = new VehicleDevice(); VehicleDevice param = new VehicleDevice();
param.setVehicleId(vehicleId); param.setVehicleId(vehicleId);
param.setBindStatus(ConstantsDevice.BIND_VEHICLE_STATUS); param.setBindStatus(ConstantsDevice.BIND_VEHICLE_STATUS);
param.setTrialType(ConstantsDevice.TRIAL_DEVICE_STATUS); param.setTrialType(ConstantsDevice.TRIAL_DEVICE_TYPE);
param.setDelFlag(ConstantsDevice.NOT_DEL_FLAG); param.setDelFlag(ConstantsDevice.NOT_DEL_FLAG);
//匹配设备 //匹配设备
return vehicleDeviceMapper.select(param); return vehicleDeviceMapper.select(param);
......
...@@ -460,7 +460,7 @@ public class VehicleService { ...@@ -460,7 +460,7 @@ public class VehicleService {
vehicleDevice.setUpdatedDate(new Date()); vehicleDevice.setUpdatedDate(new Date());
vehicleDevice.setUpdatedBy(ShieldContextHolder.getUserId()); vehicleDevice.setUpdatedBy(ShieldContextHolder.getUserId());
//试驾设备标记为非试驾设备 //试驾设备标记为非试驾设备
vehicleDevice.setTrialType(ConstantsDevice.NOT_TRIAL_DEVICE_STATUS); vehicleDevice.setTrialType(ConstantsDevice.NOT_TRIAL_DEVICE_TYPE);
vehicleDeviceService.updateByPrimaryKey(vehicleDevice); vehicleDeviceService.updateByPrimaryKey(vehicleDevice);
// 同步设备给试驾围栏 // 同步设备给试驾围栏
...@@ -680,7 +680,7 @@ public class VehicleService { ...@@ -680,7 +680,7 @@ public class VehicleService {
} }
//绑定 //绑定
log.info("将设备sn:" + sn + "绑定至vehicleId:" + vehicleId); log.info("将设备sn:" + sn + "绑定至vehicleId:" + vehicleId);
vehicleDeviceService.saveSnToVehicleId(sn, vehicleId, createId); vehicleDeviceService.syncSnToVehicleId(sn, vehicleId, createId);
} }
/** /**
...@@ -1430,7 +1430,7 @@ public class VehicleService { ...@@ -1430,7 +1430,7 @@ public class VehicleService {
VehicleDevice vehicleDevice = vehicleDeviceService.getNotTrialDeviceBySn(testVehicleBo.getSn()); VehicleDevice vehicleDevice = vehicleDeviceService.getNotTrialDeviceBySn(testVehicleBo.getSn());
if (vehicleDevice != null) { if (vehicleDevice != null) {
log.info("修改设备为试驾设备===" + testVehicleBo.getSn()); log.info("修改设备为试驾设备===" + testVehicleBo.getSn());
vehicleDevice.setTrialType(ConstantsDevice.TRIAL_DEVICE_STATUS); vehicleDevice.setTrialType(ConstantsDevice.TRIAL_DEVICE_TYPE);
vehicleDevice.setUpdatedDate(new Date()); vehicleDevice.setUpdatedDate(new Date());
vehicleDevice.setUpdatedBy(ShieldContextHolder.getUserId()); vehicleDevice.setUpdatedBy(ShieldContextHolder.getUserId());
vehicleDeviceService.updateByPrimaryKey(vehicleDevice); vehicleDeviceService.updateByPrimaryKey(vehicleDevice);
...@@ -1595,7 +1595,7 @@ public class VehicleService { ...@@ -1595,7 +1595,7 @@ public class VehicleService {
vehicleDevice.setUpdatedDate(new Date()); vehicleDevice.setUpdatedDate(new Date());
vehicleDevice.setUpdatedBy(ShieldContextHolder.getUserId()); vehicleDevice.setUpdatedBy(ShieldContextHolder.getUserId());
vehicleDevice.setBindStatus(ConstantsDevice.UN_BIND_VEHICLE_STATUS); vehicleDevice.setBindStatus(ConstantsDevice.UN_BIND_VEHICLE_STATUS);
vehicleDevice.setTrialType(ConstantsDevice.NOT_TRIAL_DEVICE_STATUS); vehicleDevice.setTrialType(ConstantsDevice.NOT_TRIAL_DEVICE_TYPE);
vehicleDevice.setDelFlag(Constants.DELETE_FLAG); vehicleDevice.setDelFlag(Constants.DELETE_FLAG);
vehicleDeviceService.updateByPrimaryKey(vehicleDevice); vehicleDeviceService.updateByPrimaryKey(vehicleDevice);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!