车辆信息管理数据更新

master
shaowenhao 2023-11-27 14:28:48 +08:00
parent 127b55f11f
commit 075dbffcfc
9 changed files with 262 additions and 59 deletions

View File

@ -0,0 +1,39 @@
package com.god.base.server.common.domainConstants;
/**
* Hbase
*/
public class HBaseConstant {
/**
*
*/
public static final String HBASE_TABLE_NAME = "vehicle_info";
/**
*
*/
public static final String HBASE_TABLE_PREFIX = "vehicle_info_";
}

View File

@ -0,0 +1,38 @@
package com.god.base.server.common.domainConstants;
/**
* RabbitMQ
* @ClassName RabbitConstant
*/
public class RabbitConstant {
/**
*
*/
public static final String FAULT_HANDLER_QUEUE = "fault_handler_queue";
/**
*
*/
public static final String FENCE_HANDLER_QUEUE = "fence_handler_queue";
}

View File

@ -0,0 +1,13 @@
package com.god.base.server.common.domainConstants;
/**
* TimeConstant
*
*/
public class TimeConstant {
/**
*
*/
public static final Integer DAY_MILLISECOND = 86400000;
}

View File

@ -0,0 +1,88 @@
package com.god.base.server.common.domainConstants;
/**
* @ClassName VehicleConstant
* @Author WenHao.Sao
*/
public class VehicleConstant {
/**
*
*/
public static final String DATA_PACK_SEPARATOR = "#$&*";
/**
*
*/
public static final String MSG_START = "7E";
/**
*
*/
public static final String MSG_END= "7E";
/**
* vin
*/
public static final String START_VIN_SUF = "START_VIN";
/**
* VIN
*/
public static final String START_VIN_SUCCESS_SUF = "SUCCESS_CIN:";
/**
*
*/
public static final String VEHICLE_MSG_SUF = "VEHICLE_MSG:";
/**
*
*/
public static final String VEHICLE_STOP_SUF = "VEHICLE_STOP:";
/**
*
*/
public static final String NETTY_CONNECT = "CONNECT";
/**
*
*/
public static final String NETTY_WILL_CLOSE = "CLOSE";
// public static final String
//
// public static final String
//
// public static final String
//
// public static final String
//
// public static final String
//
// public static final String
//
// public static final String
}

View File

