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
03ea93ae
Commit
03ea93ae
authored
Aug 15, 2022
by
shangtx
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev'
parents
c855ab08
6ff6b06f
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
91 additions
and
35 deletions
+91
-35
ServiceOrderController.java
...ervice/admin/controller/order/ServiceOrderController.java
+0
-1
OrderDetailVO.java
...nsiteservice/admin/controller/order/vo/OrderDetailVO.java
+6
-0
OrderPageVO.java
.../onsiteservice/admin/controller/order/vo/OrderPageVO.java
+3
-0
OrderListener.java
.../java/com/onsiteservice/admin/listener/OrderListener.java
+1
-1
application-dev.yaml
admin/src/main/resources/application-dev.yaml
+18
-1
ServiceOrderBizMapper.xml
...src/main/resources/mapper/order/ServiceOrderBizMapper.xml
+2
-0
ServiceOrderService.java
.../com/onsiteservice/service/order/ServiceOrderService.java
+13
-7
PayNoticeVO.java
...java/com/onsiteservice/service/order/dto/PayNoticeVO.java
+1
-1
BizConstants.java
...ava/com/onsiteservice/constant/constant/BizConstants.java
+1
-0
BizCodeEnum.java
...in/java/com/onsiteservice/constant/enums/BizCodeEnum.java
+2
-1
ServiceOrderStatusEnum.java
.../onsiteservice/constant/enums/ServiceOrderStatusEnum.java
+2
-1
ServiceOrder.java
...ain/java/com/onsiteservice/entity/order/ServiceOrder.java
+16
-4
ServiceOrderController.java
...vice/miniapp/controller/order/ServiceOrderController.java
+1
-2
ServiceOrderBizService.java
...service/miniapp/service/order/ServiceOrderBizService.java
+25
-16
No files found.
admin/src/main/java/com/onsiteservice/admin/controller/order/ServiceOrderController.java
View file @
03ea93ae
...
@@ -35,7 +35,6 @@ import static com.onsiteservice.core.result.ResultGenerator.success;
...
@@ -35,7 +35,6 @@ import static com.onsiteservice.core.result.ResultGenerator.success;
* @date 2022-07-14 15:11
* @date 2022-07-14 15:11
* @description ServiceOrderController控制类
* @description ServiceOrderController控制类
*/
*/
@ApiIgnore
@Api
(
tags
=
"ServiceOrderController"
)
@Api
(
tags
=
"ServiceOrderController"
)
@RestController
@RestController
@RequestMapping
(
"/order"
)
@RequestMapping
(
"/order"
)
...
...
admin/src/main/java/com/onsiteservice/admin/controller/order/vo/OrderDetailVO.java
View file @
03ea93ae
...
@@ -4,6 +4,7 @@ import com.onsiteservice.common.order.vo.ServiceOrderLogVO;
...
@@ -4,6 +4,7 @@ import com.onsiteservice.common.order.vo.ServiceOrderLogVO;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -34,6 +35,11 @@ public class OrderDetailVO {
...
@@ -34,6 +35,11 @@ public class OrderDetailVO {
@ApiModelProperty
(
value
=
"服务数量"
)
@ApiModelProperty
(
value
=
"服务数量"
)
private
Integer
num
;
private
Integer
num
;
@ApiModelProperty
(
"订单总价"
)
private
BigDecimal
totalPrice
;
private
BigDecimal
price
;
@ApiModelProperty
(
value
=
"子类服务图片,待受理标题图片url地址"
)
@ApiModelProperty
(
value
=
"子类服务图片,待受理标题图片url地址"
)
private
String
subclassImg
;
private
String
subclassImg
;
...
...
admin/src/main/java/com/onsiteservice/admin/controller/order/vo/OrderPageVO.java
View file @
03ea93ae
...
@@ -49,4 +49,7 @@ public class OrderPageVO {
...
@@ -49,4 +49,7 @@ public class OrderPageVO {
@ApiModelProperty
(
"创建时间"
)
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
private
Date
createTime
;
@ApiModelProperty
(
"订单总价"
)
private
BigDecimal
totalPrice
;
}
}
admin/src/main/java/com/onsiteservice/admin/listener/OrderListener.java
View file @
03ea93ae
...
@@ -25,7 +25,7 @@ public class OrderListener {
...
@@ -25,7 +25,7 @@ public class OrderListener {
private
SocketHandler
socketHandler
;
private
SocketHandler
socketHandler
;
private
static
final
String
USER_ID
=
"id"
;
private
static
final
String
USER_ID
=
"id"
;
// 1
用户已付款
// 1
已付款,未派单 2 已付款,已派单
private
static
final
String
TYPE
=
"type"
;
private
static
final
String
TYPE
=
"type"
;
@RabbitHandler
@RabbitHandler
...
...
admin/src/main/resources/application-dev.yaml
View file @
03ea93ae
...
@@ -3,3 +3,20 @@ spring:
...
@@ -3,3 +3,20 @@ spring:
profiles
:
profiles
:
include
:
include
:
-
common-dev
-
common-dev
logging
:
level
:
com.onsiteservice.admin.mapper
:
debug
org.springframework.boot.autoconfigure.security
:
warn
org.springframework.security.*
:
warn
com.ulisesbocchio.jasyptspringboot
:
warn
springfox.documentation.*
:
error
# 排除启动时Mapper扫描映射的警告 运行无影响
org.mybatis.spring.mapper.*
:
warn
tk.mybatis.spring.mapper.*
:
warn
# com.zaxxer.hikari.HikariConfig: error
org.apache.zookeeper.*
:
warn
root
:
info
com.onsiteservice.dao.mapper
:
debug
com.onsiteservice.common.business.pay
:
info
\ No newline at end of file
admin/src/main/resources/mapper/order/ServiceOrderBizMapper.xml
View file @
03ea93ae
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
t.order_status,
t.order_status,
t.price,
t.price,
t.create_time,
t.create_time,
t.total_price,
t.price,
ifnull(t2.user_name, t2.nick_name) user_name
ifnull(t2.user_name, t2.nick_name) user_name
from service_order t
from service_order t
join user t2 on t.account_no = t2.id
join user t2 on t.account_no = t2.id
...
...
common/src/main/java/com/onsiteservice/service/order/ServiceOrderService.java
View file @
03ea93ae
...
@@ -16,7 +16,10 @@ import com.onsiteservice.constant.enums.ServiceUserTypeEnum;
...
@@ -16,7 +16,10 @@ import com.onsiteservice.constant.enums.ServiceUserTypeEnum;
import
com.onsiteservice.core.exception.ServiceException
;
import
com.onsiteservice.core.exception.ServiceException
;
import
com.onsiteservice.dao.common.AbstractMapper
;
import
com.onsiteservice.dao.common.AbstractMapper
;
import
com.onsiteservice.dao.component.RecordComponent
;
import
com.onsiteservice.dao.component.RecordComponent
;
import
com.onsiteservice.dao.mapper.service.*
;
import
com.onsiteservice.dao.mapper.service.ServiceOrderMapper
;
import
com.onsiteservice.dao.mapper.service.ServiceValuatorAssignMapper
;
import
com.onsiteservice.dao.mapper.service.ServiceWorkerAssignMapper
;
import
com.onsiteservice.dao.mapper.service.ServiceWorkerMapper
;
import
com.onsiteservice.dao.mapper.sys.SysParamMapper
;
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
;
...
@@ -27,17 +30,14 @@ import com.onsiteservice.entity.service.ServiceWorkerAssign;
...
@@ -27,17 +30,14 @@ import com.onsiteservice.entity.service.ServiceWorkerAssign;
import
com.onsiteservice.entity.sys.SysParam
;
import
com.onsiteservice.entity.sys.SysParam
;
import
com.onsiteservice.entity.sys.SysUser
;
import
com.onsiteservice.entity.sys.SysUser
;
import
com.onsiteservice.entity.user.User
;
import
com.onsiteservice.entity.user.User
;
import
com.onsiteservice.util.aliyun.SmsUtils
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
tk.mybatis.mapper.entity.Condition
;
import
tk.mybatis.mapper.entity.Condition
;
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
;
...
@@ -147,7 +147,11 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -147,7 +147,11 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
// 判断能发送的状态: 估价后可以发送,预约后可以发送
// 判断能发送的状态: 估价后可以发送,预约后可以发送
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
()))
{
// 首次发送 或者 第一次的发送已经支付完成并且没有结束订单
boolean
canSendOrder
=
serviceOrder
.
getOrderStatus
()
<
ServiceOrderStatusEnum
.
SEND
.
getStatus
()
||
(
serviceOrder
.
getOrderStatus
()
>=
ServiceOrderStatusEnum
.
PAY
.
getStatus
()
&&
(
serviceOrder
.
getOrderStatus
()
<
ServiceOrderStatusEnum
.
FINISH
.
getStatus
()));
if
(!
canSendOrder
)
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_SEND
);
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_SEND
);
}
}
...
@@ -192,7 +196,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -192,7 +196,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
WorkUser
user
=
checkAuth
(
userId
,
BizCodeEnum
.
NO_AUTH_DISPATCH_ORDER
,
sourceEnum
,
Sets
.
newHashSet
(
ServiceUserTypeEnum
.
ADMIN
));
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
())
||
serviceOrder
.
getSkipWork
()
)
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_DISPATCH
);
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_DISPATCH
);
}
}
...
@@ -208,6 +212,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -208,6 +212,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
Condition
c
=
buildOrderStatusCondition
(
serviceOrder
);
Condition
c
=
buildOrderStatusCondition
(
serviceOrder
);
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
());
serviceOrder
.
setOrderStatus
(
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
());
serviceOrder
.
setModifyBy
(
userId
);
serviceOrder
.
setModifyBy
(
userId
);
serviceOrder
.
setSkipWork
(
true
);
int
result
=
serviceOrderMapper
.
updateByConditionSelective
(
serviceOrder
,
c
);
int
result
=
serviceOrderMapper
.
updateByConditionSelective
(
serviceOrder
,
c
);
commonSmsService
.
dispatched
(
serviceOrder
.
getPhone
(),
user
.
getPhone
(),
serviceOrder
.
getServiceName
());
commonSmsService
.
dispatched
(
serviceOrder
.
getPhone
(),
user
.
getPhone
(),
serviceOrder
.
getServiceName
());
...
@@ -265,7 +270,8 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
...
@@ -265,7 +270,8 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
log
.
info
(
"finishOrder dto: {}, userId: {}"
,
dto
,
userId
);
log
.
info
(
"finishOrder dto: {}, userId: {}"
,
dto
,
userId
);
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())) {
if
(!
serviceOrder
.
getSkipWork
())
{
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_FINISH
);
throw
new
ServiceException
(
BizCodeEnum
.
SERVICE_ORDER_CANNOT_FINISH
);
}
}
...
...
common/src/main/java/com/onsiteservice/service/order/dto/PayNoticeVO.java
View file @
03ea93ae
...
@@ -14,6 +14,6 @@ import java.io.Serializable;
...
@@ -14,6 +14,6 @@ import java.io.Serializable;
public
class
PayNoticeVO
implements
Serializable
{
public
class
PayNoticeVO
implements
Serializable
{
// 用户id
// 用户id
private
String
id
;
private
String
id
;
// 类型 1 支付成功
// 类型 1 支付成功
,未派单 2 已派单,支付成功
private
String
type
;
private
String
type
;
}
}
constant/src/main/java/com/onsiteservice/constant/constant/BizConstants.java
View file @
03ea93ae
...
@@ -19,6 +19,7 @@ public class BizConstants {
...
@@ -19,6 +19,7 @@ public class BizConstants {
public
static
class
OrderConstants
{
public
static
class
OrderConstants
{
public
static
final
String
ORDER_ID
=
"orderId"
;
public
static
final
String
ORDER_ID
=
"orderId"
;
public
static
final
String
ORDER_STATUS
=
"orderStatus"
;
public
static
final
String
ORDER_STATUS
=
"orderStatus"
;
public
static
final
String
DUP_ORDER_STATUS
=
"dupOrderStatus"
;
public
static
final
long
TIMEOUT_CANCEL_LIMIT
=
1000
*
60
*
30
;
public
static
final
long
TIMEOUT_CANCEL_LIMIT
=
1000
*
60
*
30
;
/**
/**
...
...
constant/src/main/java/com/onsiteservice/constant/enums/BizCodeEnum.java
View file @
03ea93ae
...
@@ -24,7 +24,8 @@ public enum BizCodeEnum {
...
@@ -24,7 +24,8 @@ public enum BizCodeEnum {
SERVICE_ORDER_NOT_EXIST
(
"订单不存在"
),
SERVICE_ORDER_NOT_EXIST
(
"订单不存在"
),
SERVICE_ORDER_CANNOT_VALUATION
(
"订单不能派估价员"
),
SERVICE_ORDER_CANNOT_VALUATION
(
"订单不能派估价员"
),
SERVICE_ORDER_CANNOT_REVALUATION
(
"订单未估价,不能修改"
),
SERVICE_ORDER_CANNOT_REVALUATION
(
"订单未估价,不能修改"
),
SERVICE_ORDER_CANNOT_SEND
(
"订单未受理,不能发送或已发送"
),
SERVICE_ORDER_CANNOT_SEND
(
"不能发送或已发送"
),
SERVICE_ORDER_CANNOT_RESEND
(
"订单不能重新发送"
),
SERVICE_ORDER_CANNOT_PAY
(
"订单未受理,暂不能支付"
),
SERVICE_ORDER_CANNOT_PAY
(
"订单未受理,暂不能支付"
),
SERVICE_ORDER_CANNOT_CANCEL
(
"订单不能取消"
),
SERVICE_ORDER_CANNOT_CANCEL
(
"订单不能取消"
),
SERVICE_ORDER_CANNOT_REFUND
(
"订单不能申请退款"
),
SERVICE_ORDER_CANNOT_REFUND
(
"订单不能申请退款"
),
...
...
constant/src/main/java/com/onsiteservice/constant/enums/ServiceOrderStatusEnum.java
View file @
03ea93ae
...
@@ -27,11 +27,12 @@ public enum ServiceOrderStatusEnum {
...
@@ -27,11 +27,12 @@ public enum ServiceOrderStatusEnum {
* 已发送
* 已发送
*/
*/
SEND
(
3
,
"%s 已发送订单信息"
),
SEND
(
3
,
"%s 已发送订单信息"
),
RESEND
(
3
,
"%s 已重新发送订单信息"
),
/**
/**
* 已支付
* 已支付
*/
*/
PAY
(
4
,
"用户已付款"
),
PAY
(
4
,
"用户已付款
%s 元
"
),
/**
/**
* 已派单
* 已派单
...
...
entity/src/main/java/com/onsiteservice/entity/order/ServiceOrder.java
View file @
03ea93ae
...
@@ -99,19 +99,31 @@ public class ServiceOrder implements Serializable {
...
@@ -99,19 +99,31 @@ public class ServiceOrder implements Serializable {
private
Boolean
readAgreement
;
private
Boolean
readAgreement
;
/**
/**
* 订单状态:1
已预约,2已派单,3进行中,4完成,5取消,6已评价
* 订单状态:1
用户下单,2派估价员或修改估价员,3发送订单,4支付,5派维修工或修改维修工,6完成订单,7取消订单
*/
*/
@Column
(
name
=
"order_status"
)
@Column
(
name
=
"order_status"
)
@ApiModelProperty
(
"订单状态:1
已预约,2已派单,3进行中,4完成,5取消,6已评价
"
)
@ApiModelProperty
(
"订单状态:1
用户下单,2派估价员或修改估价员,3发送订单,4支付,5派维修工或修改维修工,6完成订单,7取消订单
"
)
private
Integer
orderStatus
;
private
Integer
orderStatus
;
/**
/**
*
价格
*
重新发送后的订单状态:3发送订单,4支付,5派维修工或修改维修工
*/
*/
@Column
(
name
=
"skip_work"
)
@ApiModelProperty
(
"跳过维修工,派过维修工后,该字段永久为为true"
)
private
Boolean
skipWork
;
@Column
(
name
=
"total_price"
)
@ApiModelProperty
(
"订单总价格,以元为单位"
)
private
BigDecimal
totalPrice
;
@Column
(
name
=
"price"
)
@Column
(
name
=
"price"
)
@ApiModelProperty
(
"
订单价格
"
)
@ApiModelProperty
(
"
当前发送订单操作的价格,以元为单位
"
)
private
BigDecimal
price
;
private
BigDecimal
price
;
@Column
(
name
=
"pay_num"
)
@ApiModelProperty
(
"支付次数"
)
private
Integer
payNum
;
/**
/**
* 服务订单备注字段
* 服务订单备注字段
*/
*/
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/controller/order/ServiceOrderController.java
View file @
03ea93ae
...
@@ -29,7 +29,6 @@ import org.springframework.web.bind.annotation.*;
...
@@ -29,7 +29,6 @@ import org.springframework.web.bind.annotation.*;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.validation.constraints.Positive
;
import
javax.validation.constraints.Positive
;
import
java.util.Map
;
import
java.util.Map
;
import
static
com
.
onsiteservice
.
core
.
result
.
ResultGenerator
.
fail
;
import
static
com
.
onsiteservice
.
core
.
result
.
ResultGenerator
.
fail
;
...
@@ -109,7 +108,7 @@ public class ServiceOrderController {
...
@@ -109,7 +108,7 @@ public class ServiceOrderController {
@ApiOperation
(
value
=
"发送订单"
)
@ApiOperation
(
value
=
"发送订单"
)
@ApiIdempotent
(
interval
=
3000L
)
@ApiIdempotent
(
interval
=
3000L
)
@PostMapping
(
"send"
)
@PostMapping
(
"send"
)
public
Result
valuation
(
@RequestBody
@NonNull
@Validated
SendServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
public
Result
send
(
@RequestBody
@NonNull
@Validated
SendServiceOrderDTO
dto
,
@CurrentUserId
Long
userId
)
{
return
serviceOrderService
.
sendOrder
(
dto
,
userId
,
ServiceOrderOpSourceEnum
.
MINI_APP
)
==
1
?
success
()
:
fail
(
"发送失败"
);
return
serviceOrderService
.
sendOrder
(
dto
,
userId
,
ServiceOrderOpSourceEnum
.
MINI_APP
)
==
1
?
success
()
:
fail
(
"发送失败"
);
}
}
...
...
mini-app/src/main/java/com/onsiteservice/miniapp/service/order/ServiceOrderBizService.java
View file @
03ea93ae
...
@@ -38,6 +38,7 @@ import com.onsiteservice.miniapp.controller.order.vo.ServiceOrderDefDetailVO;
...
@@ -38,6 +38,7 @@ import com.onsiteservice.miniapp.controller.order.vo.ServiceOrderDefDetailVO;
import
com.onsiteservice.miniapp.mapper.order.ServiceOrderBizMapper
;
import
com.onsiteservice.miniapp.mapper.order.ServiceOrderBizMapper
;
import
com.onsiteservice.miniapp.service.weixin.pay.WechatNativePay
;
import
com.onsiteservice.miniapp.service.weixin.pay.WechatNativePay
;
import
com.onsiteservice.service.order.ServiceOrderService
;
import
com.onsiteservice.service.order.ServiceOrderService
;
import
com.onsiteservice.service.order.dto.PayNoticeVO
;
import
com.onsiteservice.util.AttrCopyUtils
;
import
com.onsiteservice.util.AttrCopyUtils
;
import
com.onsiteservice.util.RandomUtils
;
import
com.onsiteservice.util.RandomUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -52,6 +53,7 @@ import tk.mybatis.mapper.entity.Condition;
...
@@ -52,6 +53,7 @@ import tk.mybatis.mapper.entity.Condition;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -217,7 +219,6 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
...
@@ -217,7 +219,6 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
int
result
=
this
.
insertSelective
(
serviceOrder
);
int
result
=
this
.
insertSelective
(
serviceOrder
);
recordComponent
.
recordServiceOrderImg
(
serviceOrder
,
dto
.
getUrls
());
recordComponent
.
recordServiceOrderImg
(
serviceOrder
,
dto
.
getUrls
());
// 记录流程
// 记录流程
if
(
result
==
1
)
{
if
(
result
==
1
)
{
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
RESERVE
.
getStatus
(),
ServiceOrderStatusEnum
.
RESERVE
.
getMsg
(),
sourceEnum
,
null
,
null
,
null
);
recordComponent
.
recordProcess
(
serviceOrder
.
getId
(),
ServiceOrderStatusEnum
.
RESERVE
.
getStatus
(),
ServiceOrderStatusEnum
.
RESERVE
.
getMsg
(),
sourceEnum
,
null
,
null
,
null
);
...
@@ -228,33 +229,38 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
...
@@ -228,33 +229,38 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
public
void
paySuccess
(
String
orderNo
,
String
info
)
{
public
void
paySuccess
(
String
orderNo
,
String
info
)
{
log
.
info
(
"支付成功 orderNo: {}, info: {}"
,
orderNo
,
info
);
log
.
info
(
"支付成功 orderNo: {}, info: {}"
,
orderNo
,
info
);
var
no
=
orderNo
.
split
(
"-"
)[
0
];
var
order
=
selectOneByProperty
(
"orderNo"
,
no
);
var
order
=
selectOneByProperty
(
"orderNo"
,
orderNo
);
order
.
setOrderStatus
(
order
.
getSkipWork
()
?
ServiceOrderStatusEnum
.
DISPATCH
.
getStatus
()
:
ServiceOrderStatusEnum
.
PAY
.
getStatus
()
);
order
.
setTotalPrice
(
order
.
getTotalPrice
()
==
null
?
order
.
getPrice
():
order
.
getTotalPrice
().
add
(
order
.
getPrice
()));
order
.
set
OrderStatus
(
ServiceOrderStatusEnum
.
PAY
.
getStatus
()
);
order
.
set
PayNum
(
order
.
getPayNum
()
+
1
);
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
order
);
int
result
=
serviceOrderMapper
.
updateByPrimaryKeySelective
(
order
);
// 通知客服
// 通知客服
var
logCondition
=
new
ServiceOrderLog
();
var
logCondition
=
new
Condition
(
ServiceOrderLog
.
class
);
logCondition
.
setOrderId
(
order
.
getId
());
logCondition
.
createCriteria
().
andEqualTo
(
"orderId"
,
order
.
getId
())
logCondition
.
setProcessId
(
ServiceOrderStatusEnum
.
SEND
.
getStatus
());
.
andEqualTo
(
"processId"
,
ServiceOrderStatusEnum
.
SEND
.
getStatus
());
var
orderLog
=
serviceOrderLogMapper
.
selectOne
(
logCondition
);
logCondition
.
setOrderByClause
(
"create_time desc limit 1"
);
if
(
orderLog
!=
null
)
{
var
orderLogs
=
serviceOrderLogMapper
.
selectByCondition
(
logCondition
);
if
(!
orderLogs
.
isEmpty
())
{
var
orderLog
=
orderLogs
.
get
(
0
);
if
(
ServiceOrderOpSourceEnum
.
WEB
.
getId
().
equals
(
orderLog
.
getSource
()))
{
if
(
ServiceOrderOpSourceEnum
.
WEB
.
getId
().
equals
(
orderLog
.
getSource
()))
{
var
sysUser
=
sysUserMapper
.
selectByPrimaryKey
(
orderLog
.
getHostId
());
var
sysUser
=
sysUserMapper
.
selectByPrimaryKey
(
orderLog
.
getHostId
());
if
(
StringUtils
.
isNotEmpty
(
sysUser
.
getPhone
()))
{
if
(
StringUtils
.
isNotEmpty
(
sysUser
.
getPhone
()))
{
try
{
try
{
if
(
order
.
getPayNum
()
==
1
)
{
// 首次支付才发短信
commonSmsService
.
paid
(
sysUser
.
getPhone
());
commonSmsService
.
paid
(
sysUser
.
getPhone
());
amqpTemplate
.
convertAndSend
(
SysConstants
.
Queue
.
ADMIN_ORDER
,
Pair
.
of
(
sysUser
.
getId
(),
1
));
}
amqpTemplate
.
convertAndSend
(
SysConstants
.
Queue
.
ADMIN_ORDER
,
PayNoticeVO
.
builder
().
id
(
sysUser
.
getId
().
toString
()).
type
(
order
.
getSkipWork
()
?
"2"
:
"1"
).
build
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
log
.
error
(
"订单{} 支付成功短信发送失败"
,
orderNo
);
log
.
error
(
"订单{} 支付成功短信发送失败"
,
orderNo
);
}
}
}
}
}
}
if
(
ServiceOrderOpSourceEnum
.
MINI_APP
.
getId
().
equals
(
orderLog
.
getSource
()))
{
if
(
ServiceOrderOpSourceEnum
.
MINI_APP
.
getId
().
equals
(
orderLog
.
getSource
())
&&
order
.
getPayNum
()
==
1
)
{
var
user
=
userMapper
.
selectByPrimaryKey
(
orderLog
.
getHostId
());
var
user
=
userMapper
.
selectByPrimaryKey
(
orderLog
.
getHostId
());
try
{
try
{
commonSmsService
.
paid
(
user
.
getPhone
());
commonSmsService
.
paid
(
user
.
getPhone
());
...
@@ -265,7 +271,8 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
...
@@ -265,7 +271,8 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
}
}
}
}
if
(
result
==
1
)
{
if
(
result
==
1
)
{
recordComponent
.
recordProcess
(
order
.
getId
(),
ServiceOrderStatusEnum
.
PAY
.
getStatus
(),
ServiceOrderStatusEnum
.
PAY
.
getMsg
(),
ServiceOrderOpSourceEnum
.
MINI_APP
,
null
,
null
,
null
);
var
payMsg
=
String
.
format
(
ServiceOrderStatusEnum
.
PAY
.
getMsg
(),
order
.
getPrice
());
recordComponent
.
recordProcess
(
order
.
getId
(),
ServiceOrderStatusEnum
.
PAY
.
getStatus
(),
payMsg
,
ServiceOrderOpSourceEnum
.
MINI_APP
,
null
,
null
,
null
);
}
}
}
}
...
@@ -316,7 +323,8 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
...
@@ -316,7 +323,8 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
var
user
=
userMapper
.
selectByPrimaryKey
(
userId
);
var
user
=
userMapper
.
selectByPrimaryKey
(
userId
);
try
{
try
{
var
params
=
wechatNativePay
.
getPayParam
(
"服务预约"
,
order
.
getOrderNo
(),
order
.
getPrice
(),
notifyUrl
,
String
orderNo
=
order
.
getOrderNo
()
+
"-"
+
order
.
getPayNum
();
var
params
=
wechatNativePay
.
getPayParam
(
"服务预约"
,
orderNo
,
order
.
getPrice
(),
notifyUrl
,
user
.
getOpenId
(),
request
);
user
.
getOpenId
(),
request
);
return
new
OrderPayVO
(
params
);
return
new
OrderPayVO
(
params
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -425,12 +433,13 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
...
@@ -425,12 +433,13 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
/**
/**
* 获取各个状态(前端状态)下的待办数量
* 获取各个状态(前端状态)下的待办数量
*
* @param userId
* @param userId
* @return
* @return
*/
*/
public
Map
<
Integer
,
Integer
>
getTodoNum
(
Long
userId
)
{
public
Map
<
Integer
,
Integer
>
getTodoNum
(
Long
userId
)
{
User
user
=
userMapper
.
selectByPrimaryKey
(
userId
);
User
user
=
userMapper
.
selectByPrimaryKey
(
userId
);
if
(!
ServiceUserTypeEnum
.
ADMIN
.
getId
().
equals
(
user
.
getRoleType
()))
{
if
(!
ServiceUserTypeEnum
.
ADMIN
.
getId
().
equals
(
user
.
getRoleType
()))
{
return
Map
.
of
(
1
,
0
,
3
,
0
,
4
,
0
,
5
,
0
,
6
,
0
);
return
Map
.
of
(
1
,
0
,
3
,
0
,
4
,
0
,
5
,
0
,
6
,
0
);
}
}
...
...
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