记得上下班打卡 | 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
4637c8fd
Commit
4637c8fd
authored
Jul 30, 2021
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下单请求加密增加日志
parent
1894f164
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
118 additions
and
101 deletions
+118
-101
DragonPayBiz.java
...net/service/dragon/channel/strategy/biz/DragonPayBiz.java
+10
-1
DragonPayTest.java
...pl/src/test/java/com/liquidnet/service/DragonPayTest.java
+108
-100
No files found.
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/channel/strategy/biz/DragonPayBiz.java
View file @
4637c8fd
...
...
@@ -18,6 +18,7 @@ import org.springframework.stereotype.Component;
import
org.springframework.util.MultiValueMap
;
import
java.time.LocalDateTime
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -90,7 +91,7 @@ public class DragonPayBiz {
params
.
add
(
"price"
,
payNotifyDto
.
getPrice
().
toString
());
params
.
add
(
"paymentType"
,
payNotifyDto
.
getPaymentType
());
params
.
add
(
"paymentAt"
,
payNotifyDto
.
getPaymentAt
());
jsonData
=
JsonUtils
.
toJson
(
params
);
jsonData
=
JsonUtils
.
toJson
(
covertNVPS2Params
(
params
)
);
log
.
info
(
"dragon:notify:post url:{}"
,
payNotifyReqBo
.
getNotifyUrl
());
log
.
info
(
"dragon:notify:post data:{}"
,
jsonData
);
...
...
@@ -205,4 +206,12 @@ public class DragonPayBiz {
}
return
rsMap
;
}
private
static
Map
<
String
,
Object
>
covertNVPS2Params
(
MultiValueMap
<
String
,
String
>
params
)
{
Map
<
String
,
Object
>
rsMap
=
new
HashMap
<>();
for
(
Map
.
Entry
<
String
,
List
<
String
>>
param
:
params
.
entrySet
())
{
rsMap
.
put
(
param
.
getKey
(),
param
.
getValue
().
get
(
0
));
}
return
rsMap
;
}
}
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/test/java/com/liquidnet/service/DragonPayTest.java
View file @
4637c8fd
//package com.liquidnet.service;
//
//import com.alibaba.fastjson.JSON;
//import com.liquidnet.commons.lang.util.JsonUtils;
//import com.liquidnet.service.dragon.utils.ObjectUtil;
//import org.apache.http.NameValuePair;
//import org.apache.http.message.BasicNameValuePair;
//import org.springframework.util.MultiValueMap;
//
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * @author AnJiabin <anjiabin@zhengzai.tv>
// * @version V1.0
// * @Description: TODO
// * @class: DragonPayTest
// * @Package com.liquidnet.service
// * @Copyright: LightNet @ Copyright (c) 2021
// * @date 2021/7/27 13:47
// */
////@RunWith(SpringJUnit4ClassRunner.class)
////@SpringBootTest
//public class DragonPayTest {
//
// public static void testMap(){
// List<NameValuePair> nvps = new ArrayList<NameValuePair>();
// nvps.add(new BasicNameValuePair("status", "1"));
// nvps.add(new BasicNameValuePair("type", "TICKET"));
// nvps.add(new BasicNameValuePair("code", "PAY20210727111746415639688"));
// nvps.add(new BasicNameValuePair("paymentId", "4200001121202107274119605305"));
// nvps.add(new BasicNameValuePair("orderCode", "11766977997930496418880635"));
// nvps.add(new BasicNameValuePair("price", "0.01"));
// nvps.add(new BasicNameValuePair("paymentType", "APPWEPAY"));
// nvps.add(new BasicNameValuePair("paymentAt", "2021-07-27 11:18:03"));
// String jsonData = JSON.toJSONString(nvps);
// System.out.println("jsonDate === "+jsonData);
// System.out.println("covertNVPS2Params jsonDate === "+covertNVPS2Params(nvps));
// System.out.println("covertNVPS2Params jsonDate === "+ JsonUtils.toJson(covertNVPS2Params(nvps)));
// System.out.println("covertNVPS2KeyValue jsonDate === "+ covertNVPS2KeyValue(nvps));
// }
//
// public static void testMap2() {
// MultiValueMap<String, String> params = ObjectUtil.cloneLinkedMultiValueMapStringAndString();
// params.add("status", "1");
// params.add("type", "TICKET");
// params.add("code","PAY20210727111746415639688");
// params.add("paymentId", "4200001121202107274119605305");
// params.add("orderCode", "11766977997930496418880635");
// params.add("price", "0.01");
// params.add("paymentType", "APPWEPAY");
// params.add("paymentAt", "2021-07-27 11:18:03");
// String jsonData = JsonUtils.toJson(params);
// System.out.println("jsonData === "+jsonData);
// System.out.println("jsonData === " + covertNVPS2KeyValue(params));
// }
// private static ArrayList<NameValuePair> covertParams2NVPS(Map<String, Object> params) {
// ArrayList<NameValuePair> pairs = new ArrayList<NameValuePair>();
// for (Map.Entry<String, Object> param : params.entrySet()) {
// pairs.add(new BasicNameValuePair(param.getKey(), String.valueOf(param.getValue())));
// }
//
// return pairs;
// }
// private static ArrayList<NameValuePair> covertParams2NVPS(MultiValueMap<String, String> params) {
// ArrayList<NameValuePair> pairs = new ArrayList<NameValuePair>();
// for (Map.Entry<String, List<String>>param : params.entrySet()) {
// pairs.add(new BasicNameValuePair(param.getKey(), param.getValue()));
// }
//
// return pairs;
// }
// private static Map<String, Object> covertNVPS2Params(List<NameValuePair> nvpList) {
// Map<String, Object> rsMap = new HashMap<>();
// for (NameValuePair nameValuePair : nvpList) {
// rsMap.put(nameValuePair.getName(),nameValuePair.getValue());
// }
// return rsMap;
// }
//
// private static String covertNVPS2KeyValue(List<NameValuePair> nvpList) {
// StringBuffer sb = new StringBuffer();
// for (NameValuePair nameValuePair : nvpList) {
// sb.append(nameValuePair.getName()+":"+nameValuePair.getValue()+"\n");
// }
// return sb.toString();
// }
//
// private static String covertNVPS2KeyValue(Map<String, String> mapParam) {
// ArrayList<NameValuePair> pairs = covertParams2NVPS(mapParam);
// return covertNVPS2KeyValue(pairs);
// }
//
// public static void main(String[] args) {
//
package
com
.
liquidnet
.
service
;
import
com.alibaba.fastjson.JSON
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.dragon.utils.ObjectUtil
;
import
org.apache.http.NameValuePair
;
import
org.apache.http.message.BasicNameValuePair
;
import
org.springframework.util.MultiValueMap
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: DragonPayTest
* @Package com.liquidnet.service
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/7/27 13:47
*/
//@RunWith(SpringJUnit4ClassRunner.class)
//@SpringBootTest
public
class
DragonPayTest
{
public
static
void
testMap
(){
List
<
NameValuePair
>
nvps
=
new
ArrayList
<
NameValuePair
>();
nvps
.
add
(
new
BasicNameValuePair
(
"status"
,
"1"
));
nvps
.
add
(
new
BasicNameValuePair
(
"type"
,
"TICKET"
));
nvps
.
add
(
new
BasicNameValuePair
(
"code"
,
"PAY20210727111746415639688"
));
nvps
.
add
(
new
BasicNameValuePair
(
"paymentId"
,
"4200001121202107274119605305"
));
nvps
.
add
(
new
BasicNameValuePair
(
"orderCode"
,
"11766977997930496418880635"
));
nvps
.
add
(
new
BasicNameValuePair
(
"price"
,
"0.01"
));
nvps
.
add
(
new
BasicNameValuePair
(
"paymentType"
,
"APPWEPAY"
));
nvps
.
add
(
new
BasicNameValuePair
(
"paymentAt"
,
"2021-07-27 11:18:03"
));
String
jsonData
=
JSON
.
toJSONString
(
nvps
);
System
.
out
.
println
(
"jsonDate === "
+
jsonData
);
System
.
out
.
println
(
"covertNVPS2Params jsonDate === "
+
covertNVPS2Params
(
nvps
));
System
.
out
.
println
(
"covertNVPS2Params jsonDate === "
+
JsonUtils
.
toJson
(
covertNVPS2Params
(
nvps
)));
System
.
out
.
println
(
"covertNVPS2KeyValue jsonDate === "
+
covertNVPS2KeyValue
(
nvps
));
}
public
static
void
testMap2
()
{
MultiValueMap
<
String
,
String
>
params
=
ObjectUtil
.
cloneLinkedMultiValueMapStringAndString
();
params
.
add
(
"status"
,
"1"
);
params
.
add
(
"type"
,
"TICKET"
);
params
.
add
(
"code"
,
"PAY20210727111746415639688"
);
params
.
add
(
"paymentId"
,
"4200001121202107274119605305"
);
params
.
add
(
"orderCode"
,
"11766977997930496418880635"
);
params
.
add
(
"price"
,
"0.01"
);
params
.
add
(
"paymentType"
,
"APPWEPAY"
);
params
.
add
(
"paymentAt"
,
"2021-07-27 11:18:03"
);
String
jsonData
=
JsonUtils
.
toJson
(
params
);
System
.
out
.
println
(
"jsonData === "
+
jsonData
);
System
.
out
.
println
(
"jsonData === "
+
JsonUtils
.
toJson
(
covertNVPS2Params
(
params
)));
}
private
static
ArrayList
<
NameValuePair
>
covertParams2NVPS
(
Map
<
String
,
Object
>
params
)
{
ArrayList
<
NameValuePair
>
pairs
=
new
ArrayList
<
NameValuePair
>();
for
(
Map
.
Entry
<
String
,
Object
>
param
:
params
.
entrySet
())
{
pairs
.
add
(
new
BasicNameValuePair
(
param
.
getKey
(),
String
.
valueOf
(
param
.
getValue
())));
}
return
pairs
;
}
private
static
ArrayList
<
NameValuePair
>
covertParams2NVPS
(
MultiValueMap
<
String
,
String
>
params
)
{
ArrayList
<
NameValuePair
>
pairs
=
new
ArrayList
<
NameValuePair
>();
for
(
Map
.
Entry
<
String
,
List
<
String
>>
param
:
params
.
entrySet
())
{
pairs
.
add
(
new
BasicNameValuePair
(
param
.
getKey
(),
param
.
getValue
().
get
(
0
)));
}
return
pairs
;
}
private
static
Map
<
String
,
Object
>
covertNVPS2Params
(
List
<
NameValuePair
>
nvpList
)
{
Map
<
String
,
Object
>
rsMap
=
new
HashMap
<>();
for
(
NameValuePair
nameValuePair
:
nvpList
)
{
rsMap
.
put
(
nameValuePair
.
getName
(),
nameValuePair
.
getValue
());
}
return
rsMap
;
}
private
static
String
covertNVPS2KeyValue
(
List
<
NameValuePair
>
nvpList
)
{
StringBuffer
sb
=
new
StringBuffer
();
for
(
NameValuePair
nameValuePair
:
nvpList
)
{
sb
.
append
(
nameValuePair
.
getName
()+
":"
+
nameValuePair
.
getValue
()+
"\n"
);
}
return
sb
.
toString
();
}
private
static
String
covertNVPS2KeyValue
(
MultiValueMap
<
String
,
String
>
mapParam
)
{
ArrayList
<
NameValuePair
>
pairs
=
covertParams2NVPS
(
mapParam
);
return
covertNVPS2KeyValue
(
pairs
);
}
private
static
Map
<
String
,
Object
>
covertNVPS2Params
(
MultiValueMap
<
String
,
String
>
params
)
{
Map
<
String
,
Object
>
rsMap
=
new
HashMap
<>();
for
(
Map
.
Entry
<
String
,
List
<
String
>>
param
:
params
.
entrySet
())
{
rsMap
.
put
(
param
.
getKey
(),
param
.
getValue
().
get
(
0
));
}
return
rsMap
;
}
public
static
void
main
(
String
[]
args
)
{
// testMap();
//
testMap2();
//
}
//
}
testMap2
();
}
}
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