Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
f319827f
Commit
f319827f
authored
Dec 29, 2021
by
284718418@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.我的文件文件夹或共享空间列表接口
parent
39e17a53
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
193 additions
and
13 deletions
+193
-13
src/main/java/cn/timer/api/bean/disk/DiskCatalogue.java
+20
-4
src/main/java/cn/timer/api/bean/disk/DiskFileImage.java
+1
-1
src/main/java/cn/timer/api/config/enuminterface/JxglEnumInterface.java
+1
-1
src/main/java/cn/timer/api/controller/disk/DiskCatalogueController.java
+28
-6
src/main/java/cn/timer/api/controller/disk/DiskFilesController.java
+3
-1
src/main/java/cn/timer/api/controller/disk/sevice/DiskCatalogueService.java
+22
-0
src/main/java/cn/timer/api/controller/disk/sevice/DiskCatalogueServiceImpl.java
+113
-0
src/main/java/cn/timer/api/dto/disk/DiskCatalogueDto.java
+5
-0
No files found.
src/main/java/cn/timer/api/bean/disk/DiskCatalogue.java
View file @
f319827f
package
cn
.
timer
.
api
.
bean
.
disk
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
io.swagger.annotations.ApiModel
;
...
...
@@ -10,11 +11,9 @@ import lombok.Builder;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
javax.persistence.*
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -113,4 +112,21 @@ public class DiskCatalogue extends Model<DiskCatalogue> {
@ApiModelProperty
(
value
=
"更新时间"
)
private
Date
updateTime
;
/**
* 文件集合
*/
@ApiModelProperty
(
value
=
"文件集合"
)
@Transient
@TableField
(
exist
=
false
)
private
List
<
DiskFiles
>
diskFilesList
;
/**
* 文件子集
*/
@ApiModelProperty
(
value
=
"文件子集"
)
@Transient
@TableField
(
exist
=
false
)
private
List
<
DiskCatalogue
>
children
;
}
src/main/java/cn/timer/api/bean/disk/DiskFileImage.java
View file @
f319827f
...
...
@@ -48,7 +48,7 @@ public class DiskFileImage extends Model<DiskFileImage> {
* 图标类型:txt,doc,html,pdf,jpg,png,gif,swf,
*/
@ApiModelProperty
(
value
=
"图标类型:txt,doc,html,pdf,jpg,png,gif,swf,"
)
private
Integer
type
;
private
String
type
;
/**
* 文件标题
*/
...
...
src/main/java/cn/timer/api/config/enuminterface/JxglEnumInterface.java
View file @
f319827f
...
...
@@ -254,7 +254,7 @@ public interface JxglEnumInterface {
*/
@Getter
enum
DiskCatalogueType
implements
JxglEnumInterface
{
NEED
(
0
,
"云盘"
),
NOT_NEED
(
1
,
"文件夹"
);
DISK_YUN
(
0
,
"云盘"
),
DISK_FILE
(
1
,
"文件夹"
);
private
Integer
type
;
...
...
src/main/java/cn/timer/api/controller/disk/DiskCatalogueController.java
View file @
f319827f
...
...
@@ -3,6 +3,7 @@ package cn.timer.api.controller.disk;
import
cn.timer.api.bean.disk.DiskCatalogue
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.controller.disk.sevice.DiskCatalogueService
;
import
cn.timer.api.dto.disk.DiskCatalogueDto
;
import
cn.timer.api.dto.yggl.AddygdaDto
;
import
cn.timer.api.utils.Result
;
...
...
@@ -10,16 +11,15 @@ import cn.timer.api.utils.ResultUtil;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.StringUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
javax.transaction.Transactional
;
import
java.util.List
;
/**
...
...
@@ -34,6 +34,10 @@ import javax.transaction.Transactional;
@RestController
@RequestMapping
(
value
=
"/disk/catalogue"
,
produces
=
{
"application/json"
})
public
class
DiskCatalogueController
{
@Autowired
private
DiskCatalogueService
diskCatalogueService
;
/**
* 云盘-新建文件夹
*
...
...
@@ -43,7 +47,7 @@ public class DiskCatalogueController{
@PostMapping
(
value
=
"/add_catalogue"
)
@ApiOperation
(
value
=
"1.新建文件夹或共享空间"
,
httpMethod
=
"POST"
,
notes
=
"新建文件夹或共享空间:type=0共享空间,1文件夹"
)
@ApiOperationSupport
(
order
=
1
)
public
Result
<
Object
>
add
ygda
(
@CurrentUser
UserBean
userBean
,
@Validated
@RequestBody
DiskCatalogueDto
diskCatalogueDto
)
{
public
Result
<
Object
>
add
catalogue
(
@CurrentUser
UserBean
userBean
,
@Validated
@RequestBody
DiskCatalogueDto
diskCatalogueDto
)
{
Integer
empNum
=
userBean
.
getEmpNum
();
Integer
orgCode
=
userBean
.
getOrgCode
();
DiskCatalogue
diskCatalogue
=
new
DiskCatalogue
();
...
...
@@ -57,4 +61,22 @@ public class DiskCatalogueController{
return
ResultUtil
.
error
(
"新建文件夹失败!"
);
}
}
/**
* 云盘-我的文件文件夹或共享空间列表
*
* @param userBean
* @param type
* @return
*/
@GetMapping
(
value
=
"/myfile_list"
)
@ApiOperation
(
value
=
"2.我的文件文件夹或共享空间列表"
,
httpMethod
=
"GET"
,
notes
=
"文件夹或共享空间:type=0共享空间,1文件夹"
)
@ApiOperationSupport
(
order
=
2
)
public
Result
<
Object
>
myfilelist
(
@CurrentUser
UserBean
userBean
,
@ApiParam
(
"文件文件夹或共享空间ID"
)
@RequestParam
(
required
=
true
,
defaultValue
=
"0"
)
Integer
type
)
{
Integer
empNum
=
userBean
.
getEmpNum
();
Integer
orgCode
=
userBean
.
getOrgCode
();
List
<
DiskCatalogue
>
list
=
diskCatalogueService
.
getDiskCatalogueList
(
orgCode
,
empNum
,
type
);
return
ResultUtil
.
data
(
list
);
}
}
src/main/java/cn/timer/api/controller/disk/DiskFilesController.java
View file @
f319827f
...
...
@@ -15,6 +15,7 @@ import cn.timer.api.utils.Result;
import
cn.timer.api.utils.ResultUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -57,7 +58,8 @@ public class DiskFilesController {
@ApiOperation
(
value
=
"上传普通文件"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
@ResponseBody
@PostMapping
(
"/upload"
)
public
Result
<
Object
>
upload
(
@CurrentUser
UserBean
userBean
,
@RequestParam
(
required
=
true
)
MultipartFile
[]
file
,
@RequestParam
(
required
=
true
)
Integer
catalogueId
)
{
public
Result
<
Object
>
upload
(
@CurrentUser
UserBean
userBean
,
@RequestParam
(
required
=
true
)
MultipartFile
[]
file
,
@ApiParam
(
"文件文件夹或共享空间ID"
)
@RequestParam
(
required
=
true
)
Integer
catalogueId
)
{
if
(
file
==
null
||
file
.
length
==
0
)
{
return
ResultUtil
.
error
(
"上传失败,请选择上传文件"
);
}
...
...
src/main/java/cn/timer/api/controller/disk/sevice/DiskCatalogueService.java
0 → 100644
View file @
f319827f
package
cn
.
timer
.
api
.
controller
.
disk
.
sevice
;
import
cn.timer.api.bean.disk.DiskCatalogue
;
import
java.util.List
;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2021/12/29
*/
public
interface
DiskCatalogueService
{
/**
* 文件文件夹或共享空间列表
* @param orgId
* @param UserId
* @param type
* @return
*/
List
<
DiskCatalogue
>
getDiskCatalogueList
(
Integer
orgId
,
Integer
userId
,
Integer
type
);
}
src/main/java/cn/timer/api/controller/disk/sevice/DiskCatalogueServiceImpl.java
0 → 100644
View file @
f319827f
package
cn
.
timer
.
api
.
controller
.
disk
.
sevice
;
import
cn.timer.api.bean.disk.DiskCatalogue
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2021/12/29
*/
@Service
public
class
DiskCatalogueServiceImpl
implements
DiskCatalogueService
{
private
static
List
<
DiskCatalogue
>
treeList
=
new
ArrayList
<>();
@Override
public
List
<
DiskCatalogue
>
getDiskCatalogueList
(
Integer
orgId
,
Integer
userId
,
Integer
type
)
{
treeList
=
DiskCatalogue
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
DiskCatalogue
>()
.
lambda
().
eq
(
DiskCatalogue:
:
getOrgId
,
orgId
)
.
eq
(
DiskCatalogue:
:
getCreateUserId
,
userId
)
.
eq
(
DiskCatalogue:
:
getType
,
type
)
);
List
<
DiskCatalogue
>
list
=
treeList
.
stream
().
filter
(
s
->
s
.
getParentId
()
==
0
).
collect
(
Collectors
.
toList
());
return
getTree
(
list
);
}
/**
* 递归获取树形结构
*
* @param parentList 一级节点
* @return
*/
public
static
List
<
DiskCatalogue
>
getTree
(
List
<
DiskCatalogue
>
parentList
)
{
List
<
DiskCatalogue
>
list
=
new
ArrayList
<>();
if
(
parentList
!=
null
)
{
for
(
int
i
=
0
;
i
<
parentList
.
size
();
i
++)
{
list
.
add
(
recursiveTree
(
parentList
.
get
(
i
).
getId
()));
}
}
return
list
;
}
/**
* 递归算法解析成树形结构
*
* @param cid
*/
public
static
DiskCatalogue
recursiveTree
(
Integer
cid
)
{
DiskCatalogue
node
=
getMenuById
(
cid
);
List
<
DiskCatalogue
>
childTreeNodes
=
getChildTreeById
(
cid
);
for
(
DiskCatalogue
child
:
childTreeNodes
)
{
DiskCatalogue
n
=
recursiveTree
(
child
.
getId
());
List
<
DiskCatalogue
>
list
=
new
ArrayList
<
DiskCatalogue
>();
list
.
add
(
n
);
if
(
node
.
getChildren
()
==
null
)
{
List
<
DiskCatalogue
>
li
=
new
ArrayList
<
DiskCatalogue
>();
node
.
setChildren
(
li
);
}
node
.
getChildren
().
add
(
n
);
}
return
node
;
}
/**
* 根据CID查询节点对象
*/
public
static
DiskCatalogue
getMenuById
(
Integer
cid
)
{
Map
map
=
getTreeMap
();
return
(
DiskCatalogue
)
map
.
get
(
cid
);
}
/**
* 一次性取所有数据,为了减少对数据库查询操作
*
* @return
*/
public
static
Map
getTreeMap
()
{
Map
map
=
new
HashMap
<
Integer
,
DiskCatalogue
>();
if
(
null
!=
treeList
)
{
for
(
DiskCatalogue
d
:
treeList
)
{
map
.
put
(
d
.
getId
(),
d
);
}
}
return
map
;
}
/**
* 根据父节点CID获取所有了节点
*/
public
static
List
<
DiskCatalogue
>
getChildTreeById
(
Integer
cid
)
{
List
<
DiskCatalogue
>
list
=
new
ArrayList
<>();
if
(
null
!=
treeList
)
{
for
(
DiskCatalogue
d
:
treeList
)
{
if
(
null
!=
cid
)
{
if
(
cid
.
equals
(
Integer
.
valueOf
(
d
.
getParentId
())))
{
list
.
add
(
d
);
}
}
}
}
return
list
;
}
}
src/main/java/cn/timer/api/dto/disk/DiskCatalogueDto.java
View file @
f319827f
...
...
@@ -25,6 +25,11 @@ public class DiskCatalogueDto implements Serializable{
private
static
final
long
serialVersionUID
=
-
1230023773946170911L
;
/**
* 资源目录ID
*/
@ApiModelProperty
(
value
=
"资源目录ID"
)
private
Integer
catalogueId
;
/**
* 目录名称
*/
@NotBlank
(
message
=
ValidationMsg
.
NOTBLANK
)
...
...
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