Browse Source

修复撤销和暂停项目的权限漏洞

seyason 1 year ago
parent
commit
8091b9916b

+ 32 - 11
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

@@ -1011,20 +1011,41 @@ public class TimingTask {
         }
     }
 
-    //每个月1号和2号早上6点同步上个月的企业微信考勤打卡记录
-    @Scheduled(cron = "0 0 6 1,2 * ?")
+    //每个月第一个和第二个工作日早上6点同步上个月的企业微信考勤打卡记录
+    @Scheduled(cron = "0 0 6 ? * *")
     private void synMonthCorpWXCardTime() {
         if (isDev) return;
-        LocalDateTime lastMonth = LocalDateTime.now().minusMonths(1);
-        LocalDateTime start = lastMonth.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0).withNano(0);
-        LocalDateTime now = LocalDateTime.now().withDayOfMonth(1);
-        LocalDateTime end = now.minusDays(1).withHour(0).withMinute(0).withSecond(0).withNano(0);
-        System.out.println("开始同步上个月的考勤记录");
-        List<TimeType> typeList = timeTypeMapper.selectList(new QueryWrapper<TimeType>().eq("sync_corpwx_time", 1));
-        for (TimeType type : typeList) {
-            Integer companyId = type.getCompanyId();
-            wxCorpInfoService.getUserCheckInDayData(companyId, null, start, end, false);
+        LocalDateTime current = LocalDateTime.now();
+        LocalDate localDate = current.toLocalDate();
+        LocalDate firstDay = localDate.withDayOfMonth(1);
+        boolean todayIsFirstOrSecWorkDay = false;
+        int workDayCount = 0;
+        for (int i=0;i<10;i++) {
+            LocalDate targetDay = firstDay.plusDays(i);
+            if (WorkDayCalculateUtils.isWorkDay(targetDay)) {
+                workDayCount++;
+                if (targetDay.isEqual(localDate)) {
+                    todayIsFirstOrSecWorkDay = true;
+                    break;
+                }
+            }
+            if (workDayCount >= 2) break;
+        }
+        if (todayIsFirstOrSecWorkDay) {
+            LocalDateTime lastMonth = LocalDateTime.now().minusMonths(1);
+            LocalDateTime start = lastMonth.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0).withNano(0);
+            LocalDateTime now = LocalDateTime.now().withDayOfMonth(1);
+            LocalDateTime end = now.minusDays(1).withHour(0).withMinute(0).withSecond(0).withNano(0);
+            System.out.println("开始同步上个月的考勤记录");
+            List<TimeType> typeList = timeTypeMapper.selectList(new QueryWrapper<TimeType>().eq("sync_corpwx_time", 1));
+            for (TimeType type : typeList) {
+                Integer companyId = type.getCompanyId();
+                wxCorpInfoService.getUserCheckInDayData(companyId, null, start, end, false);
+            }
+        } else {
+            System.out.println("今天不是本月前两个工作日,不同步上月考勤");
         }
+
     }
     //每半个小时推送一次token到每个公司
     @Scheduled(fixedRate = 1800 * 1000)

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/project/projectInside.vue

@@ -13,7 +13,7 @@
                         </el-option>
                     </el-select>
                     
-                    <el-dropdown trigger="click" style="margin-right:30px;color:#262626;cursor:pointer;">
+                    <el-dropdown trigger="click" style="margin-right:30px;color:#262626;cursor:pointer;" v-if="projectCreatorId == user.id || projectInchargerId == user.id || permissions.projectManagement || isManageDept">
                         <i class="iconfont firerock-iconcaidan" ></i>
                         <el-dropdown-menu slot="dropdown">
                             <el-dropdown-item v-if="currentProject.status == 1" @click.native="finishPro()">