Authored by LUOXC

Merge branch 'dev_pay_million' into test6.8.8

... ... @@ -2,6 +2,7 @@ package com.yohoufo.order.service.pay.alipay;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Splitter;
import com.yoho.core.common.utils.MD5;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
... ... @@ -506,24 +507,24 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
if (data.endsWith("|")) {
data = data.substring(0, data.length() - 1);
}
String[] dataArray = data.split("^");
if (dataArray.length != 8) {
List<String> dataList = Splitter.on("^").splitToList(data);
if (dataList.size() != 8) {
logger.error("[{}] getTransferData 支付宝回调数据字段个数有误", data);
return null;
}
// 1流水号^2收款方账号^3收款账号姓名^4付款金额^5成功标识(S)^6成功原因(null)^7支付宝内部流水号^8完成时间
try {
TransferData transferData = new TransferData();
String[] transferIdAndTradeBillId = dataArray[0].split("_");
String[] transferIdAndTradeBillId = dataList.get(0).split("_");
transferData.setTransferId(new Integer(transferIdAndTradeBillId[0]));
transferData.setTradeBillsId(new Integer(transferIdAndTradeBillId[1]));
transferData.setReceiveAccount(dataArray[1]);
transferData.setReceiveUserName(dataArray[2]);
transferData.setMoney(dataArray[3]);
transferData.setStatus(dataArray[4]);
transferData.setMessage(dataArray[5]);
transferData.setAlipayTradeId(dataArray[6]);
transferData.setTime(dataArray[7]);
transferData.setReceiveAccount(dataList.get(1));
transferData.setReceiveUserName(dataList.get(2));
transferData.setMoney(dataList.get(3));
transferData.setStatus(dataList.get(4));
transferData.setMessage(dataList.get(5));
transferData.setAlipayTradeId(dataList.get(6));
transferData.setTime(dataList.get(7));
return transferData;
} catch (NumberFormatException e) {
logger.error("[{}] getTransferData 支付宝回调数据格式有误", data);
... ...
package com.yohoufo.order;
import com.google.common.base.Splitter;
import com.yohoufo.common.utils.RSAUtils;
import com.yohoufo.order.config.AlipayConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.BlockJUnit4ClassRunner;
import java.util.List;
@RunWith(BlockJUnit4ClassRunner.class)
public class BaseTest{
public class BaseTest {
@Test
public void test(){
public void test() {
String preSignStr = "batch_no=9884287188801&notify_id=2019031800222113643024821059927489&notify_time=2019-03-18 11:36:43&notify_type=batch_trans_notify&pay_account_no=20884218506361930156&pay_user_id=2088421850636193&pay_user_name=欧印南京贸易有限公司&success_details=1984_8214^2088002849778663^骆秀春^1.00^S^^201903180528078214^20190318113643|";
String sign = "BEDIzBQ6n7fyb4uAxH4lQt/GI9aaEY1Pxhz5tTH6q18u3Sz3ERzlnOLv1mIeD5BrFPtjDFc0R4WlUJ0a4do2/1pHd6SBP7hD3U5olP2Dw+HjoFDzlKBAueiDqOgfPpyVtrks/oZ7n5bu4jh2+XVKfN3JkMyem++yoKqEN0kQywc=";
String key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnxj/9qwVfgoUh/y2W89L6BkRAFljhNhgPdyPuBV64bfQNN1PjbCzkIM6qRdKBoLPXmKKMiFYnkd6rAoprih3/PrQEB/VsW8OoM8fxn67UDYuyBTqA23MML9q1+ilIZwBC2AQ2UBVOrFXfFl75p6/B5KsiNG9zpgmLCUYuLkxpLQIDAQAB";
boolean res = RSAUtils.verify(preSignStr, sign, key, AlipayConfig.input_charset);
System.out.println(res);
}
@Test
public void test2() {
String s = "1986_8220^2088002849778663^骆秀春^56.00^S^^201903180528090512^20190318121624";
String[] aa = s.split("^");
for (int i = 0; i < aa.length; i++) {
System.out.println(i + "-->" + aa[i]);
}
List<String> bb = Splitter.on("^").splitToList(s);
for (int i = 0; i < bb.size(); i++) {
System.out.println(i + "-->" + bb.get(i));
}
}
}
\ No newline at end of file
... ...