Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
patzn-cloud-service-hmhj
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangweidong
patzn-cloud-service-hmhj
Commits
8c7fb381
Commit
8c7fb381
authored
Jul 26, 2021
by
lijingjing
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
1542bba8
66455bdc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
35 deletions
+22
-35
EntrustSampleServiceImpl.java
...vice/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
+22
-35
No files found.
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
View file @
8c7fb381
...
...
@@ -961,8 +961,10 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
mapReplace
.
put
(
"#{sampleFrom}"
,
list
.
size
()
>
0
?
list
.
get
(
0
).
getSampleFrom
()
:
" - "
);
list
=
sampleList
.
stream
().
filter
(
s
->
StringUtils
.
isNotEmpty
(
s
.
getName
())).
collect
(
Collectors
.
toList
());
mapReplace
.
put
(
"#{sampleName}"
,
list
.
size
()
>
0
?
list
.
get
(
0
).
getName
()
:
" - "
);
HSSFWorkbookUtil
.
replaceModel
(
mapReplace
,
xssfWorkbook
,
0
);
XSSFSheet
sheetOne
=
xssfWorkbook
.
getSheetAt
(
0
);
int
numberOfSheets
=
xssfWorkbook
.
getNumberOfSheets
();
for
(
int
k
=
0
;
k
<
numberOfSheets
;
k
++)
{
HSSFWorkbookUtil
.
replaceModel
(
mapReplace
,
xssfWorkbook
,
k
);
XSSFSheet
sheetOne
=
xssfWorkbook
.
getSheetAt
(
k
);
String
sheetName
=
sheetOne
.
getSheetName
();
System
.
out
.
println
(
sheetName
);
sheetOne
.
setForceFormulaRecalculation
(
true
);
...
...
@@ -971,12 +973,24 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
int
templateSampleNum
=
sysFileTemplate
.
getTemplateSampleNum
();
if
(
templateSampleNum
>=
sampleVOList
.
size
())
{
Integer
beginRow
=
sysFileTemplate
.
getSampleBeginRow
();
HashMap
<
Long
,
List
<
EntrustSampleItemIndex
>>
indexMap
=
new
HashMap
<>();
for
(
EntrustSampleVO
vo
:
sampleVOList
)
{
// List<EntrustSampleItemIndex> indexList = entrustSampleItemIndexService.listBySampleId(vo.getId());
List
<
EntrustSampleItemIndex
>
indexList
=
entrustSampleItemIndexService
.
getInReportItemIndex
(
vo
.
getId
());
List
<
EntrustSampleItemIndex
>
indexList
=
new
ArrayList
<>();
if
(
indexMap
.
containsKey
(
vo
.
getId
()))
{
indexList
=
indexMap
.
get
(
vo
.
getId
());
}
else
{
indexList
=
entrustSampleItemIndexService
.
getInReportItemIndex
(
vo
.
getId
());
}
vo
.
setIndexList
(
indexList
);
XSSFRow
xssfRow
=
sheetOne
.
getRow
(
beginRow
);
for
(
EntrustReportTemplateConfig
config
:
configList
)
{
if
(
null
!=
config
.
getSheetNum
()
&&
config
.
getSheetNum
()
!=
k
)
{
continue
;
}
if
(
null
==
config
.
getColumnPlace
())
{
continue
;
}
XSSFCell
cell
=
xssfRow
.
getCell
(
config
.
getColumnPlace
());
if
(
"sn"
.
equals
(
config
.
getDataAttribute
()))
{
continue
;
...
...
@@ -989,35 +1003,6 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
}
beginRow
+=
sampleMergerNum
;
}
String
generated
=
entrust
.
getCode
();
FileOutputStream
os
=
null
;
File
file
=
null
;
try
{
file
=
File
.
createTempFile
(
generated
,
".xlsx"
);
os
=
new
FileOutputStream
(
file
);
xssfWorkbook
.
write
(
os
);
os
.
flush
();
entrustReportService
.
uploadReportGenerateDocx
(
entrust
,
ids
,
account
,
StringHandleUtils
.
join
(
sampleNameSet
),
"报告生成"
,
file
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
os
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
try
{
xssfWorkbook
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
try
{
io
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
FileUtils
.
deleteFiles
(
file
);
}
}
else
{
...
...
@@ -1028,7 +1013,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
for
(
int
i
=
1
;
i
<
totalSheetSize
;
i
++)
{
xssfWorkbook
.
cloneSheet
(
0
,
sheetOne
.
getSheetName
()
+
(
i
+
1
));
}
for
(
int
k
=
0
;
k
<
listList
.
size
();
k
++)
{
for
(
int
m
=
0
;
m
<
listList
.
size
();
m
++)
{
Integer
beginRow
=
sysFileTemplate
.
getSampleBeginRow
();
List
<
EntrustSampleVO
>
sampleVOListIndex
=
listList
.
get
(
k
);
...
...
@@ -1053,8 +1038,6 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
beginRow
+=
sampleMergerNum
;
}
}
}
else
{
Integer
beginRow
=
sysFileTemplate
.
getSampleBeginRow
();
int
insertRow
=
beginRow
+
sampleMergerNum
*
templateSampleNum
;
...
...
@@ -1081,6 +1064,9 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
List
<
EntrustSampleItemIndex
>
indexList
=
entrustSampleItemIndexService
.
listBySampleId
(
vo
.
getId
());
vo
.
setIndexList
(
indexList
);
for
(
EntrustReportTemplateConfig
config
:
configList
)
{
if
(
null
!=
config
.
getSheetNum
()
&&
config
.
getSheetNum
()
!=
k
)
{
continue
;
}
if
(
null
==
config
.
getColumnPlace
())
{
continue
;
}
...
...
@@ -1122,6 +1108,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
}
}
String
generated
=
entrust
.
getCode
();
FileOutputStream
os
=
null
;
File
file
=
null
;
...
...
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