wuhp пре 2 година
родитељ
комит
c33ab28e61

+ 0 - 1
src/main/java/com/ydtech/modules/admin/dao/TaskStatisticsMapper.java

@@ -37,7 +37,6 @@ public interface TaskStatisticsMapper extends BaseMapper<TaskStatisticsDto> {
      * @param taskStatisticsVo
      * @return  控制台任务统计 渠道代理人详情
      */
-
     IPage<TaskStatisticsDto> channelAgentDetails(Page page, TaskStatisticsVo taskStatisticsVo);
 
 }

+ 8 - 0
src/main/java/com/ydtech/modules/admin/model/dto/TaskStatisticsDto.java

@@ -133,4 +133,12 @@ public class TaskStatisticsDto {
     @ApiModelProperty(value = "app报价")
     private String appOrderSource;
 
+
+    @ApiModelProperty(value = "管理人")
+    private String leaderName;
+
+
+    @ApiModelProperty(value = "保险公司名称")
+    private String inscompany;
+
 }

+ 0 - 1
src/main/java/com/ydtech/modules/admin/service/TaskStatisticsService.java

@@ -96,6 +96,5 @@ public interface TaskStatisticsService {
      * @param taskStatisticsVo
      * @return  控制台任务统计 渠道代理人详情
      */
-
     IPage<TaskStatisticsDto> channelAgentDetails(TaskStatisticsVo taskStatisticsVo);
 }

+ 2 - 0
src/main/java/com/ydtech/modules/admin/service/impl/TaskStatisticsServiceImpl.java

@@ -269,6 +269,8 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
                 taskStatisticsVo.setDateType("2");
             } else if ("30".equals(taskStatisticsVo.getDays())) {
                 taskStatisticsVo.setDateType("3");
+            } else {
+                taskStatisticsVo.setDateType("1");
             }
         }
         HashMap<String, String> dateMapByType = getDateMapByTypeNew(taskStatisticsVo.getDateType(), taskStatisticsVo.getCreatetimeStart(), taskStatisticsVo.getCreatetimeEnd());

+ 68 - 0
src/main/resources/mapper/modules/admin/TaskStatisticsMapper.xml

@@ -262,8 +262,76 @@
     </select>
 
     <select id="channelAgentDetails" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
