|
|
@ -10,6 +10,7 @@ import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
|
|
|
|
import au.com.royalpay.payment.tools.locale.LocaleSupport;
|
|
|
|
import au.com.royalpay.payment.tools.locale.LocaleSupport;
|
|
|
|
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
|
|
|
|
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
|
|
|
|
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
|
|
|
|
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.CurrencyAmountUtils;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
@ -79,12 +80,16 @@ public class ManualSettleSupportImpl implements ManualSettleSupport {
|
|
|
|
todayTask.put("locked", settleLogs.isEmpty());
|
|
|
|
todayTask.put("locked", settleLogs.isEmpty());
|
|
|
|
if (includingUnsettleData) {
|
|
|
|
if (includingUnsettleData) {
|
|
|
|
List<JSONObject> unsettleReports = transactionMapper.listClientUnsettleDataByDate(clientId);
|
|
|
|
List<JSONObject> unsettleReports = transactionMapper.listClientUnsettleDataByDate(clientId);
|
|
|
|
unsettleReports.parallelStream().forEach(report -> report.put("date_str", DateFormatUtils.format(report.getDate("trans_date"), "yyyy-MM-dd")));
|
|
|
|
unsettleReports.parallelStream().forEach(report -> {
|
|
|
|
|
|
|
|
report.put("clearing_amount", CurrencyAmountUtils.scalePlatformCurrency(report.getBigDecimal("clearing_amount")));
|
|
|
|
|
|
|
|
report.put("settle_amount", CurrencyAmountUtils.scalePlatformCurrency(report.getBigDecimal("settle_amount")));
|
|
|
|
|
|
|
|
report.put("date_str", DateFormatUtils.format(report.getDate("trans_date"), "yyyy-MM-dd"));
|
|
|
|
|
|
|
|
});
|
|
|
|
todayTask.put("unsettle", unsettleReports);
|
|
|
|
todayTask.put("unsettle", unsettleReports);
|
|
|
|
BigDecimal totalClearing = unsettleReports.stream().map(report -> report.getBigDecimal("clearing_amount")).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
|
|
|
|
BigDecimal totalClearing = unsettleReports.stream().map(report -> report.getBigDecimal("clearing_amount")).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
|
|
|
|
todayTask.put("total_clearing_amount", totalClearing);
|
|
|
|
todayTask.put("total_clearing_amount", CurrencyAmountUtils.scalePlatformCurrency(totalClearing));
|
|
|
|
BigDecimal totalSettle = unsettleReports.stream().map(report -> report.getBigDecimal("settle_amount")).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
|
|
|
|
BigDecimal totalSettle = unsettleReports.stream().map(report -> report.getBigDecimal("settle_amount")).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
|
|
|
|
todayTask.put("total_settle_amount", totalSettle);
|
|
|
|
todayTask.put("total_settle_amount", CurrencyAmountUtils.scalePlatformCurrency(totalSettle));
|
|
|
|
todayTask.put("desc", LocaleSupport.localeMessage("manual_settle.notice"));
|
|
|
|
todayTask.put("desc", LocaleSupport.localeMessage("manual_settle.notice"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return todayTask;
|
|
|
|
return todayTask;
|
|
|
|