Commit ff922688 by guojuxing

未开票列表接口调整:添加坏账金额,如果是银行对公转账

parent ab1973d3
package com.gic.enterprise.web.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.dto.BillingPayInfoDTO;
import com.gic.enterprise.utils.UserDetail;
import com.gic.finance.dto.TransferAccountsApprovalDTO;
import com.gic.finance.service.TransferAccountsApprovalApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -49,6 +59,8 @@ public class BillingPayInfoController {
private InvoiceManageApiService invoiceManageApiService;
@Autowired
private BizdictService bizdictService;
@Autowired
private TransferAccountsApprovalApiService transferAccountsApprovalApiService;
@RequestMapping("/bank-info")
public RestResponse bankInfo() {
......@@ -75,7 +87,39 @@ public class BillingPayInfoController {
@RequestMapping("/list-bill")
public RestResponse listBill(BillListQueryQO params) {
params.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
return ResultControllerUtils.commonPageResult(billingPayInfoApiService.listBill(params), BillListVO.class);
ServiceResponse<Page<BillingPayInfoDTO>> payInfoResponse = billingPayInfoApiService.listBill(params);
if (payInfoResponse.isSuccess()) {
Page<BillingPayInfoDTO> page = payInfoResponse.getResult();
if (page != null) {
List<BillingPayInfoDTO> list = page.getResult();
if (CollectionUtils.isNotEmpty(list)) {
//银行对公转账,需要查询坏账金额
List<String> orderSerialNumberList = list.stream()
.filter(e -> e.getPayType() == 3)
.map(e -> e.getOrderSerialNumber()).collect(Collectors.toList());
final Map<String, Object> badMoneyMap;
ServiceResponse<List<TransferAccountsApprovalDTO>> approvalResponse = transferAccountsApprovalApiService
.listByOrderSerialNumber(orderSerialNumberList);
if (approvalResponse.isSuccess()) {
badMoneyMap = approvalResponse.getResult().stream()
.collect(Collectors.toMap(TransferAccountsApprovalDTO::getOrderNumber, TransferAccountsApprovalDTO::getBadAmount));
} else {
badMoneyMap = new HashMap<>(2);
}
Page<BillListVO> resultPage = EntityUtil.changeEntityNew(Page.class, page);
List<BillListVO> voList = list.stream()
.map(e -> {
BillListVO vo = EntityUtil.changeEntityNew(BillListVO.class, e);
vo.setBadAmount((Double) badMoneyMap.get(e.getOrderSerialNumber()));
return vo;
})
.collect(Collectors.toList());
resultPage.setResult(voList);
return RestResponse.success(resultPage);
}
}
}
return RestResponse.failure(payInfoResponse.getCode(), payInfoResponse.getMessage());
}
@RequestMapping("/list-pay-type")
......
......@@ -52,6 +52,11 @@ public class BillListVO implements Serializable{
*/
private String buyTypeStr;
/**
* 坏账金额
*/
private Double badAmount;
public String getSerialNumber() {
return serialNumber;
}
......@@ -101,4 +106,13 @@ public class BillListVO implements Serializable{
}
return null;
}
public Double getBadAmount() {
return badAmount;
}
public BillListVO setBadAmount(Double badAmount) {
this.badAmount = badAmount;
return this;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment