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
3442a2bc
Commit
3442a2bc
authored
Dec 31, 2021
by
284718418@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.云盘代码
parent
faa79547
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
164 additions
and
13 deletions
+164
-13
src/main/java/cn/timer/api/bean/disk/DiskCatalogue.java
+9
-0
src/main/java/cn/timer/api/bean/disk/DiskFilesLog.java
+1
-1
src/main/java/cn/timer/api/controller/disk/DiskCatalogueController.java
+78
-10
src/main/java/cn/timer/api/controller/disk/sevice/DiskCatalogueService.java
+10
-0
src/main/java/cn/timer/api/controller/disk/sevice/DiskCatalogueServiceImpl.java
+13
-0
src/main/java/cn/timer/api/dto/disk/DiskCatalogueDto.java
+7
-1
src/main/java/cn/timer/api/dto/disk/DiskCatalogueParam.java
+45
-0
src/main/resources/application-test.yml
+1
-1
No files found.
src/main/java/cn/timer/api/bean/disk/DiskCatalogue.java
View file @
3442a2bc
...
@@ -129,4 +129,13 @@ public class DiskCatalogue extends Model<DiskCatalogue> {
...
@@ -129,4 +129,13 @@ public class DiskCatalogue extends Model<DiskCatalogue> {
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
List
<
DiskCatalogue
>
children
;
private
List
<
DiskCatalogue
>
children
;
/**
* 面包屑
*/
@ApiModelProperty
(
value
=
"面包屑"
)
@Transient
@TableField
(
exist
=
false
)
private
List
<
DiskCatalogue
>
breadcrumb
;
}
}
src/main/java/cn/timer/api/bean/disk/DiskFilesLog.java
View file @
3442a2bc
...
@@ -30,7 +30,7 @@ import java.util.Date;
...
@@ -30,7 +30,7 @@ import java.util.Date;
@Builder
@Builder
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"disk_file_log"
)
@Table
(
name
=
"disk_file
s
_log"
)
@ApiModel
(
"文件浏览记录表"
)
@ApiModel
(
"文件浏览记录表"
)
public
class
DiskFilesLog
extends
Model
<
DiskFilesLog
>
{
public
class
DiskFilesLog
extends
Model
<
DiskFilesLog
>
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
src/main/java/cn/timer/api/controller/disk/DiskCatalogueController.java
View file @
3442a2bc
...
@@ -3,11 +3,13 @@ package cn.timer.api.controller.disk;
...
@@ -3,11 +3,13 @@ package cn.timer.api.controller.disk;
import
cn.timer.api.bean.disk.DiskCatalogue
;
import
cn.timer.api.bean.disk.DiskCatalogue
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.config.exception.CustomException
;
import
cn.timer.api.controller.disk.sevice.DiskCatalogueService
;
import
cn.timer.api.controller.disk.sevice.DiskCatalogueService
;
import
cn.timer.api.dto.disk.DiskCatalogueDto
;
import
cn.timer.api.dto.disk.DiskCatalogueDto
;
import
cn.timer.api.dto.
yggl.AddygdaDto
;
import
cn.timer.api.dto.
disk.DiskCatalogueParam
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.Result
;
import
cn.timer.api.utils.ResultUtil
;
import
cn.timer.api.utils.ResultUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -19,7 +21,7 @@ import org.springframework.validation.annotation.Validated;
...
@@ -19,7 +21,7 @@ import org.springframework.validation.annotation.Validated;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.transaction.Transactional
;
import
javax.transaction.Transactional
;
import
java.util.
List
;
import
java.util.
*
;
/**
/**
...
@@ -32,8 +34,8 @@ import java.util.List;
...
@@ -32,8 +34,8 @@ import java.util.List;
@Api
(
tags
=
"云盘"
)
@Api
(
tags
=
"云盘"
)
@Transactional
(
rollbackOn
=
Exception
.
class
)
@Transactional
(
rollbackOn
=
Exception
.
class
)
@RestController
@RestController
@RequestMapping
(
value
=
"/disk/catalogue"
,
produces
=
{
"application/json"
})
@RequestMapping
(
value
=
"/disk/catalogue"
,
produces
=
{
"application/json"
})
public
class
DiskCatalogueController
{
public
class
DiskCatalogueController
{
@Autowired
@Autowired
private
DiskCatalogueService
diskCatalogueService
;
private
DiskCatalogueService
diskCatalogueService
;
...
@@ -48,18 +50,31 @@ public class DiskCatalogueController{
...
@@ -48,18 +50,31 @@ public class DiskCatalogueController{
@ApiOperation
(
value
=
"1.新建文件夹或共享空间"
,
httpMethod
=
"POST"
,
notes
=
"新建文件夹或共享空间:type=0共享空间,1文件夹"
)
@ApiOperation
(
value
=
"1.新建文件夹或共享空间"
,
httpMethod
=
"POST"
,
notes
=
"新建文件夹或共享空间:type=0共享空间,1文件夹"
)
@ApiOperationSupport
(
order
=
1
)
@ApiOperationSupport
(
order
=
1
)
public
Result
<
Object
>
addcatalogue
(
@CurrentUser
UserBean
userBean
,
@Validated
@RequestBody
DiskCatalogueDto
diskCatalogueDto
)
{
public
Result
<
Object
>
addcatalogue
(
@CurrentUser
UserBean
userBean
,
@Validated
@RequestBody
DiskCatalogueDto
diskCatalogueDto
)
{
try
{
DiskCatalogue
diskCatalogue
=
new
DiskCatalogue
();
DiskCatalogue
catalogue
=
DiskCatalogue
.
builder
().
id
(
diskCatalogueDto
.
getParentId
()).
build
().
selectById
();
Integer
empNum
=
userBean
.
getEmpNum
();
Integer
empNum
=
userBean
.
getEmpNum
();
Integer
orgCode
=
userBean
.
getOrgCode
();
Integer
orgCode
=
userBean
.
getOrgCode
();
DiskCatalogue
diskCatalogue
=
new
DiskCatalogue
();
BeanUtils
.
copyProperties
(
diskCatalogueDto
,
diskCatalogue
);
BeanUtils
.
copyProperties
(
diskCatalogueDto
,
diskCatalogue
);
String
parentIds
=
""
;
if
(!
StringUtils
.
isEmpty
(
catalogue
))
{
parentIds
=
catalogue
.
getParentIds
();
diskCatalogue
.
setParentIds
(
catalogue
.
getParentId
()
>
0
?
parentIds
+
","
+
catalogue
.
getId
()
:
catalogue
.
getId
().
toString
());
}
else
{
diskCatalogue
.
setParentIds
(
parentIds
);
}
diskCatalogue
.
setCreateUserId
(
empNum
);
diskCatalogue
.
setCreateUserId
(
empNum
);
diskCatalogue
.
setOrgId
(
orgCode
);
diskCatalogue
.
setOrgId
(
orgCode
);
Boolean
count
=
diskCatalogue
.
insert
();
Boolean
count
=
diskCatalogue
.
insertOrUpdate
();
if
(
count
)
{
if
(
count
)
{
return
ResultUtil
.
data
(
diskCatalogue
,
"新建文件夹成功!"
);
return
ResultUtil
.
data
(
diskCatalogue
,
"新建文件夹成功!"
);
}
else
{
}
else
{
return
ResultUtil
.
error
(
"新建文件夹失败!"
);
return
ResultUtil
.
error
(
"新建文件夹失败!"
);
}
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
throw
new
CustomException
(
"新建文件夹或共享空间异常"
);
}
}
}
/**
/**
...
@@ -76,7 +91,60 @@ public class DiskCatalogueController{
...
@@ -76,7 +91,60 @@ public class DiskCatalogueController{
@ApiParam
(
"文件文件夹或共享空间ID"
)
@RequestParam
(
required
=
true
,
defaultValue
=
"0"
)
Integer
type
)
{
@ApiParam
(
"文件文件夹或共享空间ID"
)
@RequestParam
(
required
=
true
,
defaultValue
=
"0"
)
Integer
type
)
{
Integer
empNum
=
userBean
.
getEmpNum
();
Integer
empNum
=
userBean
.
getEmpNum
();
Integer
orgCode
=
userBean
.
getOrgCode
();
Integer
orgCode
=
userBean
.
getOrgCode
();
List
<
DiskCatalogue
>
list
=
diskCatalogueService
.
getDiskCatalogueList
(
orgCode
,
empNum
,
type
);
List
<
DiskCatalogue
>
list
=
diskCatalogueService
.
getDiskCatalogueList
(
orgCode
,
empNum
,
type
);
return
ResultUtil
.
data
(
list
);
return
ResultUtil
.
data
(
list
);
}
}
/**
* 云盘-我的文件列表
*
* @param userBean
* @param diskCatalogueParam
* @return
*/
@GetMapping
(
value
=
"/myfile"
)
@ApiOperation
(
value
=
"我的文件夹列表"
,
httpMethod
=
"GET"
,
notes
=
"文件夹或共享空间:type=0共享空间,1文件夹"
)
@ApiOperationSupport
(
order
=
2
)
public
Result
<
Object
>
myfile
(
@CurrentUser
UserBean
userBean
,
DiskCatalogueParam
diskCatalogueParam
)
{
try
{
Integer
empNum
=
userBean
.
getEmpNum
();
Integer
orgCode
=
userBean
.
getOrgCode
();
// 获取文件夹
List
<
DiskCatalogue
>
diskFileDataList
=
DiskCatalogue
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
DiskCatalogue
>()
.
lambda
().
eq
(
DiskCatalogue:
:
getOrgId
,
orgCode
)
.
eq
(
DiskCatalogue:
:
getCreateUserId
,
empNum
)
.
eq
(
DiskCatalogue:
:
getParentId
,
diskCatalogueParam
.
getParentId
())
.
eq
(
DiskCatalogue:
:
getType
,
diskCatalogueParam
.
getType
())
.
eq
(
DiskCatalogue:
:
getDeleteFlag
,
0
)
);
// 获取面包屑
List
<
DiskCatalogue
>
breadcrumbDataList
=
null
;
DiskCatalogue
catalogue
=
DiskCatalogue
.
builder
().
id
(
diskCatalogueParam
.
getParentId
()).
build
().
selectById
();
if
(!
StringUtils
.
isEmpty
(
catalogue
)){
List
<
Integer
>
ids
=
new
ArrayList
<>();
if
(!
StringUtils
.
isEmpty
(
catalogue
.
getParentIds
())){
String
[]
list
=
catalogue
.
getParentIds
().
split
(
","
);
for
(
String
str
:
list
)
{
ids
.
add
(
Integer
.
parseInt
(
str
));
}
}
ids
.
add
(
catalogue
.
getId
());
breadcrumbDataList
=
DiskCatalogue
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
DiskCatalogue
>()
.
lambda
().
in
(
DiskCatalogue:
:
getId
,
ids
)
.
eq
(
DiskCatalogue:
:
getOrgId
,
orgCode
)
.
eq
(
DiskCatalogue:
:
getCreateUserId
,
empNum
)
.
eq
(
DiskCatalogue:
:
getDeleteFlag
,
0
)
);
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
2
);
map
.
put
(
"diskFileData"
,
diskFileDataList
);
map
.
put
(
"breadcrumbData"
,
breadcrumbDataList
);
return
ResultUtil
.
data
(
map
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
throw
new
CustomException
(
"获取我的文件夹列表异常"
);
}
}
}
}
src/main/java/cn/timer/api/controller/disk/sevice/DiskCatalogueService.java
View file @
3442a2bc
package
cn
.
timer
.
api
.
controller
.
disk
.
sevice
;
package
cn
.
timer
.
api
.
controller
.
disk
.
sevice
;
import
cn.timer.api.bean.disk.DiskCatalogue
;
import
cn.timer.api.bean.disk.DiskCatalogue
;
import
cn.timer.api.dto.disk.DiskCatalogueParam
;
import
java.util.List
;
import
java.util.List
;
...
@@ -19,4 +20,13 @@ public interface DiskCatalogueService {
...
@@ -19,4 +20,13 @@ public interface DiskCatalogueService {
* @return
* @return
*/
*/
List
<
DiskCatalogue
>
getDiskCatalogueList
(
Integer
orgId
,
Integer
userId
,
Integer
type
);
List
<
DiskCatalogue
>
getDiskCatalogueList
(
Integer
orgId
,
Integer
userId
,
Integer
type
);
/**
* 我的文件夹
* @param orgId
* @param userId
* @param type
* @return
*/
List
<
DiskCatalogue
>
getDiskCatalogue
(
DiskCatalogueParam
diskCatalogueParam
);
}
}
src/main/java/cn/timer/api/controller/disk/sevice/DiskCatalogueServiceImpl.java
View file @
3442a2bc
...
@@ -3,10 +3,14 @@ package cn.timer.api.controller.disk.sevice;
...
@@ -3,10 +3,14 @@ package cn.timer.api.controller.disk.sevice;
import
cn.timer.api.bean.disk.DiskCatalogue
;
import
cn.timer.api.bean.disk.DiskCatalogue
;
import
cn.timer.api.bean.disk.DiskCatalogueFiles
;
import
cn.timer.api.bean.disk.DiskCatalogueFiles
;
import
cn.timer.api.bean.disk.DiskFiles
;
import
cn.timer.api.bean.disk.DiskFiles
;
import
cn.timer.api.dao.disk.DiskCatalogueMapper
;
import
cn.timer.api.dto.disk.DiskCatalogueParam
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -27,6 +31,9 @@ public class DiskCatalogueServiceImpl implements DiskCatalogueService {
...
@@ -27,6 +31,9 @@ public class DiskCatalogueServiceImpl implements DiskCatalogueService {
//所有文件夹ID
//所有文件夹ID
private
static
Map
<
Integer
,
List
<
DiskCatalogueFiles
>>
map
=
new
HashMap
<
Integer
,
List
<
DiskCatalogueFiles
>>();
private
static
Map
<
Integer
,
List
<
DiskCatalogueFiles
>>
map
=
new
HashMap
<
Integer
,
List
<
DiskCatalogueFiles
>>();
@Resource
private
DiskCatalogueMapper
diskCatalogueMapper
;
@Override
@Override
public
List
<
DiskCatalogue
>
getDiskCatalogueList
(
Integer
orgId
,
Integer
userId
,
Integer
type
)
{
public
List
<
DiskCatalogue
>
getDiskCatalogueList
(
Integer
orgId
,
Integer
userId
,
Integer
type
)
{
treeList
=
DiskCatalogue
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
DiskCatalogue
>()
treeList
=
DiskCatalogue
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
DiskCatalogue
>()
...
@@ -57,6 +64,12 @@ public class DiskCatalogueServiceImpl implements DiskCatalogueService {
...
@@ -57,6 +64,12 @@ public class DiskCatalogueServiceImpl implements DiskCatalogueService {
return
getTree
(
list
);
return
getTree
(
list
);
}
}
@Override
public
List
<
DiskCatalogue
>
getDiskCatalogue
(
DiskCatalogueParam
diskCatalogueParam
)
{
//diskCatalogueMapper.
return
null
;
}
/**
/**
* 递归获取树形结构
* 递归获取树形结构
*
*
...
...
src/main/java/cn/timer/api/dto/disk/DiskCatalogueDto.java
View file @
3442a2bc
...
@@ -28,6 +28,12 @@ public class DiskCatalogueDto implements Serializable{
...
@@ -28,6 +28,12 @@ public class DiskCatalogueDto implements Serializable{
* 资源目录ID
* 资源目录ID
*/
*/
@ApiModelProperty
(
value
=
"资源目录ID"
)
@ApiModelProperty
(
value
=
"资源目录ID"
)
private
Integer
id
;
/**
* 资源目录ID
*/
@ApiModelProperty
(
value
=
"资源目录ID"
)
private
Integer
catalogueId
;
private
Integer
catalogueId
;
/**
/**
* 目录名称
* 目录名称
...
@@ -39,7 +45,7 @@ public class DiskCatalogueDto implements Serializable{
...
@@ -39,7 +45,7 @@ public class DiskCatalogueDto implements Serializable{
* 上级目录
* 上级目录
*/
*/
@NotNull
(
message
=
ValidationMsg
.
NOTNULL
)
@NotNull
(
message
=
ValidationMsg
.
NOTNULL
)
@ApiModelProperty
(
value
=
"上级目录"
)
@ApiModelProperty
(
value
=
"上级目录"
,
example
=
"0"
)
private
Integer
parentId
;
private
Integer
parentId
;
/**
/**
* 所有上级目录
* 所有上级目录
...
...
src/main/java/cn/timer/api/dto/disk/DiskCatalogueParam.java
0 → 100644
View file @
3442a2bc
package
cn
.
timer
.
api
.
dto
.
disk
;
import
cn.timer.api.config.exception.ValidationMsg
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2021/12/31
*/
@Data
public
class
DiskCatalogueParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1230023773946170911L
;
/**
* 资源目录ID
*/
@NotNull
(
message
=
ValidationMsg
.
NOTNULL
)
@ApiModelProperty
(
value
=
"资源目录ID"
,
example
=
"0"
)
private
Integer
id
;
//@NotBlank(message = ValidationMsg.NOTBLANK)
@ApiModelProperty
(
value
=
"搜索条件"
)
private
String
searchName
;
/**
* 上级目录
*/
@ApiModelProperty
(
value
=
"上级目录"
,
example
=
"0"
)
private
Integer
parentId
;
/**
* 0云盘,1文件夹
*/
@NotNull
(
message
=
ValidationMsg
.
NOTNULL
)
@ApiModelProperty
(
value
=
"0云盘,1文件夹"
)
private
Integer
type
;
}
src/main/resources/application-test.yml
View file @
3442a2bc
...
@@ -128,7 +128,7 @@ mybatis-plus:
...
@@ -128,7 +128,7 @@ mybatis-plus:
mapper-locations
:
classpath:mapping/**/*Mapper.xml
# dao到xml文件映射
mapper-locations
:
classpath:mapping/**/*Mapper.xml
# dao到xml文件映射
type-aliases-package
:
cn.timer.api.bean
# xml中#全局类名别名
type-aliases-package
:
cn.timer.api.bean
# xml中#全局类名别名
configuration
:
configuration
:
#
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # sql日志打印
log-impl
:
org.apache.ibatis.logging.stdout.StdOutImpl
# sql日志打印
call-setters-on-nulls
:
true
# Map做返回体时 字段值为null依然返回
call-setters-on-nulls
:
true
# Map做返回体时 字段值为null依然返回
cache-enabled
:
true
cache-enabled
:
true
global-config
:
global-config
:
...
...
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