@ -4,12 +4,12 @@ import com.alibaba.fastjson.JSONObject;
import com.god.base.server.common.domain.Car;
import com.god.base.server.common.domain.VehicleMessage;
import com.god.base.server.common.domain.request.CarRequest;
import com.god.base.server.mapper.CarMapper;
import com.god.base.server.service.CarService;
import com.god.base.server.util.AopConfig;
import com.god.common.core.domain.Result;
import com.god.common.core.utils.poi.ExcelUtil;
import com.god.common.core.web.controller.BaseController;
import com.god.common.core.web.page.TableDataInfo;
import com.god.common.log.annotation.Log;
import com.god.common.log.enums.BusinessType;
import com.god.common.security.annotation.RequiresPermissions;
@ -39,18 +39,20 @@ public class CarController extends BaseController {
@Autowired
private AopConfig aopConfig;
@Autowired
private CarMapper carMapper;
/**
*
* vin
*/
@RequiresPermissions
@GetMapping("/list")
public Result<TableDataInfo<Car>> list(@RequestBody CarRequest carRequest){
@GetMapping("/list/{vinId}")
public Result<Car> list(@PathVariable String vinId){
startPage();//设置请求分页数据
List<Car> list = carService.selectCarInfoList(carRequest);
Car list = carService.selectCarInfoList(vinId);
return getDataTable(list);
return Result.success(list);
}
/**
@ -93,7 +95,7 @@ public class CarController extends BaseController {
*/
@Log(title = "车辆信息管理" , businessType = BusinessType.UPDATE) //修改
@PostMapping("/updCar")
public Result<Car> updCar(@PathVariable @Validated Car car){
public Result updCar(@PathVariable @Validated Car car){
log.info("功能介绍修改车辆,请求方式:{},请求路径:{},请求参数:{}",
request.getMethod(),
request.getRequestURL(),
@ -138,7 +140,7 @@ public class CarController extends BaseController {
@PostMapping("/export")
public void export(HttpServletResponse response , Car car , CarRequest carRequest)
{
List<Car> list = carService.selectCarInfoList(carRequest);
List<Car> list = carMapper.getList((int) car.getUserId());
ExcelUtil<Car> util = new ExcelUtil<>(Car.class);
//对list数据源将其里面的数据导入到excel表单
util.exportExcel(response,list,"车辆信息管理");

View File

@ -32,17 +32,25 @@ public interface CarMapper extends BaseMapper<Car> {
"\tJOIN t_car_type ON t_car.car_type_id = t_car_type.id where t_car.user_id = #{userId1}")
List<Car> getList(@Param("userId1") int userId);
@Select("select * from t_car where 1=1 " +
"<if test=\"carVinId != null and carVinId != ''\"> and car_vin_id = #{carVinId}</if>" +
"<if test=\"carTypeId != null \"> and car_type_id = #{carTypeId}</if>" +
"<if test=\"fenceId != null and fenceId != ''\"> and fence_id = #{fenceId}</if>" +
"<if test=\"status != null \"> and status = #{status}</if>" +
"<if test=\"motorManufacturer != null and motorManufacturer != ''\"> and motor_manufacturer = #{motorManufacturer}</if>" +
"<if test=\"batteryManufacturer != null and batteryManufacturer != ''\"> and battery_manufacturer = #{batteryManufacturer}</if>" +
"<if test=\"motorNumber != null and motorNumber != ''\"> and motor_number = #{motorNumber}</if>" +
"<if test=\"batteryNumber != null and batteryNumber != ''\"> and battery_number = #{batteryNumber}</if>"
)
List<Car> selectCarInfoList(Car car);
// @Select("select * from t_car where 1=1 " +
// "<if test=\"carVinId != null and carVinId != ''\"> and car_vin_id = #{carVinId}</if>" +
// "<if test=\"carTypeId != null \"> and car_type_id = #{carTypeId}</if>" +
// "<if test=\"fenceId != null and fenceId != ''\"> and fence_id = #{fenceId}</if>" +
// "<if test=\"status != null \"> and status = #{status}</if>" +
// "<if test=\"motorManufacturer != null and motorManufacturer != ''\"> and motor_manufacturer = #{motorManufacturer}</if>" +
// "<if test=\"batteryManufacturer != null and batteryManufacturer != ''\"> and battery_manufacturer = #{batteryManufacturer}</if>" +
// "<if test=\"motorNumber != null and motorNumber != ''\"> and motor_number = #{motorNumber}</if>" +
// "<if test=\"batteryNumber != null and batteryNumber != ''\"> and battery_number = #{batteryNumber}</if>"
// )
// List<Car> selectCarInfoList(Car car);
/**
* vin
* @param vinId
* @return
*/
Car HuiCarSelect(@Param("vinId") String vinId);
/**
*
@ -56,4 +64,6 @@ public interface CarMapper extends BaseMapper<Car> {
Integer getOnlineCarCount();
Integer getUnOnlineCount();
}

View File

@ -3,7 +3,6 @@ package com.god.base.server.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.god.base.server.common.domain.Car;
import com.god.base.server.common.domain.VehicleMessage;
import com.god.base.server.common.domain.request.CarRequest;
import com.god.common.core.domain.Result;
import org.apache.ibatis.annotations.Param;
@ -18,7 +17,7 @@ public interface CarService extends IService<Car> {
Result<List<Car>> carList(@Param("userId") String userId);
List<Car> selectCarInfoList(CarRequest carRequest);
Car selectCarInfoList(@Param("vinId") String vinId);
Result<List<VehicleMessage>> onlineVehicle();

View File

@ -1,16 +1,13 @@
package com.god.base.server.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.god.base.server.common.domain.Car;
import com.god.base.server.common.domain.VehicleMessage;
import com.god.base.server.common.domain.request.CarRequest;
import com.god.base.server.common.domainConstants.RedisConstant;
import com.god.base.server.mapper.CarMapper;
import com.god.base.server.service.CarService;
import com.god.common.core.domain.Result;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
@ -51,45 +48,57 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements CarSe
}
// /**
// * 查询车辆信息管理列表
// *
// * @param carRequest 车辆信息管理
// * @return
// */
// @Override
// public List<Car> selectCarInfoList(CarRequest carRequest) {
// LambdaQueryWrapper<Car> lambdaQueryWrapper = new LambdaQueryWrapper<>();
// //判断vin是否为空
// if (StringUtils.isNotEmpty(carRequest.getCarVinId())){
// //模糊查询 vin
// lambdaQueryWrapper.like(Car::getCarVinId, carRequest.getCarVinId());
// }
// //模糊查询 车辆类型
// lambdaQueryWrapper.like(Car::getCarTypeId, carRequest.getCarTypeId());
// //模糊查询 电子围栏
// lambdaQueryWrapper.like(Car::getFenceId, carRequest.getFenceId());
// //模糊查询 车辆状态
// lambdaQueryWrapper.like(Car::getStatus, carRequest.getStatus());
// if (StringUtils.isNotEmpty(carRequest.getBatteryManufacturer())){
// //模糊查询 电池厂商
// lambdaQueryWrapper.like(Car::getBatteryManufacturer, carRequest.getBatteryManufacturer());
// }
// if (StringUtils.isNotEmpty(carRequest.getMotorManufacturer())){
// //模糊查询 电机厂商
// lambdaQueryWrapper.like(Car::getMotorManufacturer, carRequest.getMotorManufacturer());
// }
// if (StringUtils.isNotEmpty(carRequest.getMotorNumber())){
// //模糊查询 电机编号
// lambdaQueryWrapper.like(Car::getMotorNumber, carRequest.getMotorNumber());
// }
// if (StringUtils.isNotEmpty(carRequest.getBatteryNumber())){
// //模糊查询 电池编号
// lambdaQueryWrapper.like(Car::getBatteryNumber, carRequest.getBatteryNumber());
// }
//
// return carMapper.selectVehicleInfoList(carRequest);
// }
/**
*
*
* @param carRequest
*
* @param vinId
* @return
*/
@Override
public List<Car> selectCarInfoList(CarRequest carRequest) {
LambdaQueryWrapper<Car> lambdaQueryWrapper = new LambdaQueryWrapper<>();
//判断vin是否为空
if (StringUtils.isNotEmpty(carRequest.getCarVinId())){
//模糊查询 vin
lambdaQueryWrapper.like(Car::getCarVinId, carRequest.getCarVinId());
}
//模糊查询 车辆类型
lambdaQueryWrapper.like(Car::getCarTypeId, carRequest.getCarTypeId());
//模糊查询 电子围栏
lambdaQueryWrapper.like(Car::getFenceId, carRequest.getFenceId());
//模糊查询 车辆状态
lambdaQueryWrapper.like(Car::getStatus, carRequest.getStatus());
if (StringUtils.isNotEmpty(carRequest.getBatteryManufacturer())){
//模糊查询 电池厂商
lambdaQueryWrapper.like(Car::getBatteryManufacturer, carRequest.getBatteryManufacturer());
}
if (StringUtils.isNotEmpty(carRequest.getMotorManufacturer())){
//模糊查询 电机厂商
lambdaQueryWrapper.like(Car::getMotorManufacturer, carRequest.getMotorManufacturer());
}
if (StringUtils.isNotEmpty(carRequest.getMotorNumber())){
//模糊查询 电机编号
lambdaQueryWrapper.like(Car::getMotorNumber, carRequest.getMotorNumber());
}
if (StringUtils.isNotEmpty(carRequest.getBatteryNumber())){
//模糊查询 电池编号
lambdaQueryWrapper.like(Car::getBatteryNumber, carRequest.getBatteryNumber());
public Car selectCarInfoList(String vinId) {
return carMapper.HuiCarSelect(vinId);
}
return carMapper.selectVehicleInfoList(carRequest);
}
/**

View File

@ -55,4 +55,9 @@
select count(*)
from t_car
</select>
<!-- 根据vin查询当前对象的所有信息-->
<select id="HuiCarSelect" resultType="com.god.base.server.common.domain.Car">
<include refid="selectVehicleInfoVo"/>
where car_vin_id = #{vinId}
</select>
</mapper>