Jelajahi Sumber

跳过赛元微电子2025年4月1日之前的考勤更新

seyason 1 bulan lalu
induk
melakukan
809331ac14

+ 0 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/WeiXinCorpController.java

@@ -2105,7 +2105,6 @@ public class WeiXinCorpController {
         } else {
             end = LocalDateTime.parse(startDate + " 23:59:59", dtf);
         }
-
         return wxCorpInfoService.getUserPunchRecord(companyId, userId, start, end, true);
     }
 

+ 12 - 6
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -738,6 +738,10 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
             msg.setError(MessageUtils.message("wx.dockError"));
             return msg;
         }
+        if (companyId == 469 && endDateTime.isBefore(LocalDateTime.of(2025, 4, 1, 0, 0, 0))) {
+            System.out.println("赛元刷新每日打卡,skip");
+            return msg;
+        }
         String url = null;
         try {
             startDateTime = startDateTime.withHour(0).withMinute(0).withSecond(0).withNano(0);
@@ -1356,7 +1360,6 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                     ct.setStartTime(DateTimeUtil.getTimeFromSeconds(sTime));
                     ct.setEndTime(DateTimeUtil.getTimeFromSeconds(eTime));
                     boolean isCrossDay = eTime >= 24 * 3600;//加班至第二天
-                    if (showLog) System.out.println("初始startTime="+ct.getStartTime()+", endTime="+ct.getEndTime());
                     //下班时间和上班时间不一样,正常应该有regular_work_sec,但是企业微信存在问题,传过来的是0,需要校正
                     if (regular_work_sec == 0 && ct.getEndTime() != null && !ct.getEndTime().equals(ct.getStartTime())) {
                         ct.setEndTime(ct.getStartTime());
@@ -1635,7 +1638,6 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                         } else {
                             timeDelta = ct.getCardTime();
                         }
-                        if (showLog) System.out.println("上下班间隔时长为==" + timeDelta);
                         ct.setName(name);
                         //解析请假和外出的情况
                         JSONArray sp_items = jsonObject.getJSONArray("sp_items");
@@ -1654,7 +1656,6 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                                         outdoorTime = 0.0;
                                     }
                                     double otTime = convertDayTimeToHours(DateTimeUtil.getHoursFromSeconds(spItem.getInteger("duration")));
-                                    if (showLog) System.out.println("补的时长:"+otTime);
                                     if (otTime > 8.0) {
                                         otTime = 8.0;
                                     }
@@ -1729,7 +1730,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                         if (ct.getAskLeaveTime() > 8.0) {
                             ct.setAskLeaveTime(8.0);//超过8小时都以8小时计算
                         }
-                        if (showLog) System.out.println("校正后请假时长=" + ct.getAskLeaveTime());
+//                        if (showLog) System.out.println("校正后请假时长=" + ct.getAskLeaveTime());
                         //如果有出差的,但是没有打卡,则用出差的时间作为timeDelta
                         if (timeDelta < 7.5 && ct.getOutdoorTime() > 0) {
                             timeDelta += ct.getOutdoorTime();
@@ -1753,12 +1754,12 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                         if (showLog) System.out.println("工作时长==" + workHours);
 
                         if (corpInfo.getCompanyId() == 481) {
-                            //给盛立安元和赛元微电子0.5单位进位
+                            //给盛立安元0.5单位进位
                             ct.setWorkHours(DateTimeUtil.getHalfHoursFromDouble(workHours));
                         } else {
                             ct.setWorkHours(DateTimeUtil.getHoursFromDouble(workHours));
                         }
-                        if (showLog) System.out.println("ct.getStartTime()==" + ct.getStartTime()+", ct.getEndTime()="+ct.getEndTime());
+//                        if (showLog) System.out.println("ct.getStartTime()==" + ct.getStartTime()+", ct.getEndTime()="+ct.getEndTime());
 
                         //针对赛元微电子,请半天假的情况下。重新校正打卡和工作时长
                         if (corpInfo.getCorpid().equals("wpy9TkCAAAgNp4jvqxKTpXrhvwFvyFHg")) {
@@ -1866,6 +1867,11 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                             .eq("create_date", localDate));
                     //有工作时长或者打卡时长或者请假时长,外出时长,都算有效时间
                     boolean hasTimeRecord = ct.getWorkHours() > 0 || ct.getCardTime() >= 1.0 || ct.getAskLeaveTime() > 0 || ct.getOutdoorTime() > 0;
+                    //对于赛元微电子,2025年4月1日之前的都不做处理,防止把数据覆盖掉
+                    if(corpInfo.getCompanyId() == 469 && ct.getCreateDate().isBefore(LocalDate.of(2025, 4, 1))) {
+                        System.out.println("赛元微电子Skip");
+                        continue;
+                    }
                     if (itemList.size() > 0) {
                         UserCorpwxTime item = itemList.get(0);
                         if (itemList.size() > 1) {