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
ca681a49
Commit
ca681a49
authored
May 21, 2022
by
lijingjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改同事错误提交的记录;
修复中海油服相关bug;
parent
51bb80d9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
109 additions
and
52 deletions
+109
-52
EntrustSampleItemIndexMapper.java
...ervice/lims/hmhj/mapper/EntrustSampleItemIndexMapper.java
+8
-0
EntrustSampleItemMapper.java
...oud/service/lims/hmhj/mapper/EntrustSampleItemMapper.java
+2
-2
IEntrustSampleItemIndexService.java
...ice/lims/hmhj/service/IEntrustSampleItemIndexService.java
+2
-0
IEntrustSampleItemService.java
.../service/lims/hmhj/service/IEntrustSampleItemService.java
+4
-0
EntrustSampleItemIndexServiceImpl.java
.../hmhj/service/impl/EntrustSampleItemIndexServiceImpl.java
+10
-2
EntrustSampleItemServiceImpl.java
.../lims/hmhj/service/impl/EntrustSampleItemServiceImpl.java
+35
-12
EntrustSampleServiceImpl.java
...vice/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
+38
-36
EntrustSampleItemIndexMapper.xml
...in/resources/mapper/hmhj/EntrustSampleItemIndexMapper.xml
+10
-0
EntrustSampleItemMapper.xml
src/main/resources/mapper/hmhj/EntrustSampleItemMapper.xml
+0
-0
No files found.
src/main/java/com/patzn/cloud/service/lims/hmhj/mapper/EntrustSampleItemIndexMapper.java
View file @
ca681a49
...
@@ -54,6 +54,14 @@ public interface EntrustSampleItemIndexMapper extends BatchMapper<EntrustSampleI
...
@@ -54,6 +54,14 @@ public interface EntrustSampleItemIndexMapper extends BatchMapper<EntrustSampleI
List
<
EntrustSampleItemIndex
>
getInReportItemIndex
(
@Param
(
"sampleId"
)
Long
sampleId
);
List
<
EntrustSampleItemIndex
>
getInReportItemIndex
(
@Param
(
"sampleId"
)
Long
sampleId
);
/**
/**
* Gets in report item index.
* @param sampleIds
* @return
*/
@SqlParser
(
filter
=
true
)
List
<
EntrustSampleItemIndexVO
>
getInReportItemIndexBySampleIds
(
@Param
(
"sampleIds"
)
List
<
Long
>
sampleIds
);
/**
* Select index with item list.
* Select index with item list.
*
*
* @param rowBounds the row bounds
* @param rowBounds the row bounds
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/mapper/EntrustSampleItemMapper.java
View file @
ca681a49
...
@@ -36,7 +36,7 @@ public interface EntrustSampleItemMapper extends BatchMapper<EntrustSampleItem>
...
@@ -36,7 +36,7 @@ public interface EntrustSampleItemMapper extends BatchMapper<EntrustSampleItem>
List
<
EntrustSampleItemVO
>
selectVOListByIds
(
@Param
(
"ids"
)
Long
[]
ids
);
List
<
EntrustSampleItemVO
>
selectVOListByIds
(
@Param
(
"ids"
)
Long
[]
ids
);
List
<
EntrustSampleItemVO
>
selectByEntrustSampleId
(
@Param
(
"sampleId"
)
Long
sampleId
);
List
<
EntrustSampleItemVO
>
selectByEntrustSampleId
s
(
@Param
(
"sampleIds"
)
List
<
Long
>
sampleIds
);
List
<
EntrustSampleItemVO
>
selectByItemDeviate
(
RowBounds
rowBounds
,
@Param
(
"vo"
)
EntrustSampleItemVO
entrustSampleItem
);
List
<
EntrustSampleItemVO
>
selectByItemDeviate
(
RowBounds
rowBounds
,
@Param
(
"vo"
)
EntrustSampleItemVO
entrustSampleItem
);
...
@@ -61,7 +61,7 @@ public interface EntrustSampleItemMapper extends BatchMapper<EntrustSampleItem>
...
@@ -61,7 +61,7 @@ public interface EntrustSampleItemMapper extends BatchMapper<EntrustSampleItem>
List
<
SampleItemStatsVO
>
selectSampleItemStats
(
@Param
(
"vo"
)
SampleItemDTO
sampleItemDTO
);
List
<
SampleItemStatsVO
>
selectSampleItemStats
(
@Param
(
"vo"
)
SampleItemDTO
sampleItemDTO
);
List
<
EntrustSampleItemVO
>
listIndexReplaceItemBySampleId
(
@Param
(
"sampleId"
)
Long
sampleId
);
List
<
EntrustSampleItemVO
>
listIndexReplaceItemBySampleId
s
(
@Param
(
"sampleIds"
)
List
<
Long
>
sampleIds
);
List
<
EntrustSampleItemVO
>
selectUnfinishItemList
(
@Param
(
"vo"
)
QueryDTO
dto
);
List
<
EntrustSampleItemVO
>
selectUnfinishItemList
(
@Param
(
"vo"
)
QueryDTO
dto
);
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/IEntrustSampleItemIndexService.java
View file @
ca681a49
...
@@ -42,4 +42,6 @@ public interface IEntrustSampleItemIndexService extends IBaseService<EntrustSamp
...
@@ -42,4 +42,6 @@ public interface IEntrustSampleItemIndexService extends IBaseService<EntrustSamp
List
<
Map
<
String
,
Object
>>
listSampleItemIndex
(
List
<
Long
>
sampleIds
);
List
<
Map
<
String
,
Object
>>
listSampleItemIndex
(
List
<
Long
>
sampleIds
);
boolean
physicalDeleteByItemIds
(
List
<
Long
>
itemIds
);
boolean
physicalDeleteByItemIds
(
List
<
Long
>
itemIds
);
List
<
EntrustSampleItemIndexVO
>
getInReportItemIndexBySampleIds
(
List
<
Long
>
sampleIds
);
}
}
src/main/java/com/patzn/cloud/service/lims/hmhj/service/IEntrustSampleItemService.java
View file @
ca681a49
...
@@ -76,6 +76,8 @@ public interface IEntrustSampleItemService extends IBaseService<EntrustSampleIte
...
@@ -76,6 +76,8 @@ public interface IEntrustSampleItemService extends IBaseService<EntrustSampleIte
List
<
EntrustSampleItemVO
>
getListBySampleId
(
Long
sampleId
);
List
<
EntrustSampleItemVO
>
getListBySampleId
(
Long
sampleId
);
List
<
EntrustSampleItemVO
>
getListBySampleIds
(
List
<
Long
>
sampleIds
);
boolean
updateQualityJudge
(
Long
[]
ids
,
Account
account
);
boolean
updateQualityJudge
(
Long
[]
ids
,
Account
account
);
List
<
EntrustSampleItemVO
>
listMinStatusBySampleIds
(
List
<
Long
>
entrustIds
);
List
<
EntrustSampleItemVO
>
listMinStatusBySampleIds
(
List
<
Long
>
entrustIds
);
...
@@ -120,6 +122,8 @@ public interface IEntrustSampleItemService extends IBaseService<EntrustSampleIte
...
@@ -120,6 +122,8 @@ public interface IEntrustSampleItemService extends IBaseService<EntrustSampleIte
List
<
EntrustSampleItemVO
>
getSampleItemIndexList
(
Long
sampleId
);
List
<
EntrustSampleItemVO
>
getSampleItemIndexList
(
Long
sampleId
);
List
<
EntrustSampleItemVO
>
getSampleItemIndexList
(
List
<
Long
>
sampleIds
);
List
<
EntrustSampleItemIndexVO
>
getItemTestByEntrustId
(
Long
entrustIds
);
List
<
EntrustSampleItemIndexVO
>
getItemTestByEntrustId
(
Long
entrustIds
);
EntrustSampleItem
getItemModelBySampleId
(
Long
sampleId
);
EntrustSampleItem
getItemModelBySampleId
(
Long
sampleId
);
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSampleItemIndexServiceImpl.java
View file @
ca681a49
...
@@ -47,7 +47,7 @@ public class EntrustSampleItemIndexServiceImpl extends BaseServiceImpl<EntrustSa
...
@@ -47,7 +47,7 @@ public class EntrustSampleItemIndexServiceImpl extends BaseServiceImpl<EntrustSa
}
}
@Override
@Override
public
List
<
Map
<
String
,
Object
>>
listSampleItemIndex
(
List
<
Long
>
sampleIds
)
{
public
List
<
Map
<
String
,
Object
>>
listSampleItemIndex
(
List
<
Long
>
sampleIds
)
{
if
(
CollectionUtils
.
isEmpty
(
sampleIds
))
{
if
(
CollectionUtils
.
isEmpty
(
sampleIds
))
{
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
...
@@ -63,6 +63,14 @@ public class EntrustSampleItemIndexServiceImpl extends BaseServiceImpl<EntrustSa
...
@@ -63,6 +63,14 @@ public class EntrustSampleItemIndexServiceImpl extends BaseServiceImpl<EntrustSa
}
}
@Override
@Override
public
List
<
EntrustSampleItemIndexVO
>
getInReportItemIndexBySampleIds
(
List
<
Long
>
sampleIds
)
{
if
(
CollectionUtils
.
isEmpty
(
sampleIds
))
{
return
new
ArrayList
<>();
}
return
baseMapper
.
getInReportItemIndexBySampleIds
(
sampleIds
);
}
@Override
public
boolean
removeByIds
(
List
<
Long
>
ids
)
{
public
boolean
removeByIds
(
List
<
Long
>
ids
)
{
return
baseMapper
.
deleteBatchIds
(
ids
)
>
0
;
return
baseMapper
.
deleteBatchIds
(
ids
)
>
0
;
}
}
...
@@ -85,7 +93,7 @@ public class EntrustSampleItemIndexServiceImpl extends BaseServiceImpl<EntrustSa
...
@@ -85,7 +93,7 @@ public class EntrustSampleItemIndexServiceImpl extends BaseServiceImpl<EntrustSa
@Override
@Override
public
List
<
EntrustSampleItemIndexVO
>
listVOBySampleIds
(
List
<
Long
>
sampleIds
)
{
public
List
<
EntrustSampleItemIndexVO
>
listVOBySampleIds
(
List
<
Long
>
sampleIds
)
{
if
(
CollectionUtils
.
isEmpty
(
sampleIds
))
{
if
(
CollectionUtils
.
isEmpty
(
sampleIds
))
{
return
n
ull
;
return
n
ew
ArrayList
<>()
;
}
}
return
baseMapper
.
listBySampleIds
(
sampleIds
);
return
baseMapper
.
listBySampleIds
(
sampleIds
);
}
}
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSampleItemServiceImpl.java
View file @
ca681a49
...
@@ -301,15 +301,13 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -301,15 +301,13 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
RestAssert
.
fail
(
"请选择检测项目"
);
RestAssert
.
fail
(
"请选择检测项目"
);
return
page
;
return
page
;
}
}
List
<
EntrustSample
>
sampleList
=
entrustSampleService
.
list
(
Condition
.
create
().
eq
(
"entrust_id"
,
itemVO
.
getEntrustId
()));
// 优化:改为直接根据委托ID查询
/*List<EntrustSample> sampleList = entrustSampleService.list(Condition.create().eq("entrust_id", itemVO.getEntrustId()));
if (CollectionUtils.isEmpty(sampleList)) {
if (CollectionUtils.isEmpty(sampleList)) {
return page;
return page;
}
}
List<Long> sampleIds = sampleList.stream().map(BaseEntity::getId).collect(Collectors.toList());
List<Long> sampleIds = sampleList.stream().map(BaseEntity::getId).collect(Collectors.toList());
itemVO.setSampleIds(sampleIds);*/
itemVO
.
setSampleIds
(
sampleIds
);
itemVO
.
setCompanyId
(
LoginHelper
.
getAccount
().
getCompanyId
());
itemVO
.
setCompanyId
(
LoginHelper
.
getAccount
().
getCompanyId
());
return
page
.
setRecords
(
baseMapper
.
selectByItemLeftRight
(
page
,
itemVO
));
return
page
.
setRecords
(
baseMapper
.
selectByItemLeftRight
(
page
,
itemVO
));
}
}
...
@@ -568,6 +566,10 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -568,6 +566,10 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
return
baseMapper
.
selectVOListBySampleIdsAndIds
(
sampleIds
,
ids
);
return
baseMapper
.
selectVOListBySampleIdsAndIds
(
sampleIds
,
ids
);
}
}
private
List
<
EntrustSampleItemIndex
>
getIndicesBySampleId
(
Long
sampleId
,
List
<
EntrustSampleItemIndexVO
>
indexVOList
)
{
return
indexVOList
.
stream
().
filter
(
idx
->
Objects
.
equals
(
idx
.
getSampleId
(),
sampleId
)).
collect
(
Collectors
.
toList
());
}
@Override
@Override
public
OriginalRecord
saveExcelOriginalRecords
(
Long
[]
ids
,
Long
templateId
,
Account
account
)
{
public
OriginalRecord
saveExcelOriginalRecords
(
Long
[]
ids
,
Long
templateId
,
Account
account
)
{
RestAssert
.
fail
(
ArrayUtils
.
isEmpty
(
ids
),
"请选择试验项目!"
);
RestAssert
.
fail
(
ArrayUtils
.
isEmpty
(
ids
),
"请选择试验项目!"
);
...
@@ -645,9 +647,11 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -645,9 +647,11 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
}
}
List
<
EntrustSampleVO
>
sampleVOList
=
new
ArrayList
<>(
sampleList
.
size
());
List
<
EntrustSampleVO
>
sampleVOList
=
new
ArrayList
<>(
sampleList
.
size
());
// 优化:批量获取检测项目指标
List
<
EntrustSampleItemIndexVO
>
itemIndexList
=
entrustSampleItemIndexService
.
listVOBySampleIds
(
new
ArrayList
<>(
sampleIdsList
));
for
(
EntrustSample
sample
:
sampleList
)
{
for
(
EntrustSample
sample
:
sampleList
)
{
EntrustSampleVO
vo
=
sample
.
convert
(
EntrustSampleVO
.
class
);
EntrustSampleVO
vo
=
sample
.
convert
(
EntrustSampleVO
.
class
);
vo
.
setIndexList
(
entrustSampleItemIndexService
.
listItemBySampleIds
(
Collections
.
singletonList
(
sample
.
getId
())
));
vo
.
setIndexList
(
getIndicesBySampleId
(
sample
.
getId
(),
itemIndexList
));
sampleVOList
.
add
(
vo
);
sampleVOList
.
add
(
vo
);
}
}
...
@@ -730,7 +734,7 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -730,7 +734,7 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
if
(
null
!=
template
.
getBlankBeginNum
()
&&
blank
.
size
()
>
0
)
{
if
(
null
!=
template
.
getBlankBeginNum
()
&&
blank
.
size
()
>
0
)
{
RestAssert
.
fail
(
"所选原始记录模板中已配置空白开始行,请删除空白标样!"
);
RestAssert
.
fail
(
"所选原始记录模板中已配置空白开始行,请删除空白标样!"
);
}
}
voList
=
voList
.
stream
().
sorted
(
Comparator
.
comparing
(
item
->
item
.
getOrderBy
()
)).
collect
(
Collectors
.
toList
());
voList
=
voList
.
stream
().
sorted
(
Comparator
.
comparing
(
EntrustSampleItemVO:
:
getOrderBy
)).
collect
(
Collectors
.
toList
());
Entrust
entrust
=
entrustService
.
getById
(
voList
.
get
(
0
).
getEntrustId
());
Entrust
entrust
=
entrustService
.
getById
(
voList
.
get
(
0
).
getEntrustId
());
InputStream
io
=
ossClient
.
download
(
template
.
getObjectKey
());
InputStream
io
=
ossClient
.
download
(
template
.
getObjectKey
());
if
(
null
==
io
)
{
if
(
null
==
io
)
{
...
@@ -799,9 +803,12 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -799,9 +803,12 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
}
}
List
<
EntrustSampleVO
>
sampleVOList
=
new
ArrayList
<>(
sampleList
.
size
());
List
<
EntrustSampleVO
>
sampleVOList
=
new
ArrayList
<>(
sampleList
.
size
());
// 优化:批量获取检测项目指标
List
<
EntrustSampleItemIndexVO
>
itemIndexList
=
entrustSampleItemIndexService
.
listVOBySampleIds
(
new
ArrayList
<>(
sampleIdsList
));
for
(
EntrustSample
sample
:
sampleList
)
{
for
(
EntrustSample
sample
:
sampleList
)
{
EntrustSampleVO
vo
=
sample
.
convert
(
EntrustSampleVO
.
class
);
EntrustSampleVO
vo
=
sample
.
convert
(
EntrustSampleVO
.
class
);
vo
.
setIndexList
(
entrustSampleItemIndexService
.
listItemBySampleIds
(
Collections
.
singletonList
(
sample
.
getId
())));
// 取值时,直接过滤获取
vo
.
setIndexList
(
getIndicesBySampleId
(
sample
.
getId
(),
itemIndexList
));
sampleVOList
.
add
(
vo
);
sampleVOList
.
add
(
vo
);
}
}
...
@@ -1098,9 +1105,17 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -1098,9 +1105,17 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
@Override
@Override
public
List
<
EntrustSampleItemVO
>
getListBySampleId
(
Long
sampleId
)
{
public
List
<
EntrustSampleItemVO
>
getListBySampleId
(
Long
sampleId
)
{
if
(
null
==
sampleId
)
{
if
(
null
==
sampleId
)
{
return
n
ull
;
return
n
ew
ArrayList
<>()
;
}
}
return
baseMapper
.
selectByEntrustSampleId
(
sampleId
);
return
getListBySampleIds
(
Collections
.
singletonList
(
sampleId
));
}
@Override
public
List
<
EntrustSampleItemVO
>
getListBySampleIds
(
List
<
Long
>
sampleIds
)
{
if
(
CollectionUtils
.
isEmpty
(
sampleIds
))
{
return
new
ArrayList
<>();
}
return
baseMapper
.
selectByEntrustSampleIds
(
sampleIds
);
}
}
private
boolean
isNumber
(
String
testValueStr
)
{
private
boolean
isNumber
(
String
testValueStr
)
{
...
@@ -1492,9 +1507,17 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -1492,9 +1507,17 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
@Override
@Override
public
List
<
EntrustSampleItemVO
>
getSampleItemIndexList
(
Long
sampleId
)
{
public
List
<
EntrustSampleItemVO
>
getSampleItemIndexList
(
Long
sampleId
)
{
if
(
null
==
sampleId
)
{
if
(
null
==
sampleId
)
{
return
null
;
return
new
ArrayList
<>();
}
return
getSampleItemIndexList
(
Collections
.
singletonList
(
sampleId
));
}
@Override
public
List
<
EntrustSampleItemVO
>
getSampleItemIndexList
(
List
<
Long
>
sampleIds
)
{
if
(
CollectionUtils
.
isEmpty
(
sampleIds
))
{
return
new
ArrayList
<>();
}
}
return
baseMapper
.
listIndexReplaceItemBySampleId
(
sampleId
);
return
baseMapper
.
listIndexReplaceItemBySampleId
s
(
sampleIds
);
}
}
@Override
@Override
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
View file @
ca681a49
...
@@ -396,7 +396,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
...
@@ -396,7 +396,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleList
),
String
.
format
(
"编号为【%s】的委托下样品为空"
,
entrust
.
getCode
()));
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleList
),
String
.
format
(
"编号为【%s】的委托下样品为空"
,
entrust
.
getCode
()));
logger
.
error
(
"样品数量:{}"
,
sampleList
.
size
());
logger
.
error
(
"样品数量:{}"
,
sampleList
.
size
());
Long
[]
sampleIds
=
sampleList
.
stream
().
map
(
t
->
t
.
getId
()).
toArray
(
size
->
new
Long
[
size
]);
Long
[]
sampleIds
=
sampleList
.
stream
().
map
(
t
->
t
.
getId
()).
toArray
(
size
->
new
Long
[
size
]);
prints
(
"样品的下一级流程"
,
nextFlowStatus
);
prints
(
"样品的下一级流程"
,
nextFlowStatus
);
//
//
EntrustSample
updateSample
=
new
EntrustSample
();
EntrustSample
updateSample
=
new
EntrustSample
();
EntrustSampleItem
updateItem
=
new
EntrustSampleItem
();
EntrustSampleItem
updateItem
=
new
EntrustSampleItem
();
...
@@ -446,8 +446,8 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
...
@@ -446,8 +446,8 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
itemStatus
=
EntrustSampleItemStatusEnum
.
END
;
itemStatus
=
EntrustSampleItemStatusEnum
.
END
;
}
}
prints
(
"样品即将更新"
,
sampleStatus
);
prints
(
"样品即将更新"
,
sampleStatus
);
prints
(
"项目即将更新"
,
itemStatus
);
prints
(
"项目即将更新"
,
itemStatus
);
// 哪一级别
// 哪一级别
int
whichLevel
=
1
;
int
whichLevel
=
1
;
...
@@ -886,7 +886,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
...
@@ -886,7 +886,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
public
boolean
makeReport
(
ReportDTO
dto
,
Account
account
)
{
public
boolean
makeReport
(
ReportDTO
dto
,
Account
account
)
{
Long
[]
ids
=
dto
.
getSampleIds
();
Long
[]
ids
=
dto
.
getSampleIds
();
RestAssert
.
fail
(
ArrayUtils
.
isEmpty
(
ids
),
"请选择要生成报告的样品"
);
RestAssert
.
fail
(
ArrayUtils
.
isEmpty
(
ids
),
"请选择要生成报告的样品"
);
List
<
Long
>
sampleIds
=
Arrays
.
asList
(
ids
);
Long
templateId
=
dto
.
getTemplateId
();
Long
templateId
=
dto
.
getTemplateId
();
RestAssert
.
fail
(
null
==
templateId
,
"请选择报告模板!"
);
RestAssert
.
fail
(
null
==
templateId
,
"请选择报告模板!"
);
...
@@ -897,17 +897,25 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
...
@@ -897,17 +897,25 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
List
<
EntrustSample
>
sampleList
=
super
.
list
(
Condition
.
create
().
in
(
"id"
,
ids
));
List
<
EntrustSample
>
sampleList
=
super
.
list
(
Condition
.
create
().
in
(
"id"
,
ids
));
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleList
),
"样品不存在请确认!"
);
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleList
),
"样品不存在请确认!"
);
// 委托信息
Long
entrustId
=
sampleList
.
get
(
0
).
getEntrustId
();
Long
entrustId
=
sampleList
.
get
(
0
).
getEntrustId
();
Entrust
entrust
=
entrustService
.
getById
(
entrustId
);
Entrust
entrust
=
entrustService
.
getById
(
entrustId
);
// 报告模板
EntrustReportTemplate
sysFileTemplate
=
entrustReportTemplateService
.
getById
(
templateId
);
EntrustReportTemplate
sysFileTemplate
=
entrustReportTemplateService
.
getById
(
templateId
);
// 样品名称集合
Set
<
String
>
sampleNameSet
=
new
HashSet
<>();
Set
<
String
>
sampleNameSet
=
new
HashSet
<>();
// 样品检测项目集合
List
<
EntrustSampleItemVO
>
sampleItemVOList
=
entrustSampleItemService
.
listBySampleIds
(
ids
);
// 样品VOList
List
<
EntrustSampleVO
>
sampleVOList
=
new
ArrayList
<>();
// 重构:循环处理样品信息
for
(
EntrustSample
sample
:
sampleList
)
{
for
(
EntrustSample
sample
:
sampleList
)
{
sampleNameSet
.
add
(
sample
.
getName
());
sampleNameSet
.
add
(
sample
.
getName
());
EntrustSampleVO
vo
=
sample
.
convert
(
EntrustSampleVO
.
class
);
// 过滤出对应样品的检测项目
vo
.
setItemVOList
(
sampleItemVOList
.
stream
().
filter
(
i
->
Objects
.
equals
(
i
.
getEntrustSampleId
(),
sample
.
getId
())).
collect
(
Collectors
.
toList
()));
sampleVOList
.
add
(
vo
);
}
}
String
sampleName
=
StringHandleUtils
.
join
(
sampleNameSet
);
String
sampleName
=
StringHandleUtils
.
join
(
sampleNameSet
);
...
@@ -929,10 +937,6 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
...
@@ -929,10 +937,6 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
}
}
XWPFDocument
baseDoc
=
xwpfTemplate
.
getXWPFDocument
();
XWPFDocument
baseDoc
=
xwpfTemplate
.
getXWPFDocument
();
List
<
EntrustSampleItemVO
>
sampleItemVOList
=
entrustSampleItemService
.
listBySampleIds
(
ids
);
List
<
XWPFTable
>
tableList
=
baseDoc
.
getTables
();
List
<
XWPFTable
>
tableList
=
baseDoc
.
getTables
();
for
(
XWPFTable
xwpfTable
:
tableList
)
{
for
(
XWPFTable
xwpfTable
:
tableList
)
{
String
text
=
xwpfTable
.
getText
();
String
text
=
xwpfTable
.
getText
();
...
@@ -966,21 +970,21 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
...
@@ -966,21 +970,21 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
}
}
}
else
if
(
sysFileTemplate
.
getObjectKey
().
contains
(
".xlsx"
))
{
}
else
if
(
sysFileTemplate
.
getObjectKey
().
contains
(
".xlsx"
))
{
List
<
EntrustSampleItemVO
>
sampleItemVOList
=
entrustSampleItemService
.
listBySampleIds
(
ids
);
// 指标信息,包含样品ID
List
<
EntrustSampleItemIndexVO
>
indexVOList
=
new
ArrayList
<>();
List
<
EntrustSampleVO
>
sampleVOList
=
new
ArrayList
<>();
// 是否获取项目中的指标
for
(
EntrustSample
sample
:
sampleList
)
{
boolean
isInReportIndex
=
sysFileTemplate
.
getTemplateSampleNum
()
>=
sampleVOList
.
size
();
EntrustSampleVO
vo
=
sample
.
convert
(
EntrustSampleVO
.
class
);
if
(
isInReportIndex
)
{
indexVOList
=
entrustSampleItemIndexService
.
getInReportItemIndexBySampleIds
(
sampleIds
);
List
<
EntrustSampleItemVO
>
sampleItemList
=
new
ArrayList
<>();
}
else
{
for
(
EntrustSampleItemVO
itemVO
:
sampleItemVOList
)
{
// 其他情况的指标
if
(
sample
.
getId
().
equals
(
itemVO
.
getEntrustSampleId
()))
{
indexVOList
=
entrustSampleItemIndexService
.
listVOBySampleIds
(
sampleIds
);
sampleItemList
.
add
(
itemVO
);
}
}
vo
.
setItemVOList
(
sampleItemList
);
sampleVOList
.
add
(
vo
);
}
}
// 循环处理指标数据
for
(
EntrustSampleVO
vo
:
sampleVOList
)
{
vo
.
setIndexList
(
indexVOList
.
stream
().
filter
(
i
->
Objects
.
equals
(
i
.
getSampleId
(),
vo
.
getId
())).
collect
(
Collectors
.
toList
()));
}
InputStream
io
=
ossClient
.
download
(
sysFileTemplate
.
getObjectKey
());
InputStream
io
=
ossClient
.
download
(
sysFileTemplate
.
getObjectKey
());
XSSFWorkbook
xssfWorkbook
=
null
;
XSSFWorkbook
xssfWorkbook
=
null
;
try
{
try
{
...
@@ -1010,17 +1014,17 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
...
@@ -1010,17 +1014,17 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
int
sampleMergerNum
=
sysFileTemplate
.
getSampleMergerNum
();
int
sampleMergerNum
=
sysFileTemplate
.
getSampleMergerNum
();
int
templateSampleNum
=
sysFileTemplate
.
getTemplateSampleNum
();
int
templateSampleNum
=
sysFileTemplate
.
getTemplateSampleNum
();
if
(
templateSampleNum
>=
sampleVOList
.
size
())
{
if
(
templateSampleNum
>=
sampleVOList
.
size
())
{
// 此节点再进行查询指标数据
Integer
beginRow
=
sysFileTemplate
.
getSampleBeginRow
();
Integer
beginRow
=
sysFileTemplate
.
getSampleBeginRow
();
HashMap
<
Long
,
List
<
EntrustSampleItemIndex
>>
indexMap
=
new
HashMap
<>();
HashMap
<
Long
,
List
<
EntrustSampleItemIndex
>>
indexMap
=
new
HashMap
<>();
for
(
EntrustSampleVO
vo
:
sampleVOList
)
{
for
(
EntrustSampleVO
vo
:
sampleVOList
)
{
// List<EntrustSampleItemIndex> indexList = entrustSampleItemIndexService.listBySampleId(vo.getId());
/*List<EntrustSampleItemIndex> indexList = new ArrayList<>();
List
<
EntrustSampleItemIndex
>
indexList
=
new
ArrayList
<>();
if (indexMap.containsKey(vo.getId())) {
if (indexMap.containsKey(vo.getId())) {
indexList = indexMap.get(vo.getId());
indexList = indexMap.get(vo.getId());
} else {
} else {
indexList = entrustSampleItemIndexService.getInReportItemIndex(vo.getId());
indexList = entrustSampleItemIndexService.getInReportItemIndex(vo.getId());
}
}
vo
.
setIndexList
(
indexList
);
vo.setIndexList(indexList);
*/
XSSFRow
xssfRow
=
sheetOne
.
getRow
(
beginRow
);
XSSFRow
xssfRow
=
sheetOne
.
getRow
(
beginRow
);
for
(
EntrustReportTemplateConfig
config
:
configList
)
{
for
(
EntrustReportTemplateConfig
config
:
configList
)
{
if
(
null
!=
config
.
getSheetNum
()
&&
config
.
getSheetNum
()
!=
k
)
{
if
(
null
!=
config
.
getSheetNum
()
&&
config
.
getSheetNum
()
!=
k
)
{
...
@@ -1056,8 +1060,8 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
...
@@ -1056,8 +1060,8 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
List
<
EntrustSampleVO
>
sampleVOListIndex
=
listList
.
get
(
k
);
List
<
EntrustSampleVO
>
sampleVOListIndex
=
listList
.
get
(
k
);
for
(
EntrustSampleVO
vo
:
sampleVOListIndex
)
{
for
(
EntrustSampleVO
vo
:
sampleVOListIndex
)
{
List
<
EntrustSampleItemIndex
>
indexList
=
getIndexList
(
vo
.
getId
());
/*
List<EntrustSampleItemIndex> indexList = getIndexList(vo.getId());
vo
.
setIndexList
(
indexList
);
vo.setIndexList(indexList);
*/
XSSFSheet
sheetOneIndex
=
xssfWorkbook
.
getSheetAt
(
k
);
XSSFSheet
sheetOneIndex
=
xssfWorkbook
.
getSheetAt
(
k
);
...
@@ -1102,8 +1106,8 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
...
@@ -1102,8 +1106,8 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
int
sn
=
1
;
int
sn
=
1
;
for
(
EntrustSampleVO
vo
:
sampleVOList
)
{
for
(
EntrustSampleVO
vo
:
sampleVOList
)
{
XSSFRow
xssfRow
=
sheetOne
.
getRow
(
beginRow
);
XSSFRow
xssfRow
=
sheetOne
.
getRow
(
beginRow
);
List
<
EntrustSampleItemIndex
>
indexList
=
getIndexList
(
vo
.
getId
());
/*
List<EntrustSampleItemIndex> indexList = getIndexList(vo.getId());
vo
.
setIndexList
(
indexList
);
vo.setIndexList(indexList);
*/
for
(
EntrustReportTemplateConfig
config
:
configList
)
{
for
(
EntrustReportTemplateConfig
config
:
configList
)
{
if
(
null
!=
config
.
getSheetNum
()
&&
config
.
getSheetNum
()
!=
k
)
{
if
(
null
!=
config
.
getSheetNum
()
&&
config
.
getSheetNum
()
!=
k
)
{
continue
;
continue
;
...
@@ -1146,8 +1150,6 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
...
@@ -1146,8 +1150,6 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
}
}
}
}
}
}
}
}
}
}
String
generated
=
entrust
.
getCode
();
String
generated
=
entrust
.
getCode
();
...
...
src/main/resources/mapper/hmhj/EntrustSampleItemIndexMapper.xml
View file @
ca681a49
...
@@ -56,6 +56,16 @@
...
@@ -56,6 +56,16 @@
where ii.deleted = 0 and s.id = #{sampleId}
where ii.deleted = 0 and s.id = #{sampleId}
</select>
</select>
<select
id=
"getInReportItemIndexBySampleIds"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustSampleItemIndexVO"
>
select ii.*,i.entrust_sample_id "sample_id"
from entrust_sample_item_index ii
join entrust_sample_item i on ii.entrust_sample_item_id = i.id and i.in_report = 1 and i.deleted = 0
where ii.deleted = 0 and i.entrust_sample_id in
<foreach
collection=
"sampleIds"
item=
"sampleId"
separator=
","
open=
"("
close=
")"
index=
"idx"
>
#{sampleId}
</foreach>
</select>
<select
id=
"selectIndexWithItem"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustSampleItemIndexVO"
>
<select
id=
"selectIndexWithItem"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustSampleItemIndexVO"
>
select
select
i.id "itemId",i.name "itemName",i.standard,q.judge_standard,
i.id "itemId",i.name "itemName",i.standard,q.judge_standard,
...
...
src/main/resources/mapper/hmhj/EntrustSampleItemMapper.xml
View file @
ca681a49
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment