This commit is contained in:
yyhouc 2023-06-07 13:52:51 +08:00
commit 102ef245fd
9 changed files with 225 additions and 23 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

@ -169,6 +169,10 @@ public class EntityDataUserVo {
*/
private String productTime;
/**
* 1-Optical satellite, 2-Night light satellite, 3-Video satellite, 4-Hyperspectral satellite, 5-Radar satellite
*/
private Integer satelliteTypeSelect;
/**
* 文件信息

View File

@ -341,6 +341,7 @@ public class DisasterInfoController {
if (disasterInfo.getRespondStatus() == 2) {
String numbering = serialNumberService.generateNumbering(disasterInfo.getDisasterType());
disasterInfo.setVordmId(numbering);
disasterInfo.setRespondTime(new Date());
}
Boolean flag = disasterInfoService.updateById(disasterInfo);
return R.data(flag);

View File

@ -92,7 +92,7 @@ public class NewsController {
}
/**
* 导入供应商模板
* 导入
* @param file
* @return
*/

View File

@ -3,19 +3,18 @@ package com.kening.vordm.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.kening.vordm.entity.*;
import com.kening.vordm.entity.DisasterInfo;
import com.kening.vordm.entity.RemoteSensingSourceData;
import com.kening.vordm.service.DisasterInfoService;
import com.kening.vordm.service.RemoteSensingSourceDataService;
import com.kening.vordm.vo.GroupByUse;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
@RestController
@AllArgsConstructor
@ -77,6 +76,32 @@ public class RemoteSensingSourceDataController {
public R approval(@RequestBody RemoteSensingSourceData remoteSensingSourceData){
return R.status(remoteSensingSourceDataService.updateById(remoteSensingSourceData));
}
@PostMapping("/addRemoteSensingSourceData")
public R addRemoteSensingSourceData(@RequestBody RemoteSensingSourceData remoteSensingSourceData){
return R.status(remoteSensingSourceDataService.save(remoteSensingSourceData));
}
/**
* 导入
* @param file
* @return
*/
@PostMapping({"/importTemplate"})
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));
}
@DeleteMapping("/remove")
public R<Boolean> delete(@RequestBody List<Long> ids) {
return R.status(remoteSensingSourceDataService.removeByIds(ids));

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">
@ -84,7 +86,7 @@
and r.product_resolution &gt; #{remoteSensingSourceData.productResolutionMin}
</if>
<if test="remoteSensingSourceData.satelliteCodeListNew != null and remoteSensingSourceData.satelliteCodeListNew != '' and remoteSensingSourceData.satelliteCodeListNew.size() != 0">
and r.satellite_code in
and r.satellite_type_select in
<foreach item="AList" index="index" collection="remoteSensingSourceData.satelliteCodeListNew"
open="(" separator="," close=")">#{AList}
</foreach>

View File

@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.kening.vordm.entity.EntityData;
import com.kening.vordm.entity.RemoteSensingSourceData;
import com.kening.vordm.vo.GroupByUse;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@ -20,4 +22,8 @@ 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

@ -22,6 +22,7 @@ import org.springblade.common.utils.ExcelCellUtil;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.w3c.dom.Text;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -129,7 +130,7 @@ public class NewsServiceImpl extends ServiceImpl<NewsMapper, News>
String time = ExcelCellUtil.strHandle(row.get(1));
String contentNew = ExcelCellUtil.strHandle(row.get(2));
String contentNew = ExcelCellUtil.strHandle( row.get(2));
String userName = ExcelCellUtil.strHandle(row.get(3));
String favorite_count = ExcelCellUtil.strHandle(row.get(4));
@ -150,7 +151,9 @@ public class NewsServiceImpl extends ServiceImpl<NewsMapper, News>
} else if (typeData == 3) {
socialMedia.setType(1);
}
if (link!=null) {
socialMedia.setLink(link);
}
if (time != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date dateStr = null;

View File

@ -1,28 +1,45 @@
package com.kening.vordm.service.impl;
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;
import com.kening.vordm.entity.News;
import com.kening.vordm.entity.RemoteSensingSourceData;
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;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
/**
* @author G1393
* @description 针对表remote_sensing_source_data(遥感影像源数据)的数据库操作Service实现
* @createDate 2023-04-04 15:54:31
*/
* @author G1393
* @description 针对表remote_sensing_source_data(遥感影像源数据)的数据库操作Service实现
* @createDate 2023-04-04 15:54:31
*/
@Service
public class RemoteSensingSourceDataServiceImpl extends ServiceImpl<RemoteSensingSourceDataMapper, RemoteSensingSourceData>
implements RemoteSensingSourceDataService {
implements RemoteSensingSourceDataService {
/**
* 对象存储模块
*/
@Autowired
private MinioTemplate minioTemplate;
@Override
public List<RemoteSensingSourceData> getRemoteSensingSourceData(String disasterType, String disasterCountry, String disasterTime) {
@ -34,20 +51,20 @@ implements RemoteSensingSourceDataService {
List<productResolutionVo> productResolutionVos = remoteSensingSourceData.getProductResolutionVos();
String satelliteCodeList = remoteSensingSourceData.getSatelliteCodeList();
List<String> result = new ArrayList<>();
if (satelliteCodeList!=null) {
if (satelliteCodeList != null) {
result = Arrays.asList(satelliteCodeList.split(","));
remoteSensingSourceData.setSatelliteCodeListNew(result);
}
IPage<RemoteSensingSourceData> remoteSensingSourceDataByCondition = new Page<>();
if (productResolutionVos != null && !productResolutionVos.isEmpty()){
if (productResolutionVos != null && !productResolutionVos.isEmpty()) {
List<RemoteSensingSourceData> remoteSensingSourceData1 = new ArrayList<>();
productResolutionVos.stream().forEach(productResolutionVo -> {
if (Objects.equals(productResolutionVo.getProductResolutionMax(), new Double("1000"))){
if (Objects.equals(productResolutionVo.getProductResolutionMax(), new Double("1000"))) {
remoteSensingSourceData.setProductResolutionMax(null);
remoteSensingSourceData.setProductResolutionMin(productResolutionVo.getProductResolutionMin());
}else {
} else {
remoteSensingSourceData.setProductResolutionMin(productResolutionVo.getProductResolutionMin());
remoteSensingSourceData.setProductResolutionMax(productResolutionVo.getProductResolutionMax());
}
@ -57,9 +74,143 @@ implements RemoteSensingSourceDataService {
remoteSensingSourceDataByCondition.setRecords(remoteSensingSourceData1);
remoteSensingSourceDataByCondition.setTotal(remoteSensingSourceData1.size());
}else {
} else {
remoteSensingSourceDataByCondition = this.baseMapper.getRemoteSensingSourceDataByCondition(remoteSensingSourceData, page);
}
return remoteSensingSourceDataByCondition;
}
@Override
public R importTemplate(MultipartFile file, Long disasterId) {
List content;
try {
ExcelReader reader = ExcelUtil.getReader(file.getInputStream());
content = reader.read();
} catch (Exception var30) {
return R.fail("上传文件格式解析错误");
}
if (CollectionUtil.isEmpty(content)) {
return R.fail("文件内容为空!");
}
for (int i = 0; i < content.size(); ++i) {
List<Object> row = (List) content.get(i);
if (i != 0) {
if (CollUtil.isNotEmpty(row)) {
String thumbnail_link = ExcelCellUtil.strHandle(row.get(0));
String product_level = ExcelCellUtil.strHandle(row.get(1));
String product_serial_num = ExcelCellUtil.strHandle(row.get(2));
String product_time = ExcelCellUtil.strHandle(row.get(3));
String product_resolution = ExcelCellUtil.strHandle(row.get(4));
String cloud_cover = ExcelCellUtil.strHandle(row.get(5));
String satellite_code = ExcelCellUtil.strHandle(row.get(6));
String upper_left_lat = ExcelCellUtil.strHandle(row.get(7));
String upper_left_lon = ExcelCellUtil.strHandle(row.get(8));
String upper_right_lat = ExcelCellUtil.strHandle(row.get(9));
String upper_right_lon = ExcelCellUtil.strHandle(row.get(10));
String view_center_lat = ExcelCellUtil.strHandle(row.get(11));
String view_center_lon = ExcelCellUtil.strHandle(row.get(12));
String lower_right_lat = ExcelCellUtil.strHandle(row.get(13));
String lower_right_lon = ExcelCellUtil.strHandle(row.get(14));
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 satellite_type_select = ExcelCellUtil.strHandle(row.get(18));
String picture_name = ExcelCellUtil.strHandle(row.get(19));
RemoteSensingSourceData remoteSensingSourceData = new RemoteSensingSourceData();
remoteSensingSourceData.setThumbnailLink(thumbnail_link);
remoteSensingSourceData.setProductLevel(product_level);
remoteSensingSourceData.setProductSerialNum(product_serial_num);
if (product_time != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date dateStr = null;
try {
dateStr = sdf.parse(product_time);
} catch (ParseException e) {
return R.fail("时间格式错误");
}
remoteSensingSourceData.setProductTime(dateStr);
}
if (product_resolution != null) {
remoteSensingSourceData.setProductResolution(Double.parseDouble(product_resolution));
}
if (cloud_cover != null) {
remoteSensingSourceData.setCloudCover(Integer.parseInt(cloud_cover));
}
if (satellite_code != null) {
remoteSensingSourceData.setSatelliteCode(satellite_code);
}
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_right_lat != null) {
remoteSensingSourceData.setUpperRightLat(Double.parseDouble(upper_right_lat));
}
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_lon != null) {
remoteSensingSourceData.setViewCenterLon(Double.parseDouble(view_center_lon));
}
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_left_lat != null) {
remoteSensingSourceData.setLowerLeftLat(Double.parseDouble(lower_left_lat));
}
if (lower_left_lon != null) {
remoteSensingSourceData.setLowerLeftLon(Double.parseDouble(lower_left_lon));
}
if (source_organization != null) {
remoteSensingSourceData.setSourceOrganization(source_organization);
}
if (satellite_type_select != null) {
remoteSensingSourceData.setSatelliteTypeSelect(Integer.parseInt(satellite_type_select));
}
if (picture_name != null) {
remoteSensingSourceData.setPictureName(picture_name);
}
remoteSensingSourceData.setDisasterId(disasterId);
remoteSensingSourceData.setCreateTime(new Date());
remoteSensingSourceData.setStatus(3);
this.baseMapper.insert(remoteSensingSourceData);
}
}
}
return R.data("上传成功!");
}
@Override
public R importTemplateImgList(List<MultipartFile> fileList, Long disasterId) {
LambdaQueryWrapper<RemoteSensingSourceData> qw = new LambdaQueryWrapper<>();
qw.eq(RemoteSensingSourceData::getDisasterId, disasterId);
qw.isNotNull(RemoteSensingSourceData::getPictureName);
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 (caselsh.equals(remoteSensingSourceData.get(i).getPictureName())) {
RemoteSensingSourceData remoteSensingSourceData1 = remoteSensingSourceData.get(i);
remoteSensingSourceData1.setThumbnailLink(bladeFile.getLink());
this.baseMapper.updateById(remoteSensingSourceData1);
break;
}
}
});
return R.data("上传成功");
}
}