Commit 1aa2659e authored by jim's avatar jim

Merge branch 'master' into staging

# Conflicts:
#	src/main/java/com/edgec/browserbackend/account/service/SmsUtils.java
parents 3dbb5ad4 b89daafd
......@@ -44,7 +44,7 @@ public class SmsUtils {
if (response.getHttpStatus() == 200 && response.getData().contains("OK")) {
return randomCode;
} else {
log.error("fail to send sms {}", response.getData());
log.error("fail to send sms {} for user {}", response.getData(), phone);
throw new ClientRequestException(AccountErrorCode.OTPSENDFAILS, AccountErrorCode.OTPSENDFAILS.getReason());
}
} catch (ServerException e) {
......
......@@ -266,7 +266,7 @@ public class PaymentServiceImpl implements PaymentService {
boolean isVpsClient = true;
AlipayConfig alipayConfig = isVpsClient ? new VpsAlipayConfig() : new CloudamAlipayConfig();
AlipayConfig alipayConfig = new VpsAlipayConfig();
AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig.getURL(), alipayConfig.getAPPID(), alipayConfig.getAPP_PRIVATE_KEY(),
"json", alipayConfig.getCHARSET(), alipayConfig.getALIPAY_PUBLIC_KEY(), alipayConfig.getSIGN_TYPE());
......@@ -757,9 +757,12 @@ public class PaymentServiceImpl implements PaymentService {
balance = new UserBalance();
balance.setUsername(byTradeNo.getUsername());
}
balance.setBalanced(balance.getBalanced() + byTradeNo.getAmount());
userBalanceRepository.save(balance);
// 充值返现
PayBack payBack = payBackRepository.findByPay(byTradeNo.getAmount());
if (payBack == null)
payBack = new PayBack();
balance.setBalanced(balance.getBalanced() + byTradeNo.getAmount() + payBack.getBack());
balance = userBalanceRepository.save(balance);
}
result.setBalance(Math.round(balance.getBalanced()));
......@@ -800,7 +803,7 @@ public class PaymentServiceImpl implements PaymentService {
boolean isVpsClient = true;
AlipayConfig alipayConfig = isVpsClient ? new VpsAlipayConfig() : new CloudamAlipayConfig();
AlipayConfig alipayConfig = new VpsAlipayConfig();
AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig.getURL(), alipayConfig.getAPPID(), alipayConfig.getAPP_PRIVATE_KEY(),
"json", alipayConfig.getCHARSET(), alipayConfig.getALIPAY_PUBLIC_KEY(), alipayConfig.getSIGN_TYPE());
......@@ -821,13 +824,17 @@ public class PaymentServiceImpl implements PaymentService {
boolean b = userPaymentRepository.updatePaymentResult(byTradeNo, true);
if (b) {
if (balance == null) {
balance = new UserBalance();
balance.setUsername(byTradeNo.getUsername());
}
balance.setBalanced(balance.getBalanced() + byTradeNo.getAmount());
userBalanceRepository.save(balance);
// 充值返现
PayBack payBack = payBackRepository.findByPay(byTradeNo.getAmount());
if (payBack == null)
payBack = new PayBack();
balance.setBalanced(balance.getBalanced() + byTradeNo.getAmount() + payBack.getBack());
balance = userBalanceRepository.save(balance);
}
result.setBalance(Math.round(balance.getBalanced()));
......
......@@ -17,6 +17,7 @@ import com.edgec.browserbackend.browser.service.IpResourceService;
import com.edgec.browserbackend.common.commons.error.ClientRequestException;
import com.edgec.browserbackend.common.commons.utils.NotifyUtils;
import com.edgec.browserbackend.common.utils.FileUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
......@@ -538,7 +539,7 @@ public class IpResourceServiceImpl implements IpResourceService {
// 获取当前用户的 ip 资及未使用的 ip资源
dealIpResourceByGroup(ipResources, notUsed, account, username, groupType);
if (notUsed != null) {
if (CollectionUtils.isNotEmpty(notUsed)) {
ipResources.addAll(notUsed);
}
......@@ -865,9 +866,10 @@ public class IpResourceServiceImpl implements IpResourceService {
notUsed = ipResourceRepository.findByOwnerInAndStatusInAndIsDeletedAndBind(accountNameList, Arrays.asList(0, 2, 4, 8), false, false);
break;
}
ipResourceList.addAll(ipResources);
notUsedList.addAll(notUsed);
if (CollectionUtils.isNotEmpty(ipResources))
ipResourceList.addAll(ipResources);
if (CollectionUtils.isNotEmpty(notUsed))
notUsedList.addAll(notUsed);
}
@NotNull
......
......@@ -93,13 +93,15 @@ public class Trans {
HttpEntity entry = response.getEntity();
return EntityUtils.toString(entry, Charsets.UTF_8);
} catch (ClientProtocolException e) {
logger.error(e.getMessage(), e);
logger.error("ClientProtocolException");
return "";
} catch (IOException e) {
logger.error(e.getMessage(), e);
// logger.error(e.getMessage(), e);
logger.error("IOException");
return "";
} catch (Exception e) {
logger.error(e.getMessage(), e);
// logger.error(e.getMessage(), e);
logger.error("Exception");
return "";
} finally {
httpGet.releaseConnection();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment