Commit 000dabd2 by jianan

战队业绩和战队业绩预测加显示被辅导人

parent 386189f1
...@@ -16,6 +16,8 @@ import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberQueryReques ...@@ -16,6 +16,8 @@ import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberQueryReques
import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberQueryResponseVO; import com.yd.api.practitioner.vo.subordinate.SubordinateSystemMemberQueryResponseVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
@Service("practitionerService") @Service("practitionerService")
public interface PractitionerService { public interface PractitionerService {
...@@ -216,4 +218,11 @@ public interface PractitionerService { ...@@ -216,4 +218,11 @@ public interface PractitionerService {
* @return 响应信息 * @return 响应信息
*/ */
ApplyForExpertSupportResponseVO applyForExpertSupport(ApplyForExpertSupportRequestVO requestVO); ApplyForExpertSupportResponseVO applyForExpertSupport(ApplyForExpertSupportRequestVO requestVO);
/**
* 经纪人-查看自己团队所有成员或自己所有被辅导人经纪人Id
* @param practitionerId
* @return
*/
List<Long> getPractitionerIdList(Long practitionerId);
} }
...@@ -80,6 +80,7 @@ import java.util.*; ...@@ -80,6 +80,7 @@ import java.util.*;
import java.util.List; import java.util.List;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import java.util.stream.Collectors;
@Service("practitionerService") @Service("practitionerService")
public class PractitionerServiceImpl implements com.yd.api.practitioner.service.PractitionerService { public class PractitionerServiceImpl implements com.yd.api.practitioner.service.PractitionerService {
...@@ -1805,18 +1806,9 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -1805,18 +1806,9 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
TeamActionsAverageQueryResponseVO responseVO = new TeamActionsAverageQueryResponseVO(); TeamActionsAverageQueryResponseVO responseVO = new TeamActionsAverageQueryResponseVO();
Long practitionerId = requestVO.getPractitionerId(); Long practitionerId = requestVO.getPractitionerId();
//该团队长下团队所有经纪人信息 //该团队长下团队所有经纪人信息
List<AclPractitioner> aclPractitioners = aclPractitionerDALService.findForSubordinateIdByPractitionerId(practitionerId); List<Long> practitionerIds = this.getPractitionerIdList(practitionerId);
//团队经纪人个数 //团队经纪人个数
BigDecimal practitionerNum = BigDecimal.valueOf(aclPractitioners.size()); BigDecimal practitionerNum = BigDecimal.valueOf(practitionerIds.size());
List<Long> practitionerIds = new ArrayList<>();
if (aclPractitioners.isEmpty()){
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return responseVO;
}
for (AclPractitioner info : aclPractitioners){
practitionerIds.add(info.getId());
}
//查询此团队经纪人所有得跟进状态 //查询此团队经纪人所有得跟进状态
List<MdDropOptions> mdDropOptions = mdDropOptionsDALService.findByDropMasterCode("bizchance_promotion_action"); List<MdDropOptions> mdDropOptions = mdDropOptionsDALService.findByDropMasterCode("bizchance_promotion_action");
...@@ -1871,6 +1863,26 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -1871,6 +1863,26 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000"))); responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return responseVO; return responseVO;
} }
@Override
public List<Long> getPractitionerIdList(Long practitionerId) {
List<Long> practitionerIdList = new ArrayList<>();
practitionerIdList.add(practitionerId);
// 判断当前经纪人是否为团队长
int count = aclPractitionerDALService.isTeamLeader(practitionerId);
if (count > 0) {
List<Long> practitionerIdList1 = aclPractitionerDALService.queryTeamAllPractitionerId(practitionerId);
practitionerIdList.addAll(practitionerIdList1);
} else {
List<Long> practitionerIdList2 = aclPractitionerDALService.queryMentoredByPractitionerId(practitionerId);
practitionerIdList.addAll(practitionerIdList2);
}
practitionerIdList = practitionerIdList.stream().distinct().collect(Collectors.toList());
return practitionerIdList;
}
@Override @Override
public PotentialGoalsActionsQueryResponseVO potentialGoalsActionsQuery(PotentialGoalsActionsQueryRequestVO requestVO) { public PotentialGoalsActionsQueryResponseVO potentialGoalsActionsQuery(PotentialGoalsActionsQueryRequestVO requestVO) {
PotentialGoalsActionsQueryResponseVO responseVO = new PotentialGoalsActionsQueryResponseVO(); PotentialGoalsActionsQueryResponseVO responseVO = new PotentialGoalsActionsQueryResponseVO();
...@@ -1967,7 +1979,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -1967,7 +1979,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
List<SalesPerformanceForecastInfo> infos = new ArrayList<>(); List<SalesPerformanceForecastInfo> infos = new ArrayList<>();
//通过团队长经纪人id,查询此团队所有经纪人id //通过团队长经纪人id,查询此团队所有经纪人id
Long practitionerId = requestVO.getPractitionerId(); Long practitionerId = requestVO.getPractitionerId();
List<AclPractitioner> practitioners = aclPractitionerDALService.findForSubordinateIdByPractitionerId(practitionerId); List<AclPractitioner> practitioners = aclPractitionerDALService.findByIds(this.getPractitionerIdList(practitionerId));
if (practitioners.isEmpty()){ if (practitioners.isEmpty()){
responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000"))); responseVO.setCommonResult(new CommonResult(true, ZHBErrorConfig.getErrorInfo("800000")));
return responseVO; return responseVO;
...@@ -2387,9 +2399,9 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -2387,9 +2399,9 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
SubordinateSystemStatisticInfo statisticInfo = new SubordinateSystemStatisticInfo(); SubordinateSystemStatisticInfo statisticInfo = new SubordinateSystemStatisticInfo();
Map<String,SubordinateSystemMemberInfo> memberInfoMap = new HashMap<>(); Map<String,SubordinateSystemMemberInfo> memberInfoMap = new HashMap<>();
//银盾保险在线 //银盾保险在线
getMemberInfoForOnLine(memberInfoMap,subordinateSystemId,time); getMemberInfoForOnLine(memberInfoMap,practitionerId,time);
//eGolden //eGolden
getMemberInfoForEGolden(memberInfoMap,mobileNo,time); getMemberInfoForEGolden(memberInfoMap,practitionerId,time);
//查询出来的结果按照fyp进行排序 //查询出来的结果按照fyp进行排序
List<SubordinateSystemMemberInfo> memberInfoList = new ArrayList<>(memberInfoMap.values()); List<SubordinateSystemMemberInfo> memberInfoList = new ArrayList<>(memberInfoMap.values());
memberInfoList.sort(Comparator.comparingDouble(SubordinateSystemMemberInfo::getFyp)); memberInfoList.sort(Comparator.comparingDouble(SubordinateSystemMemberInfo::getFyp));
...@@ -2403,8 +2415,12 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -2403,8 +2415,12 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
statisticInfo.setFyc(CommonUtil.doubleFormat(fycSum,2)); statisticInfo.setFyc(CommonUtil.doubleFormat(fycSum,2));
statisticInfo.setFyp(CommonUtil.doubleFormat(fypSum,2)); statisticInfo.setFyp(CommonUtil.doubleFormat(fypSum,2));
statisticInfo.setCompletionRate(getCompletionRate(null,subordinateSystemId,fycSum,time)); // 判断当前经纪人是否为团队长
responseVO.setId(subordinateSystemId); int count = aclPractitionerDALService.isTeamLeader(practitionerId);
if (count > 0) {
statisticInfo.setCompletionRate(getCompletionRate(null,subordinateSystemId,fycSum,time));
responseVO.setId(subordinateSystemId);
}
responseVO.setSubordinateSystemName(subordinateSystem.getName()); responseVO.setSubordinateSystemName(subordinateSystem.getName());
responseVO.setContactName(subordinateSystem.getContactName()); responseVO.setContactName(subordinateSystem.getContactName());
responseVO.setContactNo(subordinateSystem.getContactNo()); responseVO.setContactNo(subordinateSystem.getContactNo());
...@@ -2423,6 +2439,49 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -2423,6 +2439,49 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
} }
/** /**
* EGolden中的体系成员成员或被辅导人信息
* @param memberInfoMap
* @param practitionerId
* @param time
*/
private void getMemberInfoForEGolden(Map<String, SubordinateSystemMemberInfo> memberInfoMap, Long practitionerId, Integer time) {
List<AclPractitioner> practitionerList = aclPractitionerDALService.findByIds(this.getPractitionerIdList(practitionerId));
List<String> mobileNoList = new ArrayList<>();
for(AclPractitioner item : practitionerList){
mobileNoList.add(item.getMobileNo());
}
System.out.println("看看手机号");
System.out.println(mobileNoList);
List<SubordinateSystemMemberInfoE> subordinateSystemMemberInfoEList = aclPractitionerSubordinateSystemDALService.findStatisticsEBymobileList(mobileNoList, time);
System.out.println("看看根据手机号查询的EGolden");
System.out.println(subordinateSystemMemberInfoEList);
if(!subordinateSystemMemberInfoEList.isEmpty()){
String mobileNoForMember;
SubordinateSystemMemberInfo memberInfo;
Double fyp, fyc;
Integer count;
//4、根据id查询出所有的成员的fyc和fyp
for(SubordinateSystemMemberInfoE item : subordinateSystemMemberInfoEList){
mobileNoForMember = getMobileNo(item.getMobileNo());
if(memberInfoMap.containsKey(mobileNoForMember)){
memberInfo = memberInfoMap.get(mobileNoForMember);
fyp = memberInfo.getFyp();
fyc = memberInfo.getFyc();
count = memberInfo.getCount();
memberInfo.setFyc(CommonUtil.doubleFormat(fyc + item.getFyc(),2));
memberInfo.setFyp(CommonUtil.doubleFormat(fyp + item.getFyp(),2));
memberInfo.setCount(count + item.getCount());
}else{
memberInfo = new SubordinateSystemMemberInfo();
BeanUtils.copyProperties(item,memberInfo);
memberInfoMap.put(mobileNoForMember,memberInfo);
}
}
}
}
/**
* EGolden体系中的成员信息 * EGolden体系中的成员信息
* @param memberInfoMap 成员类型 * @param memberInfoMap 成员类型
* @param mobileNo 团队长手机号码 * @param mobileNo 团队长手机号码
...@@ -2491,9 +2550,9 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -2491,9 +2550,9 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
* @param subordinateSystemId 体系id * @param subordinateSystemId 体系id
* @param time 时间 * @param time 时间
*/ */
private void getMemberInfoForOnLine(Map<String,SubordinateSystemMemberInfo> memberInfoMap, Long subordinateSystemId,Integer time) { private void getMemberInfoForOnLine(Map<String,SubordinateSystemMemberInfo> memberInfoMap, Long practitionerId, Integer time) {
//1、查询该团队长所在体系的所有成员 //1、查询该团队长所在体系的所有成员
List<AclPractitioner> practitionerList = aclPractitionerDALService.findBySubordinateSystemId(subordinateSystemId); List<AclPractitioner> practitionerList = aclPractitionerDALService.findByIds(this.getPractitionerIdList(practitionerId));
if(!practitionerList.isEmpty() && practitionerList.get(0) != null){ if(!practitionerList.isEmpty() && practitionerList.get(0) != null){
Map<Long,Long> customerMap = new HashMap<>(); Map<Long,Long> customerMap = new HashMap<>();
Map<Long,String> practitionerIdMobileNoMap = new HashMap<>(); Map<Long,String> practitionerIdMobileNoMap = new HashMap<>();
...@@ -2505,7 +2564,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -2505,7 +2564,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
customerMap.put(item.getCustomerId(),item.getId()); customerMap.put(item.getCustomerId(),item.getId());
} }
//2、查询该体系下经纪人的财富订单统计 //2、查询该体系下经纪人的财富订单统计
List<AclCustomerFortuneStatistics> customerFortuneStatistics = aclCustomerFortuneDALService.findBySubordinateSystemStatistics(subordinateSystemId,time); List<AclCustomerFortuneStatistics> customerFortuneStatistics = aclCustomerFortuneDALService.findBypractitionerIds(practitionerIds, time);
Map<Long,AclCustomerFortuneStatistics> customerFortuneStatisticsMap = new HashMap<>(); Map<Long,AclCustomerFortuneStatistics> customerFortuneStatisticsMap = new HashMap<>();
customerFortuneStatistics.forEach(i->customerFortuneStatisticsMap.put(i.getPractitionerId(),i)); customerFortuneStatistics.forEach(i->customerFortuneStatisticsMap.put(i.getPractitionerId(),i));
//3、获取所有成员的级别 //3、获取所有成员的级别
......
package com.yd.api.practitioner.service.impl; package com.yd.api.practitioner.service.impl;
import com.yd.api.practitioner.service.PractitionerService;
import com.yd.api.practitioner.service.ScheduleTrackService; import com.yd.api.practitioner.service.ScheduleTrackService;
import com.yd.api.practitioner.vo.sechedule.*; import com.yd.api.practitioner.vo.sechedule.*;
import com.yd.api.result.CommonResult; import com.yd.api.result.CommonResult;
...@@ -16,7 +17,6 @@ import com.yd.dal.service.marketing.MktLeadsAssignedTrackDALService; ...@@ -16,7 +17,6 @@ import com.yd.dal.service.marketing.MktLeadsAssignedTrackDALService;
import com.yd.dal.service.meta.MdDropOptionsDALService; import com.yd.dal.service.meta.MdDropOptionsDALService;
import com.yd.util.CommonUtil; import com.yd.util.CommonUtil;
import com.yd.util.config.ZHBErrorConfig; import com.yd.util.config.ZHBErrorConfig;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -24,6 +24,7 @@ import org.springframework.stereotype.Service; ...@@ -24,6 +24,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@Service @Service
public class ScheduleTrackServiceImpl implements ScheduleTrackService { public class ScheduleTrackServiceImpl implements ScheduleTrackService {
...@@ -39,6 +40,8 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService { ...@@ -39,6 +40,8 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
private AgmsDashboardDALService agmsDashboardDALService; private AgmsDashboardDALService agmsDashboardDALService;
@Autowired @Autowired
private AclPractitionerPotentialMapper aclPractitionerPotentialMapper; private AclPractitionerPotentialMapper aclPractitionerPotentialMapper;
@Autowired
private PractitionerService practitionerService;
@Override @Override
public AddScheduleTrackResponseVO insert(AddScheduleTrackRequestVO requestVO) { public AddScheduleTrackResponseVO insert(AddScheduleTrackRequestVO requestVO) {
...@@ -293,8 +296,8 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService { ...@@ -293,8 +296,8 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
cal2.set(Calendar.SECOND, 0); cal2.set(Calendar.SECOND, 0);
Date weekOne = cal2.getTime(); Date weekOne = cal2.getTime();
// 获取团队成员被辅导人的practitionerId // 获取团队成员被辅导人的practitionerId
List<Long> practitionerIdList = this.getPractitionerIdList(practitionerId); List<Long> practitionerIdList = practitionerService.getPractitionerIdList(practitionerId);
// 根据团队长经纪人id查询团队每个成员本日,本周,本月得分以及---线上本月FYC // 根据团队长经纪人id查询团队每个成员本日,本周,本月得分以及---线上本月FYC
List<PersonalPEPScore> saleAndRecuit = scheduleTrackMapper.querySaleRecuitScoreFYC(practitionerIdList); List<PersonalPEPScore> saleAndRecuit = scheduleTrackMapper.querySaleRecuitScoreFYC(practitionerIdList);
...@@ -331,18 +334,6 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService { ...@@ -331,18 +334,6 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
return resp; return resp;
} }
private List<Long> getPractitionerIdList(Long practitionerId) {
List<Long> practitionerIdList1 = scheduleTrackMapper.queryMentoredByPractitionerId(practitionerId);
// 判断当前经纪人是否为团队长
int count = scheduleTrackMapper.isTeamLeader(practitionerId);
if (count > 0) {
List<Long> practitionerIdList2 = scheduleTrackMapper.queryTeamAllPractitionerId(practitionerId);
practitionerIdList1.addAll(practitionerIdList2);
}
return practitionerIdList1;
}
private void computeTotalFYC(List<PersonalPEPScore> saleAndRecuit, List<PersonalOffLineFYC> personalOffLineFYCList) { private void computeTotalFYC(List<PersonalPEPScore> saleAndRecuit, List<PersonalOffLineFYC> personalOffLineFYCList) {
for (PersonalPEPScore online: saleAndRecuit ) { for (PersonalPEPScore online: saleAndRecuit ) {
for (PersonalOffLineFYC offline: personalOffLineFYCList) { for (PersonalOffLineFYC offline: personalOffLineFYCList) {
...@@ -622,6 +613,4 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService { ...@@ -622,6 +613,4 @@ public class ScheduleTrackServiceImpl implements ScheduleTrackService {
return count; return count;
} }
} }
...@@ -33,4 +33,6 @@ public interface AclCustomerFortuneMapper { ...@@ -33,4 +33,6 @@ public interface AclCustomerFortuneMapper {
List<AclCustomerFortune> queryLifeFortuneListByOrderIds(List<Long> orderIds); List<AclCustomerFortune> queryLifeFortuneListByOrderIds(List<Long> orderIds);
List<AclCustomerFortune> findByOrderId(Long orderId); List<AclCustomerFortune> findByOrderId(Long orderId);
List<AclCustomerFortuneStatistics> findBypractitionerIds(@Param("list")List<Long> practitionerIds, @Param("time")Integer time);
} }
\ No newline at end of file
...@@ -66,4 +66,10 @@ public interface AclPractitionerMapper { ...@@ -66,4 +66,10 @@ public interface AclPractitionerMapper {
AclPractitioner findPractitionerByLeadsAssignedId(Long leadsAssignedId); AclPractitioner findPractitionerByLeadsAssignedId(Long leadsAssignedId);
List<AclPractitioner> findAll(); List<AclPractitioner> findAll();
int isTeamLeader(Long practitionerId);
List<Long> queryTeamAllPractitionerId(Long practitionerId);
List<Long> queryMentoredByPractitionerId(Long practitionerId);
} }
\ No newline at end of file
...@@ -30,4 +30,6 @@ public interface AclPractitionerSubordinateSystemMapper { ...@@ -30,4 +30,6 @@ public interface AclPractitionerSubordinateSystemMapper {
PractitionerSubordinateInfo findByOwnerE(@Param("practitionerId")String practitionerId); PractitionerSubordinateInfo findByOwnerE(@Param("practitionerId")String practitionerId);
List<SubordinateSystemMemberInfoE> findStatisticsE(@Param("subordinateIdForEGolden")String subordinateIdForEGolden, @Param("time")Integer time); List<SubordinateSystemMemberInfoE> findStatisticsE(@Param("subordinateIdForEGolden")String subordinateIdForEGolden, @Param("time")Integer time);
List<SubordinateSystemMemberInfoE> findStatisticsEBymobileList(@Param("list")List<String> mobileNoList, @Param("time")Integer time);
} }
\ No newline at end of file
...@@ -32,8 +32,5 @@ public interface ScheduleTrackMapper { ...@@ -32,8 +32,5 @@ public interface ScheduleTrackMapper {
int checkIsExist(@Param("practitionerId")Long practitionerId, @Param("trackTime")Date trackTime, @Param("mdDropOptionId")Long mdDropOptionId, int checkIsExist(@Param("practitionerId")Long practitionerId, @Param("trackTime")Date trackTime, @Param("mdDropOptionId")Long mdDropOptionId,
@Param("taskTimeFrom")String taskTimeFrom, @Param("taskTimeEnd")String taskTimeEnd); @Param("taskTimeFrom")String taskTimeFrom, @Param("taskTimeEnd")String taskTimeEnd);
List<Long> queryMentoredByPractitionerId(Long practitionerId);
int isTeamLeader(Long practitionerId);
} }
...@@ -25,4 +25,6 @@ public interface AclCustomerFortuneDALService { ...@@ -25,4 +25,6 @@ public interface AclCustomerFortuneDALService {
List<AclCustomerFortune> queryLifeFortuneListByOrderIds(List<Long> orderIds); List<AclCustomerFortune> queryLifeFortuneListByOrderIds(List<Long> orderIds);
List<AclCustomerFortune> findByOrderId(Long orderId); List<AclCustomerFortune> findByOrderId(Long orderId);
List<AclCustomerFortuneStatistics> findBypractitionerIds(List<Long> practitionerIds, Integer time);
} }
...@@ -175,4 +175,10 @@ public interface AclPractitionerDALService { ...@@ -175,4 +175,10 @@ public interface AclPractitionerDALService {
* @return 结果 * @return 结果
*/ */
List<AclPractitioner> findAll(); List<AclPractitioner> findAll();
int isTeamLeader(Long practitionerId);
List<Long> queryTeamAllPractitionerId(Long practitionerId);
List<Long> queryMentoredByPractitionerId(Long practitionerId);
} }
...@@ -21,4 +21,6 @@ public interface AclPractitionerSubordinateSystemDALService { ...@@ -21,4 +21,6 @@ public interface AclPractitionerSubordinateSystemDALService {
PractitionerSubordinateInfo findByOwnerE(String practitionerId); PractitionerSubordinateInfo findByOwnerE(String practitionerId);
List<SubordinateSystemMemberInfoE> findStatisticsE(String subordinateIdForEGolden, Integer time); List<SubordinateSystemMemberInfoE> findStatisticsE(String subordinateIdForEGolden, Integer time);
List<SubordinateSystemMemberInfoE> findStatisticsEBymobileList(List<String> mobileNoList, Integer time);
} }
...@@ -49,4 +49,9 @@ public class AclCustomerFortuneDALServiceImpl implements AclCustomerFortuneDALSe ...@@ -49,4 +49,9 @@ public class AclCustomerFortuneDALServiceImpl implements AclCustomerFortuneDALSe
public List<AclCustomerFortune> findByOrderId(Long orderId) { public List<AclCustomerFortune> findByOrderId(Long orderId) {
return aclCustomerFortuneMapper.findByOrderId(orderId); return aclCustomerFortuneMapper.findByOrderId(orderId);
} }
@Override
public List<AclCustomerFortuneStatistics> findBypractitionerIds(List<Long> practitionerIds, Integer time) {
return aclCustomerFortuneMapper.findBypractitionerIds(practitionerIds, time);
}
} }
...@@ -165,4 +165,19 @@ public class AclPractitionerDALServiceImpl implements AclPractitionerDALService ...@@ -165,4 +165,19 @@ public class AclPractitionerDALServiceImpl implements AclPractitionerDALService
public List<AclPractitioner> findAll() { public List<AclPractitioner> findAll() {
return aclPractitionerMapper.findAll(); return aclPractitionerMapper.findAll();
} }
@Override
public int isTeamLeader(Long practitionerId) {
return aclPractitionerMapper.isTeamLeader(practitionerId);
}
@Override
public List<Long> queryTeamAllPractitionerId(Long practitionerId) {
return aclPractitionerMapper.queryTeamAllPractitionerId(practitionerId);
}
@Override
public List<Long> queryMentoredByPractitionerId(Long practitionerId) {
return aclPractitionerMapper.queryMentoredByPractitionerId(practitionerId);
}
} }
...@@ -55,4 +55,10 @@ public class AclPractitionerSubordinateSystemDALServiceImpl implements AclPracti ...@@ -55,4 +55,10 @@ public class AclPractitionerSubordinateSystemDALServiceImpl implements AclPracti
public List<SubordinateSystemMemberInfoE> findStatisticsE(String subordinateIdForEGolden, Integer time) { public List<SubordinateSystemMemberInfoE> findStatisticsE(String subordinateIdForEGolden, Integer time) {
return aclPractitionerSubordinateSystemMapper.findStatisticsE(subordinateIdForEGolden,time); return aclPractitionerSubordinateSystemMapper.findStatisticsE(subordinateIdForEGolden,time);
} }
@Override
@TargetDataSource(dataSourceKey = DataSourceKey.DB_EGOLDEN)
public List<SubordinateSystemMemberInfoE> findStatisticsEBymobileList(List<String> mobileNoList, Integer time) {
return aclPractitionerSubordinateSystemMapper.findStatisticsEBymobileList(mobileNoList, time);
}
} }
...@@ -904,4 +904,38 @@ ...@@ -904,4 +904,38 @@
where f.order_id = #{orderId} where f.order_id = #{orderId}
</select> </select>
<select id="findBypractitionerIds" resultType="com.yd.api.practitioner.vo.rank.AclCustomerFortuneStatistics">
SELECT
f.customer_id customerId ,
p.id practitionerId ,
p.`name` name ,
p.subordinate_system_id subordinateSystemId ,
ifnull(COUNT(f.id),0) count ,
ifnull(SUM(f.order_price),0) FYP ,
ifnull(SUM(f.fyc_amount),0) FYC ,
s.practitioner_level practitionerLevelId
FROM
((ag_acl_practitioner_setting s LEFT JOIN ag_acl_practitioner p ON s.practitioner_id = p.id)
INNER JOIN (select t.* from ag_acl_customer_fortune t where t.drop_option_code = 'S01' group by t.order_id ) f ON f.customer_id = p.customer_id)
INNER JOIN ag_po_order o ON f.order_id = o.id
WHERE
o.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>
<otherwise>
and YEAR(f.order_date) = YEAR(now())
</otherwise>
</choose>
and p.id in
<foreach collection="list" item="practitionerId" index="index" open="(" close=")" separator=",">
#{practitionerId,jdbcType=BIGINT}
</foreach>
GROUP BY f.customer_id
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -746,7 +746,7 @@ ...@@ -746,7 +746,7 @@
</if> </if>
order by a.id desc order by a.id desc
</select> </select>
<select id="findByIds" resultType="com.yd.dal.entity.customer.AclPractitioner"> <select id="findByIds" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from ag_acl_practitioner from ag_acl_practitioner
...@@ -930,4 +930,19 @@ ...@@ -930,4 +930,19 @@
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from ag_acl_practitioner from ag_acl_practitioner
</select> </select>
<select id="queryMentoredByPractitionerId" resultType="java.lang.Long" statementType="CALLABLE">
CALL proc_queryMentoredByPractitionerId(#{practitionerId,jdbcType=BIGINT});
</select>
<select id="isTeamLeader" resultType="java.lang.Integer">
select count(1) from ag_acl_practitioner_subordinate_system where owner_practitioner_id = #{practitionerId,jdbcType=BIGINT}
</select>
<select id="queryTeamAllPractitionerId" resultType="Long">
SELECT id from ag_acl_practitioner
where subordinate_system_id =
(select subordinate_system_id from ag_acl_practitioner where id = #{practitionerId,jdbcType=BIGINT})
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -297,4 +297,38 @@ ...@@ -297,4 +297,38 @@
</choose> </choose>
group by p.SAL_MST_ID; group by p.SAL_MST_ID;
</select> </select>
<select id="findStatisticsEBymobileList" resultType="com.yd.dal.entity.customer.practitioner.SubordinateSystemMemberInfoE">
SELECT
p.SAL_MST_NAME as name ,
p.SAL_MST_ID_TYPE as titleCode,
p.SAL_MST_OFFICIAL_TITLE as titleName,
p.SAL_MST_MOBILE as mobileNo,
ifnull(count(distinct policy.INS_MST_ID),0) as count,
ifnull(sum(policy.INS_MST_TOTAL_PREIUM),0) as fyp,
ifnull(sum(policy.INS001_FYCTOTAL),0) as fyc
FROM ins001 policy INNER JOIN mon025 m on policy.INS_MST_ID = m.MON025_002 and m.MON025_109 IN (1,2,3,4,7) AND m.MON025_303 = 1 AND m.mon025_108 = 'S01'
INNER JOIN (
SELECT mon025_002,MAX(MON025_405) as MON025_405 FROM mon025 group by mon025_002 ORDER BY mon025_002
) b on m.mon025_002 = b.mon025_002 AND m.MON025_405 = b.MON025_405
INNER JOIN sal001 p on m.MON025_007 = p.SAL_MST_ID
WHERE 1=1
and p.SAL_MST_MOBILE in
<foreach collection="list" item="mobile" index="index" open="(" close=")" separator=",">
#{mobile,jdbcType=BIGINT}
</foreach>
<choose>
<when test="time == 1">
and DATE_FORMAT(policy.INS_MST_ACCEPT_DATE, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
</when>
<when test="time == 3">
and QUARTER(policy.INS_MST_ACCEPT_DATE) = QUARTER(NOW()) AND year(policy.INS_MST_ACCEPT_DATE)=year(now())
</when>
<otherwise>
and YEAR(policy.INS_MST_ACCEPT_DATE) = YEAR(now())
</otherwise>
</choose>
group by p.SAL_MST_ID;
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -258,12 +258,4 @@ ...@@ -258,12 +258,4 @@
AND md_drop_option_id = #{mdDropOptionId,jdbcType=BIGINT} AND md_drop_option_id = #{mdDropOptionId,jdbcType=BIGINT}
</select> </select>
<select id="queryMentoredByPractitionerId" resultType="java.lang.Long" statementType="CALLABLE">
CALL proc_queryMentoredByPractitionerId(#{practitionerId,jdbcType=BIGINT});
</select>
<select id="isTeamLeader" resultType="java.lang.Integer">
select count(1) from ag_acl_practitioner_subordinate_system where owner_practitioner_id = #{practitionerId,jdbcType=BIGINT}
</select>
</mapper> </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