|
|
@@ -6454,7 +6454,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
userIdList.add(u.getId());
|
|
|
}
|
|
|
}
|
|
|
- System.out.println("-----------------------------" + userIdList.toString());
|
|
|
|
|
|
//防止为空
|
|
|
userIdList.add("0");
|
|
|
@@ -6469,9 +6468,9 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
* */
|
|
|
for (MealApplications mealApplications:resultList) {
|
|
|
mealApplications.setQrCode(userMapper.selectById(mealApplications.getUserId()).getName());
|
|
|
- System.out.println(mealApplications.toString());
|
|
|
}
|
|
|
|
|
|
+ //报餐详细sheet1
|
|
|
List<List<String>> dataList=new ArrayList<>();
|
|
|
List<String> titleList=new ArrayList<>();
|
|
|
titleList.add("");
|
|
|
@@ -6483,6 +6482,16 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
titleList.add("日期");
|
|
|
dataList.add(titleList);
|
|
|
|
|
|
+ //个人报餐统计sheet2
|
|
|
+ List<List<String>> sheet2=new ArrayList<>();
|
|
|
+ titleList=new ArrayList<>();
|
|
|
+ titleList.add("工位名称");
|
|
|
+ titleList.add("报餐人");
|
|
|
+ titleList.add("日期范围");
|
|
|
+ titleList.add("报餐次数");
|
|
|
+ titleList.add("就餐次数");
|
|
|
+ titleList.add("缺餐次数");
|
|
|
+
|
|
|
for (MealApplications map : resultList) {
|
|
|
if(dataList.stream().noneMatch(item-> item.get(0).equals(map.getUserId()) && item.get(6).equals(map.getApplicationDate().toString())))
|
|
|
{
|
|
|
@@ -6499,6 +6508,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
|
|
|
itemMap.add(convertDepartmentIdToCascade(itemUser.getDepartmentId(), departmentList));
|
|
|
itemMap.add(itemUser.getName());
|
|
|
+ //个人统计日期范围
|
|
|
itemMap.add("0");//是否报餐
|
|
|
itemMap.add("0");//已取餐
|
|
|
itemMap.add("0");//未取餐
|
|
|
@@ -6519,7 +6529,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
- System.out.println(itemMap);
|
|
|
dataList.add(itemMap);
|
|
|
}
|
|
|
else {
|
|
|
@@ -6548,8 +6557,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
- System.out.println(i);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -6557,9 +6564,53 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
for(List<String> item:dataList){
|
|
|
item.remove(0);
|
|
|
}
|
|
|
+ sheet2 = new ArrayList<>(dataList.stream()
|
|
|
+ .filter(item -> {
|
|
|
+ // 过滤掉大小不足6的列表
|
|
|
+ if (item.size() < 6) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ //过滤第一行title
|
|
|
+ if (!item.get(0).equals("工位名称")) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ // 过滤掉无法转换为数字的项
|
|
|
+ try {
|
|
|
+ for (int i = 2; i <= 4; i++) {
|
|
|
+ Integer.parseInt(item.get(i));
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ })
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ item -> item.get(1),
|
|
|
+ Collectors.collectingAndThen(
|
|
|
+ Collectors.toList(),
|
|
|
+ items -> {
|
|
|
+ int sum2 = 0, sum3 = 0, sum4 = 0;
|
|
|
+ for (List<String> item : items) {
|
|
|
+ sum2 += Integer.parseInt(item.get(2));
|
|
|
+ sum3 += Integer.parseInt(item.get(3));
|
|
|
+ sum4 += Integer.parseInt(item.get(4));
|
|
|
+ }
|
|
|
+ if (items.size() == 0){
|
|
|
+ return new ArrayList<String>();
|
|
|
+ }
|
|
|
+ List<String> newItems = Arrays.asList(items.get(0).get(0), items.get(0).get(1), String.format("%s - %s", startDate, endDate), String.valueOf(sum2), String.valueOf(sum3), String.valueOf(sum4));
|
|
|
+ return Arrays.asList(items.get(0).get(0), items.get(0).get(1), String.format("%s - %s", startDate, endDate), String.valueOf(sum2), String.valueOf(sum3), String.valueOf(sum4));
|
|
|
+ })
|
|
|
+ ))
|
|
|
+ .values());
|
|
|
+ sheet2.add(0,titleList);
|
|
|
Company company = companyMapper.selectById(companyId);
|
|
|
String fileName=("报餐数据表_")+company.getCompanyName()+System.currentTimeMillis();
|
|
|
- String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName, dataList, path);
|
|
|
+ String sheet1Name = "报餐详细";
|
|
|
+ String sheet2Name = "个人统计";
|
|
|
+ String resp = ExcelUtil.exportTwoSheetGeneralExcelByTitleAndList(fileName, dataList,sheet2, path,sheet1Name,sheet2Name);
|
|
|
msg.setData(resp);
|
|
|
return msg;
|
|
|
}
|