Commit a169324f by jianan

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

parent 5e5a8c4c
...@@ -233,6 +233,20 @@ public class AgmsController { ...@@ -233,6 +233,20 @@ public class AgmsController {
} }
/** /**
* AGMS -- 保单发佣清算明细报表导出
* @param requestVO 请求数据
* @return 响应数据
*/
@RequestMapping(value="/exportCommissionPayoutStatusQuerySheet2")
public Object exportCommissionPayoutStatusQuerySheet2(@RequestBody CommissionPayoutStatusQueryRequestVO requestVO, HttpServletResponse response) {
JsonResult result = new JsonResult();
ExportCommissionPayoutStatusQueryResponseVO responseVO = agmsFortuneService.exportCommissionPayoutStatusQuerySheet2(requestVO,response);
result.setData(responseVO);
result.addResult(responseVO);
return result;
}
/**
* AGMS -- 导出财富文档 * AGMS -- 导出财富文档
* @param requestVO 请求数据 * @param requestVO 请求数据
* @return 响应数据 * @return 响应数据
......
...@@ -66,4 +66,6 @@ public interface AgmsFortuneService { ...@@ -66,4 +66,6 @@ public interface AgmsFortuneService {
FortunePayoutBatchQueryResponseVO fortunePayoutBatchQuery(); FortunePayoutBatchQueryResponseVO fortunePayoutBatchQuery();
ExportCommissionPayoutStatusQueryResponseVO exportCommissionPayoutStatusQuery(CommissionPayoutStatusQueryRequestVO requestVO, HttpServletResponse response); ExportCommissionPayoutStatusQueryResponseVO exportCommissionPayoutStatusQuery(CommissionPayoutStatusQueryRequestVO requestVO, HttpServletResponse response);
ExportCommissionPayoutStatusQueryResponseVO exportCommissionPayoutStatusQuerySheet2(CommissionPayoutStatusQueryRequestVO requestVO, HttpServletResponse response);
} }
...@@ -43,7 +43,7 @@ public class CommissionPayoutStatusQueryRequestVO { ...@@ -43,7 +43,7 @@ public class CommissionPayoutStatusQueryRequestVO {
private Long practitionerId; private Long practitionerId;
/** /**
* 发佣状态 暂不开放 可发 保留 已发并关账 * 发佣状态 0-作废 1-待来佣 2-可发 3-保留 4-已发并关账
*/ */
private Long commissionPayoutStatus; private Long commissionPayoutStatus;
......
...@@ -15,7 +15,7 @@ public class CommissionPayoutStatusUpdateRequestVO { ...@@ -15,7 +15,7 @@ public class CommissionPayoutStatusUpdateRequestVO {
/** /**
* 佣金发放状态 * 佣金发放状态
* 2.可发放 3.保留 * 0.作废 1.待来佣 2.可发放 3.保留
*/ */
private String paymentStatus; private String paymentStatus;
......
package com.yd.dal.mapper.agms; package com.yd.dal.mapper.agms;
import com.yd.dal.entity.agms.fortune.*; import com.yd.dal.entity.agms.fortune.*;
import com.yd.dal.entity.customer.AclCustomerFortune;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author xxy * @author xxy
...@@ -45,6 +45,5 @@ public interface AgmsFortuneMapper { ...@@ -45,6 +45,5 @@ public interface AgmsFortuneMapper {
*/ */
List<WithdrawLabelInfo> salaryPolicyNoDetails(@Param("item")WithdrawQueryInfo info); List<WithdrawLabelInfo> salaryPolicyNoDetails(@Param("item")WithdrawQueryInfo info);
List<Map<String, Object>> querySheet2Data(List<Long> fortuneIdList);
} }
package com.yd.dal.service.agms; package com.yd.dal.service.agms;
import com.yd.dal.entity.agms.fortune.*; import com.yd.dal.entity.agms.fortune.*;
import com.yd.dal.entity.agms.fortune.CommissionPayoutStatus;
import com.yd.dal.entity.agms.fortune.CommissionPayoutStatusQueryInfo;
import com.yd.dal.entity.agms.fortune.CustomerFortuneStatisticalInfo;
import com.yd.dal.entity.customer.AclCustomerFortune;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -49,4 +45,5 @@ public interface AgmsFortuneDALService { ...@@ -49,4 +45,5 @@ public interface AgmsFortuneDALService {
*/ */
List<WithdrawLabelInfo> salaryPolicyNoDetails(WithdrawQueryInfo info); List<WithdrawLabelInfo> salaryPolicyNoDetails(WithdrawQueryInfo info);
List<Map<String, Object>> querySheet2Data(List<Long> fortuneIdList);
} }
...@@ -72,4 +72,9 @@ public class AgmsFortuneDALServiceImpl implements AgmsFortuneDALService { ...@@ -72,4 +72,9 @@ public class AgmsFortuneDALServiceImpl implements AgmsFortuneDALService {
public List<WithdrawLabelInfo> salaryPolicyNoDetails(WithdrawQueryInfo info) { public List<WithdrawLabelInfo> salaryPolicyNoDetails(WithdrawQueryInfo info) {
return agmsFortuneMapper.salaryPolicyNoDetails(info); return agmsFortuneMapper.salaryPolicyNoDetails(info);
} }
@Override
public List<Map<String, Object>> querySheet2Data(List<Long> fortuneIdList) {
return agmsFortuneMapper.querySheet2Data(fortuneIdList);
}
} }
...@@ -13,6 +13,7 @@ import org.springframework.boot.CommandLineRunner; ...@@ -13,6 +13,7 @@ import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -261,6 +262,24 @@ public class SystemConfigService implements CommandLineRunner{ ...@@ -261,6 +262,24 @@ public class SystemConfigService implements CommandLineRunner{
return mdDropOption; return mdDropOption;
} }
public MdDropOptions getDropOptionInfo(String elementKey, String dropOptionId, String masterCode) {
if (CommonUtil.isNullOrBlank(elementKey) || CommonUtil.isNullOrBlank(masterCode) || CommonUtil.isNullOrBlank(dropOptionId)) {
return null;
}
ConcurrentHashMap<String, MdDropOptions> mdDropOptionsMap;
Element element = systemConfigCache.get(elementKey);
if (element != null && element.getObjectValue() != null) {
mdDropOptionsMap = (ConcurrentHashMap<String, MdDropOptions>) element.getObjectValue();
} else {
List<MdDropOptions> mdDropOptionsList = mdDropOptionsDALService.findByDropMasterCode(masterCode);
mdDropOptionsMap = new ConcurrentHashMap<>();
mdDropOptionsList.forEach(i -> mdDropOptionsMap.put(i.getId() + "", i));
element = new Element(elementKey, mdDropOptionsMap);
systemConfigCache.put(element);
}
return mdDropOptionsMap.get(dropOptionId);
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public List<MdPractitionerHiringApproveSteps> findHiringApproveStepsByPractitionerLevel(String practitionerLevelCode) { public List<MdPractitionerHiringApproveSteps> findHiringApproveStepsByPractitionerLevel(String practitionerLevelCode) {
List<MdPractitionerHiringApproveSteps> hiringApproveSteps = new ArrayList<>(); List<MdPractitionerHiringApproveSteps> hiringApproveSteps = new ArrayList<>();
......
...@@ -423,4 +423,113 @@ ...@@ -423,4 +423,113 @@
</select> </select>
<select id="querySheet2Data" resultType="java.util.LinkedHashMap">
select
pb.payout_yearmonth '0' /*对账月*/,
(select name from ag_acl_policyholder where order_id = f.order_id and type=2) '1',
o.policy_no '2',
i.name '3' /*保司*/,
o.order_price '4' ,
p.name '5' /*产品*/,
o.underwriting_date '6',
CONCAT(o.payment_term, (case o.payment_term_unit when 'Y' then '年' when 'M' then '月' else '日' END)) '7',
if(f.commission_period=1,f.fyc_rate,'') '8' /*'FYC%'*/,
if(f.order_id!=null, IFNULL(p.is_achievement_statistic,'100'), '') '9' /*'业绩折标率%'*/,
if(f.id=min(f.id),f.share_rate,'') '10' /*'分佣%'*/,
if(f.id=min(f.id),f.achievements_rate,'') '11' /*'业绩%'*/,
if(f.commission_period!=1,f.fyc_rate,'') '12' /*'RYC%'*/,
if(f.id=min(f.id),f.fyc_amount,'') '13'/*保单FYC*/,
if(f.id=min(f.id),f.referral_amount,'') '14' /*佣金FYC*/,
if(f.id=min(f.id),f.achievements,'') '15' /*业绩FYC*/,
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' /*渠道*/,
coalesce(l.s1_id,l.s2_id,l.s3_id) '19' /*FYC体系*/,
pra.name '20' /*销售经纪人*/,
ps.practitioner_level '21' /*经纪人职级*/,
if(f.id=min(f.id),f.grade_commission_rate,'') '22' /*职级率*/,
sum(case when drop_option_code ='C01' then f.referral_amount else '' end) '23' /*首年销售佣金*/,
sum(case when drop_option_code ='C02' then f.referral_amount else '' end) '24' /*续年销售佣金*/,
if(f.commission_period!=1,l.mentor_id,'') '25' /*续期辅导人*/,
if(f.commission_period!=1,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C06' and practitioner_id = l.mentor_id),
'') '26' /*续期辅导奖金率*/,
if(f.commission_period!=1,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C06' and practitioner_id = l.mentor_id),
'') '27' /*续期辅导奖*/,
sum(case when drop_option_code ='C04' then f.calculation_rate else '' end) '28' /*'经纪人月销售加码奖金%'*/,
sum(case when drop_option_code ='C04' then f.referral_amount else '' end) '29' /*经纪人月销售加码奖金*/,
l.introducer_id '30' /*推荐人*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C05' and practitioner_id = l.introducer_id) '31' /*个人推荐率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C05' and practitioner_id = l.introducer_id) '32' /*个人推荐奖¥*/,
sum(case when drop_option_code ='C15' then f.calculation_rate else '' end) '33' /*体系推荐率*/,
sum(case when drop_option_code ='C15' then f.referral_amount else '' end) '34' /*体系推荐奖金¥*/,
l.mentor_id '35' /*一代辅导人*/,
l.mentor_level '36' /*一代辅导人职级*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C06' and practitioner_id = l.mentor_id) '37' /*'一代辅导人职级岗位津贴%'*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C06' and practitioner_id = l.mentor_id) '38' /*一代辅导人岗位津贴*/,
l.in_mentor_id '39' /*二代辅导人*/,
l.in_mentor_level '40' /*二代辅导人职级*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C07' and practitioner_id = l.in_mentor_id) '41' /*'二代辅导人职级岗位津贴%'*/,
(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分部*/,
(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(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(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续期绩效奖金*/,
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(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(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续期绩效奖金*/,
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(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(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_level '61' /*育成人职级*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where drop_option_code ='C09' and order_id=f.order_id and practitioner_id = l.raise_id) '62' /*育成奖金率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where drop_option_code ='C09' and order_id=f.order_id and practitioner_id = l.raise_id) '63' /*育成金额*/,
sum(case when drop_option_code ='C14' then f.calculation_rate else '' end) '64' /*C14直接销售加码佣金率*/,
sum(case when drop_option_code ='C14' then f.referral_amount else '' end) '65' /*C14直接销售加码佣金*/,
if(o.settlement_rule_type=1,'简单基本法','标准基本法') '66' /*基本法属性*/,
sum(case when drop_option_code ='S01' then f.referral_amount else '' end) '67' /*S01-首年度销售佣金*/,
sum(case when drop_option_code ='S03' then f.referral_amount else '' end) '68' /*S03-首年度辅导奖金*/,
f.order_id,
f.practitioner_id
FROM ag_acl_customer_fortune f
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.id = f.practitioner_id
LEFT JOIN ag_acl_practitioner_setting ps on ps.practitioner_id = f.practitioner_id
LEFT JOIN ag_po_order o on o.id = f.order_id
LEFT JOIN ag_acl_insurer i on i.id = o.insurer_id
LEFT JOIN ag_product p on p.id = o.product_id
WHERE
f.id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item,jdbcType=BIGINT}
</foreach>
GROUP BY f.order_id, f.practitioner_id
</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