Преглед на файлове

1.人员渠道毛利润 后两位
2、保费为0,毛利润不应该有数字。

wuhp преди 1 година
родител
ревизия
872bd0bea5
променени са 1 файла, в които са добавени 12 реда и са изтрити 8 реда
  1. 12 8
      src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

+ 12 - 8
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -3310,10 +3310,10 @@
 
     <select id="getExpectNetProfit" resultType="com.ydtech.modules.order.entity.InsAreaCompany">
         select
-        sum(IFNULL(ifon.jq_costs_premiums,0) + IFNULL(ifon.sy_costs_premiums,0) + IFNULL (ifon.no_costs_premiums,0)) as "entranceAllFee",
-        sum(IFNULL(jq_export_other_costs_premiums,0) + IFNULL(jq_export_supervise_costs_premiums,0) +IFNULL(sy_export_other_costs_premiums,0) +IFNULL(sy_export_supervise_costs_premiums,0)
-        +IFNULL(no_export_supervise_costs_premiums,0)+IFNULL(no_export_supervise_costs_premiums,0) ) as "exportAllFee",
-        sum(IFNULL(b.distributionAmount,0)) as "distributionAmount"
+        ROUND(sum(IFNULL(ifon.jq_costs_premiums,0) + IFNULL(ifon.sy_costs_premiums,0) + IFNULL (ifon.no_costs_premiums,0)),2) as "entranceAllFee",
+        ROUND(sum(IFNULL(jq_export_other_costs_premiums,0) + IFNULL(jq_export_supervise_costs_premiums,0) +IFNULL(sy_export_other_costs_premiums,0) +IFNULL(sy_export_supervise_costs_premiums,0)
+        +IFNULL(no_export_supervise_costs_premiums,0)+IFNULL(no_export_supervise_costs_premiums,0) ),2) as "exportAllFee",
+        ROUND(sum(IFNULL(b.distributionAmount,0)),2) as "distributionAmount"
         from ins_area_company iac
         left join ins_orders io on io.orderno = iac.orderno
         LEFT JOIN ins_fee_order_new ifon ON iac.id = ifon.ins_order_no
@@ -3328,8 +3328,9 @@
             left join ins_orders io on io.orderno = iac.orderno
             LEFT JOIN ins_fee_order_new ifon ON iac.id = ifon.ins_order_no
             <where>
+                iac.orderstatus = 3
                 <if test="vo.userId !=null  and  vo.userId  !=''">
-                    ifon.first_level_user_id  =#{vo.userId}
+                    AND ifon.first_level_user_id  =#{vo.userId}
                 </if>
                 <if test="vo.ids  != null  and  vo.ids.size()>0 ">
                     AND ifon.first_level_user_id IN
@@ -3351,8 +3352,9 @@
             left join ins_orders io on io.orderno = iac.orderno
             LEFT JOIN ins_fee_order_new ifon ON iac.id = ifon.ins_order_no
             <where>
+                iac.orderstatus = 3
                 <if test="vo.userId !=null  and  vo.userId  !=''">
-                    ifon.two_level_user_id  =#{vo.userId}
+                  AND  ifon.two_level_user_id  =#{vo.userId}
                 </if>
                 <if test="vo.ids  != null  and  vo.ids.size()>0 ">
                     AND ifon.two_level_user_id IN
@@ -3375,8 +3377,9 @@
             left join ins_orders io on io.orderno = iac.orderno
             LEFT JOIN ins_fee_order_new ifon ON iac.id = ifon.ins_order_no
             <where>
+                iac.orderstatus = 3
                 <if test="vo.userId !=null  and  vo.userId  !=''">
-                    ifon.three_level_user_id  =#{vo.userId}
+                    AND  ifon.three_level_user_id  =#{vo.userId}
                 </if>
                 <if test="vo.ids  != null  and  vo.ids.size()>0 ">
                     AND ifon.three_level_user_id IN
@@ -3392,8 +3395,9 @@
             ) c on  c.threeLevelUserId = a.firstLevelUserId
         ) b   on b.firstLevelUserId =iac.leader_id
         <where>
+            iac.orderstatus = 3
             <if test="vo.userId !=null  and  vo.userId  !=''">
-                io.userid  =#{vo.userId}
+               AND io.userid  =#{vo.userId}
             </if>
             <if test="vo.ids  != null  and  vo.ids.size()>0 ">
                 AND io.userid IN