| | |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | |
| | | * 凌晨0点执行,新增用户考勤信息 |
| | | * @throws Exception |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void getDingTalkAttendanceList(Timestamp attendDate, List attUser) throws Exception { |
| | | // 日期格式化 |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); |
| | |
| | | * 中午12点30执行,更新早打卡情况 |
| | | * @throws Exception |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void getDingTalkAttendanceListOfNoon(String attendDate, List attUser) throws Exception { |
| | | // 获取钉钉Token |
| | | OapiDingTalkAccessToken oapiDingTalkAccessToken = opaiDingTalkService.getAccessToken(); |
| | |
| | | * 凌晨02:30执行,更新晚打卡情况 |
| | | * @throws Exception |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void getDingTalkAttendanceListOfNight(String attendDate, List attUser) throws Exception { |
| | | // 获取钉钉Token |
| | | OapiDingTalkAccessToken oapiDingTalkAccessToken = opaiDingTalkService.getAccessToken(); |
| | |
| | | public Double getEndDuration(Timestamp startDate, Timestamp endDate, Attendance attendance){ |
| | | Double duration = new Double(0.00); |
| | | // 下午总时长 |
| | | if(startDate.toLocalDateTime().compareTo(attendance.getRosteringLunchEndTime().toLocalDateTime()) >= 0 && endDate.toLocalDateTime().compareTo(attendance.getRosteringWorkEndTime().toLocalDateTime()) <= 0){ |
| | | if(startDate.toLocalDateTime().compareTo(attendance.getRosteringLunchEndTime().toLocalDateTime()) >= 0){ |
| | | Integer leaveETime = calculateTimes(startDate.toLocalDateTime(), endDate.toLocalDateTime()); |
| | | duration += Double.valueOf(new BigDecimal((float) leaveETime / 3600).setScale(2, BigDecimal.ROUND_HALF_UP).toString()); |
| | | } |