Commit f58eea4f by jianan

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

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