|
|
@@ -1,6 +1,7 @@
|
|
|
package com.ydtech.modules.admin.service.impl;
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.modules.admin.dao.SysUserAccountHistoryMapper;
|
|
|
import com.ydtech.modules.admin.model.dto.*;
|
|
|
@@ -9,15 +10,13 @@ import com.ydtech.modules.admin.service.AppReportService;
|
|
|
import com.ydtech.modules.admin.utils.SliceUpDateUtil;
|
|
|
import com.ydtech.modules.base.controller.BaseController;
|
|
|
import com.ydtech.modules.esm.dao.EsmUserReferrerMapper;
|
|
|
+import com.ydtech.modules.esm.model.EsmUserReferrer;
|
|
|
import com.ydtech.modules.order.dao.InsAreaCompanyMapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.LinkedHashMap;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @version
|
|
|
@@ -99,8 +98,8 @@ public class AppReportServiceImpl implements AppReportService {
|
|
|
* @Date: 2024/6/6 15:05
|
|
|
* @Description: 获取开始和结束时间
|
|
|
*/
|
|
|
- private static HashMap<String,String> getDateMap(ReportQueryVo reportQueryVo) {
|
|
|
- HashMap<String,String> map=new HashMap<String,String>();
|
|
|
+ private static HashMap<String,Object> getDateMap(ReportQueryVo reportQueryVo) {
|
|
|
+ HashMap<String,Object> map=new HashMap<String,Object>();
|
|
|
String beginTime="";
|
|
|
String endTime="";
|
|
|
//获取所有的月分
|
|
|
@@ -258,21 +257,35 @@ public class AppReportServiceImpl implements AppReportService {
|
|
|
*/
|
|
|
@Override
|
|
|
public HttpResult<EmployeeIncreaseReportAllDto> employeeIncreaseReport(ReportQueryVo reportQueryVo) {
|
|
|
+ List<String> userIds = getUserIdsByUserId(BaseController.getUser().getId());
|
|
|
+ List<EmployeeIncreaseReportDto> allList=new ArrayList<EmployeeIncreaseReportDto>();
|
|
|
//年分查询当年12月的数据
|
|
|
if("1".equals(reportQueryVo.getSearchType())){
|
|
|
- List<EmployeeIncreaseReportDto> allList= esmUserReferrerMapper.employeeIncreaseReportYear(getDateMap(reportQueryVo));
|
|
|
+ HashMap<String, Object> dateMap = getDateMap(reportQueryVo);
|
|
|
+ dateMap.put("ids",userIds);
|
|
|
+ if(userIds!=null && userIds.size()>0){
|
|
|
+ allList= esmUserReferrerMapper.employeeIncreaseReportYear(dateMap);
|
|
|
+ }
|
|
|
return HttpResult.ok(getEmployeeIncreaseReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchYear()));
|
|
|
}
|
|
|
//月分查询当月的数据
|
|
|
if("2".equals(reportQueryVo.getSearchType())){
|
|
|
reportQueryVo.setSearchMonth(reportQueryVo.getSearchYear()+"-"+reportQueryVo.getSearchMonth());
|
|
|
- List<EmployeeIncreaseReportDto> allList= esmUserReferrerMapper.employeeIncreaseReportMonth(getDateMap(reportQueryVo));
|
|
|
+ HashMap<String, Object> dateMap = getDateMap(reportQueryVo);
|
|
|
+ dateMap.put("ids",userIds);
|
|
|
+ if(userIds!=null && userIds.size()>0){
|
|
|
+ allList= esmUserReferrerMapper.employeeIncreaseReportMonth(dateMap);
|
|
|
+ }
|
|
|
return HttpResult.ok(getEmployeeIncreaseReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchMonth()));
|
|
|
}
|
|
|
//日查询当日的前20条数据
|
|
|
if("3".equals(reportQueryVo.getSearchType())){
|
|
|
reportQueryVo.setSearchDay(reportQueryVo.getSearchYear()+"-"+reportQueryVo.getSearchMonth()+"-"+reportQueryVo.getSearchDay());
|
|
|
- List<EmployeeIncreaseReportDto> allList= esmUserReferrerMapper.employeeIncreaseReportDay(getDateMap(reportQueryVo));
|
|
|
+ HashMap<String, Object> dateMap = getDateMap(reportQueryVo);
|
|
|
+ dateMap.put("ids",userIds);
|
|
|
+ if(userIds!=null && userIds.size()>0){
|
|
|
+ allList= esmUserReferrerMapper.employeeIncreaseReportDay(dateMap);
|
|
|
+ }
|
|
|
return HttpResult.ok(getEmployeeIncreaseReportAllDto(allList, getDateStrings(reportQueryVo),reportQueryVo.getSearchDay()));
|
|
|
}
|
|
|
return null;
|
|
|
@@ -314,4 +327,50 @@ public class AppReportServiceImpl implements AppReportService {
|
|
|
public AllpremiumDto getAllpremium(String year) {
|
|
|
return insAreaCompanyMapper.getAllpremium(year, BaseController.getUser().getId());
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/4/29 16:01
|
|
|
+ * @Description: 查询当前登陆人管理的渠道人 即领导人为当前登陆人的用户需要递归查询
|
|
|
+ */
|
|
|
+ public List<String> getUserIdsByUserId(String userId) {
|
|
|
+ List<EsmUserReferrer> esmUserReferrers = queryData(userId);
|
|
|
+ Set<String> set=new HashSet<>();
|
|
|
+ if(esmUserReferrers!=null && esmUserReferrers.size()>0){
|
|
|
+ for(EsmUserReferrer esmUserReferrer : esmUserReferrers){
|
|
|
+ set.add(esmUserReferrer.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new ArrayList<String>(set);
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<EsmUserReferrer> queryData(String userId) {
|
|
|
+ //通过
|
|
|
+ List<EsmUserReferrer> children = getChildrenFromDataSource(userId);
|
|
|
+ List<EsmUserReferrer> result = new ArrayList<>();
|
|
|
+ if(children!=null && children.size()>0){
|
|
|
+ for (EsmUserReferrer child : children) {
|
|
|
+ // 添加当前子节点到结果列表
|
|
|
+ result.add(child);
|
|
|
+ // 递归查询子节点的子节点
|
|
|
+ result.addAll(queryData(child.getId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/6/7 19:30
|
|
|
+ * @Description: 查询下级的
|
|
|
+ */
|
|
|
+ public List<EsmUserReferrer> getChildrenFromDataSource(String userId) {
|
|
|
+ // 模拟从数据库或其他数据源获取子节点数据
|
|
|
+ LambdaQueryWrapper<EsmUserReferrer> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(EsmUserReferrer::getReferrerId, userId);
|
|
|
+ queryWrapper.ne(EsmUserReferrer::getId, userId);
|
|
|
+ List<EsmUserReferrer> children = esmUserReferrerMapper.selectList(queryWrapper);
|
|
|
+ return children;
|
|
|
+ }
|
|
|
}
|