Commit 9982361d authored by zhangfeng's avatar zhangfeng

feat(wealth): 费用明细优化

parent 020eaa82
......@@ -130,9 +130,9 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
receivableService.createWriteOffRecord(receivableWriteOffReqVO, receiptItem);
}
// TODO 校验当前收款单汇率是否过期,过期则更新为导入的汇率 没过期不更新?更新汇率后有效期是啥?
if (receiptDO.getRateValidateDate().before(new Date())) {
//if (receiptDO.getRateValidateDate().before(new Date())) {
// 更新收款单汇率,且更新应收金额
}
//}
// 创建收款明细的时候要判断收款单状态进行更新
if (receiptDO.getState() == 1) {
ReceiptDO update = new ReceiptDO();
......
......@@ -328,7 +328,11 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
receivableBackVO.setBaseAmount(BigDecimal.ZERO);
}
// 核销比例 = 已核销金额 / 实际金额,保留两位小数字符串
receivableBackVO.setWriteOffProportion(receivableBackVO.getWriteOffAmount().divide(receivableBackVO.getActualAmount(), 2, RoundingMode.HALF_UP).toString());
if (receivableBackVO.getWriteOffAmount().compareTo(BigDecimal.ZERO) <= 0 || receivableBackVO.getActualAmount().compareTo(BigDecimal.ZERO) <= 0) {
receivableBackVO.setWriteOffProportion("0.00%");
} else {
receivableBackVO.setWriteOffProportion(receivableBackVO.getWriteOffAmount().divide(receivableBackVO.getActualAmount(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).toString());
}
});
return receivableBackVOList;
}
......@@ -507,15 +511,17 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
if (vo.getWriteOffAmount().compareTo(BigDecimal.ZERO) <= 0 || vo.getReceivableTotalAmount().compareTo(BigDecimal.ZERO) <= 0) {
vo.setWriteOffProportion("0.00%");
} else {
vo.setWriteOffProportion(vo.getWriteOffAmount().divide(vo.getReceivableTotalAmount(), 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")) + "%");
vo.setWriteOffProportion(vo.getWriteOffAmount().divide(vo.getReceivableTotalAmount(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")) + "%");
}
// 存在应收明细关联的定单不存在的情况
if (vo.getDestinationCity() != null && vo.getDestinationCountry() != null) {
RegionDTO regionCity = regionApi.getRegionById(vo.getDestinationCity().longValue());
vo.setDestinationCityZh(regionCity.getTitleZh());
vo.setDestinationCityEn(regionCity.getTitleEn());
RegionDTO regionCountry = regionApi.getRegionById(vo.getDestinationCountry().longValue());
vo.setDestinationCountryZh(regionCountry.getTitleZh());
vo.setDestinationCountryEn(regionCountry.getTitleEn());
}
RegionDTO regionCity = regionApi.getRegionById(vo.getDestinationCity().longValue());
vo.setDestinationCityZh(regionCity.getTitleZh());
vo.setDestinationCityEn(regionCity.getTitleEn());
RegionDTO regionCountry = regionApi.getRegionById(vo.getDestinationCountry().longValue());
vo.setDestinationCountryZh(regionCountry.getTitleZh());
vo.setDestinationCountryEn(regionCountry.getTitleEn());
});
return voBuilder
.list(records)
......
......@@ -14,7 +14,7 @@ public class CostDetailPageQueryVO {
private String orderNo;
@ApiModelProperty(value = "运输方式id")
private Integer transportId;
private List<Integer> transportId;
@ApiModelProperty(value = "出货渠道(多选)")
private List<Integer> shipmentChannel;
......
package cn.iocoder.yudao.module.wealth.vo.receivable;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -8,6 +9,9 @@ import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@ApiModel("管理后台 - 费用明细分页 Response VO")
public class CostDetailPageVO {
......@@ -165,8 +169,17 @@ public class CostDetailPageVO {
private String writeOffProportion;
@ApiModelProperty(value = "更新时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date updateTime;
@ApiModelProperty(value = "更新人")
private String updater;
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date createTime;
@ApiModelProperty(value = "审批人")
private String approver;
@ApiModelProperty(value = "审批时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date approverTime;
}
......@@ -17,7 +17,7 @@
LEFT JOIN system_dept sd ON su.dept_id = sd.id
INNER JOIN (SELECT receipt_id,order_id FROM ecw_receivable GROUP BY receipt_id, order_id ) rb ON rb.receipt_id = er.id
LEFT JOIN ecw_order o ON o.order_id=rb.order_id
WHERE eri.deleted = 0 AND er.bmp_status = 2
WHERE eri.deleted = 0 AND er.state NOT IN (0, 7, 8) AND er.state IS NOT NULL
<if test="query.receiptNo != null and query.receiptNo != '' ">
AND eri.`receipt_no` LIKE CONCAT('%',#{query.receiptNo},'%')
</if>
......
......@@ -4,7 +4,6 @@
<select id="getCostDetailPage" resultType="cn.iocoder.yudao.module.wealth.vo.receivable.CostDetailPageVO">
SELECT
r.*,
o.order_no,
o.transport_id,
o.channel_id,
......@@ -16,13 +15,20 @@
obw.title_zh objective_warehouse_zh,
obw.title_en objective_warehouse_en,
obw.guojia destination_country,
obw.shi destination_city
obw.shi destination_city,
usu.username AS updater,
asu.username AS approver,
ra.update_time AS approverTime,
r.*
FROM ecw_receivable r
LEFT JOIN ecw_order o ON o.order_id = r.order_id
LEFT JOIN ecw_order_departure de ON de.order_id = o.order_id
LEFT JOIN ecw_order_objective ob ON ob.order_id = o.order_id
LEFT JOIN ecw_warehouse dew ON de.departure_warehouse_id = dew.id
LEFT JOIN ecw_warehouse obw ON ob.objective_warehouse_id = obw.id
LEFT JOIN ecw_receipt_approval ra ON ra.receipt_id = r.receipt_id
LEFT JOIN system_user usu ON usu.id = r.updater
LEFT JOIN system_user asu ON asu.id = ra.updater
WHERE
r.deleted = 0
<include refid="costDetailPageCondition"/>
......@@ -36,7 +42,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 or query.status != null">
<if test="(query.transportId != null and query.transportId.size() != 0) 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">
......@@ -56,7 +62,15 @@
AND r.order_no = #{query.orderNo}
</if>
<if test="query.transportId != null">
AND o.transport_id = #{query.transportId}
<if test="query.transportId.size() == 1">
AND o.transport_id = #{query.transportId[0]}
</if>
<if test="query.transportId.size() > 1">
AND o.transport_id IN
<foreach collection="query.transportId" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</if>
<if test="query.shipmentChannel != null">
<if test="query.shipmentChannel.size() == 1">
......
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