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
52f8bf7e
Commit
52f8bf7e
authored
Mar 17, 2022
by
lijingjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
样品编号验证修改;
parent
95df0b5d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
28 deletions
+25
-28
EntrustServiceImpl.java
...ud/service/lims/hmhj/service/impl/EntrustServiceImpl.java
+25
-28
No files found.
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustServiceImpl.java
View file @
52f8bf7e
...
...
@@ -408,25 +408,21 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
entrust
.
setId
(
IdWorker
.
getId
());
// 保存并提交委托时使用
dto
.
setId
(
entrust
.
getId
());
List
<
String
>
orgNameList
=
userInfoService
.
getUserOrgNames
(
account
);
// ==
if
(
CollectionUtils
.
isNotEmpty
(
sampleDTOList
))
{
// 先对样品进行处理
Set
<
String
>
sampleNames
=
new
HashSet
<>();
Set
<
String
>
sampleCodes
=
new
HashSet
<>();
int
sampleCount
=
sampleDTOList
.
size
();
Set
<
String
>
sampleNames
=
new
HashSet
<>(),
sampleCodes
=
new
HashSet
<>(),
sampleSlots
=
new
HashSet
<>();
for
(
EntrustSampleDTO
sampleDTO
:
sampleDTOList
)
{
sampleNames
.
add
(
sampleDTO
.
getName
()
);
String
scode
=
sampleDTO
.
getCode
(
);
if
(
StringUtils
.
isNotBlank
(
scode
))
{
RestAssert
.
fail
(
sampleCodes
.
contains
(
scode
),
String
.
format
(
"样品编
号【%s】重复!"
,
scode
));
sampleCodes
.
add
(
scode
);
}
String
sname
=
sampleDTO
.
getName
(),
scode
=
sampleDTO
.
getCode
(),
slotNo
=
sampleDTO
.
getSlotNo
(
);
sampleNames
.
add
(
sname
);
RestAssert
.
fail
(
StringUtils
.
isNotBlank
(
scode
)
&&
sampleCodes
.
contains
(
scode
),
String
.
format
(
"样品编号【%s】重复!"
,
scode
));
RestAssert
.
fail
(
StringUtils
.
isNotBlank
(
slotNo
)
&&
sampleSlots
.
contains
(
slotNo
),
String
.
format
(
"样品槽
号【%s】重复!"
,
scode
));
sampleCodes
.
add
(
scode
);
sampleSlots
.
add
(
slotNo
);
}
RestAssert
.
fail
(
sampleNames
.
size
()
>
1
,
"一个委托只能下同一种样品!"
);
RestAssert
.
fail
(
isSubmit
&&
sampleCodes
.
size
()
!=
sampleCount
,
"样品编号为空或重复!"
);
List
<
EntrustSample
>
saveSampleList
=
new
ArrayList
<>();
List
<
EntrustSampleItem
>
saveEntrustSampleItemList
=
new
ArrayList
<>();
...
...
@@ -638,19 +634,18 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
List
<
EntrustSampleDTO
>
sampleList
=
entrustDTO
.
getSampleDTOList
();
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleList
),
"委托样品为空"
);
RestAssert
.
fail
(
sampleList
.
stream
().
map
(
EntrustSampleDTO:
:
getName
).
distinct
().
count
()
>
1
,
"一个委托只能下同一种样品!"
);
Set
<
String
>
sampleNames
=
new
HashSet
<>(),
sampleCodes
=
new
HashSet
<>();
int
sampleCount
=
CollectionUtils
.
isEmpty
(
sampleList
)
?
0
:
sampleList
.
size
();
Set
<
String
>
sampleNames
=
new
HashSet
<>(),
sampleCodes
=
new
HashSet
<>(),
sampleSlots
=
new
HashSet
<>();
for
(
EntrustSampleDTO
sampleDTO
:
sampleList
)
{
String
sname
=
sampleDTO
.
getName
(),
scode
=
sampleDTO
.
getCode
();
String
sname
=
sampleDTO
.
getName
(),
scode
=
sampleDTO
.
getCode
()
,
slotNo
=
sampleDTO
.
getSlotNo
()
;
RestAssert
.
fail
(
StringUtils
.
isBlank
(
sname
),
"样品名称不能为空"
);
sampleNames
.
add
(
s
ampleDTO
.
getName
()
);
sampleNames
.
add
(
s
name
);
RestAssert
.
fail
(
StringUtils
.
isNotBlank
(
scode
)
&&
sampleCodes
.
contains
(
scode
),
String
.
format
(
"样品编号【%s】重复!"
,
scode
));
sampleCodes
.
add
(
scode
);
RestAssert
.
fail
(
StringUtils
.
isNotBlank
(
slotNo
)
&&
sampleSlots
.
contains
(
slotNo
),
String
.
format
(
"样品槽号【%s】重复!"
,
slotNo
));
sampleSlots
.
add
(
slotNo
);
}
RestAssert
.
fail
(
sampleNames
.
size
()
>
1
,
"一个委托只能下同一种样品!"
);
RestAssert
.
fail
(
isSubmit
&&
sampleCodes
.
size
()
!=
sampleCount
,
"样品编号为空或重复!"
);
Entrust
entrust
=
entrustDTO
.
convert
(
Entrust
.
class
);
entrust
.
setSampleName
(
sampleList
.
get
(
0
).
getName
());
...
...
@@ -664,6 +659,13 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
EntrustSample
sample
=
dto
.
convert
(
EntrustSample
.
class
);
sample
.
setOrderBy
(
incNum
);
incNum
+=
10
;
boolean
isInsert
=
false
;
// 如果室新增的样品
if
(
null
==
sample
.
getId
())
{
isInsert
=
true
;
sample
.
setEntrustId
(
entrust
.
getId
());
sample
.
setId
(
IdWorker
.
getId
());
}
if
(
isSubmit
)
{
if
(
StringUtils
.
isBlank
(
sample
.
getCode
()))
{
handleSampleCode
(
entrust
,
sample
);
...
...
@@ -672,17 +674,12 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
RestAssert
.
fail
(
entrustSampleService
.
isRepeatSampleCode
(
sample
),
String
.
format
(
"样品编号【%s】重复!"
,
sample
.
getCode
()));
}
}
updateSampleList
.
add
(
sample
);
// if (null != sample.getId()) {
// handleSampleCode(entrust, sample);
// updateSampleList.add(sample);
// } else {
// sample.setEntrustId(entrust.getId());
// handleSampleCode(entrust, sample);
// sample.setId(IdWorker.getId());
// saveSampleList.add(sample);
// }
if
(
isInsert
)
{
saveSampleList
.
add
(
sample
);
}
else
{
updateSampleList
.
add
(
sample
);
}
if
(
StringUtils
.
isNotBlank
(
sample
.
getCode
()))
{
RestAssert
.
fail
(
entrustSampleService
.
isRepeatSampleCode
(
sample
),
String
.
format
(
"样品编号【%s】重复!"
,
sample
.
getCode
()));
...
...
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