Browse Source

部门统计表修改

anderx 11 months ago
parent
commit
7631820da5
1 changed files with 23 additions and 3 deletions
  1. 23 3
      src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

+ 23 - 3
src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

@@ -385,8 +385,8 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 	@Override
 	public DepCountBo selectAllUser(String depId, String startTime, String endTime,String aName) {
 		DepCountBo acb=new DepCountBo();
-		if (StringUtils.isNotBlank(startTime))startTime=null;
-		if (StringUtils.isNotBlank(endTime)){
+		if (StringUtils.isBlank(startTime))startTime=null;
+		if (StringUtils.isBlank(endTime)){
 			endTime = null;
 		}else {
 			endTime=endTime+" 23:59:59";
@@ -726,12 +726,32 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 			if (!myShiroDep.contains(depId))throw new BusinessException("无权查看此部门信息");
 		}
 		DepCountBo depCountBo = selectAllUser(depId, startTime, endTime, aName);
-		List<AdminCustomerBo> adminCustomerBos = depCountBo.getaList();
+		List<AdminCustomerBo> adminCustomerBos =pushSelectAllUser(depCountBo);
 		NewExcelUtil excel=new NewExcelUtil(AdminCustomerBo.class);
 		String sheetName=String.format("部门统计表_%s~%s",startTime,endTime);
 		return excel.exportExcel(adminCustomerBos,sheetName,uploadPath);
 	}
 
+	private List<AdminCustomerBo> pushSelectAllUser(DepCountBo depCountBo) {
+		List<AdminCustomerBo> list = new ArrayList<>();
+		if (!depCountBo.getaList().isEmpty()){
+			list.addAll(depCountBo.getaList());
+		}
+		iterDeps(list,depCountBo.getList());
+		return list;
+	}
+
+	private void iterDeps(List<AdminCustomerBo> list, List<DepCountBo> list1) {
+		for (DepCountBo e : list1) {
+			if (!e.getaList().isEmpty()){
+				list.addAll(e.getaList());
+			}
+			if (!e.getList().isEmpty()){
+				iterDeps(list,e.getList());
+			}
+		}
+	}
+
 	/**
 	 *
 	 * @param list