Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhuixin-art
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NFT
zhuixin-art
Commits
019ec8d6
Commit
019ec8d6
authored
Aug 18, 2021
by
tangtuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改文件下载的接口
查询类目的接口
parent
057c13d9
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
50 additions
and
33 deletions
+50
-33
CategoryController.java
...ain/java/com/fzm/admin/controller/CategoryController.java
+7
-5
NftController.java
...src/main/java/com/fzm/admin/controller/NftController.java
+14
-6
NftVo.java
art-common/src/main/java/com/fzm/common/entity/vo/NftVo.java
+3
-3
NftFileService.java
.../src/main/java/com/fzm/common/service/NftFileService.java
+7
-0
NftService.java
...mmon/src/main/java/com/fzm/common/service/NftService.java
+0
-6
NftFileServiceImpl.java
.../java/com/fzm/common/service/impl/NftFileServiceImpl.java
+15
-0
NftServiceImpl.java
...main/java/com/fzm/common/service/impl/NftServiceImpl.java
+1
-10
NftController.java
...rc/main/java/com/fzm/portal/controller/NftController.java
+3
-3
No files found.
art-admin/src/main/java/com/fzm/admin/controller/CategoryController.java
View file @
019ec8d6
...
@@ -6,8 +6,10 @@ import com.fzm.common.model.ResponseModel;
...
@@ -6,8 +6,10 @@ import com.fzm.common.model.ResponseModel;
import
com.fzm.common.service.CategoryService
;
import
com.fzm.common.service.CategoryService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -26,9 +28,9 @@ public class CategoryController {
...
@@ -26,9 +28,9 @@ public class CategoryController {
@Resource
@Resource
private
CategoryService
categoryService
;
private
CategoryService
categoryService
;
/*
@GetMapping("/list")
@GetMapping
(
"/list"
)
@ApiOperation(value = "查询所有类目信息")
@ApiOperation
(
value
=
"查询所有类目信息"
,
notes
=
"如果查所有一级目录的话,pid传0或者空值"
)
public ResponseModel<List<Category>> list() {
public
ResponseModel
<
List
<
Category
>>
list
(
@ApiParam
(
value
=
"父id,对应的是一级目录的id"
)
@RequestParam
(
required
=
false
,
defaultValue
=
"0"
)
Integer
pid
)
{
return ResponseModel.success(categoryService.getByPid());
return
ResponseModel
.
success
(
categoryService
.
getByPid
(
pid
));
}
*/
}
}
}
art-admin/src/main/java/com/fzm/admin/controller/NftController.java
View file @
019ec8d6
...
@@ -3,7 +3,9 @@ package com.fzm.admin.controller;
...
@@ -3,7 +3,9 @@ package com.fzm.admin.controller;
import
com.fzm.common.annotation.Authentication
;
import
com.fzm.common.annotation.Authentication
;
import
com.fzm.common.entity.Nft
;
import
com.fzm.common.entity.Nft
;
import
com.fzm.common.entity.vo.NftListVo
;
import
com.fzm.common.entity.vo.NftListVo
;
import
com.fzm.common.entity.vo.NftVo
;
import
com.fzm.common.model.ResponseModel
;
import
com.fzm.common.model.ResponseModel
;
import
com.fzm.common.service.NftFileService
;
import
com.fzm.common.service.NftService
;
import
com.fzm.common.service.NftService
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -26,6 +28,9 @@ public class NftController {
...
@@ -26,6 +28,9 @@ public class NftController {
@Resource
@Resource
private
NftService
nftService
;
private
NftService
nftService
;
@Resource
private
NftFileService
nftFileService
;
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
@ApiOperation
(
value
=
"查询nft列表"
)
@ApiOperation
(
value
=
"查询nft列表"
)
public
ResponseModel
<
PageInfo
<
NftListVo
>>
list
(
@ApiParam
(
value
=
"页码"
,
required
=
true
)
@RequestParam
Integer
pageNum
,
public
ResponseModel
<
PageInfo
<
NftListVo
>>
list
(
@ApiParam
(
value
=
"页码"
,
required
=
true
)
@RequestParam
Integer
pageNum
,
...
@@ -37,7 +42,7 @@ public class NftController {
...
@@ -37,7 +42,7 @@ public class NftController {
@ApiParam
(
value
=
"上架状态 0-未上架 1-已上架"
)
@RequestParam
(
required
=
false
)
Integer
status
,
@ApiParam
(
value
=
"上架状态 0-未上架 1-已上架"
)
@RequestParam
(
required
=
false
)
Integer
status
,
@ApiParam
(
value
=
"创建开始日期,yyyy-MM-dd格式"
)
@RequestParam
(
required
=
false
)
String
start
,
@ApiParam
(
value
=
"创建开始日期,yyyy-MM-dd格式"
)
@RequestParam
(
required
=
false
)
String
start
,
@ApiParam
(
value
=
"创建截止日期,yyyy-MM-dd格式"
)
@RequestParam
(
required
=
false
)
String
end
)
{
@ApiParam
(
value
=
"创建截止日期,yyyy-MM-dd格式"
)
@RequestParam
(
required
=
false
)
String
end
)
{
PageInfo
<
NftListVo
>
page
=
nftService
.
page
(
pageNum
,
pageSize
,
categoryId
,
secondCategoryId
,
name
,
telephone
,
status
,
start
,
end
);
PageInfo
<
NftListVo
>
page
=
nftService
.
page
(
pageNum
,
pageSize
,
categoryId
,
secondCategoryId
,
name
,
telephone
,
status
,
start
,
end
);
return
ResponseModel
.
success
(
page
);
return
ResponseModel
.
success
(
page
);
}
}
...
@@ -67,13 +72,16 @@ public class NftController {
...
@@ -67,13 +72,16 @@ public class NftController {
@ApiOperation
(
value
=
"查看详情"
)
@ApiOperation
(
value
=
"查看详情"
)
@PostMapping
(
"/detail/{id}"
)
@PostMapping
(
"/detail/{id}"
)
public
ResponseModel
<
Nft
>
getById
(
@ApiParam
(
value
=
"nft主键"
)
@PathVariable
Integer
id
)
{
public
ResponseModel
<
NftVo
>
getById
(
@ApiParam
(
value
=
"nft主键"
)
@PathVariable
Integer
id
)
{
return
ResponseModel
.
success
(
nftService
.
getById
(
id
));
Nft
nft
=
nftService
.
getById
(
id
);
NftVo
nftVo
=
new
NftVo
(
nft
,
null
,
null
);
nftVo
.
setFileList
(
nftFileService
.
getByNftId
(
id
));
return
ResponseModel
.
success
(
nftVo
);
}
}
@ApiOperation
(
value
=
"下载文件"
)
@ApiOperation
(
value
=
"下载文件"
)
@PostMapping
(
"/download/{
i
d}"
)
@PostMapping
(
"/download/{
fileI
d}"
)
public
void
download
(
@ApiParam
(
value
=
"
nft主键"
)
@PathVariable
Integer
i
d
)
{
public
void
download
(
@ApiParam
(
value
=
"
文件id"
)
@PathVariable
Integer
fileI
d
)
{
nft
Service
.
download
(
i
d
);
nft
FileService
.
downloadFile
(
fileI
d
);
}
}
}
}
art-common/src/main/java/com/fzm/common/entity/vo/NftVo.java
View file @
019ec8d6
...
@@ -68,14 +68,14 @@ public class NftVo {
...
@@ -68,14 +68,14 @@ public class NftVo {
this
.
author
=
nft
.
getAuthor
();
this
.
author
=
nft
.
getAuthor
();
this
.
name
=
nft
.
getName
();
this
.
name
=
nft
.
getName
();
this
.
synopsis
=
nft
.
getSynopsis
();
this
.
synopsis
=
nft
.
getSynopsis
();
this
.
publisher
=
user
.
getNickname
()
;
this
.
publisher
=
user
!=
null
?
user
.
getNickname
()
:
""
;
this
.
wallet
=
nft
.
getPublishAddress
();
this
.
wallet
=
nft
.
getPublishAddress
();
this
.
publishTime
=
nft
.
getPublishTime
();
this
.
publishTime
=
nft
.
getPublishTime
();
this
.
userId
=
nft
.
getUserId
();
this
.
userId
=
nft
.
getUserId
();
this
.
collection
=
false
;
this
.
collection
=
false
;
this
.
nftHash
=
nft
.
getNftHash
();
this
.
nftHash
=
nft
.
getNftHash
();
this
.
nftNum
=
nft
.
getNftNum
();
this
.
nftNum
=
nft
.
getNftNum
();
this
.
owner
=
owner
.
getNickname
()
;
this
.
owner
=
owner
!=
null
?
owner
.
getNickname
()
:
""
;
this
.
ownerAddress
=
owner
.
getWallet
()
;
this
.
ownerAddress
=
owner
!=
null
?
owner
.
getWallet
()
:
""
;
}
}
}
}
art-common/src/main/java/com/fzm/common/service/NftFileService.java
View file @
019ec8d6
...
@@ -19,4 +19,11 @@ public interface NftFileService extends IService<NftFile> {
...
@@ -19,4 +19,11 @@ public interface NftFileService extends IService<NftFile> {
* @return
* @return
*/
*/
List
<
NftFile
>
getByNftId
(
Integer
nftId
);
List
<
NftFile
>
getByNftId
(
Integer
nftId
);
/**
* 下载文件
*
* @param fileId
*/
void
downloadFile
(
Integer
fileId
);
}
}
art-common/src/main/java/com/fzm/common/service/NftService.java
View file @
019ec8d6
...
@@ -106,12 +106,6 @@ public interface NftService extends IService<Nft> {
...
@@ -106,12 +106,6 @@ public interface NftService extends IService<Nft> {
*/
*/
Boolean
offShelf
(
Integer
id
);
Boolean
offShelf
(
Integer
id
);
/**
* 下载附件
*
* @param id
*/
void
download
(
Integer
id
);
/**
/**
* 发行nft
* 发行nft
...
...
art-common/src/main/java/com/fzm/common/service/impl/NftFileServiceImpl.java
View file @
019ec8d6
...
@@ -4,11 +4,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...
@@ -4,11 +4,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.fzm.common.entity.AuthPerson
;
import
com.fzm.common.entity.AuthPerson
;
import
com.fzm.common.entity.NftFile
;
import
com.fzm.common.entity.NftFile
;
import
com.fzm.common.enums.ResultCode
;
import
com.fzm.common.exception.GlobalException
;
import
com.fzm.common.mapper.AuthPersonMapper
;
import
com.fzm.common.mapper.AuthPersonMapper
;
import
com.fzm.common.mapper.NftFileMapper
;
import
com.fzm.common.mapper.NftFileMapper
;
import
com.fzm.common.mapper.NftMapper
;
import
com.fzm.common.mapper.NftMapper
;
import
com.fzm.common.service.AuthPersonService
;
import
com.fzm.common.service.AuthPersonService
;
import
com.fzm.common.service.NftFileService
;
import
com.fzm.common.service.NftFileService
;
import
com.fzm.common.utils.OssUtil
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -24,10 +27,22 @@ public class NftFileServiceImpl extends ServiceImpl<NftFileMapper, NftFile> impl
...
@@ -24,10 +27,22 @@ public class NftFileServiceImpl extends ServiceImpl<NftFileMapper, NftFile> impl
@Resource
@Resource
private
NftFileMapper
nftFileMapper
;
private
NftFileMapper
nftFileMapper
;
@Resource
private
OssUtil
ossUtil
;
@Override
@Override
public
List
<
NftFile
>
getByNftId
(
Integer
nftId
)
{
public
List
<
NftFile
>
getByNftId
(
Integer
nftId
)
{
QueryWrapper
<
NftFile
>
queryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
NftFile
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"nft_id"
,
nftId
);
queryWrapper
.
eq
(
"nft_id"
,
nftId
);
return
nftFileMapper
.
selectList
(
queryWrapper
);
return
nftFileMapper
.
selectList
(
queryWrapper
);
}
}
@Override
public
void
downloadFile
(
Integer
fileId
)
{
NftFile
file
=
getById
(
fileId
);
if
(
file
==
null
)
{
throw
GlobalException
.
newException
(
ResultCode
.
DATA_ERROR
,
String
.
format
(
"没找到id为 %s 的文件详情"
,
fileId
));
}
ossUtil
.
downloadFile
(
file
.
getFileUrl
(),
file
.
getFileName
());
}
}
}
art-common/src/main/java/com/fzm/common/service/impl/NftServiceImpl.java
View file @
019ec8d6
...
@@ -306,7 +306,7 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
...
@@ -306,7 +306,7 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
if
(
StringUtils
.
isNotBlank
(
end
))
{
if
(
StringUtils
.
isNotBlank
(
end
))
{
endDate
=
DateUtil
.
parse
(
end
+
" 23:59:59"
,
"yyyy-MM-dd HH:mm:ss"
);
endDate
=
DateUtil
.
parse
(
end
+
" 23:59:59"
,
"yyyy-MM-dd HH:mm:ss"
);
}
}
List
<
NftListVo
>
list
=
nftMapper
.
page
(
categoryId
,
secondCategoryId
,
name
,
telephone
,
status
,
startDate
,
endDate
);
List
<
NftListVo
>
list
=
nftMapper
.
page
(
categoryId
,
secondCategoryId
,
name
,
telephone
,
status
,
startDate
,
endDate
);
return
new
PageInfo
<>(
list
);
return
new
PageInfo
<>(
list
);
}
}
...
@@ -346,15 +346,6 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
...
@@ -346,15 +346,6 @@ public class NftServiceImpl extends ServiceImpl<NftMapper, Nft> implements NftSe
return
updateById
(
nft
);
return
updateById
(
nft
);
}
}
@Override
public
void
download
(
Integer
id
)
{
Nft
nft
=
getById
(
id
);
if
(
nft
==
null
)
{
throw
GlobalException
.
newException
(
ResultCode
.
DATA_ERROR
,
"没找到此nft详情"
);
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
String
str
=
"{\"author\":\"金庸\",\"publisher\":\"1boYWAeq12vkodh69nLU68WyiPuaT3ZAs\",\"hash\":\"80758630e76e5990b4de0e913ba42c5e\"}"
;
String
str
=
"{\"author\":\"金庸\",\"publisher\":\"1boYWAeq12vkodh69nLU68WyiPuaT3ZAs\",\"hash\":\"80758630e76e5990b4de0e913ba42c5e\"}"
;
String
hex
=
HexUtil
.
encodeHexStr
(
str
,
CharsetUtil
.
CHARSET_UTF_8
);
String
hex
=
HexUtil
.
encodeHexStr
(
str
,
CharsetUtil
.
CHARSET_UTF_8
);
...
...
art-portal/src/main/java/com/fzm/portal/controller/NftController.java
View file @
019ec8d6
...
@@ -199,9 +199,9 @@ public class NftController {
...
@@ -199,9 +199,9 @@ public class NftController {
@Authentication
@Authentication
@ApiOperation
(
value
=
"下载文件"
)
@ApiOperation
(
value
=
"下载文件"
)
@PostMapping
(
"/download/{
i
d}"
)
@PostMapping
(
"/download/{
fileI
d}"
)
public
void
download
(
@ApiParam
(
value
=
"
nft主键"
)
@PathVariable
Integer
i
d
)
{
public
void
download
(
@ApiParam
(
value
=
"
文件id"
)
@PathVariable
Integer
fileI
d
)
{
nft
Service
.
download
(
i
d
);
nft
FileService
.
downloadFile
(
fileI
d
);
}
}
@Authentication
@Authentication
...
...
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