Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
d4f79d98
Commit
d4f79d98
authored
Sep 29, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
直接换商品限制每人一单
parent
e5d84c26
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
5 deletions
+33
-5
ch-core/src/main/java/com/wwdz/ch/core/consts/DistributionEnum.java
...c/main/java/com/wwdz/ch/core/consts/DistributionEnum.java
+0
-1
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/DistributionOrderDao.java
...com/wwdz/ch/db/dao/distribution/DistributionOrderDao.java
+7
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/DistributionOrderDaoImpl.java
...wdz/ch/db/impl/distribution/DistributionOrderDaoImpl.java
+11
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/ExchangeApplyOrderServiceImpl.java
...h/wx/impl/distribution/ExchangeApplyOrderServiceImpl.java
+3
-3
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/ExchangeOrderServiceImpl.java
...wdz/ch/wx/impl/distribution/ExchangeOrderServiceImpl.java
+1
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/ExchangeServiceImpl.java
...com/wwdz/ch/wx/impl/distribution/ExchangeServiceImpl.java
+11
-0
No files found.
ch-core/src/main/java/com/wwdz/ch/core/consts/DistributionEnum.java
View file @
d4f79d98
...
...
@@ -17,7 +17,6 @@ public class DistributionEnum {
SIGNED
(
90
,
"已签收"
),
FINISH
(
100
,
"已完成"
),
CANCEL
(
101
,
"已取消"
),
;
private
int
code
;
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dao/distribution/DistributionOrderDao.java
View file @
d4f79d98
...
...
@@ -173,6 +173,13 @@ public interface DistributionOrderDao {
*/
List
<
DistributionOrderNum
>
countGroupByStateForExchange
(
long
userId
);
/**
* 统计和平台交换的订单数量
* @param userId
* @return
*/
long
countExchangeOrderNum
(
long
userId
,
long
sellerId
);
boolean
isBuyItem
(
long
buyerId
,
long
itemId
);
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/distribution/DistributionOrderDaoImpl.java
View file @
d4f79d98
...
...
@@ -236,6 +236,17 @@ public class DistributionOrderDaoImpl implements DistributionOrderDao {
return
distributionOrderMapper
.
countGroupByStateForExchange
(
userId
);
}
@Override
public
long
countExchangeOrderNum
(
long
userId
,
long
sellerId
)
{
DistributionOrderExample
example
=
new
DistributionOrderExample
();
DistributionOrderExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andBuyerIdEqualTo
(
userId
);
criteria
.
andSellerIdEqualTo
(
sellerId
);
criteria
.
andTypeEqualTo
(
7
);
criteria
.
andStateIn
(
Arrays
.
asList
(
6
,
8
,
10
,
20
,
30
,
90
,
100
));
return
distributionOrderMapper
.
countByExample
(
example
);
}
@Override
public
boolean
isBuyItem
(
long
buyerId
,
long
itemId
)
{
DistributionOrderExample
example
=
new
DistributionOrderExample
();
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/ExchangeApplyOrderServiceImpl.java
View file @
d4f79d98
...
...
@@ -459,7 +459,7 @@ public class ExchangeApplyOrderServiceImpl implements ExchangeApplyOrderService
long
diffInMillies
=
Math
.
abs
(
new
Date
().
getTime
()
-
exchangeApplyOrder
.
getCreateTime
().
getTime
());
//超出48小时未处理审批单,订单取消
long
diffInHours
=
diffInMillies
/
(
60
*
1000
*
60
);
if
(
diffInHours
>=
48
)
{
if
(
diffInHours
>=
192
)
{
//取消申请单,把订单明细设置为无效
exchangeApplyOrderDao
.
updateState
(
orderId
,
ExchangeApplyOrderEnum
.
StateEnum
.
DISAGREE
.
getCode
());
exchangeApplyOrderDetailDao
.
updateInValid
(
orderId
);
...
...
@@ -476,7 +476,7 @@ public class ExchangeApplyOrderServiceImpl implements ExchangeApplyOrderService
long
diffInMillies
=
Math
.
abs
(
new
Date
().
getTime
()
-
exchangeApplyOrder
.
getCreateTime
().
getTime
());
//超出48小时未处理审批单,订单取消
long
diffInHours
=
diffInMillies
/
(
60
*
1000
*
60
);
if
(
diffInHours
>=
48
)
{
if
(
diffInHours
>=
192
)
{
//取消申请单,把订单明细设置为无效
exchangeApplyOrderDao
.
updateState
(
orderId
,
ExchangeApplyOrderEnum
.
StateEnum
.
DISAGREE
.
getCode
());
exchangeApplyOrderDetailDao
.
updateInValid
(
orderId
);
...
...
@@ -495,7 +495,7 @@ public class ExchangeApplyOrderServiceImpl implements ExchangeApplyOrderService
long
diffInMillies
=
Math
.
abs
(
new
Date
().
getTime
()
-
exchangeApplyOrder
.
getCreateTime
().
getTime
());
//超出48小时未处理审批单,订单取消
long
diffInHours
=
diffInMillies
/
(
60
*
1000
*
60
);
if
(
diffInHours
>=
48
)
{
if
(
diffInHours
>=
192
)
{
//取消申请单,把订单明细设置为无效
exchangeApplyOrderDao
.
updateState
(
exchangeApplyOrderId
,
ExchangeApplyOrderEnum
.
StateEnum
.
DISAGREE
.
getCode
());
exchangeApplyOrderDetailDao
.
updateInValid
(
exchangeApplyOrderId
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/ExchangeOrderServiceImpl.java
View file @
d4f79d98
...
...
@@ -276,7 +276,7 @@ public class ExchangeOrderServiceImpl implements ExchangeOrderService {
long
diffInMillies
=
Math
.
abs
(
new
Date
().
getTime
()
-
distributionOrder
.
getCreateTime
().
getTime
());
//超出48小时未寄出,订单取消
long
diffInHours
=
diffInMillies
/
(
60
*
1000
*
60
);
if
(
diffInHours
>=
48
)
{
if
(
diffInHours
>=
192
)
{
//换藏的品取消订单后恢复库存
ExchangeApplyOrder
exchangeApplyOrder
=
exchangeApplyOrderDao
.
findByExchangeOrderId
(
orderId
);
if
(
exchangeApplyOrder
!=
null
)
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/distribution/ExchangeServiceImpl.java
View file @
d4f79d98
...
...
@@ -37,6 +37,8 @@ public class ExchangeServiceImpl implements ExchangeService {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DistributorProfitServiceImpl
.
class
);
private
static
final
List
<
Long
>
BLACK_USER_LIST
=
Arrays
.
asList
(
40151043L
,
39965054L
);
@Autowired
DistributionOrderDao
distributionOrderDao
;
...
...
@@ -238,6 +240,15 @@ public class ExchangeServiceImpl implements ExchangeService {
try
{
Long
exchangeItemId
=
null
;
long
exchangeItemPrice
=
0
;
if
(
BLACK_USER_LIST
.
contains
(
dto
.
getUserId
()))
{
return
Result
.
failed
(
"可直接换的商品每人限换一单"
);
}
//判断是否有和平台交换的订单
long
orderNum
=
distributionOrderDao
.
countExchangeOrderNum
(
dto
.
getUserId
(),
CommConsts
.
SELF_SUPPORT_ACCOUNT
);
if
(
orderNum
>
0
)
{
return
Result
.
failed
(
"可直接换的商品每人限换一单"
);
}
if
(
dto
.
getIsMultiple
())
{
//多商品场景在受理方订单中出现,别人用多件商品换受理方的一件商品,对于受理方而言等于是一个订单买了多件商品,
// 由于在创建申请方订单时已经扣除过库存,所以这里无需扣减库存,也不校验库存
...
...
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