Ver código fonte

考勤异常列表增加部门和人员筛选

seyason 4 meses atrás
pai
commit
63d10c1e9d

+ 2 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -3028,8 +3028,8 @@ public class ReportController {
     }
 
     @RequestMapping("/getReportTimeLessThanCardTimeList")
-    public HttpRespMsg getReportTimeLessThanCardTimeList(String date) {
-        return reportService.getReportTimeLessThanCardTimeList(date);
+    public HttpRespMsg getReportTimeLessThanCardTimeList(String date, Integer deptId, String userId) {
+        return reportService.getReportTimeLessThanCardTimeList(date, deptId, userId);
     }
 
 

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ReportService.java

@@ -172,5 +172,5 @@ public interface ReportService extends IService<Report> {
 
     HttpRespMsg getCurAuditNode(String date, String userId);
 
-    HttpRespMsg getReportTimeLessThanCardTimeList(String date);
+    HttpRespMsg getReportTimeLessThanCardTimeList(String date, Integer deptId, String userId);
 }

+ 49 - 11
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -10380,12 +10380,12 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
     }
 
     @Override
-    public HttpRespMsg getReportTimeLessThanCardTimeList(String date) {
+    public HttpRespMsg getReportTimeLessThanCardTimeList(String date, Integer deptId, String userId) {
         //获取自己的考勤未填满的记录
         User user = userMapper.selectById(request.getHeader("token"));
         Integer companyId = user.getCompanyId();
         //获取考勤表记录
-        List<UserCorpwxTime> userCorpwxTimeList = null;
+        List<UserCorpwxTime> userCorpwxTimeList = new ArrayList<>();
         //date格式为2024-09, 需要获取该月的第一天和最后一天
         LocalDate firstDay = LocalDate.parse(date + "-01");
         LocalDate lastDay = firstDay.with(TemporalAdjusters.lastDayOfMonth());
@@ -10393,15 +10393,45 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         boolean canViewAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看全公司工时");
         List<User> manageUserList = new ArrayList<>();
         if (canViewAll) {
-            userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).between("create_date", firstDay, lastDay));
-            manageUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
+            if (!StringUtils.isEmpty(userId)) {
+                User findUser = userMapper.selectById(userId);
+                if (findUser != null) {
+                    userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).eq("corpwx_userid", findUser.getCorpwxUserid()).between("create_date", firstDay, lastDay));
+                    manageUserList.add(findUser);
+                }
+            } else  if (deptId != null) {
+                //按部门过滤
+                List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
+                List<Integer> allSubDeptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
+                manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allSubDeptIds));
+                if (manageUserList.size() > 0) {
+                    List<String> collect = manageUserList.stream().map(User::getCorpwxUserid).collect(Collectors.toList());
+                    userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).in("corpwx_userid", collect).between("create_date", firstDay, lastDay));
+                }
+            } else {
+                userCorpwxTimeList = userCorpwxTimeMapper.selectList(new QueryWrapper<UserCorpwxTime>().eq("company_id", companyId).between("create_date", firstDay, lastDay));
+                manageUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
+            }
         } else {
             //是否是部门负责人
             List<Integer> allDeptIds = getAllVisibleDeptIdList(user, departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId)));
             if (allDeptIds.size() > 0) {
-                //有部门工时的查看权限
-                //取部门的人员
-                manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allDeptIds));
+                if (!StringUtils.isEmpty(userId)) {
+                    User findUser = userMapper.selectById(userId);
+                    if (findUser != null) {
+                        manageUserList.add(findUser);
+                    }
+                } else if (deptId != null) {
+                    //按部门过滤
+                    if (allDeptIds.contains(deptId)) {
+                        List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
+                        List<Integer> allSubDeptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
+                        manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allSubDeptIds));
+                    }
+                } else {
+                    //取部门的人员
+                    manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allDeptIds));
+                }
                 //如果自己不在manageUserList中,加进去
                 if (!manageUserList.stream().anyMatch(u -> u.getId().equals(user.getId()))) {
                     manageUserList.add(user);
@@ -10429,17 +10459,25 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
 
         //获取填报工时记录表
         List<Report> reportList = new ArrayList<>();
-        if (canViewAll) {
+        if (canViewAll && StringUtils.isEmpty(userId) && deptId == null) {
+            //查看全公司的
             reportList = reportMapper.selectList(new QueryWrapper<Report>().select("creator_id,create_date, sum(working_time) as working_time").eq("company_id", companyId).between("create_date", firstDay, lastDay).groupBy("creator_id,create_date"));
         } else if (manageUserList.size() > 0) {
             List<String> userIdList = manageUserList.stream().map(User::getId).collect(Collectors.toList());
-            reportList = reportMapper.selectList(new QueryWrapper<Report>().select("creator_id,create_date, sum(working_time) as working_time").in("creator_id", userIdList).between("create_date", firstDay, lastDay).groupBy("creator_id,create_date"));
-        } else {
-            reportList = reportMapper.selectList(new QueryWrapper<Report>().select("creator_id,create_date, sum(working_time) as working_time").eq("creator_id", user.getId()).between("create_date", firstDay, lastDay).groupBy("creator_id,create_date"));
+            if (userIdList.size() > 0) {
+                if (userIdList.size() == 1) {
+                    //按单个人匹配
+                    reportList = reportMapper.selectList(new QueryWrapper<Report>().select("creator_id,create_date, sum(working_time) as working_time").eq("creator_id", userIdList.get(0)).between("create_date", firstDay, lastDay).groupBy("creator_id,create_date"));
+                } else {
+                    reportList = reportMapper.selectList(new QueryWrapper<Report>().select("creator_id,create_date, sum(working_time) as working_time").in("creator_id", userIdList).between("create_date", firstDay, lastDay).groupBy("creator_id,create_date"));
+                }
+            }
         }
         //比对userCorpwxTimeList和reportList,找出工时未填满的记录
         List<Map<String, Object>> resultList = new ArrayList<>();
         DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        System.out.println("reportList size=" + reportList.size());
+        System.out.println("userCorpwxTimeList size=" + userCorpwxTimeList.size());
         for (UserCorpwxTime corpwxTime : userCorpwxTimeList) {
             boolean isMatch = true;
             double reportTime = 0;

+ 2 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

@@ -1543,8 +1543,8 @@ public class TimingTask {
                         userList = reportService.getNotFullReportUserList(company.getId(), startDate, lastDay);
                     } else {
                         LocalDate startDate = localDate.minusDays(7);
-                        //从2023-11-10号以后开始算
-                        if (startDate.isAfter(LocalDate.parse("2023-11-05"))) {
+                        //针对物奇,从2023-11-10号以后开始算,上周漏填的也要提醒
+                        if (startDate.isAfter(LocalDate.parse("2023-11-05")) && company.getId() == 1071) {
                             //检查上周日报是否漏填
                             LocalDate lastSunday = localDate.with(DayOfWeek.SUNDAY).minusWeeks(1);
                             LocalDate lastMonday = lastSunday.minusDays(6);
@@ -1626,9 +1626,6 @@ public class TimingTask {
                         if (u.get("corpwxUserid") != null){
                             //推送到企业微信
                             String corpUid = (String) u.get("corpwxUserid");
-                            if ("woy9TkCAAAyVAc5oXhGwCO-DFWF8SfKg".equals(corpUid)){
-                                System.out.println("发送给 【顾焕峰】漏填提醒");
-                            }
                             JSONObject json=new JSONObject();
                             JSONArray dataJson = new JSONArray();
                             JSONObject jsonObj = new JSONObject();

+ 37 - 26
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -1615,17 +1615,6 @@
           </el-table>
           <el-alert style="position:absolute;bottom:0;z-index:10;" v-if="isFlag" :title="$t('message.loading')+'...'" type="success" center :closable="false" show-icon></el-alert>
           <el-alert style="position:absolute;bottom:0;z-index:10;" v-if="isMore" :title="$t('message.noMoreData')" type="warning" center show-icon></el-alert>
-
-          <!-- <div slot="title" class="dialog-title selectworktime_title">
-            <label style="font-size: 16px">员工每日已填报工时数</label>
-            <el-link
-              type="primary"
-              style="float: right; margin-right: 60px"
-              @click="exportMembWorkHours()"
-              >导出已填报数据</el-link
-            > -->
-          <!-- <el-button >导出</el-button> -->
-          <!-- </div> -->
         </el-tab-pane>
 
         <el-tab-pane :label="$t('weiTiJiaoRenYuanLieBiao')" name="second" >
@@ -1735,11 +1724,19 @@
             </div>
             <div>
                 <div style="margin-top:10px;">
+                    <el-cascader v-if="user.userNameNeedTranslate != 1" :size="'small'" v-model="deptIdForNoReport" :placeholder="$t('qing-xuan-ze-bu-men')" :options="departmentList" :props="{ checkStrictly: true, value: 'id' }" clearable style="width: 200px;" @change="showReportTimeLessThanCardTimeList()"></el-cascader>
+                    <vueCascader :size="'small'" :widthStr="'200'" :clearable="true" :subject="trandepartmentList" :radios="true" :distinction="'17'" @vueCasader="vueCasader" v-if="user.userNameNeedTranslate == 1" :selectNameChuan="$t('other.allDepartments')"></vueCascader>
+                    <el-input style="width:200px;margin-left: 15px" v-if="user.userNameNeedTranslate != '1'" @keyup.enter.native="searchScreen(2)" v-model="searchKeyword" class="input-with-select" :placeholder="$t('defaultText.pleaseEnterNametoSearch')" clearable="true" size="small">
+                        <el-button slot="append" @click="searchScreen(2)" icon="el-icon-search"></el-button>
+                    </el-input>
+                    <selectCat v-if="user.userNameNeedTranslate == '1'" :filterable="true" :searchBoxTop="'1'" :size="'small'" :subject="usersList" :subjectId="usersListId" :distinction="'15'" :clearable="true" @selectCal="selectCal"></selectCat>
+
                     <!-- <el-link
                         type="primary"
                         style="float: right; vertical-align: middle;height:32px"
                         @click="exportMembNotWorkHours()"
-                        >{{$t('export.exportData')}}</el-link> -->
+                        >{{$t('export.exportData')}}</el-link
+                    > -->
                 </div>
             </div>
             
@@ -2760,7 +2757,9 @@
                 this.http.post(
                     "/report/getReportTimeLessThanCardTimeList",
                     {
-                    date: this.notfullSelectDateMonth
+                    date: this.notfullSelectDateMonth,
+                    deptId: this.deptIdForHasReport.length>0?this.deptIdForHasReport[this.deptIdForHasReport.length-1]:null,
+                    userId: this.usersListId
                     },
                     (res) => {
                     if (res.code == "ok") {
@@ -3433,7 +3432,7 @@
                 }
             },
             searchScreen(e){
-                if(e){
+                if(e == 1){
                     this.monthNotWorkDateS1 = []
                     for (let i = 0; i < this.monthNotWorkDate.length; i++) {
                         if(this.monthNotWorkDate[i].name.indexOf(this.searchKeyword) != -1){
@@ -3445,12 +3444,7 @@
                     }else{
                         this.monthNotWorkDateS = this.monthNotWorkDateS1 
                     }
-                    // if (this.monthNotWorkDateS1.length > 0) {
-                    //     setTimeout(() => {
-                    //         this.tableListenernot()
-                    //     }, 1000);
-                    // }
-                }else{
+                } else if (e == 0) {
                     this.monthWorkDataS1 = []
                     for (let i = 0; i < this.monthWorkData.length; i++) {
                         if(this.monthWorkData[i].name.indexOf(this.searchKeyword) != -1){
@@ -3462,11 +3456,19 @@
                     }else{
                         this.monthWorkDataS = this.monthWorkDataS1 
                     }
-                    // if (this.monthWorkDataS1.length > 0) {
-                    //     setTimeout(() => {
-                    //         this.tableListener()
-                    //     }, 1000);
-                    // }
+                } else if (e == 2) {
+                    this.monthWorkDataS1 = []
+                    for (let i = 0; i < this.notFullData.length; i++) {
+                        if(this.notFullData[i].name.indexOf(this.searchKeyword) != -1){
+                            this.monthWorkDataS1.push(this.notFullData[i])
+                        }
+                    }
+                    console.log(this.monthWorkDataS1);
+                    if (this.monthWorkDataS1.length > 50) {
+                        this.notFullData = this.monthWorkDataS1.slice(0,50);
+                    }else{
+                        this.notFullData = this.monthWorkDataS1 
+                    }
                 }
             },
             addUpload(data) {
@@ -8876,6 +8878,12 @@
                     this.deptIdForReminder = arr
                     this.showMonthWorkTimeReminder()
                 }
+                if(obj.distinction == '17' && obj) {
+                    let arr = []
+                    arr.push(obj.id)
+                    this.deptIdForHasReport = arr
+                    this.showReportTimeLessThanCardTimeList();
+                }
             },
             //分页
             handleCurrentChange(val) {
@@ -9104,7 +9112,10 @@
                         this.searchKeyword = ''
                     }
                     this.searchScreen(1)
-                }
+                } else if(obj.distinction == '15') {
+                    this.usersListId = obj.id
+                    this.showReportTimeLessThanCardTimeList();
+                } 
             }
         },
         created() {