Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
patzn-cloud-service-soil
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-soil
Commits
76d40b8d
Commit
76d40b8d
authored
Jan 13, 2021
by
wangweidong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
土工平台修改
parent
dc371367
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
19 deletions
+44
-19
HSSFWorkbookUtil.java
...com/patzn/cloud/service/lims/common/HSSFWorkbookUtil.java
+3
-5
SoilExperimentServiceImpl.java
...ice/lims/soil/service/impl/SoilExperimentServiceImpl.java
+41
-14
No files found.
src/main/java/com/patzn/cloud/service/lims/common/HSSFWorkbookUtil.java
View file @
76d40b8d
package
com
.
patzn
.
cloud
.
service
.
lims
.
common
;
import
com.google.common.collect.Maps
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.poi.hssf.usermodel.HSSFCell
;
import
org.apache.poi.hssf.usermodel.HSSFRow
;
import
org.apache.poi.hssf.usermodel.HSSFSheet
;
...
...
@@ -487,13 +488,10 @@ public class HSSFWorkbookUtil {
int
num
=
row
.
getLastCellNum
();
for
(
int
i
=
0
;
i
<
num
;
i
++)
{
XSSFCell
cell
=
row
.
getCell
(
i
);
if
(
cell
!=
null
)
{
cell
.
setCellType
(
CellType
.
STRING
);
}
if
(
cell
==
null
||
cell
.
getStringCellValue
()==
null
)
{
if
(
cell
==
null
||
StringUtils
.
isBlank
(
getJavaValue
(
cell
).
toString
()))
{
continue
;
}
String
value
=
cell
.
getStringCellValue
();
String
value
=
getJavaValue
(
cell
).
toString
();
if
(!
""
.
equals
(
value
))
{
Set
<
String
>
keySet
=
item
.
keySet
();
Iterator
<
String
>
it
=
keySet
.
iterator
();
...
...
src/main/java/com/patzn/cloud/service/lims/soil/service/impl/SoilExperimentServiceImpl.java
View file @
76d40b8d
...
...
@@ -317,6 +317,7 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
}
mapReplace
.
put
(
"#{reportCode}"
,
entrust
.
getEntrustCode
());
List
<
SoilOriginalTemplateConfig
>
configList
=
soilOriginalTemplateConfigService
.
list
(
Condition
.
create
().
eq
(
"template_id"
,
templateId
));
if
(
null
==
template
.
getMoreSheet
()
||
0
==
template
.
getMoreSheet
()){
logger
.
error
(
"----------------------3"
);
...
...
@@ -332,7 +333,7 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
if
(
null
!=
beginRow
&&
null
!=
template
.
getSampleMergerNum
()
&&
null
!=
template
.
getTemplateSampleNum
()){
List
<
SoilOriginalTemplateConfig
>
configList
=
soilOriginalTemplateConfigService
.
list
(
Condition
.
create
().
eq
(
"template_id"
,
templateId
));
int
templateSampleNum
=
template
.
getTemplateSampleNum
();
if
(
voList
.
size
()<
templateSampleNum
){
int
sampleMergerNum
=
template
.
getSampleMergerNum
();
...
...
@@ -587,32 +588,58 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
}
}
else
{
int
index
=
0
;
XSSFSheet
xssfSheet
=
xssfWorkbook
.
getSheetAt
(
0
);
int
rowNum
=
xssfSheet
.
getLastRowNum
();
xssfSheet
.
setForceFormulaRecalculation
(
true
);
// int rowNum = xssfSheet.getLastRowNum();
//
// for (int i = 0; i < rowNum ; i++) {
// XSSFRow row = xssfSheet.getRow(i);
//
// int cellNum = row.getLastCellNum();
// for (int j = 0; j < cellNum; j++) {
// XSSFCell cell = row.getCell(j);
// if (cell.getCellType().equals(CellType.FORMULA)){
// String formula = cell.getCellFormula();
// if (StringUtils.isNotBlank(formula)){
// cell.setCellFormula(formula);
// }
// }
// }
// }
//
// xssfSheet.setForceFormulaRecalculation(true);
for
(
int
i
=
0
;
i
<
rowNum
;
i
++)
{
XSSFRow
row
=
xssfSheet
.
getRow
(
i
);
int
cellNum
=
row
.
getLastCellNum
();
for
(
int
j
=
0
;
j
<
cellNum
;
j
++)
{
XSSFCell
cell
=
row
.
getCell
(
j
);
if
(
cell
.
getCellType
().
equals
(
CellType
.
FORMULA
)){
String
formula
=
cell
.
getCellFormula
();
if
(
StringUtils
.
isNotBlank
(
formula
)){
cell
.
setCellFormula
(
formula
);
for
(
SoilOriginalTemplateConfig
config:
configList
)
{
if
(
StringUtils
.
isBlank
(
config
.
getFormula
())){
continue
;
}
if
(
null
==
config
.
getMergeRowNum
()){
continue
;
}
if
(
null
==
config
.
getColumnPlace
()){
continue
;
}
XSSFRow
xssfRow
=
xssfSheet
.
getRow
(
config
.
getMergeRowNum
());
if
(
null
==
xssfRow
){
continue
;
}
XSSFCell
cell
=
xssfRow
.
getCell
(
config
.
getColumnPlace
());
if
(
null
==
cell
){
continue
;
}
cell
.
setCellFormula
(
config
.
getFormula
());
}
xssfSheet
.
setForceFormulaRecalculation
(
true
);
int
index
=
0
;
for
(
SoilExperimentVO
vo:
voList
)
{
if
(
index
==
0
){
xssfWorkbook
.
setSheetName
(
index
,
vo
.
getSampleCode
());
xssfWorkbook
.
setSheetName
(
0
,
vo
.
getSampleCode
());
index
++;
continue
;
}
...
...
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