Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
patzn-cloud-service-hmhj
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangweidong
patzn-cloud-service-hmhj
Commits
81165497
Commit
81165497
authored
Jun 16, 2021
by
lijingjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改报告问题;
parent
63785439
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
108 additions
and
147 deletions
+108
-147
EntrustSampleServiceImpl.java
...vice/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
+11
-12
OriginalTemplateServiceImpl.java
...e/lims/hmhj/service/impl/OriginalTemplateServiceImpl.java
+97
-135
No files found.
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
View file @
81165497
...
...
@@ -62,7 +62,6 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
@Autowired
private
IEntrustReportTemplateConfigService
entrustReportTemplateConfigService
;
@Autowired
private
OssClient
ossClient
;
...
...
@@ -363,8 +362,8 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
e
.
printStackTrace
();
}
List
<
OriginalTemplateConfig
>
configList
=
originalTemplateConfigService
.
list
(
Condition
.
create
().
eq
(
"template_id"
,
templateId
));
OriginalUtil
.
doReplace
(
xssfWorkbook
,
entrust
);
List
<
EntrustReportTemplateConfig
>
configList
=
entrustReportTemplateConfigService
.
list
(
Condition
.
create
().
eq
(
"template_id"
,
templateId
));
OriginalUtil
.
doReplace
(
xssfWorkbook
,
entrust
);
XSSFSheet
sheetOne
=
xssfWorkbook
.
getSheetAt
(
0
);
String
sheetName
=
sheetOne
.
getSheetName
();
System
.
out
.
println
(
sheetName
);
...
...
@@ -372,33 +371,33 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
Integer
beginRow
=
sysFileTemplate
.
getSampleBeginRow
();
int
sampleMergerNum
=
sysFileTemplate
.
getSampleMergerNum
();
int
templateSampleNum
=
sysFileTemplate
.
getTemplateSampleNum
();
if
(
templateSampleNum
>=
sampleVOList
.
size
())
{
for
(
EntrustSampleVO
vo:
sampleVOList
)
{
if
(
templateSampleNum
>=
sampleVOList
.
size
())
{
for
(
EntrustSampleVO
vo
:
sampleVOList
)
{
List
<
EntrustSampleItemIndex
>
indexList
=
entrustSampleItemIndexService
.
listBySampleId
(
vo
.
getId
());
vo
.
setIndexList
(
indexList
);
XSSFRow
xssfRow
=
sheetOne
.
getRow
(
beginRow
);
for
(
OriginalTemplateConfig
config:
configList
)
{
for
(
EntrustReportTemplateConfig
config
:
configList
)
{
XSSFCell
cell
=
xssfRow
.
getCell
(
config
.
getColumnPlace
());
if
(
"sn"
.
equals
(
config
.
getDataAttribute
()))
{
if
(
"sn"
.
equals
(
config
.
getDataAttribute
()))
{
continue
;
}
if
(
StringUtils
.
isBlank
(
config
.
getDataAttribute
()))
{
if
(
StringUtils
.
isBlank
(
config
.
getDataAttribute
()))
{
continue
;
}
String
value
=
StringHandleUtils
.
getFieldValue
(
config
.
getDataAttribute
(),
vo
);
String
value
=
StringHandleUtils
.
getFieldValue
(
config
.
getDataAttribute
(),
vo
);
cell
.
setCellValue
(
value
);
}
beginRow
+=
sampleMergerNum
;
beginRow
+=
sampleMergerNum
;
}
String
generated
=
entrust
.
getCode
();
FileOutputStream
os
=
null
;
File
file
=
null
;
try
{
file
=
File
.
createTempFile
(
generated
,
".doc
x"
);
file
=
File
.
createTempFile
(
generated
,
".xls
x"
);
os
=
new
FileOutputStream
(
file
);
xssfWorkbook
.
write
(
os
);
os
.
flush
();
entrustReportService
.
uploadReportGenerateDocx
(
entrust
,
ids
,
account
,
StringHandleUtils
.
join
(
sampleNameSet
),
"报告生成"
,
file
);
entrustReportService
.
uploadReportGenerateDocx
(
entrust
,
ids
,
account
,
StringHandleUtils
.
join
(
sampleNameSet
),
"报告生成"
,
file
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/OriginalTemplateServiceImpl.java
View file @
81165497
package
com
.
patzn
.
cloud
.
service
.
lims
.
hmhj
.
service
.
impl
;
import
com.baomidou.mybatisplus.mapper.Condition
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.mapper.Wrapper
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.patzn.cloud.commons.api.RestAssert
;
import
com.patzn.cloud.commons.service.impl.BaseServiceImpl
;
import
com.patzn.cloud.oss.starter.OssClient
;
import
com.patzn.cloud.oss.starter.OssFileResult
;
import
com.patzn.cloud.service.hmhj.entity.*
;
...
...
@@ -12,10 +16,6 @@ import com.patzn.cloud.service.lims.hmhj.handler.ItemCollectEntity;
import
com.patzn.cloud.service.lims.hmhj.handler.SoilItemCollectData
;
import
com.patzn.cloud.service.lims.hmhj.mapper.OriginalTemplateMapper
;
import
com.patzn.cloud.service.lims.hmhj.service.*
;
import
com.patzn.cloud.commons.service.impl.BaseServiceImpl
;
import
com.patzn.cloud.service.soil.entity.*
;
import
com.patzn.cloud.service.soil.vo.SoilExperimentVO
;
import
com.patzn.cloud.service.soil.vo.SoilItemVO
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.format.CellFormat
;
...
...
@@ -23,15 +23,8 @@ 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.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.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.mapper.Wrapper
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.InputStream
;
...
...
@@ -67,22 +60,11 @@ public class OriginalTemplateServiceImpl extends BaseServiceImpl<OriginalTemplat
private
IOriginalTemplateConfigService
originalTemplateConfigService
;
@Autowired
private
IOriginalRecordService
originalRecordService
;
@Autowired
private
IOriginalTemplateService
originalTemplateService
;
@Autowired
private
IOriginalTemplateConfigService
originalTemplateConfigService
;
@Autowired
private
IItemRelOriginalRecordService
itemRelOriginalRecordService
;
@Autowired
private
IEntrustSampleItemService
entrustSampleItemService
;
@Autowired
private
IEntrustSampleItemIndexService
entrustSampleItemIndexService
;
...
...
@@ -225,13 +207,25 @@ public class OriginalTemplateServiceImpl extends BaseServiceImpl<OriginalTemplat
fillTestValue
(
sampleCode
,
indicatorVal
,
userId
,
userName
,
sampleItemVOList
);
}
}
// 批量更新检测值
List
<
EntrustSampleItem
>
entrustSampleItemList
=
sampleItemVOList
.
stream
().
map
(
t
->
t
.
convert
(
EntrustSampleItem
.
class
)).
collect
(
Collectors
.
toList
());
entrustSampleItemService
.
updateBatchById
(
entrustSampleItemList
);
}
else
{
// 多 tab 页情况
// do nothings
}
return
true
;
}
@Override
public
boolean
editOriginal
(
String
someParam
,
OssFileResult
obsFileResult
)
{
RestAssert
.
fail
(
StringUtils
.
isBlank
(
someParam
),
"业务ID不能为空"
);
RestAssert
.
fail
(
null
==
obsFileResult
,
"OssFileResult不能为空"
);
RestAssert
.
fail
(
StringUtils
.
isBlank
(
obsFileResult
.
getObjectKey
()),
"ObjectKey不能为空"
);
RestAssert
.
fail
(
StringUtils
.
isBlank
(
obsFileResult
.
getVersionId
()),
"VersionId不能为空"
);
RestAssert
.
fail
(
StringUtils
.
isBlank
(
obsFileResult
.
getType
()),
"Type不能为空"
);
RestAssert
.
fail
(
StringUtils
.
isBlank
(
someParam
),
"业务ID不能为空"
);
RestAssert
.
fail
(
null
==
obsFileResult
,
"OssFileResult不能为空"
);
RestAssert
.
fail
(
StringUtils
.
isBlank
(
obsFileResult
.
getObjectKey
()),
"ObjectKey不能为空"
);
RestAssert
.
fail
(
StringUtils
.
isBlank
(
obsFileResult
.
getVersionId
()),
"VersionId不能为空"
);
RestAssert
.
fail
(
StringUtils
.
isBlank
(
obsFileResult
.
getType
()),
"Type不能为空"
);
RestAssert
.
fail
(
StringUtils
.
isBlank
(
someParam
)
||
4
!=
someParam
.
split
(
"&"
).
length
,
"参数传递有误"
);
String
[]
arr
=
someParam
.
split
(
"&"
);
Long
businessId
=
Long
.
parseLong
(
arr
[
0
]);
...
...
@@ -244,7 +238,7 @@ public class OriginalTemplateServiceImpl extends BaseServiceImpl<OriginalTemplat
Long
userId
=
Long
.
parseLong
(
arr
[
1
]);
Long
companyId
=
Long
.
parseLong
(
arr
[
3
]);
OriginalRecord
report
=
originalRecordService
.
getById
(
businessId
);
if
(
null
==
report
){
if
(
null
==
report
)
{
RestAssert
.
fail
(
"数据有误"
);
}
OriginalRecord
originalRecord
=
new
OriginalRecord
();
...
...
@@ -253,7 +247,7 @@ public class OriginalTemplateServiceImpl extends BaseServiceImpl<OriginalTemplat
originalRecordService
.
updateById
(
originalRecord
);
InputStream
io
=
ossClient
.
download
(
obsFileResult
.
getObjectKey
());
//结果回调
XSSFWorkbook
xssfWorkbook
=
null
;
XSSFWorkbook
xssfWorkbook
=
null
;
try
{
xssfWorkbook
=
new
XSSFWorkbook
(
io
);
}
catch
(
Exception
e1
)
{
...
...
@@ -263,84 +257,78 @@ public class OriginalTemplateServiceImpl extends BaseServiceImpl<OriginalTemplat
}
XSSFSheet
sheet
=
xssfWorkbook
.
getSheetAt
(
0
);
if
(
null
==
report
.
getTemplateId
()){
if
(
null
==
report
.
getTemplateId
())
{
return
true
;
}
OriginalTemplate
template
=
originalTemplateService
.
getById
(
report
.
getTemplateId
());
if
(
null
==
template
){
if
(
null
==
template
)
{
return
true
;
}
Integer
moreSheet
=
template
.
getMoreSheet
();
List
<
OriginalTemplateConfig
>
configList
=
originalTemplateConfigService
.
list
(
Condition
.
create
().
eq
(
"template_id"
,
template
.
getId
()));
List
<
OriginalTemplateConfig
>
configList
=
originalTemplateConfigService
.
list
(
Condition
.
create
().
eq
(
"template_id"
,
template
.
getId
()));
List
<
ItemRelOriginalRecord
>
relOriginalRecordList
=
itemRelOriginalRecordService
.
list
(
Condition
.
create
().
eq
(
"record_id"
,
report
.
getId
()));
if
(
CollectionUtils
.
isEmpty
(
relOriginalRecordList
)){
List
<
ItemRelOriginalRecord
>
relOriginalRecordList
=
itemRelOriginalRecordService
.
list
(
Condition
.
create
().
eq
(
"record_id"
,
report
.
getId
()));
if
(
CollectionUtils
.
isEmpty
(
relOriginalRecordList
))
{
return
true
;
}
List
<
Long
>
expIdsList
=
relOriginalRecordList
.
stream
().
map
(
r
->
{
List
<
Long
>
expIdsList
=
relOriginalRecordList
.
stream
().
map
(
r
->
{
return
r
.
getItemId
();
}).
collect
(
Collectors
.
toList
());
List
<
EntrustSampleItemVO
>
experimentVOList
=
entrustSampleItemService
.
listVOByIds
(
expIdsList
);
List
<
EntrustSampleItemVO
>
experimentVOList
=
entrustSampleItemService
.
listVOByIds
(
expIdsList
);
Map
<
String
,
List
<
EntrustSampleItem
>>
esiMap
=
new
HashMap
<>();
for
(
EntrustSampleItemVO
entrustSampleItemVO
:
experimentVOList
)
{
if
(
esiMap
.
containsKey
(
entrustSampleItemVO
.
getSampleCode
())){
Map
<
String
,
List
<
EntrustSampleItem
>>
esiMap
=
new
HashMap
<>();
for
(
EntrustSampleItemVO
entrustSampleItemVO
:
experimentVOList
)
{
if
(
esiMap
.
containsKey
(
entrustSampleItemVO
.
getSampleCode
()))
{
List
<
EntrustSampleItem
>
listExp
=
esiMap
.
get
(
entrustSampleItemVO
.
getSampleCode
());
listExp
.
add
(
entrustSampleItemVO
);
esiMap
.
put
(
entrustSampleItemVO
.
getSampleCode
(),
listExp
);
}
else
{
esiMap
.
put
(
entrustSampleItemVO
.
getSampleCode
(),
listExp
);
}
else
{
List
<
EntrustSampleItem
>
listExp
=
new
ArrayList
<>();
listExp
.
add
(
entrustSampleItemVO
);
esiMap
.
put
(
entrustSampleItemVO
.
getSampleCode
(),
listExp
);
esiMap
.
put
(
entrustSampleItemVO
.
getSampleCode
(),
listExp
);
}
}
List
<
EntrustSampleItemIndexVO
>
indexList
=
entrustSampleItemIndexService
.
listVOByExpIds
(
expIdsList
);
Map
<
String
,
Long
>
stringMap
=
new
HashMap
<>();
for
(
EntrustSampleItemIndexVO
soilItemVO
:
indexList
)
{
stringMap
.
put
(
soilItemVO
.
getSampleCode
()
+
soilItemVO
.
getEntrustSampleItemId
()+
soilItemVO
.
getName
(),
soilItemVO
.
getId
());
Map
<
String
,
Long
>
stringMap
=
new
HashMap
<>();
for
(
EntrustSampleItemIndexVO
soilItemVO
:
indexList
)
{
stringMap
.
put
(
soilItemVO
.
getSampleCode
()
+
soilItemVO
.
getEntrustSampleItemId
()
+
soilItemVO
.
getName
(),
soilItemVO
.
getId
());
}
if
(
null
==
moreSheet
||
0
==
moreSheet
)
{
if
(
null
==
moreSheet
||
0
==
moreSheet
)
{
int
sampleBeginRow
=
template
.
getSampleBeginRow
();
int
sampleMergerNum
=
template
.
getSampleMergerNum
();
int
lastRowNum
=
sheet
.
getLastRowNum
();
Integer
sampleCol
=
null
;
Integer
sampleCol
=
null
;
for
(
OriginalTemplateConfig
config:
configList
)
{
if
(
"sampleCode"
.
equals
(
config
.
getDataAttribute
())){
for
(
OriginalTemplateConfig
config
:
configList
)
{
if
(
"sampleCode"
.
equals
(
config
.
getDataAttribute
()))
{
sampleCol
=
config
.
getColumnPlace
();
break
;
}
}
Integer
sampleStatus
=
null
;
Integer
sampleStatus
=
null
;
for
(
OriginalTemplateConfig
config
:
configList
)
{
if
(
"morphology"
.
equals
(
config
.
getDataAttribute
())){
for
(
OriginalTemplateConfig
config
:
configList
)
{
if
(
"morphology"
.
equals
(
config
.
getDataAttribute
()))
{
sampleStatus
=
config
.
getColumnPlace
();
break
;
}
}
Integer
shortName
=
null
;
for
(
OriginalTemplateConfig
config
:
configList
)
{
if
(
"shortName"
.
equals
(
config
.
getDataAttribute
())){
Integer
shortName
=
null
;
for
(
OriginalTemplateConfig
config
:
configList
)
{
if
(
"shortName"
.
equals
(
config
.
getDataAttribute
()))
{
shortName
=
config
.
getColumnPlace
();
break
;
}
...
...
@@ -351,12 +339,12 @@ public class OriginalTemplateServiceImpl extends BaseServiceImpl<OriginalTemplat
List
<
ItemCollectEntity
>
collectEntitiesList
=
new
ArrayList
<>();
for
(
OriginalTemplateConfig
config
:
configList
)
{
if
(
StringUtils
.
isBlank
(
config
.
getAttributeName
())){
for
(
OriginalTemplateConfig
config
:
configList
)
{
if
(
StringUtils
.
isBlank
(
config
.
getAttributeName
()))
{
continue
;
}
if
(
null
==
config
.
getColumnPlace
())
{
if
(
null
!=
config
.
getItemed
()
&&
config
.
getItemed
()
==
1
&&
null
!=
config
.
getMergeBegin
()
&&
null
!=
config
.
getMergeRowNum
())
{
if
(
null
==
config
.
getColumnPlace
())
{
if
(
null
!=
config
.
getItemed
()
&&
config
.
getItemed
()
==
1
&&
null
!=
config
.
getMergeBegin
()
&&
null
!=
config
.
getMergeRowNum
())
{
ItemCollectEntity
collectEntity
=
new
ItemCollectEntity
();
collectEntity
.
setItemName
(
config
.
getAttributeName
());
collectEntity
.
setColumnPlace
(
config
.
getMergeBegin
());
...
...
@@ -369,7 +357,7 @@ public class OriginalTemplateServiceImpl extends BaseServiceImpl<OriginalTemplat
}
continue
;
}
if
(
null
!=
config
.
getItemed
()
&&
config
.
getItemed
()
==
1
)
{
if
(
null
!=
config
.
getItemed
()
&&
config
.
getItemed
()
==
1
)
{
ItemCollectEntity
collectEntity
=
new
ItemCollectEntity
();
collectEntity
.
setItemName
(
config
.
getAttributeName
());
collectEntity
.
setColumnPlace
(
config
.
getColumnPlace
());
...
...
@@ -380,51 +368,47 @@ public class OriginalTemplateServiceImpl extends BaseServiceImpl<OriginalTemplat
}
}
if
(
CollectionUtils
.
isEmpty
(
collectEntitiesList
)){
if
(
CollectionUtils
.
isEmpty
(
collectEntitiesList
))
{
return
true
;
}
List
<
SoilItemCollectData
>
soilItemList
=
new
ArrayList
<>();
for
(
int
i
=
sampleBeginRow
;
i
<=
lastRowNum
;
i
+=
sampleMergerNum
)
{
for
(
int
i
=
sampleBeginRow
;
i
<=
lastRowNum
;
i
+=
sampleMergerNum
)
{
XSSFRow
xssfRow
=
sheet
.
getRow
(
i
);
if
(
null
==
xssfRow
){
if
(
null
==
xssfRow
)
{
continue
;
}
XSSFCell
sampleCodeCell
=
xssfRow
.
getCell
(
sampleCol
);
String
sampleCode
=
HSSFWorkbookUtil
.
getJavaValue
(
sampleCodeCell
).
toString
();
String
sampleOfStatus
=
""
;
if
(
null
!=
sampleStatus
){
String
sampleOfStatus
=
""
;
if
(
null
!=
sampleStatus
)
{
XSSFCell
sampleStatusCell
=
xssfRow
.
getCell
(
sampleStatus
);
sampleOfStatus
=
HSSFWorkbookUtil
.
getJavaValue
(
sampleStatusCell
).
toString
();
}
XSSFCell
shortNameCell
=
null
;
String
shortNames
=
null
;
if
(
null
!=
shortName
){
if
(
null
!=
shortName
)
{
shortNameCell
=
xssfRow
.
getCell
(
shortName
);
shortNames
=
HSSFWorkbookUtil
.
getJavaValue
(
shortNameCell
).
toString
();
}
for
(
ItemCollectEntity
collectEntity
:
collectEntitiesList
)
{
if
(
null
!=
collectEntity
.
getSingleElse
())
{
for
(
ItemCollectEntity
collectEntity
:
collectEntitiesList
)
{
if
(
null
!=
collectEntity
.
getSingleElse
())
{
XSSFRow
row
=
sheet
.
getRow
(
collectEntity
.
getItemMegerRow
());
if
(
null
==
row
){
if
(
null
==
row
)
{
continue
;
}
XSSFCell
cell
=
row
.
getCell
(
collectEntity
.
getColumnPlace
());
if
(
null
==
cell
){
if
(
null
==
cell
)
{
continue
;
}
String
valueElse
=
CellFormat
.
getInstance
(
cell
.
getCellStyle
().
getDataFormatString
()).
apply
(
cell
).
text
;
if
(
StringUtils
.
isNotBlank
(
valueElse
)){
if
(
StringUtils
.
isNotBlank
(
valueElse
))
{
SoilItemCollectData
soilItemCollectData
=
new
SoilItemCollectData
();
soilItemCollectData
.
setTestValue
(
valueElse
);
soilItemCollectData
.
setSampleCode
(
sampleCode
);
...
...
@@ -441,13 +425,13 @@ public class OriginalTemplateServiceImpl extends BaseServiceImpl<OriginalTemplat
String
value
=
""
;
try
{
value
=
CellFormat
.
getInstance
(
itemCell
.
getCellStyle
().
getDataFormatString
()).
apply
(
itemCell
).
text
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
value
=
HSSFWorkbookUtil
.
getJavaValue
(
itemCell
).
toString
();
}
String
itemName
=
collectEntity
.
getItemName
();
if
(
StringUtils
.
isBlank
(
value
))
{
if
(
StringUtils
.
isBlank
(
value
))
{
continue
;
}
SoilItemCollectData
soilItemCollectData
=
new
SoilItemCollectData
();
...
...
@@ -460,97 +444,89 @@ public class OriginalTemplateServiceImpl extends BaseServiceImpl<OriginalTemplat
soilItemCollectData
.
setItemName
(
itemName
);
soilItemList
.
add
(
soilItemCollectData
);
}
}
if
(
CollectionUtils
.
isEmpty
(
soilItemList
)){
if
(
CollectionUtils
.
isEmpty
(
soilItemList
))
{
return
true
;
}
List
<
EntrustSampleItemIndex
>
saveList
=
new
ArrayList
<>();
List
<
EntrustSampleItemIndex
>
updateList
=
new
ArrayList
<>();
for
(
SoilItemCollectData
soilItemCollectData
:
soilItemList
)
{
if
(
StringUtils
.
isBlank
(
soilItemCollectData
.
getTestValue
())){
for
(
SoilItemCollectData
soilItemCollectData
:
soilItemList
)
{
if
(
StringUtils
.
isBlank
(
soilItemCollectData
.
getTestValue
()))
{
continue
;
}
if
(
StringUtils
.
isBlank
(
soilItemCollectData
.
getSampleCode
())){
if
(
StringUtils
.
isBlank
(
soilItemCollectData
.
getSampleCode
()))
{
continue
;
}
if
(
"#VALUE!"
.
equals
(
soilItemCollectData
.
getTestValue
())){
if
(
"#VALUE!"
.
equals
(
soilItemCollectData
.
getTestValue
()))
{
continue
;
}
List
<
EntrustSampleItem
>
expList
=
esiMap
.
get
(
soilItemCollectData
.
getSampleCode
());
EntrustSampleItem
exp
=
null
;
EntrustSampleItem
exp
=
null
;
if
(
expList
.
size
()
==
1
)
{
if
(
expList
.
size
()
==
1
)
{
exp
=
expList
.
get
(
0
);
}
else
if
(
expList
.
size
()>
1
)
{
}
else
if
(
expList
.
size
()
>
1
)
{
String
shortNameTest
=
soilItemCollectData
.
getShortName
();
String
status
=
soilItemCollectData
.
getStatus
();
for
(
EntrustSampleItem
experiment
:
expList
)
{
if
(
shortNameTest
!=
null
&&
experiment
.
getName
().
contains
(
shortNameTest
))
{
for
(
EntrustSampleItem
experiment
:
expList
)
{
if
(
shortNameTest
!=
null
&&
experiment
.
getName
().
contains
(
shortNameTest
))
{
exp
=
experiment
;
}
else
if
(
null
!=
status
&&
experiment
.
getName
().
contains
(
status
))
{
}
else
if
(
null
!=
status
&&
experiment
.
getName
().
contains
(
status
))
{
exp
=
experiment
;
}
}
if
(
exp
==
null
&&
CollectionUtils
.
isNotEmpty
(
expList
))
{
if
(
exp
==
null
&&
CollectionUtils
.
isNotEmpty
(
expList
))
{
if
(
expList
.
size
()
>
0
)
{
for
(
EntrustSampleItem
experiment
:
expList
)
{
if
(
StringUtils
.
isBlank
(
status
)){
if
(
expList
.
size
()
>
0
)
{
for
(
EntrustSampleItem
experiment
:
expList
)
{
if
(
StringUtils
.
isBlank
(
status
))
{
exp
=
experiment
;
break
;
}
else
{
}
else
{
exp
=
experiment
;
}
}
}
}
}
if
(
null
==
exp
)
{
if
(
null
==
exp
)
{
continue
;
}
if
(
null
!=
exp
)
{
if
(
null
!=
exp
)
{
soilItemCollectData
.
setExpId
(
exp
.
getId
());
}
if
(
StringUtils
.
isBlank
(
soilItemCollectData
.
getItemName
())){
if
(
StringUtils
.
isBlank
(
soilItemCollectData
.
getItemName
()))
{
continue
;
}
if
(
StringUtils
.
isBlank
(
soilItemCollectData
.
getTestValue
())){
if
(
StringUtils
.
isBlank
(
soilItemCollectData
.
getTestValue
()))
{
continue
;
}
if
(
"#VALUE!"
.
equals
(
soilItemCollectData
.
getTestValue
())){
if
(
"#VALUE!"
.
equals
(
soilItemCollectData
.
getTestValue
()))
{
continue
;
}
if
(
"#NAME?"
.
equals
(
soilItemCollectData
.
getTestValue
())){
if
(
"#NAME?"
.
equals
(
soilItemCollectData
.
getTestValue
()))
{
continue
;
}
if
(
StringUtils
.
isBlank
(
soilItemCollectData
.
getSampleCode
())){
if
(
StringUtils
.
isBlank
(
soilItemCollectData
.
getSampleCode
()))
{
continue
;
}
String
key
=
soilItemCollectData
.
getSampleCode
()+
soilItemCollectData
.
getExpId
()+
soilItemCollectData
.
getItemName
();
if
(!
stringMap
.
containsKey
(
key
)){
String
key
=
soilItemCollectData
.
getSampleCode
()
+
soilItemCollectData
.
getExpId
()
+
soilItemCollectData
.
getItemName
();
if
(!
stringMap
.
containsKey
(
key
))
{
EntrustSampleItemIndex
soilItem
=
new
EntrustSampleItemIndex
();
soilItem
.
setEntrustSampleItemId
(
soilItemCollectData
.
getExpId
());
soilItem
.
setName
(
soilItemCollectData
.
getItemName
());
...
...
@@ -562,22 +538,20 @@ public class OriginalTemplateServiceImpl extends BaseServiceImpl<OriginalTemplat
soilItem
.
setUid
(
userId
);
entrustSampleItemIndexService
.
save
(
soilItem
);
// saveList.add(soilItem);
stringMap
.
put
(
soilItemCollectData
.
getSampleCode
()
+
soilItemCollectData
.
getExpId
()+
soilItemCollectData
.
getItemName
(),
soilItem
.
getId
());
stringMap
.
put
(
soilItemCollectData
.
getSampleCode
()
+
soilItemCollectData
.
getExpId
()
+
soilItemCollectData
.
getItemName
(),
soilItem
.
getId
());
}
else
{
}
else
{
EntrustSampleItemIndex
soilItem
=
new
EntrustSampleItemIndex
();
soilItem
.
setTestValue
(
soilItemCollectData
.
getTestValue
());
soilItem
.
setUnit
(
soilItemCollectData
.
getUnit
());
soilItem
.
setId
(
stringMap
.
get
(
soilItemCollectData
.
getSampleCode
()
+
soilItemCollectData
.
getExpId
()+
soilItemCollectData
.
getItemName
()));
soilItem
.
setId
(
stringMap
.
get
(
soilItemCollectData
.
getSampleCode
()
+
soilItemCollectData
.
getExpId
()
+
soilItemCollectData
.
getItemName
()));
updateList
.
add
(
soilItem
);
}
}
if
(
CollectionUtils
.
isNotEmpty
(
saveList
)){
if
(
CollectionUtils
.
isNotEmpty
(
saveList
))
{
entrustSampleItemIndexService
.
saveBatch
(
saveList
);
}
if
(
CollectionUtils
.
isNotEmpty
(
updateList
)){
if
(
CollectionUtils
.
isNotEmpty
(
updateList
))
{
entrustSampleItemIndexService
.
updateBatchById
(
updateList
);
}
...
...
@@ -586,18 +560,6 @@ public class OriginalTemplateServiceImpl extends BaseServiceImpl<OriginalTemplat
return
true
;
}
// 批量更新检测值
List
<
EntrustSampleItem
>
entrustSampleItemList
=
sampleItemVOList
.
stream
().
map
(
t
->
t
.
convert
(
EntrustSampleItem
.
class
)).
collect
(
Collectors
.
toList
());
entrustSampleItemService
.
updateBatchById
(
entrustSampleItemList
);
}
else
{
// 多 tab 页情况
// do nothings
}
return
true
;
}
private
void
fillTestValue
(
String
sampleCode
,
String
testValue
,
Long
userId
,
String
userName
,
List
<
EntrustSampleItemVO
>
sampleItemVOList
)
{
for
(
EntrustSampleItemVO
vo
:
sampleItemVOList
)
{
// 是否需要判断如果有值的话,不去覆盖值
...
...
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