|
|
@@ -1330,11 +1330,15 @@
|
|
|
COUNT( CASE WHEN pa.audit_type = 2 AND ifa.auditstatus = 1 THEN 1 END ) AS "automaticAudit"
|
|
|
FROM
|
|
|
ins_fee_audit ifa
|
|
|
- LEFT JOIN ins_area_company iac ON iac.id = ifa.ins_order_no
|
|
|
- LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id
|
|
|
- LEFT JOIN ins_fee_order_new ion ON ion.ins_order_no = iac.id
|
|
|
+ LEFT JOIN ins_orders io ON io.orderno = ifa.orderno
|
|
|
+ LEFT JOIN ins_area_company iac ON iac.orderno = io.orderno
|
|
|
+ AND iac.orderstatus = 3
|
|
|
+ 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>
|
|
|
1=1
|
|
|
+ and iac.id = ifa.ins_order_no
|
|
|
+ AND iac.orderstatus = 3
|
|
|
<if test="taskStatisticsVo.createtimeStart !=null and taskStatisticsVo.createtimeStart != '' and taskStatisticsVo.createtimeEnd !=null and taskStatisticsVo.createtimeEnd != ''">
|
|
|
AND DATE_FORMAT( ifa.audittime, '%Y-%m-%d') BETWEEN #{taskStatisticsVo.createtimeStart} AND #{taskStatisticsVo.createtimeEnd}
|
|
|
</if>
|
|
|
@@ -1352,8 +1356,6 @@
|
|
|
and iac.product = #{taskStatisticsVo.riskCode}
|
|
|
</when>
|
|
|
</choose>
|
|
|
-
|
|
|
-
|
|
|
</where>
|
|
|
GROUP BY
|
|
|
iac.company_id,
|
|
|
@@ -1588,13 +1590,13 @@
|
|
|
<if test="vo.days !=null and vo.days !='' ">
|
|
|
and iac.createtime >= DATE_SUB(NOW(), INTERVAL #{vo.days} DAY)
|
|
|
</if>
|
|
|
- <if test="vo.provinceId != null and vo.provinceId != ''">
|
|
|
+ <if test="vo.provinceId != null and vo.provinceId != '' and vo.cityId == null and vo.countyId == null and vo.houseId == null ">
|
|
|
and io.deptid like "${vo.provinceId}%"
|
|
|
</if>
|
|
|
- <if test="vo.cityId != null and vo.cityId != ''">
|
|
|
+ <if test="vo.cityId != null and vo.cityId != '' and vo.countyId ==null and vo.houseId ==null">
|
|
|
and io.deptid like "${vo.cityId}%"
|
|
|
</if>
|
|
|
- <if test="vo.countyId != null and vo.countyId != ''">
|
|
|
+ <if test="vo.countyId != null and vo.countyId != '' and vo.houseId ==null">
|
|
|
and io.deptid like "${vo.countyId}%"
|
|
|
</if>
|
|
|
<if test="vo.houseId != null and vo.houseId != ''">
|
|
|
@@ -1629,11 +1631,11 @@
|
|
|
agree.insurance_company AS "insuranceCompanyName",
|
|
|
agree.partner_companies_id AS "parterCompanyId",
|
|
|
ins.namesimple AS "partnerCompaniesName",
|
|
|
- sum(sumpremium) as "totalPremium",
|
|
|
+ IFNULL(sum(iac.jqpremium),0) + IFNULL(sum(iac.sypremium),0) +IFNULL(sum(iac.jypremium),0) as "totalPremium",
|
|
|
COUNT(0) AS "qutationInsureCount",
|
|
|
- sum(sumpremium) / COUNT(0) AS "averagePremium",
|
|
|
+ (IFNULL(sum(iac.jqpremium),0) + IFNULL(sum(iac.sypremium),0) +IFNULL(sum(iac.jypremium),0)) / COUNT(0) AS "averagePremium",
|
|
|
COUNT(DISTINCT io.userId) AS "userNumber",
|
|
|
- sum(sumpremium) / COUNT(DISTINCT io.userId) as "perCapitaAmount"
|
|
|
+ (IFNULL(sum(iac.jqpremium),0) + IFNULL(sum(iac.sypremium),0) +IFNULL(sum(iac.jypremium),0)) / COUNT(DISTINCT io.userId) as "perCapitaAmount"
|
|
|
FROM
|
|
|
ins_area_company iac
|
|
|
LEFT JOIN ptl_agreement agree ON iac.agreement_id = agree.id
|
|
|
@@ -1648,7 +1650,7 @@
|
|
|
and agree.partner_companies_id = #{vo.parterCompanyId}
|
|
|
</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.createtimeStart}
|
|
|
+ AND iac.createtime BETWEEN #{vo.createtimeStart} AND #{vo.createtimeStart}
|
|
|
</if>
|
|
|
<if test="vo.provinceId != null and vo.provinceId != ''">
|
|
|
and io.deptid like "${vo.provinceId}%"
|