|
|
@@ -103,12 +103,12 @@
|
|
|
SELECT iac.*, pa.agreement_name
|
|
|
FROM ins_area_company as iac
|
|
|
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 id="queryLatestStatus" resultType="java.lang.String">
|
|
|
+ <select id="queryLatestStatus" resultType="java.lang.String">
|
|
|
SELECT iac.orderstatus
|
|
|
FROM ins_area_company as iac
|
|
|
INNER JOIN (SELECT company_id, max(createtime) AS max_createtime
|
|
|
@@ -120,54 +120,97 @@
|
|
|
ORDER BY orderstatus DESC
|
|
|
LIMIT 1
|
|
|
</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 id="getPendingAuditOrders" resultType="com.ydtech.modules.order.entity.InsOrders">
|
|
|
+ <select id="getAuditOrders" resultType="com.ydtech.modules.order.entity.InsOrders">
|
|
|
SELECT
|
|
|
io.*,
|
|
|
- sd.management_source
|
|
|
- FROM
|
|
|
- ins_orders io left join sys_user su on su.id = io.userid left join sys_dept sd on sd.id = su.dept_id
|
|
|
- WHERE
|
|
|
- orderno IN (
|
|
|
- SELECT
|
|
|
- orderno
|
|
|
+ sd.management_source,
|
|
|
+ su2.name AS auditUser,
|
|
|
+ ifa.audittime as auditTime,
|
|
|
+ ifa.auditstatus as auditStatus
|
|
|
FROM
|
|
|
- ins_area_company
|
|
|
+ ins_orders io
|
|
|
+ LEFT JOIN ins_fee_audit ifa ON ifa.orderno = io.orderno
|
|
|
+ LEFT JOIN sys_user su ON su.id = io.userid
|
|
|
+ LEFT JOIN sys_dept sd ON sd.id = su.dept_id
|
|
|
+ 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
|
|
|
- id IN ( SELECT ins_order_no FROM ins_fee_order_new WHERE ins_order_no NOT IN ( SELECT ins_order_no FROM ins_fee_audit ) )
|
|
|
- AND orderstatus = 3
|
|
|
- )
|
|
|
- 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.taskNo != null and params.taskNo != ''">
|
|
|
+ AND io.orderno = #{params.taskNo}
|
|
|
+ </if>
|
|
|
+ <if test="params.orderNo != null and params.orderNo != ''">
|
|
|
+ AND iac.id = #{params.orderNo}
|
|
|
+ </if>
|
|
|
<if test="params.licenseNo != null and params.licenseNo != ''">
|
|
|
- AND licenseno = #{params.licenseNo}
|
|
|
+ AND io.licenseno = #{params.licenseNo}
|
|
|
</if>
|
|
|
<if test="params.frameNo != null and params.frameNo != ''">
|
|
|
- AND frameno = #{params.frameNo}
|
|
|
+ AND io.frameno = #{params.frameNo}
|
|
|
</if>
|
|
|
<if test="params.insuredName != null and params.insuredName != ''">
|
|
|
- AND insuredname = #{params.insuredName}
|
|
|
+ AND io.insuredname = #{params.insuredName}
|
|
|
</if>
|
|
|
<if test="params.companyId != null and params.companyId != ''">
|
|
|
- AND company_id = #{params.companyId}
|
|
|
+ AND io.company_id = #{params.companyId}
|
|
|
+ </if>
|
|
|
+ <if test="params.engineNo != null and params.engineNo != ''">
|
|
|
+ and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{params.engineNo}
|
|
|
+ </if>
|
|
|
+ <if test="params.riskCode != null and params.riskCode != ''">
|
|
|
+ and io.product = #{params.riskCode}
|
|
|
+ </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 != ''">
|
|
|
AND createtime BETWEEN #{params.startDateStr} and #{params.endDateStr}
|
|
|
</if>
|
|
|
+ <if test="params.provinceId != null and params.provinceId != ''">
|
|
|
+ and io.deptid like "${params.provinceId}%"
|
|
|
+ </if>
|
|
|
+ <if test="params.cityId != null and params.cityId != ''">
|
|
|
+ and io.deptid like "${params.cityId}%"
|
|
|
+ </if>
|
|
|
+ <if test="params.countyId != null and params.countyId != ''">
|
|
|
+ and io.deptid like "${params.countyId}%"
|
|
|
+ </if>
|
|
|
+ <if test="params.houseId != null and params.houseId != ''">
|
|
|
+ and io.deptid like "${params.houseId}%"
|
|
|
+ </if>
|
|
|
+ <if test="params.operatorId != null and params.operatorId != ''">
|
|
|
+ and iac.operator_id = #{params.operatorId}
|
|
|
+ </if>
|
|
|
+ <if test="params.operatorName != null and params.operatorName != ''">
|
|
|
+ and iac.operator_name = #{params.operatorName}
|
|
|
+ </if>
|
|
|
+ <if test="params.auditId != null and params.auditId != ''">
|
|
|
+ and iac.new_operator_id = #{params.auditId}
|
|
|
+ </if>
|
|
|
+ <if test="params.agreeId != null and params.agreeId != ''">
|
|
|
+ and iac.agreement_id = #{params.agreeId}
|
|
|
+ </if>
|
|
|
+
|
|
|
</select>
|
|
|
|
|
|
<select id="getByUserId" resultType="com.ydtech.modules.order.entity.InsOrders">
|
|
|
@@ -187,7 +230,7 @@
|
|
|
AND orderstatus = 3
|
|
|
)
|
|
|
AND
|
|
|
- orderstatus= 3
|
|
|
+ io.orderstatus= 3
|
|
|
<if test="orderNo != null and orderNo != ''">
|
|
|
AND orderno = #{orderNo}
|
|
|
</if>
|
|
|
@@ -213,10 +256,10 @@
|
|
|
|
|
|
<select id="selectFirstPromotionBy" resultType="com.ydtech.modules.order.entity.InsOrders">
|
|
|
SELECT
|
|
|
- sum(a.first_detail_premiums) as "willFirstPremiums"
|
|
|
+ sum(a.first_detail_premiums) as "willFirstPremiums"
|
|
|
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
|
|
|
a.id NOT IN (
|
|
|
SELECT
|
|
|
@@ -224,28 +267,28 @@
|
|
|
FROM
|
|
|
ins_fee_audit
|
|
|
)
|
|
|
- AND iac.orderstatus =3
|
|
|
+ AND iac.orderstatus =3
|
|
|
<if test="firstUserId != null and firstUserId != ''">
|
|
|
- AND a.first_level_user_id = #{firstUserId}
|
|
|
+ AND a.first_level_user_id = #{firstUserId}
|
|
|
</if>
|
|
|
<if test="secondUserId != null and secondUserId != ''">
|
|
|
- AND a.two_level_user_id = #{secondUserId}
|
|
|
+ AND a.two_level_user_id = #{secondUserId}
|
|
|
</if>
|
|
|
|
|
|
<if test="thirdUserId != null and thirdUserId != ''">
|
|
|
- AND a.three_level_user_id = #{thirdUserId}
|
|
|
+ AND a.three_level_user_id = #{thirdUserId}
|
|
|
</if>
|
|
|
|
|
|
- <if test="id != null and id != ''">
|
|
|
- AND a.id = #{id}
|
|
|
+ <if test="id != null and id != ''">
|
|
|
+ AND a.id = #{id}
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="selectSecondPromotionBy" resultType="com.ydtech.modules.order.entity.InsOrders">
|
|
|
SELECT
|
|
|
- sum(a.second_detail_premiums) as "willSecondPremiums"
|
|
|
+ sum(a.second_detail_premiums) as "willSecondPremiums"
|
|
|
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
|
|
|
a.id NOT IN (
|
|
|
SELECT
|
|
|
@@ -253,29 +296,29 @@
|
|
|
FROM
|
|
|
ins_fee_audit
|
|
|
)
|
|
|
- AND iac.orderstatus =3
|
|
|
+ AND iac.orderstatus =3
|
|
|
<if test="firstUserId != null and firstUserId != ''">
|
|
|
- AND a.first_level_user_id = #{firstUserId}
|
|
|
+ AND a.first_level_user_id = #{firstUserId}
|
|
|
</if>
|
|
|
<if test="secondUserId != null and secondUserId != ''">
|
|
|
- AND a.two_level_user_id = #{secondUserId}
|
|
|
+ AND a.two_level_user_id = #{secondUserId}
|
|
|
</if>
|
|
|
|
|
|
<if test="thirdUserId != null and thirdUserId != ''">
|
|
|
- AND a.three_level_user_id = #{thirdUserId}
|
|
|
+ AND a.three_level_user_id = #{thirdUserId}
|
|
|
</if>
|
|
|
<if test="id != null and id != ''">
|
|
|
- AND a.id = #{id}
|
|
|
+ AND a.id = #{id}
|
|
|
</if>
|
|
|
|
|
|
</select>
|
|
|
<select id="selectThirdPromotionBy" resultType="com.ydtech.modules.order.entity.InsOrders">
|
|
|
SELECT
|
|
|
- sum(a.third_detail_premiums) as "willThreePremiums"
|
|
|
+ sum(a.third_detail_premiums) as "willThreePremiums"
|
|
|
|
|
|
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
|
|
|
a.id NOT IN (
|
|
|
SELECT
|
|
|
@@ -283,19 +326,19 @@
|
|
|
FROM
|
|
|
ins_fee_audit
|
|
|
)
|
|
|
- AND iac.orderstatus =3
|
|
|
+ AND iac.orderstatus =3
|
|
|
<if test="firstUserId != null and firstUserId != ''">
|
|
|
- AND a.first_level_user_id = #{firstUserId}
|
|
|
+ AND a.first_level_user_id = #{firstUserId}
|
|
|
</if>
|
|
|
<if test="secondUserId != null and secondUserId != ''">
|
|
|
- AND a.two_level_user_id = #{secondUserId}
|
|
|
+ AND a.two_level_user_id = #{secondUserId}
|
|
|
</if>
|
|
|
|
|
|
<if test="thirdUserId != null and thirdUserId != ''">
|
|
|
- AND a.three_level_user_id = #{thirdUserId}
|
|
|
+ AND a.three_level_user_id = #{thirdUserId}
|
|
|
</if>
|
|
|
<if test="id != null and id != ''">
|
|
|
- AND a.id = #{id}
|
|
|
+ AND a.id = #{id}
|
|
|
</if>
|
|
|
|
|
|
</select>
|
|
|
@@ -304,22 +347,36 @@
|
|
|
<select id="getAlreadyAuditOrders" resultType="com.ydtech.modules.order.entity.InsOrders">
|
|
|
SELECT
|
|
|
io.*,
|
|
|
- sd.management_source
|
|
|
+ sd.management_source,
|
|
|
+ su2.name AS auditUser,
|
|
|
+ ifa.audittime as auditTime
|
|
|
FROM
|
|
|
- ins_orders io left join sys_user su on su.id = io.userid left join sys_dept sd on sd.id = su.dept_id
|
|
|
+ ins_orders io
|
|
|
+ LEFT JOIN ins_fee_audit ifa ON ifa.orderno = io.orderno
|
|
|
+ LEFT JOIN sys_user su ON su.id = io.userid
|
|
|
+ LEFT JOIN sys_dept sd ON sd.id = su.dept_id
|
|
|
+ LEFT JOIN sys_user su2 on ifa.audituser = su2.id
|
|
|
WHERE
|
|
|
- orderno IN (
|
|
|
+ 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 where ifa.auditstatus = #{params.auditStatus} ))
|
|
|
- AND
|
|
|
- orderstatus = 3
|
|
|
-<!-- <if test="params.orderNo != null and params.orderNo != ''">-->
|
|
|
-<!-- AND orderno = #{params.orderNo}-->
|
|
|
-<!-- </if>-->
|
|
|
+ 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
|
|
|
+ WHERE
|
|
|
+ ifa.auditstatus = #{params.auditStatus}
|
|
|
+ )
|
|
|
+ )
|
|
|
+ AND orderstatus = 3
|
|
|
+ <!-- <if test="params.orderNo != null and params.orderNo != ''">-->
|
|
|
+ <!-- AND orderno = #{params.orderNo}-->
|
|
|
+ <!-- </if>-->
|
|
|
<if test="params.licenseNo != null and params.licenseNo != ''">
|
|
|
AND licenseno = #{params.licenseNo}
|
|
|
</if>
|