diff --git a/src/main/java/it/cnr/isti/epasmed/sync/SyncService.java b/src/main/java/it/cnr/isti/epasmed/sync/SyncService.java index a0d4d6a..8d7efbf 100755 --- a/src/main/java/it/cnr/isti/epasmed/sync/SyncService.java +++ b/src/main/java/it/cnr/isti/epasmed/sync/SyncService.java @@ -102,7 +102,7 @@ public class SyncService { private static final String SI_TIPO_EMAIL_CNR = "C.N.R."; private static final String PERSON_DEFAULT_QUALIFICATION = "3"; - private static final boolean EXPORT_ABSENCE_CODE_DESCRIPTION = false; + private static final boolean EXPORT_ABSENCE_CODE_DESCRIPTION = true; private static final Logger logger = LoggerFactory.getLogger(SyncService.class); private final SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd"); diff --git a/src/main/java/it/cnr/isti/epasmed/web/rest/sync/SyncResource.java b/src/main/java/it/cnr/isti/epasmed/web/rest/sync/SyncResource.java index 1826d62..dc0c878 100755 --- a/src/main/java/it/cnr/isti/epasmed/web/rest/sync/SyncResource.java +++ b/src/main/java/it/cnr/isti/epasmed/web/rest/sync/SyncResource.java @@ -72,7 +72,8 @@ public class SyncResource { * */ @GetMapping("/sync/writes") - @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\",\""+AuthoritiesConstants.USER+"\")") + @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\") or hasAuthority(\"" + AuthoritiesConstants.USER + + "\")") public ResponseEntity syncWrites(@RequestParam("year") String year, @RequestParam("month") String month) throws Exception { logger.info("REST request syncWrites"); @@ -85,9 +86,10 @@ public class SyncResource { return res; } - + /** - * {@code GET /sync/writesscheduled} : Report from ePAS and update SistemaInformativo scheduled info. + * {@code GET /sync/writesscheduled} : Report from ePAS and update + * SistemaInformativo scheduled info. * * @param year the year. * @param month the month. @@ -98,9 +100,10 @@ public class SyncResource { * */ @GetMapping("/sync/writesscheduled") - @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\",\""+AuthoritiesConstants.USER+"\")") - public ResponseEntity syncWritesScheduled(@RequestParam("year") String year, @RequestParam("month") String month) - throws Exception { + @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\") or hasAuthority(\"" + AuthoritiesConstants.USER + + "\")") + public ResponseEntity syncWritesScheduled(@RequestParam("year") String year, + @RequestParam("month") String month) throws Exception { logger.info("REST request syncWritesScheduled"); ResponseEntity res; @@ -111,9 +114,6 @@ public class SyncResource { return res; } - - - /** * {@code GET /sync/test} : Test api. @@ -194,14 +194,13 @@ public class SyncResource { res = ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName, msg, "")).build(); return res; } - - + /** - * {@code GET /sync/writesSingleTimeCards} : Reports SingleTimeCards from ePAS in - * SistemaInformativo. + * {@code GET /sync/writesSingleTimeCards} : Reports SingleTimeCards from ePAS + * in SistemaInformativo. * - * @param year the year. - * @param month the month. + * @param year the year. + * @param month the month. * @param fiscalCode the fiscal code * @return the {@link ResponseEntity} with status {@code 201 (Executed)} or with * status {@code 400 (Bad Request)} if there is a error. @@ -210,19 +209,17 @@ public class SyncResource { * */ @GetMapping("/sync/writesSingleTimeCards") - @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\",\""+AuthoritiesConstants.USER+"\")") + @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\",\"" + AuthoritiesConstants.USER + "\")") public ResponseEntity syncSingleWritesTimeCards(@RequestParam("year") String year, @RequestParam("month") String month, @RequestParam("fiscalCode") String fc) throws Exception { logger.info("REST request syncSingleWritesTimeCards)"); ResponseEntity res; - syncService.executeWritesSingleTimeCards(year, month,fc); + syncService.executeWritesSingleTimeCards(year, month, fc); String msg = "Rendicontazione del cartellino eseguita correttamente."; logger.info(msg); res = ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName, msg, "")).build(); return res; } - - /** * {@code GET /sync/writesOffSiteWorks} : Reports Off Site Works from ePAS in @@ -232,7 +229,7 @@ public class SyncResource { * @param month the month. * @return the {@link ResponseEntity} with status {@code 201 (Executed)} or with * status {@code 400 (Bad Request)} if there is a error. - * @throws Exception + * @throws Exception * * */ @@ -249,8 +246,7 @@ public class SyncResource { return res; } - - + /** * {@code GET /sync/writesLeaves} : Reports Leaves from ePAS in * SistemaInformativo. @@ -259,14 +255,14 @@ public class SyncResource { * @param month the month. * @return the {@link ResponseEntity} with status {@code 201 (Executed)} or with * status {@code 400 (Bad Request)} if there is a error. - * @throws Exception + * @throws Exception * * */ @GetMapping("/sync/writesLeaves") @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")") - public ResponseEntity syncWritesLeaves(@RequestParam("year") String year, - @RequestParam("month") String month) throws Exception { + public ResponseEntity syncWritesLeaves(@RequestParam("year") String year, @RequestParam("month") String month) + throws Exception { logger.info("REST request syncWritesLeaves)"); ResponseEntity res; syncService.executeWritesLeaves(year, month); @@ -276,16 +272,16 @@ public class SyncResource { return res; } - + /** - * {@code GET /sync/writesPersonWorkingTime} : Reports Person Working Time from ePAS in - * SistemaInformativo. + * {@code GET /sync/writesPersonWorkingTime} : Reports Person Working Time from + * ePAS in SistemaInformativo. * * @param year the year. * @param month the month. * @return the {@link ResponseEntity} with status {@code 201 (Executed)} or with * status {@code 400 (Bad Request)} if there is a error. - * @throws Exception + * @throws Exception * * */ @@ -302,6 +298,5 @@ public class SyncResource { return res; } - } diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASContractsResourceIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASContractsResourceIT.java index 2701afe..c6f654b 100755 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASContractsResourceIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/epas/EPASContractsResourceIT.java @@ -62,8 +62,8 @@ public class EPASContractsResourceIT { private static final String PERSON_DEFAULT_ID = "1"; private static final String PERSON_DEFAULT_NAME = "Giancarlo"; private static final String PERSON_DEFAULT_SURNAME = "Panichi"; - private static final String PERSON_DEFAULT_FISCAL_CODE = "MTAGPP68D15D976W"; // "MROGLI68H29E625F"; - // //"PNCGCR75S04L103G"; + private static final String PERSON_DEFAULT_FISCAL_CODE = "PNCGCR75S04L103G";//"MTAGPP68D15D976W"; // "MROGLI68H29E625F"; + // "PNCGCR75S04L103G"; private static final String PERSON_DEFAULT_EMAIL = "giancarlo.panichi@cnr.it"; private static final String PERSON_DEFAULT_QUALIFICATION = "6"; diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/sync/SyncResourceIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/sync/SyncResourceIT.java index 2bac5f4..fa40567 100755 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/sync/SyncResourceIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/sync/SyncResourceIT.java @@ -40,7 +40,7 @@ public class SyncResourceIT { private final Logger log = LoggerFactory.getLogger(getClass()); private static final String YEAR = "2022"; - private static final String MONTH = "9"; + private static final String MONTH = "10"; private static final String PERSON_DEFAULT_FISCAL_CODE = "CSTDTL57L65A864M"; @Autowired