|
|
@ -9,25 +9,16 @@ import it.tref.liferay.portos.bo.model.Avviso; |
|
|
|
import it.tref.liferay.portos.bo.model.ControlloPratica; |
|
|
|
import it.tref.liferay.portos.bo.model.ControlloPratica; |
|
|
|
import it.tref.liferay.portos.bo.model.DettPratica; |
|
|
|
import it.tref.liferay.portos.bo.model.DettPratica; |
|
|
|
import it.tref.liferay.portos.bo.model.IntPratica; |
|
|
|
import it.tref.liferay.portos.bo.model.IntPratica; |
|
|
|
import it.tref.liferay.portos.bo.model.Sorteggio; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.AvvisoLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.ConfigurazioneLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.ControlloPraticaLocalService; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.ControlloPraticaLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.DettPraticaLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.IntPraticaLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.SorteggioLocalServiceUtil; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.TerritorioLocalServiceUtil; |
|
|
|
import it.tref.liferay.portos.bo.service.impl.ControlloPraticaLocalServiceImpl; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.bo.shared.protocollo.model.Protocollo.TipoProtocollo; |
|
|
|
|
|
|
|
import it.tref.liferay.portos.bo.shared.util.ConfigurazioneConstants; |
|
|
|
import it.tref.liferay.portos.bo.shared.util.ConfigurazioneConstants; |
|
|
|
import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants; |
|
|
|
import it.tref.liferay.portos.bo.shared.util.StatoPraticaConstants; |
|
|
|
import it.tref.liferay.portos.bo.util.AvvisoUtil; |
|
|
|
import it.tref.liferay.portos.bo.util.AvvisoUtil; |
|
|
|
import it.tref.liferay.portos.bo.util.Constants; |
|
|
|
import it.tref.liferay.portos.bo.util.Constants; |
|
|
|
import it.tref.liferay.portos.bo.util.ContentType; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import java.io.Serializable; |
|
|
|
import java.io.Serializable; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.ParseException; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
@ -38,30 +29,19 @@ import java.util.HashMap; |
|
|
|
import java.util.LinkedHashMap; |
|
|
|
import java.util.LinkedHashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.TreeMap; |
|
|
|
|
|
|
|
import java.util.Map.Entry; |
|
|
|
import java.util.Map.Entry; |
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.io.FileUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.liferay.portal.kernel.dao.orm.QueryUtil; |
|
|
|
import com.liferay.portal.kernel.dao.orm.QueryUtil; |
|
|
|
import com.liferay.portal.kernel.exception.PortalException; |
|
|
|
import com.liferay.portal.kernel.exception.PortalException; |
|
|
|
import com.liferay.portal.kernel.exception.SystemException; |
|
|
|
import com.liferay.portal.kernel.exception.SystemException; |
|
|
|
import com.liferay.portal.kernel.json.JSONFactoryUtil; |
|
|
|
|
|
|
|
import com.liferay.portal.kernel.language.LanguageUtil; |
|
|
|
import com.liferay.portal.kernel.language.LanguageUtil; |
|
|
|
import com.liferay.portal.kernel.log.Log; |
|
|
|
import com.liferay.portal.kernel.log.Log; |
|
|
|
import com.liferay.portal.kernel.log.LogFactoryUtil; |
|
|
|
import com.liferay.portal.kernel.log.LogFactoryUtil; |
|
|
|
import com.liferay.portal.kernel.repository.model.FileEntry; |
|
|
|
import com.liferay.portal.kernel.repository.model.FileEntry; |
|
|
|
import com.liferay.portal.kernel.util.FileUtil; |
|
|
|
|
|
|
|
import com.liferay.portal.kernel.util.GetterUtil; |
|
|
|
import com.liferay.portal.kernel.util.GetterUtil; |
|
|
|
import com.liferay.portal.kernel.util.HttpUtil; |
|
|
|
|
|
|
|
import com.liferay.portal.kernel.util.LocaleUtil; |
|
|
|
import com.liferay.portal.kernel.util.LocaleUtil; |
|
|
|
import com.liferay.portal.kernel.util.OrderByComparatorFactoryUtil; |
|
|
|
import com.liferay.portal.kernel.util.OrderByComparatorFactoryUtil; |
|
|
|
import com.liferay.portal.kernel.util.PropsUtil; |
|
|
|
|
|
|
|
import com.liferay.portal.kernel.util.Validator; |
|
|
|
import com.liferay.portal.kernel.util.Validator; |
|
|
|
import com.liferay.portal.kernel.util.Http.FilePart; |
|
|
|
|
|
|
|
import com.liferay.portal.kernel.util.Http.Options; |
|
|
|
|
|
|
|
import com.liferay.portal.kernel.workflow.WorkflowConstants; |
|
|
|
import com.liferay.portal.kernel.workflow.WorkflowConstants; |
|
|
|
import com.liferay.portal.kernel.workflow.WorkflowException; |
|
|
|
import com.liferay.portal.kernel.workflow.WorkflowException; |
|
|
|
import com.liferay.portal.kernel.workflow.WorkflowHandlerRegistryUtil; |
|
|
|
import com.liferay.portal.kernel.workflow.WorkflowHandlerRegistryUtil; |
|
|
@ -69,9 +49,7 @@ import com.liferay.portal.kernel.workflow.WorkflowInstance; |
|
|
|
import com.liferay.portal.kernel.workflow.WorkflowInstanceManagerUtil; |
|
|
|
import com.liferay.portal.kernel.workflow.WorkflowInstanceManagerUtil; |
|
|
|
import com.liferay.portal.kernel.workflow.WorkflowTask; |
|
|
|
import com.liferay.portal.kernel.workflow.WorkflowTask; |
|
|
|
import com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil; |
|
|
|
import com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil; |
|
|
|
import com.liferay.portal.model.Company; |
|
|
|
|
|
|
|
import com.liferay.portal.model.User; |
|
|
|
import com.liferay.portal.model.User; |
|
|
|
import com.liferay.portal.service.CompanyLocalServiceUtil; |
|
|
|
|
|
|
|
import com.liferay.portal.service.ServiceContext; |
|
|
|
import com.liferay.portal.service.ServiceContext; |
|
|
|
import com.liferay.portal.service.UserLocalServiceUtil; |
|
|
|
import com.liferay.portal.service.UserLocalServiceUtil; |
|
|
|
import com.liferay.portal.workflow.kaleo.model.KaleoTaskInstanceToken; |
|
|
|
import com.liferay.portal.workflow.kaleo.model.KaleoTaskInstanceToken; |
|
|
@ -85,6 +63,7 @@ public class SismicaUtil { |
|
|
|
|
|
|
|
|
|
|
|
private static final SimpleDateFormat dfmt = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); |
|
|
|
private static final SimpleDateFormat dfmt = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); |
|
|
|
private static final SimpleDateFormat dfmtGiorno = new SimpleDateFormat("dd/MM/yyyy"); |
|
|
|
private static final SimpleDateFormat dfmtGiorno = new SimpleDateFormat("dd/MM/yyyy"); |
|
|
|
|
|
|
|
private static final SimpleDateFormat sdfGiornoDB = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
private final static int SLICE = 1000; |
|
|
|
private final static int SLICE = 1000; |
|
|
|
|
|
|
|
|
|
|
|
public static Date[] getWeekInterval(int dow) { |
|
|
|
public static Date[] getWeekInterval(int dow) { |
|
|
@ -127,6 +106,40 @@ public class SismicaUtil { |
|
|
|
return date; |
|
|
|
return date; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static Long daysBetween(Date start, Date end) { |
|
|
|
|
|
|
|
if (Validator.isNotNull(start) && Validator.isNotNull(end)) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
start = sdfGiornoDB.parse(sdfGiornoDB.format(start)); |
|
|
|
|
|
|
|
end = sdfGiornoDB.parse(sdfGiornoDB.format(end)); |
|
|
|
|
|
|
|
} catch (ParseException e) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return Math.round((end.getTime() - start.getTime()) / 86400000.0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static Long daysBetween(String start, String end) { |
|
|
|
|
|
|
|
Long diff = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
diff = daysBetween(sdfGiornoDB.parse(start), sdfGiornoDB.parse(end)); |
|
|
|
|
|
|
|
} catch (ParseException e) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return diff; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static Long daysPast(Date start) { |
|
|
|
|
|
|
|
return daysBetween(start, new Date()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static Long daysPast(String start) { |
|
|
|
|
|
|
|
Long diff = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
diff = daysBetween(sdfGiornoDB.parse(start), new Date()); |
|
|
|
|
|
|
|
} catch (ParseException e) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return diff; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static boolean isLong(String s) { |
|
|
|
public static boolean isLong(String s) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
Long.parseLong(s); |
|
|
|
Long.parseLong(s); |
|
|
@ -375,22 +388,21 @@ public class SismicaUtil { |
|
|
|
for (IntPratica pratica : pratiche) { |
|
|
|
for (IntPratica pratica : pratiche) { |
|
|
|
String stato = pratica.getStatoPratica(); |
|
|
|
String stato = pratica.getStatoPratica(); |
|
|
|
if (Validator.isNotNull(stato) && Validator.isNotNull(pratica.getTipoProcedura()) |
|
|
|
if (Validator.isNotNull(stato) && Validator.isNotNull(pratica.getTipoProcedura()) |
|
|
|
&& pratica.getTipoPratica().equalsIgnoreCase(Constants.TIPO_PRATICA_DEPOSITO) |
|
|
|
&& pratica.getTipoPratica().equalsIgnoreCase(Constants.TIPO_PRATICA_DEPOSITO)) { |
|
|
|
&& stato.equals(StatoPraticaConstants.VIDIMATA)) { |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
avvisi = AvvisoLocalServiceUtil.findByIntPraticaId_tipoDocumento( |
|
|
|
avvisi = AvvisoLocalServiceUtil.findByIntPraticaId_tipoDocumento( |
|
|
|
pratica.getIntPraticaId(), StatoPraticaConstants.CONFORME); |
|
|
|
pratica.getIntPraticaId(), StatoPraticaConstants.CONFORME); |
|
|
|
} catch (SystemException e) { |
|
|
|
} catch (SystemException e) { |
|
|
|
esito.add("Errore caricamento avvisi: " + e.getMessage()); |
|
|
|
esito.add("Errore caricamento avvisi: " + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (avvisi.size() == 0) { |
|
|
|
List<Avviso> totali = null; |
|
|
|
List<Avviso> totali = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
totali = AvvisoLocalServiceUtil.findByIntPratica(pratica.getIntPraticaId(), |
|
|
|
totali = AvvisoLocalServiceUtil.findByIntPratica(pratica.getIntPraticaId(), |
|
|
|
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); |
|
|
|
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); |
|
|
|
} catch (SystemException e) { |
|
|
|
} catch (SystemException e) { |
|
|
|
totali = new ArrayList<>(); |
|
|
|
totali = new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
|
if ((avvisi.size() == 0) && stato.equalsIgnoreCase(StatoPraticaConstants.VIDIMATA)) { |
|
|
|
List<ControlloPratica> controlli = null; |
|
|
|
List<ControlloPratica> controlli = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
controlli = ControlloPraticaLocalServiceUtil.findByIntPratica(pratica |
|
|
|
controlli = ControlloPraticaLocalServiceUtil.findByIntPratica(pratica |
|
|
@ -453,14 +465,25 @@ public class SismicaUtil { |
|
|
|
"Attestazione di deposito progetto", new Date(), |
|
|
|
"Attestazione di deposito progetto", new Date(), |
|
|
|
AvvisoUtil.TIPO_AVVISO_DIRETTO, |
|
|
|
AvvisoUtil.TIPO_AVVISO_DIRETTO, |
|
|
|
StatoPraticaConstants.CONFORME, fileEntryIdTemplate, |
|
|
|
StatoPraticaConstants.CONFORME, fileEntryIdTemplate, |
|
|
|
dettPratica.getDettPraticaId(), DettPratica.class.getName(), |
|
|
|
dettPratica.getDettPraticaId(), |
|
|
|
|
|
|
|
DettPratica.class.getName(), |
|
|
|
controllo.getControlloPraticaId(), serviceContext); |
|
|
|
controllo.getControlloPraticaId(), serviceContext); |
|
|
|
|
|
|
|
pratica.setStatoPratica(StatoPraticaConstants.CONFORME); |
|
|
|
|
|
|
|
IntPraticaLocalServiceUtil.updateIntPratica(pratica); |
|
|
|
} catch (PortalException | SystemException e) { |
|
|
|
} catch (PortalException | SystemException e) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else if ((totali.size() == 2) && (avvisi.size() > 0) |
|
|
|
|
|
|
|
&& stato.equalsIgnoreCase(StatoPraticaConstants.SOTTOPOSTA_A_PARERE)) { |
|
|
|
|
|
|
|
esito.add("Rendo conforme: " + pratica.getNumeroProgetto()); |
|
|
|
|
|
|
|
pratica.setStatoPratica(StatoPraticaConstants.CONFORME); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
IntPraticaLocalServiceUtil.updateIntPratica(pratica); |
|
|
|
|
|
|
|
} catch (SystemException e) { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -604,80 +627,17 @@ public class SismicaUtil { |
|
|
|
return esito; |
|
|
|
return esito; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static List<String> testInterno2(long companyId) { |
|
|
|
public static List<String> testInterno(long companyId) { |
|
|
|
List<String> esito = new ArrayList<>(); |
|
|
|
List<String> esito = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
Company company = null; |
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
company = CompanyLocalServiceUtil.getCompany(companyId); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
} catch (PortalException | SystemException e) { |
|
|
|
Date start = sdf.parse("2020-01-01 13:45:23.1111"); |
|
|
|
esito.add("Errore di accesso a company id " + companyId); |
|
|
|
Date end = sdf.parse("2020-12-31 10:45:23.1111"); |
|
|
|
return esito; |
|
|
|
long diff = Math.round((end.getTime() - start.getTime()) / 86400000.0); |
|
|
|
} |
|
|
|
esito.add(diff + " giorni"); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
List<DLFileEntry> fileEntries = null; |
|
|
|
esito.add("Eccezione: " + e.getMessage()); |
|
|
|
int totale = 0, p7m = 0, start = 0; |
|
|
|
|
|
|
|
Map<Integer, Integer> conteggi = new TreeMap<>(); |
|
|
|
|
|
|
|
do { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
fileEntries = DLFileEntryLocalServiceUtil.getFileEntries(start, start + SLICE); |
|
|
|
|
|
|
|
} catch (SystemException e) { |
|
|
|
|
|
|
|
fileEntries = new ArrayList<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
start += SLICE; |
|
|
|
|
|
|
|
for (DLFileEntry fileEntry : fileEntries) { |
|
|
|
|
|
|
|
totale++; |
|
|
|
|
|
|
|
if (fileEntry.getExtension().equalsIgnoreCase("p7m")) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
byte[] contenuto = FileUtil.getBytes(fileEntry.getContentStream()); |
|
|
|
|
|
|
|
String url = (String) company.getExpandoBridge().getAttribute("url_pdf_extractor", |
|
|
|
|
|
|
|
false); |
|
|
|
|
|
|
|
Options options = new Options(); |
|
|
|
|
|
|
|
options.setLocation(url); |
|
|
|
|
|
|
|
options.setPost(true); |
|
|
|
|
|
|
|
List<FilePart> fileParts = new ArrayList<>(); |
|
|
|
|
|
|
|
fileParts.add(new FilePart("file", fileEntry.getTitle(), contenuto, ContentType.P7M |
|
|
|
|
|
|
|
.getContentType(), "UTF-8")); |
|
|
|
|
|
|
|
options.setFileParts(fileParts); |
|
|
|
|
|
|
|
String response = HttpUtil.URLtoString(options); |
|
|
|
|
|
|
|
int numeroFirme = 0; |
|
|
|
|
|
|
|
if (options.getResponse().getResponseCode() == HttpServletResponse.SC_OK |
|
|
|
|
|
|
|
|| options.getResponse().getResponseCode() == HttpServletResponse.SC_CREATED) { |
|
|
|
|
|
|
|
numeroFirme = JSONFactoryUtil.createJSONObject(response).getJSONArray("cf") |
|
|
|
|
|
|
|
.length(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (conteggi.containsKey(numeroFirme)) { |
|
|
|
|
|
|
|
conteggi.put(numeroFirme, conteggi.get(numeroFirme) + 1); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
conteggi.put(numeroFirme, 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
p7m++; |
|
|
|
|
|
|
|
if ((numeroFirme > 4) || (numeroFirme == 0)) { |
|
|
|
|
|
|
|
String folder = PropsUtil.get("env.HOME") + "/documenti/" + numeroFirme |
|
|
|
|
|
|
|
+ "_firme"; |
|
|
|
|
|
|
|
File file = new File(folder); |
|
|
|
|
|
|
|
if (!file.exists()) { |
|
|
|
|
|
|
|
file.mkdirs(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String fileName = folder + "/" + fileEntry.getTitle(); |
|
|
|
|
|
|
|
file = new File(fileName); |
|
|
|
|
|
|
|
FileUtils.writeByteArrayToFile(file, contenuto); |
|
|
|
|
|
|
|
_log.info("Salvato " + fileName); |
|
|
|
|
|
|
|
String msg = ""; |
|
|
|
|
|
|
|
for (Map.Entry<Integer, Integer> conteggio : conteggi.entrySet()) { |
|
|
|
|
|
|
|
msg += (msg.equals("") ? "" : ", ") + conteggio.getKey() + " => " |
|
|
|
|
|
|
|
+ conteggio.getValue(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
_log.info(p7m + "/" + totale + ", conteggi: " + msg); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (PortalException | SystemException | IOException e) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} while (fileEntries.size() > 0); |
|
|
|
|
|
|
|
esito.add("Conteggio file: " + totale + ", p7m: " + p7m); |
|
|
|
|
|
|
|
for (Map.Entry<Integer, Integer> conteggio : conteggi.entrySet()) { |
|
|
|
|
|
|
|
esito.add(conteggio.getKey() + " firme: " + conteggio.getValue()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return esito; |
|
|
|
return esito; |
|
|
|
} |
|
|
|
} |
|
|
@ -685,7 +645,7 @@ public class SismicaUtil { |
|
|
|
private static Map<String, String> templateByKey; |
|
|
|
private static Map<String, String> templateByKey; |
|
|
|
private static Map<Long, String> templateById; |
|
|
|
private static Map<Long, String> templateById; |
|
|
|
private static Map<String, Long> templateIdByKey; |
|
|
|
private static Map<String, Long> templateIdByKey; |
|
|
|
private static final Date inizio = SismicaUtil.stringToDate("2019-12-31"); |
|
|
|
private static final Date inizio = stringToDate("2019-12-31"); |
|
|
|
|
|
|
|
|
|
|
|
private static List<String> riparaDocumenti(long companyId) throws SystemException, PortalException { |
|
|
|
private static List<String> riparaDocumenti(long companyId) throws SystemException, PortalException { |
|
|
|
List<String> esito = new ArrayList<String>(); |
|
|
|
List<String> esito = new ArrayList<String>(); |
|
|
@ -899,45 +859,6 @@ public class SismicaUtil { |
|
|
|
return esito; |
|
|
|
return esito; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static List<String> inviaComunicazione2(long companyId) throws SystemException { |
|
|
|
|
|
|
|
List<String> esito = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int start = 0; |
|
|
|
|
|
|
|
List<IntPratica> pratiche = null; |
|
|
|
|
|
|
|
List<ControlloPratica> chiudere = new ArrayList<>(); |
|
|
|
|
|
|
|
do { |
|
|
|
|
|
|
|
pratiche = IntPraticaLocalServiceUtil.getIntPraticas(start, start + SLICE); |
|
|
|
|
|
|
|
for (IntPratica pratica : pratiche) { |
|
|
|
|
|
|
|
if (pratica.getTipoProcedura().equals(Constants.PROCEDURA_B1) |
|
|
|
|
|
|
|
&& Validator.isNotNull(pratica.getDtSorteggio()) |
|
|
|
|
|
|
|
&& pratica.getStatoPratica().equals(StatoPraticaConstants.CONFORME) |
|
|
|
|
|
|
|
&& (pratica.getStatusByUserId() == 0) |
|
|
|
|
|
|
|
&& pratica.getTipoPratica().equals(Constants.TIPO_PRATICA_DEPOSITO)) { |
|
|
|
|
|
|
|
Sorteggio sorteggio = SorteggioLocalServiceUtil.findByIntPratica(pratica |
|
|
|
|
|
|
|
.getIntPraticaId()); |
|
|
|
|
|
|
|
if (Validator.isNull(sorteggio)) { |
|
|
|
|
|
|
|
List<ControlloPratica> controlli = ControlloPraticaLocalServiceUtil |
|
|
|
|
|
|
|
.findByIntPratica(pratica.getIntPraticaId()); |
|
|
|
|
|
|
|
if ((controlli.size() == 1) || (pratica.getStatusByUserId() == 0)) { |
|
|
|
|
|
|
|
for (ControlloPratica controllo : controlli) { |
|
|
|
|
|
|
|
if (controllo.getStatus() == WorkflowConstants.STATUS_PENDING) { |
|
|
|
|
|
|
|
chiudere.add(controllo); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
start += SLICE; |
|
|
|
|
|
|
|
} while (pratiche.size() > 0); |
|
|
|
|
|
|
|
esito.add(chiudere.size() + " da togliere"); |
|
|
|
|
|
|
|
for (ControlloPratica controllo : chiudere) { |
|
|
|
|
|
|
|
controllo.setStatus(WorkflowConstants.STATUS_APPROVED); |
|
|
|
|
|
|
|
ControlloPraticaLocalServiceUtil.updateControlloPratica(controllo); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return esito; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static List<String> inviaComunicazione(long companyId) throws SystemException, PortalException, |
|
|
|
public static List<String> inviaComunicazione(long companyId) throws SystemException, PortalException, |
|
|
|
ParseException { |
|
|
|
ParseException { |
|
|
|
List<String> esito = new ArrayList<>(); |
|
|
|
List<String> esito = new ArrayList<>(); |
|
|
@ -1007,82 +928,4 @@ public class SismicaUtil { |
|
|
|
} |
|
|
|
} |
|
|
|
return esito; |
|
|
|
return esito; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static List<String> inviaComunicazione3(long companyId) throws SystemException, ParseException, |
|
|
|
|
|
|
|
PortalException { |
|
|
|
|
|
|
|
List<String> esito = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSS"); |
|
|
|
|
|
|
|
Date prima = sdf.parse("2020-03-05 11:10:17.964"); |
|
|
|
|
|
|
|
Date seconda = sdf.parse("2020-03-05 11:12:18.006"); |
|
|
|
|
|
|
|
SimpleDateFormat hdf = new SimpleDateFormat("dd/MM/yyyy"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int start = 0; |
|
|
|
|
|
|
|
List<IntPratica> pratiche = null; |
|
|
|
|
|
|
|
List<ControlloPratica> vecchi = new ArrayList<>(); |
|
|
|
|
|
|
|
List<IntPratica> SP = new ArrayList<>(); |
|
|
|
|
|
|
|
List<IntPratica> CO = new ArrayList<>(); |
|
|
|
|
|
|
|
do { |
|
|
|
|
|
|
|
pratiche = IntPraticaLocalServiceUtil.getIntPraticas(start, start + SLICE); |
|
|
|
|
|
|
|
for (IntPratica pratica : pratiche) { |
|
|
|
|
|
|
|
if (Validator.isNotNull(pratica.getDtSorteggio()) && pratica.getDtSorteggio().equals(seconda)) { |
|
|
|
|
|
|
|
String tipo = ""; |
|
|
|
|
|
|
|
List<Avviso> avvisi = AvvisoLocalServiceUtil.findByIntPratica( |
|
|
|
|
|
|
|
pratica.getIntPraticaId(), |
|
|
|
|
|
|
|
QueryUtil.ALL_POS, |
|
|
|
|
|
|
|
QueryUtil.ALL_POS, |
|
|
|
|
|
|
|
OrderByComparatorFactoryUtil.getOrderByComparatorFactory().create( |
|
|
|
|
|
|
|
"portos_bo_Avviso", "dtProtocollo", true)); |
|
|
|
|
|
|
|
for (Avviso avviso : avvisi) { |
|
|
|
|
|
|
|
Date dtAvviso = sdf.parse(avviso.getDtAvviso().toString()); |
|
|
|
|
|
|
|
if (dtAvviso.equals(prima)) { |
|
|
|
|
|
|
|
tipo += avviso.getTipoDocumento(); |
|
|
|
|
|
|
|
} else if (dtAvviso.equals(seconda)) { |
|
|
|
|
|
|
|
tipo += avviso.getTipoDocumento(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<ControlloPratica> controlli = ControlloPraticaLocalServiceUtil |
|
|
|
|
|
|
|
.findByIntPratica(pratica.getIntPraticaId()); |
|
|
|
|
|
|
|
for (ControlloPratica controllo : controlli) { |
|
|
|
|
|
|
|
vecchi.add(controllo); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
switch (tipo) { |
|
|
|
|
|
|
|
case "COCO": |
|
|
|
|
|
|
|
case "COSP": |
|
|
|
|
|
|
|
CO.add(pratica); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case "SPCO": |
|
|
|
|
|
|
|
case "SPSP": |
|
|
|
|
|
|
|
SP.add(pratica); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
start += SLICE; |
|
|
|
|
|
|
|
} while (pratiche.size() > 0); |
|
|
|
|
|
|
|
esito.add("<b>" + vecchi.size() + " controlli</b>"); |
|
|
|
|
|
|
|
esito.add("<b>" + CO.size() + " conformi</b>"); |
|
|
|
|
|
|
|
for (IntPratica pratica : SP) { |
|
|
|
|
|
|
|
if (pratica.getNumeroProgetto().equals("62976")) { |
|
|
|
|
|
|
|
List<ControlloPratica> controlli = ControlloPraticaLocalServiceUtil.findByIntPratica(pratica |
|
|
|
|
|
|
|
.getIntPraticaId()); |
|
|
|
|
|
|
|
for (ControlloPratica controllo : controlli) { |
|
|
|
|
|
|
|
ControlloPraticaLocalServiceUtil.deleteControlloPratica(controllo); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DettPratica dettPratica = DettPraticaLocalServiceUtil.getLastCompletedByIntPratica(pratica |
|
|
|
|
|
|
|
.getIntPraticaId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ServiceContext serviceContext = new ServiceContext(); |
|
|
|
|
|
|
|
serviceContext.setCompanyId(dettPratica.getCompanyId()); |
|
|
|
|
|
|
|
serviceContext.setScopeGroupId(dettPratica.getGroupId()); |
|
|
|
|
|
|
|
serviceContext.setUserId(dettPratica.getUserId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ControlloPratica controlloPratica = ControlloPraticaLocalServiceUtil.addControlloPratica( |
|
|
|
|
|
|
|
pratica.getGroupId(), pratica.getUserId(), pratica.getIntPraticaId(), |
|
|
|
|
|
|
|
dettPratica.getDettPraticaId(), true, serviceContext); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return esito; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|