|
|
@@ -40,7 +40,7 @@ public class SettleService {
|
|
|
SettleService settleService;
|
|
|
|
|
|
@Transactional
|
|
|
- public Set<String> settle(String projectOid, String oid, Long startTime, Long endTime, String remark, PaymentType paymentType){
|
|
|
+ public ResultContent settle(String projectOid, String oid, Long endTime, String remark, PaymentType paymentType){
|
|
|
//获取机构-待结算子账
|
|
|
PayAccount waitSettleAccount = payAccountService.getOrgChildren(projectOid, oid, PaymentChannelType.WaitSettle);
|
|
|
//查询时间内所有待结算账单
|
|
|
@@ -49,7 +49,7 @@ public class SettleService {
|
|
|
pageableModel.setPage(0);
|
|
|
pageableModel.setSize(1000000);
|
|
|
queryModel.setPage(pageableModel);
|
|
|
- queryModel.setStartTime(startTime);
|
|
|
+// queryModel.setStartTime(startTime);
|
|
|
queryModel.setEndTime(endTime);
|
|
|
queryModel.setGeneralLedgerId(new String[]{waitSettleAccount.getLedgerId()});
|
|
|
//过滤出对应支付渠道的账单
|
|
|
@@ -57,8 +57,12 @@ public class SettleService {
|
|
|
ResultContent<TransactionLogAggregateRetModel> aggregateResult = transactionLogService.aggregate(queryModel);
|
|
|
if (!aggregateResult.getState().equals(ResultState.Success)){
|
|
|
log.info("资金结算:查询待结算账单失败");
|
|
|
- return null;
|
|
|
+ return aggregateResult;
|
|
|
}
|
|
|
+ if (aggregateResult.getContent().getPages().getContent().isEmpty()){
|
|
|
+ return ResultContent.buildContent(new HashSet<>());
|
|
|
+ }
|
|
|
+
|
|
|
//收入-支出=可提现金额
|
|
|
Long settleAmount = aggregateResult.getContent().getStatistics().getCreditCount() - aggregateResult.getContent().getStatistics().getDebitCount();
|
|
|
//转账 机构待结算子账户- 机构待提现子账户+
|
|
|
@@ -92,7 +96,7 @@ public class SettleService {
|
|
|
List<TransactionLogModel> content = aggregateResult.getContent().getPages().getContent();
|
|
|
|
|
|
if (transfer.getState().equals(ResultState.Success)){
|
|
|
- Set<String> orderNo = new HashSet<>();
|
|
|
+ Set<String> orderNoSet = new HashSet<>();
|
|
|
content.forEach(it -> {
|
|
|
UpdateTransactionLogModel updateTransactionLogModel = new UpdateTransactionLogModel();
|
|
|
Map<String, Object> meta = it.getMeta();
|
|
|
@@ -100,11 +104,11 @@ public class SettleService {
|
|
|
updateTransactionLogModel.setMeta(meta);
|
|
|
updateTransactionLogModel.setId(it.getId());
|
|
|
transactionLogService.update(updateTransactionLogModel);
|
|
|
- orderNo.add(it.getOrderNumber());
|
|
|
+ orderNoSet.add(it.getOrderNumber());
|
|
|
});
|
|
|
- return orderNo;
|
|
|
+ return ResultContent.buildContent(orderNoSet);
|
|
|
}
|
|
|
- log.error("结算失败, projectOid: {}, paymentType: {}", projectOid, paymentType);
|
|
|
- return null;
|
|
|
+ log.error("结算划账失败, projectOid: {}, paymentType: {}", projectOid, paymentType);
|
|
|
+ return transfer;
|
|
|
}
|
|
|
}
|