Authored by qinchao

Merge branch 'test6.8.8' of http://git.yoho.cn/ufo/yohoufo-fore into test6.8.8

... ... @@ -2,6 +2,7 @@ package com.yohoufo.order.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.cache.Cache;
import com.yoho.core.config.ConfigReader;
import com.yoho.core.dal.datasource.annotation.Database;
import com.yoho.error.ServiceError;
... ... @@ -49,11 +50,13 @@ import com.yohoufo.order.utils.PaymentHelper;
import lombok.val;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.common.cache.CacheBuilder;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.Objects;
... ... @@ -1168,8 +1171,8 @@ public class PaymentServiceImpl implements IPaymentService {
// {"msg":"Business Failed","code":"40004","sub_msg":"单日最多可转100万元","sub_code":"EXCEED_LIMIT_DM_MAX_AMOUNT"}
if (StringUtils.equals("40004", jsonObject.getString("code"))
&& StringUtils.equals("EXCEED_LIMIT_DM_MAX_AMOUNT", jsonObject.getString("sub_code"))) {
exceedMillion = true;
logger.info("transferWhenExceedMillion 转账阿里接口返回 {},进入商家转账模式 exceedMillion={}", jsonObject, exceedMillion);
lastTransferDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
logger.info("transferWhenExceedMillion 转账阿里接口返回 {},进入商家转账模式 lastTransferDate={}", jsonObject, lastTransferDate);
return true;
}
return false;
... ... @@ -1178,10 +1181,15 @@ public class PaymentServiceImpl implements IPaymentService {
private boolean exceedMillion() {
boolean zkValue = configReader.getBoolean("ufo.order.pay.exceedSwitch", false);
logger.info("transferWhenExceedMillion ufo.order.pay.exceedSwitch={}", zkValue);
return zkValue || exceedMillion;
if (zkValue) {
return true;
}
String nowDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
return StringUtils.equals(lastTransferDate, nowDate);
}
private volatile boolean exceedMillion = false;
private volatile String lastTransferDate = null;
@Autowired
private ConfigReader configReader;
... ...
... ... @@ -4,6 +4,7 @@ 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.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.BlockJUnit4ClassRunner;
... ... @@ -19,7 +20,7 @@ public class BaseTest {
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);
Assert.assertTrue(res);
}
@Test
... ...