Commit ae480437 authored by chenzhao's avatar chenzhao

修改bug

parent af60da62
package com.yeejoin.amos.boot.module.jcs.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.BaseRowModel;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import com.yeejoin.amos.boot.module.common.api.excel.RoleNameExplicitConstraint;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class AircraftDtos extends BaseRowModel {
@ExcelIgnore
private static final long serialVersionUID = 1L;
@ExcelProperty(value = "飞机型号", index = 0)
@ApiModelProperty(value = "飞机型号")
private String aircraftModel;
@ExcelProperty(value = "中文全称", index = 1)
@ApiModelProperty(value = "中文全称")
private String fullName;
@ExcelProperty(value = "飞机长度", index = 2)
@ApiModelProperty(value = "飞机长度")
private Double aircraftLength;
@ExcelProperty(value = "机舱长度", index = 3)
@ApiModelProperty(value = "机舱长度")
private Double cabinLength;
@ExcelProperty(value = "尾翼高度", index = 4)
@ApiModelProperty(value = "尾翼高度")
private Double tailHeight;
@ExcelProperty(value = "翼展", index = 5)
@ApiModelProperty(value = "翼展")
private Double wingspan;
@ExcelProperty(value = "机身直径", index = 6)
@ApiModelProperty(value = "机身直径")
private Double fuselageDiameter;
@ExcelProperty(value = "翼展面积", index = 7)
@ApiModelProperty(value = "翼展面积")
private Double wingspanArea;
@ExplicitConstraint(type = "FDJLX", indexNum = 8, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容
@ExcelProperty(value = "发动机类型", index = 8)
@ApiModelProperty(value = "发动机类型")
private String engineType;
@ExcelIgnore
@ApiModelProperty(value = "发动机类型code")
private String engineTypeCode;
@ExcelProperty(value = "发动机数量", index = 9)
@ApiModelProperty(value = "发动机数量")
private Integer enginesmNum;
@ExcelProperty(value = "发动机型号", index = 10)
@ApiModelProperty(value = "发动机型号")
private String engineModel;
@ExplicitConstraint(type = "RYLX", indexNum = 11, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容
@ExcelProperty(value = "燃油类型", index = 11)
@ApiModelProperty(value = "燃油类型")
private String fuelType;
@ExcelIgnore
@ApiModelProperty(value = "燃油类型code")
private String fuelTypeCode;
@ExcelProperty(value = "最大载油量", index = 12)
@ApiModelProperty(value = "最大载油量")
private Double oilLoadMax;
@ExcelProperty(value = "标准燃油", index = 13)
@ApiModelProperty(value = "标准燃油")
private Double standardFuel;
@ExcelProperty(value = "空重", index = 14)
@ApiModelProperty(value = "空重")
private Double emptyWeight;
@ExcelProperty(value = "飞机主要构造材料", index = 15)
@ApiModelProperty(value = "飞机主要构造材料")
private String structuralMaterial;
@ExcelProperty(value = "氧气瓶数量", index = 16)
@ApiModelProperty(value = "氧气瓶数量")
private Integer oxygenCylinderNum;
@ExcelProperty(value = "氧气瓶位置描述", index = 17)
@ApiModelProperty(value = "氧气瓶位置描述")
private String oxygenCylinderLocation;
@ExcelProperty(value = "标准坐席数", index = 18)
@ApiModelProperty(value = "标准坐席数")
private Integer seatNum;
@ExcelProperty(value = "商载(吨)", index = 19)
@ApiModelProperty(value = "商载(吨)")
private Double commercialLoad;
@ExcelProperty(value = "货仓容积(立方米)", index = 20)
@ApiModelProperty(value = "货仓容积(立方米)")
private Double warehouseVolume;
@ExcelProperty(value = "最大起飞总重(吨)", index = 21)
@ApiModelProperty(value = "最大起飞总重(吨)")
private Double takeoffWeightNum;
@ExcelProperty(value = "最大巡航速度(马赫)", index = 22)
@ApiModelProperty(value = "最大巡航速度(马赫)")
private Double cruiseSpeedNum;
@ExcelProperty(value = "航程", index = 23)
@ApiModelProperty(value = "航程")
private Double voyage;
@ExcelProperty(value = "主要设施", index = 24)
@ApiModelProperty(value = "主要设施")
private String facilitie;
@ExcelProperty(value = "主要燃烧物质", index = 25)
@ApiModelProperty(value = "主要燃烧物质")
private String combustionMaterial;
@ExcelProperty(value = "疏散出口及安全通道", index = 26)
@ApiModelProperty(value = "疏散出口及安全通道")
private String exitPassage;
@ExcelProperty(value = "备注", index = 27)
@ApiModelProperty(value = "备注")
private String remark;
@ExcelProperty(value = "外观图", index = 28)
@ApiModelProperty(value = "外观图")
private String appearanceImages;
@ExcelProperty(value = "平面图", index = 29)
@ApiModelProperty(value = "平面图")
private String planeImages;
@ExcelProperty(value = "救援图", index = 30)
@ApiModelProperty(value = "救援图")
private String rescueImages;
@ExcelProperty(value = "方位图", index = 31)
@ApiModelProperty(value = "方位图")
private String positionImages;
@ExcelProperty(value = "三维模型", index = 32)
@ApiModelProperty(value = "三维模型")
private String models;
@ApiModelProperty(value = "现场图片")
private List<String> scenePicture;
}
package com.yeejoin.amos.boot.module.common.biz.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -13,20 +16,14 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.dto.FireExpertsDto;
import com.yeejoin.amos.boot.module.common.api.entity.FireExperts;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FireExpertsServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -59,8 +56,7 @@ public class FireExpertsController extends BaseController {
@Autowired
DataDictionaryServiceImpl dataDictionaryService;
@Autowired
DataDictionaryMapper dataDictionaryMapper;
/**
* 新增
......@@ -188,4 +184,40 @@ public class FireExpertsController extends BaseController {
// 创建挂在主节点
return ResponseHelper.buildResponse(menuList);
}
/**
*
* 导入航空器信息
*
* **/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/ImportData")
@ApiOperation(httpMethod = "POST", value = "导入消防专家", notes = "导入消防专家")
public Boolean ImportData (@RequestPart MultipartFile multipartFile) {
List<FireExperts> aircraftList = new ArrayList<>();
try {
EasyExcel.read(multipartFile.getInputStream(), FireExpertsDto.class, new AnalysisEventListener<FireExpertsDto>() {
// 每读取一行就调用该方法
@Override
public void invoke(FireExpertsDto data, AnalysisContext context) {
FireExperts fireExperts = new FireExperts();
BeanUtils.copyProperties(data,fireExperts);
aircraftList.add(fireExperts);
}
// 全部读取完成就调用该方法
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
System.out.println("读取完成");
}
}).sheet().doRead();
fireExpertsServiceImpl.saveBatch(aircraftList);
return true;
} catch (Exception e) {
return false;
}
}
}
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.metadata.Sheet;
import com.alibaba.excel.metadata.TableStyle;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.ExcelUtils;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.api.feign.IotFeignClient;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDtos;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftListTreeDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.KeyValueLabel;
import com.yeejoin.amos.boot.module.jcs.api.entity.Aircraft;
......@@ -21,6 +31,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.map.HashedMap;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.slf4j.Logger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -33,7 +46,13 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.*;
......@@ -53,10 +72,11 @@ public class AircraftController extends BaseController {
@Autowired
DataSourcesImpl dataSourcesImpl;
@Autowired
IotFeignClient iotFeignClient;
IotFeignClient iotFeignClient;
@Autowired
private AlertFormValueServiceImpl iAlertFormValueService;
/**
* 新增航空器信息
*
......@@ -142,12 +162,10 @@ public class AircraftController extends BaseController {
return ResponseHelper.buildResponse(aircraftServiceImpl.queryForAircraftPage(page, false, aircraftModel,
engineTypeCode, fuelTypeCode));
}
/**
*
*
* @param 获取航空器型号列表
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -155,59 +173,53 @@ public class AircraftController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "获取航空器型号列表", notes = "获取航空器型号列表")
public ResponseModel<List<AircraftListTreeDto>> getAircraft() {
return ResponseHelper.buildResponse(aircraftServiceImpl.getAircraft());
}
}
/**
*
* 获取24小时内的航班号
*
* **/
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getAircraftNum")
@ApiOperation(httpMethod = "GET", value = "获取24小时内的航班号", notes = "获取24小时内的航班号")
public ResponseModel<List<Map<String, Object>>> getAircraftNum() {
ResponseModel<List<Map<String, Object>>> dataModel= iotFeignClient.findImgByFileCategory();
if(dataModel!=null) {
List<Map<String, Object>> listmap= dataModel.getResult();
ResponseModel<List<Map<String, Object>>> dataModel = iotFeignClient.findImgByFileCategory();
if (dataModel != null) {
List<Map<String, Object>> listmap = dataModel.getResult();
return ResponseHelper.buildResponse(listmap);
}
return ResponseHelper.buildResponse(null);
}
}
/**
*
* 通过航班号,查询最新的航班信息
*
* **/
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getAircraftDetails/{num}")
@ApiOperation(httpMethod = "GET", value = "通过航班号,查询最新的航班信息", notes = "通过航班号,查询最新的航班信息")
public ResponseModel<Map<String, Object>> getAircraftDetails(@PathVariable String num) {
Map<String, Object> map1=new HashedMap();
ResponseModel<Map<String, Object>> dataModel= iotFeignClient.getDynamicFlightInfo(num);
if(dataModel!=null) {
Map<String, Object> map= dataModel.getResult();
if(map!=null) {
map1.put("aircraftModel", map.get("aircraftType"));
map1.put("dynamicFlightId", map.get("dynamicFlightId"));
map1.put("landingTime", map.get("sta"));
Map<String, Object> map1 = new HashedMap();
ResponseModel<Map<String, Object>> dataModel = iotFeignClient.getDynamicFlightInfo(num);
if (dataModel != null) {
Map<String, Object> map = dataModel.getResult();
if (map != null) {
map1.put("aircraftModel", map.get("aircraftType"));
map1.put("dynamicFlightId", map.get("dynamicFlightId"));
map1.put("landingTime", map.get("sta"));
// map1.put("fuelQuantity", map.get(""));
map1.put("passengerCapacity", map.get("psgNumTotal"));
}
}
map1.put("passengerCapacity", map.get("psgNumTotal"));
}
}
return ResponseHelper.buildResponse(map1);
}
/**
*
* 通过航班号,查询最新的航班信息
*
* **/
**/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getAircraftDetailsByAlertId/{id}")
@ApiOperation(httpMethod = "GET", value = "根据灾情id 查询最新的航班信息", notes = "根据灾情id 查询最新的航班信息")
......@@ -216,22 +228,78 @@ public class AircraftController extends BaseController {
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
List<KeyValueLabel> listdate =new ArrayList<>();
List<KeyValueLabel> listdate = new ArrayList<>();
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
String num=null;
if(list!=null&&list.size()>0) {
String num = null;
if (list != null && list.size() > 0) {
for (AlertFormValue alertFormValue : list) {
if("flightNumber".equals(alertFormValue.getFieldCode())){
num=alertFormValue.getFieldValue();
}
if ("flightNumber".equals(alertFormValue.getFieldCode())) {
num = alertFormValue.getFieldValue();
}
}
}
Map<String, Object> map=new HashedMap();
ResponseModel<Map<String, Object>> dataModel= iotFeignClient.findImgByDynamicFlightId(num);
if(dataModel!=null) {
map= dataModel.getResult();
Map<String, Object> map = new HashedMap();
ResponseModel<Map<String, Object>> dataModel = iotFeignClient.findImgByDynamicFlightId(num);
if (dataModel != null) {
map = dataModel.getResult();
}
return ResponseHelper.buildResponse(map);
}
}
/**
*
* 导出航空器信息
*
* **/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/exportData")
@ApiOperation(httpMethod = "GET", value = "导出航空器信息", notes = "导出航空器信息")
public void exportData ( HttpServletResponse response)throws IOException {
String fileName = "Aircraft";
response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8");
response.addHeader("Content-Disposition", "attachment;filename=" + fileName+ ".xlsx");
String sheetName = "航空器信息";
ExcelWriter writer = new ExcelWriter(response.getOutputStream(), ExcelTypeEnum.XLSX);
Sheet sheet = new Sheet(1, 0,AircraftDtos.class);
List<AircraftDto> list = aircraftServiceImpl.queryAircraftDtoForList(false);
sheet.setSheetName(sheetName);
writer.write(list, sheet);
writer.finish();
}
/**
*
* 导入航空器信息
*
* **/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/ImportData")
@ApiOperation(httpMethod = "POST", value = "导入航空器信息", notes = "导入航空器信息")
public Boolean ImportData (@RequestPart MultipartFile multipartFile) {
List<Aircraft> aircraftList = new ArrayList<>();
try {
// list = ExcelUtil.readFirstSheetExcel(multipartFile, AircraftDto.class, 0);
EasyExcel.read(multipartFile.getInputStream(), AircraftDto.class, new AnalysisEventListener<AircraftDto>() {
// 每读取一行就调用该方法
@Override
public void invoke(AircraftDto data, AnalysisContext context) {
Aircraft aircraft = new Aircraft();
BeanUtils.copyProperties(data,aircraft);
aircraftList.add(aircraft);
}
// 全部读取完成就调用该方法
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
System.out.println("读取完成");
}
}).sheet().doRead();
aircraftServiceImpl.saveBatch(aircraftList);
return true;
} catch (Exception e) {
return false;
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment