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
c059f034
Commit
c059f034
authored
Dec 27, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台寄售单详情查询时检测是否超时
parent
1b6be4a2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
5 deletions
+49
-5
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/ConsignSaleServiceImpl.java
...n/java/com/wwdz/ch/admin/impl/ConsignSaleServiceImpl.java
+49
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ConsignSaleServiceImpl.java
...main/java/com/wwdz/ch/wx/impl/ConsignSaleServiceImpl.java
+0
-4
No files found.
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/ConsignSaleServiceImpl.java
View file @
c059f034
...
...
@@ -163,11 +163,16 @@ public class ConsignSaleServiceImpl implements ConsignSaleService {
@Override
public
Result
findDetail
(
ConsignSaleRequestDto
dto
)
{
try
{
ConsignSaleDetailVo
consignSaleDetailVo
=
new
ConsignSaleDetailVo
();
ConsignSale
consignSale
=
consignSaleDao
.
findById
(
dto
.
getSaleId
());
if
(
ObjectUtils
.
isEmpty
(
consignSale
))
{
return
Result
.
failed
(
"寄售单不存在"
);
}
//检查该寄售单是否确认超时,超时则取消寄售
checkTimeOut
(
dto
.
getSaleId
());
long
itemId
=
consignSale
.
getItemId
();
CoinRequestDto
coinRequestDto
=
new
CoinRequestDto
();
coinRequestDto
.
setId
(
itemId
);
...
...
@@ -186,9 +191,9 @@ public class ConsignSaleServiceImpl implements ConsignSaleService {
consignSaleDetailVo
.
setSystemStateName
(
ConsignSaleEnum
.
SaleForSysStateEnum
.
getNameByCode
(
consignSale
.
getSystemState
()));
consignSaleDetailVo
.
setItemVo
(
itemResult
.
getData
());
//查询寄售单信息
List
<
ConsignSaleRecord
>
consignSaleRecords
=
consignSaleRecordDao
.
find
(
dto
.
getSaleId
());
//判断是否已经有了报价
if
(
consignSale
.
getSystemState
()
==
ConsignSaleEnum
.
SaleForSysStateEnum
.
WAIT_IMG_VALUATE
.
getCode
())
{
long
count
=
consignSaleRecords
.
stream
().
filter
(
consignSaleRecord
->
consignSaleRecord
.
getType
()
==
ConsignSaleEnum
.
OperateTypeEnum
.
VALUATE
.
getCode
()).
count
();
...
...
@@ -505,6 +510,49 @@ public class ConsignSaleServiceImpl implements ConsignSaleService {
}
}
/**
* 检查处于图文鉴定和实物鉴定状态的订单,用户是否超出24小时确认的时间范围'
* @param saleId
*/
private
void
checkTimeOut
(
String
saleId
){
//查询订单
ConsignSale
consignSale
=
consignSaleDao
.
findById
(
saleId
);
if
(
consignSale
.
getSystemState
()
==
ConsignSaleEnum
.
SaleForSysStateEnum
.
WAIT_IMG_VALUATE
.
getCode
())
{
ConsignSaleRecord
consignSaleRecord
=
consignSaleRecordDao
.
findByType
(
saleId
,
ConsignSaleEnum
.
OperateTypeEnum
.
WAIT_USER_CONFIRM_VALUATE
.
getCode
());
if
(
consignSaleRecord
!=
null
&&
consignSaleRecord
.
getCreateTime
()
!=
null
)
{
Date
startTime
=
consignSaleRecord
.
getCreateTime
();
Date
endTime
=
new
Date
();
long
diffInMillies
=
Math
.
abs
(
endTime
.
getTime
()
-
startTime
.
getTime
());
long
diffInHours
=
diffInMillies
/
(
60
*
60
*
1000
);
if
(
diffInHours
>=
24
)
{
//超时未确认取消寄售
ConsignSaleRequestDto
consignSaleRequestDto
=
new
ConsignSaleRequestDto
();
consignSaleRequestDto
.
setSaleId
(
saleId
);
timeOutForCancel
(
consignSaleRequestDto
);
logger
.
info
(
">>>>>> 检测到寄售单号:{} 图文估价超时未确认,更改寄售单状态为已取消,并记录操作节点 <<<<<<<"
,
saleId
);
}
}
}
else
if
(
consignSale
.
getSystemState
()
==
ConsignSaleEnum
.
SaleForSysStateEnum
.
IDENTIFY
.
getCode
())
{
//查询实物鉴定待用户确认的订单
ConsignSaleRecord
consignSaleRecord
=
consignSaleRecordDao
.
findByType
(
saleId
,
ConsignSaleEnum
.
OperateTypeEnum
.
WAIT_USER_CONFIRM_IDENTIFY
.
getCode
());
if
(
consignSaleRecord
!=
null
&&
consignSaleRecord
.
getCreateTime
()
!=
null
)
{
Date
startTime
=
consignSaleRecord
.
getCreateTime
();
Date
endTime
=
new
Date
();
long
diffInMillies
=
Math
.
abs
(
endTime
.
getTime
()
-
startTime
.
getTime
());
long
diffInHours
=
diffInMillies
/
(
60
*
60
*
1000
);
if
(
diffInHours
>=
24
)
{
//超时未确认取消
ConsignSaleRequestDto
consignSaleRequestDto
=
new
ConsignSaleRequestDto
();
consignSaleRequestDto
.
setSaleId
(
consignSale
.
getSaleId
());
timeOutForCancel
(
consignSaleRequestDto
);
logger
.
info
(
">>>>>> 检测到寄售单号:{} 实物鉴定超时未确认,更改寄售单状态为已取消,并记录操作节点 <<<<<<<"
,
saleId
);
}
}
}
}
@Transactional
public
Result
timeOutForCancel
(
ConsignSaleRequestDto
dto
)
{
try
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ConsignSaleServiceImpl.java
View file @
c059f034
...
...
@@ -75,7 +75,6 @@ public class ConsignSaleServiceImpl implements ConsignSaleService {
if
(
StringUtils
.
isEmpty
(
user
.
getMobile
()))
{
return
Result
.
failed
(
"请先绑定手机号"
);
}
ConsignSale
consignSale
=
new
ConsignSale
();
EntityMapper
.
copyAttribute
(
dto
,
consignSale
);
Date
now
=
new
Date
();
...
...
@@ -151,7 +150,6 @@ public class ConsignSaleServiceImpl implements ConsignSaleService {
logger
.
info
(
">>>>>> 查询寄售单列表,检测到寄售单号:{} 图文估价超时未确认,更改寄售单状态为已取消,并记录操作节点 <<<<<<<"
,
consignSale
.
getSaleId
());
}
}
//查询实物鉴定后待用户确认的订单
ConsignSaleRequestDto
identifyConfirmOrderDto
=
new
ConsignSaleRequestDto
();
identifyConfirmOrderDto
.
setUserId
(
dto
.
getUserId
());
...
...
@@ -170,8 +168,6 @@ public class ConsignSaleServiceImpl implements ConsignSaleService {
logger
.
info
(
">>>>>> 查询寄售单列表,检测到寄售单号:{} 实物鉴定超时未确认,更改寄售单状态为已取消,并记录操作节点 <<<<<<<"
,
consignSale
.
getSaleId
());
}
}
if
(
StringUtils
.
hasLength
(
dto
.
getSearchParam
()))
{
//判断查询条件是否为中文,是的话就根据商品名称模糊查询
if
(
RegexUtil
.
isContainChinese
(
dto
.
getSearchParam
()))
{
...
...
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