|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package au.com.royalpay.payment.manage.settlement.core.impls;
|
|
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.analysis.mappers.ClientAnalysisMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.log.ClearingLogMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.payment.TaskManualSettleMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
|
|
|
|
@ -13,14 +14,17 @@ import au.com.royalpay.payment.tools.locale.LocaleSupport;
|
|
|
|
|
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
|
|
|
|
|
import au.com.royalpay.payment.tools.permission.enums.PartnerRole;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.CurrencyAmountUtils;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.PageListUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.Order;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
|
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -45,6 +49,8 @@ public class ManualSettleSupportImpl implements ManualSettleSupport {
|
|
|
|
|
private CalendarMapper calendarMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientManager clientManager;
|
|
|
|
|
@Resource
|
|
|
|
|
private ClientAnalysisMapper clientAnalysisMapper;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject requestManualSettle(Date settleTo, String accountId) {
|
|
|
|
@ -138,22 +144,19 @@ public class ManualSettleSupportImpl implements ManualSettleSupport {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<JSONObject> listWithClearInfo() {
|
|
|
|
|
List<JSONObject> manuals = taskManualSettleMapper.getEveryLatestRecord();
|
|
|
|
|
List<Integer> client_ids = new ArrayList<>(manuals.size());
|
|
|
|
|
manuals.parallelStream().forEach(p -> {
|
|
|
|
|
client_ids.add(p.getInteger("client_id"));
|
|
|
|
|
});
|
|
|
|
|
List<JSONObject> clientUnsettle = transactionMapper.getClientsUnClearedAmount(client_ids);
|
|
|
|
|
for (JSONObject manual : manuals) {
|
|
|
|
|
for (JSONObject settle : clientUnsettle) {
|
|
|
|
|
if (manual.getIntValue("client_id") == settle.getIntValue("client_id")) {
|
|
|
|
|
manual.put("unsettle", settle.getBigDecimal("clearing_amount"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public JSONObject listWithClearInfo(int page) {
|
|
|
|
|
PageList<JSONObject> manuals = taskManualSettleMapper.getEveryLatestRecord(
|
|
|
|
|
new PageBounds(page, 20, Order.formString("unsettle.desc")));
|
|
|
|
|
return PageListUtils.buildPageListResult(manuals);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return manuals;
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getWithManualSettleAnalysis() {
|
|
|
|
|
JSONObject params = new JSONObject();
|
|
|
|
|
params.put("end", new Date());
|
|
|
|
|
JSONObject analysis = taskManualSettleMapper.getManualSettleAnalysis();
|
|
|
|
|
analysis.put("total_partners", clientAnalysisMapper.countClientsAll(params));
|
|
|
|
|
return analysis;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|