于继渤 1 anno fa
parent
commit
db1a4b792a

+ 15 - 1
src/main/java/com/dk/mdm/mapper/mst/CustomerMapper.xml

@@ -97,6 +97,12 @@
         <result column="follow_staff_name" property="followStaffName"/>
         <result column="receivable_residue" property="receivableResidue"/>
         <result column="receipt_residue" property="receiptResidue"/>
+        <result column="orderQuantity" property="orderQuantity"/>
+        <result column="orderAmount" property="orderAmount"/>
+
+        <result column="outboundQuantity" property="outboundQuantity"/>
+        <result column="outboundAmount" property="outboundAmount"/>
+
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -256,9 +262,15 @@
         tmo.org_name  AS  "orgName",
         tms.staff_name  AS  "staffName",
         tms2.staff_name  AS  "reportStaffName",
-        tdk.kind_name_i18n  ->>  #{i18n} AS "saleStatusName"
+        tdk.kind_name_i18n  ->>  #{i18n} AS "saleStatusName",
 --         tccfs.follow_staff  as follow_staff,
 --         tms1.staff_name  as follow_staff_name
+        (SELECT COUNT(1) FROM  dkic_b.t_psi_order tpo  WHERE tpo.cus_id = tmc.cus_id AND  tpo.cp_id = tmc.cp_id AND tpo.flg_valid) AS "orderQuantity",
+        (SELECT sum(tpo.sum_amount) FROM  dkic_b.t_psi_order tpo  WHERE tpo.cus_id = tmc.cus_id AND  tpo.cp_id = tmc.cp_id AND tpo.flg_valid) AS "orderAmount",
+
+
+        (SELECT COUNT(1) FROM  dkic_b.t_psi_outbound tpob  WHERE tpob.cus_id = tmc.cus_id AND  tpob.cp_id = tmc.cp_id AND tpob.flg_valid AND tpob.out_type = '出库类型-销售出库' AND tpob.out_status = '出库状态-已出库') AS "outboundQuantity",
+        (SELECT sum(tpob.out_amt) FROM  dkic_b.t_psi_outbound tpob  WHERE tpob.cus_id = tmc.cus_id AND  tpob.cp_id = tmc.cp_id AND tpob.flg_valid AND tpob.out_type = '出库类型-销售出库' AND tpob.out_status = '出库状态-已出库') AS "outboundAmount"
         FROM dkic_b.t_mst_customer tmc
         LEFT JOIN  dkic_b.t_mst_dictionary_data tmd  on tmd.data_id =  tmc.cus_from
         LEFT JOIN  dkic_b.t_mst_sale_channel tmsc  on tmsc.channel_id =  tmc.channel_id
@@ -266,6 +278,8 @@
         LEFT JOIN  dkic_b.t_mst_staff tms  on tms.staff_id =  tmc.staff_id
         LEFT JOIN  dkic_b.t_mst_staff tms2  on tms2.staff_id =  tmc.report_staff
         LEFT JOIN  sys.t_data_kind tdk  on tdk.kind_code =  tmc.sale_status
+
+
 --         LEFT JOIN  dkic_b.t_crm_cus_follow_staff  tccfs on tccfs.follow_staff = any(tmc.follow_staffs)
 --         LEFT JOIN  dkic_b.t_mst_staff tms1  on tms1.staff_id =  tccfs.follow_staff
         WHERE tmc.cus_id = #{id}::uuid

+ 11 - 0
src/main/java/com/dk/mdm/model/response/mst/CustomerResponse.java

@@ -313,6 +313,17 @@ public class CustomerResponse extends PageInfo<CustomerResponse> implements Seri
     private BigDecimal receiptResidue;
 
 
+    private BigDecimal orderQuantity;
+
+    private BigDecimal orderAmount;
+
+    private BigDecimal outboundQuantity;
+
+    private BigDecimal outboundAmount;
+
+
+
+
     private static final long serialVersionUID = 1L;
 
 }