Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
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
pseer
gxpt_ht
Commits
329c641e
Commit
329c641e
authored
Nov 28, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改对接实现类
parent
dfbf9c83
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
0 deletions
+63
-0
VendingMachineController.java
...share/web/controller/system/VendingMachineController.java
+10
-0
VendingMachineSrevice.java
...main/java/share/system/service/VendingMachineSrevice.java
+4
-0
VendingMachineSreviceImpl.java
.../share/system/service/impl/VendingMachineSreviceImpl.java
+49
-0
No files found.
share-admin/src/main/java/share/web/controller/system/VendingMachineController.java
View file @
329c641e
...
...
@@ -103,4 +103,14 @@ public class VendingMachineController {
public
String
sendOrder
(
SendOrder
sendOrder
)
{
return
vendingMachineSrevice
.
sendOrder
(
sendOrder
);
}
@PostMapping
(
"/pickupCodeCheck"
)
public
void
pickupCodeCheck
(
String
pickupCode
,
String
machineId
)
{
vendingMachineSrevice
.
pickupCodeCheck
(
pickupCode
,
machineId
);
}
@GetMapping
(
"/queryPayInfo"
)
public
void
queryPayInfo
(
String
machineId
,
String
orderSn
)
{
vendingMachineSrevice
.
queryPayInfo
(
machineId
,
orderSn
);
}
}
share-system/src/main/java/share/system/service/VendingMachineSrevice.java
View file @
329c641e
...
...
@@ -39,4 +39,8 @@ public interface VendingMachineSrevice {
String
orderList
(
QueryOrder
queryOrder
);
String
sendOrder
(
SendOrder
sendOrder
);
void
pickupCodeCheck
(
String
pickupCode
,
String
machineId
);
void
queryPayInfo
(
String
machineId
,
String
orderSn
);
}
share-system/src/main/java/share/system/service/impl/VendingMachineSreviceImpl.java
View file @
329c641e
...
...
@@ -477,6 +477,55 @@ public class VendingMachineSreviceImpl implements VendingMachineSrevice {
return
""
;
}
@Override
public
void
pickupCodeCheck
(
String
pickupCode
,
String
machineId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"version"
,
"1.0"
);
map
.
put
(
"pickup_code"
,
pickupCode
);
map
.
put
(
"machine_id"
,
machineId
);
map
.
put
(
"sign_type"
,
"MD5"
);
map
.
put
(
"nonce_str"
,
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
String
sign
=
formatBizQueryParaMap
(
map
,
true
,
false
);
try
{
map
.
put
(
"sign"
,
MD5Util
.
MD5Encode
(
sign
,
"UTF-8"
).
toLowerCase
());
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
JSONObject
jsonObject
=
new
JSONObject
(
map
);
String
url
=
VendingMachineConstants
.
DOMAIN
+
VendingMachineConstants
.
PICKUP_CODE_CHECK
;
String
result
=
HttpRequest
.
post
(
url
)
.
contentType
(
"multipart/form-data"
)
.
body
(
jsonObject
.
toString
()).
execute
().
body
();
JSONObject
entries
=
new
JSONObject
(
result
);
if
(
entries
.
containsKey
(
"code"
)
&&
entries
.
getStr
(
"code"
).
equals
(
"0"
))
{
JSONArray
content
=
entries
.
getJSONArray
(
"content"
);
content
.
forEach
(
item
->
{
});
}
}
@Override
public
void
queryPayInfo
(
String
machineId
,
String
orderSn
)
{
String
accessToken
=
obtain
();
String
url
=
VendingMachineConstants
.
DOMAIN
+
VendingMachineConstants
.
QUERY_PAY_INFO
;
String
result
=
HttpRequest
.
get
(
url
)
.
contentType
(
"application/json"
)
.
form
(
"api_token"
,
accessToken
)
.
form
(
"version"
,
"1.0"
)
.
form
(
"machine_id"
,
machineId
)
.
form
(
"order_sn"
,
orderSn
)
.
execute
().
body
();
JSONObject
entries
=
new
JSONObject
(
result
);
if
(
entries
.
containsKey
(
"code"
)
&&
entries
.
getStr
(
"code"
).
equals
(
"0"
))
{
JSONArray
content
=
entries
.
getJSONArray
(
"content"
);
content
.
forEach
(
item
->
{
});
}
}
public
String
obtain
()
{
String
o
;
...
...
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