Browse Source

修改接口/flightIndex/getAirportDetail, 变更获得可选挂载设备名的方式

tags/V1.2.1^2
wanghaoran 1 year ago
parent
commit
612ea71ada
1 changed files with 13 additions and 5 deletions
  1. +13
    -5
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/IndexServiceImpl.java

+ 13
- 5
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/IndexServiceImpl.java View File

package com.tuoheng.admin.service.impl; package com.tuoheng.admin.service.impl;


import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
airportDetailDto.setTmp(tmp + "℃"); airportDetailDto.setTmp(tmp + "℃");
} }
JSONObject mountJson = dataObject.getJSONObject("mount"); JSONObject mountJson = dataObject.getJSONObject("mount");
if(Objects.nonNull(mountJson)){
airportDetailDto.setMountName(mountJson.getString("cameraName") + "、" +
mountJson.getString("megaphoneName") + "、" +
mountJson.getString("searchlightName")
);
JSONArray mountEquipmentList = mountJson.getJSONArray("mountEquipmentList");
StringBuilder sb = new StringBuilder();
if (Objects.nonNull(mountEquipmentList)) {
for(int i = 0; i < mountEquipmentList.size(); i++){
JSONObject equipment = mountEquipmentList.getJSONObject(i);
String name = equipment.getString("name");
sb.append(name);
if(i < mountEquipmentList.size()-1){
sb.append("、");
}
}
vo.setMountName(sb.toString());
} }
airportDetailDto.setStatus(dataObject.getString("status")); airportDetailDto.setStatus(dataObject.getString("status"));
return JsonResult.success(airportDetailDto); return JsonResult.success(airportDetailDto);

Loading…
Cancel
Save