Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pms
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
pms
Commits
1e92c8c8
提交
1e92c8c8
authored
6月 25, 2023
作者:
zhenjie
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of
ssh://git.mmcuav.cn:8222/iuav/pms
into develop
上级
452905e0
3d9dfc71
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
128 行增加
和
42 行删除
+128
-42
configMap.yaml
kustomization/base/configMap.yaml
+1
-1
deployment.yaml
kustomization/base/deployment.yaml
+8
-2
kustomization.yaml
kustomization/overlays/dev/kustomization.yaml
+1
-1
GlobalFormDateConvert.java
src/main/java/com/mmc/pms/config/GlobalFormDateConvert.java
+0
-3
PartUploadController.java
...ain/java/com/mmc/pms/controller/PartUploadController.java
+101
-5
UploadController.java
src/main/java/com/mmc/pms/controller/UploadController.java
+14
-23
JsonUtil.java
src/main/java/com/mmc/pms/json/JsonUtil.java
+0
-6
CategoriesServiceImpl.java
.../java/com/mmc/pms/service/Impl/CategoriesServiceImpl.java
+3
-1
没有找到文件。
kustomization/base/configMap.yaml
浏览文件 @
1e92c8c8
...
@@ -5,5 +5,5 @@ metadata:
...
@@ -5,5 +5,5 @@ metadata:
namespace
:
default
namespace
:
default
data
:
data
:
SPRING_PROFILES_ACTIVE
:
default
SPRING_PROFILES_ACTIVE
:
default
SW_AGENT_COLLECTOR_BACKEND_SERVICES
:
"
default-oap.
default
:11800"
SW_AGENT_COLLECTOR_BACKEND_SERVICES
:
"
default-oap.
skywalking-swck-system
:11800"
SW_AGENT_NAME
:
pms
SW_AGENT_NAME
:
pms
kustomization/base/deployment.yaml
浏览文件 @
1e92c8c8
...
@@ -22,6 +22,9 @@ spec:
...
@@ -22,6 +22,9 @@ spec:
volumeMounts
:
volumeMounts
:
-
name
:
log-of-app
-
name
:
log-of-app
mountPath
:
/var/log/app
mountPath
:
/var/log/app
-
name
:
localtime
mountPath
:
/etc/localtime
readOnly
:
true
resources
:
resources
:
limits
:
limits
:
memory
:
1024Mi
memory
:
1024Mi
...
@@ -47,4 +50,7 @@ spec:
...
@@ -47,4 +50,7 @@ spec:
volumes
:
volumes
:
-
name
:
log-of-app
-
name
:
log-of-app
hostPath
:
hostPath
:
path
:
/var/log/app
path
:
/var/log/app
\ No newline at end of file
-
name
:
localtime
hostPath
:
path
:
/etc/localtime
\ No newline at end of file
kustomization/overlays/dev/kustomization.yaml
浏览文件 @
1e92c8c8
...
@@ -18,4 +18,4 @@ patches:
...
@@ -18,4 +18,4 @@ patches:
images
:
images
:
-
name
:
REGISTRY/NAMESPACE/IMAGE:TAG
-
name
:
REGISTRY/NAMESPACE/IMAGE:TAG
newName
:
mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/pms
newName
:
mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/pms
newTag
:
81962caa60ca37cac7193d1b082e03ec12050775
newTag
:
194916f4e3221cae1ca3a244509e5a2311dca5db
src/main/java/com/mmc/pms/config/GlobalFormDateConvert.java
浏览文件 @
1e92c8c8
...
@@ -33,7 +33,6 @@ public class GlobalFormDateConvert implements Converter<String, Date> {
...
@@ -33,7 +33,6 @@ public class GlobalFormDateConvert implements Converter<String, Date> {
// 自定义函数,将字符串转Date 参1:传入的日期字符串 参2:格式参数
// 自定义函数,将字符串转Date 参1:传入的日期字符串 参2:格式参数
public
Date
parseDate
(
String
source
,
String
format
)
{
public
Date
parseDate
(
String
source
,
String
format
)
{
System
.
out
.
println
(
"parseDate转换日期"
);
Date
date
=
null
;
Date
date
=
null
;
try
{
try
{
// 日期格式转换器
// 日期格式转换器
...
@@ -48,8 +47,6 @@ public class GlobalFormDateConvert implements Converter<String, Date> {
...
@@ -48,8 +47,6 @@ public class GlobalFormDateConvert implements Converter<String, Date> {
// convert转换方法 ,s是将会传递过来的日期的字符串
// convert转换方法 ,s是将会传递过来的日期的字符串
@Override
@Override
public
Date
convert
(
String
source
)
{
public
Date
convert
(
String
source
)
{
System
.
out
.
println
(
"convert日期格式转换器"
);
if
(
StringUtils
.
isEmpty
(
source
))
{
if
(
StringUtils
.
isEmpty
(
source
))
{
return
null
;
return
null
;
}
}
...
...
src/main/java/com/mmc/pms/controller/PartUploadController.java
浏览文件 @
1e92c8c8
package
com
.
mmc
.
pms
.
controller
;
package
com
.
mmc
.
pms
.
controller
;
import
com.aliyun.oss.ClientException
;
import
com.aliyun.oss.OSS
;
import
com.aliyun.oss.OSS
;
import
com.aliyun.oss.OSSClientBuilder
;
import
com.aliyun.oss.OSSClientBuilder
;
import
com.aliyun.oss.OSSException
;
import
com.aliyun.oss.model.*
;
import
com.aliyun.oss.model.*
;
import
com.mmc.pms.common.ResultBody
;
import
com.mmc.pms.common.ResultBody
;
import
com.mmc.pms.json.JsonUtil
;
import
com.mmc.pms.json.JsonUtil
;
...
@@ -9,12 +11,15 @@ import com.mmc.pms.redis.RedisConstant;
...
@@ -9,12 +11,15 @@ import com.mmc.pms.redis.RedisConstant;
import
com.mmc.pms.util.OssConstant
;
import
com.mmc.pms.util.OssConstant
;
import
com.mmc.pms.util.PartUploadInfo
;
import
com.mmc.pms.util.PartUploadInfo
;
import
com.mmc.pms.util.TDateUtil
;
import
com.mmc.pms.util.TDateUtil
;
import
com.mmc.pms.util.XmlUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.File
;
import
java.io.File
;
...
@@ -23,6 +28,7 @@ import java.io.IOException;
...
@@ -23,6 +28,7 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.UUID
;
/**
/**
* @Author small @Date 2023/5/23 13:46 @Version 1.0
* @Author small @Date 2023/5/23 13:46 @Version 1.0
...
@@ -30,10 +36,12 @@ import java.util.List;
...
@@ -30,10 +36,12 @@ import java.util.List;
@Api
(
tags
=
{
"分片上传"
})
@Api
(
tags
=
{
"分片上传"
})
@RestController
@RestController
@RequestMapping
(
"/partupload"
)
@RequestMapping
(
"/partupload"
)
@Slf4j
public
class
PartUploadController
{
public
class
PartUploadController
{
@Autowired
private
StringRedisTemplate
stringRedisTemplate
;
@Autowired
private
StringRedisTemplate
stringRedisTemplate
;
@ApiIgnore
@ApiOperation
(
value
=
"初始化分片上传"
)
@ApiOperation
(
value
=
"初始化分片上传"
)
@GetMapping
(
"/initPartUpload"
)
@GetMapping
(
"/initPartUpload"
)
public
ResultBody
initPartUpload
(
@RequestParam
String
fileName
,
HttpServletRequest
httpRequest
)
{
public
ResultBody
initPartUpload
(
@RequestParam
String
fileName
,
HttpServletRequest
httpRequest
)
{
...
@@ -74,7 +82,7 @@ public class PartUploadController {
...
@@ -74,7 +82,7 @@ public class PartUploadController {
.
set
(
RedisConstant
.
createPartUploadKey
(
uploadId
),
JsonUtil
.
parseObjToJson
(
pinfo
));
.
set
(
RedisConstant
.
createPartUploadKey
(
uploadId
),
JsonUtil
.
parseObjToJson
(
pinfo
));
return
ResultBody
.
success
(
uploadId
);
return
ResultBody
.
success
(
uploadId
);
}
}
@ApiIgnore
@ApiOperation
(
value
=
"进行片段上传"
)
@ApiOperation
(
value
=
"进行片段上传"
)
@PostMapping
(
"/partUpload"
)
@PostMapping
(
"/partUpload"
)
public
ResultBody
partUpload
(
public
ResultBody
partUpload
(
...
@@ -133,13 +141,12 @@ public class PartUploadController {
...
@@ -133,13 +141,12 @@ public class PartUploadController {
// 完成上传。
// 完成上传。
CompleteMultipartUploadResult
completeMultipartUploadResult
=
CompleteMultipartUploadResult
completeMultipartUploadResult
=
ossClient
.
completeMultipartUpload
(
completeMultipartUploadRequest
);
ossClient
.
completeMultipartUpload
(
completeMultipartUploadRequest
);
// 关闭OSSClient。
System
.
out
.
println
(
completeMultipartUploadResult
.
getETag
());
// 关闭OSSClient。
ossClient
.
shutdown
();
ossClient
.
shutdown
();
return
ResultBody
.
success
();
return
ResultBody
.
success
();
}
}
@ApiIgnore
@ApiOperation
(
value
=
"上传到阿里云oss"
)
@ApiOperation
(
value
=
"上传到阿里云oss"
)
@PostMapping
(
"/oss"
)
@PostMapping
(
"/oss"
)
public
ResultBody
oss
(
public
ResultBody
oss
(
...
@@ -219,9 +226,98 @@ public class PartUploadController {
...
@@ -219,9 +226,98 @@ public class PartUploadController {
// 完成上传。
// 完成上传。
CompleteMultipartUploadResult
completeMultipartUploadResult
=
CompleteMultipartUploadResult
completeMultipartUploadResult
=
ossClient
.
completeMultipartUpload
(
completeMultipartUploadRequest
);
ossClient
.
completeMultipartUpload
(
completeMultipartUploadRequest
);
System
.
out
.
println
(
completeMultipartUploadResult
.
getETag
());
// 关闭OSSClient。
// 关闭OSSClient。
ossClient
.
shutdown
();
ossClient
.
shutdown
();
return
ResultBody
.
success
();
return
ResultBody
.
success
();
}
}
@PostMapping
(
"/multipartUpload"
)
public
ResultBody
multipartUpload
(
@RequestParam
(
"multipartUpload"
)
MultipartFile
uploadFile
,
HttpServletRequest
request
)
throws
IOException
{
OSS
ossClient
=
new
OSSClientBuilder
()
.
build
(
OssConstant
.
ENDPOINT
,
OssConstant
.
ACCESSKEYID
,
OssConstant
.
ACCESSKEYSECRET
);
File
file
=
XmlUtil
.
ossUpload
(
uploadFile
);
String
oldName
=
uploadFile
.
getOriginalFilename
();
String
newName
=
"file/"
+
UUID
.
randomUUID
().
toString
()
+
oldName
.
substring
(
oldName
.
lastIndexOf
(
"."
),
oldName
.
length
());
String
location
=
null
;
try
{
// 创建InitiateMultipartUploadRequest对象。
InitiateMultipartUploadRequest
requests
=
new
InitiateMultipartUploadRequest
(
OssConstant
.
BUCKET
,
newName
);
// 初始化分片。
InitiateMultipartUploadResult
upresult
=
ossClient
.
initiateMultipartUpload
(
requests
);
// 返回uploadId,它是分片上传事件的唯一标识。您可以根据该uploadId发起相关的操作,例如取消分片上传、查询分片上传等。
String
uploadId
=
upresult
.
getUploadId
();
List
<
PartETag
>
partETags
=
new
ArrayList
<
PartETag
>();
final
long
partSize
=
1
*
1024
*
1024L
;
//1 MB。
// 根据上传的数据大小计算分片数。以本地文件为例,说明如何通过File.length()获取上传数据的大小。
final
File
sampleFile
=
new
File
(
file
.
toString
());
long
fileLength
=
sampleFile
.
length
();
int
partCount
=
(
int
)
(
fileLength
/
partSize
);
if
(
fileLength
%
partSize
!=
0
)
{
partCount
++;
}
// 遍历分片上传。
for
(
int
i
=
0
;
i
<
partCount
;
i
++)
{
long
startPos
=
i
*
partSize
;
long
curPartSize
=
(
i
+
1
==
partCount
)
?
(
fileLength
-
startPos
)
:
partSize
;
UploadPartRequest
uploadPartRequest
=
new
UploadPartRequest
();
uploadPartRequest
.
setBucketName
(
OssConstant
.
BUCKET
);
uploadPartRequest
.
setKey
(
newName
);
uploadPartRequest
.
setUploadId
(
uploadId
);
// 设置上传的分片流。
// 以本地文件为例说明如何创建FIleInputstream,并通过InputStream.skip()方法跳过指定数据。
InputStream
instream
=
new
FileInputStream
(
sampleFile
);
instream
.
skip
(
startPos
);
uploadPartRequest
.
setInputStream
(
instream
);
// 设置分片大小。除了最后一个分片没有大小限制,其他的分片最小为100 KB。
uploadPartRequest
.
setPartSize
(
curPartSize
);
// 设置分片号。每一个上传的分片都有一个分片号,取值范围是1~10000,如果超出此范围,OSS将返回InvalidArgument错误码。
uploadPartRequest
.
setPartNumber
(
i
+
1
);
// 每个分片不需要按顺序上传,甚至可以在不同客户端上传,OSS会按照分片号排序组成完整的文件。
UploadPartResult
uploadPartResult
=
ossClient
.
uploadPart
(
uploadPartRequest
);
// 每次上传分片之后,OSS的返回结果包含PartETag。PartETag将被保存在partETags中。
partETags
.
add
(
uploadPartResult
.
getPartETag
());
}
CompleteMultipartUploadRequest
completeMultipartUploadRequest
=
new
CompleteMultipartUploadRequest
(
OssConstant
.
BUCKET
,
newName
,
uploadId
,
partETags
);
// 完成分片上传。
CompleteMultipartUploadResult
completeMultipartUploadResult
=
ossClient
.
completeMultipartUpload
(
completeMultipartUploadRequest
);
log
.
info
(
completeMultipartUploadResult
.
getETag
());
location
=
completeMultipartUploadResult
.
getLocation
();
}
catch
(
OSSException
oe
)
{
log
.
info
(
"Caught an OSSException, which means your request made it to OSS, "
+
"but was rejected with an error response for some reason."
);
log
.
info
(
"Error Message:"
+
oe
.
getErrorMessage
());
log
.
info
(
"Error Code:"
+
oe
.
getErrorCode
());
log
.
info
(
"Request ID:"
+
oe
.
getRequestId
());
log
.
info
(
"Host ID:"
+
oe
.
getHostId
());
}
catch
(
ClientException
ce
)
{
log
.
info
(
"Caught an ClientException, which means the client encountered "
+
"a serious internal problem while trying to communicate with OSS, "
+
"such as not being able to access the network."
);
log
.
info
(
"Error Message:"
+
ce
.
getMessage
());
}
finally
{
if
(
ossClient
!=
null
)
{
ossClient
.
shutdown
();
}
}
deleteFile
(
file
);
return
ResultBody
.
success
(
location
);
}
private
void
deleteFile
(
File
...
files
)
{
for
(
File
file
:
files
)
{
if
(
file
.
exists
())
{
file
.
delete
();
}
}
}
}
}
src/main/java/com/mmc/pms/controller/UploadController.java
浏览文件 @
1e92c8c8
...
@@ -18,6 +18,7 @@ import io.swagger.annotations.Api;
...
@@ -18,6 +18,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
springfox.documentation.annotations.ApiIgnore
;
import
springfox.documentation.annotations.ApiIgnore
;
...
@@ -36,6 +37,7 @@ import java.util.*;
...
@@ -36,6 +37,7 @@ import java.util.*;
@Api
(
tags
=
{
"上传文件"
})
@Api
(
tags
=
{
"上传文件"
})
@RestController
@RestController
@RequestMapping
(
"/upload"
)
@RequestMapping
(
"/upload"
)
@Slf4j
public
class
UploadController
{
public
class
UploadController
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy/MM/dd/"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy/MM/dd/"
);
...
@@ -124,20 +126,11 @@ public class UploadController {
...
@@ -124,20 +126,11 @@ public class UploadController {
// 断点续传上传。
// 断点续传上传。
UploadFileResult
uploadFileResult
=
ossClient
.
uploadFile
(
uploadFileRequest
);
UploadFileResult
uploadFileResult
=
ossClient
.
uploadFile
(
uploadFileRequest
);
location
=
uploadFileResult
.
getMultipartUploadResult
().
getLocation
();
location
=
uploadFileResult
.
getMultipartUploadResult
().
getLocation
();
System
.
out
.
println
(
uploadFileResult
);
}
catch
(
OSSException
oe
)
{
}
catch
(
OSSException
oe
)
{
System
.
out
.
println
(
"Caught an OSSException, which means your request made it to OSS, "
+
"but was rejected with an error response for some reason."
);
System
.
out
.
println
(
"Error Message:"
+
oe
.
getErrorMessage
());
System
.
out
.
println
(
"Error Code:"
+
oe
.
getErrorCode
());
System
.
out
.
println
(
"Request ID:"
+
oe
.
getRequestId
());
System
.
out
.
println
(
"Host ID:"
+
oe
.
getHostId
());
}
catch
(
Throwable
ce
)
{
}
catch
(
Throwable
ce
)
{
System
.
out
.
println
(
"Caught an ClientException, which means the client encountered "
+
"a serious internal problem while trying to communicate with OSS, "
+
"such as not being able to access the network."
);
System
.
out
.
println
(
"Error Message:"
+
ce
.
getMessage
());
}
finally
{
}
finally
{
// 关闭OSSClient。
// 关闭OSSClient。
if
(
ossClient
!=
null
)
{
if
(
ossClient
!=
null
)
{
...
@@ -183,7 +176,7 @@ public class UploadController {
...
@@ -183,7 +176,7 @@ public class UploadController {
.
build
(
OssConstant
.
ENDPOINT
,
OssConstant
.
ACCESSKEYID
,
OssConstant
.
ACCESSKEYSECRET
);
.
build
(
OssConstant
.
ENDPOINT
,
OssConstant
.
ACCESSKEYID
,
OssConstant
.
ACCESSKEYSECRET
);
List
list
=
new
LinkedList
();
List
list
=
new
LinkedList
();
if
(
uploadFile
!=
null
&&
uploadFile
.
length
>
0
)
{
if
(
uploadFile
!=
null
&&
uploadFile
.
length
>
0
)
{
System
.
out
.
println
(
"osses文件数量"
+
uploadFile
.
length
);
log
.
info
(
"osses文件数量"
+
uploadFile
.
length
);
for
(
int
i
=
0
;
i
<
uploadFile
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
uploadFile
.
length
;
i
++)
{
MultipartFile
file
=
uploadFile
[
i
];
MultipartFile
file
=
uploadFile
[
i
];
InputStream
inputStream
=
null
;
InputStream
inputStream
=
null
;
...
@@ -245,7 +238,7 @@ public class UploadController {
...
@@ -245,7 +238,7 @@ public class UploadController {
clientBuilderConfiguration
);
clientBuilderConfiguration
);
List
list
=
new
LinkedList
();
List
list
=
new
LinkedList
();
if
(
uploadFile
!=
null
&&
uploadFile
.
length
>
0
)
{
if
(
uploadFile
!=
null
&&
uploadFile
.
length
>
0
)
{
System
.
out
.
println
(
"osses文件数量"
+
uploadFile
.
length
);
log
.
info
(
"osses文件数量"
+
uploadFile
.
length
);
for
(
int
i
=
0
;
i
<
uploadFile
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
uploadFile
.
length
;
i
++)
{
MultipartFile
file
=
uploadFile
[
i
];
MultipartFile
file
=
uploadFile
[
i
];
InputStream
inputStream
=
null
;
InputStream
inputStream
=
null
;
...
@@ -266,7 +259,7 @@ public class UploadController {
...
@@ -266,7 +259,7 @@ public class UploadController {
+
UUID
.
randomUUID
().
toString
()
+
UUID
.
randomUUID
().
toString
()
+
oldName
.
substring
(
oldName
.
lastIndexOf
(
"."
),
oldName
.
length
());
+
oldName
.
substring
(
oldName
.
lastIndexOf
(
"."
),
oldName
.
length
());
ossClient
.
putObject
(
OssConstant
.
BUCKET
,
newName
,
bis
);
ossClient
.
putObject
(
OssConstant
.
BUCKET
,
newName
,
bis
);
System
.
out
.
println
(
"视频名称:"
+
newName
);
log
.
info
(
"视频名称:"
+
newName
);
list
.
add
(
"https://"
+
OssConstant
.
BUCKET
+
'.'
+
OssConstant
.
ENDPOINT
+
"/"
+
newName
);
list
.
add
(
"https://"
+
OssConstant
.
BUCKET
+
'.'
+
OssConstant
.
ENDPOINT
+
"/"
+
newName
);
}
}
}
}
...
@@ -309,7 +302,7 @@ public class UploadController {
...
@@ -309,7 +302,7 @@ public class UploadController {
clientBuilderConfiguration
);
clientBuilderConfiguration
);
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
();
if
(
uploadFile
!=
null
&&
uploadFile
.
length
>
0
)
{
if
(
uploadFile
!=
null
&&
uploadFile
.
length
>
0
)
{
System
.
out
.
println
(
"osses文件数量"
+
uploadFile
.
length
);
log
.
info
(
"osses文件数量"
+
uploadFile
.
length
);
for
(
int
i
=
0
;
i
<
uploadFile
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
uploadFile
.
length
;
i
++)
{
MultipartFile
file
=
uploadFile
[
i
];
MultipartFile
file
=
uploadFile
[
i
];
InputStream
inputStream
=
null
;
InputStream
inputStream
=
null
;
...
@@ -330,7 +323,7 @@ public class UploadController {
...
@@ -330,7 +323,7 @@ public class UploadController {
+
UUID
.
randomUUID
().
toString
()
+
UUID
.
randomUUID
().
toString
()
+
oldName
.
substring
(
oldName
.
lastIndexOf
(
"."
),
oldName
.
length
());
+
oldName
.
substring
(
oldName
.
lastIndexOf
(
"."
),
oldName
.
length
());
ossClient
.
putObject
(
OssConstant
.
BUCKET
,
newName
,
bis
);
ossClient
.
putObject
(
OssConstant
.
BUCKET
,
newName
,
bis
);
System
.
out
.
println
(
"视频名称:"
+
newName
);
log
.
info
(
"视频名称:"
+
newName
);
map
.
put
(
map
.
put
(
"filePath"
,
"filePath"
,
"https://"
+
OssConstant
.
BUCKET
+
'.'
+
OssConstant
.
ENDPOINT
+
"/"
+
newName
);
"https://"
+
OssConstant
.
BUCKET
+
'.'
+
OssConstant
.
ENDPOINT
+
"/"
+
newName
);
...
@@ -369,7 +362,7 @@ public class UploadController {
...
@@ -369,7 +362,7 @@ public class UploadController {
.
build
(
OssConstant
.
ENDPOINT
,
OssConstant
.
ACCESSKEYID
,
OssConstant
.
ACCESSKEYSECRET
);
.
build
(
OssConstant
.
ENDPOINT
,
OssConstant
.
ACCESSKEYID
,
OssConstant
.
ACCESSKEYSECRET
);
List
list
=
new
LinkedList
();
List
list
=
new
LinkedList
();
if
(
uploadFile
!=
null
&&
uploadFile
.
length
>
0
)
{
if
(
uploadFile
!=
null
&&
uploadFile
.
length
>
0
)
{
System
.
out
.
println
(
"osses文件数量"
+
uploadFile
.
length
);
log
.
info
(
"osses文件数量"
+
uploadFile
.
length
);
for
(
int
i
=
0
;
i
<
uploadFile
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
uploadFile
.
length
;
i
++)
{
MultipartFile
file
=
uploadFile
[
i
];
MultipartFile
file
=
uploadFile
[
i
];
InputStream
inputStream
=
null
;
InputStream
inputStream
=
null
;
...
@@ -391,7 +384,7 @@ public class UploadController {
...
@@ -391,7 +384,7 @@ public class UploadController {
+
UUID
.
randomUUID
().
toString
()
+
UUID
.
randomUUID
().
toString
()
+
oldName
.
substring
(
oldName
.
lastIndexOf
(
"."
),
oldName
.
length
());
+
oldName
.
substring
(
oldName
.
lastIndexOf
(
"."
),
oldName
.
length
());
ossClient
.
putObject
(
OssConstant
.
BUCKET
,
newName
,
bis
);
ossClient
.
putObject
(
OssConstant
.
BUCKET
,
newName
,
bis
);
System
.
out
.
println
(
"图片名称:"
+
newName
);
log
.
info
(
"图片名称:"
+
newName
);
list
.
add
(
"https://"
+
OssConstant
.
BUCKET
+
'.'
+
OssConstant
.
ENDPOINT
+
"/"
+
newName
);
list
.
add
(
"https://"
+
OssConstant
.
BUCKET
+
'.'
+
OssConstant
.
ENDPOINT
+
"/"
+
newName
);
}
}
}
}
...
@@ -447,7 +440,7 @@ public class UploadController {
...
@@ -447,7 +440,7 @@ public class UploadController {
+
UUID
.
randomUUID
().
toString
()
+
UUID
.
randomUUID
().
toString
()
+
oldName
.
substring
(
oldName
.
lastIndexOf
(
"."
),
oldName
.
length
());
+
oldName
.
substring
(
oldName
.
lastIndexOf
(
"."
),
oldName
.
length
());
ossClient
.
putObject
(
OssConstant
.
BUCKET
,
newName
,
bis
);
ossClient
.
putObject
(
OssConstant
.
BUCKET
,
newName
,
bis
);
System
.
out
.
println
(
"图片名称:"
+
newName
);
log
.
info
(
"图片名称:"
+
newName
);
list
.
add
(
"https://"
+
OssConstant
.
BUCKET
+
'.'
+
OssConstant
.
ENDPOINT
+
"/"
+
newName
);
list
.
add
(
"https://"
+
OssConstant
.
BUCKET
+
'.'
+
OssConstant
.
ENDPOINT
+
"/"
+
newName
);
}
}
}
}
...
@@ -480,7 +473,7 @@ public class UploadController {
...
@@ -480,7 +473,7 @@ public class UploadController {
.
build
(
OssConstant
.
ENDPOINT
,
OssConstant
.
ACCESSKEYID
,
OssConstant
.
ACCESSKEYSECRET
);
.
build
(
OssConstant
.
ENDPOINT
,
OssConstant
.
ACCESSKEYID
,
OssConstant
.
ACCESSKEYSECRET
);
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
();
if
(
uploadFile
!=
null
&&
uploadFile
.
length
>
0
)
{
if
(
uploadFile
!=
null
&&
uploadFile
.
length
>
0
)
{
System
.
out
.
println
(
"osses文件数量"
+
uploadFile
.
length
);
log
.
info
(
"osses文件数量"
+
uploadFile
.
length
);
for
(
int
i
=
0
;
i
<
uploadFile
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
uploadFile
.
length
;
i
++)
{
MultipartFile
file
=
uploadFile
[
i
];
MultipartFile
file
=
uploadFile
[
i
];
InputStream
inputStream
=
null
;
InputStream
inputStream
=
null
;
...
@@ -502,7 +495,7 @@ public class UploadController {
...
@@ -502,7 +495,7 @@ public class UploadController {
+
UUID
.
randomUUID
().
toString
()
+
UUID
.
randomUUID
().
toString
()
+
oldName
.
substring
(
oldName
.
lastIndexOf
(
"."
),
oldName
.
length
());
+
oldName
.
substring
(
oldName
.
lastIndexOf
(
"."
),
oldName
.
length
());
ossClient
.
putObject
(
OssConstant
.
BUCKET
,
newName
,
bis
);
ossClient
.
putObject
(
OssConstant
.
BUCKET
,
newName
,
bis
);
System
.
out
.
println
(
"图片名称:"
+
newName
);
log
.
info
(
"图片名称:"
+
newName
);
map
.
put
(
map
.
put
(
"filePath"
,
"filePath"
,
"https://"
+
OssConstant
.
BUCKET
+
'.'
+
OssConstant
.
ENDPOINT
+
"/"
+
newName
);
"https://"
+
OssConstant
.
BUCKET
+
'.'
+
OssConstant
.
ENDPOINT
+
"/"
+
newName
);
...
@@ -554,7 +547,6 @@ public class UploadController {
...
@@ -554,7 +547,6 @@ public class UploadController {
.
build
(
OssConstant
.
ENDPOINT
,
OssConstant
.
ACCESSKEYID
,
OssConstant
.
ACCESSKEYSECRET
);
.
build
(
OssConstant
.
ENDPOINT
,
OssConstant
.
ACCESSKEYID
,
OssConstant
.
ACCESSKEYSECRET
);
Map
map
=
new
HashMap
();
Map
map
=
new
HashMap
();
if
(
uploadFile
!=
null
&&
uploadFile
.
length
>
0
)
{
if
(
uploadFile
!=
null
&&
uploadFile
.
length
>
0
)
{
System
.
out
.
println
(
"osses文件数量"
+
uploadFile
.
length
);
for
(
int
i
=
0
;
i
<
uploadFile
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
uploadFile
.
length
;
i
++)
{
MultipartFile
file
=
uploadFile
[
i
];
MultipartFile
file
=
uploadFile
[
i
];
InputStream
inputStream
=
null
;
InputStream
inputStream
=
null
;
...
@@ -576,7 +568,6 @@ public class UploadController {
...
@@ -576,7 +568,6 @@ public class UploadController {
+
UUID
.
randomUUID
().
toString
()
+
UUID
.
randomUUID
().
toString
()
+
oldName
.
substring
(
oldName
.
lastIndexOf
(
"."
),
oldName
.
length
());
+
oldName
.
substring
(
oldName
.
lastIndexOf
(
"."
),
oldName
.
length
());
ossClient
.
putObject
(
OssConstant
.
BUCKET
,
newName
,
bis
);
ossClient
.
putObject
(
OssConstant
.
BUCKET
,
newName
,
bis
);
System
.
out
.
println
(
"文档名称:"
+
newName
);
map
.
put
(
map
.
put
(
"filePath"
,
"filePath"
,
...
...
src/main/java/com/mmc/pms/json/JsonUtil.java
浏览文件 @
1e92c8c8
...
@@ -13,12 +13,6 @@ import java.util.List;
...
@@ -13,12 +13,6 @@ import java.util.List;
*/
*/
public
class
JsonUtil
{
public
class
JsonUtil
{
public
static
void
main
(
String
[]
args
)
{
String
array
=
"[1,24,23]"
;
List
<
Integer
>
list
=
JSONArray
.
parseArray
(
array
,
Integer
.
class
);
System
.
out
.
println
(
list
.
get
(
2
));
}
/**
/**
* 把Java对象转换成json字符串
* 把Java对象转换成json字符串
*
*
...
...
src/main/java/com/mmc/pms/service/Impl/CategoriesServiceImpl.java
浏览文件 @
1e92c8c8
...
@@ -22,6 +22,7 @@ import com.mmc.pms.model.sale.vo.QueryClassifyVO;
...
@@ -22,6 +22,7 @@ import com.mmc.pms.model.sale.vo.QueryClassifyVO;
import
com.mmc.pms.page.PageResult
;
import
com.mmc.pms.page.PageResult
;
import
com.mmc.pms.service.BackstageTaskService
;
import
com.mmc.pms.service.BackstageTaskService
;
import
com.mmc.pms.service.CategoriesService
;
import
com.mmc.pms.service.CategoriesService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -38,6 +39,7 @@ import java.util.stream.Collectors;
...
@@ -38,6 +39,7 @@ import java.util.stream.Collectors;
* @createDate 2023-05-24 10:29:28
* @createDate 2023-05-24 10:29:28
*/
*/
@Service
@Service
@Slf4j
public
class
CategoriesServiceImpl
implements
CategoriesService
{
public
class
CategoriesServiceImpl
implements
CategoriesService
{
@Autowired
private
CategoriesDao
categoriesDao
;
@Autowired
private
CategoriesDao
categoriesDao
;
@Resource
private
GoodsInfoDao
goodsInfoDao
;
@Resource
private
GoodsInfoDao
goodsInfoDao
;
...
@@ -252,7 +254,7 @@ public class CategoriesServiceImpl implements CategoriesService {
...
@@ -252,7 +254,7 @@ public class CategoriesServiceImpl implements CategoriesService {
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
Map
<
Integer
,
List
<
CategoriesInfoListDTO
>>
categoryMap
=
getCategoryMap
(
allCategoryDTOList
);
Map
<
Integer
,
List
<
CategoriesInfoListDTO
>>
categoryMap
=
getCategoryMap
(
allCategoryDTOList
);
addSubCategories
(
allCategoryDTOList
,
categoryMap
);
addSubCategories
(
allCategoryDTOList
,
categoryMap
);
System
.
out
.
println
(
"Res: "
+
JSONObject
.
toJSON
(
allCategoryDTOList
));
log
.
info
(
"Res: "
+
JSONObject
.
toJSON
(
allCategoryDTOList
));
return
allCategoryDTOList
;
return
allCategoryDTOList
;
}
}
return
null
;
return
null
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论