gps添加设备类型、车辆设备绑定
This commit is contained in:
@ -41,7 +41,7 @@ public class RedisMessageListener implements MessageListener {
|
|||||||
public void onMessage(Message message, byte[] pattern) {
|
public void onMessage(Message message, byte[] pattern) {
|
||||||
try {
|
try {
|
||||||
// 1. 快速日志记录(证明监听到消息)
|
// 1. 快速日志记录(证明监听到消息)
|
||||||
log.info("【Redis消息监听】收到消息,长度:{}字节,提交异步处理", message.getBody().length);
|
// log.info("【Redis消息监听】收到消息,长度:{}字节,提交异步处理", message.getBody().length);
|
||||||
|
|
||||||
// 2. 提交给异步服务处理(核心:线程分离,监听线程立即返回)
|
// 2. 提交给异步服务处理(核心:线程分离,监听线程立即返回)
|
||||||
asyncMessageHandlerService.handleRedisMessageAsync(message);
|
asyncMessageHandlerService.handleRedisMessageAsync(message);
|
||||||
|
|||||||
@ -88,6 +88,11 @@ public class GpsEquipment extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Integer gpsType;
|
private Integer gpsType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型(0、人员设备,1、车辆设备)
|
||||||
|
*/
|
||||||
|
private Integer clientType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模型id
|
* 模型id
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -29,9 +29,14 @@ public class GpsManmachine implements Serializable {
|
|||||||
private String clientId;
|
private String clientId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* 绑定id
|
||||||
*/
|
*/
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型(绑定id类型,1、车辆,2人员)
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,6 +87,11 @@ public class GpsEquipmentBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Integer gpsType;
|
private Integer gpsType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型(0、人员设备,1、车辆设备)
|
||||||
|
*/
|
||||||
|
private Integer clientType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模型id
|
* 模型id
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -32,4 +32,10 @@ public class GpsManmachineBo extends BaseEntity {
|
|||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型(绑定id类型,1、车辆,2人员)
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,6 +106,11 @@ public class GpsEquipmentVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer gpsType;
|
private Integer gpsType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型(0、人员设备,1、车辆设备)
|
||||||
|
*/
|
||||||
|
private Integer clientType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模型id
|
* 模型id
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -41,4 +41,9 @@ public class GpsManmachineVo implements Serializable {
|
|||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型(绑定id类型,1、车辆,2人员)
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import cn.hutool.json.JSONUtil;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
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.websocket.websocket.service.InitOnStartWebSocketServer;
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
@ -70,6 +72,8 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
|
|||||||
private IBusProjectService projectService;
|
private IBusProjectService projectService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserService userService;
|
private ISysUserService userService;
|
||||||
|
@Autowired
|
||||||
|
private IVehVehicleInfoService iVehVehicleInfoService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询GPS设备详细
|
* 查询GPS设备详细
|
||||||
@ -103,10 +107,19 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
|
|||||||
}else{
|
}else{
|
||||||
item.setType(2);
|
item.setType(2);
|
||||||
}
|
}
|
||||||
|
if (item.getClientType() != null){
|
||||||
|
if (item.getClientType() == 0){
|
||||||
SysUserVo sysUserVo = userService.queryById(item.getUserId());
|
SysUserVo sysUserVo = userService.queryById(item.getUserId());
|
||||||
if (sysUserVo != null) {
|
if (sysUserVo != null) {
|
||||||
item.setUserName(sysUserVo.getNickName());
|
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());
|
BusProjectVo busProjectVo = projectService.selectById(item.getProjectId());
|
||||||
if (busProjectVo != null) {
|
if (busProjectVo != null) {
|
||||||
item.setProjectName(busProjectVo.getProjectName());
|
item.setProjectName(busProjectVo.getProjectName());
|
||||||
@ -147,6 +160,7 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
|
|||||||
LambdaQueryWrapper<GpsEquipment> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<GpsEquipment> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.orderByDesc(GpsEquipment::getCreateTime);
|
lqw.orderByDesc(GpsEquipment::getCreateTime);
|
||||||
lqw.eq(bo.getGpsType() != null, GpsEquipment::getGpsType, bo.getGpsType());
|
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.getProjectId() != null, GpsEquipment::getProjectId, bo.getProjectId());
|
||||||
lqw.eq(bo.getUserId() != null, GpsEquipment::getUserId, bo.getUserId());
|
lqw.eq(bo.getUserId() != null, GpsEquipment::getUserId, bo.getUserId());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getClientId()), GpsEquipment::getClientId, bo.getClientId());
|
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>()
|
baseMapper.update(new LambdaUpdateWrapper<GpsEquipment>()
|
||||||
.set(GpsEquipment::getUserId,bo.getUserId())
|
.set(GpsEquipment::getUserId,bo.getUserId())
|
||||||
.set(GpsEquipment::getProjectId,bo.getProjectId())
|
.set(GpsEquipment::getProjectId,bo.getProjectId())
|
||||||
|
.set(GpsEquipment::getClientType,bo.getClientType())
|
||||||
.eq(GpsEquipment::getId,bo.getId()));
|
.eq(GpsEquipment::getId,bo.getId()));
|
||||||
//只能绑定一个设备
|
//只能绑定一个设备
|
||||||
List<GpsManmachine> gpsManmachines = gpsManmachineMapper.selectList(Wrappers.<GpsManmachine>lambdaQuery()
|
List<GpsManmachine> gpsManmachines = gpsManmachineMapper.selectList(Wrappers.<GpsManmachine>lambdaQuery()
|
||||||
@ -411,6 +426,7 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
|
|||||||
GpsManmachine gpsManmachine = new GpsManmachine();
|
GpsManmachine gpsManmachine = new GpsManmachine();
|
||||||
gpsManmachine.setClientId(bo.getClientId());
|
gpsManmachine.setClientId(bo.getClientId());
|
||||||
gpsManmachine.setUserId(bo.getUserId());
|
gpsManmachine.setUserId(bo.getUserId());
|
||||||
|
gpsManmachine.setType(bo.getClientType()== 1 ? 1:2);
|
||||||
return gpsManmachineMapper.insert(gpsManmachine) > 0;
|
return gpsManmachineMapper.insert(gpsManmachine) > 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -420,6 +436,7 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
|
|||||||
public Boolean unbindManmachine(GpsEquipmentBo bo) {
|
public Boolean unbindManmachine(GpsEquipmentBo bo) {
|
||||||
baseMapper.update(new LambdaUpdateWrapper<GpsEquipment>()
|
baseMapper.update(new LambdaUpdateWrapper<GpsEquipment>()
|
||||||
.set(GpsEquipment::getUserId,null)
|
.set(GpsEquipment::getUserId,null)
|
||||||
|
.set(GpsEquipment::getClientType,null)
|
||||||
.eq(GpsEquipment::getId,bo.getId()));
|
.eq(GpsEquipment::getId,bo.getId()));
|
||||||
GpsManmachine gpsManmachine = new GpsManmachine();
|
GpsManmachine gpsManmachine = new GpsManmachine();
|
||||||
gpsManmachine.setClientId(bo.getClientId());
|
gpsManmachine.setClientId(bo.getClientId());
|
||||||
|
|||||||
@ -46,6 +46,15 @@ public class VehVehicleInfoController extends BaseController {
|
|||||||
return vehVehicleInfoService.queryPageList(bo, pageQuery);
|
return vehVehicleInfoService.queryPageList(bo, pageQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆信息列表
|
||||||
|
*/
|
||||||
|
// @SaCheckPermission("vehicle:vehicleInfo:getList")
|
||||||
|
@GetMapping("/getList")
|
||||||
|
public R<List<VehVehicleInfoVo>> list(VehVehicleInfoBo bo) {
|
||||||
|
return R.ok(vehVehicleInfoService.queryList(bo));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出车辆信息列表
|
* 导出车辆信息列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user