|
|
@@ -6425,12 +6425,45 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
@Override
|
|
|
public HttpRespMsg exportMealStatistic(String deptIds, String userId, String startDate, String endDate) {
|
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
|
- Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
DateTimeFormatter dtf=DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
+ QueryWrapper<User> queryWrapper = new QueryWrapper<>();
|
|
|
+
|
|
|
+ String token = request.getHeader("TOKEN");
|
|
|
+ User user = userMapper.selectById(token);
|
|
|
+ Integer companyId = user.getCompanyId();
|
|
|
+
|
|
|
+
|
|
|
+ if(!StringUtils.isEmpty(userId)){
|
|
|
+ queryWrapper.eq("id",userId);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
|
|
|
+ List<Integer> deptIdList=new ArrayList<>();
|
|
|
+ if(deptIds!=null&&!StringUtils.isEmpty(deptIds)){
|
|
|
+ String[] split = deptIds.split(",");
|
|
|
+ for (String deptId : split) {
|
|
|
+ List<Integer> branchDepartment = getBranchDepartment(Integer.valueOf(deptId), departmentList);
|
|
|
+ deptIdList.addAll(branchDepartment);
|
|
|
+ }
|
|
|
+ queryWrapper.in("department_id",deptIdList);
|
|
|
+ }
|
|
|
+ List<User> userList= userMapper.selectList(queryWrapper);
|
|
|
+ List<String> userIdList = new ArrayList<>();
|
|
|
+ for(User u:userList){
|
|
|
+ if(u.getId()!= null){
|
|
|
+ userIdList.add(u.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println("-----------------------------" + userIdList.toString());
|
|
|
+
|
|
|
+ //防止为空
|
|
|
+ userIdList.add("0");
|
|
|
+
|
|
|
List<MealApplications> resultList = mealApplicationsService.getBaseMapper().selectList(new QueryWrapper<MealApplications>()
|
|
|
.ge("application_date",LocalDate.parse(startDate,dtf))
|
|
|
.le("application_date",LocalDate.parse(endDate,dtf))
|
|
|
- .ne("status",2));
|
|
|
+ .ne("status",2)
|
|
|
+ .in("user_id",userIdList));
|
|
|
/*
|
|
|
* 测试用
|
|
|
* */
|
|
|
@@ -6439,10 +6472,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
System.out.println(mealApplications.toString());
|
|
|
}
|
|
|
|
|
|
- String token = request.getHeader("TOKEN");
|
|
|
- User user = userMapper.selectById(token);
|
|
|
- List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
|
|
|
-
|
|
|
List<List<String>> dataList=new ArrayList<>();
|
|
|
List<String> titleList=new ArrayList<>();
|
|
|
titleList.add("");
|