gps添加设备类型、车辆设备绑定

This commit is contained in:
2025-11-10 14:26:51 +08:00
parent ceec388f5f
commit 9d3c212856
9 changed files with 62 additions and 5 deletions

View File

@ -41,7 +41,7 @@ public class RedisMessageListener implements MessageListener {
public void onMessage(Message message, byte[] pattern) {
try {
// 1. 快速日志记录(证明监听到消息)
log.info("【Redis消息监听】收到消息长度{}字节,提交异步处理", message.getBody().length);
// log.info("【Redis消息监听】收到消息长度{}字节,提交异步处理", message.getBody().length);
// 2. 提交给异步服务处理(核心:线程分离,监听线程立即返回)
asyncMessageHandlerService.handleRedisMessageAsync(message);

View File

@ -88,6 +88,11 @@ public class GpsEquipment extends BaseEntity {
*/
private Integer gpsType;
/**
* 设备类型0、人员设备1、车辆设备
*/
private Integer clientType;
/**
* 模型id
*/

View File

@ -29,9 +29,14 @@ public class GpsManmachine implements Serializable {
private String clientId;
/**
*
* 绑定id
*/
private Long userId;
/**
* 类型绑定id类型1、车辆2人员
*/
private Integer type;
}

View File

@ -87,6 +87,11 @@ public class GpsEquipmentBo extends BaseEntity {
*/
private Integer gpsType;
/**
* 设备类型0、人员设备1、车辆设备
*/
private Integer clientType;
/**
* 模型id
*/

View File

@ -32,4 +32,10 @@ public class GpsManmachineBo extends BaseEntity {
private Long userId;
/**
* 类型绑定id类型1、车辆2人员
*/
private Integer type;
}

View File

@ -106,6 +106,11 @@ public class GpsEquipmentVo implements Serializable {
*/
private Integer gpsType;
/**
* 设备类型0、人员设备1、车辆设备
*/
private Integer clientType;
/**
* 模型id
*/

View File

@ -41,4 +41,9 @@ public class GpsManmachineVo implements Serializable {
private Long userId;
/**
* 类型绑定id类型1、车辆2人员
*/
private Integer type;
}

View File

@ -6,6 +6,8 @@ import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.dromara.vehicle.domain.vo.VehVehicleInfoVo;
import org.dromara.vehicle.service.IVehVehicleInfoService;
import org.dromara.websocket.websocket.service.InitOnStartWebSocketServer;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
@ -70,6 +72,8 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
private IBusProjectService projectService;
@Autowired
private ISysUserService userService;
@Autowired
private IVehVehicleInfoService iVehVehicleInfoService;
/**
* 查询GPS设备详细
@ -103,10 +107,19 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
}else{
item.setType(2);
}
if (item.getClientType() != null){
if (item.getClientType() == 0){
SysUserVo sysUserVo = userService.queryById(item.getUserId());
if (sysUserVo != null) {
item.setUserName(sysUserVo.getNickName());
}
}else if (item.getClientType() == 1){
VehVehicleInfoVo vehVehicleInfoVo = iVehVehicleInfoService.queryById(item.getUserId());
if (vehVehicleInfoVo != null) {
item.setUserName(vehVehicleInfoVo.getPlateNumber());
}
}
}
BusProjectVo busProjectVo = projectService.selectById(item.getProjectId());
if (busProjectVo != null) {
item.setProjectName(busProjectVo.getProjectName());
@ -147,6 +160,7 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
LambdaQueryWrapper<GpsEquipment> lqw = Wrappers.lambdaQuery();
lqw.orderByDesc(GpsEquipment::getCreateTime);
lqw.eq(bo.getGpsType() != null, GpsEquipment::getGpsType, bo.getGpsType());
lqw.eq(bo.getClientType() != null, GpsEquipment::getClientType, bo.getClientType());
lqw.eq(bo.getProjectId() != null, GpsEquipment::getProjectId, bo.getProjectId());
lqw.eq(bo.getUserId() != null, GpsEquipment::getUserId, bo.getUserId());
lqw.eq(StringUtils.isNotBlank(bo.getClientId()), GpsEquipment::getClientId, bo.getClientId());
@ -400,6 +414,7 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
baseMapper.update(new LambdaUpdateWrapper<GpsEquipment>()
.set(GpsEquipment::getUserId,bo.getUserId())
.set(GpsEquipment::getProjectId,bo.getProjectId())
.set(GpsEquipment::getClientType,bo.getClientType())
.eq(GpsEquipment::getId,bo.getId()));
//只能绑定一个设备
List<GpsManmachine> gpsManmachines = gpsManmachineMapper.selectList(Wrappers.<GpsManmachine>lambdaQuery()
@ -411,6 +426,7 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
GpsManmachine gpsManmachine = new GpsManmachine();
gpsManmachine.setClientId(bo.getClientId());
gpsManmachine.setUserId(bo.getUserId());
gpsManmachine.setType(bo.getClientType()== 1 ? 1:2);
return gpsManmachineMapper.insert(gpsManmachine) > 0;
}
@ -420,6 +436,7 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
public Boolean unbindManmachine(GpsEquipmentBo bo) {
baseMapper.update(new LambdaUpdateWrapper<GpsEquipment>()
.set(GpsEquipment::getUserId,null)
.set(GpsEquipment::getClientType,null)
.eq(GpsEquipment::getId,bo.getId()));
GpsManmachine gpsManmachine = new GpsManmachine();
gpsManmachine.setClientId(bo.getClientId());

View File

@ -46,6 +46,15 @@ public class VehVehicleInfoController extends BaseController {
return vehVehicleInfoService.queryPageList(bo, pageQuery);
}
/**
* 查询车辆信息列表
*/
// @SaCheckPermission("vehicle:vehicleInfo:getList")
@GetMapping("/getList")
public R<List<VehVehicleInfoVo>> list(VehVehicleInfoBo bo) {
return R.ok(vehVehicleInfoService.queryList(bo));
}
/**
* 导出车辆信息列表
*/