3e05b567 by xiaojie

【数据资产】

1、上传文件到obs
1 parent 6f68c475
...@@ -220,15 +220,6 @@ public class EnterpriseController { ...@@ -220,15 +220,6 @@ public class EnterpriseController {
220 return CommonRes.success(vo); 220 return CommonRes.success(vo);
221 } 221 }
222 222
223 @Autowired
224 private DataPortService dataPortService;
225
226 @PostMapping("/test")
227 public CommonRes test(@RequestBody EnterpriseRegisterRQVO enterpriseRegisterRQVO) {
228 dataPortService.test(enterpriseRegisterRQVO);
229 return CommonRes.success(true);
230 }
231
232 //endregion 223 //endregion
233 224
234 } 225 }
......
...@@ -35,7 +35,7 @@ public interface DaopCommonFeign { ...@@ -35,7 +35,7 @@ public interface DaopCommonFeign {
35 ResponseEntity<ByteArrayResource> downloadFile(@RequestParam(value = "filePath", required = true) String filePath); 35 ResponseEntity<ByteArrayResource> downloadFile(@RequestParam(value = "filePath", required = true) String filePath);
36 36
37 /** 37 /**
38 * 上传 38 * 上传(公有桶)
39 * @param image 39 * @param image
40 * @return 40 * @return
41 */ 41 */
...@@ -43,11 +43,11 @@ public interface DaopCommonFeign { ...@@ -43,11 +43,11 @@ public interface DaopCommonFeign {
43 CommonRes uploadImage(@RequestPart MultipartFile image); 43 CommonRes uploadImage(@RequestPart MultipartFile image);
44 44
45 /** 45 /**
46 * 上传 46 * 上传(私有桶)
47 * @param file 47 * @param file
48 * @return 48 * @return
49 */ 49 */
50 @RequestMapping(value = "/obs/upload-file-for-import",method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) 50 @RequestMapping(value = "/obs/upload-file-for-import_base_name",method = RequestMethod.POST, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
51 CommonRes uploadFile(@RequestPart MultipartFile file); 51 CommonRes uploadFile(@RequestPart MultipartFile file, @RequestPart String fileName);
52 52
53 } 53 }
......
...@@ -122,7 +122,7 @@ public class DataPortServiceImpl implements DataPortService { ...@@ -122,7 +122,7 @@ public class DataPortServiceImpl implements DataPortService {
122 } else { 122 } else {
123 String fileName = "身份凭证.png"; 123 String fileName = "身份凭证.png";
124 MultipartFile image = new MockMultipartFile(fileName, fileName, "application/octet-stream", resourceByteArray); 124 MultipartFile image = new MockMultipartFile(fileName, fileName, "application/octet-stream", resourceByteArray);
125 String url = (String) daopCommonFeign.uploadImage(image).getData(); 125 String url = (String) daopCommonFeign.uploadFile(image, fileName).getData();
126 log.info("======url======, {}", url); 126 log.info("======url======, {}", url);
127 LambdaUpdateWrapper<MfEnterprise> updateWrapper = new LambdaUpdateWrapper<>(); 127 LambdaUpdateWrapper<MfEnterprise> updateWrapper = new LambdaUpdateWrapper<>();
128 updateWrapper.set(MfEnterprise::getTrustedIdentityCredential, url); 128 updateWrapper.set(MfEnterprise::getTrustedIdentityCredential, url);
...@@ -156,7 +156,7 @@ public class DataPortServiceImpl implements DataPortService { ...@@ -156,7 +156,7 @@ public class DataPortServiceImpl implements DataPortService {
156 } 156 }
157 } else { 157 } else {
158 MultipartFile image = new MockMultipartFile("测试.png", "测试,png", "application/octet-stream", resource.getByteArray()); 158 MultipartFile image = new MockMultipartFile("测试.png", "测试,png", "application/octet-stream", resource.getByteArray());
159 String url = (String) ((CommonRes<?>) daopCommonFeign.uploadFile(image).getData()).getData(); 159 String url = (String) daopCommonFeign.uploadFile(image, "测试.png").getData();
160 log.info("======url======, {}", url); 160 log.info("======url======, {}", url);
161 System.out.println(url); 161 System.out.println(url);
162 } 162 }
...@@ -190,7 +190,7 @@ public class DataPortServiceImpl implements DataPortService { ...@@ -190,7 +190,7 @@ public class DataPortServiceImpl implements DataPortService {
190 } else { 190 } else {
191 String fileName = "身份凭证.png"; 191 String fileName = "身份凭证.png";
192 MultipartFile image = new MockMultipartFile(fileName, fileName, "application/octet-stream", resourceByteArray); 192 MultipartFile image = new MockMultipartFile(fileName, fileName, "application/octet-stream", resourceByteArray);
193 String url = (String) daopCommonFeign.uploadImage(image).getData(); 193 String url = (String) daopCommonFeign.uploadFile(image, fileName).getData();
194 log.info("======url======, {}", url); 194 log.info("======url======, {}", url);
195 LambdaUpdateWrapper<MfEnterprise> updateWrapper = new LambdaUpdateWrapper<>(); 195 LambdaUpdateWrapper<MfEnterprise> updateWrapper = new LambdaUpdateWrapper<>();
196 updateWrapper.set(MfEnterprise::getTrustedIdentityCredential, url); 196 updateWrapper.set(MfEnterprise::getTrustedIdentityCredential, url);
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!