|
@@ -19,6 +19,7 @@ import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.snowflake.Sequence;
|
|
import com.cyksj.common.snowflake.Sequence;
|
|
|
import com.cyksj.common.util.Jsons;
|
|
import com.cyksj.common.util.Jsons;
|
|
|
import com.cyksj.common.util.SmsUtil;
|
|
import com.cyksj.common.util.SmsUtil;
|
|
|
|
|
+import com.cyksj.common.util.StringUtil;
|
|
|
import com.cyksj.config.zfb.AliPayClientFactory;
|
|
import com.cyksj.config.zfb.AliPayClientFactory;
|
|
|
import com.cyksj.config.zfb.ZfbProductCode;
|
|
import com.cyksj.config.zfb.ZfbProductCode;
|
|
|
import com.cyksj.dto.Result;
|
|
import com.cyksj.dto.Result;
|
|
@@ -87,13 +88,18 @@ public class TransferFuncServiceImpl implements TransferFuncService {
|
|
|
if (!redisService.setNx(key, applyMoneyReq.getUserId(), RedisService.key.APPLY_MONEY_DAY_LIMIT_KEY.getTimeout())) {
|
|
if (!redisService.setNx(key, applyMoneyReq.getUserId(), RedisService.key.APPLY_MONEY_DAY_LIMIT_KEY.getTimeout())) {
|
|
|
throw BusinessRuntimeException.getInstance("每天仅可提现一次");
|
|
throw BusinessRuntimeException.getInstance("每天仅可提现一次");
|
|
|
}
|
|
}
|
|
|
- Result result = commonApplyMoney(applyMoneyReq);
|
|
|
|
|
- if (result.isFlag()) {
|
|
|
|
|
- redisService.set(key, applyMoneyReq.getUserId(), RedisService.key.APPLY_MONEY_DAY_LIMIT_KEY.getTimeout());
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ Result result = commonApplyMoney(applyMoneyReq);
|
|
|
|
|
+ if (result.isFlag()) {
|
|
|
|
|
+ redisService.set(key, applyMoneyReq.getUserId(), RedisService.key.APPLY_MONEY_DAY_LIMIT_KEY.getTimeout());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ redisService.del(key);
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
redisService.del(key);
|
|
redisService.del(key);
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(StringUtil.getErrorMsg(e));
|
|
|
}
|
|
}
|
|
|
- return result;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -103,13 +109,18 @@ public class TransferFuncServiceImpl implements TransferFuncService {
|
|
|
if (!redisService.setNx(key, applyMoneyReq.getUserId(), RedisService.key.APPLY_MONEY_DAY_LIMIT_KEY.getTimeout())) {
|
|
if (!redisService.setNx(key, applyMoneyReq.getUserId(), RedisService.key.APPLY_MONEY_DAY_LIMIT_KEY.getTimeout())) {
|
|
|
throw BusinessRuntimeException.getInstance("每天仅可提现一次");
|
|
throw BusinessRuntimeException.getInstance("每天仅可提现一次");
|
|
|
}
|
|
}
|
|
|
- Result result = yhShopApplyMoney(applyMoneyReq);
|
|
|
|
|
- if (result.isFlag()) {
|
|
|
|
|
- redisService.set(key, applyMoneyReq.getUserId(), RedisService.key.APPLY_MONEY_DAY_LIMIT_KEY.getTimeout());
|
|
|
|
|
- } else {
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ Result result = yhShopApplyMoney(applyMoneyReq);
|
|
|
|
|
+ if (result.isFlag()) {
|
|
|
|
|
+ redisService.set(key, applyMoneyReq.getUserId(), RedisService.key.APPLY_MONEY_DAY_LIMIT_KEY.getTimeout());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ redisService.del(key);
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
redisService.del(key);
|
|
redisService.del(key);
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(StringUtil.getErrorMsg(e));
|
|
|
}
|
|
}
|
|
|
- return result;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -324,6 +335,9 @@ public class TransferFuncServiceImpl implements TransferFuncService {
|
|
|
if (alipayResponse.getSubMsg().contains("冻结")) {
|
|
if (alipayResponse.getSubMsg().contains("冻结")) {
|
|
|
return GatewayResponse.FAIL.newBuilder().setMsg("目前财务清账中,48小时后可提现").toResult();
|
|
return GatewayResponse.FAIL.newBuilder().setMsg("目前财务清账中,48小时后可提现").toResult();
|
|
|
}
|
|
}
|
|
|
|
|
+ if (alipayResponse.getSubMsg().contains("余额不足")) {
|
|
|
|
|
+ return GatewayResponse.FAIL.newBuilder().setMsg("转账失败,请联系客服").toResult();
|
|
|
|
|
+ }
|
|
|
return GatewayResponse.FAIL.newBuilder().setMsg(alipayResponse.getSubMsg()).toResult();
|
|
return GatewayResponse.FAIL.newBuilder().setMsg(alipayResponse.getSubMsg()).toResult();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -418,6 +432,9 @@ public class TransferFuncServiceImpl implements TransferFuncService {
|
|
|
if (alipayResponse.getSubMsg().contains("冻结")) {
|
|
if (alipayResponse.getSubMsg().contains("冻结")) {
|
|
|
return GatewayResponse.FAIL.newBuilder().setMsg("目前财务清账中,48小时后可提现").toResult();
|
|
return GatewayResponse.FAIL.newBuilder().setMsg("目前财务清账中,48小时后可提现").toResult();
|
|
|
}
|
|
}
|
|
|
|
|
+ if (alipayResponse.getSubMsg().contains("余额不足")) {
|
|
|
|
|
+ return GatewayResponse.FAIL.newBuilder().setMsg("转账失败,请联系客服").toResult();
|
|
|
|
|
+ }
|
|
|
return GatewayResponse.FAIL.newBuilder().setMsg(alipayResponse.getSubMsg()).toResult();
|
|
return GatewayResponse.FAIL.newBuilder().setMsg(alipayResponse.getSubMsg()).toResult();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|