记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
董敬伟
liquidnet-bus-v1
Commits
2196c840
Commit
2196c840
authored
Jul 09, 2021
by
jiangxiulong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test'
parents
3dd62637
e6dd4f3f
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
154 additions
and
406 deletions
+154
-406
IDragonOrderRefundsService.java
...et/service/dragon/service/IDragonOrderRefundsService.java
+16
-0
HttpClientUtils.java
...et/client/admin/zhengzai/kylin/utils/HttpClientUtils.java
+0
-314
ShunfengSignUtils.java
.../client/admin/zhengzai/kylin/utils/ShunfengSignUtils.java
+0
-48
AdamEntersController.java
...quidnet/service/adam/controller/AdamEntersController.java
+5
-5
errors.properties
...et-service-adam-impl/src/main/resources/errors.properties
+5
-0
pom.xml
...dnet-service-dragon/liquidnet-service-dragon-impl/pom.xml
+5
-0
RefundController.java
...liquidnet/service/dragon/controller/RefundController.java
+9
-10
DragonOrderRefundsServiceImpl.java
...ce/dragon/service/impl/DragonOrderRefundsServiceImpl.java
+39
-9
PayAlipayUtils.java
...va/com/liquidnet/service/dragon/utils/PayAlipayUtils.java
+45
-0
PayWepayUtils.java
...ava/com/liquidnet/service/dragon/utils/PayWepayUtils.java
+11
-8
OrderUtils.java
...in/java/com/liquidnet/service/order/utils/OrderUtils.java
+6
-6
ShunfengSignUtils.java
...m/liquidnet/service/platform/utils/ShunfengSignUtils.java
+13
-6
No files found.
liquidnet-bus-api/liquidnet-service-dragon-api/src/main/java/com/liquidnet/service/dragon/service/IDragonOrderRefundsService.java
View file @
2196c840
package
com
.
liquidnet
.
service
.
dragon
.
service
;
package
com
.
liquidnet
.
service
.
dragon
.
service
;
import
java.math.BigDecimal
;
public
interface
IDragonOrderRefundsService
{
public
interface
IDragonOrderRefundsService
{
void
sendRedisQueue
();
void
sendRedisQueue
();
/**
*
* @param trade_no => refund_code
* @param out_trade_no => pay_code
* @param reason
* @param returnUrl
* @param price 退款金额
*/
void
dragonRefund
(
String
trade_no
,
String
out_trade_no
,
String
reason
,
String
returnUrl
,
BigDecimal
price
);
void
weyPayRefund
();
void
aliPayRefund
(
String
trade_no
,
String
out_trade_no
,
String
reason
,
String
returnUrl
,
BigDecimal
price
);
}
}
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/kylin/utils/HttpClientUtils.java
deleted
100644 → 0
View file @
3dd62637
This diff is collapsed.
Click to expand it.
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/kylin/utils/ShunfengSignUtils.java
View file @
2196c840
package
com
.
liquidnet
.
client
.
admin
.
zhengzai
.
kylin
.
utils
;
package
com
.
liquidnet
.
client
.
admin
.
zhengzai
.
kylin
.
utils
;
import
com.liquidnet.client.admin.common.utils.http.HttpUtils
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.base.UserPathDto
;
import
com.liquidnet.service.base.UserPathDto
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -8,20 +7,15 @@ import org.apache.commons.codec.binary.Base64;
...
@@ -8,20 +7,15 @@ import org.apache.commons.codec.binary.Base64;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.conn.ssl.NoopHostnameVerifier
;
import
org.apache.http.conn.ssl.SSLConnectionSocketFactory
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.ssl.SSLContexts
;
import
org.apache.http.util.EntityUtils
;
import
org.apache.http.util.EntityUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.net.ssl.SSLContext
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -78,56 +72,14 @@ public class ShunfengSignUtils {
...
@@ -78,56 +72,14 @@ public class ShunfengSignUtils {
headers
.
put
(
"Accept"
,
"application/json"
);
headers
.
put
(
"Accept"
,
"application/json"
);
Map
<
String
,
String
>
querys
=
new
HashMap
<>();
Map
<
String
,
String
>
querys
=
new
HashMap
<>();
try
{
try
{
// HttpResponse httpResponse = HttpClientUtils.doPost(URL, url, "", headers, querys, body);
// HttpEntity httpEntity = new HttpEntity(body, "utf-8");
// HttpEntity httpEntity = new HttpEntity(body, "utf-8");
HttpEntity
httpEntity
=
new
StringEntity
(
body
,
"utf-8"
);
HttpEntity
httpEntity
=
new
StringEntity
(
body
,
"utf-8"
);
String
post
=
HttpsUtils
.
post
(
URL
+
url
,
headers
,
querys
,
httpEntity
);
String
post
=
HttpsUtils
.
post
(
URL
+
url
,
headers
,
querys
,
httpEntity
);
return
post
;
return
post
;
// HttpResponse httpResponse = HttpsUtils.post(URL+url, headers, querys, httpEntity);
/*if (httpResponse.getStatusLine().getStatusCode() == 200) {
System.out.println("发送请求成功");
HttpEntity entity = httpResponse.getEntity();
// 发送响应且编码UTF8!!!
return EntityUtils.toString(entity, "utf-8");
}*/
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"发送请求失败"
);
System
.
out
.
println
(
"发送请求失败"
);
e
.
printStackTrace
();
e
.
printStackTrace
();
return
e
.
getMessage
();
return
e
.
getMessage
();
}
}
// return null;
}
/**
* 生成签名并请求
* @param hbody 请求body
* @return
*/
public
String
generateSignatureAndRequestNew2
(
Map
<
String
,
String
>
hbody
,
String
url
)
{
long
currentTimeMillis
=
System
.
currentTimeMillis
();
// 时间戳
String
timestamp
=
currentTimeMillis
+
""
;
hbody
.
put
(
"companyId"
,
APP_ID
);
String
body
=
JsonUtils
.
toJson
(
hbody
);
// 生成签名
String
sign
=
genSign
(
timestamp
,
body
);
Map
<
String
,
String
>
headers
=
new
HashMap
<>();
headers
.
put
(
"sendAppId"
,
APP_ID
);
headers
.
put
(
"timestamp"
,
timestamp
);
headers
.
put
(
"sign"
,
sign
);
headers
.
put
(
"Content-Type"
,
"application/json;charset=utf-8"
);
headers
.
put
(
"Accept"
,
"application/json"
);
try
{
String
sss
=
HttpUtils
.
sendSSLPost
(
URL
+
url
,
body
);
System
.
out
.
println
(
"发送请求成功"
);
System
.
out
.
println
(
sss
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"发送请求失败"
);
e
.
printStackTrace
();
return
e
.
getMessage
();
}
return
null
;
}
}
/**
/**
...
...
liquidnet-bus-service/liquidnet-service-adam/liquidnet-service-adam-impl/src/main/java/com/liquidnet/service/adam/controller/AdamEntersController.java
View file @
2196c840
...
@@ -62,25 +62,25 @@ public class AdamEntersController {
...
@@ -62,25 +62,25 @@ public class AdamEntersController {
break
;
break
;
case
2
:
case
2
:
if
(!
Pattern
.
matches
(
LnsRegex
.
Valid
.
CN_ID_CARD_HM
,
parameter
.
getIdCard
()))
{
if
(!
Pattern
.
matches
(
LnsRegex
.
Valid
.
CN_ID_CARD_HM
,
parameter
.
getIdCard
()))
{
return
ResponseDto
.
failure
(
Error
Code
.
HTTP_PARAM_ERROR
.
getCode
(),
"港澳居民来往内地通行证号码不合规"
);
return
ResponseDto
.
failure
(
Error
Mapping
.
get
(
"10107"
)
);
}
}
break
;
break
;
case
3
:
case
3
:
if
(!
Pattern
.
matches
(
LnsRegex
.
Valid
.
CN_ID_CARD_TW
,
parameter
.
getIdCard
()))
{
if
(!
Pattern
.
matches
(
LnsRegex
.
Valid
.
CN_ID_CARD_TW
,
parameter
.
getIdCard
()))
{
return
ResponseDto
.
failure
(
Error
Code
.
HTTP_PARAM_ERROR
.
getCode
(),
"台湾居民来往大陆通行证号码不合规"
);
return
ResponseDto
.
failure
(
Error
Mapping
.
get
(
"10108"
)
);
}
}
break
;
break
;
case
4
:
case
4
:
if
(
Pattern
.
matches
(
LnsRegex
.
Valid
.
CN_ID_CARD_PP
,
parameter
.
getIdCard
()))
{
if
(
Pattern
.
matches
(
LnsRegex
.
Valid
.
CN_ID_CARD_PP
,
parameter
.
getIdCard
()))
{
return
ResponseDto
.
failure
(
Error
Code
.
HTTP_PARAM_ERROR
.
getCode
(),
"不支持中国大陆护照"
);
return
ResponseDto
.
failure
(
Error
Mapping
.
get
(
"10109"
)
);
}
}
if
(!
Pattern
.
matches
(
LnsRegex
.
Valid
.
CN_ID_CARD_PP_NON
,
parameter
.
getIdCard
()))
{
if
(!
Pattern
.
matches
(
LnsRegex
.
Valid
.
CN_ID_CARD_PP_NON
,
parameter
.
getIdCard
()))
{
return
ResponseDto
.
failure
(
Error
Code
.
HTTP_PARAM_ERROR
.
getCode
(),
"护照号码不合规"
);
return
ResponseDto
.
failure
(
Error
Mapping
.
get
(
"10110"
)
);
}
}
break
;
break
;
case
5
:
case
5
:
if
(!
Pattern
.
matches
(
LnsRegex
.
Valid
.
CN_ID_CARD_MO
,
parameter
.
getIdCard
()))
{
if
(!
Pattern
.
matches
(
LnsRegex
.
Valid
.
CN_ID_CARD_MO
,
parameter
.
getIdCard
()))
{
return
ResponseDto
.
failure
(
Error
Code
.
HTTP_PARAM_ERROR
.
getCode
(),
"军官证号不合规"
);
return
ResponseDto
.
failure
(
Error
Mapping
.
get
(
"10111"
)
);
}
}
break
;
break
;
}
}
...
...
liquidnet-bus-service/liquidnet-service-adam/liquidnet-service-adam-impl/src/main/resources/errors.properties
View file @
2196c840
...
@@ -31,6 +31,11 @@
...
@@ -31,6 +31,11 @@
10104
=
身份证号码不合规
10104
=
身份证号码不合规
10105
=
入场人不存在
10105
=
入场人不存在
10106
=
收获地址不存在
10106
=
收获地址不存在
10107
=
港澳居民来往内地通行证号码不合规
10108
=
台湾居民来往大陆通行证号码不合规
10109
=
不支持中国大陆护照
10110
=
护照号码不合规
10111
=
军官证号不合规
10200
=
仅限从未购买过会员的用户使用
10200
=
仅限从未购买过会员的用户使用
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/pom.xml
View file @
2196c840
...
@@ -30,6 +30,11 @@
...
@@ -30,6 +30,11 @@
<artifactId>
wechatpay-apache-httpclient
</artifactId>
<artifactId>
wechatpay-apache-httpclient
</artifactId>
<version>
0.2.2
</version>
<version>
0.2.2
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.alipay.sdk
</groupId>
<artifactId>
alipay-sdk-java
</artifactId>
<version>
4.15.6.ALL
</version>
</dependency>
</dependencies>
</dependencies>
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/controller/RefundController.java
View file @
2196c840
package
com
.
liquidnet
.
service
.
dragon
.
controller
;
package
com
.
liquidnet
.
service
.
dragon
.
controller
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.dragon.service.IDragonOrderRefundsService
;
import
com.liquidnet.service.dragon.service.IDragonOrderRefundsService
;
import
com.liquidnet.service.dragon.utils.PayUtils
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponse
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.util.EntityUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.io.ByteArrayOutputStream
;
@RestController
@RestController
@RequestMapping
(
"refund"
)
@RequestMapping
(
"refund"
)
public
class
RefundController
{
public
class
RefundController
{
...
@@ -26,10 +17,18 @@ public class RefundController {
...
@@ -26,10 +17,18 @@ public class RefundController {
IDragonOrderRefundsService
orderRefundsService
;
IDragonOrderRefundsService
orderRefundsService
;
@PostMapping
(
"preTest"
)
@PostMapping
(
"preTest"
)
@ApiOperation
(
"
发送测试退款redis
"
)
@ApiOperation
(
"
微信退款
"
)
@ApiResponse
(
code
=
200
,
message
=
"接口返回对象参数"
)
@ApiResponse
(
code
=
200
,
message
=
"接口返回对象参数"
)
public
ResponseDto
<
String
>
checkCanOrder
()
{
public
ResponseDto
<
String
>
checkCanOrder
()
{
orderRefundsService
.
sendRedisQueue
();
orderRefundsService
.
sendRedisQueue
();
return
ResponseDto
.
success
();
return
ResponseDto
.
success
();
}
}
@PostMapping
(
"refundAliPay"
)
@ApiOperation
(
"支付宝退款"
)
@ApiResponse
(
code
=
200
,
message
=
"接口返回对象参数"
)
public
ResponseDto
<
String
>
refundAliPay
()
{
// orderRefundsService.aliPayRefund();
return
ResponseDto
.
success
();
}
}
}
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/service/impl/DragonOrderRefundsServiceImpl.java
View file @
2196c840
package
com
.
liquidnet
.
service
.
dragon
.
service
.
impl
;
package
com
.
liquidnet
.
service
.
dragon
.
service
.
impl
;
import
com.alipay.api.AlipayClient
;
import
com.alipay.api.DefaultAlipayClient
;
import
com.alipay.api.request.AlipayTradeRefundRequest
;
import
com.alipay.api.response.AlipayTradeRefundResponse
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.dragon.service.IDragonOrderRefundsService
;
import
com.liquidnet.service.dragon.service.IDragonOrderRefundsService
;
import
com.liquidnet.service.dragon.utils.PayUtils
;
import
com.liquidnet.service.dragon.utils.PayAlipayUtils
;
import
com.liquidnet.service.dragon.utils.PayWepayUtils
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.util.EntityUtils
;
import
org.apache.http.util.EntityUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.connection.stream.MapRecord
;
import
org.springframework.data.redis.connection.stream.StreamRecords
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.
util.HashMap
;
import
java.
math.BigDecimal
;
@Service
@Service
public
class
DragonOrderRefundsServiceImpl
implements
IDragonOrderRefundsService
{
public
class
DragonOrderRefundsServiceImpl
implements
IDragonOrderRefundsService
{
...
@@ -36,7 +38,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
...
@@ -36,7 +38,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
// }
// }
try
{
try
{
Pay
Utils
payUtils
=
new
P
ayUtils
();
Pay
WepayUtils
payWepayUtils
=
new
PayWep
ayUtils
();
HttpPost
httpPost
=
new
HttpPost
(
"https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi"
);
HttpPost
httpPost
=
new
HttpPost
(
"https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi"
);
httpPost
.
addHeader
(
"Accept"
,
"application/json"
);
httpPost
.
addHeader
(
"Accept"
,
"application/json"
);
httpPost
.
addHeader
(
"Content-type"
,
"application/json; charset=utf-8"
);
httpPost
.
addHeader
(
"Content-type"
,
"application/json; charset=utf-8"
);
...
@@ -53,18 +55,46 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
...
@@ -53,18 +55,46 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
rootNode
.
putObject
(
"amount"
)
rootNode
.
putObject
(
"amount"
)
.
put
(
"total"
,
1
);
.
put
(
"total"
,
1
);
rootNode
.
putObject
(
"payer"
)
rootNode
.
putObject
(
"payer"
)
.
put
(
"openid"
,
"oUp
F8uMuAJO_M2pxb1Q9zNjWeS6o
"
);
.
put
(
"openid"
,
"oUp
kkuHUgiyTYE4ZU8Y5Sga-znWQ
"
);
objectMapper
.
writeValue
(
bos
,
rootNode
);
objectMapper
.
writeValue
(
bos
,
rootNode
);
httpPost
.
setEntity
(
new
StringEntity
(
bos
.
toString
(
"UTF-8"
),
"UTF-8"
));
httpPost
.
setEntity
(
new
StringEntity
(
bos
.
toString
(
"UTF-8"
),
"UTF-8"
));
CloseableHttpResponse
response
=
payUtils
.
getHttpClient
().
execute
(
httpPost
);
CloseableHttpResponse
response
=
pay
Wepay
Utils
.
getHttpClient
().
execute
(
httpPost
);
String
bodyAsString
=
EntityUtils
.
toString
(
response
.
getEntity
());
String
bodyAsString
=
EntityUtils
.
toString
(
response
.
getEntity
());
System
.
out
.
println
(
bodyAsString
);
System
.
out
.
println
(
bodyAsString
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
@Override
public
void
dragonRefund
(
String
trade_no
,
String
out_trade_no
,
String
reason
,
String
returnUrl
,
BigDecimal
price
)
{
}
@Override
public
void
weyPayRefund
()
{
}
@Override
public
void
aliPayRefund
(
String
trade_no
,
String
out_trade_no
,
String
reason
,
String
returnUrl
,
BigDecimal
price
)
{
PayAlipayUtils
payAlipayUtils
=
new
PayAlipayUtils
();
try
{
AlipayTradeRefundRequest
request
=
new
AlipayTradeRefundRequest
();
//创建API对应的request类
request
.
setBizContent
(
"{"
+
"\"out_trade_no\":\"20210708171331569350143233340P\","
+
"\"trade_no\":\"2021070822001417381433077659\","
+
"\"out_request_no\":\"20210708145709112413077422058T\","
+
"\"refund_amount\":\"0.01\"}"
);
//设置业务参数
AlipayTradeRefundResponse
response
=
PayAlipayUtils
.
getHttpClient
().
execute
(
request
);
//通过alipayClient调用API,获得对应的response类
System
.
out
.
print
(
response
.
getBody
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
}
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/utils/PayAlipayUtils.java
0 → 100644
View file @
2196c840
package
com
.
liquidnet
.
service
.
dragon
.
utils
;
import
com.alipay.api.AlipayClient
;
import
com.alipay.api.DefaultAlipayClient
;
import
com.alipay.api.request.AlipayTradeRefundRequest
;
import
com.alipay.api.response.AlipayTradeRefundResponse
;
import
com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder
;
import
com.wechat.pay.contrib.apache.httpclient.auth.AutoUpdateCertificatesVerifier
;
import
com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner
;
import
com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Credentials
;
import
com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Validator
;
import
com.wechat.pay.contrib.apache.httpclient.util.PemUtil
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.client.utils.URIBuilder
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.util.EntityUtils
;
import
java.io.FileInputStream
;
import
java.net.URL
;
import
java.security.PrivateKey
;
public
class
PayAlipayUtils
{
private
static
AlipayClient
httpClient
;
private
static
PayAlipayUtils
instance
=
new
PayAlipayUtils
();
private
String
appId
=
"2019082866535131"
;
private
String
merchant_pub_key
=
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmePaETscydypY3rV4mXa8MtcQIL5zjP1KxdusNkHpePeU61hAZxKn0Z8pDB1wNaTK72wgEWaORXeRp4YTbf4usHlW562Pe5wdiSutb3iT6EMJ5eBD4HLI9wWDgYBtwfHwS5JJFhf0eptP4R1XluLiMhmMynLwJvHepgkVrS3mN+jmoPRmKFhZHGIYDoWypBMbUKiFHWiToHK1n0NYHHIi4WgK2wt4Wj7nexQGD69W7ofRCirYmz35c/cNFUA1lqzOEKu2z7PpjA6jQV2GJolnJ4xXPJ8Dpgp4g/dgsGqRydlmFqZD71i/pDDpF0RfRKHL+WhWVhI1hqe6jLtvJE+zQIDAQAB"
;
private
String
merchant_private_key
=
"MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCArhnBTpcAww8wSYBTwGp6oBvenzCCYFrugERgxJDZ7YnBZ3ZdiAaHjJ9PI0WymkpDr27FSg9czVbiH7G91zPq+8s9onrZi/l6cBZ2VjrwQ9BQPN2a8zHy8D6BfoKEV+PIicGz6hNPA7lgf04NgsXeWjeXnYD/IBTLZmnCxB2sPYo/0EN32mlSG9snO63HlPkoqn8ycw71a1cBrlQ+Y22fFnJAk/vrGoou8E0UHfL5zVE/up+ToOYW/eOKMFL/DSceCy32t9Za0RmpV3i2E9s8gBDewzT10Yf4+4mPUiTR6AhcLjqafAy2IaKPK57WZ6cGF9cGs9yq8bSTRpeNC4alAgMBAAECggEAH0Ms+qvPP94j6IVS6gYLWHNhkfp23JXwQZVkB2Z6EpgFKbmrJhoQDAp8Acv9+OBHPp52ePP/O3qfqxwsIIUSFfrKa9T3p7a8C6UDsAhPFWRETdobtLN05SK87NUBfImly2i8aKtruXycIveKzPmCfPzKGMmpN1Jh+vCMrUbcNqX8OUcxmhGvJwnQuBW4QEiepzl89Nl91iSwFmxaZoqLaB9lYUKke/z7FDHTpTWpZvtvxlZ0gvMVNLVp9NBNazolQ8eEjBG2PsQGD2cLUbM33mLTz+/VQjzZR3KXu5kQR9MloURILDsdxE1AyA4AkIXd4eMszEjA4Dv6CQK/jjrsgQKBgQDIiCt1OGmV2sqDBSn4nZNH7BzY3Hdnf+qsYUi+TXKhnQaT8XPKWZpKE/AcqsIKnANmO4sX0NL7ACBe7Rl1RcU9Mq5XuHhnkveFBVRRIHindzUfEN0WgdLy23qmJ2N+1i4FigelY0E5T2lojVb7wycAgAc6vflwE+eYf8W3968q0QKBgQCkRgsVCWWNMSLZeB0V9LV3Om2/UPWY/ovadTxAQtxg0Z75V6Wdu8u0hrYaPSeUK2ryaoE6HKgp7U8NiJGzgm2wpj7D2ysrPmhX5+CjiWkDMCuvWytVT7hLqhhLp7frZT39u8VhyfC8lE0xA67gAPsGSl1sBoZPwvvsmNAQ/h6rlQKBgQCtCtw9be2m88M3JnieYhOax8Po2u5qsLZoBBcKqLhXf7ISbhPWNFXwwJ29jxicoR5J1O3lIj09fVFxuLX0Pb3DXn2VksjLz8Wp0vx8eUHEeRis8xdleaf4C68du/WemOHjw8VvUWQSOVWjc/vwiumYA+K5LQAXWAXM0c1jP+e3UQKBgEWY/1z8TDATn0Yvo3MH6FIJSTIDJOqa/bmibdJ0AVZruUS+o4Y+aEGlyUU4n6og8wCdqv5p4b1Rs2pyb/hzy/FJndHw60s495A2x2/B6eHV6Mw0fhl42wYDnKOA/WUX0bnMcgXKPtpGoqWff9mb0L6LhyUbZpAodf95hr2MTIY5AoGBAIyPtYP6jRyR980h/Ud1MS0fBxymjQrR+kg3GWjnw0ZJJ8yFEXxDqLV8uLyXQKc89HGbI0cClWgZBTjfIPJ5U4Gl19Xlwx1SFrdgg5mGUqnMARTg7w1TG5QLSqNhZo2jgBM5FCJRbDUCO/MzLcFhTeGNva9yP7E7gW5/Dott9D7d"
;
private
String
sign_type
=
"RSA2"
;
private
String
charset
=
"utf-8"
;
private
String
gatewayUrl
=
"https://openapi.alipay.com/gateway.do"
;
public
PayAlipayUtils
()
{
httpClient
=
new
DefaultAlipayClient
(
gatewayUrl
,
appId
,
merchant_private_key
,
"json"
,
charset
,
merchant_pub_key
,
sign_type
);
//获得初始化的AlipayClient
}
private
static
PayAlipayUtils
getInstance
()
{
return
instance
;
}
public
static
AlipayClient
getHttpClient
()
{
return
httpClient
;
}
}
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/utils/PayUtils.java
→
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/utils/Pay
Wepay
Utils.java
View file @
2196c840
...
@@ -6,27 +6,30 @@ import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner;
...
@@ -6,27 +6,30 @@ import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner;
import
com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Credentials
;
import
com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Credentials
;
import
com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Validator
;
import
com.wechat.pay.contrib.apache.httpclient.auth.WechatPay2Validator
;
import
com.wechat.pay.contrib.apache.httpclient.util.PemUtil
;
import
com.wechat.pay.contrib.apache.httpclient.util.PemUtil
;
import
org.apache.http.client.HttpClient
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.client.utils.URIBuilder
;
import
org.apache.http.client.utils.URIBuilder
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.util.EntityUtils
;
import
org.apache.http.util.EntityUtils
;
import
java.io.FileInputStream
;
import
java.net.URL
;
import
java.security.PrivateKey
;
import
java.security.PrivateKey
;
import
java.util.Objects
;
public
class
PayUtils
{
public
class
PayWepayUtils
{
private
CloseableHttpClient
httpClient
;
// private static PayUtils instance = new PayUtils();
private
String
merchantId
=
"1551961491"
;
private
String
merchantId
=
"1551961491"
;
private
String
merchantSerialNumber
=
"6D25ECC819EAE0BCEA7DB18F143F0752431D9295"
;
private
String
merchantSerialNumber
=
"6D25ECC819EAE0BCEA7DB18F143F0752431D9295"
;
// private static PayUtils instance = new PayUtils();
private
String
appId
=
"wx3498304dda39c5a1"
;
private
CloseableHttpClient
httpClient
;
private
String
openId
=
"wx3498304dda39c5a1"
;
public
PayUtils
()
{
public
PayWepayUtils
()
{
System
.
out
.
println
(
"1"
);
try
{
try
{
URL
path
=
PayWepayUtils
.
class
.
getClassLoader
().
getResource
(
"payCert/wepay/wepay_apiclient_key.pem"
);
PrivateKey
merchantPrivateKey
=
PemUtil
.
loadPrivateKey
(
PrivateKey
merchantPrivateKey
=
PemUtil
.
loadPrivateKey
(
Objects
.
requireNonNull
(
PayUtils
.
class
.
getClassLoader
().
getResourceAsStream
(
"wepay_apiclient_key.pem"
))
new
FileInputStream
(
path
.
getPath
(
))
);
);
CloseableHttpClient
httpClientTemp
=
WechatPayHttpClientBuilder
.
create
()
CloseableHttpClient
httpClientTemp
=
WechatPayHttpClientBuilder
.
create
()
...
...
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/utils/OrderUtils.java
View file @
2196c840
...
@@ -43,7 +43,7 @@ public class OrderUtils {
...
@@ -43,7 +43,7 @@ public class OrderUtils {
}
else
{
}
else
{
integers
=
roadShowOrderLimit
(
userId
,
idCard
,
performanceId
,
ticketId
,
performanceBuyCount
,
ticketBuyCount
,
isTrueName
);
integers
=
roadShowOrderLimit
(
userId
,
idCard
,
performanceId
,
ticketId
,
performanceBuyCount
,
ticketBuyCount
,
isTrueName
);
}
}
return
judgeMemberType
(
performanceLimitCount
,
performanceMemberLimitCount
,
ticketLimitCount
,
ticketMemberLimitCount
,
memberType
,
integers
[
0
],
integers
[
1
]);
return
judgeMemberType
(
performanceLimitCount
,
performanceMemberLimitCount
,
ticketLimitCount
,
ticketMemberLimitCount
,
memberType
,
integers
[
0
],
integers
[
1
]
,
isTrueName
);
}
}
public
Integer
[]
roadShowOrderLimit
(
public
Integer
[]
roadShowOrderLimit
(
...
@@ -85,20 +85,20 @@ public class OrderUtils {
...
@@ -85,20 +85,20 @@ public class OrderUtils {
return
new
Integer
[]{
performanceBuyCount
,
ticketBuyCount
};
return
new
Integer
[]{
performanceBuyCount
,
ticketBuyCount
};
}
}
public
String
judgeMemberType
(
int
performanceLimitCount
,
int
performanceMemberLimitCount
,
int
ticketLimitCount
,
int
ticketMemberLimitCount
,
int
memberType
,
int
performanceBuyCount
,
int
ticketBuyCount
)
{
public
String
judgeMemberType
(
int
performanceLimitCount
,
int
performanceMemberLimitCount
,
int
ticketLimitCount
,
int
ticketMemberLimitCount
,
int
memberType
,
int
performanceBuyCount
,
int
ticketBuyCount
,
int
isTrueName
)
{
if
(
memberType
==
1
||
memberType
==
2
)
{
if
(
memberType
==
1
||
memberType
==
2
)
{
if
(
performanceBuyCount
>
performanceMemberLimitCount
&&
performanceMemberLimitCount
!=
0
)
{
if
(
performanceBuyCount
>
performanceMemberLimitCount
&&
performanceMemberLimitCount
!=
0
)
{
return
"该演出只能购买"
+
performanceMemberLimitCount
+
"张
"
;
//超过演出维度购买量
return
(
1
==
isTrueName
?
"实名制"
:
"本场"
)
+
"演出限购"
+
performanceMemberLimitCount
+
"张,已超出
"
;
//超过演出维度购买量
}
}
if
(
ticketBuyCount
>
ticketMemberLimitCount
&&
ticketMemberLimitCount
!=
0
)
{
if
(
ticketBuyCount
>
ticketMemberLimitCount
&&
ticketMemberLimitCount
!=
0
)
{
return
"该票种只能购买"
+
ticketMemberLimitCount
+
"张
"
;
//超过票维度购买量
return
(
1
==
isTrueName
?
"实名制"
:
"该"
)
+
"票种限购"
+
ticketMemberLimitCount
+
"张,已超出
"
;
//超过票维度购买量
}
}
}
else
{
//非会员区间
}
else
{
//非会员区间
if
(
performanceBuyCount
>
performanceLimitCount
&&
performanceLimitCount
!=
0
)
{
if
(
performanceBuyCount
>
performanceLimitCount
&&
performanceLimitCount
!=
0
)
{
return
"该演出只能购买"
+
performanceLimitCount
+
"张
"
;
//超过演出维度购买量
return
(
1
==
isTrueName
?
"实名制"
:
"本场"
)
+
"演出限购"
+
performanceLimitCount
+
"张,已超出
"
;
//超过演出维度购买量
}
}
if
(
ticketBuyCount
>
ticketLimitCount
&&
ticketLimitCount
!=
0
)
{
if
(
ticketBuyCount
>
ticketLimitCount
&&
ticketLimitCount
!=
0
)
{
return
"该票种只能购买"
+
ticketLimitCount
+
"张
"
;
//超过票维度购买量
return
(
1
==
isTrueName
?
"实名制"
:
"该"
)
+
"票种限购"
+
ticketLimitCount
+
"张,已超出
"
;
//超过票维度购买量
}
}
}
}
return
""
;
return
""
;
...
...
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/utils/ShunfengSignUtils.java
View file @
2196c840
...
@@ -59,38 +59,45 @@ public class ShunfengSignUtils {
...
@@ -59,38 +59,45 @@ public class ShunfengSignUtils {
* @return
* @return
*/
*/
public
boolean
receiveRequestAndCheckSign
(
String
params
,
HttpServletRequest
request
)
{
public
boolean
receiveRequestAndCheckSign
(
String
params
,
HttpServletRequest
request
)
{
log
.
error
(
"params {}"
,
params
);
log
.
debug
(
"params {}"
,
params
);
log
.
info
(
"params {}"
,
params
);
// 请求方APPID
// 请求方APPID
String
sendAppId
=
request
.
getHeader
(
"sendAppId"
);
String
sendAppId
=
request
.
getHeader
(
"sendAppId"
);
log
.
error
(
"sendAppId {}"
,
sendAppId
);
// 请求方时间戳
// 请求方时间戳
String
timestamp
=
request
.
getHeader
(
"timestamp"
);
String
timestamp
=
request
.
getHeader
(
"timestamp"
);
log
.
error
(
"timestamp {}"
,
timestamp
);
// 请求方签名
// 请求方签名
String
sign
=
request
.
getHeader
(
"sign"
);
String
sign
=
request
.
getHeader
(
"sign"
);
log
.
error
(
"sign {}"
,
sign
);
if
(
StringUtils
.
isBlank
(
sendAppId
))
{
if
(
StringUtils
.
isBlank
(
sendAppId
))
{
System
.
out
.
println
(
"参数sendAppId不能为空"
);
log
.
error
(
"参数sendAppId不能为空"
);
return
false
;
return
false
;
}
}
if
(
StringUtils
.
isBlank
(
timestamp
))
{
if
(
StringUtils
.
isBlank
(
timestamp
))
{
log
.
error
(
"参数timestamp不能为空 {}"
,
""
);
System
.
out
.
println
(
"参数timestamp不能为空"
);
System
.
out
.
println
(
"参数timestamp不能为空"
);
return
false
;
return
false
;
}
}
if
(
StringUtils
.
isBlank
(
sign
))
{
if
(
StringUtils
.
isBlank
(
sign
))
{
System
.
out
.
println
(
"参数sign不能为空"
);
log
.
error
(
"参数sign不能为空"
);
return
false
;
return
false
;
}
}
// 校验签名是否过期
// 校验签名是否过期
long
requestTime
=
Long
.
parseLong
(
timestamp
);
long
requestTime
=
Long
.
parseLong
(
timestamp
);
long
now
=
System
.
currentTimeMillis
();
long
now
=
System
.
currentTimeMillis
();
if
(
Math
.
abs
(
now
-
requestTime
)
>
CHECK_TIME
)
{
if
(
Math
.
abs
(
now
-
requestTime
)
>
CHECK_TIME
)
{
System
.
out
.
println
(
"签名过期!
"
);
log
.
error
(
"签名过期
"
);
return
false
;
return
false
;
}
}
// 请求方参数+请求方时间戳+SK 生成签名
// 请求方参数+请求方时间戳+SK 生成签名
String
thisSign
=
genSign
(
timestamp
,
params
);
String
thisSign
=
genSign
(
timestamp
,
params
);
System
.
out
.
println
(
params
);
log
.
error
(
"thisSign {}"
,
thisSign
);
System
.
out
.
println
(
thisSign
);
// 获取的签名和请求方签名比较是否一致
// 获取的签名和请求方签名比较是否一致
if
(!
thisSign
.
equals
(
sign
))
{
if
(!
thisSign
.
equals
(
sign
))
{
System
.
out
.
println
(
"签名错误"
);
log
.
error
(
"签名错误"
);
return
false
;
return
false
;
}
}
return
true
;
return
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