|
@@ -7,6 +7,7 @@
|
|
|
<resultMap id="BaseResultMap" type="com.ydtech.modules.inv.model.vo.ReceivableResultVo">
|
|
<resultMap id="BaseResultMap" type="com.ydtech.modules.inv.model.vo.ReceivableResultVo">
|
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
+
|
|
|
<select id="getReceivableList" resultType="com.ydtech.modules.inv.model.vo.ReceivableResultVo">
|
|
<select id="getReceivableList" resultType="com.ydtech.modules.inv.model.vo.ReceivableResultVo">
|
|
|
SELECT
|
|
SELECT
|
|
|
DATE_FORMAT( signing_time, '%d' ) AS DAY,
|
|
DATE_FORMAT( signing_time, '%d' ) AS DAY,
|
|
@@ -178,114 +179,164 @@
|
|
|
|
|
|
|
|
<select id="getReceivableAndSettlementPage" resultType="com.ydtech.modules.inv.model.vo.ReceivableAndSettlementVo">
|
|
<select id="getReceivableAndSettlementPage" resultType="com.ydtech.modules.inv.model.vo.ReceivableAndSettlementVo">
|
|
|
SELECT
|
|
SELECT
|
|
|
- iss.operations_team,
|
|
|
|
|
- iss.channel_classification,
|
|
|
|
|
- ivs.signing_time as sign_date,
|
|
|
|
|
- iss.channel,
|
|
|
|
|
- ivs.licenseno,
|
|
|
|
|
- ivs.insured_name,
|
|
|
|
|
- ivs.insurance_id,
|
|
|
|
|
- ivs.insurance_name as insurance_company,
|
|
|
|
|
- ivs.insurance_dept_id,
|
|
|
|
|
- ivs.insurance_dept,
|
|
|
|
|
- ivs.risk as insurance_type,
|
|
|
|
|
- iss.business_owner,
|
|
|
|
|
- ivs.jq_policy_id,
|
|
|
|
|
- ivs.jq_premium_tax,
|
|
|
|
|
- ivs.jq_premium,
|
|
|
|
|
- ivs.sy_policy_id,
|
|
|
|
|
- ivs.sy_premium_tax,
|
|
|
|
|
- ivs.sy_premium,
|
|
|
|
|
- ivs.non_car_policy_id,
|
|
|
|
|
- ivs.non_car_premium_tax,
|
|
|
|
|
- ivs.non_car_premium,
|
|
|
|
|
- iss.agency_settlement_time,
|
|
|
|
|
- ivs.taxamount,
|
|
|
|
|
- ivs.jq_receivable_ratio,
|
|
|
|
|
- ivs.jq_premium_ratio,
|
|
|
|
|
- ivs.jq_non_copying_ratio,
|
|
|
|
|
- ivs.sy_receivable_ratio,
|
|
|
|
|
- ivs.sy_premium_ratio,
|
|
|
|
|
- ivs.sy_non_copying_ratio,
|
|
|
|
|
- ivs.non_car_receivable_ratio,
|
|
|
|
|
- ivs.non_car_premium_ratio,
|
|
|
|
|
- ivs.non_car_non_copying_ratio,
|
|
|
|
|
- ivs.premium,
|
|
|
|
|
- ivs.non_copying,
|
|
|
|
|
- ivs.receivable,
|
|
|
|
|
- ivs.subsidy_ratio,
|
|
|
|
|
- ivs.subsidy_amount,
|
|
|
|
|
- ivs.max_jq_receivable_ratio,
|
|
|
|
|
- ivs.max_sy_receivable_ratio,
|
|
|
|
|
- ivs.max_non_car_receivable_ratio,
|
|
|
|
|
- ivs.max_receivable,
|
|
|
|
|
- ivs.total_receivable_amount,
|
|
|
|
|
- iss.settlement_amount,
|
|
|
|
|
- (CASE ivs.clearing_state
|
|
|
|
|
- WHEN 1 THEN '已结算'
|
|
|
|
|
- WHEN 0 THEN '未结算'
|
|
|
|
|
- WHEN 3 THEN '孤儿单'
|
|
|
|
|
- END) as clearing_state,
|
|
|
|
|
- (CASE ivs.insurance_clearing_state
|
|
|
|
|
- WHEN 1 THEN '已结算'
|
|
|
|
|
- WHEN 0 THEN '未结算'
|
|
|
|
|
- WHEN 3 THEN '孤儿单'
|
|
|
|
|
- END) as insurance_clearing_state
|
|
|
|
|
|
|
+ a.operations_team,
|
|
|
|
|
+ a.channel_classification,
|
|
|
|
|
+ a.sign_date,
|
|
|
|
|
+ a.channel,
|
|
|
|
|
+ a.licenseno,
|
|
|
|
|
+ a.insured_name,
|
|
|
|
|
+ a.insurance_id,
|
|
|
|
|
+ a.insurance_company,
|
|
|
|
|
+ a.insurance_dept_id,
|
|
|
|
|
+ a.insurance_dept,
|
|
|
|
|
+ a.insurance_type,
|
|
|
|
|
+ a.business_owner,
|
|
|
|
|
+ a.jq_policy_id,
|
|
|
|
|
+ a.jq_premium_tax,
|
|
|
|
|
+ a.jq_premium,
|
|
|
|
|
+ a.sy_policy_id,
|
|
|
|
|
+ a.sy_premium_tax,
|
|
|
|
|
+ a.sy_premium,
|
|
|
|
|
+ a.non_car_policy_id,
|
|
|
|
|
+ a.non_car_premium_tax,
|
|
|
|
|
+ a.non_car_premium,
|
|
|
|
|
+ a.agency_settlement_time,
|
|
|
|
|
+ a.taxamount,
|
|
|
|
|
+ a.jq_receivable_ratio,
|
|
|
|
|
+ a.jq_premium_ratio,
|
|
|
|
|
+ a.jq_non_copying_ratio,
|
|
|
|
|
+ a.sy_receivable_ratio,
|
|
|
|
|
+ a.sy_premium_ratio,
|
|
|
|
|
+ a.sy_non_copying_ratio,
|
|
|
|
|
+ a.non_car_receivable_ratio,
|
|
|
|
|
+ a.non_car_premium_ratio,
|
|
|
|
|
+ a.non_car_non_copying_ratio,
|
|
|
|
|
+ a.premium,
|
|
|
|
|
+ a.non_copying,
|
|
|
|
|
+ a.receivable,
|
|
|
|
|
+ a.subsidy_ratio,
|
|
|
|
|
+ a.subsidy_amount,
|
|
|
|
|
+ a.max_jq_receivable_ratio,
|
|
|
|
|
+ a.max_sy_receivable_ratio,
|
|
|
|
|
+ a.max_non_car_receivable_ratio,
|
|
|
|
|
+ a.max_receivable,
|
|
|
|
|
+ a.total_receivable_amount,
|
|
|
|
|
+ a.settlement_amount,
|
|
|
|
|
+ ( CASE a.clearing_state WHEN 1 THEN '已结算' WHEN 0 THEN '未结算' WHEN 2 THEN '孤儿单' END ) AS clearing_state,
|
|
|
|
|
+ ( CASE a.insurance_clearing_state WHEN 1 THEN '已结算' WHEN 0 THEN '未结算' END ) AS insurance_clearing_state
|
|
|
|
|
+ FROM
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ *
|
|
|
|
|
+ FROM
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ iss.operations_team,
|
|
|
|
|
+ iss.channel_classification,
|
|
|
|
|
+ ivs.signing_time AS sign_date,
|
|
|
|
|
+ iss.channel,
|
|
|
|
|
+ ivs.licenseno,
|
|
|
|
|
+ ivs.insured_name,
|
|
|
|
|
+ ivs.insurance_id,
|
|
|
|
|
+ ivs.insurance_name AS insurance_company,
|
|
|
|
|
+ ivs.insurance_dept_id,
|
|
|
|
|
+ ivs.insurance_dept,
|
|
|
|
|
+ ivs.risk AS insurance_type,
|
|
|
|
|
+ iss.business_owner,
|
|
|
|
|
+ ivs.jq_policy_id,
|
|
|
|
|
+ ivs.jq_premium_tax,
|
|
|
|
|
+ ivs.jq_premium,
|
|
|
|
|
+ ivs.sy_policy_id,
|
|
|
|
|
+ ivs.sy_premium_tax,
|
|
|
|
|
+ ivs.sy_premium,
|
|
|
|
|
+ ivs.non_car_policy_id,
|
|
|
|
|
+ ivs.non_car_premium_tax,
|
|
|
|
|
+ ivs.non_car_premium,
|
|
|
|
|
+ iss.agency_settlement_time,
|
|
|
|
|
+ ivs.taxamount,
|
|
|
|
|
+ ivs.jq_receivable_ratio,
|
|
|
|
|
+ ivs.jq_premium_ratio,
|
|
|
|
|
+ ivs.jq_non_copying_ratio,
|
|
|
|
|
+ ivs.sy_receivable_ratio,
|
|
|
|
|
+ ivs.sy_premium_ratio,
|
|
|
|
|
+ ivs.sy_non_copying_ratio,
|
|
|
|
|
+ ivs.non_car_receivable_ratio,
|
|
|
|
|
+ ivs.non_car_premium_ratio,
|
|
|
|
|
+ ivs.non_car_non_copying_ratio,
|
|
|
|
|
+ ivs.premium,
|
|
|
|
|
+ ivs.non_copying,
|
|
|
|
|
+ ivs.receivable,
|
|
|
|
|
+ ivs.subsidy_ratio,
|
|
|
|
|
+ ivs.subsidy_amount,
|
|
|
|
|
+ ivs.max_jq_receivable_ratio,
|
|
|
|
|
+ ivs.max_sy_receivable_ratio,
|
|
|
|
|
+ ivs.max_non_car_receivable_ratio,
|
|
|
|
|
+ ivs.max_receivable,
|
|
|
|
|
+ ivs.total_receivable_amount,
|
|
|
|
|
+ iss.settlement_amount,
|
|
|
|
|
+ CASE
|
|
|
|
|
+
|
|
|
|
|
+ WHEN DATEDIFF( NOW(), signing_time ) > 90 THEN
|
|
|
|
|
+ 2 ELSE ivs.clearing_state
|
|
|
|
|
+ END AS clearing_state,
|
|
|
|
|
+ insurance_clearing_state
|
|
|
FROM
|
|
FROM
|
|
|
inv_source ivs
|
|
inv_source ivs
|
|
|
LEFT JOIN inv_settlement_source iss ON ivs.licenseno = iss.licenseno
|
|
LEFT JOIN inv_settlement_source iss ON ivs.licenseno = iss.licenseno
|
|
|
AND ivs.jq_policy_id = iss.jq_policy_id
|
|
AND ivs.jq_policy_id = iss.jq_policy_id
|
|
|
AND ivs.sy_policy_id = iss.sy_policy_id
|
|
AND ivs.sy_policy_id = iss.sy_policy_id
|
|
|
AND ivs.non_car_policy_id = iss.non_car_policy_id
|
|
AND ivs.non_car_policy_id = iss.non_car_policy_id
|
|
|
|
|
+ ) a
|
|
|
|
|
+ ) a
|
|
|
WHERE
|
|
WHERE
|
|
|
- 1=1
|
|
|
|
|
|
|
+ 1 =1
|
|
|
<if test="param.signDateStartTime != null and param.signDateStartTime != ''">
|
|
<if test="param.signDateStartTime != null and param.signDateStartTime != ''">
|
|
|
- and iss.sign_date between #{param.signDateStartTime} and #{param.signDateEndTime}
|
|
|
|
|
|
|
+ and a.sign_date between #{param.signDateStartTime} and #{param.signDateEndTime}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="param.agencySettlementTimeStartTime != null and param.agencySettlementTimeStartTime != ''">
|
|
<if test="param.agencySettlementTimeStartTime != null and param.agencySettlementTimeStartTime != ''">
|
|
|
- and iss.agency_settlement_time between #{param.agencySettlementTimeStartTime} and #{param.agencySettlementTimeEndTime}
|
|
|
|
|
|
|
+ and a.agency_settlement_time between #{param.agencySettlementTimeStartTime} and #{param.agencySettlementTimeEndTime}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="param.operationsTeam != null and param.operationsTeam != ''">
|
|
<if test="param.operationsTeam != null and param.operationsTeam != ''">
|
|
|
- and iss.operations_team = #{param.operationsTeam}
|
|
|
|
|
|
|
+ and a.operations_team = #{param.operationsTeam}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="param.channelClassification != null and param.channelClassification != ''">
|
|
<if test="param.channelClassification != null and param.channelClassification != ''">
|
|
|
- and iss.channel_classification = #{param.channelClassification}
|
|
|
|
|
|
|
+ and a.channel_classification = #{param.channelClassification}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="param.channel != null and param.channel != ''">
|
|
<if test="param.channel != null and param.channel != ''">
|
|
|
- and iss.channel = #{param.channel}
|
|
|
|
|
|
|
+ and a.channel = #{param.channel}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="param.licenseNo != null and param.licenseNo != ''">
|
|
<if test="param.licenseNo != null and param.licenseNo != ''">
|
|
|
- and ivs.licenseno = #{param.licenseNo}
|
|
|
|
|
|
|
+ and a.licenseno = #{param.licenseNo}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="param.insuredName != null and param.insuredName != ''">
|
|
<if test="param.insuredName != null and param.insuredName != ''">
|
|
|
- and ivs.insured_name = #{param.insuredName}
|
|
|
|
|
|
|
+ and a.insured_name = #{param.insuredName}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="param.insuranceId != null and param.insuranceId != ''">
|
|
<if test="param.insuranceId != null and param.insuranceId != ''">
|
|
|
- and ivs.insurance_id = #{param.insuranceId}
|
|
|
|
|
|
|
+ and a.insurance_id = #{param.insuranceId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="param.insuranceDeptId != null and param.insuranceDeptId != ''">
|
|
<if test="param.insuranceDeptId != null and param.insuranceDeptId != ''">
|
|
|
- and ivs.insurance_dept_id = #{param.insuranceDeptId}
|
|
|
|
|
|
|
+ and a.insurance_dept_id = #{param.insuranceDeptId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="param.clearingState != null and param.clearingState != ''">
|
|
<if test="param.clearingState != null and param.clearingState != ''">
|
|
|
- and ivs.clearing_state = #{param.clearingState}
|
|
|
|
|
|
|
+ and a.clearing_state = #{param.clearingState}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="param.insuranceClearingState != null and param.insuranceClearingState != ''">
|
|
<if test="param.insuranceClearingState != null and param.insuranceClearingState != ''">
|
|
|
- and ivs.insurance_clearing_state = #{param.insuranceClearingState}
|
|
|
|
|
|
|
+ and a.insurance_clearing_state = #{param.insuranceClearingState}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="param.insuranceDept != null and param.insuranceDept != ''">
|
|
<if test="param.insuranceDept != null and param.insuranceDept != ''">
|
|
|
- and ivs.insurance_dept = #{param.insuranceDept}
|
|
|
|
|
|
|
+ and a.insurance_dept = #{param.insuranceDept}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="param.insuranceType != null and param.insuranceType != ''">
|
|
<if test="param.insuranceType != null and param.insuranceType != ''">
|
|
|
- and ivs.risk = #{param.insuranceType}
|
|
|
|
|
|
|
+ and a.insurance_type = #{param.insuranceType}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="param.jqPolicyId != null and param.jqPolicyId != ''">
|
|
<if test="param.jqPolicyId != null and param.jqPolicyId != ''">
|
|
|
- and ivs.jq_policy_id = #{param.jqPolicyId}
|
|
|
|
|
|
|
+ and a.jq_policy_id = #{param.jqPolicyId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="param.syPolicyId != null and param.syPolicyId != ''">
|
|
<if test="param.syPolicyId != null and param.syPolicyId != ''">
|
|
|
- and ivs.sy_policy_id = #{param.syPolicyId}
|
|
|
|
|
|
|
+ and a.sy_policy_id = #{param.syPolicyId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="param.nonCarPolicyId != null and param.nonCarPolicyId != ''">
|
|
<if test="param.nonCarPolicyId != null and param.nonCarPolicyId != ''">
|
|
|
- and ivs.non_car_policy_id = #{param.nonCarPolicyId}
|
|
|
|
|
|
|
+ and a.non_car_policy_id = #{param.nonCarPolicyId}
|
|
|
</if>
|
|
</if>
|
|
|
|
|
|
|
|
</select>
|
|
</select>
|