|
@@ -20,7 +20,6 @@
|
|
|
IFNULL(a.riskCodeJshang,0) as "riskCodeJshang",
|
|
IFNULL(a.riskCodeJshang,0) as "riskCodeJshang",
|
|
|
IFNULL(a.riskCodeDs,0) as "riskCodeDs",
|
|
IFNULL(a.riskCodeDs,0) as "riskCodeDs",
|
|
|
IFNULL(a.riskCodeDsan,0) as "riskCodeDsan",
|
|
IFNULL(a.riskCodeDsan,0) as "riskCodeDsan",
|
|
|
- IFNULL(a.exportAllFee,0) as "exportAllFee",
|
|
|
|
|
sd.management_source as "managementSource",
|
|
sd.management_source as "managementSource",
|
|
|
IFNULL(IFNULL(a.entranceAllFee,0) -IFNULL(a.exportAllFee,0),0) as "distributionAmount",
|
|
IFNULL(IFNULL(a.entranceAllFee,0) -IFNULL(a.exportAllFee,0),0) as "distributionAmount",
|
|
|
(IFNULL(IFNULL(a.entranceAllFee,0) -IFNULL(a.exportAllFee,0),0)) / a.sumpremium as "distributionAmountRate"
|
|
(IFNULL(IFNULL(a.entranceAllFee,0) -IFNULL(a.exportAllFee,0),0)) / a.sumpremium as "distributionAmountRate"
|
|
@@ -446,27 +445,25 @@
|
|
|
io.licenseno AS "car_num",
|
|
io.licenseno AS "car_num",
|
|
|
su.id AS "user_id",
|
|
su.id AS "user_id",
|
|
|
su.name AS "user_name",
|
|
su.name AS "user_name",
|
|
|
- IFNULL(sum(jqpremium), 0) AS "jq_premium",
|
|
|
|
|
- IFNULL(sum(sypremium), 0) AS "sy_premium",
|
|
|
|
|
- IFNULL(sum(taxamount), 0) AS "tax_amount",
|
|
|
|
|
- IFNULL(sum(jypremium), 0) AS "jy_premium",
|
|
|
|
|
- (IFNULL(sum(jqpremium), 0) + IFNULL(sum(sypremium), 0) + IFNULL(sum(jypremium), 0)) AS "sum_premium",
|
|
|
|
|
- ROUND(sum(IFNULL(ifon.jq_costs_premiums, 0) + IFNULL(ifon.sy_costs_premiums, 0)
|
|
|
|
|
- + IFNULL(ifon.no_costs_premiums, 0)), 2) AS "entrance_all_fee",
|
|
|
|
|
- ROUND(sum(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_other_costs_premiums, 0) + IFNULL(no_export_supervise_costs_premiums, 0)), 2) AS "export_all_fee"
|
|
|
|
|
|
|
+ IFNULL(SUM(iac.jqpremium), 0) AS "jq_premium",
|
|
|
|
|
+ IFNULL(SUM(iac.sypremium), 0) AS "sy_premium",
|
|
|
|
|
+ IFNULL(SUM(iac.taxamount), 0) AS "tax_amount",
|
|
|
|
|
+ IFNULL(SUM(iac.jypremium), 0) AS "jy_premium",
|
|
|
|
|
+ (IFNULL(SUM(iac.jqpremium), 0) + IFNULL(SUM(iac.sypremium), 0) + IFNULL(SUM(iac.jypremium), 0)) AS "sum_premium",
|
|
|
|
|
+ SUM(IFNULL(ifon.jq_costs_premiums, 0) + IFNULL(ifon.sy_costs_premiums, 0) + IFNULL(ifon.no_costs_premiums, 0)) AS "entrance_all_fee",
|
|
|
|
|
+ SUM(IFNULL(ifon.jq_export_other_costs_premiums, 0) + IFNULL(ifon.jq_export_supervise_costs_premiums, 0)
|
|
|
|
|
+ + IFNULL(ifon.sy_export_other_costs_premiums, 0) + IFNULL(ifon.sy_export_supervise_costs_premiums, 0)
|
|
|
|
|
+ + IFNULL(ifon.no_export_other_costs_premiums, 0) + IFNULL(ifon.no_export_supervise_costs_premiums, 0)) AS "export_all_fee"
|
|
|
FROM ins_area_company iac
|
|
FROM ins_area_company iac
|
|
|
- LEFT JOIN ins_orders io ON io.orderno = iac.orderno
|
|
|
|
|
- LEFT JOIN sys_user su ON io.userid = su.id
|
|
|
|
|
- LEFT JOIN ins_fee_order_new ifon ON iac.id = ifon.ins_order_no
|
|
|
|
|
|
|
+ LEFT JOIN ins_orders io ON io.orderno = iac.orderno
|
|
|
|
|
+ LEFT JOIN sys_user su ON io.userid = su.id
|
|
|
|
|
+ LEFT JOIN ins_fee_order_new ifon ON iac.id = ifon.ins_order_no
|
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="getBusinessOrderDataDetails" resultMap="OrderDataMap">
|
|
<select id="getBusinessOrderDataDetails" resultMap="OrderDataMap">
|
|
|
<include refid="BusinessOrderDataSQL"/>
|
|
<include refid="BusinessOrderDataSQL"/>
|
|
|
<where>
|
|
<where>
|
|
|
iac.orderstatus = '3'
|
|
iac.orderstatus = '3'
|
|
|
- AND io.orderstatus = '3'
|
|
|
|
|
<if test="vo.userId != null and vo.userId!=''">
|
|
<if test="vo.userId != null and vo.userId!=''">
|
|
|
AND su.id = #{vo.userId}
|
|
AND su.id = #{vo.userId}
|
|
|
</if>
|
|
</if>
|
|
@@ -485,35 +482,32 @@
|
|
|
|
|
|
|
|
<select id="getBusinessOrderDataTotal" resultMap="OrderDataMap">
|
|
<select id="getBusinessOrderDataTotal" resultMap="OrderDataMap">
|
|
|
SELECT
|
|
SELECT
|
|
|
- count(*) AS `total`,
|
|
|
|
|
|
|
+ COUNT(*) AS `total`,
|
|
|
IFNULL(SUM(a.jq_premium), 0) AS `jq_premium`,
|
|
IFNULL(SUM(a.jq_premium), 0) AS `jq_premium`,
|
|
|
IFNULL(SUM(a.sy_premium), 0) AS `sy_premium`,
|
|
IFNULL(SUM(a.sy_premium), 0) AS `sy_premium`,
|
|
|
- IFNULL(SUM(a.tax_amount), 0) AS `tax_amount`,
|
|
|
|
|
IFNULL(SUM(a.jy_premium), 0) AS `jy_premium`,
|
|
IFNULL(SUM(a.jy_premium), 0) AS `jy_premium`,
|
|
|
- sum(IFNULL(a.jq_premium, 0) + IFNULL(a.sy_premium, 0) + IFNULL(a.jy_premium, 0)) as `sum_premium`,
|
|
|
|
|
- IFNULL(SUM(a.entrance_all_fee), 0) AS `entrance_all_fee`,
|
|
|
|
|
- IFNULL(SUM(a.export_all_fee), 0) AS `export_all_fee`
|
|
|
|
|
|
|
+ IFNULL(SUM(a.tax_amount), 0) AS `tax_amount`,
|
|
|
|
|
+ SUM(IFNULL(a.jq_premium, 0) + IFNULL(a.sy_premium, 0) + IFNULL(a.jy_premium, 0)) AS `sum_premium`,
|
|
|
|
|
+ ROUND(IFNULL(SUM(a.entrance_all_fee),0),2) AS `entrance_all_fee`,
|
|
|
|
|
+ ROUND(IFNULL(SUM(a.export_all_fee),0),2) AS `export_all_fee`
|
|
|
FROM (
|
|
FROM (
|
|
|
<include refid="BusinessOrderDataSQL"/>
|
|
<include refid="BusinessOrderDataSQL"/>
|
|
|
<where>
|
|
<where>
|
|
|
- iac.orderstatus = '3'
|
|
|
|
|
- AND io.orderstatus = '3'
|
|
|
|
|
- <if test="vo.userId != null and vo.userId!=''">
|
|
|
|
|
- AND su.id = #{vo.userId}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="vo.signingTimeStart != null and vo.signingTimeStart!='' and vo.signingTimeEnd != null and vo.signingTimeEnd != ''">
|
|
|
|
|
- AND DATE_FORMAT(iac.signing_time, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{vo.signingTimeStart}, '%Y-%m-%d')
|
|
|
|
|
- AND DATE_FORMAT(#{vo.signingTimeEnd}, '%Y-%m-%d')
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="vo.enterTimeStart != null and vo.enterTimeStart!='' and vo.enterTimeEnd != null and vo.enterTimeEnd != ''">
|
|
|
|
|
- AND DATE_FORMAT(iac.createtime, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{vo.enterTimeStart}, '%Y-%m-%d')
|
|
|
|
|
- AND DATE_FORMAT(#{vo.enterTimeEnd}, '%Y-%m-%d')
|
|
|
|
|
- </if>
|
|
|
|
|
- </where>
|
|
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ <if test="vo.userId != null and vo.userId!=''">
|
|
|
|
|
+ AND su.id = #{vo.userId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.signingTimeStart != null and vo.signingTimeStart!='' and vo.signingTimeEnd != null and vo.signingTimeEnd != ''">
|
|
|
|
|
+ AND DATE_FORMAT(iac.signing_time, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{vo.signingTimeStart}, '%Y-%m-%d')
|
|
|
|
|
+ AND DATE_FORMAT(#{vo.signingTimeEnd}, '%Y-%m-%d')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.enterTimeStart != null and vo.enterTimeStart!='' and vo.enterTimeEnd != null and vo.enterTimeEnd != ''">
|
|
|
|
|
+ AND DATE_FORMAT(iac.createtime, '%Y-%m-%d') BETWEEN DATE_FORMAT(#{vo.enterTimeStart}, '%Y-%m-%d')
|
|
|
|
|
+ AND DATE_FORMAT(#{vo.enterTimeEnd}, '%Y-%m-%d')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
GROUP BY
|
|
GROUP BY
|
|
|
io.orderno) a
|
|
io.orderno) a
|
|
|
- GROUP BY
|
|
|
|
|
- a.user_id
|
|
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
</mapper>
|
|
</mapper>
|