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
fd9a5857
Commit
fd9a5857
authored
May 09, 2022
by
lijingjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加相关日志
parent
ff190ea8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
27 deletions
+62
-27
EntrustReportServiceImpl.java
...vice/lims/hmhj/service/impl/EntrustReportServiceImpl.java
+18
-8
EntrustSampleServiceImpl.java
...vice/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
+19
-7
EntrustServiceImpl.java
...ud/service/lims/hmhj/service/impl/EntrustServiceImpl.java
+24
-11
application-dev.yml
src/main/resources/application-dev.yml
+1
-1
No files found.
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustReportServiceImpl.java
View file @
fd9a5857
...
...
@@ -618,17 +618,24 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
flowStatus
=
fromFlowStatus
.
getName
();
entrust
.
setFlowStatus
(
flowStatus
);
}
// 当终止节点不一致,当以状态路径配置的下一节点为准
// 当终止节点不一致,当以状态路径配置的下一
个
节点为准
if
(
StringUtils
.
isNotBlank
(
statusPath
))
{
EntrustFlowEnum
nextFlowStatus
=
EntrustFlowUtils
.
getNextFlowStatus
(
flowStatus
,
statusPath
);
RestAssert
.
fail
(
null
==
nextFlowStatus
,
"配置的状态路径没有下一步!"
);
RestAssert
.
fail
(
nextFlowStatus
.
getValue
()
<
fromFlowStatus
.
getValue
(),
String
.
format
(
"起始流程节点配置存在问题:从【%s】,至【%s】"
,
fromFlowStatus
.
getDisplay
(),
nextFlowStatus
.
getDisplay
()));
toFlowStatus
=
nextFlowStatus
;
// 质量判定才触发此逻辑
if
(
toFlowStatus
==
EntrustFlowEnum
.
QUALITY_JUDGE
)
{
entrustService
.
submitToNextNode
(
entrust
,
account
);
// 不再从submitToNextNode中处理,直接处理委托质量判定相关内容
// entrustService.submitToNextNode(entrust, account);
// 委托状态获取,实际从状态路径获取,此处直接使用质量判定即可
EntrustStatusEnum
nextStatus
=
EntrustStatusEnum
.
QUALITY_CHECK
;
// 修改委托状态信息
entrust
.
setStatus
(
nextStatus
);
entrust
.
setProgress
(
nextStatus
);
entrust
.
setFlowStatus
(
toFlowStatus
.
getName
());
entrustSampleService
.
updateSampleNextFlowInfo
(
entrust
,
nextFlowStatus
,
account
);
}
}
...
...
@@ -684,12 +691,16 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
// 更新对应委托流程状态
// 过滤掉标样,空白样
List
<
EntrustSample
>
entrustSamples
=
entrustSampleService
.
getNormalByEntrustId
(
entrust
.
getId
());
List
<
EntrustSample
>
normalSampleList
=
entrustSampleService
.
getNormalByEntrustId
(
entrust
.
getId
());
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
normalSampleList
),
"正常样品为空!"
);
// ==
EntrustSampleStatusEnum
finalSampleStatusEnum
=
sampleStatusEnum
;
if
(
CollectionUtils
.
isNotEmpty
(
entrustSamples
)
&&
entrustSamples
.
stream
().
filter
(
t
->
!
sampleIds
.
contains
(
t
.
getId
())
).
noneMatch
(
t
->
(
int
)
t
.
getStatus
().
getValue
()
<
(
int
)
finalSampleStatusEnum
.
getValue
()))
{
// 从正常样品中过滤出提交的样品,匹配是否存在剩余未处理的样品
boolean
isDealEnd
=
normalSampleList
.
stream
().
filter
(
t
->
!
sampleIds
.
contains
(
t
.
getId
()))
.
noneMatch
(
t
->
(
int
)
t
.
getStatus
().
getValue
()
<
(
int
)
finalSampleStatusEnum
.
getValue
());
// 处理完成,更新委托和样品状态
if
(
isDealEnd
)
{
entrust
.
setFlowStatus
(
toFlowStatus
.
getName
());
entrustService
.
updateById
(
entrust
);
entrustRecordService
.
record
(
Collections
.
singletonList
(
entrust
.
getId
()),
fromFlowStatus
.
getDisplay
(),
...
...
@@ -743,7 +754,6 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
}
Entrust
entrust
=
entrustService
.
getById
(
entrustId
);
String
sampleName
=
"铝成品"
;
Account
account
=
LoginHelper
.
getAccount
();
// ==
List
<
EntrustSample
>
sampleList
=
new
ArrayList
<>();
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
View file @
fd9a5857
...
...
@@ -11,6 +11,7 @@ import com.patzn.cloud.commons.api.RestAssert;
import
com.patzn.cloud.commons.constant.CommonConstants
;
import
com.patzn.cloud.commons.controller.Account
;
import
com.patzn.cloud.commons.controller.LoginHelper
;
import
com.patzn.cloud.commons.enums.IBaseEnum
;
import
com.patzn.cloud.commons.exception.PatznException
;
import
com.patzn.cloud.commons.service.impl.BaseServiceImpl
;
import
com.patzn.cloud.commons.toolkit.DateUtils
;
...
...
@@ -382,12 +383,20 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
return
result
;
}
private
void
prints
(
String
title
,
IBaseEnum
baseEnum
)
{
logger
.
error
(
"{}状态为:{},{},{}。"
,
title
,
baseEnum
.
getName
(),
baseEnum
.
getValue
(),
baseEnum
.
getDisplay
());
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
updateSampleNextFlowInfo
(
Entrust
entrust
,
EntrustFlowEnum
nextFlowStatus
,
Account
account
)
{
List
<
EntrustSample
>
sampleList
=
list
(
Condition
.
create
().
eq
(
"entrust_id"
,
entrust
.
getId
()).
eq
(
"deleted"
,
0
));
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleList
),
String
.
format
(
"编号为【%s】委托下样品为空"
,
entrust
.
getCode
()));
logger
.
error
(
"开始执行更新样品及检测项目流程....."
);
logger
.
error
(
"委托ID:{},委托编号:{}。"
,
entrust
.
getId
(),
entrust
.
getCode
());
List
<
EntrustSample
>
sampleList
=
getByEntrustId
(
entrust
.
getId
());
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleList
),
String
.
format
(
"编号为【%s】的委托下样品为空"
,
entrust
.
getCode
()));
logger
.
error
(
"样品数量:{}"
,
sampleList
.
size
());
Long
[]
sampleIds
=
sampleList
.
stream
().
map
(
t
->
t
.
getId
()).
toArray
(
size
->
new
Long
[
size
]);
prints
(
"样品的下一级流程"
,
nextFlowStatus
);
//
EntrustSample
updateSample
=
new
EntrustSample
();
EntrustSampleItem
updateItem
=
new
EntrustSampleItem
();
...
...
@@ -437,6 +446,9 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
itemStatus
=
EntrustSampleItemStatusEnum
.
END
;
}
prints
(
"样品即将更新"
,
sampleStatus
);
prints
(
"项目即将更新"
,
itemStatus
);
// 哪一级别
int
whichLevel
=
1
;
int
nextFlowVal
=
nextFlowStatus
.
getValue
().
intValue
();
...
...
@@ -451,10 +463,10 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
}
if
(
null
!=
sampleStatus
)
{
updateSample
.
setStatus
(
sampleStatus
);
// 判定是否为质量判定
// 若为质量判定,判断需要判级
boolean
isRequireJudgeGrading
=
isRequireJudgeGrading
(
entrust
.
getId
());
logger
.
error
(
"样品判级时使用。是否需要判定:{}"
,
isRequireJudgeGrading
);
for
(
EntrustSample
sample
:
sampleList
)
{
// 排除批样样品编号
if
(
2
!=
sample
.
getType
())
{
...
...
@@ -475,7 +487,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
}
}
}
// update(updateSample, Condition.create().eq("entrust_id", entrust.getId())
);
logger
.
error
(
"执行批量更新样品信息......."
);
// 批量更新样品编号和状态
updateBatchById
(
sampleList
);
}
...
...
@@ -483,7 +495,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
updateItem
.
setStatus
(
itemStatus
).
setProgress
(
itemStatus
);
entrustSampleItemService
.
update
(
updateItem
,
Condition
.
create
().
in
(
"entrust_sample_id"
,
sampleIds
));
}
return
fals
e
;
return
tru
e
;
}
@Override
...
...
@@ -618,7 +630,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
@Override
public
List
<
EntrustSample
>
getByEntrustId
(
Long
entrustId
)
{
return
list
(
Condition
.
create
().
eq
(
"entrust_id"
,
entrustId
)
.
eq
(
"deleted"
,
0
)
);
return
list
(
Condition
.
create
().
eq
(
"entrust_id"
,
entrustId
));
}
@Override
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustServiceImpl.java
View file @
fd9a5857
...
...
@@ -434,6 +434,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
}
EntrustSample
sample
=
sampleDTO
.
convert
(
EntrustSample
.
class
);
sample
.
setEntrustId
(
entrust
.
getId
());
// 只有在提交时,才初始化样品编号
if
(
isSubmit
)
{
if
(
StringUtils
.
isBlank
(
sample
.
getCode
()))
{
handleSampleCode
(
entrust
,
sample
);
...
...
@@ -447,6 +448,8 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
sample
.
setId
(
IdWorker
.
getId
());
sample
.
setOrderBy
(
incNum
);
saveSampleList
.
add
(
sample
);
logger
.
error
(
"添加了编号为【{}】的【{}】样品。"
,
sample
.
getCode
(),
sample
.
getName
());
// 样品的顺序号,为了插入标样方便设置
incNum
+=
10
;
List
<
EntrustSampleItem
>
experiments
=
sampleDTO
.
getItemList
();
if
(
CollectionUtils
.
isEmpty
(
experiments
))
{
...
...
@@ -628,9 +631,8 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
editEntrust
(
EntrustDTO
entrustDTO
,
boolean
isSubmit
,
Account
account
)
{
if
(
null
==
entrustDTO
.
getId
())
{
return
false
;
}
final
Long
entrustId
=
entrustDTO
.
getId
();
RestAssert
.
fail
(
Objects
.
isNull
(
entrustId
),
"委托编号为空"
);
List
<
EntrustSampleDTO
>
sampleList
=
entrustDTO
.
getSampleDTOList
();
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleList
),
"委托样品为空"
);
RestAssert
.
fail
(
sampleList
.
stream
().
map
(
EntrustSampleDTO:
:
getName
).
distinct
().
count
()
>
1
,
"一个委托只能下同一种样品!"
);
...
...
@@ -648,9 +650,10 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
RestAssert
.
fail
(
sampleNames
.
size
()
>
1
,
"一个委托只能下同一种样品!"
);
Entrust
entrust
=
entrustDTO
.
convert
(
Entrust
.
class
);
// 保存样品名字至委托备用
entrust
.
setSampleName
(
sampleList
.
get
(
0
).
getName
());
if
(
updateById
(
entrust
))
{
final
Long
entrustId
=
entrust
.
getId
();
List
<
EntrustSample
>
updateSampleList
=
new
ArrayList
<>();
List
<
EntrustSample
>
saveSampleList
=
new
ArrayList
<>();
...
...
@@ -679,8 +682,10 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
if
(
isInsert
)
{
saveSampleList
.
add
(
sample
);
logger
.
error
(
"添加了编号为【{}】的【{}】样品"
,
sample
.
getCode
(),
sample
.
getName
());
}
else
{
updateSampleList
.
add
(
sample
);
logger
.
error
(
"修改了编号为【{}】的【{}】样品"
,
sample
.
getCode
(),
sample
.
getName
());
}
if
(
StringUtils
.
isNotBlank
(
sample
.
getCode
()))
{
...
...
@@ -704,6 +709,8 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
}
}
logger
.
error
(
"样品添加{}个,修改{}个,总共前端提交{}个。"
,
saveSampleList
.
size
(),
updateSampleList
.
size
(),
sampleList
.
size
());
if
(
CollectionUtils
.
isNotEmpty
(
updateSampleList
))
{
entrustSampleService
.
updateBatchById
(
updateSampleList
);
}
...
...
@@ -715,10 +722,10 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
entrustSampleItemService
.
saveBatch
(
saveItemList
);
}
entrustSampleItemService
.
updateItemComposeJudgeByEntrustId
(
entrustId
);
CompletableFuture
.
runAsync
(()
->
{
// 委托费用
// 更新委托下,检测项目组合标记
entrustSampleItemService
.
updateItemComposeJudgeByEntrustId
(
entrustId
);
// 委托费用计算
calTotalFee
(
entrustId
);
});
}
...
...
@@ -988,16 +995,21 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
if
(!
isUpdateSampleInfo
)
{
return
true
;
}
// 异步修改样品信息及其样品附属信息
CompletableFuture
.
runAsync
(()
->
{
entrustSampleService
.
updateSampleNextFlowInfo
(
entrust
,
nextFlowStatus
,
account
);
});
logger
.
error
(
"进入异步执行样品和检测项目状态修改流程......"
);
entrustSampleService
.
updateSampleNextFlowInfo
(
entrust
,
nextFlowStatus
,
account
);
// 修改委托状态信息
entrust
.
setStatus
(
nextStatus
);
entrust
.
setProgress
(
nextStatus
);
entrust
.
setFlowStatus
(
nextFlowStatus
.
getName
());
updateById
(
entrust
);
// 对于质量判定后的消息提醒,不再此处发送
if
(
nextFlowValue
>
13
)
{
return
true
;
}
// 若为特殊需求,必须要走评审
String
uri
=
""
;
// 是否特殊需求
...
...
@@ -1559,6 +1571,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
submitToNextFlow
(
Long
[]
ids
,
Account
account
)
{
logger
.
error
(
"进入提交委托流程......"
);
RestAssert
.
fail
(
null
==
ids
||
0
==
ids
.
length
,
"请选择要提交的委托!"
);
List
<
Entrust
>
entrustList
=
getBatchIds
(
Arrays
.
asList
(
ids
));
List
<
Long
>
specialIds
=
new
ArrayList
<>(),
normalIds
=
new
ArrayList
<>();
...
...
src/main/resources/application-dev.yml
View file @
fd9a5857
...
...
@@ -21,7 +21,7 @@ spring:
cloud
:
consul
:
localhost
rabbitmq
:
host
:
1
24.70.150.247
host
:
1
92.168.0.140
port
:
5672
username
:
mqbase
password
:
mqb123#@$5
...
...
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