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
36663cdd
Commit
36663cdd
authored
Jan 26, 2022
by
lijingjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批量扫码需求添加;
parent
b2682797
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
89 additions
and
18 deletions
+89
-18
EntrustSampleController.java
...service/lims/hmhj/controller/EntrustSampleController.java
+2
-0
IEntrustSamplePrepareService.java
...rvice/lims/hmhj/service/IEntrustSamplePrepareService.java
+2
-0
EntrustSamplePrepareServiceImpl.java
...ms/hmhj/service/impl/EntrustSamplePrepareServiceImpl.java
+54
-4
EntrustSampleServiceImpl.java
...vice/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
+25
-14
EntrustSampleMapper.xml
src/main/resources/mapper/hmhj/EntrustSampleMapper.xml
+6
-0
No files found.
src/main/java/com/patzn/cloud/service/lims/hmhj/controller/EntrustSampleController.java
View file @
36663cdd
...
...
@@ -28,6 +28,7 @@ import io.swagger.annotations.ApiOperation;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -307,6 +308,7 @@ public class EntrustSampleController extends ServiceController {
@PostMapping
(
"/page_sample_receive"
)
public
RestResult
<
Page
<
EntrustSampleVO
>>
getPageSampleReceive
(
EntrustSampleVO
entrustSample
)
{
entrustSample
.
setPrepareStatus
(
EntrustSamplePrepareStatusEnum
.
RECEIVE
);
entrustSample
.
setStatusList
(
Collections
.
singletonList
(
EntrustSampleStatusEnum
.
RECEIVE
));
return
success
(
entrustSampleService
.
pageSampleReceive
(
getPage
(),
entrustSample
));
}
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/IEntrustSamplePrepareService.java
View file @
36663cdd
...
...
@@ -25,6 +25,8 @@ public interface IEntrustSamplePrepareService extends IBaseService<EntrustSample
boolean
submitSampleReceive
(
Long
[]
ids
,
String
receiveType
,
Account
account
);
boolean
submitSampleReceiveWithoutPrepare
(
List
<
Long
>
sampleIds
,
String
receiveType
,
Account
account
);
boolean
addOrUpdateToSetStatus
(
Long
[]
sampleIds
,
EntrustSamplePrepareStatusEnum
statusEnum
);
boolean
removeBySampleIds
(
Long
[]
sampleIds
);
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSamplePrepareServiceImpl.java
View file @
36663cdd
...
...
@@ -226,10 +226,11 @@ public class EntrustSamplePrepareServiceImpl extends BaseServiceImpl<EntrustSamp
EntrustSample
entrustSample
=
entrustSampleService
.
getById
(
prepareList
.
get
(
0
).
getEntrustSampleId
());
Entrust
entrust
=
entrustService
.
getById
(
entrustSample
.
getEntrustId
());
if
(
null
==
entrust
.
getTestAddress
())
{
// entrust.setReceiveTime(new Date());
List
<
EntrustSample
>
notSampleList
=
entrustSampleService
.
list
(
Condition
.
create
().
eq
(
"entrust_id"
,
entrust
.
getId
()).
notIn
(
"id"
,
sampleIdsList
));
List
<
Long
>
notOkSampleIds
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
notSampleList
))
{
notOkSampleIds
=
notSampleList
.
stream
().
map
(
EntrustSample:
:
getId
).
collect
(
Collectors
.
toList
());
}
EntrustSamplePrepare
prepare
=
new
EntrustSamplePrepare
();
prepare
.
setStatus
(
EntrustSamplePrepareStatusEnum
.
TEST
);
prepare
.
setStatus
(
EntrustSamplePrepareStatusEnum
.
TEST
);
...
...
@@ -242,10 +243,14 @@ public class EntrustSamplePrepareServiceImpl extends BaseServiceImpl<EntrustSamp
statusNotOkList
.
add
(
EntrustSamplePrepareStatusEnum
.
RECEIVE_OK
);
List
<
EntrustSamplePrepare
>
preparesNotOkList
=
super
.
list
(
Condition
.
create
().
in
(
"id"
,
sampleIdsList
).
in
(
"status"
,
statusNotOkList
));
List
<
Long
>
not
Ok
SampleIds
=
preparesNotOkList
.
stream
().
map
(
i
->
{
List
<
Long
>
notSampleIds
=
preparesNotOkList
.
stream
().
map
(
i
->
{
return
i
.
getEntrustSampleId
();
}).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
notSampleIds
))
{
notOkSampleIds
.
addAll
(
notSampleIds
);
}
List
<
Long
>
changeList
=
new
ArrayList
<>();
for
(
Long
id
:
sampleIdsList
)
{
if
(!
notOkSampleIds
.
contains
(
id
))
{
...
...
@@ -279,6 +284,51 @@ public class EntrustSamplePrepareServiceImpl extends BaseServiceImpl<EntrustSamp
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
submitSampleReceiveWithoutPrepare
(
List
<
Long
>
sampleIds
,
String
receiveType
,
Account
account
)
{
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleIds
),
"请选择检测样品"
);
// 更新检测项目
EntrustSampleItem
item
=
new
EntrustSampleItem
();
item
.
setStatus
(
EntrustSampleItemStatusEnum
.
ALLOT
);
item
.
setProgress
(
EntrustSampleItemStatusEnum
.
ALLOT
);
entrustSampleItemService
.
update
(
item
,
Condition
.
create
().
in
(
"entrust_sample_id"
,
sampleIds
));
// 更新样品信息
EntrustSample
sample
=
new
EntrustSample
();
sample
.
setStatus
(
EntrustSampleStatusEnum
.
TEST
);
sample
.
setProgress
(
EntrustSampleStatusEnum
.
TEST
);
entrustSampleService
.
update
(
sample
,
Condition
.
create
().
in
(
"id"
,
sampleIds
));
// 查询随机样品对应的委托信息
EntrustSample
entrustSample
=
entrustSampleService
.
getById
(
sampleIds
.
get
(
0
));
// 查询委托下,是否还有没有完成接收的样品
List
<
EntrustSampleStatusEnum
>
unfinishStatus
=
Arrays
.
asList
(
EntrustSampleStatusEnum
.
DRAFT
,
EntrustSampleStatusEnum
.
RECEIVE
);
List
<
EntrustSample
>
entrustSamples
=
entrustSampleService
.
list
(
Condition
.
create
()
.
eq
(
"entrust_id"
,
entrustSample
.
getEntrustId
())
.
in
(
"status"
,
unfinishStatus
)
);
if
(
CollectionUtils
.
isNotEmpty
(
entrustSamples
))
{
return
true
;
}
Entrust
entrust
=
entrustService
.
getById
(
entrustSample
.
getEntrustId
());
// 检测开始时间为接收时间
entrust
.
setTestTimeS
(
new
Date
());
if
(
entrustService
.
isCanIntoNextNode
(
entrust
))
{
entrustService
.
submitToNextNode
(
entrust
,
account
);
}
else
{
entrust
.
setFlowStatus
(
EntrustFlowEnum
.
TEST
.
getName
());
entrustService
.
updateById
(
entrust
);
// 添加委托操作记录
entrustRecordService
.
record
(
new
Long
[]{
entrust
.
getId
()},
"样品接收"
,
"任务分配"
,
0
,
account
,
"提交至任务分配"
);
}
return
true
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
receiveSampleBatch
(
Long
[]
ids
,
Account
account
)
{
RestAssert
.
fail
(
ArrayUtils
.
isEmpty
(
ids
),
"请选择要接收的委托"
);
List
<
EntrustSample
>
sampleList
=
entrustSampleService
.
list
(
Condition
.
create
().
in
(
"entrust_id"
,
ids
));
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
View file @
36663cdd
...
...
@@ -1723,7 +1723,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
if
(
CollectionUtils
.
isEmpty
(
itemList
))
return
false
;
List
<
EntrustSample
>
sampleList
=
getBatchIds
(
sampleIdsList
);
Map
<
Long
,
Long
>
sampleEntrustIdMap
=
sampleList
.
stream
().
collect
(
Collectors
.
toMap
(
EntrustSample:
:
getId
,
EntrustSample:
:
getEntrustId
));
Map
<
Long
,
Long
>
sampleEntrustIdMap
=
sampleList
.
stream
().
collect
(
Collectors
.
toMap
(
EntrustSample:
:
getId
,
EntrustSample:
:
getEntrustId
));
List
<
EntrustSampleItem
>
saveItemList
=
new
ArrayList
<>();
for
(
Long
sampleId
:
sampleIdsList
)
{
...
...
@@ -1751,18 +1751,29 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
boolean
scanReceive
(
String
sampleCode
,
Account
account
)
{
RestAssert
.
fail
(
StringUtils
.
isBlank
(
sampleCode
),
"请扫描二维码"
);
String
[]
codeArray
=
sampleCode
.
split
(
"~"
);
RestAssert
.
fail
(
codeArray
.
length
!=
3
,
"样品编号有误!"
);
Long
groupId
=
Long
.
parseLong
(
codeArray
[
1
]);
Long
sampleId
=
Long
.
parseLong
(
codeArray
[
2
]);
// 样品编号ID,根据当前提供的样品编号和组号获取
// EntrustSample sample = getOne(Condition.create().setSqlSelect("id").eq("id", codeArray[0]).last("LIMIT 1"));
List
<
EntrustSamplePrepare
>
prepareList
=
entrustSamplePrepareService
.
list
(
Condition
.
create
().
eq
(
"entrust_sample_id"
,
sampleId
).
eq
(
"group_id"
,
groupId
));
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
prepareList
),
"暂未查询到样品下的接收信息!"
);
Long
[]
prepareIds
=
prepareList
.
stream
().
map
(
EntrustSamplePrepare:
:
getId
).
toArray
(
size
->
new
Long
[
size
]);
return
entrustSamplePrepareService
.
submitSampleReceive
(
prepareIds
,
"扫码接收"
,
account
);
public
boolean
scanReceive
(
String
sampleCodes
,
Account
account
)
{
RestAssert
.
fail
(
StringUtils
.
isBlank
(
sampleCodes
),
"请扫描二维码"
);
String
[]
sampleCodeArr
=
sampleCodes
.
split
(
","
);
Wrapper
wrapper
=
Condition
.
create
();
List
<
Long
>
sampleIds
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
sampleCodeArr
.
length
;
i
++)
{
String
code
=
sampleCodeArr
[
i
];
String
[]
codeArr
=
code
.
split
(
"~"
);
RestAssert
.
fail
(
codeArr
.
length
!=
3
,
"样品编号有误!"
);
Long
groupId
=
Long
.
parseLong
(
codeArr
[
1
]);
Long
sampleId
=
Long
.
parseLong
(
codeArr
[
2
]);
sampleIds
.
add
(
sampleId
);
wrapper
.
orNew
().
eq
(
"entrust_sample_id"
,
sampleId
).
eq
(
"group_id"
,
groupId
);
}
System
.
out
.
println
(
wrapper
.
toString
());
List
<
EntrustSamplePrepare
>
prepareList
=
entrustSamplePrepareService
.
list
(
wrapper
);
if
(
CollectionUtils
.
isNotEmpty
(
prepareList
))
{
Long
[]
prepareIds
=
prepareList
.
stream
().
map
(
EntrustSamplePrepare:
:
getId
).
toArray
(
size
->
new
Long
[
size
]);
return
entrustSamplePrepareService
.
submitSampleReceive
(
prepareIds
,
"扫码接收"
,
account
);
}
return
entrustSamplePrepareService
.
submitSampleReceiveWithoutPrepare
(
sampleIds
,
"扫码接收"
,
account
);
}
@Override
...
...
@@ -2229,7 +2240,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
private
List
<
EntrustSampleItemIndex
>
getIndexList
(
Long
sampleId
)
{
if
(
null
==
sampleId
)
{
if
(
null
==
sampleId
)
{
return
new
ArrayList
<>();
}
return
entrustSampleItemIndexService
.
listItemBySampleIds
(
Collections
.
singletonList
(
sampleId
));
...
...
src/main/resources/mapper/hmhj/EntrustSampleMapper.xml
View file @
36663cdd
...
...
@@ -25,6 +25,12 @@
AND p.status != #{vo.prepareNotStatus}
</if>
<if
test=
"null!=vo.statusList"
>
<foreach
collection=
"vo.statusList"
index=
"index"
item=
"status"
open=
" and s.status in ("
separator=
","
close=
")"
>
#{status}
</foreach>
</if>
<if
test=
"null!=vo.entrustId"
>
AND s.entrust_id = #{vo.entrustId}
</if>
...
...
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