|
@@ -552,7 +552,7 @@
|
|
|
fee.amount,
|
|
fee.amount,
|
|
|
"1" as businessSegmentsType,
|
|
"1" as businessSegmentsType,
|
|
|
"2" as transactionType,
|
|
"2" as transactionType,
|
|
|
- fee.createtime
|
|
|
|
|
|
|
+ fee.createTime
|
|
|
FROM
|
|
FROM
|
|
|
(
|
|
(
|
|
|
SELECT
|
|
SELECT
|
|
@@ -567,8 +567,10 @@
|
|
|
left join ins_orders o ON o.orderno=iac.orderno
|
|
left join ins_orders o ON o.orderno=iac.orderno
|
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
|
<where>
|
|
<where>
|
|
|
- iff.auditstatus=0
|
|
|
|
|
- and iac.orderstatus = '3'
|
|
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ <if test="myCollectInAdvanceQueryDto.auditstatus!=null and myCollectInAdvanceQueryDto.auditstatus!= ''">
|
|
|
|
|
+ AND iff.auditstatus = #{myCollectInAdvanceQueryDto.auditstatus}
|
|
|
|
|
+ </if>
|
|
|
<if test="myCollectInAdvanceQueryDto.userId!=null and myCollectInAdvanceQueryDto.userId!= ''">
|
|
<if test="myCollectInAdvanceQueryDto.userId!=null and myCollectInAdvanceQueryDto.userId!= ''">
|
|
|
AND a.first_level_user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
AND a.first_level_user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
|
</if>
|
|
</if>
|
|
@@ -642,7 +644,9 @@
|
|
|
<where>
|
|
<where>
|
|
|
ins.orderstatus ='3'
|
|
ins.orderstatus ='3'
|
|
|
and a.user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
and a.user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
|
- and iff.auditstatus=0
|
|
|
|
|
|
|
+ <if test="myCollectInAdvanceQueryDto.auditstatus!=null and myCollectInAdvanceQueryDto.auditstatus!= ''">
|
|
|
|
|
+ AND iff.auditstatus = #{myCollectInAdvanceQueryDto.auditstatus}
|
|
|
|
|
+ </if>
|
|
|
<if test="myCollectInAdvanceQueryDto.startDate!= null and myCollectInAdvanceQueryDto.startDate !='' and myCollectInAdvanceQueryDto.endDate!= null and myCollectInAdvanceQueryDto.endDate !=''">
|
|
<if test="myCollectInAdvanceQueryDto.startDate!= null and myCollectInAdvanceQueryDto.startDate !='' and myCollectInAdvanceQueryDto.endDate!= null and myCollectInAdvanceQueryDto.endDate !=''">
|
|
|
AND ins.createtime BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
|
|
AND ins.createtime BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
|
|
|
</if>
|
|
</if>
|
|
@@ -664,8 +668,10 @@
|
|
|
left join ins_orders o ON o.orderno=iac.orderno
|
|
left join ins_orders o ON o.orderno=iac.orderno
|
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
|
<where>
|
|
<where>
|
|
|
- iff.auditstatus=0
|
|
|
|
|
- and iac.orderstatus = '3'
|
|
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ <if test="myCollectInAdvanceQueryDto.auditstatus!=null and myCollectInAdvanceQueryDto.auditstatus!= ''">
|
|
|
|
|
+ AND iff.auditstatus = #{myCollectInAdvanceQueryDto.auditstatus}
|
|
|
|
|
+ </if>
|
|
|
<if test="myCollectInAdvanceQueryDto.userId!=null and myCollectInAdvanceQueryDto.userId!= ''">
|
|
<if test="myCollectInAdvanceQueryDto.userId!=null and myCollectInAdvanceQueryDto.userId!= ''">
|
|
|
AND a.first_level_user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
AND a.first_level_user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
|
</if>
|
|
</if>
|
|
@@ -685,8 +691,10 @@
|
|
|
left join ins_orders o ON o.orderno=iac.orderno
|
|
left join ins_orders o ON o.orderno=iac.orderno
|
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
|
<where>
|
|
<where>
|
|
|
- iff.auditstatus=0
|
|
|
|
|
- and iac.orderstatus = '3'
|
|
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ <if test="myCollectInAdvanceQueryDto.auditstatus!=null and myCollectInAdvanceQueryDto.auditstatus!= ''">
|
|
|
|
|
+ AND iff.auditstatus = #{myCollectInAdvanceQueryDto.auditstatus}
|
|
|
|
|
+ </if>
|
|
|
<if test="myCollectInAdvanceQueryDto.userId!=null and myCollectInAdvanceQueryDto.userId!= ''">
|
|
<if test="myCollectInAdvanceQueryDto.userId!=null and myCollectInAdvanceQueryDto.userId!= ''">
|
|
|
AND a.three_level_user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
AND a.three_level_user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
|
</if>
|
|
</if>
|
|
@@ -706,8 +714,10 @@
|
|
|
left join ins_orders o ON o.orderno=iac.orderno
|
|
left join ins_orders o ON o.orderno=iac.orderno
|
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
|
<where>
|
|
<where>
|
|
|
- iff.auditstatus=0
|
|
|
|
|
- and iac.orderstatus = '3'
|
|
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ <if test="myCollectInAdvanceQueryDto.auditstatus!=null and myCollectInAdvanceQueryDto.auditstatus!= ''">
|
|
|
|
|
+ AND iff.auditstatus = #{myCollectInAdvanceQueryDto.auditstatus}
|
|
|
|
|
+ </if>
|
|
|
<if test="myCollectInAdvanceQueryDto.userId!=null and myCollectInAdvanceQueryDto.userId!= ''">
|
|
<if test="myCollectInAdvanceQueryDto.userId!=null and myCollectInAdvanceQueryDto.userId!= ''">
|
|
|
AND a.two_level_user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
AND a.two_level_user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
|
</if>
|
|
</if>
|
|
@@ -725,9 +735,11 @@
|
|
|
left join ins_orders o ON o.orderno=ins.orderno
|
|
left join ins_orders o ON o.orderno=ins.orderno
|
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
|
<where>
|
|
<where>
|
|
|
- ins.orderstatus ='3'
|
|
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ <if test="myCollectInAdvanceQueryDto.auditstatus!=null and myCollectInAdvanceQueryDto.auditstatus!= ''">
|
|
|
|
|
+ AND iff.auditstatus = #{myCollectInAdvanceQueryDto.auditstatus}
|
|
|
|
|
+ </if>
|
|
|
and a.user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
and a.user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
|
- and iff.auditstatus=0
|
|
|
|
|
<if test="myCollectInAdvanceQueryDto.startDate!= null and myCollectInAdvanceQueryDto.startDate !='' and myCollectInAdvanceQueryDto.endDate!= null and myCollectInAdvanceQueryDto.endDate !=''">
|
|
<if test="myCollectInAdvanceQueryDto.startDate!= null and myCollectInAdvanceQueryDto.startDate !='' and myCollectInAdvanceQueryDto.endDate!= null and myCollectInAdvanceQueryDto.endDate !=''">
|
|
|
AND ins.createtime BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
|
|
AND ins.createtime BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
|
|
|
</if>
|
|
</if>
|
|
@@ -745,8 +757,8 @@
|
|
|
LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
|
|
LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
|
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
|
<where>
|
|
<where>
|
|
|
- iff.auditstatus=0
|
|
|
|
|
- and iac.orderstatus = '3'
|
|
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ AND iff.auditstatus =0
|
|
|
<if test="myCollectInAdvanceQueryDto.userId!=null and myCollectInAdvanceQueryDto.userId!= ''">
|
|
<if test="myCollectInAdvanceQueryDto.userId!=null and myCollectInAdvanceQueryDto.userId!= ''">
|
|
|
AND a.first_level_user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
AND a.first_level_user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
|
</if>
|
|
</if>
|
|
@@ -762,8 +774,10 @@
|
|
|
LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
|
|
LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
|
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
|
<where>
|
|
<where>
|
|
|
- iff.auditstatus=0
|
|
|
|
|
- and iac.orderstatus = '3'
|
|
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ <if test="myCollectInAdvanceQueryDto.auditstatus!=null and myCollectInAdvanceQueryDto.auditstatus!= ''">
|
|
|
|
|
+ AND iff.auditstatus = #{myCollectInAdvanceQueryDto.auditstatus}
|
|
|
|
|
+ </if>
|
|
|
<if test="myCollectInAdvanceQueryDto.userId!=null and myCollectInAdvanceQueryDto.userId!= ''">
|
|
<if test="myCollectInAdvanceQueryDto.userId!=null and myCollectInAdvanceQueryDto.userId!= ''">
|
|
|
AND a.three_level_user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
AND a.three_level_user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
|
</if>
|
|
</if>
|
|
@@ -779,8 +793,10 @@
|
|
|
LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
|
|
LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
|
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
|
<where>
|
|
<where>
|
|
|
- iff.auditstatus=0
|
|
|
|
|
- and iac.orderstatus = '3'
|
|
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ <if test="myCollectInAdvanceQueryDto.auditstatus!=null and myCollectInAdvanceQueryDto.auditstatus!= ''">
|
|
|
|
|
+ AND iff.auditstatus = #{myCollectInAdvanceQueryDto.auditstatus}
|
|
|
|
|
+ </if>
|
|
|
<if test="myCollectInAdvanceQueryDto.userId!=null and myCollectInAdvanceQueryDto.userId!= ''">
|
|
<if test="myCollectInAdvanceQueryDto.userId!=null and myCollectInAdvanceQueryDto.userId!= ''">
|
|
|
AND a.two_level_user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
AND a.two_level_user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
|
</if>
|
|
</if>
|
|
@@ -800,18 +816,351 @@
|
|
|
)
|
|
)
|
|
|
as "amount"
|
|
as "amount"
|
|
|
from
|
|
from
|
|
|
- ins_fee_order_new a left join ins_area_company ins on a.ins_order_no=ins.id
|
|
|
|
|
- left join ins_orders o ON o.orderno=ins.orderno
|
|
|
|
|
|
|
+ ins_fee_order_new a left join ins_area_company iac on a.ins_order_no=iac.id
|
|
|
|
|
+ left join ins_orders o ON o.orderno=iac.orderno
|
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
left join ins_fee_audit iff on a.ins_order_no=iff.ins_order_no
|
|
|
<where>
|
|
<where>
|
|
|
- ins.orderstatus ='3'
|
|
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ AND iff.auditstatus = 0
|
|
|
and a.user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
and a.user_id = #{myCollectInAdvanceQueryDto.userId}
|
|
|
- and iff.auditstatus=0
|
|
|
|
|
<if test="myCollectInAdvanceQueryDto.startDate!= null and myCollectInAdvanceQueryDto.startDate !='' and myCollectInAdvanceQueryDto.endDate!= null and myCollectInAdvanceQueryDto.endDate !=''">
|
|
<if test="myCollectInAdvanceQueryDto.startDate!= null and myCollectInAdvanceQueryDto.startDate !='' and myCollectInAdvanceQueryDto.endDate!= null and myCollectInAdvanceQueryDto.endDate !=''">
|
|
|
- AND ins.createtime BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
|
|
|
|
|
|
|
+ AND iac.createtime BETWEEN #{myCollectInAdvanceQueryDto.startDate} AND #{myCollectInAdvanceQueryDto.endDate}
|
|
|
</if>
|
|
</if>
|
|
|
</where>
|
|
</where>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
+ <select id="findMyInsuranceByUserId"
|
|
|
|
|
+ resultType="com.ydtech.modules.admin.model.dto.ExportExpenditureTypeDetalsDto">
|
|
|
|
|
+ <include refid="common_List_sql"/>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="exportMyInsuranceByUserId"
|
|
|
|
|
+ resultType="com.ydtech.modules.admin.model.dto.ExportExpenditureTypeDetalsDto">
|
|
|
|
|
+ <include refid="common_List_sql"/>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <sql id="common_List_sql">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.ins_order_no AS "subOrderNo",
|
|
|
|
|
+ DATE_FORMAT(iac.signing_time, '%Y-%m-%d %H:%i:%s') AS "signingTime",
|
|
|
|
|
+ DATE_FORMAT(iff.audittime, '%Y-%m-%d %H:%i:%s') AS "auditTime",
|
|
|
|
|
+ CASE iff.auditstatus WHEN '0' THEN '未审核' WHEN '1' THEN '已审核' ELSE '' END AS auditstatus,
|
|
|
|
|
+ o.licenseno AS "licenseno",
|
|
|
|
|
+ (
|
|
|
|
|
+ ifnull( a.jq_export_supervise_costs_premiums, 0 )+ ifnull( a.sy_export_supervise_costs_premiums, 0 )+ ifnull( a.no_export_supervise_costs_premiums, 0 )) + (
|
|
|
|
|
+ ifnull( a.jq_export_other_costs_premiums, 0 )+ ifnull( a.sy_export_other_costs_premiums, 0 )+ ifnull( a.no_export_other_costs_premiums, 0 )) AS "amount",
|
|
|
|
|
+ a.user_id AS userId,
|
|
|
|
|
+ iac.jqapplyno AS jqapplyno,
|
|
|
|
|
+ iac.syapplyno AS syapplyno,
|
|
|
|
|
+ iac.inscompany AS companyName,
|
|
|
|
|
+ o.insuredname AS insuredName,
|
|
|
|
|
+ ins.NAME AS partnerCompaniesName,
|
|
|
|
|
+ o.username as userName,
|
|
|
|
|
+ o.orderno as orderno,
|
|
|
|
|
+ o.frameno as frameNo,
|
|
|
|
|
+ JSON_EXTRACT( o.carinfo, '$.engineNo' ) as engineNo,
|
|
|
|
|
+ iac.product as productId
|
|
|
|
|
+ FROM
|
|
|
|
|
+ ins_fee_audit iff
|
|
|
|
|
+ LEFT JOIN ins_fee_order_new a ON a.ins_order_no = iff.ins_order_no
|
|
|
|
|
+ LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
|
|
|
|
|
+ LEFT JOIN ins_orders o ON o.orderno = iac.orderno
|
|
|
|
|
+ LEFT JOIN ptl_agreement agree ON iac.agreement_id = agree.id
|
|
|
|
|
+ LEFT JOIN esm_ins_company ins ON ins.id = agree.partner_companies_id
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="userList != null and userList.size>0">
|
|
|
|
|
+ AND ( a.user_id = #{vo.userId} or a.user_id in
|
|
|
|
|
+ <foreach collection="userList" item="item" open="(" separator="," close=")">
|
|
|
|
|
+ #{item}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ )
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <otherwise>
|
|
|
|
|
+ AND a.user_id = #{vo.userId}
|
|
|
|
|
+ </otherwise>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ <if test="vo.orderNo!=null and vo.orderNo!= ''">
|
|
|
|
|
+ AND o.orderno = #{vo.orderNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.subOrderNo!=null and vo.subOrderNo!= ''">
|
|
|
|
|
+ AND iac.id = #{vo.subOrderNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.userDLId!=null and vo.userDLId!= ''">
|
|
|
|
|
+ AND a.user_id = #{vo.userDLId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.userDLName!=null and vo.userDLName!= ''">
|
|
|
|
|
+ AND o.username= #{vo.userDLName}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.licenseNo!=null and vo.licenseNo!= ''">
|
|
|
|
|
+ AND o.licenseno = #{vo.licenseNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.startDate!=null and vo.startDate!= '' and vo.endDate!=null and vo.endDate!= ''">
|
|
|
|
|
+ AND iac.signing_time BETWEEN #{vo.startDate} AND #{vo.endDate}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.auditstatus!=null and vo.auditstatus!= ''">
|
|
|
|
|
+ AND iff.auditstatus = #{vo.auditstatus}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.salesmanId!=null and vo.salesmanId!= ''">
|
|
|
|
|
+ AND o.user_id = #{vo.salesmanId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.salesmanName!=null and vo.salesmanName!= ''">
|
|
|
|
|
+ AND o.username = #{vo.salesmanName}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.jqapplyno!=null and vo.jqapplyno!= ''">
|
|
|
|
|
+ AND iac.jqapplyno like concat('%', #{vo.jqapplyno},'%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.syapplyno!=null and vo.syapplyno!= ''">
|
|
|
|
|
+ AND iac.syapplyno like concat('%', #{vo.syapplyno},'%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.frameNo!=null and vo.frameNo!= ''">
|
|
|
|
|
+ AND o.frameno = #{vo.frameNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.engineNo!=null and vo.engineNo!= ''">
|
|
|
|
|
+ and JSON_EXTRACT( o.carinfo, '$.engineNo' ) = #{vo.engineNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.productId!=null and vo.productId!= ''">
|
|
|
|
|
+ AND iac.productid = #{vo.productId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.insuredName!=null and vo.insuredName!= ''">
|
|
|
|
|
+ AND o.insuredname = #{vo.insuredName}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.companyId!=null and vo.companyId!= ''">
|
|
|
|
|
+ AND iac.company_id = #{vo.companyId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ </sql>
|
|
|
|
|
+ <select id="findMyInsuranceTGByUserId"
|
|
|
|
|
+ resultType="com.ydtech.modules.admin.model.dto.ExportExpenditureTypeDetalsTGDto">
|
|
|
|
|
+ <include refid="common_List_sql_tg"/>
|
|
|
|
|
+ </select>
|
|
|
|
|
|
|
|
|
|
+ <select id="exportMyInsuranceTGByUserId"
|
|
|
|
|
+ resultType="com.ydtech.modules.admin.model.dto.ExportExpenditureTypeDetalsTGDto">
|
|
|
|
|
+ <include refid="common_List_sql_tg"/>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ <sql id="common_List_sql_tg">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ fee.subOrderNo,
|
|
|
|
|
+ DATE_FORMAT(fee.signingTime, '%Y-%m-%d %H:%i:%s') AS "signingTime",
|
|
|
|
|
+ DATE_FORMAT(fee.audittime, '%Y-%m-%d %H:%i:%s') AS "auditTime",
|
|
|
|
|
+ CASE fee.auditstatus WHEN '0' THEN '未审核' WHEN '1' THEN '已审核' ELSE '' END AS auditstatus,
|
|
|
|
|
+ fee.licenseno,
|
|
|
|
|
+ fee.amount,
|
|
|
|
|
+ fee.userId,
|
|
|
|
|
+ fee.userName,
|
|
|
|
|
+ fee.jqpremium,
|
|
|
|
|
+ fee.sypremium,
|
|
|
|
|
+ fee.jypremium,
|
|
|
|
|
+ fee.sumpremium,
|
|
|
|
|
+ fee.userLevel
|
|
|
|
|
+ FROM
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.ins_order_no AS "subOrderNo",
|
|
|
|
|
+ iac.signing_time AS "signingTime",
|
|
|
|
|
+ o.licenseno AS "licenseno",
|
|
|
|
|
+ iff.audittime AS "auditTime",
|
|
|
|
|
+ iff.auditstatus AS auditstatus,
|
|
|
|
|
+ o.username AS userName,
|
|
|
|
|
+ o.userid AS userId,
|
|
|
|
|
+ iac.jqpremium AS jqpremium,
|
|
|
|
|
+ iac.sypremium AS sypremium,
|
|
|
|
|
+ iac.jypremium AS jypremium,
|
|
|
|
|
+ iac.sumpremium AS sumpremium,
|
|
|
|
|
+ a.first_detail_premiums AS "amount",
|
|
|
|
|
+ "一级代理" AS userLevel
|
|
|
|
|
+ FROM
|
|
|
|
|
+ ins_fee_audit iff
|
|
|
|
|
+ LEFT JOIN ins_fee_order_new a ON a.ins_order_no = iff.ins_order_no
|
|
|
|
|
+ LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
|
|
|
|
|
+ LEFT JOIN ins_orders o ON o.orderno = iac.orderno
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ AND a.first_level_user_id = #{vo.userId}
|
|
|
|
|
+ <if test="vo.subOrderNo!=null and vo.subOrderNo!= ''">
|
|
|
|
|
+ AND iac.id = #{vo.subOrderNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.userDLId!=null and vo.userDLId!= ''">
|
|
|
|
|
+ AND o.userid = #{vo.userDLId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.userDLName!=null and vo.userDLName!= ''">
|
|
|
|
|
+ AND o.username= #{vo.orderNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.licenseNo!=null and vo.licenseNo!= ''">
|
|
|
|
|
+ AND o.licenseno = #{vo.licenseNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.startDate!=null and vo.startDate!= '' and vo.endDate!=null and vo.endDate!= ''">
|
|
|
|
|
+ AND iac.signing_time BETWEEN #{vo.startDate} AND #{vo.endDate}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.auditstatus!=null and vo.auditstatus!= ''">
|
|
|
|
|
+ AND iff.auditstatus = #{vo.auditstatus}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ UNION
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.ins_order_no AS "subOrderNo",
|
|
|
|
|
+ iac.signing_time AS "signingTime",
|
|
|
|
|
+ o.licenseno AS "licenseno",
|
|
|
|
|
+ iff.audittime AS "auditTime",
|
|
|
|
|
+ iff.auditstatus AS auditstatus,
|
|
|
|
|
+ o.username AS userName,
|
|
|
|
|
+ o.userid AS userId,
|
|
|
|
|
+ iac.jqpremium AS jqpremium,
|
|
|
|
|
+ iac.sypremium AS sypremium,
|
|
|
|
|
+ iac.jypremium AS jypremium,
|
|
|
|
|
+ iac.sumpremium AS sumpremium,
|
|
|
|
|
+ a.third_detail_premiums AS "amount",
|
|
|
|
|
+ "三级级代理" AS userLevel
|
|
|
|
|
+ FROM
|
|
|
|
|
+ ins_fee_audit iff
|
|
|
|
|
+ LEFT JOIN ins_fee_order_new a ON a.ins_order_no = iff.ins_order_no
|
|
|
|
|
+ LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
|
|
|
|
|
+ LEFT JOIN ins_orders o ON o.orderno = iac.orderno
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ AND iff.auditstatus = 0
|
|
|
|
|
+ AND a.three_level_user_id = #{vo.userId}
|
|
|
|
|
+ <if test="vo.subOrderNo!=null and vo.subOrderNo!= ''">
|
|
|
|
|
+ AND iac.id = #{vo.subOrderNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.userDLId!=null and vo.userDLId!= ''">
|
|
|
|
|
+ AND o.userid = #{vo.userDLId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.userDLName!=null and vo.userDLName!= ''">
|
|
|
|
|
+ AND o.username= #{vo.orderNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.licenseNo!=null and vo.licenseNo!= ''">
|
|
|
|
|
+ AND o.licenseno = #{vo.licenseNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.startDate!=null and vo.startDate!= '' and vo.endDate!=null and vo.endDate!= ''">
|
|
|
|
|
+ AND iac.signing_time BETWEEN #{vo.startDate} AND #{vo.endDate}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.auditstatus!=null and vo.auditstatus!= ''">
|
|
|
|
|
+ AND iff.auditstatus = #{vo.auditstatus}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ UNION
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.ins_order_no AS "subOrderNo",
|
|
|
|
|
+ iac.signing_time AS "signingTime",
|
|
|
|
|
+ o.licenseno AS "licenseno",
|
|
|
|
|
+ iff.audittime AS "auditTime",
|
|
|
|
|
+ iff.auditstatus AS auditstatus,
|
|
|
|
|
+ o.username AS userName,
|
|
|
|
|
+ o.userid AS userId,
|
|
|
|
|
+ iac.jqpremium AS jqpremium,
|
|
|
|
|
+ iac.sypremium AS sypremium,
|
|
|
|
|
+ iac.jypremium AS jypremium,
|
|
|
|
|
+ iac.sumpremium AS sumpremium,
|
|
|
|
|
+ a.second_detail_premiums AS "amount",
|
|
|
|
|
+ "二级代理" AS userLevel
|
|
|
|
|
+ FROM
|
|
|
|
|
+ ins_fee_audit iff
|
|
|
|
|
+ LEFT JOIN ins_fee_order_new a ON a.ins_order_no = iff.ins_order_no
|
|
|
|
|
+ LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
|
|
|
|
|
+ LEFT JOIN ins_orders o ON o.orderno = iac.orderno
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ AND a.two_level_user_id = #{vo.userId}
|
|
|
|
|
+ <if test="vo.subOrderNo!=null and vo.subOrderNo!= ''">
|
|
|
|
|
+ AND iac.id = #{vo.subOrderNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.userDLId!=null and vo.userDLId!= ''">
|
|
|
|
|
+ AND o.userid = #{vo.userDLId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.userDLName!=null and vo.userDLName!= ''">
|
|
|
|
|
+ AND o.username= #{vo.orderNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.licenseNo!=null and vo.licenseNo!= ''">
|
|
|
|
|
+ AND o.licenseno = #{vo.licenseNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.startDate!=null and vo.startDate!= '' and vo.endDate!=null and vo.endDate!= ''">
|
|
|
|
|
+ AND iac.signing_time BETWEEN #{vo.startDate} AND #{vo.endDate}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.auditstatus!=null and vo.auditstatus!= ''">
|
|
|
|
|
+ AND iff.auditstatus = #{vo.auditstatus}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ ) AS fee
|
|
|
|
|
+ ORDER BY
|
|
|
|
|
+ fee.signingTime DESC
|
|
|
|
|
+ </sql>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="findMyAmountYSOrSSCXAmount" resultType="java.math.BigDecimal">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ ifnull(sum(
|
|
|
|
|
+ ifnull( a.jq_export_supervise_costs_premiums, 0 )+ ifnull( a.sy_export_supervise_costs_premiums, 0 )+ ifnull( a.no_export_supervise_costs_premiums, 0 ) +
|
|
|
|
|
+ ifnull( a.jq_export_other_costs_premiums, 0 )+ ifnull( a.sy_export_other_costs_premiums, 0 )+ ifnull( a.no_export_other_costs_premiums, 0 )
|
|
|
|
|
+ ),0)
|
|
|
|
|
+ FROM
|
|
|
|
|
+ ins_fee_audit iff
|
|
|
|
|
+ LEFT JOIN ins_fee_order_new a ON a.ins_order_no = iff.ins_order_no
|
|
|
|
|
+ LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ and iff.auditstatus=#{vo.auditstatus}
|
|
|
|
|
+ AND a.user_id = #{vo.userId}
|
|
|
|
|
+ <if test="vo.startDate!=null and vo.startDate!= '' and vo.endDate!=null and vo.endDate!= ''">
|
|
|
|
|
+ AND iac.signingTime BETWEEN #{vo.startDate} AND #{vo.endDate}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <select id="findMyAmountYSOrSSTGAmount" resultType="java.math.BigDecimal">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ ifnull(sum(fee.amount),0)
|
|
|
|
|
+ FROM
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.first_detail_premiums AS "amount"
|
|
|
|
|
+ FROM
|
|
|
|
|
+ ins_fee_audit iff
|
|
|
|
|
+ LEFT JOIN ins_fee_order_new a ON a.ins_order_no = iff.ins_order_no
|
|
|
|
|
+ LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ AND a.first_level_user_id = #{vo.userId}
|
|
|
|
|
+ and iff.auditstatus = #{vo.auditstatus}
|
|
|
|
|
+ <if test="vo.startDate!=null and vo.startDate!= '' and vo.endDate!=null and vo.endDate!= ''">
|
|
|
|
|
+ AND iac.signingTime BETWEEN #{vo.startDate} AND #{vo.endDate}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ UNION
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.third_detail_premiums AS "amount"
|
|
|
|
|
+ FROM
|
|
|
|
|
+ ins_fee_audit iff
|
|
|
|
|
+ LEFT JOIN ins_fee_order_new a ON a.ins_order_no = iff.ins_order_no
|
|
|
|
|
+ LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ AND a.three_level_user_id = #{vo.userId}
|
|
|
|
|
+ and iff.auditstatus = #{vo.auditstatus}
|
|
|
|
|
+ <if test="vo.startDate!=null and vo.startDate!= '' and vo.endDate!=null and vo.endDate!= ''">
|
|
|
|
|
+ AND iac.signingTime BETWEEN #{vo.startDate} AND #{vo.endDate}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ UNION
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ a.second_detail_premiums AS "amount"
|
|
|
|
|
+ FROM
|
|
|
|
|
+ ins_fee_audit iff
|
|
|
|
|
+ LEFT JOIN ins_fee_order_new a ON a.ins_order_no = iff.ins_order_no
|
|
|
|
|
+ LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ iac.orderstatus = '3'
|
|
|
|
|
+ AND a.two_level_user_id = #{vo.userId}
|
|
|
|
|
+ and iff.auditstatus = #{vo.auditstatus}
|
|
|
|
|
+ <if test="vo.startDate!=null and vo.startDate!= '' and vo.endDate!=null and vo.endDate!= ''">
|
|
|
|
|
+ AND iac.signingTime BETWEEN #{vo.startDate} AND #{vo.endDate}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ ) AS fee
|
|
|
|
|
+
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <select id="findMyAmountYTXmount" resultType="java.math.BigDecimal">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ ifnull( sum( au.amount ), 0 )
|
|
|
|
|
+ FROM
|
|
|
|
|
+ sys_amount_auditing au
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ au.user_id = #{userId}
|
|
|
|
|
+ AND auditing_status = '3'
|
|
|
|
|
+ </select>
|
|
|
</mapper>
|
|
</mapper>
|