Skip to content

Commit

Permalink
Added control over HelpDesk expert valorization
Browse files Browse the repository at this point in the history
  • Loading branch information
mspasiano committed Apr 15, 2024
1 parent 29b97a1 commit 1216e1d
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public void protocol() {
} catch (Exception e) {
LOGGER.error("Protocol application failed", e);
}
callService.checkCallHelpdesk(cmisService.createAdminSession());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
import it.cnr.cool.util.StringUtil;
import it.cnr.cool.web.PermissionServiceImpl;
import it.cnr.cool.web.scripts.exception.ClientMessageException;
import it.cnr.ict.domain.User;
import it.cnr.jada.firma.arss.ArubaSignServiceClient;
import it.cnr.jada.firma.arss.ArubaSignServiceException;
import it.cnr.jada.firma.arss.stub.PdfSignApparence;
import it.cnr.si.cool.jconon.cmis.model.*;
import it.cnr.si.cool.jconon.configuration.PECConfiguration;
Expand Down Expand Up @@ -2625,6 +2625,52 @@ private Boolean convertFromString(String s) {
return null;
}

public void checkCallHelpdesk(Session session) {
Criteria criteria = CriteriaFactory.createCriteria(JCONONFolderType.JCONON_CALL.queryName());
criteria.add(Restrictions.eq(JCONONPropertyIds.CALL_PUBBLICATO.value(), Boolean.TRUE));
criteria.add(
Restrictions.le(
JCONONPropertyIds.CALL_DATA_INIZIO_INVIO_DOMANDE.value(),
ISO8601DATEFORMAT.format(Date.from(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant()))
)
);
criteria.add(
Restrictions.ge(
JCONONPropertyIds.CALL_DATA_FINE_INVIO_DOMANDE.value(),
ISO8601DATEFORMAT.format(Date.from(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant()))
)
);
ItemIterable<QueryResult> bandiAttivi = criteria.executeQuery(session, false, session.getDefaultContext());
for (QueryResult queryResult : bandiAttivi.getPage(Integer.MAX_VALUE)) {
Folder call = (Folder) session.getObject((String) queryResult.getPropertyValueById(PropertyIds.OBJECT_ID));
final Optional<List<User>> usersHelpDeskTecnico = Optional.ofNullable(call.<BigInteger>getPropertyValue(JCONONPropertyIds.CALL_ID_CATEGORIA_TECNICO_HELPDESK.value()))
.map(integer -> helpdeskService.getEsperti(integer.intValue()));
final Optional<List<User>> usersHelpDeskAmministrativo = Optional.ofNullable(call.<BigInteger>getPropertyValue(JCONONPropertyIds.CALL_ID_CATEGORIA_NORMATIVA_HELPDESK.value()))
.map(integer -> helpdeskService.getEsperti(integer.intValue()));
final boolean helpDeskTecnico = usersHelpDeskTecnico.isPresent() && usersHelpDeskTecnico.get().isEmpty();
final boolean helpDeskAmministrativo = usersHelpDeskAmministrativo.isPresent() && usersHelpDeskAmministrativo.get().isEmpty();
if (helpDeskTecnico || helpDeskAmministrativo) {
EmailMessage message = new EmailMessage();
CMISUser user = userService.loadUserForConfirm(call.getPropertyValue(PropertyIds.CREATED_BY));
message.setRecipients(Collections.singletonList(user.getEmail()));
message.setSubject(i18NService.getLabel("subject-info", Locale.ITALY) + i18NService.getLabel("subject-reminder-helpdesk-list", Locale.ITALY,
queryResult.getPropertyById(JCONONPropertyIds.CALL_CODICE.value()).getFirstValue(),
removeHtmlFromString((String) queryResult.getPropertyById(JCONONPropertyIds.CALL_DESCRIZIONE.value()).getFirstValue())));
String body = "Attenzione, per il bando in oggetto non risultano valorizzati gli esperti <b>HelpDesk</b>";
if (helpDeskTecnico) {
body += ", nella categoria Tecnica";
}
if (helpDeskAmministrativo) {
body += ", nella categoria Amministrativa";
}
body += ".<br/><br/>Si prega di procedere quanto prima alla loro valorizzazione.";
message.setBody(body);
mailService.send(message);
LOGGER.info("Spedita mail a {} per il bando {} con testo {}", user.getEmail(), message.getSubject(), body);
}
}
}

public void protocolApplication(Session session) {
Criteria criteria = CriteriaFactory.createCriteria(JCONONFolderType.JCONON_CALL.queryName());
criteria.add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

/**
Expand Down Expand Up @@ -226,12 +227,12 @@ public Integer createCategoria(Integer idPadre, String nome, String descrizione)
return oilService.map(oil -> oil.addCategory(category).intValue()).orElse(null);
}

public Object getEsperti(Integer idCategoria) {
public List<User> getEsperti(Integer idCategoria) {
try {
return oilService.map(oil -> oil.getExperts(Long.valueOf(idCategoria))).orElse(Collections.emptyList());
} catch (FeignException _ex) {
if (_ex.status() == HttpStatus.NOT_FOUND.value()) {
return "{}";
return Collections.emptyList();
}
throw _ex;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ subject-reminder-domanda=E-Recruitment of the National Research Council of Italy
subject-print-domanda=E-Recruitment of the National Research Council of Italy - Notice No. {0} - temporary question Print
subject-reminder-selectedproducts=E-Recruitment of the National Research Council of Italy - Reminder selected product for call {0} {1}
subject-reminder-selectedproducts-list=E-Recruitment of the National Research Council of Italy - Reminder selected product for call {0} {1}
subject-reminder-helpdesk-list=E-Recruitment of the National Research Council of Italy - Valorizzazzione esperti HelpDesk per il bando {0} {1}

message.confirm.account=To complete the registration, we will send you a mail to the following address: <a href="mailto:{0}">{0}</a><br><b>Do you wish to continue?</b>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ subject-reminder-domanda=Selezioni online Consiglio Nazionale delle Ricerche - S
subject-print-domanda=Selezioni online Consiglio Nazionale delle Ricerche - Codice Bando {0} - Stampa provvisoria domanda
subject-reminder-selectedproducts=Selezioni online Consiglio Nazionale delle Ricerche - Sollecito caricamento prodotti scelti bando {0} {1}
subject-reminder-selectedproducts-list=Selezioni online Consiglio Nazionale delle Ricerche - Caricamento Schede prodotti/titoli scelti per il bando {0} {1}
subject-reminder-helpdesk-list=Selezioni online Consiglio Nazionale delle Ricerche - Valorizzazzione esperti HelpDesk per il bando {0} {1}

main.title=Selezioni online Consiglio Nazionale delle Ricerche
page.admin=Console di amministrazione
Expand Down

0 comments on commit 1216e1d

Please sign in to comment.