fix 跨境商城扣款接口

master
luoyang 5 years ago
parent 96b5139d97
commit 4da54d7219

@ -93,13 +93,21 @@ public class RetailRSvcServiceImpl implements RetailRSvcService {
throw new InvalidShortIdException(); throw new InvalidShortIdException();
} }
Key key = AESCrypt.fromKeyString(Base64.decodeBase64(params.getString("nonce_str"))); Key key = AESCrypt.fromKeyString(Base64.decodeBase64(params.getString("nonce_str")));
String signPrice = "0";
String signRate = "0";
if (params.get("signPrice") != null) {
signPrice = decData(params.getString("signPrice"), key, svcInfo.getString("platform_pri_key"));
}
if (params.get("signRate") != null) {
signRate = decData(params.getString("signRate"), key, svcInfo.getString("platform_pri_key"));
}
JSONObject serviceApply = new JSONObject(); JSONObject serviceApply = new JSONObject();
serviceApply.put("apply_id", UUID.randomUUID().toString()); serviceApply.put("apply_id", UUID.randomUUID().toString());
serviceApply.put("service_code", sourceCode); serviceApply.put("service_code", sourceCode);
serviceApply.put("client_id", client.getIntValue("client_id")); serviceApply.put("client_id", client.getIntValue("client_id"));
serviceApply.put("title", params.getString("signData")); serviceApply.put("title", params.getString("signData"));
serviceApply.put("amount", decData(params.getString("signPrice"), key, svcInfo.getString("platform_pri_key"))); serviceApply.put("amount", signPrice);
serviceApply.put("surcharge_rate", decData(params.getString("signRate"), key, svcInfo.getString("platform_pri_key"))); serviceApply.put("surcharge_rate", signRate);
serviceApply.put("apply_username", params.getString("signName")); serviceApply.put("apply_username", params.getString("signName"));
serviceApply.put("status", 0); serviceApply.put("status", 0);
serviceApply.put("is_valid", 1); serviceApply.put("is_valid", 1);

