Updated Sync Service
This commit is contained in:
parent
c128f13eb7
commit
45f4a2c28d
|
@ -43,6 +43,35 @@ public class EPASTimeCardsClient {
|
||||||
return epasTimeCard;
|
return epasTimeCard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EPASTimeCards getByPersonFiscalCode(String fc, String year, String month) {
|
||||||
|
log.info("Retrieving EPASTimeCard by person fiscalcode: {}", fc);
|
||||||
|
Map<String, String> uriVariables = new HashMap<>();
|
||||||
|
uriVariables.put("fc", fc);
|
||||||
|
uriVariables.put("year", year);
|
||||||
|
uriVariables.put("month", month);
|
||||||
|
|
||||||
|
EPASTimeCards epasTimeCard = rt.getForObject(
|
||||||
|
appProps.getDatasourceEpasRest().getRestUrl() + "/v3/persondays/getMonthSituationByPerson?fiscalCode={fc}&year={year}&month={month}",
|
||||||
|
EPASTimeCards.class,uriVariables);
|
||||||
|
log.info("Retrieved EPASTimeCard: {}", epasTimeCard);
|
||||||
|
return epasTimeCard;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public EPASTimeCards getByPersonEmail(String email, String year, String month) {
|
||||||
|
log.info("Retrieving EPASTimeCard by person email: {}", email);
|
||||||
|
Map<String, String> uriVariables = new HashMap<>();
|
||||||
|
uriVariables.put("email", email);
|
||||||
|
uriVariables.put("year", year);
|
||||||
|
uriVariables.put("month", month);
|
||||||
|
|
||||||
|
EPASTimeCards epasTimeCard = rt.getForObject(
|
||||||
|
appProps.getDatasourceEpasRest().getRestUrl() + "/v3/persondays/getMonthSituationByPerson?email={email}&year={year}&month={month}",
|
||||||
|
EPASTimeCards.class,uriVariables);
|
||||||
|
log.info("Retrieved EPASTimeCard: {}", epasTimeCard);
|
||||||
|
return epasTimeCard;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<EPASTimeCards> getByOfficeCodeId(String id, String year, String month) {
|
public List<EPASTimeCards> getByOfficeCodeId(String id, String year, String month) {
|
||||||
Map<String, String> uriVariables = new HashMap<>();
|
Map<String, String> uriVariables = new HashMap<>();
|
||||||
|
@ -59,6 +88,9 @@ public class EPASTimeCardsClient {
|
||||||
return listEPASTimeCards;
|
return listEPASTimeCards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class EPASValidatesClient {
|
||||||
ApplicationProperties appProps;
|
ApplicationProperties appProps;
|
||||||
|
|
||||||
public String isByPersonEmail(String email, String year, String month) {
|
public String isByPersonEmail(String email, String year, String month) {
|
||||||
log.info("Retrieving EPASValidates status for person email: {}", email);
|
log.info("Retrieving EPASValidates status by person email: {}", email);
|
||||||
Map<String, String> uriVariables = new HashMap<>();
|
Map<String, String> uriVariables = new HashMap<>();
|
||||||
uriVariables.put("email", email);
|
uriVariables.put("email", email);
|
||||||
uriVariables.put("year", year);
|
uriVariables.put("year", year);
|
||||||
|
|
|
@ -18,6 +18,14 @@ public class EPASTimeCardsService {
|
||||||
return epasTimeCardsClient.getByPersonId(id, year, month);
|
return epasTimeCardsClient.getByPersonId(id, year, month);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EPASTimeCards getTimeCardByPersonFiscalCode(String fc, String year, String month) {
|
||||||
|
return epasTimeCardsClient.getByPersonFiscalCode(fc, year, month);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EPASTimeCards getTimeCardByPersonEmail(String email, String year, String month) {
|
||||||
|
return epasTimeCardsClient.getByPersonEmail(email, year, month);
|
||||||
|
}
|
||||||
|
|
||||||
public List<EPASTimeCards> getTimeCardByOfficeCodeId(String id, String year, String month) {
|
public List<EPASTimeCards> getTimeCardByOfficeCodeId(String id, String year, String month) {
|
||||||
return epasTimeCardsClient.getByOfficeCodeId(id, year, month);
|
return epasTimeCardsClient.getByOfficeCodeId(id, year, month);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package it.cnr.isti.epasmed.sync;
|
package it.cnr.isti.epasmed.sync;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -12,8 +13,11 @@ import it.cnr.isti.epasmed.domain.TabsSI;
|
||||||
import it.cnr.isti.epasmed.epas.dto.EPASPersonsDTO;
|
import it.cnr.isti.epasmed.epas.dto.EPASPersonsDTO;
|
||||||
import it.cnr.isti.epasmed.epas.mapper.EPASPersonsMapper;
|
import it.cnr.isti.epasmed.epas.mapper.EPASPersonsMapper;
|
||||||
import it.cnr.isti.epasmed.epas.model.EPASPersons;
|
import it.cnr.isti.epasmed.epas.model.EPASPersons;
|
||||||
|
import it.cnr.isti.epasmed.epas.model.EPASTimeCards;
|
||||||
|
import it.cnr.isti.epasmed.epas.model.EPASValidates;
|
||||||
import it.cnr.isti.epasmed.epas.service.EPASPersonsService;
|
import it.cnr.isti.epasmed.epas.service.EPASPersonsService;
|
||||||
import it.cnr.isti.epasmed.epas.service.EPASTimeCardsService;
|
import it.cnr.isti.epasmed.epas.service.EPASTimeCardsService;
|
||||||
|
import it.cnr.isti.epasmed.epas.service.EPASValidatesService;
|
||||||
import it.cnr.isti.epasmed.service.TabsSIService;
|
import it.cnr.isti.epasmed.service.TabsSIService;
|
||||||
import it.cnr.isti.epasmed.sistemainformativo.model.SIAnagrafico;
|
import it.cnr.isti.epasmed.sistemainformativo.model.SIAnagrafico;
|
||||||
import it.cnr.isti.epasmed.sistemainformativo.model.SIEmail;
|
import it.cnr.isti.epasmed.sistemainformativo.model.SIEmail;
|
||||||
|
@ -26,6 +30,8 @@ import it.cnr.isti.epasmed.sistemainformativo.service.SITelefoniService;
|
||||||
@Service
|
@Service
|
||||||
public class SyncService {
|
public class SyncService {
|
||||||
private static final String ISTI_OFFICE_ID = "1";
|
private static final String ISTI_OFFICE_ID = "1";
|
||||||
|
private static final String ISTI_OFFICE_CODEID = "225200";
|
||||||
|
|
||||||
private static final String SI_FLAG_DEL_TRUE = "1";
|
private static final String SI_FLAG_DEL_TRUE = "1";
|
||||||
private static final String SI_RECAPITO_TELEFONICO_UFFICIO = "Ufficio";
|
private static final String SI_RECAPITO_TELEFONICO_UFFICIO = "Ufficio";
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
@ -51,9 +57,10 @@ public class SyncService {
|
||||||
@Autowired
|
@Autowired
|
||||||
EPASPersonsMapper epasPersonsMapper;
|
EPASPersonsMapper epasPersonsMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
||||||
EPASTimeCardsService epasTimeCardsService;
|
EPASTimeCardsService epasTimeCardsService;
|
||||||
|
@Autowired
|
||||||
|
EPASValidatesService epasValidatesService;
|
||||||
|
|
||||||
private boolean banagrafico;
|
private boolean banagrafico;
|
||||||
private boolean bemail;
|
private boolean bemail;
|
||||||
|
@ -421,7 +428,7 @@ public class SyncService {
|
||||||
TabsSI cartelliniTab = null;
|
TabsSI cartelliniTab = null;
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
for (TabsSI tab : tabsSI) {
|
for (TabsSI tab : tabsSI) {
|
||||||
log.info("TabSI: {}", tab);
|
log.info("TabSI: {}", tab);
|
||||||
if (tab.getOperazioni() != null && !tab.getOperazioni().isEmpty()
|
if (tab.getOperazioni() != null && !tab.getOperazioni().isEmpty()
|
||||||
|
@ -431,31 +438,62 @@ public class SyncService {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (tab.getNome()) {
|
switch (tab.getNome()) {
|
||||||
case "orario":
|
//case "orario":
|
||||||
syncOrario(idFlux,tab);
|
// syncOrario(idFlux,tab);
|
||||||
break;
|
// break;
|
||||||
case "pers_orario":
|
//case "pers_orario":
|
||||||
syncPersOrario(idFlux,tab);
|
// syncPersOrario(idFlux,tab);
|
||||||
break;
|
// break;
|
||||||
case "cartellini":
|
case "cartellini":
|
||||||
break;
|
break;
|
||||||
case "cartellini_rendicontazioni":
|
case "cartellini_rendicontazioni":
|
||||||
syncCartelliniRendicontazioni(idFlux,tab);
|
syncCartelliniRendicontazioni(idFlux,tab);
|
||||||
break;
|
break;
|
||||||
|
//case "lavoro_fuori_sede":
|
||||||
case "lavoro_fuori_sede":
|
// syncLavoroFuoriSede(idFlux,tab);
|
||||||
syncLavoroFuoriSede(idFlux,tab);
|
// break;
|
||||||
break;
|
//case "aspettative":
|
||||||
case "aspettative":
|
// syncAspettative(idFlux,tab);
|
||||||
syncAspettative(idFlux,tab);
|
// break;
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void syncCartelliniRendicontazioni(Long idFlux, TabsSI tab) {
|
||||||
|
if (tab.getIdFlusso() == null || tab.getIdFlusso().longValue() == 0) {
|
||||||
|
log.info("Invalid Id Flusso for tab: {}", tab);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
long maxIdFlusso = 0;
|
||||||
|
|
||||||
|
GregorianCalendar lastMonthSent=new GregorianCalendar(2021,11,1);
|
||||||
|
GregorianCalendar nextMonthToSent=new GregorianCalendar();
|
||||||
|
nextMonthToSent.setTime(lastMonthSent.getTime());
|
||||||
|
nextMonthToSent.add(GregorianCalendar.MONTH, 1);
|
||||||
|
String y=String.valueOf(nextMonthToSent.get(GregorianCalendar.YEAR));
|
||||||
|
String m=String.valueOf(nextMonthToSent.get(GregorianCalendar.YEAR));
|
||||||
|
EPASValidates epasValidates=epasValidatesService.getValidatesByOfficeCodeId(ISTI_OFFICE_CODEID, y,
|
||||||
|
m);
|
||||||
|
|
||||||
|
if(!epasValidates.getAllCertificationsValidated()) {
|
||||||
|
log.info("No new month closed on EPAS: [year={}, month={}]", y,m);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO
|
||||||
|
log.info("Certifications Validated: [year={}, month={}]",y,m);
|
||||||
|
for(EPASPersons person:epasValidates.getValidatedPersons()) {
|
||||||
|
log.info("Writing TimeCard for Person: {}",person);
|
||||||
|
EPASTimeCards epasTimeCards=epasTimeCardsService.getTimeCardByPersonEmail(person.getEmail(), y, m);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import io.github.jhipster.web.util.HeaderUtil;
|
||||||
import io.github.jhipster.web.util.ResponseUtil;
|
import io.github.jhipster.web.util.ResponseUtil;
|
||||||
|
import it.cnr.isti.epasmed.epas.model.EPASCertifications;
|
||||||
import it.cnr.isti.epasmed.epas.model.EPASTimeCards;
|
import it.cnr.isti.epasmed.epas.model.EPASTimeCards;
|
||||||
import it.cnr.isti.epasmed.epas.service.EPASTimeCardsService;
|
import it.cnr.isti.epasmed.epas.service.EPASTimeCardsService;
|
||||||
|
|
||||||
|
@ -31,29 +33,53 @@ public class EPASTimeCardsResource {
|
||||||
this.epasTimeCardsService = epasTimeCardsService;
|
this.epasTimeCardsService = epasTimeCardsService;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code GET /timecards/show} : get time card by personId, year and month.
|
* {@code GET /timecards/byPerson} : get time card by person, year and month
|
||||||
*
|
*
|
||||||
* @param personId the id of the persons.
|
* @param id the id of the person.
|
||||||
* @param year the year
|
* @param fiscalCode the fiscal code of the person.
|
||||||
* @param month the month
|
* @param email the email of the person.
|
||||||
|
* @param year the year.
|
||||||
|
* @param month the month.
|
||||||
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body
|
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body
|
||||||
* the EPAS Time Card, or with status {@code 404 (Not Found)}.
|
* the EPAS TimeCards, or with status {@code 404 (Not Found)}.
|
||||||
*/
|
*/
|
||||||
@GetMapping("/timecards/show")
|
@GetMapping("/timecards/byPerson")
|
||||||
public ResponseEntity<EPASTimeCards> getEPASTimeCardByPersonId(@RequestParam("personId") String id,
|
public ResponseEntity<EPASTimeCards> getEPASCertificationByPerson(@RequestParam("id") Optional<String> id,
|
||||||
@RequestParam("year") String year, @RequestParam("month") String month) {
|
@RequestParam("fiscalCode") Optional<String> fiscalCode,
|
||||||
log.info("REST request to get ePAS TimeCard by Person Id: personId={}, year={}, month={}", id,year,month);
|
@RequestParam("email") Optional<String> email,
|
||||||
EPASTimeCards epasTimeCard = epasTimeCardsService.getTimeCardByPersonId(id, year, month);
|
@RequestParam("year") String year,@RequestParam("month") String month) {
|
||||||
log.info("Retrieved TimeCard: {}", epasTimeCard);
|
|
||||||
return ResponseUtil.wrapOrNotFound(Optional.of(epasTimeCard));
|
|
||||||
|
EPASTimeCards epasTimeCards = null;
|
||||||
|
if (id.isPresent()) {
|
||||||
|
log.info("REST request to get ePAS TimeCards by Person id: {}", id.get());
|
||||||
|
epasTimeCards = epasTimeCardsService.getTimeCardByPersonId(id.get(), year, month);
|
||||||
|
} else {
|
||||||
|
if (fiscalCode.isPresent()) {
|
||||||
|
log.info("REST request to get ePAS TimeCards by Person fiscalcode: {}", fiscalCode.get());
|
||||||
|
epasTimeCards = epasTimeCardsService.getTimeCardByPersonFiscalCode(fiscalCode.get(), year, month);
|
||||||
|
} else {
|
||||||
|
if (email.isPresent()) {
|
||||||
|
log.info("REST request to get ePAS TimeCards by Person email: {}", email.get());
|
||||||
|
epasTimeCards = epasTimeCardsService.getTimeCardByPersonEmail(email.get(), year, month);
|
||||||
|
} else {
|
||||||
|
return ResponseUtil.wrapOrNotFound(Optional.of(epasTimeCards), HeaderUtil.createFailureAlert(applicationName,false,
|
||||||
|
"","","Invalid parameter in call"));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info("Retrieved Certification: {}", epasTimeCards);
|
||||||
|
return ResponseUtil.wrapOrNotFound(Optional.of(epasTimeCards));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code GET /timecards} : get the time cards list.
|
* {@code GET /timecards/byOffice} : get the time cards list.
|
||||||
*
|
*
|
||||||
* @param officeCodeId the id of the office.
|
* @param officeCodeId the id of the office.
|
||||||
* @param year the year
|
* @param year the year
|
||||||
|
@ -61,8 +87,8 @@ public class EPASTimeCardsResource {
|
||||||
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body
|
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body
|
||||||
* the EPAS Time Card, or with status {@code 404 (Not Found)}.
|
* the EPAS Time Card, or with status {@code 404 (Not Found)}.
|
||||||
*/
|
*/
|
||||||
@GetMapping("/timecards")
|
@GetMapping("/timecards/byOffice")
|
||||||
public ResponseEntity<List<EPASTimeCards>> getEPASTimeCardByOfficeCodeId(@RequestParam("officeCodeId") String id,
|
public ResponseEntity<List<EPASTimeCards>> getEPASTimeCardByOffice(@RequestParam("codeId") String id,
|
||||||
@RequestParam("year") String year, @RequestParam("month") String month) {
|
@RequestParam("year") String year, @RequestParam("month") String month) {
|
||||||
log.info("REST request to get ePAS TimeCard list: officeCodeId={}, year={}, month={}", id,year,month);
|
log.info("REST request to get ePAS TimeCard list: officeCodeId={}, year={}, month={}", id,year,month);
|
||||||
List<EPASTimeCards> epasTimeCardsList = epasTimeCardsService.getTimeCardByOfficeCodeId(id, year, month);
|
List<EPASTimeCards> epasTimeCardsList = epasTimeCardsService.getTimeCardByOfficeCodeId(id, year, month);
|
||||||
|
|
|
@ -24,7 +24,7 @@ import it.cnr.isti.epasmed.security.AuthoritiesConstants;
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
@WithMockUser(authorities = AuthoritiesConstants.ADMIN)
|
@WithMockUser(authorities = AuthoritiesConstants.ADMIN)
|
||||||
@SpringBootTest(classes = EpasmedApp.class)
|
@SpringBootTest(classes = EpasmedApp.class)
|
||||||
@EnabledIf("false")
|
@EnabledIf("true")
|
||||||
public class EPASCertificationsResourceIT {
|
public class EPASCertificationsResourceIT {
|
||||||
|
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
@ -59,7 +59,7 @@ public class EPASCertificationsResourceIT {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getEPASCertificationsByPersonId() throws Exception {
|
public void getEPASCertificationsByPersonId() throws Exception {
|
||||||
restEPASCertificationsMockMvc.perform(get("/api/epas/certifications/getMonthSituation?id=" + PERSON_DEFAULT_ID + "&year=2021&month=10"))
|
restEPASCertificationsMockMvc.perform(get("/api/epas/certifications/getMonthSituation?id=" + PERSON_DEFAULT_ID + "&year=2021&month=11"))
|
||||||
.andExpect(status().isOk());
|
.andExpect(status().isOk());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,14 +67,14 @@ public class EPASCertificationsResourceIT {
|
||||||
public void getEPASCertificationsByPersonFiscalcode() throws Exception {
|
public void getEPASCertificationsByPersonFiscalcode() throws Exception {
|
||||||
restEPASCertificationsMockMvc
|
restEPASCertificationsMockMvc
|
||||||
.perform(
|
.perform(
|
||||||
get("/api/epas/certifications/getMonthSituation?fiscalCode=" + PERSON_DEFAULT_FISCAL_CODE + "&year=2021&month=10"))
|
get("/api/epas/certifications/getMonthSituation?fiscalCode=" + PERSON_DEFAULT_FISCAL_CODE + "&year=2021&month=11"))
|
||||||
.andExpect(status().isOk());
|
.andExpect(status().isOk());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getEPASCertificationsByPersonEmail() throws Exception {
|
public void getEPASCertificationsByPersonEmail() throws Exception {
|
||||||
restEPASCertificationsMockMvc
|
restEPASCertificationsMockMvc
|
||||||
.perform(get("/api/epas/certifications/getMonthSituation?email=" + PERSON_DEFAULT_EMAIL + "&year=2021&month=10"))
|
.perform(get("/api/epas/certifications/getMonthSituation?email=" + PERSON_DEFAULT_EMAIL + "&year=2021&month=11"))
|
||||||
.andExpect(status().isOk());
|
.andExpect(status().isOk());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import it.cnr.isti.epasmed.security.AuthoritiesConstants;
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
@WithMockUser(authorities = AuthoritiesConstants.ADMIN)
|
@WithMockUser(authorities = AuthoritiesConstants.ADMIN)
|
||||||
@SpringBootTest(classes = EpasmedApp.class)
|
@SpringBootTest(classes = EpasmedApp.class)
|
||||||
@EnabledIf("false")
|
@EnabledIf("true")
|
||||||
public class EPASLeavesResourceIT {
|
public class EPASLeavesResourceIT {
|
||||||
|
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
|
|
@ -46,7 +46,7 @@ import it.cnr.isti.epasmed.web.rest.TestUtil;
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
@WithMockUser(authorities = AuthoritiesConstants.ADMIN)
|
@WithMockUser(authorities = AuthoritiesConstants.ADMIN)
|
||||||
@SpringBootTest(classes = EpasmedApp.class)
|
@SpringBootTest(classes = EpasmedApp.class)
|
||||||
@EnabledIf("false")
|
@EnabledIf("true")
|
||||||
public class EPASPersonsResourceIT {
|
public class EPASPersonsResourceIT {
|
||||||
|
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
|
|
@ -24,7 +24,7 @@ import it.cnr.isti.epasmed.security.AuthoritiesConstants;
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
@WithMockUser(authorities = AuthoritiesConstants.ADMIN)
|
@WithMockUser(authorities = AuthoritiesConstants.ADMIN)
|
||||||
@SpringBootTest(classes = EpasmedApp.class)
|
@SpringBootTest(classes = EpasmedApp.class)
|
||||||
@EnabledIf("false")
|
@EnabledIf("true")
|
||||||
public class EPASTimeCardsResourceIT {
|
public class EPASTimeCardsResourceIT {
|
||||||
|
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
@ -34,6 +34,12 @@ public class EPASTimeCardsResourceIT {
|
||||||
//private static final String OFFICE_DEFAULT_CODE = "074000";
|
//private static final String OFFICE_DEFAULT_CODE = "074000";
|
||||||
private static final String OFFICE_DEFAULT_CODEID = "225200";
|
private static final String OFFICE_DEFAULT_CODEID = "225200";
|
||||||
|
|
||||||
|
private static final String PERSON_DEFAULT_ID = "113";
|
||||||
|
//private static final String PERSON_DEFAULT_NAME = "Giuseppe";
|
||||||
|
//private static final String PERSON_DEFAULT_SURNAME = "Amato";
|
||||||
|
private static final String PERSON_DEFAULT_FISCAL_CODE = "MTAGPP68D15D976W";
|
||||||
|
private static final String PERSON_DEFAULT_EMAIL = "giuseppe.amato@cnr.it";
|
||||||
|
//private static final String PERSON_DEFAULT_QUALIFICATION = "2";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private MockMvc restEPASTimeCardsMockMvc;
|
private MockMvc restEPASTimeCardsMockMvc;
|
||||||
|
@ -51,12 +57,22 @@ public class EPASTimeCardsResourceIT {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getTimeCardByPersonId() throws Exception {
|
public void getTimeCardByPersonId() throws Exception {
|
||||||
restEPASTimeCardsMockMvc.perform(get("/api/epas/timecards/show?personId=113&year=2021&month=11")).andExpect(status().isOk());
|
restEPASTimeCardsMockMvc.perform(get("/api/epas/timecards/byPerson?id="+PERSON_DEFAULT_ID+"&year=2021&month=11")).andExpect(status().isOk());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getTimeCardByPersonFiscalCode() throws Exception {
|
||||||
|
restEPASTimeCardsMockMvc.perform(get("/api/epas/timecards/byPerson?fiscalCode="+PERSON_DEFAULT_FISCAL_CODE+"&year=2021&month=11")).andExpect(status().isOk());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getTimeCardByPersonEmail() throws Exception {
|
||||||
|
restEPASTimeCardsMockMvc.perform(get("/api/epas/timecards/byPerson?email="+PERSON_DEFAULT_EMAIL+"&year=2021&month=11")).andExpect(status().isOk());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getTimeCardByOfficeCodeId() throws Exception {
|
public void getTimeCardByOfficeCodeId() throws Exception {
|
||||||
restEPASTimeCardsMockMvc.perform(get("/api/epas/timecards?officeCodeId="+OFFICE_DEFAULT_CODEID+"&year=2021&month=11")).andExpect(status().isOk());
|
restEPASTimeCardsMockMvc.perform(get("/api/epas/timecards/byOffice?codeId="+OFFICE_DEFAULT_CODEID+"&year=2021&month=11")).andExpect(status().isOk());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ import it.cnr.isti.epasmed.security.AuthoritiesConstants;
|
||||||
@AutoConfigureMockMvc
|
@AutoConfigureMockMvc
|
||||||
@WithMockUser(authorities = AuthoritiesConstants.ADMIN)
|
@WithMockUser(authorities = AuthoritiesConstants.ADMIN)
|
||||||
@SpringBootTest(classes = EpasmedApp.class)
|
@SpringBootTest(classes = EpasmedApp.class)
|
||||||
@EnabledIf("false")
|
@EnabledIf("true")
|
||||||
public class EPASValidatesResourceIT {
|
public class EPASValidatesResourceIT {
|
||||||
|
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
@ -67,7 +67,7 @@ public class EPASValidatesResourceIT {
|
||||||
@Test
|
@Test
|
||||||
public void getEPASValidatesByOfficeCodeId() throws Exception {
|
public void getEPASValidatesByOfficeCodeId() throws Exception {
|
||||||
MvcResult result = restEPASValidatesMockMvc.perform(get("/api/epas/validates?officeCodeId="+OFFICE_DEFAULT_CODEID+"&"
|
MvcResult result = restEPASValidatesMockMvc.perform(get("/api/epas/validates?officeCodeId="+OFFICE_DEFAULT_CODEID+"&"
|
||||||
+ "year=2021&month=10")).andExpect(status().isOk()).andReturn();
|
+ "year=2021&month=11")).andExpect(status().isOk()).andReturn();
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
EPASValidates validates = mapper.readValue(result.getResponse().getContentAsString(),
|
EPASValidates validates = mapper.readValue(result.getResponse().getContentAsString(),
|
||||||
new TypeReference<EPASValidates>() {
|
new TypeReference<EPASValidates>() {
|
||||||
|
|
Loading…
Reference in New Issue