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