Commit f58eea4f by jianan

团队经纪人报聘,PEP得分,寿险经纪人商机预测缺2

parent 0de6b3be
...@@ -122,6 +122,7 @@ public class AgmsDashboardDALServiceImpl implements AgmsDashboardDALService { ...@@ -122,6 +122,7 @@ public class AgmsDashboardDALServiceImpl implements AgmsDashboardDALService {
} else { } else {
// 新体系 // 新体系
List<Map<String, Object>> teamMapList = agmsDashboardDALService.queryTeamAllMap(); List<Map<String, Object>> teamMapList = agmsDashboardDALService.queryTeamAllMap();
teamMapList= teamMapList.stream().filter((Map<String, Object> i) -> i.size()==2).collect(Collectors.toList()); teamMapList= teamMapList.stream().filter((Map<String, Object> i) -> i.size()==2).collect(Collectors.toList());
return agmsDashboardMapper.statisticsOpportunityTeam(type, time, dropOptionId, teamMapList); return agmsDashboardMapper.statisticsOpportunityTeam(type, time, dropOptionId, teamMapList);
} }
......
...@@ -15,18 +15,16 @@ ...@@ -15,18 +15,16 @@
ifnull(sum(case when YEAR(t.track_time)=YEAR(now()) then t.track_score else 0 end), 0) scoreYear, ifnull(sum(case when YEAR(t.track_time)=YEAR(now()) then t.track_score else 0 end), 0) scoreYear,
ifnull(sum(case when t.track_score is not null then t.track_score else 0 end), 0) scoreTotal ifnull(sum(case when t.track_score is not null then t.track_score else 0 end), 0) scoreTotal
from ag_acl_practitioner p from ag_acl_practitioner p
left join ag_mkt_leads_assigneds a on p.id = a.assigned_practitioner_id and a.is_active = 1 left join ag_mkt_schedule_task_tracking t on t.practitioner_id = p.id
left join ag_mkt_leads_assigned_track t on t.leads_assigned_id = a.id
left join ag_acl_insurer_branch b on b.id = p.insurer_branch_id left join ag_acl_insurer_branch b on b.id = p.insurer_branch_id
left join ag_acl_practitioner_subordinate_system s on s.id = p.subordinate_system_id left join ag_acl_practitioner_subordinate_system s on s.id = p.subordinate_system_id
left join ag_acl_practitioner_setting ps on ps.practitioner_id = p.id left join ag_acl_practitioner_setting ps on ps.practitioner_id = p.id
where ps.practitioner_type_id = 28 where ps.practitioner_type_id = 28
and p.is_active = 1 and p.is_active = 1
and not EXISTS( and t.md_drop_option_id not in
select tt.leads_assigned_id (SELECT o.id FROM ag_md_drop_options o LEFT JOIN ag_md_drop_master m ON m.id = o.drop_master_id
from ag_mkt_leads_assigned_track tt WHERE m.scenario_code = 'pep_schedule_task_others')
where tt.md_drop_option_id = #{dropOptionId,jdbcType=BIGINT}
and a.id = tt.leads_assigned_id)
<choose> <choose>
<when test="type.equalsIgnoreCase('B')"> <when test="type.equalsIgnoreCase('B')">
group by p.insurer_branch_id group by p.insurer_branch_id
...@@ -52,18 +50,17 @@ ...@@ -52,18 +50,17 @@
ifnull(sum(case when YEAR(t.track_time)=YEAR(now()) then t.track_score else 0 end), 0) scoreYear, ifnull(sum(case when YEAR(t.track_time)=YEAR(now()) then t.track_score else 0 end), 0) scoreYear,
ifnull(sum(case when t.track_score is not null then t.track_score else 0 end), 0) scoreTotal ifnull(sum(case when t.track_score is not null then t.track_score else 0 end), 0) scoreTotal
from ag_acl_practitioner p from ag_acl_practitioner p
left join ag_mkt_leads_assigneds a on p.id = a.assigned_practitioner_id and a.is_active = 1 left join ag_mkt_schedule_task_tracking t on t.practitioner_id = p.id
left join ag_mkt_leads_assigned_track t on t.leads_assigned_id = a.id
left join ag_acl_insurer_branch b on b.id = p.insurer_branch_id left join ag_acl_insurer_branch b on b.id = p.insurer_branch_id
left join ag_acl_practitioner_subordinate_system s on s.id = p.subordinate_system_id left join ag_acl_practitioner_subordinate_system s on s.id = p.subordinate_system_id
left join ag_acl_practitioner_setting ps on ps.practitioner_id = p.id left join ag_acl_practitioner_setting ps on ps.practitioner_id = p.id
where ps.practitioner_type_id = 28 where ps.practitioner_type_id = 28
and p.is_active = 1 and p.is_active = 1
and not EXISTS( -- and t.md_drop_option_id not in
select tt.leads_assigned_id -- (SELECT o.id FROM ag_md_drop_options o LEFT JOIN ag_md_drop_master m ON m.id = o.drop_master_id
from ag_mkt_leads_assigned_track tt -- WHERE m.scenario_code = 'pep_schedule_task_others')
where tt.md_drop_option_id = #{dropOptionId,jdbcType=BIGINT}
and a.id = tt.leads_assigned_id)
and p.id in <foreach collection="item.teamMember" item="p_id" open="(" separator="," close=")">#{p_id,jdbcType=BIGINT}</foreach> and p.id in <foreach collection="item.teamMember" item="p_id" open="(" separator="," close=")">#{p_id,jdbcType=BIGINT}</foreach>
</if> </if>
...@@ -193,34 +190,34 @@ ...@@ -193,34 +190,34 @@
(select name from ag_acl_practitioner_subordinate_system where id=#{item.id}) as subordinateName, (select name from ag_acl_practitioner_subordinate_system where id=#{item.id}) as subordinateName,
<choose> <choose>
<when test="time.equalsIgnoreCase('D')"> <when test="time.equalsIgnoreCase('D')">
sum(case when to_days(a.created_at)=to_days(now()) then 1 else 0 end) opportunityNum, ifnull(sum(case when to_days(a.created_at)=to_days(now()) then 1 else 0 end), 0) opportunityNum,
sum(case when to_days(a.time_to_close)=to_days(now()) then a.FYP else 0 end) predictFYP, ifnull(sum(case when to_days(a.time_to_close)=to_days(now()) then a.FYP else 0 end), 0) predictFYP,
sum(case when to_days(a.time_to_close)=to_days(now()) then a.FYC else 0 end) predictFYC, ifnull(sum(case when to_days(a.time_to_close)=to_days(now()) then a.FYC else 0 end), 0) predictFYC,
sum(case when to_days(a.time_to_close)=to_days(now()) then a.pieces else 0 end) pieces ifnull(sum(case when to_days(a.time_to_close)=to_days(now()) then a.pieces else 0 end), 0) pieces
</when> </when>
<when test="time.equalsIgnoreCase('W')"> <when test="time.equalsIgnoreCase('W')">
sum(case when YEARWEEK(date_format(a.created_at, '%Y-%m-%d'))=YEARWEEK(now()) then 1 else 0 end) opportunityNum, ifnull(sum(case when YEARWEEK(date_format(a.created_at, '%Y-%m-%d'))=YEARWEEK(now()) then 1 else 0 end), 0) opportunityNum,
sum(case when YEARWEEK(date_format(a.time_to_close, '%Y-%m-%d')) = YEARWEEK(now()) then a.FYP else 0 end) predictFYP, ifnull(sum(case when YEARWEEK(date_format(a.time_to_close, '%Y-%m-%d')) = YEARWEEK(now()) then a.FYP else 0 end), 0) predictFYP,
sum(case when YEARWEEK(date_format(a.time_to_close, '%Y-%m-%d')) = YEARWEEK(now()) then a.FYC else 0 end) predictFYC, ifnull(sum(case when YEARWEEK(date_format(a.time_to_close, '%Y-%m-%d')) = YEARWEEK(now()) then a.FYC else 0 end), 0) predictFYC,
sum(case when YEARWEEK(date_format(a.time_to_close, '%Y-%m-%d')) = YEARWEEK(now()) then a.pieces else 0 end) pieces ifnull(sum(case when YEARWEEK(date_format(a.time_to_close, '%Y-%m-%d')) = YEARWEEK(now()) then a.pieces else 0 end), 0) pieces
</when> </when>
<when test="time.equalsIgnoreCase('M')"> <when test="time.equalsIgnoreCase('M')">
sum(case when date_format(a.created_at, '%Y-%m') = date_format(now(), '%Y-%m') then 1 else 0 end) opportunityNum, ifnull(sum(case when date_format(a.created_at, '%Y-%m') = date_format(now(), '%Y-%m') then 1 else 0 end), 0) opportunityNum,
sum(case when date_format(a.time_to_close, '%Y-%m') = date_format(now(), '%Y-%m') then a.FYP else 0 end) predictFYP, ifnull(sum(case when date_format(a.time_to_close, '%Y-%m') = date_format(now(), '%Y-%m') then a.FYP else 0 end), 0) predictFYP,
sum(case when date_format(a.time_to_close, '%Y-%m') = date_format(now(), '%Y-%m') then a.FYC else 0 end) predictFYC, ifnull(sum(case when date_format(a.time_to_close, '%Y-%m') = date_format(now(), '%Y-%m') then a.FYC else 0 end), 0) predictFYC,
sum(case when date_format(a.time_to_close, '%Y-%m') = date_format(now(), '%Y-%m') then a.pieces else 0 end) pieces ifnull(sum(case when date_format(a.time_to_close, '%Y-%m') = date_format(now(), '%Y-%m') then a.pieces else 0 end), 0) pieces
</when> </when>
<when test="time.equalsIgnoreCase('Q')"> <when test="time.equalsIgnoreCase('Q')">
sum(case when QUARTER(a.created_at)=QUARTER(now()) then 1 else 0 end) opportunityNum, ifnull(sum(case when QUARTER(a.created_at)=QUARTER(now()) then 1 else 0 end), 0) opportunityNum,
sum(case when QUARTER(a.time_to_close) = QUARTER(now()) then a.FYP else 0 end) predictFYP, ifnull(sum(case when QUARTER(a.time_to_close) = QUARTER(now()) then a.FYP else 0 end), 0) predictFYP,
sum(case when QUARTER(a.time_to_close) = QUARTER(now()) then a.FYC else 0 end) predictFYC, ifnull(sum(case when QUARTER(a.time_to_close) = QUARTER(now()) then a.FYC else 0 end), 0) predictFYC,
sum(case when QUARTER(a.time_to_close) = QUARTER(now()) then a.pieces else 0 end) pieces ifnull(sum(case when QUARTER(a.time_to_close) = QUARTER(now()) then a.pieces else 0 end), 0) pieces
</when> </when>
<when test="time.equalsIgnoreCase('Y')"> <when test="time.equalsIgnoreCase('Y')">
sum(case when YEAR(a.created_at)=YEAR(now()) then 1 else 0 end) opportunityNum, ifnull(sum(case when YEAR(a.created_at)=YEAR(now()) then 1 else 0 end), 0) opportunityNum,
sum(case when YEAR(a.time_to_close) = YEAR(now()) then a.FYP else 0 end) predictFYP, ifnull(sum(case when YEAR(a.time_to_close) = YEAR(now()) then a.FYP else 0 end), 0) predictFYP,
sum(case when YEAR(a.time_to_close) = YEAR(now()) then a.FYC else 0 end) predictFYC, ifnull(sum(case when YEAR(a.time_to_close) = YEAR(now()) then a.FYC else 0 end), 0) predictFYC,
sum(case when YEAR(a.time_to_close) = YEAR(now()) then a.pieces else 0 end) pieces ifnull(sum(case when YEAR(a.time_to_close) = YEAR(now()) then a.pieces else 0 end), 0) pieces
</when> </when>
</choose> </choose>
from ag_acl_practitioner p from ag_acl_practitioner p
......
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