Commit 16393a09 by jianan

dashboard-12fengongsi

parent af5cda54
......@@ -25,4 +25,11 @@ public interface AgmsDashboardMapper {
List<StatisticsSalesInfo> statisticsSalesEG(@Param("type")String type, @Param("time")String time);
List<PersonalOffLineFYC> personalOffLineFYC(List<String> mobileNoList);
List<Map<String, String>> queryTeamAllMap();
List<StatisticsSalesInfo> statisticsSalesTeam(@Param("category")String category,
@Param("time")String time, @Param("list")List<Map<String, String>> teamMapList);
List<StatisticsPractitionerInfo> statisticsPractitionerTeam(@Param("time")String time, @Param("list")List<Map<String, String>> teamMapList);
}
......@@ -8,6 +8,7 @@ import com.yd.dal.entity.practitioner.PersonalOffLineFYC;
import com.yd.rmi.n22.salary.pojo.Achieve;
import java.util.List;
import java.util.Map;
public interface AgmsDashboardDALService {
List<StatisticsPEPInfo> statisticsPEP(String type,Long dropOptionId);
......@@ -32,4 +33,6 @@ public interface AgmsDashboardDALService {
* @return
*/
List<Achieve> queryN22FYC(Integer time, Integer isPersonal, String loginName);
List<Map<String, String>> queryTeamAllMap();
}
......@@ -100,7 +100,14 @@ public class AgmsDashboardDALServiceImpl implements AgmsDashboardDALService {
@Override
public List<StatisticsSalesInfo> statisticsSalesYD(String category, String type, String time) {
List<StatisticsSalesInfo> statisticsSalesInfos = agmsDashboardMapper.statisticsSalesYD(category, type,time);
List<StatisticsSalesInfo> statisticsSalesInfos = null;
if ("b".equalsIgnoreCase(type)) {
statisticsSalesInfos = agmsDashboardMapper.statisticsSalesYD(category, type,time);
} else {
List<Map<String, String>> teamMapList = this.queryTeamAllMap();
System.out.println(teamMapList);
statisticsSalesInfos = agmsDashboardMapper.statisticsSalesTeam(category, time, teamMapList);
}
getUnitPremium(statisticsSalesInfos);
return statisticsSalesInfos;
}
......@@ -159,8 +166,19 @@ public class AgmsDashboardDALServiceImpl implements AgmsDashboardDALService {
}
@Override
public List<Map<String, String>> queryTeamAllMap() {
return agmsDashboardMapper.queryTeamAllMap();
}
@Override
public List<StatisticsPractitionerInfo> statisticsPractitioner(String type, String time) {
List<StatisticsPractitionerInfo> statisticsPractitionerInfos = agmsDashboardMapper.statisticsPractitioner(type, time);
List<StatisticsPractitionerInfo> statisticsPractitionerInfos = null;
if ("b".equalsIgnoreCase(type)) {
statisticsPractitionerInfos = agmsDashboardMapper.statisticsPractitioner(type, time);
} else {
List<Map<String, String>> teamMapList = this.queryTeamAllMap();
statisticsPractitionerInfos = agmsDashboardMapper.statisticsPractitionerTeam(time, teamMapList);
}
//计算实动率
if(statisticsPractitionerInfos != null && statisticsPractitionerInfos.size() > 0){
Integer realAmount,amount;
......
......@@ -146,7 +146,7 @@
</otherwise>
</choose>
concat(ifnull(sum(o.order_price),0),'') as fyp,
concat(ifnull(sum(o.commission_amount),0),'') as fyc,
concat(ifnull(sum(o.fyc_amount),0),'') as fyc,
ifnull(count(o.id),0) as pieces
from ag_acl_practitioner p
inner join ag_po_order o on o.broker_customer_id = p.customer_id
......@@ -180,7 +180,6 @@
</choose>
<choose>
<when test="type.equalsIgnoreCase('B')">
and p.insurer_branch_id is not null
group by p.insurer_branch_id
</when>
<otherwise>
......@@ -191,6 +190,57 @@
order by 4 desc
</select>
<select id="statisticsSalesTeam" resultType="com.yd.api.agms.vo.dashboard.StatisticsSalesInfo">
<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 drop_option_code
from ag_acl_practitioner_setting b
LEFT JOIN ag_md_drop_options op1 ON op1.id = b.practitioner_level
where b.practitioner_id = p.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
from ag_acl_practitioner p
inner join ag_po_order o on o.broker_customer_id = p.customer_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
where o.status = 3 and o.payment_status=3
and p.id in (#{item.teamMember})
<choose>
<when test="category.equalsIgnoreCase('life')">
and o.product_category_id in (2,5,8)
</when>
<when test="category.equalsIgnoreCase('pc')">
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>
<select id="statisticsPractitioner" resultType="com.yd.api.agms.vo.dashboard.StatisticsPractitionerInfo">
<choose>
......@@ -253,6 +303,57 @@
</choose>
</select>
<select id="statisticsPractitionerTeam" resultType="com.yd.api.agms.vo.dashboard.StatisticsPractitionerInfo">
<foreach collection="list" item="item" index="index" separator=" union all " >
<if test="item.teamMember != null">
SELECT
#{item.id} as typeId,
(select name from ag_acl_practitioner_subordinate_system where id=#{item.id}) as typeName,
ifnull( count( p.id ), 0 ) AS amount,
<include refid="realAmount"/> AS realAmount,
<include refid="statisticsPractitionerHiring"/> AS hiringAmount,
sum(case when p.cert_list LIKE "%1%" then 1 else 0 end) AS mdrt
FROM
ag_acl_practitioner p
left join ag_acl_practitioner_hiring_approve_records hr on hr.hiring_basic_info_id=p.hiring_basic_info_id
and hr.approve_step_id=5 and hr.approving_status=1
WHERE 1=1
and p.id in (#{item.teamMember})
and p.is_active = 1
</if>
</foreach>
ORDER BY amount DESC
</select>
<sql id="realAmount">
(SELECT
count( DISTINCT o.broker_customer_id )
FROM
ag_acl_customer_fortune f
left JOIN ag_po_order o ON f.order_id = o.id and o.STATUS = 3 AND o.payment_status = 3
left JOIN ag_acl_practitioner p ON o.broker_customer_id = p.customer_id
WHERE 1=1
<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>
)
</sql>
<sql id="statisticsPractitionerS2">
SELECT
s.id as typeId,
......@@ -395,4 +496,18 @@
group by sales.SAL_MST_MOBILE
</select>
<select id="queryTeamAllMap" resultType="MAP">
select s.id,
(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
WHERE ps.id = s.id
and p.is_active=1
) as 'teamMember'
from ag_acl_practitioner_subordinate_system s
WHERE s.is_active=1
</select>
</mapper>
\ No newline at end of file
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