Преглед на файлове

添加导出汇总

main
1341924763@qq.com преди 2 дни
родител
ревизия
f8203c6439

Двоични данни
ruoyi-admin/src/main/resources/template/template-guonei.xlsx Целия файл


+ 29
- 0
zs-manager/src/main/java/com/ruoyi/zhushi/entity/EmployeeAttendance.java Целия файл

@@ -1,5 +1,6 @@
package com.ruoyi.zhushi.entity;

import java.math.BigDecimal;
import java.util.List;

public class EmployeeAttendance {
@@ -16,6 +17,10 @@ public class EmployeeAttendance {
private int chidaocishu = 0;
private int zaotuirenshu = 0;
private int zaotuicishu = 0;
private java.math.BigDecimal workOverTime;
private java.math.BigDecimal restOverTime;

private BigDecimal exceptionCount;

// getters and setters

@@ -114,4 +119,28 @@ public class EmployeeAttendance {
public void setZaotuicishu(int zaotuicishu) {
this.zaotuicishu = zaotuicishu;
}

public BigDecimal getWorkOverTime() {
return workOverTime;
}

public void setWorkOverTime(BigDecimal workOverTime) {
this.workOverTime = workOverTime;
}

public BigDecimal getRestOverTime() {
return restOverTime;
}

public void setRestOverTime(BigDecimal restOverTime) {
this.restOverTime = restOverTime;
}

public BigDecimal getExceptionCount() {
return exceptionCount;
}

public void setExceptionCount(BigDecimal exceptionCount) {
this.exceptionCount = exceptionCount;
}
}

+ 105
- 23
zs-manager/src/main/java/com/ruoyi/zhushi/service/impl/DkRecordServiceImpl.java Целия файл

@@ -306,6 +306,13 @@ public class DkRecordServiceImpl implements DkRecordService {
int lateCount = 0;
// 定义早退次数
int earlyCount = 0;
// 工作日加班时间
BigDecimal workOverTime = new BigDecimal(0);
// 休息日加班时间
BigDecimal restOverTime = new BigDecimal(0);
// 异常数量
BigDecimal exceptionCount = new BigDecimal(0);

for(DkCheckInRecordDTO dk : dkCheckInRecordDTOS){
// 根据打卡时间获取日期
LocalDate localDate = dk.getCheckInTime() != null ? dk.getCheckInTime().toLocalDate() : LocalDate.now();
@@ -343,20 +350,34 @@ public class DkRecordServiceImpl implements DkRecordService {
if(dk.getClockIn() != null && dk.getClockOut() == null){
dayRecord.setYichang("*");
dayRecord.setRemark("异常打卡");
exceptionCount = exceptionCount.add(new BigDecimal(1));
if(dk.getClockIn().isAfter(workStartTime1)){
dayRecord.setChidao("*");
lateCount ++;
}
}
if(dk.getClockIn() == null && dk.getClockOut() != null){
dayRecord.setYichang("*");
dayRecord.setRemark("异常打卡");
exceptionCount = exceptionCount.add(new BigDecimal(1));

if(dk.getClockOut().isBefore(workEndTime1)){
dayRecord.setChidao("*");
earlyCount ++;
}
}
if(dk.getClockIn() == null && dk.getClockOut() == null){
dayRecord.setRemark("缺卡");
}

// 判断是否为工作日加班
if(dk.getClockOut() != null){
if(dk.getClockOut().isAfter(workEndTime1)){

// 判断是否为休假日加班
if(Constans.EXPORT_ZHOULIU==week || Constans.EXPORT_ZHOURI== week){
if(dk.getClockIn() != null && dk.getClockOut() != null){
dayRecord.setXiuxiri("*");
dayRecord.setRemark("加班1次");
// 计算时间差
Duration duration = Duration.between(workEndTime1, dk.getClockOut());
Duration duration = Duration.between(dk.getClockIn(), dk.getClockOut());
// 获取小时差(注意:此方法会舍去分钟和秒部分)
long hours1 = duration.toMinutes(); // 结果:6 小时(15:45 - 09:30 = 6小时15分钟)

@@ -365,15 +386,30 @@ public class DkRecordServiceImpl implements DkRecordService {
BigDecimal b = new BigDecimal("60");
// 执行除法,指定精度和舍入模式
BigDecimal result = a.divide(b, 1, BigDecimal.ROUND_HALF_UP);
dayRecord.setGongzuori("*");
dayRecord.setRemark("加班1次:" + result + "小时");
restOverTime = restOverTime.add(result);
}
}
}else {
// 判断是否为工作日加班
if(dk.getClockOut() != null){
if(dk.getClockOut().isAfter(workEndTime1)){
// 计算时间差
Duration duration = Duration.between(workEndTime1, dk.getClockOut());
// 获取小时差(注意:此方法会舍去分钟和秒部分)
long hours1 = duration.toMinutes(); // 结果:6 小时(15:45 - 09:30 = 6小时15分钟)

if(hours1 >= 30){
BigDecimal a = new BigDecimal(hours1);
BigDecimal b = new BigDecimal("60");
// 执行除法,指定精度和舍入模式
BigDecimal result = a.divide(b, 1, BigDecimal.ROUND_HALF_UP);
dayRecord.setGongzuori("*");
dayRecord.setRemark("加班1次:" + result + "小时");

workOverTime = workOverTime.add(result);
}
}
}
}
// 判断是否为休假日加班
if(Constans.ZHOULIU.equals(dk.getWeek()) || Constans.ZHOURI.equals(dk.getWeek())){
dayRecord.setXiuxiri("*");
dayRecord.setRemark("加班1次");
}
// 判断是否为法定节假日加班
// // 获取法定节假日时间
@@ -394,6 +430,9 @@ public class DkRecordServiceImpl implements DkRecordService {
// dayRecords.add(new DayRecord(3, "日", "", "", "休息", "年假", 0, ""));
// 添加更多日期记录...

data.setWorkOverTime(workOverTime);
data.setRestOverTime(restOverTime);
data.setExceptionCount(exceptionCount);
data.setDayRecords(dayRecords);
return data;
}
@@ -447,7 +486,11 @@ public class DkRecordServiceImpl implements DkRecordService {
setCellValue(sheet, 6, 10, data.getEmployeeName());
setCellValue(sheet, 3, 1, data.getDateTime());
// setCellValue(sheet, 2, 0, data.getYear() + "年" + data.getMonth() + "月考勤记录");

// 汇总数据
setCellValue(sheet, 41, 5, data.getChidaocishu());
setCellValue(sheet, 41, 7, data.getExceptionCount());
setCellValue(sheet, 41, 8, data.getWorkOverTime() + "小时");
setCellValue(sheet, 41, 9, data.getRestOverTime() + "小时");

for (DayRecord record : data.getDayRecords()) {
if(record.getDay() == 1){
@@ -647,6 +690,13 @@ public class DkRecordServiceImpl implements DkRecordService {
// 定义早退次数
int earlyCount = 0;

// 工作日加班时间
BigDecimal workOverTime = new BigDecimal(0);
// 休息日加班时间
BigDecimal restOverTime = new BigDecimal(0);
// 异常数量
BigDecimal exceptionCount = new BigDecimal(0);

// 定义集合,用于存储每天打卡记录
List<DayRecord> dayRecords = new ArrayList<>();
// 根据用户的ID查询该用户所有的打卡记录
@@ -702,21 +752,35 @@ public class DkRecordServiceImpl implements DkRecordService {
if(dk.getClockIn() != null && dk.getClockOut() == null){
dayRecord.setYichang("*");
dayRecord.setRemark("异常打卡");
exceptionCount = exceptionCount.add(new BigDecimal(1));
if(dk.getClockIn().isAfter(workStartTime1)){
dayRecord.setChidao("*");
lateCount ++;
}
}

if(dk.getClockIn() == null && dk.getClockOut() != null){
dayRecord.setYichang("*");
dayRecord.setRemark("异常打卡");
exceptionCount = exceptionCount.add(new BigDecimal(1));

if(dk.getClockOut().isBefore(workEndTime1)){
dayRecord.setChidao("*");
earlyCount ++;
}
}
if(dk.getClockIn() == null && dk.getClockOut() == null){
dayRecord.setRemark("缺卡");
}

// 判断是否为工作日加班
if(dk.getClockOut() != null){
if(dk.getClockOut().isAfter(workEndTime1)){

// 判断是否为休假日加班
if(Constans.EXPORT_ZHOULIU==week || Constans.EXPORT_ZHOURI==week){
if(dk.getClockIn() != null && dk.getClockOut() != null){
dayRecord.setXiuxiri("*");
dayRecord.setRemark("加班1次");
// 计算时间差
Duration duration = Duration.between(workEndTime1, dk.getClockOut());
Duration duration = Duration.between(dk.getClockIn(), dk.getClockOut());
// 获取小时差(注意:此方法会舍去分钟和秒部分)
long hours1 = duration.toMinutes(); // 结果:6 小时(15:45 - 09:30 = 6小时15分钟)

@@ -725,15 +789,30 @@ public class DkRecordServiceImpl implements DkRecordService {
BigDecimal b = new BigDecimal("60");
// 执行除法,指定精度和舍入模式
BigDecimal result = a.divide(b, 1, BigDecimal.ROUND_HALF_UP);
dayRecord.setGongzuori("*");
dayRecord.setRemark("加班1次:" + result + "小时");
restOverTime = restOverTime.add(result);
}
}
}else{
// 判断是否为工作日加班
if(dk.getClockOut() != null){
if(dk.getClockOut().isAfter(workEndTime1)){
// 计算时间差
Duration duration = Duration.between(workEndTime1, dk.getClockOut());
// 获取小时差(注意:此方法会舍去分钟和秒部分)
long hours1 = duration.toMinutes(); // 结果:6 小时(15:45 - 09:30 = 6小时15分钟)

if(hours1 >= 30){
BigDecimal a = new BigDecimal(hours1);
BigDecimal b = new BigDecimal("60");
// 执行除法,指定精度和舍入模式
BigDecimal result = a.divide(b, 1, BigDecimal.ROUND_HALF_UP);
dayRecord.setGongzuori("*");
dayRecord.setRemark("加班1次:" + result + "小时");

workOverTime = workOverTime.add(result);
}
}
}
}
// 判断是否为休假日加班
if(Constans.ZHOULIU.equals(dk.getWeek()) || Constans.ZHOURI.equals(dk.getWeek())){
dayRecord.setXiuxiri("*");
dayRecord.setRemark("加班1次");
}
// 判断是否为法定节假日加班
// // 获取法定节假日时间
@@ -752,6 +831,9 @@ public class DkRecordServiceImpl implements DkRecordService {
// 添加更多日期记录...
data.setChidaocishu(lateCount);
data.setZaotuicishu(earlyCount);
data.setWorkOverTime(workOverTime);
data.setRestOverTime(restOverTime);
data.setExceptionCount(exceptionCount);
data.setDayRecords(dayRecords);
return data;
}

Loading…
Отказ
Запис