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
471c1de3
Commit
471c1de3
authored
Jul 19, 2022
by
shangtx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 完成订单
parent
a016024c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
7 deletions
+24
-7
ServiceOrderController.java
...ervice/admin/controller/order/ServiceOrderController.java
+10
-0
ServiceOrderService.java
.../com/onsiteservice/service/order/ServiceOrderService.java
+14
-7
No files found.
admin/src/main/java/com/onsiteservice/admin/controller/order/ServiceOrderController.java
View file @
471c1de3
...
...
@@ -7,6 +7,7 @@ import com.onsiteservice.admin.service.order.AdminOrderService;
import
com.onsiteservice.common.annotation.dict.Dict
;
import
com.onsiteservice.common.annotation.user.CurrentUserId
;
import
com.onsiteservice.common.order.dto.DispatchServiceOrderDTO
;
import
com.onsiteservice.common.order.dto.FinishServiceOrderDTO
;
import
com.onsiteservice.common.order.dto.SendServiceOrderDTO
;
import
com.onsiteservice.common.order.dto.ValuationServiceOrderDTO
;
import
com.onsiteservice.constant.enums.ServiceOrderOpSourceEnum
;
...
...
@@ -91,4 +92,13 @@ public class ServiceOrderController {
return
serviceOrderService
.
redispatch
(
dto
,
userId
,
ServiceOrderOpSourceEnum
.
WEB
)
==
1
?
success
()
:
fail
(
"修改派单失败"
);
}
/**
* 未派单之前不能完成,已申请退款的也可以点击完成
*/
@ApiOperation
(
value
=
"完成订单"
)
@PostMapping
(
"finish"
)
public
Result
finish
(
@RequestBody
@NonNull
@Validated
FinishServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderService
.
finishOrder
(
dto
,
userId
,
ServiceOrderOpSourceEnum
.
WEB
)
==
1
?
success
()
:
fail
(
"取消失败"
);
}
}
common/src/main/java/com/onsiteservice/service/order/ServiceOrderService.java
View file @
471c1de3
...
...
@@ -270,14 +270,21 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_FINISH
);
}
User
user
=
userMapper
.
selectByPrimaryKey
(
userId
);
// 既不是客户 又不是客服
boolean
isUser
=
serviceOrder
.
getAccountNo
().
equals
(
userId
);
boolean
isAdmin
=
!
Objects
.
isNull
(
user
)
&&
user
.
getRoleType
().
equals
(
ServiceUserTypeEnum
.
ADMIN
.
getId
());
if
(!
isUser
&&
!
isAdmin
)
{
throw
new
ServiceException
(
BizCodeEnum
.
NO_AUTH_FINISH_ORDER
);
WorkUser
user
;
if
(
sourceEnum
==
ServiceOrderOpSourceEnum
.
MINI_APP
)
{
var
miniUser
=
userMapper
.
selectByPrimaryKey
(
userId
);
boolean
isUser
=
serviceOrder
.
getAccountNo
().
equals
(
userId
);
boolean
isAdmin
=
!
Objects
.
isNull
(
miniUser
)
&&
miniUser
.
getRoleType
().
equals
(
ServiceUserTypeEnum
.
ADMIN
.
getId
());
if
(!
isUser
&&
!
isAdmin
)
{
throw
new
ServiceException
(
BizCodeEnum
.
NO_AUTH_FINISH_ORDER
);
}
user
=
new
WorkUser
(
miniUser
.
getId
(),
miniUser
.
getUserName
(),
isAdmin
);
}
else
{
var
sysUser
=
sysUserMapper
.
selectByPrimaryKey
(
userId
);
user
=
new
WorkUser
(
sysUser
.
getId
(),
sysUser
.
getRealName
(),
true
);
}
disableServiceWorkerAssign
(
serviceOrder
,
userId
,
null
);
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
FINISH
.
getStatus
());
...
...
@@ -286,7 +293,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
serviceOrder
);
if
(
result
==
1
)
{
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
FINISH
.
getMsg
(),
isUser
?
ServiceUserTypeEnum
.
USER
.
getName
()
:
ServiceUserTypeEnum
.
ADMIN
.
getName
()
+
user
.
getUser
Name
());
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
FINISH
.
getMsg
(),
user
.
getIsAdmin
()
?
ServiceUserTypeEnum
.
ADMIN
.
getName
()
+
user
.
getName
()
:
ServiceUserTypeEnum
.
USER
.
get
Name
());
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
FINISH
.
getStatus
(),
description
,
sourceEnum
,
null
,
null
,
null
);
}
...
...
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