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
64d6368e
Commit
64d6368e
authored
Sep 14, 2023
by
Wangmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善 取消订单业务
parent
d1a52aea
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
102 additions
and
23 deletions
+102
-23
pz-admin/src/main/resources/application.yml
+1
-1
pz-system/src/main/java/com/pz/merchant/service/ISonOrderService.java
+1
-2
pz-system/src/main/java/com/pz/system/service/impl/DbghOrderServiceImpl.java
+7
-4
pz-system/src/main/java/com/pz/system/service/impl/DbmyOrderServiceImpl.java
+67
-4
pz-system/src/main/java/com/pz/system/service/impl/DbwzOrderServiceImpl.java
+7
-4
pz-system/src/main/java/com/pz/system/service/impl/YypzOrderServiceImpl.java
+7
-4
pz-system/src/main/java/com/pz/system/service/impl/ZqghOrderServiceImpl.java
+5
-0
pz-system/src/main/java/com/pz/system/service/impl/ZyphOrderServiceImpl.java
+7
-4
No files found.
pz-admin/src/main/resources/application.yml
View file @
64d6368e
...
...
@@ -27,7 +27,7 @@ captcha:
# 开发环境配置
server
:
# 服务器的HTTP端口,默认为8080
port
:
9524
port
:
8089
servlet
:
# 应用的访问路径
context-path
:
/
...
...
pz-system/src/main/java/com/pz/merchant/service/ISonOrderService.java
View file @
64d6368e
...
...
@@ -49,7 +49,6 @@ public interface ISonOrderService {
* @param totalId 取消订单
* @return 操作结果
*/
default
boolean
accompanyCancellationOfOrder
(
Integer
totalId
){
return
true
;}
boolean
accompanyCancellationOfOrder
(
Integer
totalId
);
}
pz-system/src/main/java/com/pz/system/service/impl/DbghOrderServiceImpl.java
View file @
64d6368e
...
...
@@ -194,11 +194,12 @@ public class DbghOrderServiceImpl implements IDbghOrderService, ISonOrderService
if
(
dbghOrder
.
getVisitTime
()
!=
null
)
{
LocalDateTime
visitTime
=
LocalDateTime
.
ofInstant
(
dbghOrder
.
getVisitTime
().
toInstant
(),
ZoneId
.
systemDefault
());
LocalDateTime
currentDate
=
LocalDateTime
.
ofInstant
(
new
Date
().
toInstant
(),
ZoneId
.
systemDefault
());
// 取消次数
Integer
cancelCount
=
RedisUtils
.<
Integer
>
getCacheMapValue
(
ISonOrderService
.
ORDER_CANCEL_CACHE_PREFIX
,
String
.
valueOf
(
emId
));
// 若在18小时前取消订单,需记录取消次数
cancel
=
cancelCount
==
null
?
1
:
cancelCount
+
1
;
if
(
visitTime
.
isBefore
(
currentDate
)
||
ChronoUnit
.
HOURS
.
between
(
visitTime
,
currentDate
)
<=
18
)
{
// 取消次数
Integer
cancelCount
=
RedisUtils
.<
Integer
>
getCacheMapValue
(
ISonOrderService
.
ORDER_CANCEL_CACHE_PREFIX
,
String
.
valueOf
(
emId
));
cancel
=
cancelCount
==
null
?
1
:
cancelCount
+
1
;
cancel
++;
}
}
// 更新主订单数据
...
...
@@ -215,7 +216,9 @@ public class DbghOrderServiceImpl implements IDbghOrderService, ISonOrderService
// 若取消次数大于3,则冻结用户账号
if
(
cancel
>
3
)
{
if
(
employeesMapper
.
update
(
null
,
Wrappers
.<
Employees
>
lambdaUpdate
().
set
(
Employees:
:
getStatus
,
2
)
Wrappers
.<
Employees
>
lambdaUpdate
()
.
set
(
Employees:
:
getStatus
,
2
)
.
set
(
Employees:
:
getKillOrder
,
cancel
)
.
eq
(
Employees:
:
getId
,
emId
))
<
0
)
{
throw
new
ServiceException
(
"用户冻结失败"
);
}
...
...
pz-system/src/main/java/com/pz/system/service/impl/DbmyOrderServiceImpl.java
View file @
64d6368e
...
...
@@ -8,10 +8,17 @@ import com.pz.common.core.domain.PageQuery;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.pz.common.exception.ServiceException
;
import
com.pz.common.utils.redis.RedisUtils
;
import
com.pz.merchant.domain.Employees
;
import
com.pz.merchant.domain.vo.SonOrderVo
;
import
com.pz.merchant.mapper.EmployeesMapper
;
import
com.pz.merchant.service.ISonOrderService
;
import
com.pz.system.domain.DbwzOrder
;
import
com.pz.system.domain.TotalOrder
;
import
com.pz.system.domain.YypzOrder
;
import
com.pz.system.domain.bo.AccompanyAddressBo
;
import
com.pz.system.mapper.TotalOrderMapper
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
com.pz.system.domain.bo.DbmyOrderBo
;
...
...
@@ -21,10 +28,10 @@ import com.pz.system.mapper.DbmyOrderMapper;
import
com.pz.system.service.IDbmyOrderService
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.
util.List
;
import
java.
util.Map
;
import
java.
util.Collection
;
import
java.util.
Objects
;
import
java.
time.LocalDateTime
;
import
java.
time.ZoneId
;
import
java.
time.temporal.ChronoUnit
;
import
java.util.
*
;
/**
* 代办买药订单Service业务层处理
...
...
@@ -37,6 +44,8 @@ import java.util.Objects;
public
class
DbmyOrderServiceImpl
implements
IDbmyOrderService
,
ISonOrderService
{
private
final
DbmyOrderMapper
baseMapper
;
private
final
TotalOrderMapper
totalOrderMapper
;
private
final
EmployeesMapper
employeesMapper
;
/**
* 查询代办买药订单
...
...
@@ -180,4 +189,58 @@ public class DbmyOrderServiceImpl implements IDbmyOrderService, ISonOrderService
public
Object
getSonOrderDetailDataByTotalId
(
Integer
totalId
)
{
return
baseMapper
.
selectDbmyOrderDetailDataByTotalId
(
totalId
);
}
/**
* 陪诊员取消代办买药订单
*
* @param totalId 取消订单
* @return 操作结果
*/
@Override
public
boolean
accompanyCancellationOfOrder
(
Integer
totalId
)
{
TotalOrder
totalOrder
=
totalOrderMapper
.
selectById
(
totalId
);
Objects
.
requireNonNull
(
totalOrder
,
"主订单不存在"
);
Integer
emId
=
totalOrder
.
getEmId
();
if
(
emId
==
0
)
{
throw
new
ServiceException
(
"订单暂未分配陪诊员,拒绝该操作"
);
}
DbmyOrder
dbmyOrder
=
baseMapper
.
selectOne
(
Wrappers
.<
DbmyOrder
>
lambdaQuery
().
eq
(
DbmyOrder:
:
getOrderId
,
totalId
));
Objects
.
requireNonNull
(
dbmyOrder
,
"子订单与主订单不一致!"
);
// 若设置了就诊时间,在取消订单时需要检查是否在18小时之前
int
cancel
=
0
;
if
(
dbmyOrder
.
getOverTime
()
!=
null
)
{
LocalDateTime
visitTime
=
LocalDateTime
.
ofInstant
(
dbmyOrder
.
getOverTime
().
toInstant
(),
ZoneId
.
systemDefault
());
LocalDateTime
currentDate
=
LocalDateTime
.
ofInstant
(
new
Date
().
toInstant
(),
ZoneId
.
systemDefault
());
// 取消次数
Integer
cancelCount
=
RedisUtils
.<
Integer
>
getCacheMapValue
(
ISonOrderService
.
ORDER_CANCEL_CACHE_PREFIX
,
String
.
valueOf
(
emId
));
// 若在18小时前取消订单,需记录取消次数
cancel
=
cancelCount
==
null
?
1
:
cancelCount
+
1
;
if
(
visitTime
.
isBefore
(
currentDate
)
||
ChronoUnit
.
HOURS
.
between
(
visitTime
,
currentDate
)
<=
18
)
{
cancel
++;
}
}
// 更新主订单数据
totalOrder
.
setEmId
(
0
);
totalOrder
.
setSuborderStatus
(
0
);
if
(
totalOrderMapper
.
updateById
(
totalOrder
)
<
0
)
{
throw
new
ServiceException
(
"更新主订单失败"
);
}
// 更新子订单
dbmyOrder
.
setStatus
(
0
);
if
(
baseMapper
.
updateById
(
dbmyOrder
)
<
0
)
{
throw
new
ServiceException
(
"子订单更新失败"
);
}
// 若取消次数大于3,则冻结用户账号
if
(
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
(
"用户冻结失败"
);
}
}
RedisUtils
.
setCacheMapValue
(
ISonOrderService
.
ORDER_CANCEL_CACHE_PREFIX
,
String
.
valueOf
(
emId
),
cancel
);
return
true
;
}
}
pz-system/src/main/java/com/pz/system/service/impl/DbwzOrderServiceImpl.java
View file @
64d6368e
...
...
@@ -196,11 +196,12 @@ public class DbwzOrderServiceImpl implements IDbwzOrderService, ISonOrderService
if
(
dbwzOrder
.
getVisitTime
()
!=
null
)
{
LocalDateTime
visitTime
=
LocalDateTime
.
ofInstant
(
dbwzOrder
.
getVisitTime
().
toInstant
(),
ZoneId
.
systemDefault
());
LocalDateTime
currentDate
=
LocalDateTime
.
ofInstant
(
new
Date
().
toInstant
(),
ZoneId
.
systemDefault
());
// 取消次数
Integer
cancelCount
=
RedisUtils
.<
Integer
>
getCacheMapValue
(
ISonOrderService
.
ORDER_CANCEL_CACHE_PREFIX
,
String
.
valueOf
(
emId
));
// 若在18小时前取消订单,需记录取消次数
cancel
=
cancelCount
==
null
?
1
:
cancelCount
+
1
;
if
(
visitTime
.
isBefore
(
currentDate
)
||
ChronoUnit
.
HOURS
.
between
(
visitTime
,
currentDate
)
<=
18
)
{
// 取消次数
Integer
cancelCount
=
RedisUtils
.<
Integer
>
getCacheMapValue
(
ISonOrderService
.
ORDER_CANCEL_CACHE_PREFIX
,
String
.
valueOf
(
emId
));
cancel
=
cancelCount
==
null
?
1
:
cancelCount
+
1
;
cancel
++;
}
}
// 更新主订单数据
...
...
@@ -217,7 +218,9 @@ public class DbwzOrderServiceImpl implements IDbwzOrderService, ISonOrderService
// 若取消次数大于3,则冻结用户账号
if
(
cancel
>
3
)
{
if
(
employeesMapper
.
update
(
null
,
Wrappers
.<
Employees
>
lambdaUpdate
().
set
(
Employees:
:
getStatus
,
2
)
Wrappers
.<
Employees
>
lambdaUpdate
()
.
set
(
Employees:
:
getStatus
,
2
)
.
set
(
Employees:
:
getKillOrder
,
cancel
)
.
eq
(
Employees:
:
getId
,
emId
))
<
0
)
{
throw
new
ServiceException
(
"用户冻结失败"
);
}
...
...
pz-system/src/main/java/com/pz/system/service/impl/YypzOrderServiceImpl.java
View file @
64d6368e
...
...
@@ -199,11 +199,12 @@ public class YypzOrderServiceImpl implements IYypzOrderService, ISonOrderService
if
(
yypzOrder
.
getVisitTime
()
!=
null
)
{
LocalDateTime
visitTime
=
LocalDateTime
.
ofInstant
(
yypzOrder
.
getVisitTime
().
toInstant
(),
ZoneId
.
systemDefault
());
LocalDateTime
currentDate
=
LocalDateTime
.
ofInstant
(
new
Date
().
toInstant
(),
ZoneId
.
systemDefault
());
// 取消次数
Integer
cancelCount
=
RedisUtils
.<
Integer
>
getCacheMapValue
(
ISonOrderService
.
ORDER_CANCEL_CACHE_PREFIX
,
String
.
valueOf
(
emId
));
// 若在18小时前取消订单,需记录取消次数
cancel
=
cancelCount
==
null
?
1
:
cancelCount
+
1
;
if
(
visitTime
.
isBefore
(
currentDate
)
||
ChronoUnit
.
HOURS
.
between
(
visitTime
,
currentDate
)
<=
18
)
{
// 取消次数
Integer
cancelCount
=
RedisUtils
.<
Integer
>
getCacheMapValue
(
ISonOrderService
.
ORDER_CANCEL_CACHE_PREFIX
,
String
.
valueOf
(
emId
));
cancel
=
cancelCount
==
null
?
1
:
cancelCount
+
1
;
cancel
++;
}
}
// 更新主订单数据
...
...
@@ -220,7 +221,9 @@ public class YypzOrderServiceImpl implements IYypzOrderService, ISonOrderService
// 若取消次数大于3,则冻结用户账号
if
(
cancel
>
3
)
{
if
(
employeesMapper
.
update
(
null
,
Wrappers
.<
Employees
>
lambdaUpdate
().
set
(
Employees:
:
getStatus
,
2
)
Wrappers
.<
Employees
>
lambdaUpdate
()
.
set
(
Employees:
:
getStatus
,
2
)
.
set
(
Employees:
:
getKillOrder
,
cancel
)
.
eq
(
Employees:
:
getId
,
emId
))
<
0
)
{
throw
new
ServiceException
(
"用户冻结失败"
);
}
...
...
pz-system/src/main/java/com/pz/system/service/impl/ZqghOrderServiceImpl.java
View file @
64d6368e
...
...
@@ -153,4 +153,9 @@ public class ZqghOrderServiceImpl implements IZqghOrderService, ISonOrderService
// return baseMapper.selectZqghOrderDetailDateByTotalId(totalId);
return
ISonOrderService
.
super
.
getSonOrderDetailDataByTotalId
(
totalId
);
}
@Override
public
boolean
accompanyCancellationOfOrder
(
Integer
totalId
)
{
throw
new
UnsupportedOperationException
(
"不支持该操作"
);
}
}
pz-system/src/main/java/com/pz/system/service/impl/ZyphOrderServiceImpl.java
View file @
64d6368e
...
...
@@ -203,11 +203,12 @@ public class ZyphOrderServiceImpl implements IZyphOrderService, ISonOrderService
if
(
paseDateTime
!=
null
)
{
LocalDateTime
visitTime
=
LocalDateTime
.
ofInstant
(
paseDateTime
.
toInstant
(),
ZoneId
.
systemDefault
());
LocalDateTime
currentDate
=
LocalDateTime
.
ofInstant
(
new
Date
().
toInstant
(),
ZoneId
.
systemDefault
());
// 取消次数
Integer
cancelCount
=
RedisUtils
.<
Integer
>
getCacheMapValue
(
ISonOrderService
.
ORDER_CANCEL_CACHE_PREFIX
,
String
.
valueOf
(
emId
));
// 若在18小时前取消订单,需记录取消次数
cancel
=
cancelCount
==
null
?
1
:
cancelCount
+
1
;
if
(
visitTime
.
isBefore
(
currentDate
)
||
ChronoUnit
.
HOURS
.
between
(
visitTime
,
currentDate
)
<=
18
)
{
// 取消次数
Integer
cancelCount
=
RedisUtils
.<
Integer
>
getCacheMapValue
(
ISonOrderService
.
ORDER_CANCEL_CACHE_PREFIX
,
String
.
valueOf
(
emId
));
cancel
=
cancelCount
==
null
?
1
:
cancelCount
+
1
;
cancel
++;
}
}
// 更新主订单数据
...
...
@@ -224,7 +225,9 @@ public class ZyphOrderServiceImpl implements IZyphOrderService, ISonOrderService
// 若取消次数大于3,则冻结用户账号
if
(
cancel
>
3
)
{
if
(
employeesMapper
.
update
(
null
,
Wrappers
.<
Employees
>
lambdaUpdate
().
set
(
Employees:
:
getStatus
,
2
)
Wrappers
.<
Employees
>
lambdaUpdate
()
.
set
(
Employees:
:
getStatus
,
2
)
.
set
(
Employees:
:
getKillOrder
,
cancel
)
.
eq
(
Employees:
:
getId
,
emId
))
<
0
)
{
throw
new
ServiceException
(
"用户冻结失败"
);
}
...
...
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