|
|
@@ -2337,6 +2337,67 @@
|
|
|
</select>
|
|
|
|
|
|
|
|
|
+
|
|
|
+ <select id="getCountBusinessData" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
|
|
|
+ select
|
|
|
+ a.totalPremium as "totalPremium",
|
|
|
+ a.qutationInsureCount as "qutationInsureCount",
|
|
|
+ ROUND(a.averagePremium, 2) as "averagePremium",
|
|
|
+ a.userNumber as "userNumber",
|
|
|
+ ROUND(a.perCapitaAmount, 2) as "perCapitaAmount"
|
|
|
+ from (
|
|
|
+ SELECT
|
|
|
+ IFNULL(sum(iac.jqpremium),0) + IFNULL(sum(iac.sypremium),0) +IFNULL(sum(iac.jypremium),0) as "totalPremium",
|
|
|
+ COUNT(0 ) AS "qutationInsureCount",
|
|
|
+ (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",
|
|
|
+ (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
|
|
|
+ LEFT JOIN ins_orders io on io.orderno = iac.orderno
|
|
|
+ WHERE
|
|
|
+ agree.id IS NOT NULL
|
|
|
+ and iac.orderstatus = '3'
|
|
|
+ <if test="vo.companyId != null and vo.companyId!='' ">
|
|
|
+ and agree.insurance_company_id = #{vo.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="vo.parterCompanyId != null and vo.parterCompanyId!='' ">
|
|
|
+ and agree.partner_companies_id = #{vo.parterCompanyId}
|
|
|
+ </if>
|
|
|
+ <if test="vo.createtimeStart != null and vo.createtimeStart!='' and vo.createtimeEnd != null and vo.createtimeEnd!=''">
|
|
|
+ AND DATE_FORMAT( iac.signing_time, '%Y-%m-%d') BETWEEN DATE_FORMAT( #{vo.createtimeStart}, '%Y-%m-%d') AND DATE_FORMAT( #{vo.createtimeEnd}, '%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <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 != '' and vo.countyId ==null and vo.houseId ==null">
|
|
|
+ and io.deptid like "${vo.cityId}%"
|
|
|
+ </if>
|
|
|
+ <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 != ''">
|
|
|
+ and io.deptid like "${vo.houseId}%"
|
|
|
+ </if>
|
|
|
+ <if test="vo.deptIds != null and vo.deptIds != '' and vo.deptIds.size() > 0">
|
|
|
+ AND io.deptid in
|
|
|
+ <foreach collection="vo.deptIds" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="vo.userIds != null and vo.userIds != '' and vo.userIds.size() > 0">
|
|
|
+ AND io.userid in
|
|
|
+ <foreach collection="vo.userIds" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ ) a
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
<select id="getDistribution" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
|
|
|
SELECT
|
|
|
agree.insurance_company_id AS "companyId",
|