-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from consiglionazionaledellericerche/46-implem…
…entare-endpoint-rest-per-riepilogo-ore 46 implementare endpoint rest per riepilogo ore e delle ore di formazione
- Loading branch information
Showing
12 changed files
with
1,031 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
467 changes: 467 additions & 0 deletions
467
src/main/java/it/cnr/iit/epas/controller/v4/PersonMonthsController.java
Large diffs are not rendered by default.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
src/main/java/it/cnr/iit/epas/dto/v4/PersonMonthRecapCreateDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (C) 2022 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.time.LocalDate; | ||
import java.util.Optional; | ||
import lombok.Data; | ||
|
||
/** | ||
* DTO per creare/aggiornare le ore di formazione PersonMonthRecap per TrainingHours. | ||
* | ||
* @author Andrea Generosi | ||
* | ||
*/ | ||
@Data | ||
public class PersonMonthRecapCreateDto { | ||
private Long id=null; | ||
private Integer year; | ||
private Integer month; | ||
private Integer begin; | ||
private Integer end; | ||
private Integer trainingHours; | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/it/cnr/iit/epas/dto/v4/PersonMonthRecapDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (C) 2022 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.time.LocalDate; | ||
import lombok.Data; | ||
|
||
/** | ||
* DTO per i PersonMonthRecap per TrainingHours. | ||
* | ||
* @author Andrea Generosi | ||
* | ||
*/ | ||
@Data | ||
public class PersonMonthRecapDto { | ||
@Schema(description = "Persona") | ||
private PersonShowDto person; | ||
private Long id; | ||
private Integer year; | ||
private Integer month; | ||
private LocalDate fromDate; | ||
private LocalDate toDate; | ||
private Integer trainingHours; | ||
private boolean hoursApproved = false; | ||
private boolean editable = false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* 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.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
/** | ||
* DTO per rappresentare i IWrapperContractMonthRecap. | ||
* | ||
* @author Cristian Lucchesi | ||
* | ||
*/ | ||
@Data | ||
@AllArgsConstructor | ||
public class PersonMonthsDto { | ||
|
||
private ContractMonthRecapDto value; | ||
private Optional<ContractMonthRecapDto> previousRecap; | ||
private Optional<ContractMonthRecapDto> previousRecapInYear; | ||
private boolean hasResidualInitInYearMonth; | ||
private boolean hasResidualLastYear; | ||
private int getResidualLastYearInit; | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/it/cnr/iit/epas/dto/v4/TrainingHoursDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (C) 2022 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.time.LocalDate; | ||
import java.util.List; | ||
import lombok.Data; | ||
|
||
/** | ||
* DTO per i PersonMonthRecap per TrainingHours. | ||
* | ||
* @author Andrea Generosi | ||
* | ||
*/ | ||
@Data | ||
public class TrainingHoursDto { | ||
|
||
private PersonShowDto person; | ||
private List<PersonMonthRecapDto> personMonthRecaps; | ||
private LocalDate today; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/it/cnr/iit/epas/dto/v4/mapper/PersonMonthRecapMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* 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.mapper; | ||
|
||
import it.cnr.iit.epas.dto.v4.PersonMonthRecapDto; | ||
import it.cnr.iit.epas.dto.v4.PersonReperibilityDayDto; | ||
import it.cnr.iit.epas.dto.v4.PersonShowDto; | ||
import it.cnr.iit.epas.models.Person; | ||
import it.cnr.iit.epas.models.PersonMonthRecap; | ||
import it.cnr.iit.epas.models.PersonReperibilityDay; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
|
||
/** | ||
* Mapper da PersonReperibilityDay al suo DTO per la visualizzazione via REST. | ||
*/ | ||
@Mapper(componentModel = "spring") | ||
public interface PersonMonthRecapMapper { | ||
|
||
@Mapping(target = "qualification", source = "person.qualification.id") | ||
PersonShowDto convert(Person person); | ||
|
||
@Mapping(target = "id", expression = "java(personMonthRecap.getId())") | ||
@Mapping(target = "editable", expression = "java(personMonthRecap.isEditable())") | ||
PersonMonthRecapDto convert(PersonMonthRecap personMonthRecap); | ||
} |
86 changes: 86 additions & 0 deletions
86
src/main/java/it/cnr/iit/epas/dto/v4/mapper/PersonMonthsMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* 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.mapper; | ||
|
||
import it.cnr.iit.epas.dao.wrapper.IWrapperContractMonthRecap; | ||
import it.cnr.iit.epas.dto.v4.AbsenceShowDto; | ||
import it.cnr.iit.epas.dto.v4.AbsenceShowTerseDto; | ||
import it.cnr.iit.epas.dto.v4.AbsenceToRecoverDto; | ||
import it.cnr.iit.epas.dto.v4.AbsenceTypeShowTerseDto; | ||
import it.cnr.iit.epas.dto.v4.ContractMonthRecapDto; | ||
import it.cnr.iit.epas.dto.v4.PersonDayDto; | ||
import it.cnr.iit.epas.dto.v4.PersonMonthsDto; | ||
import it.cnr.iit.epas.dto.v4.PersonStampingDayRecapDto; | ||
import it.cnr.iit.epas.dto.v4.PersonStampingRecapDto; | ||
import it.cnr.iit.epas.dto.v4.StampingTemplateDto; | ||
import it.cnr.iit.epas.dto.v4.WorkingTimeTypeDayDto; | ||
import it.cnr.iit.epas.dto.v4.WorkingTimeTypeDto; | ||
import it.cnr.iit.epas.manager.recaps.personstamping.PersonStampingDayRecap; | ||
import it.cnr.iit.epas.manager.recaps.personstamping.PersonStampingRecap; | ||
import it.cnr.iit.epas.manager.recaps.personstamping.StampingTemplate; | ||
import it.cnr.iit.epas.models.ContractMonthRecap; | ||
import it.cnr.iit.epas.models.PersonDay; | ||
import it.cnr.iit.epas.models.WorkingTimeType; | ||
import it.cnr.iit.epas.models.WorkingTimeTypeDay; | ||
import it.cnr.iit.epas.models.absences.Absence; | ||
import it.cnr.iit.epas.models.absences.AbsenceType; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
|
||
/** | ||
* Mapping delle informazioni per il riepilogo delle ore mensili nell'anno | ||
* in un DTO da esportare via REST. | ||
* | ||
* @author cristian | ||
* | ||
*/ | ||
@Mapper(componentModel = "spring") | ||
public interface PersonMonthsMapper { | ||
|
||
@Mapping(target = ".", source = "value") | ||
@Mapping( | ||
target = "hasResidualInitInYearMonth", | ||
expression = | ||
"java(contractMonthRecap.residualInitInYearMonth(contractMonthRecap.getValue().getYear(), " | ||
+ "contractMonthRecap.getValue().getMonth()))") | ||
@Mapping( | ||
target = "getResidualLastYearInit", | ||
expression = "java(contractMonthRecap.getResidualLastYearInit())") | ||
@Mapping( | ||
target = "hasResidualLastYear", | ||
expression = "java(contractMonthRecap.hasResidualLastYear())") | ||
@Mapping( | ||
target = "previousRecap", | ||
source = "previousRecapInYear") // Mappatura esplicita del campo Optional | ||
@Mapping( | ||
target = "previousRecapInYear", | ||
source = "previousRecapInYear") // Mappatura esplicita del campo Optional | ||
PersonMonthsDto convert(IWrapperContractMonthRecap contractMonthRecap); | ||
|
||
@Mapping( | ||
target = "expireInMonth", | ||
expression = "java(contractMonthRecap.expireInMonth())") | ||
ContractMonthRecapDto convert(ContractMonthRecap contractMonthRecap); | ||
|
||
// Metodo helper per mappare un Optional<ContractMonthRecap> in Optional<ContractMonthRecapDto> | ||
default Optional<ContractMonthRecapDto> mapOptionalRecap(Optional<ContractMonthRecap> contractMonthRecapOptional) { | ||
return contractMonthRecapOptional.map(this::convert); // Usa il metodo convert per l'oggetto effettivo | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/it/cnr/iit/epas/dto/v4/mapper/TrainingHoursMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* 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.mapper; | ||
|
||
import it.cnr.iit.epas.dto.v4.PersonMonthRecapDto; | ||
import it.cnr.iit.epas.dto.v4.PersonShowDto; | ||
import it.cnr.iit.epas.models.Person; | ||
import it.cnr.iit.epas.models.PersonMonthRecap; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
|
||
/** | ||
* Mapper da TrainingHours al suo DTO per la visualizzazione via REST. | ||
*/ | ||
@Mapper(componentModel = "spring") | ||
public interface TrainingHoursMapper { | ||
|
||
@Mapping(target = "qualification", source = "person.qualification.id") | ||
PersonShowDto convert(Person person); | ||
|
||
PersonMonthRecapDto convert(PersonMonthRecap personMonthRecap); | ||
} |
Oops, something went wrong.