diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/search/ControlloPraticaAdvancedSearch.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/search/ControlloPraticaAdvancedSearch.java index 5681e1d3..1b951492 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/search/ControlloPraticaAdvancedSearch.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/search/ControlloPraticaAdvancedSearch.java @@ -522,6 +522,8 @@ public class ControlloPraticaAdvancedSearch { String dataAl = ParamUtil.getString(request, "dataRichiestaFine"); String comune = ParamUtil.getString(request, "comune"); String tipoAttivita = ParamUtil.getString(request, "tipoAttivita"); + Long geologi = ParamUtil.getLong(request, "geologi"); + Long parereGeologo = ParamUtil.getLong(request, "parereGeologo"); // ADT - BUG-11 Aggiunta filtro ricerca String controlloObbligatorioSearch = ParamUtil.getString(request, "controlloObbligatorio"); try { @@ -596,6 +598,18 @@ public class ControlloPraticaAdvancedSearch { booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); } + if (Validator.isNotNull(geologi) && !geologi.equals(-1L) && !geologi.equals(0L)) { + TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "geologi", + geologi); + booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); + } + + if (Validator.isNotNull(parereGeologo) && !parereGeologo.equals(-1L)) { + TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "parereGeologo", + parereGeologo); + booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); + } + if (Validator.isNotNull(unitaOperativa) && !unitaOperativa.equals("-1")) { TermQuery uoQuery = TermQueryFactoryUtil.create(searchContext, "unitaOperativa", unitaOperativa); @@ -633,8 +647,6 @@ public class ControlloPraticaAdvancedSearch { booleanQuery.add(controlloObbligatorioTermQuery, BooleanClauseOccur.MUST); } - _log.info("Query backend" + booleanQuery.toString()); - } catch (ParseException | java.text.ParseException e) { _log.error(e, e); } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/search/IntPraticaAdvancedSearch.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/search/IntPraticaAdvancedSearch.java index 9d34694f..5c4a58c7 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/search/IntPraticaAdvancedSearch.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/search/IntPraticaAdvancedSearch.java @@ -271,6 +271,8 @@ public class IntPraticaAdvancedSearch { String istruttoreId = ParamUtil.getString(request, "istruttore"); String unitaOperativa = ParamUtil.getString(request, "unitaOperativa"); + Long geologi = ParamUtil.getLong(request, "geologi"); + Long parereGeologo = ParamUtil.getLong(request, "parereGeologo"); try { TermQuery termQuery; @@ -332,7 +334,18 @@ public class IntPraticaAdvancedSearch { booleanQuery.add(uoQuery, BooleanClauseOccur.MUST); } - _log.info("Query frontend" + booleanQuery.toString()); + if (Validator.isNotNull(geologi) && !geologi.equals(-1L) && !geologi.equals(0L)) { + TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "geologi", + geologi); + booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); + } + + if (Validator.isNotNull(parereGeologo) && !parereGeologo.equals(-1L)) { + TermQuery singleGroupIdQuery = TermQueryFactoryUtil.create(searchContext, "parereGeologo", + parereGeologo); + booleanQuery.add(singleGroupIdQuery, BooleanClauseOccur.MUST); + } + } catch (ParseException | java.text.ParseException e) { _log.error(e, e); } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/PortosIndexField.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/PortosIndexField.java index 49306644..0e351b4c 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/PortosIndexField.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/service/it/tref/liferay/portos/bo/util/PortosIndexField.java @@ -48,6 +48,7 @@ public class PortosIndexField implements Serializable { public static final String PROPRIETARIO_DIGITALE_FULL_NAME = "proprietarioDigitaleFullName"; public static final String ISTRUTTORE_USERNAME = "istruttoreUsername"; public static final String PARERE_GEOLOGO = "parereGeologo"; + public static final String GEOLOGI = "geologi"; public static final String COMUNE_ID = "comuneId"; public static final String COMUNE_DENOMINAZIONE = "comuneDenominazione"; public static final String PROVINCIA_ID = "provinciaId"; diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/indexer/ControlloPraticaIndexer.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/indexer/ControlloPraticaIndexer.java index 6a862672..edba5fac 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/indexer/ControlloPraticaIndexer.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/indexer/ControlloPraticaIndexer.java @@ -4,6 +4,7 @@ import it.tref.liferay.portos.bo.model.Comune; import it.tref.liferay.portos.bo.model.ControlloPratica; import it.tref.liferay.portos.bo.model.DettPratica; import it.tref.liferay.portos.bo.model.IntPratica; +import it.tref.liferay.portos.bo.model.ParereGeologo; import it.tref.liferay.portos.bo.model.Provincia; import it.tref.liferay.portos.bo.model.Soggetto; import it.tref.liferay.portos.bo.model.Territorio; @@ -11,6 +12,7 @@ import it.tref.liferay.portos.bo.service.ComuneLocalServiceUtil; import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; +import it.tref.liferay.portos.bo.service.ParereGeologoLocalServiceUtil; import it.tref.liferay.portos.bo.service.ProvinciaLocalServiceUtil; import it.tref.liferay.portos.bo.service.SoggettoLocalServiceUtil; import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil; @@ -114,7 +116,7 @@ public class ControlloPraticaIndexer extends BaseIndexer { document.addKeyword("entryClassName", ControlloPratica.class.getName()); document.addKeyword(PortosIndexField.CONTROLLO_PRATICA_ID, controlloPraticaFromDB.getControlloPraticaId()); document.addKeyword(PortosIndexField.DETT_PRATICA_ID, controlloPraticaFromDB.getDettPraticaId()); - document.addKeyword(PortosIndexField.PARERE_GEOLOGO, controlloPraticaFromDB.getParereGeologo()); + //document.addKeyword(PortosIndexField.PARERE_GEOLOGO, controlloPraticaFromDB.getParereGeologo()); document.addKeyword(PortosIndexField.STATUS, controlloPraticaFromDB.getStatus()); document.addKeyword(PortosIndexField.STATUS_BY_USERID, controlloPraticaFromDB.getStatusByUserId()); document.addKeyword(PortosIndexField.STATUS_BY_USERNAME, controlloPraticaFromDB.getStatusByUserName()); @@ -124,6 +126,22 @@ public class ControlloPraticaIndexer extends BaseIndexer { } else { document.addKeyword(PortosIndexField.STATUS_DATE, 0); } + + List listaParereGeologo = ParereGeologoLocalServiceUtil.findByIntPraticaId( + controlloPraticaFromDB.getIntPraticaId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS); + + List idGeologi = new ArrayList(); + for(ParereGeologo geo : listaParereGeologo){ + idGeologi.add(geo.getGeologoUserId()); + } + + if (Validator.isNotNull(listaParereGeologo) && !listaParereGeologo.isEmpty()) { + document.addKeyword(PortosIndexField.PARERE_GEOLOGO, 1L); + } else { + document.addKeyword(PortosIndexField.PARERE_GEOLOGO, 0L); + } + + document.addNumber(PortosIndexField.GEOLOGI, idGeologi.toArray(new Long[0])); document.addKeyword(PortosIndexField.DATA_INIZIO_PROCEDIMENTO, DATE_FORMAT.format(controlloPraticaFromDB.getCreateDate())); document.addKeywordSortable(PortosIndexField.DATA_INIZIO_PROCEDIMENTO, diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/indexer/IntPraticaIndexer.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/indexer/IntPraticaIndexer.java index 71ede575..0cc6aabf 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/indexer/IntPraticaIndexer.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/indexer/IntPraticaIndexer.java @@ -29,6 +29,7 @@ import java.util.Locale; import javax.portlet.PortletURL; import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery; +import com.liferay.portal.kernel.dao.orm.QueryUtil; import com.liferay.portal.kernel.exception.PortalException; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.log.Log; @@ -252,12 +253,21 @@ public class IntPraticaIndexer extends BaseIndexer { document.addKeyword(PortosIndexField.UNITA_OPERATIVA, intPraticaFromDB.getUnitaOperativa()); // Gestione Parere Geologo List listaParereGeologo = ParereGeologoLocalServiceUtil.findByIntPraticaId( - intPratica.getIntPraticaId(), 0, 1); + intPratica.getIntPraticaId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS); + + List idGeologi = new ArrayList(); + for(ParereGeologo geo : listaParereGeologo){ + idGeologi.add(geo.getGeologoUserId()); + } + + document.addNumber(PortosIndexField.GEOLOGI, idGeologi.toArray(new Long[0])); + if (Validator.isNotNull(listaParereGeologo) && !listaParereGeologo.isEmpty()) { - document.addKeyword(PortosIndexField.PARERE_GEOLOGO, StringPool.TRUE); + document.addKeyword(PortosIndexField.PARERE_GEOLOGO, 1L); } else { - document.addKeyword(PortosIndexField.PARERE_GEOLOGO, StringPool.FALSE); + document.addKeyword(PortosIndexField.PARERE_GEOLOGO, 0L); } + // Gestione pratica sospesa document.addKeyword(PortosIndexField.STATUS_SOSPESA, intPraticaFromDB.isSospesa()); // Gestione Diverse tipologie di IntPratica MIEI PROGETTI && ARCHIVIO PROGETTI diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/FascicoloPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/FascicoloPortlet.java index 99cfa4a9..e8c440ed 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/FascicoloPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/FascicoloPortlet.java @@ -260,7 +260,8 @@ public class FascicoloPortlet extends MVCPortlet { String tipoIntervento = actionRequest.getParameter("tipoIntervento"); String tipoProcedura = ParamUtil.getString(actionRequest, "tipoProcedura"); String unitaOperativa = ParamUtil.getString(actionRequest, "unitaOperativa"); - String geologo = ParamUtil.getString(actionRequest, "geologo"); + String geologi = ParamUtil.getString(actionRequest, "geologi"); + String parereGeologo = ParamUtil.getString(actionRequest, "parereGeologo"); String istruttore = ParamUtil.getString(actionRequest, "istruttore"); if (Validator.isNotNull(dataRichiestaInizio)) { @@ -316,7 +317,8 @@ public class FascicoloPortlet extends MVCPortlet { actionResponse.setRenderParameter("tipoProcedura", tipoProcedura); actionResponse.setRenderParameter("unitaOperativa", unitaOperativa); - actionResponse.setRenderParameter("geologo", geologo); + actionResponse.setRenderParameter("geologi", geologi); + actionResponse.setRenderParameter("parereGeologo", parereGeologo); actionResponse.setRenderParameter("istruttore", istruttore); } @@ -481,44 +483,39 @@ public class FascicoloPortlet extends MVCPortlet { writeJSON(resourceRequest, resourceResponse, jsonArray); }else if ("geologo".equals(id)) { - Integer uoId = ParamUtil.getInteger(resourceRequest, "uoId"); JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); - if (Validator.isNotNull(uoId) && !uoId.equals("-1")) { - List organizationList = OrganizationLocalServiceUtil.getUserOrganizations(user.getUserId()); - List geologi = new ArrayList(); - - for(Organization org : organizationList) { - Role role = RoleLocalServiceUtil.getRole(org.getCompanyId(), "portos_geologo"); - List geologiUsers = UserLocalServiceUtil.getRoleUsers(role.getRoleId()); - - for (User userGroupRole : geologiUsers) { - List unitaOperativeGeologo = UnitaOperativeUtil.getUnitaOperative(userGroupRole); - if(unitaOperativeGeologo.contains(uoId)){ - if (geologi.isEmpty()) { - geologi.add(userGroupRole); - } else { - boolean isPresent = false; - for(User geo : geologi) { - if (geo.getUserId() == userGroupRole.getUserId()) { - isPresent = true; - break; - } - } - if(!isPresent){ - geologi.add(userGroupRole); - } + List organizationList = OrganizationLocalServiceUtil.getUserOrganizations(user.getUserId()); + List geologi = new ArrayList(); + + for(Organization org : organizationList) { + Role role = RoleLocalServiceUtil.getRole(org.getCompanyId(), "portos_geologo"); + List geologiUsers = UserLocalServiceUtil.getRoleUsers(role.getRoleId()); + + for (User userGroupRole : geologiUsers) { + if (geologi.isEmpty()) { + geologi.add(userGroupRole); + } else { + boolean isPresent = false; + for(User geo : geologi) { + if (geo.getUserId() == userGroupRole.getUserId()) { + isPresent = true; + break; } } + if(!isPresent){ + geologi.add(userGroupRole); + } } } - - for (User geo : geologi) { - JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); - jsonObject.put("geologoId", geo.getUserId()); - jsonObject.put("descLong", geo.getFullName()); - jsonArray.put(jsonObject); - } } + + for (User geo : geologi) { + JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); + jsonObject.put("geologoId", geo.getUserId()); + jsonObject.put("descLong", geo.getFullName()); + jsonArray.put(jsonObject); + } + writeJSON(resourceRequest, resourceResponse, jsonArray); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaIstruttorePortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaIstruttorePortlet.java index eb396eb7..795b3ae6 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaIstruttorePortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaIstruttorePortlet.java @@ -15,13 +15,17 @@ import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; import it.tref.liferay.portos.bo.service.ProvinciaLocalServiceUtil; import it.tref.liferay.portos.bo.service.SoggettoLocalServiceUtil; import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil; +import it.tref.liferay.portos.bo.shared.bean.IstruttoreBean; import it.tref.liferay.portos.bo.shared.util.TipoSoggettoUtil; +import it.tref.liferay.portos.bo.shared.util.UnitaOperativeUtil; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.Date; import java.util.List; @@ -52,7 +56,14 @@ import com.liferay.portal.kernel.util.PropsUtil; import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.Validator; import com.liferay.portal.kernel.util.WebKeys; +import com.liferay.portal.model.Organization; +import com.liferay.portal.model.Role; import com.liferay.portal.model.User; +import com.liferay.portal.model.UserGroupRole; +import com.liferay.portal.service.OrganizationLocalServiceUtil; +import com.liferay.portal.service.RoleLocalServiceUtil; +import com.liferay.portal.service.UserGroupRoleLocalServiceUtil; +import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portal.theme.ThemeDisplay; import com.liferay.portal.util.PortalUtil; import com.liferay.util.bridges.mvc.MVCPortlet; @@ -91,7 +102,8 @@ public class GestioneAttivitaIstruttorePortlet extends MVCPortlet { String tipoProcedura = ParamUtil.getString(actionRequest, "tipoProcedura"); String unitaOperativa = ParamUtil.getString(actionRequest, "unitaOperativa"); String provincia = ParamUtil.getString(actionRequest, "provincia"); - String geologo = ParamUtil.getString(actionRequest, "geologo"); + String geologi = ParamUtil.getString(actionRequest, "geologi"); + String parereGeologo = ParamUtil.getString(actionRequest, "parereGeologo"); String istruttore = ParamUtil.getString(actionRequest, "istruttore"); actionResponse.setRenderParameter("numeroProgetto", numeroProgetto); @@ -117,7 +129,8 @@ public class GestioneAttivitaIstruttorePortlet extends MVCPortlet { actionResponse.setRenderParameter("tipoProcedura", tipoProcedura); actionResponse.setRenderParameter("unitaOperativa", unitaOperativa); actionResponse.setRenderParameter("provincia", provincia); - actionResponse.setRenderParameter("geologo", geologo); + actionResponse.setRenderParameter("geologi", geologi); + actionResponse.setRenderParameter("parereGeologo", parereGeologo); actionResponse.setRenderParameter("istruttore", istruttore); } @@ -251,38 +264,180 @@ public class GestioneAttivitaIstruttorePortlet extends MVCPortlet { } // ADT BUG-ID=16 Sezione Pratiche Assegnate User user = themeDisplay.getUser(); - if ("comuniForUfficio".equals(resourceId)) { - String ufficio = ParamUtil.getString(resourceRequest, "ufficioId"); - JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); - List comuni; - if (Validator.isNotNull(ufficio) && !ufficio.equals("0")) { - try { - if (!ufficio.equals("-1")) { - long ufficioId = Long.parseLong(ufficio); - comuni = ComuneLocalServiceUtil.getComuniForOrganizationByUserIdUfficioId(user.getUserId(), - ufficioId); - for (Comune comune : comuni) { - JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); - jsonObject.put("comuneId", comune.getComuneId()); - jsonObject.put("descLong", comune.getDenominazione()); - jsonArray.put(jsonObject); + try{ + if ("comuniForUfficio".equals(resourceId)) { + String ufficio = ParamUtil.getString(resourceRequest, "ufficioId"); + JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); + List comuni; + if (Validator.isNotNull(ufficio) && !ufficio.equals("0")) { + try { + if (!ufficio.equals("-1")) { + long ufficioId = Long.parseLong(ufficio); + comuni = ComuneLocalServiceUtil.getComuniForOrganizationByUserIdUfficioId(user.getUserId(), + ufficioId); + for (Comune comune : comuni) { + JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); + jsonObject.put("comuneId", comune.getComuneId()); + jsonObject.put("descLong", comune.getDenominazione()); + jsonArray.put(jsonObject); + } + writeJSON(resourceRequest, resourceResponse, jsonArray); + } else { + comuni = ComuneLocalServiceUtil.getComuniForOrganizationByUserId(user.getUserId()); + for (Comune comune : comuni) { + JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); + jsonObject.put("comuneId", comune.getComuneId()); + jsonObject.put("descLong", comune.getDenominazione()); + jsonArray.put(jsonObject); + } + writeJSON(resourceRequest, resourceResponse, jsonArray); } - writeJSON(resourceRequest, resourceResponse, jsonArray); - } else { - comuni = ComuneLocalServiceUtil.getComuniForOrganizationByUserId(user.getUserId()); - for (Comune comune : comuni) { - JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); - jsonObject.put("comuneId", comune.getComuneId()); - jsonObject.put("descLong", comune.getDenominazione()); - jsonArray.put(jsonObject); + } catch (Exception e) { + e.printStackTrace(); + } + } + }else if ("province".equals(resourceId)) { + JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); + List province = TerritorioLocalServiceUtil.getActiveProvince(); + for (String codiceProvincia : province) { + JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); + Provincia provincia = ProvinciaLocalServiceUtil.fetchByC_C(themeDisplay.getCompanyId(), codiceProvincia); + jsonObject.put("provinciaId", provincia.getCodiceProvincia()); + jsonObject.put("descLong", provincia.getSigla() + " - " + provincia.getProvincia()); + jsonArray.put(jsonObject); + } + writeJSON(resourceRequest, resourceResponse, jsonArray); + }else if ("unitaOperative".equals(resourceId)) { + JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); + + for(int i=1; i<11; i++) { + JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); + jsonObject.put("uoId", i); + jsonObject.put("descLong", i); + jsonArray.put(jsonObject); + } + + writeJSON(resourceRequest, resourceResponse, jsonArray); + }else if ("comuni".equals(resourceId)) { + String provinciaId = ParamUtil.getString(resourceRequest, "provinciaId"); + JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); + if (Validator.isNotNull(provinciaId) && !provinciaId.equals("0")) { + List comuniIds = TerritorioLocalServiceUtil.getActiveComuniByCodiceProvincia(provinciaId); + List comumeList = new ArrayList(); + for (long comuneId : comuniIds) { + Comune comune = ComuneLocalServiceUtil.getComune(comuneId); + comumeList.add(comune); + } + Collections.sort(comumeList, new Comparator() { + @Override + public int compare(Comune o1, Comune o2) { + return o1.getDenominazione().compareTo(o2.getDenominazione()); + } + }); + for (Comune comune : comumeList) { + JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); + jsonObject.put("comuneId", comune.getComuneId()); + jsonObject.put("descLong", comune.getDenominazione()); + jsonArray.put(jsonObject); + } + } + writeJSON(resourceRequest, resourceResponse, jsonArray); + }else if ("istruttore".equals(resourceId)) { + Integer uoId = ParamUtil.getInteger(resourceRequest, "uoId"); + JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); + if (Validator.isNotNull(uoId) && !uoId.equals("-1")) { + List organizationList = OrganizationLocalServiceUtil.getUserOrganizations(user.getUserId()); + List tecniciIstruttori = new ArrayList(); + + for(Organization org : organizationList) { + Role role = RoleLocalServiceUtil.getRole(org.getCompanyId(), "portos_istruttore"); + List istruttori = UserGroupRoleLocalServiceUtil.getUserGroupRolesByGroupAndRole( + org.getGroupId(), role.getRoleId()); + for (UserGroupRole userGroupRole : istruttori) { + User istruttore = userGroupRole.getUser(); + List unitaOperativeIstruttore = UnitaOperativeUtil.getUnitaOperative(istruttore); + if(unitaOperativeIstruttore.contains(uoId)){ + if (tecniciIstruttori.isEmpty()) { + tecniciIstruttori.add(userGroupRole); + } else { + boolean isPresent = false; + for(UserGroupRole tecnico : tecniciIstruttori) { + if (tecnico.getUserId() == userGroupRole.getUserId()) { + isPresent = true; + break; + } + } + if(!isPresent){ + tecniciIstruttori.add(userGroupRole); + } + } + } } - writeJSON(resourceRequest, resourceResponse, jsonArray); } - } catch (Exception e) { - e.printStackTrace(); + + List tecniciIstruttoriSorted = new ArrayList(); + for (UserGroupRole tecnico : tecniciIstruttori) { + IstruttoreBean istruttore = new IstruttoreBean(); + istruttore.setIdIstruttore(tecnico.getUserId()); + istruttore.setDenominazione(tecnico.getUser().getFullName()); + tecniciIstruttoriSorted.add(istruttore); + } + + Collections.sort(tecniciIstruttoriSorted); + + for (IstruttoreBean istruttore : tecniciIstruttoriSorted) { + JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); + jsonObject.put("istruttoreId", istruttore.getIdIstruttore()); + jsonObject.put("descLong", istruttore.getDenominazione()); + jsonArray.put(jsonObject); + } } + + writeJSON(resourceRequest, resourceResponse, jsonArray); + + }else if ("geologo".equals(resourceId)) { + JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); + List organizationList = OrganizationLocalServiceUtil.getUserOrganizations(user.getUserId()); + List geologi = new ArrayList(); + + for(Organization org : organizationList) { + Role role = RoleLocalServiceUtil.getRole(org.getCompanyId(), "portos_geologo"); + List geologiUsers = UserLocalServiceUtil.getRoleUsers(role.getRoleId()); + + for (User userGroupRole : geologiUsers) { + if (geologi.isEmpty()) { + geologi.add(userGroupRole); + } else { + boolean isPresent = false; + for(User geo : geologi) { + if (geo.getUserId() == userGroupRole.getUserId()) { + isPresent = true; + break; + } + } + if(!isPresent){ + geologi.add(userGroupRole); + } + } + } + } + + for (User geo : geologi) { + JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); + jsonObject.put("geologoId", geo.getUserId()); + jsonObject.put("descLong", geo.getFullName()); + jsonArray.put(jsonObject); + } + + + writeJSON(resourceRequest, resourceResponse, jsonArray); + } + }catch (Exception e) { + _log.error(e, e); + throw new IOException(e); } + super.serveResource(resourceRequest, resourceResponse); } } diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaPortlet.java b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaPortlet.java index 674d36ed..39e1dcfa 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaPortlet.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/bo/portlet/GestioneAttivitaPortlet.java @@ -108,7 +108,9 @@ public class GestioneAttivitaPortlet extends MVCPortlet { String tipoProcedura = ParamUtil.getString(actionRequest, "tipoProcedura"); String unitaOperativa = ParamUtil.getString(actionRequest, "unitaOperativa"); String provincia = ParamUtil.getString(actionRequest, "provincia"); - String geologo = ParamUtil.getString(actionRequest, "geologo"); + String geologi = ParamUtil.getString(actionRequest, "geologi"); + String parereGeologo = ParamUtil.getString(actionRequest, "parereGeologo"); + actionResponse.setRenderParameter("tabs1", tabs1); actionResponse.setRenderParameter("numeroProgetto", numeroProgetto); actionResponse.setRenderParameter("protocollo", protocollo); @@ -148,7 +150,8 @@ public class GestioneAttivitaPortlet extends MVCPortlet { actionResponse.setRenderParameter("tipoProcedura", tipoProcedura); actionResponse.setRenderParameter("unitaOperativa", unitaOperativa); actionResponse.setRenderParameter("provincia", provincia); - actionResponse.setRenderParameter("geologo", geologo); + actionResponse.setRenderParameter("geologi", geologi); + actionResponse.setRenderParameter("parereGeologo", parereGeologo); } public void cambioIstruttore(ActionRequest actionRequest, ActionResponse actionResponse) { @@ -424,44 +427,39 @@ public class GestioneAttivitaPortlet extends MVCPortlet { writeJSON(resourceRequest, resourceResponse, jsonArray); }else if ("geologo".equals(id)) { - Integer uoId = ParamUtil.getInteger(resourceRequest, "uoId"); JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); - if (Validator.isNotNull(uoId) && !uoId.equals("-1")) { - List organizationList = OrganizationLocalServiceUtil.getUserOrganizations(user.getUserId()); - List geologi = new ArrayList(); - - for(Organization org : organizationList) { - Role role = RoleLocalServiceUtil.getRole(org.getCompanyId(), "portos_geologo"); - List geologiUsers = UserLocalServiceUtil.getRoleUsers(role.getRoleId()); - - for (User userGroupRole : geologiUsers) { - List unitaOperativeGeologo = UnitaOperativeUtil.getUnitaOperative(userGroupRole); - if(unitaOperativeGeologo.contains(uoId)){ - if (geologi.isEmpty()) { - geologi.add(userGroupRole); - } else { - boolean isPresent = false; - for(User geo : geologi) { - if (geo.getUserId() == userGroupRole.getUserId()) { - isPresent = true; - break; - } - } - if(!isPresent){ - geologi.add(userGroupRole); - } + List organizationList = OrganizationLocalServiceUtil.getUserOrganizations(user.getUserId()); + List geologi = new ArrayList(); + + for(Organization org : organizationList) { + Role role = RoleLocalServiceUtil.getRole(org.getCompanyId(), "portos_geologo"); + List geologiUsers = UserLocalServiceUtil.getRoleUsers(role.getRoleId()); + + for (User userGroupRole : geologiUsers) { + if (geologi.isEmpty()) { + geologi.add(userGroupRole); + } else { + boolean isPresent = false; + for(User geo : geologi) { + if (geo.getUserId() == userGroupRole.getUserId()) { + isPresent = true; + break; } } + if(!isPresent){ + geologi.add(userGroupRole); + } } } - - for (User geo : geologi) { - JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); - jsonObject.put("geologoId", geo.getUserId()); - jsonObject.put("descLong", geo.getFullName()); - jsonArray.put(jsonObject); - } } + + for (User geo : geologi) { + JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); + jsonObject.put("geologoId", geo.getUserId()); + jsonObject.put("descLong", geo.getFullName()); + jsonArray.put(jsonObject); + } + writeJSON(resourceRequest, resourceResponse, jsonArray); diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties index 6c22bc37..46ccbe0e 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/WEB-INF/src/service.properties @@ -13,8 +13,8 @@ ## build.namespace=portos_bo - build.number=3277 - build.date=1629883670001 + build.number=3294 + build.date=1629903256819 build.auto.upgrade=true ## diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/advanced_search.jsp b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/advanced_search.jsp index 51a613bf..70d904a6 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/advanced_search.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/fascicolo/advanced_search.jsp @@ -16,7 +16,7 @@ String provinciaSelect = ParamUtil.getString(renderRequest, "provincia"); String comuneSelect = ParamUtil.getString(renderRequest, "comune"); String istruttoreSelect = ParamUtil.getString(renderRequest, "istruttore"); String uoSelect = ParamUtil.getString(renderRequest, "unitaOperativa"); -String geologoSelect = ParamUtil.getString(renderRequest, "geologo"); +String geologoSelect = ParamUtil.getString(renderRequest, "geologi"); %> - +
-
+
@@ -211,11 +214,8 @@ String geologoSelect = ParamUtil.getString(renderRequest, "geologo"); }); }; - var getGeologo = function(callback, uoId) { + var getGeologo = function(callback) { A.io.request('<%= getGeologoUrl %>', { - data: { - uoId: uoId - }, dataType: 'json', on: { success: function() { @@ -260,7 +260,7 @@ String geologoSelect = ParamUtil.getString(renderRequest, "geologo"); selectVal: '<%= (Validator.isNotNull(istruttoreSelect) ? istruttoreSelect : "") %>' }, { - select: 'geologo', + select: 'geologi', selectData: getGeologo, selectDesc: 'descLong', selectId: 'geologoId', diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/advanced_search.jsp b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/advanced_search.jsp index 605ab5c8..559b7328 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/advanced_search.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivita/advanced_search.jsp @@ -21,7 +21,7 @@ String provinciaSelect = ParamUtil.getString(renderRequest, "provincia"); String comuneSelect = ParamUtil.getString(renderRequest, "comune"); String istruttoreSelect = ParamUtil.getString(renderRequest, "istruttore"); String uoSelect = ParamUtil.getString(renderRequest, "unitaOperativa"); -String geologoSelect = ParamUtil.getString(renderRequest, "geologo"); +String geologoSelect = ParamUtil.getString(renderRequest, "geologi"); %>
- +
-
+
@@ -270,11 +274,8 @@ String geologoSelect = ParamUtil.getString(renderRequest, "geologo"); }); }; - var getGeologo = function(callback, uoId) { + var getGeologo = function(callback) { A.io.request('<%= getGeologoUrl %>', { - data: { - uoId: uoId - }, dataType: 'json', on: { success: function() { @@ -319,7 +320,7 @@ String geologoSelect = ParamUtil.getString(renderRequest, "geologo"); selectVal: '<%= (Validator.isNotNull(istruttoreSelect) ? istruttoreSelect : "") %>' }, { - select: 'geologo', + select: 'geologi', selectData: getGeologo, selectDesc: 'descLong', selectId: 'geologoId', diff --git a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivitaistruttore/advanced_search.jsp b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivitaistruttore/advanced_search.jsp index dc7bee9d..af4bb9ad 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivitaistruttore/advanced_search.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-bo-portlet/docroot/html/gestioneattivitaistruttore/advanced_search.jsp @@ -33,6 +33,11 @@ <% List organizationList = OrganizationLocalServiceUtil.getUserOrganizations(user.getUserId()); +String provinciaSelect = ParamUtil.getString(renderRequest, "provincia"); +String comuneSelect = ParamUtil.getString(renderRequest, "comune"); +String istruttoreSelect = ParamUtil.getString(renderRequest, "istruttore"); +String uoSelect = ParamUtil.getString(renderRequest, "unitaOperativa"); +String geologoSelect = ParamUtil.getString(renderRequest, "geologi"); %> @@ -86,18 +91,21 @@ List organizationList = OrganizationLocalServiceUtil.getUserOrgani
- +
-
+
@@ -160,46 +168,125 @@ List organizationList = OrganizationLocalServiceUtil.getUserOrgani
-<%-- ADT BUG-ID=16 Sezione Pratiche Assegnate --%> - - -$(".add-new-project__ufficio select").change(function() { - var comuni = ''; - var val = $(this).val(); - $(".add-new-project__comune select").empty(); - A.io.request('<%= getComuniURL %>', { - data: { - ufficioId: val - }, - dataType: 'json', - on: { - success: function() { - $(".add-new-project__comune select").empty(); - $(".add-new-project__comune select").append($(' diff --git a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/advanced_search.jsp b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/advanced_search.jsp index 6ad6e04d..e63576fa 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/advanced_search.jsp +++ b/liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/advanced_search.jsp @@ -32,43 +32,47 @@ Stato Pratica - + - + + + + - + - - - - - + - + - - + + - - + + - - - - + - + + + + - + + + + + + + -