Skip to content

Commit

Permalink
Merge pull request #39 from consiglionazionaledellericerche/38-svilup…
Browse files Browse the repository at this point in the history
…po-api-rest-per-inserimento-delle-assenze

38 sviluppo api rest per inserimento delle assenze
  • Loading branch information
criluc authored Jun 4, 2024
2 parents e05b1a1 + 5311d9a commit 235fedf
Show file tree
Hide file tree
Showing 36 changed files with 2,150 additions and 154 deletions.

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/main/java/it/cnr/iit/epas/dao/history/HistoricalDao.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Consiglio Nazionale delle Ricerche
* Copyright (C) 2024 Consiglio Nazionale delle Ricerche
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand All @@ -14,7 +14,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package it.cnr.iit.epas.dao.history;

import com.google.common.base.Verify;
Expand All @@ -29,8 +28,8 @@
import javax.inject.Inject;
import javax.inject.Provider;
import javax.persistence.EntityManager;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.envers.AuditReaderFactory;
import org.hibernate.envers.query.AuditEntity;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -160,4 +159,7 @@ public User lastRevisionOperator(BaseEntity entity) {
return lastRevisionOf(entity.getClass(), entity.getId()).revision.owner;
}

public Boolean isPersistent(BaseEntity entity) {
return emp.get().contains(entity);
}
}
40 changes: 40 additions & 0 deletions src/main/java/it/cnr/iit/epas/dto/v4/AbsenceErrorDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (C) 2023 Consiglio Nazionale delle Ricerche
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package it.cnr.iit.epas.dto.v4;

import com.google.common.collect.Lists;
import java.time.LocalDate;
import java.util.List;
import java.util.Set;
import lombok.Data;

/**
* DTO per una specifica giornata all'interno di un periodo di assenze.
*
* @author Cristian Lucchesi
*
*/
@Data
public class AbsenceErrorDto {

public AbsenceShowDto absence;
public String absenceProblem;

public Set<AbsenceShowDto> conflictingAbsences;

}
78 changes: 78 additions & 0 deletions src/main/java/it/cnr/iit/epas/dto/v4/AbsenceFormDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright (C) 2023 Consiglio Nazionale delle Ricerche
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package it.cnr.iit.epas.dto.v4;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import io.swagger.v3.oas.annotations.media.Schema;
import it.cnr.iit.epas.models.absences.CategoryGroupAbsenceType;
import it.cnr.iit.epas.models.absences.GroupAbsenceType;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import lombok.Data;

/**
* DTO per i gruppi di assenza.
*
* @author Cristian Lucchesi
*
*/
@Data
public class AbsenceFormDto {
@Schema(description = "Persona")
private PersonShowDto person;
// switch date
private LocalDate from;
private LocalDate to;
private List<GroupAbsenceTypeDto> groupsPermitted = Lists.newArrayList();
private SortedMap<Integer, CategoryTabDto> tabsVisibile = Maps.newTreeMap();
private boolean permissionDenied = false;

//tab selected
private CategoryTabDto categoryTabSelected;
private boolean hasGroupChoice;
private boolean hasAbsenceTypeChoice;
private boolean hasJustifiedTypeChoice;
private Long theOnlyAbsenceType;
private GroupAbsenceTypeDto groupSelected;
private List<GroupAbsenceTypeDto> groups;
private Map<String, List<GroupAbsenceTypeDto>> groupsByCategory;
private boolean hasHourMinutesChoice;
private List<Integer> selectableHours;
private List<Integer> selectableMinutes;

//for those absences who need future recovery of time
private LocalDate recoveryDate;

//automatic choice
private boolean automaticChoiceExists;
private boolean automaticChoiceSelected;

//switch absenceType
private List<AbsenceTypeDto> absenceTypes;
private AbsenceTypeDto absenceTypeSelected;

//switch justifiedType
private List<String> justifiedTypes = Lists.newArrayList();
private String justifiedTypeSelected;

//quantity
private Integer minutes = 0;
private Integer hours = 0;}
42 changes: 42 additions & 0 deletions src/main/java/it/cnr/iit/epas/dto/v4/AbsenceFormSaveDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (C) 2023 Consiglio Nazionale delle Ricerche
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package it.cnr.iit.epas.dto.v4;

