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
32323ba5
Commit
32323ba5
authored
Jan 08, 2020
by
yanlveming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步
parent
69b9fd2d
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
118 additions
and
89 deletions
+118
-89
src/com/library/TopUp/Statel/SeatelSentUtils.java
+1
-1
src/com/library/TopUp/cellcard/CellcardSentUtils.java
+32
-8
src/com/library/TopUp/mefont/MetfoneSentUtils.java
+4
-4
src/com/library/controller/CommonController.java
+76
-61
src/com/library/service/Impl/AutomaticCodeServiceImpl.java
+1
-1
src/com/library/service/Impl/CommServiceImpl.java
+0
-10
src/com/library/util/QiniuUtils.java
+4
-4
No files found.
src/com/library/TopUp/Statel/SeatelSentUtils.java
View file @
32323ba5
...
...
@@ -325,7 +325,7 @@ public class SeatelSentUtils {
tip
+=
"获取不到余额信息"
;
}
}
else
{
tip
+=
"
校验号码
失败;结果为:"
+
feeJson
;
tip
+=
"
查询余额
失败;结果为:"
+
feeJson
;
}
}
...
...
src/com/library/TopUp/cellcard/CellcardSentUtils.java
View file @
32323ba5
...
...
@@ -10,10 +10,7 @@ import org.apache.http.util.TextUtils;
import
java.net.URLEncoder
;
import
java.text.SimpleDateFormat
;
import
java.util.Base64
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.*
;
public
class
CellcardSentUtils
{
...
...
@@ -54,10 +51,32 @@ public class CellcardSentUtils {
}
}
public
static
String
checkBalance
(
String
transaction_id
)
{
public
static
String
checkBalance
()
{
try
{
String
tokenStr
=
""
;
String
jsonToken
=
getToken
();
if
(!
TextUtils
.
isEmpty
(
jsonToken
))
{
JsonParser
jsonParserToken
=
new
JsonParser
();
JsonObject
jsonObjectToken
=
jsonParserToken
.
parse
(
jsonToken
).
getAsJsonObject
();
tokenStr
=
jsonObjectToken
.
get
(
"access_token"
)
==
null
?
""
:
jsonObjectToken
.
get
(
"access_token"
).
getAsString
();
if
(!
TextUtils
.
isEmpty
(
tokenStr
))
{
token_type
=
jsonObjectToken
.
get
(
"token_type"
)
==
null
?
""
:
jsonObjectToken
.
get
(
"token_type"
).
getAsString
();
access_token
=
tokenStr
;
}
else
{
return
"令牌为空"
;
}
}
else
{
return
"请求令牌为空"
;
}
if
(!
TextUtils
.
isEmpty
(
tokenStr
))
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
);
String
transaction_id
=
sdf
.
format
(
new
Date
());
Map
<
String
,
String
>
params
=
new
HashMap
();
params
.
put
(
"transaction_id"
,
transaction_id
);
params
.
put
(
"distributor_id"
,
distributor_id
);
...
...
@@ -73,6 +92,9 @@ public class CellcardSentUtils {
String
json
=
HttpUtils
.
post
(
url
,
params
,
heardMap
,
30000
,
30000
,
"utf-8"
);
return
json
;
}
else
{
return
"tokenStr为空"
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
...
...
@@ -174,9 +196,11 @@ public class CellcardSentUtils {
// String json = topUpStatus("85561254730", "123");
ResultsModel
model
=
sentTopUp
(
"855061254730"
,
"123"
,
1
);
System
.
out
.
println
(
"充值结果 "
+
model
.
getTip
());
System
.
out
.
println
(
"充值状态"
+
model
.
isSuccessful
());
// ResultsModel model = sentTopUp("855061254730", "123", 1);
// System.out.println("充值结果 " + model.getTip());
// System.out.println("充值状态" + model.isSuccessful());
String
json
=
checkBalance
();
System
.
out
.
println
(
json
);
}
/**
...
...
src/com/library/TopUp/mefont/MetfoneSentUtils.java
View file @
32323ba5
...
...
@@ -211,17 +211,17 @@ public class MetfoneSentUtils {
}
}
public
static
void
main
2222
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
/* String str = checkMyMoneyPost("1200016", "0979530750");
//{"status":0,"code":"MSG_SUCCESS","message":"Success","msisdn":null,"accountName":null,"accountType":null,"balances":{"KHR":"498,983","USD":"5,135.60"}}
System.out.println(str);*/
/* String str = billInfoPost(
"0979530750");
System.out.println(str);
*/
String
str
=
checkMyMoneyPost
(
"20010818431127"
,
"0979530750"
);
System
.
out
.
println
(
str
);
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
222
(
String
[]
args
)
{
String
phone
=
"0979530750"
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyMMddHHmmss"
);
...
...
src/com/library/controller/CommonController.java
View file @
32323ba5
package
com
.
library
.
controller
;
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.Statel.HttpClientUtils
;
import
com.library.TopUp.Statel.SeatelSentUtils
;
...
...
@@ -11,12 +13,14 @@ import com.library.service.AdminService;
import
com.library.service.CommService
;
import
com.library.util.QiniuUtils
;
import
com.wechat.pay.MD5Util
;
import
org.apache.http.util.TextUtils
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
...
...
@@ -41,83 +45,94 @@ public class CommonController {
@Resource
private
HttpServletRequest
request
;
//获取七牛云的token
@ResponseBody
@RequestMapping
(
"/FindQNYToken"
)
private
ServerResponse
FindQNYToken
()
{
String
token
=
QiniuUtils
.
getUpToken
();
return
ServerResponse
.
createBySuccess
(
token
);
}
//Recharge
@ResponseBody
@RequestMapping
(
"recharge"
)
private
ServerResponse
recharge
()
{
return
commService
.
Recharge
();
}
//登录
@ResponseBody
@RequestMapping
(
"adminLogin"
)
private
ServerResponse
adminLogin
()
{
return
commService
.
adminLogin
();
}
//
登录
//
检查Seatel运营商的手机
@ResponseBody
@RequestMapping
(
"test1"
)
private
ServerResponse
test
()
{
String
phone
=
"0189464112"
;
String
json
=
SeatelSentUtils
.
checkPhone
(
phone
);
return
ServerResponse
.
createBySuccess
(
json
);
}
@RequestMapping
(
"checkPhoneInSeatel"
)
private
ServerResponse
checkPhoneInSeatel
()
{
//登录
@ResponseBody
@RequestMapping
(
"test2"
)
private
ServerResponse
test2
()
{
String
phone
=
"0189464112"
;
String
phone
=
request
.
getParameter
(
"phone"
);
String
json
=
SeatelSentUtils
.
checkPhone2
(
phone
);
return
ServerResponse
.
createBySuccess
(
json
);
}
//
登录
//
查询Seatel运营商剩余的余额
@ResponseBody
@RequestMapping
(
"test3"
)
private
ServerResponse
test3
()
{
String
json
=
SeatelSentUtils
.
queryAgentFee
();
return
ServerResponse
.
createBySuccess
(
json
);
@RequestMapping
(
"queryAgentFeeInSeatel"
)
private
ServerResponse
queryAgentFeeInSeatel
()
{
String
feeJson
=
SeatelSentUtils
.
queryAgentFee
();
String
tip
=
""
;
String
myAmount
=
""
;
if
(!
TextUtils
.
isEmpty
(
feeJson
))
{
JsonParser
jsonParserFee
=
new
JsonParser
();
JsonObject
jsonObjectFee
=
jsonParserFee
.
parse
(
feeJson
).
getAsJsonObject
();
String
codeCheck
=
jsonObjectFee
.
get
(
"code"
)
==
null
?
""
:
jsonObjectFee
.
get
(
"code"
).
getAsString
();
if
(!
TextUtils
.
isEmpty
(
codeCheck
)
&&
codeCheck
.
equals
(
"0"
))
{
//接口查询成功,比较金额大小
if
(
jsonObjectFee
.
get
(
"amount"
)
!=
null
)
{
myAmount
=
jsonObjectFee
.
get
(
"amount"
).
getAsString
();
tip
+=
"您当前的余额为:$"
+
myAmount
+
""
;
}
else
{
tip
+=
"获取不到余额信息"
;
}
}
else
{
tip
+=
"查询余额失败;结果为:"
+
feeJson
;
}
}
@ResponseBody
@RequestMapping
(
"test4"
)
private
ServerResponse
test4
()
{
String
phone
=
"0189464112"
;
String
json
=
SeatelSentUtils
.
crmRecharge
(
phone
,
1
);
return
ServerResponse
.
createBySuccess
(
json
);
return
ServerResponse
.
createBySuccess
(
tip
,
myAmount
);
}
//查询Cellcard运营商剩余的余额
@ResponseBody
@RequestMapping
(
"test5"
)
private
ServerResponse
test5
()
{
@RequestMapping
(
"queryAgentFeeInCellcard"
)
private
ServerResponse
queryAgentFeeInCellcard
()
{
String
feeJson
=
""
;
try
{
feeJson
=
CellcardSentUtils
.
checkBalance
();
String
tip
=
""
;
String
myAmount
=
""
;
if
(!
TextUtils
.
isEmpty
(
feeJson
))
{
JsonParser
jsonParserFee
=
new
JsonParser
();
JsonObject
jsonObjectFee
=
jsonParserFee
.
parse
(
feeJson
).
getAsJsonObject
();
if
(
jsonObjectFee
.
get
(
"data"
)
!=
null
)
{
JsonObject
data
=
jsonObjectFee
.
get
(
"data"
).
getAsJsonObject
();
String
error_message
=
data
.
get
(
"error_message"
)
==
null
?
""
:
data
.
get
(
"error_message"
).
getAsString
();
String
error_code
=
data
.
get
(
"error_code"
)
==
null
?
""
:
data
.
get
(
"error_code"
).
getAsString
();
if
(!
TextUtils
.
isEmpty
(
error_code
)
&&
error_code
.
equals
(
"0"
))
{
//接口查询成功,比较金额大小
if
(
data
.
get
(
"distributor_balance"
)
!=
null
)
{
myAmount
=
data
.
get
(
"distributor_balance"
).
getAsString
();
tip
+=
"您当前的余额为:$"
+
myAmount
+
""
;
return
ServerResponse
.
createByErrorCodeMessage
(
3002
,
tip
);
}
else
{
tip
+=
"获取不到余额信息;"
+
error_message
;
}
}
else
{
tip
+=
"查询余额失败;结果为:"
+
feeJson
;
}
}
else
{
tip
+=
"解析data为空"
;
}
String
str
=
request
.
getParameter
(
"str"
);
String
type
=
request
.
getParameter
(
"type"
);
String
json
=
SeatelSentUtils
.
queryCrmRecharge
(
str
);
return
ServerResponse
.
createBySuccess
(
json
);
}
else
{
tip
+=
"请求的数据为空"
;
}
return
ServerResponse
.
createByErrorCodeMessage
(
3001
,
tip
);
@ResponseBody
@RequestMapping
(
"sentTopUp"
)
private
ServerResponse
sentTopUp
()
{
String
phone
=
request
.
getParameter
(
"phone"
);
// String phone = "0189464112";
ResultsModel
resultsModel
=
SeatelSentUtils
.
sentTopUp
(
phone
,
1
);
return
ServerResponse
.
createBySuccess
(
new
Gson
().
toJson
(
resultsModel
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
ServerResponse
.
createByErrorCodeMessage
(-
1
,
feeJson
);
}
}
...
...
src/com/library/service/Impl/AutomaticCodeServiceImpl.java
View file @
32323ba5
...
...
@@ -127,7 +127,7 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
String
phoneThree
=
automaticQueueModel
.
getOrder_phone
().
substring
(
0
,
3
);
Map
<
String
,
Object
>
map
=
automaticQueueMapper
.
selectSegment
(
phoneThree
);
//1.先判断这是哪个公司的充值订单
//1.先判断这是哪个公司的充值订单
,然后发起充值
SegmentModel
segmentModel
=
(
SegmentModel
)
TransformationTools
.
ToObjectOne
(
SegmentModel
.
class
,
map
);
if
(
segmentModel
.
getOperator
().
equals
(
SegmentType_Cellcard
))
{
//Cellcard的手机号,则选择Cellcard公司的api发起充值
...
...
src/com/library/service/Impl/CommServiceImpl.java
View file @
32323ba5
...
...
@@ -42,17 +42,7 @@ public class CommServiceImpl implements CommService {
@Override
public
ServerResponse
Recharge
()
{
try
{
// String phone = request.getParameter("phone");
// int serviceId = Integer.parseInt(request.getParameter("serviceId"));
// automaticCodeService.automaticForTack();
// Paygo24Utils paygo24Utils = new Paygo24Utils();
// System.out.println("===================开始==================");
// String result = paygo24Utils.payment(phone, serviceId, new BigDecimal(1.0));
// System.out.println(result);
return
ServerResponse
.
createBySuccess
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
src/com/library/util/QiniuUtils.java
View file @
32323ba5
...
...
@@ -23,12 +23,12 @@ public class QiniuUtils {
//设置好账号的ACCESS_KEY和SECRET_KEY
// private static String ACCESS_KEY ="5hILYOS8yK0havuWevEe5R3Qh-AUEGwEvLjHvBuH";
private
static
String
ACCESS_KEY
=
"
bJOJLfSclr6-8fSwkkiKioNyKi3qSIoy4JuFH0DB
"
;
private
static
String
SECRET_KEY
=
"
ziEscQ_7iyV95C8M7BrZ0y_2CXyo0hwLSVVYeG_K
"
;
private
static
String
ACCESS_KEY
=
""
;
private
static
String
SECRET_KEY
=
""
;
private
static
String
domain
=
"
http://qiniu.xnsystem.com
"
;
private
static
String
domain
=
""
;
//要上传的空间
private
static
String
bucketname
=
"
xntest
"
;
private
static
String
bucketname
=
""
;
//密钥配置
private
static
Auth
auth
;
//第一种方式: 指定具体的要上传的zone
...
...
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