Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
TopUpCambodian-java
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
TopUpCambodian-java
Commits
537848d4
Commit
537848d4
authored
Mar 29, 2021
by
giaogiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2021年03月29日15:36:29, 部署的正式环境代码, 修复cellcard对接的api文档
parent
66ed7f99
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
167 additions
and
132 deletions
+167
-132
src/com/library/TopUp/cellcard/CellcardSentUtils.java
+16
-11
src/com/library/TopUp/mefont/MetfoneSentUtils.java
+9
-10
src/com/library/service/Impl/AutomaticCodeServiceImpl.java
+65
-76
src/com/library/service/Impl/CommServiceImpl.java
+39
-31
src/com/library/test/A.java
+21
-0
src/jdbc.properties
+17
-4
No files found.
src/com/library/TopUp/cellcard/CellcardSentUtils.java
View file @
537848d4
package
com
.
library
.
TopUp
.
cellcard
;
import
com.google.gson.Gson
;
import
com.google.gson.JsonObject
;
import
com.google.gson.JsonParser
;
import
com.library.TopUp.Http.HttpUtils
;
import
com.library.TopUp.Http.HttpsTool
;
import
com.library.TopUp.model.ResultsModel
;
import
org.apache.http.util.TextUtils
;
import
java.net.URLEncoder
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.Base64
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
CellcardSentUtils
{
...
...
@@ -27,7 +27,8 @@ public class CellcardSentUtils {
Map
<
String
,
String
>
params
=
new
HashMap
();
params
.
put
(
"grant_type"
,
"client_credentials"
);
String
keyAndSecret
=
"v2VSgq7Q2Yqhp36s5TOzD13J5FMa:Go0wTNZdR53xNbxHwhneLF1p40Ma"
;
// String keyAndSecret = "v2VSgq7Q2Yqhp36s5TOzD13J5FMa:Go0wTNZdR53xNbxHwhneLF1p40Ma";
String
keyAndSecret
=
"mTUd8uExL3jpms3yoclDyAtEnIAa:9fegPABu4LBCsrxAhELkDytSGzUa"
;
String
code
=
Base64
.
getEncoder
().
encodeToString
(
keyAndSecret
.
getBytes
(
"UTF-8"
));
Map
<
String
,
String
>
heardMap
=
new
HashMap
<>();
...
...
@@ -35,8 +36,8 @@ public class CellcardSentUtils {
// heardMap.put("Content-Type", "application/json");
// heardMap.put("Accept", "application/json");
String
url
=
"https://
stg
-api.cellcard.com.kh:8243/token"
;
//
String
url
=
"https://
prd
-api.cellcard.com.kh:8243/token"
;
// HttpClientResult clientResult = HttpClientUtils.doPost(url, heardMap, params);
//// System.out.println(new Gson().toJson(clientResult));
...
...
@@ -86,8 +87,7 @@ public class CellcardSentUtils {
heardMap
.
put
(
"Content-Type"
,
"application/x-www-form-urlencoded"
);
// heardMap.put("Accept", "application/json");
String
url
=
"https://stg-api.cellcard.com.kh:8243/tom/v2/query_balance"
;
String
url
=
"https://prd-api.cellcard.com.kh:8243/tom/v2/query_balance"
;
String
json
=
HttpUtils
.
post
(
url
,
params
,
heardMap
,
30000
,
30000
,
"utf-8"
);
return
json
;
...
...
@@ -121,8 +121,8 @@ public class CellcardSentUtils {
Map
<
String
,
String
>
heardMap
=
new
HashMap
<>();
heardMap
.
put
(
"Authorization"
,
token_type
+
" "
+
access_token
);
heardMap
.
put
(
"Content-Type"
,
"application/x-www-form-urlencoded"
);
String
url
=
"https://
stg
-api.cellcard.com.kh:8243/tom/v2/balance_transfer"
;
// https://stg-api.cellcard.com.kh:8243/tom/v2/balance_transfer
String
url
=
"https://
prd
-api.cellcard.com.kh:8243/tom/v2/balance_transfer"
;
String
json
=
HttpUtils
.
post
(
url
,
params
,
heardMap
,
30000
,
30000
,
"utf-8"
);
return
json
;
...
...
@@ -201,6 +201,11 @@ public class CellcardSentUtils {
// System.out.println("充值状态" + model.isSuccessful());
String
json
=
checkBalance
();
System
.
out
.
println
(
json
);
ResultsModel
resultsModel
=
sentTopUp
(
"012885610"
,
"1237189239"
,
1
);
System
.
out
.
println
(
resultsModel
);
}
/**
...
...
src/com/library/TopUp/mefont/MetfoneSentUtils.java
View file @
537848d4
...
...
@@ -16,10 +16,9 @@ import java.util.Map;
public
class
MetfoneSentUtils
{
private
final
static
String
baseUrl
=
"https://36.37.242.116:8301/"
;
//测试
// private final static String baseUrl = "https://payment.emoney.com.kh:8888/";
//线上
private
final
static
String
baseUrl
=
"https://36.37.242.116:8301/"
;
// private final static String baseUrl = "https://payment.emoney.com.kh:8888/";
private
final
static
String
PIN
=
"298315"
;
private
final
static
String
MyAuthorization
=
"epa 2478e27af578e11a6af86a8320562124240f5c972e8039cd9c564e53d643bb31"
;
public
static
String
initTel
(
String
transAmount
,
String
refId
,
String
customerPhoneNumber
)
{
...
...
@@ -33,7 +32,7 @@ public class MetfoneSentUtils {
Map
<
String
,
String
>
heardMap
=
new
HashMap
<>();
heardMap
.
put
(
"Authorization"
,
MyAuthorization
);
heardMap
.
put
(
"Authorization"
,
"epa 2478e27af578e11a6af86a8320562124240f5c972e8039cd9c564e53d643bb31"
);
heardMap
.
put
(
"e-language"
,
"English"
);
heardMap
.
put
(
"Content-Type"
,
"application/json"
);
heardMap
.
put
(
"Accept"
,
"application/json"
);
...
...
@@ -50,7 +49,7 @@ public class MetfoneSentUtils {
public
static
String
confirmTel
(
String
txPaymentTokenId
)
{
Map
<
String
,
String
>
heardMap
=
new
HashMap
<>();
heardMap
.
put
(
"Authorization"
,
MyAuthorization
);
heardMap
.
put
(
"Authorization"
,
"epa 2478e27af578e11a6af86a8320562124240f5c972e8039cd9c564e53d643bb31"
);
heardMap
.
put
(
"e-language"
,
"English"
);
heardMap
.
put
(
"Content-Type"
,
"application/json"
);
heardMap
.
put
(
"Accept"
,
"application/json"
);
...
...
@@ -81,7 +80,7 @@ public class MetfoneSentUtils {
Map
<
String
,
String
>
heardMap
=
new
HashMap
<>();
heardMap
.
put
(
"Authorization"
,
MyAuthorization
);
heardMap
.
put
(
"Authorization"
,
"epa 2478e27af578e11a6af86a8320562124240f5c972e8039cd9c564e53d643bb31"
);
heardMap
.
put
(
"e-language"
,
"English"
);
heardMap
.
put
(
"Content-Type"
,
"application/json"
);
heardMap
.
put
(
"Accept"
,
"application/json"
);
...
...
@@ -107,7 +106,7 @@ public class MetfoneSentUtils {
try
{
Map
<
String
,
String
>
heardMap
=
new
HashMap
<>();
heardMap
.
put
(
"Authorization"
,
MyAuthorization
);
heardMap
.
put
(
"Authorization"
,
"epa 2478e27af578e11a6af86a8320562124240f5c972e8039cd9c564e53d643bb31"
);
heardMap
.
put
(
"e-language"
,
"English"
);
heardMap
.
put
(
"Content-Type"
,
"application/json"
);
heardMap
.
put
(
"Accept"
,
"application/json"
);
...
...
@@ -131,7 +130,7 @@ public class MetfoneSentUtils {
try
{
Map
<
String
,
String
>
heardMap
=
new
HashMap
<>();
heardMap
.
put
(
"Authorization"
,
MyAuthorization
);
heardMap
.
put
(
"Authorization"
,
"epa 2478e27af578e11a6af86a8320562124240f5c972e8039cd9c564e53d643bb31"
);
heardMap
.
put
(
"e-language"
,
"English"
);
heardMap
.
put
(
"Content-Type"
,
"application/json"
);
heardMap
.
put
(
"Accept"
,
"application/json"
);
...
...
@@ -156,7 +155,7 @@ public class MetfoneSentUtils {
try
{
Map
<
String
,
String
>
heardMap
=
new
HashMap
<>();
heardMap
.
put
(
"Authorization"
,
MyAuthorization
);
heardMap
.
put
(
"Authorization"
,
"epa 2478e27af578e11a6af86a8320562124240f5c972e8039cd9c564e53d643bb31"
);
heardMap
.
put
(
"e-language"
,
"English"
);
heardMap
.
put
(
"Content-Type"
,
"application/json"
);
heardMap
.
put
(
"Accept"
,
"application/json"
);
...
...
@@ -187,7 +186,7 @@ public class MetfoneSentUtils {
try
{
Map
<
String
,
String
>
heardMap
=
new
HashMap
<>();
heardMap
.
put
(
"Authorization"
,
MyAuthorization
);
heardMap
.
put
(
"Authorization"
,
"epa 2478e27af578e11a6af86a8320562124240f5c972e8039cd9c564e53d643bb31"
);
heardMap
.
put
(
"e-language"
,
"English"
);
heardMap
.
put
(
"Content-Type"
,
"application/json"
);
heardMap
.
put
(
"Accept"
,
"application/json"
);
...
...
src/com/library/service/Impl/AutomaticCodeServiceImpl.java
View file @
537848d4
This diff is collapsed.
Click to expand it.
src/com/library/service/Impl/CommServiceImpl.java
View file @
537848d4
...
...
@@ -8,10 +8,20 @@ import com.library.TopUp.mefont.MetfoneSentUtils;
import
com.library.config.NameValue
;
import
com.library.mapper.CommMapper
;
import
com.library.mapper.CurrencyMapper
;
import
com.library.model.AdminModel
;
import
com.library.model.UserModel
;
import
com.library.respcode.ServerResponse
;
import
com.library.service.AutomaticCodeService
;
import
com.library.service.CommService
;
import
com.library.util.MSMmethodUtil
;
import
com.library.util.Paygo24Utils
;
import
com.library.util.SendEmailTools
;
import
com.library.util.TransformationTools
;
import
com.wechat.pay.MD5Util
;
import
com.wechat.pay.WeChatManager
;
import
com.wechat.pay.WeChatManager.UserInfo
;
import
org.apache.http.util.TextUtils
;
import
org.springframework.stereotype.Service
;
...
...
@@ -19,12 +29,9 @@ import javax.annotation.Resource;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.net.URLDecoder
;
import
java.sql.Timestamp
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.SimpleTimeZone
;
import
java.util.TimeZone
;
import
java.util.*
;
@Service
public
class
CommServiceImpl
implements
CommService
{
...
...
@@ -39,32 +46,6 @@ public class CommServiceImpl implements CommService {
@Resource
private
AutomaticCodeService
automaticCodeService
;
/**
* 此函数非原创,从网上搜索而来,timeZoneOffset原为int类型,为班加罗尔调整成float类型
* timeZoneOffset表示时区,如中国一般使用东八区,因此timeZoneOffset就是8
*
* @param timeZoneOffset
* @return
*/
public
static
String
getFormatedDateString
(
float
timeZoneOffset
)
{
if
(
timeZoneOffset
>
13
||
timeZoneOffset
<
-
12
)
{
timeZoneOffset
=
0
;
}
int
newTime
=
(
int
)
(
timeZoneOffset
*
60
*
60
*
1000
);
TimeZone
timeZone
;
String
[]
ids
=
TimeZone
.
getAvailableIDs
(
newTime
);
if
(
ids
.
length
==
0
)
{
timeZone
=
TimeZone
.
getDefault
();
}
else
{
timeZone
=
new
SimpleTimeZone
(
newTime
,
ids
[
0
]);
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
sdf
.
setTimeZone
(
timeZone
);
return
sdf
.
format
(
new
Date
());
}
@Override
public
ServerResponse
Recharge
()
{
try
{
...
...
@@ -311,4 +292,31 @@ public class CommServiceImpl implements CommService {
}
}
/**
* 此函数非原创,从网上搜索而来,timeZoneOffset原为int类型,为班加罗尔调整成float类型
* timeZoneOffset表示时区,如中国一般使用东八区,因此timeZoneOffset就是8
*
* @param timeZoneOffset
* @return
*/
public
static
String
getFormatedDateString
(
float
timeZoneOffset
)
{
if
(
timeZoneOffset
>
13
||
timeZoneOffset
<
-
12
)
{
timeZoneOffset
=
0
;
}
int
newTime
=
(
int
)
(
timeZoneOffset
*
60
*
60
*
1000
);
TimeZone
timeZone
;
String
[]
ids
=
TimeZone
.
getAvailableIDs
(
newTime
);
if
(
ids
.
length
==
0
)
{
timeZone
=
TimeZone
.
getDefault
();
}
else
{
timeZone
=
new
SimpleTimeZone
(
newTime
,
ids
[
0
]);
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
sdf
.
setTimeZone
(
timeZone
);
return
sdf
.
format
(
new
Date
());
}
}
src/com/library/test/A.java
0 → 100644
View file @
537848d4
package
com
.
library
.
test
;
public
class
A
{
String
a
=
"<?xml version='1.0' encoding='utf-8'?>\n"
+
"<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>\n"
+
" <soap:Body>\n"
+
" <SendRequest xmlns='http://tempuri.org/'>\n"
+
" <request xsi:type='RegisterCheckRequest' Id='7a646d45-ee2f-4b1c-8de8-780c416fbbd0' Service='42' xmlns='http://paygo24.com/v3/protocol'>\n"
+
" <PaymentParameters xmlns=''>\n"
+
" <Parameter Name='account' Value='08374829' />\n"
+
" </PaymentParameters>\n"
+
" </request>\n"
+
" <pointId>46</pointId>\n"
+
" <password>4QrcOUm6Wau+VuBX8g+IPg==</password>\n"
+
" </SendRequest>\n"
+
" </soap:Body>\n"
+
"</soap:Envelope>"
;
}
src/jdbc.properties
View file @
537848d4
#jdbc.driverClassName=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://localhost:3306/comb_top?useUnicode=true&characterEncoding=utf8&autoReconnect=true
#jdbc.username=root
#jdbc.password=123
#jdbc.driverClassName=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://5846b961499e7.gz.cdb.myqcloud.com:5698/discuz?useUnicode=true&characterEncoding=utf8&autoReconnect=true
#jdbc.username=cdb_outerroot
#jdbc.password=dengyebin940805
jdbc.driverClassName
=
com.mysql.jdbc.Driver
jdbc.url
=
jdbc:mysql://5846b961499e7.gz.cdb.myqcloud.com:5698/discuz?useUnicode=true&characterEncoding=utf8&autoReconnect=true
jdbc.username
=
cdb_outerroot
jdbc.password
=
dengyebin940805
\ No newline at end of file
#jdbc.url=jdbc:mysql://localhost:3306/discuz?useUnicode=true&characterEncoding=utf8&autoReconnect=true
jdbc.url
=
jdbc:mysql://localhost:3306/recharge_sys?useUnicode=true&characterEncoding=utf8&autoReconnect=true
jdbc.username
=
recharge_sys
jdbc.password
=
cK2bPBkwLtKNeGRc
\ 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