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
f3d35f96
Commit
f3d35f96
authored
Jul 18, 2022
by
shangtx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 公共订单接口修改
parent
dc7f6b9c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
13 deletions
+66
-13
ServiceOrderController.java
...ervice/admin/controller/order/ServiceOrderController.java
+29
-0
ServiceOrderService.java
.../com/onsiteservice/service/order/ServiceOrderService.java
+24
-13
WorkUser.java
...c/main/java/com/onsiteservice/service/order/WorkUser.java
+13
-0
No files found.
admin/src/main/java/com/onsiteservice/admin/controller/order/ServiceOrderController.java
View file @
f3d35f96
...
...
@@ -5,10 +5,15 @@ import com.onsiteservice.admin.controller.order.vo.OrderDetailVO;
import
com.onsiteservice.admin.controller.order.vo.OrderPageVO
;
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.SendServiceOrderDTO
;
import
com.onsiteservice.common.order.dto.ValuationServiceOrderDTO
;
import
com.onsiteservice.constant.enums.ServiceOrderOpSourceEnum
;
import
com.onsiteservice.entity.order.ServiceOrder
;
import
com.onsiteservice.core.result.Result
;
import
com.onsiteservice.dao.common.page.PageInfoVO
;
import
com.onsiteservice.service.order.ServiceOrderService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.NonNull
;
...
...
@@ -19,6 +24,7 @@ import springfox.documentation.annotations.ApiIgnore;
import
javax.annotation.Resource
;
import
javax.validation.constraints.Positive
;
import
static
com
.
onsiteservice
.
core
.
result
.
ResultGenerator
.
fail
;
import
static
com
.
onsiteservice
.
core
.
result
.
ResultGenerator
.
success
;
/**
...
...
@@ -35,6 +41,8 @@ public class ServiceOrderController {
@Resource
private
AdminOrderService
adminOrderService
;
@Resource
private
ServiceOrderService
serviceOrderService
;
@Dict
(
code
=
"BIZ0002"
,
name
=
"orderStatus"
)
@ApiOperation
(
value
=
"分页查询列表"
,
notes
=
"作者: 商天翔"
)
...
...
@@ -49,4 +57,25 @@ public class ServiceOrderController {
return
success
(
adminOrderService
.
getOrderDetail
(
id
));
}
@ApiOperation
(
value
=
"订单估价"
)
@PostMapping
(
"valuation"
)
public
Result
valuation
(
@RequestBody
@NonNull
@Validated
ValuationServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderService
.
valuation
(
dto
,
userId
,
ServiceOrderOpSourceEnum
.
WEB
)
==
1
?
success
()
:
fail
(
"估价失败"
);
}
@ApiOperation
(
value
=
"修改估价"
)
@PostMapping
(
"revaluation"
)
public
Result
revaluation
(
@RequestBody
@NonNull
@Validated
ValuationServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderService
.
revaluation
(
dto
,
userId
,
ServiceOrderOpSourceEnum
.
WEB
)
==
1
?
success
()
:
fail
(
"修改估价失败"
);
}
/**
* 发送订单
*/
@ApiOperation
(
value
=
"发送订单"
)
@PostMapping
(
"send"
)
public
Result
sendPrice
(
@RequestBody
@NonNull
@Validated
SendServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderService
.
sendOrder
(
dto
,
userId
,
ServiceOrderOpSourceEnum
.
WEB
)
==
1
?
success
()
:
fail
(
"发送失败"
);
}
}
common/src/main/java/com/onsiteservice/service/order/ServiceOrderService.java
View file @
f3d35f96
...
...
@@ -13,12 +13,14 @@ import com.onsiteservice.core.exception.ServiceException;
import
com.onsiteservice.dao.common.AbstractMapper
;
import
com.onsiteservice.dao.component.RecordComponent
;
import
com.onsiteservice.dao.mapper.service.*
;
import
com.onsiteservice.dao.mapper.sys.SysUserMapper
;
import
com.onsiteservice.dao.mapper.user.UserMapper
;
import
com.onsiteservice.entity.order.ServiceOrder
;
import
com.onsiteservice.entity.service.ServiceValuator
;
import
com.onsiteservice.entity.service.ServiceValuatorAssign
;
import
com.onsiteservice.entity.service.ServiceWorker
;
import
com.onsiteservice.entity.service.ServiceWorkerAssign
;
import
com.onsiteservice.entity.sys.SysUser
;
import
com.onsiteservice.entity.user.User
;
import
com.onsiteservice.util.aliyun.SmsUtils
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -66,6 +68,9 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
@Autowired
private
RecordComponent
recordComponent
;
@Resource
private
SysUserMapper
sysUserMapper
;
/**
* 指派估价员 管理员操作
...
...
@@ -73,7 +78,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
public
int
valuation
(
ValuationServiceOrderDTO
dto
,
Long
userId
,
ServiceOrderOpSourceEnum
sourceEnum
)
{
log
.
info
(
"order valuation dto: {}, userId: {}"
,
dto
,
userId
);
User
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_VALUATION_ORDER
);
WorkUser
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_VALUATION_ORDER
,
sourceEnum
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
RESERVE
.
getStatus
()))
{
...
...
@@ -94,7 +99,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
int
result
=
this
.
updateByPrimaryKeySelective
(
serviceOrder
);
if
(
result
==
1
)
{
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
VALUATION
.
getMsg
(),
user
.
get
User
Name
(),
valuatorUser
.
getUserName
());
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
VALUATION
.
getMsg
(),
user
.
getName
(),
valuatorUser
.
getUserName
());
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
(),
description
,
sourceEnum
,
valuatorUser
.
getId
(),
dto
.
getRemark
(),
dto
.
getExpectArrivalTime
());
}
...
...
@@ -106,7 +111,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
public
int
revaluation
(
ValuationServiceOrderDTO
dto
,
Long
userId
,
ServiceOrderOpSourceEnum
sourceEnum
)
{
log
.
info
(
"order revaluation dto: {}, userId: {}"
,
dto
,
userId
);
User
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_REVALUATION_ORDER
);
WorkUser
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_REVALUATION_ORDER
,
sourceEnum
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
()))
{
...
...
@@ -126,7 +131,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
int
result
=
this
.
updateByPrimaryKeySelective
(
serviceOrder
);
if
(
result
==
1
)
{
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
REVALUATION
.
getMsg
(),
user
.
get
User
Name
(),
valuatorUser
.
getUserName
());
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
REVALUATION
.
getMsg
(),
user
.
getName
(),
valuatorUser
.
getUserName
());
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
REVALUATION
.
getStatus
(),
description
,
sourceEnum
,
valuatorUser
.
getId
(),
dto
.
getRemark
(),
dto
.
getExpectArrivalTime
());
}
...
...
@@ -186,7 +191,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
public
int
dispatch
(
DispatchServiceOrderDTO
dto
,
Long
userId
,
ServiceOrderOpSourceEnum
sourceEnum
)
{
log
.
info
(
"order dispatch dto: {}, userId: {}"
,
dto
,
userId
);
User
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_DISPATCH_ORDER
);
WorkUser
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_DISPATCH_ORDER
,
sourceEnum
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
PAY
.
getStatus
()))
{
...
...
@@ -214,7 +219,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
// TODO 小程序通知 您的订单已为您指派维修工~~~
if
(
result
==
1
)
{
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
DISPATCH
.
getMsg
(),
user
.
get
User
Name
(),
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
);
}
...
...
@@ -225,7 +230,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
public
int
redispatch
(
DispatchServiceOrderDTO
dto
,
Long
userId
,
ServiceOrderOpSourceEnum
sourceEnum
)
{
log
.
info
(
"order redispatch dto: {}, userId: {}"
,
dto
,
userId
);
User
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_REDISPATCH_ORDER
);
WorkUser
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_REDISPATCH_ORDER
,
sourceEnum
);
ServiceOrder
serviceOrder
=
checkOrder
(
dto
.
getId
(),
null
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
()))
{
...
...
@@ -250,7 +255,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
// TODO 小程序通知 您的订单已为您重新指派维修工~~~
if
(
result
==
1
)
{
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
REDISPATCH
.
getMsg
(),
user
.
get
User
Name
(),
serviceWorker
.
getName
());
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
REDISPATCH
.
getMsg
(),
user
.
getName
(),
serviceWorker
.
getName
());
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
REDISPATCH
.
getStatus
(),
description
,
sourceEnum
,
serviceWorker
.
getId
(),
dto
.
getRemark
(),
null
);
}
...
...
@@ -309,13 +314,19 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
}
private
User
checkAuth
(
Long
userId
,
BizCodeEnum
biz
)
{
private
WorkUser
checkAuth
(
Long
userId
,
BizCodeEnum
biz
,
ServiceOrderOpSourceEnum
source
)
{
if
(
source
==
ServiceOrderOpSourceEnum
.
MINI_APP
)
{
User
user
=
userMapper
.
selectByPrimaryKey
(
userId
);
if
(
Objects
.
isNull
(
user
)
||
!
user
.
getRoleType
().
equals
(
ServiceUserTypeEnum
.
ADMIN
.
getId
()))
{
throw
new
ServiceException
(
biz
);
}
return
user
;
return
new
WorkUser
(
user
.
getId
(),
user
.
getUserName
());
}
SysUser
sysUser
=
sysUserMapper
.
selectByPrimaryKey
(
userId
);
if
(
Objects
.
isNull
(
sysUser
))
{
throw
new
ServiceException
(
biz
);
}
return
new
WorkUser
(
sysUser
.
getId
(),
sysUser
.
getRealName
());
}
...
...
common/src/main/java/com/onsiteservice/service/order/WorkUser.java
0 → 100644
View file @
f3d35f96
package
com
.
onsiteservice
.
service
.
order
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
@AllArgsConstructor
@Builder
@Data
public
class
WorkUser
{
private
Long
id
;
private
String
name
;
}
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