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
759289cd
Commit
759289cd
authored
Apr 20, 2021
by
wangweidong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
土工试验优化
parent
b2ee5275
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
794 additions
and
788 deletions
+794
-788
OriginalUtil.java
...a/com/patzn/cloud/service/lims/original/OriginalUtil.java
+98
-0
SheetMoreMuchOperation.java
...n/cloud/service/lims/original/SheetMoreMuchOperation.java
+1
-1
SheetMoreSingleOperation.java
...cloud/service/lims/original/SheetMoreSingleOperation.java
+1
-1
SingleLessOperation.java
...atzn/cloud/service/lims/original/SingleLessOperation.java
+1
-1
SingleMoreOperation.java
...atzn/cloud/service/lims/original/SingleMoreOperation.java
+11
-72
RpcDecoder.java
...ain/java/com/patzn/cloud/service/lims/rcp/RpcDecoder.java
+0
-36
RpcEncoder.java
...ain/java/com/patzn/cloud/service/lims/rcp/RpcEncoder.java
+0
-33
RpcRequest.java
...ain/java/com/patzn/cloud/service/lims/rcp/RpcRequest.java
+0
-33
RpcResponse.java
...in/java/com/patzn/cloud/service/lims/rcp/RpcResponse.java
+0
-44
Runner.java
src/main/java/com/patzn/cloud/service/lims/rcp/Runner.java
+0
-3
MoreSheetReportOperation.java
...n/cloud/service/lims/report/MoreSheetReportOperation.java
+381
-0
ReportOperation.java
.../com/patzn/cloud/service/lims/report/ReportOperation.java
+5
-0
ReportUtil.java
.../java/com/patzn/cloud/service/lims/report/ReportUtil.java
+88
-0
SingleSheetReportOperation.java
...cloud/service/lims/report/SingleSheetReportOperation.java
+146
-0
ISoilAppendixService.java
...cloud/service/lims/soil/service/ISoilAppendixService.java
+2
-0
ISoilExperimentService.java
...oud/service/lims/soil/service/ISoilExperimentService.java
+2
-0
SoilAppendixServiceImpl.java
...rvice/lims/soil/service/impl/SoilAppendixServiceImpl.java
+5
-0
SoilExperimentServiceImpl.java
...ice/lims/soil/service/impl/SoilExperimentServiceImpl.java
+48
-562
SoilExperimentMapper.xml
src/main/resources/mapper/soil/SoilExperimentMapper.xml
+5
-2
No files found.
src/main/java/com/patzn/cloud/service/lims/original/OriginalUtil.java
View file @
759289cd
package
com
.
patzn
.
cloud
.
service
.
lims
.
original
;
package
com
.
patzn
.
cloud
.
service
.
lims
.
original
;
import
com.patzn.cloud.service.lims.common.HSSFWorkbookUtil
;
import
com.patzn.cloud.service.soil.entity.SoilOriginalTemplate
;
import
com.patzn.cloud.service.soil.entity.SoilOriginalTemplateConfig
;
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
com.patzn.cloud.service.soil.vo.SoilItemVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.util.CellRangeAddress
;
import
org.apache.poi.xssf.usermodel.XSSFCell
;
import
org.apache.poi.xssf.usermodel.XSSFCell
;
import
org.apache.poi.xssf.usermodel.XSSFRow
;
import
org.apache.poi.xssf.usermodel.XSSFRow
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
public
final
class
OriginalUtil
{
public
final
class
OriginalUtil
{
...
@@ -39,4 +44,97 @@ public final class OriginalUtil {
...
@@ -39,4 +44,97 @@ public final class OriginalUtil {
return
false
;
return
false
;
}
}
public
static
boolean
skipMerge
(
SoilOriginalTemplateConfig
config
){
if
(
null
==
config
.
getMergeBegin
()){
return
true
;
}
if
(
null
==
config
.
getMergeEnd
()){
return
true
;
}
if
(
config
.
getMergeRowNum
()==
1
&&
config
.
getMergeEnd
()
==
config
.
getMergeBegin
()){
return
true
;
}
if
(
null
==
config
.
getColumnPlace
()){
return
true
;
}
if
(
null
==
config
.
getMergeRowNum
()){
return
true
;
}
if
(
null
==
config
.
getColumnPlace
()){
return
true
;
}
if
(
null
==
config
.
getMergeRowNum
()){
return
true
;
}
return
false
;
}
public
static
void
mergeExcel
(
XSSFSheet
sheetOne
,
SoilOriginalTemplate
template
,
int
step
,
int
templateSampleNum
,
int
sampleMergerNum
,
List
<
SoilExperimentVO
>
voList
,
SoilOriginalTemplateConfig
config
){
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
;
}
}
public
static
void
mergeSpecialExcel
(
XSSFSheet
sheetOne
,
SoilOriginalTemplate
template
,
int
step
,
Map
<
String
,
String
>
siteNoSampleCodeMap
,
int
templateSampleNum
,
int
sampleMergerNum
,
List
<
SoilExperimentVO
>
voList
,
SoilOriginalTemplateConfig
config
){
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/java/com/patzn/cloud/service/lims/original/SheetMoreMuchOperation.java
View file @
759289cd
...
@@ -49,7 +49,7 @@ public class SheetMoreMuchOperation implements Operation {
...
@@ -49,7 +49,7 @@ public class SheetMoreMuchOperation implements Operation {
this
.
sampleSoilItemVOMap
=
sampleSoilItemVOMap
;
this
.
sampleSoilItemVOMap
=
sampleSoilItemVOMap
;
this
.
entrust
=
entrust
;
this
.
entrust
=
entrust
;
}
}
public
void
doProductOriginal
(){
public
synchronized
void
doProductOriginal
(){
Integer
templateSampleNum
=
template
.
getTemplateSampleNum
();
Integer
templateSampleNum
=
template
.
getTemplateSampleNum
();
List
<
List
<
SoilExperimentVO
>>
relList
=
ListUtils
.
partition
(
voList
,
templateSampleNum
);
List
<
List
<
SoilExperimentVO
>>
relList
=
ListUtils
.
partition
(
voList
,
templateSampleNum
);
int
templateSheetMum
=
xssfWorkbook
.
getNumberOfSheets
();
int
templateSheetMum
=
xssfWorkbook
.
getNumberOfSheets
();
...
...
src/main/java/com/patzn/cloud/service/lims/original/SheetMoreSingleOperation.java
View file @
759289cd
...
@@ -44,7 +44,7 @@ public class SheetMoreSingleOperation implements Operation {
...
@@ -44,7 +44,7 @@ public class SheetMoreSingleOperation implements Operation {
this
.
voList
=
voList
;
this
.
voList
=
voList
;
this
.
sampleSoilItemVOMap
=
sampleSoilItemVOMap
;
this
.
sampleSoilItemVOMap
=
sampleSoilItemVOMap
;
}
}
public
void
doProductOriginal
(){
public
synchronized
void
doProductOriginal
(){
XSSFSheet
xssfSheet
=
xssfWorkbook
.
getSheetAt
(
0
);
XSSFSheet
xssfSheet
=
xssfWorkbook
.
getSheetAt
(
0
);
xssfSheet
.
setForceFormulaRecalculation
(
true
);
xssfSheet
.
setForceFormulaRecalculation
(
true
);
int
index
=
0
;
int
index
=
0
;
...
...
src/main/java/com/patzn/cloud/service/lims/original/SingleLessOperation.java
View file @
759289cd
...
@@ -40,7 +40,7 @@ public class SingleLessOperation implements Operation {
...
@@ -40,7 +40,7 @@ public class SingleLessOperation implements Operation {
public
void
doProductOriginal
(){
public
synchronized
void
doProductOriginal
(){
HSSFWorkbookUtil
.
replaceModel
(
mapReplace
,
xssfWorkbook
,
0
);
HSSFWorkbookUtil
.
replaceModel
(
mapReplace
,
xssfWorkbook
,
0
);
XSSFSheet
sheetOne
=
xssfWorkbook
.
getSheetAt
(
0
);
XSSFSheet
sheetOne
=
xssfWorkbook
.
getSheetAt
(
0
);
sheetOne
.
setForceFormulaRecalculation
(
true
);
sheetOne
.
setForceFormulaRecalculation
(
true
);
...
...
src/main/java/com/patzn/cloud/service/lims/original/SingleMoreOperation.java
View file @
759289cd
...
@@ -41,7 +41,7 @@ public class SingleMoreOperation implements Operation{
...
@@ -41,7 +41,7 @@ public class SingleMoreOperation implements Operation{
protected
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SingleMoreOperation
.
class
);
protected
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SingleMoreOperation
.
class
);
public
void
doProductOriginal
(){
public
synchronized
void
doProductOriginal
(){
HSSFWorkbookUtil
.
replaceModel
(
mapReplace
,
xssfWorkbook
,
0
);
HSSFWorkbookUtil
.
replaceModel
(
mapReplace
,
xssfWorkbook
,
0
);
XSSFSheet
sheetOne
=
xssfWorkbook
.
getSheetAt
(
0
);
XSSFSheet
sheetOne
=
xssfWorkbook
.
getSheetAt
(
0
);
sheetOne
.
setForceFormulaRecalculation
(
true
);
sheetOne
.
setForceFormulaRecalculation
(
true
);
...
@@ -72,8 +72,15 @@ public class SingleMoreOperation implements Operation{
...
@@ -72,8 +72,15 @@ public class SingleMoreOperation implements Operation{
int
insertCount
=
voList
.
size
()-
templateSampleNum
;
int
insertCount
=
voList
.
size
()-
templateSampleNum
;
for
(
int
m
=
0
;
m
<
insertCount
;
m
++)
{
for
(
int
m
=
0
;
m
<
insertCount
;
m
++)
{
for
(
int
i
=
0
;
i
<
sampleMergerNum
;
i
++)
{
for
(
int
i
=
0
;
i
<
sampleMergerNum
;
i
++)
{
try
{
sheetOne
.
shiftRows
(
insertRow
,
sheetOne
.
getLastRowNum
(),
1
,
true
,
false
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
XSSFRow
row
=
sheetOne
.
createRow
(
insertRow
);
XSSFRow
row
=
sheetOne
.
createRow
(
insertRow
);
row
.
setHeight
(
zeroRow
.
getHeight
());
row
.
setHeight
(
zeroRow
.
getHeight
());
for
(
int
j
=
0
;
j
<
lastCellNum
;
j
++)
{
for
(
int
j
=
0
;
j
<
lastCellNum
;
j
++)
{
XSSFCellStyle
cellStyle
=
zeroRow
.
getCell
(
j
).
getCellStyle
();
XSSFCellStyle
cellStyle
=
zeroRow
.
getCell
(
j
).
getCellStyle
();
XSSFCell
xssfCell
=
row
.
createCell
(
j
);
XSSFCell
xssfCell
=
row
.
createCell
(
j
);
...
@@ -115,7 +122,6 @@ public class SingleMoreOperation implements Operation{
...
@@ -115,7 +122,6 @@ public class SingleMoreOperation implements Operation{
}
}
beginRow
+=
sampleMergerNum
;
beginRow
+=
sampleMergerNum
;
sn
++;
sn
++;
}
}
for
(
SoilOriginalTemplateConfig
config:
configList
)
{
for
(
SoilOriginalTemplateConfig
config:
configList
)
{
if
(
null
==
config
.
getMergeRowNum
()){
if
(
null
==
config
.
getMergeRowNum
()){
...
@@ -186,83 +192,16 @@ public class SingleMoreOperation implements Operation{
...
@@ -186,83 +192,16 @@ public class SingleMoreOperation implements Operation{
if
(
null
==
config
.
getMergeRowNum
()){
if
(
null
==
config
.
getMergeRowNum
()){
config
.
setMergeRowNum
(
1
);
config
.
setMergeRowNum
(
1
);
}
}
if
(
null
==
config
.
getMergeBegin
()){
if
(
OriginalUtil
.
skipMerge
(
config
)){
continue
;
}
if
(
null
==
config
.
getMergeEnd
()){
continue
;
continue
;
}
}
int
step
=
config
.
getMergeRowNum
();
int
step
=
config
.
getMergeRowNum
();
if
(
step
==
1
&&
config
.
getMergeEnd
()
==
config
.
getMergeBegin
()){
continue
;
}
if
(
null
==
config
.
getColumnPlace
()){
continue
;
}
if
(
null
==
config
.
getMergeRowNum
()){
continue
;
}
if
(!
teShu
){
if
(!
teShu
){
Integer
sampleBgMum
=
template
.
getSampleBeginRow
()+
templateSampleNum
*
sampleMergerNum
;
OriginalUtil
.
mergeExcel
(
sheetOne
,
template
,
step
,
templateSampleNum
,
sampleMergerNum
,
voList
,
config
);
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
{
}
else
{
if
(
config
.
getColumnPlace
()
!=
10
&&
config
.
getColumnPlace
()
!=
12
){
OriginalUtil
.
mergeSpecialExcel
(
sheetOne
,
template
,
step
,
siteNoSampleCodeMap
,
templateSampleNum
,
sampleMergerNum
,
voList
,
config
);
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/java/com/patzn/cloud/service/lims/rcp/RpcDecoder.java
deleted
100644 → 0
View file @
b2ee5275
package
com
.
patzn
.
cloud
.
service
.
lims
.
rcp
;
import
com.alibaba.fastjson.JSON
;
import
io.netty.buffer.ByteBuf
;
import
io.netty.channel.ChannelHandlerContext
;
import
io.netty.handler.codec.ByteToMessageDecoder
;
import
java.util.List
;
public
class
RpcDecoder
extends
ByteToMessageDecoder
{
//目标对象类型进行解码
private
Class
<?>
target
;
public
RpcDecoder
(
Class
target
)
{
this
.
target
=
target
;
}
@Override
protected
void
decode
(
ChannelHandlerContext
ctx
,
ByteBuf
in
,
List
<
Object
>
out
)
throws
Exception
{
if
(
in
.
readableBytes
()
<
4
)
{
//不够长度丢弃
return
;
}
in
.
markReaderIndex
();
//标记一下当前的readIndex的位置
int
dataLength
=
in
.
readInt
();
// 读取传送过来的消息的长度。ByteBuf 的readInt()方法会让他的readIndex增加4
if
(
in
.
readableBytes
()
<
dataLength
)
{
//读到的消息体长度如果小于我们传送过来的消息长度,则resetReaderIndex. 这个配合markReaderIndex使用的。把readIndex重置到mark的地方
in
.
resetReaderIndex
();
return
;
}
byte
[]
data
=
new
byte
[
dataLength
];
in
.
readBytes
(
data
);
Object
obj
=
JSON
.
parseObject
(
data
,
target
);
//将byte数据转化为我们需要的对象
out
.
add
(
obj
);
}
}
src/main/java/com/patzn/cloud/service/lims/rcp/RpcEncoder.java
deleted
100644 → 0
View file @
b2ee5275
package
com
.
patzn
.
cloud
.
service
.
lims
.
rcp
;
/*
* @author uv
* @date 2018/10/13 18:09
* 编码器(将实体类转换成可传输的数据)
*/
import
com.alibaba.fastjson.JSON
;
import
io.netty.buffer.ByteBuf
;
import
io.netty.channel.ChannelHandlerContext
;
import
io.netty.handler.codec.MessageToByteEncoder
;
public
class
RpcEncoder
extends
MessageToByteEncoder
{
//目标对象类型进行编码
private
Class
<?>
target
;
public
RpcEncoder
(
Class
target
)
{
this
.
target
=
target
;
}
@Override
protected
void
encode
(
ChannelHandlerContext
ctx
,
Object
msg
,
ByteBuf
out
)
throws
Exception
{
if
(
target
.
isInstance
(
msg
))
{
byte
[]
data
=
JSON
.
toJSONBytes
(
msg
);
//使用fastJson将对象转换为byte
out
.
writeInt
(
data
.
length
);
//先将消息长度写入,也就是消息头
out
.
writeBytes
(
data
);
//消息体中包含我们要发送的数据
}
}
}
\ No newline at end of file
src/main/java/com/patzn/cloud/service/lims/rcp/RpcRequest.java
deleted
100644 → 0
View file @
b2ee5275
package
com
.
patzn
.
cloud
.
service
.
lims
.
rcp
;
/*
* @author uv
* @date 2018/10/13 18:10
* 传输请求对象
*/
public
class
RpcRequest
{
private
String
id
;
private
Object
data
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
Object
getData
()
{
return
data
;
}
public
void
setData
(
Object
data
)
{
this
.
data
=
data
;
}
@Override
public
String
toString
()
{
return
"RpcRequest{"
+
"id='"
+
id
+
'\''
+
", data="
+
data
+
'}'
;
}
}
src/main/java/com/patzn/cloud/service/lims/rcp/RpcResponse.java
deleted
100644 → 0
View file @
b2ee5275
package
com
.
patzn
.
cloud
.
service
.
lims
.
rcp
;
/*
* @author uv
* @date 2018/10/13 18:10
* 传输响应对象
*/
public
class
RpcResponse
{
private
String
id
;
private
Object
data
;
// 0=success -1=fail
private
int
status
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
Object
getData
()
{
return
data
;
}
public
void
setData
(
Object
data
)
{
this
.
data
=
data
;
}
public
int
getStatus
()
{
return
status
;
}
public
void
setStatus
(
int
status
)
{
this
.
status
=
status
;
}
@Override
public
String
toString
()
{
return
"RpcResponse{"
+
"id='"
+
id
+
'\''
+
", data="
+
data
+
", status="
+
status
+
'}'
;
}
}
src/main/java/com/patzn/cloud/service/lims/rcp/Runner.java
View file @
759289cd
package
com
.
patzn
.
cloud
.
service
.
lims
.
rcp
;
package
com
.
patzn
.
cloud
.
service
.
lims
.
rcp
;
import
com.patzn.cloud.service.lims.socket.SocketProperties
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.InitializingBean
;
...
@@ -13,8 +12,6 @@ import java.util.concurrent.ExecutorService;
...
@@ -13,8 +12,6 @@ import java.util.concurrent.ExecutorService;
public
class
Runner
implements
InitializingBean
{
public
class
Runner
implements
InitializingBean
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Runner
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Runner
.
class
);
@Autowired
@Autowired
private
SocketProperties
properties
;
@Autowired
@Qualifier
(
value
=
"crawlExecutorPool"
)
@Qualifier
(
value
=
"crawlExecutorPool"
)
private
ExecutorService
pool
;
private
ExecutorService
pool
;
...
...
src/main/java/com/patzn/cloud/service/lims/report/MoreSheetReportOperation.java
0 → 100644
View file @
759289cd
package
com
.
patzn
.
cloud
.
service
.
lims
.
report
;
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.original.SheetMoreMuchOperation
;
import
com.patzn.cloud.service.soil.entity.SoilEntrust
;
import
com.patzn.cloud.service.soil.entity.SoilExpReportTemplate
;
import
com.patzn.cloud.service.soil.vo.SoilExperimentVO
;
import
com.patzn.cloud.service.soil.vo.SoilItemVO
;
import
org.apache.commons.collections4.ListUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.usermodel.PrintSetup
;
import
org.apache.poi.xssf.usermodel.*
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
MoreSheetReportOperation
implements
ReportOperation
{
protected
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SheetMoreMuchOperation
.
class
);
private
Map
<
String
,
String
>
mapReplace
;
private
XSSFWorkbook
xssfWorkbook
;
private
XSSFSheet
sheetOne
;
private
SoilExpReportTemplate
template
;
private
List
<
SoilExperimentVO
>
voList
;
private
SoilEntrust
entrust
;
private
List
<
SoilItemVO
>
soilItemVOList
;
public
MoreSheetReportOperation
(
Map
<
String
,
String
>
mapReplace
,
XSSFWorkbook
xssfWorkbook
,
XSSFSheet
sheetOne
,
SoilExpReportTemplate
template
,
List
<
SoilExperimentVO
>
voList
,
SoilEntrust
entrust
,
List
<
SoilItemVO
>
soilItemVOList
)
{
this
.
mapReplace
=
mapReplace
;
this
.
xssfWorkbook
=
xssfWorkbook
;
this
.
sheetOne
=
sheetOne
;
this
.
template
=
template
;
this
.
voList
=
voList
;
this
.
entrust
=
entrust
;
this
.
soilItemVOList
=
soilItemVOList
;
}
@Override
public
synchronized
void
doMakeReport
()
{
Integer
templateSampleNum
=
template
.
getTemplateSampleNum
();
Map
<
Long
,
List
<
SoilItemVO
>>
sampleSoilItemVOMap
=
new
HashMap
<>();
for
(
SoilItemVO
soilItemVO:
soilItemVOList
)
{
if
(
sampleSoilItemVOMap
.
containsKey
(
soilItemVO
.
getSampleId
())){
List
<
SoilItemVO
>
sampleItems
=
sampleSoilItemVOMap
.
get
(
soilItemVO
.
getSampleId
());
sampleItems
.
add
(
soilItemVO
);
sampleSoilItemVOMap
.
put
(
soilItemVO
.
getSampleId
(),
sampleItems
);
}
else
{
List
<
SoilItemVO
>
sampleItems
=
new
ArrayList
<>();
sampleItems
.
add
(
soilItemVO
);
sampleSoilItemVOMap
.
put
(
soilItemVO
.
getSampleId
(),
sampleItems
);
}
}
if
(
null
==
templateSampleNum
||
1
==
templateSampleNum
){
XSSFSheet
xssfSheet
=
xssfWorkbook
.
getSheetAt
(
0
);
xssfSheet
.
setForceFormulaRecalculation
(
true
);
int
index
=
0
;
SoilExperimentVO
firstVO
=
null
;
int
sheetNum
=
xssfWorkbook
.
getNumberOfSheets
();
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
);
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
());
HSSFWorkbookUtil
.
replaceModel
(
mapReplace
,
xssfWorkbook
,
sheet
);
nextSample
++;
}
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
());
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
);
}
else
{
List
<
List
<
SoilExperimentVO
>>
relList
=
ListUtils
.
partition
(
voList
,
templateSampleNum
);
int
templateSheetMum
=
xssfWorkbook
.
getNumberOfSheets
();
XSSFSheet
sheetMy
=
xssfWorkbook
.
getSheetAt
(
0
);
boolean
first
=
true
;
List
<
SoilExperimentVO
>
firstList
=
null
;
PrintSetup
printSetup
=
sheetMy
.
getPrintSetup
();
boolean
printRound
=
printSetup
.
getLandscape
();
for
(
List
<
SoilExperimentVO
>
expVOList:
relList
)
{
XSSFSheet
sheet
=
null
;
if
(
first
){
sheet
=
sheetMy
;
firstList
=
expVOList
;
first
=
false
;
continue
;
}
else
{
sheet
=
xssfWorkbook
.
cloneSheet
(
0
,
sheetMy
.
getSheetName
()+(
templateSheetMum
));
sheet
.
getPrintSetup
().
setLandscape
(
printRound
);
}
Map
<
String
,
String
>
mapReplaceMy
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
templateSampleNum
;
i
++)
{
mapReplaceMy
.
put
(
"#{sampleCode"
+
i
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{sampleDepth"
+
i
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{siteNo"
+
i
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{含水率"
+
i
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81"
+
i
+
"}"
,
""
);
}
mapReplaceMy
.
put
(
"#{projectName}"
,
entrust
.
getProjectName
());
mapReplaceMy
.
put
(
"#{client}"
,
entrust
.
getClient
());
mapReplaceMy
.
put
(
"#{boreholeName}"
,
entrust
.
getBoreholeName
());
mapReplaceMy
.
put
(
"#{projectNo}"
,
entrust
.
getProjectNo
());
int
entitySize
=
expVOList
.
size
();
for
(
int
j
=
0
;
j
<
entitySize
;
j
++)
{
SoilExperimentVO
vo
=
expVOList
.
get
(
j
);
mapReplaceMy
.
put
(
"#{sampleCode"
+
j
+
"}"
,
StringHandleUtils
.
getString
(
vo
.
getSampleCode
()));
mapReplaceMy
.
put
(
"#{sampleDepth"
+
j
+
"}"
,
StringHandleUtils
.
getString
(
vo
.
getSampleDepth
()));
mapReplaceMy
.
put
(
"#{siteNo"
+
j
+
"}"
,
StringHandleUtils
.
getString
(
vo
.
getSiteNo
()));
List
<
SoilItemVO
>
itemVOList
=
sampleSoilItemVOMap
.
get
(
vo
.
getSampleId
());
if
(
CollectionUtils
.
isNotEmpty
(
itemVOList
)){
for
(
SoilItemVO
itemVO:
itemVOList
)
{
mapReplaceMy
.
put
(
"#{"
+
itemVO
.
getName
()+
"}"
,
itemVO
.
getTestValue
());
}
}
if
(!
mapReplaceMy
.
containsKey
(
"#{含水率}"
)){
mapReplaceMy
.
put
(
"#{含水率}"
,
""
);
mapReplaceMy
.
put
(
"#{含水率"
+
j
+
"}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{液限}"
)){
mapReplaceMy
.
put
(
"#{液限}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{塑限}"
)){
mapReplaceMy
.
put
(
"#{塑限}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{比重}"
)){
mapReplaceMy
.
put
(
"#{比重}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{密度}"
)){
mapReplaceMy
.
put
(
"#{密度}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{容重}"
)){
mapReplaceMy
.
put
(
"#{容重}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81}"
,
""
);
mapReplaceMy
.
put
(
"#{容重"
+
j
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81"
+
j
+
"}"
,
""
);
}
else
{
String
rongzhong
=
mapReplace
.
get
(
"#{容重}"
);
if
(
StringUtils
.
isBlank
(
rongzhong
)){
mapReplaceMy
.
put
(
"#{容重9.81}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81"
+
j
+
"}"
,
""
);
}
else
{
if
(
StringHandleUtils
.
validateNumber
(
rongzhong
)){
BigDecimal
rong
=
new
BigDecimal
(
rongzhong
);
BigDecimal
chengshu
=
new
BigDecimal
(
"9.81"
);
BigDecimal
ji
=
rong
.
multiply
(
chengshu
);
mapReplaceMy
.
put
(
"#{容重9.81}"
,
ji
.
toString
());
mapReplaceMy
.
put
(
"#{容重9.81"
+
j
+
"}"
,
ji
.
toString
());
}
else
{
mapReplaceMy
.
put
(
"#{容重9.81}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81"
+
j
+
"}"
,
""
);
}
}
}
}
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
(
mapReplaceMy
,
xssfWorkbook
,
sheet
);
templateSheetMum
++;
}
int
firstSize
=
firstList
.
size
();
Map
<
String
,
String
>
mapReplaceMy
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
templateSampleNum
;
i
++)
{
mapReplaceMy
.
put
(
"#{sampleCode"
+
i
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{sampleDepth"
+
i
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{含水率"
+
i
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81"
+
i
+
"}"
,
""
);
}
mapReplaceMy
.
put
(
"#{projectName}"
,
entrust
.
getProjectName
());
mapReplaceMy
.
put
(
"#{client}"
,
entrust
.
getClient
());
mapReplaceMy
.
put
(
"#{boreholeName}"
,
entrust
.
getBoreholeName
());
mapReplaceMy
.
put
(
"#{projectNo}"
,
entrust
.
getProjectNo
());
for
(
int
j
=
0
;
j
<
firstSize
;
j
++)
{
SoilExperimentVO
vo
=
firstList
.
get
(
j
);
mapReplaceMy
.
put
(
"#{sampleCode"
+
j
+
"}"
,
StringHandleUtils
.
getString
(
vo
.
getSampleCode
()));
mapReplaceMy
.
put
(
"#{sampleDepth"
+
j
+
"}"
,
StringHandleUtils
.
getString
(
vo
.
getSampleDepth
()));
List
<
SoilItemVO
>
itemVOList
=
sampleSoilItemVOMap
.
get
(
vo
.
getSampleId
());
if
(
CollectionUtils
.
isNotEmpty
(
itemVOList
)){
for
(
SoilItemVO
itemVO:
itemVOList
)
{
mapReplaceMy
.
put
(
"#{"
+
itemVO
.
getName
()+
"}"
,
itemVO
.
getTestValue
());
}
}
if
(!
mapReplaceMy
.
containsKey
(
"#{含水率}"
)){
mapReplaceMy
.
put
(
"#{含水率}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{液限}"
)){
mapReplaceMy
.
put
(
"#{液限}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{塑限}"
)){
mapReplaceMy
.
put
(
"#{塑限}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{比重}"
)){
mapReplaceMy
.
put
(
"#{比重}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{密度}"
)){
mapReplaceMy
.
put
(
"#{密度}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{含水率}"
)){
mapReplaceMy
.
put
(
"#{含水率"
+
j
+
"}"
,
""
);
}
else
{
mapReplaceMy
.
put
(
"#{含水率"
+
j
+
"}"
,
mapReplaceMy
.
get
(
"#{含水率}"
));
}
if
(!
mapReplaceMy
.
containsKey
(
"#{容重}"
)){
mapReplaceMy
.
put
(
"#{容重}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81}"
,
""
);
mapReplaceMy
.
put
(
"#{容重"
+
j
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81"
+
j
+
"}"
,
""
);
}
else
{
String
rongzhong
=
mapReplace
.
get
(
"#{容重}"
);
if
(
StringUtils
.
isBlank
(
rongzhong
)){
mapReplaceMy
.
put
(
"#{容重9.81}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81"
+
j
+
"}"
,
""
);
}
else
{
if
(
StringHandleUtils
.
validateNumber
(
rongzhong
)){
BigDecimal
rong
=
new
BigDecimal
(
rongzhong
);
BigDecimal
chengshu
=
new
BigDecimal
(
"9.81"
);
BigDecimal
ji
=
rong
.
multiply
(
chengshu
);
mapReplaceMy
.
put
(
"#{容重9.81}"
,
ji
.
toString
());
mapReplaceMy
.
put
(
"#{容重9.81"
+
j
+
"}"
,
ji
.
toString
());
}
else
{
mapReplaceMy
.
put
(
"#{容重9.81}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81"
+
j
+
"}"
,
""
);
}
}
}
}
HSSFWorkbookUtil
.
replaceModel
(
mapReplaceMy
,
xssfWorkbook
,
sheetMy
);
}
}
}
src/main/java/com/patzn/cloud/service/lims/report/ReportOperation.java
0 → 100644
View file @
759289cd
package
com
.
patzn
.
cloud
.
service
.
lims
.
report
;
public
interface
ReportOperation
{
void
doMakeReport
();
}
src/main/java/com/patzn/cloud/service/lims/report/ReportUtil.java
0 → 100644
View file @
759289cd
package
com
.
patzn
.
cloud
.
service
.
lims
.
report
;
import
com.baomidou.mybatisplus.toolkit.CollectionUtils
;
import
com.patzn.cloud.service.lims.common.StringHandleUtils
;
import
com.patzn.cloud.service.soil.entity.SoilAppendix
;
import
com.patzn.cloud.service.soil.entity.SoilItem
;
import
com.patzn.cloud.service.soil.vo.SoilExperimentVO
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.xssf.usermodel.XSSFCell
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
final
class
ReportUtil
{
public
static
void
initChongSu
(
List
<
SoilExperimentVO
>
voList
,
List
<
SoilItem
>
soilItemList
){
Map
<
String
,
Integer
>
checkChongSuMap
=
new
HashMap
<>();
for
(
SoilExperimentVO
vo
:
voList
)
{
String
name
=
vo
.
getName
().
replace
(
"-重塑"
,
""
)+
vo
.
getSampleCode
();
if
(
checkChongSuMap
.
containsKey
(
name
)){
Integer
num
=
checkChongSuMap
.
get
(
name
);
num
=
num
+
1
;
checkChongSuMap
.
put
(
name
,
num
);
}
else
{
checkChongSuMap
.
put
(
name
,
1
);
}
}
List
<
SoilExperimentVO
>
newVOList
=
new
ArrayList
<>();
Map
<
String
,
SoilExperimentVO
>
newChongSuMap
=
new
HashMap
<>();
for
(
SoilExperimentVO
vo:
voList
)
{
String
name
=
vo
.
getName
().
replace
(
"-重塑"
,
""
)+
vo
.
getSampleCode
();
if
(!
vo
.
getName
().
contains
(
"重塑"
)){
newVOList
.
add
(
vo
);
}
else
{
Integer
num
=
checkChongSuMap
.
get
(
name
);
if
(
null
==
num
||
num
==
1
)
{
newVOList
.
add
(
vo
);
}
newChongSuMap
.
put
(
vo
.
getName
()+
vo
.
getSampleCode
(),
vo
);
}
}
voList
=
newVOList
;
List
<
SoilItem
>
saveNewItemList
=
new
ArrayList
<>();
for
(
SoilExperimentVO
vo:
voList
)
{
SoilExperimentVO
chongSu
=
newChongSuMap
.
get
(
vo
.
getName
()+
"-重塑"
+
vo
.
getSampleCode
());
if
(
null
!=
chongSu
){
for
(
SoilItem
item
:
soilItemList
)
{
if
(
item
.
getExperimentId
().
equals
(
chongSu
.
getId
())){
SoilItem
soilItem
=
item
.
convert
(
SoilItem
.
class
);
soilItem
.
setExperimentId
(
vo
.
getId
());
saveNewItemList
.
add
(
soilItem
);
}
}
}
}
for
(
SoilItem
item
:
saveNewItemList
)
{
soilItemList
.
add
(
item
);
}
}
public
static
void
setExcellCellValue
(
String
prepory
,
SoilExperimentVO
vo
,
XSSFCell
cell
,
List
<
SoilItem
>
itemList
){
if
(
StringUtils
.
isNotBlank
(
prepory
)){
if
(
prepory
.
equals
(
"{appendix}"
)){
SoilAppendix
soilAppendix
=
vo
.
getSoilAppendix
();
if
(
null
!=
soilAppendix
){
cell
.
setCellValue
(
"见附录"
);
}
}
else
{
if
(
StringHandleUtils
.
is_alpha
(
prepory
)){
cell
.
setCellValue
(
StringHandleUtils
.
getFieldIfNummReturnBlankValueByFieldName
(
prepory
,
vo
));
}
else
{
if
(
CollectionUtils
.
isNotEmpty
(
itemList
)){
for
(
SoilItem
item:
itemList
)
{
if
(
prepory
.
equals
(
item
.
getName
())){
cell
.
setCellValue
(
item
.
getTestValue
());
break
;
}
}
}
}
}
}
}
}
src/main/java/com/patzn/cloud/service/lims/report/SingleSheetReportOperation.java
0 → 100644
View file @
759289cd
package
com
.
patzn
.
cloud
.
service
.
lims
.
report
;
import
com.baomidou.mybatisplus.mapper.Condition
;
import
com.patzn.cloud.commons.api.RestAssert
;
import
com.patzn.cloud.service.lims.common.HSSFWorkbookUtil
;
import
com.patzn.cloud.service.lims.original.SheetMoreMuchOperation
;
import
com.patzn.cloud.service.soil.entity.SoilExpReportTemplate
;
import
com.patzn.cloud.service.soil.entity.SoilExpReportTemplateConfig
;
import
com.patzn.cloud.service.soil.entity.SoilItem
;
import
com.patzn.cloud.service.soil.vo.SoilExperimentVO
;
import
org.apache.poi.ss.util.CellRangeAddress
;
import
org.apache.poi.xssf.usermodel.*
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
public
class
SingleSheetReportOperation
implements
ReportOperation
{
protected
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SheetMoreMuchOperation
.
class
);
private
Map
<
String
,
String
>
mapReplace
;
private
XSSFWorkbook
xssfWorkbook
;
private
XSSFSheet
sheetOne
;
private
SoilExpReportTemplate
template
;
private
List
<
SoilExpReportTemplateConfig
>
configList
;
private
List
<
SoilExperimentVO
>
voList
;
private
Map
<
Long
,
List
<
SoilItem
>>
expItemMap
;
public
SingleSheetReportOperation
(
Map
<
String
,
String
>
mapReplace
,
XSSFWorkbook
xssfWorkbook
,
XSSFSheet
sheetOne
,
SoilExpReportTemplate
template
,
List
<
SoilExpReportTemplateConfig
>
configList
,
List
<
SoilExperimentVO
>
voList
,
Map
<
Long
,
List
<
SoilItem
>>
expItemMap
)
{
this
.
mapReplace
=
mapReplace
;
this
.
xssfWorkbook
=
xssfWorkbook
;
this
.
sheetOne
=
sheetOne
;
this
.
template
=
template
;
this
.
configList
=
configList
;
this
.
voList
=
voList
;
this
.
expItemMap
=
expItemMap
;
}
@Override
public
synchronized
void
doMakeReport
()
{
HSSFWorkbookUtil
.
replaceModel
(
mapReplace
,
xssfWorkbook
,
0
);
sheetOne
.
setForceFormulaRecalculation
(
true
);
Integer
beginRow
=
template
.
getSampleBeginRow
();
Integer
sampleMergerNumOri
=
template
.
getSampleMergerNum
();
RestAssert
.
fail
(
null
==
template
.
getTemplateSampleNum
(),
"模板样品数不能为空"
);
int
templateSampleNum
=
template
.
getTemplateSampleNum
();
if
(
null
!=
beginRow
&&
null
!=
sampleMergerNumOri
&&
null
!=
template
.
getTemplateSampleNum
()){
if
(
voList
.
size
()<
templateSampleNum
){
int
sampleMergerNum
=
sampleMergerNumOri
;
for
(
SoilExperimentVO
vo:
voList
)
{
List
<
SoilItem
>
itemList
=
expItemMap
.
get
(
vo
.
getId
());
if
(
null
==
itemList
){
itemList
=
new
ArrayList
<>();
}
XSSFRow
xssfRow
=
sheetOne
.
getRow
(
beginRow
);
for
(
SoilExpReportTemplateConfig
config:
configList
)
{
if
(
"sn"
.
equals
(
config
.
getDataAttribute
())){
continue
;
}
ReportUtil
.
setExcellCellValue
(
config
.
getDataAttribute
(),
vo
,
xssfRow
.
getCell
(
config
.
getColumnPlace
()),
itemList
);
}
beginRow
+=
sampleMergerNum
;
}
}
else
{
int
sampleMergerNum
=
sampleMergerNumOri
;
int
insertRow
=
beginRow
+
sampleMergerNum
*
templateSampleNum
;
XSSFRow
zeroRow
=
sheetOne
.
getRow
(
beginRow
);
int
lastCellNum
=
zeroRow
.
getLastCellNum
();
int
insertCount
=
voList
.
size
()-
templateSampleNum
;
for
(
int
m
=
0
;
m
<
insertCount
;
m
++)
{
for
(
int
i
=
0
;
i
<
sampleMergerNum
;
i
++)
{
sheetOne
.
shiftRows
(
insertRow
,
sheetOne
.
getLastRowNum
(),
1
,
true
,
false
);
XSSFRow
row
=
sheetOne
.
createRow
(
insertRow
);
row
.
setHeight
(
zeroRow
.
getHeight
());
for
(
int
j
=
0
;
j
<
lastCellNum
;
j
++)
{
XSSFCell
xssfCell
=
row
.
createCell
(
j
);
XSSFCellStyle
cellStyle
=
zeroRow
.
getCell
(
j
).
getCellStyle
();
xssfCell
.
setCellStyle
(
cellStyle
);
xssfCell
.
setCellValue
(
"/"
);
}
insertRow
++;
}
}
int
sn
=
1
;
for
(
SoilExperimentVO
vo:
voList
)
{
XSSFRow
xssfRow
=
sheetOne
.
getRow
(
beginRow
);
List
<
SoilItem
>
itemList
=
expItemMap
.
get
(
vo
.
getId
());
if
(
null
==
itemList
){
itemList
=
new
ArrayList
<>();
}
for
(
SoilExpReportTemplateConfig
config:
configList
)
{
if
(
null
==
config
.
getColumnPlace
()){
continue
;
}
XSSFCell
cell
=
xssfRow
.
getCell
(
config
.
getColumnPlace
());
if
(
"sn"
.
equals
(
config
.
getDataAttribute
())){
cell
.
setCellValue
(
sn
);
continue
;
}
ReportUtil
.
setExcellCellValue
(
config
.
getDataAttribute
(),
vo
,
cell
,
itemList
);
}
beginRow
+=
sampleMergerNum
;
sn
++;
}
for
(
SoilExpReportTemplateConfig
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
()
&&
null
!=
config
.
getMergeRowNum
()){
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
;
}
}
}
logger
.
error
(
"----------------------15"
);
}
}
}
}
src/main/java/com/patzn/cloud/service/lims/soil/service/ISoilAppendixService.java
View file @
759289cd
...
@@ -24,4 +24,6 @@ public interface ISoilAppendixService extends IBaseService<SoilAppendix> {
...
@@ -24,4 +24,6 @@ public interface ISoilAppendixService extends IBaseService<SoilAppendix> {
SoilAppendix
getByExpId
(
Long
expId
);
SoilAppendix
getByExpId
(
Long
expId
);
void
downloadFile
(
Long
id
,
HttpServletResponse
response
);
void
downloadFile
(
Long
id
,
HttpServletResponse
response
);
List
<
SoilAppendix
>
getByExpIds
(
List
<
Long
>
ids
);
}
}
src/main/java/com/patzn/cloud/service/lims/soil/service/ISoilExperimentService.java
View file @
759289cd
...
@@ -73,6 +73,8 @@ public interface ISoilExperimentService extends IBaseService<SoilExperiment> {
...
@@ -73,6 +73,8 @@ public interface ISoilExperimentService extends IBaseService<SoilExperiment> {
List
<
SoilExperimentVO
>
listVOByIds
(
Long
[]
expIds
);
List
<
SoilExperimentVO
>
listVOByIds
(
Long
[]
expIds
);
List
<
SoilExperimentVO
>
listVOByIdsInit
(
Long
[]
expIds
);
boolean
parseTxt
(
SmbFile
smbFile
,
CollectDataType
request
);
boolean
parseTxt
(
SmbFile
smbFile
,
CollectDataType
request
);
boolean
parseWuxingTxt
(
SmbFile
smbFile
,
CollectDataType
request
);
boolean
parseWuxingTxt
(
SmbFile
smbFile
,
CollectDataType
request
);
...
...
src/main/java/com/patzn/cloud/service/lims/soil/service/impl/SoilAppendixServiceImpl.java
View file @
759289cd
...
@@ -75,4 +75,9 @@ public class SoilAppendixServiceImpl extends BaseServiceImpl<SoilAppendixMapper,
...
@@ -75,4 +75,9 @@ public class SoilAppendixServiceImpl extends BaseServiceImpl<SoilAppendixMapper,
}
}
ossClient
.
download
(
attachment
.
getObjectKey
(),
attachment
.
getName
()
+
".xlsx"
,
response
);
ossClient
.
download
(
attachment
.
getObjectKey
(),
attachment
.
getName
()
+
".xlsx"
,
response
);
}
}
@Override
public
List
<
SoilAppendix
>
getByExpIds
(
List
<
Long
>
ids
)
{
return
super
.
list
(
Condition
.
create
().
in
(
"exp_id"
,
ids
));
}
}
}
src/main/java/com/patzn/cloud/service/lims/soil/service/impl/SoilExperimentServiceImpl.java
View file @
759289cd
...
@@ -32,6 +32,9 @@ import com.patzn.cloud.service.lims.gideon.utils.DrawXlsxUtil;
...
@@ -32,6 +32,9 @@ import com.patzn.cloud.service.lims.gideon.utils.DrawXlsxUtil;
import
com.patzn.cloud.service.lims.original.InitMapReplace
;
import
com.patzn.cloud.service.lims.original.InitMapReplace
;
import
com.patzn.cloud.service.lims.original.Operation
;
import
com.patzn.cloud.service.lims.original.Operation
;
import
com.patzn.cloud.service.lims.original.OriginalOperationFactory
;
import
com.patzn.cloud.service.lims.original.OriginalOperationFactory
;
import
com.patzn.cloud.service.lims.report.MoreSheetReportOperation
;
import
com.patzn.cloud.service.lims.report.ReportUtil
;
import
com.patzn.cloud.service.lims.report.SingleSheetReportOperation
;
import
com.patzn.cloud.service.lims.soil.service.*
;
import
com.patzn.cloud.service.lims.soil.service.*
;
import
com.patzn.cloud.service.soil.dto.SoilExperimentQueryDTO
;
import
com.patzn.cloud.service.soil.dto.SoilExperimentQueryDTO
;
import
com.patzn.cloud.service.soil.entity.*
;
import
com.patzn.cloud.service.soil.entity.*
;
...
@@ -614,12 +617,12 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
...
@@ -614,12 +617,12 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
SoilEntrust
entrust
=
soilEntrustService
.
getById
(
entrustId
);
SoilEntrust
entrust
=
soilEntrustService
.
getById
(
entrustId
);
RestAssert
.
fail
(
null
==
entrust
,
"委托单不存在"
);
RestAssert
.
fail
(
null
==
entrust
,
"委托单不存在"
);
List
<
SoilExperimentVO
>
voList
=
soilExperimentService
.
listVOByIds
(
ids
);
List
<
SoilExperimentVO
>
voList
=
soilExperimentService
.
listVOByIds
Init
(
ids
);
boolean
chong
=
"检测报告(力学试验)落锥"
.
equals
(
template
.
getName
())||
"检测报告(力学试验)实验室微型十字板"
.
equals
(
template
.
getName
())||
"检测报告(力学试验)无侧限"
.
equals
(
template
.
getName
());
boolean
chong
=
"检测报告(力学试验)落锥"
.
equals
(
template
.
getName
())||
"检测报告(力学试验)实验室微型十字板"
.
equals
(
template
.
getName
())||
"检测报告(力学试验)无侧限"
.
equals
(
template
.
getName
());
List
<
SoilExpReportTemplateConfig
>
configList
=
soilExpReportTemplateConfigService
.
list
(
Condition
.
create
().
eq
(
"template_id"
,
templateId
));
if
(
CollectionUtils
.
isEmpty
(
voList
)){
if
(
CollectionUtils
.
isEmpty
(
voList
)){
RestAssert
.
fail
(
"试验项目不存在"
);
RestAssert
.
fail
(
"试验项目不存在"
);
}
}
...
@@ -654,51 +657,7 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
...
@@ -654,51 +657,7 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
if
(
chong
){
if
(
chong
){
ReportUtil
.
initChongSu
(
voList
,
soilItemList
);
Map
<
String
,
Integer
>
checkChongSuMap
=
new
HashMap
<>();
for
(
SoilExperimentVO
vo
:
voList
)
{
String
name
=
vo
.
getName
().
replace
(
"-重塑"
,
""
)+
vo
.
getSampleCode
();
if
(
checkChongSuMap
.
containsKey
(
name
)){
Integer
num
=
checkChongSuMap
.
get
(
name
);
num
=
num
+
1
;
checkChongSuMap
.
put
(
name
,
num
);
}
else
{
checkChongSuMap
.
put
(
name
,
1
);
}
}
List
<
SoilExperimentVO
>
newVOList
=
new
ArrayList
<>();
Map
<
String
,
SoilExperimentVO
>
newChongSuMap
=
new
HashMap
<>();
for
(
SoilExperimentVO
vo:
voList
)
{
String
name
=
vo
.
getName
().
replace
(
"-重塑"
,
""
)+
vo
.
getSampleCode
();
if
(!
vo
.
getName
().
contains
(
"重塑"
)){
newVOList
.
add
(
vo
);
}
else
{
Integer
num
=
checkChongSuMap
.
get
(
name
);
if
(
null
==
num
||
num
==
1
)
{
newVOList
.
add
(
vo
);
}
newChongSuMap
.
put
(
vo
.
getName
()+
vo
.
getSampleCode
(),
vo
);
}
}
voList
=
newVOList
;
List
<
SoilItem
>
saveNewItemList
=
new
ArrayList
<>();
for
(
SoilExperimentVO
vo:
voList
)
{
SoilExperimentVO
chongSu
=
newChongSuMap
.
get
(
vo
.
getName
()+
"-重塑"
+
vo
.
getSampleCode
());
if
(
null
!=
chongSu
){
for
(
SoilItem
item
:
soilItemList
)
{
if
(
item
.
getExperimentId
().
equals
(
chongSu
.
getId
())){
SoilItem
soilItem
=
item
.
convert
(
SoilItem
.
class
);
soilItem
.
setExperimentId
(
vo
.
getId
());
saveNewItemList
.
add
(
soilItem
);
}
}
}
}
for
(
SoilItem
item
:
saveNewItemList
)
{
soilItemList
.
add
(
item
);
}
}
}
Map
<
Long
,
List
<
SoilItem
>>
expItemMap
=
new
HashMap
<>();
Map
<
Long
,
List
<
SoilItem
>>
expItemMap
=
new
HashMap
<>();
for
(
SoilItem
item:
soilItemList
)
{
for
(
SoilItem
item:
soilItemList
)
{
...
@@ -781,455 +740,13 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
...
@@ -781,455 +740,13 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
SysFileSignature
signature
=
sysUserClient
.
signature
(
account
.
getUserId
()).
serviceData
();
SysFileSignature
signature
=
sysUserClient
.
signature
(
account
.
getUserId
()).
serviceData
();
if
(
null
==
template
.
getMoreSheet
()
||
0
==
template
.
getMoreSheet
()){
if
(
null
==
template
.
getMoreSheet
()
||
0
==
template
.
getMoreSheet
()){
HSSFWorkbookUtil
.
replaceModel
(
mapReplace
,
xssfWorkbook
,
0
);
SingleSheetReportOperation
operation
=
new
SingleSheetReportOperation
(
mapReplace
,
xssfWorkbook
,
sheetOne
,
template
,
configList
,
voList
,
expItemMap
);
sheetOne
.
setForceFormulaRecalculation
(
true
);
operation
.
doMakeReport
();
Integer
beginRow
=
template
.
getSampleBeginRow
();
Integer
sampleMergerNumOri
=
template
.
getSampleMergerNum
();
RestAssert
.
fail
(
null
==
template
.
getTemplateSampleNum
(),
"模板样品数不能为空"
);
int
templateSampleNum
=
template
.
getTemplateSampleNum
();
if
(
null
!=
beginRow
&&
null
!=
sampleMergerNumOri
&&
null
!=
template
.
getTemplateSampleNum
()){
List
<
SoilExpReportTemplateConfig
>
configList
=
soilExpReportTemplateConfigService
.
list
(
Condition
.
create
().
eq
(
"template_id"
,
templateId
));
if
(
voList
.
size
()<
templateSampleNum
){
int
sampleMergerNum
=
sampleMergerNumOri
;
for
(
SoilExperimentVO
vo:
voList
)
{
List
<
SoilItem
>
itemList
=
expItemMap
.
get
(
vo
.
getId
());
if
(
null
==
itemList
){
itemList
=
new
ArrayList
<>();
}
XSSFRow
xssfRow
=
sheetOne
.
getRow
(
beginRow
);
for
(
SoilExpReportTemplateConfig
config:
configList
)
{
if
(
"sn"
.
equals
(
config
.
getDataAttribute
())){
continue
;
}
setExcellCellValue
(
config
.
getDataAttribute
(),
vo
,
xssfRow
.
getCell
(
config
.
getColumnPlace
()),
itemList
);
}
beginRow
+=
sampleMergerNum
;
}
}
else
{
int
sampleMergerNum
=
sampleMergerNumOri
;
int
insertRow
=
beginRow
+
sampleMergerNum
*
templateSampleNum
;
XSSFRow
zeroRow
=
sheetOne
.
getRow
(
beginRow
);
int
lastCellNum
=
zeroRow
.
getLastCellNum
();
int
insertCount
=
voList
.
size
()-
templateSampleNum
;
for
(
int
m
=
0
;
m
<
insertCount
;
m
++)
{
for
(
int
i
=
0
;
i
<
sampleMergerNum
;
i
++)
{
sheetOne
.
shiftRows
(
insertRow
,
sheetOne
.
getLastRowNum
(),
1
,
true
,
false
);
XSSFRow
row
=
sheetOne
.
createRow
(
insertRow
);
row
.
setHeight
(
zeroRow
.
getHeight
());
for
(
int
j
=
0
;
j
<
lastCellNum
;
j
++)
{
XSSFCell
xssfCell
=
row
.
createCell
(
j
);
XSSFCellStyle
cellStyle
=
zeroRow
.
getCell
(
j
).
getCellStyle
();
xssfCell
.
setCellStyle
(
cellStyle
);
xssfCell
.
setCellValue
(
"/"
);
}
insertRow
++;
}
}
int
sn
=
1
;
for
(
SoilExperimentVO
vo:
voList
)
{
XSSFRow
xssfRow
=
sheetOne
.
getRow
(
beginRow
);
List
<
SoilItem
>
itemList
=
expItemMap
.
get
(
vo
.
getId
());
if
(
null
==
itemList
){
itemList
=
new
ArrayList
<>();
}
for
(
SoilExpReportTemplateConfig
config:
configList
)
{
if
(
null
==
config
.
getColumnPlace
()){
continue
;
}
XSSFCell
cell
=
xssfRow
.
getCell
(
config
.
getColumnPlace
());
if
(
"sn"
.
equals
(
config
.
getDataAttribute
())){
cell
.
setCellValue
(
sn
);
continue
;
}
setExcellCellValue
(
config
.
getDataAttribute
(),
vo
,
cell
,
itemList
);
}
beginRow
+=
sampleMergerNum
;
sn
++;
}
for
(
SoilExpReportTemplateConfig
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
()
&&
null
!=
config
.
getMergeRowNum
()){
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
;
}
}
}
logger
.
error
(
"----------------------15"
);
}
}
}
else
{
}
else
{
Integer
templateSampleNum
=
template
.
getTemplateSampleNum
();
List
<
SoilItemVO
>
soilItemVOList
=
soilItemService
.
listVOByExpSampleIds
(
sampleIdList
);
List
<
SoilItemVO
>
soilItemVOList
=
soilItemService
.
listVOByExpSampleIds
(
sampleIdList
);
MoreSheetReportOperation
operation
=
new
MoreSheetReportOperation
(
mapReplace
,
xssfWorkbook
,
sheetOne
,
template
,
voList
,
entrust
,
soilItemVOList
);
operation
.
doMakeReport
();
Map
<
Long
,
List
<
SoilItemVO
>>
sampleSoilItemVOMap
=
new
HashMap
<>();
for
(
SoilItemVO
soilItemVO:
soilItemVOList
)
{
if
(
sampleSoilItemVOMap
.
containsKey
(
soilItemVO
.
getSampleId
())){
List
<
SoilItemVO
>
sampleItems
=
sampleSoilItemVOMap
.
get
(
soilItemVO
.
getSampleId
());
sampleItems
.
add
(
soilItemVO
);
sampleSoilItemVOMap
.
put
(
soilItemVO
.
getSampleId
(),
sampleItems
);
}
else
{
List
<
SoilItemVO
>
sampleItems
=
new
ArrayList
<>();
sampleItems
.
add
(
soilItemVO
);
sampleSoilItemVOMap
.
put
(
soilItemVO
.
getSampleId
(),
sampleItems
);
}
}
if
(
null
==
templateSampleNum
||
1
==
templateSampleNum
){
XSSFSheet
xssfSheet
=
xssfWorkbook
.
getSheetAt
(
0
);
xssfSheet
.
setForceFormulaRecalculation
(
true
);
int
index
=
0
;
SoilExperimentVO
firstVO
=
null
;
int
sheetNum
=
xssfWorkbook
.
getNumberOfSheets
();
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
);
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
());
HSSFWorkbookUtil
.
replaceModel
(
mapReplace
,
xssfWorkbook
,
sheet
);
nextSample
++;
}
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
());
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
);
// for (int i = 0; i < length; i++) {
//
//
// }
}
else
{
List
<
List
<
SoilExperimentVO
>>
relList
=
ListUtils
.
partition
(
voList
,
templateSampleNum
);
int
templateSheetMum
=
xssfWorkbook
.
getNumberOfSheets
();
XSSFSheet
sheetMy
=
xssfWorkbook
.
getSheetAt
(
0
);
boolean
first
=
true
;
List
<
SoilExperimentVO
>
firstList
=
null
;
PrintSetup
printSetup
=
sheetMy
.
getPrintSetup
();
boolean
printRound
=
printSetup
.
getLandscape
();
for
(
List
<
SoilExperimentVO
>
expVOList:
relList
)
{
XSSFSheet
sheet
=
null
;
if
(
first
){
sheet
=
sheetMy
;
firstList
=
expVOList
;
first
=
false
;
continue
;
}
else
{
sheet
=
xssfWorkbook
.
cloneSheet
(
0
,
sheetMy
.
getSheetName
()+(
templateSheetMum
));
sheet
.
getPrintSetup
().
setLandscape
(
printRound
);
}
Map
<
String
,
String
>
mapReplaceMy
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
templateSampleNum
;
i
++)
{
mapReplaceMy
.
put
(
"#{sampleCode"
+
i
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{sampleDepth"
+
i
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{含水率"
+
i
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81"
+
i
+
"}"
,
""
);
}
mapReplaceMy
.
put
(
"#{projectName}"
,
entrust
.
getProjectName
());
mapReplaceMy
.
put
(
"#{client}"
,
entrust
.
getClient
());
mapReplaceMy
.
put
(
"#{boreholeName}"
,
entrust
.
getBoreholeName
());
mapReplaceMy
.
put
(
"#{projectNo}"
,
entrust
.
getProjectNo
());
int
entitySize
=
expVOList
.
size
();
for
(
int
j
=
0
;
j
<
entitySize
;
j
++)
{
SoilExperimentVO
vo
=
expVOList
.
get
(
j
);
mapReplaceMy
.
put
(
"#{sampleCode"
+
j
+
"}"
,
StringHandleUtils
.
getString
(
vo
.
getSampleCode
()));
mapReplaceMy
.
put
(
"#{sampleDepth"
+
j
+
"}"
,
StringHandleUtils
.
getString
(
vo
.
getSampleDepth
()));
List
<
SoilItemVO
>
itemVOList
=
sampleSoilItemVOMap
.
get
(
vo
.
getSampleId
());
if
(
CollectionUtils
.
isNotEmpty
(
itemVOList
)){
for
(
SoilItemVO
itemVO:
itemVOList
)
{
mapReplaceMy
.
put
(
"#{"
+
itemVO
.
getName
()+
"}"
,
itemVO
.
getTestValue
());
}
}
if
(!
mapReplaceMy
.
containsKey
(
"#{含水率}"
)){
mapReplaceMy
.
put
(
"#{含水率}"
,
""
);
mapReplaceMy
.
put
(
"#{含水率"
+
j
+
"}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{液限}"
)){
mapReplaceMy
.
put
(
"#{液限}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{塑限}"
)){
mapReplaceMy
.
put
(
"#{塑限}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{比重}"
)){
mapReplaceMy
.
put
(
"#{比重}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{密度}"
)){
mapReplaceMy
.
put
(
"#{密度}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{容重}"
)){
mapReplaceMy
.
put
(
"#{容重}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81}"
,
""
);
mapReplaceMy
.
put
(
"#{容重"
+
j
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81"
+
j
+
"}"
,
""
);
}
else
{
String
rongzhong
=
mapReplace
.
get
(
"#{容重}"
);
if
(
StringUtils
.
isBlank
(
rongzhong
)){
mapReplaceMy
.
put
(
"#{容重9.81}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81"
+
j
+
"}"
,
""
);
}
else
{
if
(
StringHandleUtils
.
validateNumber
(
rongzhong
)){
BigDecimal
rong
=
new
BigDecimal
(
rongzhong
);
BigDecimal
chengshu
=
new
BigDecimal
(
"9.81"
);
BigDecimal
ji
=
rong
.
multiply
(
chengshu
);
mapReplaceMy
.
put
(
"#{容重9.81}"
,
ji
.
toString
());
mapReplaceMy
.
put
(
"#{容重9.81"
+
j
+
"}"
,
ji
.
toString
());
}
else
{
mapReplaceMy
.
put
(
"#{容重9.81}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81"
+
j
+
"}"
,
""
);
}
}
}
}
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
(
mapReplaceMy
,
xssfWorkbook
,
sheet
);
templateSheetMum
++;
}
int
firstSize
=
firstList
.
size
();
Map
<
String
,
String
>
mapReplaceMy
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
templateSampleNum
;
i
++)
{
mapReplaceMy
.
put
(
"#{sampleCode"
+
i
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{sampleDepth"
+
i
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{含水率"
+
i
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81"
+
i
+
"}"
,
""
);
}
mapReplaceMy
.
put
(
"#{projectName}"
,
entrust
.
getProjectName
());
mapReplaceMy
.
put
(
"#{client}"
,
entrust
.
getClient
());
mapReplaceMy
.
put
(
"#{boreholeName}"
,
entrust
.
getBoreholeName
());
mapReplaceMy
.
put
(
"#{projectNo}"
,
entrust
.
getProjectNo
());
for
(
int
j
=
0
;
j
<
firstSize
;
j
++)
{
SoilExperimentVO
vo
=
firstList
.
get
(
j
);
mapReplaceMy
.
put
(
"#{sampleCode"
+
j
+
"}"
,
StringHandleUtils
.
getString
(
vo
.
getSampleCode
()));
mapReplaceMy
.
put
(
"#{sampleDepth"
+
j
+
"}"
,
StringHandleUtils
.
getString
(
vo
.
getSampleDepth
()));
List
<
SoilItemVO
>
itemVOList
=
sampleSoilItemVOMap
.
get
(
vo
.
getSampleId
());
if
(
CollectionUtils
.
isNotEmpty
(
itemVOList
)){
for
(
SoilItemVO
itemVO:
itemVOList
)
{
mapReplaceMy
.
put
(
"#{"
+
itemVO
.
getName
()+
"}"
,
itemVO
.
getTestValue
());
}
}
if
(!
mapReplaceMy
.
containsKey
(
"#{含水率}"
)){
mapReplaceMy
.
put
(
"#{含水率}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{液限}"
)){
mapReplaceMy
.
put
(
"#{液限}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{塑限}"
)){
mapReplaceMy
.
put
(
"#{塑限}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{比重}"
)){
mapReplaceMy
.
put
(
"#{比重}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{密度}"
)){
mapReplaceMy
.
put
(
"#{密度}"
,
""
);
}
if
(!
mapReplaceMy
.
containsKey
(
"#{含水率}"
)){
mapReplaceMy
.
put
(
"#{含水率"
+
j
+
"}"
,
""
);
}
else
{
mapReplaceMy
.
put
(
"#{含水率"
+
j
+
"}"
,
mapReplaceMy
.
get
(
"#{含水率}"
));
}
if
(!
mapReplaceMy
.
containsKey
(
"#{容重}"
)){
mapReplaceMy
.
put
(
"#{容重}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81}"
,
""
);
mapReplaceMy
.
put
(
"#{容重"
+
j
+
"}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81"
+
j
+
"}"
,
""
);
}
else
{
String
rongzhong
=
mapReplace
.
get
(
"#{容重}"
);
if
(
StringUtils
.
isBlank
(
rongzhong
)){
mapReplaceMy
.
put
(
"#{容重9.81}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81"
+
j
+
"}"
,
""
);
}
else
{
if
(
StringHandleUtils
.
validateNumber
(
rongzhong
)){
BigDecimal
rong
=
new
BigDecimal
(
rongzhong
);
BigDecimal
chengshu
=
new
BigDecimal
(
"9.81"
);
BigDecimal
ji
=
rong
.
multiply
(
chengshu
);
mapReplaceMy
.
put
(
"#{容重9.81}"
,
ji
.
toString
());
mapReplaceMy
.
put
(
"#{容重9.81"
+
j
+
"}"
,
ji
.
toString
());
}
else
{
mapReplaceMy
.
put
(
"#{容重9.81}"
,
""
);
mapReplaceMy
.
put
(
"#{容重9.81"
+
j
+
"}"
,
""
);
}
}
}
}
HSSFWorkbookUtil
.
replaceModel
(
mapReplaceMy
,
xssfWorkbook
,
sheetMy
);
}
}
}
...
@@ -1269,61 +786,7 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
...
@@ -1269,61 +786,7 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
}
}
public
void
setExcellCellValue
(
String
prepory
,
SoilSampleVO
vo
,
XSSFCell
cell
,
List
<
SoilItem
>
itemList
){
if
(
StringUtils
.
isNotBlank
(
prepory
)){
if
(
prepory
.
equals
(
"{appendix}"
)){
List
<
SoilExperimentVO
>
voList
=
vo
.
getExperimentVOList
();
if
(
null
!=
voList
){
for
(
SoilExperimentVO
experimentVO:
voList
)
{
SoilAppendix
soilAppendix
=
soilAppendixService
.
getByExpId
(
experimentVO
.
getId
());
if
(
null
!=
soilAppendix
){
cell
.
setCellValue
(
soilAppendix
.
getTitle
());
}
break
;
}
}
}
else
{
if
(
StringHandleUtils
.
is_alpha
(
prepory
)){
cell
.
setCellValue
(
StringHandleUtils
.
getFieldIfNummReturnBlankValueByFieldName
(
prepory
,
vo
));
}
else
{
if
(
CollectionUtils
.
isNotEmpty
(
itemList
)){
for
(
SoilItem
item:
itemList
)
{
if
(
prepory
.
equals
(
item
.
getName
())){
cell
.
setCellValue
(
item
.
getTestValue
());
break
;
}
}
}
}
}
}
}
public
void
setExcellCellValue
(
String
prepory
,
SoilExperimentVO
vo
,
XSSFCell
cell
,
List
<
SoilItem
>
itemList
){
if
(
StringUtils
.
isNotBlank
(
prepory
)){
if
(
prepory
.
equals
(
"{appendix}"
)){
SoilAppendix
soilAppendix
=
soilAppendixService
.
getByExpId
(
vo
.
getId
());
if
(
null
!=
soilAppendix
){
cell
.
setCellValue
(
soilAppendix
.
getTitle
());
}
}
else
{
if
(
StringHandleUtils
.
is_alpha
(
prepory
)){
cell
.
setCellValue
(
StringHandleUtils
.
getFieldIfNummReturnBlankValueByFieldName
(
prepory
,
vo
));
}
else
{
if
(
CollectionUtils
.
isNotEmpty
(
itemList
)){
for
(
SoilItem
item:
itemList
)
{
if
(
prepory
.
equals
(
item
.
getName
())){
cell
.
setCellValue
(
item
.
getTestValue
());
break
;
}
}
}
}
}
}
}
@Override
@Override
public
void
uploadCollectGds
(
SmbFile
smbFile
,
CollectDataType
request
)
{
public
void
uploadCollectGds
(
SmbFile
smbFile
,
CollectDataType
request
)
{
...
@@ -2066,7 +1529,6 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
...
@@ -2066,7 +1529,6 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
Map
<
String
,
File
>
fileMap
=
new
HashMap
<>();
Map
<
String
,
File
>
fileMap
=
new
HashMap
<>();
fileMap
.
put
(
"${picTest}"
,
file
);
fileMap
.
put
(
"${picTest}"
,
file
);
int
count
=
soilAppendixService
.
countByEntrustId
(
sample
.
getEntrustId
())+
1
;
Map
<
String
,
String
>
replaceMap
=
new
HashMap
<>();
Map
<
String
,
String
>
replaceMap
=
new
HashMap
<>();
...
@@ -2081,15 +1543,15 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
...
@@ -2081,15 +1543,15 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
testEnglish
=
"FIGURE OF TRIAXIAL COMPRESSION TEST"
;
testEnglish
=
"FIGURE OF TRIAXIAL COMPRESSION TEST"
;
}
}
replaceMap
.
put
(
"#{reportCode}"
,
StringHandleUtils
.
getString
(
type
.
getEntrustCode
()));
replaceMap
.
put
(
"#{reportCode}"
,
StringHandleUtils
.
getString
(
type
.
getEntrustCode
()));
replaceMap
.
put
(
"#{title}"
,
"附录"
+
(
count
)+
" "
+
type
.
getExperiment
()+
"试验成果图\n"
+
replaceMap
.
put
(
"#{title}"
,
"附录"
+
sample
.
getSiteNo
(
)+
" "
+
type
.
getExperiment
()+
"试验成果图\n"
+
"APPENDIX "
+
count
+
" "
+
testEnglish
);
"APPENDIX "
+
sample
.
getSiteNo
()
+
" "
+
testEnglish
);
try
{
try
{
HSSFWorkbookUtil
.
replaceModel
(
replaceMap
,
xssfWorkbook
);
HSSFWorkbookUtil
.
replaceModel
(
replaceMap
,
xssfWorkbook
);
HSSFWorkbookUtil
.
insertImage
(
xssfWorkbook
,
fileMap
,
true
);
HSSFWorkbookUtil
.
insertImage
(
xssfWorkbook
,
fileMap
,
true
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
logger
.
error
(
"generateExcelReport错误"
+
e
.
getMessage
());
logger
.
error
(
"generateExcelReport错误"
+
e
.
getMessage
());
}
}
xssfWorkbook
.
setSheetName
(
0
,
"附录"
+
count
+
type
.
getExperiment
());
xssfWorkbook
.
setSheetName
(
0
,
"附录"
+
sample
.
getSiteNo
()
+
type
.
getExperiment
());
...
@@ -2107,8 +1569,8 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
...
@@ -2107,8 +1569,8 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
appendix
.
setEntrustId
(
sample
.
getEntrustId
());
appendix
.
setEntrustId
(
sample
.
getEntrustId
());
appendix
.
setUname
(
LoginHelper
.
getAccount
().
getUserName
());
appendix
.
setUname
(
LoginHelper
.
getAccount
().
getUserName
());
appendix
.
setObjectKey
(
result
.
getObjectKey
());
appendix
.
setObjectKey
(
result
.
getObjectKey
());
appendix
.
setName
(
"附录"
+
count
+
" "
+
type
.
getExperiment
()+
"试验成果图"
);
appendix
.
setName
(
"附录"
+
sample
.
getSiteNo
()
+
" "
+
type
.
getExperiment
()+
"试验成果图"
);
appendix
.
setTitle
(
"附录"
+
count
);
appendix
.
setTitle
(
"附录"
+
sample
.
getSiteNo
()
);
appendix
.
setExpId
(
type
.
getExpId
());
appendix
.
setExpId
(
type
.
getExpId
());
appendix
.
setSampleCode
(
type
.
getSiteNo
());
appendix
.
setSampleCode
(
type
.
getSiteNo
());
if
(
name
.
contains
(
"三轴"
)){
if
(
name
.
contains
(
"三轴"
)){
...
@@ -2128,8 +1590,6 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
...
@@ -2128,8 +1590,6 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
}
}
}
else
{
}
}
...
@@ -2401,7 +1861,6 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
...
@@ -2401,7 +1861,6 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
Map
<
String
,
File
>
fileMap
=
new
HashMap
<>();
Map
<
String
,
File
>
fileMap
=
new
HashMap
<>();
fileMap
.
put
(
"${picTest}"
,
file
);
fileMap
.
put
(
"${picTest}"
,
file
);
int
count
=
soilAppendixService
.
countByEntrustId
(
sample
.
getEntrustId
())+
1
;
Map
<
String
,
String
>
replaceMap
=
new
HashMap
<>();
Map
<
String
,
String
>
replaceMap
=
new
HashMap
<>();
...
@@ -2417,8 +1876,8 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
...
@@ -2417,8 +1876,8 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
}
}
replaceMap
.
put
(
"#{title}"
,
"附录"
+
(
count
)+
" "
+
type
.
getExperiment
()+
"试验成果图\n"
+
replaceMap
.
put
(
"#{title}"
,
"附录"
+
sample
.
getSiteNo
(
)+
" "
+
type
.
getExperiment
()+
"试验成果图\n"
+
"APPENDIX "
+
count
+
" "
+
testEnglish
);
"APPENDIX "
+
sample
.
getSiteNo
()
+
" "
+
testEnglish
);
replaceMap
.
put
(
"#{reportCode}"
,
StringHandleUtils
.
getString
(
type
.
getEntrustCode
()));
replaceMap
.
put
(
"#{reportCode}"
,
StringHandleUtils
.
getString
(
type
.
getEntrustCode
()));
try
{
try
{
...
@@ -2427,7 +1886,7 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
...
@@ -2427,7 +1886,7 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
logger
.
error
(
"generateExcelReport错误"
+
e
.
getMessage
());
logger
.
error
(
"generateExcelReport错误"
+
e
.
getMessage
());
}
}
xssfWorkbook
.
setSheetName
(
0
,
"附录"
+
count
+
type
.
getExperiment
());
xssfWorkbook
.
setSheetName
(
0
,
"附录"
+
sample
.
getSiteNo
()
+
type
.
getExperiment
());
...
@@ -2445,8 +1904,8 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
...
@@ -2445,8 +1904,8 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
appendix
.
setEntrustId
(
sample
.
getEntrustId
());
appendix
.
setEntrustId
(
sample
.
getEntrustId
());
appendix
.
setUname
(
LoginHelper
.
getAccount
().
getUserName
());
appendix
.
setUname
(
LoginHelper
.
getAccount
().
getUserName
());
appendix
.
setObjectKey
(
result
.
getObjectKey
());
appendix
.
setObjectKey
(
result
.
getObjectKey
());
appendix
.
setName
(
"附录"
+
count
+
" "
+
type
.
getExperiment
()+
"试验成果图"
);
appendix
.
setName
(
"附录"
+
sample
.
getSiteNo
()
+
" "
+
type
.
getExperiment
()+
"试验成果图"
);
appendix
.
setTitle
(
"附录"
+
count
);
appendix
.
setTitle
(
"附录"
+
sample
.
getSiteNo
()
);
appendix
.
setExpId
(
type
.
getExpId
());
appendix
.
setExpId
(
type
.
getExpId
());
appendix
.
setSampleCode
(
type
.
getSiteNo
());
appendix
.
setSampleCode
(
type
.
getSiteNo
());
appendix
.
setEntrustCode
(
type
.
getEntrustCode
());
appendix
.
setEntrustCode
(
type
.
getEntrustCode
());
...
@@ -2541,7 +2000,34 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
...
@@ -2541,7 +2000,34 @@ public class SoilExperimentServiceImpl extends BaseServiceImpl<SoilExperimentMap
@Override
@Override
public
List
<
SoilExperimentVO
>
listVOByIds
(
Long
[]
expIds
)
{
public
List
<
SoilExperimentVO
>
listVOByIds
(
Long
[]
expIds
)
{
return
baseMapper
.
selectListVOByIds
(
expIds
);
List
<
SoilExperimentVO
>
list
=
baseMapper
.
selectListVOByIds
(
expIds
);
return
list
;
}
@Override
public
List
<
SoilExperimentVO
>
listVOByIdsInit
(
Long
[]
expIds
)
{
List
<
SoilExperimentVO
>
list
=
baseMapper
.
selectListVOByIds
(
expIds
);
if
(
CollectionUtils
.
isEmpty
(
list
)){
return
list
;
}
List
<
Long
>
ids
=
list
.
stream
().
map
(
s
->{
return
s
.
getId
();
}).
collect
(
Collectors
.
toList
());
List
<
SoilAppendix
>
appendixList
=
soilAppendixService
.
getByExpIds
(
ids
);
if
(
CollectionUtils
.
isEmpty
(
appendixList
)){
return
list
;
}
for
(
SoilExperimentVO
vo
:
list
)
{
for
(
SoilAppendix
appendix
:
appendixList
)
{
if
(
vo
.
getId
().
equals
(
appendix
.
getExpId
())){
vo
.
setSoilAppendix
(
appendix
);
break
;
}
}
}
return
list
;
}
}
...
...
src/main/resources/mapper/soil/SoilExperimentMapper.xml
View file @
759289cd
...
@@ -20,9 +20,11 @@
...
@@ -20,9 +20,11 @@
o.alloter,
o.alloter,
o.allot_time,
o.allot_time,
s.sample_code,
s.sample_code,
s.site_no,
s.sample_depth,
s.sample_depth,
s.describe_detail,
s.describe_detail,
s.sample_pack
s.sample_pack,
e.borehole_name
FROM soil_experiment t
FROM soil_experiment t
...
@@ -366,7 +368,8 @@
...
@@ -366,7 +368,8 @@
s.sample_pack,
s.sample_pack,
o.alloter,
o.alloter,
o.allot_time,
o.allot_time,
e.client
e.client,
e.borehole_name
FROM soil_experiment t
FROM soil_experiment t
JOIN soil_sample s ON t.sample_id = s.id
JOIN soil_sample s ON t.sample_id = s.id
...
...
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