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
a9fb2bb0
Commit
a9fb2bb0
authored
Mar 19, 2022
by
284718418@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改BUG 空间大小总计
parent
38dae9b4
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
13 deletions
+26
-13
src/main/java/cn/timer/api/bean/disk/DiskFiles.java
+5
-0
src/main/java/cn/timer/api/controller/disk/DiskFilesController.java
+7
-6
src/main/java/cn/timer/api/controller/disk/sevice/DiskFilesService.java
+3
-2
src/main/java/cn/timer/api/controller/disk/sevice/DiskFilesServiceImpl.java
+3
-2
src/main/java/cn/timer/api/dao/disk/DiskFilesMapper.java
+3
-2
src/main/resources/mapping/disk/DiskFilesMapper.xml
+5
-1
No files found.
src/main/java/cn/timer/api/bean/disk/DiskFiles.java
View file @
a9fb2bb0
...
@@ -83,6 +83,11 @@ public class DiskFiles extends Model<DiskFiles> {
...
@@ -83,6 +83,11 @@ public class DiskFiles extends Model<DiskFiles> {
@ApiModelProperty
(
value
=
""
)
@ApiModelProperty
(
value
=
""
)
private
Integer
deleteFlag
;
private
Integer
deleteFlag
;
/**
/**
* 当前企业id
*/
@ApiModelProperty
(
value
=
"当前企业id"
)
private
Integer
orgId
;
/**
* 创建者
* 创建者
*/
*/
@ApiModelProperty
(
value
=
""
)
@ApiModelProperty
(
value
=
""
)
...
...
src/main/java/cn/timer/api/controller/disk/DiskFilesController.java
View file @
a9fb2bb0
...
@@ -101,15 +101,20 @@ public class DiskFilesController {
...
@@ -101,15 +101,20 @@ public class DiskFilesController {
return
ResultUtil
.
error
(
"上传失败,请选择上传文件"
);
return
ResultUtil
.
error
(
"上传失败,请选择上传文件"
);
}
}
DiskFiles
diskFiles
=
new
DiskFiles
();
DiskFiles
diskFiles
=
new
DiskFiles
();
diskFiles
.
setOrgId
(
userBean
.
getOrgCode
());
diskFiles
.
setCreateUserId
(
userBean
.
getEmpNum
());
diskFiles
.
setUploadIp
(
UserIp
.
getIpAddr
(
request
));
diskFiles
.
setUserName
(
userBean
.
getQyzxEmpLogin
().
getUsername
());
DiskCatalogueFiles
diskCatalogueFiles
=
new
DiskCatalogueFiles
();
DiskCatalogueFiles
diskCatalogueFiles
=
new
DiskCatalogueFiles
();
DiskFilesLog
diskFilesLog
=
new
DiskFilesLog
();
DiskFilesLog
diskFilesLog
=
new
DiskFilesLog
();
diskFilesLog
.
setUserId
(
userBean
.
getEmpNum
());
diskFilesLog
.
setUserName
(
userBean
.
getQyzxEmpLogin
().
getUsername
());
List
<
FileInfoDto
>
imageUrls
;
List
<
FileInfoDto
>
imageUrls
;
try
{
try
{
//上传文件到服务器
//上传文件到服务器
imageUrls
=
ftpService
.
uploadFile
(
targetPath
,
file
,
reservedName
);
imageUrls
=
ftpService
.
uploadFile
(
targetPath
,
file
,
reservedName
);
for
(
FileInfoDto
dto
:
imageUrls
)
{
for
(
FileInfoDto
dto
:
imageUrls
)
{
//新增资源上传文件
//新增资源上传文件
diskFiles
.
setCreateUserId
(
userBean
.
getEmpNum
());
diskFiles
.
setFileType
(
dto
.
getFileSuffix
());
diskFiles
.
setFileType
(
dto
.
getFileSuffix
());
//"/home/disk/123456.jpg"
//"/home/disk/123456.jpg"
diskFiles
.
setDiskPath
(
root
+
targetPath
+
"/"
+
dto
.
getFileName
());
diskFiles
.
setDiskPath
(
root
+
targetPath
+
"/"
+
dto
.
getFileName
());
...
@@ -118,8 +123,6 @@ public class DiskFilesController {
...
@@ -118,8 +123,6 @@ public class DiskFilesController {
diskFiles
.
setFileSize
(
dto
.
getFileSize
());
diskFiles
.
setFileSize
(
dto
.
getFileSize
());
// 显示大小:10KB,5M,2G
// 显示大小:10KB,5M,2G
diskFiles
.
setShowSize
(
FileUtils
.
getSize
(
dto
.
getFileSize
()));
diskFiles
.
setShowSize
(
FileUtils
.
getSize
(
dto
.
getFileSize
()));
diskFiles
.
setUserName
(
userBean
.
getQyzxEmpLogin
().
getUsername
());
diskFiles
.
setUploadIp
(
UserIp
.
getIpAddr
(
request
));
diskFiles
.
insert
();
diskFiles
.
insert
();
//新增中间关系
//新增中间关系
...
@@ -133,8 +136,6 @@ public class DiskFilesController {
...
@@ -133,8 +136,6 @@ public class DiskFilesController {
diskFilesLog
.
setFileSize
(
dto
.
getFileSize
()
+
"B"
);
diskFilesLog
.
setFileSize
(
dto
.
getFileSize
()
+
"B"
);
diskFilesLog
.
setTitle
(
dto
.
getResourceFileName
());
diskFilesLog
.
setTitle
(
dto
.
getResourceFileName
());
diskFilesLog
.
setType
(
JxglEnumInterface
.
DiskFilesLogType
.
CREATE_LOG
.
getType
());
diskFilesLog
.
setType
(
JxglEnumInterface
.
DiskFilesLogType
.
CREATE_LOG
.
getType
());
diskFilesLog
.
setUserId
(
userBean
.
getEmpNum
());
diskFilesLog
.
setUserName
(
userBean
.
getQyzxEmpLogin
().
getUsername
());
diskFilesLog
.
insert
();
diskFilesLog
.
insert
();
}
}
...
@@ -234,7 +235,7 @@ public class DiskFilesController {
...
@@ -234,7 +235,7 @@ public class DiskFilesController {
@ApiOperation
(
value
=
"我的文件空间大小"
,
httpMethod
=
"GET"
,
notes
=
"我的文件空间大小"
)
@ApiOperation
(
value
=
"我的文件空间大小"
,
httpMethod
=
"GET"
,
notes
=
"我的文件空间大小"
)
public
Result
<
Object
>
myCatalogue
(
@CurrentUser
UserBean
userBean
)
{
public
Result
<
Object
>
myCatalogue
(
@CurrentUser
UserBean
userBean
)
{
try
{
try
{
DiskFileCatalogueDto
diskFileCatalogueDto
=
diskFilesService
.
getFileCount
(
userBean
.
getEmpNum
()
);
DiskFileCatalogueDto
diskFileCatalogueDto
=
diskFilesService
.
getFileCount
(
userBean
);
return
ResultUtil
.
data
(
diskFileCatalogueDto
);
return
ResultUtil
.
data
(
diskFileCatalogueDto
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
src/main/java/cn/timer/api/controller/disk/sevice/DiskFilesService.java
View file @
a9fb2bb0
...
@@ -2,6 +2,7 @@ package cn.timer.api.controller.disk.sevice;
...
@@ -2,6 +2,7 @@ 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.DiskFiles
;
import
cn.timer.api.bean.disk.DiskFiles
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.dto.disk.DiskCatalogueParam
;
import
cn.timer.api.dto.disk.DiskCatalogueParam
;
import
cn.timer.api.dto.disk.DiskFileCatalogueDto
;
import
cn.timer.api.dto.disk.DiskFileCatalogueDto
;
...
@@ -24,10 +25,10 @@ public interface DiskFilesService {
...
@@ -24,10 +25,10 @@ public interface DiskFilesService {
/**
/**
* 获取用户文件空间大小
* 获取用户文件空间大小
* @param user
Id
* @param user
Bean
* @return
* @return
*/
*/
DiskFileCatalogueDto
getFileCount
(
Integer
userId
);
DiskFileCatalogueDto
getFileCount
(
UserBean
userBean
);
/**
/**
* 删除文件
* 删除文件
...
...
src/main/java/cn/timer/api/controller/disk/sevice/DiskFilesServiceImpl.java
View file @
a9fb2bb0
package
cn
.
timer
.
api
.
controller
.
disk
.
sevice
;
package
cn
.
timer
.
api
.
controller
.
disk
.
sevice
;
import
cn.timer.api.bean.disk.DiskFiles
;
import
cn.timer.api.bean.disk.DiskFiles
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.dao.disk.DiskFilesMapper
;
import
cn.timer.api.dao.disk.DiskFilesMapper
;
import
cn.timer.api.dto.disk.DiskCatalogueParam
;
import
cn.timer.api.dto.disk.DiskCatalogueParam
;
import
cn.timer.api.dto.disk.DiskFileCatalogueDto
;
import
cn.timer.api.dto.disk.DiskFileCatalogueDto
;
...
@@ -29,8 +30,8 @@ public class DiskFilesServiceImpl implements DiskFilesService {
...
@@ -29,8 +30,8 @@ public class DiskFilesServiceImpl implements DiskFilesService {
}
}
@Override
@Override
public
DiskFileCatalogueDto
getFileCount
(
Integer
userId
)
{
public
DiskFileCatalogueDto
getFileCount
(
UserBean
userBean
)
{
DiskFileCatalogueDto
dto
=
diskFilesMapper
.
selectFileCount
(
user
Id
);
DiskFileCatalogueDto
dto
=
diskFilesMapper
.
selectFileCount
(
user
Bean
);
if
(
StringUtils
.
isEmpty
(
dto
)){
if
(
StringUtils
.
isEmpty
(
dto
)){
dto
=
new
DiskFileCatalogueDto
();
dto
=
new
DiskFileCatalogueDto
();
}
}
...
...
src/main/java/cn/timer/api/dao/disk/DiskFilesMapper.java
View file @
a9fb2bb0
...
@@ -2,6 +2,7 @@ package cn.timer.api.dao.disk;
...
@@ -2,6 +2,7 @@ package cn.timer.api.dao.disk;
import
cn.timer.api.bean.disk.DiskFiles
;
import
cn.timer.api.bean.disk.DiskFiles
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.dto.disk.DiskCatalogueParam
;
import
cn.timer.api.dto.disk.DiskCatalogueParam
;
import
cn.timer.api.dto.disk.DiskFileCatalogueDto
;
import
cn.timer.api.dto.disk.DiskFileCatalogueDto
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
...
@@ -30,10 +31,10 @@ public interface DiskFilesMapper extends BaseMapper<DiskFiles> {
...
@@ -30,10 +31,10 @@ public interface DiskFilesMapper extends BaseMapper<DiskFiles> {
/**
/**
* 获取用户文件空间大小
* 获取用户文件空间大小
* @param user
Id
* @param user
Bean
* @return
* @return
*/
*/
DiskFileCatalogueDto
selectFileCount
(
@Param
(
"
userId"
)
Integer
userId
);
DiskFileCatalogueDto
selectFileCount
(
@Param
(
"
param"
)
UserBean
userBean
);
/**
/**
* 删除文件
* 删除文件
...
...
src/main/resources/mapping/disk/DiskFilesMapper.xml
View file @
a9fb2bb0
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
<result
property=
"showSize"
column=
"show_size"
/>
<result
property=
"showSize"
column=
"show_size"
/>
<result
property=
"fileType"
column=
"file_type"
/>
<result
property=
"fileType"
column=
"file_type"
/>
<result
property=
"uploadIp"
column=
"upload_ip"
/>
<result
property=
"uploadIp"
column=
"upload_ip"
/>
<result
property=
"orgId"
column=
"org_id"
/>
<result
property=
"deleteFlag"
column=
"delete_flag"
/>
<result
property=
"deleteFlag"
column=
"delete_flag"
/>
<result
property=
"createUserId"
column=
"create_user_id"
/>
<result
property=
"createUserId"
column=
"create_user_id"
/>
<result
property=
"userName"
column=
"user_name"
/>
<result
property=
"userName"
column=
"user_name"
/>
...
@@ -33,7 +34,10 @@
...
@@ -33,7 +34,10 @@
</select>
</select>
<select
id=
"selectFileCount"
resultType=
"cn.timer.api.dto.disk.DiskFileCatalogueDto"
>
<select
id=
"selectFileCount"
resultType=
"cn.timer.api.dto.disk.DiskFileCatalogueDto"
>
SELECT COALESCE(sum(file_size),0) as countSize FROM `disk_files` where create_user_id = #{userId} AND delete_flag=0
SELECT COALESCE(sum(df.file_size),0) as countSize FROM `disk_files` df
LEFT JOIN disk_catalogue_files dcf ON df.id = dcf.files_id
LEFT JOIN disk_catalogue dc ON dc.id = dcf.catalogue_id
WHERE df.create_user_id = #{param.empNum} AND df.org_id=#{param.orgCode} AND df.delete_flag=0 AND dcf.delete_flag=0 AND dc.delete_flag=0 AND dc.type=0
</select>
</select>
...
...
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