Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-operate-sys-cscec
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fulixin
dsk-operate-sys-cscec
Commits
9ff23aa9
Commit
9ff23aa9
authored
Mar 06, 2024
by
lcl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
u
parent
a505e5a7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
DataAnalysisComponent.java
...rc/main/java/com/dsk/component/DataAnalysisComponent.java
+13
-14
No files found.
dsk-module/dsk-biz-api/src/main/java/com/dsk/component/DataAnalysisComponent.java
View file @
9ff23aa9
...
@@ -48,7 +48,7 @@ public class DataAnalysisComponent {
...
@@ -48,7 +48,7 @@ public class DataAnalysisComponent {
* 工料汇总数据解析
* 工料汇总数据解析
*/
*/
@Async
@Async
public
void
quantitySummaryDataAnalysis
(
CbProjectBaseBo
bo
)
throws
Exception
{
public
void
quantitySummaryDataAnalysis
(
CbProjectBaseBo
bo
){
//查询工料汇总导入文件
//查询工料汇总导入文件
List
<
CbProjectFile
>
fileList
=
projectFileService
.
selectAnalysisList
(
bo
.
getProjectId
(),
CbProjectConstants
.
CB_TYPE_QUANTITY_SUMMARY
,
bo
.
getCbStage
());
List
<
CbProjectFile
>
fileList
=
projectFileService
.
selectAnalysisList
(
bo
.
getProjectId
(),
CbProjectConstants
.
CB_TYPE_QUANTITY_SUMMARY
,
bo
.
getCbStage
());
...
@@ -59,17 +59,13 @@ public class DataAnalysisComponent {
...
@@ -59,17 +59,13 @@ public class DataAnalysisComponent {
//文件下载
//文件下载
InputStream
inputStream
=
ossService
.
downFileIO
(
file
.
getFileOssId
());
InputStream
inputStream
=
ossService
.
downFileIO
(
file
.
getFileOssId
());
if
(
ObjectUtil
.
isNull
(
inputStream
))
{
if
(
ObjectUtil
.
isNull
(
inputStream
))
{
file
.
setFileParseStatus
(
3
);
addFileErrorMsg
(
file
,
"文件数据不存在"
);
file
.
setFailRemark
(
"文件数据不存在"
);
projectFileService
.
updateById
(
file
);
break
;
break
;
}
}
//解析数据
//解析数据
List
<
CbQuantitySummary
>
importList
=
new
ExcelUtils
<>(
CbQuantitySummary
.
class
).
importExcelAllSheet
(
inputStream
,
1
);
List
<
CbQuantitySummary
>
importList
=
new
ExcelUtils
<>(
CbQuantitySummary
.
class
).
importExcelAllSheet
(
inputStream
,
1
);
if
(
importList
.
isEmpty
())
{
if
(
importList
.
isEmpty
())
{
file
.
setFileParseStatus
(
3
);
addFileErrorMsg
(
file
,
"表格中不存在待导入数据"
);
file
.
setFailRemark
(
"表格中不存在待导入数据!"
);
projectFileService
.
updateById
(
file
);
break
;
break
;
}
}
List
<
CbQuantitySummary
>
quantitySummaryList
=
importList
.
stream
().
parallel
()
List
<
CbQuantitySummary
>
quantitySummaryList
=
importList
.
stream
().
parallel
()
...
@@ -80,7 +76,8 @@ public class DataAnalysisComponent {
...
@@ -80,7 +76,8 @@ public class DataAnalysisComponent {
item
.
setCbProjectFileId
(
file
.
getId
());
item
.
setCbProjectFileId
(
file
.
getId
());
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
if
(
quantitySummaryList
.
isEmpty
())
{
if
(
quantitySummaryList
.
isEmpty
())
{
throw
new
ServiceException
(
"表格中不存在有效数据!"
);
addFileErrorMsg
(
file
,
"表格中不存在有效数据"
);
break
;
}
}
transactionTemplate
.
execute
(
status
->
{
transactionTemplate
.
execute
(
status
->
{
...
@@ -114,18 +111,20 @@ public class DataAnalysisComponent {
...
@@ -114,18 +111,20 @@ public class DataAnalysisComponent {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
status
.
setRollbackOnly
();
status
.
setRollbackOnly
();
file
.
setFileParseStatus
(
3
);
addFileErrorMsg
(
file
,
e
.
getMessage
());
file
.
setFailRemark
(
e
.
getMessage
());
projectFileService
.
updateById
(
file
);
}
}
return
Boolean
.
TRUE
;
return
Boolean
.
TRUE
;
});
});
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
file
.
setFileParseStatus
(
3
);
addFileErrorMsg
(
file
,
e
.
getMessage
());
file
.
setFailRemark
(
e
.
getMessage
());
}
projectFileService
.
updateById
(
file
);
}
}
}
}
private
void
addFileErrorMsg
(
CbProjectFile
file
,
String
errorMsg
)
{
file
.
setFileParseStatus
(
3
);
file
.
setFailRemark
(
errorMsg
);
projectFileService
.
updateById
(
file
);
}
}
}
}
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