|
|
@@ -188,27 +188,6 @@ public class LandVehicleServiceImpl extends ServiceImpl<LandVehicleMapper, LandV
|
|
|
if (StringUtil.isBlank(excel.getPlateNo())) {
|
|
|
throw new SecurityException("第" + (i + 1) + "行数据异常,车号不能为空");
|
|
|
}
|
|
|
- if (StringUtil.isBlank(excel.getTowModel())){
|
|
|
- throw new SecurityException("第" + (i + 1) + "行数据异常,牵引车辆型号不能为空");
|
|
|
- }
|
|
|
- if (ObjectUtil.isEmpty(excel.getRegisterDate())){
|
|
|
- throw new SecurityException("第" + (i + 1) + "行数据异常,注册日期不能为空");
|
|
|
- }
|
|
|
- if (StringUtil.isBlank(excel.getEngineModel())){
|
|
|
- throw new SecurityException("第" + (i + 1) + "行数据异常,发动机型号不能为空");
|
|
|
- }
|
|
|
- if (StringUtil.isBlank(excel.getTowVin())){
|
|
|
- throw new SecurityException("第" + (i + 1) + "行数据异常,牵引车车架号不能为空");
|
|
|
- }
|
|
|
- if (ObjectUtil.isEmpty(excel.getTransferDate())){
|
|
|
- throw new SecurityException("第" + (i + 1) + "行数据异常,过户日期不能为空");
|
|
|
- }
|
|
|
- if (ObjectUtil.isEmpty(excel.getApprovedWeight())){
|
|
|
- throw new SecurityException("第" + (i + 1) + "行数据异常,核定重量不能为空");
|
|
|
- }
|
|
|
- if (ObjectUtil.isEmpty(excel.getEquipmentWeight())){
|
|
|
- throw new SecurityException("第" + (i + 1) + "行数据异常,装备重量不能为空");
|
|
|
- }
|
|
|
|
|
|
/*Integer count = baseMapper.selectCount(new LambdaQueryWrapper<LandVehicle>()
|
|
|
.eq(LandVehicle::getPlateNo, excel.getPlateNo())
|
|
|
@@ -249,11 +228,28 @@ public class LandVehicleServiceImpl extends ServiceImpl<LandVehicleMapper, LandV
|
|
|
|
|
|
LandVehicle vehicle = BeanUtil.copy(excel, LandVehicle.class);
|
|
|
if (!ObjectUtil.isEmpty(vehicle)) {
|
|
|
- vehicle.setFleetId(fleetId);
|
|
|
- vehicle.setDriverId(driverId);
|
|
|
- vehicle.setCreateUser(AuthUtil.getUserId());
|
|
|
- vehicle.setCreateTime(new Date());
|
|
|
- baseMapper.insert(vehicle);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<LandVehicle> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(LandVehicle::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(LandVehicle::getIsDeleted, 0)
|
|
|
+ .eq(LandVehicle::getFleetId, fleetId)
|
|
|
+ .eq(LandVehicle::getDriverId, driverId)
|
|
|
+ .eq(LandVehicle::getPlateNo, vehicle.getPlateNo());
|
|
|
+
|
|
|
+ LandVehicle landVehicle = baseMapper.selectOne(lambdaQueryWrapper);
|
|
|
+
|
|
|
+ if (ObjectUtil.isNotEmpty(landVehicle)){
|
|
|
+ vehicle.setId(landVehicle.getId());
|
|
|
+ vehicle.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ vehicle.setUpdateTime(new Date());
|
|
|
+ baseMapper.updateById(vehicle);
|
|
|
+ }else {
|
|
|
+ vehicle.setFleetId(fleetId);
|
|
|
+ vehicle.setDriverId(driverId);
|
|
|
+ vehicle.setCreateUser(AuthUtil.getUserId());
|
|
|
+ vehicle.setCreateTime(new Date());
|
|
|
+ baseMapper.insert(vehicle);
|
|
|
+ }
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(driverId)) {
|
|
|
LandVehicleChange vehicleChange = new LandVehicleChange();
|