Commit acf55213 by wenyang Committed by akexiu

1.团队成员活动量得分排序【 1:天;2:周;3:月(不传默认2:周)】

2.团队业绩完成率统计根据该团队下经纪人设置的目标fyc计算
parent 461c5ad0
...@@ -3366,6 +3366,10 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -3366,6 +3366,10 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
// for(AclCustomer item : customerList){ // for(AclCustomer item : customerList){
// practitionerIdMobileNoMap.put(customerMap.get(item.getId()),item.getMobileNo()); // practitionerIdMobileNoMap.put(customerMap.get(item.getId()),item.getMobileNo());
// } // }
//6、查询该体系下经纪人设置的目标
List<AclCustomerFortuneStatistics> customerTarget = aclCustomerFortuneDALService.findTargetBypractitionerIds(practitionerIds, time);
Map<Long, AclCustomerFortuneStatistics> customerTargetMap = new HashMap<>();
customerTarget.forEach(i -> customerTargetMap.put(i.getPractitionerId(), i));
SubordinateSystemMemberInfo memberInfo; SubordinateSystemMemberInfo memberInfo;
Long practitionerIdForMember, practitionerLevelId; Long practitionerIdForMember, practitionerLevelId;
AclCustomerFortuneStatistics customerFortuneStatisticsItem; AclCustomerFortuneStatistics customerFortuneStatisticsItem;
...@@ -3387,6 +3391,9 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -3387,6 +3391,9 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
fyc = Double.valueOf(customerFortuneStatisticsItem.getFyc()); fyc = Double.valueOf(customerFortuneStatisticsItem.getFyc());
fyp = Double.valueOf(customerFortuneStatisticsItem.getFyp()); fyp = Double.valueOf(customerFortuneStatisticsItem.getFyp());
count = Integer.valueOf(customerFortuneStatisticsItem.getCount()); count = Integer.valueOf(customerFortuneStatisticsItem.getCount());
}
if (customerTargetMap.containsKey(practitionerIdForMember)) {
customerFortuneStatisticsItem = customerTargetMap.get(practitionerIdForMember);
targetFyc = Double.valueOf(customerFortuneStatisticsItem.getTargetFyc()); targetFyc = Double.valueOf(customerFortuneStatisticsItem.getTargetFyc());
targetFyp = Double.valueOf(customerFortuneStatisticsItem.getTargetFyp()); targetFyp = Double.valueOf(customerFortuneStatisticsItem.getTargetFyp());
targetCount = Integer.valueOf(customerFortuneStatisticsItem.getTargetCount()); targetCount = Integer.valueOf(customerFortuneStatisticsItem.getTargetCount());
......
...@@ -37,6 +37,8 @@ public interface AclCustomerFortuneMapper { ...@@ -37,6 +37,8 @@ public interface AclCustomerFortuneMapper {
List<AclCustomerFortuneStatistics> findBypractitionerIds(@Param("list")List<Long> practitionerIds, @Param("time")Integer time); List<AclCustomerFortuneStatistics> findBypractitionerIds(@Param("list")List<Long> practitionerIds, @Param("time")Integer time);
List<AclCustomerFortuneStatistics> findTargetBypractitionerIds(@Param("list")List<Long> practitionerIds, @Param("time")Integer time);
List<AclCustomerFortune> queryLifeFortuneListByOrderId(Long orderId); List<AclCustomerFortune> queryLifeFortuneListByOrderId(Long orderId);
List<AclCustomerFortune> queryLifeFortuneListByCommissionId(Long commissionId); List<AclCustomerFortune> queryLifeFortuneListByCommissionId(Long commissionId);
......
...@@ -28,6 +28,8 @@ public interface AclCustomerFortuneDALService { ...@@ -28,6 +28,8 @@ public interface AclCustomerFortuneDALService {
List<AclCustomerFortuneStatistics> findBypractitionerIds(List<Long> practitionerIds, Integer time); List<AclCustomerFortuneStatistics> findBypractitionerIds(List<Long> practitionerIds, Integer time);
List<AclCustomerFortuneStatistics> findTargetBypractitionerIds(List<Long> practitionerIds, Integer time);
List<AclCustomerFortune> queryLifeFortuneListByOrderId(Long orderId); List<AclCustomerFortune> queryLifeFortuneListByOrderId(Long orderId);
List<AclCustomerFortune> queryLifeFortuneListByCommissionId(Long commissionId); List<AclCustomerFortune> queryLifeFortuneListByCommissionId(Long commissionId);
......
...@@ -56,6 +56,11 @@ public class AclCustomerFortuneDALServiceImpl implements AclCustomerFortuneDALSe ...@@ -56,6 +56,11 @@ public class AclCustomerFortuneDALServiceImpl implements AclCustomerFortuneDALSe
} }
@Override @Override
public List<AclCustomerFortuneStatistics> findTargetBypractitionerIds(List<Long> practitionerIds, Integer time) {
return aclCustomerFortuneMapper.findTargetBypractitionerIds(practitionerIds, time);
}
@Override
public List<AclCustomerFortune> queryLifeFortuneListByOrderId(Long orderId) { public List<AclCustomerFortune> queryLifeFortuneListByOrderId(Long orderId) {
return aclCustomerFortuneMapper.queryLifeFortuneListByOrderId(orderId); return aclCustomerFortuneMapper.queryLifeFortuneListByOrderId(orderId);
} }
......
...@@ -978,52 +978,40 @@ ...@@ -978,52 +978,40 @@
ifnull(COUNT(f.id),0) count , ifnull(COUNT(f.id),0) count ,
ifnull(SUM(f.order_price),0) FYP , ifnull(SUM(f.order_price),0) FYP ,
ifnull(SUM(f.fyc_amount),0) FYC , ifnull(SUM(f.fyc_amount),0) FYC ,
s.practitioner_level practitionerLevelId, s.practitioner_level practitionerLevelId
(select ifnull(sum(t.commission),0) from ag_mkt_leads_goals t where t.practitioner_id=p.id and t.goals_type=1 and t.is_active=1 FROM
<choose> ((ag_acl_practitioner_setting s LEFT JOIN ag_acl_practitioner p ON s.practitioner_id = p.id)
<when test="time == 1"> INNER JOIN ag_acl_customer_fortune f ON f.customer_id = p.customer_id and f.drop_option_code in('S01','C01') )
and t.statistic_time_unit=3 INNER JOIN ag_po_order o ON f.order_id = o.id
and t.current_year=year(now()) WHERE
and t.seq_time=month(now()) o.status = 3 and o.payment_status = 3 and o.order_price &gt; 0
</when>
<when test="time == 3">
and t.statistic_time_unit=3
and t.current_year=year(now())
and quarter(concat(t.current_year,'-',t.seq_time,'-01'))=quarter(now())
</when>
<when test="time == 4">
and t.statistic_time_unit=1
and t.current_year=year(now())-1
</when>
<otherwise>
and t.statistic_time_unit=1
and t.current_year=year(now())
</otherwise>
</choose>
) targetFyc,
(select ifnull(sum(t.premium),0) from ag_mkt_leads_goals t where t.practitioner_id=p.id and t.goals_type=1 and t.is_active=1
<choose> <choose>
<when test="time == 1"> <when test="time == 1">
and t.statistic_time_unit=3 and DATE_FORMAT(f.order_date, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
and t.current_year=year(now())
and t.seq_time=month(now())
</when> </when>
<when test="time == 3"> <when test="time == 3">
and t.statistic_time_unit=3 and QUARTER(f.order_date) = QUARTER(NOW()) AND year(f.order_date)=year(now())
and t.current_year=year(now())
and quarter(concat(t.current_year,'-',t.seq_time,'-01'))=quarter(now())
</when> </when>
<when test="time == 4"> <when test="time == 4">
and t.statistic_time_unit=1 and YEAR(f.order_date) = YEAR(now())-1
and t.current_year=year(now())-1
</when> </when>
<otherwise> <otherwise>
and t.statistic_time_unit=1 and YEAR(f.order_date) = YEAR(now())
and t.current_year=year(now())
</otherwise> </otherwise>
</choose> </choose>
) targetFyp, and p.id in
(select ifnull(sum(t.pieces),0) from ag_mkt_leads_goals t where t.practitioner_id=p.id and t.goals_type=1 and t.is_active=1 <foreach collection="list" item="practitionerId" index="index" open="(" close=")" separator=",">
#{practitionerId,jdbcType=BIGINT}
</foreach>
GROUP BY f.customer_id
</select>
<select id="findTargetBypractitionerIds" resultType="com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics">
select ifnull(sum(t.commission),0) targetFyc,
ifnull(sum(t.premium),0) targetFyp,
ifnull(sum(t.pieces),0) targetCount,
t.practitioner_id practitionerId
from ag_mkt_leads_goals t where t.goals_type=1 and t.is_active=1
<choose> <choose>
<when test="time == 1"> <when test="time == 1">
and t.statistic_time_unit=3 and t.statistic_time_unit=3
...@@ -1044,32 +1032,11 @@ ...@@ -1044,32 +1032,11 @@
and t.current_year=year(now()) and t.current_year=year(now())
</otherwise> </otherwise>
</choose> </choose>
) targetCount and t.practitioner_id in
FROM
((ag_acl_practitioner_setting s LEFT JOIN ag_acl_practitioner p ON s.practitioner_id = p.id)
INNER JOIN ag_acl_customer_fortune f ON f.customer_id = p.customer_id and f.drop_option_code in('S01','C01') )
INNER JOIN ag_po_order o ON f.order_id = o.id
WHERE
o.status = 3 and o.payment_status = 3 and o.order_price &gt; 0
<choose>
<when test="time == 1">
and DATE_FORMAT(f.order_date, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
</when>
<when test="time == 3">
and QUARTER(f.order_date) = QUARTER(NOW()) AND year(f.order_date)=year(now())
</when>
<when test="time == 4">
and YEAR(f.order_date) = YEAR(now())-1
</when>
<otherwise>
and YEAR(f.order_date) = YEAR(now())
</otherwise>
</choose>
and p.id in
<foreach collection="list" item="practitionerId" index="index" open="(" close=")" separator=","> <foreach collection="list" item="practitionerId" index="index" open="(" close=")" separator=",">
#{practitionerId,jdbcType=BIGINT} #{practitionerId,jdbcType=BIGINT}
</foreach> </foreach>
GROUP BY f.customer_id group by t.practitioner_id
</select> </select>
<select id="queryLifeFortuneListByOrderId" resultMap="BaseResultMap"> <select id="queryLifeFortuneListByOrderId" resultMap="BaseResultMap">
......
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