Commit 68786c20 by giaogiao

以前那个人 本地没提交的代码

parent 0562463e
...@@ -16,9 +16,10 @@ import java.util.Map; ...@@ -16,9 +16,10 @@ import java.util.Map;
public class MetfoneSentUtils { public class MetfoneSentUtils {
private final static String baseUrl = "https://36.37.242.116:8301/"; 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://payment.emoney.com.kh:8888/"; //线上
private final static String PIN = "298315"; private final static String PIN = "298315";
private final static String MyAuthorization = "epa 2478e27af578e11a6af86a8320562124240f5c972e8039cd9c564e53d643bb31";
public static String initTel(String transAmount, String refId, String customerPhoneNumber) { public static String initTel(String transAmount, String refId, String customerPhoneNumber) {
...@@ -32,7 +33,7 @@ public class MetfoneSentUtils { ...@@ -32,7 +33,7 @@ public class MetfoneSentUtils {
Map<String, String> heardMap = new HashMap<>(); Map<String, String> heardMap = new HashMap<>();
heardMap.put("Authorization", "epa 2478e27af578e11a6af86a8320562124240f5c972e8039cd9c564e53d643bb31"); heardMap.put("Authorization", MyAuthorization);
heardMap.put("e-language", "English"); heardMap.put("e-language", "English");
heardMap.put("Content-Type", "application/json"); heardMap.put("Content-Type", "application/json");
heardMap.put("Accept", "application/json"); heardMap.put("Accept", "application/json");
...@@ -49,7 +50,7 @@ public class MetfoneSentUtils { ...@@ -49,7 +50,7 @@ public class MetfoneSentUtils {
public static String confirmTel(String txPaymentTokenId) { public static String confirmTel(String txPaymentTokenId) {
Map<String, String> heardMap = new HashMap<>(); Map<String, String> heardMap = new HashMap<>();
heardMap.put("Authorization", "epa 2478e27af578e11a6af86a8320562124240f5c972e8039cd9c564e53d643bb31"); heardMap.put("Authorization", MyAuthorization);
heardMap.put("e-language", "English"); heardMap.put("e-language", "English");
heardMap.put("Content-Type", "application/json"); heardMap.put("Content-Type", "application/json");
heardMap.put("Accept", "application/json"); heardMap.put("Accept", "application/json");
...@@ -80,7 +81,7 @@ public class MetfoneSentUtils { ...@@ -80,7 +81,7 @@ public class MetfoneSentUtils {
Map<String, String> heardMap = new HashMap<>(); Map<String, String> heardMap = new HashMap<>();
heardMap.put("Authorization", "epa 2478e27af578e11a6af86a8320562124240f5c972e8039cd9c564e53d643bb31"); heardMap.put("Authorization", MyAuthorization);
heardMap.put("e-language", "English"); heardMap.put("e-language", "English");
heardMap.put("Content-Type", "application/json"); heardMap.put("Content-Type", "application/json");
heardMap.put("Accept", "application/json"); heardMap.put("Accept", "application/json");
...@@ -106,7 +107,7 @@ public class MetfoneSentUtils { ...@@ -106,7 +107,7 @@ public class MetfoneSentUtils {
try { try {
Map<String, String> heardMap = new HashMap<>(); Map<String, String> heardMap = new HashMap<>();
heardMap.put("Authorization", "epa 2478e27af578e11a6af86a8320562124240f5c972e8039cd9c564e53d643bb31"); heardMap.put("Authorization", MyAuthorization);
heardMap.put("e-language", "English"); heardMap.put("e-language", "English");
heardMap.put("Content-Type", "application/json"); heardMap.put("Content-Type", "application/json");
heardMap.put("Accept", "application/json"); heardMap.put("Accept", "application/json");
...@@ -130,7 +131,7 @@ public class MetfoneSentUtils { ...@@ -130,7 +131,7 @@ public class MetfoneSentUtils {
try { try {
Map<String, String> heardMap = new HashMap<>(); Map<String, String> heardMap = new HashMap<>();
heardMap.put("Authorization", "epa 2478e27af578e11a6af86a8320562124240f5c972e8039cd9c564e53d643bb31"); heardMap.put("Authorization", MyAuthorization);
heardMap.put("e-language", "English"); heardMap.put("e-language", "English");
heardMap.put("Content-Type", "application/json"); heardMap.put("Content-Type", "application/json");
heardMap.put("Accept", "application/json"); heardMap.put("Accept", "application/json");
...@@ -155,7 +156,7 @@ public class MetfoneSentUtils { ...@@ -155,7 +156,7 @@ public class MetfoneSentUtils {
try { try {
Map<String, String> heardMap = new HashMap<>(); Map<String, String> heardMap = new HashMap<>();
heardMap.put("Authorization", "epa 2478e27af578e11a6af86a8320562124240f5c972e8039cd9c564e53d643bb31"); heardMap.put("Authorization", MyAuthorization);
heardMap.put("e-language", "English"); heardMap.put("e-language", "English");
heardMap.put("Content-Type", "application/json"); heardMap.put("Content-Type", "application/json");
heardMap.put("Accept", "application/json"); heardMap.put("Accept", "application/json");
...@@ -186,7 +187,7 @@ public class MetfoneSentUtils { ...@@ -186,7 +187,7 @@ public class MetfoneSentUtils {
try { try {
Map<String, String> heardMap = new HashMap<>(); Map<String, String> heardMap = new HashMap<>();
heardMap.put("Authorization", "epa 2478e27af578e11a6af86a8320562124240f5c972e8039cd9c564e53d643bb31"); heardMap.put("Authorization", MyAuthorization);
heardMap.put("e-language", "English"); heardMap.put("e-language", "English");
heardMap.put("Content-Type", "application/json"); heardMap.put("Content-Type", "application/json");
heardMap.put("Accept", "application/json"); heardMap.put("Accept", "application/json");
......
...@@ -3,27 +3,18 @@ package com.library.service.Impl; ...@@ -3,27 +3,18 @@ package com.library.service.Impl;
import com.library.config.NameValue; import com.library.config.NameValue;
import com.library.mapper.AdminMapper; import com.library.mapper.AdminMapper;
import com.library.mapper.CurrencyMapper; import com.library.mapper.CurrencyMapper;
import com.library.model.*; import com.library.model.AdminModel;
import com.library.respcode.ResponseCode; import com.library.respcode.ResponseCode;
import com.library.respcode.ServerResponse; import com.library.respcode.ServerResponse;
import com.library.service.AdminService; import com.library.service.AdminService;
import com.library.util.PictureCode;
import com.library.util.TransformationTools; import com.library.util.TransformationTools;
import org.apache.http.util.TextUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID;
@Service @Service
public class AdminServiceImpl implements AdminService { public class AdminServiceImpl implements AdminService {
...@@ -82,8 +73,4 @@ public class AdminServiceImpl implements AdminService { ...@@ -82,8 +73,4 @@ public class AdminServiceImpl implements AdminService {
} }
} }
...@@ -34,15 +34,17 @@ import java.util.regex.Pattern; ...@@ -34,15 +34,17 @@ import java.util.regex.Pattern;
@Transactional @Transactional
public class AutomaticCodeServiceImpl implements AutomaticCodeService { public class AutomaticCodeServiceImpl implements AutomaticCodeService {
private final static String SegmentType_Cellcard = "Cellcard";
private final static String SegmentType_Metfone = "Metfone";
private final static String SegmentType_Smart = "Smart";
private final static String SegmentType_Seatel = "Seatel";
public static String REGULARLY = "^1(3[0-9]|4[57]|5[0-35-9]|7[0135678]|8[0-9])\\d{8}$";
private static final String PREFIX_ZERO = "0";
@Resource @Resource
private AutomaticQueueMapper automaticQueueMapper; private AutomaticQueueMapper automaticQueueMapper;
@Resource @Resource
private CurrencyMapper currencyMapper; private CurrencyMapper currencyMapper;
private static String PREFIX_ZERO = "0";
public static String REGULARLY = "^1(3[0-9]|4[57]|5[0-35-9]|7[0135678]|8[0-9])\\d{8}$";
@Override @Override
public boolean isChinaPhone(String phone) { public boolean isChinaPhone(String phone) {
if (StringUtils.isBlank(phone)) { if (StringUtils.isBlank(phone)) {
...@@ -50,15 +52,12 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService { ...@@ -50,15 +52,12 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
} }
String removePhone = phone; String removePhone = phone;
if (phone.startsWith(PREFIX_ZERO)) { if (phone.startsWith(PREFIX_ZERO)) {
removePhone = phone.substring(0, phone.length()); removePhone = phone;
} }
// 判断是否是中国手机号 // 判断是否是中国手机号
if (Pattern.matches(REGULARLY, removePhone)) { // 是
// 是 return Pattern.matches(REGULARLY, removePhone);
return true;
}
return false;
} }
//开始自动充值 //开始自动充值
...@@ -111,11 +110,6 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService { ...@@ -111,11 +110,6 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
} }
} }
private final static String SegmentType_Cellcard = "Cellcard";
private final static String SegmentType_Metfone = "Metfone";
private final static String SegmentType_Smart = "Smart";
private final static String SegmentType_Seatel = "Seatel";
private ResultsModel sentTopup(AutomaticQueueModel automaticQueueModel, String top_up_num) { private ResultsModel sentTopup(AutomaticQueueModel automaticQueueModel, String top_up_num) {
ResultsModel resultsModel = null; ResultsModel resultsModel = null;
...@@ -148,11 +142,7 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService { ...@@ -148,11 +142,7 @@ public class AutomaticCodeServiceImpl implements AutomaticCodeService {
resultsModel = new ResultsModel(); resultsModel = new ResultsModel();
resultsModel.setTip(result);//描述 resultsModel.setTip(result);//描述
if (result.equals(Paygo24Utils.SUCCESS)) { resultsModel.setSuccessful(result.equals(Paygo24Utils.SUCCESS));
resultsModel.setSuccessful(true);
} else {
resultsModel.setSuccessful(false);
}
resultsModel.setTopUpNum(orderNumId); resultsModel.setTopUpNum(orderNumId);
} }
......
...@@ -8,20 +8,10 @@ import com.library.TopUp.mefont.MetfoneSentUtils; ...@@ -8,20 +8,10 @@ import com.library.TopUp.mefont.MetfoneSentUtils;
import com.library.config.NameValue; import com.library.config.NameValue;
import com.library.mapper.CommMapper; import com.library.mapper.CommMapper;
import com.library.mapper.CurrencyMapper; import com.library.mapper.CurrencyMapper;
import com.library.model.AdminModel;
import com.library.model.UserModel;
import com.library.respcode.ServerResponse; import com.library.respcode.ServerResponse;
import com.library.service.AutomaticCodeService; import com.library.service.AutomaticCodeService;
import com.library.service.CommService; import com.library.service.CommService;
import com.library.util.MSMmethodUtil;
import com.library.util.Paygo24Utils;
import com.library.util.SendEmailTools; 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.apache.http.util.TextUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -29,9 +19,12 @@ import javax.annotation.Resource; ...@@ -29,9 +19,12 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.SimpleTimeZone;
import java.util.TimeZone;
@Service @Service
public class CommServiceImpl implements CommService { public class CommServiceImpl implements CommService {
...@@ -46,6 +39,32 @@ public class CommServiceImpl implements CommService { ...@@ -46,6 +39,32 @@ public class CommServiceImpl implements CommService {
@Resource @Resource
private AutomaticCodeService automaticCodeService; 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 @Override
public ServerResponse Recharge() { public ServerResponse Recharge() {
try { try {
...@@ -292,31 +311,4 @@ public class CommServiceImpl implements CommService { ...@@ -292,31 +311,4 @@ 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());
}
} }
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