glj-代码提交

This commit is contained in:
glj 2023-05-24 18:18:50 +08:00
parent 2eb4055d56
commit 31ba049dae
5 changed files with 94 additions and 28 deletions

View File

@ -170,6 +170,16 @@ public class RemoteSensingSourceData implements Serializable {
*/
private Long uploadId;
/**
* 1-Optical satellite, 2-Night light satellite, 3-Video satellite, 4-Hyperspectral satellite, 5-Radar satellite
*/
private Integer satelliteTypeSelect;
/**
* 影像缩略图名称 用户批量添加缩略图区分
*/
private String pictureName;
/**
* 分辨率集合最大值
*/

View File

@ -92,4 +92,14 @@ public class RemoteSensingSourceDataController {
public R fileExcelUpload(@RequestParam("file") MultipartFile file, @RequestParam("disasterId") Long disasterId) {
return R.data(remoteSensingSourceDataService.importTemplate(file,disasterId));
}
/**
* 导入
* @param fileList
* @return
*/
@PostMapping({"/importTemplateImgList"})
public R importTemplateImgList(@RequestParam("fileList") List<MultipartFile> fileList, @RequestParam("disasterId") Long disasterId) {
return R.data(remoteSensingSourceDataService.importTemplateImgList(fileList,disasterId));
}
}

View File

@ -36,6 +36,8 @@
<result property="satelliteType" column="satellite_type" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="uploadId" column="upload_id" jdbcType="INTEGER"/>
<result property="satelliteTypeSelect" column="satellite_type_select" jdbcType="INTEGER"/>
<result property="pictureName" column="picture_name" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
@ -47,7 +49,7 @@
upper_left_lon,upper_right_lat,upper_right_lon,
view_center_lat,view_center_lon,lower_right_lat,
lower_right_lon,lower_left_lat,lower_left_lon,
disaster_id,create_time,download_url,source_organization,satellite_type,status,upload_id
disaster_id,create_time,download_url,source_organization,satellite_type,status,upload_id, satellite_type_select, picture_name
</sql>
<select id="getRemoteSensingSourceData" resultMap="BaseResultMap">

View File

@ -23,4 +23,7 @@ public interface RemoteSensingSourceDataService extends IService<RemoteSensingSo
IPage<RemoteSensingSourceData> getRemoteSensingSourceDataByCondition(IPage<Object> page, RemoteSensingSourceData remoteSensingSourceData);
R importTemplate(MultipartFile file, Long disasterId);
R importTemplateImgList(List<MultipartFile> fileList, Long disasterId);
}

View File

