jinch 15 годин тому
батько
коміт
7bf1f67f0d

+ 7 - 6
ship-module-trade/ship-module-trade-biz/src/main/java/com/yc/ship/module/trade/controller/admin/report/vo/IncomeOrderLedgerPageReqVO.java

@@ -8,6 +8,7 @@ import lombok.ToString;
 import org.springframework.format.annotation.DateTimeFormat;
 
 import java.time.LocalDate;
+import java.util.List;
 
 import static com.yc.ship.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
 
@@ -25,18 +26,18 @@ public class IncomeOrderLedgerPageReqVO extends PageParam {
     @Schema(description = "订单编号", example = "CJXLY-20260204-YC-1")
     private String orderNo;
 
-    @Schema(description = "订单状态", example = "1")
-    private Integer orderStatus;
+    @Schema(description = "订单状态(支持多选)", example = "1")
+    private List<Integer> orderStatus;
 
-    @Schema(description = "支付状态", example = "1")
-    private Integer paymentStatus;
+    @Schema(description = "支付状态(支持多选)", example = "1")
+    private List<Integer> paymentStatus;
 
     @Schema(description = "开航时间", example = "2024-03-01")
     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
     private LocalDate sailTime;
 
-    @Schema(description = "组团社", example = "长江国际旅行社")
-    private String travelAgency;
+    @Schema(description = "组团社(支持多选)", example = "长江国际旅行社")
+    private List<String> travelAgency;
 
     @Schema(description = "游轮ID", example = "1")
     private Long shipId;

+ 36 - 18
ship-module-trade/ship-module-trade-biz/src/main/resources/mapper/report/IncomeOrderLedgerMapper.xml

@@ -23,10 +23,10 @@
             IFNULL(tot.free_num, 0) AS freeCount,
             (IFNULL(tot.adult_total_num, 0) + IFNULL(tot.child_total_num, 0) +
              IFNULL(tot.baby_total_num, 0) + IFNULL(tot.with_total_num, 0) + IFNULL(tot.free_num, 0)) AS totalCount,
-            o.amount AS marketingPrice,
+            o.pay_amount AS marketingPrice,
             o.free_amount AS discountAmount,
             COALESCE(refund_fee_sum.refundFee, 0) AS refundFee,
-            (o.amount - IFNULL(o.free_amount, 0) - COALESCE(refund_fee_sum.refundFee, 0)) AS actualSettlementPrice
+            (o.pay_amount - IFNULL(o.free_amount, 0) - COALESCE(refund_fee_sum.refundFee, 0)) AS actualSettlementPrice
         FROM trade_order o
         INNER JOIN product_voyage v ON o.voyage_id = v.id AND v.deleted = 0
         INNER JOIN resource_route r ON v.route_id = r.id AND r.deleted = 0
@@ -41,24 +41,33 @@
         LEFT JOIN (
             SELECT order_id, SUM(fee) AS refundFee
             FROM trade_refund
-            WHERE deleted = 0 AND refund_status = 6
+            WHERE deleted = 0 AND refund_status IN (3)
             GROUP BY order_id
         ) refund_fee_sum ON o.id = refund_fee_sum.order_id
         WHERE o.deleted = 0
         <if test="vo.orderNo != null and vo.orderNo != ''">
             AND o.order_no LIKE CONCAT('%', #{vo.orderNo}, '%')
         </if>
-        <if test="vo.orderStatus != null">
-            AND o.order_status = #{vo.orderStatus}
+        <if test="vo.orderStatus != null and vo.orderStatus.size() > 0">
+            AND o.order_status IN
+            <foreach collection="vo.orderStatus" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
-        <if test="vo.paymentStatus != null">
-            AND o.pay_status = #{vo.paymentStatus}
+        <if test="vo.paymentStatus != null and vo.paymentStatus.size() > 0">
+            AND o.pay_status IN
+            <foreach collection="vo.paymentStatus" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
         <if test="vo.sailTime != null">
             AND DATE(v.start_time) = #{vo.sailTime}
         </if>
-        <if test="vo.travelAgency != null and vo.travelAgency != ''">
-            AND o.source_name LIKE CONCAT('%', #{vo.travelAgency}, '%')
+        <if test="vo.travelAgency != null and vo.travelAgency.size() > 0">
+            AND o.source_name IN
+            <foreach collection="vo.travelAgency" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
         <if test="vo.shipId != null">
             AND v.ship_id = #{vo.shipId}
@@ -97,10 +106,10 @@
             IFNULL(tot.free_num, 0) AS freeCount,
             (IFNULL(tot.adult_total_num, 0) + IFNULL(tot.child_total_num, 0) +
              IFNULL(tot.baby_total_num, 0) + IFNULL(tot.with_total_num, 0) + IFNULL(tot.free_num, 0)) AS totalCount,
-            o.amount AS marketingPrice,
+            o.pay_amount AS marketingPrice,
             o.free_amount AS discountAmount,
             COALESCE(refund_fee_sum.refundFee, 0) AS refundFee,
-            (o.amount - IFNULL(o.free_amount, 0) - COALESCE(refund_fee_sum.refundFee, 0)) AS actualSettlementPrice
+            (o.pay_amount - IFNULL(o.free_amount, 0) - COALESCE(refund_fee_sum.refundFee, 0)) AS actualSettlementPrice
         FROM trade_order o
         INNER JOIN product_voyage v ON o.voyage_id = v.id AND v.deleted = 0
         INNER JOIN resource_route r ON v.route_id = r.id AND r.deleted = 0
@@ -115,24 +124,33 @@
         LEFT JOIN (
             SELECT order_id, SUM(fee) AS refundFee
             FROM trade_refund
-            WHERE deleted = 0 AND refund_status = 6
+            WHERE deleted = 0 AND refund_status IN (3)
             GROUP BY order_id
         ) refund_fee_sum ON o.id = refund_fee_sum.order_id
         WHERE o.deleted = 0
         <if test="vo.orderNo != null and vo.orderNo != ''">
             AND o.order_no LIKE CONCAT('%', #{vo.orderNo}, '%')
         </if>
-        <if test="vo.orderStatus != null">
-            AND o.order_status = #{vo.orderStatus}
+        <if test="vo.orderStatus != null and vo.orderStatus.size() > 0">
+            AND o.order_status IN
+            <foreach collection="vo.orderStatus" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
-        <if test="vo.paymentStatus != null">
-            AND o.pay_status = #{vo.paymentStatus}
+        <if test="vo.paymentStatus != null and vo.paymentStatus.size() > 0">
+            AND o.pay_status IN
+            <foreach collection="vo.paymentStatus" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
         <if test="vo.sailTime != null">
             AND DATE(v.start_time) = #{vo.sailTime}
         </if>
-        <if test="vo.travelAgency != null and vo.travelAgency != ''">
-            AND o.source_name LIKE CONCAT('%', #{vo.travelAgency}, '%')
+        <if test="vo.travelAgency != null and vo.travelAgency.size() > 0">
+            AND o.source_name IN
+            <foreach collection="vo.travelAgency" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
         <if test="vo.shipId != null">
             AND v.ship_id = #{vo.shipId}