Commit 8bdb601e by jianan

4and5-保单发佣明细报表8

parent d4c65f49
...@@ -2,6 +2,7 @@ package com.yd.api.agms.service.impl; ...@@ -2,6 +2,7 @@ package com.yd.api.agms.service.impl;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.google.common.base.Joiner;
import com.yd.api.agms.service.AgmsFortuneService; import com.yd.api.agms.service.AgmsFortuneService;
import com.yd.api.agms.vo.fortune.*; import com.yd.api.agms.vo.fortune.*;
import com.yd.api.order.vo.SurrenderFortuneRequestVO; import com.yd.api.order.vo.SurrenderFortuneRequestVO;
...@@ -987,7 +988,8 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -987,7 +988,8 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
"所属 S3纵队", "S3团队达标奖金率", "S3团队达标奖金¥(季度)", "S3团队长辅导津贴比率", "S3团队长辅导津贴", "所属 S3纵队", "S3团队达标奖金率", "S3团队达标奖金¥(季度)", "S3团队长辅导津贴比率", "S3团队长辅导津贴",
"育成人", "育成人职级", "育成奖金率", "育成金额", "育成人", "育成人职级", "育成奖金率", "育成金额",
"C14直接销售加码佣金率", "C14直接销售加码佣金", "C14直接销售加码佣金率", "C14直接销售加码佣金",
"基本法属性", "S01-首年度销售佣金", "S03-首年度辅导奖金"}; "基本法属性", "S01-首年度销售佣金", "S03-首年度辅导奖金",
"R01-首年度直接销售佣金(旧)", "R02-续年度直接销售拥金(旧)", "R03-续年度辅导佣金(旧)", "R04-续年度绩效奖金(旧)"};
XSSFRow rownum = sheet2.createRow(0); XSSFRow rownum = sheet2.createRow(0);
for (int j = 0; j < columnName.length; j++) { for (int j = 0; j < columnName.length; j++) {
rownum.createCell(j).setCellValue(columnName[j]); rownum.createCell(j).setCellValue(columnName[j]);
...@@ -1089,10 +1091,44 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService { ...@@ -1089,10 +1091,44 @@ public class AgmsFortuneServiceImpl implements AgmsFortuneService {
practitioner = aclPractitionerMap.get(Long.valueOf(item.get("60").toString())); practitioner = aclPractitionerMap.get(Long.valueOf(item.get("60").toString()));
item.put("60", practitioner != null ? practitioner.getName() : null); item.put("60", practitioner != null ? practitioner.getName() : null);
} }
//44-47
item.put("44", this.processMerge(item.get("44"), aclPractitionerMap));
item.put("45", this.processMerge(item.get("45"), aclPractitionerMap));
item.put("46", this.processMerge(item.get("46"), aclPractitionerMap));
item.put("47", this.processMerge(item.get("47"), aclPractitionerMap));
//50-53
item.put("50", this.processMerge(item.get("50"), aclPractitionerMap));
item.put("51", this.processMerge(item.get("51"), aclPractitionerMap));
item.put("52", this.processMerge(item.get("52"), aclPractitionerMap));
item.put("53", this.processMerge(item.get("53"), aclPractitionerMap));
//56-59
item.put("56", this.processMerge(item.get("56"), aclPractitionerMap));
item.put("57", this.processMerge(item.get("57"), aclPractitionerMap));
item.put("58", this.processMerge(item.get("58"), aclPractitionerMap));
item.put("59", this.processMerge(item.get("59"), aclPractitionerMap));
}
}
private String processMerge(Object o, Map<Long, AclPractitioner> aclPractitionerMap) {
if (null != o && StringUtils.isNotBlank(o.toString())) {
String[] practitionerId_values = o.toString().split(",");
for (int j = 0; j < practitionerId_values.length; j++) {
String[] split = practitionerId_values[j].split("-");
if (StringUtils.isNotBlank(split[0])) {
Long practitionerId = Long.valueOf(split[0]);
AclPractitioner practitioner = aclPractitionerMap.get(practitionerId);
if (practitioner != null) {
String strNew = practitioner.getName() + "-" + split[1];
practitionerId_values[j] = strNew;
}
}
}
return Joiner.on(",").join(Arrays.asList(practitionerId_values));
} }
return null;
} }
private void exportCommissionPayoutStatusQueryCSV(List<CommissionPayoutStatus> commissionPayoutStatusList, HttpServletResponse response) { private void exportCommissionPayoutStatusQueryCSV(List<CommissionPayoutStatus> commissionPayoutStatusList, HttpServletResponse response) {
String[] columnName = new String[]{"序号", "来佣检核年月", "发佣状态", "预计发佣年月", "实际发佣年月", "保险公司", "保单号", "保费", "来佣金额", "佣金类型", "应发佣率", "应发金额", String[] columnName = new String[]{"序号", "来佣检核年月", "发佣状态", "预计发佣年月", "实际发佣年月", "保险公司", "保单号", "保费", "来佣金额", "佣金类型", "应发佣率", "应发金额",
"经纪人", "经纪人职级", "体系", "营业部", "购买方案", "缴费年限", "保障期间"}; "经纪人", "经纪人职级", "体系", "营业部", "购买方案", "缴费年限", "保障期间"};
......
...@@ -482,24 +482,24 @@ ...@@ -482,24 +482,24 @@
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C07' and practitioner_id = l.in_mentor_id) '42' /*二代辅导人岗位津贴*/, (SELECT group_concat(referral_amount) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C07' and practitioner_id = l.in_mentor_id) '42' /*二代辅导人岗位津贴*/,
l.s1_id '43' /*所属S1分部*/, l.s1_id '43' /*所属S1分部*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where drop_option_code ='C08' and order_id=f.order_id and practitioner_id = l.s1_team_leader_id) '44' /*S1团队达标奖金率*/, (SELECT group_concat(CONCAT_WS('-', practitioner_id, calculation_rate)) from ag_acl_customer_fortune where drop_option_code ='C08' and order_id=f.order_id and practitioner_id = l.s1_team_leader_id) '44' /*S1团队达标奖金率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where drop_option_code ='C08' and order_id=f.order_id and practitioner_id = l.s1_team_leader_id) '45' /*'S1团队达标奖金¥(季度)'*/, (SELECT group_concat(CONCAT_WS('-', practitioner_id, referral_amount)) from ag_acl_customer_fortune where drop_option_code ='C08' and order_id=f.order_id and practitioner_id = l.s1_team_leader_id) '45' /*'S1团队达标奖金¥(季度)'*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where drop_option_code ='C10' and order_id=f.order_id and practitioner_id = l.s1_team_leader_id) '46' /*S1团队长辅导津贴比率*/, (SELECT group_concat(CONCAT_WS('-', practitioner_id, calculation_rate)) from ag_acl_customer_fortune where drop_option_code ='C10' and order_id=f.order_id and practitioner_id = l.s1_team_leader_id) '46' /*S1团队长辅导津贴比率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where drop_option_code ='C10' and order_id=f.order_id and practitioner_id = l.s1_team_leader_id) '47' /*S1团队长辅导津贴*/, (SELECT group_concat(CONCAT_WS('-', practitioner_id, referral_amount)) from ag_acl_customer_fortune where drop_option_code ='C10' and order_id=f.order_id and practitioner_id = l.s1_team_leader_id) '47' /*S1团队长辅导津贴*/,
'' as '48' /*S1续期绩效奖金*/, '' as '48' /*S1续期绩效奖金*/,
l.s2_id '49' /*所属S2体系*/, l.s2_id '49' /*所属S2体系*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where drop_option_code ='C08' and order_id=f.order_id and practitioner_id = l.s2_team_leader_id) '50' /*S2团队达标奖金率*/, (SELECT group_concat(CONCAT_WS('-', practitioner_id, calculation_rate)) from ag_acl_customer_fortune where drop_option_code ='C08' and order_id=f.order_id and practitioner_id = l.s2_team_leader_id) '50' /*S2团队达标奖金率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where drop_option_code ='C08' and order_id=f.order_id and practitioner_id = l.s2_team_leader_id) '51' /*'S2团队达标奖金¥(季度)'*/, (SELECT group_concat(CONCAT_WS('-', practitioner_id, referral_amount)) from ag_acl_customer_fortune where drop_option_code ='C08' and order_id=f.order_id and practitioner_id = l.s2_team_leader_id) '51' /*'S2团队达标奖金¥(季度)'*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where drop_option_code ='C10' and order_id=f.order_id and practitioner_id = l.s2_team_leader_id) '52' /*S2团队长辅导津贴比率*/, (SELECT group_concat(CONCAT_WS('-', practitioner_id, calculation_rate)) from ag_acl_customer_fortune where drop_option_code ='C10' and order_id=f.order_id and practitioner_id = l.s2_team_leader_id) '52' /*S2团队长辅导津贴比率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where drop_option_code ='C10' and order_id=f.order_id and practitioner_id = l.s2_team_leader_id) '53' /*S2团队长辅导津贴*/, (SELECT group_concat(CONCAT_WS('-', practitioner_id, referral_amount)) from ag_acl_customer_fortune where drop_option_code ='C10' and order_id=f.order_id and practitioner_id = l.s2_team_leader_id) '53' /*S2团队长辅导津贴*/,
'' as '54' /*S2续期绩效奖金*/, '' as '54' /*S2续期绩效奖金*/,
l.s3_id '55' /*所属S3纵队*/, l.s3_id '55' /*所属S3纵队*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where drop_option_code ='C08' and order_id=f.order_id and practitioner_id = l.s3_team_leader_id) '56' /*S3团队达标奖金率*/, (SELECT group_concat(CONCAT_WS('-', practitioner_id, calculation_rate)) from ag_acl_customer_fortune where drop_option_code ='C08' and order_id=f.order_id and practitioner_id = l.s3_team_leader_id) '56' /*S3团队达标奖金率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where drop_option_code ='C08' and order_id=f.order_id and practitioner_id = l.s3_team_leader_id) '57' /*'S3团队达标奖金¥(季度)'*/, (SELECT group_concat(CONCAT_WS('-', practitioner_id, referral_amount)) from ag_acl_customer_fortune where drop_option_code ='C08' and order_id=f.order_id and practitioner_id = l.s3_team_leader_id) '57' /*'S3团队达标奖金¥(季度)'*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where drop_option_code ='C10' and order_id=f.order_id and practitioner_id = l.s3_team_leader_id) '58' /*S3团队长辅导津贴比率*/, (SELECT group_concat(CONCAT_WS('-', practitioner_id, calculation_rate)) from ag_acl_customer_fortune where drop_option_code ='C10' and order_id=f.order_id and practitioner_id = l.s3_team_leader_id) '58' /*S3团队长辅导津贴比率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where drop_option_code ='C10' and order_id=f.order_id and practitioner_id = l.s3_team_leader_id) '59' /*S3团队长辅导津贴*/, (SELECT group_concat(CONCAT_WS('-', practitioner_id, referral_amount)) from ag_acl_customer_fortune where drop_option_code ='C10' and order_id=f.order_id and practitioner_id = l.s3_team_leader_id) '59' /*S3团队长辅导津贴*/,
l.raise_id '60' /*育成人*/, l.raise_id '60' /*育成人*/,
l.raise_level '61' /*育成人职级*/, l.raise_level '61' /*育成人职级*/,
...@@ -513,12 +513,17 @@ ...@@ -513,12 +513,17 @@
sum(case when drop_option_code ='S01' then f.referral_amount else null end) '67' /*S01-首年度销售佣金*/, sum(case when drop_option_code ='S01' then f.referral_amount else null end) '67' /*S01-首年度销售佣金*/,
sum(case when drop_option_code ='S03' then f.referral_amount else null end) '68' /*S03-首年度辅导奖金*/, sum(case when drop_option_code ='S03' then f.referral_amount else null end) '68' /*S03-首年度辅导奖金*/,
sum(case when drop_option_code ='R01' then f.referral_amount else null end) '69' /*R01-首年度直接销售佣金(旧)*/,
sum(case when drop_option_code ='R02' then f.referral_amount else null end) '70' /*R02-续年度直接销售拥金(旧)*/,
sum(case when drop_option_code ='R03' then f.referral_amount else null end) '71' /*R03-续年度辅导佣金(旧)*/,
sum(case when drop_option_code ='R04' then f.referral_amount else null end) '72' /*R04-续年度绩效奖金(旧)*/,
f.order_id, f.order_id,
f.customer_id l.customer_id
FROM ag_acl_customer_fortune f FROM ag_acl_customer_fortune f
INNER JOIN ag_acl_life_insurance_practitioner l on l.order_id = f.order_id and l.customer_id = f.customer_id
LEFT JOIN ag_acl_customer_fortune_payout_batch pb on pb.id = f.payout_batch_id LEFT JOIN ag_acl_customer_fortune_payout_batch pb on pb.id = f.payout_batch_id
LEFT JOIN ag_acl_life_insurance_practitioner l on l.order_id = f.order_id and l.practitioner_id = f.practitioner_id
LEFT JOIN ag_acl_practitioner pra on pra.customer_id = f.customer_id LEFT JOIN ag_acl_practitioner pra on pra.customer_id = f.customer_id
LEFT JOIN ag_acl_practitioner_setting ps on ps.practitioner_id = pra.id LEFT JOIN ag_acl_practitioner_setting ps on ps.practitioner_id = pra.id
LEFT JOIN ag_po_order o on o.id = f.order_id LEFT JOIN ag_po_order o on o.id = f.order_id
...@@ -529,7 +534,7 @@ ...@@ -529,7 +534,7 @@
<foreach collection="list" item="item" open="(" separator="," close=")"> <foreach collection="list" item="item" open="(" separator="," close=")">
#{item,jdbcType=BIGINT} #{item,jdbcType=BIGINT}
</foreach> </foreach>
GROUP BY f.order_id, f.customer_id GROUP BY f.order_id, l.customer_id
</select> </select>
</mapper> </mapper>
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