Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
peizhen-java
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PeiZhen-Java
peizhen-java
Commits
dc985e34
Commit
dc985e34
authored
Sep 15, 2023
by
Wangmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善 开始服务
parent
4c486c26
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
313 additions
and
49 deletions
+313
-49
pz-accompany/src/main/java/com/pz/accompany/AccompanyController.java
+35
-3
pz-system/src/main/java/com/pz/merchant/service/ISonOrderService.java
+19
-0
pz-system/src/main/java/com/pz/system/domain/bo/OrderCommonBo.java
+29
-0
pz-system/src/main/java/com/pz/system/domain/bo/OrderFinishedBo.java
+32
-0
pz-system/src/main/java/com/pz/system/domain/vo/ZyphOrderItemVo.java
+10
-0
pz-system/src/main/java/com/pz/system/service/impl/DbghOrderServiceImpl.java
+5
-1
pz-system/src/main/java/com/pz/system/service/impl/DbmyOrderServiceImpl.java
+30
-25
pz-system/src/main/java/com/pz/system/service/impl/DbwzOrderServiceImpl.java
+41
-2
pz-system/src/main/java/com/pz/system/service/impl/TotalOrderServiceImpl.java
+22
-15
pz-system/src/main/java/com/pz/system/service/impl/YypzOrderServiceImpl.java
+41
-2
pz-system/src/main/java/com/pz/system/service/impl/ZyphOrderServiceImpl.java
+46
-0
pz-system/src/main/resources/mapper/system/ZyphOrderMapper.xml
+3
-1
No files found.
pz-accompany/src/main/java/com/pz/accompany/Accompany
EmployeesAccompany
Controller.java
→
pz-accompany/src/main/java/com/pz/accompany/AccompanyController.java
View file @
dc985e34
...
...
@@ -6,11 +6,16 @@ import com.pz.common.core.domain.PageQuery;
import
com.pz.common.core.domain.R
;
import
com.pz.common.core.page.TableDataInfo
;
import
com.pz.common.core.validate.EditGroup
;
import
com.pz.common.exception.ServiceException
;
import
com.pz.merchant.domain.bo.OrderBo
;
import
com.pz.merchant.domain.vo.OrderInfoVO
;
import
com.pz.merchant.service.IEmployeesService
;
import
com.pz.merchant.service.ISonOrderService
;
import
com.pz.merchant.service.impl.SonOrderServiceBuilder
;
import
com.pz.system.domain.bo.AccompanyAddressBo
;
import
com.pz.system.domain.bo.OrderCommonBo
;
import
com.pz.system.domain.vo.AccompanyDemandVo
;
import
com.pz.system.domain.vo.OrderCommonVo
;
import
com.pz.system.service.IDbmyOrderService
;
import
com.pz.system.service.ITotalOrderService
;
import
lombok.RequiredArgsConstructor
;
...
...
@@ -31,7 +36,7 @@ import javax.validation.constraints.NotNull;
@RestController
@RequestMapping
(
"app/accompany"
)
@SaIgnore
public
class
Accompany
EmployeesAccompany
Controller
extends
BaseController
{
public
class
AccompanyController
extends
BaseController
{
private
final
ITotalOrderService
totalOrderService
;
...
...
@@ -39,6 +44,8 @@ public class AccompanyEmployeesAccompanyController extends BaseController {
private
final
IDbmyOrderService
dbmyOrderService
;
private
final
SonOrderServiceBuilder
sonOrderServiceBuilder
;
/**
* 需求广场 列表
...
...
@@ -85,9 +92,34 @@ public class AccompanyEmployeesAccompanyController extends BaseController {
return
employeesService
.
queryAllOrder
(
bo
,
pageQuery
);
}
/**
* 陪诊员取消订单
*
* @param bo 订单参数
* @return 操作结果
*/
@PutMapping
(
"/cancel"
)
public
R
<
Boolean
>
cancelOrder
()
{
return
null
;
public
R
<
Boolean
>
cancelOrder
(
@Validated
(
EditGroup
.
class
)
@RequestBody
OrderCommonBo
bo
)
{
ISonOrderService
orderService
=
sonOrderServiceBuilder
.
getSonOrderService
(
bo
.
getBusinessId
());
if
(
orderService
==
null
)
{
throw
new
ServiceException
(
"业务异常"
);
}
return
R
.
ok
(
orderService
.
accompanyCancellationOfOrder
(
bo
.
getOrderId
()));
}
/**
* 陪诊员取消订单
*
* @param bo 订单参数
* @return 操作结果
*/
@PutMapping
(
"/startService"
)
public
R
<
Boolean
>
startOrderService
(
@Validated
(
EditGroup
.
class
)
@RequestBody
OrderCommonBo
bo
)
{
ISonOrderService
orderService
=
sonOrderServiceBuilder
.
getSonOrderService
(
bo
.
getBusinessId
());
if
(
orderService
==
null
)
{
throw
new
ServiceException
(
"业务异常"
);
}
return
R
.
ok
(
orderService
.
accompanyStartService
(
bo
.
getOrderId
()));
}
/**
...
...
pz-system/src/main/java/com/pz/merchant/service/ISonOrderService.java
View file @
dc985e34
...
...
@@ -51,4 +51,23 @@ public interface ISonOrderService {
*/
boolean
accompanyCancellationOfOrder
(
Integer
totalId
);
/**
* 陪诊员开始服务
*
* @param totalId 主订单ID
* @return 操作结果
*/
default
boolean
accompanyStartService
(
Integer
totalId
){
throw
new
UnsupportedOperationException
(
"不支持该操作"
);
}
/**
* 陪诊员完成服务
* @param totalId 主订单ID
* @return 操作结果
*/
default
boolean
finishedService
(
Integer
totalId
)
{
throw
new
UnsupportedOperationException
(
"不支持该操作"
);
}
}
pz-system/src/main/java/com/pz/system/domain/bo/OrderCommonBo.java
0 → 100644
View file @
dc985e34
package
com
.
pz
.
system
.
domain
.
bo
;
import
com.pz.common.core.validate.EditGroup
;
import
lombok.Data
;
import
javax.validation.constraints.NotNull
;
/**
* <p>created in 2023/9/15 9:31
*
* @author WangMin
* @version 1.0
*/
@Data
public
class
OrderCommonBo
{
/**
* 业务ID
*/
@NotNull
(
groups
=
EditGroup
.
class
,
message
=
"业务ID不能为空"
)
private
Integer
businessId
;
/**
* 主订单ID
*/
@NotNull
(
groups
=
EditGroup
.
class
,
message
=
"主订单ID不能为空"
)
private
Integer
orderId
;
}
pz-system/src/main/java/com/pz/system/domain/bo/OrderFinishedBo.java
0 → 100644
View file @
dc985e34
package
com
.
pz
.
system
.
domain
.
bo
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* 订单已完成实体
* <p>created in 2023/9/15 11:43
*
* @author WangMin
* @version 1.0
*/
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
public
class
OrderFinishedBo
extends
OrderCommonBo
{
/**
* 凭证
*/
private
String
voucher
;
/**
* 备注
*/
private
String
remark
;
/**
* 主治医师
*/
private
String
doctor
;
}
pz-system/src/main/java/com/pz/system/domain/vo/ZyphOrderItemVo.java
View file @
dc985e34
...
...
@@ -57,4 +57,14 @@ public class ZyphOrderItemVo extends OrderCommonVo {
* 凭证
*/
private
String
voucher
;
/**
* 评价
*/
private
String
evaluationContent
;
/**
* 是否好评,0-未评价,1-好评,2-差评
*/
private
Integer
evaluationFlag
;
}
pz-system/src/main/java/com/pz/system/service/impl/DbghOrderServiceImpl.java
View file @
dc985e34
...
...
@@ -181,7 +181,6 @@ public class DbghOrderServiceImpl implements IDbghOrderService, ISonOrderService
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
accompanyCancellationOfOrder
(
Integer
totalId
)
{
TotalOrder
totalOrder
=
totalOrderMapper
.
selectById
(
totalId
);
Objects
.
requireNonNull
(
totalOrder
,
"主订单不存在"
);
Integer
emId
=
totalOrder
.
getEmId
();
...
...
@@ -233,4 +232,9 @@ public class DbghOrderServiceImpl implements IDbghOrderService, ISonOrderService
}
return
true
;
}
@Override
public
boolean
accompanyStartService
(
Integer
totalId
)
{
throw
new
UnsupportedOperationException
(
"此类业务订单不支持该操作"
);
}
}
pz-system/src/main/java/com/pz/system/service/impl/DbmyOrderServiceImpl.java
View file @
dc985e34
...
...
@@ -207,21 +207,7 @@ public class DbmyOrderServiceImpl implements IDbmyOrderService, ISonOrderService
}
DbmyOrder
dbmyOrder
=
baseMapper
.
selectOne
(
Wrappers
.<
DbmyOrder
>
lambdaQuery
().
eq
(
DbmyOrder:
:
getOrderId
,
totalId
));
Objects
.
requireNonNull
(
dbmyOrder
,
"子订单与主订单不一致!"
);
// 若设置了就诊时间,在取消订单时需要检查是否在18小时之前
// 取消次数
Integer
cancel
=
RedisUtils
.<
Integer
>
getCacheMapValue
(
ISonOrderService
.
ORDER_CANCEL_CACHE_PREFIX
,
String
.
valueOf
(
emId
));
if
(
dbmyOrder
.
getOverTime
()
!=
null
)
{
LocalDateTime
visitTime
=
LocalDateTime
.
ofInstant
(
dbmyOrder
.
getOverTime
().
toInstant
(),
ZoneId
.
systemDefault
());
LocalDateTime
currentDate
=
LocalDateTime
.
ofInstant
(
new
Date
().
toInstant
(),
ZoneId
.
systemDefault
());
// 若缓存为空,则查询数据表
if
(
cancel
==
null
)
{
cancel
=
Optional
.
ofNullable
(
employeesMapper
.
selectById
(
emId
).
getKillOrder
()).
orElse
(
0
);
}
// 若在18小时前取消订单,需记录取消次数
if
(
visitTime
.
isBefore
(
currentDate
)
||
ChronoUnit
.
HOURS
.
between
(
visitTime
,
currentDate
)
<=
18
)
{
cancel
++;
}
}
// 代办买药,取消时间判定操作
// 更新主订单数据
totalOrder
.
setEmId
(
0
);
totalOrder
.
setSuborderStatus
(
0
);
...
...
@@ -233,18 +219,37 @@ public class DbmyOrderServiceImpl implements IDbmyOrderService, ISonOrderService
if
(
baseMapper
.
updateById
(
dbmyOrder
)
<
0
)
{
throw
new
ServiceException
(
"子订单更新失败"
);
}
// 若取消次数大于3,则冻结用户账号
if
(
cancel
!=
null
&&
cancel
>
3
)
{
if
(
employeesMapper
.
update
(
null
,
Wrappers
.<
Employees
>
lambdaUpdate
()
.
set
(
Employees:
:
getStatus
,
2
)
.
set
(
Employees:
:
getKillOrder
,
cancel
)
.
eq
(
Employees:
:
getId
,
emId
))
<
0
)
{
throw
new
ServiceException
(
"用户冻结失败"
);
return
true
;
}
/**
* 陪诊员开始服务代办买药订单
*
* @param totalId 主订单ID
* @return 操作结果
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
accompanyStartService
(
Integer
totalId
)
{
TotalOrder
totalOrder
=
totalOrderMapper
.
selectById
(
totalId
);
Objects
.
requireNonNull
(
totalOrder
,
"主订单不存在"
);
if
(
totalOrder
.
getStatus
()
!=
1
||
totalOrder
.
getEmId
()
==
0
)
{
// 用户已付款
throw
new
ServiceException
(
"主订单不符合开始服务要求"
);
}
DbmyOrder
suborder
=
baseMapper
.
selectOne
(
Wrappers
.<
DbmyOrder
>
lambdaQuery
().
eq
(
DbmyOrder:
:
getOrderId
,
totalId
));
Objects
.
requireNonNull
(
suborder
,
"子订单不存在"
);
if
(
suborder
.
getStatus
()
!=
1
)
{
// 订单已接单
throw
new
ServiceException
(
"子订单不符合开始服务要求"
);
}
if
(
cancel
!=
null
)
{
RedisUtils
.
setCacheMapValue
(
ISonOrderService
.
ORDER_CANCEL_CACHE_PREFIX
,
String
.
valueOf
(
emId
),
cancel
);
// 代办买药,取消时间判定操作
// 修改子订单状态为开始服务
suborder
.
setStatus
(
6
);
totalOrder
.
setSuborderStatus
(
6
);
if
(
baseMapper
.
updateById
(
suborder
)
<
0
)
{
throw
new
ServiceException
(
"操作失败,子订单异常"
);
}
if
(
totalOrderMapper
.
updateById
(
totalOrder
)
<
0
)
{
throw
new
ServiceException
(
"操作失败,主订单异常"
);
}
return
true
;
}
...
...
pz-system/src/main/java/com/pz/system/service/impl/DbwzOrderServiceImpl.java
View file @
dc985e34
...
...
@@ -195,8 +195,8 @@ public class DbwzOrderServiceImpl implements IDbwzOrderService, ISonOrderService
// 若设置了就诊时间,在取消订单时需要检查是否在18小时之前
// 取消次数
Integer
cancel
=
RedisUtils
.<
Integer
>
getCacheMapValue
(
ISonOrderService
.
ORDER_CANCEL_CACHE_PREFIX
,
String
.
valueOf
(
emId
));
if
(
dbwzOrder
.
get
Over
Time
()
!=
null
)
{
LocalDateTime
visitTime
=
LocalDateTime
.
ofInstant
(
dbwzOrder
.
get
Over
Time
().
toInstant
(),
ZoneId
.
systemDefault
());
if
(
dbwzOrder
.
get
Visit
Time
()
!=
null
)
{
LocalDateTime
visitTime
=
LocalDateTime
.
ofInstant
(
dbwzOrder
.
get
Visit
Time
().
toInstant
(),
ZoneId
.
systemDefault
());
LocalDateTime
currentDate
=
LocalDateTime
.
ofInstant
(
new
Date
().
toInstant
(),
ZoneId
.
systemDefault
());
// 若缓存为空,则查询数据表
if
(
cancel
==
null
)
{
...
...
@@ -233,4 +233,43 @@ public class DbwzOrderServiceImpl implements IDbwzOrderService, ISonOrderService
}
return
true
;
}
/**
* 陪诊员开始服务待办问诊订单
*
* @param totalId 主订单ID
* @return 操作结果
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
accompanyStartService
(
Integer
totalId
)
{
TotalOrder
totalOrder
=
totalOrderMapper
.
selectById
(
totalId
);
Objects
.
requireNonNull
(
totalOrder
,
"主订单不存在"
);
if
(
totalOrder
.
getStatus
()
!=
1
||
totalOrder
.
getEmId
()
==
0
)
{
// 用户已付款
throw
new
ServiceException
(
"主订单不符合开始服务要求"
);
}
DbwzOrder
suborder
=
baseMapper
.
selectOne
(
Wrappers
.<
DbwzOrder
>
lambdaQuery
().
eq
(
DbwzOrder:
:
getOrderId
,
totalId
));
Objects
.
requireNonNull
(
suborder
,
"子订单不存在"
);
if
(
suborder
.
getStatus
()
!=
1
)
{
// 订单已接单
throw
new
ServiceException
(
"子订单不符合开始服务要求"
);
}
// 操作时间若未到达开始时间,则拒绝该操作
if
(
suborder
.
getVisitTime
()
!=
null
)
{
LocalDateTime
visitTime
=
LocalDateTime
.
ofInstant
(
suborder
.
getVisitTime
().
toInstant
(),
ZoneId
.
systemDefault
());
LocalDateTime
currentDate
=
LocalDateTime
.
ofInstant
(
new
Date
().
toInstant
(),
ZoneId
.
systemDefault
());
if
(
currentDate
.
isBefore
(
visitTime
))
{
throw
new
ServiceException
(
"请在到达陪诊时间后再点击开始服务"
);
}
}
// 修改子订单状态为开始服务
suborder
.
setStatus
(
6
);
totalOrder
.
setSuborderStatus
(
6
);
if
(
baseMapper
.
updateById
(
suborder
)
<
0
)
{
throw
new
ServiceException
(
"操作失败,子订单异常"
);
}
if
(
totalOrderMapper
.
updateById
(
totalOrder
)
<
0
)
{
throw
new
ServiceException
(
"操作失败,主订单异常"
);
}
return
true
;
}
}
pz-system/src/main/java/com/pz/system/service/impl/TotalOrderServiceImpl.java
View file @
dc985e34
...
...
@@ -87,46 +87,46 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
@Override
public
TotalOrderVo
queryByAppId
(
Integer
id
)
{
TotalOrderVo
totalOrderVo
=
baseMapper
.
selectByOrderId
(
id
);
if
(
totalOrderVo
.
getBusinessId
()
==
1
){
//
预约陪诊
if
(
totalOrderVo
.
getBusinessId
()
==
1
)
{
//
预约陪诊
totalOrderVo
.
setServiceStatus
(
yypzOrderMapper
.
selectOne
(
new
LambdaQueryWrapper
<
YypzOrder
>().
eq
(
YypzOrder:
:
getOrderId
,
totalOrderVo
.
getId
())).
getStatus
()
);
}
else
if
(
totalOrderVo
.
getBusinessId
()
==
2
){
//
代办挂号
}
else
if
(
totalOrderVo
.
getBusinessId
()
==
2
)
{
//
代办挂号
totalOrderVo
.
setServiceStatus
(
dbghOrderMapper
.
selectOne
(
new
LambdaQueryWrapper
<
DbghOrder
>().
eq
(
DbghOrder:
:
getOrderId
,
totalOrderVo
.
getId
())).
getStatus
()
);
}
else
if
(
totalOrderVo
.
getBusinessId
()
==
3
){
//
代办问诊
}
else
if
(
totalOrderVo
.
getBusinessId
()
==
3
)
{
//
代办问诊
totalOrderVo
.
setServiceStatus
(
dbwzOrderMapper
.
selectOne
(
new
LambdaQueryWrapper
<
DbwzOrder
>().
eq
(
DbwzOrder:
:
getOrderId
,
totalOrderVo
.
getId
())).
getStatus
()
);
}
else
if
(
totalOrderVo
.
getBusinessId
()
==
4
){
//
住院陪护
}
else
if
(
totalOrderVo
.
getBusinessId
()
==
4
)
{
//
住院陪护
totalOrderVo
.
setServiceStatus
(
zyphOrderMapper
.
selectOne
(
new
LambdaQueryWrapper
<
ZyphOrder
>().
eq
(
ZyphOrder:
:
getOrderId
,
totalOrderVo
.
getId
())).
getStatus
()
);
}
else
if
(
totalOrderVo
.
getBusinessId
()
==
5
){
//
代办买药
}
else
if
(
totalOrderVo
.
getBusinessId
()
==
5
)
{
//
代办买药
totalOrderVo
.
setServiceStatus
(
dbmyOrderMapper
.
selectOne
(
new
LambdaQueryWrapper
<
DbmyOrder
>().
eq
(
DbmyOrder:
:
getOrderId
,
totalOrderVo
.
getId
())).
getStatus
()
);
}
else
if
(
totalOrderVo
.
getBusinessId
()
==
6
){
//
诊前挂号
}
else
if
(
totalOrderVo
.
getBusinessId
()
==
6
)
{
//
诊前挂号
totalOrderVo
.
setServiceStatus
(
zqghOrderMapper
.
selectOne
(
new
LambdaQueryWrapper
<
ZqghOrder
>().
eq
(
ZqghOrder:
:
getOrderId
,
totalOrderVo
.
getId
())).
getStatus
()
);
}
else
if
(
totalOrderVo
.
getBusinessId
()
==
0
){
//
商城订单
}
else
if
(
totalOrderVo
.
getBusinessId
()
==
0
)
{
//
商城订单
StoreOrder
storeOrder
=
storeOrderMapper
.
selectOne
(
new
LambdaQueryWrapper
<
StoreOrder
>().
eq
(
StoreOrder:
:
getOrderId
,
totalOrderVo
.
getId
()));
totalOrderVo
.
setServiceStatus
(
...
...
@@ -278,7 +278,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
baseMapper
.
insert
(
totalOrder
);
bo
.
setOrderId
(
totalOrder
.
getId
().
intValue
());
totalOrderVo
.
setOrderSn
(
totalOrder
.
getId
()
+
""
);
totalOrderVo
.
setOrderSn
(
totalOrder
.
getId
()
+
""
);
totalOrderVo
.
setPayMoney
(
bo
.
getPayMoney
());
if
(
bo
.
getBusinessId
()
==
1
)
{
// 预约陪诊
...
...
@@ -341,11 +341,11 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
@Override
public
Boolean
cancelOrder
(
TotalOrderBo
bo
)
{
TotalOrder
totalOrder
=
baseMapper
.
selectById
(
bo
.
getId
());
if
(
null
!=
totalOrder
.
getEmId
()
&&
totalOrder
.
getEmId
()
!=
0
){
//
预约陪诊
//yypzOrderMapper.selectOne(new LambdaQueryWrapper<YypzOrder>().eq(YypzOrder::getOrderId,totalOrder));
if
(
null
!=
totalOrder
.
getEmId
()
&&
totalOrder
.
getEmId
()
!=
0
)
{
//
预约陪诊
//
yypzOrderMapper.selectOne(new LambdaQueryWrapper<YypzOrder>().eq(YypzOrder::getOrderId,totalOrder));
totalOrder
.
setStatus
(
TotalOrderStatus
.
CANCEL
.
getCode
());
return
baseMapper
.
updateById
(
totalOrder
)
>
0
;
}
else
{
}
else
{
throw
new
ServiceException
(
"该订单已分配给陪诊员,不允许取消订单!"
);
}
}
...
...
@@ -360,7 +360,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
WxPayUnifiedOrderRequest
orderRequest
=
new
WxPayUnifiedOrderRequest
();
orderRequest
.
setBody
(
bo
.
getOrderTitle
());
orderRequest
.
setOutTradeNo
(
totalOrder
.
getOrderSn
());
orderRequest
.
setTotalFee
(
money
);
//元转成分
orderRequest
.
setTotalFee
(
money
);
//
元转成分
orderRequest
.
setOpenid
(
sysUserMapper
.
selectById
(
loginUser
.
getUserId
()).
getOpenId
());
orderRequest
.
setSpbillCreateIp
(
"127.0.0.1"
);
orderRequest
.
setNotifyUrl
(
"http://127.0.0.1:8089/applet/totalOrder/orderPayCallBack"
);
...
...
@@ -541,15 +541,22 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
}
ISonOrderService
orderService
=
serviceBuilder
.
getSonOrderService
(
totalOrder
.
getBusinessId
());
Objects
.
requireNonNull
(
orderService
,
"订单业务属性出错"
);
// 修改子订单状态为已接单
boolean
sonOrderFlag
=
orderService
.
switchSonOrderStatus
(
totalOrder
.
getId
(),
1
);
// 已接单状态
int
target
=
1
;
// 代办挂号需额外处理
if
(
totalOrder
.
getBusinessId
()
==
2
&&
totalOrder
.
getStatus
()
==
1
)
{
// 若接单(待办挂号)时,订单已支付,则子订单状态应该修改为6(进行中)
target
=
6
;
}
// 修改子订单状态
boolean
sonOrderFlag
=
orderService
.
switchSonOrderStatus
(
totalOrder
.
getId
(),
target
);
if
(!
sonOrderFlag
)
{
throw
new
ServiceException
(
"子订单状态修改出错,接单失败"
);
}
// 绑定主订单陪诊员
totalOrder
.
setEmId
(
emId
);
// 设置主订单中子订单状态为已接单
totalOrder
.
setSuborderStatus
(
1
);
totalOrder
.
setSuborderStatus
(
target
);
boolean
flag
=
baseMapper
.
updateById
(
totalOrder
)
>
0
;
if
(!
flag
)
{
throw
new
ServiceException
(
"接单失败"
);
...
...
pz-system/src/main/java/com/pz/system/service/impl/YypzOrderServiceImpl.java
View file @
dc985e34
...
...
@@ -197,8 +197,8 @@ public class YypzOrderServiceImpl implements IYypzOrderService, ISonOrderService
// 若设置了就诊时间,在取消订单时需要检查是否在18小时之前
// 取消次数
Integer
cancel
=
RedisUtils
.<
Integer
>
getCacheMapValue
(
ISonOrderService
.
ORDER_CANCEL_CACHE_PREFIX
,
String
.
valueOf
(
emId
));
if
(
yypzOrder
.
get
Over
Time
()
!=
null
)
{
LocalDateTime
visitTime
=
LocalDateTime
.
ofInstant
(
yypzOrder
.
get
Over
Time
().
toInstant
(),
ZoneId
.
systemDefault
());
if
(
yypzOrder
.
get
Visit
Time
()
!=
null
)
{
LocalDateTime
visitTime
=
LocalDateTime
.
ofInstant
(
yypzOrder
.
get
Visit
Time
().
toInstant
(),
ZoneId
.
systemDefault
());
LocalDateTime
currentDate
=
LocalDateTime
.
ofInstant
(
new
Date
().
toInstant
(),
ZoneId
.
systemDefault
());
// 若缓存为空,则查询数据表
if
(
cancel
==
null
)
{
...
...
@@ -235,4 +235,43 @@ public class YypzOrderServiceImpl implements IYypzOrderService, ISonOrderService
}
return
true
;
}
/**
* 陪诊员预约陪诊开始服务
*
* @param totalId 主订单ID
* @return 操作结果
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
accompanyStartService
(
Integer
totalId
)
{
TotalOrder
totalOrder
=
totalOrderMapper
.
selectById
(
totalId
);
Objects
.
requireNonNull
(
totalOrder
,
"主订单不存在"
);
if
(
totalOrder
.
getStatus
()
!=
1
||
totalOrder
.
getEmId
()
==
0
)
{
// 用户已付款
throw
new
ServiceException
(
"主订单不符合开始服务要求"
);
}
YypzOrder
suborder
=
baseMapper
.
selectOne
(
Wrappers
.<
YypzOrder
>
lambdaQuery
().
eq
(
YypzOrder:
:
getOrderId
,
totalId
));
Objects
.
requireNonNull
(
suborder
,
"子订单不存在"
);
if
(
suborder
.
getStatus
()
!=
1
)
{
// 订单已接单
throw
new
ServiceException
(
"子订单不符合开始服务要求"
);
}
// 操作时间若未到达开始时间,则拒绝该操作
if
(
suborder
.
getVisitTime
()
!=
null
)
{
LocalDateTime
visitTime
=
LocalDateTime
.
ofInstant
(
suborder
.
getVisitTime
().
toInstant
(),
ZoneId
.
systemDefault
());
LocalDateTime
currentDate
=
LocalDateTime
.
ofInstant
(
new
Date
().
toInstant
(),
ZoneId
.
systemDefault
());
if
(
currentDate
.
isBefore
(
visitTime
))
{
throw
new
ServiceException
(
"请在到达陪诊时间后再点击开始服务"
);
}
}
// 修改子订单状态为开始服务
suborder
.
setStatus
(
6
);
totalOrder
.
setSuborderStatus
(
6
);
if
(
baseMapper
.
updateById
(
suborder
)
<
0
)
{
throw
new
ServiceException
(
"操作失败,子订单异常"
);
}
if
(
totalOrderMapper
.
updateById
(
totalOrder
)
<
0
)
{
throw
new
ServiceException
(
"操作失败,主订单异常"
);
}
return
true
;
}
}
pz-system/src/main/java/com/pz/system/service/impl/ZyphOrderServiceImpl.java
View file @
dc985e34
...
...
@@ -239,4 +239,50 @@ public class ZyphOrderServiceImpl implements IZyphOrderService, ISonOrderService
}
return
true
;
}
/**
* 陪诊员开始服务住院陪护订单
*
* @param totalId 主订单ID
* @return 操作结果
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
accompanyStartService
(
Integer
totalId
)
{
TotalOrder
totalOrder
=
totalOrderMapper
.
selectById
(
totalId
);
Objects
.
requireNonNull
(
totalOrder
,
"主订单不存在"
);
if
(
totalOrder
.
getStatus
()
!=
1
||
totalOrder
.
getEmId
()
==
0
)
{
// 用户已付款
throw
new
ServiceException
(
"主订单不符合开始服务要求"
);
}
ZyphOrder
suborder
=
baseMapper
.
selectOne
(
Wrappers
.<
ZyphOrder
>
lambdaQuery
().
eq
(
ZyphOrder:
:
getOrderId
,
totalId
));
Objects
.
requireNonNull
(
suborder
,
"子订单不存在"
);
if
(
suborder
.
getStatus
()
!=
1
)
{
// 订单已接单
throw
new
ServiceException
(
"子订单不符合开始服务要求"
);
}
String
dateTimeStr
=
suborder
.
getStartDay
()
+
" "
+
suborder
.
getEndTime
();
Date
paseDateTime
=
null
;
try
{
paseDateTime
=
DATETIME_FORMAT
.
parse
(
dateTimeStr
);
}
catch
(
ParseException
e
)
{
log
.
error
(
"时间解析失败"
);
}
// 操作时间若未到达开始时间,则拒绝该操作
if
(
paseDateTime
!=
null
)
{
LocalDateTime
visitTime
=
LocalDateTime
.
ofInstant
(
paseDateTime
.
toInstant
(),
ZoneId
.
systemDefault
());
LocalDateTime
currentDate
=
LocalDateTime
.
ofInstant
(
new
Date
().
toInstant
(),
ZoneId
.
systemDefault
());
if
(
currentDate
.
isBefore
(
visitTime
))
{
throw
new
ServiceException
(
"请在到达陪诊时间后再点击开始服务"
);
}
}
// 修改子订单状态为开始服务
suborder
.
setStatus
(
6
);
totalOrder
.
setSuborderStatus
(
6
);
if
(
baseMapper
.
updateById
(
suborder
)
<
0
)
{
throw
new
ServiceException
(
"操作失败,子订单异常"
);
}
if
(
totalOrderMapper
.
updateById
(
totalOrder
)
<
0
)
{
throw
new
ServiceException
(
"操作失败,主订单异常"
);
}
return
true
;
}
}
pz-system/src/main/resources/mapper/system/ZyphOrderMapper.xml
View file @
dc985e34
...
...
@@ -86,7 +86,9 @@
zyph_order.remark,
concat(zyph_order.start_day, ' ~ ', zyph_order.end_day) as visitDate,
concat(zyph_order.start_time, ' ~ ', zyph_order.end_time) as visitTime,
zyph_order.voucher
zyph_order.voucher,
total_order.evaluation_content,
total_order.is_satisfaction as evaluation_flag
from total_order
left join zyph_order on zyph_order.order_id = total_order.id
left join services on total_order.service_id = services.id
...
...
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