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
5e869911
Commit
5e869911
authored
Apr 19, 2021
by
wangweidong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
土工
parent
51a30ac2
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
624 additions
and
29 deletions
+624
-29
aspose-cells-20.7-crack.jar
libs/aspose-cells-20.7-crack.jar
+0
-0
aspose-cells-8.5.2.jar
libs/aspose-cells-8.5.2.jar
+0
-0
AsposeUtil.java
.../java/com/patzn/cloud/service/lims/common/AsposeUtil.java
+19
-5
HSSFWorkbookUtil.java
...com/patzn/cloud/service/lims/common/HSSFWorkbookUtil.java
+24
-8
InitMapReplace.java
...com/patzn/cloud/service/lims/original/InitMapReplace.java
+20
-0
Operation.java
...java/com/patzn/cloud/service/lims/original/Operation.java
+10
-0
OriginalUtil.java
...a/com/patzn/cloud/service/lims/original/OriginalUtil.java
+42
-0
SheetMoreSingleOperation.java
...cloud/service/lims/original/SheetMoreSingleOperation.java
+199
-0
SingleMoreOperation.java
...atzn/cloud/service/lims/original/SingleMoreOperation.java
+268
-0
SoilExperimentMapper.xml
src/main/resources/mapper/soil/SoilExperimentMapper.xml
+1
-1
Aspose.Total.Product.Family(3).lic
src/main/resources/static/Aspose.Total.Product.Family(3).lic
+24
-0
license.xml
src/main/resources/static/license.xml
+17
-15
AttachmentTemplateSZYS.xlsx
...ain/resources/templates/excel/AttachmentTemplateSZYS.xlsx
+0
-0
No files found.
libs/aspose-cells-20.7-crack.jar
0 → 100644
View file @
5e869911
File added
libs/aspose-cells-8.5.2.jar
deleted
100644 → 0
View file @
51a30ac2
File deleted
src/main/java/com/patzn/cloud/service/lims/common/AsposeUtil.java
View file @
5e869911
...
@@ -19,12 +19,27 @@ public class AsposeUtil {
...
@@ -19,12 +19,27 @@ public class AsposeUtil {
protected
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AsposeUtil
.
class
);
protected
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AsposeUtil
.
class
);
public
static
boolean
getLicense
()
{
public
static
boolean
getLicense
()
{
// boolean result = false;
// try {
// InputStream is = Word2Pdf.class.getClassLoader()
// .getResourceAsStream("classpath:statis/Aspose.Total.Product.Family(3).lic");
// License aposeLic = new License();
// aposeLic.setLicense(is);
// result = true;
// } catch (Exception e) {
// logger.error("授权失败"+e.getMessage());
// e.printStackTrace();
// }
// return result;
boolean
result
=
false
;
boolean
result
=
false
;
try
{
try
{
InputStream
is
=
Word2Pdf
.
class
.
getClassLoader
()
InputStream
is
=
License
.
class
.
getResourceAsStream
(
"/com.aspose.cells.lic_2999.xml"
);
.
getResourceAsStream
(
"classpath:statis/license.xml"
);
License
asposeLicense
=
new
License
(
);
License
aposeLic
=
new
License
(
);
asposeLicense
.
setLicense
(
is
);
aposeLic
.
setLicense
(
is
);
is
.
close
(
);
result
=
true
;
result
=
true
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -54,7 +69,6 @@ public class AsposeUtil {
...
@@ -54,7 +69,6 @@ public class AsposeUtil {
XSSFWorkbook
workbookOk
=
new
XSSFWorkbook
(
tempFile
);
XSSFWorkbook
workbookOk
=
new
XSSFWorkbook
(
tempFile
);
workbookOk
.
setActiveSheet
(
0
);
workbookOk
.
setActiveSheet
(
0
);
workbookOk
.
removeSheetAt
(
workbookOk
.
getNumberOfSheets
()-
1
);
logger
.
error
(
"mergeWork----------6"
);
logger
.
error
(
"mergeWork----------6"
);
File
file
=
File
.
createTempFile
(
DateUtils
.
toYearMonthDayEasy
(
new
Date
())+
name
,
".xlsx"
);
File
file
=
File
.
createTempFile
(
DateUtils
.
toYearMonthDayEasy
(
new
Date
())+
name
,
".xlsx"
);
logger
.
error
(
"mergeWork----------7"
);
logger
.
error
(
"mergeWork----------7"
);
...
...
src/main/java/com/patzn/cloud/service/lims/common/HSSFWorkbookUtil.java
View file @
5e869911
package
com
.
patzn
.
cloud
.
service
.
lims
.
common
;
package
com
.
patzn
.
cloud
.
service
.
lims
.
common
;
import
com.baomidou.mybatisplus.toolkit.CollectionUtils
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.patzn.cloud.service.soil.vo.SoilExperimentVO
;
import
com.patzn.cloud.service.soil.vo.SoilItemVO
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.poi.hssf.usermodel.HSSFCell
;
import
org.apache.poi.hssf.usermodel.HSSFCell
;
import
org.apache.poi.hssf.usermodel.HSSFRow
;
import
org.apache.poi.hssf.usermodel.HSSFRow
;
...
@@ -17,12 +20,30 @@ import java.math.BigInteger;
...
@@ -17,12 +20,30 @@ import java.math.BigInteger;
import
java.text.DateFormat
;
import
java.text.DateFormat
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
public
class
HSSFWorkbookUtil
{
public
class
HSSFWorkbookUtil
{
public
static
String
getFieldValue
(
String
dataAttribute
,
SoilExperimentVO
vo
,
List
<
SoilItemVO
>
soilItemVOList
)
{
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isBlank
(
dataAttribute
)){
return
""
;
}
if
(
StringHandleUtils
.
is_alpha
(
dataAttribute
)){
return
StringHandleUtils
.
getFieldIfNummReturnBlankValueByFieldName
(
dataAttribute
,
vo
);
}
else
{
if
(
CollectionUtils
.
isEmpty
(
soilItemVOList
)){
return
""
;
}
for
(
SoilItemVO
soilItemVO
:
soilItemVOList
)
{
if
(
dataAttribute
.
equals
(
soilItemVO
.
getName
())){
return
soilItemVO
.
getTestValue
();
}
}
}
return
""
;
}
public
static
HSSFWorkbook
replaceModel
(
Map
item
,
HSSFWorkbook
wb
)
{
public
static
HSSFWorkbook
replaceModel
(
Map
item
,
HSSFWorkbook
wb
)
{
try
{
try
{
HSSFSheet
sheet
=
wb
.
getSheetAt
(
0
);
HSSFSheet
sheet
=
wb
.
getSheetAt
(
0
);
...
@@ -285,17 +306,13 @@ public class HSSFWorkbookUtil {
...
@@ -285,17 +306,13 @@ public class HSSFWorkbookUtil {
if
(
resize
){
if
(
resize
){
// 指定我想要的长宽
// 指定我想要的长宽
double
standardWidth
=
60
0
;
double
standardWidth
=
58
0
;
double
standardHeight
=
8
3
0
;
double
standardHeight
=
8
1
0
;
double
w
=
sheet
.
getColumnWidth
(
cell
.
getColumnIndex
());
double
w
=
sheet
.
getColumnWidth
(
cell
.
getColumnIndex
());
double
h
=
cell
.
getRow
().
getHeight
();
double
h
=
cell
.
getRow
().
getHeight
();
double
cellWidth
=
sheet
.
getColumnWidthInPixels
(
cell
.
getColumnIndex
());
double
cellWidth
=
sheet
.
getColumnWidthInPixels
(
cell
.
getColumnIndex
());
double
cellHeight
=
cell
.
getRow
().
getHeightInPoints
()/
72
*
96
;
double
cellHeight
=
cell
.
getRow
().
getHeightInPoints
()/
72
*
96
;
// 计算需要的长宽比例的系数
// 计算需要的长宽比例的系数
double
a
=
standardWidth
/
cellWidth
;
double
a
=
standardWidth
/
cellWidth
;
double
b
=
standardHeight
/
cellHeight
;
double
b
=
standardHeight
/
cellHeight
;
...
@@ -303,7 +320,6 @@ public class HSSFWorkbookUtil {
...
@@ -303,7 +320,6 @@ public class HSSFWorkbookUtil {
}
else
{
}
else
{
pict
.
resize
();
pict
.
resize
();
}
}
}
}
}
}
}
}
...
...
src/main/java/com/patzn/cloud/service/lims/original/InitMapReplace.java
0 → 100644
View file @
5e869911
package
com
.
patzn
.
cloud
.
service
.
lims
.
original
;
import
com.patzn.cloud.service.soil.entity.SoilEntrust
;
import
java.util.Map
;
public
class
InitMapReplace
{
public
static
void
initMapReplace
(
Map
<
String
,
String
>
mapReplace
,
SoilEntrust
entrust
){
mapReplace
.
put
(
"#{projectName}"
,
entrust
.
getProjectName
());
mapReplace
.
put
(
"#{client}"
,
entrust
.
getClient
());
mapReplace
.
put
(
"#{boreholeName}"
,
entrust
.
getBoreholeName
());
mapReplace
.
put
(
"#{projectNo}"
,
entrust
.
getProjectNo
());
if
(
null
==
entrust
.
getWaterDepth
()){
mapReplace
.
put
(
"#{waterDepth}"
,
""
);
}
else
{
mapReplace
.
put
(
"#{waterDepth}"
,
entrust
.
getWaterDepth
().
toString
());
}
mapReplace
.
put
(
"#{reportCode}"
,
entrust
.
getEntrustCode
());
}
}
src/main/java/com/patzn/cloud/service/lims/original/Operation.java
0 → 100644
View file @
5e869911
package
com
.
patzn
.
cloud
.
service
.
lims
.
original
;
public
interface
Operation
{
void
doProductOriginal
();
}
src/main/java/com/patzn/cloud/service/lims/original/OriginalUtil.java
0 → 100644
View file @
5e869911
package
com
.
patzn
.
cloud
.
service
.
lims
.
original
;
import
com.patzn.cloud.service.soil.entity.SoilOriginalTemplateConfig
;
import
com.patzn.cloud.service.soil.vo.SoilItemVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.xssf.usermodel.XSSFCell
;
import
org.apache.poi.xssf.usermodel.XSSFRow
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
java.util.List
;
public
final
class
OriginalUtil
{
public
static
void
doForValue
(
int
sampleMergerNum
,
XSSFSheet
sheetOne
,
int
beginRow
,
SoilOriginalTemplateConfig
config
,
String
name
,
List
<
SoilItemVO
>
soilItemVOS
){
for
(
int
i
=
0
;
i
<
sampleMergerNum
;
i
++)
{
XSSFRow
zhuiRow
=
sheetOne
.
getRow
(
beginRow
+
i
);
if
(
null
!=
zhuiRow
){
XSSFCell
cellZhui
=
zhuiRow
.
getCell
(
config
.
getColumnPlace
());
if
(
null
!=
cellZhui
){
for
(
SoilItemVO
itemVO:
soilItemVOS
)
{
if
((
name
+(
i
+
1
)).
equals
(
itemVO
.
getName
())){
cellZhui
.
setCellValue
(
itemVO
.
getTestValue
());
break
;
}
}
}
}
}
}
public
static
boolean
skipDoExcel
(
SoilOriginalTemplateConfig
config
){
if
(
StringUtils
.
isBlank
(
config
.
getFormula
())||
null
==
config
.
getColumnPlace
()||
null
==
config
.
getMergeRowNum
()){
return
true
;
}
return
false
;
}
}
src/main/java/com/patzn/cloud/service/lims/original/SheetMoreSingleOperation.java
0 → 100644
View file @
5e869911
package
com
.
patzn
.
cloud
.
service
.
lims
.
original
;
import
com.baomidou.mybatisplus.toolkit.CollectionUtils
;
import
com.patzn.cloud.service.lims.common.HSSFWorkbookUtil
;
import
com.patzn.cloud.service.lims.common.StringHandleUtils
;
import
com.patzn.cloud.service.lims.gideon.utils.ApachePoiLineChart4
;
import
com.patzn.cloud.service.lims.gideon.utils.DrawXlsxUtil
;
import
com.patzn.cloud.service.soil.entity.SoilOriginalTemplate
;
import
com.patzn.cloud.service.soil.entity.SoilOriginalTemplateConfig
;
import
com.patzn.cloud.service.soil.vo.SoilExperimentVO
;
import
com.patzn.cloud.service.soil.vo.SoilItemVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.usermodel.PrintSetup
;
import
org.apache.poi.xssf.usermodel.XSSFCell
;
import
org.apache.poi.xssf.usermodel.XSSFRow
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.InputStream
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
public
class
SheetMoreSingleOperation
implements
Operation
{
private
XSSFWorkbook
xssfWorkbook
;
private
InputStream
io
;
private
Map
<
String
,
String
>
mapReplace
;
private
List
<
SoilOriginalTemplateConfig
>
configList
;
private
SoilOriginalTemplate
template
;
private
List
<
SoilExperimentVO
>
voList
;
private
Map
<
Long
,
List
<
SoilItemVO
>>
sampleSoilItemVOMap
;
protected
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SheetMoreSingleOperation
.
class
);
public
SheetMoreSingleOperation
(
XSSFWorkbook
xssfWorkbook
,
InputStream
io
,
Map
<
String
,
String
>
mapReplace
,
List
<
SoilOriginalTemplateConfig
>
configList
,
SoilOriginalTemplate
template
,
List
<
SoilExperimentVO
>
voList
,
Map
<
Long
,
List
<
SoilItemVO
>>
sampleSoilItemVOMap
)
{
this
.
xssfWorkbook
=
xssfWorkbook
;
this
.
io
=
io
;
this
.
mapReplace
=
mapReplace
;
this
.
configList
=
configList
;
this
.
template
=
template
;
this
.
voList
=
voList
;
this
.
sampleSoilItemVOMap
=
sampleSoilItemVOMap
;
}
public
void
doProductOriginal
(){
XSSFSheet
xssfSheet
=
xssfWorkbook
.
getSheetAt
(
0
);
xssfSheet
.
setForceFormulaRecalculation
(
true
);
int
index
=
0
;
SoilExperimentVO
firstVO
=
null
;
int
sheetNum
=
xssfWorkbook
.
getNumberOfSheets
();
boolean
keliJIa
=
"颗粒分析实验(甲种)"
.
equals
(
template
.
getName
())
||
"颗粒分析实验(乙种)"
.
equals
(
template
.
getName
());
boolean
keliAstm
=
"颗粒分析实验(ASTM)"
.
equals
(
template
.
getName
())
;
if
(
keliJIa
){
DrawXlsxUtil
.
AnchorPosition
position
=
new
DrawXlsxUtil
.
AnchorPosition
(
21
,
2
,
28
,
8
,
"颗粒大小分布曲线"
,
"颗粒大小(mm)"
,
"小于某直径之百分数(%)"
);
ApachePoiLineChart4
.
productZhexian
(
xssfSheet
,
position
);
}
if
(
keliAstm
){
DrawXlsxUtil
.
AnchorPosition
position
=
new
DrawXlsxUtil
.
AnchorPosition
(
21
,
2
,
28
,
8
,
"颗粒大小分布曲线"
,
"颗粒大小(mm)"
,
"小于某直径之百分数(%)"
);
ApachePoiLineChart4
.
productZhexianAstm
(
xssfSheet
,
position
);
}
PrintSetup
printSetup
=
xssfSheet
.
getPrintSetup
();
boolean
printRound
=
printSetup
.
getLandscape
();
for
(
SoilExperimentVO
vo:
voList
)
{
if
(
index
==
0
){
index
++;
firstVO
=
vo
;
continue
;
}
XSSFSheet
sheet
=
xssfWorkbook
.
cloneSheet
(
0
);
sheet
.
getPrintSetup
().
setLandscape
(
printRound
);
if
(
keliJIa
){
DrawXlsxUtil
.
AnchorPosition
position
=
new
DrawXlsxUtil
.
AnchorPosition
(
21
,
2
,
28
,
8
,
"颗粒大小分布曲线"
,
"颗粒大小(mm)"
,
"小于某直径之百分数(%)"
);
ApachePoiLineChart4
.
productZhexian
(
sheet
,
position
);
}
if
(
keliAstm
){
DrawXlsxUtil
.
AnchorPosition
position
=
new
DrawXlsxUtil
.
AnchorPosition
(
21
,
2
,
28
,
8
,
"颗粒大小分布曲线"
,
"颗粒大小(mm)"
,
"小于某直径之百分数(%)"
);
ApachePoiLineChart4
.
productZhexianAstm
(
xssfSheet
,
position
);
}
index
++;
}
int
nextSample
=
sheetNum
;
boolean
start
=
true
;
for
(
SoilExperimentVO
vo:
voList
)
{
if
(
start
){
start
=
false
;
continue
;
}
XSSFSheet
sheet
=
xssfWorkbook
.
getSheetAt
(
nextSample
);
xssfWorkbook
.
setSheetName
(
nextSample
,
vo
.
getSampleCode
());
List
<
SoilItemVO
>
itemVOList
=
sampleSoilItemVOMap
.
get
(
vo
.
getSampleId
());
if
(
CollectionUtils
.
isNotEmpty
(
itemVOList
)){
for
(
SoilItemVO
itemVO:
itemVOList
)
{
mapReplace
.
put
(
"#{"
+
itemVO
.
getName
()+
"}"
,
itemVO
.
getTestValue
());
}
}
if
(!
mapReplace
.
containsKey
(
"#{含水率}"
)){
mapReplace
.
put
(
"#{含水率}"
,
""
);
}
if
(!
mapReplace
.
containsKey
(
"#{液限}"
)){
mapReplace
.
put
(
"#{液限}"
,
""
);
}
if
(!
mapReplace
.
containsKey
(
"#{塑限}"
)){
mapReplace
.
put
(
"#{塑限}"
,
""
);
}
if
(!
mapReplace
.
containsKey
(
"#{比重}"
)){
mapReplace
.
put
(
"#{比重}"
,
""
);
}
if
(!
mapReplace
.
containsKey
(
"#{密度}"
)){
mapReplace
.
put
(
"#{密度}"
,
""
);
}
mapReplace
.
put
(
"#{sampleCode}"
,
vo
.
getSampleCode
());
mapReplace
.
put
(
"#{siteNo}"
,
vo
.
getSiteNo
());
mapReplace
.
put
(
"#{sampleDepth}"
,
vo
.
getSampleDepth
());
String
midu
=
mapReplace
.
get
(
"#{密度}"
);
if
(
StringUtils
.
isNotBlank
(
midu
)){
try
{
BigDecimal
bigDecimal
=
new
BigDecimal
(
midu
);
BigDecimal
mul
=
new
BigDecimal
(
"9.81"
);
BigDecimal
rz981
=
bigDecimal
.
multiply
(
mul
);
mapReplace
.
put
(
"#{密度9.81}"
,
rz981
.
toString
());
}
catch
(
Exception
e
){
logger
.
error
(
"密度9.81失败"
+
e
.
getMessage
());
mapReplace
.
put
(
"#{密度9.81}"
,
""
);
}
}
else
{
mapReplace
.
put
(
"#{密度9.81}"
,
""
);
}
nextSample
++;
HSSFWorkbookUtil
.
replaceModel
(
mapReplace
,
xssfWorkbook
,
sheet
);
}
List
<
SoilItemVO
>
itemVOList
=
sampleSoilItemVOMap
.
get
(
firstVO
.
getSampleId
());
if
(
CollectionUtils
.
isNotEmpty
(
itemVOList
)){
for
(
SoilItemVO
itemVO:
itemVOList
)
{
mapReplace
.
put
(
"#{"
+
itemVO
.
getName
()+
"}"
,
itemVO
.
getTestValue
());
}
}
if
(!
mapReplace
.
containsKey
(
"#{含水率}"
)){
mapReplace
.
put
(
"#{含水率}"
,
""
);
}
if
(!
mapReplace
.
containsKey
(
"#{液限}"
)){
mapReplace
.
put
(
"#{液限}"
,
""
);
}
if
(!
mapReplace
.
containsKey
(
"#{塑限}"
)){
mapReplace
.
put
(
"#{塑限}"
,
""
);
}
if
(!
mapReplace
.
containsKey
(
"#{比重}"
)){
mapReplace
.
put
(
"#{比重}"
,
""
);
}
if
(!
mapReplace
.
containsKey
(
"#{密度}"
)){
mapReplace
.
put
(
"#{密度}"
,
""
);
}
mapReplace
.
put
(
"#{sampleCode}"
,
firstVO
.
getSampleCode
());
mapReplace
.
put
(
"#{siteNo}"
,
firstVO
.
getSiteNo
());
mapReplace
.
put
(
"#{sampleDepth}"
,
firstVO
.
getSampleDepth
());
String
midu
=
mapReplace
.
get
(
"#{密度}"
);
if
(
StringUtils
.
isNotBlank
(
midu
)){
try
{
BigDecimal
bigDecimal
=
new
BigDecimal
(
midu
);
BigDecimal
mul
=
new
BigDecimal
(
"9.81"
);
BigDecimal
rz981
=
bigDecimal
.
multiply
(
mul
);
mapReplace
.
put
(
"#{密度9.81}"
,
rz981
.
toString
());
}
catch
(
Exception
e
){
logger
.
error
(
"密度9.81失败"
+
e
.
getMessage
());
mapReplace
.
put
(
"#{密度9.81}"
,
""
);
}
}
else
{
mapReplace
.
put
(
"#{密度9.81}"
,
""
);
}
HSSFWorkbookUtil
.
replaceModel
(
mapReplace
,
xssfWorkbook
,
xssfSheet
);
}
}
src/main/java/com/patzn/cloud/service/lims/original/SingleMoreOperation.java
0 → 100644
View file @
5e869911
package
com
.
patzn
.
cloud
.
service
.
lims
.
original
;
import
com.patzn.cloud.service.lims.common.HSSFWorkbookUtil
;
import
com.patzn.cloud.service.lims.common.StringHandleUtils
;
import
com.patzn.cloud.service.soil.entity.SoilOriginalTemplate
;
import
com.patzn.cloud.service.soil.entity.SoilOriginalTemplateConfig
;
import
com.patzn.cloud.service.soil.vo.SoilExperimentVO
;
import
com.patzn.cloud.service.soil.vo.SoilItemVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.util.CellRangeAddress
;
import
org.apache.poi.xssf.usermodel.*
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
SingleMoreOperation
implements
Operation
{
private
XSSFWorkbook
xssfWorkbook
;
private
InputStream
io
;
private
Map
<
String
,
String
>
mapReplace
;
private
List
<
SoilOriginalTemplateConfig
>
configList
;
private
SoilOriginalTemplate
template
;
private
List
<
SoilExperimentVO
>
voList
;
private
Map
<
Long
,
List
<
SoilItemVO
>>
sampleSoilItemVOMap
;
public
SingleMoreOperation
(
XSSFWorkbook
xssfWorkbook
,
InputStream
io
,
Map
<
String
,
String
>
mapReplace
,
List
<
SoilOriginalTemplateConfig
>
configList
,
SoilOriginalTemplate
template
,
List
<
SoilExperimentVO
>
voList
,
Map
<
Long
,
List
<
SoilItemVO
>>
sampleSoilItemVOMap
)
{
this
.
xssfWorkbook
=
xssfWorkbook
;
this
.
io
=
io
;
this
.
mapReplace
=
mapReplace
;
this
.
configList
=
configList
;
this
.
template
=
template
;
this
.
voList
=
voList
;
this
.
sampleSoilItemVOMap
=
sampleSoilItemVOMap
;
}
protected
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SingleMoreOperation
.
class
);
public
void
doProductOriginal
(){
HSSFWorkbookUtil
.
replaceModel
(
mapReplace
,
xssfWorkbook
,
0
);
XSSFSheet
sheetOne
=
xssfWorkbook
.
getSheetAt
(
0
);
sheetOne
.
setForceFormulaRecalculation
(
true
);
Integer
beginRow
=
template
.
getSampleBeginRow
();
boolean
teShu
=
"界限含水率 (碟式液限仪多点法)试验记录表"
.
equals
(
template
.
getName
());
if
(
null
==
beginRow
){
return
;
}
if
(
null
==
template
.
getSampleMergerNum
()){
return
;
}
if
(
null
==
template
.
getTemplateSampleNum
()){
return
;
}
int
templateSampleNum
=
template
.
getTemplateSampleNum
();
logger
.
error
(
"----------------------8"
);
int
sampleMergerNum
=
template
.
getSampleMergerNum
();
int
insertRow
=
beginRow
+
sampleMergerNum
*
templateSampleNum
;
logger
.
error
(
"---------------------9"
);
XSSFRow
zeroRow
=
sheetOne
.
getRow
(
beginRow
);
logger
.
error
(
"----------------------10"
);
int
lastCellNum
=
zeroRow
.
getLastCellNum
();
int
insertCount
=
voList
.
size
()-
templateSampleNum
;
for
(
int
m
=
0
;
m
<
insertCount
;
m
++)
{
for
(
int
i
=
0
;
i
<
sampleMergerNum
;
i
++)
{
XSSFRow
row
=
sheetOne
.
createRow
(
insertRow
);
row
.
setHeight
(
zeroRow
.
getHeight
());
for
(
int
j
=
0
;
j
<
lastCellNum
;
j
++)
{
XSSFCellStyle
cellStyle
=
zeroRow
.
getCell
(
j
).
getCellStyle
();
XSSFCell
xssfCell
=
row
.
createCell
(
j
);
xssfCell
.
setCellStyle
(
cellStyle
);
}
insertRow
++;
}
}
int
sn
=
1
;
Map
<
String
,
String
>
siteNoSampleCodeMap
=
new
HashMap
<>();
for
(
SoilExperimentVO
vo:
voList
){
siteNoSampleCodeMap
.
put
(
vo
.
getSiteNo
(),
vo
.
getSampleCode
());
}
for
(
SoilExperimentVO
vo:
voList
)
{
List
<
SoilItemVO
>
soilItemVOS
=
sampleSoilItemVOMap
.
get
(
vo
.
getSampleId
());
XSSFRow
xssfRow
=
sheetOne
.
getRow
(
beginRow
);
for
(
SoilOriginalTemplateConfig
config:
configList
)
{
if
(
null
==
config
.
getColumnPlace
()){
continue
;
}
XSSFCell
cell
=
xssfRow
.
getCell
(
config
.
getColumnPlace
());
if
(
null
!=
config
.
getDataAttribute
()&&
config
.
getDataAttribute
().
contains
(
"for"
)){
String
name
=
config
.
getDataAttribute
().
replace
(
"for"
,
""
);
OriginalUtil
.
doForValue
(
sampleMergerNum
,
sheetOne
,
beginRow
,
config
,
name
,
soilItemVOS
);
continue
;
}
if
(
"sn"
.
equals
(
config
.
getDataAttribute
())){
cell
.
setCellValue
(
sn
);
}
else
{
cell
.
setCellValue
(
HSSFWorkbookUtil
.
getFieldValue
(
config
.
getDataAttribute
(),
vo
,
soilItemVOS
));
}
}
beginRow
+=
sampleMergerNum
;
sn
++;
}
for
(
SoilOriginalTemplateConfig
config:
configList
)
{
if
(
null
==
config
.
getMergeRowNum
()){
config
.
setMergeRowNum
(
1
);
}
if
(
OriginalUtil
.
skipDoExcel
(
config
)){
continue
;
}
Integer
sampleBgMum
=
template
.
getSampleBeginRow
();
Integer
mergeRowNum
=
config
.
getMergeRowNum
();
int
formulaNum
=
template
.
getSampleBeginRow
()+
sampleMergerNum
*
voList
.
size
()-
1
;
for
(
int
i
=
sampleBgMum
;
i
<=
formulaNum
;
i
+=
mergeRowNum
)
{
XSSFRow
row
=
sheetOne
.
getRow
(
i
);
if
(
null
==
row
){
continue
;
}
XSSFCell
cell
=
row
.
getCell
(
config
.
getColumnPlace
());
if
(
null
==
cell
){
continue
;
}
String
formula
=
config
.
getFormula
();
formula
=
formula
.
replace
(
"#{sn}"
,(
i
+
1
)+
""
);
if
(
formula
.
contains
(
"#{sneven1}"
)){
if
(
StringHandleUtils
.
isEven
(
i
)){
formula
=
formula
.
replace
(
"#{sneven1}"
,(
i
+
1
)+
""
);
}
else
{
formula
=
formula
.
replace
(
"#{sneven1}"
,
i
+
""
);
}
}
if
(
formula
.
contains
(
"#{snodd1}"
)){
if
(!
StringHandleUtils
.
isEven
(
i
)){
formula
=
formula
.
replace
(
"#{snodd1}"
,(
i
+
1
)+
""
);
}
else
{
formula
=
formula
.
replace
(
"#{snodd1}"
,
i
+
""
);
}
}
if
(
formula
.
contains
(
"#{sn+1}"
)){
formula
=
formula
.
replace
(
"#{sn+1}"
,(
i
+
2
)+
""
);
}
if
(
formula
.
contains
(
"#{sn+2}"
)){
formula
=
formula
.
replace
(
"#{sn+2}"
,(
i
+
3
)+
""
);
}
if
(
formula
.
contains
(
"#{sn+3}"
)){
formula
=
formula
.
replace
(
"#{sn+3}"
,(
i
+
4
)+
""
);
}
if
(
formula
.
contains
(
"#{sn+4}"
)){
formula
=
formula
.
replace
(
"#{sn+4}"
,(
i
+
5
)+
""
);
}
if
(
formula
.
contains
(
"#{sn+5}"
)){
formula
=
formula
.
replace
(
"#{sn+5}"
,(
i
+
6
)+
""
);
}
if
(
formula
.
contains
(
"#{sn+6}"
)){
formula
=
formula
.
replace
(
"#{sn+6}"
,(
i
+
7
)+
""
);
}
if
(
formula
.
contains
(
"#{sn+7}"
)){
formula
=
formula
.
replace
(
"#{sn+7}"
,(
i
+
8
)+
""
);
}
cell
.
setCellFormula
(
formula
);
}
}
for
(
SoilOriginalTemplateConfig
config:
configList
)
{
if
(
null
==
config
.
getMergeRowNum
()){
config
.
setMergeRowNum
(
1
);
}
if
(
null
==
config
.
getMergeBegin
()){
continue
;
}
if
(
null
==
config
.
getMergeEnd
()){
continue
;
}
int
step
=
config
.
getMergeRowNum
();
if
(
step
==
1
&&
config
.
getMergeEnd
()
==
config
.
getMergeBegin
()){
continue
;
}
if
(
null
==
config
.
getColumnPlace
()){
continue
;
}
if
(
null
==
config
.
getMergeRowNum
()){
continue
;
}
if
(!
teShu
){
Integer
sampleBgMum
=
template
.
getSampleBeginRow
()+
templateSampleNum
*
sampleMergerNum
;
Integer
sampleEnMum
=
template
.
getSampleBeginRow
()+
voList
.
size
()*
sampleMergerNum
-
1
;
while
(
sampleBgMum
<=
sampleEnMum
)
{
sheetOne
.
addMergedRegion
(
new
CellRangeAddress
(
sampleBgMum
,
sampleBgMum
+
step
-
1
,
config
.
getMergeBegin
(),
config
.
getMergeEnd
()));
sampleBgMum
=
sampleBgMum
+
step
;
}
}
else
{
if
(
config
.
getColumnPlace
()
!=
10
&&
config
.
getColumnPlace
()
!=
12
){
Integer
sampleBgMum
=
template
.
getSampleBeginRow
()+
templateSampleNum
*
sampleMergerNum
;
Integer
sampleEnMum
=
template
.
getSampleBeginRow
()+
voList
.
size
()*
sampleMergerNum
-
1
;
while
(
sampleBgMum
<=
sampleEnMum
)
{
sheetOne
.
addMergedRegion
(
new
CellRangeAddress
(
sampleBgMum
,
sampleBgMum
+
step
-
1
,
config
.
getMergeBegin
(),
config
.
getMergeEnd
()));
sampleBgMum
=
sampleBgMum
+
step
;
}
}
else
{
Integer
sampleBgMum
=
template
.
getSampleBeginRow
()+
templateSampleNum
*
sampleMergerNum
;
Integer
sampleEnMum
=
template
.
getSampleBeginRow
()+
voList
.
size
()*
sampleMergerNum
-
1
;
int
indexJishu
=
0
;
while
(
sampleBgMum
<=
sampleEnMum
)
{
if
(
indexJishu
%
2
==
0
){
sheetOne
.
addMergedRegion
(
new
CellRangeAddress
(
sampleBgMum
,
sampleBgMum
+
3
-
1
,
config
.
getMergeBegin
(),
config
.
getMergeEnd
()));
if
(
config
.
getColumnPlace
()==
10
){
XSSFRow
teshuRow
=
sheetOne
.
getRow
(
sampleBgMum
);
if
(
null
!=
teshuRow
){
XSSFCell
teshuCell
=
teshuRow
.
getCell
(
config
.
getColumnPlace
());
XSSFCell
teshuCellSampleCode
=
teshuRow
.
getCell
(
1
);
String
code
=
HSSFWorkbookUtil
.
getJavaValue
(
teshuCellSampleCode
).
toString
();
String
mapCode
=
siteNoSampleCodeMap
.
get
(
code
);
if
(
StringUtils
.
isNotBlank
(
mapCode
)){
teshuCell
.
setCellFormula
(
"'附录"
+
mapCode
+
"'!B11"
);
}
else
{
teshuCell
.
setCellFormula
(
"'附录"
+
code
+
"'!B11"
);
}
}
}
sampleBgMum
=
sampleBgMum
+
3
;
}
else
{
sheetOne
.
addMergedRegion
(
new
CellRangeAddress
(
sampleBgMum
,
sampleBgMum
+
2
-
1
,
config
.
getMergeBegin
(),
config
.
getMergeEnd
()));
if
(
config
.
getColumnPlace
()==
10
){
XSSFRow
teshuRow
=
sheetOne
.
getRow
(
sampleBgMum
);
if
(
null
!=
teshuRow
){
XSSFCell
teshuCell
=
teshuRow
.
getCell
(
config
.
getColumnPlace
());
teshuCell
.
setCellFormula
(
"IF(OR(J"
+(
sampleBgMum
+
1
)+
"=\"\",J"
+(
sampleBgMum
+
2
)+
"=\"\",J"
+(
sampleBgMum
+
1
)+
"=\"/\",J"
+(
sampleBgMum
+
2
)+
"=\"/\"),\"\",(J"
+(
sampleBgMum
+
1
)+
"+J"
+((
sampleBgMum
+
2
))+
")/2)"
);
}
}
sampleBgMum
=
sampleBgMum
+
2
;
}
indexJishu
++;
}
}
}
}
}
}
src/main/resources/mapper/soil/SoilExperimentMapper.xml
View file @
5e869911
...
@@ -431,7 +431,7 @@
...
@@ -431,7 +431,7 @@
<select
id=
"selectByEntrustId"
resultType=
"com.patzn.cloud.service.soil.vo.SoilExperimentVO"
>
<select
id=
"selectByEntrustId"
resultType=
"com.patzn.cloud.service.soil.vo.SoilExperimentVO"
>
SELECT i.id,i.name,s.sample_code,s.site_no FROM soil_experiment i
SELECT i.id,i.name,s.sample_code,s.site_no
, e.entrust_code
FROM soil_experiment i
JOIN soil_sample s ON i.sample_id = s.id
JOIN soil_sample s ON i.sample_id = s.id
JOIN soil_entrust e ON s.entrust_id = e.id
JOIN soil_entrust e ON s.entrust_id = e.id
...
...
src/main/resources/static/Aspose.Total.Product.Family(3).lic
0 → 100644
View file @
5e869911
<?xml version="1.0"?>
<License>
<Data>
<LicensedTo>
evget
</LicensedTo>
<EmailTo>
zouyw@evget.com
</EmailTo>
<LicenseType>
Developer OEM
</LicenseType>
<LicenseNote>
1 Developer And Unlimited Deployment Locations
</LicenseNote>
<OrderID>
201130075911
</OrderID>
<UserID>
826696
</UserID>
<OEM>
This is a redistributable license
</OEM>
<Products>
<Product>
Aspose.Total Product Family
</Product>
</Products>
<EditionType>
Professional
</EditionType>
<SerialNumber>
1deeda7a-1403-46c5-8fbd-ca4c176737f4
</SerialNumber>
<SubscriptionExpiry>
20220325
</SubscriptionExpiry>
<LicenseExpiry>
20210425
</LicenseExpiry>
<ExpiryNote>
This is a temporary license for non-commercial use only and it will expire on 2021-04-25
</ExpiryNote>
<LicenseVersion>
3.0
</LicenseVersion>
<LicenseInstructions>
https://purchase.aspose.com/policies/use-license
</LicenseInstructions>
</Data>
<Signature>
lU2XvPdwtYE3jExkkK87Cf5LgcUzFPUfDIVtkG1LO9S+RqwUdu3BlafVoIXZX+FREJP0RoLuwR12IDiThKPAw5mpC+1L645e7qoKg8JQizwf4P+P5uO8VsHlCJrBo2vrGvJbCXvtiLetA+d5eGRId94cMnOJJw9rb14xH9cjJXM=
</Signature>
</License>
\ No newline at end of file
src/main/resources/static/license.xml
View file @
5e869911
<?xml version="1.0"?>
<License>
<License>
<Data>
<Data>
<LicensedTo>
南京中普安信
</LicensedTo>
<LicensedTo>
evget
</LicensedTo>
<EmailTo>
zhangmengqi@qd-partner
.com
</EmailTo>
<EmailTo>
zouyw@evget
.com
</EmailTo>
<LicenseType>
Developer Small Business
</LicenseType>
<LicenseType>
Developer OEM
</LicenseType>
<LicenseNote>
1 Developer And 1 Deployment Location
</LicenseNote>
<LicenseNote>
1 Developer And Unlimited Deployment Locations
</LicenseNote>
<OrderID>
210401015312
</OrderID>
<OrderID>
201130075911
</OrderID>
<UserID>
879938
</UserID>
<UserID>
826696
</UserID>
<OEM>
This is not
a redistributable license
</OEM>
<OEM>
This is
a redistributable license
</OEM>
<Products>
<Products>
<Product>
Aspose.Cells
Product Family
</Product>
<Product>
Aspose.Total
Product Family
</Product>
</Products>
</Products>
<EditionType>
Professional
</EditionType>
<EditionType>
Professional
</EditionType>
<SerialNumber>
511eb1f9-57ff-4254-bbeb-b9ee82f390cb
</SerialNumber>
<SerialNumber>
1deeda7a-1403-46c5-8fbd-ca4c176737f4
</SerialNumber>
<SubscriptionExpiry>
20220401
</SubscriptionExpiry>
<SubscriptionExpiry>
20220325
</SubscriptionExpiry>
<LicenseExpiry>
20210501
</LicenseExpiry>
<LicenseExpiry>
20210425
</LicenseExpiry>
<ExpiryNote>
This is a temporary license for non-commercial use only and it will expire on 2021-05-01
</ExpiryNote>
<ExpiryNote>
This is a temporary license for non-commercial use only and it will expire on 2021-04-25
</ExpiryNote>
<LicenseVersion>
3.0
</LicenseVersion>
<LicenseVersion>
3.0
</LicenseVersion>
<LicenseInstructions>
https://purchase.aspose.com/policies/use-license
</LicenseInstructions>
<LicenseInstructions>
https://purchase.aspose.com/policies/use-license
</LicenseInstructions>
</Data>
</Data>
<Signature>
gvk7I3r/lKw/n0K5FhxBBvoAgyYZ/HwbguDGsOCzMFvhbYAabwxly9RVncRENZLSMiZ570I+lG/NK9cfq9IRxyS/2mvuM0IKfIX7QVtnzUZof4/bU55/dj1+obPI6j7T8E+oCqo8O1ec/BdAGw05tJ+GlWvvhcaBfJw9C5b4CRU
=
</Signature>
<Signature>
lU2XvPdwtYE3jExkkK87Cf5LgcUzFPUfDIVtkG1LO9S+RqwUdu3BlafVoIXZX+FREJP0RoLuwR12IDiThKPAw5mpC+1L645e7qoKg8JQizwf4P+P5uO8VsHlCJrBo2vrGvJbCXvtiLetA+d5eGRId94cMnOJJw9rb14xH9cjJXM
=
</Signature>
</License>
</License>
\ No newline at end of file
src/main/resources/templates/excel/AttachmentTemplateSZYS.xlsx
View file @
5e869911
No preview for this file type
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