...
|
...
|
@@ -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;
|
|
|
|
...
|
...
|
|