From 1216e1d9db15697f43edd2771ec6bdadc446e332 Mon Sep 17 00:00:00 2001 From: "marco.spasiano" Date: Mon, 15 Apr 2024 09:59:34 +0200 Subject: [PATCH] Added control over HelpDesk expert valorization --- .../configuration/TimerConfiguration.java | 1 + .../cool/jconon/service/call/CallService.java | 48 ++++++++++++++++++- .../service/helpdesk/HelpdeskService.java | 5 +- .../resources/i18n/cool-jconon_en.properties | 1 + .../resources/i18n/cool-jconon_it.properties | 1 + 5 files changed, 53 insertions(+), 3 deletions(-) diff --git a/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/configuration/TimerConfiguration.java b/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/configuration/TimerConfiguration.java index fb1fe00deb..388339a293 100644 --- a/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/configuration/TimerConfiguration.java +++ b/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/configuration/TimerConfiguration.java @@ -99,6 +99,7 @@ public void protocol() { } catch (Exception e) { LOGGER.error("Protocol application failed", e); } + callService.checkCallHelpdesk(cmisService.createAdminSession()); } } diff --git a/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/service/call/CallService.java b/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/service/call/CallService.java index b4e87dc6bb..cad326b983 100644 --- a/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/service/call/CallService.java +++ b/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/service/call/CallService.java @@ -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; @@ -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 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> usersHelpDeskTecnico = Optional.ofNullable(call.getPropertyValue(JCONONPropertyIds.CALL_ID_CATEGORIA_TECNICO_HELPDESK.value())) + .map(integer -> helpdeskService.getEsperti(integer.intValue())); + final Optional> usersHelpDeskAmministrativo = Optional.ofNullable(call.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 HelpDesk"; + if (helpDeskTecnico) { + body += ", nella categoria Tecnica"; + } + if (helpDeskAmministrativo) { + body += ", nella categoria Amministrativa"; + } + body += ".

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( diff --git a/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/service/helpdesk/HelpdeskService.java b/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/service/helpdesk/HelpdeskService.java index 66fed6b21f..e56940860e 100644 --- a/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/service/helpdesk/HelpdeskService.java +++ b/cool-jconon-backend/src/main/java/it/cnr/si/cool/jconon/service/helpdesk/HelpdeskService.java @@ -49,6 +49,7 @@ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Collections; +import java.util.List; import java.util.Optional; /** @@ -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 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; } diff --git a/cool-jconon-webapp-resources/src/main/resources/i18n/cool-jconon_en.properties b/cool-jconon-webapp-resources/src/main/resources/i18n/cool-jconon_en.properties index 23e0b4c4e8..c09dde0d15 100644 --- a/cool-jconon-webapp-resources/src/main/resources/i18n/cool-jconon_en.properties +++ b/cool-jconon-webapp-resources/src/main/resources/i18n/cool-jconon_en.properties @@ -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: {0}
Do you wish to continue? diff --git a/cool-jconon-webapp-resources/src/main/resources/i18n/cool-jconon_it.properties b/cool-jconon-webapp-resources/src/main/resources/i18n/cool-jconon_it.properties index 0ebbb7e6b9..95c8b8186f 100644 --- a/cool-jconon-webapp-resources/src/main/resources/i18n/cool-jconon_it.properties +++ b/cool-jconon-webapp-resources/src/main/resources/i18n/cool-jconon_it.properties @@ -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