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; 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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -13,20 +16,14 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; ...@@ -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.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.dto.FireExpertsDto; 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.entity.FireExperts;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FireExpertsServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.FireExpertsServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.multipart.MultipartFile;
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.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
...@@ -59,8 +56,7 @@ public class FireExpertsController extends BaseController { ...@@ -59,8 +56,7 @@ public class FireExpertsController extends BaseController {
@Autowired @Autowired
DataDictionaryServiceImpl dataDictionaryService; DataDictionaryServiceImpl dataDictionaryService;
@Autowired
DataDictionaryMapper dataDictionaryMapper;
/** /**
* 新增 * 新增
...@@ -188,4 +184,40 @@ public class FireExpertsController extends BaseController { ...@@ -188,4 +184,40 @@ public class FireExpertsController extends BaseController {
// 创建挂在主节点 // 创建挂在主节点
return ResponseHelper.buildResponse(menuList); 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;
}
}
} }
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