Commit 32323ba5 by yanlveming

同步

parent 69b9fd2d
...@@ -325,7 +325,7 @@ public class SeatelSentUtils { ...@@ -325,7 +325,7 @@ public class SeatelSentUtils {
tip += "获取不到余额信息"; tip += "获取不到余额信息";
} }
} else { } else {
tip += "校验号码失败;结果为:" + feeJson; tip += "查询余额失败;结果为:" + feeJson;
} }
} }
......
...@@ -10,10 +10,7 @@ import org.apache.http.util.TextUtils; ...@@ -10,10 +10,7 @@ import org.apache.http.util.TextUtils;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Base64; import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class CellcardSentUtils { public class CellcardSentUtils {
...@@ -54,10 +51,32 @@ public class CellcardSentUtils { ...@@ -54,10 +51,32 @@ public class CellcardSentUtils {
} }
} }
public static String checkBalance(String transaction_id) { public static String checkBalance() {
try { 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(); Map<String, String> params = new HashMap();
params.put("transaction_id", transaction_id); params.put("transaction_id", transaction_id);
params.put("distributor_id", distributor_id); params.put("distributor_id", distributor_id);
...@@ -73,6 +92,9 @@ public class CellcardSentUtils { ...@@ -73,6 +92,9 @@ public class CellcardSentUtils {
String json = HttpUtils.post(url, params, heardMap, 30000, 30000, "utf-8"); String json = HttpUtils.post(url, params, heardMap, 30000, 30000, "utf-8");
return json; return json;
} else {
return "tokenStr为空";
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return null; return null;
...@@ -174,9 +196,11 @@ public class CellcardSentUtils { ...@@ -174,9 +196,11 @@ public class CellcardSentUtils {
// String json = topUpStatus("85561254730", "123"); // String json = topUpStatus("85561254730", "123");
ResultsModel model = sentTopUp("855061254730", "123", 1); // ResultsModel model = sentTopUp("855061254730", "123", 1);
System.out.println("充值结果 " + model.getTip()); // System.out.println("充值结果 " + model.getTip());
System.out.println("充值状态" + model.isSuccessful()); // System.out.println("充值状态" + model.isSuccessful());
String json = checkBalance();
System.out.println(json);
} }
/** /**
......
...@@ -211,17 +211,17 @@ public class MetfoneSentUtils { ...@@ -211,17 +211,17 @@ public class MetfoneSentUtils {
} }
} }
public static void main2222(String[] args) { public static void main(String[] args) {
/* String str = checkMyMoneyPost("1200016", "0979530750"); /* 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"}} //{"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);*/ System.out.println(str);*/
/* String str = billInfoPost("0979530750"); String str = checkMyMoneyPost("20010818431127","0979530750");
System.out.println(str);*/ System.out.println(str);
} }
public static void main(String[] args) { public static void main222(String[] args) {
String phone = "0979530750"; String phone = "0979530750";
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss"); SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
......
package com.library.controller; package com.library.controller;
import com.google.gson.Gson; 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.HttpUtils;
import com.library.TopUp.Statel.HttpClientUtils; import com.library.TopUp.Statel.HttpClientUtils;
import com.library.TopUp.Statel.SeatelSentUtils; import com.library.TopUp.Statel.SeatelSentUtils;
...@@ -11,12 +13,14 @@ import com.library.service.AdminService; ...@@ -11,12 +13,14 @@ import com.library.service.AdminService;
import com.library.service.CommService; import com.library.service.CommService;
import com.library.util.QiniuUtils; import com.library.util.QiniuUtils;
import com.wechat.pay.MD5Util; import com.wechat.pay.MD5Util;
import org.apache.http.util.TextUtils;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -41,83 +45,94 @@ public class CommonController { ...@@ -41,83 +45,94 @@ public class CommonController {
@Resource @Resource
private HttpServletRequest request; 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 @ResponseBody
@RequestMapping("test1") @RequestMapping("checkPhoneInSeatel")
private ServerResponse test() { private ServerResponse checkPhoneInSeatel() {
String phone = "0189464112";
String json = SeatelSentUtils.checkPhone(phone);
return ServerResponse.createBySuccess(json);
}
//登录 String phone = request.getParameter("phone");
@ResponseBody
@RequestMapping("test2")
private ServerResponse test2() {
String phone = "0189464112";
String json = SeatelSentUtils.checkPhone2(phone); String json = SeatelSentUtils.checkPhone2(phone);
return ServerResponse.createBySuccess(json); return ServerResponse.createBySuccess(json);
} }
//登录 //查询Seatel运营商剩余的余额
@ResponseBody @ResponseBody
@RequestMapping("test3") @RequestMapping("queryAgentFeeInSeatel")
private ServerResponse test3() { private ServerResponse queryAgentFeeInSeatel() {
String json = SeatelSentUtils.queryAgentFee(); String feeJson = SeatelSentUtils.queryAgentFee();
return ServerResponse.createBySuccess(json);
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 return ServerResponse.createBySuccess(tip, myAmount);
@RequestMapping("test4")
private ServerResponse test4() {
String phone = "0189464112";
String json = SeatelSentUtils.crmRecharge(phone, 1);
return ServerResponse.createBySuccess(json);
} }
//查询Cellcard运营商剩余的余额
@ResponseBody @ResponseBody
@RequestMapping("test5") @RequestMapping("queryAgentFeeInCellcard")
private ServerResponse test5() { 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"); } else {
String type = request.getParameter("type"); tip += "请求的数据为空";
String json = SeatelSentUtils.queryCrmRecharge(str);
return ServerResponse.createBySuccess(json);
} }
return ServerResponse.createByErrorCodeMessage(3001, tip);
@ResponseBody } catch (Exception e) {
@RequestMapping("sentTopUp") e.printStackTrace();
private ServerResponse sentTopUp() { return ServerResponse.createByErrorCodeMessage(-1, feeJson);
String phone = request.getParameter("phone"); }
// String phone = "0189464112";
ResultsModel resultsModel = SeatelSentUtils.sentTopUp(phone,1);
return ServerResponse.createBySuccess(new Gson().toJson(resultsModel));
} }
......
...@@ -127,7 +127,7 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService { ...@@ -127,7 +127,7 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
String phoneThree = automaticQueueModel.getOrder_phone().substring(0, 3); String phoneThree = automaticQueueModel.getOrder_phone().substring(0, 3);
Map<String, Object> map = automaticQueueMapper.selectSegment(phoneThree); Map<String, Object> map = automaticQueueMapper.selectSegment(phoneThree);
//1.先判断这是哪个公司的充值订单 //1.先判断这是哪个公司的充值订单,然后发起充值
SegmentModel segmentModel = (SegmentModel) TransformationTools.ToObjectOne(SegmentModel.class, map); SegmentModel segmentModel = (SegmentModel) TransformationTools.ToObjectOne(SegmentModel.class, map);
if (segmentModel.getOperator().equals(SegmentType_Cellcard)) { if (segmentModel.getOperator().equals(SegmentType_Cellcard)) {
//Cellcard的手机号,则选择Cellcard公司的api发起充值 //Cellcard的手机号,则选择Cellcard公司的api发起充值
......
...@@ -42,17 +42,7 @@ public class CommServiceImpl implements CommService { ...@@ -42,17 +42,7 @@ public class CommServiceImpl implements CommService {
@Override @Override
public ServerResponse Recharge() { public ServerResponse Recharge() {
try { 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(); return ServerResponse.createBySuccess();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -23,12 +23,12 @@ public class QiniuUtils { ...@@ -23,12 +23,12 @@ public class QiniuUtils {
//设置好账号的ACCESS_KEY和SECRET_KEY //设置好账号的ACCESS_KEY和SECRET_KEY
// private static String ACCESS_KEY ="5hILYOS8yK0havuWevEe5R3Qh-AUEGwEvLjHvBuH"; // private static String ACCESS_KEY ="5hILYOS8yK0havuWevEe5R3Qh-AUEGwEvLjHvBuH";
private static String ACCESS_KEY = "bJOJLfSclr6-8fSwkkiKioNyKi3qSIoy4JuFH0DB"; private static String ACCESS_KEY = "";
private static String SECRET_KEY = "ziEscQ_7iyV95C8M7BrZ0y_2CXyo0hwLSVVYeG_K"; 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 ; private static Auth auth ;
//第一种方式: 指定具体的要上传的zone //第一种方式: 指定具体的要上传的zone
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment