Commit 0d1713c3 authored by zhangfeng's avatar zhangfeng

feat(wealth): 费用明细状态改为订单状态

parent 7c732a99
......@@ -449,37 +449,11 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
IPage<CostDetailPageVO> costDetailPage = costDetailPageFuture.get();
List<WealthMoneyAmountVO> searchStatistics = searchStatisticsFuture.get();
List<WealthMoneyAmountVO> totalStatistics = totalStatisticsFuture.get();
// 计算库中不存在的金额字段
// TODO 暂定 不含税金额 = 总金额
// 实际金额 = 含税金额 - 优惠金额
// 未核销金额 = 实际金额 - 核销金额
if (CollectionUtil.isNotEmpty(searchStatistics)) {
searchStatistics.forEach(vo -> {
vo.setCurrencySymbol(allCurrency.get(vo.getCurrencyId()).getFuhao());
vo.setCurrencyName(allCurrency.get(vo.getCurrencyId()).getTitleZh());
if (vo.getWriteOffAmount() == null) {
vo.setWriteOffAmount(BigDecimal.ZERO);
}
if (vo.getDiscountTotal() == null) {
vo.setDiscountTotal(BigDecimal.ZERO);
}
vo.setReceivableTotalAmount(vo.getTaxAmount().subtract(vo.getDiscountTotal()));
vo.setNotWriteOffAmount(vo.getReceivableTotalAmount().subtract(vo.getWriteOffAmount()));
});
calculateStatisticalAmount(allCurrency, searchStatistics);
}
totalStatistics.forEach(vo -> {
vo.setCurrencySymbol(allCurrency.get(vo.getCurrencyId()).getFuhao());
vo.setCurrencyName(allCurrency.get(vo.getCurrencyId()).getTitleZh());
if (vo.getWriteOffAmount() == null) {
vo.setWriteOffAmount(BigDecimal.ZERO);
}
if (vo.getDiscountTotal() == null) {
vo.setDiscountTotal(BigDecimal.ZERO);
}
vo.setNotIncludedTaxAmount(vo.getTotalAmount());
vo.setReceivableTotalAmount(vo.getTaxAmount().subtract(vo.getDiscountTotal()));
vo.setNotWriteOffAmount(vo.getReceivableTotalAmount().subtract(vo.getWriteOffAmount()));
});
calculateStatisticalAmount(allCurrency, totalStatistics);
CostDetailBackVO.CostDetailBackVOBuilder voBuilder = CostDetailBackVO.builder()
.searchStatistics(searchStatistics)
......@@ -521,6 +495,29 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
return null;
}
/**
* 实际金额 = 含税金额 - 优惠金额
* 未核销金额 = 实际金额 - 核销金额
* TODO 暂定 不含税金额 = 总金额
* @param allCurrency
* @param statistics
*/
private void calculateStatisticalAmount(Map<Integer, CurrencyRespDTO> allCurrency, List<WealthMoneyAmountVO> statistics) {
statistics.forEach(vo -> {
vo.setCurrencySymbol(allCurrency.get(vo.getCurrencyId()).getFuhao());
vo.setCurrencyName(allCurrency.get(vo.getCurrencyId()).getTitleZh());
if (vo.getWriteOffAmount() == null) {
vo.setWriteOffAmount(BigDecimal.ZERO);
}
if (vo.getDiscountTotal() == null) {
vo.setDiscountTotal(BigDecimal.ZERO);
}
vo.setNotIncludedTaxAmount(vo.getTotalAmount());
vo.setReceivableTotalAmount(vo.getTaxAmount().subtract(vo.getDiscountTotal()));
vo.setNotWriteOffAmount(vo.getReceivableTotalAmount().subtract(vo.getWriteOffAmount()));
});
}
@Override
public PageResult<BatchGenReceiptPageVO> batchGenReceiptPage(BatchGenReceiptPageQueryVO query, PageVO page) {
int start = (page.getPage() - 1) * page.getRows();
......
......@@ -43,6 +43,6 @@ public class CostDetailPageQueryVO {
@ApiModelProperty(value = "收款类型(字典 payment_type)(多选)")
private List<Integer> collectionType;
@ApiModelProperty(value = "收款状态(0未收款,1收款中,2已收款)(多选)")
private Integer state;
@ApiModelProperty(value = "订单状态详情见字典:order_status")
private Integer status;
}
......@@ -8,6 +8,7 @@
o.order_no,
o.transport_id,
o.channel_id,
o.status,
de.departure_warehouse_id,
ob.objective_warehouse_id,
dew.title_zh departure_warehouse_zh,
......@@ -35,7 +36,7 @@
SUM(r.discount_total) AS discount_total,
SUM(r.write_off_amount) AS write_off_amount
FROM ecw_receivable r
<if test="query.transportId != null or query.shipmentChannel != null">
<if test="query.transportId != null or query.shipmentChannel != null or query.status != null">
LEFT JOIN ecw_order o ON o.order_id = r.order_id
</if>
<if test="query.departureWareHouseId != null">
......@@ -148,8 +149,8 @@
</foreach>
</if>
</if>
<if test="query.state != null">
AND r.state = #{query.state}
<if test="query.status != null">
AND o.status = #{query.status}
</if>
</sql>
......
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