Forráskód Böngészése

出差外勤的考勤完善
重新提交日报时,更新提交时间

seyason 1 éve
szülő
commit
5be734be83

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

@@ -1314,6 +1314,9 @@ public class ReportController {
                 }
             }
         }
+        //更新填报时间
+        reportList.forEach(r->r.setCreateTime(LocalDateTime.now()));
+
         HttpRespMsg httpRespMsg = reportService.editReport(reportList, createDate.length > 0 ? createDate[0] : null, targetUserList, hourCost, user.getCompanyId());
         //【上海绎维】、【火石演示】、【博通容合】使用
         if (company.getId() == 862 || company.getId() == 10 || company.getId() == 3344) {

+ 49 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -1328,7 +1328,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                                         ct.setEndTime(leaveEnd);
                                         needRecaculate = true;
                                     }
-                                } else if (leaveText.startsWith("外出")) {
+                                } else if (leaveText.startsWith("外出") || leaveText.startsWith("出差") || leaveText.startsWith("外勤")) {
                                     //格式 "10/17 09:00 / 10/19 18:00"
                                     String string = holiday.getJSONObject("sp_description").getJSONArray("data").getJSONObject(m).getString("text");
                                     String[] s = string.split(" \\/ | |\\~");
@@ -1395,7 +1395,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                                             //中间日期就是全天
                                             outStart = baseMorningStart;
                                             outEnd = baseAfternoonEnd;
-                                            if (showLog) System.out.println("===中间天请假===");
+                                            if (showLog) System.out.println("===中间天外出===");
                                         }
                                     }
                                     //获取外出的最早的开始时间和最晚的结束时间最为当天考勤的最早和最晚时间
@@ -1454,6 +1454,7 @@ 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;
                                     }
@@ -1592,6 +1593,52 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                                 ct.setEndTime(baseMorningEnd);
                                 if (showLog) System.out.println("再次校正,下午请假");
                             }
+
+                            //校正出差时间
+                            //获取请假的最早和最晚时间
+//                            boolean morningBusTrip = false;
+//                            boolean afternoonBusTrip = false;
+//                            for (int t = 0; t < holidayItems.size(); t++) {
+//                                JSONObject holiday = holidayItems.getJSONObject(t);
+//                                JSONObject spTitle = holiday.getJSONObject("sp_title");
+//                                JSONArray data = spTitle.getJSONArray("data");
+//                                for (int m = 0; m < data.size(); m++) {
+//                                    String leaveText = data.getJSONObject(m).getString("text");
+//                                    if (leaveText.contains("出差")) {
+//                                        //获取对应位置的出差时间段
+//                                        String string = holiday.getJSONObject("sp_description").getJSONArray("data").getJSONObject(m).getString("text");
+//                                        String[] s = string.split(" |\\~");
+//                                        boolean isOldFormat = false;
+//                                        if (s.length < 5) {
+//                                            isOldFormat = true;
+//                                        }
+//                                        //获取到出差的开始时间和结束时间
+//                                        String leaveStart = s[1];
+//                                        String leaveEnd = isOldFormat ? s[3] : s[4];
+//
+//                                        //检查出差时间段是否在打卡的时间范围内
+//                                        if ("上午".equals(leaveEnd) || "下午".equals(leaveEnd)) {
+//                                            //半天或者全天请假, 上面已经处理过结束时间为请假之前的时间了,此处不需要再处理了
+//                                            if (ct.getAskLeaveTime() >= 12) {
+//                                                if (showLog)
+//                                                    System.out.println("====半天或者全天出差 =转化为8小时制下的时间=" + (ct.getAskLeaveTime() / 24 * 8.0));
+//                                                //12小时以上的,是请假半天或者全天的。 防止1天有2次上下午分开的请假,导致计算两次的错误
+//                                                ct.setOutdoorTime(ct.getAskLeaveTime() / 24 * 8.0);//转换成一天8小时工作制
+//                                            }
+//                                            if ("上午".equals(leaveStart)) {
+//                                                morningBusTrip = true;
+//                                            }
+//                                            if ("下午".equals(leaveEnd)) {
+//                                                afternoonBusTrip = true;
+//                                            }
+//                                        } else if (ct.getStartTime().compareTo(leaveStart) <= 0 && ct.getEndTime().compareTo(leaveEnd) >= 0) {
+//                                            String hourLeaveTime = leaveText.replaceAll("出差", "").replaceAll("小时", "");
+//                                            if (showLog) System.out.println("出差时长=" + hourLeaveTime);
+////                                        ct.setCardTime(ct.getCardTime() - Double.parseDouble(hourLeaveTime));
+//                                        }
+//                                    }
+//                                }
+//                            }
                         }
                     }