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
9a8a6aa0
Commit
9a8a6aa0
authored
Mar 16, 2022
by
lijingjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改原始记录关联问题;
修改可输入委托下样品编号重复问题; 修改委托进度查询状态不准问题;
parent
81445f50
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
92 deletions
+62
-92
EntrustController.java
...cloud/service/lims/hmhj/controller/EntrustController.java
+1
-1
IEntrustService.java
...atzn/cloud/service/lims/hmhj/service/IEntrustService.java
+1
-1
EntrustServiceImpl.java
...ud/service/lims/hmhj/service/impl/EntrustServiceImpl.java
+52
-84
EntrustMapper.xml
src/main/resources/mapper/hmhj/EntrustMapper.xml
+2
-1
OriginalTemplateItemMapper.xml
...main/resources/mapper/hmhj/OriginalTemplateItemMapper.xml
+6
-5
No files found.
src/main/java/com/patzn/cloud/service/lims/hmhj/controller/EntrustController.java
View file @
9a8a6aa0
...
...
@@ -297,7 +297,7 @@ public class EntrustController extends ServiceController {
@ApiOperation
(
value
=
"编辑委托单"
,
notes
=
"编辑报价单"
)
@PostMapping
(
"/edit_entrust"
)
public
RestResult
<
Boolean
>
editEntrust
(
@RequestBody
EntrustDTO
entrustDTO
)
{
return
success
(
entrustService
.
editEntrust
(
entrustDTO
,
getAccount
()));
return
success
(
entrustService
.
editEntrust
(
entrustDTO
,
false
,
getAccount
()));
}
@ApiOperation
(
"保存并提交委托"
)
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/IEntrustService.java
View file @
9a8a6aa0
...
...
@@ -36,7 +36,7 @@ public interface IEntrustService extends IBaseService<Entrust> {
boolean
registerSubmitToMake
(
Long
[]
ids
,
Account
account
);
boolean
editEntrust
(
EntrustDTO
entrustDTO
,
Account
account
);
boolean
editEntrust
(
EntrustDTO
entrustDTO
,
boolean
isSubmit
,
Account
account
);
EntrustDTO
getDTOById
(
Long
id
);
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustServiceImpl.java
View file @
9a8a6aa0
...
...
@@ -23,8 +23,6 @@ import com.patzn.cloud.service.hmhj.dto.EntrustDTO;
import
com.patzn.cloud.service.hmhj.dto.EntrustSampleDTO
;
import
com.patzn.cloud.service.hmhj.entity.*
;
import
com.patzn.cloud.service.hmhj.enums.*
;
import
com.patzn.cloud.service.hmhj.vo.EntrustSampleItemVO
;
import
com.patzn.cloud.service.hmhj.vo.EntrustSampleVO
;
import
com.patzn.cloud.service.hmhj.vo.EntrustVO
;
import
com.patzn.cloud.service.lims.chemical.entity.LmsChemicalCategory
;
import
com.patzn.cloud.service.lims.common.DateKit
;
...
...
@@ -411,9 +409,24 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
// 保存并提交委托时使用
dto
.
setId
(
entrust
.
getId
());
List
<
String
>
orgNameList
=
userInfoService
.
getUserOrgNames
(
account
);
// ==
if
(
CollectionUtils
.
isNotEmpty
(
sampleDTOList
))
{
RestAssert
.
fail
(
sampleDTOList
.
stream
().
map
(
EntrustSampleDTO:
:
getName
).
distinct
().
count
()
>
1
,
"一个委托只能下同一种样品!"
);
// 先对样品进行处理
Set
<
String
>
sampleNames
=
new
HashSet
<>();
Set
<
String
>
sampleCodes
=
new
HashSet
<>();
int
sampleCount
=
sampleDTOList
.
size
();
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
);
}
}
RestAssert
.
fail
(
sampleNames
.
size
()
>
1
,
"一个委托只能下同一种样品!"
);
RestAssert
.
fail
(
isSubmit
&&
sampleCodes
.
size
()
!=
sampleCount
,
"样品编号为空或重复!"
);
List
<
EntrustSample
>
saveSampleList
=
new
ArrayList
<>();
List
<
EntrustSampleItem
>
saveEntrustSampleItemList
=
new
ArrayList
<>();
...
...
@@ -618,16 +631,27 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
editEntrust
(
EntrustDTO
entrustDTO
,
Account
account
)
{
public
boolean
editEntrust
(
EntrustDTO
entrustDTO
,
boolean
isSubmit
,
Account
account
)
{
if
(
null
==
entrustDTO
.
getId
())
{
return
false
;
}
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
();
for
(
EntrustSampleDTO
sampleDTO
:
sampleList
)
{
RestAssert
.
fail
(
StringUtils
.
isBlank
(
sampleDTO
.
getName
()),
"样品名称不能为空"
);
String
sname
=
sampleDTO
.
getName
(),
scode
=
sampleDTO
.
getCode
();
RestAssert
.
fail
(
StringUtils
.
isBlank
(
sname
),
"样品名称不能为空"
);
sampleNames
.
add
(
sampleDTO
.
getName
());
RestAssert
.
fail
(
StringUtils
.
isNotBlank
(
scode
)
&&
sampleCodes
.
contains
(
scode
),
String
.
format
(
"样品编号【%s】重复!"
,
scode
));
sampleCodes
.
add
(
scode
);
}
RestAssert
.
fail
(
sampleNames
.
size
()
>
1
,
"一个委托只能下同一种样品!"
);
RestAssert
.
fail
(
isSubmit
&&
sampleCodes
.
size
()
!=
sampleCount
,
"样品编号为空或重复!"
);
Entrust
entrust
=
entrustDTO
.
convert
(
Entrust
.
class
);
entrust
.
setSampleName
(
sampleList
.
get
(
0
).
getName
());
if
(
updateById
(
entrust
))
{
...
...
@@ -640,21 +664,31 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
EntrustSample
sample
=
dto
.
convert
(
EntrustSample
.
class
);
sample
.
setOrderBy
(
incNum
);
incNum
+=
10
;
if
(
null
!=
sample
.
getId
())
{
if
(
isSubmit
)
{
if
(
StringUtils
.
isBlank
(
sample
.
getCode
()))
{
handleSampleCode
(
entrust
,
sample
);
updateSampleList
.
add
(
sample
);
}
else
{
sample
.
setEntrustId
(
entrust
.
getId
());
handleSampleCode
(
entrust
,
sample
);
sample
.
setId
(
IdWorker
.
getId
());
saveSampleList
.
add
(
sample
);
}
if
(
StringUtils
.
isNotBlank
(
sample
.
getCode
()))
{
RestAssert
.
fail
(
entrustSampleService
.
isRepeatSampleCode
(
sample
),
String
.
format
(
"样品编号【%s】重复!"
,
sample
.
getCode
()));
}
}
// 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
(
StringUtils
.
isNotBlank
(
sample
.
getCode
()))
{
RestAssert
.
fail
(
entrustSampleService
.
isRepeatSampleCode
(
sample
),
String
.
format
(
"样品编号【%s】重复!"
,
sample
.
getCode
()));
}
judgeSampleFields
(
sample
,
true
);
judgeSampleFields
(
sample
,
isSubmit
);
List
<
EntrustSampleItem
>
viewItemList
=
dto
.
getItemList
();
if
(
CollectionUtils
.
isNotEmpty
(
viewItemList
))
{
...
...
@@ -916,76 +950,10 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
if
(
CollectionUtils
.
isEmpty
(
voList
))
{
return
page
;
}
List
<
Long
>
entrustIds
=
voList
.
stream
().
map
(
e
->
{
return
e
.
getId
();
}).
collect
(
Collectors
.
toList
());
List
<
EntrustSampleVO
>
sampleVOList
=
entrustSampleService
.
listMinStatusByEntrustIds
(
entrustIds
);
Map
<
Long
,
EntrustSampleVO
>
sampleVOMap
=
new
HashMap
<>();
for
(
EntrustSampleVO
vo
:
sampleVOList
)
{
sampleVOMap
.
put
(
vo
.
getEntrustId
(),
vo
);
}
Map
<
Long
,
EntrustSampleItemVO
>
itemVOMap
=
new
HashMap
<>();
if
(
CollectionUtils
.
isNotEmpty
(
sampleVOList
))
{
List
<
Long
>
sampleIds
=
sampleVOList
.
stream
().
map
(
e
->
{
return
e
.
getId
();
}).
collect
(
Collectors
.
toList
());
List
<
EntrustSampleItemVO
>
itemVOList
=
entrustSampleItemService
.
listMinStatusBySampleIds
(
sampleIds
);
for
(
EntrustSampleItemVO
entrustSampleItemVO
:
itemVOList
)
{
itemVOMap
.
put
(
entrustSampleItemVO
.
getEntrustSampleId
(),
entrustSampleItemVO
);
}
}
for
(
EntrustVO
vo
:
voList
)
{
EntrustSampleVO
sampleVO
=
sampleVOMap
.
get
(
vo
.
getId
());
if
(
vo
.
getStatus
().
equals
(
EntrustStatusEnum
.
DRAFT
))
{
vo
.
setNowStatus
(
"委托登记"
);
}
else
if
(
vo
.
getStatus
().
equals
(
EntrustStatusEnum
.
OUT_DRAFT
))
{
vo
.
setNowStatus
(
"委托登记"
);
}
else
if
(
vo
.
getStatus
().
equals
(
EntrustStatusEnum
.
CHECK
))
{
vo
.
setNowStatus
(
"委托评审"
);
}
else
if
(
vo
.
getStatus
().
equals
(
EntrustStatusEnum
.
MAKE
))
{
vo
.
setNowStatus
(
"样品制备"
);
}
if
(
sampleVO
==
null
)
{
continue
;
}
if
(
sampleVO
.
getStatus
().
equals
(
EntrustSampleStatusEnum
.
DRAFT
))
{
continue
;
}
if
(
sampleVO
.
getStatus
().
equals
(
EntrustSampleStatusEnum
.
RECEIVE
))
{
vo
.
setNowStatus
(
"样品接收"
);
}
else
if
(
sampleVO
.
getStatus
().
equals
(
EntrustSampleStatusEnum
.
TEST
))
{
EntrustSampleItemVO
itemVO
=
itemVOMap
.
get
(
sampleVO
.
getId
());
if
(
null
!=
itemVO
&&
itemVO
.
getStatus
().
equals
(
EntrustSampleItemStatusEnum
.
ALLOT
))
{
vo
.
setNowStatus
(
"任务分配"
);
}
else
if
(
null
!=
itemVO
&&
itemVO
.
getStatus
().
equals
(
EntrustSampleItemStatusEnum
.
TEST
))
{
vo
.
setNowStatus
(
"试样检测"
);
}
voList
.
forEach
(
t
->
{
t
.
setNowStatus
(
EntrustFlowEnum
.
convert
(
t
.
getFlowStatus
()).
getDisplay
());
});
}
else
if
(
sampleVO
.
getStatus
().
equals
(
EntrustSampleStatusEnum
.
REPORT_MAKE
))
{
vo
.
setNowStatus
(
"报告编制"
);
}
else
if
(
sampleVO
.
getStatus
().
equals
(
EntrustSampleStatusEnum
.
REPORT_CHECK
))
{
vo
.
setNowStatus
(
"报告审核中"
);
}
else
if
(
sampleVO
.
getStatus
().
equals
(
EntrustSampleStatusEnum
.
REPORT_ALLOW
))
{
vo
.
setNowStatus
(
"报告审核中"
);
}
else
if
(
sampleVO
.
getStatus
().
equals
(
EntrustSampleStatusEnum
.
REPORT_ISSUE
))
{
vo
.
setNowStatus
(
"报告发放"
);
}
else
if
(
sampleVO
.
getStatus
().
equals
(
EntrustSampleStatusEnum
.
REPORT_SEND
))
{
vo
.
setNowStatus
(
"报告发放"
);
}
else
if
(
sampleVO
.
getStatus
().
equals
(
EntrustSampleStatusEnum
.
END
))
{
vo
.
setNowStatus
(
"质量判定"
);
}
}
return
page
.
setRecords
(
voList
);
}
...
...
@@ -1548,7 +1516,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
entrustSampleItemService
.
update
(
item
,
Condition
.
create
().
in
(
"entrust_sample_id"
,
sampleIds
));
// 2.4.重置样品报告关联
Wrapper
<
EntrustReportRelSample
>
wrapper
=
Condition
.
wrapper
();
entrustReportRelSampleService
.
remove
(
wrapper
.
in
(
"sample_id"
,
sampleIds
));
entrustReportRelSampleService
.
remove
(
wrapper
.
in
(
"sample_id"
,
sampleIds
));
// 2.5.重置委托日志
entrustRecordService
.
record
(
ids
,
EntrustFlowEnum
.
REPORT_MAKE
.
getDisplay
(),
prevFlow
.
getDisplay
(),
1
,
account
,
reason
);
// 2.6.发送消息
...
...
@@ -1652,7 +1620,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
if
(
null
==
entrustDTO
.
getId
())
{
saveEntrustDTO
(
entrustDTO
,
true
,
account
);
}
else
{
editEntrust
(
entrustDTO
,
account
);
editEntrust
(
entrustDTO
,
true
,
account
);
}
return
submitToNextFlow
(
new
Long
[]{
entrustDTO
.
getId
()},
account
);
}
...
...
src/main/resources/mapper/hmhj/EntrustMapper.xml
View file @
9a8a6aa0
...
...
@@ -269,7 +269,8 @@
<select
id=
"selectEntrustProgressList"
resultType=
"com.patzn.cloud.service.hmhj.vo.EntrustVO"
>
SELECT id,code,client,client_tel,entrust_time,assignor,test_side,status,progress,sample_name,
SELECT
id,code,client,client_tel,entrust_time,assignor,test_side,status,progress,sample_name,flow_status,
s."sample_num"
FROM entrust e
left join (select s.entrust_id,count(1) "sample_num" from entrust_sample s
...
...
src/main/resources/mapper/hmhj/OriginalTemplateItemMapper.xml
View file @
9a8a6aa0
...
...
@@ -7,23 +7,24 @@
distinct ot.id
from original_template ot
left join (
select st.company_id,st.template_id,string_agg(st.name,'~~') || '~~' "sname"
select st.company_id,st.template_id,string_agg(
distinct
st.name,'~~') || '~~' "sname"
from original_template_item st where st.deleted = 0 and st.type = 'sample'
group by st.company_id,st.template_id
) st ON st.template_id = ot.id
left join (
select it.company_id,it.template_id,string_agg(it.name,'~~') || '~~' "iname"
select it.company_id,it.template_id,string_agg(
distinct
it.name,'~~') || '~~' "iname"
from original_template_item it where it.deleted = 0 and it.type = 'item'
group by it.company_id,it.template_id
) it ON it.template_id = ot.id
where ot.deleted = 0 and (
<foreach
collection=
"sampleItemList"
index=
"index"
item=
"sampleItem"
separator=
"or"
open=
"("
close=
")"
>
1 != 2
(st.sname is not null or it.iname is not null)
<if
test=
"null != sampleItem.name"
>
and
strpos(st.sname,concat(#{sampleItem.name},'~~')) > 0
and
( st.sname is null or strpos(st.sname,concat(#{sampleItem.name},'~~')) > 0)
</if>
<if
test=
"null != sampleItem.itemList"
>
and (
and (
it.iname is null or
<foreach
collection=
"sampleItem.itemList"
index=
"ix"
item=
"item"
separator=
"or"
open=
"("
close=
")"
>
strpos(it.iname,concat(#{item},'~~')) > 0
</foreach>
...
...
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