Procházet zdrojové kódy

1.任务统计 渠道 供应商 数据统计不对,各个状态数据要累加。如果一条数据从报价到承保,那报价中,代缴费,承保,都要有1条数据

wuhp před 1 rokem
rodič
revize
8cdd460a8a

+ 15 - 0
src/main/java/com/ydtech/modules/admin/model/vo/BusinessAgentData.java

@@ -65,4 +65,19 @@ public class BusinessAgentData {
     @ApiModelProperty(value = "管理人名称")
     private String leaderName;
 
+    @ApiModelProperty(value = "交三订单数")
+    private String riskCodeJs;
+
+    @ApiModelProperty(value = "单交订单数")
+    private String riskCodeDj;
+
+    @ApiModelProperty(value = "交商订单数")
+    private String riskCodeJshang;
+
+    @ApiModelProperty(value = "单商订单数")
+    private String riskCodeDs;
+
+    @ApiModelProperty(value = "单三订单数")
+    private String riskCodeDsan;
+
 }

+ 12 - 1
src/main/resources/mapper/modules/admin/TaskStatisticsMapper.xml

@@ -15,6 +15,11 @@
         IFNULL(a.sypremium,0) as "sypremium",
         IFNULL(a.taxamount,0) as "taxamount",
         IFNULL(a.jypremium,0) as "jypremium",
+        IFNULL(a.riskCodeJs,0) as "riskCodeJs",
+        IFNULL(a.riskCodeDj,0) as "riskCodeDj" ,
+        IFNULL(a.riskCodeJshang,0) as "riskCodeJshang",
+        IFNULL(a.riskCodeDs,0) as "riskCodeDs",
+        IFNULL(a.riskCodeDsan,0) as "riskCodeDsan",
         sd.management_source as "managementSource"
         from sys_user su
         left join sys_dept sd on sd.id =su.dept_id
@@ -26,7 +31,12 @@
         IFNULL(sum(jqpremium),0) as "jqpremium",
         IFNULL(sum(sypremium),0) as "sypremium",
         IFNULL(sum(taxamount),0) as "taxamount",
-        IFNULL(sum(jypremium),0) as "jypremium"
+        IFNULL(sum(jypremium),0) as "jypremium",
+        COUNT( CASE WHEN iac.product = '交三'  THEN 1 END ) AS "riskCodeJs",
+        COUNT( CASE WHEN iac.product = '单交'  THEN 1 END ) AS "riskCodeDj",
+        COUNT( CASE WHEN iac.product = '交商'  THEN 1 END ) AS "riskCodeJshang",
+        COUNT( CASE WHEN iac.product = '单商'  THEN 1 END ) AS "riskCodeDs",
+        COUNT( CASE WHEN iac.product = '单三'  THEN 1 END ) AS "riskCodeDsan"
         from ins_area_company iac
         left join ins_orders io on io.orderno =iac.orderno
         <where>
@@ -81,6 +91,7 @@
             </if>
         </where>
         order by  a.sumpremium  desc
+
     </select>
 
     <select id="getBusinessAgentDataTotal" resultType="java.lang.Long">

+ 32 - 29
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -1066,17 +1066,17 @@
         io.userid AS "userId",
         sd.parent_id as "deptId",
         sd.management_source as "managementSource",
-        COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS qutationCount,
-        COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS underwritingCount,
+        COUNT( CASE WHEN iac.orderstatus in ( 0 ,1 , 2 , 3 ,4) THEN 1 END ) AS qutationCount,
+        COUNT( CASE WHEN iac.orderstatus in (2,3) THEN 1 END ) AS underwritingCount,
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) AS qutationInsureCount,
         COUNT( CASE WHEN iac.orderstatus = 4 THEN 1 END ) AS underwritingReturn,
