|
@@ -918,69 +918,126 @@
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="queryPageTaskStatistics" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
|
|
<select id="queryPageTaskStatistics" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
|
|
|
|
|
+ select a.*,(select name from sys_user where id =a.userId) as "userName"
|
|
|
|
|
+ from (
|
|
|
SELECT
|
|
SELECT
|
|
|
- sd.name as "deptName",
|
|
|
|
|
- su.name as "userName",
|
|
|
|
|
- io.userid as "userId",
|
|
|
|
|
- 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( CASE WHEN iac.orderstatus = 0 THEN 1 END ) as "closeRate",
|
|
|
|
|
- COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) as "contributionRate",
|
|
|
|
|
- COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) / COUNT(iac.orderstatus) as "quotationRate",
|
|
|
|
|
- COUNT( CASE WHEN ifa.auditstatus = '0' 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
|
|
|
|
|
- left join sys_user su on su.id=io.userid
|
|
|
|
|
- left join ins_fee_audit ifa on ifa .ins_order_no =iac.id
|
|
|
|
|
- <where>
|
|
|
|
|
- sd.management_source = '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.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.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 io.userid , su.name, sd.id , sd.name
|
|
|
|
|
|
|
+ sd.NAME AS "deptName",
|
|
|
|
|
+ io.userid AS "userId",
|
|
|
|
|
+ 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( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS "closeRate",
|
|
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS "contributionRate",
|
|
|
|
|
+ COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) / COUNT( iac.orderstatus ) AS "quotationRate",
|
|
|
|
|
+ COUNT( CASE WHEN ifa.auditstatus = '0' 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
|
|
|
|
|
+ LEFT JOIN ins_fee_audit ifa ON ifa.ins_order_no = iac.id
|
|
|
|
|
+ <where>
|
|
|
|
|
+ sd.management_source = '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.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.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
|
|
|
|
|
+ io.userid,
|
|
|
|
|
+ sd.NAME
|
|
|
|
|
+ ) a
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+ <select id="queryPageTaskStatisticsTotal" resultType="java.lang.Long">
|
|
|
|
|
+ select count(0) from (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ io.userid
|
|
|
|
|
+ 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>
|
|
|
|
|
+ sd.management_source = '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.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.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
|
|
|
|
|
+ io.userid
|
|
|
|
|
+ ) a
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="insuranceCompanyQueryPage" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
|
|
<select id="insuranceCompanyQueryPage" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.*,
|
|
|
|
|
+ ( SELECT eic.namesimple FROM esm_ins_company eic WHERE eic.id = a.partner_companies_id ) AS "namesimple"
|
|
|
|
|
+ FROM
|
|
|
|
|
+ (
|
|
|
SELECT
|
|
SELECT
|
|
|
pa.insurance_company_id,
|
|
pa.insurance_company_id,
|
|
|
- pa.insurance_company as "insuranceCompanyName",
|
|
|
|
|
- eic.namesimple as "partnerCompaniesName",
|
|
|
|
|
|
|
+ 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 = 0 THEN 1 END ) AS qutationCount,
|
|
|
COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS underwritingCount,
|
|
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 = 3 THEN 1 END ) AS qutationInsureCount,
|
|
@@ -992,50 +1049,99 @@
|
|
|
COUNT( CASE WHEN ifa.auditstatus = '0' THEN 1 END ) AS "auditOrder"
|
|
COUNT( CASE WHEN ifa.auditstatus = '0' THEN 1 END ) AS "auditOrder"
|
|
|
FROM
|
|
FROM
|
|
|
ins_area_company iac
|
|
ins_area_company iac
|
|
|
- LEFT JOIN ins_orders io ON io.orderno = iac.orderno
|
|
|
|
|
- LEFT JOIN sys_dept sd ON sd.id = io.deptid
|
|
|
|
|
LEFT JOIN ins_fee_audit ifa ON ifa.ins_order_no = iac.id
|
|
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 ptl_agreement pa ON pa.id = iac.agreement_id
|
|
|
- LEFT JOIN esm_ins_company eic ON eic.id = pa.partner_companies_id
|
|
|
|
|
- <where>
|
|
|
|
|
- pa.insurance_company_id IS NOT NULL
|
|
|
|
|
- <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.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.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
|
|
|
|
|
- pa.insurance_company_id,
|
|
|
|
|
- pa.insurance_company,
|
|
|
|
|
- eic.namesimple,
|
|
|
|
|
- pa.insurance_company
|
|
|
|
|
|
|
+ <where>
|
|
|
|
|
+ pa.insurance_company_id IS NOT NULL
|
|
|
|
|
+ <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.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.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
|
|
|
|
|
+ pa.insurance_company_id,
|
|
|
|
|
+ pa.partner_companies_id,
|
|
|
|
|
+ pa.insurance_company
|
|
|
|
|
+ ) a
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="insuranceCompanyQueryTotal" resultType="java.lang.Long">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ COUNT(0)
|
|
|
|
|
+ FROM
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ pa.insurance_company_id,
|
|
|
|
|
+ pa.partner_companies_id
|
|
|
|
|
+ FROM
|
|
|
|
|
+ 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
|
|
|
|
|
+ <where>
|
|
|
|
|
+ pa.insurance_company_id IS NOT NULL
|
|
|
|
|
+ <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.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.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
|
|
|
|
|
+ pa.insurance_company_id,
|
|
|
|
|
+ pa.partner_companies_id
|
|
|
|
|
+ ) total
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="agentStatisticsQueryPage" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
|
|
<select id="agentStatisticsQueryPage" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
|
|
@@ -1151,7 +1257,9 @@
|
|
|
(
|
|
(
|
|
|
SELECT
|
|
SELECT
|
|
|
count( io.userid ) AS "numberUserId",
|
|
count( io.userid ) AS "numberUserId",
|
|
|
- sum( iac.sumpremium ) AS "orderAmount"
|
|
|
|
|
|
|
+ SUM(IFNULL(iac.jqpremium, 0)) +
|
|
|
|
|
+ SUM(IFNULL(iac.sypremium, 0)) +
|
|
|
|
|
+ SUM(IFNULL(iac.jypremium, 0)) AS "orderAmount"
|
|
|
FROM
|
|
FROM
|
|
|
`ins_area_company` iac
|
|
`ins_area_company` iac
|
|
|
LEFT JOIN ins_orders io ON io.orderno = iac.orderno
|
|
LEFT JOIN ins_orders io ON io.orderno = iac.orderno
|
|
@@ -1169,6 +1277,38 @@
|
|
|
) a
|
|
) a
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
+ <select id="getOrderManpowerNew" resultType="com.ydtech.modules.admin.model.dto.QxFrontlineAgentDto">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ count( a.numberUserId ) as "orderManpower",
|
|
|
|
|
+ sum( a.orderAmount ) as "totalPremium",
|
|
|
|
|
+ sum( a.orderAmount )/ count( a.numberUserId ) as "averagePremium"
|
|
|
|
|
+ FROM
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ count( io.userid ) AS "numberUserId",
|
|
|
|
|
+ SUM(IFNULL(iac.jqpremium, 0)) +
|
|
|
|
|
+ SUM(IFNULL(iac.sypremium, 0)) +
|
|
|
|
|
+ SUM(IFNULL(iac.jypremium, 0)) AS "orderAmount"
|
|
|
|
|
+ FROM
|
|
|
|
|
+ `ins_area_company` iac
|
|
|
|
|
+ LEFT JOIN ins_orders io ON io.orderno = iac.orderno
|
|
|
|
|
+ <where>
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ <if test="vo.ids != null and vo.ids.size()>0 ">
|
|
|
|
|
+ AND io.userid IN
|
|
|
|
|
+ <foreach item="item" collection="vo.ids" open="(" separator="," close=")">
|
|
|
|
|
+ #{item}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.createtimeStart != null and vo.createtimeStart!='' and vo.createtimeEnd != null and vo.createtimeEnd!=''">
|
|
|
|
|
+ AND iac.signing_time BETWEEN #{vo.createtimeStart} AND #{vo.createtimeEnd}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ GROUP BY
|
|
|
|
|
+ io.userid
|
|
|
|
|
+ ) a
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
|
|
|
<select id="NumberQuotations" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
|
|
<select id="NumberQuotations" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
|
|
|
SELECT
|
|
SELECT
|
|
@@ -1189,6 +1329,7 @@
|
|
|
</if>
|
|
</if>
|
|
|
</where>
|
|
</where>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+
|
|
|
<select id="totalQuotation" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
|
|
<select id="totalQuotation" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
|
|
|
SELECT
|
|
SELECT
|
|
|
agree.insurance_company_id AS companyId,
|
|
agree.insurance_company_id AS companyId,
|
|
@@ -1365,5 +1506,4 @@
|
|
|
agree.partner_companies_id,
|
|
agree.partner_companies_id,
|
|
|
ins.namesimple
|
|
ins.namesimple
|
|
|
</select>
|
|
</select>
|
|
|
-
|
|
|
|
|
</mapper>
|
|
</mapper>
|