Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
shop
Project
Project
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
曲欣亮
shop
Commits
7ab82873
Commit
7ab82873
authored
Mar 05, 2020
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
f756b39e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1387 additions
and
1360 deletions
+1387
-1360
OrderController.java
src/main/java/com/egolm/shop/api/OrderController.java
+351
-327
OrderService.java
src/main/java/com/egolm/shop/api/service/OrderService.java
+39
-39
OrderServiceImpl.java
...ava/com/egolm/shop/api/service/impl/OrderServiceImpl.java
+898
-896
QiyeWxServiceImpl.java
...va/com/egolm/shop/api/service/impl/QiyeWxServiceImpl.java
+99
-98
No files found.
src/main/java/com/egolm/shop/api/OrderController.java
View file @
7ab82873
This diff is collapsed.
Click to expand it.
src/main/java/com/egolm/shop/api/service/OrderService.java
View file @
7ab82873
package
com
.
egolm
.
shop
.
api
.
service
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
com.alibaba.fastjson.JSONObject
;
import
com.egolm.common.jdbc.Page
;
public
interface
OrderService
{
public
String
orderCheck
(
Map
<
String
,
Object
>
params
);
public
String
submit
(
JSONObject
submitObj
);
public
String
queryOrderList
(
String
orgNo
,
String
shopNo
,
Integer
status
,
String
[]
orderType
,
String
langID
,
Page
page
);
public
String
queryOrderDetailList
(
String
salesOrderId
);
public
String
getOrderDetail
(
String
salesOrderId
);
public
void
paySuccess
(
String
sSalesOrderID
,
BigDecimal
nPayAmount
,
String
sOpenID
,
String
sTransTraceNO
,
String
sOutTradeNO
,
Date
dPayDateTime
);
public
String
getSubOrderDetail
(
String
subOrderID
);
public
void
cancelOrder
(
String
sSalesOrderID
);
public
String
submitByGroup
(
String
orgNo
,
String
shopNo
,
String
prompPaperNO
,
String
promoGroupNO
,
Integer
saleQty
,
String
addrId
,
String
payTypeId
,
String
terminal
,
String
salesmanNo
,
String
formId
,
String
bankType
,
String
bankAccount
,
String
bankAccountName
,
String
revBankType
,
String
revBankAccount
,
String
revBankAccountNo
,
String
memo
);
public
String
submitByZhc
(
String
orgNo
,
String
shopNo
,
Integer
planId
,
Integer
saleQty
,
String
addrId
,
String
payTypeId
,
String
terminal
,
String
salesmanNo
,
String
formId
,
String
bankType
,
String
bankAccount
,
String
bankAccountName
,
String
revBankType
,
String
revBankAccount
,
String
revBankAccountNo
,
String
memo
);
public
String
submitByMdzs
(
String
orgNo
,
String
shopNo
,
String
contractNo
,
Integer
goodsId
,
Integer
saleQty
,
String
addrId
,
String
email
,
String
payTypeId
,
String
terminal
,
String
salesmanNo
,
String
formId
,
String
bankType
,
String
bankAccount
,
String
bankAccountName
,
String
revBankType
,
String
revBankAccount
,
String
revBankAccountNo
,
String
memo
);
public
void
confirmReceipt
(
String
custNo
,
String
subOrderID
);
public
List
<
Map
<
String
,
Object
>>
getDeliverSubDetail
(
String
aocOrderID
);
}
package
com
.
egolm
.
shop
.
api
.
service
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
com.alibaba.fastjson.JSONObject
;
import
com.egolm.common.jdbc.Page
;
public
interface
OrderService
{
public
String
orderCheck
(
Map
<
String
,
Object
>
params
);
public
String
submit
(
JSONObject
submitObj
);
public
String
queryOrderList
(
String
orgNo
,
String
shopNo
,
Integer
status
,
String
[]
orderType
,
String
langID
,
Page
page
);
public
String
queryOrderDetailList
(
String
salesOrderId
);
public
String
getOrderDetail
(
String
salesOrderId
);
public
void
paySuccess
(
String
sSalesOrderID
,
BigDecimal
nPayAmount
,
String
sOpenID
,
String
sTransTraceNO
,
String
sOutTradeNO
,
Date
dPayDateTime
);
public
String
getSubOrderDetail
(
String
subOrderID
);
public
void
cancelOrder
(
String
sSalesOrderID
);
public
String
submitByGroup
(
String
orgNo
,
String
shopNo
,
String
prompPaperNO
,
String
promoGroupNO
,
Integer
saleQty
,
String
addrId
,
String
payTypeId
,
String
terminal
,
String
salesmanNo
,
String
formId
,
String
bankType
,
String
bankAccount
,
String
bankAccountName
,
String
revBankType
,
String
revBankAccount
,
String
revBankAccountNo
,
String
memo
);
public
String
submitByZhc
(
String
orgNo
,
String
shopNo
,
Integer
planId
,
Integer
saleQty
,
String
addrId
,
String
payTypeId
,
String
terminal
,
String
salesmanNo
,
String
formId
,
String
bankType
,
String
bankAccount
,
String
bankAccountName
,
String
revBankType
,
String
revBankAccount
,
String
revBankAccountNo
,
String
memo
);
public
String
submitByMdzs
(
String
orgNo
,
String
shopNo
,
String
contractNo
,
Integer
goodsId
,
Integer
saleQty
,
String
addrId
,
String
email
,
String
payTypeId
,
String
terminal
,
String
salesmanNo
,
String
formId
,
String
bankType
,
String
bankAccount
,
String
bankAccountName
,
String
revBankType
,
String
revBankAccount
,
String
revBankAccountNo
,
String
memo
);
public
void
confirmReceipt
(
String
custNo
,
String
subOrderID
);
public
List
<
Map
<
String
,
Object
>>
getDeliverSubDetail
(
String
aocOrderID
);
}
src/main/java/com/egolm/shop/api/service/impl/OrderServiceImpl.java
View file @
7ab82873
This diff is collapsed.
Click to expand it.
src/main/java/com/egolm/shop/api/service/impl/QiyeWxServiceImpl.java
View file @
7ab82873
package
com
.
egolm
.
shop
.
api
.
service
.
impl
;
import
java.text.MessageFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.egolm.common.DateUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.shop.api.service.QiyeWxService
;
import
com.egolm.shop.common.utils.HttpUtil
;
import
com.egolm.shop.common.utils.HttpUtil.HttpReqObject
;
import
com.egolm.shop.common.utils.HttpUtil.HttpRespObject
;
import
com.egolm.shop.common.utils.HttpUtil.JsonReqObject
;
import
com.egolm.shop.common.utils.HttpUtil.SSLVersion
;
@Service
public
class
QiyeWxServiceImpl
implements
QiyeWxService
{
@Value
(
"${qiyewx.corpid}"
)
private
String
corpid
;
@Value
(
"${qiyewx.corpsecret}"
)
private
String
corpsecret
;
@Value
(
"${qiyewx.baseUrl}"
)
private
String
baseUrl
;
@Value
(
"${qiyewx.msg.redirect.appid}"
)
private
String
redirectAppid
;
@Autowired
private
RedisTemplate
<
String
,
String
>
redis
;
@Override
public
String
getTokenString
()
{
String
redisCacheKey
=
PrefixRedisTokenKey
+
corpid
;
Long
systemTime
=
System
.
currentTimeMillis
();
String
tokenObjectString
=
redis
.
opsForValue
().
get
(
redisCacheKey
);
if
(
StringUtil
.
isNotBlank
(
tokenObjectString
))
{
JSONObject
tokenObject
=
JSON
.
parseObject
(
tokenObjectString
);
Integer
errcode
=
tokenObject
.
getInteger
(
"errcode"
);
if
(
errcode
==
0
)
{
Long
expires_in
=
tokenObject
.
getLong
(
"expires_in"
);
String
loadTimeString
=
tokenObject
.
getString
(
"loadTime"
);
if
(
expires_in
!=
null
&&
StringUtil
.
isNotBlank
(
loadTimeString
))
{
Date
loadTime
=
DateUtil
.
parse
(
loadTimeString
,
"yyyy-MM-dd HH:mm:ss"
);
Long
expireTime
=
loadTime
.
getTime
()
+
(
expires_in
*
1000L
);
if
((
expireTime
-
DevTime
)
>
systemTime
)
{
String
access_token
=
tokenObject
.
getString
(
"access_token"
);
if
(
StringUtil
.
isNotBlank
(
access_token
))
{
return
access_token
;
}
}
}
}
}
String
requestUrl
=
baseUrl
+
MessageFormat
.
format
(
UrlGetToken
,
corpid
,
corpsecret
);
HttpRespObject
resp
=
HttpUtil
.
newInstance
().
setSSLVersion
(
SSLVersion
.
SSLv3
).
get
(
new
HttpReqObject
(
requestUrl
,
null
,
null
));
if
(
resp
.
getHttpCode
()
==
200
)
{
String
text
=
resp
.
getResponseBody
();
JSONObject
tokenObject
=
JSON
.
parseObject
(
text
);
Integer
code
=
tokenObject
.
getInteger
(
"errcode"
);
if
(
code
==
0
)
{
tokenObject
.
put
(
"loadTime"
,
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
));
redis
.
opsForValue
().
set
(
redisCacheKey
,
tokenObject
.
toJSONString
());
return
tokenObject
.
getString
(
"access_token"
);
}
}
return
null
;
}
@Override
public
void
refreshToken
()
{
String
redisCacheKey
=
PrefixRedisTokenKey
+
corpid
;
redis
.
delete
(
redisCacheKey
);
}
@Override
public
void
sendMessage
(
WxMessage
wxMessage
)
{
String
tokenString
=
this
.
getTokenString
();
String
requestUrl
=
baseUrl
+
MessageFormat
.
format
(
UrlSendMsg
,
tokenString
);
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
headers
.
put
(
"content-type"
,
"application/x-www-form-urlencoded"
);
wxMessage
.
getMiniprogram_notice
().
setAppid
(
redirectAppid
);
HttpUtil
.
newInstance
().
setSSLVersion
(
SSLVersion
.
SSLv3
).
postJson
(
new
JsonReqObject
(
requestUrl
,
wxMessage
,
headers
));
}
}
package
com
.
egolm
.
shop
.
api
.
service
.
impl
;
import
java.text.MessageFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.egolm.common.DateUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.shop.api.service.QiyeWxService
;
import
com.egolm.shop.api.service.QiyeWxService.WxMessage
;
import
com.egolm.shop.common.utils.HttpUtil
;
import
com.egolm.shop.common.utils.HttpUtil.HttpReqObject
;
import
com.egolm.shop.common.utils.HttpUtil.HttpRespObject
;
import
com.egolm.shop.common.utils.HttpUtil.JsonReqObject
;
import
com.egolm.shop.common.utils.HttpUtil.SSLVersion
;
@Service
public
class
QiyeWxServiceImpl
implements
QiyeWxService
{
@Value
(
"${qiyewx.corpid}"
)
private
String
corpid
;
@Value
(
"${qiyewx.corpsecret}"
)
private
String
corpsecret
;
@Value
(
"${qiyewx.baseUrl}"
)
private
String
baseUrl
;
@Value
(
"${qiyewx.msg.redirect.appid}"
)
private
String
redirectAppid
;
@Autowired
private
RedisTemplate
<
String
,
String
>
redis
;
@Override
public
String
getTokenString
()
{
String
redisCacheKey
=
PrefixRedisTokenKey
+
corpid
;
Long
systemTime
=
System
.
currentTimeMillis
();
String
tokenObjectString
=
redis
.
opsForValue
().
get
(
redisCacheKey
);
if
(
StringUtil
.
isNotBlank
(
tokenObjectString
))
{
JSONObject
tokenObject
=
JSON
.
parseObject
(
tokenObjectString
);
Integer
errcode
=
tokenObject
.
getInteger
(
"errcode"
);
if
(
errcode
==
0
)
{
Long
expires_in
=
tokenObject
.
getLong
(
"expires_in"
);
String
loadTimeString
=
tokenObject
.
getString
(
"loadTime"
);
if
(
expires_in
!=
null
&&
StringUtil
.
isNotBlank
(
loadTimeString
))
{
Date
loadTime
=
DateUtil
.
parse
(
loadTimeString
,
"yyyy-MM-dd HH:mm:ss"
);
Long
expireTime
=
loadTime
.
getTime
()
+
(
expires_in
*
1000L
);
if
((
expireTime
-
DevTime
)
>
systemTime
)
{
String
access_token
=
tokenObject
.
getString
(
"access_token"
);
if
(
StringUtil
.
isNotBlank
(
access_token
))
{
return
access_token
;
}
}
}
}
}
String
requestUrl
=
baseUrl
+
MessageFormat
.
format
(
UrlGetToken
,
corpid
,
corpsecret
);
HttpRespObject
resp
=
HttpUtil
.
newInstance
().
setSSLVersion
(
SSLVersion
.
SSLv3
).
get
(
new
HttpReqObject
(
requestUrl
,
null
,
null
));
if
(
resp
.
getHttpCode
()
==
200
)
{
String
text
=
resp
.
getResponseBody
();
JSONObject
tokenObject
=
JSON
.
parseObject
(
text
);
Integer
code
=
tokenObject
.
getInteger
(
"errcode"
);
if
(
code
==
0
)
{
tokenObject
.
put
(
"loadTime"
,
DateUtil
.
format
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
));
redis
.
opsForValue
().
set
(
redisCacheKey
,
tokenObject
.
toJSONString
());
return
tokenObject
.
getString
(
"access_token"
);
}
}
return
null
;
}
@Override
public
void
refreshToken
()
{
String
redisCacheKey
=
PrefixRedisTokenKey
+
corpid
;
redis
.
delete
(
redisCacheKey
);
}
@Override
public
void
sendMessage
(
WxMessage
wxMessage
)
{
String
tokenString
=
this
.
getTokenString
();
String
requestUrl
=
baseUrl
+
MessageFormat
.
format
(
UrlSendMsg
,
tokenString
);
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
headers
.
put
(
"content-type"
,
"application/x-www-form-urlencoded"
);
wxMessage
.
getMiniprogram_notice
().
setAppid
(
redirectAppid
);
HttpUtil
.
newInstance
().
setSSLVersion
(
SSLVersion
.
SSLv3
).
postJson
(
new
JsonReqObject
(
requestUrl
,
wxMessage
,
headers
));
}
}
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