Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
chnmuseum-party
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liqin
chnmuseum-party
Commits
bff7861b
Commit
bff7861b
authored
4 years ago
by
liqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixed
parent
7c43a45c
master
1.0
dev
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
21 deletions
+39
-21
MyShiroRealm.java
...cn/wisenergy/chnmuseum/party/auth/realm/MyShiroRealm.java
+2
-2
FastDFSUtils.java
...cn/wisenergy/chnmuseum/party/common/dfs/FastDFSUtils.java
+13
-4
MetaObjectHandlerConfig.java
...nmuseum/party/common/mybatis/MetaObjectHandlerConfig.java
+3
-11
VideoTestUtil.java
...wisenergy/chnmuseum/party/common/video/VideoTestUtil.java
+1
-1
TUser.java
src/main/java/cn/wisenergy/chnmuseum/party/model/TUser.java
+4
-1
AssetController.java
...nergy/chnmuseum/party/web/controller/AssetController.java
+16
-2
No files found.
src/main/java/cn/wisenergy/chnmuseum/party/auth/realm/MyShiroRealm.java
View file @
bff7861b
...
...
@@ -99,12 +99,12 @@ public class MyShiroRealm extends AuthorizingRealm {
if
(
user
==
null
)
{
throw
new
AuthenticationException
(
"User does not exist!"
);
}
user
=
userService
.
selectByUsername
(
user
.
getUserName
());
if
(
JwtTokenUtil
.
verify
(
credentials
,
username
)
==
null
)
{
throw
new
AuthenticationException
(
"token invalid"
);
}
return
new
SimpleAuthenticationInfo
(
new
TUser
(
user
.
getId
(),
credentials
),
credentials
,
getName
());
return
new
SimpleAuthenticationInfo
(
new
TUser
(
user
.
getId
(),
user
.
getUserName
(),
user
.
getOrgId
(),
user
.
getOrgName
(),
credentials
),
credentials
,
getName
());
}
/**
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cn/wisenergy/chnmuseum/party/common/dfs/FastDFSUtils.java
View file @
bff7861b
...
...
@@ -9,6 +9,7 @@ import com.github.tobato.fastdfs.domain.fdfs.MetaData;
import
com.github.tobato.fastdfs.domain.fdfs.StorePath
;
import
com.github.tobato.fastdfs.domain.fdfs.ThumbImageConfig
;
import
com.github.tobato.fastdfs.domain.proto.storage.DownloadByteArray
;
import
com.github.tobato.fastdfs.domain.proto.storage.DownloadFileStream
;
import
com.github.tobato.fastdfs.exception.FdfsServerException
;
import
com.github.tobato.fastdfs.service.FastFileStorageClient
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -21,10 +22,7 @@ import javax.annotation.PostConstruct;
import
javax.annotation.Resource
;
import
javax.imageio.ImageIO
;
import
java.awt.image.BufferedImage
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.*
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
...
...
@@ -115,6 +113,17 @@ public class FastDFSUtils {
return
storageClient
.
downloadFile
(
groupName
,
path
,
new
DownloadByteArray
());
}
/**
* 下载文件(字节数组)
* @return
*/
public
static
BufferedInputStream
downloadFile
(
String
fileUrl
,
OutputStream
outputStream
)
{
fileUrl
=
fileUrl
.
replace
(
dfsFileAccessBasePath
+
"/"
,
""
);
String
groupName
=
fileUrl
.
substring
(
0
,
fileUrl
.
indexOf
(
"/"
));
String
path
=
fileUrl
.
substring
(
fileUrl
.
indexOf
(
"/"
)
+
1
);
return
storageClient
.
downloadFile
(
groupName
,
path
,
new
DownloadFileStream
(
outputStream
));
}
/**
* 下载文件
*
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cn/wisenergy/chnmuseum/party/common/mybatis/MetaObjectHandlerConfig.java
View file @
bff7861b
package
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
mybatis
;
import
cn.wisenergy.chnmuseum.party.auth.util.JwtTokenUtil
;
import
cn.wisenergy.chnmuseum.party.model.TUser
;
import
cn.wisenergy.chnmuseum.party.service.TUserService
;
import
com.baomidou.mybatisplus.core.handlers.MetaObjectHandler
;
import
org.apache.ibatis.reflection.MetaObject
;
import
org.apache.shiro.SecurityUtils
;
import
org.apache.shiro.subject.Subject
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.time.LocalDateTime
;
/**
...
...
@@ -20,9 +17,6 @@ import java.time.LocalDateTime;
@Component
public
class
MetaObjectHandlerConfig
implements
MetaObjectHandler
{
@Resource
private
TUserService
userService
;
@Override
public
void
insertFill
(
MetaObject
metaObject
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
...
...
@@ -36,11 +30,9 @@ public class MetaObjectHandlerConfig implements MetaObjectHandler {
}
final
TUser
currentUser
=
getCurrentUser
();
if
(
currentUser
!=
null
)
{
final
String
userName
=
JwtTokenUtil
.
getUsername
(
currentUser
.
getJwtToken
());
final
TUser
user
=
this
.
userService
.
selectByUsername
(
userName
);
this
.
setFieldValByName
(
"userId"
,
user
.
getId
(),
metaObject
);
this
.
setFieldValByName
(
"userName"
,
user
.
getUserName
(),
metaObject
);
this
.
setFieldValByName
(
"orgName"
,
user
.
getOrgName
(),
metaObject
);
this
.
setFieldValByName
(
"userId"
,
currentUser
.
getId
(),
metaObject
);
this
.
setFieldValByName
(
"userName"
,
currentUser
.
getUserName
(),
metaObject
);
this
.
setFieldValByName
(
"orgName"
,
currentUser
.
getOrgName
(),
metaObject
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cn/wisenergy/chnmuseum/party/common/video/VideoTestUtil.java
View file @
bff7861b
...
...
@@ -15,7 +15,7 @@ public class VideoTestUtil {
private
static
final
String
cipher
=
"3348c95c60520be7"
;
private
static
final
int
dataLength
=
4096
;
public
static
void
main
(
String
[]
args
){
public
static
void
main
(
String
[]
args
)
{
//加密视频
new
Thread
(()
->
{
try
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cn/wisenergy/chnmuseum/party/model/TUser.java
View file @
bff7861b
...
...
@@ -35,8 +35,11 @@ public class TUser implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
public
TUser
(
String
id
,
String
jwtToken
)
{
public
TUser
(
String
id
,
String
userName
,
String
orgId
,
String
orgName
,
String
jwtToken
)
{
this
.
id
=
id
;
this
.
userName
=
userName
;
this
.
orgId
=
orgId
;
this
.
orgName
=
orgName
;
this
.
jwtToken
=
jwtToken
;
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cn/wisenergy/chnmuseum/party/web/controller/AssetController.java
View file @
bff7861b
...
...
@@ -16,6 +16,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -44,7 +45,7 @@ public class AssetController extends BaseController {
})
@PostMapping
(
"/getPageList"
)
@RequiresPermissions
(
"asset:page"
)
@ApiOperation
(
value
=
"获取
文件资产分页列表"
,
notes
=
"获取文件资产
分页列表"
)
@ApiOperation
(
value
=
"获取
视频汇出分页列表"
,
notes
=
"获取视频汇出
分页列表"
)
public
Map
<
String
,
Object
>
getAssetPageList
(
GenericPageParam
genericPageParam
,
@RequestParam
(
value
=
"videoContentCatId"
,
required
=
false
)
String
videoContentCatId
,
@RequestParam
(
value
=
"videoContentCopyrightOwnerId"
,
required
=
false
)
String
videoContentCopyrightOwnerId
)
{
...
...
@@ -59,7 +60,7 @@ public class AssetController extends BaseController {
return
getResult
(
page
);
}
@ApiOperation
(
value
=
"获取
文件资产详情"
,
notes
=
"获取文件资产
详情"
)
@ApiOperation
(
value
=
"获取
视频文件详情"
,
notes
=
"获取视频文件
详情"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"标识ID"
,
dataType
=
"String"
,
paramType
=
"path"
)
})
...
...
@@ -70,5 +71,18 @@ public class AssetController extends BaseController {
return
getResult
(
asset
);
}
@ApiOperation
(
value
=
"视频文件汇出"
,
notes
=
"视频文件汇出"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"idList"
,
value
=
"视频文件标识ID集合"
,
dataType
=
"String"
,
paramType
=
"path"
)
})
@PostMapping
(
"/download"
)
@RequiresPermissions
(
"asset:download"
)
public
void
download
(
@RequestParam
(
"idList"
)
List
<
String
>
idList
)
{
final
List
<
Asset
>
assetList
=
assetService
.
listByIds
(
idList
);
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment