|
|
@@ -1,12 +1,12 @@
|
|
|
package com.ydtech.modules.admin.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.ydtech.modules.admin.dao.SysDeptMapper;
|
|
|
import com.ydtech.modules.admin.dao.SysUserMapper;
|
|
|
import com.ydtech.modules.admin.model.SysDept;
|
|
|
+import com.ydtech.modules.admin.model.SysUser;
|
|
|
import com.ydtech.modules.admin.model.dto.ReportDto;
|
|
|
-import com.ydtech.modules.admin.model.report.user.HouLinePersonnelReportDto;
|
|
|
-import com.ydtech.modules.admin.model.report.user.QianLineDDPersonnelReportDto;
|
|
|
-import com.ydtech.modules.admin.model.report.user.QianLineDLPersonnelReportDto;
|
|
|
+import com.ydtech.modules.admin.model.report.user.*;
|
|
|
import com.ydtech.modules.admin.service.UserReportService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -42,12 +42,12 @@ public class UserReportServiceImpl implements UserReportService {
|
|
|
|
|
|
SysDept sysDept = sysDeptMapper.selectById(deptId);
|
|
|
//查询总数和平均年龄
|
|
|
- HashMap<String,Integer> map= sysUserMapper.findSumCountAndAvgAge(deptId);
|
|
|
+ HashMap<String, String> map= sysUserMapper.findSumCountAndAvgAge(deptId);
|
|
|
//查询学历分布
|
|
|
List<ReportDto> edutionList= sysUserMapper.findEducationSumCount(deptId);
|
|
|
-
|
|
|
+ // todo 缺少专业、职称字段 是否添加
|
|
|
HouLinePersonnelReportDto houLinePersonnelReportDto =new HouLinePersonnelReportDto(
|
|
|
- sysDept.getId(),sysDept.getName(),map.get("sumCount"),map.get("avgAge"),edutionList,
|
|
|
+ sysDept.getId(),sysDept.getName(), String.valueOf(map.get("sumCount")), String.valueOf(map.get("avgAge")),edutionList,
|
|
|
new ArrayList<ReportDto>(),new ArrayList<ReportDto>()
|
|
|
);
|
|
|
return houLinePersonnelReportDto;
|
|
|
@@ -61,39 +61,79 @@ public class UserReportServiceImpl implements UserReportService {
|
|
|
@Override
|
|
|
public QianLineDDPersonnelReportDto queryQXTDReportData(String deptId) {
|
|
|
//查询总数和平均年龄
|
|
|
- HashMap<String,Integer> map= sysUserMapper.findQXTDSumCountAndAvgAge(deptId);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- return null;
|
|
|
+ HashMap<String,String> map= sysUserMapper.findQXTDSumCountAndAvgAge(deptId);
|
|
|
+ //查询团队长的区域位置
|
|
|
+ List<ReportDto> areaList = sysUserMapper.findQXTDAreaSumCount(deptId);
|
|
|
+ //查询性别分布
|
|
|
+ List<ReportDto> sexList = sysUserMapper.findQXTDSexSumCount(deptId);
|
|
|
+ //维护人分布
|
|
|
+ List<ReportDto> whList = sysUserMapper.findQXTDWhSumCount(deptId);
|
|
|
+ return new QianLineDDPersonnelReportDto("团队长", String.valueOf(map.get("sumCount")), String.valueOf(map.get("avgAge")),
|
|
|
+ areaList,sexList,whList);
|
|
|
}
|
|
|
/**
|
|
|
* @version
|
|
|
* @author: hxl
|
|
|
* @Date: 2024/6/28 10:37
|
|
|
- * @Description: 查询代理人数据
|
|
|
+ * @Description: 查询渠道数据
|
|
|
*/
|
|
|
@Override
|
|
|
- public List<QianLineDLPersonnelReportDto> queryQXQDReportData(String deptId) {
|
|
|
- HashMap<String,Integer> map= sysUserMapper.findQXDLSumCountAndAvgAge(deptId,"2");
|
|
|
-
|
|
|
- return null;
|
|
|
+ public List<QianLineQDPersonnelReportDto> queryQXQDReportData(String deptId) {
|
|
|
+ // todo 渠道类型无法确定,需要后续确定
|
|
|
+ List<QianLineQDPersonnelReportDto> list= sysUserMapper.queryQXQDReportData(deptId);
|
|
|
+ return list;
|
|
|
}
|
|
|
/**
|
|
|
* @version
|
|
|
* @author: hxl
|
|
|
* @Date: 2024/6/28 10:38
|
|
|
- * @Description: 查询渠道
|
|
|
+ * @Description: 查询代理人
|
|
|
*/
|
|
|
@Override
|
|
|
public QianLineDLPersonnelReportDto queryQXDLReportData(String deptId) {
|
|
|
//查询总数和平均年龄
|
|
|
- HashMap<String,Integer> map= sysUserMapper.findQXDLSumCountAndAvgAge(deptId,"1");
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- return null;
|
|
|
+ HashMap<String,String> map= sysUserMapper.findQXDLSumCountAndAvgAge(deptId,"2");
|
|
|
+ //查询代理人的区域位置
|
|
|
+ List<ReportDto> areaList = sysUserMapper.findQXDLAreaSumCount(deptId);
|
|
|
+ //查询性别分布
|
|
|
+ List<ReportDto> sexList = sysUserMapper.findQXDLSexSumCount(deptId);
|
|
|
+ //维护人分布
|
|
|
+ List<ReportDto> whList = sysUserMapper.findQXDLWhSumCount(deptId);
|
|
|
+ //查询当前人的下三级机构
|
|
|
+ List<SysUser> levelList =sysUserMapper.findQXDLUserList(deptId,"2");
|
|
|
+ List<DLPersonDto> list=new ArrayList<>();
|
|
|
+ if(levelList !=null && levelList.size()>0){
|
|
|
+ for(SysUser sysUser: levelList){
|
|
|
+ SysUser level1 = getBottomByUserId(sysUser.getId());
|
|
|
+ SysUser level2=null;
|
|
|
+ SysUser level3=null;
|
|
|
+ if(level1!=null){
|
|
|
+ level2 = getBottomByUserId(sysUser.getId());
|
|
|
+ }
|
|
|
+ if(level2!=null){
|
|
|
+ level3 = getBottomByUserId(sysUser.getId());
|
|
|
+ }
|
|
|
+ DLPersonDto dLPersonDto =new DLPersonDto(sysUser.getId(), sysUser.getName(), level1==null?"":level1.getName(), level2==null?"":level2.getName(), level3==null?"":level3.getName());
|
|
|
+ list.add(dLPersonDto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new QianLineDLPersonnelReportDto("团队长", String.valueOf(map.get("sumCount")), String.valueOf(map.get("avgAge")),
|
|
|
+ areaList,sexList,whList,list);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/7/5 18:04
|
|
|
+ * @Description: 通过领导人id查询数据
|
|
|
+ */
|
|
|
+ public SysUser getBottomByUserId(String userId){
|
|
|
+ LambdaQueryWrapper<SysUser> lqw = new LambdaQueryWrapper<>();
|
|
|
+ lqw.eq(SysUser::getLeaderId, userId);
|
|
|
+ lqw.eq(SysUser::getStatus,1);
|
|
|
+ SysUser user =sysUserMapper.selectOne(lqw);
|
|
|
+ return user;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|