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()); AircraftDevice aircraftDevice = aircraftDeviceService.getById(dto.getId());
PageResult<AircraftLogPageVO> pageVOPageResult = new PageResult(); PageResult<AircraftLogPageVO> pageVOPageResult = new PageResult();
if (null != aircraftDevice) { if (null != aircraftDevice) {
dto.setModel(aircraftDevice.getModel()); dto.setDeviceCode(aircraftDevice.getDeviceCode());
pageVOPageResult = aircraftLogStrategyFactory.getAllStrategies() pageVOPageResult = aircraftLogStrategyFactory.getAllStrategies()
.stream() .stream()
.filter(aircraftLogService -> aircraftLogService.support(AircraftDeviceBrandEnum.find(aircraftDevice.getBrand()))) .filter(aircraftLogService -> aircraftLogService.support(AircraftDeviceBrandEnum.find(aircraftDevice.getBrand())))

View File

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

View File

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

View File

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

View File

@ -41,9 +41,9 @@ public abstract class AbstractAircraftLogServiceImpl<T extends AbstractAircraftT
protected abstract Class<T> getEntityClass(); 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 @Override
public PageResult<AircraftLogPageVO> page(AircraftLogPageDTO dto) { public PageResult<AircraftLogPageVO> page(AircraftLogPageDTO dto) {
try { try {
Query query = buildQuery(dto, getModelKey(), getTimeKey()); Query query = buildQuery(dto, getDeviceCodeKey(), getTimeKey());
// 获取总数 // 获取总数
long total = mongotemplate.count(query, getEntityClass()); long total = mongotemplate.count(query, getEntityClass());
@ -85,7 +85,7 @@ public abstract class AbstractAircraftLogServiceImpl<T extends AbstractAircraftT
return new PageResult<>(resultList, total); return new PageResult<>(resultList, total);
} catch (Exception e) { } catch (Exception e) {
log.error("分页查询无人机日志失败 - model: {}, page: {}, size: {}", log.error("分页查询无人机日志失败 - model: {}, page: {}, size: {}",
dto.getModel(), dto.getPage(), dto.getSize(), e); dto.getDeviceCode(), dto.getPage(), dto.getSize(), e);
throw new RuntimeException("查询无人机日志失败", e); throw new RuntimeException("查询无人机日志失败", e);
} }
} }
@ -94,7 +94,7 @@ public abstract class AbstractAircraftLogServiceImpl<T extends AbstractAircraftT
@Override @Override
public String getStateByTextLog(AircraftLogPageDTO dto) { public String getStateByTextLog(AircraftLogPageDTO dto) {
try { try {
Query query = buildQuery(dto, getModelKey(), getTimeKey()); Query query = buildQuery(dto, getDeviceCodeKey(), getTimeKey());
//只查一条 //只查一条
dto.setPage(1); dto.setPage(1);
dto.setSize(1); dto.setSize(1);
@ -218,7 +218,7 @@ public abstract class AbstractAircraftLogServiceImpl<T extends AbstractAircraftT
*/ */
protected Query buildQuery(AircraftLogPageDTO dto, String modelKey, String timeKey) { 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()) && if (StringUtils.isNotBlank(dto.getCreateTimeStart()) &&

View File

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

View File

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

View File

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

View File

@ -36,6 +36,12 @@ public class OrderTaskDetailVO {
@ApiModelProperty(value = "设备名称") @ApiModelProperty(value = "设备名称")
private String deviceName; 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 id="page" resultType="com.aircraft.modules.aircraft.domain.vo.AircraftDevicePageVO">
select d.id, select d.id,
d.name, d.name,
d.device_code,
d.model, d.model,
d.brand, d.brand,
d.use_type, d.use_type,