Merge branch 'master' of http://git.lionquexpress.com/wuweihua/BMS
This commit is contained in:
@@ -21,6 +21,8 @@ public class ArBillDetail implements Serializable {
|
||||
private Integer detailNo;
|
||||
private String orderNo;
|
||||
private String trackingNo;
|
||||
/** 转单号快照;账单生成时从来源计费订单复制,保证历史账单可追溯。 */
|
||||
private String transferNo;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date receiveTime;
|
||||
private String productCode;
|
||||
|
||||
@@ -17,9 +17,9 @@ public class ArBillGenerateQuery
|
||||
|
||||
private String currency;
|
||||
|
||||
/** 订单号或运单号关键词,按 OR 条件模糊查询。 */
|
||||
/** 订单号、运单号或转单号关键词,按 OR 条件模糊查询。 */
|
||||
private String orderOrTrackingNo;
|
||||
|
||||
/** 全选模式下,排除弹窗使用的附加订单号或运单号关键词。 */
|
||||
/** 全选模式下,排除弹窗使用的附加订单号、运单号或转单号关键词。 */
|
||||
private String excludeOrderOrTrackingNo;
|
||||
}
|
||||
|
||||
+8
-1
@@ -3,8 +3,11 @@ package com.ruoyi.ar.domain.vo;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import com.ruoyi.common.config.serializer.StrictDateDeserializer;
|
||||
import com.ruoyi.ar.enums.ArBillSelectionMode;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -15,11 +18,13 @@ public class ArBillGenerateRequest
|
||||
@NotNull(message = "客户不能为空")
|
||||
private Long customerId;
|
||||
@NotBlank(message = "账单名称不能为空")
|
||||
@Size(max = 100, message = "账单名称不能超过100个字符")
|
||||
private String billName;
|
||||
private String customerCode;
|
||||
private String customerName;
|
||||
@NotNull(message = "账单截止日不能为空")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = StrictDateDeserializer.class)
|
||||
private Date billPeriodEnd;
|
||||
/** 手动模式选中的来源订单 ID;全选模式为空。 */
|
||||
private List<String> sourceBillIds;
|
||||
@@ -28,13 +33,15 @@ public class ArBillGenerateRequest
|
||||
/** 全选模式中用户明确排除的来源订单 ID。 */
|
||||
private List<String> excludedSourceBillIds;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonDeserialize(using = StrictDateDeserializer.class)
|
||||
private Date billDate;
|
||||
private String currency = "CNY";
|
||||
/** 订单号或运单号关键词,生成时用于再次校验筛选条件。 */
|
||||
/** 订单号、运单号或转单号关键词,生成时用于再次校验筛选条件。 */
|
||||
private String orderOrTrackingNo;
|
||||
private String bankAccountName;
|
||||
private String bankAccountNo;
|
||||
private String bankName;
|
||||
@Size(max = 500, message = "备注不能超过500个字符")
|
||||
private String remark;
|
||||
/** 前端幂等号;重复提交同一请求时复用原任务。 */
|
||||
private String requestId;
|
||||
|
||||
+3
@@ -90,6 +90,9 @@ public class ArBalanceWriteoffServiceImpl implements IArBalanceWriteoffService {
|
||||
throw new ServiceException("核销金额必须大于0");
|
||||
}
|
||||
amount = amount.setScale(MONEY_SCALE, RoundingMode.HALF_UP);
|
||||
if (amount.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
throw new ServiceException("核销金额保留两位小数后必须大于0");
|
||||
}
|
||||
|
||||
// 1. 行锁锁定账单(加锁顺序:账单 -> 账户,与反核销保持一致)
|
||||
ArBill bill = billMapper.selectArBillByIdForUpdate(cmd.getArBillId());
|
||||
|
||||
+11
-2
@@ -984,6 +984,7 @@ public class ArBillServiceImpl implements IArBillService {
|
||||
detail.setDetailNo(detailNo);
|
||||
detail.setOrderNo(source.getOrderNo());
|
||||
detail.setTrackingNo(source.getTrackingNo());
|
||||
detail.setTransferNo(source.getTransferNo());
|
||||
detail.setReceiveTime(source.getOrderTime());
|
||||
detail.setProductCode(source.getProductCode());
|
||||
detail.setProductName(source.getProductName());
|
||||
@@ -1631,15 +1632,23 @@ public class ArBillServiceImpl implements IArBillService {
|
||||
}
|
||||
|
||||
private void validatePeriod(ArBillGenerateRequest request) {
|
||||
if (request == null || request.getCustomerId() == null || StringUtils.isEmpty(request.getBillName())
|
||||
if (request == null || request.getCustomerId() == null || request.getCustomerId() <= 0
|
||||
|| StringUtils.isEmpty(request.getBillName())
|
||||
|| request.getBillName().trim().isEmpty()
|
||||
|| request.getBillPeriodEnd() == null) {
|
||||
throw new ServiceException("客户、账单名称和账单截止日不能为空");
|
||||
}
|
||||
if (request.getBillName().trim().length() > 100) {
|
||||
throw new ServiceException("账单名称不能超过100个字符");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getRemark()) && request.getRemark().trim().length() > 500) {
|
||||
throw new ServiceException("备注不能超过500个字符");
|
||||
}
|
||||
}
|
||||
|
||||
private void validatePreviewQuery(ArBillGenerateQuery query) {
|
||||
if (query == null || query.getCustomerId() == null || query.getBillPeriodEnd() == null) {
|
||||
if (query == null || query.getCustomerId() == null || query.getCustomerId() <= 0
|
||||
|| query.getBillPeriodEnd() == null) {
|
||||
throw new ServiceException("客户和账单截止日不能为空");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="detailNo" column="detail_no"/>
|
||||
<result property="orderNo" column="order_no"/>
|
||||
<result property="trackingNo" column="tracking_no"/>
|
||||
<result property="transferNo" column="transfer_no"/>
|
||||
<result property="receiveTime" column="receive_time"/>
|
||||
<result property="productCode" column="product_code"/>
|
||||
<result property="productName" column="product_name"/>
|
||||
@@ -32,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByBillId" parameterType="long" resultMap="ArBillDetailResult">
|
||||
select detail_id, ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, receive_time,
|
||||
select detail_id, ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, transfer_no, receive_time,
|
||||
product_code, product_name, goods_description, country_code, country_name, dest_postcode,
|
||||
actual_weight, volume_weight, charge_weight, pkg_length, pkg_width, pkg_height,
|
||||
currency, total_amount, remark, create_by, create_time
|
||||
@@ -40,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectByBillIdAndSourceIds" resultMap="ArBillDetailResult">
|
||||
select detail_id, ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, receive_time,
|
||||
select detail_id, ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, transfer_no, receive_time,
|
||||
product_code, product_name, goods_description, country_code, country_name, dest_postcode,
|
||||
actual_weight, volume_weight, charge_weight, pkg_length, pkg_width, pkg_height,
|
||||
currency, total_amount, remark, create_by, create_time
|
||||
@@ -76,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByBillIdWithFees" parameterType="long" resultMap="ArBillDetailWithFeesResult">
|
||||
select d.detail_id, d.ar_bill_id, d.prc_order_bill_id, d.detail_no, d.order_no, d.tracking_no, d.receive_time,
|
||||
select d.detail_id, d.ar_bill_id, d.prc_order_bill_id, d.detail_no, d.order_no, d.tracking_no, d.transfer_no, d.receive_time,
|
||||
d.product_code, d.product_name, d.goods_description, d.country_code, d.country_name, d.dest_postcode,
|
||||
d.actual_weight, d.volume_weight, d.charge_weight, d.pkg_length, d.pkg_width, d.pkg_height,
|
||||
d.currency, d.total_amount, d.remark, d.create_by, d.create_time,
|
||||
@@ -94,7 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectExportPage" resultMap="ArBillDetailResult">
|
||||
select detail_id, ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, receive_time,
|
||||
select detail_id, ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, transfer_no, receive_time,
|
||||
product_code, product_name, goods_description, country_code, country_name, dest_postcode,
|
||||
actual_weight, volume_weight, charge_weight, pkg_length, pkg_width, pkg_height,
|
||||
currency, total_amount, remark, create_by, create_time
|
||||
@@ -105,14 +106,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="ArBillDetail" useGeneratedKeys="true" keyProperty="detailId">
|
||||
insert into ar_bill_detail (ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, receive_time,
|
||||
insert into ar_bill_detail (ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, transfer_no, receive_time,
|
||||
product_code,
|
||||
product_name, goods_description, country_code, country_name, dest_postcode,
|
||||
actual_weight,
|
||||
volume_weight, charge_weight, pkg_length, pkg_width, pkg_height, currency,
|
||||
total_amount,
|
||||
remark, create_by, create_time)
|
||||
values (#{arBillId}, #{prcOrderBillId}, #{detailNo}, #{orderNo}, #{trackingNo}, #{receiveTime},
|
||||
values (#{arBillId}, #{prcOrderBillId}, #{detailNo}, #{orderNo}, #{trackingNo}, #{transferNo}, #{receiveTime},
|
||||
#{productCode}, #{productName}, #{goodsDescription}, #{countryCode}, #{countryName},
|
||||
#{destPostcode}, #{actualWeight}, #{volumeWeight}, #{chargeWeight}, #{pkgLength}, #{pkgWidth},
|
||||
#{pkgHeight}, #{currency}, #{totalAmount}, #{remark}, #{createBy}, sysdate())
|
||||
@@ -120,14 +121,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="detailId">
|
||||
insert into ar_bill_detail (
|
||||
ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, receive_time, product_code,
|
||||
ar_bill_id, prc_order_bill_id, detail_no, order_no, tracking_no, transfer_no, receive_time, product_code,
|
||||
product_name, goods_description, country_code, country_name, dest_postcode, actual_weight,
|
||||
volume_weight, charge_weight, pkg_length, pkg_width, pkg_height, currency, total_amount,
|
||||
remark, create_by, create_time
|
||||
) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.arBillId}, #{item.prcOrderBillId}, #{item.detailNo}, #{item.orderNo}, #{item.trackingNo},
|
||||
#{item.receiveTime}, #{item.productCode}, #{item.productName}, #{item.goodsDescription},
|
||||
#{item.transferNo}, #{item.receiveTime}, #{item.productCode}, #{item.productName}, #{item.goodsDescription},
|
||||
#{item.countryCode}, #{item.countryName}, #{item.destPostcode}, #{item.actualWeight},
|
||||
#{item.volumeWeight}, #{item.chargeWeight}, #{item.pkgLength}, #{item.pkgWidth}, #{item.pkgHeight},
|
||||
#{item.currency}, #{item.totalAmount}, #{item.remark}, #{item.createBy}, sysdate())
|
||||
|
||||
@@ -225,7 +225,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<!-- rename_bill_tables.sql 已将需求文档中的 prc_bill 映射为本项目的 prc_order_bill。 -->
|
||||
<!-- 生成弹窗预览:按客户、截止日、币种和订单/运单号 OR 条件分页查询未入账订单。 -->
|
||||
<!-- 生成弹窗预览:按客户、截止日、币种和订单号/运单号/转单号 OR 条件分页查询未入账订单。 -->
|
||||
<select id="selectPrcOrderBillByCustomerPeriod" resultMap="PrcOrderBillResult">
|
||||
<include refid="selectPrcOrderBillVo"/>
|
||||
where customer_id = #{customerId}
|
||||
@@ -234,11 +234,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
<if test="orderOrTrackingNo != null and orderOrTrackingNo != ''">
|
||||
and (order_no like concat('%', #{orderOrTrackingNo}, '%')
|
||||
or tracking_no like concat('%', #{orderOrTrackingNo}, '%'))
|
||||
or tracking_no like concat('%', #{orderOrTrackingNo}, '%')
|
||||
or transfer_no like concat('%', #{orderOrTrackingNo}, '%'))
|
||||
</if>
|
||||
<if test="excludeOrderOrTrackingNo != null and excludeOrderOrTrackingNo != ''">
|
||||
and (order_no like concat('%', #{excludeOrderOrTrackingNo}, '%')
|
||||
or tracking_no like concat('%', #{excludeOrderOrTrackingNo}, '%'))
|
||||
or tracking_no like concat('%', #{excludeOrderOrTrackingNo}, '%')
|
||||
or transfer_no like concat('%', #{excludeOrderOrTrackingNo}, '%'))
|
||||
</if>
|
||||
and biz_date <= #{cutoffDate}
|
||||
and ar_bill_status = #{arBillStatus}
|
||||
@@ -263,11 +265,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
<if test="orderOrTrackingNo != null and orderOrTrackingNo != ''">
|
||||
and (order_no like concat('%', #{orderOrTrackingNo}, '%')
|
||||
or tracking_no like concat('%', #{orderOrTrackingNo}, '%'))
|
||||
or tracking_no like concat('%', #{orderOrTrackingNo}, '%')
|
||||
or transfer_no like concat('%', #{orderOrTrackingNo}, '%'))
|
||||
</if>
|
||||
<if test="excludeOrderOrTrackingNo != null and excludeOrderOrTrackingNo != ''">
|
||||
and (order_no like concat('%', #{excludeOrderOrTrackingNo}, '%')
|
||||
or tracking_no like concat('%', #{excludeOrderOrTrackingNo}, '%'))
|
||||
or tracking_no like concat('%', #{excludeOrderOrTrackingNo}, '%')
|
||||
or transfer_no like concat('%', #{excludeOrderOrTrackingNo}, '%'))
|
||||
</if>
|
||||
and biz_date <= #{cutoffDate}
|
||||
and ar_bill_status = #{arBillStatus}
|
||||
@@ -283,7 +287,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
<if test="orderOrTrackingNo != null and orderOrTrackingNo != ''">
|
||||
and (order_no like concat('%', #{orderOrTrackingNo}, '%')
|
||||
or tracking_no like concat('%', #{orderOrTrackingNo}, '%'))
|
||||
or tracking_no like concat('%', #{orderOrTrackingNo}, '%')
|
||||
or transfer_no like concat('%', #{orderOrTrackingNo}, '%'))
|
||||
</if>
|
||||
and biz_date <= #{cutoffDate}
|
||||
and ar_bill_status = #{arBillStatus}
|
||||
@@ -339,7 +344,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
<if test="orderOrTrackingNo != null and orderOrTrackingNo != ''">
|
||||
and (order_no like concat('%', #{orderOrTrackingNo}, '%')
|
||||
or tracking_no like concat('%', #{orderOrTrackingNo}, '%'))
|
||||
or tracking_no like concat('%', #{orderOrTrackingNo}, '%')
|
||||
or transfer_no like concat('%', #{orderOrTrackingNo}, '%'))
|
||||
</if>
|
||||
<if test="currency != null and currency != ''">
|
||||
and currency = #{currency}
|
||||
|
||||
Reference in New Issue
Block a user