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
09cd2053
Commit
09cd2053
authored
Aug 01, 2022
by
shangtx
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'master'
Dev See merge request
!1
parents
9be2457e
307a5fac
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
295 additions
and
125 deletions
+295
-125
ServiceOrderController.java
...ervice/admin/controller/order/ServiceOrderController.java
+1
-0
CommonSmsService.java
...va/com/onsiteservice/common/service/CommonSmsService.java
+141
-0
ServiceOrderService.java
.../com/onsiteservice/service/order/ServiceOrderService.java
+57
-42
BizCodeEnum.java
...in/java/com/onsiteservice/constant/enums/BizCodeEnum.java
+7
-7
application-third-service.yaml
constant/src/main/resources/application-third-service.yaml
+11
-4
SysBusinessMapper.xml
dao/src/main/resources/mapper/sys/SysBusinessMapper.xml
+6
-1
ServiceOrderController.java
...vice/miniapp/controller/order/ServiceOrderController.java
+8
-0
WechatNotifyController.java
...vice/miniapp/controller/weixn/WechatNotifyController.java
+37
-44
ServiceValuatorAssignBizMapper.java
...iniapp/mapper/service/ServiceValuatorAssignBizMapper.java
+1
-1
ServiceValuatorBizMapper.java
...vice/miniapp/mapper/service/ServiceValuatorBizMapper.java
+0
-1
ServiceWorkerAssignBizMapper.java
.../miniapp/mapper/service/ServiceWorkerAssignBizMapper.java
+0
-2
OrderListener.java
...onsiteservice/miniapp/service/listener/OrderListener.java
+0
-1
ServiceOrderBizService.java
...service/miniapp/service/order/ServiceOrderBizService.java
+11
-14
UserService.java
...a/com/onsiteservice/miniapp/service/user/UserService.java
+7
-8
ServiceValuatorAssignBizMapper.xml
...sources/mapper/service/ServiceValuatorAssignBizMapper.xml
+8
-0
No files found.
admin/src/main/java/com/onsiteservice/admin/controller/order/ServiceOrderController.java
View file @
09cd2053
...
...
@@ -5,6 +5,7 @@ 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.idempotent.ApiIdempotent
;
import
com.onsiteservice.common.annotation.user.CurrentUserId
;
import
com.onsiteservice.common.order.dto.DispatchServiceOrderDTO
;
import
com.onsiteservice.common.order.dto.FinishServiceOrderDTO
;
...
...
common/src/main/java/com/onsiteservice/common/service/CommonSmsService.java
0 → 100644
View file @
09cd2053
package
com
.
onsiteservice
.
common
.
service
;
import
com.onsiteservice.common.redis.RedisUtils
;
import
com.onsiteservice.util.aliyun.SmsUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
/**
* 业务短信服务
*/
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Slf4j
public
class
CommonSmsService
{
@Value
(
"${spring.profiles.active}"
)
private
String
env
;
@Value
(
"${aliyun.sms.template-code.change-phone}"
)
private
String
changePhoneTmpCode
;
// 手机号换绑
@Value
(
"${aliyun.sms.template-code.payable}"
)
private
String
payableTmpCode
;
// 通知用户完成估价请支付
@Value
(
"${aliyun.sms.template-code.dispatched}"
)
private
String
dispatchedTmpCode
;
// 通知用户已经派单
@Value
(
"${aliyun.sms.template-code.redispatched}"
)
private
String
redispatchedTmpCode
;
// 通知用户已经重新派单
@Value
(
"${aliyun.sms.template-code.paid}"
)
private
String
paidTmpCode
;
// 手机号换绑
@Value
(
"${aliyun.sms.template-code.valuator}"
)
private
String
valuatorTmpCode
;
// 通知客户已派估价员
@Value
(
"${aliyun.sms.template-code.revaluator}"
)
private
String
revaluatorTmpCode
;
// 通知客户已重新指派估价员
@Value
(
"${aliyun.sms.sign}"
)
private
String
sign
;
@Resource
private
SmsUtils
smsUtils
;
@Resource
private
RedisUtils
redisUtil
;
/***
* 禁用短信方法
*/
private
boolean
disableSms
()
{
// return "dev".equals(env);
return
false
;
}
/***
* 发送改变信息验证码
*/
public
void
sendChangePhone
(
String
code
,
String
phone
)
{
if
(
StringUtils
.
isEmpty
(
phone
))
{
return
;
}
try
{
smsUtils
.
send
(
sign
,
changePhoneTmpCode
,
code
,
phone
);
}
catch
(
Exception
e
)
{
log
.
error
(
"发送短信错误"
,
e
);
}
}
public
void
payable
(
String
phone
)
{
if
(
StringUtils
.
isEmpty
(
phone
))
{
return
;
}
try
{
smsUtils
.
send
(
sign
,
payableTmpCode
,
null
,
phone
);
}
catch
(
Exception
e
)
{
log
.
error
(
"发送短信错误"
,
e
);
}
}
public
void
dispatched
(
String
phone
)
{
if
(
StringUtils
.
isEmpty
(
phone
))
{
return
;
}
try
{
smsUtils
.
send
(
sign
,
dispatchedTmpCode
,
null
,
phone
);
}
catch
(
Exception
e
)
{
log
.
error
(
"发送短信错误"
,
e
);
}
}
public
void
redispatched
(
String
phone
)
{
if
(
StringUtils
.
isEmpty
(
phone
))
{
return
;
}
try
{
smsUtils
.
send
(
sign
,
redispatchedTmpCode
,
null
,
phone
);
}
catch
(
Exception
e
)
{
log
.
error
(
"发送短信错误"
,
e
);
}
}
public
void
paid
(
String
phone
)
{
if
(
StringUtils
.
isEmpty
(
phone
))
{
return
;
}
try
{
smsUtils
.
send
(
sign
,
paidTmpCode
,
null
,
phone
);
}
catch
(
Exception
e
)
{
log
.
error
(
"发送短信错误"
,
e
);
}
}
public
void
valuator
(
String
phone
)
{
if
(
StringUtils
.
isEmpty
(
phone
))
{
return
;
}
try
{
smsUtils
.
send
(
sign
,
valuatorTmpCode
,
null
,
phone
);
}
catch
(
Exception
e
)
{
log
.
error
(
"发送短信错误"
,
e
);
}
}
public
void
revaluator
(
String
phone
)
{
if
(
StringUtils
.
isEmpty
(
phone
))
{
return
;
}
try
{
smsUtils
.
send
(
sign
,
revaluatorTmpCode
,
null
,
phone
);
}
catch
(
Exception
e
)
{
log
.
error
(
"发送短信错误"
,
e
);
}
}
}
common/src/main/java/com/onsiteservice/service/order/ServiceOrderService.java
View file @
09cd2053
package
com
.
onsiteservice
.
service
.
order
;
import
com.google.common.collect.Sets
;
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.common.service.CommonSmsService
;
import
com.onsiteservice.constant.constant.BizConstants
;
import
com.onsiteservice.constant.constant.SysParamConstants
;
import
com.onsiteservice.constant.enums.BizCodeEnum
;
...
...
@@ -18,7 +20,6 @@ import com.onsiteservice.dao.mapper.sys.SysParamMapper;
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
;
...
...
@@ -38,6 +39,8 @@ import javax.annotation.Resource;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
@Service
@Slf4j
...
...
@@ -48,10 +51,8 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
/**
* 短信相关
*/
@Value
(
"${aliyun.sms.sign}"
)
private
String
sign
;
@Autowired
private
SmsUtils
smsUtils
;
private
CommonSmsService
commonSmsService
;
@Resource
private
ServiceOrderMapper
serviceOrderMapper
;
...
...
@@ -85,7 +86,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
public
int
valuation
(
ValuationServiceOrderDTO
dto
,
Long
userId
,
ServiceOrderOpSourceEnum
sourceEnum
)
{
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
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
RESERVE
.
getStatus
()))
{
...
...
@@ -97,15 +98,18 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_VALUATOR_NOT_EXIST
);
}
serviceValuatorAssignMapper
.
insertSelective
(
buildServiceValuatorAssign
(
dto
,
userId
));
Condition
c
=
buildOrderStatusCondition
(
serviceOrder
);
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
());
serviceOrder
.
setModifyBy
(
userId
);
serviceOrder
.
setValuatorId
(
valuatorUser
.
getId
());
int
result
=
this
.
updateByPrimaryKeySelective
(
serviceOrder
);
int
result
=
serviceOrderMapper
.
updateByConditionSelective
(
serviceOrder
,
c
);
if
(
result
==
1
)
{
// 记录估价员指派时间
serviceValuatorAssignMapper
.
insertSelective
(
buildServiceValuatorAssign
(
dto
,
userId
));
// 通知用户
commonSmsService
.
valuator
(
serviceOrder
.
getPhone
());
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
());
...
...
@@ -118,7 +122,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
public
int
revaluation
(
ValuationServiceOrderDTO
dto
,
Long
userId
,
ServiceOrderOpSourceEnum
sourceEnum
)
{
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
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
()))
{
...
...
@@ -130,14 +134,16 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_VALUATOR_NOT_EXIST
);
}
disableServiceValuatorAssign
(
serviceOrder
,
userId
,
false
);
serviceValuatorAssignMapper
.
insertSelective
(
buildServiceValuatorAssign
(
dto
,
userId
));
serviceOrder
.
setValuatorId
(
dto
.
getHostId
());
int
result
=
this
.
updateByPrimaryKeySelective
(
serviceOrder
);
if
(
result
==
1
)
{
// 取消之前被指派的估价员时间
disableServiceValuatorAssign
(
serviceOrder
,
userId
,
false
);
// 设置新的估计员世间
serviceValuatorAssignMapper
.
insertSelective
(
buildServiceValuatorAssign
(
dto
,
userId
));
// 通知用户
commonSmsService
.
revaluator
(
serviceOrder
.
getPhone
());
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
());
...
...
@@ -154,16 +160,15 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
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
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
VALUATION
.
getStatus
())
&&
!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
RESERVE
.
getStatus
()))
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_SEND
);
}
disableServiceValuatorAssign
(
serviceOrder
,
userId
,
null
);
Condition
c
=
buildOrderStatusCondition
(
serviceOrder
);
// 估价价格
serviceOrder
.
setPrice
(
dto
.
getPrice
());
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
SEND
.
getStatus
());
...
...
@@ -174,21 +179,21 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
List
<
SysParam
>
sysParamList
=
sysParamMapper
.
selectByCondition
(
sysParamCondition
);
long
timeOut
=
CollectionUtils
.
isEmpty
(
sysParamList
)
?
BizConstants
.
OrderConstants
.
TIMEOUT_CANCEL_LIMIT
:
Long
.
parseLong
(
sysParamList
.
get
(
0
).
getValue
());
serviceOrder
.
setCancelTime
(
new
Date
(
System
.
currentTimeMillis
()
+
timeOut
));
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
serviceOrder
);
int
result
=
serviceOrderMapper
.
updateByConditionSelective
(
serviceOrder
,
c
);
try
{
// 发短信
log
.
info
(
"sendOrder send msg to phone: {}"
,
serviceOrder
.
getPhone
());
// TODO 短信通知客户完成支付
smsUtils
.
send
(
sign
,
""
,
""
,
serviceOrder
.
getPhone
());
commonSmsService
.
payable
(
serviceOrder
.
getPhone
());
}
catch
(
Exception
e
)
{
log
.
error
(
"sendOrder error, "
,
e
);
}
// TODO 小程序通知客户完成支付
if
(
result
==
1
)
{
// 置估价员指派时间为失效
disableServiceValuatorAssign
(
serviceOrder
,
userId
,
null
);
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
);
}
...
...
@@ -200,7 +205,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
public
int
dispatch
(
DispatchServiceOrderDTO
dto
,
Long
userId
,
ServiceOrderOpSourceEnum
sourceEnum
)
{
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
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
PAY
.
getStatus
()))
{
...
...
@@ -216,18 +221,17 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_WORKER_NOT_EXIST
);
}
serviceWorkerAssignMapper
.
insertSelective
(
buildServiceWorkerAssign
(
dto
,
serviceOrder
,
userId
));
Condition
c
=
buildOrderStatusCondition
(
serviceOrder
);
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
());
serviceOrder
.
setModifyBy
(
userId
);
int
result
=
serviceOrderMapper
.
updateByConditionSelective
(
serviceOrder
,
c
);
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
serviceOrder
);
// TODO 短信 "您的订单已为您指派维修工,请保持手机畅通!"
// TODO 小程序通知 您的订单已为您指派维修工~~~
commonSmsService
.
dispatched
(
serviceOrder
.
getPhone
());
if
(
result
==
1
)
{
// 记录维修工时间
serviceWorkerAssignMapper
.
insertSelective
(
buildServiceWorkerAssign
(
dto
,
serviceOrder
,
userId
));
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
);
}
...
...
@@ -239,7 +243,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
public
int
redispatch
(
DispatchServiceOrderDTO
dto
,
Long
userId
,
ServiceOrderOpSourceEnum
sourceEnum
)
{
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
);
if
(!
serviceOrder
.
getOrderStatus
().
equals
(
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
()))
{
...
...
@@ -259,9 +263,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
int
result
=
serviceWorkerAssignMapper
.
insertSelective
(
buildServiceWorkerAssign
(
dto
,
serviceOrder
,
userId
));
// TODO 短信 "您的订单已为您重新指派维修工,请保持手机畅通!"
// TODO 小程序通知 您的订单已为您重新指派维修工~~~
commonSmsService
.
redispatched
(
serviceOrder
.
getPhone
());
if
(
result
==
1
)
{
String
description
=
String
.
format
(
ServiceOrderStatusEnum
.
REDISPATCH
.
getMsg
(),
user
.
getName
(),
serviceWorker
.
getName
());
...
...
@@ -297,15 +299,15 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
user
=
new
WorkUser
(
sysUser
.
getId
(),
sysUser
.
getRealName
(),
true
);
}
disableServiceWorkerAssign
(
serviceOrder
,
userId
,
null
);
Condition
c
=
buildOrderStatusCondition
(
serviceOrder
);
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
FINISH
.
getStatus
());
serviceOrder
.
setModifyBy
(
userId
);
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
serviceOrder
);
int
result
=
serviceOrderMapper
.
updateByConditionSelective
(
serviceOrder
,
c
);
if
(
result
==
1
)
{
// 取消维修工服务时间
disableServiceWorkerAssign
(
serviceOrder
,
userId
,
null
);
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
);
}
...
...
@@ -330,12 +332,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
)
{
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
);
}
return
new
WorkUser
(
user
.
getId
(),
user
.
getUserName
(),
user
.
getRoleType
().
equals
(
ServiceUserTypeEnum
.
ADMIN
.
getId
()));
}
SysUser
sysUser
=
sysUserMapper
.
selectByPrimaryKey
(
userId
);
...
...
@@ -420,5 +427,13 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
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
;
}
}
constant/src/main/java/com/onsiteservice/constant/enums/BizCodeEnum.java
View file @
09cd2053
...
...
@@ -22,16 +22,16 @@ public enum BizCodeEnum {
* 订单分组
*/
SERVICE_ORDER_NOT_EXIST
(
"订单不存在"
),
SERVICE_ORDER_CANNOT_VALUATION
(
"
处于非预约状态的
订单不能派估价员"
),
SERVICE_ORDER_CANNOT_REVALUATION
(
"订单未
指派估价员
,不能修改"
),
SERVICE_ORDER_CANNOT_SEND
(
"订单未受理,不能发送
给客户
"
),
SERVICE_ORDER_CANNOT_VALUATION
(
"订单不能派估价员"
),
SERVICE_ORDER_CANNOT_REVALUATION
(
"订单未
估价
,不能修改"
),
SERVICE_ORDER_CANNOT_SEND
(
"订单未受理,不能发送
或已发送
"
),
SERVICE_ORDER_CANNOT_PAY
(
"订单未受理,暂不能支付"
),
SERVICE_ORDER_CANNOT_CANCEL
(
"订单不能取消"
),
SERVICE_ORDER_CANNOT_REFUND
(
"订单不能申请退款"
),
SERVICE_ORDER_CANNOT_DISPATCH
(
"订单未支付,不能派
维修
工"
),
SERVICE_ORDER_CANNOT_REDISPATCH
(
"订单未
指派维修
工,不能修改"
),
SERVICE_ORDER_TIMEOUT_CANNOT_DISPATCH
(
"已过
上门
维修时间,不能派维修工"
),
SERVICE_ORDER_CANNOT_FINISH
(
"订单未派单,不能完成
本次服务
"
),
SERVICE_ORDER_CANNOT_DISPATCH
(
"订单未支付,不能派
工或已派
工"
),
SERVICE_ORDER_CANNOT_REDISPATCH
(
"订单未
派
工,不能修改"
),
SERVICE_ORDER_TIMEOUT_CANNOT_DISPATCH
(
"已过维修时间,不能派维修工"
),
SERVICE_ORDER_CANNOT_FINISH
(
"订单未派单,不能完成
服务或已完成
"
),
SERVICE_ORDER_STATUS_ERROR
(
"请选择正确的订单状态"
),
...
...
constant/src/main/resources/application-third-service.yaml
View file @
09cd2053
...
...
@@ -18,7 +18,14 @@ aliyun:
batch-size
:
500
# 批量发送个数
# 短信模板Code
template-code
:
# change-info: SMS_161475524 # 信息变更验证码
change-phone
:
SMS_161475524
# 修改手机号短信验证码
payable
:
SMS_226520016
# 通知用户完成估价请支付 开发环境使用项目开盘替代
dispatched
:
SMS_226505027
# 通知用户已经派单 开发环境使用项目动态替代
redispatched
:
SMS_226505027
# 通知用户已经重新派单 开发环境使用项目动态替代
paid
:
SMS_226505027
# 通知业务人员客户已完成支付 开发环境使用优惠券发放替代
valuator
:
SMS_226505027
# 通知客户已派估价员 开发环境使用优惠券发放替代
revaluator
:
SMS_226505027
# 通知客户已重新指派估价员 开发环境使用优惠券发放替代
# 微信配置
...
...
@@ -37,9 +44,9 @@ wx:
secret
:
d5e1aeae4fa4daa6328a6a02ddafb9ff
#公众号的appsecret
token
:
OfficialAccounts2020
#接口配置里的Token值
aesKey
:
EBFO9I8JUrLLYZxSd1QqO08LyheQX1ABGLeNylv8LoW
#接口配置里的EncodingAESKey值
# configs:
# - appId: wxceb5bea07decc398 #公众号的appid
# secret: d5e1aeae4fa4daa6328a6a02ddafb9ff #公众号的appsecret
# configs:
# - appId: wxceb5bea07decc398 #公众号的appid
# secret: d5e1aeae4fa4daa6328a6a02ddafb9ff #公众号的appsecret
# 微信支付
pay
:
appId
:
wx2c8a98f02c1a4258
#微信公众号或者小程序等的appid
...
...
dao/src/main/resources/mapper/sys/SysBusinessMapper.xml
View file @
09cd2053
...
...
@@ -43,8 +43,13 @@
parent_code,
icon,
name,
vr_name,
vr_path path,
show_order
show_order,
vr_redirect,
is_show,
is_cache,
vr_component_path component
from temp
order by show_order
</select>
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/ServiceOrderController.java
View file @
09cd2053
package
com
.
onsiteservice
.
miniapp
.
controller
.
order
;
import
com.onsiteservice.common.annotation.dict.Dict
;
import
com.onsiteservice.common.annotation.idempotent.ApiIdempotent
;
import
com.onsiteservice.common.annotation.user.CurrentUserId
;
import
com.onsiteservice.common.order.dto.DispatchServiceOrderDTO
;
import
com.onsiteservice.common.order.dto.FinishServiceOrderDTO
;
...
...
@@ -81,12 +82,14 @@ public class ServiceOrderController {
}
@ApiOperation
(
value
=
"订单估价"
)
@ApiIdempotent
(
interval
=
3000L
)
@PostMapping
(
"valuation"
)
public
Result
valuation
(
@RequestBody
@NonNull
@Validated
ValuationServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderService
.
valuation
(
dto
,
userId
,
ServiceOrderOpSourceEnum
.
MINI_APP
)
==
1
?
success
()
:
fail
(
"估价失败"
);
}
@ApiOperation
(
value
=
"修改估价"
)
@ApiIdempotent
(
interval
=
3000L
)
@PostMapping
(
"revaluation"
)
public
Result
revaluation
(
@RequestBody
@NonNull
@Validated
ValuationServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderService
.
revaluation
(
dto
,
userId
,
ServiceOrderOpSourceEnum
.
MINI_APP
)
==
1
?
success
()
:
fail
(
"修改估价失败"
);
...
...
@@ -96,6 +99,7 @@ public class ServiceOrderController {
* 发送订单 已估价订单才能发送 <link>ServiceOrderStatusEnum</link>
*/
@ApiOperation
(
value
=
"发送订单"
)
@ApiIdempotent
(
interval
=
3000L
)
@PostMapping
(
"send"
)
public
Result
valuation
(
@RequestBody
@NonNull
@Validated
SendServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderService
.
sendOrder
(
dto
,
userId
,
ServiceOrderOpSourceEnum
.
MINI_APP
)
==
1
?
success
()
:
fail
(
"发送失败"
);
...
...
@@ -103,12 +107,14 @@ public class ServiceOrderController {
@ApiOperation
(
value
=
"派单"
)
@ApiIdempotent
(
interval
=
3000L
)
@PostMapping
(
"dispatch"
)
public
Result
dispatch
(
@RequestBody
@NonNull
@Validated
DispatchServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderService
.
dispatch
(
dto
,
userId
,
ServiceOrderOpSourceEnum
.
MINI_APP
)
==
1
?
success
()
:
fail
(
"派单失败"
);
}
@ApiOperation
(
value
=
"修改派单"
)
@ApiIdempotent
(
interval
=
3000L
)
@PostMapping
(
"redispatch"
)
public
Result
redispatch
(
@RequestBody
@NonNull
@Validated
DispatchServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderService
.
redispatch
(
dto
,
userId
,
ServiceOrderOpSourceEnum
.
MINI_APP
)
==
1
?
success
()
:
fail
(
"修改派单失败"
);
...
...
@@ -118,6 +124,7 @@ public class ServiceOrderController {
* 未派单之前不能完成,已申请退款的也可以点击完成
*/
@ApiOperation
(
value
=
"完成订单"
)
@ApiIdempotent
(
interval
=
3000L
)
@PostMapping
(
"finish"
)
public
Result
finish
(
@RequestBody
@NonNull
@Validated
FinishServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderService
.
finishOrder
(
dto
,
userId
,
ServiceOrderOpSourceEnum
.
MINI_APP
)
==
1
?
success
()
:
fail
(
"取消失败"
);
...
...
@@ -137,6 +144,7 @@ public class ServiceOrderController {
*/
@ApiOperation
(
value
=
"取消订单"
)
@PostMapping
(
"cancel"
)
@ApiIdempotent
(
interval
=
3000L
)
public
Result
cancel
(
@RequestBody
@NonNull
@Validated
CancelServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderBizService
.
cancelOrder
(
dto
,
userId
,
ServiceOrderOpSourceEnum
.
MINI_APP
)
==
1
?
success
()
:
fail
(
"取消失败"
);
}
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/controller/weixn/WechatNotifyController.java
View file @
09cd2053
...
...
@@ -46,7 +46,6 @@ public class WechatNotifyController {
public
void
notify
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
//WechatPayMyConfigMini config = new WechatPayMyConfigMini();
PrintWriter
out
=
null
;
try
{
log
.
info
(
"微信支付成功回调通知开始!"
);
StringBuffer
sb
=
new
StringBuffer
();
InputStream
is
=
request
.
getInputStream
();
...
...
@@ -91,15 +90,9 @@ public class WechatNotifyController {
}
else
{
log
.
warn
(
"微信支付成功回调通知内容为空,请检查!"
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"notify() Exception exception:"
,
e
);
e
.
printStackTrace
();
}
}
/**
* 微信通知签名校验
*
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/mapper/service/ServiceValuatorAssignBizMapper.java
View file @
09cd2053
...
...
@@ -2,11 +2,11 @@ package com.onsiteservice.miniapp.mapper.service;
/**
* @author 潘维吉
* @date 2022-07-11 16:07
* @description ServiceValuatorAssignBizMapper业务接口
*/
public
interface
ServiceValuatorAssignBizMapper
{
int
getTodoNum
(
Long
valuatorId
);
}
mini-app/src/main/java/com/onsiteservice/miniapp/mapper/service/ServiceValuatorBizMapper.java
View file @
09cd2053
...
...
@@ -6,7 +6,6 @@ import com.onsiteservice.entity.service.ServiceValuator;
import
java.util.List
;
/**
* @author 潘维吉
* @date 2022-07-11 16:07
* @description ServiceValuatorBizMapper业务接口
*/
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/mapper/service/ServiceWorkerAssignBizMapper.java
View file @
09cd2053
...
...
@@ -2,11 +2,9 @@ package com.onsiteservice.miniapp.mapper.service;
/**
* @author 潘维吉
* @date 2022-07-11 16:07
* @description ServiceWorkerAssignBizMapper业务接口
*/
public
interface
ServiceWorkerAssignBizMapper
{
}
mini-app/src/main/java/com/onsiteservice/miniapp/service/listener/OrderListener.java
View file @
09cd2053
...
...
@@ -17,7 +17,6 @@ public class OrderListener {
@Resource
private
WeixinMessageService
weixinMessageService
;
/* TODO 给用户发送订单的新情况 */
@RabbitHandler
public
void
notice
()
{
weixinMessageService
.
sendMsg
(
null
);
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/service/order/ServiceOrderBizService.java
View file @
09cd2053
...
...
@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
import
com.onsiteservice.common.order.vo.OrderPayVO
;
import
com.onsiteservice.common.order.vo.ServiceOrderLogVO
;
import
com.onsiteservice.common.order.vo.ServiceOrderVO
;
import
com.onsiteservice.common.service.CommonSmsService
;
import
com.onsiteservice.constant.constant.BizConstants
;
import
com.onsiteservice.constant.constant.SysConstants
;
import
com.onsiteservice.constant.constant.SysParamConstants
;
...
...
@@ -62,14 +63,11 @@ import java.util.stream.Collectors;
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
ServiceOrderBizService
extends
AbstractMapper
<
ServiceOrder
>
{
/**
* 短信相关
*/
@Value
(
"${aliyun.sms.sign}"
)
private
String
sign
;
@Autowired
private
SmsUtils
smsUtils
;
private
CommonSmsService
commonSmsService
;
@Resource
private
ServiceOrderMapper
serviceOrderMapper
;
...
...
@@ -220,8 +218,6 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
recordComponent
.
recordServiceOrderImg
(
serviceOrder
,
dto
.
getUrls
());
// TODO 发短信通知所有客服
// 记录流程
if
(
result
==
1
)
{
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
RESERVE
.
getStatus
(),
ServiceOrderStatusEnum
.
RESERVE
.
getMsg
(),
sourceEnum
,
null
,
null
,
null
);
...
...
@@ -230,18 +226,16 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
return
result
;
}
public
void
paySuccess
(
String
o
utTradeNo
,
String
orderN
o
)
{
log
.
info
(
"支付成功 o
utTradeNo: {}, orderNo: {}"
,
outTradeNo
,
orderN
o
);
public
void
paySuccess
(
String
o
rderNo
,
String
inf
o
)
{
log
.
info
(
"支付成功 o
rderNo: {}, info: {}"
,
orderNo
,
inf
o
);
var
order
=
selectOneByProperty
(
"orderNo"
,
o
utTrade
No
);
var
order
=
selectOneByProperty
(
"orderNo"
,
o
rder
No
);
order
.
setOrderStatus
(
ServiceOrderStatusEnum
.
PAY
.
getStatus
());
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
order
);
if
(
result
==
1
)
{
recordComponent
.
recordProcess
(
order
.
getId
(),
ServiceOrderStatusEnum
.
PAY
.
getStatus
(),
ServiceOrderStatusEnum
.
PAY
.
getMsg
(),
ServiceOrderOpSourceEnum
.
MINI_APP
,
null
,
null
,
null
);
}
// 通知客服
var
logCondition
=
new
ServiceOrderLog
();
logCondition
.
setOrderId
(
order
.
getId
());
...
...
@@ -252,7 +246,7 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
var
sysUser
=
sysUserMapper
.
selectByPrimaryKey
(
orderLog
.
getHostId
());
if
(
StringUtils
.
isNotEmpty
(
sysUser
.
getPhone
()))
{
try
{
smsUtils
.
send
(
""
,
""
,
""
,
sysUser
.
getPhone
());
commonSmsService
.
paid
(
sysUser
.
getPhone
());
amqpTemplate
.
convertAndSend
(
SysConstants
.
Queue
.
ADMIN_ORDER
,
Pair
.
of
(
sysUser
.
getId
(),
1
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -263,13 +257,16 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
if
(
ServiceOrderOpSourceEnum
.
MINI_APP
.
getId
().
equals
(
orderLog
.
getSource
()))
{
var
user
=
userMapper
.
selectByPrimaryKey
(
orderLog
.
getHostId
());
try
{
smsUtils
.
send
(
""
,
""
,
""
,
user
.
getPhone
());
commonSmsService
.
paid
(
user
.
getPhone
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"订单{} 支付成功短信发送失败"
,
orderNo
);
}
}
}
if
(
result
==
1
)
{
recordComponent
.
recordProcess
(
order
.
getId
(),
ServiceOrderStatusEnum
.
PAY
.
getStatus
(),
ServiceOrderStatusEnum
.
PAY
.
getMsg
(),
ServiceOrderOpSourceEnum
.
MINI_APP
,
null
,
null
,
null
);
}
}
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/service/user/UserService.java
View file @
09cd2053
...
...
@@ -2,6 +2,7 @@ package com.onsiteservice.miniapp.service.user;
import
com.alibaba.fastjson.JSON
;
import
com.onsiteservice.common.runner.InitDataRunner
;
import
com.onsiteservice.common.service.CommonSmsService
;
import
com.onsiteservice.constant.constant.Constants
;
import
com.onsiteservice.constant.constant.DictConstants
;
import
com.onsiteservice.constant.constant.RedisKeyConstants
;
...
...
@@ -29,6 +30,7 @@ import com.onsiteservice.miniapp.controller.user.dto.SendCodeDTO;
import
com.onsiteservice.miniapp.controller.user.vo.UserInfoVO
;
import
com.onsiteservice.miniapp.controller.user.vo.UserOrderInfoVO
;
import
com.onsiteservice.miniapp.mapper.order.ServiceOrderBizMapper
;
import
com.onsiteservice.miniapp.mapper.service.ServiceValuatorAssignBizMapper
;
import
com.onsiteservice.util.RandomUtils
;
import
io.jsonwebtoken.Claims
;
import
lombok.AllArgsConstructor
;
...
...
@@ -58,7 +60,8 @@ public class UserService extends AbstractMapper<User> {
private
UserConvert
userConvert
;
private
ServiceOrderBizMapper
serviceOrderBizMapper
;
private
ServiceOrderMapper
serviceOrderMapper
;
private
ServiceValuatorAssignMapper
serviceValuatorAssignMapper
;
private
ServiceValuatorAssignBizMapper
serviceValuatorAssignBizMapper
;
private
CommonSmsService
commonSmsService
;
public
Result
<
String
>
sendCode
(
SendCodeDTO
dto
)
{
...
...
@@ -81,7 +84,7 @@ public class UserService extends AbstractMapper<User> {
// 置入
redisTemplate
.
opsForValue
().
set
(
cacheKey
,
value
,
RedisKeyConstants
.
CODE_EXPIRED
,
TimeUnit
.
MILLISECONDS
);
// TODO 发送短信
commonSmsService
.
sendChangePhone
(
code
,
dto
.
getTo
());
return
ResultGenerator
.
success
();
}
...
...
@@ -134,11 +137,7 @@ public class UserService extends AbstractMapper<User> {
vo
.
setTodo
(
num
);
}
if
(
Objects
.
equals
(
user
.
getRoleType
(),
ServiceUserTypeEnum
.
VALUATOR
.
getId
()))
{
Condition
condition
=
new
Condition
(
ServiceValuatorAssign
.
class
);
condition
.
createCriteria
().
andEqualTo
(
"valuatorId"
,
userId
)
.
andGreaterThan
(
"assignTime"
,
new
Date
());
int
num
=
serviceValuatorAssignMapper
.
selectCountByCondition
(
condition
);
vo
.
setTodo
(
num
);
vo
.
setTodo
(
serviceValuatorAssignBizMapper
.
getTodoNum
(
userId
));
}
// 获取订单状况
var
numMap
=
serviceOrderBizMapper
.
getMyOrderNum
(
userId
);
...
...
@@ -146,7 +145,7 @@ public class UserService extends AbstractMapper<User> {
new
UserOrderInfoVO
(
"待支付"
,
numMap
.
get
(
"pay"
),
1
),
new
UserOrderInfoVO
(
"待受理"
,
numMap
.
get
(
"handle"
),
3
),
new
UserOrderInfoVO
(
"待派单"
,
numMap
.
get
(
"dispatch"
),
4
),
new
UserOrderInfoVO
(
"
已完成"
,
numMap
.
get
(
"finished"
),
6
)
new
UserOrderInfoVO
(
"
服务中"
,
numMap
.
get
(
"service"
),
5
)
));
return
vo
;
}
...
...
mini-app/src/main/resources/mapper/service/ServiceValuatorAssignBizMapper.xml
View file @
09cd2053
...
...
@@ -3,4 +3,12 @@
<mapper
namespace=
"com.onsiteservice.miniapp.mapper.service.ServiceValuatorAssignBizMapper"
>
<select
id=
"getTodoNum"
resultType=
"java.lang.Integer"
>
select count(1)
from service_valuator_assign t1
join service_order t2 on t1.order_id = t2.id
where t1.valuator_Id = #{valuatorId}
and t1.assign_time > current_timestamp
and t2.order_status = ${@com.onsiteservice.constant.enums.ServiceOrderStatusEnum@VALUATION.getStatus()}
</select>
</mapper>
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