-        COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS "passingRate",
+        COUNT( CASE WHEN iac.orderstatus in (2,3) THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus in ( 0 ,1 , 2 , 3 ,4) THEN 1 END ) AS "passingRate",
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) /  COUNT( iac.orderstatus ) AS "closeRate",
-        (COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )  +  COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ))/ COUNT( iac.orderstatus ) AS "contributionRate",
-        COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) / COUNT( iac.orderstatus ) AS "quotationRate",
-        COUNT(CASE WHEN io.order_source = 0  and iac.orderstatus = 0 THEN 1 END) as "pcOrderSource",
-        COUNT(CASE WHEN io.order_source = 1  and iac.orderstatus = 0 THEN 1 END) as "appOrderSource",
-        COUNT( CASE WHEN iac.orderstatus = 1 THEN 1 END ) AS "auditOrder"
+        (COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )  +  COUNT( CASE WHEN iac.orderstatus in (2,3) THEN 1 END ))/ COUNT( iac.orderstatus ) AS "contributionRate",
+        COUNT( CASE WHEN iac.orderstatus in ( 0 ,1 , 2 , 3 ,4) THEN 1 END ) / COUNT( iac.orderstatus ) AS "quotationRate",
+        COUNT(CASE WHEN io.order_source = 0  and iac.orderstatus in ( 0 ,1 , 2 , 3 ,4) THEN 1 END) as "pcOrderSource",
+        COUNT(CASE WHEN io.order_source = 1  and iac.orderstatus in ( 0 ,1 , 2 , 3 ,4) THEN 1 END) as "appOrderSource",
+        COUNT( CASE WHEN iac.orderstatus in( 1 , 2 , 3 ,4) THEN 1 END ) AS "auditOrder"
         FROM
         ins_area_company iac
         LEFT JOIN ins_orders io ON io.orderno = iac.orderno
@@ -1160,6 +1160,7 @@
     </select>
 
     <select id="queryPageElectric"  resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
+
         select a.*, su.name  as "userName",
         inf.url  as "logo",
         sui.sex as "sex",
@@ -1171,17 +1172,17 @@
         io.userid AS "userId",
         sd.parent_id as "deptId",
         sd.management_source as "managementSource",
-        COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS qutationCount,
-        COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS underwritingCount,
+        COUNT( CASE WHEN iac.orderstatus in ( 0 ,1 , 2 , 3 ,4) THEN 1 END ) AS qutationCount,
+        COUNT( CASE WHEN iac.orderstatus in (2,3) THEN 1 END ) AS underwritingCount,
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) AS qutationInsureCount,
         COUNT( CASE WHEN iac.orderstatus = 4 THEN 1 END ) AS underwritingReturn,
-        COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS "passingRate",
+        COUNT( CASE WHEN iac.orderstatus in (2,3) THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus in ( 0 ,1 , 2 , 3 ,4) THEN 1 END ) AS "passingRate",
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) /  COUNT( iac.orderstatus ) AS "closeRate",
-        (COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )  +  COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ))/ COUNT( iac.orderstatus ) AS "contributionRate",
-        COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) / COUNT( iac.orderstatus ) AS "quotationRate",
-        COUNT(CASE WHEN io.order_source = 0  and iac.orderstatus = 0 THEN 1 END) as "pcOrderSource",
-        COUNT(CASE WHEN io.order_source = 1  and iac.orderstatus = 0 THEN 1 END) as "appOrderSource",
-        COUNT( CASE WHEN iac.orderstatus = 1 THEN 1 END ) AS "auditOrder"
+        (COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )  +  COUNT( CASE WHEN iac.orderstatus in (2,3) THEN 1 END ))/ COUNT( iac.orderstatus ) AS "contributionRate",
+        COUNT( CASE WHEN iac.orderstatus in ( 0 ,1 , 2 , 3 ,4) THEN 1 END ) / COUNT( iac.orderstatus ) AS "quotationRate",
+        COUNT(CASE WHEN io.order_source = 0  and iac.orderstatus in ( 0 ,1 , 2 , 3 ,4) THEN 1 END) as "pcOrderSource",
+        COUNT(CASE WHEN io.order_source = 1  and iac.orderstatus in ( 0 ,1 , 2 , 3 ,4) THEN 1 END) as "appOrderSource",
+        COUNT( CASE WHEN iac.orderstatus in( 1 , 2 , 3 ,4) THEN 1 END ) AS "auditOrder"
         FROM
         ins_area_company iac
         LEFT JOIN ins_orders io ON io.orderno = iac.orderno