@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -13,7 +14,10 @@ import com.kening.vordm.mapper.RemoteSensingSourceDataMapper;
import com.kening.vordm.service.RemoteSensingSourceDataService;
import com.kening.vordm.vo.productResolutionVo;
import org.springblade.common.utils.ExcelCellUtil;
import org.springblade.core.oss.MinioTemplate;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@ -31,6 +35,12 @@ import java.util.concurrent.atomic.AtomicReference;
public class RemoteSensingSourceDataServiceImpl extends ServiceImpl<RemoteSensingSourceDataMapper, RemoteSensingSourceData>
implements RemoteSensingSourceDataService {
/**
* 对象存储模块
*/
@Autowired
private MinioTemplate minioTemplate;
@Override
public List<RemoteSensingSourceData> getRemoteSensingSourceData(String disasterType, String disasterCountry, String disasterTime) {
return this.baseMapper.getRemoteSensingSourceData(disasterType, disasterCountry, disasterTime);
@ -104,6 +114,7 @@ public class RemoteSensingSourceDataServiceImpl extends ServiceImpl<RemoteSensin
String lower_left_lat = ExcelCellUtil.strHandle(row.get(15));
String lower_left_lon = ExcelCellUtil.strHandle(row.get(16));
String source_organization = ExcelCellUtil.strHandle(row.get(17));
String picture_name = ExcelCellUtil.strHandle(row.get(18));
RemoteSensingSourceData remoteSensingSourceData = new RemoteSensingSourceData();
remoteSensingSourceData.setThumbnailLink(thumbnail_link);
remoteSensingSourceData.setProductLevel(product_level);
@ -118,47 +129,50 @@ public class RemoteSensingSourceDataServiceImpl extends ServiceImpl<RemoteSensin
}
remoteSensingSourceData.setProductTime(dateStr);
}
if (product_resolution!=null){
if (product_resolution != null) {
remoteSensingSourceData.setProductResolution(Double.parseDouble(product_resolution));
}
if (cloud_cover!=null){
remoteSensingSourceData.setCloudCover(Integer.parseInt(cloud_cover));
if (cloud_cover != null) {
remoteSensingSourceData.setCloudCover(Integer.parseInt(cloud_cover));
}
if (satellite_code!=null){
remoteSensingSourceData.setSatelliteCode(satellite_code);
if (satellite_code != null) {
remoteSensingSourceData.setSatelliteCode(satellite_code);
}
if (upper_left_lat!=null){
remoteSensingSourceData.setUpperLeftLat(Double.parseDouble(upper_left_lat));
if (upper_left_lat != null) {
remoteSensingSourceData.setUpperLeftLat(Double.parseDouble(upper_left_lat));
}
if (upper_left_lon!=null){
remoteSensingSourceData.setUpperLeftLon(Double.parseDouble(upper_left_lon));
if (upper_left_lon != null) {
remoteSensingSourceData.setUpperLeftLon(Double.parseDouble(upper_left_lon));
}
if (upper_right_lat!=null){
remoteSensingSourceData.setUpperRightLat(Double.parseDouble(upper_right_lat));
if (upper_right_lat != null) {
remoteSensingSourceData.setUpperRightLat(Double.parseDouble(upper_right_lat));
}
if (upper_right_lon!=null){
remoteSensingSourceData.setUpperRightLon(Double.parseDouble(upper_right_lon));
if (upper_right_lon != null) {
remoteSensingSourceData.setUpperRightLon(Double.parseDouble(upper_right_lon));
}
if (view_center_lat!=null){
remoteSensingSourceData.setViewCenterLat(Double.parseDouble(view_center_lat));
if (view_center_lat != null) {
remoteSensingSourceData.setViewCenterLat(Double.parseDouble(view_center_lat));
}
if (view_center_lon!=null){
remoteSensingSourceData.setViewCenterLon(Double.parseDouble(view_center_lon));
if (view_center_lon != null) {
remoteSensingSourceData.setViewCenterLon(Double.parseDouble(view_center_lon));
}
if (lower_right_lat!=null){
remoteSensingSourceData.setLowerRightLat(Double.parseDouble(lower_right_lat));
if (lower_right_lat != null) {
remoteSensingSourceData.setLowerRightLat(Double.parseDouble(lower_right_lat));
}
if (lower_right_lon!=null){
remoteSensingSourceData.setLowerRightLon(Double.parseDouble(lower_right_lon));
if (lower_right_lon != null) {
remoteSensingSourceData.setLowerRightLon(Double.parseDouble(lower_right_lon));
}
if (lower_left_lat!=null){
remoteSensingSourceData.setLowerLeftLat(Double.parseDouble(lower_left_lat));
if (lower_left_lat != null) {
remoteSensingSourceData.setLowerLeftLat(Double.parseDouble(lower_left_lat));
}
if (lower_left_lon!=null){
remoteSensingSourceData.setLowerLeftLon(Double.parseDouble(lower_left_lon));
if (lower_left_lon != null) {
remoteSensingSourceData.setLowerLeftLon(Double.parseDouble(lower_left_lon));
}
if (source_organization!=null){
remoteSensingSourceData.setSourceOrganization(source_organization);
if (source_organization != null) {
remoteSensingSourceData.setSourceOrganization(source_organization);
}
if (picture_name != null) {
remoteSensingSourceData.setPictureName(picture_name);
}
remoteSensingSourceData.setDisasterId(disasterId);
remoteSensingSourceData.setCreateTime(new Date());
@ -169,4 +183,31 @@ public class RemoteSensingSourceDataServiceImpl extends ServiceImpl<RemoteSensin
}
return R.data("上传成功!");
}
@Override
public R importTemplateImgList(List<MultipartFile> fileList, Long disasterId) {
LambdaQueryWrapper<RemoteSensingSourceData> qw = new LambdaQueryWrapper<>();
qw.eq(RemoteSensingSourceData::getDisasterId, disasterId);
List<RemoteSensingSourceData> remoteSensingSourceData = this.baseMapper.selectList(qw);
fileList.stream().forEach(multipartFile -> {
String name = multipartFile.getOriginalFilename();
String caselsh = name.substring(0,name.lastIndexOf("."));
BladeFile bladeFile = minioTemplate.putFile(multipartFile);
for (int i = 0; i < remoteSensingSourceData.size(); i++) {
if (remoteSensingSourceData.get(i).getPictureName() != null) {
if (caselsh.equals(remoteSensingSourceData.get(i).getPictureName())) {
RemoteSensingSourceData remoteSensingSourceData1 = remoteSensingSourceData.get(i);
remoteSensingSourceData1.setThumbnailLink(bladeFile.getLink());
this.baseMapper.updateById(remoteSensingSourceData1);
break;
}
}
}
});
return R.data("上传成功");
}
}