feat:飞行日志接入

This commit is contained in:
sugus 2025-10-20 16:14:40 +08:00
parent 3488f86386
commit 54dfbd0811
10 changed files with 33 additions and 19 deletions

View File

@ -46,7 +46,7 @@ public class AircraftLogController {
AircraftDevice aircraftDevice = aircraftDeviceService.getById(dto.getId());
PageResult<AircraftLogPageVO> pageVOPageResult = new PageResult();
if (null != aircraftDevice) {
dto.setModel(aircraftDevice.getModel());
dto.setDeviceCode(aircraftDevice.getDeviceCode());
pageVOPageResult = aircraftLogStrategyFactory.getAllStrategies()
.stream()
.filter(aircraftLogService -> aircraftLogService.support(AircraftDeviceBrandEnum.find(aircraftDevice.getBrand())))

View File

@ -48,6 +48,13 @@ public class AircraftDevice extends BaseEntity {
@ApiModelProperty(value = "设备型号")
private String model;
/**
* 设备码
*/
@NotBlank
@ApiModelProperty(value = "设备码")
private String deviceCode;
/**
* 品牌DJISF
*/

View File

@ -115,7 +115,7 @@ public class FNZZAircraftLog extends AbstractAircraftTextLog implements Serializ
private String latitude;
@ApiModelProperty(value = "无人机经度坐标")
private String Stringitude;
private String longitude;
@ApiModelProperty(value = "无人机俯仰角度")
private String pitch;

View File

@ -30,9 +30,8 @@ public class AircraftLogPageDTO {
@ApiModelProperty("结束时间 yyyy-MM-dd HH:mm:mm")
private String createTimeEnd;
@JSONField(serialize = false)
@ApiModelProperty(value = "设备型号")
private String model;
@ApiModelProperty(value = "设备码")
private String deviceCode;
}

View File

@ -41,9 +41,9 @@ public abstract class AbstractAircraftLogServiceImpl<T extends AbstractAircraftT
protected abstract Class<T> getEntityClass();
/**
* 获取设备型号字段名
* 获取设备字段名
*/
protected abstract String getModelKey();
protected abstract String getDeviceCodeKey();
/**
* 获取时间字段名
@ -61,7 +61,7 @@ public abstract class AbstractAircraftLogServiceImpl<T extends AbstractAircraftT
@Override
public PageResult<AircraftLogPageVO> page(AircraftLogPageDTO dto) {
try {
Query query = buildQuery(dto, getModelKey(), getTimeKey());
Query query = buildQuery(dto, getDeviceCodeKey(), getTimeKey());
// 获取总数
long total = mongotemplate.count(query, getEntityClass());
@ -85,7 +85,7 @@ public abstract class AbstractAircraftLogServiceImpl<T extends AbstractAircraftT
return new PageResult<>(resultList, total);
} catch (Exception e) {
log.error("分页查询无人机日志失败 - model: {}, page: {}, size: {}",
dto.getModel(), dto.getPage(), dto.getSize(), e);
dto.getDeviceCode(), dto.getPage(), dto.getSize(), e);
throw new RuntimeException("查询无人机日志失败", e);
}
}
@ -94,7 +94,7 @@ public abstract class AbstractAircraftLogServiceImpl<T extends AbstractAircraftT
@Override
public String getStateByTextLog(AircraftLogPageDTO dto) {
try {
Query query = buildQuery(dto, getModelKey(), getTimeKey());
Query query = buildQuery(dto, getDeviceCodeKey(), getTimeKey());
//只查一条
dto.setPage(1);
dto.setSize(1);
@ -218,7 +218,7 @@ public abstract class AbstractAircraftLogServiceImpl<T extends AbstractAircraftT
*/
protected Query buildQuery(AircraftLogPageDTO dto, String modelKey, String timeKey) {
// 构建查询条件
Criteria criteria = Criteria.where(modelKey).is(dto.getModel());
Criteria criteria = Criteria.where(modelKey).is(dto.getDeviceCode());
// 添加时间范围查询条件
if (StringUtils.isNotBlank(dto.getCreateTimeStart()) &&

View File

@ -73,7 +73,7 @@ public class AircraftDeviceServiceImpl extends ServiceImpl<AircraftDeviceMapper,
.stream()
.filter(aircraftLogService -> aircraftLogService.support(AircraftDeviceBrandEnum.find(item.getBrand())))
.findFirst()
.map(service -> service.getStateByTextLog(AircraftLogPageDTO.builder().model(item.getModel()).build()))
.map(service -> service.getStateByTextLog(AircraftLogPageDTO.builder().deviceCode(item.getDeviceCode()).build()))
.ifPresent(item::setState);
});
}
@ -84,8 +84,8 @@ public class AircraftDeviceServiceImpl extends ServiceImpl<AircraftDeviceMapper,
@Transactional(rollbackFor = Exception.class)
public void create(AircraftDevice aircraftDevice) {
aircraftDevice.setId(null);
//检查型号是否重复
checkModelRepeat(aircraftDevice);
//检查是否重复
checkRepeat(aircraftDevice);
save(aircraftDevice);
//保存设备图片
List<AttachmentMaterial> deviceImages = aircraftDevice.getDeviceImages()
@ -104,7 +104,7 @@ public class AircraftDeviceServiceImpl extends ServiceImpl<AircraftDeviceMapper,
@Override
@Transactional(rollbackFor = Exception.class)
public void update(AircraftDevice aircraftDevice) {
checkModelRepeat(aircraftDevice);
checkRepeat(aircraftDevice);
updateById(aircraftDevice);
//保存设备图片
List<AttachmentMaterial> deviceImages = aircraftDevice.getDeviceImages()
@ -161,16 +161,16 @@ public class AircraftDeviceServiceImpl extends ServiceImpl<AircraftDeviceMapper,
/**
* 检查型号是否重复
*/
private void checkModelRepeat(AircraftDevice aircraftDevice) {
private void checkRepeat(AircraftDevice aircraftDevice) {
LambdaQueryWrapper<AircraftDevice> queryWrapper = new LambdaQueryWrapper<>();
if (null != aircraftDevice.getId()) {
queryWrapper.ne(AircraftDevice::getId, aircraftDevice.getId());
}
queryWrapper.eq(AircraftDevice::getBrand, aircraftDevice.getBrand())
.eq(AircraftDevice::getModel, aircraftDevice.getModel());
.eq(AircraftDevice::getDeviceCode, aircraftDevice.getDeviceCode());
int count = this.count(queryWrapper);
if (count > 0) {
throw new BadRequestException("设备型号重复");
throw new BadRequestException("设备重复");
}
}
}

View File

@ -35,7 +35,7 @@ public class FNZZAircraftLogServiceImpl extends AbstractAircraftLogServiceImpl<F
}
@Override
protected String getModelKey() {
protected String getDeviceCodeKey() {
return "uavUUID";
}

View File

@ -453,6 +453,7 @@ public class OrderBiz {
AircraftDevice aircraftDevice = aircraftDeviceMap.get(orderDetail.getDeviceId());
if (ObjectUtil.isNotNull(aircraftDevice)) {
orderTaskDetailVO.setDeviceName(aircraftDevice.getName());
orderTaskDetailVO.setDeviceId(aircraftDevice.getId());
}
orderTaskDetailVO.setCargoWeight(orderDetail.getCargoWeight());
EmEmployees employees = emEmployeesMap.get(orderDetail.getOperatorId());

View File

@ -36,6 +36,12 @@ public class OrderTaskDetailVO {
@ApiModelProperty(value = "设备名称")
private String deviceName;
/**
* 设备ID
*/
@ApiModelProperty(value = "设备ID")
private Long deviceId;
/**
* 载物重量
*/

View File

@ -43,6 +43,7 @@
<select id="page" resultType="com.aircraft.modules.aircraft.domain.vo.AircraftDevicePageVO">
select d.id,
d.name,
d.device_code,
d.model,
d.brand,
d.use_type,