|
@@ -2,6 +2,7 @@ package com.yohoufo.order.service.impl; |
|
@@ -2,6 +2,7 @@ package com.yohoufo.order.service.impl; |
2
|
|
2
|
|
3
|
import com.alibaba.fastjson.JSON;
|
3
|
import com.alibaba.fastjson.JSON;
|
4
|
import com.alibaba.fastjson.JSONObject;
|
4
|
import com.alibaba.fastjson.JSONObject;
|
|
|
5
|
+import com.google.common.cache.Cache;
|
5
|
import com.yoho.core.config.ConfigReader;
|
6
|
import com.yoho.core.config.ConfigReader;
|
6
|
import com.yoho.core.dal.datasource.annotation.Database;
|
7
|
import com.yoho.core.dal.datasource.annotation.Database;
|
7
|
import com.yoho.error.ServiceError;
|
8
|
import com.yoho.error.ServiceError;
|
|
@@ -49,11 +50,13 @@ import com.yohoufo.order.utils.PaymentHelper; |
|
@@ -49,11 +50,13 @@ import com.yohoufo.order.utils.PaymentHelper; |
49
|
import lombok.val;
|
50
|
import lombok.val;
|
50
|
import org.apache.commons.collections.CollectionUtils;
|
51
|
import org.apache.commons.collections.CollectionUtils;
|
51
|
import org.apache.commons.lang3.StringUtils;
|
52
|
import org.apache.commons.lang3.StringUtils;
|
|
|
53
|
+import org.elasticsearch.common.cache.CacheBuilder;
|
52
|
import org.slf4j.Logger;
|
54
|
import org.slf4j.Logger;
|
53
|
import org.springframework.beans.factory.annotation.Autowired;
|
55
|
import org.springframework.beans.factory.annotation.Autowired;
|
54
|
import org.springframework.stereotype.Service;
|
56
|
import org.springframework.stereotype.Service;
|
55
|
|
57
|
|
56
|
import java.math.BigDecimal;
|
58
|
import java.math.BigDecimal;
|
|
|
59
|
+import java.text.SimpleDateFormat;
|
57
|
import java.util.Date;
|
60
|
import java.util.Date;
|
58
|
import java.util.Map;
|
61
|
import java.util.Map;
|
59
|
import java.util.Objects;
|
62
|
import java.util.Objects;
|
|
@@ -1168,8 +1171,8 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -1168,8 +1171,8 @@ public class PaymentServiceImpl implements IPaymentService { |
1168
|
// {"msg":"Business Failed","code":"40004","sub_msg":"单日最多可转100万元","sub_code":"EXCEED_LIMIT_DM_MAX_AMOUNT"}
|
1171
|
// {"msg":"Business Failed","code":"40004","sub_msg":"单日最多可转100万元","sub_code":"EXCEED_LIMIT_DM_MAX_AMOUNT"}
|
1169
|
if (StringUtils.equals("40004", jsonObject.getString("code"))
|
1172
|
if (StringUtils.equals("40004", jsonObject.getString("code"))
|
1170
|
&& StringUtils.equals("EXCEED_LIMIT_DM_MAX_AMOUNT", jsonObject.getString("sub_code"))) {
|
1173
|
&& StringUtils.equals("EXCEED_LIMIT_DM_MAX_AMOUNT", jsonObject.getString("sub_code"))) {
|
1171
|
- exceedMillion = true;
|
|
|
1172
|
- logger.info("transferWhenExceedMillion 转账阿里接口返回 {},进入商家转账模式 exceedMillion={}", jsonObject, exceedMillion);
|
1174
|
+ lastTransferDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
|
|
|
1175
|
+ logger.info("transferWhenExceedMillion 转账阿里接口返回 {},进入商家转账模式 lastTransferDate={}", jsonObject, lastTransferDate);
|
1173
|
return true;
|
1176
|
return true;
|
1174
|
}
|
1177
|
}
|
1175
|
return false;
|
1178
|
return false;
|
|
@@ -1178,10 +1181,15 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -1178,10 +1181,15 @@ public class PaymentServiceImpl implements IPaymentService { |
1178
|
private boolean exceedMillion() {
|
1181
|
private boolean exceedMillion() {
|
1179
|
boolean zkValue = configReader.getBoolean("ufo.order.pay.exceedSwitch", false);
|
1182
|
boolean zkValue = configReader.getBoolean("ufo.order.pay.exceedSwitch", false);
|
1180
|
logger.info("transferWhenExceedMillion ufo.order.pay.exceedSwitch={}", zkValue);
|
1183
|
logger.info("transferWhenExceedMillion ufo.order.pay.exceedSwitch={}", zkValue);
|
1181
|
- return zkValue || exceedMillion;
|
1184
|
+ if (zkValue) {
|
|
|
1185
|
+ return true;
|
|
|
1186
|
+ }
|
|
|
1187
|
+ String nowDate = new SimpleDateFormat("yyyyMMdd").format(new Date());
|
|
|
1188
|
+ return StringUtils.equals(lastTransferDate, nowDate);
|
1182
|
}
|
1189
|
}
|
1183
|
|
1190
|
|
1184
|
- private volatile boolean exceedMillion = false;
|
1191
|
+ private volatile String lastTransferDate = null;
|
|
|
1192
|
+
|
1185
|
@Autowired
|
1193
|
@Autowired
|
1186
|
private ConfigReader configReader;
|
1194
|
private ConfigReader configReader;
|
1187
|
|
1195
|
|