Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
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
order-group-application
order-group
Commits
fa1f6a9f
Commit
fa1f6a9f
authored
Jan 26, 2021
by
zhiheng.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
益禾堂添加排队号
parent
93202d0a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
31 deletions
+66
-31
order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
+66
-31
No files found.
order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
View file @
fa1f6a9f
...
@@ -142,6 +142,8 @@ import com.google.common.collect.Lists;
...
@@ -142,6 +142,8 @@ import com.google.common.collect.Lists;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonObject
;
import
jdk.nashorn.internal.runtime.ECMAException
;
import
lombok.SneakyThrows
;
import
lombok.SneakyThrows
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
...
@@ -919,43 +921,77 @@ public class OrderServiceImpl implements Orderservice {
...
@@ -919,43 +921,77 @@ public class OrderServiceImpl implements Orderservice {
// 查询待取餐订单才需要查询排队人数和订单状态扭转记录
// 查询待取餐订单才需要查询排队人数和订单状态扭转记录
if
(
QueryOrderStatus
.
TAKE_MEAL
.
getCode
().
equals
(
queryOrderDto
.
getQueryOrderStatus
())
)
{
if
(
QueryOrderStatus
.
TAKE_MEAL
.
getCode
().
equals
(
queryOrderDto
.
getQueryOrderStatus
())
)
{
String
returnWords
=
""
;
String
returnWords
=
""
;
Integer
queueIndex
=
0
;
//订单数
Integer
productSum
=
0
;
//件数
Integer
productSum
=
0
;
//件数
Long
pickUpTime
=
0L
;
//预计
Long
pickUpTime
=
0L
;
//预计
Integer
totalSumTime
=
0
;
Integer
totalSumTime
=
0
;
String
progress
=
""
;
//进度
String
progress
=
""
;
//进度
try
{
// 查询订单的排队人数
QueryLineUpOrderReq
queryLineUpOrderReq
=
new
QueryLineUpOrderReq
();
queryLineUpOrderReq
.
setPartnerId
(
orderBean
.
getCompanyId
());
queryLineUpOrderReq
.
setStoreId
(
orderBean
.
getShopId
());
queryLineUpOrderReq
.
setStartTime
(
orderBean
.
getGmtCreate
());
queryLineUpOrderReq
.
setEndTime
(
orderBean
.
getGmtCreate
());
// 取餐排队人数查询代码去除
BaseOrderResponse
response
=
orderCenterSdkService
.
queryHistoryOrder
(
queryLineUpOrderReq
);
List
<
String
>
strings
=
new
ArrayList
<>();
if
(
RESPONSE_SUCCESS_CODE
.
equals
(
response
.
getErrcode
()))
{
if
(
StringUtils
.
isEmpty
(
response
.
getData
()))
{
progress
=
"100"
;
returnWords
=
""
;
}
else
{
List
<
String
>
orderCodeList
=
JSONObject
.
parseObject
(
JSONObject
.
toJSON
(
strings
).
toString
(),
List
.
class
);
//开启制作时间 1 :是 , 2 :否"
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
storeResponseDto
.
getConfiguration
());
StoreResponse
.
Configuration
configuration
=
jsonObject
.
toJavaObject
(
StoreResponse
.
Configuration
.
class
);
Integer
goodsAvgTimeOfMaking
=
0
==
configuration
.
getGoodsAvgTimeOfMaking
()
?
15
:
configuration
.
getGoodsAvgTimeOfMaking
();
returnWords
+=
"前方还有 "
+
orderCodeList
.
size
()
+
" 单"
;
if
(
1
!=
configuration
.
getTurnOnTimeOfMaking
())
{
totalSumTime
=
orderCodeList
.
size
()
*
Integer
.
valueOf
(
configuration
.
getAutoSelfmentionMakerWorkflowFinishTime
())
*
60
;
//秒
}
else
{
returnWords
+=
" / "
+
productSum
+
" 件"
;
productSum
=
orderCodeList
.
stream
().
mapToInt
(
product
->
Integer
.
parseInt
(
product
.
split
(
"-"
)[
1
])).
sum
();
totalSumTime
=
productSum
*
goodsAvgTimeOfMaking
*
60
;
//秒
}
pickUpTime
=
orderBean
.
getGmtAccept
()
+
Long
.
valueOf
(
totalSumTime
)
*
1000
;
Date
date
=
new
Date
(
pickUpTime
);
returnWords
+=
",预计 "
+
date
.
getHours
()
+
":"
+
date
.
getMinutes
()
+
" 可取餐"
;
//制餐时间(当前时间-接单时间)/总时长(制餐时长)x100%
progress
=
String
.
valueOf
((
new
Date
().
getTime
()
-
orderBean
.
getGmtAccept
())
/
pickUpTime
+
1
);
}
}
}
catch
(
Exception
e
){
log
.
error
(
"get returnWords error {}"
,
e
.
getMessage
());
}
orderBean
.
setProgress
(
progress
);
orderBean
.
setReturnWords
(
returnWords
);
//以下代码为老代码,不确定还在不在用,就留着了
// 查询订单的排队人数
// 查询订单的排队人数
QueryLineUpOrderReq
queryLineUpOrderReq
=
new
QueryLineUpOrderReq
();
BaseQueryOrderRequest
var1
=
new
BaseQueryOrderRequest
();
queryLineUpOrderReq
.
setPartnerId
(
orderBean
.
getCompanyId
());
var1
.
setOrderId
(
orderBean
.
getOid
());
queryLineUpOrderReq
.
setStoreId
(
orderBean
.
getShopId
());
var1
.
setTrackingNo
(
LogTreadLocal
.
getTrackingNo
());
queryLineUpOrderReq
.
setStartTime
(
orderBean
.
getGmtCreate
());
queryLineUpOrderReq
.
setEndTime
(
orderBean
.
getGmtCreate
());
// 取餐排队人数查询代码去除
// 取餐排队人数查询代码去除
BaseOrderResponse
response
=
orderCenterSdkService
.
queryHistoryOrder
(
queryLineUpOrderReq
);
/* BaseOrderResponse baseOrderResponse = orderCenterSdkService.queryOrderQueueIndex(var1);
QueryOrderQueueIndexResponse response = new QueryOrderQueueIndexResponse();
response.setErrcode(baseOrderResponse.getErrcode());
response.setErrmsg(baseOrderResponse.getErrmsg());
response.setData(baseOrderResponse.getData() == null ? 0 : Integer.parseInt(baseOrderResponse.getData()));
if (RESPONSE_SUCCESS_CODE.equals(response.getErrcode())) {
if (RESPONSE_SUCCESS_CODE.equals(response.getErrcode())) {
if
(
StringUtils
.
isEmpty
(
response
.
getData
())){
String queueIndex = response.getData() == null ? "" : response.getData().toString();
queueIndex
=
0
;
orderBean.setQueueIndex(queueIndex);
returnWords
+=
""
;
}*/
}
else
{
// 查询订单的操作状态
List
<
String
>
orderCodeList
=
JSONObject
.
parseArray
(
response
.
getData
(),
String
.
class
);
BaseQueryOrderRequest
var2
=
new
BaseQueryOrderRequest
();
//开启制作时间 1 :是 , 2 :否"
var2
.
setOrderId
(
orderBean
.
getOid
());
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
storeResponseDto
.
getConfiguration
());
var2
.
setTrackingNo
(
LogTreadLocal
.
getTrackingNo
());
StoreResponse
.
Configuration
configuration
=
jsonObject
.
toJavaObject
(
StoreResponse
.
Configuration
.
class
);
OrderStatusTrackingInfoResponse
orderStatusTrackingInfoResponse
=
orderCenterSdkService
.
getOrderStatusTrackingInfoByOid
(
var2
);
Integer
goodsAvgTimeOfMaking
=
0
==
configuration
.
getGoodsAvgTimeOfMaking
()?
15
:
configuration
.
getGoodsAvgTimeOfMaking
();
if
(
1
==
configuration
.
getTurnOnTimeOfMaking
())
{
String
string
=
JSONObject
.
toJSONString
(
orderStatusTrackingInfoResponse
);
totalSumTime
=
orderCodeList
.
size
()
*
goodsAvgTimeOfMaking
*
60
;
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
string
);
}
else
{
OrderStatusTrackingInfoDto
orderStatusTrackingInfoByOid
=
jsonObject
.
toJavaObject
(
OrderStatusTrackingInfoDto
.
class
);
productSum
=
orderCodeList
.
stream
().
mapToInt
(
product
->
Integer
.
parseInt
(
product
.
split
(
"-"
)[
1
])).
sum
();
if
(
RESPONSE_SUCCESS_CODE
.
equals
(
orderStatusTrackingInfoByOid
.
getErrcode
()))
{
totalSumTime
=
productSum
*
goodsAvgTimeOfMaking
*
60
;
orderStatusTracking
(
orderBean
,
orderStatusTrackingInfoByOid
);
returnWords
+=
" / "
+
productSum
+
" 件"
;
}
pickUpTime
=
orderBean
.
getGmtAccept
()
+
Long
.
valueOf
(
totalSumTime
);
Date
date
=
new
Date
(
pickUpTime
);
returnWords
+=
",预计 "
+
date
.
getHours
()+
":"
+
date
.
getMinutes
()
+
" 可取餐"
;
progress
=
String
.
valueOf
((
new
Date
().
getTime
()
-
orderBean
.
getGmtAccept
())
/
goodsAvgTimeOfMaking
*
productSum
*
60
*
100
);
orderBean
.
setProgress
(
progress
);
orderBean
.
setReturnWords
(
returnWords
);
}
}
}
}
}
});
});
...
@@ -3865,5 +3901,4 @@ public class OrderServiceImpl implements Orderservice {
...
@@ -3865,5 +3901,4 @@ public class OrderServiceImpl implements Orderservice {
return
Boolean
.
TRUE
;
return
Boolean
.
TRUE
;
}
}
}
}
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