+        SELECT
+        iac.inscompany,
+        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 = 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( 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"
+        FROM
+        ins_area_company iac
+        LEFT JOIN ins_orders io ON io.orderno = iac.orderno
+        LEFT JOIN sys_dept sd ON sd.id = io.deptid
+        <where>
+            1=1
+            <if test="taskStatisticsVo.provinceId != null and taskStatisticsVo.provinceId != ''">
+                and io.deptid like "${taskStatisticsVo.provinceId}%"
+            </if>
+            <if test="taskStatisticsVo.cityId != null and taskStatisticsVo.cityId != ''">
+                and io.deptid like "${taskStatisticsVo.cityId}%"
+            </if>
+            <if test="taskStatisticsVo.countyId != null and taskStatisticsVo.countyId != ''">
+                and io.deptid like "${taskStatisticsVo.countyId}%"
+            </if>
+            <if test="taskStatisticsVo.houseId != null and taskStatisticsVo.houseId != ''">
+                and io.deptid like "${taskStatisticsVo.houseId}%"
+            </if>
+            <if test="taskStatisticsVo.userId != null and taskStatisticsVo.userId != ''">
+                and io.userid =#{taskStatisticsVo.userId}
+            </if>
 
+            <if test="taskStatisticsVo.managementSource != null and taskStatisticsVo.managementSource != ''">
+                and sd.management_source =#{taskStatisticsVo.managementSource}
+            </if>
 
+            <if test="taskStatisticsVo.createtimeStart !=null and taskStatisticsVo.createtimeStart != '' and taskStatisticsVo.createtimeEnd !=null and taskStatisticsVo.createtimeEnd != ''">
+                AND DATE_FORMAT( io.createtime, '%Y-%m-%d') BETWEEN #{taskStatisticsVo.createtimeStart} AND
+                #{taskStatisticsVo.createtimeEnd}
+            </if>
+            <if test="taskStatisticsVo.beginDate !=null and taskStatisticsVo.beginDate != '' and taskStatisticsVo.endDate !=null and taskStatisticsVo.endDate != ''">
+                AND DATE_FORMAT( iac.createtime, '%Y-%m-%d') BETWEEN DATE_FORMAT( #{taskStatisticsVo.beginDate},
+                '%Y-%m-%d') AND DATE_FORMAT( #{taskStatisticsVo.endDate}, '%Y-%m-%d')
+            </if>
+            <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
+                and iac.createtime >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
+            </if>
+
+            <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
+                <choose>
+                    <when test="taskStatisticsVo.days =='1'">
+                        and io.createtime >= DATE_SUB(NOW(), INTERVAL 1 DAY)
+                    </when>
+
+                    <when test="taskStatisticsVo.days =='7'">
+                        and io.createtime >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+                    </when>
+
+                    <when test="taskStatisticsVo.days =='30'">
+                        and io.createtime >= DATE_SUB(NOW(), INTERVAL 30 DAY)
+                    </when>
+                </choose>
+            </if>
+        </where>
+        GROUP BY
+        iac.inscompany
     </select>
 
 

+ 25 - 11
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -983,7 +983,8 @@
     </select>
 
     <select id="queryPageTaskStatistics"  resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
-        select a.*,(select name  from sys_user  where id =a.userId) as "userName"
+        select a.*,(select name  from sys_user  where id =a.userId) as "userName",
+        su.leader_name as "leaderName"
         from (
         SELECT
         sd.NAME AS "deptName",
@@ -1054,6 +1055,7 @@
         sd.NAME,
         sd.id
         ) a
+        left  join  sys_user su  on su.id =a.userId
     </select>
     <select id="queryPageTaskStatisticsTotal"  resultType="java.lang.Long">
         select count(0) from (
@@ -1138,19 +1140,23 @@
         ins_area_company iac
         LEFT JOIN ins_fee_audit ifa ON ifa.ins_order_no = iac.id
         LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id
+        LEFT JOIN ins_orders io ON io.orderno = iac.orderno
         <where>
             pa.insurance_company_id IS NOT NULL
             <if test="taskStatisticsVo.provinceId != null and taskStatisticsVo.provinceId != ''">
-                and io.deptid like "${taskStatisticsVo.provinceId}%"
+                and io.deptid like concat('%', #{taskStatisticsVo.provinceId}, '%')
+
             </if>
             <if test="taskStatisticsVo.cityId != null and taskStatisticsVo.cityId != ''">
-                and io.deptid like "${taskStatisticsVo.cityId}%"
+                and io.deptid like concat('%', #{taskStatisticsVo.cityId}, '%')
+
             </if>
             <if test="taskStatisticsVo.countyId != null and taskStatisticsVo.countyId != ''">
-                and io.deptid like "${taskStatisticsVo.countyId}%"
+                and io.deptid like concat('%', #{taskStatisticsVo.countyId}, '%')
+
             </if>
             <if test="taskStatisticsVo.houseId != null and taskStatisticsVo.houseId != ''">
-                and io.deptid like "${taskStatisticsVo.houseId}%"
+                and io.deptid like concat('%', #{taskStatisticsVo.houseId}, '%')
             </if>
             <if test="taskStatisticsVo.createtimeStart !=null and taskStatisticsVo.createtimeStart != '' and taskStatisticsVo.createtimeEnd !=null and taskStatisticsVo.createtimeEnd != ''">
                 AND   DATE_FORMAT( io.createtime, '%Y-%m-%d')   BETWEEN #{taskStatisticsVo.createtimeStart} AND #{taskStatisticsVo.createtimeEnd}
@@ -1186,19 +1192,23 @@
         ins_area_company iac
         LEFT JOIN ins_fee_audit ifa ON ifa.ins_order_no = iac.id
         LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id
+        LEFT JOIN ins_orders io ON io.orderno = iac.orderno
         <where>
             pa.insurance_company_id IS NOT NULL
             <if test="taskStatisticsVo.provinceId != null and taskStatisticsVo.provinceId != ''">
-                and io.deptid like "${taskStatisticsVo.provinceId}%"
+                and io.deptid like concat('%', #{taskStatisticsVo.provinceId}, '%')
+
             </if>
             <if test="taskStatisticsVo.cityId != null and taskStatisticsVo.cityId != ''">
-                and io.deptid like "${taskStatisticsVo.cityId}%"
+                and io.deptid like concat('%', #{taskStatisticsVo.cityId}, '%')
+
             </if>
             <if test="taskStatisticsVo.countyId != null and taskStatisticsVo.countyId != ''">
-                and io.deptid like "${taskStatisticsVo.countyId}%"
+                and io.deptid like concat('%', #{taskStatisticsVo.countyId}, '%')
+
             </if>
             <if test="taskStatisticsVo.houseId != null and taskStatisticsVo.houseId != ''">
-                and io.deptid like "${taskStatisticsVo.houseId}%"
+                and io.deptid like concat('%', #{taskStatisticsVo.houseId}, '%')
             </if>
             <if test="taskStatisticsVo.createtimeStart !=null and taskStatisticsVo.createtimeStart != '' and taskStatisticsVo.createtimeEnd !=null and taskStatisticsVo.createtimeEnd != ''">
                 AND   io.createtime   BETWEEN #{taskStatisticsVo.createtimeStart} AND #{taskStatisticsVo.createtimeEnd}
@@ -1318,6 +1328,10 @@
                 AND   DATE_FORMAT( iac.createtime, '%Y-%m-%d')   BETWEEN DATE_FORMAT( #{taskStatisticsVo.beginDate}, '%Y-%m-%d')  AND DATE_FORMAT( #{taskStatisticsVo.endDate}, '%Y-%m-%d')
             </if>
 
+            <if test="taskStatisticsVo.userId !=null  and  taskStatisticsVo.userId!='' ">
+                and io.userid =#{taskStatisticsVo.userId}
+            </if>
+
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
                 and iac.createtime >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
             </if>
@@ -1774,7 +1788,7 @@
             </if>
 
             <if test="vo.frameno  != null  and  vo.frameno!=''  ">
-                AND su.frameno =#{vo.frameno}
+                AND io.frameno =#{vo.frameno}
             </if>
             <if test="vo.deptId  != null  and  vo.deptId!=''  ">
                 and io.deptid like concat('%', #{vo.deptId}, '%')
@@ -1887,7 +1901,7 @@
             </if>
 
             <if test="vo.frameno  != null  and  vo.frameno!=''  ">
-                AND su.frameno =#{vo.frameno}
+                AND io.frameno =#{vo.frameno}
             </if>
             <if test="vo.deptId  != null  and  vo.deptId!=''  ">
                 and io.deptid like concat('%', #{vo.deptId}, '%')