Commit ff3388f7 by jianan

渠道发佣报表4

parent 50631ce3
......@@ -1186,7 +1186,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
private void exportCommissionPayoutStatusQueryCSV(List<CommissionPayoutStatus> commissionPayoutStatusList, HttpServletResponse response) {
String[] columnName = new String[]{"序号", "来佣检核年月", "发佣状态", "预计发佣年月", "实际发佣年月", "保险公司", "保单号", "保费", "来佣金额", "佣金类型", "应发佣率", "应发金额",
"经纪人", "经纪人职级", "体系", "营业部", "购买方案", "缴费年限", "保障期间", "备注"};
"渠道", "经纪人", "经纪人职级", "体系", "营业部", "购买方案", "缴费年限", "保障期间", "备注"};
String tableName = "YD_CommissionPayout" + System.currentTimeMillis() + ".csv";
String CSV_COLUMN_SEPARATOR = ",";//CSV文件列分隔符
......@@ -1214,6 +1214,7 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
buf.append(info.getCommissionType() == null ? "" : info.getCommissionType()).append(CSV_COLUMN_SEPARATOR);
buf.append(info.getReferralRate() == null ? 0 : info.getReferralRate()).append(CSV_COLUMN_SEPARATOR);
buf.append(info.getReferralAmount() == null ? 0 : info.getReferralAmount()).append(CSV_COLUMN_SEPARATOR);
buf.append(info.getChannelName() == null ? "" : info.getChannelName()).append(CSV_COLUMN_SEPARATOR);
buf.append(info.getPractitionerName() == null ? "" : info.getPractitionerName()).append(CSV_COLUMN_SEPARATOR);
buf.append(info.getPractitionerLevel() == null ? "" : info.getPractitionerLevel()).append(CSV_COLUMN_SEPARATOR);
buf.append(info.getSubordinateSystemName() == null ? "" : info.getSubordinateSystemName()).append(CSV_COLUMN_SEPARATOR);
......
......@@ -108,6 +108,10 @@ public class CommissionPayoutStatus {
* 渠道类型: 对公:1; 对私:2或者空
*/
private String channelType;
/**
* 所属渠道
*/
private String channelName;
public String getCommissionPayoutYearmonth() {
return commissionPayoutYearmonth;
......@@ -323,4 +327,11 @@ public class CommissionPayoutStatus {
this.channelType = channelType;
}
public String getChannelName() {
return channelName;
}
public void setChannelName(String channelName) {
this.channelName = channelName;
}
}
......@@ -17,7 +17,10 @@ public class WithdrawLabelInfo {
* 预计发佣年月
*/
private String payoutYearmonth;
/**
* 所属渠道
*/
private String channelName;
/**
* 经纪人
*/
......
......@@ -34,6 +34,7 @@
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,
IFNULL(pra.name,cha.name) practitionerName,
cha.name channelName,
dept.name insurerBranchDeptName,
sub.name subordinateSystemName,
op1.drop_option_name practitionerLevel,
......@@ -128,6 +129,7 @@
'' coverTermType,
'0.00' orderPrice,
IFNULL(pra.name,cha.name) practitionerName,
cha.name channelName,
dept.name insurerBranchDeptName,
sub.name subordinateSystemName,
op1.drop_option_name practitionerLevel,
......@@ -283,6 +285,7 @@
select distinct pay.id payId,
pay.withdraw_id withdrawId,
pb.payout_yearmonth payoutYearmonth,
cha.name channelName,
ifnull(pra.name,cha.name) practitionerName,
pay.withdraw_amount referralAmount,
pra.mobile_no mobileNo,
......@@ -437,7 +440,7 @@
if(f.commission_period!=1,f.fyc_amount,'') '16' /*保单RYC*/,
if(f.commission_period!=1,f.referral_amount,'') '17' /*佣金RYC*/,
(select name from ag_acl_channel where id = f.channel_id) '18' /*渠道*/,
(select name from ag_acl_channel_new where id = f.channel_id) '18' /*渠道*/,
ifnull(coalesce(l.s1_id,l.s2_id,l.s3_id),(SELECT a.subordinate_system_id from ag_acl_practitioner a where a.id = f.sale_practitioner_id)) as '19' /*FYC体系*/,
ifnull(l.practitioner_name,(select t.name from ag_acl_practitioner t where t.id = f.sale_practitioner_id)) '20' /*销售经纪人*/,
ifnull(l.practitioner_level,
......@@ -682,7 +685,11 @@
sum(case when drop_option_code ='C14' then f.calculation_rate else null end) '64' /*C14直接销售加码佣金率*/,
sum(case when drop_option_code ='C14' then f.referral_amount else null end) '65' /*C14直接销售加码佣金*/,
if(o.settlement_rule_type=1,'简单基本法','标准基本法') '66' /*基本法属性*/,
IF(f.rule_id is null, if(o.settlement_rule_type=1,'简单基本法','标准基本法'),
(select (case settlement_rule_type when 1 then '简单基本法' when 2 then '标准基本法' when 3 then '特殊结算' when 4 then if(o.settlement_rule_type=1,'简单基本法','标准基本法') end)
from ag_settlement_rule_base where id = f.rule_id
)
) '66' /*基本法属性*/,
sum(case when drop_option_code ='S01' then f.referral_amount else null end) '67' /*S01-首年度销售佣金*/,
(SELECT GROUP_CONCAT(referral_amount)
FROM ag_acl_customer_fortune t
......@@ -856,7 +863,7 @@
if(f.commission_period!=1,f.fyc_amount,'') '16' /*保单RYC*/,
if(f.commission_period!=1,f.referral_amount,'') '17' /*佣金RYC*/,
(select name from ag_acl_channel where id = f.channel_id) '18' /*渠道*/,
(select name from ag_acl_channel_new where id = f.channel_id) '18' /*渠道*/,
coalesce(l.s1_id,l.s2_id,l.s3_id) as '19' /*FYC体系*/,
l.practitioner_name '20' /*销售经纪人*/,
l.practitioner_level '21' /*经纪人职级*/,
......@@ -921,7 +928,12 @@
null as '64' /*C14直接销售加码佣金率*/,
null as '65' /*C14直接销售加码佣金*/,
if(o.settlement_rule_type=1,'简单基本法','标准基本法') '66' /*基本法属性*/,
<!-- if(o.settlement_rule_type=1,'简单基本法','标准基本法') '66' /*基本法属性*/, -->
IF(f.rule_id is null, if(o.settlement_rule_type=1,'简单基本法','标准基本法'),
(select (case settlement_rule_type when 1 then '简单基本法' when 2 then '标准基本法' when 3 then '特殊结算' when 4 then if(o.settlement_rule_type=1,'简单基本法','标准基本法') end)
from ag_settlement_rule_base where id = f.rule_id
)
) '66' /*基本法属性*/,
null as '67' /*S01-首年度销售佣金*/,
null as '68' /*S03-首年度辅导奖金*/,
......@@ -997,7 +1009,11 @@
sum(case when f.drop_option_code ='D01' then f.referral_amount else null end) '14' /*D01首年渠道服务费*/,
sum(case when f.drop_option_code ='D02' then f.referral_amount else null end) '15' /*D02续年渠道服务费*/,
if(o.settlement_rule_type=1,'简单基本法','标准基本法') '16' /*基本法属性*/,
IF(f.rule_id is null, if(o.settlement_rule_type=1,'简单基本法','标准基本法'),
(select (case settlement_rule_type when 1 then '简单基本法' when 2 then '标准基本法' when 3 then '特殊结算' when 4 then if(o.settlement_rule_type=1,'简单基本法','标准基本法') end)
from ag_settlement_rule_base where id = f.rule_id
)
) '16' /*基本法属性*/,
sum(case when f.drop_option_code ='D91' then f.referral_amount else null end) as '17' /*D91渠道加扣款1*/,
sum(case when f.drop_option_code ='D92' then f.referral_amount else null end) as '18' /*D92渠道加扣款2*/,
......
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