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 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");

View File

@ -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<Void> 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<Void> syncWritesScheduled(@RequestParam("year") String year, @RequestParam("month") String month)
throws Exception {
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\") or hasAuthority(\"" + AuthoritiesConstants.USER
+ "\")")
public ResponseEntity<Void> syncWritesScheduled(@RequestParam("year") String year,
@RequestParam("month") String month) throws Exception {
logger.info("REST request syncWritesScheduled");
ResponseEntity<Void> 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<Void> syncSingleWritesTimeCards(@RequestParam("year") String year,
@RequestParam("month") String month, @RequestParam("fiscalCode") String fc) throws Exception {
logger.info("REST request syncSingleWritesTimeCards)");
ResponseEntity<Void> 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<Void> syncWritesLeaves(@RequestParam("year") String year,
@RequestParam("month") String month) throws Exception {
public ResponseEntity<Void> syncWritesLeaves(@RequestParam("year") String year, @RequestParam("month") String month)
throws Exception {
logger.info("REST request syncWritesLeaves)");
ResponseEntity<Void> 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;
}
}

View File

@ -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";

View File

@ -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