|
|
@ -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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (applyInfo.getBigDecimal("amount").compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
afterPassProcessingApply(applyInfo);
|
|
|
|
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) {
|
|
|
|