|
|
|
|
|
|
|
|
package com.ruoyi.zhushi.service.impl; |
|
|
package com.ruoyi.zhushi.service.impl; |
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
import com.ruoyi.common.core.domain.PageQuery; |
|
|
import com.ruoyi.common.core.domain.PageQuery; |
|
|
|
|
|
|
|
|
import com.ruoyi.common.helper.LoginHelper; |
|
|
import com.ruoyi.common.helper.LoginHelper; |
|
|
import com.ruoyi.zhushi.entity.*; |
|
|
import com.ruoyi.zhushi.entity.*; |
|
|
import com.ruoyi.zhushi.mapper.DkAttendanceGroupAndUserMapper; |
|
|
import com.ruoyi.zhushi.mapper.DkAttendanceGroupAndUserMapper; |
|
|
|
|
|
import com.ruoyi.zhushi.mapper.DkAttendanceGroupMapper; |
|
|
import com.ruoyi.zhushi.mapper.DkRecordMapper; |
|
|
import com.ruoyi.zhushi.mapper.DkRecordMapper; |
|
|
import com.ruoyi.zhushi.mapper.NjBalanceManageDetailMapper; |
|
|
import com.ruoyi.zhushi.mapper.NjBalanceManageDetailMapper; |
|
|
import com.ruoyi.zhushi.service.DkRecordService; |
|
|
import com.ruoyi.zhushi.service.DkRecordService; |
|
|
import com.ruoyi.zhushi.service.NjBalanceManageDetailService; |
|
|
|
|
|
import com.ruoyi.zhushi.util.CalendarGenerator; |
|
|
import com.ruoyi.zhushi.util.CalendarGenerator; |
|
|
import com.ruoyi.zhushi.util.Constans; |
|
|
import com.ruoyi.zhushi.util.Constans; |
|
|
import com.ruoyi.zhushi.util.TimeUtils; |
|
|
import com.ruoyi.zhushi.util.TimeUtils; |
|
|
|
|
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
import java.time.format.DateTimeFormatter; |
|
|
import java.time.format.TextStyle; |
|
|
import java.time.format.TextStyle; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("all") |
|
|
@Service |
|
|
@Service |
|
|
public class DkRecordServiceImpl implements DkRecordService { |
|
|
public class DkRecordServiceImpl implements DkRecordService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private DkAttendanceGroupAndUserMapper dkAttendanceGroupAndUserMapper; |
|
|
private DkAttendanceGroupAndUserMapper dkAttendanceGroupAndUserMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private DkAttendanceGroupMapper dkAttendanceGroupMapper; |
|
|
|
|
|
|
|
|
public String getTime() { |
|
|
public String getTime() { |
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
Date currentDate = new Date(); |
|
|
Date currentDate = new Date(); |
|
|
|
|
|
|
|
|
queryWrapper.eq(null != dkCheckInRecordDTO.getSysUserName() ,DkCheckInRecord::getSysUserName, dkCheckInRecordDTO.getSysUserName()); |
|
|
queryWrapper.eq(null != dkCheckInRecordDTO.getSysUserName() ,DkCheckInRecord::getSysUserName, dkCheckInRecordDTO.getSysUserName()); |
|
|
queryWrapper.eq(null != dkCheckInRecordDTO.getCheckInTime(), DkCheckInRecord::getCheckInTime, dkCheckInRecordDTO.getCheckInTime()); |
|
|
queryWrapper.eq(null != dkCheckInRecordDTO.getCheckInTime(), DkCheckInRecord::getCheckInTime, dkCheckInRecordDTO.getCheckInTime()); |
|
|
if (null != dkCheckInRecordDTO.getCheckInStatus()) { |
|
|
if (null != dkCheckInRecordDTO.getCheckInStatus()) { |
|
|
queryWrapper.eq(null != dkCheckInRecordDTO.getCheckInStatus(), DkCheckInRecord::getClockInStatus, |
|
|
|
|
|
dkCheckInRecordDTO.getCheckInStatus()).or().eq(null != dkCheckInRecordDTO.getCheckInStatus(), |
|
|
|
|
|
DkCheckInRecord::getClockOutStatus, dkCheckInRecordDTO.getCheckInStatus()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//未打卡 |
|
|
|
|
|
if ("0".equals(dkCheckInRecordDTO.getCheckInStatus())) { |
|
|
|
|
|
queryWrapper.eq( DkCheckInRecord::getClockInStatus,dkCheckInRecordDTO.getCheckInStatus()); |
|
|
|
|
|
queryWrapper.eq( DkCheckInRecord::getClockOutStatus,dkCheckInRecordDTO.getCheckInStatus()); |
|
|
|
|
|
} |
|
|
|
|
|
//上班打卡 迟到 |
|
|
|
|
|
if ("1".equals(dkCheckInRecordDTO.getCheckInStatus())||"3".equals(dkCheckInRecordDTO.getCheckInStatus())) { |
|
|
|
|
|
queryWrapper.eq( DkCheckInRecord::getClockInStatus,dkCheckInRecordDTO.getCheckInStatus()); |
|
|
|
|
|
} |
|
|
|
|
|
//下班打卡 早退 |
|
|
|
|
|
if ("2".equals(dkCheckInRecordDTO.getCheckInStatus())||"4".equals(dkCheckInRecordDTO.getCheckInStatus())) { |
|
|
|
|
|
queryWrapper.eq( DkCheckInRecord::getClockOutStatus,dkCheckInRecordDTO.getCheckInStatus()); |
|
|
|
|
|
} |
|
|
|
|
|
//更新打卡 |
|
|
|
|
|
if ("5".equals(dkCheckInRecordDTO.getCheckInStatus())) { |
|
|
|
|
|
|
|
|
// queryWrapper.eq(null != dkCheckInRecordDTO.getExportRange(), DkCheckInRecord::getExportRange, dkCheckInRecordDTO.getExportRange()); |
|
|
|
|
|
if(dkCheckInRecordDTO.getStrDay() != null){ |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//考勤日期 查询 |
|
|
|
|
|
if(StringUtils.isNotBlank(dkCheckInRecordDTO.getStrDay())){ |
|
|
queryWrapper.between(DkCheckInRecord::getCheckInTime, TimeUtils.getStartTime(dkCheckInRecordDTO.getStrDay()), |
|
|
queryWrapper.between(DkCheckInRecord::getCheckInTime, TimeUtils.getStartTime(dkCheckInRecordDTO.getStrDay()), |
|
|
TimeUtils.getEndTime(dkCheckInRecordDTO.getStrDay())); |
|
|
TimeUtils.getEndTime(dkCheckInRecordDTO.getStrDay())); |
|
|
} |
|
|
} |
|
|
if(dkCheckInRecordDTO.getStrMonth() != null){ |
|
|
|
|
|
|
|
|
//导出excel 考勤月 |
|
|
|
|
|
if(StringUtils.isNotBlank(dkCheckInRecordDTO.getStrMonth())){ |
|
|
queryWrapper.between(DkCheckInRecord::getCheckInTime, TimeUtils.getFirstDayOfMonth(dkCheckInRecordDTO.getStrMonth()), |
|
|
queryWrapper.between(DkCheckInRecord::getCheckInTime, TimeUtils.getFirstDayOfMonth(dkCheckInRecordDTO.getStrMonth()), |
|
|
TimeUtils.getLastDayOfMonth(dkCheckInRecordDTO.getStrMonth())); |
|
|
TimeUtils.getLastDayOfMonth(dkCheckInRecordDTO.getStrMonth())); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//考勤组查询 |
|
|
|
|
|
if (dkCheckInRecordDTO.getAttendanceGroupIds()!=null&&dkCheckInRecordDTO.getAttendanceGroupIds().size()>0) { |
|
|
|
|
|
queryWrapper.in(DkCheckInRecord::getAttendanceGroupId,dkCheckInRecordDTO.getAttendanceGroupIds()); |
|
|
|
|
|
} |
|
|
queryWrapper.orderByDesc(DkCheckInRecord::getSysUserName).orderByDesc(DkCheckInRecord::getCheckInTime); |
|
|
queryWrapper.orderByDesc(DkCheckInRecord::getSysUserName).orderByDesc(DkCheckInRecord::getCheckInTime); |
|
|
|
|
|
|
|
|
return queryWrapper; |
|
|
return queryWrapper; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 查询预警结果列表 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public List<DkCheckInRecordDTO> queryList(DkCheckInRecordDTO dkCheckInRecordDTO) { |
|
|
|
|
|
LambdaQueryWrapper<DkCheckInRecord> queryWrapper = buildQueryWrapper(dkCheckInRecordDTO); |
|
|
|
|
|
List<DkCheckInRecordDTO> dkCheckInRecordDTOS = dkMapper.selectVoList(queryWrapper); |
|
|
|
|
|
dkCheckInRecordDTOS.forEach(dk -> { |
|
|
|
|
|
if("0".equals(dk.getCheckInStatus())){ |
|
|
|
|
|
dk.setCheckInStatus("正常"); |
|
|
|
|
|
} |
|
|
|
|
|
if("1".equals(dk.getCheckInStatus())){ |
|
|
|
|
|
dk.setCheckInStatus("迟到"); |
|
|
|
|
|
} |
|
|
|
|
|
if("2".equals(dk.getCheckInStatus())){ |
|
|
|
|
|
dk.setCheckInStatus("缺卡"); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
return dkCheckInRecordDTOS; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 导出考勤 excel |
|
|
* 导出考勤 excel |
|
|
* @param dkCheckInRecordDTO |
|
|
* @param dkCheckInRecordDTO |
|
|
|
|
|
|
|
|
if(Constans.GUONEI.equals(dkCheckInRecordDTO.getModelType())){ |
|
|
if(Constans.GUONEI.equals(dkCheckInRecordDTO.getModelType())){ |
|
|
// 构造导出数据 |
|
|
// 构造导出数据 |
|
|
EmployeeAttendance attendanceData = prepareSampleData(dkCheckInRecordDTO); |
|
|
EmployeeAttendance attendanceData = prepareSampleData(dkCheckInRecordDTO); |
|
|
|
|
|
//计算总共 迟到 早退次数 |
|
|
if(attendanceData.getChidaocishu() > 0){ |
|
|
if(attendanceData.getChidaocishu() > 0){ |
|
|
latePersonCount ++; |
|
|
latePersonCount ++; |
|
|
lateCount = lateCount + attendanceData.getChidaocishu(); |
|
|
lateCount = lateCount + attendanceData.getChidaocishu(); |
|
|
|
|
|
|
|
|
/* if (attendanceData.getDayRecords().size() == 0){ |
|
|
/* if (attendanceData.getDayRecords().size() == 0){ |
|
|
continue; |
|
|
continue; |
|
|
}*/ |
|
|
}*/ |
|
|
|
|
|
//excel内容构建 |
|
|
fillTemplate(newSheet, attendanceData,dkCheckInRecordDTO.getStrMonth(),user); |
|
|
fillTemplate(newSheet, attendanceData,dkCheckInRecordDTO.getStrMonth(),user); |
|
|
} |
|
|
} |
|
|
// 日本模版 |
|
|
// 日本模版 |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public int updateDkRecord(DkCheckInRecordDTO dkCheckInRecordDTO) { |
|
|
|
|
|
AppDTO appDTO = dkAttendanceGroupMapper.queryAttendanceGroupBYUserId(dkCheckInRecordDTO.getSysUserId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UpdateWrapper<DkCheckInRecord> updateWrapper =new UpdateWrapper(); |
|
|
|
|
|
updateWrapper.eq("id",dkCheckInRecordDTO.getId()); |
|
|
|
|
|
updateWrapper.eq("sys_user_id",dkCheckInRecordDTO.getSysUserId()); |
|
|
|
|
|
//备注 |
|
|
|
|
|
updateWrapper.set("description",dkCheckInRecordDTO.getDescription()); |
|
|
|
|
|
updateWrapper.set("update_time",LocalDateTime.now(ZoneId.of("Asia/Shanghai"))); |
|
|
|
|
|
updateWrapper.set("update_by",LoginHelper.getUsername()); |
|
|
|
|
|
|
|
|
|
|
|
//上班时间 |
|
|
|
|
|
if (dkCheckInRecordDTO.getClockIn()!=null) { |
|
|
|
|
|
//规定上班时间 |
|
|
|
|
|
String workStartTime = appDTO.getWorkStartTime(); |
|
|
|
|
|
if (isLate(workStartTime,dkCheckInRecordDTO.getClockIn())) { |
|
|
|
|
|
updateWrapper.set("clock_in_status","3"); |
|
|
|
|
|
updateWrapper.set("check_in_status","3"); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
updateWrapper.set("clock_in_status","1"); |
|
|
|
|
|
updateWrapper.set("check_in_status","1"); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
updateWrapper.set("clock_in",dkCheckInRecordDTO.getClockIn()); |
|
|
|
|
|
//考勤时间跟随变化 |
|
|
|
|
|
updateWrapper.set("check_in_time",dkCheckInRecordDTO.getClockIn()); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
//下班时间 |
|
|
|
|
|
if (dkCheckInRecordDTO.getClockOut()!=null) { |
|
|
|
|
|
//规定下班时间 |
|
|
|
|
|
String workEndTime = appDTO.getWorkEndTime(); |
|
|
|
|
|
if (isEarlyLeave(workEndTime,dkCheckInRecordDTO.getClockOut())) { |
|
|
|
|
|
updateWrapper.set("clock_out_status","4"); |
|
|
|
|
|
updateWrapper.set("check_in_status","4"); |
|
|
|
|
|
} else { |
|
|
|
|
|
updateWrapper.set("clock_out_status","2"); |
|
|
|
|
|
updateWrapper.set("check_in_status","2"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
updateWrapper.set("clock_out",dkCheckInRecordDTO.getClockOut()); |
|
|
|
|
|
//考勤时间跟随变化 |
|
|
|
|
|
updateWrapper.set("check_in_time",dkCheckInRecordDTO.getClockOut()); |
|
|
|
|
|
} |
|
|
|
|
|
return dkMapper.update(null,updateWrapper); |
|
|
|
|
|
} |
|
|
|
|
|
/** |
|
|
|
|
|
* 判断是否迟到 |
|
|
|
|
|
* |
|
|
|
|
|
* @param ruleStartTime 规定上班时间(格式:HH:mm,例如 "08:30") |
|
|
|
|
|
* @param clockIn 实际上班打卡时间 |
|
|
|
|
|
* @return true = 迟到,false = 正常 |
|
|
|
|
|
*/ |
|
|
|
|
|
public static boolean isLate(String ruleStartTime, LocalDateTime clockIn) { |
|
|
|
|
|
// 解析成 LocalTime |
|
|
|
|
|
LocalTime startTime = LocalTime.parse(ruleStartTime); |
|
|
|
|
|
// 获取当天规定的上班时间点 |
|
|
|
|
|
LocalDateTime startDateTime = LocalDateTime.of(clockIn.toLocalDate(), startTime); |
|
|
|
|
|
// 如果打卡时间在规定上班时间之后,就迟到 |
|
|
|
|
|
return clockIn.isAfter(startDateTime); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 判断是否早退 |
|
|
|
|
|
* |
|
|
|
|
|
* @param ruleEndTime 规定下班时间(格式:HH:mm,例如 "17:30") |
|
|
|
|
|
* @param clockOut 实际下班打卡时间 |
|
|
|
|
|
* @return true = 早退,false = 正常 |
|
|
|
|
|
*/ |
|
|
|
|
|
public static boolean isEarlyLeave(String ruleEndTime, LocalDateTime clockOut) { |
|
|
|
|
|
// 解析成 LocalTime |
|
|
|
|
|
LocalTime endTime = LocalTime.parse(ruleEndTime); |
|
|
|
|
|
// 获取当天规定的下班时间点 |
|
|
|
|
|
LocalDateTime endDateTime = LocalDateTime.of(clockOut.toLocalDate(), endTime); |
|
|
|
|
|
// 如果打卡时间在规定下班时间之前,就早退 |
|
|
|
|
|
return clockOut.isBefore(endDateTime); |
|
|
|
|
|
} |
|
|
/*--------------------------------------------------国内汇总信息 --------------------------*/ |
|
|
/*--------------------------------------------------国内汇总信息 --------------------------*/ |
|
|
private void fillTemplateHuiZong(Sheet sheet, int latePersonCount, int earlyPersonCount, int lateCount, |
|
|
private void fillTemplateHuiZong(Sheet sheet, int latePersonCount, int earlyPersonCount, int lateCount, |
|
|
int earlyCount) { |
|
|
int earlyCount) { |
|
|
|
|
|
|
|
|
if (dk.getClockIn().isBefore(lunchStartTime1)) { |
|
|
if (dk.getClockIn().isBefore(lunchStartTime1)) { |
|
|
// 午休之前 打卡时间在规定上班时间后 使用打卡时间 否则使用规定上班时间 计算 |
|
|
// 午休之前 打卡时间在规定上班时间后 使用打卡时间 否则使用规定上班时间 计算 |
|
|
Overtime = calculateOvertime(dk.getClockIn().isAfter(workStartTime1)?dk.getClockIn():workStartTime1, |
|
|
Overtime = calculateOvertime(dk.getClockIn().isAfter(workStartTime1)?dk.getClockIn():workStartTime1, |
|
|
dk.getClockOut(),Double.valueOf(lunchTime)); |
|
|
|
|
|
|
|
|
dk.getClockOut(),Double.valueOf(lunchTime),true); |
|
|
|
|
|
|
|
|
}else if (dk.getClockIn().isAfter(lunchStartTime1)){ |
|
|
}else if (dk.getClockIn().isAfter(lunchStartTime1)){ |
|
|
//午休之后 打卡时间计算 |
|
|
//午休之后 打卡时间计算 |
|
|
Overtime = calculateOvertime(dk.getClockIn(),dk.getClockOut(),0); |
|
|
|
|
|
|
|
|
Overtime = calculateOvertime(dk.getClockIn(),dk.getClockOut(),0,false); |
|
|
} else { |
|
|
} else { |
|
|
//午休中 使用午休结束时间计算 |
|
|
//午休中 使用午休结束时间计算 |
|
|
Overtime = calculateOvertime(lunchEndTime1,dk.getClockOut(),0); |
|
|
|
|
|
|
|
|
Overtime = calculateOvertime(lunchEndTime1,dk.getClockOut(),0,false); |
|
|
} |
|
|
} |
|
|
//转换时间格式 |
|
|
//转换时间格式 |
|
|
dayRecord.setXiuxiri(formatOvertime(Overtime)); |
|
|
dayRecord.setXiuxiri(formatOvertime(Overtime)); |
|
|
|
|
|
|
|
|
if(dk.getClockOut() != null){ |
|
|
if(dk.getClockOut() != null){ |
|
|
if(dk.getClockOut().isAfter(workEndTime1)){ |
|
|
if(dk.getClockOut().isAfter(workEndTime1)){ |
|
|
// 计算时间差 规定的下班打卡时间 和下班打卡时间差值 |
|
|
// 计算时间差 规定的下班打卡时间 和下班打卡时间差值 |
|
|
double Overtime = calculateOvertime(workEndTime1,dk.getClockOut(),0.5); |
|
|
|
|
|
|
|
|
double Overtime = calculateOvertime(workEndTime1,dk.getClockOut(),0.5,false); |
|
|
dayRecord.setGongzuori(formatOvertime(Overtime)); |
|
|
dayRecord.setGongzuori(formatOvertime(Overtime)); |
|
|
//工作日加班合计 |
|
|
//工作日加班合计 |
|
|
workOverTime = workOverTime.add(new BigDecimal(Overtime)); |
|
|
workOverTime = workOverTime.add(new BigDecimal(Overtime)); |
|
|
|
|
|
|
|
|
* 计算加班时间,返回格式为 HH:mm:ss。如果加班时间为0则返回空字符串。 |
|
|
* 计算加班时间,返回格式为 HH:mm:ss。如果加班时间为0则返回空字符串。 |
|
|
* @param start 开始时间 |
|
|
* @param start 开始时间 |
|
|
* @param end 结束时间 |
|
|
* @param end 结束时间 |
|
|
* @param baseWorkHours 标准工作时长(比如 9.5) |
|
|
|
|
|
|
|
|
* @param deductHours 扣除时间(比如 0.5) |
|
|
|
|
|
* @param isCalculateDeduct 计算扣除时间 |
|
|
* @return 加班时长,格式为 "1:30:00",若无加班则返回 "" |
|
|
* @return 加班时长,格式为 "1:30:00",若无加班则返回 "" |
|
|
*/ |
|
|
*/ |
|
|
public static double calculateOvertime(LocalDateTime start, LocalDateTime end, double baseWorkHours) { |
|
|
|
|
|
|
|
|
public static double calculateOvertime(LocalDateTime start, LocalDateTime end, double deductHours,boolean isCalculateDeduct) { |
|
|
// 计算时间差(分钟) |
|
|
// 计算时间差(分钟) |
|
|
long minutes = Duration.between(start, end).toMinutes(); |
|
|
long minutes = Duration.between(start, end).toMinutes(); |
|
|
|
|
|
|
|
|
// 转换为小时(带小数) |
|
|
// 转换为小时(带小数) |
|
|
double totalHours = minutes / 60.0; |
|
|
double totalHours = minutes / 60.0; |
|
|
|
|
|
|
|
|
// 减去标准工时 小时 |
|
|
|
|
|
double overtime = totalHours - baseWorkHours; |
|
|
|
|
|
|
|
|
//扣除时间 |
|
|
|
|
|
double overtime = totalHours - deductHours; |
|
|
|
|
|
|
|
|
// 如果没超出,直接返回 0 |
|
|
|
|
|
|
|
|
// 如果加班时间没有超过 deductHours 返回0 |
|
|
if (overtime <= 0) { |
|
|
if (overtime <= 0) { |
|
|
return 0d; |
|
|
return 0d; |
|
|
} |
|
|
} |
|
|
double floored = Math.floor(overtime * 2) / 2.0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double floored = 0d; |
|
|
|
|
|
|
|
|
|
|
|
if (isCalculateDeduct) { |
|
|
|
|
|
floored = Math.floor(overtime * 2) / 2.0; |
|
|
|
|
|
} else { |
|
|
|
|
|
floored = Math.floor(totalHours * 2) / 2.0; |
|
|
|
|
|
} |
|
|
return floored; |
|
|
return floored; |
|
|
} |
|
|
} |
|
|
public static String formatOvertime(double Overtime) { |
|
|
public static String formatOvertime(double Overtime) { |