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
66ed7f99
Commit
66ed7f99
authored
Mar 19, 2021
by
giaogiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改为payGo进行话费充值
parent
68786c20
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
42 deletions
+70
-42
src/com/library/service/Impl/AutomaticCodeServiceImpl.java
+32
-19
src/com/library/test/PaygoTest.java
+0
-0
src/com/library/util/Paygo24Utils.java
+38
-23
No files found.
src/com/library/service/Impl/AutomaticCodeServiceImpl.java
View file @
66ed7f99
package
com
.
library
.
service
.
Impl
;
package
com
.
library
.
service
.
Impl
;
import
com.library.TopUp.Statel.SeatelSentUtils
;
import
com.library.TopUp.cellcard.CellcardSentUtils
;
import
com.library.TopUp.mefont.MetfoneSentUtils
;
import
com.library.TopUp.model.ResultsModel
;
import
com.library.TopUp.model.ResultsModel
;
import
com.library.TopUp.smart.SmartSentUtils
;
import
com.library.config.NameValue
;
import
com.library.config.NameValue
;
import
com.library.mapper.AutomaticQueueMapper
;
import
com.library.mapper.AutomaticQueueMapper
;
import
com.library.mapper.CurrencyMapper
;
import
com.library.mapper.CurrencyMapper
;
...
@@ -53,7 +49,6 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
...
@@ -53,7 +49,6 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
String
removePhone
=
phone
;
String
removePhone
=
phone
;
if
(
phone
.
startsWith
(
PREFIX_ZERO
))
{
if
(
phone
.
startsWith
(
PREFIX_ZERO
))
{
removePhone
=
phone
;
removePhone
=
phone
;
}
}
// 判断是否是中国手机号
// 判断是否是中国手机号
// 是
// 是
...
@@ -65,7 +60,10 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
...
@@ -65,7 +60,10 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
public
void
automaticForTack
()
{
public
void
automaticForTack
()
{
// 得到最早的一条充值记录
// 得到最早的一条充值记录
Map
<
String
,
Object
>
map
=
automaticQueueMapper
.
selectEarlyOne
();
Map
<
String
,
Object
>
map
=
automaticQueueMapper
.
selectEarlyOne
();
if
(
map
!=
null
)
{
if
(
map
==
null
)
{
return
;
}
// 充值业务状态
// 充值业务状态
boolean
success
=
false
;
boolean
success
=
false
;
//自动处理状态说明
//自动处理状态说明
...
@@ -89,7 +87,6 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
...
@@ -89,7 +87,6 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
//添加订单操作日志
//添加订单操作日志
currencyMapper
.
AddTableForMysql
(
TransformationTools
.
CreatAddMysql
(
orderLogModel
,
NameValue
.
Table_order_log
,
"id"
,
null
));
currencyMapper
.
AddTableForMysql
(
TransformationTools
.
CreatAddMysql
(
orderLogModel
,
NameValue
.
Table_order_log
,
"id"
,
null
));
//生成充值的订单编号。每次都会变,以后可能会复查使用到。
//生成充值的订单编号。每次都会变,以后可能会复查使用到。
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
top_up_num
=
sdf
.
format
(
new
Date
());
top_up_num
=
sdf
.
format
(
new
Date
());
...
@@ -108,7 +105,6 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
...
@@ -108,7 +105,6 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
// 自动处理结果
// 自动处理结果
this
.
automaticForTackResult
(
automaticQueueModel
,
success
,
desc
,
top_up_num
);
this
.
automaticForTackResult
(
automaticQueueModel
,
success
,
desc
,
top_up_num
);
}
}
}
private
ResultsModel
sentTopup
(
AutomaticQueueModel
automaticQueueModel
,
String
top_up_num
)
{
private
ResultsModel
sentTopup
(
AutomaticQueueModel
automaticQueueModel
,
String
top_up_num
)
{
...
@@ -123,29 +119,46 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
...
@@ -123,29 +119,46 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
//1.先判断这是哪个公司的充值订单,然后发起充值
//1.先判断这是哪个公司的充值订单,然后发起充值
SegmentModel
segmentModel
=
(
SegmentModel
)
TransformationTools
.
ToObjectOne
(
SegmentModel
.
class
,
map
);
SegmentModel
segmentModel
=
(
SegmentModel
)
TransformationTools
.
ToObjectOne
(
SegmentModel
.
class
,
map
);
// if (segmentModel.getOperator().equals(SegmentType_Cellcard)) {
// //Cellcard的手机号,则选择Cellcard公司的api发起充值
// resultsModel = CellcardSentUtils.sentTopUp(automaticQueueModel.getOrder_phone(), orderNumId, automaticQueueModel.getOrder_money().intValue());
// resultsModel.setTopUpNum(orderNumId);
// } else if (segmentModel.getOperator().equals(SegmentType_Metfone)) {
// resultsModel = MetfoneSentUtils.sentTopUp(automaticQueueModel.getOrder_phone(), automaticQueueModel.getOrder_money().intValue(), orderNumId);
// resultsModel.setTopUpNum(orderNumId);
// } else if (segmentModel.getOperator().equals(SegmentType_Smart)) {
// resultsModel = SmartSentUtils.sentTopUp(automaticQueueModel.getOrder_phone(), automaticQueueModel.getOrder_money().intValue(), orderNumId);
// resultsModel.setTopUpNum(orderNumId);
// } else if (segmentModel.getOperator().equals(SegmentType_Seatel)) {
// resultsModel = SeatelSentUtils.sentTopUp(automaticQueueModel.getOrder_phone(), automaticQueueModel.getOrder_money().intValue());
// //这个不用返回订单num,里面已经做了处理
// } else {
// payGo的运营商对应id
int
serviceId
;
if
(
segmentModel
.
getOperator
().
equals
(
SegmentType_Cellcard
))
{
if
(
segmentModel
.
getOperator
().
equals
(
SegmentType_Cellcard
))
{
//Cellcard的手机号,则选择Cellcard公司的api发起充值
serviceId
=
3
;
resultsModel
=
CellcardSentUtils
.
sentTopUp
(
automaticQueueModel
.
getOrder_phone
(),
orderNumId
,
automaticQueueModel
.
getOrder_money
().
intValue
());
resultsModel
.
setTopUpNum
(
orderNumId
);
}
else
if
(
segmentModel
.
getOperator
().
equals
(
SegmentType_Metfone
))
{
}
else
if
(
segmentModel
.
getOperator
().
equals
(
SegmentType_Metfone
))
{
resultsModel
=
MetfoneSentUtils
.
sentTopUp
(
automaticQueueModel
.
getOrder_phone
(),
automaticQueueModel
.
getOrder_money
().
intValue
(),
orderNumId
);
serviceId
=
4
;
resultsModel
.
setTopUpNum
(
orderNumId
);
}
else
if
(
segmentModel
.
getOperator
().
equals
(
SegmentType_Smart
))
{
}
else
if
(
segmentModel
.
getOperator
().
equals
(
SegmentType_Smart
))
{
resultsModel
=
SmartSentUtils
.
sentTopUp
(
automaticQueueModel
.
getOrder_phone
(),
automaticQueueModel
.
getOrder_money
().
intValue
(),
orderNumId
);
serviceId
=
2
;
resultsModel
.
setTopUpNum
(
orderNumId
);
}
else
if
(
segmentModel
.
getOperator
().
equals
(
SegmentType_Seatel
))
{
}
else
if
(
segmentModel
.
getOperator
().
equals
(
SegmentType_Seatel
))
{
resultsModel
=
SeatelSentUtils
.
sentTopUp
(
automaticQueueModel
.
getOrder_phone
(),
automaticQueueModel
.
getOrder_money
().
intValue
());
serviceId
=
111
;
//这个不用返回订单num,里面已经做了处理
}
else
{
}
else
{
// 没找到
return
null
;
}
Paygo24Utils
paygo
=
new
Paygo24Utils
();
Paygo24Utils
paygo
=
new
Paygo24Utils
();
String
result
=
paygo
.
payment
(
automaticQueueModel
.
getOrder_phone
(),
automaticQueueModel
.
getSegment_id
()
,
automaticQueueModel
.
getOrder_money
());
String
result
=
paygo
.
payment
(
automaticQueueModel
.
getOrder_phone
(),
serviceId
,
automaticQueueModel
.
getOrder_money
());
resultsModel
=
new
ResultsModel
();
resultsModel
=
new
ResultsModel
();
resultsModel
.
setTip
(
result
);
//描述
resultsModel
.
setTip
(
result
);
//描述
resultsModel
.
setSuccessful
(
result
.
equals
(
Paygo24Utils
.
SUCCESS
));
resultsModel
.
setSuccessful
(
result
.
equals
(
Paygo24Utils
.
SUCCESS
));
resultsModel
.
setTopUpNum
(
orderNumId
);
resultsModel
.
setTopUpNum
(
orderNumId
);
}
return
resultsModel
;
return
resultsModel
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
src/com/library/test/PaygoTest.java
0 → 100644
View file @
66ed7f99
This diff is collapsed.
Click to expand it.
src/com/library/util/Paygo24Utils.java
View file @
66ed7f99
package
com
.
library
.
util
;
package
com
.
library
.
util
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
com.library.util.currency.AESUtils
;
import
com.library.util.currency.DiscountFileUtils
;
import
com.library.util.currency.DiscountFileUtils
;
import
com.paygo24.v3.protocol.*
;
import
com.paygo24.v3.protocol.*
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.tempuri.PayGoService
;
import
org.tempuri.PayGoService
;
import
org.tempuri.PayGoServiceSoap
;
import
org.tempuri.PayGoServiceSoap
;
...
@@ -44,26 +42,43 @@ public class Paygo24Utils {
...
@@ -44,26 +42,43 @@ public class Paygo24Utils {
private
static
final
String
CORRECT_PAYMENT_STATE_ACCEPTED
=
"0"
;
private
static
final
String
CORRECT_PAYMENT_STATE_ACCEPTED
=
"0"
;
/** 充值还没有处理完返回的状态码 */
/** 充值还没有处理完返回的状态码 */
private
static
final
String
CORRECT_PAYMENT_STATE_WAS
=
"3"
;
private
static
final
String
CORRECT_PAYMENT_STATE_WAS
=
"3"
;
/** 充值还没有处理完返回的状态码 */
/**
* 充值还没有处理完返回的状态码
*/
private
static
final
String
CORRECT_PAYMENT_STATE_DELAYED
=
"4"
;
private
static
final
String
CORRECT_PAYMENT_STATE_DELAYED
=
"4"
;
/** 充值还没有处理完返回的状态码 */
/**
* 充值还没有处理完返回的状态码
*/
private
static
final
String
CORRECT_PAYMENT_STATE_PROVIDER
=
"6"
;
private
static
final
String
CORRECT_PAYMENT_STATE_PROVIDER
=
"6"
;
/** 处理成功返回给调用者的状态码 */
/**
* 处理成功返回给调用者的状态码
*/
public
static
final
String
SUCCESS
=
"SUCCESS"
;
public
static
final
String
SUCCESS
=
"SUCCESS"
;
/** 配置文件中的paygo24 id */
/**
* 配置文件中的paygo24 id
*/
private
static
Integer
POINT_ID
;
private
static
Integer
POINT_ID
;
/** 配置文件中的paygo24 密码 */
/**
* 配置文件中的paygo24 密码
*/
private
static
String
PASSWORD
;
private
static
String
PASSWORD
;
/** 配置文件中是否存在paygo24账号 */
/**
* 配置文件中是否存在paygo24账号
*/
private
static
boolean
hasAccount
=
true
;
private
static
boolean
hasAccount
=
true
;
/** 付款后余额 */
/**
* 付款后余额
*/
private
BigDecimal
availableBalance
;
private
BigDecimal
availableBalance
;
/** 当前账号余额 */
/**
* 当前账号余额
*/
private
BigDecimal
currentBalance
;
private
BigDecimal
currentBalance
;
/*** 重新查询的次数 ****/
/*** 重新查询的次数 ****/
private
Integer
count
;
private
Integer
count
;
private
static
boolean
ISTEST
=
true
;
private
static
boolean
ISTEST
;
static
{
static
{
Map
<
String
,
String
>
map
;
Map
<
String
,
String
>
map
;
try
{
try
{
...
@@ -71,10 +86,9 @@ public class Paygo24Utils {
...
@@ -71,10 +86,9 @@ public class Paygo24Utils {
if
(
map
.
get
(
"paygo.pointid"
)
!=
null
&&
map
.
get
(
"paygo.password"
)
!=
null
)
{
if
(
map
.
get
(
"paygo.pointid"
)
!=
null
&&
map
.
get
(
"paygo.password"
)
!=
null
)
{
// POINT_ID = Integer.parseInt(map.get("paygo.pointid"));
// POINT_ID = Integer.parseInt(map.get("paygo.pointid"));
// PASSWORD = AESUtils.decryptData(AESUtils.DEFAULT_KEY, map.get("paygo.password"));
// PASSWORD = AESUtils.decryptData(AESUtils.DEFAULT_KEY, map.get("paygo.password"));
POINT_ID
=
326386
;
// POINT_ID =326386 ;
PASSWORD
=
"5TNO+4kpAXtphf1eIlGCLw=="
;
// PASSWORD = "5TNO+4kpAXtphf1eIlGCLw==";
// POINT_ID =46 ;
// PASSWORD = "4QrcOUm6Wau+VuBX8g+IPg==";
System
.
out
.
println
(
PASSWORD
);
System
.
out
.
println
(
PASSWORD
);
// paygo.pointid=326386
// paygo.pointid=326386
...
@@ -100,9 +114,9 @@ public class Paygo24Utils {
...
@@ -100,9 +114,9 @@ public class Paygo24Utils {
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
Paygo24Utils
paygo24Utils
=
new
Paygo24Utils
();
Paygo24Utils
paygo24Utils
=
new
Paygo24Utils
();
String
result
=
paygo24Utils
.
payment
(
"066301180"
,
4
,
new
BigDecimal
(
1.0
));
String
result
=
paygo24Utils
.
payment
(
"0960000000"
,
2
,
new
BigDecimal
(
1.0
));
System
.
out
.
println
(
result
);
System
.
out
.
println
(
"result:"
+
result
);
}
}
/**
/**
...
@@ -127,11 +141,11 @@ public class Paygo24Utils {
...
@@ -127,11 +141,11 @@ public class Paygo24Utils {
// QName.valueOf("{http://tempuri.org/}PayGoService"));
// QName.valueOf("{http://tempuri.org/}PayGoService"));
PayGoService
service
;
PayGoService
service
;
ISTEST
=
fals
e
;
ISTEST
=
tru
e
;
if
(
ISTEST
)
{
if
(
ISTEST
)
{
service
=
new
PayGoService
(
new
URL
(
"https://api2.paygo24.com/paygoservice.asmx
?wsdl
"
),
service
=
new
PayGoService
(
new
URL
(
"https://api2.paygo24.com/paygoservice.asmx"
),
QName
.
valueOf
(
"{http://tempuri.org/}PayGoService"
));
QName
.
valueOf
(
"{http://tempuri.org/}PayGoService"
));
}
else
{
}
else
{
service
=
new
PayGoService
(
new
URL
(
"https://processing2.paygo24.com/paygoservice.asmx"
),
service
=
new
PayGoService
(
new
URL
(
"https://processing2.paygo24.com/paygoservice.asmx"
),
QName
.
valueOf
(
"{http://tempuri.org/}PayGoService"
));
QName
.
valueOf
(
"{http://tempuri.org/}PayGoService"
));
}
}
...
@@ -153,7 +167,8 @@ public class Paygo24Utils {
...
@@ -153,7 +167,8 @@ public class Paygo24Utils {
registerCheckRequest
.
setPaymentParameters
(
ap
);
registerCheckRequest
.
setPaymentParameters
(
ap
);
sendRequest
.
setRequest
(
registerCheckRequest
);
sendRequest
.
setRequest
(
registerCheckRequest
);
SendRequestResponse
response
=
soap
.
sendRequest
(
sendRequest
);
SendRequestResponse
response
=
soap
.
sendRequest
(
sendRequest
);
System
.
out
.
println
(
new
Gson
().
toJson
(
response
));
System
.
out
.
println
(
"RegisterCheckRequest response:"
+
new
Gson
().
toJson
(
response
));
if
(
response
.
getSendRequestResult
()
instanceof
RegisterCheckResponse
)
{
if
(
response
.
getSendRequestResult
()
instanceof
RegisterCheckResponse
)
{
// Success. You can get result
// Success. You can get result
Duration
duaration
=
((
RegisterCheckResponse
)
response
.
getSendRequestResult
())
Duration
duaration
=
((
RegisterCheckResponse
)
response
.
getSendRequestResult
())
...
...
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