Commit 4cff198b by jianan

dashboard-15

parent 0984dca7
......@@ -52,7 +52,7 @@ public class AgmsDashboardDALServiceImpl implements AgmsDashboardDALService {
} else {
// 新体系
List<Map<String, Object>> teamMapList = agmsDashboardDALService.queryTeamAllMap();
teamMapList= teamMapList.stream().filter((Map<String, Object> i) -> StringUtils.isBlank((String) i.get("teamMember"))).collect(Collectors.toList());
teamMapList= teamMapList.stream().filter((Map<String, Object> i) -> i.size()==2).collect(Collectors.toList());
statisticsPEPInfos = agmsDashboardMapper.statisticsPEPTeam(type, dropOptionId, teamMapList);
for (Map<String, Object> teamMap :teamMapList) {
......@@ -125,7 +125,7 @@ public class AgmsDashboardDALServiceImpl implements AgmsDashboardDALService {
} else {
// 新体系
List<Map<String, Object>> teamMapList = agmsDashboardDALService.queryTeamAllMap();
teamMapList = teamMapList.stream().filter((Map<String, Object> i) -> StringUtils.isBlank((String) i.get("teamMember"))).collect(Collectors.toList());
teamMapList= teamMapList.stream().filter((Map<String, Object> i) -> i.size()==2).collect(Collectors.toList());
return agmsDashboardMapper.statisticsOpportunityTeam(type, time, dropOptionId, teamMapList);
}
}
......@@ -137,7 +137,7 @@ public class AgmsDashboardDALServiceImpl implements AgmsDashboardDALService {
statisticsSalesInfos = agmsDashboardMapper.statisticsSalesYD(category, type,time);
} else {
List<Map<String, Object>> teamMapList = this.queryTeamAllMap();
teamMapList= teamMapList.stream().filter((Map<String, Object> i) -> i.size()==2).collect(Collectors.toList());
statisticsSalesInfos = agmsDashboardMapper.statisticsSalesTeam(category, time, teamMapList);
}
getUnitPremium(statisticsSalesInfos);
......
......@@ -68,7 +68,7 @@
and p.id in (#{item.teamMember})
</if>
</foreach>
order by scoreDay desc ,scoreWeek desc ,scoreMonth desc
</select>
<select id="statisticsOpportunity" resultType="com.yd.dal.entity.agms.dashboard.StatisticsOpportunityInfo">
......@@ -108,8 +108,8 @@
</choose>
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_acl_insurer_branch b on b.id = p.insurer_branch_id and b.is_active = 1
left join ag_acl_practitioner_subordinate_system s on s.id = p.subordinate_system_id and s.is_active = 1
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
......@@ -121,7 +121,6 @@
and a.id = tt.leads_assigned_id)
<choose>
<when test="type.equalsIgnoreCase('B')">
and p.insurer_branch_id is not null
group by p.insurer_branch_id
</when>
<when test="type.equalsIgnoreCase('T')">
......@@ -186,7 +185,7 @@
and p.id in (#{item.teamMember})
</if>
</foreach>
order by predictFYC desc ,predictFYP desc ,pieces desc ,opportunityNum desc
</select>
<select id="getPractitionerNums" resultType="java.util.Map">
......@@ -263,7 +262,8 @@
</when>
</choose>
from ag_acl_practitioner p
left join ag_po_order o on o.broker_customer_id = p.customer_id
INNER JOIN ag_acl_life_insurance_practitioner lip ON lip.practitioner_id= p.id
INNER JOIN ag_po_order o ON o.policy_no = lip.policy_no
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
where o.status = 3 and o.payment_status=3
......@@ -291,19 +291,45 @@
<foreach collection="list" item="item" index="index" separator=" union all " >
<if test="item.teamMember != null">
select
s.name as typeName,
s.id as typeId,
(select name from ag_acl_practitioner_subordinate_system where id=#{item.id}) as typeName,
#{item.id} as typeId,
(SELECT drop_option_code
from ag_acl_practitioner_setting b
from ag_acl_practitioner_subordinate_system s
LEFT JOIN ag_acl_practitioner_setting b on b.practitioner_id = s.owner_practitioner_id
LEFT JOIN ag_md_drop_options op1 ON op1.id = b.practitioner_level
where b.practitioner_id = p.id
where s.id=#{item.id}
) as level,
ifnull(sum(o.order_price),0) as fyp,
ifnull(sum(o.fyc_amount),0) as fyc,
ifnull(count(o.id),0) as pieces
<choose>
<when test="time.equalsIgnoreCase('D')">
ifnull(sum(case when to_days(o.underwriting_date)=to_days(now()) then o.order_price else 0 end), 0) fyp,
ifnull(sum(case when to_days(o.underwriting_date)=to_days(now()) then o.fyc_amount else 0 end), 0) fyc,
ifnull(sum(case when to_days(o.underwriting_date)=to_days(now()) then 1 else 0 end), 0) pieces
</when>
<when test="time.equalsIgnoreCase('W')">
ifnull(sum(case when YEARWEEK(date_format(o.underwriting_date, '%Y-%m-%d')) = YEARWEEK(now()) then o.order_price else 0 end), 0) fyp,
ifnull(sum(case when YEARWEEK(date_format(o.underwriting_date, '%Y-%m-%d')) = YEARWEEK(now()) then o.fyc_amount else 0 end), 0) fyc,
ifnull(sum(case when YEARWEEK(date_format(o.underwriting_date, '%Y-%m-%d')) = YEARWEEK(now()) then 1 else 0 end), 0) pieces
</when>
<when test="time.equalsIgnoreCase('M')">
ifnull(sum(case when date_format(o.underwriting_date, '%Y-%m') = date_format(now(), '%Y-%m') then o.order_price else 0 end), 0) fyp,
ifnull(sum(case when date_format(o.underwriting_date, '%Y-%m') = date_format(now(), '%Y-%m') then o.fyc_amount else 0 end), 0) fyc,
ifnull(sum(case when date_format(o.underwriting_date, '%Y-%m') = date_format(now(), '%Y-%m') then 1 else 0 end), 0) pieces
</when>
<when test="time.equalsIgnoreCase('Q')">
ifnull(sum(case when QUARTER(o.underwriting_date) = QUARTER(now()) and year(o.underwriting_date)=year(now()) then o.order_price else 0 end), 0) fyp,
ifnull(sum(case when QUARTER(o.underwriting_date) = QUARTER(now()) and year(o.underwriting_date)=year(now()) then o.fyc_amount else 0 end), 0) fyc,
ifnull(sum(case when QUARTER(o.underwriting_date) = QUARTER(now()) and year(o.underwriting_date)=year(now()) then 1 else 0 end), 0) pieces
</when>
<when test="time.equalsIgnoreCase('Y')">
ifnull(sum(case when YEAR(o.underwriting_date) = YEAR(now()) then o.order_price else 0 end), 0) fyp,
ifnull(sum(case when YEAR(o.underwriting_date) = YEAR(now()) then o.fyc_amount else 0 end), 0) fyc,
ifnull(sum(case when YEAR(o.underwriting_date) = YEAR(now()) then 1 else 0 end), 0) pieces
</when>
</choose>
from ag_acl_practitioner p
inner join ag_po_order o on o.broker_customer_id = p.customer_id
INNER JOIN ag_acl_life_insurance_practitioner lip ON lip.practitioner_id= p.id
INNER JOIN ag_po_order o ON o.policy_no = lip.policy_no
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
where o.status = 3 and o.payment_status=3
......@@ -316,26 +342,9 @@
and o.product_category_id not in (2,5,8)
</when>
</choose>
<choose>
<when test="time.equalsIgnoreCase('D')">
and TO_DAYS(o.underwriting_date) = TO_DAYS(now())
</when>
<when test="time.equalsIgnoreCase('W')">
and YEARWEEK(DATE_FORMAT(o.underwriting_date,'%Y-%m-%d')) = YEARWEEK(NOW())
</when>
<when test="time.equalsIgnoreCase('M')">
and DATE_FORMAT(o.underwriting_date, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
</when>
<when test="time.equalsIgnoreCase('Q')">
and QUARTER(o.underwriting_date) = QUARTER(NOW()) AND year(o.underwriting_date)=year(now())
</when>
<otherwise>
and YEAR(o.underwriting_date) = YEAR(now())
</otherwise>
</choose>
</if>
</foreach>
order by 4 desc
</select>
......@@ -393,8 +402,7 @@
WHERE p.is_active = 1
AND p.subordinate_system_id IS NOT NULL
GROUP BY p.subordinate_system_id
union all <include refid="statisticsPractitionerS2"/>
union all <include refid="statisticsPractitionerS3"/>
ORDER BY amount DESC
</otherwise>
</choose>
......@@ -420,7 +428,7 @@
and p.is_active = 1
</if>
</foreach>
ORDER BY amount DESC
</select>
<sql id="realAmount">
......@@ -598,7 +606,7 @@
(select group_concat(p.id)
from ag_acl_practitioner p
LEFT JOIN ag_acl_practitioner_subordinate_system ps ON p.s2_id = ps.id or p.subordinate_system_id = ps.id or p.s3_id = ps.id
LEFT JOIN ag_acl_practitioner_subordinate_system ps ON p.s2_id = ps.id or p.s1_id = ps.id or p.s3_id = ps.id
WHERE ps.id = s.id
and p.is_active=1
) as 'teamMember'
......
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