Aggiornata sync per exportare le descrizioni delle assenze

This commit is contained in:
Giancarlo Panichi 2022-11-14 15:48:35 +01:00
parent 3255e335b6
commit 3c01bf39b8
4 changed files with 29 additions and 34 deletions

View File

@ -102,7 +102,7 @@ public class SyncService {
private static final String SI_TIPO_EMAIL_CNR = "C.N.R."; private static final String SI_TIPO_EMAIL_CNR = "C.N.R.";
private static final String PERSON_DEFAULT_QUALIFICATION = "3"; 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 static final Logger logger = LoggerFactory.getLogger(SyncService.class);
private final SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd"); private final SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");

View File

@ -72,7 +72,8 @@ public class SyncResource {
* *
*/ */
@GetMapping("/sync/writes") @GetMapping("/sync/writes")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\",\""+AuthoritiesConstants.USER+"\")") @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\") or hasAuthority(\"" + AuthoritiesConstants.USER
+ "\")")
public ResponseEntity<Void> syncWrites(@RequestParam("year") String year, @RequestParam("month") String month) public ResponseEntity<Void> syncWrites(@RequestParam("year") String year, @RequestParam("month") String month)
throws Exception { throws Exception {
logger.info("REST request syncWrites"); logger.info("REST request syncWrites");
@ -87,7 +88,8 @@ public class SyncResource {
} }
/** /**
* {@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 year the year.
* @param month the month. * @param month the month.
@ -98,9 +100,10 @@ public class SyncResource {
* *
*/ */
@GetMapping("/sync/writesscheduled") @GetMapping("/sync/writesscheduled")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\",\""+AuthoritiesConstants.USER+"\")") @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\") or hasAuthority(\"" + AuthoritiesConstants.USER
public ResponseEntity<Void> syncWritesScheduled(@RequestParam("year") String year, @RequestParam("month") String month) + "\")")
throws Exception { public ResponseEntity<Void> syncWritesScheduled(@RequestParam("year") String year,
@RequestParam("month") String month) throws Exception {
logger.info("REST request syncWritesScheduled"); logger.info("REST request syncWritesScheduled");
ResponseEntity<Void> res; ResponseEntity<Void> res;
@ -112,9 +115,6 @@ public class SyncResource {
return res; return res;
} }
/** /**
* {@code GET /sync/test} : Test api. * {@code GET /sync/test} : Test api.
* *
@ -195,13 +195,12 @@ public class SyncResource {
return res; return res;
} }
/** /**
* {@code GET /sync/writesSingleTimeCards} : Reports SingleTimeCards from ePAS in * {@code GET /sync/writesSingleTimeCards} : Reports SingleTimeCards from ePAS
* SistemaInformativo. * in SistemaInformativo.
* *
* @param year the year. * @param year the year.
* @param month the month. * @param month the month.
* @param fiscalCode the fiscal code * @param fiscalCode the fiscal code
* @return the {@link ResponseEntity} with status {@code 201 (Executed)} or with * @return the {@link ResponseEntity} with status {@code 201 (Executed)} or with
* status {@code 400 (Bad Request)} if there is a error. * status {@code 400 (Bad Request)} if there is a error.
@ -210,20 +209,18 @@ public class SyncResource {
* *
*/ */
@GetMapping("/sync/writesSingleTimeCards") @GetMapping("/sync/writesSingleTimeCards")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\",\""+AuthoritiesConstants.USER+"\")") @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\",\"" + AuthoritiesConstants.USER + "\")")
public ResponseEntity<Void> syncSingleWritesTimeCards(@RequestParam("year") String year, public ResponseEntity<Void> syncSingleWritesTimeCards(@RequestParam("year") String year,
@RequestParam("month") String month, @RequestParam("fiscalCode") String fc) throws Exception { @RequestParam("month") String month, @RequestParam("fiscalCode") String fc) throws Exception {
logger.info("REST request syncSingleWritesTimeCards)"); logger.info("REST request syncSingleWritesTimeCards)");
ResponseEntity<Void> res; ResponseEntity<Void> res;
syncService.executeWritesSingleTimeCards(year, month,fc); syncService.executeWritesSingleTimeCards(year, month, fc);
String msg = "Rendicontazione del cartellino eseguita correttamente."; String msg = "Rendicontazione del cartellino eseguita correttamente.";
logger.info(msg); logger.info(msg);
res = ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName, msg, "")).build(); res = ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName, msg, "")).build();
return res; return res;
} }
/** /**
* {@code GET /sync/writesOffSiteWorks} : Reports Off Site Works from ePAS in * {@code GET /sync/writesOffSiteWorks} : Reports Off Site Works from ePAS in
* SistemaInformativo. * SistemaInformativo.
@ -250,7 +247,6 @@ public class SyncResource {
return res; return res;
} }
/** /**
* {@code GET /sync/writesLeaves} : Reports Leaves from ePAS in * {@code GET /sync/writesLeaves} : Reports Leaves from ePAS in
* SistemaInformativo. * SistemaInformativo.
@ -265,8 +261,8 @@ public class SyncResource {
*/ */
@GetMapping("/sync/writesLeaves") @GetMapping("/sync/writesLeaves")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")") @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<Void> syncWritesLeaves(@RequestParam("year") String year, public ResponseEntity<Void> syncWritesLeaves(@RequestParam("year") String year, @RequestParam("month") String month)
@RequestParam("month") String month) throws Exception { throws Exception {
logger.info("REST request syncWritesLeaves)"); logger.info("REST request syncWritesLeaves)");
ResponseEntity<Void> res; ResponseEntity<Void> res;
syncService.executeWritesLeaves(year, month); syncService.executeWritesLeaves(year, month);
@ -278,8 +274,8 @@ public class SyncResource {
} }
/** /**
* {@code GET /sync/writesPersonWorkingTime} : Reports Person Working Time from ePAS in * {@code GET /sync/writesPersonWorkingTime} : Reports Person Working Time from
* SistemaInformativo. * ePAS in SistemaInformativo.
* *
* @param year the year. * @param year the year.
* @param month the month. * @param month the month.
@ -303,5 +299,4 @@ public class SyncResource {
return res; return res;
} }
} }

View File

@ -62,8 +62,8 @@ public class EPASContractsResourceIT {
private static final String PERSON_DEFAULT_ID = "1"; private static final String PERSON_DEFAULT_ID = "1";
private static final String PERSON_DEFAULT_NAME = "Giancarlo"; private static final String PERSON_DEFAULT_NAME = "Giancarlo";
private static final String PERSON_DEFAULT_SURNAME = "Panichi"; private static final String PERSON_DEFAULT_SURNAME = "Panichi";
private static final String PERSON_DEFAULT_FISCAL_CODE = "MTAGPP68D15D976W"; // "MROGLI68H29E625F"; private static final String PERSON_DEFAULT_FISCAL_CODE = "PNCGCR75S04L103G";//"MTAGPP68D15D976W"; // "MROGLI68H29E625F";
// //"PNCGCR75S04L103G"; // "PNCGCR75S04L103G";
private static final String PERSON_DEFAULT_EMAIL = "giancarlo.panichi@cnr.it"; private static final String PERSON_DEFAULT_EMAIL = "giancarlo.panichi@cnr.it";
private static final String PERSON_DEFAULT_QUALIFICATION = "6"; private static final String PERSON_DEFAULT_QUALIFICATION = "6";

View File

@ -40,7 +40,7 @@ public class SyncResourceIT {
private final Logger log = LoggerFactory.getLogger(getClass()); private final Logger log = LoggerFactory.getLogger(getClass());
private static final String YEAR = "2022"; 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"; private static final String PERSON_DEFAULT_FISCAL_CODE = "CSTDTL57L65A864M";
@Autowired @Autowired