Sfoglia il codice sorgente

aggiunte funzionalità per gestione attività e reindex pratica

develop
marcoalderighi 2 anni fa
parent
commit
c19621fa17
  1. 12
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java
  2. 43
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/util/AdvancedOperationUtil.java
  3. 106
      liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/view.jsp

12
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/portlet/AdvancedOperationPortlet.java

@ -33,6 +33,18 @@ public class AdvancedOperationPortlet extends MVCPortlet {
private static final Log _log = LogFactoryUtil.getLog(AdvancedOperationPortlet.class);
public void reindexPratica(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
_checkIfUserIsCompanyAdmin(actionRequest);
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long intPraticaId = ParamUtil.getLong(actionRequest, "intPraticaId", 0L);
if (intPraticaId != 0L) {
IntPraticaLocalServiceUtil.reIndexFasciolo(intPraticaId, themeDisplay.getCompanyId());
}
}
public void cambiaDataInizioLavori(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception{
_checkIfUserIsCompanyAdmin(actionRequest);

43
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/WEB-INF/src/it/nextmind/liferay/portos/advanced/operation/util/AdvancedOperationUtil.java

@ -1,16 +1,24 @@
package it.nextmind.liferay.portos.advanced.operation.util;
import com.liferay.portal.kernel.dao.orm.DynamicQuery;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.workflow.WorkflowConstants;
import com.liferay.portal.kernel.workflow.WorkflowTask;
import com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil;
import com.liferay.portal.model.WorkflowInstanceLink;
import com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil;
import it.tref.liferay.portos.bo.model.ControlloPratica;
import it.tref.liferay.portos.bo.model.DettPratica;
import it.tref.liferay.portos.bo.model.DocPratica;
import it.tref.liferay.portos.bo.model.IntPratica;
import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil;
import it.tref.liferay.portos.bo.service.DocPraticaLocalServiceUtil;
@ -20,7 +28,40 @@ import java.util.List;
public class AdvancedOperationUtil {
public static List<WorkflowTask> getListaTask(IntPratica intPratica) {
if(Validator.isNull(intPratica)){
return null;
}
try {
ControlloPratica controlloPratica = null;
List<ControlloPratica> controlloPraticaList =
ControlloPraticaLocalServiceUtil.findByIntPraticaId_Status(intPratica.getIntPraticaId(), intPratica.getStatus());
if(controlloPraticaList.size() > 1){
for(ControlloPratica cp : controlloPraticaList){
if(Validator.isNull(controlloPratica) || cp.getCreateDate().after(controlloPratica.getCreateDate())) {
controlloPratica = cp;
}
}
} else if(controlloPraticaList.size() == 1){
controlloPratica = controlloPraticaList.get(0);
} else {
return null;
}
WorkflowInstanceLink workflowInstanceLink = WorkflowInstanceLinkLocalServiceUtil.fetchWorkflowInstanceLink(
controlloPratica.getCompanyId(),controlloPratica.getGroupId(), ControlloPratica.class.getName(),
controlloPratica.getPrimaryKey());
List<WorkflowTask> listaTask = null;
if (workflowInstanceLink == null) {
return null;
} else {
return listaTask = WorkflowTaskManagerUtil.getWorkflowTasksByWorkflowInstance(controlloPratica.getCompanyId(), null,
workflowInstanceLink.getWorkflowInstanceId(), false, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
}
} catch (SystemException | PortalException e){
_log.error(e,e);
return null;
}
}
public static boolean isPraticaAnnullata(IntPratica intPratica){
if(Validator.isNotNull(intPratica)){

106
liferay-plugins-sdk-6.2/portlets/portos-advanced-operation-portlet/docroot/html/view.jsp

@ -1,3 +1,20 @@
<%@page import="com.liferay.portal.service.UserLocalServiceUtil"%>
<%@page import="com.liferay.portal.model.User"%>
<%@page import="com.liferay.portal.kernel.portlet.LiferayWindowState"%>
<%@page import="javax.portlet.PortletMode"%>
<%@page import="com.liferay.portal.util.PortletKeys"%>
<%@page import="javax.portlet.PortletRequest"%>
<%@page import="javax.portlet.PortletURL"%>
<%@page import="com.liferay.portal.model.Group"%>
<%@page import="com.liferay.portlet.PortletURLFactoryUtil"%>
<%@page import="com.liferay.portal.service.LayoutLocalServiceUtil"%>
<%@page import="com.liferay.portal.model.GroupConstants"%>
<%@page import="com.liferay.portal.service.GroupLocalServiceUtil"%>
<%@page import="it.tref.liferay.portos.bo.model.ControlloPratica"%>
<%@page import="it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil"%>
<%@page import="com.liferay.portal.service.WorkflowInstanceLinkLocalServiceUtil"%>
<%@page import="com.liferay.portal.model.WorkflowInstanceLink"%>
<%@page import="com.liferay.portal.kernel.workflow.WorkflowTask"%>
<%@page import="it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil"%>
<%@page import="it.tref.liferay.portos.bo.model.DettPratica"%>
<%@page import="it.tref.liferay.portos.bo.util.SoggettiUtil"%>
@ -273,6 +290,31 @@
</aui:row>
</liferay-ui:panel>
</div>
<div class="module-group">
<liferay-ui:panel title="REINDICIZZAZIONE" extended="true" collapsible="false">
<aui:row>
<liferay-portlet:actionURL
name="reindexPratica"
var="reindexPraticaURL" >
<liferay-portlet:param name="intPraticaId" value="<%= String.valueOf(intPraticaId) %>"/>
<liferay-portlet:param name="mvcPath" value="/html/view.jsp"/>
</liferay-portlet:actionURL>
<%
String functionReindex = "javascript:"+renderResponse.getNamespace()+"openConfirmationDialog('"+renderResponse.getNamespace()+"reindexPratica','Sei sicuro di voler reindicizzare questa pratica?')";
%>
<aui:form action="<%= reindexPraticaURL %>" method="post" name="reindexPratica">
<aui:button
type="button"
cssClass="btn-primary"
name="reindexPraticaBtn"
onClick='<%= functionReindex %>'
value="Reindicizza Pratica"
>
</aui:button>
</aui:form>
</aui:row>
</liferay-ui:panel>
</div>
<div class="module-group">
<liferay-ui:panel title="IMPERSONAMENTO" extended="true" collapsible="false">
<aui:row>
@ -300,6 +342,7 @@
<liferay-ui:icon
id="impersonaSoggettiBtn"
image="team_icon"
message="Visualizza Soggetti"
target="_blank"
>
</liferay-ui:icon>
@ -348,6 +391,69 @@
<% } %>
</liferay-ui:panel>
</div>
<div class="module-group">
<%
List<WorkflowTask> listaTask = AdvancedOperationUtil.getListaTask(intPratica);
if(Validator.isNotNull(listaTask)){
%>
<liferay-ui:panel title="GESTIONE ATTIVITÀ" extended="true" collapsible="false">
<aui:row>
<div style="display:flex;">
<div style=" margin-right: 15px;">
<p><b>Gestisci ultima attività:</b></p>
</div>
<%
Group controlPanelGroup = GroupLocalServiceUtil.getGroup(company.getCompanyId(), GroupConstants.CONTROL_PANEL);
long controlPanelPlid = LayoutLocalServiceUtil.getDefaultPlid(controlPanelGroup.getGroupId(),true);
PortletURL workflowTaskURL = PortletURLFactoryUtil.create(request, PortletKeys.MY_WORKFLOW_TASKS,
controlPanelPlid, PortletRequest.RENDER_PHASE);
workflowTaskURL.setParameter("struts_action", "/my_workflow_tasks/edit_workflow_task");
workflowTaskURL.setParameter("workflowTaskId", String.valueOf(listaTask.get(0).getWorkflowTaskId()));
workflowTaskURL.setPortletMode(PortletMode.VIEW);
workflowTaskURL.setWindowState(LiferayWindowState.POP_UP);
%>
<div title='<%= LanguageUtil.get(pageContext,"workflow-action-manage") %>' class="tooltip-info">
<liferay-ui:icon
useDialog="true"
image="action_right"
message="Gestisci Attività"
url='<%= workflowTaskURL.toString() + "&controlPanelCategory=my" %>'
/>
</div>
</div>
</aui:row>
<%
if(intPratica.getStatusByUserId() != 0L ){
User tecnico = UserLocalServiceUtil.fetchUser(intPratica.getStatusByUserId());
if (Validator.isNotNull(tecnico)) {
%>
<aui:row>
<div style="display:flex;">
<liferay-security:doAsURL
doAsUserId="<%= tecnico.getUserId() %>"
var="impersonateIstruttoreURL">
</liferay-security:doAsURL>
<div style=" margin-right: 15px;">
<p><b>Impersona Istruttore:</b></p>
</div>
<liferay-ui:icon
image="impersonate_user"
target="_blank"
message="Impersona Istruttore"
url="<%= impersonateIstruttoreURL %>">
</liferay-ui:icon>
</div>
</aui:row>
<%
}
}
%>
</liferay-ui:panel>
<%
}
%>
</div>
</aui:row>
<aui:row id="docPraticaDiv">
<div class="module-group">

Caricamento…
Annulla
Salva