#45-Registro Semanal de Horas Trabajadas corregir duplicados
This commit is contained in:
parent
ebb5454b29
commit
e2f128c301
@ -25,7 +25,7 @@ public class Actividad extends BaseEntity {
|
|||||||
private String tarea;
|
private String tarea;
|
||||||
private double horas;
|
private double horas;
|
||||||
|
|
||||||
public Actividad() {}
|
public Actividad() { }
|
||||||
|
|
||||||
public Actividad(final Builder builder) {
|
public Actividad(final Builder builder) {
|
||||||
this.nombre = builder.nombre;
|
this.nombre = builder.nombre;
|
||||||
@ -49,46 +49,46 @@ public class Actividad extends BaseEntity {
|
|||||||
return nombre;
|
return nombre;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLunes(double lunes) {
|
public void setLunes(final double lunes) {
|
||||||
this.lunes = lunes;
|
this.lunes = lunes;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMartes(double martes) {
|
public void setMartes(final double martes) {
|
||||||
this.martes = martes;
|
this.martes = martes;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMiercoles(double miercoles) {
|
public void setMiercoles(final double miercoles) {
|
||||||
this.miercoles = miercoles;
|
this.miercoles = miercoles;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setJueves(double jueves) {
|
public void setJueves(final double jueves) {
|
||||||
this.jueves = jueves;
|
this.jueves = jueves;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setViernes(double viernes) {
|
public void setViernes(final double viernes) {
|
||||||
this.viernes = viernes;
|
this.viernes = viernes;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSabado(double sabado) {
|
public void setSabado(final double sabado) {
|
||||||
this.sabado = sabado;
|
this.sabado = sabado;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDomingo(double domingo) {
|
public void setDomingo(final double domingo) {
|
||||||
this.domingo = domingo;
|
this.domingo = domingo;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
public void setTarea(String tarea) {
|
public void setTarea(final String tarea) {
|
||||||
this.tarea = tarea;
|
this.tarea = tarea;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHoras(double horas) {
|
public void setHoras(final double horas) {
|
||||||
this.horas = horas;
|
this.horas = horas;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -27,13 +27,13 @@ public class HoursWorked extends BaseEntity {
|
|||||||
private LocalDate fecha;
|
private LocalDate fecha;
|
||||||
|
|
||||||
|
|
||||||
public HoursWorked() {}
|
public HoursWorked() { }
|
||||||
|
|
||||||
public Actividad getActividad() {
|
public Actividad getActividad() {
|
||||||
return this.actividad;
|
return this.actividad;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setActividad(Actividad actividad){
|
public void setActividad(final Actividad actividad) {
|
||||||
this.actividad = actividad;
|
this.actividad = actividad;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,9 @@ public class HoursWorked extends BaseEntity {
|
|||||||
this.weekNumber = weekNumber;
|
this.weekNumber = weekNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalDate getFecha() { return this.fecha;}
|
public LocalDate getFecha() {
|
||||||
|
return this.fecha;
|
||||||
|
}
|
||||||
|
|
||||||
public double getTotalHours() {
|
public double getTotalHours() {
|
||||||
return totalHours;
|
return totalHours;
|
||||||
|
@ -5,6 +5,7 @@ import com.primefactorsolutions.model.HoursWorked;
|
|||||||
import com.primefactorsolutions.service.EmployeeService;
|
import com.primefactorsolutions.service.EmployeeService;
|
||||||
import com.primefactorsolutions.service.HoursWorkedService;
|
import com.primefactorsolutions.service.HoursWorkedService;
|
||||||
import com.vaadin.flow.component.grid.Grid;
|
import com.vaadin.flow.component.grid.Grid;
|
||||||
|
import com.vaadin.flow.component.html.H2;
|
||||||
import com.vaadin.flow.component.notification.Notification;
|
import com.vaadin.flow.component.notification.Notification;
|
||||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||||
import com.vaadin.flow.component.textfield.TextField;
|
import com.vaadin.flow.component.textfield.TextField;
|
||||||
@ -15,13 +16,9 @@ import com.vaadin.flow.router.PageTitle;
|
|||||||
import com.vaadin.flow.router.Route;
|
import com.vaadin.flow.router.Route;
|
||||||
import com.vaadin.flow.spring.annotation.SpringComponent;
|
import com.vaadin.flow.spring.annotation.SpringComponent;
|
||||||
import jakarta.annotation.security.PermitAll;
|
import jakarta.annotation.security.PermitAll;
|
||||||
import jakarta.persistence.ManyToOne;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import com.vaadin.flow.component.html.Label;
|
import com.vaadin.flow.component.html.Label;
|
||||||
import org.springframework.web.servlet.HandlerMapping;
|
|
||||||
import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
|
||||||
import org.vaadin.firitin.components.datepicker.VDatePicker;
|
import org.vaadin.firitin.components.datepicker.VDatePicker;
|
||||||
|
|
||||||
|
|
||||||
@ -36,19 +33,18 @@ import java.util.Locale;
|
|||||||
@SpringComponent
|
@SpringComponent
|
||||||
@PermitAll
|
@PermitAll
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@PageTitle("Hours Worked")
|
@PageTitle("Horas Trabajadas")
|
||||||
@Route(value = "/hours-worked/me", layout = MainLayout.class)
|
@Route(value = "/hours-worked/me", layout = MainLayout.class)
|
||||||
public class HoursWorkedView extends VerticalLayout {
|
public class HoursWorkedView extends VerticalLayout {
|
||||||
@ManyToOne
|
|
||||||
private Actividad actividad;
|
|
||||||
|
|
||||||
private final List<Actividad> actividades = new ArrayList<>();
|
private final List<Actividad> actividades = new ArrayList<>();
|
||||||
private final List<Actividad> actividadesEspecificas = new ArrayList<>(); // Nueva lista para tareas específicas
|
private final List<Actividad> actividadesEspecificas = new ArrayList<>(); // Nueva lista para tareas específicas
|
||||||
private final Grid<Actividad> grid = new Grid<>(Actividad.class);
|
private final Grid<Actividad> grid = new Grid<>(Actividad.class);
|
||||||
private final Grid<Actividad> gridActividadesEspecificas = new Grid<>(Actividad.class);
|
private final Grid<Actividad> gridActividadesEspecificas = new Grid<>(Actividad.class);
|
||||||
|
|
||||||
private final ComboBox<Employee> employeeComboBox = new ComboBox<>("Employee");
|
private final ComboBox<Employee> employeeComboBox = new ComboBox<>("Empleado");
|
||||||
private final ComboBox<String> equipoDropdown = new ComboBox<>("Equipo");
|
private final ComboBox<String> equipoDropdown = new ComboBox<>("Equipo");
|
||||||
|
private VDatePicker fechaPicker = new VDatePicker("Selecciona una fecha");
|
||||||
|
|
||||||
|
|
||||||
private final ComboBox<String> tareasEspecificasDropdown = new ComboBox<>("Tareas Específicas");
|
private final ComboBox<String> tareasEspecificasDropdown = new ComboBox<>("Tareas Específicas");
|
||||||
private final TextField tareaEspecificaInput = new TextField("Especificar Tarea");
|
private final TextField tareaEspecificaInput = new TextField("Especificar Tarea");
|
||||||
@ -62,15 +58,11 @@ public class HoursWorkedView extends VerticalLayout {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private final HoursWorkedService hoursWorkedService;
|
private final HoursWorkedService hoursWorkedService;
|
||||||
|
|
||||||
private final Label fechasLabel = new Label("Selecciona una semana para ver las fechas.");
|
private final H2 equipoLabel = new H2("Tareas del Cliente/Equipo");
|
||||||
|
private final H2 empresaLabel = new H2("Tareas de la Empresa");
|
||||||
private final Label totalCompletadoLabel = new Label();
|
private final Label totalCompletadoLabel = new Label();
|
||||||
private final Label horasPendientesLabel = new Label();
|
private final Label horasPendientesLabel = new Label();
|
||||||
|
|
||||||
private final Label numeroSemanaLabel = new Label("Número de la Semana: ");
|
|
||||||
|
|
||||||
private VDatePicker fechaPicker = new VDatePicker("Selecciona una fecha");
|
|
||||||
|
|
||||||
|
|
||||||
public HoursWorkedView(final EmployeeService employeeService, final HoursWorkedService hoursWorkedService) {
|
public HoursWorkedView(final EmployeeService employeeService, final HoursWorkedService hoursWorkedService) {
|
||||||
this.employeeService = employeeService;
|
this.employeeService = employeeService;
|
||||||
this.hoursWorkedService = hoursWorkedService;
|
this.hoursWorkedService = hoursWorkedService;
|
||||||
@ -149,10 +141,7 @@ public class HoursWorkedView extends VerticalLayout {
|
|||||||
LocalDate selectedDate = event.getValue();
|
LocalDate selectedDate = event.getValue();
|
||||||
if (selectedDate != null) {
|
if (selectedDate != null) {
|
||||||
selectedStartOfWeek = getStartOfWeek(selectedDate);
|
selectedStartOfWeek = getStartOfWeek(selectedDate);
|
||||||
LocalDate endOfWeek = selectedStartOfWeek.plusDays(6);
|
|
||||||
weekNumber = getWeekOfYear(selectedDate);
|
weekNumber = getWeekOfYear(selectedDate);
|
||||||
fechasLabel.setText("Semana del " + selectedStartOfWeek + " al " + endOfWeek);
|
|
||||||
numeroSemanaLabel.setText("Número de la Semana: " + weekNumber);
|
|
||||||
cargarDatos();
|
cargarDatos();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -189,12 +178,14 @@ public class HoursWorkedView extends VerticalLayout {
|
|||||||
HorizontalLayout buttonsLayout = new HorizontalLayout(actualizarButton, guardarButton,
|
HorizontalLayout buttonsLayout = new HorizontalLayout(actualizarButton, guardarButton,
|
||||||
cerrarButton, verMesButton);
|
cerrarButton, verMesButton);
|
||||||
|
|
||||||
VerticalLayout totalesLayout = new VerticalLayout(totalCompletadoLabel, horasPendientesLabel);
|
VerticalLayout totalesLayout = new VerticalLayout(totalCompletadoLabel,
|
||||||
|
horasPendientesLabel);
|
||||||
totalesLayout.setSpacing(true);
|
totalesLayout.setSpacing(true);
|
||||||
totalesLayout.setPadding(true);
|
totalesLayout.setPadding(true);
|
||||||
|
|
||||||
add(fechaPicker, fechasLabel, numeroSemanaLabel, filtersLayout, actividadFormLayout,
|
add(fechaPicker, filtersLayout, actividadFormLayout,
|
||||||
tareasEspecificasLayout, grid, gridActividadesEspecificas, buttonsLayout, totalesLayout);
|
equipoLabel, grid, empresaLabel, tareasEspecificasLayout,
|
||||||
|
gridActividadesEspecificas, buttonsLayout, totalesLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configurarGrid() {
|
private void configurarGrid() {
|
||||||
@ -209,6 +200,7 @@ public class HoursWorkedView extends VerticalLayout {
|
|||||||
grid.addColumn(Actividad::getSabado).setHeader("Sábado");
|
grid.addColumn(Actividad::getSabado).setHeader("Sábado");
|
||||||
grid.addColumn(Actividad::getDomingo).setHeader("Domingo");
|
grid.addColumn(Actividad::getDomingo).setHeader("Domingo");
|
||||||
grid.addColumn(this::calcularTotalPorDia).setHeader("Total Día").setKey("totalDia");
|
grid.addColumn(this::calcularTotalPorDia).setHeader("Total Día").setKey("totalDia");
|
||||||
|
grid.setItems(actividades);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configurarGridActividadesEspecificas() {
|
private void configurarGridActividadesEspecificas() {
|
||||||
@ -294,7 +286,7 @@ public class HoursWorkedView extends VerticalLayout {
|
|||||||
return new HorizontalLayout(actividadNombre, horasInput, agregarActividadButton);
|
return new HorizontalLayout(actividadNombre, horasInput, agregarActividadButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void agregarOActualizarActividad(Actividad nuevaActividad, DayOfWeek dia, double horas) {
|
private void agregarOActualizarActividad(final Actividad nuevaActividad, final DayOfWeek dia, final double horas) {
|
||||||
Actividad actividadExistente = actividades.stream()
|
Actividad actividadExistente = actividades.stream()
|
||||||
.filter(a -> a.getNombre().equals(nuevaActividad.getNombre()))
|
.filter(a -> a.getNombre().equals(nuevaActividad.getNombre()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
@ -414,7 +406,7 @@ public class HoursWorkedView extends VerticalLayout {
|
|||||||
|
|
||||||
private LocalDate getStartOfWeek(final LocalDate date) {
|
private LocalDate getStartOfWeek(final LocalDate date) {
|
||||||
WeekFields weekFields = WeekFields.of(Locale.getDefault());
|
WeekFields weekFields = WeekFields.of(Locale.getDefault());
|
||||||
return date.with(weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
|
return date.with(weekFields.dayOfWeek(), DayOfWeek.FRIDAY.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private double calcularTotalPorDia(final Actividad actividad) {
|
private double calcularTotalPorDia(final Actividad actividad) {
|
||||||
|
@ -50,7 +50,6 @@ public class ReporteView extends VerticalLayout {
|
|||||||
|
|
||||||
private final Span semanaInfoSpan = new Span();
|
private final Span semanaInfoSpan = new Span();
|
||||||
|
|
||||||
|
|
||||||
// Obtener el año actual
|
// Obtener el año actual
|
||||||
private int currentYear = LocalDate.now().getYear();
|
private int currentYear = LocalDate.now().getYear();
|
||||||
|
|
||||||
@ -76,22 +75,19 @@ public class ReporteView extends VerticalLayout {
|
|||||||
// Listener para actualizar `semanaInfoSpan` con la selección del usuario en `semanaComboBox`
|
// Listener para actualizar `semanaInfoSpan` con la selección del usuario en `semanaComboBox`
|
||||||
semanaComboBox.addValueChangeListener(event -> {
|
semanaComboBox.addValueChangeListener(event -> {
|
||||||
String selectedWeek = event.getValue();
|
String selectedWeek = event.getValue();
|
||||||
semanaInfoSpan.setText(selectedWeek != null
|
semanaInfoSpan.setText(selectedWeek != null ? selectedWeek : "Selecciona una semana");
|
||||||
? selectedWeek : "Selecciona una semana");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Button reportButton = new Button("Generar Reporte de Horas Trabajadas",
|
Button reportButton = new Button("Generar Reporte de Horas Trabajadas",
|
||||||
event -> generateHoursWorkedReport());
|
event -> generateHoursWorkedReport());
|
||||||
HorizontalLayout filtersLayout = new HorizontalLayout(equipoComboBox,
|
HorizontalLayout filtersLayout = new HorizontalLayout(equipoComboBox, semanaComboBox, reportButton);
|
||||||
semanaComboBox, reportButton);
|
|
||||||
add(filtersLayout);
|
add(filtersLayout);
|
||||||
|
|
||||||
// Añadir `headerLayout` al diseño principal para el encabezado dinámico
|
// Añadir `headerLayout` al diseño principal para el encabezado dinámico
|
||||||
add(headerLayout);
|
add(headerLayout);
|
||||||
updateHeaderLayout(null, null);
|
updateHeaderLayout(null, null);
|
||||||
|
|
||||||
grid.addColumn(map -> map.get("ID")).setHeader("ID")
|
grid.addColumn(map -> map.get("ID")).setHeader("ID").getElement().getStyle().set("font-weight", "bold");
|
||||||
.getElement().getStyle().set("font-weight", "bold");
|
|
||||||
grid.addColumn(map -> map.get("Employee ID")).setHeader("Employee ID");
|
grid.addColumn(map -> map.get("Employee ID")).setHeader("Employee ID");
|
||||||
grid.addColumn(map -> map.get("Empleado")).setHeader("Empleado");
|
grid.addColumn(map -> map.get("Empleado")).setHeader("Empleado");
|
||||||
grid.addColumn(map -> map.get("Horas Trabajadas")).setHeader("Horas Trabajadas");
|
grid.addColumn(map -> map.get("Horas Trabajadas")).setHeader("Horas Trabajadas");
|
||||||
@ -105,8 +101,7 @@ public class ReporteView extends VerticalLayout {
|
|||||||
int year = LocalDate.now().getYear();
|
int year = LocalDate.now().getYear();
|
||||||
LocalDate startOfYear = LocalDate.of(year, 1, 5); // Suponemos que la semana comienza el 5 de enero.
|
LocalDate startOfYear = LocalDate.of(year, 1, 5); // Suponemos que la semana comienza el 5 de enero.
|
||||||
|
|
||||||
List<String> semanas = startOfYear.datesUntil(LocalDate
|
List<String> semanas = startOfYear.datesUntil(LocalDate.of(year + 1, 1, 1),
|
||||||
.of(year + 1, 1, 1),
|
|
||||||
java.time.Period.ofWeeks(1))
|
java.time.Period.ofWeeks(1))
|
||||||
.map(date -> {
|
.map(date -> {
|
||||||
int weekNumber = date.get(WeekFields.of(DayOfWeek.MONDAY, 1)
|
int weekNumber = date.get(WeekFields.of(DayOfWeek.MONDAY, 1)
|
||||||
@ -133,27 +128,23 @@ public class ReporteView extends VerticalLayout {
|
|||||||
String selectedWeek = semanaComboBox.getValue();
|
String selectedWeek = semanaComboBox.getValue();
|
||||||
if (selectedEquipo == null || selectedWeek == null) {
|
if (selectedEquipo == null || selectedWeek == null) {
|
||||||
Notification.show("Por favor, selecciona un equipo y una semana para generar el reporte.",
|
Notification.show("Por favor, selecciona un equipo y una semana para generar el reporte.",
|
||||||
3000,
|
3000, Notification.Position.MIDDLE);
|
||||||
Notification.Position.MIDDLE);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int weekNumber = Integer.parseInt(selectedWeek.split(" ")[1]
|
int weekNumber = Integer.parseInt(selectedWeek.split(" ")[1].replace(":", ""));
|
||||||
.replace(":", ""));
|
LocalDate selectedDate = LocalDate.now().with(WeekFields.of(DayOfWeek.FRIDAY, 1)
|
||||||
LocalDate selectedDate = LocalDate.now()
|
.weekOfWeekBasedYear(), weekNumber);
|
||||||
.with(WeekFields.of(DayOfWeek.FRIDAY, 1)
|
|
||||||
.weekOfWeekBasedYear(), weekNumber);
|
|
||||||
updateHeaderLayout(selectedEquipo, selectedDate);
|
updateHeaderLayout(selectedEquipo, selectedDate);
|
||||||
|
|
||||||
List<HoursWorked> hoursWorkedList = hoursWorkedService.findAll().stream()
|
List<HoursWorked> hoursWorkedList = hoursWorkedService.findAll().stream()
|
||||||
.filter(hw -> hw.getEmployee().getTeam().getId()
|
.filter(hw -> hw.getEmployee().getTeam().getId().equals(selectedEquipo
|
||||||
.equals(selectedEquipo.getId()) && hw.getWeekNumber() == weekNumber)
|
.getId()) && hw.getWeekNumber() == weekNumber)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (hoursWorkedList.isEmpty()) {
|
if (hoursWorkedList.isEmpty()) {
|
||||||
Notification.show("No hay horas trabajadas disponibles para generar el reporte.",
|
Notification.show("No hay horas trabajadas disponibles para generar el reporte.",
|
||||||
3000,
|
3000, Notification.Position.MIDDLE);
|
||||||
Notification.Position.MIDDLE);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,8 +179,8 @@ public class ReporteView extends VerticalLayout {
|
|||||||
String formattedEndDate = endOfWeek.getDayOfMonth() + " de "
|
String formattedEndDate = endOfWeek.getDayOfMonth() + " de "
|
||||||
+ endOfWeek.getMonth().getDisplayName(TextStyle.FULL, Locale.getDefault());
|
+ endOfWeek.getMonth().getDisplayName(TextStyle.FULL, Locale.getDefault());
|
||||||
|
|
||||||
headerLayout.add(new Span("Informe " + String.format("%03d", weekNumber)
|
headerLayout.add(new Span("Informe "
|
||||||
+ "/" + currentYear) {{
|
+ String.format("%03d", weekNumber) + "/" + currentYear) {{
|
||||||
getStyle().set("font-size", "24px");
|
getStyle().set("font-size", "24px");
|
||||||
getStyle().set("font-weight", "bold");
|
getStyle().set("font-weight", "bold");
|
||||||
}});
|
}});
|
||||||
@ -213,14 +204,13 @@ public class ReporteView extends VerticalLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateExcelDownloadLink(final List<Map<String, Object>> data,
|
private void generateExcelDownloadLink(final List<Map<String, Object>> data, final int weekNumber) {
|
||||||
final int weekNumber) {
|
|
||||||
try {
|
try {
|
||||||
List<String> headers = List.of("ID", "Employee ID", "Empleado",
|
List<String> headers = List.of("ID", "Employee ID", "Empleado",
|
||||||
"Horas Trabajadas", "Horas Pendientes", "Observaciones");
|
"Horas Trabajadas", "Horas Pendientes", "Observaciones");
|
||||||
String selectedTeam = equipoComboBox.getValue().getName();
|
String selectedTeam = equipoComboBox.getValue().getName();
|
||||||
byte[] excelBytes = reportService.writeAsExcel("hours_worked_report",
|
byte[] excelBytes = reportService.writeAsExcel(
|
||||||
headers, data, selectedTeam, weekNumber, currentYear);
|
"hours_worked_report", headers, data, selectedTeam, weekNumber, currentYear);
|
||||||
|
|
||||||
StreamResource excelResource = new StreamResource("hours_worked_report.xlsx",
|
StreamResource excelResource = new StreamResource("hours_worked_report.xlsx",
|
||||||
() -> new ByteArrayInputStream(excelBytes));
|
() -> new ByteArrayInputStream(excelBytes));
|
||||||
@ -241,13 +231,4 @@ public class ReporteView extends VerticalLayout {
|
|||||||
return date.get(WeekFields.of(Locale.getDefault()).weekOfWeekBasedYear());
|
return date.get(WeekFields.of(Locale.getDefault()).weekOfWeekBasedYear());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCurrentYear() {
|
|
||||||
return currentYear;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Opcional: Si deseas permitir cambiar el año actual manualmente, agrega un setter
|
|
||||||
public void setCurrentYear(final int currentYear) {
|
|
||||||
this.currentYear = currentYear;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user