|
|
@@ -76,6 +76,7 @@
|
|
|
<result column="sy_end_date" property="syEndDate"/>
|
|
|
<result column="settle_other_status" property="settleOtherStatus"/>
|
|
|
<result column="settlement_image_id" property="settlementImageId"/>
|
|
|
+ <result column="task_id" property="taskId"/>
|
|
|
|
|
|
</resultMap>
|
|
|
<sql id="income_com">
|
|
|
@@ -150,6 +151,7 @@
|
|
|
a.user_id as "userId",
|
|
|
a.invoicing_method as "invoicingMethod",
|
|
|
a.settlement_image_id as "settlementImageId",
|
|
|
+ a.task_id as "taskId",
|
|
|
a.create_time as "createTime"
|
|
|
</sql>
|
|
|
|
|
|
@@ -1335,7 +1337,6 @@
|
|
|
</where>
|
|
|
group by a.invoic_id
|
|
|
</select>
|
|
|
-
|
|
|
<update id="updateByIds" parameterType="com.ydtech.modules.fnc.entity.InsPlyIncome">
|
|
|
update ins_ply_income
|
|
|
set handling_fees_status ='1',
|
|
|
@@ -1350,147 +1351,196 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
</update>
|
|
|
- <select id="otherTimeDetail" resultType="java.util.HashMap">
|
|
|
- WITH RECURSIVE months AS (
|
|
|
- SELECT 1 AS month_num
|
|
|
- UNION ALL
|
|
|
- SELECT month_num + 1 FROM months WHERE month_num < 12
|
|
|
- )
|
|
|
- SELECT
|
|
|
- m.month_num AS monthNumber,
|
|
|
- DATE_FORMAT(STR_TO_DATE(CONCAT(YEAR(CURDATE()), '-', LPAD(m.month_num, 2, '0'), '-01'), '%Y-%m-%d'), '%Y-%m') AS monthYear,
|
|
|
- COALESCE(other_fees.total_other_feevalue, 0) AS "allTotalOtherFeevalue",
|
|
|
- COALESCE(settlement_fees.total_settlement_amount, 0) AS "invoicCommissionFeevalue",
|
|
|
- COALESCE(other_fees.total_other_feevalue, 0) - COALESCE(settlement_fees.total_settlement_amount, 0) AS "noInvoicCommissionFeevalue"
|
|
|
- FROM
|
|
|
- months m
|
|
|
- LEFT JOIN (
|
|
|
- SELECT
|
|
|
- MONTH(a.signdate) AS month_num,
|
|
|
- SUM(a.other_feevalue) AS total_other_feevalue
|
|
|
- FROM
|
|
|
- `ins_ply_income` a
|
|
|
- INNER JOIN ptl_agreement pa ON a.agreement_id = pa.id
|
|
|
- <where>
|
|
|
- 1=1
|
|
|
- <if test="startDate !=null and startDate!='' and endDate !=null and endDate !=''">
|
|
|
- and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
|
|
|
- </if>
|
|
|
- <if test="agreementType !=null and agreementType !=''">
|
|
|
- and pa.agreement_type =#{agreementType}
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="signDateEnd !=null and signDateEnd!='' and signDateStart !=null and signDateStart !=''">
|
|
|
- and a.signdate between #{signDateStart} and #{signDateEnd}
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
|
|
|
- and a.handling_fees_status =#{handlingFeesStatus}
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="dockingPerson !=null and dockingPerson !=''">
|
|
|
- and pa.docking_person =#{dockingPerson}
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="orderno !=null and orderno !=''">
|
|
|
- and a.orderno =#{orderno}
|
|
|
- </if>
|
|
|
- <if test="companyName !=null and companyName !=''">
|
|
|
- and a.company_id =#{companyName}
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="policyno !=null and policyno !=''">
|
|
|
- and a.policyno =#{policyno}
|
|
|
- </if>
|
|
|
- <if test="documentaryFeesStatus !=null and documentaryFeesStatus !=''">
|
|
|
- and a.documentary_fees_status =#{documentaryFeesStatus}
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="isNotCar !=null and isNotCar !=''">
|
|
|
- and a.is_not_car =#{isNotCar}
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="isOther !=null and isOther !=''">
|
|
|
- and a.is_not_documentary =#{isOther}
|
|
|
- </if>
|
|
|
- <if test="licenseno != null and licenseno != ''">
|
|
|
- and a.licenseno =#{licenseno}
|
|
|
- </if>
|
|
|
- <if test="syPolicyno != null and syPolicyno != ''">
|
|
|
- and a.sy_policyno =#{syPolicyno}
|
|
|
- </if>
|
|
|
|
|
|
- <if test="noPolicyno != null and noPolicyno != ''">
|
|
|
- and a.no_policyno =#{noPolicyno}
|
|
|
- </if>
|
|
|
- <if test="signdate !=null and signdate !=''">
|
|
|
- AND a.signdate =#{signdate}
|
|
|
- </if>
|
|
|
- <if test="partnerCompaniesId !=null and partnerCompaniesId !=''">
|
|
|
- AND a.partner_companies_id =#{partnerCompaniesId}
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="partnerCompaniesName !=null and partnerCompaniesName !=''">
|
|
|
- AND a.partner_companies_name =#{partnerCompaniesName}
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="createTime !=null and createTime !=''">
|
|
|
- AND a.create_time =#{createTime}
|
|
|
- </if>
|
|
|
- <if test="settlementTime !=null and settlementTime !=''">
|
|
|
- AND a.settlement_time =#{settlementTime}
|
|
|
- </if>
|
|
|
-
|
|
|
- <if test="userId !=null and userId !=''">
|
|
|
- and a.userId =#{userId}
|
|
|
- </if>
|
|
|
- <if test="companyId !=null and companyId !=''">
|
|
|
- and a.company_id =#{companyId}
|
|
|
- </if>
|
|
|
- <if test="riskcode !=null and riskcode !=''">
|
|
|
- and a.riskcode =#{riskcode}
|
|
|
- </if>
|
|
|
- <if test="year !=null and year !=''">
|
|
|
- AND YEAR(a.signdate) =#{year}
|
|
|
- </if>
|
|
|
- <if test="yeartsStart !=null and yeartsStart !='' and yeartsEnd !=null and yeartsEnd!=''">
|
|
|
- and DATE_FORMAT( a.signdate, '%Y') between #{yeartsStart} and #{yeartsEnd}
|
|
|
- </if>
|
|
|
- <if test="month !=null and month !=''">
|
|
|
- AND month(a.signdate) =#{month}
|
|
|
- </if>
|
|
|
- <if test="day !=null and day !=''">
|
|
|
- AND day(a.signdate) =#{day}
|
|
|
- </if>
|
|
|
- <if test="insuredName !=null and insuredName !=''">
|
|
|
- AND a.insured_name =#{insuredName}
|
|
|
- </if>
|
|
|
-
|
|
|
- AND YEAR(a.signdate) = YEAR(CURDATE())
|
|
|
- </where>
|
|
|
- GROUP BY
|
|
|
- MONTH(a.signdate)
|
|
|
- ) other_fees ON m.month_num = other_fees.month_num
|
|
|
- LEFT JOIN (
|
|
|
- SELECT
|
|
|
- MONTH(signing_time) AS month_num,
|
|
|
- SUM(settlement_amount) AS total_settlement_amount
|
|
|
- FROM
|
|
|
- settlement_documentary_fees
|
|
|
- WHERE
|
|
|
- settlement_status = '1'
|
|
|
- AND handling_fees_status = '1'
|
|
|
- <if test="isNotCar !=null and isNotCar !=''">
|
|
|
- and is_not_car =#{isNotCar}
|
|
|
- </if>
|
|
|
- <if test="yeartsStart !=null and yeartsStart !='' and yeartsEnd !=null and yeartsEnd!=''">
|
|
|
- and DATE_FORMAT( signing_time, '%Y') between #{yeartsStart} and #{yeartsEnd}
|
|
|
- </if>
|
|
|
- GROUP BY
|
|
|
- MONTH(signing_time)
|
|
|
- ) settlement_fees ON m.month_num = settlement_fees.month_num
|
|
|
- ORDER BY
|
|
|
- m.month_num;
|
|
|
+ <select id="otherTimeDetail" resultType="java.util.HashMap">
|
|
|
+ SELECT
|
|
|
+ i.YEAR as "year",
|
|
|
+ i.monthNumber as "monthNumber",
|
|
|
+ i.allTotalOtherFeevalue as "allTotalOtherFeevalue",
|
|
|
+ IFNULL(s.invoicCommissionFeevalue,0) AS invoicCommissionFeevalue,
|
|
|
+ CONCAT(i.YEAR, '-', LPAD(i.monthNumber, 2, '0')) AS "monthYear",
|
|
|
+ IFNULL(i.allTotalOtherFeevalue ,0) - IFNULL(s.invoicCommissionFeevalue,0) AS noInvoicCommissionFeevalue
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ YEAR(a.signdate) AS YEAR,
|
|
|
+ MONTH(a.signdate) AS monthNumber,
|
|
|
+ SUM(IFNULL(a.other_feevalue, 0)) AS allTotalOtherFeevalue
|
|
|
+
|
|
|
+ FROM ins_ply_income a
|
|
|
+ LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
|
|
|
+ <where>
|
|
|
+ YEAR(a.signdate) BETWEEN YEAR(CURDATE()) AND YEAR(CURDATE()) + 1
|
|
|
+ <if test="startDate !=null and startDate!='' and endDate !=null and endDate !=''">
|
|
|
+ and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
|
|
|
+ </if>
|
|
|
+ <if test="agreementType !=null and agreementType !=''">
|
|
|
+ and pa.agreement_type =#{agreementType}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="signDateEnd !=null and signDateEnd!='' and signDateStart !=null and signDateStart !=''">
|
|
|
+ and a.signdate between #{signDateStart} and #{signDateEnd}
|
|
|
+ </if>
|
|
|
+ <if test="yeartsStart !=null and yeartsStart !='' and yeartsEnd !=null and yeartsEnd!=''">
|
|
|
+ and DATE_FORMAT( a.signdate, '%Y') between #{yeartsStart} and #{yeartsEnd}
|
|
|
+ </if>
|
|
|
+ <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
|
|
|
+ and a.handling_fees_status =#{handlingFeesStatus}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="dockingPerson !=null and dockingPerson !=''">
|
|
|
+ and pa.docking_person =#{dockingPerson}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="provinceId != null and provinceId != ''">
|
|
|
+ and a.deptid like "${provinceId}%"
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="cityId != null and cityId != ''">
|
|
|
+ and a.deptid like "${cityId}%"
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="countyId != null and countyId != ''">
|
|
|
+ and a.deptid like "${countyId}%"
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="orderno !=null and orderno !=''">
|
|
|
+ and a.orderno =#{orderno}
|
|
|
+ </if>
|
|
|
+ <if test="companyName !=null and companyName !=''">
|
|
|
+ and a.company_id =#{companyName}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="policyno !=null and policyno !=''">
|
|
|
+ and a.policyno =#{policyno}
|
|
|
+ </if>
|
|
|
+ <if test="documentaryFeesStatus !=null and documentaryFeesStatus !=''">
|
|
|
+ and a.documentary_fees_status =#{documentaryFeesStatus}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="isNotCar !=null and isNotCar !=''">
|
|
|
+ and a.is_not_car =#{isNotCar}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="deptId !=null and deptId !=''">
|
|
|
+ and pa.dept_id =#{deptId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+
|
|
|
+ <if test="ids != null and ids != '' and ids.length > 0">
|
|
|
+ and a.id in
|
|
|
+ <foreach collection="ids" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="selectIds != null and selectIds != '' and selectIds.size() > 0">
|
|
|
+ and a.id in
|
|
|
+ <foreach collection="selectIds" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="partnerCompaniesIdList != null and partnerCompaniesIdList != '' and partnerCompaniesIdList.size() > 0">
|
|
|
+ and a.partner_companies_id in
|
|
|
+ <foreach collection="partnerCompaniesIdList" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="isOther !=null and isOther !=''">
|
|
|
+ and a.is_not_documentary =#{isOther}
|
|
|
+ </if>
|
|
|
+ <if test="licenseno != null and licenseno != ''">
|
|
|
+ and a.licenseno =#{licenseno}
|
|
|
+ </if>
|
|
|
+ <if test="syPolicyno != null and syPolicyno != ''">
|
|
|
+ and a.sy_policyno =#{syPolicyno}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="noPolicyno != null and noPolicyno != ''">
|
|
|
+ and a.no_policyno =#{noPolicyno}
|
|
|
+ </if>
|
|
|
+ <if test="signdate !=null and signdate !=''">
|
|
|
+ AND a.signdate =#{signdate}
|
|
|
+ </if>
|
|
|
+ <if test="partnerCompaniesId !=null and partnerCompaniesId !=''">
|
|
|
+ AND a.partner_companies_id =#{partnerCompaniesId}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="partnerCompaniesName !=null and partnerCompaniesName !=''">
|
|
|
+ AND a.partner_companies_name =#{partnerCompaniesName}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="createTime !=null and createTime !=''">
|
|
|
+ AND a.create_time =#{createTime}
|
|
|
+ </if>
|
|
|
+ <if test="settlementTime !=null and settlementTime !=''">
|
|
|
+ AND a.settlement_time =#{settlementTime}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ <if test="userId !=null and userId !=''">
|
|
|
+ and a.userId =#{userId}
|
|
|
+ </if>
|
|
|
+ <if test="companyId !=null and companyId !=''">
|
|
|
+ and a.company_id =#{companyId}
|
|
|
+ </if>
|
|
|
+ <if test="riskcode !=null and riskcode !=''">
|
|
|
+ and a.riskcode =#{riskcode}
|
|
|
+ </if>
|
|
|
+ <if test="year !=null and year !=''">
|
|
|
+ AND YEAR(a.signdate) =#{year}
|
|
|
+ </if>
|
|
|
+ <if test="month !=null and month !=''">
|
|
|
+ AND month(a.signdate) =#{month}
|
|
|
+ </if>
|
|
|
+ <if test="day !=null and day !=''">
|
|
|
+ AND day(a.signdate) =#{day}
|
|
|
+ </if>
|
|
|
+ <if test="insuredName !=null and insuredName !=''">
|
|
|
+ AND a.insured_name =#{insuredName}
|
|
|
+ </if>
|
|
|
+ <if test="jqStartDate !=null and jqStartDate != '' and jqEndDate != null and jqEndDate !=''">
|
|
|
+ AND a.jq_end_date BETWEEN #{jqStartDate} AND #{jqEndDate} AND a.jq_start_date > = #{jqStartDate}
|
|
|
+ </if>
|
|
|
+ <if test="syStartDate !=null and syStartDate != '' and syEndDate != null and syEndDate !=''">
|
|
|
+ AND a.sy_start_date BETWEEN #{syStartDate} AND #{syEndDate} AND a.sy_start_date > = #{syStartDate}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY YEAR(a.signdate), MONTH(a.signdate)
|
|
|
+ ) i
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ YEAR(a.signing_time) AS YEAR,
|
|
|
+ MONTH(a.signing_time) AS monthNumber,
|
|
|
+ SUM(CASE WHEN a.settlement_status = '1' THEN IFNULL(a.settlement_amount, 0) ELSE 0 END) AS invoicCommissionFeevalue
|
|
|
+ FROM settlement_documentary_fees a
|
|
|
+ <where>
|
|
|
+ YEAR(a.signing_time) BETWEEN YEAR(CURDATE()) AND YEAR(CURDATE()) + 1
|
|
|
+ <if test="isNotCar !=null and isNotCar !=''">
|
|
|
+ and a.is_not_car =#{isNotCar}
|
|
|
+ </if>
|
|
|
+ <if test="partnerCompaniesIdList != null and partnerCompaniesIdList != '' and partnerCompaniesIdList.size() > 0">
|
|
|
+ and a.partner_companies_id in
|
|
|
+ <foreach collection="partnerCompaniesIdList" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="partnerCompaniesId !=null and partnerCompaniesId !=''">
|
|
|
+ AND a.partner_companies_id =#{partnerCompaniesId}
|
|
|
+ </if>
|
|
|
+ <if test="companyName !=null and companyName !=''">
|
|
|
+ and a.company_id =#{companyName}
|
|
|
+ </if>
|
|
|
+ <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
|
|
|
+ and a.handling_fees_status =#{handlingFeesStatus}
|
|
|
+ </if>
|
|
|
+ <if test="yeartsStart !=null and yeartsStart !='' and yeartsEnd !=null and yeartsEnd!=''">
|
|
|
+ and DATE_FORMAT( a.signing_time, '%Y') between #{yeartsStart} and #{yeartsEnd}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY YEAR(a.signing_time), MONTH(a.signing_time)
|
|
|
+ ) s ON i.YEAR = s.YEAR AND i.monthNumber = s.monthNumber
|
|
|
+ ORDER BY i.YEAR, i.monthNumber;
|
|
|
</select>
|
|
|
|
|
|
</mapper>
|