| | |
| | | package com.ard.route.service.impl; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | import com.ard.common.annotation.DataScope; |
| | | import com.ard.common.utils.DateUtils; |
| | | import com.ard.common.utils.SecurityUtils; |
| | | import com.ard.common.utils.uuid.IdUtils; |
| | | import com.ard.oss.service.impl.OssServiceContext; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.ard.route.mapper.ArdRouteFileMapper; |
| | | import com.ard.route.domain.ArdRouteFile; |
| | | import com.ard.route.domain.route.ArdRouteFile; |
| | | import com.ard.route.service.IArdRouteFileService; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 文件Service业务层处理 |
| | |
| | | |
| | | @Autowired |
| | | private ArdRouteFileMapper ardRouteFileMapper; |
| | | |
| | | @Autowired |
| | | private OssServiceContext ossService; |
| | | |
| | | /** |
| | | * 查询文件 |
| | |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertArdRouteFile(ArdRouteFile ardRouteFile) { |
| | | public int insertArdRouteFile(ArdRouteFile ardRouteFile, MultipartFile file){ |
| | | ardRouteFile.setId(IdUtils.simpleUUID()); |
| | | ardRouteFile.setCreateTime(DateUtils.getNowDate()); |
| | | // 放到默认文件夹 |
| | | ardRouteFile.setFolderId("0"); |
| | | try { |
| | | String url = ossService.upload("kmz",file); |
| | | ardRouteFile.setFilePath(url); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return ardRouteFileMapper.insertArdRouteFile(ardRouteFile); |
| | | } |
| | | |