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
81165497
Commit
81165497
authored
Jun 16, 2021
by
lijingjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改报告问题;
parent
63785439
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
57 deletions
+56
-57
EntrustSampleServiceImpl.java
...vice/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
+56
-57
OriginalTemplateServiceImpl.java
...e/lims/hmhj/service/impl/OriginalTemplateServiceImpl.java
+0
-0
No files found.
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
View file @
81165497
...
...
@@ -62,7 +62,6 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
@Autowired
private
IEntrustReportTemplateConfigService
entrustReportTemplateConfigService
;
@Autowired
private
OssClient
ossClient
;
...
...
@@ -363,62 +362,62 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
e
.
printStackTrace
();
}
List
<
OriginalTemplateConfig
>
configList
=
originalTemplateConfigService
.
list
(
Condition
.
create
().
eq
(
"template_id"
,
templateId
));
OriginalUtil
.
doReplace
(
xssfWorkbook
,
entrust
);
XSSFSheet
sheetOne
=
xssfWorkbook
.
getSheetAt
(
0
);
String
sheetName
=
sheetOne
.
getSheetName
();
System
.
out
.
println
(
sheetName
);
sheetOne
.
setForceFormulaRecalculation
(
true
);
Integer
beginRow
=
sysFileTemplate
.
getSampleBeginRow
();
int
sampleMergerNum
=
sysFileTemplate
.
getSampleMergerNum
();
int
templateSampleNum
=
sysFileTemplate
.
getTemplateSampleNum
();
if
(
templateSampleNum
>=
sampleVOList
.
size
())
{
for
(
EntrustSampleVO
vo:
sampleVOList
)
{
List
<
EntrustSampleItemIndex
>
indexList
=
entrustSampleItemIndexService
.
listBySampleId
(
vo
.
getId
());
vo
.
setIndexList
(
indexList
);
XSSFRow
xssfRow
=
sheetOne
.
getRow
(
beginRow
);
for
(
OriginalTemplateConfig
config:
configList
)
{
XSSFCell
cell
=
xssfRow
.
getCell
(
config
.
getColumnPlace
());
if
(
"sn"
.
equals
(
config
.
getDataAttribute
()))
{
continue
;
}
if
(
StringUtils
.
isBlank
(
config
.
getDataAttribute
()))
{
continue
;
}
String
value
=
StringHandleUtils
.
getFieldValue
(
config
.
getDataAttribute
(),
vo
);
cell
.
setCellValue
(
value
);
}
beginRow
+=
sampleMergerNum
;
}
String
generated
=
entrust
.
getCode
();
FileOutputStream
os
=
null
;
File
file
=
null
;
try
{
file
=
File
.
createTempFile
(
generated
,
".doc
x"
);
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
);
}
List
<
EntrustReportTemplateConfig
>
configList
=
entrustReportTemplateConfigService
.
list
(
Condition
.
create
().
eq
(
"template_id"
,
templateId
));
OriginalUtil
.
doReplace
(
xssfWorkbook
,
entrust
);
XSSFSheet
sheetOne
=
xssfWorkbook
.
getSheetAt
(
0
);
String
sheetName
=
sheetOne
.
getSheetName
();
System
.
out
.
println
(
sheetName
);
sheetOne
.
setForceFormulaRecalculation
(
true
);
Integer
beginRow
=
sysFileTemplate
.
getSampleBeginRow
();
int
sampleMergerNum
=
sysFileTemplate
.
getSampleMergerNum
();
int
templateSampleNum
=
sysFileTemplate
.
getTemplateSampleNum
();
if
(
templateSampleNum
>=
sampleVOList
.
size
())
{
for
(
EntrustSampleVO
vo
:
sampleVOList
)
{
List
<
EntrustSampleItemIndex
>
indexList
=
entrustSampleItemIndexService
.
listBySampleId
(
vo
.
getId
());
vo
.
setIndexList
(
indexList
);
XSSFRow
xssfRow
=
sheetOne
.
getRow
(
beginRow
);
for
(
EntrustReportTemplateConfig
config
:
configList
)
{
XSSFCell
cell
=
xssfRow
.
getCell
(
config
.
getColumnPlace
());
if
(
"sn"
.
equals
(
config
.
getDataAttribute
()))
{
continue
;
}
if
(
StringUtils
.
isBlank
(
config
.
getDataAttribute
()))
{
continue
;
}
String
value
=
StringHandleUtils
.
getFieldValue
(
config
.
getDataAttribute
(),
vo
);
cell
.
setCellValue
(
value
);
}
beginRow
+=
sampleMergerNum
;
}
String
generated
=
entrust
.
getCode
();
FileOutputStream
os
=
null
;
File
file
=
null
;
try
{
file
=
File
.
createTempFile
(
generated
,
".xls
x"
);
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
{
int
insertRow
=
beginRow
+
sampleMergerNum
*
templateSampleNum
;
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/OriginalTemplateServiceImpl.java
View file @
81165497
This diff is collapsed.
Click to expand it.
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