@ -33,6 +33,7 @@ import org.thymeleaf.context.Context;
import org.thymeleaf.spring5.SpringTemplateEngine; import org.thymeleaf.spring5.SpringTemplateEngine;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.UUID; import java.util.UUID;
@ -88,22 +89,26 @@ public class RServicesApplyServiceImpl implements RServicesApplyService {
clientServicesApplyMapper.update(applyInfo); clientServicesApplyMapper.update(applyInfo);
JSONObject increment = commonIncrementalChannelMapper.findIncreamentalChannelBySourceCode(applyInfo.getString("service_code")); JSONObject increment = commonIncrementalChannelMapper.findIncreamentalChannelBySourceCode(applyInfo.getString("service_code"));
JSONObject clientServices = clientIncrementalMapper.findByClinetIdAndChannel(applyInfo.getIntValue("client_id"), increment.getString("channel")); JSONObject clientServices = clientIncrementalMapper.findByClinetIdAndChannel(applyInfo.getIntValue("client_id"), increment.getString("channel"));
JSONObject serviceInfo = new JSONObject();
if (applyInfo.getBigDecimal("surcharge_rate").compareTo(BigDecimal.ZERO)>0) {
serviceInfo.put("incremental_mode", 1);
serviceInfo.put("incremental_rate_value", applyInfo.getBigDecimal("surcharge_rate"));
}else {
serviceInfo.put("incremental_mode", 2);
serviceInfo.put("incremental_rate_value", 0);
}
if (clientServices == null) { if (clientServices == null) {
clientServices = new JSONObject(); serviceInfo.put("incremental_id", UUID.randomUUID().toString());
clientServices.put("incremental_id", UUID.randomUUID().toString()); serviceInfo.put("client_id", applyInfo.getIntValue("client_id"));
clientServices.put("client_id", applyInfo.getIntValue("client_id")); serviceInfo.put("channel", increment.getString("channel"));
clientServices.put("channel", increment.getString("channel")); serviceInfo.put("total_incremental_amount", applyInfo.getBigDecimal("amount"));
clientServices.put("incremental_mode", 2); serviceInfo.put("create_time", applyInfo.getDate("create_time"));
clientServices.put("incremental_rate_value", 0); serviceInfo.put("update_time", applyInfo.getDate("operator_time"));
clientServices.put("total_incremental_amount", applyInfo.getBigDecimal("amount")); serviceInfo.put("operator", applyInfo.getString("operator"));
clientServices.put("create_time", applyInfo.getDate("create_time")); serviceInfo.put("is_valid", 1);
clientServices.put("update_time", applyInfo.getDate("operator_time")); clientIncrementalMapper.save(serviceInfo);
clientServices.put("operator", applyInfo.getString("operator"));
clientServices.put("is_valid", 1);
clientIncrementalMapper.save(clientServices);
}else { }else {
clientServices.put("incremental_mode", 2); clientServices.putAll(serviceInfo);
clientServices.put("incremental_rate_value", 0);
clientServices.put("total_incremental_amount", applyInfo.getBigDecimal("amount")); clientServices.put("total_incremental_amount", applyInfo.getBigDecimal("amount"));
clientServices.put("create_time", applyInfo.getDate("create_time")); clientServices.put("create_time", applyInfo.getDate("create_time"));
clientServices.put("update_time", applyInfo.getDate("operator_time")); clientServices.put("update_time", applyInfo.getDate("operator_time"));
@ -111,7 +116,9 @@ public class RServicesApplyServiceImpl implements RServicesApplyService {
clientServices.put("is_valid", 1); clientServices.put("is_valid", 1);
clientIncrementalMapper.update(clientServices); clientIncrementalMapper.update(clientServices);
} }
afterPassProcessingApply(applyInfo); if (applyInfo.getBigDecimal("amount").compareTo(BigDecimal.ZERO) > 0) {
afterPassProcessingApply(applyInfo);
}
} finally { } finally {
locker.unlock(lockKey); locker.unlock(lockKey);
} }
@ -137,6 +144,7 @@ public class RServicesApplyServiceImpl implements RServicesApplyService {
transaction.put("system_transaction_id", orderId); transaction.put("system_transaction_id", orderId);
transaction.put("order_id", orderId); transaction.put("order_id", orderId);
transaction.put("client_id", applyInfo.getIntValue("client_id")); transaction.put("client_id", applyInfo.getIntValue("client_id"));
transaction.put("currency", PlatformEnvironment.getEnv().getForeignCurrency());
transaction.put("transaction_currency", PlatformEnvironment.getEnv().getForeignCurrency()); transaction.put("transaction_currency", PlatformEnvironment.getEnv().getForeignCurrency());
transaction.put("transaction_amount", applyInfo.getBigDecimal("amount")); transaction.put("transaction_amount", applyInfo.getBigDecimal("amount"));
transaction.put("clearing_currency", PlatformEnvironment.getEnv().getForeignCurrency()); transaction.put("clearing_currency", PlatformEnvironment.getEnv().getForeignCurrency());
@ -153,11 +161,11 @@ public class RServicesApplyServiceImpl implements RServicesApplyService {
} }
private void sendNotify(JSONObject applyInfo, JSONObject client) { private void sendNotify(JSONObject applyInfo, JSONObject client) {
try { // try {
retailAppService.sendRServicesApplyMessage(applyInfo, client); // retailAppService.sendRServicesApplyMessage(applyInfo, client);
} catch (Exception e) { // } catch (Exception e) {
logger.error("R-services-{}付费成功app推送发送失败 - {}",client.getIntValue("client_id"), e); // logger.error("R-services-{}付费成功app推送发送失败 - {}",client.getIntValue("client_id"), e);
} // }
JSONObject increment = commonIncrementalChannelMapper.findIncreamentalChannelBySourceCode(applyInfo.getString("service_code")); JSONObject increment = commonIncrementalChannelMapper.findIncreamentalChannelBySourceCode(applyInfo.getString("service_code"));
JSONObject account = clientAccountMapper.findByUsernameForDuplicate(applyInfo.getString("apply_username")); JSONObject account = clientAccountMapper.findByUsernameForDuplicate(applyInfo.getString("apply_username"));
if (increment == null || account == null) { if (increment == null || account == null) {

@ -39,7 +39,8 @@ define(['angular'], function (angular) {
'[<b><span style="color: red">' + apply.client_moniker + '</span></b>]即将签约[' + '[<b><span style="color: red">' + apply.client_moniker + '</span></b>]即将签约[' +
'<b><span style="color: red">' + apply.channel + '</span></b>]服务<br>服务内容:[' + '<b><span style="color: red">' + apply.channel + '</span></b>]服务<br>服务内容:[' +
'<b><span style="color: red">' + apply.title + '</span></b>]<br>需要扣款[' + '<b><span style="color: red">' + apply.title + '</span></b>]<br>需要扣款[' +
'<b><span style="color: red">AUD ' + apply.amount + '</span></b>]<br>申请人[' + '<b><span style="color: red">AUD ' + apply.amount + '</span></b>]<br>手续费附加[' +
'<b><span style="color: red"> ' + apply.surcharge_rate + '%</span></b>]<br>申请人[' +
'<b><span style="color: red"> ' + apply.apply_username + '</span></b>]' + '<b><span style="color: red"> ' + apply.apply_username + '</span></b>]' +
'<br>请确认扣款信息是否正确' '<br>请确认扣款信息是否正确'
); );
@ -58,9 +59,10 @@ define(['angular'], function (angular) {
$scope.refuseApply = function (apply) { $scope.refuseApply = function (apply) {
var contentHtml = $sce.trustAsHtml( var contentHtml = $sce.trustAsHtml(
'[<b><span style="color: red">' + apply.client_moniker + '</span></b>]签约[' + '[<b><span style="color: red">' + apply.client_moniker + '</span></b>]签约[' +
'<b><span style="color: red">' + apply.channel + '</span></b>]服务服务内容:[' + '<b><span style="color: red">' + apply.channel + '</span></b>]<br>服务服务内容:[' +
'<b><span style="color: red">' + apply.title + '</span></b>]需要扣款[' + '<b><span style="color: red">' + apply.title + '</span></b>]<br>需要扣款[' +
'<b><span style="color: red">AUD ' + apply.amount + '</span></b>]申请人[' + '<b><span style="color: red">AUD ' + apply.amount + '</span></b>]<br>手续费附加[' +
'<b><span style="color: red"> ' + apply.surcharge_rate + '%</span></b>]<br>申请人[' +
'<b><span style="color: red"> ' + apply.apply_username + '</span>]' + '<b><span style="color: red"> ' + apply.apply_username + '</span>]' +
'<br>请确认是否拒绝申请' '<br>请确认是否拒绝申请'
); );

@ -69,6 +69,7 @@
<th>Compliance Status</th> <th>Compliance Status</th>
<th>Service Name</th> <th>Service Name</th>
<th>Amount</th> <th>Amount</th>
<th>附加手续费(%)</th>
<th>Service Title</th> <th>Service Title</th>
<th>Status</th> <th>Status</th>
<th>Apply Username</th> <th>Apply Username</th>
@ -100,6 +101,7 @@
</td> </td>
<td ng-bind="apply.channel"></td> <td ng-bind="apply.channel"></td>
<td ng-bind="apply.amount|currency:'AUD'"></td> <td ng-bind="apply.amount|currency:'AUD'"></td>
<td>{{apply.surcharge_rate}}%</td>
<td ng-bind="apply.title"></td> <td ng-bind="apply.title"></td>
<td> <td>
<span ng-if="apply.status==0">待审核</span> <span ng-if="apply.status==0">待审核</span>

Loading…
Cancel
Save