Updated the synchronization support
This commit is contained in:
parent
82589c8dc0
commit
3ef43f206f
|
@ -1,6 +1,8 @@
|
||||||
package it.cnr.isti.epasmed.sync;
|
package it.cnr.isti.epasmed.sync;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -10,20 +12,32 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import it.cnr.isti.epasmed.domain.TabsSI;
|
import it.cnr.isti.epasmed.domain.TabsSI;
|
||||||
|
import it.cnr.isti.epasmed.epas.dto.EPASAffiliationsDTO;
|
||||||
|
import it.cnr.isti.epasmed.epas.dto.EPASGroupsDTO;
|
||||||
import it.cnr.isti.epasmed.epas.dto.EPASPersonsDTO;
|
import it.cnr.isti.epasmed.epas.dto.EPASPersonsDTO;
|
||||||
|
import it.cnr.isti.epasmed.epas.mapper.EPASAffiliationsMapper;
|
||||||
|
import it.cnr.isti.epasmed.epas.mapper.EPASGroupsMapper;
|
||||||
import it.cnr.isti.epasmed.epas.mapper.EPASPersonsMapper;
|
import it.cnr.isti.epasmed.epas.mapper.EPASPersonsMapper;
|
||||||
|
import it.cnr.isti.epasmed.epas.model.EPASAffiliations;
|
||||||
|
import it.cnr.isti.epasmed.epas.model.EPASGroups;
|
||||||
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.EPASTimeCards;
|
||||||
import it.cnr.isti.epasmed.epas.model.EPASValidates;
|
import it.cnr.isti.epasmed.epas.model.EPASValidates;
|
||||||
|
import it.cnr.isti.epasmed.epas.service.EPASAffiliationsService;
|
||||||
|
import it.cnr.isti.epasmed.epas.service.EPASGroupsService;
|
||||||
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.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;
|
||||||
|
import it.cnr.isti.epasmed.sistemainformativo.model.SIGruppi;
|
||||||
|
import it.cnr.isti.epasmed.sistemainformativo.model.SIGruppiPers;
|
||||||
import it.cnr.isti.epasmed.sistemainformativo.model.SITelefoni;
|
import it.cnr.isti.epasmed.sistemainformativo.model.SITelefoni;
|
||||||
import it.cnr.isti.epasmed.sistemainformativo.service.SIAnagraficoService;
|
import it.cnr.isti.epasmed.sistemainformativo.service.SIAnagraficoService;
|
||||||
import it.cnr.isti.epasmed.sistemainformativo.service.SIEmailService;
|
import it.cnr.isti.epasmed.sistemainformativo.service.SIEmailService;
|
||||||
|
import it.cnr.isti.epasmed.sistemainformativo.service.SIGruppiPersService;
|
||||||
|
import it.cnr.isti.epasmed.sistemainformativo.service.SIGruppiService;
|
||||||
import it.cnr.isti.epasmed.sistemainformativo.service.SIMasterLogService;
|
import it.cnr.isti.epasmed.sistemainformativo.service.SIMasterLogService;
|
||||||
import it.cnr.isti.epasmed.sistemainformativo.service.SITelefoniService;
|
import it.cnr.isti.epasmed.sistemainformativo.service.SITelefoniService;
|
||||||
|
|
||||||
|
@ -39,7 +53,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 final Logger log = LoggerFactory.getLogger(SyncService.class);
|
private final Logger log = LoggerFactory.getLogger(SyncService.class);
|
||||||
|
private final SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
@Autowired
|
@Autowired
|
||||||
TabsSIService tabsSIService;
|
TabsSIService tabsSIService;
|
||||||
|
|
||||||
|
@ -51,12 +65,19 @@ public class SyncService {
|
||||||
SITelefoniService siTelefoniService;
|
SITelefoniService siTelefoniService;
|
||||||
@Autowired
|
@Autowired
|
||||||
SIEmailService siEmailService;
|
SIEmailService siEmailService;
|
||||||
|
@Autowired
|
||||||
|
SIGruppiService siGruppiService;
|
||||||
|
@Autowired
|
||||||
|
SIGruppiPersService siGruppiPersService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
EPASPersonsService epasPersonsService;
|
EPASPersonsService epasPersonsService;
|
||||||
@Autowired
|
@Autowired
|
||||||
EPASPersonsMapper epasPersonsMapper;
|
EPASPersonsMapper epasPersonsMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
EPASGroupsService epasGroupsService;
|
||||||
|
@Autowired
|
||||||
|
EPASAffiliationsService epasAffiliationsService;
|
||||||
|
|
||||||
EPASTimeCardsService epasTimeCardsService;
|
EPASTimeCardsService epasTimeCardsService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -67,8 +88,8 @@ public class SyncService {
|
||||||
private boolean btelefoni;
|
private boolean btelefoni;
|
||||||
private boolean bgruppi;
|
private boolean bgruppi;
|
||||||
private boolean bgruppo_pers;
|
private boolean bgruppo_pers;
|
||||||
//private boolean bposizioni;
|
// private boolean bposizioni;
|
||||||
//private boolean bproroghe;
|
// private boolean bproroghe;
|
||||||
private boolean borario;
|
private boolean borario;
|
||||||
private boolean bcartellini;
|
private boolean bcartellini;
|
||||||
private boolean bcartellini_rendicontazioni;
|
private boolean bcartellini_rendicontazioni;
|
||||||
|
@ -82,8 +103,8 @@ public class SyncService {
|
||||||
btelefoni = false;
|
btelefoni = false;
|
||||||
bgruppi = false;
|
bgruppi = false;
|
||||||
bgruppo_pers = false;
|
bgruppo_pers = false;
|
||||||
//bposizioni = false;
|
// bposizioni = false;
|
||||||
//bproroghe = false;
|
// bproroghe = false;
|
||||||
|
|
||||||
List<TabsSI> tabsSI = tabsSIService.getAllTabsSI();
|
List<TabsSI> tabsSI = tabsSIService.getAllTabsSI();
|
||||||
siMasterLogService.startFluxReads();
|
siMasterLogService.startFluxReads();
|
||||||
|
@ -101,15 +122,15 @@ public class SyncService {
|
||||||
baspettative = false;
|
baspettative = false;
|
||||||
|
|
||||||
List<TabsSI> tabsSI = tabsSIService.getAllTabsSI();
|
List<TabsSI> tabsSI = tabsSIService.getAllTabsSI();
|
||||||
Long idFlux=siMasterLogService.startFluxWrites();
|
Long idFlux = siMasterLogService.startFluxWrites();
|
||||||
writeData(idFlux,tabsSI);
|
writeData(idFlux, tabsSI);
|
||||||
siMasterLogService.closeFluxWrites(idFlux,writeTabs());
|
siMasterLogService.closeFluxWrites(idFlux, writeTabs());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readData(List<TabsSI> tabsSI) {
|
private void readData(List<TabsSI> tabsSI) {
|
||||||
//TabsSI posizioniTab = null;
|
// TabsSI posizioniTab = null;
|
||||||
//TabsSI prorogheTab = null;
|
// TabsSI prorogheTab = 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()
|
||||||
|
@ -133,10 +154,10 @@ public class SyncService {
|
||||||
case "gruppo_pers":
|
case "gruppo_pers":
|
||||||
syncGruppoPers(tab);
|
syncGruppoPers(tab);
|
||||||
break;
|
break;
|
||||||
//case "posizioni":
|
// case "posizioni":
|
||||||
// posizioniTab = tab;
|
// posizioniTab = tab;
|
||||||
// break;
|
// break;
|
||||||
//case "proroghe":
|
// case "proroghe":
|
||||||
// prorogheTab = tab;
|
// prorogheTab = tab;
|
||||||
// break;
|
// break;
|
||||||
default:
|
default:
|
||||||
|
@ -145,9 +166,9 @@ public class SyncService {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if (posizioniTab != null || prorogheTab != null) {
|
// if (posizioniTab != null || prorogheTab != null) {
|
||||||
// syncPosizioniAndProroghe(posizioniTab, prorogheTab);
|
// syncPosizioniAndProroghe(posizioniTab, prorogheTab);
|
||||||
//}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void syncAnagrafico(TabsSI tab) {
|
private void syncAnagrafico(TabsSI tab) {
|
||||||
|
@ -219,7 +240,7 @@ public class SyncService {
|
||||||
EPASPersonsDTO epasPersonsDTO = epasPersonsMapper
|
EPASPersonsDTO epasPersonsDTO = epasPersonsMapper
|
||||||
.epasPersonsToEPASPersonsDTO(epasPerson);
|
.epasPersonsToEPASPersonsDTO(epasPerson);
|
||||||
switch (emailTipo) {
|
switch (emailTipo) {
|
||||||
//case SI_TIPO_EMAIL_ISTITUZIONALE:
|
// case SI_TIPO_EMAIL_ISTITUZIONALE:
|
||||||
// epasPersonsDTO.setEmail(se.getEmail());
|
// epasPersonsDTO.setEmail(se.getEmail());
|
||||||
// epasPersonsService.updateByFiscalCode(epasPersonsDTO.getFiscalCode(),
|
// epasPersonsService.updateByFiscalCode(epasPersonsDTO.getFiscalCode(),
|
||||||
// epasPersonsDTO);
|
// epasPersonsDTO);
|
||||||
|
@ -301,18 +322,220 @@ public class SyncService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void syncGruppi(TabsSI tab) {
|
private void syncGruppi(TabsSI tab) {
|
||||||
// TODO Auto-generated method stub
|
if (tab.getIdFlusso() == null || tab.getIdFlusso().longValue() == 0) {
|
||||||
|
log.info("Invalid Id Flusso for tab: {}", tab);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
long maxIdFlusso = 0;
|
||||||
|
|
||||||
|
List<SIGruppi> sigList = siGruppiService.readNewFlux(tab.getIdFlusso());
|
||||||
|
for (SIGruppi sig : sigList) {
|
||||||
|
if (sig.getId_flusso() != null && sig.getId_flusso().longValue() > maxIdFlusso) {
|
||||||
|
maxIdFlusso = sig.getId_flusso();
|
||||||
|
}
|
||||||
|
if (sig.getId() != null && sig.getId() != 0) {
|
||||||
|
if (sig.getFlag_del() != null && !sig.getFlag_del().isEmpty()) {
|
||||||
|
if (sig.getFlag_del().compareTo(SI_FLAG_DEL_TRUE) != 0) {
|
||||||
|
List<EPASGroups> epasGroups = epasGroupsService.getList(ISTI_OFFICE_ID);
|
||||||
|
if (epasGroups != null) {
|
||||||
|
EPASGroups groupPresent = null;
|
||||||
|
for (EPASGroups g : epasGroups) {
|
||||||
|
if (Integer.valueOf(g.getExternalId()).compareTo(sig.getId()) == 0) {
|
||||||
|
groupPresent = g;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (groupPresent == null) {
|
||||||
|
EPASGroupsDTO epasGroupsDTO = new EPASGroupsDTO(sig.getDescrizione(), null,
|
||||||
|
String.valueOf(sig.getId()), null, null, sig.getSigla(), ISTI_OFFICE_ID);
|
||||||
|
EPASGroups epasGroup = epasGroupsService.create(epasGroupsDTO);
|
||||||
|
log.info("EPAS Created Group: {}", epasGroup);
|
||||||
|
} else {
|
||||||
|
EPASGroupsMapper epasGroupsMapper = new EPASGroupsMapper();
|
||||||
|
EPASGroupsDTO epasGroupsDTO = epasGroupsMapper.epasGroupsToEPASGroupsDTO(groupPresent);
|
||||||
|
epasGroupsDTO.setDescription(sig.getDescrizione());
|
||||||
|
epasGroupsDTO.setName(sig.getSigla());
|
||||||
|
epasGroupsService.updateById(groupPresent.getId(), epasGroupsDTO);
|
||||||
|
log.info("EPAS Updated Group: {}", epasGroupsDTO);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
EPASGroupsDTO epasGroupsDTO = new EPASGroupsDTO(sig.getDescrizione(), null,
|
||||||
|
String.valueOf(sig.getId()), null, null, sig.getSigla(), ISTI_OFFICE_ID);
|
||||||
|
EPASGroups epasGroup = epasGroupsService.create(epasGroupsDTO);
|
||||||
|
log.info("EPAS Created Group: {}", epasGroup);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
List<EPASGroups> epasGroups = epasGroupsService.getList(ISTI_OFFICE_ID);
|
||||||
|
if (epasGroups != null) {
|
||||||
|
EPASGroups groupPresent = null;
|
||||||
|
for (EPASGroups g : epasGroups) {
|
||||||
|
if (Integer.valueOf(g.getExternalId()).compareTo(sig.getId()) == 0) {
|
||||||
|
groupPresent = g;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (groupPresent != null) {
|
||||||
|
Date endDate = new Date();
|
||||||
|
if (sig.getData_mod() != null) {
|
||||||
|
endDate.setTime(sig.getData_mod().getTime());
|
||||||
|
groupPresent.setEndDate(sdfDate.format(endDate));
|
||||||
|
EPASGroupsMapper epasGroupsMapper = new EPASGroupsMapper();
|
||||||
|
EPASGroupsDTO epasGroupsDTO = epasGroupsMapper
|
||||||
|
.epasGroupsToEPASGroupsDTO(groupPresent);
|
||||||
|
epasGroupsService.updateById(groupPresent.getId(), epasGroupsDTO);
|
||||||
|
log.info("EPAS Delete Group: {}", epasGroupsDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxIdFlusso > 0) {
|
||||||
|
bgruppi = true;
|
||||||
|
tab.setIdFlusso(maxIdFlusso);
|
||||||
|
tab.setLastUpdate(LocalDateTime.now());
|
||||||
|
tabsSIService.updateTabsSI(tab);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void syncGruppoPers(TabsSI tab) {
|
private void syncGruppoPers(TabsSI tab) {
|
||||||
// TODO Auto-generated method stub
|
if (tab.getIdFlusso() == null || tab.getIdFlusso().longValue() == 0) {
|
||||||
|
log.info("Invalid Id Flusso for tab: {}", tab);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
long maxIdFlusso = 0;
|
||||||
|
|
||||||
|
List<SIGruppiPers> sigList = siGruppiPersService.readNewFlux(tab.getIdFlusso());
|
||||||
|
for (SIGruppiPers sigp : sigList) {
|
||||||
|
if (sigp.getId_flusso() != null && sigp.getId_flusso().longValue() > maxIdFlusso) {
|
||||||
|
maxIdFlusso = sigp.getId_flusso();
|
||||||
|
}
|
||||||
|
if (sigp.getId() != null && sigp.getId() != 0) {
|
||||||
|
if (sigp.getFlag_del() != null && !sigp.getFlag_del().isEmpty()) {
|
||||||
|
if (sigp.getFlag_del().compareTo(SI_FLAG_DEL_TRUE) != 0) {
|
||||||
|
List<EPASAffiliations> epasAffiliations = epasAffiliationsService
|
||||||
|
.getByPersonFiscalcode(sigp.getCf());
|
||||||
|
if (epasAffiliations != null) {
|
||||||
|
EPASAffiliations affPresent = null;
|
||||||
|
for (EPASAffiliations aff : epasAffiliations) {
|
||||||
|
if (Integer.valueOf(aff.getExternalId()).compareTo(sigp.getId()) == 0) {
|
||||||
|
affPresent = aff;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (affPresent != null) {
|
||||||
|
List<EPASGroups> epasGroups = epasGroupsService.getList(ISTI_OFFICE_ID);
|
||||||
|
EPASGroups groupPresent = null;
|
||||||
|
if (epasGroups != null) {
|
||||||
|
for (EPASGroups g : epasGroups) {
|
||||||
|
if (Integer.valueOf(g.getExternalId()).compareTo(sigp.getId()) == 0) {
|
||||||
|
groupPresent = g;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (groupPresent != null) {
|
||||||
|
EPASPersons epasPerson = epasPersonsService.getByFiscalCode(sigp.getCf());
|
||||||
|
if (epasPerson != null) {
|
||||||
|
EPASAffiliationsDTO epasAffiliationsDTO = new EPASAffiliationsDTO(
|
||||||
|
sdfDate.format(sigp.getDal()), sdfDate.format(sigp.getAl()),
|
||||||
|
groupPresent.getId(), null, String.valueOf(sigp.getPercentuale()),
|
||||||
|
epasPerson.getId(), String.valueOf(sigp.getId()));
|
||||||
|
epasAffiliationsService.updateById(affPresent.getId(), epasAffiliationsDTO);
|
||||||
|
log.info("EPAS Updated Affilation: {}", epasAffiliationsDTO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//private void syncPosizioniAndProroghe(TabsSI posizioniTab, TabsSI prorogheTab) {
|
}
|
||||||
//
|
}
|
||||||
//}
|
} else {
|
||||||
|
List<EPASGroups> epasGroups = epasGroupsService.getList(ISTI_OFFICE_ID);
|
||||||
|
EPASGroups groupPresent = null;
|
||||||
|
if (epasGroups != null) {
|
||||||
|
for (EPASGroups g : epasGroups) {
|
||||||
|
if (Integer.valueOf(g.getExternalId()).compareTo(sigp.getId()) == 0) {
|
||||||
|
groupPresent = g;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (groupPresent != null) {
|
||||||
|
EPASPersons epasPerson = epasPersonsService.getByFiscalCode(sigp.getCf());
|
||||||
|
if (epasPerson != null) {
|
||||||
|
EPASAffiliationsDTO epasAffiliationsDTO = new EPASAffiliationsDTO(
|
||||||
|
sdfDate.format(sigp.getDal()), sdfDate.format(sigp.getAl()),
|
||||||
|
groupPresent.getId(), null, String.valueOf(sigp.getPercentuale()),
|
||||||
|
epasPerson.getId(), String.valueOf(sigp.getId()));
|
||||||
|
EPASAffiliations epasAffiliationNew = epasAffiliationsService
|
||||||
|
.create(epasAffiliationsDTO);
|
||||||
|
log.info("EPAS Created Affilation: {}", epasAffiliationNew);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
List<EPASGroups> epasGroups = epasGroupsService.getList(ISTI_OFFICE_ID);
|
||||||
|
EPASGroups groupPresent = null;
|
||||||
|
if (epasGroups != null) {
|
||||||
|
for (EPASGroups g : epasGroups) {
|
||||||
|
if (Integer.valueOf(g.getExternalId()).compareTo(sigp.getId()) == 0) {
|
||||||
|
groupPresent = g;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (groupPresent != null) {
|
||||||
|
EPASPersons epasPerson = epasPersonsService.getByFiscalCode(sigp.getCf());
|
||||||
|
if (epasPerson != null) {
|
||||||
|
EPASAffiliationsDTO epasAffiliationsDTO = new EPASAffiliationsDTO(
|
||||||
|
sdfDate.format(sigp.getDal()), sdfDate.format(sigp.getAl()),
|
||||||
|
groupPresent.getId(), null, String.valueOf(sigp.getPercentuale()),
|
||||||
|
epasPerson.getId(), String.valueOf(sigp.getId()));
|
||||||
|
EPASAffiliations epasAffiliationNew = epasAffiliationsService
|
||||||
|
.create(epasAffiliationsDTO);
|
||||||
|
log.info("EPAS Created Affilation: {}", epasAffiliationNew);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
List<EPASAffiliations> epasAffiliations = epasAffiliationsService
|
||||||
|
.getByPersonFiscalcode(sigp.getCf());
|
||||||
|
if (epasAffiliations != null) {
|
||||||
|
EPASAffiliations affPresent = null;
|
||||||
|
for (EPASAffiliations aff : epasAffiliations) {
|
||||||
|
if (Integer.valueOf(aff.getExternalId()).compareTo(sigp.getId()) == 0) {
|
||||||
|
affPresent = aff;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (affPresent != null) {
|
||||||
|
EPASAffiliationsMapper epasAffiliationsMapper=new EPASAffiliationsMapper();
|
||||||
|
EPASAffiliationsDTO epasAffiliationsDTO=epasAffiliationsMapper.epasAffiliationsToEPASAffiliationsDTO(affPresent);
|
||||||
|
epasAffiliationsDTO.setEndDate(sdfDate.format(sigp.getAl()));
|
||||||
|
epasAffiliationsService.updateById(affPresent.getId(), epasAffiliationsDTO);
|
||||||
|
log.info("EPAS Delete Affilation: {}", epasAffiliationsDTO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxIdFlusso > 0) {
|
||||||
|
bgruppo_pers = true;
|
||||||
|
tab.setIdFlusso(maxIdFlusso);
|
||||||
|
tab.setLastUpdate(LocalDateTime.now());
|
||||||
|
tabsSIService.updateTabsSI(tab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String readTabs() {
|
private String readTabs() {
|
||||||
String readTabs = "";
|
String readTabs = "";
|
||||||
|
@ -354,21 +577,15 @@ public class SyncService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (bposizioni) {
|
/*
|
||||||
if (tabelle_lette == null || tabelle_lette.isEmpty()) {
|
* if (bposizioni) { if (tabelle_lette == null || tabelle_lette.isEmpty()) {
|
||||||
tabelle_lette = "posizioni";
|
* tabelle_lette = "posizioni"; } else { tabelle_lette = tabelle_lette +
|
||||||
} else {
|
* ",posizioni"; } }
|
||||||
tabelle_lette = tabelle_lette + ",posizioni";
|
*
|
||||||
}
|
* if (bproroghe) { if (tabelle_lette == null || tabelle_lette.isEmpty()) {
|
||||||
}
|
* tabelle_lette = "proroghe"; } else { tabelle_lette = tabelle_lette +
|
||||||
|
* ",proroghe"; } }
|
||||||
if (bproroghe) {
|
*/
|
||||||
if (tabelle_lette == null || tabelle_lette.isEmpty()) {
|
|
||||||
tabelle_lette = "proroghe";
|
|
||||||
} else {
|
|
||||||
tabelle_lette = tabelle_lette + ",proroghe";
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return readTabs;
|
return readTabs;
|
||||||
}
|
}
|
||||||
|
@ -421,13 +638,9 @@ public class SyncService {
|
||||||
return writeTabs;
|
return writeTabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void writeData(Long idFlux, List<TabsSI> tabsSI) {
|
private void writeData(Long idFlux, List<TabsSI> tabsSI) {
|
||||||
TabsSI caretelliniRendicontazioniTab = null;
|
//TabsSI caretelliniRendicontazioniTab = null;
|
||||||
TabsSI cartelliniTab = null;
|
//TabsSI cartelliniTab = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (TabsSI tab : tabsSI) {
|
for (TabsSI tab : tabsSI) {
|
||||||
log.info("TabSI: {}", tab);
|
log.info("TabSI: {}", tab);
|
||||||
|
@ -438,21 +651,21 @@ 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:
|
||||||
|
@ -470,30 +683,27 @@ public class SyncService {
|
||||||
}
|
}
|
||||||
long maxIdFlusso = 0;
|
long maxIdFlusso = 0;
|
||||||
|
|
||||||
GregorianCalendar lastMonthSent=new GregorianCalendar(2021,11,1);
|
GregorianCalendar lastMonthSent = new GregorianCalendar(2021, 11, 1);
|
||||||
GregorianCalendar nextMonthToSent=new GregorianCalendar();
|
GregorianCalendar nextMonthToSent = new GregorianCalendar();
|
||||||
nextMonthToSent.setTime(lastMonthSent.getTime());
|
nextMonthToSent.setTime(lastMonthSent.getTime());
|
||||||
nextMonthToSent.add(GregorianCalendar.MONTH, 1);
|
nextMonthToSent.add(GregorianCalendar.MONTH, 1);
|
||||||
String y=String.valueOf(nextMonthToSent.get(GregorianCalendar.YEAR));
|
String y = String.valueOf(nextMonthToSent.get(GregorianCalendar.YEAR));
|
||||||
String m=String.valueOf(nextMonthToSent.get(GregorianCalendar.YEAR));
|
String m = String.valueOf(nextMonthToSent.get(GregorianCalendar.YEAR));
|
||||||
EPASValidates epasValidates=epasValidatesService.getValidatesByOfficeCodeId(ISTI_OFFICE_CODEID, y,
|
EPASValidates epasValidates = epasValidatesService.getValidatesByOfficeCodeId(ISTI_OFFICE_CODEID, y, m);
|
||||||
m);
|
|
||||||
|
|
||||||
if(!epasValidates.getAllCertificationsValidated()) {
|
if (!epasValidates.getAllCertificationsValidated()) {
|
||||||
log.info("No new month closed on EPAS: [year={}, month={}]", y,m);
|
log.info("No new month closed on EPAS: [year={}, month={}]", y, m);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO
|
// TODO
|
||||||
log.info("Certifications Validated: [year={}, month={}]",y,m);
|
log.info("Certifications Validated: [year={}, month={}]", y, m);
|
||||||
for(EPASPersons person:epasValidates.getValidatedPersons()) {
|
for (EPASPersons person : epasValidates.getValidatedPersons()) {
|
||||||
log.info("Writing TimeCard for Person: {}",person);
|
log.info("Writing TimeCard for Person: {}", person);
|
||||||
EPASTimeCards epasTimeCards=epasTimeCardsService.getTimeCardByPersonEmail(person.getEmail(), y, m);
|
EPASTimeCards epasTimeCards = epasTimeCardsService.getTimeCardByPersonEmail(person.getEmail(), y, m);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue