Commit c7458086 by wenyang Committed by jianan

渠道规则开发1(发佣检核查询)

parent 6e3034cd
......@@ -957,6 +957,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
practitionerSubordinateInfo.setDeptId(requestVO.getInsurerBranchDeptId());
List<Long> subsystemIdList = aclPractitionerSubordinateSystemDalService.getLongs(practitionerSubordinateInfo);
info.setSubsystemIdList(subsystemIdList);
info.setChannelType("2");//对私报表
List<CommissionPayoutStatus> commissionPayoutStatusList = agmsFortuneDalService.commissionPayoutStatusQuery(info);
......
......@@ -104,6 +104,10 @@ public class CommissionPayoutStatus {
private String monthPeriod;
private String remark;
/**
* 渠道类型: 对公:1; 对私:2或者空
*/
private String channelType;
public String getCommissionPayoutYearmonth() {
return commissionPayoutYearmonth;
......@@ -283,6 +287,7 @@ public class CommissionPayoutStatus {
", commissionPayoutStatus='" + commissionPayoutStatus + '\'' +
", monthPeriod='" + monthPeriod + '\'' +
", remark='" + remark + '\'' +
", channelType='" + channelType + '\'' +
'}';
}
@JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8")
......@@ -301,4 +306,21 @@ public class CommissionPayoutStatus {
public void setRemark(String remark) {
this.remark = remark;
}
/**
* 渠道类型: 对公:1; 对私:2或者空
* @return the channelType
*/
public String getChannelType() {
return channelType;
}
/**
* 渠道类型: 对公:1; 对私:2或者空
* @param channelType the channelType to set
*/
public void setChannelType(String channelType) {
this.channelType = channelType;
}
}
......@@ -64,6 +64,12 @@ public class CommissionPayoutStatusQueryInfo {
* 体系子集id
*/
List<Long> subsystemIdList;
/**
* 渠道Id
*/
private Long channelId;
private String channelType;//渠道类型: 对公:1; 对私:2或者空
private PageInfo<CommissionPayoutStatus> page;
......@@ -184,4 +190,21 @@ public class CommissionPayoutStatusQueryInfo {
public void setCommissionTypeDropOptionCodeList(List<String> commissionTypeDropOptionCodeList) {
this.commissionTypeDropOptionCodeList = commissionTypeDropOptionCodeList;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public String getChannelType() {
return channelType;
}
public void setChannelType(String channelType) {
this.channelType = channelType;
}
}
......@@ -27,52 +27,13 @@
<select id="commissionPayoutStatusQuery"
parameterType="com.yd.dal.entity.agms.fortune.CommissionPayoutStatusQueryInfo"
resultType="com.yd.dal.entity.agms.fortune.CommissionPayoutStatus">
<!-- select
o.id orderId,
f.id fortuneId,
c.check_yearmonth commissionPayoutYearmonth,
i.name insurerName,
if(o.config_level = 2,p.name,pp.name) productName,
o.policy_no policyNo,
if(o.payment_term IS NOT NULL ,CONCAT(o.payment_term,(case o.payment_term_unit when 'Y' then '年' when 'M' then '月' else '日' END ) ),(SELECT e.element_text from ag_po_order_life_product_elements e where o.id = e.order_id and e.factor_code like 'f_pay_term' LIMIT 1)) paymentTermUnit,
if(o.cover_term IS NOT NULL ,o.cover_term_type ,(SELECT e.element_text from ag_po_order_life_product_elements e where o.id = e.order_id and e.factor_code like 'f_coverage_term' LIMIT 1)) coverTermType,
o.order_price orderPrice,
pra.name practitionerName,
dept.name insurerBranchDeptName,
sub.name subordinateSystemName,
f.practitioner_level practitionerLevel,
f.commission_amount commissionAmount,
f.commission_type commissionType,
f.referral_rate referralRate,
f.referral_amount referralAmount,
op.drop_option_name commissionPayoutStatus,
pb.payout_yearmonth monthPeriod
from ag_acl_customer_fortune f
LEFT JOIN ag_po_order o
LEFT JOIN ag_acl_insurer i ON i.id = o.insurer_id
LEFT JOIN ag_product p ON p.id = o.product_id
LEFT JOIN ag_product_plan pp ON pp.id = o.plan_id
ON o.id = f.order_id
LEFT JOIN ag_acl_practitioner pra
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
ON pra.customer_id = f.customer_id
LEFT JOIN ag_acl_customer_fortune_payout_batch pb ON pb.id = f.payout_batch_id
LEFT JOIN ag_md_drop_options op
LEFT JOIN ag_md_drop_master mas ON mas.id = op.drop_master_id
ON op.drop_option_code = f.commission_payout_status
left join ag_po_order_commission_check c on o.commission_check_id = c.id
where o.commission_check_status = 2
AND mas.drop_code like 'Commission_Payout_Status'
and setting.practitioner_type_id = 28 -->
SELECT distinct o.id orderId,t.id fortuneId,
c.check_yearmonth commissionPayoutYearmonth,
i.name insurerName,IF(o.config_level = 2,p.name,pp.name) productName,o.policy_no policyNo,
IF(o.payment_term IS NOT NULL ,CONCAT(o.payment_term,(CASE o.payment_term_unit WHEN 'Y' THEN '年' WHEN 'M' THEN '月' ELSE '日' END ) ),(SELECT e.element_text FROM ag_po_order_life_product_elements e WHERE o.id = e.order_id AND e.factor_code LIKE 'f_pay_term' LIMIT 1)) paymentTermUnit,
IF(o.cover_term IS NOT NULL ,o.cover_term_type ,(SELECT e.element_text FROM ag_po_order_life_product_elements e WHERE o.id = e.order_id AND e.factor_code LIKE 'f_coverage_term' LIMIT 1)) coverTermType,
o.order_price orderPrice,
pra.name practitionerName,
IFNULL(pra.name,cha.name) practitionerName,
dept.name insurerBranchDeptName,
sub.name subordinateSystemName,
op1.drop_option_name practitionerLevel,
......@@ -83,7 +44,8 @@
t.predict_month_period predictMonthPeriod,
op.drop_option_name commissionPayoutStatus,
t.remark,
pb.payout_yearmonth monthPeriod
pb.payout_yearmonth monthPeriod,
t.channel_type channelType
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
......@@ -98,16 +60,15 @@
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
LEFT JOIN (SELECT distinct poc.order_id,poc.commission_period,c.* FROM ag_po_order_commission poc,ag_po_order_commission_check c
LEFT JOIN ag_acl_channel_new cha ON cha.customer_id = t.customer_id
LEFT JOIN (select distinct poc.order_id,poc.commission_period,c.* FROM ag_po_order_commission poc,ag_po_order_commission_check c
WHERE poc.commission_check_id=c.id AND poc.commission_status='2' AND poc.commission_type='1'
<if test="item.commissionPayoutYearmonth == null">
GROUP BY poc.order_id,poc.commission_period
</if>
) c ON c.order_id=t.order_id AND c.commission_period=t.commission_period
WHERE t.settlement_type = '1'
AND mas.drop_code = 'Fortune_Payout_Status'
AND mas1.scenario_code = 'practitioner_level'
and setting.practitioner_type_id = 28
WHERE ((t.settlement_type='1' and setting.practitioner_type_id=28 and mas1.scenario_code='practitioner_level' ) or t.settlement_type='3')
and mas.drop_code = 'Fortune_Payout_Status'
and EXISTS(select 1 from ag_po_order_commission poc
where poc.commission_status='2' and poc.commission_type='1'
and poc.order_id=t.order_id and poc.commission_period=t.commission_period)
......@@ -120,12 +81,15 @@
<if test="item.insurerBranchId != null">
and pra.insurer_branch_id = #{item.insurerBranchId,jdbcType=BIGINT}
</if>
<if test="item.channelId != null">
and cha.id = #{item.channelId,jdbcType=BIGINT}
</if>
<if test="item.channelType != null">
and t.channel_type = #{item.channelType,jdbcType=VARCHAR}
</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=")">
......@@ -143,9 +107,6 @@
</if>
<if test="item.commissionPayoutStatus != null">
and t.status = #{item.commissionPayoutStatus,jdbcType=BIGINT}
<if test="'1'.equals(item.commissionPayoutStatus)">
and oc.commission_check_id is not null
</if>
</if>
<if test="item.commissionPayoutYearmonth != null">
and (c.check_yearmonth = #{item.commissionPayoutYearmonth,jdbcType=VARCHAR}
......@@ -165,7 +126,7 @@
'' paymentTermUnit,
'' coverTermType,
'0.00' orderPrice,
pra.name practitionerName,
IFNULL(pra.name,cha.name) practitionerName,
dept.name insurerBranchDeptName,
sub.name subordinateSystemName,
op1.drop_option_name practitionerLevel,
......@@ -176,7 +137,8 @@
t.predict_month_period predictMonthPeriod,
op.drop_option_name commissionPayoutStatus,
t.remark,
pb.payout_yearmonth monthPeriod
pb.payout_yearmonth monthPeriod,
t.channel_type channelType
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
......@@ -187,19 +149,21 @@
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'
LEFT JOIN ag_acl_channel_new cha ON cha.customer_id = t.customer_id
WHERE ((t.settlement_type='2' and mas1.scenario_code='practitioner_level' and setting.practitioner_type_id=28) or t.settlement_type='3')
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.channelId != null">
and cha.id = #{item.channelId,jdbcType=BIGINT}
</if>
<if test="item.channelType != null">
and t.channel_type = #{item.channelType,jdbcType=VARCHAR}
</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=")">
......@@ -218,9 +182,6 @@
<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>
......
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