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
59719297
Commit
59719297
authored
Apr 25, 2023
by
lijingjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
异常项目对比,清除重新填写原始记录消除异常的对比项;
parent
1ed9f46a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
103 additions
and
33 deletions
+103
-33
IItemComparisonService.java
...oud/service/lims/hmhj/service/IItemComparisonService.java
+3
-3
EntrustReportServiceImpl.java
...vice/lims/hmhj/service/impl/EntrustReportServiceImpl.java
+2
-2
ItemComparisonServiceImpl.java
...ice/lims/hmhj/service/impl/ItemComparisonServiceImpl.java
+83
-28
ItemComparisonMapper.xml
src/main/resources/mapper/hmhj/ItemComparisonMapper.xml
+15
-0
No files found.
src/main/java/com/patzn/cloud/service/lims/hmhj/service/IItemComparisonService.java
View file @
59719297
...
...
@@ -40,7 +40,7 @@ public interface IItemComparisonService extends IBaseService<ItemComparison> {
* @param queryDTO the query dto
* @return the list
*/
List
<
ItemComparison
>
listCompareItems
(
SlotQueryDTO
queryDTO
);
List
<
List
<
ItemComparison
>
>
listCompareItems
(
SlotQueryDTO
queryDTO
);
/**
* Save data batch boolean.
...
...
@@ -63,8 +63,8 @@ public interface IItemComparisonService extends IBaseService<ItemComparison> {
/**
* 是否存在对比数据
*
* @param sampleCodeList
* @return
* @param sampleCodeList
the sample code list
* @return
boolean boolean
*/
boolean
isExistCompareData
(
List
<
String
>
sampleCodeList
);
}
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustReportServiceImpl.java
View file @
59719297
...
...
@@ -344,7 +344,7 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
p
rotected
void
generateCompareItems
(
Long
[]
ids
,
Account
account
)
{
p
ublic
void
generateCompareItems
(
Long
[]
ids
,
Account
account
)
{
if
(
ArrayUtils
.
isEmpty
(
ids
))
{
logger
.
error
(
"==== EntrustReportServiceImpl ==== generateCompareItems ====> 报告IDS数据为空!"
);
return
;
...
...
@@ -631,7 +631,7 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
p
rotected
boolean
doExecuteSubmit
(
Long
[]
ids
,
EntrustFlowEnum
fromFlowStatus
,
EntrustFlowEnum
toFlowStatus
,
Account
account
)
{
p
ublic
boolean
doExecuteSubmit
(
Long
[]
ids
,
EntrustFlowEnum
fromFlowStatus
,
EntrustFlowEnum
toFlowStatus
,
Account
account
)
{
Entrust
entrust
=
handleConditionGetEntrust
(
ids
);
String
statusPath
=
entrust
.
getStatusPath
(),
flowStatus
=
entrust
.
getFlowStatus
();
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/ItemComparisonServiceImpl.java
View file @
59719297
...
...
@@ -21,6 +21,7 @@ import org.springframework.stereotype.Service;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* 检测项目比对表 服务实现类
...
...
@@ -96,7 +97,8 @@ public class ItemComparisonServiceImpl extends BaseServiceImpl<ItemComparisonMap
@Override
public
List
<
ItemComparison
>
listCompareItems
(
SlotQueryDTO
queryDTO
)
{
public
List
<
List
<
ItemComparison
>>
listCompareItems
(
SlotQueryDTO
queryDTO
)
{
List
<
List
<
ItemComparison
>>
result
=
new
ArrayList
<>();
if
(
null
==
queryDTO
.
getQueryDate
())
{
queryDTO
.
setQueryDate
(
new
Date
());
}
...
...
@@ -104,7 +106,8 @@ public class ItemComparisonServiceImpl extends BaseServiceImpl<ItemComparisonMap
List
<
ItemComparison
>
itemCompareVOList
=
baseMapper
.
selectCompareItems
(
queryDTO
);
logger
.
error
(
"listCompare items data: "
+
JacksonUtils
.
toJSONString
(
itemCompareVOList
));
List
<
ItemComparison
>
itemList
=
new
ArrayList
<>();
List
<
ItemComparison
>
updateItemList
=
new
ArrayList
<>();
List
<
ItemComparison
>
removeItemList
=
new
ArrayList
<>();
// 查询样本库下检测项目限定值
Map
<
String
,
String
>
limitValueMap
=
materialItemService
.
listAlLimitItemMap
();
...
...
@@ -120,17 +123,18 @@ public class ItemComparisonServiceImpl extends BaseServiceImpl<ItemComparisonMap
logger
.
error
(
"compare item data: {}"
,
JacksonUtils
.
toJSONString
(
item
));
try
{
BigDecimal
newVal
=
new
BigDecimal
(
item
.
getTestValue
());
logger
.
error
(
"
newValue is :"
+
newVal
.
doubleValue
()
);
logger
.
error
(
"
==== compareTestValue ====> newValue :{}"
,
newVal
);
BigDecimal
oldVal
=
new
BigDecimal
(
item
.
getPrevTestValue
());
logger
.
error
(
"
oldVal is :"
+
oldVal
.
doubleValue
()
);
logger
.
error
(
"
==== compareTestValue ====> oldValue :{}"
,
oldVal
);
BigDecimal
difVal
=
newVal
.
subtract
(
oldVal
).
abs
();
logger
.
error
(
"
difVal is :"
+
difVal
.
doubleValue
()
);
logger
.
error
(
"
==== compareTestValue ====> difValue :{}"
,
difVal
);
item
.
setDiffValue
(
difVal
.
toPlainString
());
BigDecimal
limitValue
=
new
BigDecimal
(
item
.
getLimitValue
());
logger
.
error
(
"
limitValue is :"
+
difVal
.
doubleValue
()
);
logger
.
error
(
"
==== compareTestValue ====> limitValue :{}"
,
limitValue
);
// 差值与限定值相比,大于0需要重取
double
compareValue
=
difVal
.
subtract
(
limitValue
).
doubleValue
();
logger
.
error
(
"compare diff value and limit value subtract is: "
+
compareValue
);
logger
.
error
(
"==== compareTestValue ====> 差值与限定值相比,大于0需要重取。"
);
logger
.
error
(
"==== compareTestValue ====> compareValue :{}"
,
compareValue
);
if
(
compareValue
>=
0
)
{
item
.
setReclaim
(
true
);
}
...
...
@@ -143,55 +147,106 @@ public class ItemComparisonServiceImpl extends BaseServiceImpl<ItemComparisonMap
// 倘若循环的同槽号的检测项目中,存在大于限定值的项目,都将保存在此列表中
slotItemMap
.
forEach
((
slotNo
,
list
)
->
{
if
(
list
.
stream
().
anyMatch
(
ItemComparison:
:
getReclaim
))
{
itemList
.
addAll
(
list
);
updateItemList
.
addAll
(
list
);
}
else
{
removeItemList
.
addAll
(
list
);
}
});
logger
.
error
(
"handler data for list is: {}"
,
JacksonUtils
.
toJSONString
(
itemList
));
return
itemList
;
logger
.
error
(
"handler data for list is: {}"
,
JacksonUtils
.
toJSONString
(
updateItemList
));
result
.
add
(
updateItemList
);
result
.
add
(
removeItemList
);
return
result
;
}
@Override
public
boolean
saveCompareDataBatch
(
SlotQueryDTO
queryDTO
,
Account
account
)
{
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> [queryDTO]: {}"
,
JacksonUtils
.
toJSONString
(
queryDTO
));
List
<
ItemComparison
>
comparisonList
=
listCompareItems
(
queryDTO
);
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> [comparisonList]: {}"
,
JacksonUtils
.
toJSONString
(
comparisonList
));
if
(
CollectionUtils
.
isEmpty
(
comparisonList
))
{
logger
.
error
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> 比对的检测项目数据为空!"
);
return
false
;
}
// ==
comparisonList
.
forEach
(
item
->
item
.
setUid
(
account
.
getUserId
()).
setCompanyId
(
account
.
getCompanyId
()));
List
<
List
<
ItemComparison
>>
resultList
=
listCompareItems
(
queryDTO
);
List
<
ItemComparison
>
comparisonUpdateList
=
resultList
.
get
(
0
);
List
<
ItemComparison
>
comparisonRemoveList
=
resultList
.
get
(
1
);
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> [comparisonUpdateList]: {}"
,
JacksonUtils
.
toJSONString
(
comparisonUpdateList
));
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> [comparisonRemoveList]: {}"
,
JacksonUtils
.
toJSONString
(
comparisonRemoveList
));
ItemComparison
comparison
=
comparisonList
.
get
(
0
);
ItemComparison
comparison
;
List
<
ItemComparison
>
comparisonOldList
;
// == 要更新或新增的数据为空,需要删除老数据
if
(
CollectionUtils
.
isEmpty
(
comparisonUpdateList
))
{
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> 比对的检测项目数据为空!"
);
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> 清除之前的对比异常数据!"
);
comparison
=
comparisonRemoveList
.
get
(
0
);
List
<
String
>
sampleCodes
=
new
ArrayList
<>(),
itemNames
=
new
ArrayList
<>();
for
(
ItemComparison
item
:
comparisonRemoveList
)
{
String
delSampleCode
=
item
.
getSampleCode
(),
delItemName
=
item
.
getName
();
if
(!
sampleCodes
.
contains
(
delSampleCode
))
{
sampleCodes
.
add
(
delSampleCode
);
}
if
(!
itemNames
.
contains
(
delItemName
))
{
itemNames
.
add
(
delItemName
);
}
}
queryDTO
.
setPeriod
(
comparison
.
getPeriod
());
queryDTO
.
setQueryDate
(
DateUtils
.
str2Date
(
comparison
.
getCompareDate
()));
queryDTO
.
setSampleName
(
comparison
.
getSampleName
());
queryDTO
.
setItemNames
(
itemNames
);
queryDTO
.
setSampleCodes
(
sampleCodes
);
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> remove[comparisonOldList.queryDTO]: {}"
,
JacksonUtils
.
toJSONString
(
queryDTO
));
// 根据名称和日期查询要清除的对比数据
comparisonOldList
=
baseMapper
.
selectDataPage
(
new
Page
(
1
,
Integer
.
MAX_VALUE
),
queryDTO
);
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> remove[comparisonOldList]: {}"
,
JacksonUtils
.
toJSONString
(
comparisonOldList
));
if
(
CollectionUtils
.
isNotEmpty
(
comparisonOldList
))
{
List
<
Long
>
removeIds
=
comparisonOldList
.
stream
().
map
(
ItemComparison:
:
getId
).
collect
(
Collectors
.
toList
());
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> removeIds: {}"
,
JacksonUtils
.
toJSONString
(
removeIds
));
super
.
removeBatchIds
(
removeIds
);
}
return
true
;
}
// 取其一作查询条件
comparison
=
comparisonUpdateList
.
get
(
0
);
queryDTO
.
setQueryDate
(
DateUtils
.
str2Date
(
comparison
.
getCompareDate
()));
queryDTO
.
setSampleName
(
comparison
.
getSampleName
());
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> [
ItemComparison
.queryDTO]: {}"
,
JacksonUtils
.
toJSONString
(
queryDTO
));
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> [
comparisonOldList
.queryDTO]: {}"
,
JacksonUtils
.
toJSONString
(
queryDTO
));
// 根据时间查询是否有存在的数据
List
<
ItemComparison
>
itemComparisonList
=
baseMapper
.
selectDataPage
(
new
Page
(
1
,
Integer
.
MAX_VALUE
),
queryDTO
);
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> [itemComparisonList]: {}"
,
JacksonUtils
.
toJSONString
(
itemComparisonList
));
comparisonOldList
=
baseMapper
.
selectDataPage
(
new
Page
(
1
,
Integer
.
MAX_VALUE
),
queryDTO
);
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> [comparisonOldList]: {}"
,
JacksonUtils
.
toJSONString
(
comparisonOldList
));
// ==
comparisonUpdateList
.
forEach
(
item
->
item
.
setUid
(
account
.
getUserId
()).
setCompanyId
(
account
.
getCompanyId
()));
// 老数据Map组信息,用来取Id
Map
<
String
,
ItemComparison
>
comparisonMap
=
new
HashMap
<>(
4
);
// 组list,过滤重复数据
if
(
CollectionUtils
.
isNotEmpty
(
itemComparisonList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
comparisonOldList
))
{
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> itemComparisonList: 更新老数据检测对比值"
);
// 处理老数据,组key用来获取ID
itemComparison
List
.
forEach
(
ic
->
{
comparisonOld
List
.
forEach
(
ic
->
{
String
key
=
ic
.
getSampleCode
()
+
ic
.
getName
();
logger
.
info
(
"==== saveCompareDataBatch ====> key: {}"
,
key
);
logger
.
info
(
"==== saveCompareDataBatch ====> value: {}"
,
JacksonUtils
.
toJSONString
(
ic
));
comparisonMap
.
put
(
key
,
ic
);
});
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> comparisonMap: {}"
,
JacksonUtils
.
toJSONString
(
comparisonMap
));
// 新数据,存在对应的改ID
comparisonList
.
forEach
(
d
->
{
comparison
Update
List
.
forEach
(
d
->
{
String
key
=
d
.
getSampleCode
()
+
d
.
getName
();
ItemComparison
source
=
comparisonMap
.
get
(
key
);
logger
.
info
(
"==== ItemComparisonServiceImpl ==== comparisonList.source ====> key: {}"
,
key
);
logger
.
info
(
"==== ItemComparisonServiceImpl ==== comparisonList.source ====> sampleCode: {}"
,
d
.
getSampleCode
());
logger
.
info
(
"==== ItemComparisonServiceImpl ==== comparisonList.source ====> prevSampleCode: {}"
,
d
.
getPrevSampleCode
());
logger
.
info
(
"==== ItemComparisonServiceImpl ==== comparisonList.source ====> testValue: {}"
,
d
.
getTestValue
());
logger
.
info
(
"==== ItemComparisonServiceImpl ==== comparisonList.source ====> prevTestValue: {}"
,
d
.
getPrevTestValue
());
if
(
Objects
.
nonNull
(
source
))
{
d
.
setId
(
source
.
getId
());
d
.
setCtime
(
new
Date
());
d
.
setUid
(
account
.
getUserId
());
logger
.
info
(
"==== ItemComparisonServiceImpl ==== comparisonList.target ====> {}"
,
JacksonUtils
.
toJSONString
(
d
));
logger
.
info
(
"==== ItemComparisonServiceImpl ==== comparisonList.target ====> sampleCode: {}"
,
d
.
getSampleCode
());
logger
.
info
(
"==== ItemComparisonServiceImpl ==== comparisonList.target ====> prevSampleCode: {}"
,
d
.
getPrevSampleCode
());
logger
.
info
(
"==== ItemComparisonServiceImpl ==== comparisonList.target ====> testValue: {}"
,
d
.
getTestValue
());
logger
.
info
(
"==== ItemComparisonServiceImpl ==== comparisonList.target ====> prevTestValue: {}"
,
d
.
getPrevTestValue
());
}
});
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> data handler: {}"
,
JacksonUtils
.
toJSONString
(
comparisonList
));
logger
.
info
(
"==== ItemComparisonServiceImpl ==== saveCompareDataBatch ====> data handler: {}"
,
JacksonUtils
.
toJSONString
(
comparison
Update
List
));
}
return
super
.
saveOrUpdateBatch
(
comparisonList
);
return
super
.
saveOrUpdateBatch
(
comparison
Update
List
);
}
@Override
...
...
src/main/resources/mapper/hmhj/ItemComparisonMapper.xml
View file @
59719297
...
...
@@ -29,6 +29,21 @@
<if
test=
"null != vo.queryDate"
>
and ic.compare_date = to_char(#{vo.queryDate}::timestamp,'yyyy-MM-dd')
</if>
<if
test=
"null != vo.sampleCodes"
>
and ic.sample_code in
<foreach
collection=
"vo.sampleCodes"
item=
"sc"
open=
"("
separator=
","
close=
")"
>
#{sc}
</foreach>
</if>
<if
test=
"null != vo.itemNames"
>
and ic.name in
<foreach
collection=
"vo.itemNames"
item=
"itn"
open=
"("
separator=
","
close=
")"
>
#{itn}
</foreach>
</if>
<if
test=
"null != vo.queryDate"
>
and ic.compare_date = to_char(#{vo.queryDate}::timestamp,'yyyy-MM-dd')
</if>
</where>
order by ic.sample_code desc,ic.name
</select>
...
...
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