| | |
| | | package cn.gistack.resource.feign; |
| | | |
| | | import cn.gistack.resource.builder.oss.OssBuilder; |
| | | import cn.gistack.resource.entity.FormateTuEntity; |
| | | import cn.gistack.resource.entity.QieTuEntity; |
| | | import cn.gistack.resource.panoramaUtils.QietuResult; |
| | | import com.alibaba.fastjson.JSON; |
| | |
| | | @Override |
| | | @PostMapping(UPLOAD_QIETU) |
| | | public R uploadQietu(QieTuEntity qieTuEntity) throws IOException { |
| | | // public R uploadQietu(HashMap<String,String> qietuHashMap,String resGuid) throws IOException { |
| | | HashMap<String,String> qietuHashMap = qieTuEntity.getQietuHashMap(); |
| | | System.err.println("切图的路径:"+qietuHashMap); |
| | | |
| | | String resGuid = qieTuEntity.getResGuid(); |
| | | |
| | | List<String> qieTuUrlList = new ArrayList<String>(); |
| | |
| | | return R.data(result); |
| | | } |
| | | |
| | | @Override |
| | | @PostMapping(UPLOAD_FORMATETU) |
| | | public R uploadFormate(QieTuEntity qieTuEntity) throws IOException { |
| | | |
| | | ArrayList<FormateTuEntity> list = qieTuEntity.getList(); |
| | | |
| | | |
| | | // Set<String> mapKey = qietuHashMap.keySet(); |
| | | if(list != null && list.size()>0) { |
| | | for (FormateTuEntity item : list) { |
| | | |
| | | String picName = item.getPicName(); |
| | | String url = item.getLinshiUrl(); |
| | | Path qietuPath = Paths.get(url); |
| | | File qietufile = qietuPath.toFile(); |
| | | FileInputStream fileInputStream = new FileInputStream(qietufile); |
| | | BladeFile bladeFile = ossBuilder.template().putFile(picName, fileInputStream); |
| | | fileInputStream.close(); // 关闭文件流 |
| | | |
| | | String link = bladeFile.getLink(); |
| | | |
| | | // 临时图片上传完成后删除临时文件 |
| | | if (qietufile.exists()) { |
| | | // 删除指定文件,不存在报异常 |
| | | FileUtils.forceDelete(qietufile); |
| | | } |
| | | |
| | | item.setLinshiUrl(link); |
| | | |
| | | } |
| | | } |
| | | QieTuEntity result = new QieTuEntity(); |
| | | result.setList(list); |
| | | |
| | | return R.data(result); |
| | | } |
| | | |
| | | @PostMapping(value = UPLOAD_FILE) |
| | | public String uploadFile(String fileName, MultipartFile file) throws Exception{ |
| | | |