|
|
@@ -1,5 +1,6 @@
|
|
|
package com.zhongshu.card.server.core.service.pay;
|
|
|
|
|
|
+import com.github.microservice.components.data.base.page.PageableModel;
|
|
|
import com.github.microservice.components.data.base.util.PageEntityUtil;
|
|
|
import com.github.microservice.core.util.JsonUtil;
|
|
|
import com.github.microservice.core.util.queue.ExecuteQueueUtil;
|
|
|
@@ -214,6 +215,10 @@ public class WithdrawService extends SuperService {
|
|
|
PaymentType paymentType = param.getPaymentType();
|
|
|
BigDecimal amount = param.getAmount();
|
|
|
|
|
|
+ if(amount.compareTo(new BigDecimal(0)) == 0) {
|
|
|
+ return com.github.microservice.net.ResultContent.buildFail("提现金额不能为0");
|
|
|
+ }
|
|
|
+
|
|
|
if (StringUtils.isBlank(projectOid)) {
|
|
|
projectOid = getCurrentProjectOid();
|
|
|
}
|
|
|
@@ -260,7 +265,7 @@ public class WithdrawService extends SuperService {
|
|
|
sourceTransaction.setTransactionType(TransactionType.WithdrawFrozen);
|
|
|
sourceTransaction.setTransactionStatus(TransactionStatus.Success);
|
|
|
sourceTransaction.setAmount(amount.negate().longValue());
|
|
|
- sourceTransaction.setMeta(Map.of("paymentType", paymentType, "paymentChannelType", paymentType.getChannelType(), "description", "提现冻结"));
|
|
|
+ sourceTransaction.setMeta(Map.of("paymentType", paymentType, "paymentChannelType", paymentType.getChannelType(), "description", "提现冻结", "withdrawMethodType", projectMainPaySetting.getWithdrawMethodType()));
|
|
|
transferModel.setSource(new TransferTransactionsModel.GeneralLedgerTransaction[]{sourceTransaction});
|
|
|
//构建入账账户
|
|
|
TransferTransactionsModel.GeneralLedgerTransaction destinationTransaction = new TransferTransactionsModel.GeneralLedgerTransaction();
|
|
|
@@ -269,7 +274,7 @@ public class WithdrawService extends SuperService {
|
|
|
destinationTransaction.setTransactionType(TransactionType.WithdrawFrozen);
|
|
|
destinationTransaction.setTransactionStatus(TransactionStatus.Success);
|
|
|
destinationTransaction.setAmount(amount.longValue());
|
|
|
- destinationTransaction.setMeta(Map.of("paymentType", paymentType, "paymentChannelType", paymentType.getChannelType(), "description", "提现冻结"));
|
|
|
+ destinationTransaction.setMeta(Map.of("paymentType", paymentType, "paymentChannelType", paymentType.getChannelType(), "description", "提现冻结", "withdrawMethodType", projectMainPaySetting.getWithdrawMethodType()));
|
|
|
transferModel.setDestinations(new TransferTransactionsModel.GeneralLedgerTransaction[]{destinationTransaction});
|
|
|
ResultContent<List<TransactionLogModel>> transfer = transactionLogService.transfer(transferModel);
|
|
|
if (!transfer.getState().equals(ResultState.Success)) {
|
|
|
@@ -480,7 +485,7 @@ public class WithdrawService extends SuperService {
|
|
|
}
|
|
|
boolean isProjectManager = userOrgPermissService.userIsProjectManager(projectOid, userId);
|
|
|
if (isProjectManager) {
|
|
|
- Page<WithdrawOrder> page = withdrawOrderDao.page(pageable, projectOid, null, param.getStartTime(), param.getEndTime(), param.getSearch(), param.getAuditStatus());
|
|
|
+ Page<WithdrawOrder> page = withdrawOrderDao.page(pageable, projectOid, null, param.getStartTime(), param.getEndTime(), param.getSearch(), param.getAuditStatus(), null);
|
|
|
return com.github.microservice.net.ResultContent.buildContent(PageEntityUtil.concurrent2PageModel(page, this::toModel));
|
|
|
}
|
|
|
List<String> userManagerOids = userOrgPermissService.getUserManagerOids(projectOid, userId);
|
|
|
@@ -489,10 +494,73 @@ public class WithdrawService extends SuperService {
|
|
|
return com.github.microservice.net.ResultContent.buildContent(PageEntityUtil.buildEmptyPage(pageable));
|
|
|
}
|
|
|
|
|
|
- Page<WithdrawOrder> page = withdrawOrderDao.page(pageable, projectOid, userManagerOids.get(0), param.getStartTime(), param.getEndTime(), param.getSearch(), param.getAuditStatus());
|
|
|
+ Page<WithdrawOrder> page = withdrawOrderDao.page(pageable, projectOid, userManagerOids.get(0), param.getStartTime(), param.getEndTime(), param.getSearch(), param.getAuditStatus(), null);
|
|
|
return com.github.microservice.net.ResultContent.buildContent(PageEntityUtil.concurrent2PageModel(page, this::toModel));
|
|
|
}
|
|
|
|
|
|
+ public Object page(Pageable pageable, WithdrawMonthPageParam param){
|
|
|
+ String projectOid = param.getProjectOid();
|
|
|
+ if (StringUtils.isBlank(projectOid)) {
|
|
|
+ projectOid = getCurrentProjectOid();
|
|
|
+ }
|
|
|
+ String oid = param.getOid();
|
|
|
+ if (StringUtils.isBlank(oid)) {
|
|
|
+ oid = getCurrentOid();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (param.getYear() == null || param.getMonth() == null) {
|
|
|
+ return com.github.microservice.net.ResultContent.buildFail("year或month不能为null");
|
|
|
+ }
|
|
|
+
|
|
|
+ Long monthStartTime = DateUtils.getMonthStartTime(param.getYear(), param.getMonth());
|
|
|
+ Long monthEndTime = DateUtils.getMonthEndTime(param.getYear(), param.getMonth());
|
|
|
+
|
|
|
+ Page<WithdrawOrder> page = withdrawOrderDao.page(pageable, projectOid, oid, monthStartTime, monthEndTime, null, null, param.getWithdrawMethodType());
|
|
|
+ return com.github.microservice.net.ResultContent.buildContent(PageEntityUtil.concurrent2PageModel(page, this::toModel));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询提现余额明细
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Object transactionLogPage(Pageable pageable, WithdrawMonthPageParam param){
|
|
|
+ String projectOid = param.getProjectOid();
|
|
|
+ if (StringUtils.isBlank(projectOid)) {
|
|
|
+ projectOid = getCurrentProjectOid();
|
|
|
+ }
|
|
|
+ String oid = param.getOid();
|
|
|
+ if (StringUtils.isBlank(oid)) {
|
|
|
+ oid = getCurrentOid();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (param.getYear() == null || param.getMonth() == null) {
|
|
|
+ return com.github.microservice.net.ResultContent.buildFail("year或month不能为null");
|
|
|
+ }
|
|
|
+
|
|
|
+ Long monthStartTime = DateUtils.getMonthStartTime(param.getYear(), param.getMonth());
|
|
|
+ Long monthEndTime = DateUtils.getMonthEndTime(param.getYear(), param.getMonth());
|
|
|
+
|
|
|
+ PayAccount orgChildren = payAccountService.getOrgChildren(projectOid, oid, PaymentChannelType.Settle);
|
|
|
+
|
|
|
+ GeneralLedgerQueryTransactionLogModel queryModel = new GeneralLedgerQueryTransactionLogModel();
|
|
|
+ queryModel.setGeneralLedgerId(new String[]{orgChildren.getLedgerId()});
|
|
|
+ queryModel.setStartTime(monthStartTime);
|
|
|
+ queryModel.setEndTime(monthEndTime);
|
|
|
+ if (param.getWithdrawMethodType()!=null){
|
|
|
+ queryModel.setFilter(Map.of("meta.withdrawMethodType", param.getWithdrawMethodType()));
|
|
|
+ }
|
|
|
+ PageableModel pageableModel = new PageableModel();
|
|
|
+ pageableModel.setPage(pageable.getPageNumber());
|
|
|
+ pageableModel.setSize(pageable.getPageSize());
|
|
|
+ pageableModel.setSort("createTime");
|
|
|
+ queryModel.setPage(pageableModel);
|
|
|
+ ResultContent<TransactionLogAggregateRetModel> aggregateResult = transactionLogService.aggregate(queryModel);
|
|
|
+ if (!aggregateResult.getState().equals(ResultState.Success)){
|
|
|
+ return com.github.microservice.net.ResultContent.buildFail(aggregateResult.getMsg());
|
|
|
+ }
|
|
|
+ return com.github.microservice.net.ResultContent.buildContent(aggregateResult.getContent().getPages());
|
|
|
+ }
|
|
|
+
|
|
|
private WithdrawOrderModel toModel(WithdrawOrder withdrawOrder) {
|
|
|
WithdrawOrderModel model = new WithdrawOrderModel();
|
|
|
if (withdrawOrder != null) {
|