Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
youka-api
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
java-youka-wallet
youka-api
Commits
ce49c9a1
Commit
ce49c9a1
authored
Apr 11, 2018
by
Java-聂换换
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商户进件
parent
d3e0bb7e
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
744 additions
and
15 deletions
+744
-15
CommonDto.java
src/main/java/com/thinkgem/jeesite/modules/pay/alipay/dto/CommonDto.java
+4
-0
AlipayService.java
src/main/java/com/thinkgem/jeesite/modules/pay/alipay/service/AlipayService.java
+35
-0
PayApiService.java
src/main/java/com/thinkgem/jeesite/modules/pay/service/PayApiService.java
+10
-1
CommonDto.java
src/main/java/com/thinkgem/jeesite/modules/pay/weixin/dto/CommonDto.java
+67
-0
WeixinPayDto.java
src/main/java/com/thinkgem/jeesite/modules/pay/weixin/dto/WeixinPayDto.java
+143
-0
WeixinPayService.java
src/main/java/com/thinkgem/jeesite/modules/pay/weixin/service/WeixinPayService.java
+52
-0
HttpUtils.java
src/main/java/com/thinkgem/jeesite/modules/pay/weixin/utils/HttpUtils.java
+286
-0
SignUtils.java
src/main/java/com/thinkgem/jeesite/modules/pay/weixin/utils/SignUtils.java
+25
-0
XMLAndEntityUtil.java
src/main/java/com/thinkgem/jeesite/modules/pay/weixin/utils/XMLAndEntityUtil.java
+30
-0
XmltoJsonUtil.java
src/main/java/com/thinkgem/jeesite/modules/pay/weixin/utils/XmltoJsonUtil.java
+76
-0
UserApiService.java
src/main/java/com/thinkgem/jeesite/modules/user/service/UserApiService.java
+12
-11
youka.properties
src/main/resources/youka.properties
+4
-3
No files found.
src/main/java/com/thinkgem/jeesite/modules/pay/alipay/dto/CommonDto.java
0 → 100644
View file @
ce49c9a1
package
com
.
thinkgem
.
jeesite
.
modules
.
pay
.
alipay
.
dto
;
public
class
CommonDto
implements
java
.
io
.
Serializable
{
}
src/main/java/com/thinkgem/jeesite/modules/pay/alipay/service/AlipayService.java
0 → 100644
View file @
ce49c9a1
package
com
.
thinkgem
.
jeesite
.
modules
.
pay
.
alipay
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alipay.api.AlipayApiException
;
import
com.alipay.api.AlipayClient
;
import
com.alipay.api.DefaultAlipayClient
;
import
com.alipay.api.request.AlipayTradeFastpayRefundQueryRequest
;
import
com.alipay.api.response.AlipayTradeFastpayRefundQueryResponse
;
import
com.thinkgem.jeesite.common.config.Global
;
public
class
AlipayService
{
public
JSONObject
alipay
()
throws
AlipayApiException
{
AlipayClient
alipayClient
=
new
DefaultAlipayClient
(
"https://openapi.alipay.com/gateway.do"
,
Global
.
getConfig
(
"alipay.appid"
),
"your private_key"
,
"json"
,
"GBK"
,
"alipay_public_key"
,
"RSA2"
);
AlipayTradeFastpayRefundQueryRequest
request
=
new
AlipayTradeFastpayRefundQueryRequest
();
request
.
setBizContent
(
"{"
+
"\"trade_no\":\"20150320010101001\","
+
"\"out_trade_no\":\"2014112611001004680073956707\","
+
"\"out_request_no\":\"2014112611001004680073956707\""
+
" }"
);
AlipayTradeFastpayRefundQueryResponse
response
=
alipayClient
.
execute
(
request
);
if
(
response
.
isSuccess
()){
System
.
out
.
println
(
"调用成功"
);
}
else
{
System
.
out
.
println
(
"调用失败"
);
}
return
null
;
}
public
static
void
main
(
String
[]
args
)
throws
AlipayApiException
{
AlipayService
alipayService
=
new
AlipayService
();
alipayService
.
alipay
();
}
}
src/main/java/com/thinkgem/jeesite/modules/pay/service/PayApiService.java
View file @
ce49c9a1
...
...
@@ -192,13 +192,22 @@ public class PayApiService {
*/
public
PayBackDto
quickPayJuHeZhongIntegralPay
(
UserEntity
userEntity
,
OrderEntity
orderEntity
,
JuHeZhongPayRequest
request
,
CardEntity
cardEntity
)
throws
Exception
{
UserRequest
userRequest
=
new
UserRequest
();
userRequest
.
setSubMerchantCode
(
request
.
getSubMerchantCode
());
userRequest
.
setBelongBank
(
userEntity
.
getUserDetail
().
getCard
().
getBelongBank
());
String
subMchId
=
userService
.
quickPayHandleJuhezhong
(
userRequest
,
""
);
JSONObject
dto
=
new
JSONObject
();
dto
.
put
(
"serviceType"
,
4
);
// 服务类型
dto
.
put
(
"orderId"
,
orderEntity
.
getPayCode
());
//订单号
dto
.
put
(
"amount"
,
Long
.
parseLong
(
request
.
getAmount
())*
100
);
//交易金额
dto
.
put
(
"merchantId"
,
ComCode
.
INTEGRAL_MERCHANT_ID
);
//商户号
dto
.
put
(
"subMchId"
,
userEntity
.
getUserDetail
().
getCard
().
getSubMerchantId
());
//由系统分配的商户号
// dto.put("subMchId", userEntity.getUserDetail().getCard().getSubMerchantId());//由系统分配的商户号
dto
.
put
(
"subMchId"
,
subMchId
);
dto
.
put
(
"accNo"
,
cardEntity
.
getCardNo
());
//开卡 唯一标识
// dto.put("accNo", "6210210010501799229");//开卡 唯一标识
dto
.
put
(
"mobile"
,
cardEntity
.
getCardMobile
());
...
...
src/main/java/com/thinkgem/jeesite/modules/pay/weixin/dto/CommonDto.java
0 → 100644
View file @
ce49c9a1
package
com
.
thinkgem
.
jeesite
.
modules
.
pay
.
weixin
.
dto
;
public
class
CommonDto
implements
java
.
io
.
Serializable
{
private
String
appid
;
// 微信开放平台审核通过的应用APPID
private
String
mch_id
;
// 微信支付分配的商户号
private
String
device_info
;
// 终端设备号(门店号或收银设备ID),默认请传"WEB"
private
String
nonce_str
;
// 随机字符串,不长于32位。推荐随机数生成算法
private
String
sign
;
// 签名,详见签名生成算法
private
String
sign_type
;
// 签名,详见签名生成算法
private
String
spbill_create_ip
;
// 签名,详见签名生成算法
public
String
getAppid
()
{
return
appid
;
}
public
void
setAppid
(
String
appid
)
{
this
.
appid
=
appid
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getDevice_info
()
{
return
device_info
;
}
public
void
setDevice_info
(
String
device_info
)
{
this
.
device_info
=
device_info
;
}
public
String
getNonce_str
()
{
return
nonce_str
;
}
public
void
setNonce_str
(
String
nonce_str
)
{
this
.
nonce_str
=
nonce_str
;
}
public
String
getSign
()
{
return
sign
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
String
getSign_type
()
{
return
sign_type
;
}
public
void
setSign_type
(
String
sign_type
)
{
this
.
sign_type
=
sign_type
;
}
public
String
getSpbill_create_ip
()
{
return
spbill_create_ip
;
}
public
void
setSpbill_create_ip
(
String
spbill_create_ip
)
{
this
.
spbill_create_ip
=
spbill_create_ip
;
}
}
src/main/java/com/thinkgem/jeesite/modules/pay/weixin/dto/WeixinPayDto.java
0 → 100644
View file @
ce49c9a1
package
com
.
thinkgem
.
jeesite
.
modules
.
pay
.
weixin
.
dto
;
public
class
WeixinPayDto
extends
CommonDto
{
private
String
body
;
// 商品描述交易字段格式根据不同的应用场景按照以下格式:APP——需传入应用市场上的APP名字-实际商品名称,天天爱消除-游戏充值。
private
String
detail
;
// 商品详细描述,对于使用单品优惠的商户,改字段必须按照规范上传,详见“单品优惠参数说明”
private
String
attach
;
// 附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据
private
String
out_trade_no
;
// 商户系统内部订单号,要求32个字符内,只能是数字、大小写字母_-|*@ ,且在同一个商户号下唯一。详见商户订单号
private
String
fee_type
;
// 符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型
private
String
total_fee
;
// 订单总金额,单位为分,详见支付金额
private
String
time_start
;
// 订单生成时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。其他详见时间规则
private
String
time_expire
;
// 订单失效时间,格式为yyyyMMddHHmmss,如2009年12月27日9点10分10秒表示为20091227091010。订单失效时间是针对订单号而言的,由于在请求支付的时候有一个必传参数prepay_id只有两小时的有效期,所以在重入时间超过2小时的时候需要重新请求下单接口获取新的prepay_id。其他详见时间规则建议:最短失效时间间隔大于1分钟
private
String
goods_tag
;
// 订单优惠标记,代金券或立减优惠功能的参数,说明详见代金券或立减优惠
private
String
notify_url
;
// 接收微信支付异步通知回调地址,通知url必须为直接可访问的url,不能携带参数。
private
String
trade_type
;
// 支付类型
private
String
limit_pay
;
// no_credit--指定不能使用信用卡支付
private
String
scene_info
;
// 该字段用于统一下单时上报场景信息,目前支持上报实际门店信息。
// {
// "store_id": "", //门店唯一标识,选填,String(32)
// "store_name":"”//门店名称,选填,String(64)
//
// }
public
String
getBody
()
{
return
body
;
}
public
void
setBody
(
String
body
)
{
this
.
body
=
body
;
}
public
String
getDetail
()
{
return
detail
;
}
public
void
setDetail
(
String
detail
)
{
this
.
detail
=
detail
;
}
public
String
getAttach
()
{
return
attach
;
}
public
void
setAttach
(
String
attach
)
{
this
.
attach
=
attach
;
}
public
String
getOut_trade_no
()
{
return
out_trade_no
;
}
public
void
setOut_trade_no
(
String
out_trade_no
)
{
this
.
out_trade_no
=
out_trade_no
;
}
public
String
getFee_type
()
{
return
fee_type
;
}
public
void
setFee_type
(
String
fee_type
)
{
this
.
fee_type
=
fee_type
;
}
public
String
getTotal_fee
()
{
return
total_fee
;
}
public
void
setTotal_fee
(
String
total_fee
)
{
this
.
total_fee
=
total_fee
;
}
public
String
getTime_start
()
{
return
time_start
;
}
public
void
setTime_start
(
String
time_start
)
{
this
.
time_start
=
time_start
;
}
public
String
getTime_expire
()
{
return
time_expire
;
}
public
void
setTime_expire
(
String
time_expire
)
{
this
.
time_expire
=
time_expire
;
}
public
String
getGoods_tag
()
{
return
goods_tag
;
}
public
void
setGoods_tag
(
String
goods_tag
)
{
this
.
goods_tag
=
goods_tag
;
}
public
String
getNotify_url
()
{
return
notify_url
;
}
public
void
setNotify_url
(
String
notify_url
)
{
this
.
notify_url
=
notify_url
;
}
public
String
getTrade_type
()
{
return
trade_type
;
}
public
void
setTrade_type
(
String
trade_type
)
{
this
.
trade_type
=
trade_type
;
}
public
String
getLimit_pay
()
{
return
limit_pay
;
}
public
void
setLimit_pay
(
String
limit_pay
)
{
this
.
limit_pay
=
limit_pay
;
}
public
String
getScene_info
()
{
return
scene_info
;
}
public
void
setScene_info
(
String
scene_info
)
{
this
.
scene_info
=
scene_info
;
}
}
src/main/java/com/thinkgem/jeesite/modules/pay/weixin/service/WeixinPayService.java
0 → 100644
View file @
ce49c9a1
package
com
.
thinkgem
.
jeesite
.
modules
.
pay
.
weixin
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.thinkgem.jeesite.common.constant.ComCode
;
import
com.thinkgem.jeesite.common.utils.IdGen
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.utils.Bean2Map
;
import
com.thinkgem.jeesite.modules.pay.weixin.dto.WeixinPayDto
;
import
com.thinkgem.jeesite.modules.pay.weixin.utils.HttpUtils
;
import
com.thinkgem.jeesite.modules.pay.weixin.utils.SignUtils
;
import
com.thinkgem.jeesite.modules.pay.weixin.utils.XMLAndEntityUtil
;
import
com.thinkgem.jeesite.modules.pay.weixin.utils.XmltoJsonUtil
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.SortedMap
;
@Transactional
@Service
public
class
WeixinPayService
{
public
JSONObject
unifiedorder
(
WeixinPayDto
dto
)
throws
Exception
{
dto
.
setMch_id
(
ComCode
.
WEIXIN_MERCHANT_ID
);
dto
.
setAppid
(
ComCode
.
WEIXIN_APPID
);
dto
.
setNonce_str
(
IdGen
.
uuid
());
dto
.
setSign_type
(
"MD5"
);
dto
.
setFee_type
(
"CNY"
);
SortedMap
map
=
Bean2Map
.
Entity2SortedMap
(
dto
);
// map.put("sub_mch_id","1480689732");
map
.
put
(
"sign"
,
SignUtils
.
createSign
(
map
,
ComCode
.
WEIXIN_APPSECRET
));
String
xml
=
XMLAndEntityUtil
.
getRequestXML
(
map
);
System
.
out
.
println
(
"xml:"
+
xml
);
String
str
=
HttpUtils
.
sendPost
(
ComCode
.
WEIXIN_UNIFIEDPAY_URL
,
xml
);
System
.
out
.
println
(
str
);
JSONObject
jsonObject
=
XmltoJsonUtil
.
xmlToJSONObject
(
str
);
System
.
out
.
println
(
jsonObject
.
toJSONString
());
return
jsonObject
;
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
WeixinPayService
weixinPayService
=
new
WeixinPayService
();
WeixinPayDto
dto
=
new
WeixinPayDto
();
dto
.
setBody
(
"body"
);
dto
.
setOut_trade_no
(
ComCode
.
YYYYMMDDHHMM
.
format
(
new
Date
())
+
IdGen
.
randomBase62
(
8
));
dto
.
setTotal_fee
(
"1000"
);
dto
.
setSpbill_create_ip
(
"127.0.0.1"
);
dto
.
setNotify_url
(
"www.baidu.com"
);
dto
.
setTrade_type
(
"APP"
);
weixinPayService
.
unifiedorder
(
dto
);
}
}
src/main/java/com/thinkgem/jeesite/modules/pay/weixin/utils/HttpUtils.java
0 → 100644
View file @
ce49c9a1
package
com
.
thinkgem
.
jeesite
.
modules
.
pay
.
weixin
.
utils
;
import
org.aspectj.util.FileUtil
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.OutputStream
;
import
java.io.PrintStream
;
import
java.io.PrintWriter
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.util.Map
;
public
class
HttpUtils
{
public
static
final
String
POST
=
"POST"
;
public
static
final
String
GET
=
"GET"
;
public
static
String
post
(
String
uriString
,
Map
<
String
,
String
>
params
)
throws
Exception
{
URL
url
=
new
URL
(
uriString
);
HttpURLConnection
con
=
(
HttpURLConnection
)
url
.
openConnection
();
con
.
setDoOutput
(
true
);
con
.
setDoInput
(
true
);
con
.
setRequestMethod
(
RequstMethod
.
POST
.
value
());
con
.
setRequestProperty
(
" Content-Type "
,
" application/x-www-form-urlencoded "
);
con
.
setUseCaches
(
false
);
con
.
setInstanceFollowRedirects
(
true
);
if
(
params
!=
null
)
{
StringBuffer
sb
=
new
StringBuffer
();
String
data
=
null
;
byte
[]
b
=
null
;
for
(
String
key
:
params
.
keySet
())
{
sb
.
append
(
key
).
append
(
'='
).
append
((
String
)
params
.
get
(
key
)).
append
(
'&'
);
}
data
=
sb
.
substring
(
0
,
sb
.
length
()
-
1
);
b
=
data
.
getBytes
(
"UTF-8"
);
OutputStream
out
=
con
.
getOutputStream
();
out
.
write
(
b
);
out
.
flush
();
out
.
close
();
}
InputStream
in
=
con
.
getInputStream
();
String
str
=
readAll
(
in
);
in
.
close
();
in
=
null
;
con
.
disconnect
();
return
str
;
}
public
static
String
post
(
String
uriString
,
Map
<
String
,
String
>
params
,
String
authorization
)
throws
Exception
{
URL
url
=
new
URL
(
uriString
);
HttpURLConnection
con
=
(
HttpURLConnection
)
url
.
openConnection
();
con
.
setDoOutput
(
true
);
con
.
setDoInput
(
true
);
con
.
setRequestMethod
(
RequstMethod
.
POST
.
value
());
con
.
setRequestProperty
(
"Content-Type"
,
"application/json"
);
con
.
setRequestProperty
(
"Authorization"
,
authorization
);
con
.
setUseCaches
(
false
);
con
.
setInstanceFollowRedirects
(
true
);
if
(
params
!=
null
)
{
StringBuffer
sb
=
new
StringBuffer
();
String
data
=
null
;
byte
[]
b
=
null
;
for
(
String
key
:
params
.
keySet
())
{
sb
.
append
(
key
).
append
(
'='
).
append
((
String
)
params
.
get
(
key
)).
append
(
'&'
);
}
data
=
sb
.
substring
(
0
,
sb
.
length
()
-
1
);
b
=
data
.
getBytes
(
"UTF-8"
);
OutputStream
out
=
con
.
getOutputStream
();
out
.
write
(
b
);
out
.
flush
();
out
.
close
();
}
InputStream
in
=
con
.
getInputStream
();
String
responseBody
=
readAll
(
in
);
in
.
close
();
in
=
null
;
con
.
disconnect
();
return
responseBody
;
}
public
static
String
jpost
(
String
uriString
,
Map
<
String
,
String
>
params
)
throws
Exception
{
URL
url
=
new
URL
(
uriString
);
HttpURLConnection
con
=
(
HttpURLConnection
)
url
.
openConnection
();
con
.
setDoOutput
(
true
);
con
.
setDoInput
(
true
);
con
.
setRequestMethod
(
RequstMethod
.
POST
.
value
());
con
.
setRequestProperty
(
"Content-Type"
,
"application/json"
);
con
.
setUseCaches
(
false
);
con
.
setInstanceFollowRedirects
(
true
);
if
(
params
!=
null
)
{
StringBuffer
sb
=
new
StringBuffer
();
String
data
=
null
;
byte
[]
b
=
null
;
for
(
String
key
:
params
.
keySet
())
{
sb
.
append
(
key
).
append
(
'='
).
append
((
String
)
params
.
get
(
key
)).
append
(
'&'
);
}
data
=
sb
.
substring
(
0
,
sb
.
length
()
-
1
);
b
=
data
.
getBytes
(
"UTF-8"
);
OutputStream
out
=
con
.
getOutputStream
();
out
.
write
(
b
);
out
.
flush
();
out
.
close
();
}
InputStream
in
=
con
.
getInputStream
();
String
responseBody
=
readAll
(
in
);
in
.
close
();
in
=
null
;
con
.
disconnect
();
return
responseBody
;
}
public
static
String
sendGet
(
String
url
,
String
param
)
{
String
result
=
""
;
BufferedReader
in
=
null
;
try
{
String
urlNameString
=
url
+
"?"
+
param
;
URL
realUrl
=
new
URL
(
urlNameString
);
URLConnection
connection
=
realUrl
.
openConnection
();
connection
.
setRequestProperty
(
"accept"
,
"*/*"
);
connection
.
setRequestProperty
(
"Content-Type"
,
"application/json"
);
connection
.
setRequestProperty
(
"connection"
,
"Keep-Alive"
);
connection
.
setRequestProperty
(
"user-agent"
,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"
);
connection
.
connect
();
Map
map
=
connection
.
getHeaderFields
();
// for (String key : map.keySet()) {
// System.out.println(key + "--->" + map.get(key));
// }
in
=
new
BufferedReader
(
new
InputStreamReader
(
connection
.
getInputStream
(),
"utf-8"
));
String
line
;
while
((
line
=
in
.
readLine
())
!=
null
)
{
//String line;
result
=
result
+
line
;
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"����GET��������쳣��"
+
e
);
e
.
printStackTrace
();
try
{
if
(
in
!=
null
)
in
.
close
();
}
catch
(
Exception
e2
)
{
e2
.
printStackTrace
();
}
}
finally
{
try
{
if
(
in
!=
null
)
in
.
close
();
}
catch
(
Exception
e2
)
{
e2
.
printStackTrace
();
}
}
return
result
;
}
public
static
String
sendPost
(
String
url
,
String
param
)
{
PrintWriter
out
=
null
;
BufferedReader
in
=
null
;
String
result
=
""
;
try
{
URL
realUrl
=
new
URL
(
url
);
URLConnection
conn
=
realUrl
.
openConnection
();
conn
.
setRequestProperty
(
"Content-Type"
,
"application/xml"
);
conn
.
setDoOutput
(
true
);
conn
.
setDoInput
(
true
);
out
=
new
PrintWriter
(
conn
.
getOutputStream
());
out
.
print
(
param
);
out
.
flush
();
in
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
()));
String
line
;
while
((
line
=
in
.
readLine
())
!=
null
)
{
//String line;
result
=
result
+
line
;
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"���� POST ��������쳣��"
+
e
);
e
.
printStackTrace
();
try
{
if
(
out
!=
null
)
{
out
.
close
();
}
if
(
in
!=
null
)
in
.
close
();
}
catch
(
IOException
ex
)
{
ex
.
printStackTrace
();
}
}
finally
{
try
{
if
(
out
!=
null
)
{
out
.
close
();
}
if
(
in
!=
null
)
in
.
close
();
}
catch
(
IOException
ex
)
{
ex
.
printStackTrace
();
}
}
return
result
;
}
public
static
enum
RequstMethod
{
GET
(
"GET"
),
POST
(
"POST"
);
private
String
value
;
private
RequstMethod
(
String
value
)
{
this
.
value
=
value
;
}
public
String
value
()
{
return
this
.
value
;
}
}
public
static
String
readAll
(
InputStream
in
)
throws
IOException
{
InputStreamReader
inputStreamReader
=
new
InputStreamReader
(
in
,
"UTF-8"
);
BufferedReader
bufferedReader
=
new
BufferedReader
(
inputStreamReader
);
String
str
=
null
;
StringBuffer
buffer
=
new
StringBuffer
();
while
((
str
=
bufferedReader
.
readLine
())
!=
null
)
{
buffer
.
append
(
str
);
}
bufferedReader
.
close
();
inputStreamReader
.
close
();
return
buffer
.
toString
();
}
}
src/main/java/com/thinkgem/jeesite/modules/pay/weixin/utils/SignUtils.java
0 → 100644
View file @
ce49c9a1
package
com
.
thinkgem
.
jeesite
.
modules
.
pay
.
weixin
.
utils
;
import
com.thinkgem.jeesite.modules.pay.juhezhong.utils.MD5Utils
;
import
java.util.*
;
public
class
SignUtils
{
public
static
String
createSign
(
SortedMap
<
Object
,
Object
>
parameters
,
String
APIKEY
)
throws
Exception
{
StringBuffer
buffer
=
new
StringBuffer
();
Set
set
=
parameters
.
entrySet
();
Iterator
iterator
=
set
.
iterator
();
while
(
iterator
.
hasNext
()){
Map
.
Entry
entry
=
(
Map
.
Entry
)
iterator
.
next
();
String
key
=
(
String
)
entry
.
getKey
();
Object
value
=
(
String
)
entry
.
getValue
();
if
(
null
!=
value
&&
!
""
.
equals
(
value
)
&&
!
"sign"
.
equals
(
key
)
&&
!
"key"
.
equals
(
key
)){
buffer
.
append
(
key
+
"="
+
value
+
"&"
);
}
}
buffer
.
append
(
"key="
+
APIKEY
);
String
sign
=
MD5Utils
.
md5
(
buffer
.
toString
()).
toUpperCase
();
System
.
out
.
println
(
"签名参数:"
+
sign
);
return
sign
;
}
}
src/main/java/com/thinkgem/jeesite/modules/pay/weixin/utils/XMLAndEntityUtil.java
0 → 100644
View file @
ce49c9a1
package
com
.
thinkgem
.
jeesite
.
modules
.
pay
.
weixin
.
utils
;
import
java.util.Iterator
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.SortedMap
;
public
class
XMLAndEntityUtil
{
//拼接xml 请求路径
public
static
String
getRequestXML
(
SortedMap
<
Object
,
Object
>
parame
){
StringBuffer
buffer
=
new
StringBuffer
();
buffer
.
append
(
"<xml>"
);
Set
set
=
parame
.
entrySet
();
Iterator
iterator
=
set
.
iterator
();
while
(
iterator
.
hasNext
()){
Map
.
Entry
entry
=
(
Map
.
Entry
)
iterator
.
next
();
String
key
=
(
String
)
entry
.
getKey
();
String
value
=
(
String
)
entry
.
getValue
();
//过滤相关字段sign
if
(
"sign"
.
equalsIgnoreCase
(
key
)){
buffer
.
append
(
"<"
+
key
+
">"
+
"<![CDATA["
+
value
+
"]]>"
+
"</"
+
key
+
">"
);
}
else
{
buffer
.
append
(
"<"
+
key
+
">"
+
value
+
"</"
+
key
+
">"
);
}
}
buffer
.
append
(
"</xml>"
);
return
buffer
.
toString
();
}
}
src/main/java/com/thinkgem/jeesite/modules/pay/weixin/utils/XmltoJsonUtil.java
0 → 100644
View file @
ce49c9a1
package
com
.
thinkgem
.
jeesite
.
modules
.
pay
.
weixin
.
utils
;
import
java.io.ByteArrayInputStream
;
import
java.io.InputStream
;
import
java.util.HashMap
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
import
com.alibaba.fastjson.JSONObject
;
import
org.jdom2.Document
;
import
org.jdom2.Element
;
import
org.jdom2.input.SAXBuilder
;
public
class
XmltoJsonUtil
{
public
static
String
xml2JSON
(
String
xml
)
{
JSONObject
obj
=
new
JSONObject
();
try
{
InputStream
is
=
new
ByteArrayInputStream
(
xml
.
getBytes
(
"utf-8"
));
SAXBuilder
sb
=
new
SAXBuilder
();
Document
doc
=
sb
.
build
(
is
);
Element
root
=
doc
.
getRootElement
();
obj
.
put
(
root
.
getName
(),
iterateElement
(
root
));
return
obj
.
toString
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
public
static
JSONObject
xmlToJSONObject
(
String
xml
)
{
JSONObject
obj
=
new
JSONObject
();
try
{
InputStream
is
=
new
ByteArrayInputStream
(
xml
.
getBytes
(
"utf-8"
));
SAXBuilder
sb
=
new
SAXBuilder
();
Document
doc
=
sb
.
build
(
is
);
Element
root
=
doc
.
getRootElement
();
obj
.
put
(
root
.
getName
(),
iterateElement
(
root
));
return
obj
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
private
static
Map
iterateElement
(
Element
element
)
{
List
jiedian
=
element
.
getChildren
();
Element
et
=
null
;
Map
obj
=
new
HashMap
();
List
list
=
null
;
for
(
int
i
=
0
;
i
<
jiedian
.
size
();
i
++)
{
list
=
new
LinkedList
();
et
=
(
Element
)
jiedian
.
get
(
i
);
if
(
et
.
getTextTrim
().
equals
(
""
))
{
if
(
et
.
getChildren
().
size
()
==
0
)
continue
;
if
(
obj
.
containsKey
(
et
.
getName
()))
{
list
=
(
List
)
obj
.
get
(
et
.
getName
());
}
list
.
add
(
iterateElement
(
et
));
obj
.
put
(
et
.
getName
(),
list
);
}
else
{
if
(
obj
.
containsKey
(
et
.
getName
()))
{
list
=
(
List
)
obj
.
get
(
et
.
getName
());
}
list
.
add
(
et
.
getTextTrim
());
obj
.
put
(
et
.
getName
(),
list
);
}
}
return
obj
;
}
}
src/main/java/com/thinkgem/jeesite/modules/user/service/UserApiService.java
View file @
ce49c9a1
...
...
@@ -226,8 +226,8 @@ public class UserApiService {
// 为用户卡注册subMerchantId
String
type
=
"1"
;
// 默认将卡片添加为对私
String
status
=
"0"
;
// 新增卡片审核状态均为未审核
//
String subMerchantId = null;//registJuHeZhongPay(request, type);
String
subMerchantId
=
quickPayHandleJuhezhong
(
request
,
type
);
String
subMerchantId
=
null
;
//registJuHeZhongPay(request, type);
//
String subMerchantId = quickPayHandleJuhezhong(request,type);
submitPayTest
(
subMerchantId
);
// 更新银行卡详情
CardEntity
cardStatusEntity
=
new
CardEntity
(
request
.
getSubMerchantCode
(),
"N"
);
...
...
@@ -338,18 +338,19 @@ public class UserApiService {
if
(
userEntity
==
null
)
{
throw
new
MyException
(
"用户信息为空"
);
}
UserDetailEntity
userDetailEntity
=
userDao
.
getUserDetailByCode
(
userEntity
);
RateEntity
rateEntityParam
=
new
RateEntity
(
userEntity
.
getLevel
(),
"quick"
);
RateEntity
rateEntity
=
userDao
.
getRateByLevel
(
rateEntityParam
);
if
(
rateEntity
==
null
)
{
throw
new
MyException
(
"费率等级信息为空"
);
}
//
UserDetailEntity userDetailEntity = userDao.getUserDetailByCode(userEntity);
//
RateEntity rateEntityParam = new RateEntity(userEntity.getLevel(), "quick");
//
RateEntity rateEntity = userDao.getRateByLevel(rateEntityParam);
//
if (rateEntity == null) {
//
throw new MyException("费率等级信息为空");
//
}
JSONObject
dto
=
new
JSONObject
();
dto
.
put
(
"orderId"
,
MakeOrderNum
.
makeOrderNum
());
//标识请求唯一(非订单号)
String
orderId
=
MakeOrderNum
.
makeOrderNum
();
dto
.
put
(
"orderId"
,
orderId
);
//标识请求唯一(非订单号)
dto
.
put
(
"serviceType"
,
1
);
//服务类型
dto
.
put
(
"merchantId"
,
ComCode
.
INTEGRAL_MERCHANT_ID
);
//商户号
dto
.
put
(
"subMerchantName"
,
request
.
getRealName
()
);
//对公的就按照营业执照的注册名称进行商户名的报备进件,个体户的需要突出省,市,区一级营业范围,如:“XX市+XX区+法人名称+营业范围”--例“北京市朝阳区洪新阳饭店”而且一个身份证不要重复入很多个做银联二维码交易的商户 原则上一个身份证下只有一个做银联二维码交易的户,23:00—7:00,这段时间,银联二维码可以交易,不结算
dto
.
put
(
"subMerchantName"
,
request
.
getRealName
()
+
orderId
);
//对公的就按照营业执照的注册名称进行商户名的报备进件,个体户的需要突出省,市,区一级营业范围,如:“XX市+XX区+法人名称+营业范围”--例“北京市朝阳区洪新阳饭店”而且一个身份证不要重复入很多个做银联二维码交易的商户 原则上一个身份证下只有一个做银联二维码交易的户,23:00—7:00,这段时间,银联二维码可以交易,不结算
dto
.
put
(
"accName"
,
request
.
getRealName
());
//开户名称
dto
.
put
(
"accNo"
,
request
.
getCardNo
());
//开户账号
...
...
@@ -359,7 +360,7 @@ public class UserApiService {
dto
.
put
(
"bankCode"
,
request
.
getBelongBank
());
//联行号
dto
.
put
(
"mobile"
,
request
.
getMobile
());
dto
.
put
(
"idNo"
,
request
.
getIdCard
());
//身份证号
dto
.
put
(
"settleType"
,
"177631"
);
//费率类型 795934
dto
.
put
(
"settleType"
,
Global
.
getConfig
(
"pay.settle.type"
)
);
//费率类型 795934
dto
.
put
(
"address"
,
request
.
getCardPlace
());
//地址
dto
.
put
(
"merchantKey"
,
ComCode
.
INTEGRAL_MERCHANT_KEY
);
//商户key
dto
.
put
(
"timestamp"
,
System
.
currentTimeMillis
());
//时间戳
...
...
src/main/resources/youka.properties
View file @
ce49c9a1
...
...
@@ -107,8 +107,9 @@ image.return.url=youka-api/image/
#ali接口获取银行logo
logo.bank.url
=
https://apimg.alipay.com/combo.png?d=cashier&t=
#
#
# 快捷支付相关
pay.y
=
0
pay.settle.type
=
177631
## 短信相关
message.username
=
710047
...
...
@@ -122,5 +123,6 @@ weixin.merchant.id = 1489100872
weixin.appid
=
wx6a278e46e075d9f6
weixin.appsecret
=
libo13821934497libo1382193449700
## 支付宝相关
alipay.appid
=
2018041002530242
alipay.appid
=
2018041002530242
\ No newline at end of file
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