|
@@ -2061,7 +2061,7 @@ public class TimingTask {
|
|
|
/**
|
|
|
* 每天凌晨2:50同步前一天的北森考勤数据 暂时固定公司id(5978)针对景昱
|
|
|
* */
|
|
|
- @Scheduled(cron ="0 50 2 ? * *")
|
|
|
+ @Scheduled(cron ="0 38 16 ? * *")
|
|
|
public void syncAttendanceFromBeisen(){
|
|
|
if(isDev){
|
|
|
return;
|
|
@@ -2069,7 +2069,7 @@ public class TimingTask {
|
|
|
DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
DateTimeFormatter df1=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
DateTimeFormatter df2=DateTimeFormatter.ofPattern("HH:mm");
|
|
|
- String startDate=LocalDate.now().plusDays(1).format(df);
|
|
|
+ String startDate=LocalDate.now().minusDays(1).format(df);
|
|
|
String endDate=LocalDate.now().plusDays(1).format(df);
|
|
|
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getCompanyId, 5978));
|
|
|
List<UserWithBeisen> userWithBeisenList = userWithBeisenService.list(new LambdaQueryWrapper<UserWithBeisen>().eq(UserWithBeisen::getCompanyId, 5978));
|
|
@@ -2077,15 +2077,18 @@ public class TimingTask {
|
|
|
if(beisenConfig==null){
|
|
|
return;
|
|
|
}
|
|
|
- //todo 获取到指定日期的考勤数据
|
|
|
- JSONArray attendanceStatistics = BeiSenUtils.getAttendanceStatistics(startDate, endDate, beisenConfig.getAppKey(), beisenConfig.getAppSecret(), 1, 100);
|
|
|
+
|
|
|
//todo 获取到指定日期的加班数据
|
|
|
List<LocalDate> workDaysListInRange = WorkDayCalculateUtils.getWorkDaysListInRange(startDate, endDate, 1);
|
|
|
JSONArray allOverTimeList=new JSONArray();
|
|
|
+ JSONArray attendanceStatistics=new JSONArray();
|
|
|
List<UserFvTime> userFvTimeList=new ArrayList<>();
|
|
|
for (LocalDate localDate : workDaysListInRange) {
|
|
|
JSONArray overTimeList = BeiSenUtils.getOverTimeList(df.format(localDate), beisenConfig.getAppKey(), beisenConfig.getAppSecret(), 1, 100);
|
|
|
+ //todo 获取到指定日期的考勤数据
|
|
|
+ JSONArray attendanceStatisticList = BeiSenUtils.getAttendanceStatistics(df.format(localDate), df.format(localDate), beisenConfig.getAppKey(), beisenConfig.getAppSecret(), 1, 100);
|
|
|
allOverTimeList.addAll(overTimeList);
|
|
|
+ attendanceStatistics.addAll(attendanceStatisticList);
|
|
|
}
|
|
|
for (LocalDate localDate : workDaysListInRange) {
|
|
|
Stream<JSONObject> swipingCardsStream = attendanceStatistics.stream().map(item -> (JSONObject) item);
|
|
@@ -2114,7 +2117,8 @@ public class TimingTask {
|
|
|
Optional<UserWithBeisen> beisen = userWithBeisenList.stream().filter(u -> u.getJobNumber() != null && u.getJobNumber().equals(first.get().getJobNumber())).findFirst();
|
|
|
if(beisen.isPresent()){
|
|
|
List<JSONObject> overTimeList = overTimeStream.filter(a -> a.getString("StaffId").equals(beisen.get().getUserId())
|
|
|
- && a.getIntValue("ApproveStatus") == 2).collect(Collectors.toList());
|
|
|
+ && (a.getIntValue("ApproveStatus") == 2||a.getIntValue("ApproveStatus") == 1)
|
|
|
+ &&LocalDateTime.parse(a.getString("StartDate"),df1).toLocalDate().isEqual(localDate)).collect(Collectors.toList());
|
|
|
if(overTimeList.size()>0){
|
|
|
double actualOverTimeDuration = overTimeList.stream().mapToDouble(i -> i.getDouble("ActualOverTimeDuration")).sum();
|
|
|
if(workDay){
|