@@ -1422,15 +1423,16 @@
         pa.insurance_company_id,
         pa.partner_companies_id,
         pa.insurance_company AS "insuranceCompanyName",
-        COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS qutationCount,
-        COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS underwritingCount,
+        COUNT( CASE WHEN iac.orderstatus in ( 0 ,1 , 2 , 3 ,4) THEN 1 END ) AS qutationCount,
+        COUNT( CASE WHEN iac.orderstatus in( 1 , 2 , 3 ,4) THEN 1 END ) AS "auditOrder",
+        COUNT( CASE WHEN iac.orderstatus in (2,3) THEN 1 END ) AS underwritingCount,
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) AS qutationInsureCount,
         COUNT( CASE WHEN iac.orderstatus = 4 THEN 1 END ) AS underwritingReturn,
-        COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS "passingRate",
-        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS "closeRate",
+
+        COUNT( CASE WHEN iac.orderstatus in (2,3) THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus in ( 0 ,1 , 2 , 3 ,4) THEN 1 END ) AS "passingRate",
+        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus in ( 0 ,1 , 2 , 3 ,4) THEN 1 END ) AS "closeRate",
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( iac.orderstatus ) AS "contributionRate",
-        COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) / COUNT( iac.orderstatus ) AS "quotationRate",
-        COUNT( CASE WHEN iac.orderstatus = 1 THEN 1 END ) AS "auditOrder"
+        COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) / COUNT( iac.orderstatus ) AS "quotationRate"
         FROM
         ins_area_company iac
         LEFT JOIN ins_fee_audit ifa ON ifa.ins_order_no = iac.id
@@ -1541,6 +1543,7 @@
     </select>
 
     <select id="agentStatisticsQueryPage"  resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
+
         SELECT
         sd.name as "deptName",
         su.name as "userName",
@@ -1549,15 +1552,15 @@
         suLeader.name as "leaderName",
         suLeader.mobile as "leaderMobile",
         sd.management_source as "managementSource",
-        COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS qutationCount,
-        COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS underwritingCount,
+        COUNT( CASE WHEN iac.orderstatus in ( 0 ,1 , 2 , 3 ,4) THEN 1 END ) AS qutationCount,
+        COUNT( CASE WHEN iac.orderstatus in (2,3) THEN 1 END ) AS underwritingCount,
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) AS qutationInsureCount,
         COUNT( CASE WHEN iac.orderstatus = 4 THEN 1 END ) AS underwritingReturn,
-        (COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) +COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ))  /  COUNT(iac.orderstatus)  as "passingRate",
-        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )  /  COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END )  as "closeRate",
+        (COUNT( CASE WHEN iac.orderstatus in (2,3) THEN 1 END ) +COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ))  /  COUNT(iac.orderstatus)  as "passingRate",
+        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )  /  COUNT( CASE WHEN iac.orderstatus in ( 0 ,1 , 2 , 3 ,4) THEN 1 END )  as "closeRate",
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )  /  COUNT(iac.orderstatus)  as  "contributionRate",
-        COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END )  /  COUNT(iac.orderstatus)  as "quotationRate",
-        COUNT( CASE WHEN iac.orderstatus = 1 THEN 1 END  )   as  "auditOrder"
+        COUNT( CASE WHEN iac.orderstatus in ( 0 ,1 , 2 , 3 ,4) THEN 1 END )  /  COUNT(iac.orderstatus)  as "quotationRate",
+        COUNT( CASE WHEN iac.orderstatus in( 1 , 2 , 3 ,4) THEN 1 END  )   as  "auditOrder"
         FROM
         ins_area_company iac
         left join ins_orders io on io.orderno = iac.orderno
@@ -3294,7 +3297,7 @@
         IFNULL(ifon.jq_costs_premiums,0) + IFNULL(ifon.sy_costs_premiums,0) + IFNULL (ifon.no_costs_premiums,0) as "entranceAllFee",
         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",
-        IFNULL(b.distributionAmount,0)
+        IFNULL(b.distributionAmount,0) 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