Commit 8425a250 by jianan

发佣检核25-发佣检核根据保单号查询不显示手工数据

parent 14b0eeca
......@@ -82,8 +82,8 @@
t.predict_month_period predictMonthPeriod,
op.drop_option_name commissionPayoutStatus,
pb.payout_yearmonth monthPeriod
FROM ag_acl_customer_fortune t
LEFT JOIN ag_po_order o ON o.id = t.order_id
FROM ag_acl_customer_fortune t
LEFT JOIN ag_po_order o ON o.id = t.order_id
LEFT JOIN ag_product p ON p.id = o.product_id
LEFT JOIN ag_product_plan pp ON pp.id = o.plan_id
LEFT JOIN ag_po_order_commission oc ON oc.order_id = t.order_id AND oc.id = t.commission_id
......@@ -95,7 +95,7 @@
LEFT JOIN ag_acl_practitioner_setting setting ON setting.practitioner_id = pra.id
LEFT JOIN ag_acl_customer_fortune_payout_batch pb ON pb.id = t.payout_batch_id
LEFT JOIN ag_md_drop_options op ON op.drop_option_code = t.status
LEFT JOIN ag_md_drop_master mas ON mas.id = op.drop_master_id
LEFT JOIN ag_md_drop_master mas ON mas.id = op.drop_master_id
LEFT JOIN ag_md_drop_options op1 ON op1.id = setting.practitioner_level
LEFT JOIN ag_md_drop_master mas1 ON mas1.id = op1.drop_master_id
WHERE t.settlement_type = '1'
......@@ -142,68 +142,70 @@
<if test="item.payoutYearmonth != null">
and pb.payout_yearmonth = #{item.payoutYearmonth,jdbcType=VARCHAR}
</if>
UNION ALL
SELECT '' orderId,t.id fortuneId,'' commissionPayoutYearmonth,'' insurerName,'' productName,
'' policyNo,
'' paymentTermUnit,
'' coverTermType,
'0.00' orderPrice,
pra.name practitionerName,
dept.name insurerBranchDeptName,
sub.name subordinateSystemName,
<!-- t.practitioner_level practitionerLevel, -->
op1.drop_option_name practitionerLevel,
t.commission_amount commissionAmount,
t.commission_type commissionType,
t.referral_rate referralRate,
t.referral_amount referralAmount,
t.predict_month_period predictMonthPeriod,
op.drop_option_name commissionPayoutStatus,
pb.payout_yearmonth monthPeriod
FROM ag_acl_customer_fortune t
LEFT JOIN ag_acl_practitioner pra ON pra.id = t.practitioner_id
LEFT JOIN ag_acl_insurer_branch_dept dept ON pra.dept_id = dept.id
LEFT JOIN ag_acl_practitioner_subordinate_system sub ON sub.id = pra.subordinate_system_id
LEFT JOIN ag_acl_practitioner_setting setting ON setting.practitioner_id = pra.id
LEFT JOIN ag_acl_customer_fortune_payout_batch pb ON pb.id = t.payout_batch_id
LEFT JOIN ag_md_drop_options op ON op.drop_option_code = t.status
LEFT JOIN ag_md_drop_master mas ON mas.id = op.drop_master_id
LEFT JOIN ag_md_drop_options op1 ON op1.id = setting.practitioner_level
LEFT JOIN ag_md_drop_master mas1 ON mas1.id = op1.drop_master_id
WHERE t.settlement_type = '2'
AND mas.drop_code = 'Fortune_Payout_Status'
AND mas1.scenario_code = 'practitioner_level'
and setting.practitioner_type_id = 28
<if test="item.insurerBranchId != null">
and pra.insurer_branch_id = #{item.insurerBranchId,jdbcType=BIGINT}
</if>
<if test="item.insurerBranchDeptId != null">
and dept.id = #{item.insurerBranchDeptId,jdbcType=BIGINT}
</if>
<!-- <if test="item.subordinateSystemId != null">
and sub.id = #{item.subordinateSystemId,jdbcType=BIGINT}
</if>-->
<if test="item.subsystemIdList != null and item.subsystemIdList.size() > 0">
and sub.id in
<foreach collection="item.subsystemIdList" index="index" item="subordinateSystemId" open="(" separator="," close=")">
#{subordinateSystemId}
</foreach>
</if>
<if test="item.practitionerId != null">
and pra.id = #{item.practitionerId,jdbcType=BIGINT}
</if>
<if test="item.commissionPayoutStatus != null">
and t.status = #{item.commissionPayoutStatus,jdbcType=BIGINT}
</if>
<!-- <if test="item.commissionPayoutYearmonth != null"> -->
<!-- and c.check_yearmonth = #{item.commissionPayoutYearmonth,jdbcType=VARCHAR} -->
<!-- </if> -->
<if test="item.predictMonthPeriod != null">
and DATE_FORMAT(t.predict_month_period, '%Y-%m') = #{item.predictMonthPeriod,jdbcType=VARCHAR}
</if>
<if test="item.payoutYearmonth != null">
and pb.payout_yearmonth = #{item.payoutYearmonth,jdbcType=VARCHAR}
</if>
<if test="item.policyNo == null">
UNION ALL
SELECT '' orderId,t.id fortuneId,'' commissionPayoutYearmonth,'' insurerName,'' productName,
'' policyNo,
'' paymentTermUnit,
'' coverTermType,
'0.00' orderPrice,
pra.name practitionerName,
dept.name insurerBranchDeptName,
sub.name subordinateSystemName,
<!-- t.practitioner_level practitionerLevel, -->
op1.drop_option_name practitionerLevel,
t.commission_amount commissionAmount,
t.commission_type commissionType,
t.referral_rate referralRate,
t.referral_amount referralAmount,
t.predict_month_period predictMonthPeriod,
op.drop_option_name commissionPayoutStatus,
pb.payout_yearmonth monthPeriod
FROM ag_acl_customer_fortune t
LEFT JOIN ag_acl_practitioner pra ON pra.id = t.practitioner_id
LEFT JOIN ag_acl_insurer_branch_dept dept ON pra.dept_id = dept.id
LEFT JOIN ag_acl_practitioner_subordinate_system sub ON sub.id = pra.subordinate_system_id
LEFT JOIN ag_acl_practitioner_setting setting ON setting.practitioner_id = pra.id
LEFT JOIN ag_acl_customer_fortune_payout_batch pb ON pb.id = t.payout_batch_id
LEFT JOIN ag_md_drop_options op ON op.drop_option_code = t.status
LEFT JOIN ag_md_drop_master mas ON mas.id = op.drop_master_id
LEFT JOIN ag_md_drop_options op1 ON op1.id = setting.practitioner_level
LEFT JOIN ag_md_drop_master mas1 ON mas1.id = op1.drop_master_id
WHERE t.settlement_type = '2'
AND mas.drop_code = 'Fortune_Payout_Status'
AND mas1.scenario_code = 'practitioner_level'
and setting.practitioner_type_id = 28
<if test="item.insurerBranchId != null">
and pra.insurer_branch_id = #{item.insurerBranchId,jdbcType=BIGINT}
</if>
<if test="item.insurerBranchDeptId != null">
and dept.id = #{item.insurerBranchDeptId,jdbcType=BIGINT}
</if>
<!-- <if test="item.subordinateSystemId != null">
and sub.id = #{item.subordinateSystemId,jdbcType=BIGINT}
</if>-->
<if test="item.subsystemIdList != null and item.subsystemIdList.size() > 0">
and sub.id in
<foreach collection="item.subsystemIdList" index="index" item="subordinateSystemId" open="(" separator="," close=")">
#{subordinateSystemId}
</foreach>
</if>
<if test="item.practitionerId != null">
and pra.id = #{item.practitionerId,jdbcType=BIGINT}
</if>
<if test="item.commissionPayoutStatus != null">
and t.status = #{item.commissionPayoutStatus,jdbcType=BIGINT}
</if>
<!-- <if test="item.commissionPayoutYearmonth != null"> -->
<!-- and c.check_yearmonth = #{item.commissionPayoutYearmonth,jdbcType=VARCHAR} -->
<!-- </if> -->
<if test="item.predictMonthPeriod != null">
and DATE_FORMAT(t.predict_month_period, '%Y-%m') = #{item.predictMonthPeriod,jdbcType=VARCHAR}
</if>
<if test="item.payoutYearmonth != null">
and pb.payout_yearmonth = #{item.payoutYearmonth,jdbcType=VARCHAR}
</if>
</if>
</select>
<select id="fortunePayToOrder" resultType="com.yd.dal.entity.agms.fortune.FortunePayToOrderInfo">
......@@ -354,11 +356,11 @@
i.name insurerName,
p.name productName,
pp.name planName,
o.effective_start_date effectiveStartDate,
if(o.effective_start_date is not null,left(o.effective_start_date,10),o.effective_start_date) effectiveStartDate,
o.policy_no policyNo,
f.order_price orderPrice,
f.fyc_amount fycAmount,
f.grade_commission_rate gradeCommissionRate,
if(f.order_price is null,0,f.order_price) orderPrice,
if(f.fyc_amount is null,0,f.fyc_amount) fycAmount,
if(f.grade_commission_rate is null,0,f.grade_commission_rate) gradeCommissionRate,
(select s.name from ag_acl_practitioner_subordinate_system s where s.id = pra.subordinate_system_id) subordinateSystemName,
pra.name practitionerName,
if(f.commission_rate is null,0,f.commission_rate) commissionRate,
......@@ -367,7 +369,7 @@
f.drop_option_code dropOptionCode,
f.remark remark,
f.commission_type commissionType,
f.referral_amount referralAmount,
if(f.referral_amount is null,0,f.referral_amount) referralAmount,
f.calculation_formula calculationFormula,
f.withdrawed_id withdrawId
from ag_acl_customer_fortune f
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment