Merge remote-tracking branch 'origin/develop' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import it.integry.ems.Import.dto.AnomalieDTO;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.export.enums.EntityExportTipoInvio;
|
||||
import it.integry.ems.file_sharer.IFileSharer;
|
||||
import it.integry.ems.file_sharer.IFileSharerAttachment;
|
||||
@@ -251,7 +252,7 @@ public abstract class BaseEntityExporter implements IEntityExporter {
|
||||
|
||||
case WEBSERVICES:
|
||||
|
||||
ResponseJSONObjectMapper objectMapper = new ResponseJSONObjectMapper();
|
||||
ResponseJSONObjectMapper objectMapper = ApplicationContextProvider.getApplicationContext().getBean(ResponseJSONObjectMapper.class);
|
||||
|
||||
String url = wtbUserInfo.getWsEndpoint();
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomer;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250304104653 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("W_VARTVENDTOT_DISP", "DATAWINDOW", "D_VARTVENDTOT_REP", null,
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("W_VARTVENDTOT_DISP", "DATAWINDOW", "D_VARTVENDTOT_GRP_REP", null,
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
|
||||
if(isCustomer(IntegryCustomer.Maggio)) {
|
||||
updateSetupValue("W_VARTVENDTOT_DISP", "DATAWINDOW", "D_VARTVENDTOT_REP", "D_VARTVENDTOT_MAGGIO_REP");
|
||||
updateSetupValue("W_VARTVENDTOT_DISP", "DATAWINDOW", "D_VARTVENDTOT_GRP_REP", "D_VARTVENDTOT_GRP_MAGGIO_REP");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250307143631 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetupQuery("SI_NO", "SI_NO", "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
createSetup("FATTURA_ELETTRONICA_CUSTOM", "CAUSALE", "TERM_CONS", "N",
|
||||
"Se S attiva la visualizzazione dei termini di consegna nel tag Causale", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250307163255 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("delete from stb_gest_setup where gest_name ='fattura_elettronica_custom' and section ='causale' and key_section ='note_pie_pagina'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250307170225 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("alter table mtb_stip add flag_bio bit not null default 0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.adapter.EsitoDeserialize;
|
||||
import it.integry.ems.adapter.ExecDateSerializer;
|
||||
import it.integry.ems.adapter.JsonDateAdapterDeserializer;
|
||||
@@ -283,7 +283,7 @@ public class ServiceRestResponse {
|
||||
|
||||
@JsonIgnore
|
||||
public <T> T getDTO(TypeReference<T> type) throws IOException {
|
||||
ObjectMapper objectMapper = new ResponseJSONObjectMapper();
|
||||
ResponseJSONObjectMapper objectMapper = ApplicationContextProvider.getApplicationContext().getBean(ResponseJSONObjectMapper.class);
|
||||
|
||||
StringWriter writer = new StringWriter();
|
||||
objectMapper.writeValue(writer, getJsonObject());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package it.integry.ems.schedule.new_cron_job.dto.operations.runners;
|
||||
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.response.EsitoType;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
@@ -20,7 +21,7 @@ public class ExportScheduledOperationRunner extends BaseScheduledOperationRunner
|
||||
|
||||
String baseUrl = "http://localhost:" + port + "/ems-api";
|
||||
|
||||
ResponseJSONObjectMapper mapper = new ResponseJSONObjectMapper();
|
||||
ResponseJSONObjectMapper mapper = ApplicationContextProvider.getApplicationContext().getBean(ResponseJSONObjectMapper.class);
|
||||
|
||||
int status;
|
||||
StringBuilder jsonResponse = new StringBuilder();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems.schedule.new_cron_job.dto.operations.runners;
|
||||
|
||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.response.EsitoType;
|
||||
import it.integry.ems.response.MessageDTO;
|
||||
@@ -47,7 +48,7 @@ public class ImportDirectoryOperationRunner extends BaseDirectoryOperationRunner
|
||||
logger.debug(String.format("Operazione [ID:%s, Name:%s] - Importo %s", this.getDtoInstance().getId(), this.getDtoInstance().getName(), file.getName()));
|
||||
|
||||
try {
|
||||
ResponseJSONObjectMapper mapper = new ResponseJSONObjectMapper();
|
||||
ResponseJSONObjectMapper objectMapper = ApplicationContextProvider.getApplicationContext().getBean(ResponseJSONObjectMapper.class);
|
||||
|
||||
String port = UtilityServer.getLocalServerPort();
|
||||
|
||||
@@ -66,7 +67,7 @@ public class ImportDirectoryOperationRunner extends BaseDirectoryOperationRunner
|
||||
jsonResponse);
|
||||
|
||||
String responseJson = jsonResponse.toString();
|
||||
ServiceRestResponse serviceRestResponse = mapper.readValue(responseJson, ServiceRestResponse.class);
|
||||
ServiceRestResponse serviceRestResponse = objectMapper.readValue(responseJson, ServiceRestResponse.class);
|
||||
|
||||
if (serviceRestResponse.getEsito().equals(EsitoType.KO)) {
|
||||
String errorMessage = serviceRestResponse.getErrorMessage();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems.schedule.new_cron_job.dto.operations.runners;
|
||||
|
||||
import it.integry.ems.Import.dto.ImportRequestDTO;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.response.EsitoType;
|
||||
import it.integry.ems.response.ServiceRestResponse;
|
||||
@@ -16,7 +17,7 @@ public class ImportScheduledOperationRunner extends BaseScheduledOperationRunner
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
|
||||
ResponseJSONObjectMapper mapper = new ResponseJSONObjectMapper();
|
||||
ResponseJSONObjectMapper objectMapper = ApplicationContextProvider.getApplicationContext().getBean(ResponseJSONObjectMapper.class);
|
||||
|
||||
String port = UtilityServer.getLocalServerPort();
|
||||
|
||||
@@ -38,7 +39,7 @@ public class ImportScheduledOperationRunner extends BaseScheduledOperationRunner
|
||||
jsonResponse);
|
||||
|
||||
String responseJson = jsonResponse.toString();
|
||||
ServiceRestResponse serviceRestResponse = mapper.readValue(responseJson, ServiceRestResponse.class);
|
||||
ServiceRestResponse serviceRestResponse = objectMapper.readValue(responseJson, ServiceRestResponse.class);
|
||||
|
||||
if (serviceRestResponse.getEsito().equals(EsitoType.KO) && serviceRestResponse.getErrorMessage() !=null ) {
|
||||
logger.error(String.format("Eccezione %s generata dall'operazione %s", serviceRestResponse.getErrorMessage(), this.getDtoInstance().getName()));
|
||||
|
||||
@@ -26,74 +26,74 @@ public class LocalFolderDirectoryWatcher extends DirectoryWatcher {
|
||||
private FileAlterationMonitor monitor;
|
||||
private FileAlterationListener listener = new FileAlterationListener() {
|
||||
|
||||
@Override
|
||||
public void onStart(FileAlterationObserver observer) {
|
||||
@Override
|
||||
public void onStart(FileAlterationObserver observer) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDirectoryCreate(File directory) {
|
||||
@Override
|
||||
public void onDirectoryCreate(File directory) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDirectoryChange(File directory) {
|
||||
@Override
|
||||
public void onDirectoryChange(File directory) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDirectoryDelete(File directory) {
|
||||
@Override
|
||||
public void onDirectoryDelete(File directory) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFileCreate(File file) {
|
||||
if (!isASubDirectory(file)) {
|
||||
if (getMatcher(fileFilter, file.getName()).matches()) {
|
||||
executor.execute(() -> {
|
||||
try {
|
||||
final boolean importStatus = directoryWatcherEvents.onFileCreate(file);
|
||||
|
||||
if (operationData.isDeleteAfterImport() && importStatus)
|
||||
file.delete();
|
||||
} catch (Exception ex) {
|
||||
logger.error(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFileChange(File file) {
|
||||
if (!isASubDirectory(file)) {
|
||||
if (getMatcher(fileFilter, file.getName()).matches()) {
|
||||
executor.execute(() -> {
|
||||
final boolean importStatus = directoryWatcherEvents.onFileChange(file);
|
||||
@Override
|
||||
public void onFileCreate(File file) {
|
||||
if (!isASubDirectory(file)) {
|
||||
if (getMatcher(fileFilter, file.getName()).matches()) {
|
||||
executor.execute(() -> {
|
||||
try {
|
||||
final boolean importStatus = directoryWatcherEvents.onFileCreate(file);
|
||||
|
||||
if (operationData.isDeleteAfterImport() && importStatus)
|
||||
file.delete();
|
||||
});
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.error(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFileDelete(File file) {
|
||||
if (!isASubDirectory(file)) {
|
||||
if (getMatcher(fileFilter, file.getName()).matches()) {
|
||||
executor.execute(() -> {
|
||||
directoryWatcherEvents.onFileDelete(file);
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void onFileChange(File file) {
|
||||
if (!isASubDirectory(file)) {
|
||||
if (getMatcher(fileFilter, file.getName()).matches()) {
|
||||
executor.execute(() -> {
|
||||
final boolean importStatus = directoryWatcherEvents.onFileChange(file);
|
||||
|
||||
if (operationData.isDeleteAfterImport() && importStatus)
|
||||
file.delete();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop(FileAlterationObserver observer) {
|
||||
|
||||
@Override
|
||||
public void onFileDelete(File file) {
|
||||
if (!isASubDirectory(file)) {
|
||||
if (getMatcher(fileFilter, file.getName()).matches()) {
|
||||
executor.execute(() -> {
|
||||
directoryWatcherEvents.onFileDelete(file);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop(FileAlterationObserver observer) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
public LocalFolderDirectoryWatcher(ImportDirectoryOperationDTO operationDTO) {
|
||||
super(operationDTO);
|
||||
@@ -111,15 +111,19 @@ public class LocalFolderDirectoryWatcher extends DirectoryWatcher {
|
||||
}
|
||||
|
||||
protected void start() throws Exception {
|
||||
observer = new FileAlterationObserver(path);
|
||||
monitor = new FileAlterationMonitor(10000);
|
||||
long pollingInterval = 30 * 1000;
|
||||
|
||||
observer = new FileAlterationObserver(path, pathname ->
|
||||
!pathname.isDirectory() && getMatcher(fileFilter, pathname.getName()).matches());
|
||||
monitor = new FileAlterationMonitor(pollingInterval);
|
||||
|
||||
observer.addListener(listener);
|
||||
monitor.addObserver(observer);
|
||||
|
||||
logger.debug("Avviato servizio di recupero files nella cartella: " + this.observer.getDirectory().toString());
|
||||
|
||||
File[] files = observer.getDirectory().listFiles(pathname -> getMatcher(fileFilter, pathname.getName()).matches());
|
||||
File[] files = observer.getDirectory()
|
||||
.listFiles(pathname -> getMatcher(fileFilter, pathname.getName()).matches());
|
||||
|
||||
List<File> filesList = new ArrayList<File>();
|
||||
|
||||
|
||||
@@ -52,6 +52,9 @@ public class MtbStip extends EntityBase {
|
||||
@SqlField(value = "expr_calc_descr_estesa", maxLength = 8000)
|
||||
private String exprCalcDescrEstesa;
|
||||
|
||||
@SqlField(value = "flag_bio", nullable = false, defaultObjectValue = "0")
|
||||
private Boolean flagBio;
|
||||
|
||||
@EntityChild
|
||||
private List<MtbTipiCarat> mtbTipiCarat = new ArrayList<>();
|
||||
|
||||
@@ -131,6 +134,14 @@ public class MtbStip extends EntityBase {
|
||||
this.exprCalcDescrEstesa = exprCalcDescrEstesa;
|
||||
}
|
||||
|
||||
public Boolean getFlagBio() {
|
||||
return flagBio;
|
||||
}
|
||||
|
||||
public void setFlagBio(Boolean flagBio) {
|
||||
this.flagBio = flagBio;
|
||||
}
|
||||
|
||||
public List<MtbTipiCarat> getMtbTipiCarat() {
|
||||
return mtbTipiCarat;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.vividsolutions.jts.geom.GeometryFactory;
|
||||
import com.vividsolutions.jts.geom.PrecisionModel;
|
||||
import com.vividsolutions.jts.io.WKTReader;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.expansion.RunnableArgsWithReturn;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
@@ -59,7 +60,7 @@ public class SqlFieldHolder {
|
||||
private static SpelExpressionParser pp;
|
||||
private static StandardEvaluationContext ctx;
|
||||
|
||||
private static final ResponseJSONObjectMapper jsonObjectMapper = new ResponseJSONObjectMapper();
|
||||
private static final ResponseJSONObjectMapper jsonObjectMapper = ApplicationContextProvider.getApplicationContext().getBean(ResponseJSONObjectMapper.class);
|
||||
|
||||
private static final TypeReference<List<String>> STRING_LIST_TYPE_REF = new TypeReference<List<String>>() {
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems_model.utility;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
@@ -10,9 +11,8 @@ import java.io.IOException;
|
||||
|
||||
public class UtilityJSON {
|
||||
|
||||
private static final ResponseJSONObjectMapper jsonObjectMapper = new ResponseJSONObjectMapper();
|
||||
|
||||
public static JsonNode stringToJsonNode(String jsonString) throws IOException {
|
||||
ResponseJSONObjectMapper jsonObjectMapper = ApplicationContextProvider.getApplicationContext().getBean(ResponseJSONObjectMapper.class);
|
||||
return jsonObjectMapper.readTree(jsonString);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,9 @@ public class NotificationSenderComponent {
|
||||
@Autowired
|
||||
private LooperService looperService;
|
||||
|
||||
@Autowired
|
||||
private ResponseJSONObjectMapper responseJSONObjectMapper;
|
||||
|
||||
@PostContextConstruct(priority = 10)
|
||||
private void init() {
|
||||
if (!UtilityDebug.isDebugExecution())
|
||||
@@ -91,10 +94,8 @@ public class NotificationSenderComponent {
|
||||
);
|
||||
|
||||
if (status == 200) {
|
||||
ResponseJSONObjectMapper mapper = new ResponseJSONObjectMapper();
|
||||
|
||||
String responseJson = jsonResponse.toString();
|
||||
ServiceRestResponse serviceRestResponse = mapper.readValue(responseJson, ServiceRestResponse.class);
|
||||
ServiceRestResponse serviceRestResponse = responseJSONObjectMapper.readValue(responseJson, ServiceRestResponse.class);
|
||||
|
||||
if (serviceRestResponse.getEsito().equals(EsitoType.KO)) {
|
||||
logger.error(String.format("Eccezione %s generata dall'operazione send", serviceRestResponse.getErrorMessage()));
|
||||
|
||||
@@ -499,17 +499,31 @@ public class DigitalInvoiceBodyFactory {
|
||||
}
|
||||
}
|
||||
|
||||
// se configurato inserisce nel tag CAUSALE i termini di consegna del documento
|
||||
if (setupCustom.getSetupBoolean("FATTURA_ELETTRONICA_CUSTOM", "CAUSALE", "TERM_CONS")) {
|
||||
sql = "select dtb_doct.term_cons " +
|
||||
" from dtb_doct " +
|
||||
" where dtb_doct.cod_dtip = " + UtilityDB.valueToString(bodyFattura.getCodDtipDocumento()) + " and " +
|
||||
" dtb_doct.cod_anag = " + UtilityDB.valueToString(bodyFattura.getCodAnagDocumento()) + "and " +
|
||||
" dtb_doct.data_doc = " + UtilityDB.valueDateToString(bodyFattura.getDataDocumento(), CommonConstants.DATE_FORMAT_YMD) + "and " +
|
||||
" dtb_doct.ser_doc = " + UtilityDB.valueToString(bodyFattura.getSerieDocumento()) + "and " +
|
||||
" dtb_doct.num_doc = " + UtilityDB.valueToString(bodyFattura.getNumeroDocumento());
|
||||
String termCons = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
if (!UtilityString.isNullOrEmpty(termCons)) {
|
||||
datiGeneraliDocumento.getCausale().add(termCons);
|
||||
}
|
||||
}
|
||||
|
||||
// se configurato inserisce nel tag CAUSALE le note del cliente presenti nella gtb_anag_note con flag_stampa_doc ='S'
|
||||
if (setupCustom.getSetupBoolean("FATTURA_ELETTRONICA_CUSTOM", "CAUSALE", "GTB_ANAG_NOTE")) {
|
||||
sql = "SELECT note FROM gtb_anag_note WHERE flag_stampa_doc ='S' and cod_anag = " + UtilityDB.valueToString(request.getCodAnag()) + " ORDER BY riga_note";
|
||||
|
||||
List<String> notes = UtilityDB.executeSimpleQueryOnlyFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
for (String note : notes) {
|
||||
datiGeneraliDocumento.getCausale().add(note);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//se configurato inserisce nel tag CAUSALE tutte le partite di magazzino presenti nel docuemnto
|
||||
if (setupCustom.getSetupBoolean("FATTURA_ELETTRONICA_CUSTOM", "COD_ANAG_" + request.getCodAnag(), "CAUSALE_LOTTO")) {
|
||||
final String[] matricole = {""};
|
||||
@@ -525,15 +539,6 @@ public class DigitalInvoiceBodyFactory {
|
||||
}
|
||||
}
|
||||
|
||||
// Elenco note da aggiungere alla fattura (Es. dicitura CONAI )
|
||||
String noteDoc = setup.getSetup("FATTURA_ELETTRONICA_CUSTOM", "CAUSALE", "NOTE_PIE_PAGINA");
|
||||
if (noteDoc != null && !noteDoc.isEmpty()) {
|
||||
String[] notes = noteDoc.split("\\|");
|
||||
for (int j = 0; j < notes.length; j++) {
|
||||
datiGeneraliDocumento.getCausale().add(notes[j]);
|
||||
}
|
||||
}
|
||||
|
||||
return datiGeneraliDocumento;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.logistic.Export.dto.MagAutoPickingRequestDTO;
|
||||
import it.integry.ems.logistic.Export.dto.MagAutoPickingRowRequestDTO;
|
||||
import it.integry.ems.response.FileItem;
|
||||
import it.integry.ems.service.EntityProcessor;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
@@ -38,17 +37,19 @@ import static it.integry.ems.rules.completing.QueryRules.getSingleValue;
|
||||
@Service
|
||||
@Scope("request")
|
||||
public class ICONExportService {
|
||||
|
||||
@Autowired
|
||||
private SetupGest setupGest;
|
||||
|
||||
@Autowired
|
||||
EntityProcessor entityProcessor;
|
||||
ResponseJSONObjectMapper jsonObjectMapper;
|
||||
|
||||
@Autowired
|
||||
MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
public EntityExportResponse<List<FileItem>> invioMissionePicking(String type, String format, JsonNode body) throws Exception {
|
||||
|
||||
EntityExportResponse<List<FileItem>> response = new EntityExportResponse<>();
|
||||
ResponseJSONObjectMapper jsonObjectMapper = new ResponseJSONObjectMapper();
|
||||
MagAutoPickingRequestDTO ordT = jsonObjectMapper.readValue(body.toString(), MagAutoPickingRequestDTO.class);
|
||||
|
||||
// Inizializzazione variabili
|
||||
@@ -212,7 +213,6 @@ public class ICONExportService {
|
||||
|
||||
public EntityExportResponse invioMissioneAccettazione(String type, String format, JsonNode body) throws Exception {
|
||||
EntityExportResponse<List<FileItem>> response = new EntityExportResponse<>();
|
||||
ResponseJSONObjectMapper jsonObjectMapper = new ResponseJSONObjectMapper();
|
||||
MtbColt colT = jsonObjectMapper.readValue(body.toString(), MtbColt.class);
|
||||
|
||||
int index = 0;
|
||||
|
||||
@@ -74,6 +74,7 @@ public class ContrattiDiVenditaHandlerService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Scheduled(fixedDelay = 10, timeUnit = TimeUnit.SECONDS, initialDelay = 60, zone = "Europe/Rome")
|
||||
private void updateProgContrattoV() throws Exception {
|
||||
if (!canBeExecuted) return;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package it.integry.ems.production.service;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import it.integry.annotations.PostContextConstruct;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems.looper.service.LooperService;
|
||||
import it.integry.ems.production.dto.OrdineLavorazioneDTO;
|
||||
import it.integry.ems.retail.pvmRetail.dto.OrdineInevasoGroupMercDTO;
|
||||
import it.integry.ems.settings.Model.AvailableConnectionsModel;
|
||||
@@ -16,11 +14,13 @@ import it.integry.ems_model.utility.*;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@@ -28,9 +28,6 @@ public class ProductionOrderDataHandlerService {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
@Autowired
|
||||
private LooperService looperService;
|
||||
|
||||
@Autowired
|
||||
private SettingsModel settingsModel;
|
||||
|
||||
@@ -44,34 +41,61 @@ public class ProductionOrderDataHandlerService {
|
||||
private final HashMap<String, HashMap<String, List<OrdineLavorazioneDTO>>> inevasiOrdersCachedData = new HashMap<>();
|
||||
|
||||
|
||||
@PostContextConstruct
|
||||
public void init() {
|
||||
if (!UtilityDebug.isDebugExecution() && !UtilityDebug.isIntegryServer()) {
|
||||
looperService.add(() -> this.internalCacheOrdiniLavorazione(true, inevasiOrdersCachedData), 5 * 1000, ProductionOrderDataHandlerService.class.getName());
|
||||
private boolean canBeExecuted = false;
|
||||
private final HashMap<String, Boolean> executionPermission = new HashMap<>();
|
||||
|
||||
|
||||
@Scheduled(fixedDelay = 1, timeUnit = TimeUnit.HOURS, zone = "Europe/Rome")
|
||||
private void refreshCronPermission() throws Exception {
|
||||
canBeExecuted = !UtilityDebug.isDebugExecution() && settingsModel.isPrimaryInstance() && !UtilityDebug.isIntegryServer();
|
||||
if (!canBeExecuted) return;
|
||||
|
||||
try {
|
||||
String sql =
|
||||
"SELECT CAST(COUNT(*) AS BIT)\n" +
|
||||
"FROM stb_abil\n" +
|
||||
"WHERE cod_opz IN ('WG069', 'WG135')\n" +
|
||||
" AND flag_abil <> 'N'";
|
||||
|
||||
String historyProfileDb = settingsController.getHistoryProfileDb();
|
||||
final List<AvailableConnectionsModel> availableConnections = settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(true, historyProfileDb);
|
||||
|
||||
for (AvailableConnectionsModel connectionsModel : availableConnections) {
|
||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(connectionsModel, false)) {
|
||||
|
||||
boolean isEnabled = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
executionPermission.remove(connectionsModel.getDbName());
|
||||
executionPermission.put(connectionsModel.getDbName(), isEnabled);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.error(ProductionOrderDataHandlerService.class.getSimpleName(), ex);
|
||||
throw ex;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void internalCacheOrdiniLavorazione(boolean onlyInevasi, HashMap<String, HashMap<String, List<OrdineLavorazioneDTO>>> orderList) {
|
||||
@Scheduled(fixedDelay = 5, timeUnit = TimeUnit.SECONDS, initialDelay = 60, zone = "Europe/Rome")
|
||||
public void updateInternalCache() throws Exception {
|
||||
boolean onlyInevasi = true;
|
||||
HashMap<String, HashMap<String, List<OrdineLavorazioneDTO>>> orderList = inevasiOrdersCachedData;
|
||||
|
||||
String historyProfileDb = null;
|
||||
try {
|
||||
historyProfileDb = settingsController.getHistoryProfileDb();
|
||||
} catch (Exception ex) {
|
||||
logger.error(ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
String finalHistoryProfileDb = historyProfileDb;
|
||||
Map<String, List<AvailableConnectionsModel>> databases = settingsModel.getAvailableConnections(true)
|
||||
.stream()
|
||||
.filter(x -> finalHistoryProfileDb != null && !finalHistoryProfileDb.equalsIgnoreCase(x.getProfileName()))
|
||||
.collect(Collectors.groupingBy(AvailableConnectionsModel::getDbName));
|
||||
String historyProfileDb = settingsController.getHistoryProfileDb();
|
||||
final List<AvailableConnectionsModel> availableConnections = settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(true, historyProfileDb);
|
||||
|
||||
|
||||
for (String dbName : databases.keySet()) {
|
||||
try {
|
||||
String profileName = databases.get(dbName).get(0).getProfileName();
|
||||
loadOrdiniProfile(onlyInevasi, dbName, profileName, orderList);
|
||||
for (AvailableConnectionsModel connectionModel : availableConnections) {
|
||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(connectionModel, false)) {
|
||||
|
||||
boolean isEnabled = executionPermission.getOrDefault(connectionModel.getDbName(), false);
|
||||
Date startDate = new Date();
|
||||
|
||||
if (isEnabled)
|
||||
loadOrdiniProfile(multiDBTransactionManager, onlyInevasi, connectionModel.getDbName(), orderList);
|
||||
|
||||
logger.trace(ProductionOrderDataHandlerService.class.getSimpleName() + ": Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");
|
||||
|
||||
} catch (Exception ex) {
|
||||
logger.error(ex.getMessage(), ex);
|
||||
}
|
||||
@@ -79,27 +103,19 @@ public class ProductionOrderDataHandlerService {
|
||||
|
||||
}
|
||||
|
||||
private void loadOrdiniProfile(boolean onlyInevasi, String dbName, String profileName, HashMap<String, HashMap<String, List<OrdineLavorazioneDTO>>> orderList) throws Exception {
|
||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(profileName, false)) {
|
||||
Date startDate = new Date();
|
||||
//Verifichiamo se la gestione del MES è abilitata
|
||||
boolean gestioneAbilitata = isMESEnabled(multiDBTransactionManager);
|
||||
private void loadOrdiniProfile(MultiDBTransactionManager multiDBTransactionManager, boolean onlyInevasi, String dbName, HashMap<String, HashMap<String, List<OrdineLavorazioneDTO>>> orderList) throws Exception {
|
||||
List<OrdineLavorazioneDTO> ordiniLav = getOrdiniLavorazione(multiDBTransactionManager, onlyInevasi ? "I" : null, null, null, null, null);
|
||||
|
||||
if (gestioneAbilitata) {
|
||||
List<OrdineLavorazioneDTO> ordiniLav = getOrdiniLavorazione(multiDBTransactionManager, onlyInevasi ? "I" : null, null, null, null, null);
|
||||
HashMap<String, List<OrdineLavorazioneDTO>> section = getSectionByDBName(orderList, dbName);
|
||||
section.clear();
|
||||
if (ordiniLav != null)
|
||||
Stream.of(ordiniLav).groupBy(OrdineLavorazioneDTO::getCodJfas)
|
||||
.forEach(x -> {
|
||||
List<OrdineLavorazioneDTO> listToUpdate = getListByCodJfas(section, x.getKey());
|
||||
listToUpdate.addAll(x.getValue());
|
||||
});
|
||||
HashMap<String, List<OrdineLavorazioneDTO>> section = getSectionByDBName(orderList, dbName);
|
||||
section.clear();
|
||||
|
||||
if (ordiniLav != null)
|
||||
Stream.of(ordiniLav).groupBy(OrdineLavorazioneDTO::getCodJfas)
|
||||
.forEach(x -> {
|
||||
List<OrdineLavorazioneDTO> listToUpdate = getListByCodJfas(section, x.getKey());
|
||||
listToUpdate.addAll(x.getValue());
|
||||
});
|
||||
|
||||
logger.trace(ProductionOrderDataHandlerService.class.getSimpleName() + ": Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -52,9 +52,13 @@ public class RetailController {
|
||||
|
||||
@Autowired
|
||||
private ServiceChecker serviceChecker;
|
||||
|
||||
@Autowired
|
||||
private RequestDataDTO requestDataDTO;
|
||||
|
||||
@Autowired
|
||||
private ResponseJSONObjectMapper jsonObjectMapper;
|
||||
|
||||
@RequestMapping(value = "/retail/status", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
List<StatusResponse> status(HttpServletRequest request) {
|
||||
@@ -138,7 +142,6 @@ public class RetailController {
|
||||
variazioniPvDTO.setFileXml(inputXML);
|
||||
variazioniPvDTO.setDataValidita(UtilityDate.RecognizeDate(dataValidita));
|
||||
variazioniPvDTO.setUserName(requestDataDTO.getUsername());
|
||||
ResponseJSONObjectMapper jsonObjectMapper = new ResponseJSONObjectMapper();
|
||||
|
||||
JsonNode node = jsonObjectMapper.valueToTree(variazioniPvDTO);
|
||||
EntityExportResponse exportResponse = emsServices.export(EntityExportType.VARIAZIONE_PV.getText(), VariazioniExporter.Format.XML_DIALOGO.getText(), node, true);
|
||||
|
||||
Reference in New Issue
Block a user