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
c250e915
Commit
c250e915
authored
Jul 14, 2021
by
lijingjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改样品判定逻辑;
parent
ac8d44c8
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
171 additions
and
16 deletions
+171
-16
EntrustSampleMapper.java
...n/cloud/service/lims/hmhj/mapper/EntrustSampleMapper.java
+3
-0
IEntrustSampleItemService.java
.../service/lims/hmhj/service/IEntrustSampleItemService.java
+0
-1
IEntrustSampleService.java
...loud/service/lims/hmhj/service/IEntrustSampleService.java
+6
-0
EntrustSampleItemServiceImpl.java
.../lims/hmhj/service/impl/EntrustSampleItemServiceImpl.java
+83
-15
EntrustSampleServiceImpl.java
...vice/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
+26
-0
EntrustSampleItemIndexMapper.xml
...in/resources/mapper/hmhj/EntrustSampleItemIndexMapper.xml
+1
-0
EntrustSampleMapper.xml
src/main/resources/mapper/hmhj/EntrustSampleMapper.xml
+52
-0
No files found.
src/main/java/com/patzn/cloud/service/lims/hmhj/mapper/EntrustSampleMapper.java
View file @
c250e915
...
...
@@ -28,6 +28,8 @@ public interface EntrustSampleMapper extends BatchMapper<EntrustSample> {
List
<
EntrustSampleVO
>
selectVOList
(
RowBounds
rowBounds
,
@Param
(
"vo"
)
EntrustSampleVO
entrustSample
);
List
<
EntrustSampleVO
>
selectListWithRelation
(
@Param
(
"vo"
)
EntrustSampleVO
entrustSample
);
List
<
EntrustSampleVO
>
selectMinStatusByEntrustIds
(
@Param
(
"entrustIds"
)
List
<
Long
>
entrustIds
);
List
<
EntrustSampleVO
>
selectTestResultQuery
(
RowBounds
rowBounds
,
@Param
(
"vo"
)
EntrustSampleVO
entrustSample
);
...
...
@@ -37,4 +39,5 @@ public interface EntrustSampleMapper extends BatchMapper<EntrustSample> {
List
<
ElectrolyteRatioStatsVO
>
selectElectrolyteRatioStats
(
@Param
(
"vo"
)
QueryDTO
queryDTO
);
List
<
PMakeFeStatsVO
>
selectPMakeFeStats
(
@Param
(
"vo"
)
QueryDTO
queryDTO
);
}
src/main/java/com/patzn/cloud/service/lims/hmhj/service/IEntrustSampleItemService.java
View file @
c250e915
...
...
@@ -78,7 +78,6 @@ public interface IEntrustSampleItemService extends IBaseService<EntrustSampleIte
public
boolean
isAllocatedByEntrustId
(
Long
entrustId
);
Page
<
LmsUserRelGroupVO
>
pageGroupUser
(
Page
<
LmsUserRelGroupVO
>
page
,
LmsUserRelGroup
soilExperiment
);
List
<
TesterWorkloadStatsVO
>
getTesterWorkloadStatusQuery
(
QueryDTO
queryDTO
);
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/IEntrustSampleService.java
View file @
c250e915
...
...
@@ -76,6 +76,10 @@ public interface IEntrustSampleService extends IBaseService<EntrustSample> {
List
<
EntrustSample
>
getByEntrustId
(
Long
entrustId
);
List
<
EntrustSampleVO
>
getVOListByEntrustId
(
Long
entrustId
);
List
<
EntrustSampleVO
>
getVOListByIds
(
List
<
Long
>
sampleIdList
);
List
<
Long
>
getIdsByEntrustId
(
Long
entrustId
);
boolean
updateSample
(
EntrustSample
entrustSample
,
String
source
,
Account
account
);
...
...
@@ -91,4 +95,6 @@ public interface IEntrustSampleService extends IBaseService<EntrustSample> {
boolean
updateSampleCodeByEntrustId
(
Long
entrustId
,
int
level
);
boolean
updateSampleCodeByIds
(
List
<
Long
>
sampleIdsList
,
int
level
);
List
<
EntrustSampleVO
>
selectListWithRelation
(
EntrustSampleVO
entrustSampleVO
);
}
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSampleItemServiceImpl.java
View file @
c250e915
...
...
@@ -289,6 +289,13 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
changeExcelToPdf
(
ids
,
list
);
}
});
// 提交后执行组合判定
executor1
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
updateComposeJudgeByTestValue
(
entrustId
);
}
});
return
true
;
}
...
...
@@ -527,7 +534,6 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
}
OriginalFactory
factory
=
new
OriginalFactory
(
template
,
voList
,
entrust
,
configList
,
xssfWorkbook
);
Operation
operation
=
factory
.
getOperation
();
if
(
null
!=
operation
)
{
...
...
@@ -714,21 +720,32 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
public
boolean
updateQualityJudge
(
Long
[]
ids
,
Account
account
)
{
RestAssert
.
fail
(
null
==
ids
||
ids
.
length
==
0
,
"样品编号不能为空"
);
// ==
List
<
EntrustSample
>
sampleList
=
entrustSampleService
.
getBatchIds
(
Arrays
.
asList
(
ids
));
List
<
EntrustSampleVO
>
sampleList
=
entrustSampleService
.
getVOListByIds
(
Arrays
.
asList
(
ids
));
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleList
),
"样品信息不能为空"
);
//其他稀有元素
List
<
String
>
otherYsList
=
Arrays
.
asList
(
"Mn"
,
"V"
,
"Ni"
);
for
(
EntrustSample
sample
:
sampleList
)
{
for
(
EntrustSampleVO
sampleVO
:
sampleList
)
{
// 若为此标准,需要判断是否需要过滤掉稀有元素的判断
boolean
isSpecStandard
=
"GB/T 1196 2017"
.
equalsIgnoreCase
(
sampleVO
.
getStandardCode
());
// 获取检测项目及指标数据
List
<
EntrustSampleItemIndexVO
>
sampleItemIndexList
=
entrustSampleItemIndexService
.
listVOBySampleIds
(
Lists
.
newArrayList
(
sample
.
getId
()));
List
<
EntrustSampleItemIndexVO
>
sampleItemIndexList
=
entrustSampleItemIndexService
.
listVOBySampleIds
(
Arrays
.
asList
(
sampleVO
.
getId
()));
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleItemIndexList
),
"样品检测项目及内容不能为空"
);
// 计算合计值
BigDecimal
totalValue
=
sampleItemIndexList
.
stream
().
map
(
t
->
new
BigDecimal
(
t
.
getTestValue
())).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
totalValue
=
sampleItemIndexList
.
stream
().
map
(
t
->
{
// 符合此条件,需要判断是否此标准且为稀有元素且值小于0.01即可忽略为0
if
(
isSpecStandard
&&
otherYsList
.
contains
(
t
.
getName
())
&&
Double
.
parseDouble
(
t
.
getTestValue
())
<
0.01
)
{
return
BigDecimal
.
ZERO
;
}
return
new
BigDecimal
(
t
.
getTestValue
());
}).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
double
total
=
totalValue
.
doubleValue
();
// 获取检测项目值对象
Map
<
String
,
Double
>
itemDataMap
=
sampleItemIndexList
.
stream
().
collect
(
Collectors
.
toMap
(
EntrustSampleItemIndexVO:
:
get
Item
Name
,
t
->
Double
.
parseDouble
(
t
.
getTestValue
())));
Map
<
String
,
Double
>
itemDataMap
=
sampleItemIndexList
.
stream
().
collect
(
Collectors
.
toMap
(
EntrustSampleItemIndexVO:
:
getName
,
t
->
Double
.
parseDouble
(
t
.
getTestValue
())));
// 获得产品标准信息
GradingStandard
standard
=
gradingStandardService
.
getById
(
sample
.
getProductStandardId
());
GradingStandard
standard
=
gradingStandardService
.
getById
(
sample
VO
.
getProductStandardId
());
RestAssert
.
fail
(
null
==
standard
,
"产品标准不能为空"
);
// 是否组合判定
boolean
isComposeJudgment
=
null
!=
standard
.
getComposeJudge
()
&&
1
==
standard
.
getComposeJudge
().
intValue
();
...
...
@@ -751,17 +768,17 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
if
(
i
<
gradingProductList
.
size
()
-
1
)
{
continue
;
}
return
updateJudgeNoPass
(
sample
,
account
);
return
updateJudgeNoPass
(
sample
VO
,
account
);
}
// 符合合计,若不为组合判定,则直接判定合格
if
(!
isComposeJudgment
)
{
// continue;
// 样品判定合格
sample
.
setOkJudge
(
"合格"
).
setJudger
(
account
.
getUserName
()).
setJudgerId
(
account
.
getUserId
())
sample
VO
.
setOkJudge
(
"合格"
).
setJudger
(
account
.
getUserName
()).
setJudgerId
(
account
.
getUserId
())
.
setJudgeCheckTime
(
new
Date
()).
setJudgeStatus
(
0
).
setJudgeProgress
(
0
)
.
setSampleGrading
(
product
.
getProductGrade
());
return
entrustSampleService
.
updateById
(
sample
);
return
entrustSampleService
.
updateById
(
sample
VO
.
convert
(
EntrustSample
.
class
)
);
}
// 若为组合判定,比较单个大小是否都符合
...
...
@@ -774,8 +791,16 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
RestAssert
.
fail
(
StringUtils
.
isBlank
(
t
.
getDecisionSymbol
()),
"产品等级下产品检测项目比较符为空"
);
RestAssert
.
fail
(
StringUtils
.
isBlank
(
t
.
getLimitValue
()),
"产品等级下产品检测项目限制值为空"
);
});
List
<
GradingItem
>
gradingItems
=
gradingItemList
.
stream
().
filter
(
t
->
itemDataMap
.
containsKey
(
t
.
getName
())).
collect
(
Collectors
.
toList
());
// 过滤 只要名称包含
List
<
GradingItem
>
gradingItems
=
gradingItemList
.
stream
().
filter
(
t
->
{
//
for
(
Map
.
Entry
entry
:
itemDataMap
.
entrySet
())
{
if
(
entry
.
getKey
().
toString
().
contains
(
t
.
getName
())
&&
StringUtils
.
isNotBlank
(
t
.
getLimitValue
()))
{
return
true
;
}
}
return
false
;
}).
collect
(
Collectors
.
toList
());
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
gradingItems
),
"样品下设定组合判定的检测项目不存在"
);
// 获取失败数量
...
...
@@ -791,15 +816,15 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
}
// 不存在下一个判定标准,直接不合格
else
{
return
updateJudgeNoPass
(
sample
,
account
);
return
updateJudgeNoPass
(
sample
VO
.
convert
(
EntrustSample
.
class
)
,
account
);
}
}
// 样品判定合格
sample
.
setOkJudge
(
"合格"
).
setJudger
(
account
.
getUserName
()).
setJudgerId
(
account
.
getUserId
())
sample
VO
.
setOkJudge
(
"合格"
).
setJudger
(
account
.
getUserName
()).
setJudgerId
(
account
.
getUserId
())
.
setJudgeCheckTime
(
new
Date
()).
setJudgeStatus
(
0
).
setJudgeProgress
(
0
)
.
setSampleGrading
(
product
.
getProductGrade
());
return
entrustSampleService
.
updateById
(
sample
);
return
entrustSampleService
.
updateById
(
sample
VO
.
convert
(
EntrustSample
.
class
)
);
}
}
return
true
;
...
...
@@ -888,4 +913,47 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
}
return
baseMapper
.
updateItemJudgeByEntrustId
(
entrustId
);
}
/**
* 处理 原铝等标准为
*
* @param entrustId
*/
private
void
updateComposeJudgeByTestValue
(
Long
entrustId
)
{
// GB/T 1196 2017
List
<
EntrustSampleVO
>
entrustSamples
=
entrustSampleService
.
getVOListByEntrustId
(
entrustId
);
if
(
CollectionUtils
.
isEmpty
(
entrustSamples
))
{
return
;
}
EntrustSampleVO
sampleVO
=
entrustSamples
.
get
(
0
);
// 若不为此标准,直接返回
if
(!
"GB/T 1196 2017"
.
equalsIgnoreCase
(
sampleVO
.
getStandardCode
()))
{
return
;
}
List
<
String
>
otherYsList
=
Arrays
.
asList
(
"Mn"
,
"V"
,
"Ni"
);
// 需要更新的检测项目
List
<
EntrustSampleItem
>
updateItems
=
new
ArrayList
<>();
// 获取此标准的数据
for
(
EntrustSampleVO
vo
:
entrustSamples
)
{
// 获取检测值
List
<
EntrustSampleItemIndexVO
>
itemIndexVOList
=
entrustSampleItemIndexService
.
listVOBySampleIds
(
Arrays
.
asList
(
vo
.
getId
()));
for
(
EntrustSampleItemIndexVO
indexVO
:
itemIndexVOList
)
{
if
(
StringUtils
.
isBlank
(
indexVO
.
getTestValue
())
||
!
otherYsList
.
contains
(
indexVO
))
{
continue
;
}
if
(
Double
.
parseDouble
(
indexVO
.
getTestValue
())
>=
0.01d
)
{
EntrustSampleItem
updateItem
=
new
EntrustSampleItem
();
updateItem
.
setId
(
indexVO
.
getItemId
());
updateItems
.
add
(
updateItem
.
setComposeJudge
(
1
));
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
updateItems
))
{
// 更新判定字段
updateBatchById
(
updateItems
);
}
}
}
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
View file @
c250e915
...
...
@@ -566,6 +566,26 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
}
@Override
public
List
<
EntrustSampleVO
>
getVOListByEntrustId
(
Long
entrustId
){
if
(
null
==
entrustId
){
return
null
;
}
EntrustSampleVO
vo
=
new
EntrustSampleVO
();
vo
.
setEntrustId
(
entrustId
);
return
selectListWithRelation
(
vo
);
}
@Override
public
List
<
EntrustSampleVO
>
getVOListByIds
(
List
<
Long
>
sampleIdList
){
if
(
CollectionUtils
.
isEmpty
(
sampleIdList
)){
return
null
;
}
EntrustSampleVO
vo
=
new
EntrustSampleVO
();
vo
.
setIds
(
sampleIdList
);
return
selectListWithRelation
(
vo
);
}
@Override
public
List
<
Long
>
getIdsByEntrustId
(
Long
entrustId
)
{
List
<
EntrustSample
>
list
=
getByEntrustId
(
entrustId
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
...
...
@@ -1709,4 +1729,9 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
return
baseMapper
.
updateForSet
(
String
.
format
(
"code=%s"
,
fromFiled
),
new
EntityWrapper
<
EntrustSample
>().
in
(
"id"
,
sampleIdsList
))
>
0
;
}
@Override
public
List
<
EntrustSampleVO
>
selectListWithRelation
(
EntrustSampleVO
entrustSampleVO
){
return
baseMapper
.
selectListWithRelation
(
entrustSampleVO
);
}
}
\ No newline at end of file
src/main/resources/mapper/hmhj/EntrustSampleItemIndexMapper.xml
View file @
c250e915
...
...
@@ -22,6 +22,7 @@
ii.*,
i.name "item_name",
i.id "item_id",
i.compose_judge "item_compose_judge",
s.id "sample_id",
s.code "sample_code",
s.entrust_id
...
...
src/main/resources/mapper/hmhj/EntrustSampleMapper.xml
View file @
c250e915
...
...
@@ -77,6 +77,58 @@
order by s.order_by asc, s.code ,s.ctime desc
</select>
<!--查询带关联信息的样品列表-->
<select
id=
"selectListWithRelation"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustSampleVO"
>
SELECT
s.*,
g.name "standard_name",g.code "standard_code",g.compose_judge "standard_compose_judge"
FROM entrust_sample s
LEFT JOIN grading_standard g on g.id = s.product_standard_id
WHERE deleted = 0
<if
test=
"null != vo.entrustId"
>
AND s.entrust_id = #{vo.entrustId}
</if>
<if
test=
"null != vo.status"
>
AND s.status = #{vo.status}
</if>
<if
test=
"null != vo.code"
>
AND s.code LIKE CONCAT('%',#{vo.code},'%')
</if>
<if
test=
"null != vo.notStatus"
>
AND s.status != #{vo.notStatus}
</if>
<if
test=
"null != vo.itemStatus"
>
AND exists (
select 1 from entrust_sample_item i where i.deleted = 0
and i.entrust_sample_id = s.id
and i.status = #{vo.itemStatus}
)
</if>
<if
test=
"null != vo.itemStatusList"
>
AND exists (
select 1 from entrust_sample_item i where i.deleted = 0
and i.entrust_sample_id = s.id
and i.status IN
<foreach
collection=
"vo.itemStatusList"
index=
"index"
item=
"itemStatus"
open=
"("
separator=
","
close=
")"
>
#{itemStatus}
</foreach>
)
</if>
<if
test=
"null!=vo.ids"
>
AND s.id IN
<foreach
collection=
"vo.ids"
index=
"index"
item=
"sampleId"
open=
"("
separator=
","
close=
")"
>
#{sampleId}
</foreach>
</if>
order by s.order_by asc, s.code ,s.ctime desc
</select>
<select
id=
"selectMinStatusByEntrustIds"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustSampleVO"
>
WITH summary AS (
...
...
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