Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
74abb526
Commit
74abb526
authored
Jul 06, 2023
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表结构修改
parent
5aa581f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
YzgExcelService.java
...main/java/com/yanzuoguang/cloud/file/YzgExcelService.java
+17
-14
No files found.
yzg-util-file/src/main/java/com/yanzuoguang/cloud/file/YzgExcelService.java
View file @
74abb526
...
...
@@ -12,7 +12,6 @@ import com.yanzuoguang.util.helper.JsonHelper;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
com.yanzuoguang.util.vo.ResponseResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -28,14 +27,15 @@ import java.util.Date;
@Component
public
class
YzgExcelService
{
@Autowired
private
CloudConfig
cloudConfig
;
private
final
CloudConfig
cloudConfig
;
private
final
YzgFileDao
fileDao
;
private
final
YzgFileProcedure
fileProcedure
;
@Autowired
private
YzgFileDao
fileDao
;
@Autowired
private
YzgFileProcedure
fileProcedure
;
public
YzgExcelService
(
CloudConfig
cloudConfig
,
YzgFileDao
fileDao
,
YzgFileProcedure
fileProcedure
)
{
this
.
cloudConfig
=
cloudConfig
;
this
.
fileDao
=
fileDao
;
this
.
fileProcedure
=
fileProcedure
;
}
/**
* 创建文件,不需要开启事务
...
...
@@ -51,13 +51,12 @@ public class YzgExcelService {
fileDao
.
create
(
load
);
}
// 生成回调参数
String
server
File
=
getServer
Path
(
load
);
String
server
AbsolutePath
=
getServerAbsolute
Path
(
load
);
YzgFileCallbackReqVo
callbackReq
=
new
YzgFileCallbackReqVo
(
fileReq
.
getFileId
(),
fileReq
.
getCompanyId
(),
fileReq
.
getCallbackMQ
(),
fileReq
.
getCallbackParameter
(),
server
File
server
AbsolutePath
);
// 判断文件状态
int
fileStatus
=
StringHelper
.
toInt
(
load
.
getFileStatus
());
switch
(
fileStatus
)
{
...
...
@@ -80,11 +79,11 @@ public class YzgExcelService {
fileProcedure
.
fileCreateDelay
(
json
);
break
;
default
:
return
;
break
;
}
}
catch
(
CodeException
ex
)
{
if
(
fileReq
!=
null
&&
!
StringHelper
.
isEmpty
(
fileReq
.
getFileId
()))
{
ResponseResult
error
=
ExceptionHelper
.
getError
(
ex
);
ResponseResult
<?>
error
=
ExceptionHelper
.
getError
(
ex
);
fileDao
.
updateStatus
(
new
YzgFileStatusReqVo
(
fileReq
.
getFileId
(),
fileReq
.
getCompanyId
(),
error
.
getMessage
()));
}
}
...
...
@@ -173,9 +172,13 @@ public class YzgExcelService {
}
private
String
getServerPath
(
YzgFileVo
load
)
{
return
String
.
format
(
"%s/%s"
,
cloudConfig
.
getServerUrl
(),
getServerAbsolutePath
(
load
));
}
private
String
getServerAbsolutePath
(
YzgFileVo
load
)
{
Date
date
=
DateHelper
.
getDateTime
(
load
.
getCreateDate
());
// 获取临时文件路径
String
tempFolder
=
cloudConfig
.
getTempFolder
(
load
.
getCompanyId
(),
date
);
return
String
.
format
(
"%s/%s
/%s.xlsx"
,
cloudConfig
.
getServerUrl
()
,
tempFolder
,
load
.
getFileId
());
return
String
.
format
(
"%s/%s
.xlsx"
,
tempFolder
,
load
.
getFileId
());
}
}
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