|
|
@@ -34,6 +34,8 @@ import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
@Service
|
|
|
@@ -68,7 +70,7 @@ public class EsmUserReferrerServiceImpl extends ServiceImpl<EsmUserReferrerMappe
|
|
|
}
|
|
|
|
|
|
private static void findParentsRecursive(String userId, List<EsmUserReferrer> esmUserReferrers, List<EsmUserReferrer> referrers) {
|
|
|
- if(esmUserReferrers.isEmpty())
|
|
|
+ if (esmUserReferrers.isEmpty())
|
|
|
return;
|
|
|
EsmUserReferrer collect = esmUserReferrers.stream().filter(item -> item.getId().equals(userId)).findFirst()
|
|
|
.orElse(null);
|
|
|
@@ -364,7 +366,7 @@ public class EsmUserReferrerServiceImpl extends ServiceImpl<EsmUserReferrerMappe
|
|
|
// 一级团队信息
|
|
|
userList1 = this.baseMapper.getIdDown_1(esmUserReferrer.getId());
|
|
|
esmTeamPolicyVO1.setTeamlevel("一级会员");
|
|
|
- if (userList1 != null && userList1.size() > 0) {
|
|
|
+ if (userList1 != null && !userList1.isEmpty()) {
|
|
|
userPolicyList1 = this.baseMapper.queryOrderCount(userList1, record.getStartdate(), record.getEnddate());
|
|
|
EsmTeamPolicyVO esmTeamPolicyVO1_t = this.baseMapper.queryOrderCountHz(userList1, record.getStartdate(),
|
|
|
record.getEnddate());
|
|
|
@@ -377,7 +379,7 @@ public class EsmUserReferrerServiceImpl extends ServiceImpl<EsmUserReferrerMappe
|
|
|
userList2 = this.baseMapper.getIdDown_2(esmUserReferrer.getId());
|
|
|
|
|
|
esmTeamPolicyVO2.setTeamlevel("二级会员");
|
|
|
- if (userList2 != null && userList2.size() > 0) {
|
|
|
+ if (userList2 != null && !userList2.isEmpty()) {
|
|
|
userPolicyList2 = this.baseMapper.queryOrderCount(userList2, record.getStartdate(), record.getEnddate());
|
|
|
EsmTeamPolicyVO esmTeamPolicyVO2_t = this.baseMapper.queryOrderCountHz(userList2, record.getStartdate(),
|
|
|
record.getEnddate());
|
|
|
@@ -388,9 +390,9 @@ public class EsmUserReferrerServiceImpl extends ServiceImpl<EsmUserReferrerMappe
|
|
|
esmTeamPolicyVO2.setTeamnum(userList2.size());
|
|
|
// 三级团队信息
|
|
|
userList3 = this.baseMapper.getIdDown_3(esmUserReferrer.getId());
|
|
|
- if(userList3!=null && userList3.size()>0){
|
|
|
- userPolicyList3=this.baseMapper.queryOrderCount(userList3,record.getStartdate(), record.getEnddate());
|
|
|
- EsmTeamPolicyVO esmTeamPolicyVO3_t=this.baseMapper.queryOrderCountHz(userList3,record.getStartdate(), record.getEnddate());
|
|
|
+ if (userList3 != null && !userList3.isEmpty()) {
|
|
|
+ userPolicyList3 = this.baseMapper.queryOrderCount(userList3, record.getStartdate(), record.getEnddate());
|
|
|
+ EsmTeamPolicyVO esmTeamPolicyVO3_t = this.baseMapper.queryOrderCountHz(userList3, record.getStartdate(), record.getEnddate());
|
|
|
esmTeamPolicyVO3.setTeamlevel("三级会员");
|
|
|
esmTeamPolicyVO3.setTeamnum(userList3.size());
|
|
|
if (esmTeamPolicyVO2_t != null) {
|
|
|
@@ -400,11 +402,11 @@ public class EsmUserReferrerServiceImpl extends ServiceImpl<EsmUserReferrerMappe
|
|
|
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
//临时团队
|
|
|
List<String> registList = this.baseMapper.getIdDown3_regist(record.getId());
|
|
|
+ List<EsmUserPolicyVO> userPolicyList9 = this.baseMapper.queryOrderCount(userList3, record.getStartdate(), record.getEnddate());
|
|
|
EsmTeamPolicyVO esmTeamPolicyVO9 = new EsmTeamPolicyVO();
|
|
|
esmTeamPolicyVO9.setTeamlevel("临时会员");
|
|
|
esmTeamPolicyVO9.setTeamnum(registList == null ? 0 : registList.size());
|
|
|
@@ -432,11 +434,26 @@ public class EsmUserReferrerServiceImpl extends ServiceImpl<EsmUserReferrerMappe
|
|
|
hzList.add(esmTeamPolicyVO3);
|
|
|
hzList.add(esmTeamPolicyVO9);
|
|
|
esmUserCountVO.setHzList(hzList);
|
|
|
+
|
|
|
+ // 设置级别
|
|
|
+ Map<String, String> collect1 = userPolicyList1.stream().collect(Collectors.toMap(EsmUserPolicyVO::getId, x -> "1"));
|
|
|
+ Map<String, String> collect2 = userPolicyList2.stream().collect(Collectors.toMap(EsmUserPolicyVO::getId, x -> "2"));
|
|
|
+ Map<String, String> collect3 = userPolicyList3.stream().collect(Collectors.toMap(EsmUserPolicyVO::getId, x -> "3"));
|
|
|
+ Map<String, String> collect = Stream.of(collect1, collect2, collect3)
|
|
|
+ .flatMap(map -> map.entrySet().stream())
|
|
|
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
|
|
+
|
|
|
+ userPolicyList.forEach(x->{
|
|
|
+ String s = collect.get(x.getId());
|
|
|
+ x.setTeamlevel(s);
|
|
|
+ });
|
|
|
+
|
|
|
esmUserCountVO.setUserPolicyList(userPolicyList);
|
|
|
esmUserCountVO.setUserPolicyList0(userPolicyList0);
|
|
|
esmUserCountVO.setUserPolicyList1(userPolicyList1);
|
|
|
esmUserCountVO.setUserPolicyList2(userPolicyList2);
|
|
|
esmUserCountVO.setUserPolicyList3(userPolicyList3);
|
|
|
+ esmUserCountVO.setUserPolicyList9(userPolicyList9);
|
|
|
} else {
|
|
|
throw new SystemException("内部错误");
|
|
|
}
|
|
|
@@ -458,14 +475,15 @@ public class EsmUserReferrerServiceImpl extends ServiceImpl<EsmUserReferrerMappe
|
|
|
}
|
|
|
int i = esmUserReferrers.get(0).getLevel() + 3;
|
|
|
PageHelper.startPage(managementQueryVo.getPageNum(), managementQueryVo.getPageSize());
|
|
|
+ if ("2".equals(managementQueryVo.getAuthenticationStatus())) {
|
|
|
+ managementQueryVo.setAuthenticationStatus("-1");
|
|
|
+ }
|
|
|
List<SysUserTeamDto> byTeam = baseMapper.getByTeam(managementQueryVo, userId, i);
|
|
|
PageResult<SysUserTeamDto> sysUserPageResult = new PageResult<>(byTeam);
|
|
|
return new BasePageResult<>(managementQueryVo.getPageNum(), managementQueryVo.getPageSize(), sysUserPageResult.getTotalPages(),
|
|
|
sysUserPageResult.getPageSize(), sysUserPageResult.getContent());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 人员团队业绩统计--指定业务员查询
|
|
|
*
|