|
@@ -103,12 +103,12 @@
|
|
|
SELECT iac.*, pa.agreement_name
|
|
SELECT iac.*, pa.agreement_name
|
|
|
FROM ins_area_company as iac
|
|
FROM ins_area_company as iac
|
|
|
left join ptl_agreement as pa on pa.id = iac.agreement_id
|
|
left join ptl_agreement as pa on pa.id = iac.agreement_id
|
|
|
- WHERE iac.orderstatus = 3 and orderno = #{orderNo};
|
|
|
|
|
|
|
+ WHERE iac.orderstatus = 3
|
|
|
|
|
+ and orderno = #{orderNo};
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- <select id="queryLatestStatus" resultType="java.lang.String">
|
|
|
|
|
|
|
+ <select id="queryLatestStatus" resultType="java.lang.String">
|
|
|
SELECT iac.orderstatus
|
|
SELECT iac.orderstatus
|
|
|
FROM ins_area_company as iac
|
|
FROM ins_area_company as iac
|
|
|
INNER JOIN (SELECT company_id, max(createtime) AS max_createtime
|
|
INNER JOIN (SELECT company_id, max(createtime) AS max_createtime
|
|
@@ -120,51 +120,42 @@
|
|
|
ORDER BY orderstatus DESC
|
|
ORDER BY orderstatus DESC
|
|
|
LIMIT 1
|
|
LIMIT 1
|
|
|
</select>
|
|
</select>
|
|
|
- <select id="getorDerIds" resultType="com.ydtech.modules.order.entity.InsAreaCompany">
|
|
|
|
|
- SELECT
|
|
|
|
|
- a.id as "id" ,
|
|
|
|
|
- a.orderno as "orderno"
|
|
|
|
|
- FROM
|
|
|
|
|
- ins_area_company a
|
|
|
|
|
- LEFT JOIN ins_fee_order_new b ON a.id =b.ins_order_no
|
|
|
|
|
- WHERE
|
|
|
|
|
- a.orderstatus = '3' or a.orderstatus = '2'
|
|
|
|
|
- and b.id is not null
|
|
|
|
|
|
|
+ <select id="getorDerIds" resultType="com.ydtech.modules.order.entity.InsAreaCompany">
|
|
|
|
|
+ SELECT a.id as "id",
|
|
|
|
|
+ a.orderno as "orderno"
|
|
|
|
|
+ FROM ins_area_company a
|
|
|
|
|
+ LEFT JOIN ins_fee_order_new b ON a.id = b.ins_order_no
|
|
|
|
|
+ WHERE a.orderstatus = '3'
|
|
|
|
|
+ or a.orderstatus = '2'
|
|
|
|
|
+ and b.id is not null
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
- <select id="getPendingAuditOrders" resultType="com.ydtech.modules.order.entity.InsOrders">
|
|
|
|
|
|
|
+ <select id="getAuditOrders" resultType="com.ydtech.modules.order.entity.InsOrders">
|
|
|
SELECT
|
|
SELECT
|
|
|
io.*,
|
|
io.*,
|
|
|
sd.management_source,
|
|
sd.management_source,
|
|
|
su2.name AS auditUser,
|
|
su2.name AS auditUser,
|
|
|
- ifa.audittime as auditTime
|
|
|
|
|
|
|
+ ifa.audittime as auditTime,
|
|
|
|
|
+ ifa.auditstatus as auditStatus
|
|
|
FROM
|
|
FROM
|
|
|
ins_orders io
|
|
ins_orders io
|
|
|
LEFT JOIN ins_fee_audit ifa ON ifa.orderno = io.orderno
|
|
LEFT JOIN ins_fee_audit ifa ON ifa.orderno = io.orderno
|
|
|
LEFT JOIN sys_user su ON su.id = io.userid
|
|
LEFT JOIN sys_user su ON su.id = io.userid
|
|
|
LEFT JOIN sys_dept sd ON sd.id = su.dept_id
|
|
LEFT JOIN sys_dept sd ON sd.id = su.dept_id
|
|
|
- LEFT JOIN sys_user su2 on ifa.audituser = su2.id
|
|
|
|
|
- WHERE
|
|
|
|
|
- io.orderno IN (
|
|
|
|
|
- SELECT
|
|
|
|
|
- orderno
|
|
|
|
|
- FROM
|
|
|
|
|
- ins_area_company
|
|
|
|
|
- WHERE
|
|
|
|
|
- id IN (
|
|
|
|
|
- SELECT
|
|
|
|
|
- ifon.ins_order_no
|
|
|
|
|
- FROM
|
|
|
|
|
- ins_fee_order_new ifon
|
|
|
|
|
- RIGHT JOIN ins_fee_audit ifa ON ifon.ins_order_no = ifa.ins_order_no
|
|
|
|
|
|
|
+ LEFT JOIN sys_user su2 ON ifa.audituser = su2.id
|
|
|
|
|
+ LEFT JOIN ins_area_company iac ON iac.orderno = io.orderno and iac.orderstatus = 3
|
|
|
WHERE
|
|
WHERE
|
|
|
- ifa.auditstatus = #{params.auditStatus}
|
|
|
|
|
- )
|
|
|
|
|
- )
|
|
|
|
|
- AND orderstatus = 3
|
|
|
|
|
-<!-- <if test="params.orderNo != null and params.orderNo != ''">-->
|
|
|
|
|
-<!-- AND orderno = #{params.orderNo}-->
|
|
|
|
|
-<!-- </if>-->
|
|
|
|
|
|
|
+ io.orderno IN ( SELECT orderno FROM ins_area_company WHERE id IN (
|
|
|
|
|
+ SELECT ins_order_no FROM ins_fee_order_new
|
|
|
|
|
+ WHERE ins_order_no
|
|
|
|
|
+ <if test="params.auditStatus != null and params.auditStatus == 0">
|
|
|
|
|
+ NOT
|
|
|
|
|
+ </if>
|
|
|
|
|
+ IN ( SELECT ins_order_no FROM ins_fee_audit) ) AND orderstatus = 3 )
|
|
|
|
|
+ AND io.orderstatus = 3
|
|
|
|
|
+ <if test="params.orderNo != null and params.orderNo != ''">
|
|
|
|
|
+ AND io.orderno = #{params.orderNo}
|
|
|
|
|
+ </if>
|
|
|
<if test="params.licenseNo != null and params.licenseNo != ''">
|
|
<if test="params.licenseNo != null and params.licenseNo != ''">
|
|
|
AND licenseno = #{params.licenseNo}
|
|
AND licenseno = #{params.licenseNo}
|
|
|
</if>
|
|
</if>
|
|
@@ -177,6 +168,18 @@
|
|
|
<if test="params.companyId != null and params.companyId != ''">
|
|
<if test="params.companyId != null and params.companyId != ''">
|
|
|
AND company_id = #{params.companyId}
|
|
AND company_id = #{params.companyId}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
+ <if test="params.engineNo != null and params.engineNo != ''">
|
|
|
|
|
+ AND engineno = #{params.engineNo}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="params.productId != null and params.productId != ''">
|
|
|
|
|
+ AND product_id = #{params.productId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="params.quoteStartDateStr != null and params.quoteStartDateStr != ''">
|
|
|
|
|
+ AND iac.createtime BETWEEN #{params.quoteStartDateStr} and #{params.quoteEndDateStr}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="params.attachStartDateStr != null and params.attachStartDateStr != ''">
|
|
|
|
|
+ AND iac.signing_time BETWEEN #{params.attachStartDateStr} and #{params.attachEndDateStr}
|
|
|
|
|
+ </if>
|
|
|
<if test="params.startDateStr != null and params.startDateStr != ''">
|
|
<if test="params.startDateStr != null and params.startDateStr != ''">
|
|
|
AND createtime BETWEEN #{params.startDateStr} and #{params.endDateStr}
|
|
AND createtime BETWEEN #{params.startDateStr} and #{params.endDateStr}
|
|
|
</if>
|
|
</if>
|
|
@@ -199,7 +202,7 @@
|
|
|
AND orderstatus = 3
|
|
AND orderstatus = 3
|
|
|
)
|
|
)
|
|
|
AND
|
|
AND
|
|
|
- orderstatus= 3
|
|
|
|
|
|
|
+ io.orderstatus= 3
|
|
|
<if test="orderNo != null and orderNo != ''">
|
|
<if test="orderNo != null and orderNo != ''">
|
|
|
AND orderno = #{orderNo}
|
|
AND orderno = #{orderNo}
|
|
|
</if>
|
|
</if>
|
|
@@ -225,10 +228,10 @@
|
|
|
|
|
|
|
|
<select id="selectFirstPromotionBy" resultType="com.ydtech.modules.order.entity.InsOrders">
|
|
<select id="selectFirstPromotionBy" resultType="com.ydtech.modules.order.entity.InsOrders">
|
|
|
SELECT
|
|
SELECT
|
|
|
- sum(a.first_detail_premiums) as "willFirstPremiums"
|
|
|
|
|
|
|
+ sum(a.first_detail_premiums) as "willFirstPremiums"
|
|
|
FROM
|
|
FROM
|
|
|
- ins_fee_order_new a
|
|
|
|
|
- LEFT JOIN ins_area_company iac on iac.id=a.ins_order_no
|
|
|
|
|
|
|
+ ins_fee_order_new a
|
|
|
|
|
+ LEFT JOIN ins_area_company iac on iac.id=a.ins_order_no
|
|
|
WHERE
|
|
WHERE
|
|
|
a.id NOT IN (
|
|
a.id NOT IN (
|
|
|
SELECT
|
|
SELECT
|
|
@@ -236,28 +239,28 @@
|
|
|
FROM
|
|
FROM
|
|
|
ins_fee_audit
|
|
ins_fee_audit
|
|
|
)
|
|
)
|
|
|
- AND iac.orderstatus =3
|
|
|
|
|
|
|
+ AND iac.orderstatus =3
|
|
|
<if test="firstUserId != null and firstUserId != ''">
|
|
<if test="firstUserId != null and firstUserId != ''">
|
|
|
- AND a.first_level_user_id = #{firstUserId}
|
|
|
|
|
|
|
+ AND a.first_level_user_id = #{firstUserId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="secondUserId != null and secondUserId != ''">
|
|
<if test="secondUserId != null and secondUserId != ''">
|
|
|
- AND a.two_level_user_id = #{secondUserId}
|
|
|
|
|
|
|
+ AND a.two_level_user_id = #{secondUserId}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
|
|
|
<if test="thirdUserId != null and thirdUserId != ''">
|
|
<if test="thirdUserId != null and thirdUserId != ''">
|
|
|
- AND a.three_level_user_id = #{thirdUserId}
|
|
|
|
|
|
|
+ AND a.three_level_user_id = #{thirdUserId}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
|
|
|
- <if test="id != null and id != ''">
|
|
|
|
|
- AND a.id = #{id}
|
|
|
|
|
|
|
+ <if test="id != null and id != ''">
|
|
|
|
|
+ AND a.id = #{id}
|
|
|
</if>
|
|
</if>
|
|
|
</select>
|
|
</select>
|
|
|
<select id="selectSecondPromotionBy" resultType="com.ydtech.modules.order.entity.InsOrders">
|
|
<select id="selectSecondPromotionBy" resultType="com.ydtech.modules.order.entity.InsOrders">
|
|
|
SELECT
|
|
SELECT
|
|
|
- sum(a.second_detail_premiums) as "willSecondPremiums"
|
|
|
|
|
|
|
+ sum(a.second_detail_premiums) as "willSecondPremiums"
|
|
|
FROM
|
|
FROM
|
|
|
- ins_fee_order_new a
|
|
|
|
|
- LEFT JOIN ins_area_company iac on iac.id=a.ins_order_no
|
|
|
|
|
|
|
+ ins_fee_order_new a
|
|
|
|
|
+ LEFT JOIN ins_area_company iac on iac.id=a.ins_order_no
|
|
|
WHERE
|
|
WHERE
|
|
|
a.id NOT IN (
|
|
a.id NOT IN (
|
|
|
SELECT
|
|
SELECT
|
|
@@ -265,29 +268,29 @@
|
|
|
FROM
|
|
FROM
|
|
|
ins_fee_audit
|
|
ins_fee_audit
|
|
|
)
|
|
)
|
|
|
- AND iac.orderstatus =3
|
|
|
|
|
|
|
+ AND iac.orderstatus =3
|
|
|
<if test="firstUserId != null and firstUserId != ''">
|
|
<if test="firstUserId != null and firstUserId != ''">
|
|
|
- AND a.first_level_user_id = #{firstUserId}
|
|
|
|
|
|
|
+ AND a.first_level_user_id = #{firstUserId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="secondUserId != null and secondUserId != ''">
|
|
<if test="secondUserId != null and secondUserId != ''">
|
|
|
- AND a.two_level_user_id = #{secondUserId}
|
|
|
|
|
|
|
+ AND a.two_level_user_id = #{secondUserId}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
|
|
|
<if test="thirdUserId != null and thirdUserId != ''">
|
|
<if test="thirdUserId != null and thirdUserId != ''">
|
|
|
- AND a.three_level_user_id = #{thirdUserId}
|
|
|
|
|
|
|
+ AND a.three_level_user_id = #{thirdUserId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="id != null and id != ''">
|
|
<if test="id != null and id != ''">
|
|
|
- AND a.id = #{id}
|
|
|
|
|
|
|
+ AND a.id = #{id}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
|
|
|
</select>
|
|
</select>
|
|
|
<select id="selectThirdPromotionBy" resultType="com.ydtech.modules.order.entity.InsOrders">
|
|
<select id="selectThirdPromotionBy" resultType="com.ydtech.modules.order.entity.InsOrders">
|
|
|
SELECT
|
|
SELECT
|
|
|
- sum(a.third_detail_premiums) as "willThreePremiums"
|
|
|
|
|
|
|
+ sum(a.third_detail_premiums) as "willThreePremiums"
|
|
|
|
|
|
|
|
FROM
|
|
FROM
|
|
|
- ins_fee_order_new a
|
|
|
|
|
- LEFT JOIN ins_area_company iac on iac.id=a.ins_order_no
|
|
|
|
|
|
|
+ ins_fee_order_new a
|
|
|
|
|
+ LEFT JOIN ins_area_company iac on iac.id=a.ins_order_no
|
|
|
WHERE
|
|
WHERE
|
|
|
a.id NOT IN (
|
|
a.id NOT IN (
|
|
|
SELECT
|
|
SELECT
|
|
@@ -295,19 +298,19 @@
|
|
|
FROM
|
|
FROM
|
|
|
ins_fee_audit
|
|
ins_fee_audit
|
|
|
)
|
|
)
|
|
|
- AND iac.orderstatus =3
|
|
|
|
|
|
|
+ AND iac.orderstatus =3
|
|
|
<if test="firstUserId != null and firstUserId != ''">
|
|
<if test="firstUserId != null and firstUserId != ''">
|
|
|
- AND a.first_level_user_id = #{firstUserId}
|
|
|
|
|
|
|
+ AND a.first_level_user_id = #{firstUserId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="secondUserId != null and secondUserId != ''">
|
|
<if test="secondUserId != null and secondUserId != ''">
|
|
|
- AND a.two_level_user_id = #{secondUserId}
|
|
|
|
|
|
|
+ AND a.two_level_user_id = #{secondUserId}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
|
|
|
<if test="thirdUserId != null and thirdUserId != ''">
|
|
<if test="thirdUserId != null and thirdUserId != ''">
|
|
|
- AND a.three_level_user_id = #{thirdUserId}
|
|
|
|
|
|
|
+ AND a.three_level_user_id = #{thirdUserId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="id != null and id != ''">
|
|
<if test="id != null and id != ''">
|
|
|
- AND a.id = #{id}
|
|
|
|
|
|
|
+ AND a.id = #{id}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
|
|
|
</select>
|
|
</select>
|
|
@@ -343,9 +346,9 @@
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
|
AND orderstatus = 3
|
|
AND orderstatus = 3
|
|
|
-<!-- <if test="params.orderNo != null and params.orderNo != ''">-->
|
|
|
|
|
-<!-- AND orderno = #{params.orderNo}-->
|
|
|
|
|
-<!-- </if>-->
|
|
|
|
|
|
|
+ <!-- <if test="params.orderNo != null and params.orderNo != ''">-->
|
|
|
|
|
+ <!-- AND orderno = #{params.orderNo}-->
|
|
|
|
|
+ <!-- </if>-->
|
|
|
<if test="params.licenseNo != null and params.licenseNo != ''">
|
|
<if test="params.licenseNo != null and params.licenseNo != ''">
|
|
|
AND licenseno = #{params.licenseNo}
|
|
AND licenseno = #{params.licenseNo}
|
|
|
</if>
|
|
</if>
|