[Y] surcharge为实时计算

master
Tayl0r 7 years ago
parent 81fa3ef96c
commit 87584077f9

@ -76,6 +76,13 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService {
logger.error("PlatformClearAnalysisServiceImpl.verifySettleLogByDate ==> 校验" + end_date + "支付宝到账失败:", e); logger.error("PlatformClearAnalysisServiceImpl.verifySettleLogByDate ==> 校验" + end_date + "支付宝到账失败:", e);
} }
} }
if (StringUtils.equals("AlipayOnline", channel)) {
try {
doVerifyAlipayOnlineSettleLog(sdfClear.parse(end_date));
} catch (Exception e) {
logger.error("PlatformClearAnalysisServiceImpl.verifySettleLogByDate ==> 校验" + end_date + "支付宝Online到账失败", e);
}
}
if (StringUtils.equals("Wechat", channel)) { if (StringUtils.equals("Wechat", channel)) {
try { try {
Map<String, Date> settleDate = new HashMap<>(); Map<String, Date> settleDate = new HashMap<>();
@ -130,13 +137,13 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService {
List<Date> dateList = TimeZoneUtils.getStatetime(); List<Date> dateList = TimeZoneUtils.getStatetime();
for (Date dateStr : dateList) { for (Date dateStr : dateList) {
try { try {
doVerifyAlipaySettleLog(dateStr); doVerifyAlipayOnlineSettleLog(dateStr);
} catch (Exception e) { } catch (Exception e) {
logger.error("获取" + dateStr + "Alipay清算记录失败", e); logger.error("获取" + dateStr + "AlipayOnline清算记录失败", e);
} }
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("获取Alipay清算记录时间失败", e); logger.error("获取AlipayOnline清算记录时间失败", e);
} }
} }
@ -322,7 +329,9 @@ public class PlatformClearAnalysisServiceImpl implements PlatformClearService {
sysLogs.put("sys_net_fee", creditLogs.getBigDecimal("aud_amount").subtract(debitLogs.getBigDecimal("aud_amount"))); sysLogs.put("sys_net_fee", creditLogs.getBigDecimal("aud_amount").subtract(debitLogs.getBigDecimal("aud_amount")));
if (StringUtils.equals("Alipay", channel)) { if (StringUtils.equals("Alipay", channel)) {
sysLogs.put("sys_surcharge",platformSettlementMapper.calculateRmbCharge(start_date, end_date, channel)); sysLogs.put("sys_surcharge", platformSettlementMapper.calculateRmbCharge(start_date, end_date, channel, new BigDecimal(0.006)));
} else if (StringUtils.equals("AlipayOnline", channel)) {
sysLogs.put("sys_surcharge", platformSettlementMapper.calculateRmbCharge(start_date, end_date, channel, new BigDecimal(0.018)));
} else { } else {
sysLogs.put("sys_surcharge", creditLogs.getBigDecimal("charge_amount").subtract(debitLogs.getBigDecimal("charge_amount"))); sysLogs.put("sys_surcharge", creditLogs.getBigDecimal("charge_amount").subtract(debitLogs.getBigDecimal("charge_amount")));
} }

@ -36,7 +36,7 @@ public interface PlatformSettlementMapper {
JSONObject calculateSysSettleLog5(@Param("start_date") String start_date, @Param("end_date") String end_date, @Param("channel") String channel, @Param("transaction_type") String type); JSONObject calculateSysSettleLog5(@Param("start_date") String start_date, @Param("end_date") String end_date, @Param("channel") String channel, @Param("transaction_type") String type);
BigDecimal calculateRmbCharge(@Param("start_date") String start_date, @Param("end_date") String end_date, @Param("channel") String channel); BigDecimal calculateRmbCharge(@Param("start_date") String start_date, @Param("end_date") String end_date, @Param("channel") String channel,@Param("ali_rate") BigDecimal ali_rate);
@AutoSql(type = SqlType.DELETE) @AutoSql(type = SqlType.DELETE)
void delete(JSONObject params); void delete(JSONObject params);

@ -28,8 +28,8 @@
<select id="calculateRmbCharge" resultType="decimal"> <select id="calculateRmbCharge" resultType="decimal">
SELECT SELECT
IFNULL( IFNULL(
SUM(CASE transaction_type WHEN 'Credit' THEN ROUND(ROUND(cny_amount * 0.006, 2) / exchange_rate,2) SUM(CASE transaction_type WHEN 'Credit' THEN ROUND(ROUND(cny_amount * #{ali_rate}, 2) / exchange_rate,2)
WHEN 'Debit' THEN -ROUND(ROUND(cny_amount * 0.006, 2) / exchange_rate,2) WHEN 'Debit' THEN -ROUND(ROUND(cny_amount * #{ali_rate}, 2) / exchange_rate,2)
ELSE 0 END), ELSE 0 END),
0.00) ali_charge_amount 0.00) ali_charge_amount
FROM pmt_transactions FROM pmt_transactions

Loading…
Cancel
Save