Explorar el Código

Merge remote-tracking branch 'origin/master'

wangchao %!s(int64=4) %!d(string=hace) años
padre
commit
9720d09362

+ 38 - 0
security-protection-service/src/main/java/com/ai/bss/security/protection/controller/UploadFileController.java

1
package com.ai.bss.security.protection.controller;
2
3
import org.apache.commons.lang.StringUtils;
4
import org.springframework.beans.factory.annotation.Autowired;
5
import org.springframework.stereotype.Controller;
6
import org.springframework.web.bind.annotation.RequestMapping;
7
import org.springframework.web.bind.annotation.RequestParam;
8
import org.springframework.web.bind.annotation.ResponseBody;
9
10
import com.ai.abc.api.model.CommonResponse;
11
import com.ai.bss.security.protection.service.interfaces.UploadFileService;
12
13
@Controller
14
@RequestMapping("/uploadFile")
15
public class UploadFileController {
16
17
	@Autowired
18
	private UploadFileService uploadFileService;
19
20
	/**
21
	 * 上传设备照片
22
	 * @param meFile
23
	 * @return
24
	 * @throws Exception
25
	 */
26
	@ResponseBody
27
	@RequestMapping("/getFileUrl")
28
	public CommonResponse<String> getFileUrl(@RequestParam String fileName) throws Exception {
29
		if (StringUtils.isEmpty(fileName)) {
30
			return CommonResponse.fail("501", "获取失败");
31
		}
32
33
		String minioFileUrl = uploadFileService.getFileUrl(fileName);
34
35
		return CommonResponse.ok(minioFileUrl);
36
	}
37
38
}

+ 3 - 3
security-protection-service/src/main/java/com/ai/bss/security/protection/service/impl/UploadFileServiceImpl.java

91
	}
91
	}
92
92
93
	@Override
93
	@Override
94
	public List<Map<String, Object>> getFileUrl(List<Map<String, Object>> minioFileListMap, String mapkey,
94
	public List<Map<String, Object>> getFileUrlForListMap(List<Map<String, Object>> minioFileListMap, String mapkey,
95
			String minioFileUrlKey) throws Exception {
95
			String minioFileUrlKey) throws Exception {
96
		if (CollectionUtils.isEmpty(minioFileListMap)) {
96
		if (CollectionUtils.isEmpty(minioFileListMap)) {
97
			log.debug("批量获取文件的url为空");
97
			log.debug("批量获取文件的url为空");
100
100
101
		String minioFileName = String.valueOf(minioFileListMap.get(0).get(mapkey));
101
		String minioFileName = String.valueOf(minioFileListMap.get(0).get(mapkey));
102
102
103
		return getFileUrl(minioFileListMap, mapkey, minioFileUrlKey, getBucketName(minioFileName));
103
		return getFileUrlForListMap(minioFileListMap, mapkey, minioFileUrlKey, getBucketName(minioFileName));
104
	}
104
	}
105
105
106
	@Override
106
	@Override
107
	public List<Map<String, Object>> getFileUrl(List<Map<String, Object>> minioFileListMap, String mapkey,
107
	public List<Map<String, Object>> getFileUrlForListMap(List<Map<String, Object>> minioFileListMap, String mapkey,
108
			String minioFileUrlKey, String bucketName) throws Exception {
108
			String minioFileUrlKey, String bucketName) throws Exception {
109
		if (CollectionUtils.isEmpty(minioFileListMap)) {
109
		if (CollectionUtils.isEmpty(minioFileListMap)) {
110
			log.debug("批量获取文件的url为空");
110
			log.debug("批量获取文件的url为空");

+ 13 - 10
security-protection-service/src/main/java/com/ai/bss/security/protection/service/interfaces/UploadFileService.java

31
31
32
	/**
32
	/**
33
	 * 批量获取文件的url地址
33
	 * 批量获取文件的url地址
34
	 * @param minioFileListMap
35
	 * @param mapkey
36
	 * @param minioFileUrlKey
34
	 * @param minioFileListMap 数据列表
35
	 * @param mapkey 数据列表中minioFileName的key
36
	 * @param minioFileUrlKey 数据列表中minioFileUrl的key
37
	 * @return
37
	 * @return
38
	 * @throws Exception
38
	 * @throws Exception
39
	 */
39
	 */
40
	List<Map<String,Object>> getFileUrl(List<Map<String,Object>> minioFileListMap,String mapkey,String minioFileUrlKey) throws Exception;
41
	
40
	List<Map<String, Object>> getFileUrlForListMap(List<Map<String, Object>> minioFileListMap, String mapkey,
41
			String minioFileUrlKey) throws Exception;
42
42
	/**
43
	/**
43
	 * 批量获取文件的url地址
44
	 * 批量获取文件的url地址
44
	 * @param minioFileListMap
45
	 * @param key
46
	 * @param bucketName
45
	 * @param minioFileListMap 数据列表
46
	 * @param mapkey 数据列表中minioFileName的key
47
	 * @param minioFileUrlKey 数据列表中minioFileUrl的key
48
	 * @param bucketName 存储文件的桶名(文件夹)
47
	 * @return
49
	 * @return
48
	 * @throws Exception
50
	 * @throws Exception
49
	 */
51
	 */
50
	List<Map<String,Object>> getFileUrl(List<Map<String,Object>> minioFileListMap,String mapkey,String minioFileUrlKey, String bucketName) throws Exception;
51
	
52
	List<Map<String, Object>> getFileUrlForListMap(List<Map<String, Object>> minioFileListMap, String mapkey,
53
			String minioFileUrlKey, String bucketName) throws Exception;
54
52
	/**
55
	/**
53
	 * 移除文件
56
	 * 移除文件
54
	 * @param minioFileName minio文件标识
57
	 * @param minioFileName minio文件标识