Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hooloo
ms
soss
Commits
d06db564
Commit
d06db564
authored
Mar 15, 2023
by
weijiguang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/v2' into v2
parents
6c33c84c
28bcd52d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
95 deletions
+98
-95
soss-framework/src/main/java/com/soss/framework/web/service/WeixinServiceImpl.java
+90
-91
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
+8
-4
No files found.
soss-framework/src/main/java/com/soss/framework/web/service/WeixinServiceImpl.java
View file @
d06db564
...
@@ -68,7 +68,7 @@ import java.util.concurrent.locks.ReentrantLock;
...
@@ -68,7 +68,7 @@ import java.util.concurrent.locks.ReentrantLock;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
@Service
public
class
WeixinServiceImpl
{
public
class
WeixinServiceImpl
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
WeixinServiceImpl
.
class
);
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
WeixinServiceImpl
.
class
);
@Autowired
@Autowired
...
@@ -168,15 +168,15 @@ public class WeixinServiceImpl {
...
@@ -168,15 +168,15 @@ public class WeixinServiceImpl {
}
}
}
}
public
String
login
(
String
code
)
{
public
String
login
(
String
code
)
{
String
sessionKeyOrOpenId
=
getSessionKeyOrOpenId
(
code
);
String
sessionKeyOrOpenId
=
getSessionKeyOrOpenId
(
code
);
return
sessionKeyOrOpenId
;
return
sessionKeyOrOpenId
;
}
}
private
LoginUser
transLoginUser
(
Customer
customer
){
private
LoginUser
transLoginUser
(
Customer
customer
)
{
SysUser
user
=
new
SysUser
();
SysUser
user
=
new
SysUser
();
user
.
setUserName
(
customer
.
getUserName
());
user
.
setUserName
(
customer
.
getUserName
());
LoginUser
loginUser
=
new
LoginUser
(
user
,
null
);
LoginUser
loginUser
=
new
LoginUser
(
user
,
null
);
loginUser
.
setLoginTime
(
System
.
currentTimeMillis
());
loginUser
.
setLoginTime
(
System
.
currentTimeMillis
());
loginUser
.
setOpenId
(
customer
.
getId
());
loginUser
.
setOpenId
(
customer
.
getId
());
user
.
setPhonenumber
(
customer
.
getPhone
());
user
.
setPhonenumber
(
customer
.
getPhone
());
...
@@ -209,9 +209,9 @@ public class WeixinServiceImpl {
...
@@ -209,9 +209,9 @@ public class WeixinServiceImpl {
order
.
setOut_trade_no
(
"wuyye9w8akwbq1nc60o4affwwqnxh9dn"
);
order
.
setOut_trade_no
(
"wuyye9w8akwbq1nc60o4affwwqnxh9dn"
);
//order.setSign_type("MD5");
//order.setSign_type("MD5");
//生成签名
//生成签名
String
sign
=
Signature
.
getSign
(
order
,
key
);
String
sign
=
Signature
.
getSign
(
order
,
key
);
order
.
setSign
(
sign
);
order
.
setSign
(
sign
);
String
result
=
restTemplate
.
postForObject
(
queryUrl
,
order
,
String
.
class
);
String
result
=
restTemplate
.
postForObject
(
queryUrl
,
order
,
String
.
class
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
XStream
xStream
=
new
XStream
();
XStream
xStream
=
new
XStream
();
xStream
.
alias
(
"xml"
,
QueryReturnInfo
.
class
);
xStream
.
alias
(
"xml"
,
QueryReturnInfo
.
class
);
...
@@ -230,7 +230,7 @@ public class WeixinServiceImpl {
...
@@ -230,7 +230,7 @@ public class WeixinServiceImpl {
@Autowired
@Autowired
private
WxPayService
wxPayService
;
private
WxPayService
wxPayService
;
public
Map
<
String
,
String
>
weChatPay
(
HttpServletRequest
r
,
String
body
,
String
orderNo
,
String
openId
,
int
money
)
{
public
Map
<
String
,
String
>
weChatPay
(
HttpServletRequest
r
,
String
body
,
String
orderNo
,
String
openId
,
int
money
)
{
/**
/**
* 处理内部业务,校验订单等
* 处理内部业务,校验订单等
*/
*/
...
@@ -248,7 +248,7 @@ public class WeixinServiceImpl {
...
@@ -248,7 +248,7 @@ public class WeixinServiceImpl {
//回调的 URL 地址
//回调的 URL 地址
.
notifyUrl
(
"http://我们的域名/api/client/pay/weChatPayNotify"
)
.
notifyUrl
(
"http://我们的域名/api/client/pay/weChatPayNotify"
)
.
build
();
.
build
();
WxPayUnifiedOrderResult
wxPayUnifiedOrderResult
=
null
;
WxPayUnifiedOrderResult
wxPayUnifiedOrderResult
=
null
;
try
{
try
{
wxPayUnifiedOrderResult
=
wxPayService
.
unifiedOrder
(
wxPayUnifiedOrderRequest
);
wxPayUnifiedOrderResult
=
wxPayService
.
unifiedOrder
(
wxPayUnifiedOrderRequest
);
}
catch
(
WxPayException
e
)
{
}
catch
(
WxPayException
e
)
{
...
@@ -258,7 +258,7 @@ public class WeixinServiceImpl {
...
@@ -258,7 +258,7 @@ public class WeixinServiceImpl {
return
null
;
return
null
;
}
}
public
String
refund
(
String
orderNo
,
String
refundNo
,
Integer
totalFee
,
Integer
refundFee
)
{
public
String
refund
(
String
orderNo
,
String
refundNo
,
Integer
totalFee
,
Integer
refundFee
)
{
//申请退款
//申请退款
WxPayRefundRequest
refundInfo
=
WxPayRefundRequest
.
newBuilder
()
WxPayRefundRequest
refundInfo
=
WxPayRefundRequest
.
newBuilder
()
//订单号
//订单号
...
@@ -291,12 +291,8 @@ public class WeixinServiceImpl {
...
@@ -291,12 +291,8 @@ public class WeixinServiceImpl {
}
}
public
Map
<
String
,
String
>
pay
(
HttpServletRequest
r
,
String
body
,
String
orderNo
,
String
openId
,
int
money
)
{
try
{
public
Map
<
String
,
String
>
pay
(
HttpServletRequest
r
,
String
body
,
String
orderNo
,
String
openId
,
int
money
)
{
try
{
HttpClientUtils
client
=
new
HttpClientUtils
(
url
);
HttpClientUtils
client
=
new
HttpClientUtils
(
url
);
//组装接口参数
//组装接口参数
Map
<
String
,
String
>
params
=
new
HashMap
<>();
Map
<
String
,
String
>
params
=
new
HashMap
<>();
...
@@ -327,22 +323,22 @@ public class WeixinServiceImpl {
...
@@ -327,22 +323,22 @@ public class WeixinServiceImpl {
Map
<
String
,
String
>
resultMap
=
WXPayUtil
.
xmlToMap
(
resultXml
);
Map
<
String
,
String
>
resultMap
=
WXPayUtil
.
xmlToMap
(
resultXml
);
//错误处理
//错误处理
if
(
"FAIL"
.
equals
(
resultMap
.
get
(
"return_code"
))
||
"FAIL"
.
equals
(
resultMap
.
get
(
"result_code"
)))
{
if
(
"FAIL"
.
equals
(
resultMap
.
get
(
"return_code"
))
||
"FAIL"
.
equals
(
resultMap
.
get
(
"result_code"
)))
{
log
.
error
(
"微信支付统一下单错误 ===> {} "
,
resultXml
);
log
.
error
(
"微信支付统一下单错误 ===> {} "
,
resultXml
);
throw
new
RuntimeException
(
"微信支付统一下单错误"
);
throw
new
RuntimeException
(
"微信支付统一下单错误"
);
}
}
long
time
=
System
.
currentTimeMillis
()
/
1000
;
long
time
=
System
.
currentTimeMillis
()
/
1000
;
Map
<
String
,
String
>
signInfo
=
new
HashMap
<>();
Map
<
String
,
String
>
signInfo
=
new
HashMap
<>();
signInfo
.
put
(
"appId"
,
appid
);
signInfo
.
put
(
"appId"
,
appid
);
signInfo
.
put
(
"timeStamp"
,
String
.
valueOf
(
time
));
signInfo
.
put
(
"timeStamp"
,
String
.
valueOf
(
time
));
signInfo
.
put
(
"nonceStr"
,
WXPayUtil
.
generateNonceStr
());
signInfo
.
put
(
"nonceStr"
,
WXPayUtil
.
generateNonceStr
());
signInfo
.
put
(
"repay_id"
,
"prepay_id="
+
resultMap
.
get
(
"prepay_id"
));
signInfo
.
put
(
"repay_id"
,
"prepay_id="
+
resultMap
.
get
(
"prepay_id"
));
signInfo
.
put
(
"signType"
,
"MD5"
);
signInfo
.
put
(
"signType"
,
"MD5"
);
//生成签名
//生成签名
Map
<
String
,
String
>
payInfo
=
new
HashMap
<>();
Map
<
String
,
String
>
payInfo
=
new
HashMap
<>();
payInfo
.
put
(
"appId"
,
appid
);
payInfo
.
put
(
"appId"
,
appid
);
payInfo
.
put
(
"timeStamp"
,
signInfo
.
get
(
"timeStamp"
));
payInfo
.
put
(
"timeStamp"
,
signInfo
.
get
(
"timeStamp"
));
payInfo
.
put
(
"nonceStr"
,
signInfo
.
get
(
"nonceStr"
));
payInfo
.
put
(
"nonceStr"
,
signInfo
.
get
(
"nonceStr"
));
payInfo
.
put
(
"package"
,
signInfo
.
get
(
"repay_id"
));
payInfo
.
put
(
"package"
,
signInfo
.
get
(
"repay_id"
));
...
@@ -352,21 +348,23 @@ public class WeixinServiceImpl {
...
@@ -352,21 +348,23 @@ public class WeixinServiceImpl {
// 此处可以写唤起支付前的业务逻辑
// 此处可以写唤起支付前的业务逻辑
// 业务逻辑结束 回传给小程序端唤起支付
// 业务逻辑结束 回传给小程序端唤起支付
return
payInfo
;
return
payInfo
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"微信支付发生异常"
,
e
);
log
.
error
(
"微信支付发生异常"
,
e
);
throw
new
ServiceException
(
"微信支付异常"
);
throw
new
ServiceException
(
"微信支付异常"
);
}
}
}
}
public
String
wxNotify
(
HttpServletRequest
request
)
throws
Exception
{
@Transactional
public
synchronized
String
wxNotify
(
HttpServletRequest
request
)
throws
Exception
{
Map
<
String
,
String
>
returnMap
=
new
HashMap
<>();
//应答对象
Map
<
String
,
String
>
returnMap
=
new
HashMap
<>();
//应答对象
//处理通知参数
//处理通知参数
String
body
=
this
.
readData
(
request
);
String
body
=
this
.
readData
(
request
);
log
.
info
(
"wx notify receive origin: \n{}"
,
body
);
//验签
//验签
if
(!
WXPayUtil
.
isSignatureValid
(
body
,
key
))
{
if
(!
WXPayUtil
.
isSignatureValid
(
body
,
key
))
{
log
.
error
(
"通知验签失败"
);
log
.
error
(
"通知验签失败"
);
//失败应答
//失败应答
returnMap
.
put
(
"return_code"
,
"FAIL"
);
returnMap
.
put
(
"return_code"
,
"FAIL"
);
...
@@ -377,8 +375,9 @@ public class WeixinServiceImpl {
...
@@ -377,8 +375,9 @@ public class WeixinServiceImpl {
//解析xml数据
//解析xml数据
Map
<
String
,
String
>
notifyMap
=
WXPayUtil
.
xmlToMap
(
body
);
Map
<
String
,
String
>
notifyMap
=
WXPayUtil
.
xmlToMap
(
body
);
log
.
info
(
"wx notify receive decode: \n{}"
,
JSONObject
.
toJSONString
(
notifyMap
));
//判断通信和业务是否成功
//判断通信和业务是否成功
if
(!
"SUCCESS"
.
equals
(
notifyMap
.
get
(
"return_code"
))
||
!
"SUCCESS"
.
equals
(
notifyMap
.
get
(
"result_code"
)))
{
if
(!
"SUCCESS"
.
equals
(
notifyMap
.
get
(
"return_code"
))
||
!
"SUCCESS"
.
equals
(
notifyMap
.
get
(
"result_code"
)))
{
log
.
error
(
"失败"
);
log
.
error
(
"失败"
);
//失败应答
//失败应答
returnMap
.
put
(
"return_code"
,
"FAIL"
);
returnMap
.
put
(
"return_code"
,
"FAIL"
);
...
@@ -400,33 +399,33 @@ public class WeixinServiceImpl {
...
@@ -400,33 +399,33 @@ public class WeixinServiceImpl {
// }
// }
//处理订单
//处理订单
if
(
lock
.
tryLock
())
{
// if (lock.tryLock()) {
Order
order
=
new
Order
();
Order
order
=
new
Order
();
order
.
setOrderNo
(
orderNo
);
order
.
setOrderNo
(
orderNo
);
List
<
Order
>
orders
=
orderService
.
selectOrderList
(
order
);
List
<
Order
>
orders
=
orderService
.
selectOrderList
(
order
);
if
(
orders
.
isEmpty
())
{
if
(
orders
.
isEmpty
())
{
returnMap
.
put
(
"return_code"
,
"FAIL"
);
returnMap
.
put
(
"return_code"
,
"FAIL"
);
returnMap
.
put
(
"return_msg"
,
"没有该订单"
);
returnMap
.
put
(
"return_msg"
,
"没有该订单"
);
return
WXPayUtil
.
mapToXml
(
returnMap
);
return
WXPayUtil
.
mapToXml
(
returnMap
);
}
}
order
=
orders
.
get
(
0
);
order
=
orders
.
get
(
0
);
try
{
// try {
//处理重复的通知
//处理重复的通知
//接口调用的幂等性:无论接口被调用多少次,产生的结果是一致的。
//接口调用的幂等性:无论接口被调用多少次,产生的结果是一致的。
String
orderStatus
=
order
.
getState
();
String
orderStatus
=
order
.
getState
();
log
.
info
(
"order current status: {}"
,
orderStatus
);
log
.
info
(
"order current status: {}"
,
orderStatus
);
if
(
OrderStatusConstant
.
Unpaid
.
equals
(
orderStatus
))
{
if
(
OrderStatusConstant
.
Unpaid
.
equals
(
orderStatus
))
{
//更新订单状态
//更新订单状态
order
.
setPayTime
(
new
Date
());
order
.
setPayTime
(
new
Date
());
order
.
setState
(
OrderStatusConstant
.
Paid
);
order
.
setState
(
OrderStatusConstant
.
Paid
);
order
.
setPickCode
(
generatePickCode
(
order
));
order
.
setPickCode
(
generatePickCode
(
order
));
orderService
.
updateOrder
(
order
);
orderService
.
updateOrder
(
order
);
}
}
finally
{
//要主动释放锁
lock
.
unlock
();
}
}
}
/*} finally {
//要主动释放锁
lock.unlock();
}*/
// }
returnMap
.
put
(
"return_code"
,
"SUCCESS"
);
returnMap
.
put
(
"return_code"
,
"SUCCESS"
);
returnMap
.
put
(
"return_msg"
,
"OK"
);
returnMap
.
put
(
"return_msg"
,
"OK"
);
String
returnXml
=
WXPayUtil
.
mapToXml
(
returnMap
);
String
returnXml
=
WXPayUtil
.
mapToXml
(
returnMap
);
...
@@ -467,7 +466,7 @@ public class WeixinServiceImpl {
...
@@ -467,7 +466,7 @@ public class WeixinServiceImpl {
Order
order
=
new
Order
();
Order
order
=
new
Order
();
order
.
setOrderNo
(
orderNo
);
order
.
setOrderNo
(
orderNo
);
List
<
Order
>
orders
=
orderService
.
selectOrderList
(
order
);
List
<
Order
>
orders
=
orderService
.
selectOrderList
(
order
);
if
(
orders
.
isEmpty
())
{
if
(
orders
.
isEmpty
())
{
return
"没有该订单"
;
return
"没有该订单"
;
}
}
...
@@ -483,11 +482,11 @@ public class WeixinServiceImpl {
...
@@ -483,11 +482,11 @@ public class WeixinServiceImpl {
// }
// }
//处理订单
//处理订单
if
(
lock
.
tryLock
())
{
if
(
lock
.
tryLock
())
{
try
{
try
{
//处理重复的通知
//处理重复的通知
//接口调用的幂等性:无论接口被调用多少次,产生的结果是一致的。
//接口调用的幂等性:无论接口被调用多少次,产生的结果是一致的。
String
orderStatus
=
order
.
getState
();
String
orderStatus
=
order
.
getState
();
if
(
OrderStatusConstant
.
Unpaid
.
equals
(
orderStatus
))
{
if
(
OrderStatusConstant
.
Unpaid
.
equals
(
orderStatus
))
{
//更新订单状态
//更新订单状态
order
.
setPayTime
(
new
Date
());
order
.
setPayTime
(
new
Date
());
...
@@ -657,76 +656,76 @@ public class WeixinServiceImpl {
...
@@ -657,76 +656,76 @@ public class WeixinServiceImpl {
shop1
.
setOrderState
(
1
);
shop1
.
setOrderState
(
1
);
}
}
String
province
=
shop1
.
getProvince
();
String
province
=
shop1
.
getProvince
();
if
(
proString
.
contains
(
province
))
{
if
(
proString
.
contains
(
province
))
{
for
(
JSONObject
provinceObject
:
proviceList
)
{
for
(
JSONObject
provinceObject
:
proviceList
)
{
if
(
province
.
equals
(
provinceObject
.
getString
(
"value"
)))
{
if
(
province
.
equals
(
provinceObject
.
getString
(
"value"
)))
{
JSONArray
cityChild
=
provinceObject
.
getJSONArray
(
"children"
);
JSONArray
cityChild
=
provinceObject
.
getJSONArray
(
"children"
);
boolean
cityboo
=
true
;
boolean
cityboo
=
true
;
for
(
int
i
=
0
;
i
<
cityChild
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
cityChild
.
size
();
i
++)
{
JSONObject
city
=
cityChild
.
getJSONObject
(
i
);
JSONObject
city
=
cityChild
.
getJSONObject
(
i
);
if
(
shop1
.
getCity
().
equals
(
city
.
getString
(
"value"
)))
{
if
(
shop1
.
getCity
().
equals
(
city
.
getString
(
"value"
)))
{
cityboo
=
false
;
cityboo
=
false
;
JSONArray
zooeObject
=
city
.
getJSONArray
(
"children"
);
JSONArray
zooeObject
=
city
.
getJSONArray
(
"children"
);
boolean
zoneBoo
=
true
;
boolean
zoneBoo
=
true
;
for
(
int
j
=
0
;
j
<
zooeObject
.
size
();
j
++)
{
for
(
int
j
=
0
;
j
<
zooeObject
.
size
();
j
++)
{
JSONObject
zooe
=
zooeObject
.
getJSONObject
(
j
);
JSONObject
zooe
=
zooeObject
.
getJSONObject
(
j
);
if
(
shop1
.
getZone
().
equals
(
zooe
.
getString
(
"value"
)))
{
if
(
shop1
.
getZone
().
equals
(
zooe
.
getString
(
"value"
)))
{
zoneBoo
=
false
;
zoneBoo
=
false
;
JSONArray
shopInfos
=
zooe
.
getJSONArray
(
"shops"
);
JSONArray
shopInfos
=
zooe
.
getJSONArray
(
"shops"
);
shopInfos
.
add
(
shop1
);
shopInfos
.
add
(
shop1
);
ArrayList
<
Shop
>
shopList
=
(
ArrayList
<
Shop
>)
shopInfos
.
toJavaList
(
Shop
.
class
);
ArrayList
<
Shop
>
shopList
=
(
ArrayList
<
Shop
>)
shopInfos
.
toJavaList
(
Shop
.
class
);
List
<
Shop
>
collect
=
shopList
.
stream
().
sorted
((
a
,
b
)
->
a
.
getDistance
().
compareTo
(
b
.
getDistance
())).
collect
(
Collectors
.
toList
());
List
<
Shop
>
collect
=
shopList
.
stream
().
sorted
((
a
,
b
)
->
a
.
getDistance
().
compareTo
(
b
.
getDistance
())).
collect
(
Collectors
.
toList
());
zooe
.
put
(
"shops"
,
collect
);
zooe
.
put
(
"shops"
,
collect
);
}
}
}
}
if
(
zoneBoo
)
{
if
(
zoneBoo
)
{
JSONObject
zone
=
new
JSONObject
();
JSONObject
zone
=
new
JSONObject
();
zone
.
put
(
"value"
,
shop1
.
getZone
());
zone
.
put
(
"value"
,
shop1
.
getZone
());
zone
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
String
.
format
(
zoneString
,
province
,
shop1
.
getCity
(),
shop1
.
getZone
())));
zone
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
String
.
format
(
zoneString
,
province
,
shop1
.
getCity
(),
shop1
.
getZone
())));
zooeObject
.
add
(
zone
);
zooeObject
.
add
(
zone
);
List
<
Shop
>
shopList
=
new
ArrayList
<>();
List
<
Shop
>
shopList
=
new
ArrayList
<>();
shopList
.
add
(
shop1
);
shopList
.
add
(
shop1
);
zone
.
put
(
"shops"
,
shopList
);
zone
.
put
(
"shops"
,
shopList
);
}
}
}
}
}
}
if
(
cityboo
)
{
if
(
cityboo
)
{
JSONObject
city
=
new
JSONObject
();
JSONObject
city
=
new
JSONObject
();
city
.
put
(
"value"
,
shop1
.
getCity
());
city
.
put
(
"value"
,
shop1
.
getCity
());
city
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
String
.
format
(
cityString
,
province
,
shop1
.
getCity
())));
city
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
String
.
format
(
cityString
,
province
,
shop1
.
getCity
())));
cityChild
.
add
(
city
);
cityChild
.
add
(
city
);
JSONObject
zone
=
new
JSONObject
();
JSONObject
zone
=
new
JSONObject
();
zone
.
put
(
"value"
,
shop1
.
getZone
());
zone
.
put
(
"value"
,
shop1
.
getZone
());
zone
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
String
.
format
(
zoneString
,
province
,
shop1
.
getCity
(),
shop1
.
getZone
())));
zone
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
String
.
format
(
zoneString
,
province
,
shop1
.
getCity
(),
shop1
.
getZone
())));
List
<
Shop
>
shopList
=
new
ArrayList
<>();
List
<
Shop
>
shopList
=
new
ArrayList
<>();
shopList
.
add
(
shop1
);
shopList
.
add
(
shop1
);
zone
.
put
(
"shops"
,
shopList
);
zone
.
put
(
"shops"
,
shopList
);
List
<
JSONObject
>
zones
=
new
ArrayList
<>();
List
<
JSONObject
>
zones
=
new
ArrayList
<>();
zones
.
add
(
zone
);
zones
.
add
(
zone
);
city
.
put
(
"children"
,
zones
);
city
.
put
(
"children"
,
zones
);
}
}
}
}
}
}
}
else
{
}
else
{
proString
.
add
(
province
);
proString
.
add
(
province
);
JSONObject
provice
=
new
JSONObject
();
JSONObject
provice
=
new
JSONObject
();
provice
.
put
(
"value"
,
province
);
provice
.
put
(
"value"
,
province
);
String
format
=
String
.
format
(
provinceString
,
province
);
String
format
=
String
.
format
(
provinceString
,
province
);
provice
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
format
));
provice
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
format
));
proviceList
.
add
(
provice
);
proviceList
.
add
(
provice
);
JSONObject
city
=
new
JSONObject
();
JSONObject
city
=
new
JSONObject
();
city
.
put
(
"value"
,
shop1
.
getCity
());
city
.
put
(
"value"
,
shop1
.
getCity
());
city
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
String
.
format
(
cityString
,
province
,
shop1
.
getCity
())));
city
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
String
.
format
(
cityString
,
province
,
shop1
.
getCity
())));
List
<
JSONObject
>
citys
=
new
ArrayList
<>();
List
<
JSONObject
>
citys
=
new
ArrayList
<>();
citys
.
add
(
city
);
citys
.
add
(
city
);
provice
.
put
(
"children"
,
citys
);
provice
.
put
(
"children"
,
citys
);
JSONObject
zone
=
new
JSONObject
();
JSONObject
zone
=
new
JSONObject
();
zone
.
put
(
"value"
,
shop1
.
getZone
());
zone
.
put
(
"value"
,
shop1
.
getZone
());
zone
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
String
.
format
(
zoneString
,
province
,
shop1
.
getCity
(),
shop1
.
getZone
())));
zone
.
put
(
"name"
,
JSONPath
.
read
(
areaData
,
String
.
format
(
zoneString
,
province
,
shop1
.
getCity
(),
shop1
.
getZone
())));
List
<
Shop
>
shopList
=
new
ArrayList
<>();
List
<
Shop
>
shopList
=
new
ArrayList
<>();
shopList
.
add
(
shop1
);
shopList
.
add
(
shop1
);
zone
.
put
(
"shops"
,
shopList
);
zone
.
put
(
"shops"
,
shopList
);
...
...
soss-system/src/main/java/com/soss/system/service/impl/OrderServiceImpl.java
View file @
d06db564
...
@@ -92,8 +92,10 @@ public class OrderServiceImpl implements IOrderService {
...
@@ -92,8 +92,10 @@ public class OrderServiceImpl implements IOrderService {
public
Order
selectOrderById
(
Long
id
)
{
public
Order
selectOrderById
(
Long
id
)
{
Order
order
=
orderMapper
.
selectOrderById
(
id
);
Order
order
=
orderMapper
.
selectOrderById
(
id
);
order
.
setShop
(
shopMapper
.
selectShopById
(
order
.
getShopId
()));
order
.
setShop
(
shopMapper
.
selectShopById
(
order
.
getShopId
()));
String
pickCode
=
stringRedisTemplate
.
opsForValue
().
get
(
order
.
getPickCode
());
if
(!
StringUtils
.
isEmpty
(
order
.
getPickCode
()))
{
order
.
setPickCode
(
pickCode
);
String
pickCode
=
stringRedisTemplate
.
opsForValue
().
get
(
order
.
getPickCode
());
order
.
setPickCode
(
pickCode
);
}
OrderSnapshot
orderSnapshot
=
orderSnapshotService
.
selectOrderSnapshotByOrderId
(
order
.
getId
());
OrderSnapshot
orderSnapshot
=
orderSnapshotService
.
selectOrderSnapshotByOrderId
(
order
.
getId
());
String
snapshot
=
orderSnapshot
.
getSnapshot
();
String
snapshot
=
orderSnapshot
.
getSnapshot
();
List
<
OrderDetail
>
orderDetails
=
JSONObject
.
parseArray
(
snapshot
,
OrderDetail
.
class
);
List
<
OrderDetail
>
orderDetails
=
JSONObject
.
parseArray
(
snapshot
,
OrderDetail
.
class
);
...
@@ -615,8 +617,10 @@ public class OrderServiceImpl implements IOrderService {
...
@@ -615,8 +617,10 @@ public class OrderServiceImpl implements IOrderService {
String
waitTime
=
getWaitTimeByOrderId
(
order
.
getId
());
String
waitTime
=
getWaitTimeByOrderId
(
order
.
getId
());
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"waitTime"
,
waitTime
);
map
.
put
(
"waitTime"
,
waitTime
);
String
pickCode
=
stringRedisTemplate
.
opsForValue
().
get
(
order
.
getPickCode
());
if
(
StringUtils
.
isNotEmpty
(
order
.
getPickCode
()))
{
map
.
put
(
"pickCode"
,
pickCode
);
String
pickCode
=
stringRedisTemplate
.
opsForValue
().
get
(
order
.
getPickCode
());
map
.
put
(
"pickCode"
,
pickCode
);
}
map
.
put
(
"orderNum"
,
order
.
getOrderNum
());
map
.
put
(
"orderNum"
,
order
.
getOrderNum
());
map
.
put
(
"state"
,
order
.
getState
());
map
.
put
(
"state"
,
order
.
getState
());
return
map
;
return
map
;
...
...
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