Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b40829de
authored
Dec 05, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:派工结果通知bean
1 parent
bb94843d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
27 deletions
project-order/src/main/java/com/dituhui/pea/order/service/OrderInfoService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/DispatchServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderInfoServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/OrderInfoService.java
View file @
b40829d
...
@@ -10,6 +10,7 @@ import com.dituhui.pea.order.entity.SkillInfoEntity;
...
@@ -10,6 +10,7 @@ import com.dituhui.pea.order.entity.SkillInfoEntity;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -69,6 +70,17 @@ public interface OrderInfoService {
...
@@ -69,6 +70,17 @@ public interface OrderInfoService {
* @param isSub 是否指派辅助指派工程师
* @param isSub 是否指派辅助指派工程师
* @return
* @return
*/
*/
public
Result
<
OrderInfoEntity
>
insterEngineerOrders
(
List
<
OrderInfoEntity
>
engineerOrders
,
OrderInfoEntity
insertOrder
,
SkillInfoEntity
skillInfo
,
OrgTeamEntity
orgTeam
,
EngineerInfoEntity
engineer
,
Boolean
isSub
);
Result
<
OrderInfoEntity
>
insterEngineerOrders
(
List
<
OrderInfoEntity
>
engineerOrders
,
OrderInfoEntity
insertOrder
,
SkillInfoEntity
skillInfo
,
OrgTeamEntity
orgTeam
,
EngineerInfoEntity
engineer
,
Boolean
isSub
);
/**
* 派工消息通知bean
*
* @param source 原订单
* @param target 改动后订单
* @param happened 变动发生时间
* @param reason 改约原因
* @param operator 操作人
* @return
*/
Boolean
rescheduled
(
OrderInfoEntity
source
,
OrderInfoEntity
target
,
Date
happened
,
String
reason
,
String
operator
);
}
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/DispatchServiceImpl.java
View file @
b40829d
...
@@ -22,6 +22,7 @@ import com.google.common.collect.Sets;
...
@@ -22,6 +22,7 @@ import com.google.common.collect.Sets;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -359,6 +360,8 @@ public class DispatchServiceImpl implements DispatchService {
...
@@ -359,6 +360,8 @@ public class DispatchServiceImpl implements DispatchService {
OrgTeamEntity
byTeamId
=
orgTeamDao
.
getByTeamId
(
orgTeamEngineers
.
get
(
0
).
getTeamId
());
OrgTeamEntity
byTeamId
=
orgTeamDao
.
getByTeamId
(
orgTeamEngineers
.
get
(
0
).
getTeamId
());
for
(
OrderInfoEntity
entity
:
orders
)
{
for
(
OrderInfoEntity
entity
:
orders
)
{
final
OrderInfoEntity
sourceOrder
=
new
OrderInfoEntity
();
BeanUtils
.
copyProperties
(
entity
,
sourceOrder
);
if
(
StringUtils
.
isNotBlank
(
entity
.
getEngineerCode
())
&&
entity
.
getEngineerCode
().
equals
(
engineer
.
getEngineerCode
()))
{
if
(
StringUtils
.
isNotBlank
(
entity
.
getEngineerCode
())
&&
entity
.
getEngineerCode
().
equals
(
engineer
.
getEngineerCode
()))
{
return
Result
.
failed
(
String
.
format
(
"订单已指派给技术员[%s], 不必重复指派给同一个技术员"
,
engineer
.
getName
()));
return
Result
.
failed
(
String
.
format
(
"订单已指派给技术员[%s], 不必重复指派给同一个技术员"
,
engineer
.
getName
()));
}
}
...
@@ -394,6 +397,13 @@ public class DispatchServiceImpl implements DispatchService {
...
@@ -394,6 +397,13 @@ public class DispatchServiceImpl implements DispatchService {
entity
.
setOrgBranchId
(
byTeamId
.
getBranchId
());
entity
.
setOrgBranchId
(
byTeamId
.
getBranchId
());
entity
.
setOrgClusterId
(
byTeamId
.
getClusterId
());
entity
.
setOrgClusterId
(
byTeamId
.
getClusterId
());
}
}
//回调改约
Boolean
boo
=
orderInfoService
.
rescheduled
(
sourceOrder
,
entity
,
new
Date
(),
""
,
"PEA"
);
log
.
info
(
"[orderReschedule] orderId:{}, 通知bean结果: {}"
,
sourceOrder
.
getOrderId
(),
boo
);
if
(!
boo
)
{
throw
new
BusinessException
(
"服务工单变更结果通知BEAN失败"
);
}
orderInfoDao
.
save
(
entity
);
orderInfoDao
.
save
(
entity
);
//记录流程
//记录流程
commonService
.
addOrderEvent
(
entity
.
getOrderId
(),
""
,
"PEA"
,
"PEA"
,
OrderEventEnum
.
reassignment
.
getEvent
(),
commonService
.
addOrderEvent
(
entity
.
getOrderId
(),
""
,
"PEA"
,
"PEA"
,
OrderEventEnum
.
reassignment
.
getEvent
(),
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
View file @
b40829d
...
@@ -54,6 +54,7 @@ import lombok.Setter;
...
@@ -54,6 +54,7 @@ import lombok.Setter;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -66,16 +67,7 @@ import javax.persistence.criteria.Root;
...
@@ -66,16 +67,7 @@ import javax.persistence.criteria.Root;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
@Service
...
@@ -218,7 +210,8 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -218,7 +210,8 @@ public class OrderAssignImpl implements OrderAssign {
if
(
entity
==
null
)
{
if
(
entity
==
null
)
{
return
Result
.
failed
(
"订单不存在"
);
return
Result
.
failed
(
"订单不存在"
);
}
}
final
OrderInfoEntity
sourceOrder
=
new
OrderInfoEntity
();
BeanUtils
.
copyProperties
(
entity
,
sourceOrder
);
EngineerInfoEntity
engineer
=
engineerInfoDao
.
getByEngineerCode
(
req
.
getEngineerCode
());
EngineerInfoEntity
engineer
=
engineerInfoDao
.
getByEngineerCode
(
req
.
getEngineerCode
());
List
<
OrgTeamEngineerEntity
>
orgTeamEngineers
=
orgTeamEngineerDao
.
findByEngineerCode
(
engineer
.
getEngineerCode
());
List
<
OrgTeamEngineerEntity
>
orgTeamEngineers
=
orgTeamEngineerDao
.
findByEngineerCode
(
engineer
.
getEngineerCode
());
...
@@ -256,6 +249,12 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -256,6 +249,12 @@ public class OrderAssignImpl implements OrderAssign {
entity
.
setOrgBranchId
(
byTeamId
.
getBranchId
());
entity
.
setOrgBranchId
(
byTeamId
.
getBranchId
());
entity
.
setOrgClusterId
(
byTeamId
.
getClusterId
());
entity
.
setOrgClusterId
(
byTeamId
.
getClusterId
());
}
}
//回调改约
Boolean
boo
=
orderInfoService
.
rescheduled
(
sourceOrder
,
entity
,
new
Date
(),
""
,
"PEA"
);
log
.
info
(
"[orderReschedule] orderId:{}, 通知bean结果: {}"
,
sourceOrder
.
getOrderId
(),
boo
);
if
(!
boo
)
{
throw
new
BusinessException
(
"服务工单变更结果通知BEAN失败"
);
}
orderInfoDao
.
save
(
entity
);
orderInfoDao
.
save
(
entity
);
// 工单变更登记
// 工单变更登记
commonService
.
addOrderEvent
(
entity
.
getOrderId
(),
""
,
"BEAN"
,
"BEAN"
,
OrderEventEnum
.
reassignment
.
getEvent
(),
commonService
.
addOrderEvent
(
entity
.
getOrderId
(),
""
,
"BEAN"
,
"BEAN"
,
OrderEventEnum
.
reassignment
.
getEvent
(),
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderInfoServiceImpl.java
View file @
b40829d
...
@@ -476,11 +476,11 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -476,11 +476,11 @@ public class OrderInfoServiceImpl implements OrderInfoService {
order
.
setPlanEndTime
(
order
.
getExpectTimeEnd
());
order
.
setPlanEndTime
(
order
.
getExpectTimeEnd
());
orderInfoDao
.
save
(
order
);
orderInfoDao
.
save
(
order
);
log
.
info
(
"[orderReschedule] orderId:{}, order: {}"
,
order
.
getOrderId
(),
JSONObject
.
toJSONString
(
order
));
log
.
info
(
"[orderReschedule] orderId:{}, order: {}"
,
order
.
getOrderId
(),
JSONObject
.
toJSONString
(
order
));
//
//
回调改约
if
(!
Objects
.
equals
(
req
.
getOperator
(),
"BEAN"
))
{
Boolean
boo
=
this
.
rescheduled
(
sourceOrder
,
order
,
req
.
getHappendDate
(),
req
.
getReschedulingReason
(),
StringUtils
.
isNotBlank
(
req
.
getOperator
())
?
req
.
getOperator
()
:
"PEA"
);
//回调改约
log
.
info
(
"[orderReschedule] orderId:{}, 通知bean结果: {}"
,
order
.
getOrderId
(),
boo
);
Rescheduled
pea
=
rescheduled
(
sourceOrder
,
order
,
req
.
getHappendDate
(),
req
.
getReschedulingReason
(),
"PEA"
);
if
(!
boo
)
{
beanRemoteService
.
orderRescheduled
(
pea
);
throw
new
BusinessException
(
"服务工单变更结果通知BEAN失败"
);
}
}
// 登记事件
// 登记事件
commonService
.
addOrderEvent
(
req
.
getOrderId
(),
""
,
req
.
getOperator
(),
req
.
getOperator
(),
OrderEventEnum
.
recontracting
.
getEvent
(),
String
.
format
(
OrderEventEnum
.
recontracting
.
getMsg
(),
engineerName
+
"-"
+
(
ObjectUtil
.
isNotNull
(
orgTeamEntity
)
?
orgTeamEntity
.
getTeamName
()
:
""
),
ObjectUtil
.
isNotNull
(
orgGroupEntity
)
?
orgGroupEntity
.
getGroupName
()
:
""
,
req
.
getExpectBegin
(),
req
.
getReschedulingReason
()),
StringUtils
.
isNotBlank
(
req
.
getReschedulingReason
())
?
"改约原因:"
+
req
.
getReschedulingReason
()
:
""
);
commonService
.
addOrderEvent
(
req
.
getOrderId
(),
""
,
req
.
getOperator
(),
req
.
getOperator
(),
OrderEventEnum
.
recontracting
.
getEvent
(),
String
.
format
(
OrderEventEnum
.
recontracting
.
getMsg
(),
engineerName
+
"-"
+
(
ObjectUtil
.
isNotNull
(
orgTeamEntity
)
?
orgTeamEntity
.
getTeamName
()
:
""
),
ObjectUtil
.
isNotNull
(
orgGroupEntity
)
?
orgGroupEntity
.
getGroupName
()
:
""
,
req
.
getExpectBegin
(),
req
.
getReschedulingReason
()),
StringUtils
.
isNotBlank
(
req
.
getReschedulingReason
())
?
"改约原因:"
+
req
.
getReschedulingReason
()
:
""
);
...
@@ -489,7 +489,11 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -489,7 +489,11 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
}
public
Rescheduled
rescheduled
(
OrderInfoEntity
source
,
OrderInfoEntity
target
,
Date
happened
,
String
reason
,
String
operator
)
{
@Override
public
Boolean
rescheduled
(
OrderInfoEntity
source
,
OrderInfoEntity
target
,
Date
happened
,
String
reason
,
String
operator
)
{
if
(
source
.
getOrderId
().
startsWith
(
"peatest"
)
||
Objects
.
equals
(
operator
,
"BEAN"
))
{
return
true
;
}
Rescheduled
rescheduled
=
new
Rescheduled
();
Rescheduled
rescheduled
=
new
Rescheduled
();
rescheduled
.
setRisId
(
source
.
getOrderId
());
rescheduled
.
setRisId
(
source
.
getOrderId
());
...
@@ -501,24 +505,24 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -501,24 +505,24 @@ public class OrderInfoServiceImpl implements OrderInfoService {
rescheduled
.
setRequireApprove
(
Boolean
.
FALSE
);
rescheduled
.
setRequireApprove
(
Boolean
.
FALSE
);
String
engineerCode
=
target
.
getEngineerCode
();
String
engineerCode
=
target
.
getEngineerCode
();
EngineerInfoEntity
byEngineerCode
=
engineerInfoDao
.
getByEngineerCode
(
engineerCode
);
rescheduled
.
setExecutorWorkNo
(
byEngineerCode
.
getCosmosId
());
rescheduled
.
setOrgUnitId
(
byEngineerCode
.
getGroupId
());
if
(
StringUtils
.
isNotBlank
(
target
.
getEngineerCodeSub
()))
{
EngineerInfoEntity
code
=
engineerInfoDao
.
getByEngineerCode
(
target
.
getEngineerCodeSub
());
rescheduled
.
setAssistantWorkNo
(
code
.
getCosmosId
());
rescheduled
.
setAssOrgUnitId
(
code
.
getGroupId
());
}
if
((
StringUtils
.
isNotBlank
(
target
.
getEngineerCode
())
&&
!
Objects
.
equals
(
engineerCode
,
source
.
getEngineerCode
()))
||
if
((
StringUtils
.
isNotBlank
(
target
.
getEngineerCode
())
&&
!
Objects
.
equals
(
engineerCode
,
source
.
getEngineerCode
()))
||
(
StringUtils
.
isNotBlank
(
target
.
getEngineerCodeSub
())
&&
!
Objects
.
equals
(
target
.
getEngineerCodeSub
(),
source
.
getEngineerCodeSub
())))
{
(
StringUtils
.
isNotBlank
(
target
.
getEngineerCodeSub
())
&&
!
Objects
.
equals
(
target
.
getEngineerCodeSub
(),
source
.
getEngineerCodeSub
())))
{
rescheduled
.
setReassignment
(
Boolean
.
TRUE
);
rescheduled
.
setReassignment
(
Boolean
.
TRUE
);
}
else
{
}
else
{
rescheduled
.
setReassignment
(
Boolean
.
FALSE
);
rescheduled
.
setReassignment
(
Boolean
.
FALSE
);
EngineerInfoEntity
byEngineerCode
=
engineerInfoDao
.
getByEngineerCode
(
engineerCode
);
rescheduled
.
setExecutorWorkNo
(
engineerCode
);
rescheduled
.
setOrgUnitId
(
byEngineerCode
.
getGroupId
());
if
(
StringUtils
.
isNotBlank
(
target
.
getEngineerCodeSub
()))
{
rescheduled
.
setAssistantWorkNo
(
target
.
getEngineerCodeSub
());
EngineerInfoEntity
code
=
engineerInfoDao
.
getByEngineerCode
(
target
.
getEngineerCodeSub
());
rescheduled
.
setAssOrgUnitId
(
code
.
getGroupId
());
}
}
}
return
rescheduled
;
return
beanRemoteService
.
orderRescheduled
(
rescheduled
)
;
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment