Browse Source

添加飞行时间和飞行无人机

tags/v1.1.0
qiujinyang 2 years ago
parent
commit
91ab8d14f3
2 changed files with 22 additions and 4 deletions
  1. +3
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/MissionVO.java
  2. +19
    -4
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/MissionServiceImpl.java

+ 3
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/MissionVO.java View File

@@ -96,6 +96,9 @@ public class MissionVO implements Serializable {
@ApiModelProperty(value = "创建人")
private String createUser;

@ApiModelProperty(value = "飞行时间")
private Long flyTime;

@ApiModelProperty(value = "租户id",hidden = true)
private Integer tenantId;


+ 19
- 4
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/MissionServiceImpl.java View File

@@ -231,11 +231,11 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi
page.setSize(queryInspectionRequest.getLimit());
page.setCurrent(queryInspectionRequest.getPage());
queryInspectionRequest.setTenantId(ShiroUtils.getTenantId());
LambdaQueryWrapper<ThMission> queryInspection=new LambdaQueryWrapper<>();
queryParam(queryInspectionRequest, queryInspection);
queryInspection.eq(ThMission::getMark,MarkTypeEnum.VALID.getCode()).orderByDesc(ThMission::getCreateTime);
LambdaQueryWrapper<ThMission> queryMission=new LambdaQueryWrapper<>();
queryParam(queryInspectionRequest, queryMission);
queryMission.eq(ThMission::getMark,MarkTypeEnum.VALID.getCode()).orderByDesc(ThMission::getCreateTime);

IPage<ThMission> thMissionIPage = thMissionMapper.selectPage(page, queryInspection);
IPage<ThMission> thMissionIPage = thMissionMapper.selectPage(page, queryMission);
List<ThMission> records = thMissionIPage.getRecords();

Map<Integer, String> userName = getUserNameMap(records);
@@ -243,10 +243,25 @@ public class MissionServiceImpl extends BaseServiceImpl<ThMissionMapper, ThMissi
records.forEach(mission->{
MissionVO missionVO=new MissionVO();
BeanUtils.copyProperties(mission,missionVO);

//获取最后一次的飞行时间
if(missionVO.getStatus().equals(TaskStatusEnum.COMPLETE.getCode())) {
LambdaQueryWrapper<ThInspection> lambdaInspection = new LambdaQueryWrapper<>();
lambdaInspection.eq(ThInspection::getMissionId, mission.getId());
lambdaInspection.eq(ThInspection::getMark, MarkTypeEnum.VALID.getCode()).orderByDesc(ThInspection::getCreateTime);
List<ThInspection> thInspections = inspectionMapper.selectList(lambdaInspection);
if (ObjectUtil.isNotEmpty(thInspections) && thInspections.size() > 0) {
ThInspection temp = thInspections.get(0);
missionVO.setFlyTime(temp.getFlyTime() / 1000);
}
}
missionVO.setCreateUser(userName.get(mission.getCreateUser()));
result.add(missionVO);
});




IPage<MissionVO> resultPage=new Page<>();
resultPage.setCurrent(thMissionIPage.getCurrent());
resultPage.setPages(thMissionIPage.getPages());

Loading…
Cancel
Save