Parcourir la source

修改 部门

lxy_01 il y a 2 semaines
Parent
commit
809f2b4d36

+ 3 - 0
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/MealApplicationsServiceImpl.java

@@ -222,6 +222,9 @@ public class MealApplicationsServiceImpl extends ServiceImpl<MealApplicationsMap
         queryWrapper.orderByAsc("department_id");
         IPage<User> userIPage = userMapper.selectPage(new Page<>(pageIndex, pageSize), queryWrapper);
         List<User> userList = userIPage.getRecords();
+        if(userList.isEmpty()){
+            userList = new ArrayList<>();
+        }
 
         //先将数据全部取出来,再根据人员和部门进行筛选
         List<Map<String,Object>>  mealList = mealApplicationsMapper.getMealList(companyId,startDate,endDate,deptIdList,userId,mealTypeIdString);

+ 35 - 6
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -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("");

+ 9 - 8
fhKeeper/formulahousekeeper/timesheet-workshop/src/views/statistic/index.vue

@@ -318,15 +318,15 @@
                                   {{items.statusString || '暂无状态' }}
                                 </div>
                                 
-                                <div v-if = "items.userId === '0' && items.applyAmount > 0" style = "color: #ff0000; ">
-                                  <div>
+                                <div v-if = "items.userId === '0' && items.applyAmount > 0" >
+                                  <div style = "color:blue ; ">
                                     报餐人数:{{items.applyAmount}}
                                   </div>
-                                  <div>
+                                  <div style = "color:green ; ">
                                     就餐人数:{{items.getMeal}}
                                   </div>
-                                  <div>
-                                    餐人数:{{items.overLine}}
+                                  <div style = "color:red ; ">
+                                    餐人数:{{items.overLine}}
                                   </div>
 
                                 </div>
@@ -336,9 +336,9 @@
                 </el-table-column>
                 <el-table-column align="center" prop="totalResult" label="合计" min-width="180">
                    <template slot-scope="scope" >
-                      <div style="color: #02a7f0;" > 报餐次数:{{scope.row.totalApplication}}</div> 
-                      <div style="color: red;"> 就餐次数:{{scope.row.totalGetMeal }}</div>
-                      <div style="color: green;" > 缺餐次数:{{scope.row.totalOverLine}}</div> 
+                      <div style="color: #0000ff;" > 报餐次数:{{scope.row.totalApplication}}</div> 
+                      <div style="color: green;"> 就餐次数:{{scope.row.totalGetMeal }}</div>
+                      <div style="color: red;" > 缺餐次数:{{scope.row.totalOverLine}}</div> 
                   </template>
                 </el-table-column>
             </el-table>
@@ -1657,6 +1657,7 @@ export default {
         sl.endDate=this.rangeDatas[1];
         url += "/exportMealStatistic";
         sl.deptIds=deptArr.join(',');
+        sl.userId=this.userId;
     }
         this.http.post(url, sl,
         res => {