import java.util.Optional;
import lombok.Data;

/**
* DTO per le tab della modale delle assenze.
*
* @author Cristian Lucchesi
*
*/
@Data
public class AbsenceFormSaveDto {
private Optional<Long> idPerson;
private Optional<String> fiscalCode;
private String from;
private String to;
private String recoveryDate;
private String groupAbsenceTypeName;
private String absenceTypeCode;
private String justifiedTypeName;
private int hours;
private int minutes;
private boolean forceInsert;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2023 Consiglio Nazionale delle Ricerche
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package it.cnr.iit.epas.dto.v4;

import java.util.Optional;
import lombok.Data;

/**
* DTO per le tab della modale delle assenze.
*
* @author Cristian Lucchesi
*
*/
@Data
public class AbsenceFormSaveResponseDto {
private Long idPerson;
private int year;
private int month;
private boolean isSavedSuccessfully;
}
34 changes: 34 additions & 0 deletions src/main/java/it/cnr/iit/epas/dto/v4/AbsenceFormSimulationDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (C) 2023 Consiglio Nazionale delle Ricerche
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package it.cnr.iit.epas.dto.v4;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
* DTO per le tab della modale delle assenze.
*
* @author Cristian Lucchesi
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class AbsenceFormSimulationDto extends AbsenceFormSaveDto {
private String categoryTabName;
private boolean switchGroup;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (C) 2023 Consiglio Nazionale delle Ricerche
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package it.cnr.iit.epas.dto.v4;

import com.google.common.collect.Lists;
import java.util.List;
import lombok.Data;

/**
* DTO per la risposta della simulazione dell'inserimento assenza.
*
* @author Cristian Lucchesi
*
*/
@Data
public class AbsenceFormSimulationResponseDto {
private List<CriticalErrorDto> criticalErrors = Lists.newArrayList();
private List<TemplateRowDto> insertTemplateRows = Lists.newArrayList();
private boolean usableColumn;
private boolean complationColumn;
private List<AbsenceShowDto> absencesToPersist = Lists.newArrayList();

private List<String> warningsPreviousVersion = Lists.newArrayList();

private int howManyWarning;
private int howManyError;
private int howManySuccess;
private int howManyReplacing;
private int howManyIgnored;
}
5 changes: 5 additions & 0 deletions src/main/java/it/cnr/iit/epas/dto/v4/AbsenceTypeDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package it.cnr.iit.epas.dto.v4;

import java.util.Optional;
import lombok.Data;
import lombok.EqualsAndHashCode;

Expand All @@ -35,4 +36,8 @@ public class AbsenceTypeDto extends BaseModelDto {
private boolean hasGroups;
private Integer numberOfDays = 0;

private String defaultTakableGroup;

private Optional<String> categoryTabName=null;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (C) 2023 Consiglio Nazionale delle Ricerche
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package it.cnr.iit.epas.dto.v4;

import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Set;
import lombok.Data;

/**
* DTO per le private ContractualClauseDto contractualClause;
*
* @author Cristian Lucchesi
*
*/
@Data
public class CategoryGroupAbsenceTypeDto {

@Schema(description = "Nome categoria.")
private String name;
@Schema(description = "Descrizione categoria.")
private String description;
@Schema(description = "Priorità categoria.")
private int priority;
@Schema(description = "Tipologia di gruppo di assenze.")
private Set<GroupAbsenceTypeDto> groupAbsenceTypes;
@Schema(description = "Categorie di tab da mostrare nel menu per la gestione delle assenze.")
private CategoryTabDto tab;
@Schema(description = "Documentazione delle varie disposizioni contrattuali raggruppate per tipologia di assenza")
private ContractualClauseDto contractualClause;

}
Loading

0 comments on commit 235fedf

Please sign in to comment.