Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
O
on-site-service
Project
Project
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
external
on-site-service
Commits
7e1a0bc7
Commit
7e1a0bc7
authored
Jul 28, 2022
by
lining
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 狂点接口的bug+估价员不能发送订单的bug
parent
c455b30a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
30 deletions
+49
-30
ServiceOrderService.java
.../com/onsiteservice/service/order/ServiceOrderService.java
+49
-30
No files found.
common/src/main/java/com/onsiteservice/service/order/ServiceOrderService.java
View file @
7e1a0bc7
package
com
.
onsiteservice
.
service
.
order
;
package
com
.
onsiteservice
.
service
.
order
;
import
com.google.common.collect.Sets
;
import
com.onsiteservice.common.order.dto.DispatchServiceOrderDTO
;
import
com.onsiteservice.common.order.dto.DispatchServiceOrderDTO
;
import
com.onsiteservice.common.order.dto.FinishServiceOrderDTO
;
import
com.onsiteservice.common.order.dto.FinishServiceOrderDTO
;
import
com.onsiteservice.common.order.dto.SendServiceOrderDTO
;
import
com.onsiteservice.common.order.dto.SendServiceOrderDTO
;
...
@@ -18,7 +19,6 @@ import com.onsiteservice.dao.mapper.sys.SysParamMapper;
...
@@ -18,7 +19,6 @@ import com.onsiteservice.dao.mapper.sys.SysParamMapper;
import
com.onsiteservice.dao.mapper.sys.SysUserMapper
;
import
com.onsiteservice.dao.mapper.sys.SysUserMapper
;
import
com.onsiteservice.dao.mapper.user.UserMapper
;
import
com.onsiteservice.dao.mapper.user.UserMapper
;
import
com.onsiteservice.entity.order.ServiceOrder
;
import
com.onsiteservice.entity.order.ServiceOrder
;
import
com.onsiteservice.entity.service.ServiceValuator
;
import
com.onsiteservice.entity.service.ServiceValuatorAssign
;
import
com.onsiteservice.entity.service.ServiceValuatorAssign
;
import
com.onsiteservice.entity.service.ServiceWorker
;
import
com.onsiteservice.entity.service.ServiceWorker
;
import
com.onsiteservice.entity.service.ServiceWorkerAssign
;
import
com.onsiteservice.entity.service.ServiceWorkerAssign
;
...
@@ -38,6 +38,8 @@ import javax.annotation.Resource;
...
@@ -38,6 +38,8 @@ import javax.annotation.Resource;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
@Service
@Service
@Slf4j
@Slf4j
...
@@ -85,7 +87,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -85,7 +87,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
public
int
valuation
(
ValuationServiceOrderDTO
dto
,
Long
userId
,
ServiceOrderOpSourceEnum
sourceEnum
)
{
public
int
valuation
(
ValuationServiceOrderDTO
dto
,
Long
userId
,
ServiceOrderOpSourceEnum
sourceEnum
)
{
log
.
info
(
"order valuation dto: {}, userId: {}"
,
dto
,
userId
);
log
.
info
(
"order valuation dto: {}, userId: {}"
,
dto
,
userId
);
WorkUser
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_VALUATION_ORDER
,
sourceEnum
);
WorkUser
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_VALUATION_ORDER
,
sourceEnum
,
Sets
.
newHashSet
(
ServiceUserTypeEnum
.
ADMIN
)
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
RESERVE
.
getStatus
()))
{
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
RESERVE
.
getStatus
()))
{
...
@@ -97,15 +99,16 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -97,15 +99,16 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_VALUATOR_NOT_EXIST
);
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_VALUATOR_NOT_EXIST
);
}
}
serviceValuatorAssignMapper
.
insertSelective
(
buildServiceValuatorAssign
(
dto
,
userId
));
Condition
c
=
buildOrderStatusCondition
(
serviceOrder
);
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
());
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
());
serviceOrder
.
setModifyBy
(
userId
);
serviceOrder
.
setModifyBy
(
userId
);
serviceOrder
.
setValuatorId
(
valuatorUser
.
getId
());
serviceOrder
.
setValuatorId
(
valuatorUser
.
getId
());
int
result
=
serviceOrderMapper
.
updateByConditionSelective
(
serviceOrder
,
c
);
int
result
=
this
.
updateByPrimaryKeySelective
(
serviceOrder
);
if
(
result
==
1
)
{
if
(
result
==
1
)
{
// 记录估价员指派时间
serviceValuatorAssignMapper
.
insertSelective
(
buildServiceValuatorAssign
(
dto
,
userId
));
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
VALUATION
.
getMsg
(),
user
.
getName
(),
valuatorUser
.
getUserName
());
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
VALUATION
.
getMsg
(),
user
.
getName
(),
valuatorUser
.
getUserName
());
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
(),
description
,
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
(),
description
,
sourceEnum
,
valuatorUser
.
getId
(),
dto
.
getRemark
(),
dto
.
getExpectArrivalTime
());
sourceEnum
,
valuatorUser
.
getId
(),
dto
.
getRemark
(),
dto
.
getExpectArrivalTime
());
...
@@ -118,7 +121,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -118,7 +121,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
public
int
revaluation
(
ValuationServiceOrderDTO
dto
,
Long
userId
,
ServiceOrderOpSourceEnum
sourceEnum
)
{
public
int
revaluation
(
ValuationServiceOrderDTO
dto
,
Long
userId
,
ServiceOrderOpSourceEnum
sourceEnum
)
{
log
.
info
(
"order revaluation dto: {}, userId: {}"
,
dto
,
userId
);
log
.
info
(
"order revaluation dto: {}, userId: {}"
,
dto
,
userId
);
WorkUser
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_REVALUATION_ORDER
,
sourceEnum
);
WorkUser
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_REVALUATION_ORDER
,
sourceEnum
,
Sets
.
newHashSet
(
ServiceUserTypeEnum
.
ADMIN
)
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
()))
{
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
()))
{
...
@@ -130,14 +133,15 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -130,14 +133,15 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_VALUATOR_NOT_EXIST
);
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_VALUATOR_NOT_EXIST
);
}
}
disableServiceValuatorAssign
(
serviceOrder
,
userId
,
false
);
serviceValuatorAssignMapper
.
insertSelective
(
buildServiceValuatorAssign
(
dto
,
userId
));
serviceOrder
.
setValuatorId
(
dto
.
getHostId
());
serviceOrder
.
setValuatorId
(
dto
.
getHostId
());
int
result
=
this
.
updateByPrimaryKeySelective
(
serviceOrder
);
int
result
=
this
.
updateByPrimaryKeySelective
(
serviceOrder
);
if
(
result
==
1
)
{
if
(
result
==
1
)
{
// 取消之前被指派的估价员时间
disableServiceValuatorAssign
(
serviceOrder
,
userId
,
false
);
// 设置新的估计员世间
serviceValuatorAssignMapper
.
insertSelective
(
buildServiceValuatorAssign
(
dto
,
userId
));
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
REVALUATION
.
getMsg
(),
user
.
getName
(),
valuatorUser
.
getUserName
());
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
REVALUATION
.
getMsg
(),
user
.
getName
(),
valuatorUser
.
getUserName
());
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
REVALUATION
.
getStatus
(),
description
,
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
REVALUATION
.
getStatus
(),
description
,
sourceEnum
,
valuatorUser
.
getId
(),
dto
.
getRemark
(),
dto
.
getExpectArrivalTime
());
sourceEnum
,
valuatorUser
.
getId
(),
dto
.
getRemark
(),
dto
.
getExpectArrivalTime
());
...
@@ -154,16 +158,15 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -154,16 +158,15 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
log
.
info
(
"sendOrder dto: {}, userId: {}"
,
dto
,
userId
);
log
.
info
(
"sendOrder dto: {}, userId: {}"
,
dto
,
userId
);
// 判断发送者权限 只有客服和估价员可以发送订单
// 判断发送者权限 只有客服和估价员可以发送订单
WorkUser
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_SEND_ORDER
,
sourceEnum
);
WorkUser
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_SEND_ORDER
,
sourceEnum
,
Sets
.
newHashSet
(
ServiceUserTypeEnum
.
ADMIN
,
ServiceUserTypeEnum
.
VALUATOR
)
);
// 判断能发送的状态: 估价
可以发送,下单可以直接
发送
// 判断能发送的状态: 估价
后可以发送,预约后可以
发送
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
())
&&
!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
RESERVE
.
getStatus
()))
{
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
())
&&
!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
RESERVE
.
getStatus
()))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_SEND
);
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_SEND
);
}
}
disableServiceValuatorAssign
(
serviceOrder
,
userId
,
null
);
Condition
c
=
buildOrderStatusCondition
(
serviceOrder
);
// 估价价格
// 估价价格
serviceOrder
.
setPrice
(
dto
.
getPrice
());
serviceOrder
.
setPrice
(
dto
.
getPrice
());
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
SEND
.
getStatus
());
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
SEND
.
getStatus
());
...
@@ -174,8 +177,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -174,8 +177,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
List
<
SysParam
>
sysParamList
=
sysParamMapper
.
selectByCondition
(
sysParamCondition
);
List
<
SysParam
>
sysParamList
=
sysParamMapper
.
selectByCondition
(
sysParamCondition
);
long
timeOut
=
CollectionUtils
.
isEmpty
(
sysParamList
)
?
BizConstants
.
OrderConstants
.
TIMEOUT_CANCEL_LIMIT
:
Long
.
parseLong
(
sysParamList
.
get
(
0
).
getValue
());
long
timeOut
=
CollectionUtils
.
isEmpty
(
sysParamList
)
?
BizConstants
.
OrderConstants
.
TIMEOUT_CANCEL_LIMIT
:
Long
.
parseLong
(
sysParamList
.
get
(
0
).
getValue
());
serviceOrder
.
setCancelTime
(
new
Date
(
System
.
currentTimeMillis
()
+
timeOut
));
serviceOrder
.
setCancelTime
(
new
Date
(
System
.
currentTimeMillis
()
+
timeOut
));
int
result
=
serviceOrderMapper
.
updateByConditionSelective
(
serviceOrder
,
c
);
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
serviceOrder
);
try
{
try
{
// 发短信
// 发短信
...
@@ -189,6 +191,9 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -189,6 +191,9 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
// TODO 小程序通知客户完成支付
// TODO 小程序通知客户完成支付
if
(
result
==
1
)
{
if
(
result
==
1
)
{
// 置估价员指派时间为失效
disableServiceValuatorAssign
(
serviceOrder
,
userId
,
null
);
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
SEND
.
getMsg
(),
(
user
.
getIsAdmin
()
?
ServiceUserTypeEnum
.
ADMIN
.
getName
()
:
ServiceUserTypeEnum
.
VALUATOR
.
getName
())
+
user
.
getName
());
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
SEND
.
getMsg
(),
(
user
.
getIsAdmin
()
?
ServiceUserTypeEnum
.
ADMIN
.
getName
()
:
ServiceUserTypeEnum
.
VALUATOR
.
getName
())
+
user
.
getName
());
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
SEND
.
getStatus
(),
description
,
sourceEnum
,
userId
,
null
,
null
);
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
SEND
.
getStatus
(),
description
,
sourceEnum
,
userId
,
null
,
null
);
}
}
...
@@ -200,7 +205,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -200,7 +205,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
public
int
dispatch
(
DispatchServiceOrderDTO
dto
,
Long
userId
,
ServiceOrderOpSourceEnum
sourceEnum
)
{
public
int
dispatch
(
DispatchServiceOrderDTO
dto
,
Long
userId
,
ServiceOrderOpSourceEnum
sourceEnum
)
{
log
.
info
(
"order dispatch dto: {}, userId: {}"
,
dto
,
userId
);
log
.
info
(
"order dispatch dto: {}, userId: {}"
,
dto
,
userId
);
WorkUser
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_DISPATCH_ORDER
,
sourceEnum
);
WorkUser
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_DISPATCH_ORDER
,
sourceEnum
,
Sets
.
newHashSet
(
ServiceUserTypeEnum
.
ADMIN
)
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
PAY
.
getStatus
()))
{
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
PAY
.
getStatus
()))
{
...
@@ -216,18 +221,19 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -216,18 +221,19 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_WORKER_NOT_EXIST
);
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_WORKER_NOT_EXIST
);
}
}
serviceWorkerAssignMapper
.
insertSelective
(
buildServiceWorkerAssign
(
dto
,
serviceOrder
,
userId
));
Condition
c
=
buildOrderStatusCondition
(
serviceOrder
);
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
());
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
());
serviceOrder
.
setModifyBy
(
userId
);
serviceOrder
.
setModifyBy
(
userId
);
int
result
=
serviceOrderMapper
.
updateByConditionSelective
(
serviceOrder
,
c
);
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
serviceOrder
);
// TODO 短信 "您的订单已为您指派维修工,请保持手机畅通!"
// TODO 短信 "您的订单已为您指派维修工,请保持手机畅通!"
// TODO 小程序通知 您的订单已为您指派维修工~~~
// TODO 小程序通知 您的订单已为您指派维修工~~~
if
(
result
==
1
)
{
if
(
result
==
1
)
{
// 记录维修工时间
serviceWorkerAssignMapper
.
insertSelective
(
buildServiceWorkerAssign
(
dto
,
serviceOrder
,
userId
));
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
DISPATCH
.
getMsg
(),
user
.
getName
(),
serviceWorker
.
getName
());
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
DISPATCH
.
getMsg
(),
user
.
getName
(),
serviceWorker
.
getName
());
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
(),
description
,
sourceEnum
,
serviceWorker
.
getId
(),
dto
.
getRemark
(),
null
);
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
(),
description
,
sourceEnum
,
serviceWorker
.
getId
(),
dto
.
getRemark
(),
null
);
}
}
...
@@ -239,7 +245,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -239,7 +245,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
public
int
redispatch
(
DispatchServiceOrderDTO
dto
,
Long
userId
,
ServiceOrderOpSourceEnum
sourceEnum
)
{
public
int
redispatch
(
DispatchServiceOrderDTO
dto
,
Long
userId
,
ServiceOrderOpSourceEnum
sourceEnum
)
{
log
.
info
(
"order redispatch dto: {}, userId: {}"
,
dto
,
userId
);
log
.
info
(
"order redispatch dto: {}, userId: {}"
,
dto
,
userId
);
WorkUser
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_REDISPATCH_ORDER
,
sourceEnum
);
WorkUser
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_REDISPATCH_ORDER
,
sourceEnum
,
Sets
.
newHashSet
(
ServiceUserTypeEnum
.
ADMIN
)
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
()))
{
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
()))
{
...
@@ -297,15 +303,15 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -297,15 +303,15 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
user
=
new
WorkUser
(
sysUser
.
getId
(),
sysUser
.
getRealName
(),
true
);
user
=
new
WorkUser
(
sysUser
.
getId
(),
sysUser
.
getRealName
(),
true
);
}
}
Condition
c
=
buildOrderStatusCondition
(
serviceOrder
);
disableServiceWorkerAssign
(
serviceOrder
,
userId
,
null
);
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
FINISH
.
getStatus
());
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
FINISH
.
getStatus
());
serviceOrder
.
setModifyBy
(
userId
);
serviceOrder
.
setModifyBy
(
userId
);
int
result
=
serviceOrderMapper
.
updateByConditionSelective
(
serviceOrder
,
c
);
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
serviceOrder
);
if
(
result
==
1
)
{
if
(
result
==
1
)
{
// 取消维修工服务时间
disableServiceWorkerAssign
(
serviceOrder
,
userId
,
null
);
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
FINISH
.
getMsg
(),
user
.
getIsAdmin
()
?
ServiceUserTypeEnum
.
ADMIN
.
getName
()
+
user
.
getName
()
:
ServiceUserTypeEnum
.
USER
.
getName
());
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
FINISH
.
getMsg
(),
user
.
getIsAdmin
()
?
ServiceUserTypeEnum
.
ADMIN
.
getName
()
+
user
.
getName
()
:
ServiceUserTypeEnum
.
USER
.
getName
());
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
FINISH
.
getStatus
(),
description
,
sourceEnum
,
null
,
null
,
null
);
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
FINISH
.
getStatus
(),
description
,
sourceEnum
,
null
,
null
,
null
);
}
}
...
@@ -330,12 +336,17 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -330,12 +336,17 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
}
}
private
WorkUser
checkAuth
(
Long
userId
,
BizCodeEnum
biz
,
ServiceOrderOpSourceEnum
source
)
{
private
WorkUser
checkAuth
(
Long
userId
,
BizCodeEnum
biz
,
ServiceOrderOpSourceEnum
source
,
Set
<
ServiceUserTypeEnum
>
roles
)
{
if
(
source
==
ServiceOrderOpSourceEnum
.
MINI_APP
)
{
if
(
source
==
ServiceOrderOpSourceEnum
.
MINI_APP
)
{
User
user
=
userMapper
.
selectByPrimaryKey
(
userId
);
User
user
=
userMapper
.
selectByPrimaryKey
(
userId
);
if
(
Objects
.
isNull
(
user
)
||
!
user
.
getRoleType
().
equals
(
ServiceUserTypeEnum
.
ADMIN
.
getId
()))
{
if
(
Objects
.
isNull
(
user
))
{
throw
new
ServiceException
(
biz
);
}
if
(!
roles
.
parallelStream
().
map
(
ServiceUserTypeEnum:
:
getId
).
collect
(
Collectors
.
toSet
()).
contains
(
user
.
getRoleType
()))
{
throw
new
ServiceException
(
biz
);
throw
new
ServiceException
(
biz
);
}
}
return
new
WorkUser
(
user
.
getId
(),
user
.
getUserName
(),
user
.
getRoleType
().
equals
(
ServiceUserTypeEnum
.
ADMIN
.
getId
()));
return
new
WorkUser
(
user
.
getId
(),
user
.
getUserName
(),
user
.
getRoleType
().
equals
(
ServiceUserTypeEnum
.
ADMIN
.
getId
()));
}
}
SysUser
sysUser
=
sysUserMapper
.
selectByPrimaryKey
(
userId
);
SysUser
sysUser
=
sysUserMapper
.
selectByPrimaryKey
(
userId
);
...
@@ -420,5 +431,13 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -420,5 +431,13 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
serviceWorkerAssignMapper
.
updateByConditionSelective
(
serviceWorkerAssign
,
c
);
serviceWorkerAssignMapper
.
updateByConditionSelective
(
serviceWorkerAssign
,
c
);
}
}
private
Condition
buildOrderStatusCondition
(
ServiceOrder
serviceOrder
)
{
Condition
c
=
new
Condition
(
ServiceOrder
.
class
);
c
.
createCriteria
()
.
andEqualTo
(
"id"
,
serviceOrder
.
getId
())
.
andEqualTo
(
BizConstants
.
OrderConstants
.
ORDER_STATUS
,
serviceOrder
.
getOrderStatus
());
return
c
;
}
}
}
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