| | |
| | | |
| | | import java.util.List; |
| | | import com.ard.common.utils.DateUtils; |
| | | import com.ard.common.utils.file.FileUtils; |
| | | import com.ard.common.utils.uuid.IdUtils; |
| | | import com.ard.oss.model.MinioUploadResult; |
| | | import com.ard.oss.service.impl.OssServiceContext; |
| | | import com.ard.route.domain.route.ArdRouteInformation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.ard.route.mapper.ArdRouteInformationMapper; |
| | | import com.ard.route.service.IArdRouteInformationService; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import static com.ard.route.util.ToolUtils.getFileNameWithoutExtension; |
| | | |
| | | /** |
| | | * 航线(kmz)Service业务层处理 |
| | |
| | | return ardRouteInformationMapper.deleteArdRouteInformationById(id); |
| | | } |
| | | |
| | | /** |
| | | * 导入航线(kmz)文件 |
| | | * |
| | | * @param file 文件 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public MinioUploadResult uploadArdRouteInformation(MultipartFile file) { |
| | | try { |
| | | String url = ossService.upload("kmz",file); |
| | | ArdRouteInformation information = new ArdRouteInformation(); |
| | | information.setFileName(file.getOriginalFilename()); |
| | | information.setFileNameNew(getFileNameWithoutExtension(url)); |
| | | information.setUpPath(url); |
| | | information.setUpFileSize((double) file.getSize()); |
| | | insertArdRouteInformation(information); |
| | | return MinioUploadResult.builder() |
| | | .url(url) |
| | | .newFileName(FileUtils.getName(url)) |
| | | .originalFilename(file.getOriginalFilename()) |
| | | .build(); |
| | | }catch (Exception e){ |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |