Compare commits
107 Commits
feature-re
...
68a45a9eea
| Author | SHA1 | Date | |
|---|---|---|---|
| 68a45a9eea | |||
| 8fe752e595 | |||
| 71ffc5b4cf | |||
| cc189f4761 | |||
| bd3bf9a8dc | |||
| 7fd4b6236c | |||
| 5075e17078 | |||
| 656f2018a2 | |||
| 2b4cea4ada | |||
| 72ebb39b22 | |||
| 8e01509e99 | |||
| 18da8c2763 | |||
| a770e150a4 | |||
| 72059e4623 | |||
| db5ee20a39 | |||
| 7b40578ea4 | |||
| 9685bff5ef | |||
| bfa48cbbb1 | |||
| 4f2b251d20 | |||
| a1f1ffba95 | |||
| 1ab59fa9a6 | |||
| 800407ebd7 | |||
| 3dad6790fc | |||
| d073a8fd17 | |||
| a9068c45cd | |||
| ca78b09ad8 | |||
| 3e17a7239a | |||
| d78597cba4 | |||
| 91f28a8c82 | |||
| 03a7877899 | |||
| 46e8a19c53 | |||
| 81a42fc1d9 | |||
| fdbcc0c539 | |||
| 7d51ddb868 | |||
| 9f25bd2bf6 | |||
| a9ce0d82b6 | |||
| 83d2f329ce | |||
| 7e06512598 | |||
| b5776e82c9 | |||
| 05dd42b0bf | |||
| 636774ed86 | |||
| 6649af6e92 | |||
| acfff8e8d6 | |||
| 44c1bd7cee | |||
| c712e729cc | |||
| b684129f39 | |||
| 1b339289c1 | |||
| b246991600 | |||
| dc578d1f17 | |||
| 6c6f6d4d7e | |||
| 50dcb999f1 | |||
| c656cc95de | |||
| 0b0b5bbf33 | |||
| c2310327d2 | |||
| 9962471f71 | |||
| 8ad86f71d3 | |||
| 3a42baab00 | |||
| a1bfd0150c | |||
| 2e420fc540 | |||
| f591246ae3 | |||
| d4c02cf504 | |||
| e15878a9eb | |||
| 39f43b3361 | |||
| 18a6756860 | |||
| 3640b08041 | |||
| 928d47f772 | |||
| 28478cb11d | |||
| 0c48df7895 | |||
| 327f5af3dd | |||
| 62234f2edf | |||
| 2fcba55965 | |||
| d29768776a | |||
| 3dcf6d3ee0 | |||
| 7c2aa55eb8 | |||
| e92d64a05e | |||
| b46f26790d | |||
| c364d57e86 | |||
| 6d89e4d09b | |||
| acba051357 | |||
| 21a189ea66 | |||
| 3a4a11d9e8 | |||
| 185d403d7a | |||
| 85ed6b54f9 | |||
| 9b6b0c87aa | |||
| fd68a9b73a | |||
| 433ab4b0ec | |||
| df9fbc7f65 | |||
| a8253614b4 | |||
| 9977cae821 | |||
| 344010ed90 | |||
| 1c51fb717a | |||
| 81827a8368 | |||
| 21222a25e9 | |||
| d24a033e01 | |||
| 5e76d8db2a | |||
| bae92e626b | |||
| 0d471db37d | |||
| c4c6875e16 | |||
| 3515e5c976 | |||
| 84a6f4c4f1 | |||
| ee9ec1a8a7 | |||
| 1884a9184e | |||
| caa62588b6 | |||
| 8bb9803f5b | |||
| ea27c26597 | |||
| 80aaa94036 | |||
| a82c0de415 |
1701
.idea/inspectionProfiles/LocalDate_passato_a_SimpleDate.xml
generated
Normal file
1701
.idea/inspectionProfiles/LocalDate_passato_a_SimpleDate.xml
generated
Normal file
File diff suppressed because it is too large
Load Diff
10
.idea/structuralSearch.xml
generated
Normal file
10
.idea/structuralSearch.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="StructuralSearch">
|
||||
<searchConfiguration name="LocalDate passato a SimpleDateFormat" text="$formatter$.format($date$)" recursive="true" caseInsensitive="true" type="JAVA" pattern_context="default">
|
||||
<constraint name="__context__" within="" contains="" />
|
||||
<constraint name="formatter" nameOfExprType="java\.text\.SimpleDateFormat" within="" contains="" />
|
||||
<constraint name="date" nameOfExprType="java\.time\.LocalDate" within="" contains="" />
|
||||
</searchConfiguration>
|
||||
</component>
|
||||
</project>
|
||||
@@ -6,6 +6,7 @@ import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
|
||||
import java.sql.SQLException;
|
||||
@@ -13,6 +14,8 @@ import java.util.HashMap;
|
||||
|
||||
public class DataSource extends BasicDataSource {
|
||||
|
||||
private final int POOL_SIZE;
|
||||
|
||||
private AvailableConnectionModel connectionModel;
|
||||
|
||||
/**
|
||||
@@ -24,6 +27,13 @@ public class DataSource extends BasicDataSource {
|
||||
@Deprecated
|
||||
public DataSource() {
|
||||
super();
|
||||
POOL_SIZE = 5;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public DataSource(int poolSize) {
|
||||
super();
|
||||
POOL_SIZE = poolSize;
|
||||
}
|
||||
|
||||
public EmsRestConstants.DB_TYPE getTypeDB() {
|
||||
@@ -62,12 +72,20 @@ public class DataSource extends BasicDataSource {
|
||||
}
|
||||
|
||||
public synchronized void initialize(String profileDB) throws Exception {
|
||||
initialize(profileDB, null);
|
||||
}
|
||||
|
||||
public synchronized void initialize(String profileDB, String customAppName) throws Exception {
|
||||
AvailableConnectionModel connectionsModel = SettingsModel.getInstance().findConnectionModel(profileDB);
|
||||
|
||||
initialize(connectionsModel);
|
||||
initialize(connectionsModel, customAppName);
|
||||
}
|
||||
|
||||
public synchronized void initialize(AvailableConnectionModel connectionModel) throws Exception {
|
||||
initialize(connectionModel, null);
|
||||
}
|
||||
|
||||
public synchronized void initialize(AvailableConnectionModel connectionModel, String customAppName) throws Exception {
|
||||
if (connectionModel == null) {
|
||||
throw new Exception("Configurazione DB non trovata");
|
||||
}
|
||||
@@ -76,7 +94,7 @@ public class DataSource extends BasicDataSource {
|
||||
|
||||
this.setDriverClassName(connectionModel.getDriverClassName());
|
||||
|
||||
this.setUrl(connectionModel.getDbConnectionString("EMS Connection"));
|
||||
this.setUrl(connectionModel.getDbConnectionString(UtilityString.isNull(customAppName, "EMS Connection")));
|
||||
this.setUsername(connectionModel.getUsername());
|
||||
this.setPassword(connectionModel.getPasswordDecrypted());
|
||||
this.setDefaultCatalog(connectionModel.getDbName());
|
||||
@@ -87,9 +105,9 @@ public class DataSource extends BasicDataSource {
|
||||
// ===== OTTIMIZZAZIONI CRITICHE =====
|
||||
|
||||
// Pool sizing ottimizzato per READ_UNCOMMITTED (meno locking = più connessioni possibili)
|
||||
this.setInitialSize(5); // Inizia con più connessioni
|
||||
this.setInitialSize(POOL_SIZE); // Inizia con più connessioni
|
||||
this.setMaxTotal(-1); // Aumentato il massimo
|
||||
this.setMinIdle(5); // Non scendere sotto 5
|
||||
this.setMinIdle(POOL_SIZE); // Non scendere sotto 5
|
||||
this.setMaxIdle(-1); // Mantieni più connessioni idle
|
||||
|
||||
// Timeout ottimizzati per performance massime
|
||||
@@ -97,8 +115,8 @@ public class DataSource extends BasicDataSource {
|
||||
|
||||
// Validazione veloce ed efficiente
|
||||
this.setValidationQuery("SELECT 1");
|
||||
// this.setValidationQueryTimeout(60); // Ridotto a 1 secondo
|
||||
// this.setTestWhileIdle(true); // Testa connessioni idle
|
||||
this.setValidationQueryTimeout(30); // Ridotto a 1 secondo
|
||||
this.setTestWhileIdle(true); // Testa connessioni idle
|
||||
|
||||
// Eviction ottimizzata per READ_UNCOMMITTED
|
||||
// this.setTimeBetweenEvictionRunsMillis(1 * 1000); // Ogni 30 secondi
|
||||
|
||||
@@ -0,0 +1,291 @@
|
||||
package it.integry.ems.dbms_change_tracker.component;
|
||||
|
||||
import com.microsoft.sqlserver.jdbc.SQLServerConnection;
|
||||
import it.integry.ems.datasource.DataSource;
|
||||
import it.integry.ems.dbms_change_tracker.model.ChangeTrackingConfigDTO;
|
||||
import it.integry.ems.dbms_change_tracker.model.DetectedChangeDataDTO;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.exception.DataConverterNotFoundException;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class DbmsChangeTracker {
|
||||
|
||||
private DataSource dataSource;
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
|
||||
private final int CHANGE_RETENTION_HOURS = 1;
|
||||
private final boolean AUTO_CLEANUP = true;
|
||||
|
||||
private Connection integryConnection;
|
||||
private boolean trackerEnabled = false;
|
||||
private long currentVersion;
|
||||
|
||||
|
||||
private Listener eventListener;
|
||||
|
||||
public DbmsChangeTracker(String profileDb) throws Exception {
|
||||
createDataSource(profileDb);
|
||||
createConnection();
|
||||
}
|
||||
|
||||
private void createDataSource(String profileDb) throws Exception {
|
||||
DataSource ds = new DataSource(1);
|
||||
ds.initialize(profileDb, "Integry Changes Tracker");
|
||||
this.dataSource = ds;
|
||||
}
|
||||
|
||||
private void createConnection() throws SQLException {
|
||||
integryConnection = dataSource.getConnection();
|
||||
if (!(integryConnection.isWrapperFor(SQLServerConnection.class))) {
|
||||
integryConnection.close();
|
||||
|
||||
throw new SQLException("Connection is not a SQL Server connection");
|
||||
}
|
||||
}
|
||||
|
||||
private void checkConnection() {
|
||||
try {
|
||||
UtilityDB.executeSimpleQuery(integryConnection, "SELECT 1");
|
||||
if (integryConnection.isClosed())
|
||||
createConnection();
|
||||
} catch (SQLException e) {
|
||||
try {
|
||||
integryConnection.close();
|
||||
createConnection();
|
||||
} catch (SQLException ex) {
|
||||
logger.error("Unable to reestablish DB connection for Change Tracker", ex);
|
||||
throw new RuntimeException("Unable to reestablish DB connection for Change Tracker");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void enableTrackerInDbms() throws SQLException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
|
||||
final ChangeTrackingConfigDTO currentConfig = retrieveTrackerCurrentConfig();
|
||||
if (currentConfig != null) {
|
||||
logInfo("Changes Tracker is already enabled (with " + currentConfig.getRetentionPeriod() + " " + currentConfig.getRetentionPeriodUnit().toLowerCase() + " retention and auto cleanup " + (currentConfig.isAutoCleanupOn() ? "ON" : "OFF") + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
String enableSql = "ALTER DATABASE [" + integryConnection.getDbName() + "] \n" +
|
||||
"SET CHANGE_TRACKING = ON (" +
|
||||
"CHANGE_RETENTION = " + CHANGE_RETENTION_HOURS + " HOURS, " +
|
||||
"AUTO_CLEANUP = " + (AUTO_CLEANUP ? "ON" : "OFF") +
|
||||
");\n";
|
||||
|
||||
//COMMIT necessario perché ALTER DATABASE richiede che non ci siano altre transazioni attive
|
||||
UtilityDB.executeStatement(integryConnection, "COMMIT", enableSql);
|
||||
|
||||
logInfo("Changes Tracker is now enabled (with " + CHANGE_RETENTION_HOURS + " hours retention and auto cleanup " + (AUTO_CLEANUP ? "ON" : "OFF") + ")");
|
||||
}
|
||||
|
||||
|
||||
public void enableTrackerOnTable(String tableName) throws SQLException {
|
||||
if (isTableTrackingEnabled(tableName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
UtilityDB.executeStatement(integryConnection, "ALTER TABLE dbo." + tableName + "\n" +
|
||||
"ENABLE CHANGE_TRACKING WITH (TRACK_COLUMNS_UPDATED = ON);", "COMMIT");
|
||||
}
|
||||
|
||||
|
||||
public void disableTrackerOnNotUsedTables(List<String> usedTables) throws SQLException {
|
||||
final List<String> trackedTables = retrieveTrackedTables();
|
||||
|
||||
trackedTables.removeAll(usedTables);
|
||||
|
||||
for (String tableName : trackedTables) {
|
||||
disableTrackerOnTable(tableName);
|
||||
}
|
||||
}
|
||||
|
||||
public void disableTrackerOnTable(String tableName) throws SQLException {
|
||||
if (!isTableTrackingEnabled(tableName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
UtilityDB.executeStatement(integryConnection, "ALTER TABLE dbo." + tableName + "\n" +
|
||||
"DISABLE CHANGE_TRACKING;", "COMMIT");
|
||||
}
|
||||
|
||||
|
||||
public void startTracking() throws SQLException {
|
||||
currentVersion = retrieveCurrentVersion();
|
||||
trackerEnabled = true;
|
||||
}
|
||||
|
||||
public void checkForChanges() throws Exception {
|
||||
if (!trackerEnabled)
|
||||
return;
|
||||
|
||||
checkConnection();
|
||||
|
||||
final List<String> trackedTables = retrieveTrackedTables();
|
||||
|
||||
HashMap<Long, DetectedChangeDataDTO> changesByVersion = new HashMap<>();
|
||||
|
||||
for (String trackedTable : trackedTables) {
|
||||
long minValidVersion = getMinValidVersion(trackedTable);
|
||||
if (currentVersion < minValidVersion) {
|
||||
throw new SQLException("Change Tracking on table " + trackedTable + " has been reset. Current version: " + currentVersion + ", Min valid version: " + minValidVersion);
|
||||
}
|
||||
|
||||
|
||||
final List<DetectedChangeDataDTO> detectedChanges = retrieveChangeList(trackedTable);
|
||||
|
||||
detectedChanges.forEach(detectedChangeDataDTO -> {
|
||||
changesByVersion.put(detectedChangeDataDTO.getSysChangeVersion(), detectedChangeDataDTO);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
logTrace("Detected " + changesByVersion.size() + " changes since version " + currentVersion);
|
||||
|
||||
dispatchChanges(changesByVersion);
|
||||
}
|
||||
|
||||
private void dispatchChanges(HashMap<Long, DetectedChangeDataDTO> changesByVersion) throws Exception {
|
||||
final List<Long> sortedChanges = changesByVersion.keySet().stream()
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
for (Long changeId : sortedChanges) {
|
||||
final DetectedChangeDataDTO detectedChange = changesByVersion.get(changeId);
|
||||
|
||||
switch (detectedChange.getSysChangeOperation()) {
|
||||
case INSERT:
|
||||
if (eventListener != null)
|
||||
eventListener.onInsertDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
||||
break;
|
||||
|
||||
case UPDATE:
|
||||
if (eventListener != null)
|
||||
eventListener.onUpdateDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
||||
break;
|
||||
|
||||
case DELETE:
|
||||
if (eventListener != null)
|
||||
eventListener.onDeleteDetected(detectedChange.getTableName(), detectedChange.getPrimaryKey());
|
||||
break;
|
||||
}
|
||||
|
||||
currentVersion = changeId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<DetectedChangeDataDTO> retrieveChangeList(String tableName) throws SQLException {
|
||||
String sql = "SELECT *\n" +
|
||||
"FROM CHANGETABLE(CHANGES dbo." + tableName + ", " + currentVersion + ") AS c";
|
||||
final List<HashMap<String, Object>> result = UtilityDB.executeSimpleQuery(integryConnection, sql);
|
||||
|
||||
return result.stream()
|
||||
.map(x -> {
|
||||
DetectedChangeDataDTO detectedChangeDataDTO = new DetectedChangeDataDTO()
|
||||
.setTableName(tableName);
|
||||
|
||||
Long sysChangeVersion = UtilityHashMap.<Long>getValueIfExists(x, "SYS_CHANGE_VERSION");
|
||||
detectedChangeDataDTO.setSysChangeVersion(sysChangeVersion);
|
||||
|
||||
|
||||
Long sysChangeCreationVersion = UtilityHashMap.<Long>getValueIfExists(x, "SYS_CHANGE_CREATION_VERSION");
|
||||
detectedChangeDataDTO.setSysChangeCreationVersion(sysChangeCreationVersion);
|
||||
|
||||
detectedChangeDataDTO.setSysChangeOperation(DetectedChangeDataDTO.Operation.from(UtilityHashMap.<String>getValueIfExists(x, "SYS_CHANGE_OPERATION")));
|
||||
|
||||
List<String> keysToRemove = new ArrayList<>();
|
||||
for (String colName : x.keySet()) {
|
||||
if (colName.startsWith("SYS_"))
|
||||
keysToRemove.add(colName);
|
||||
}
|
||||
|
||||
for (String colName : keysToRemove) {
|
||||
x.remove(colName);
|
||||
}
|
||||
|
||||
detectedChangeDataDTO.setPrimaryKey(x);
|
||||
|
||||
return detectedChangeDataDTO;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private long retrieveCurrentVersion() throws SQLException {
|
||||
String sql = "SELECT CHANGE_TRACKING_CURRENT_VERSION() AS current_version";
|
||||
|
||||
long currentVersion = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(integryConnection, sql);
|
||||
return currentVersion;
|
||||
}
|
||||
|
||||
private long getMinValidVersion(String table) throws SQLException {
|
||||
String sql = "SELECT CHANGE_TRACKING_MIN_VALID_VERSION(OBJECT_ID(" + UtilityDB.valueToString(table) + "))";
|
||||
|
||||
long minValidVersion = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(integryConnection, sql);
|
||||
return minValidVersion;
|
||||
}
|
||||
|
||||
private List<String> retrieveTrackedTables() throws SQLException {
|
||||
String sql = "SELECT OBJECT_NAME(object_id) AS table_name\n" +
|
||||
" FROM sys.change_tracking_tables";
|
||||
|
||||
List<String> trackedTables = UtilityDB.executeSimpleQueryOnlyFirstColumn(integryConnection, sql);
|
||||
return trackedTables;
|
||||
}
|
||||
|
||||
private boolean isTableTrackingEnabled(String tableName) throws SQLException {
|
||||
String sql = "SELECT CAST(COUNT(is_track_columns_updated_on) AS BIT) AS enabled\n" +
|
||||
" FROM sys.change_tracking_tables \n" +
|
||||
" WHERE object_id = OBJECT_ID('dbo." + tableName + "')";
|
||||
|
||||
boolean enabled = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(integryConnection, sql);
|
||||
return enabled;
|
||||
}
|
||||
|
||||
private ChangeTrackingConfigDTO retrieveTrackerCurrentConfig() throws SQLException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
|
||||
String checkSql = "SELECT DB_NAME(database_id) as database_name,\n" +
|
||||
"CAST(is_auto_cleanup_on AS BIT) AS is_auto_cleanup_on,\n" +
|
||||
"retention_period,\n" +
|
||||
"retention_period_units_desc,\n" +
|
||||
"max_cleanup_version\n" +
|
||||
"FROM sys.change_tracking_databases \n" +
|
||||
"WHERE DB_NAME(database_id)=DB_NAME()";
|
||||
|
||||
final ChangeTrackingConfigDTO currentConfig = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(integryConnection, checkSql, ChangeTrackingConfigDTO.class);
|
||||
|
||||
return currentConfig;
|
||||
}
|
||||
|
||||
|
||||
private void logInfo(String message) {
|
||||
logger.info("[" + integryConnection.getProfileName() + "] " + message);
|
||||
}
|
||||
|
||||
private void logTrace(String message) {
|
||||
logger.trace("[" + integryConnection.getProfileName() + "] " + message);
|
||||
}
|
||||
|
||||
|
||||
public DbmsChangeTracker setEventListener(Listener eventListener) {
|
||||
this.eventListener = eventListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface Listener {
|
||||
void onInsertDetected(String tableName, HashMap<String, Object> primaryKey) throws Exception;
|
||||
|
||||
void onUpdateDetected(String tableName, HashMap<String, Object> primaryKey) throws Exception;
|
||||
|
||||
void onDeleteDetected(String tableName, HashMap<String, Object> primaryKey) throws Exception;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package it.integry.ems.dbms_change_tracker.component;
|
||||
|
||||
import it.integry.annotations.PostContextAutowired;
|
||||
import it.integry.annotations.PostContextConstruct;
|
||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordDeletedEvent;
|
||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordInsertedEvent;
|
||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordUpdatedEvent;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.exception.DataConverterNotFoundException;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Component
|
||||
public class DbmsChangeTrackerComponent {
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
private final HashMap<IntegryCustomerDB, DbmsChangeTracker> activeChangeTrackers = new HashMap<>();
|
||||
|
||||
private final ArrayList<String> trackedTables = new ArrayList<String>() {{
|
||||
add(MtbAart.ENTITY);
|
||||
add(MtbAartBarCode.ENTITY);
|
||||
add(MtbUntMis.ENTITY);
|
||||
add(StbEditLimit.ENTITY);
|
||||
add(StbGestSetup.ENTITY);
|
||||
add(StbGestSetupDepo.ENTITY);
|
||||
add(WtbGestSetupUser.ENTITY);
|
||||
}};
|
||||
|
||||
|
||||
private final ApplicationEventPublisher applicationEventPublisher;
|
||||
|
||||
@PostContextAutowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
public DbmsChangeTrackerComponent(ApplicationEventPublisher applicationEventPublisher) {
|
||||
this.applicationEventPublisher = applicationEventPublisher;
|
||||
}
|
||||
|
||||
|
||||
@PostContextConstruct(priority = 10)
|
||||
public void init() throws Exception {
|
||||
for (Connection conn : multiDBTransactionManager.getActiveConnections()) {
|
||||
IntegryCustomerDB customerDB = IntegryCustomerDB.parse(conn.getDbName());
|
||||
activeChangeTrackers.put(customerDB, new DbmsChangeTracker(conn.getProfileName()));
|
||||
}
|
||||
|
||||
enableAllChangeTracking();
|
||||
}
|
||||
|
||||
|
||||
private void enableAllChangeTracking() throws SQLException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
|
||||
for (Map.Entry<IntegryCustomerDB, DbmsChangeTracker> entrySet : activeChangeTrackers.entrySet()) {
|
||||
IntegryCustomerDB customerDB = entrySet.getKey();
|
||||
DbmsChangeTracker dbmsChangeTracker = entrySet.getValue();
|
||||
|
||||
dbmsChangeTracker.enableTrackerInDbms();
|
||||
|
||||
for (String tableName : trackedTables) {
|
||||
dbmsChangeTracker.enableTrackerOnTable(tableName);
|
||||
}
|
||||
|
||||
dbmsChangeTracker.disableTrackerOnNotUsedTables(trackedTables);
|
||||
|
||||
dbmsChangeTracker.setEventListener(new DbmsChangeTracker.Listener() {
|
||||
@Override
|
||||
public void onInsertDetected(String tableName, HashMap<String, Object> primaryKey) {
|
||||
onItemInserted(customerDB, tableName, primaryKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateDetected(String tableName, HashMap<String, Object> primaryKey) {
|
||||
onItemUpdated(customerDB, tableName, primaryKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleteDetected(String tableName, HashMap<String, Object> primaryKey) {
|
||||
onItemDeleted(customerDB, tableName, primaryKey);
|
||||
}
|
||||
});
|
||||
|
||||
dbmsChangeTracker.startTracking();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Scheduled(fixedDelay = 5, timeUnit = TimeUnit.SECONDS)
|
||||
private void checkAllChanges() throws Exception {
|
||||
for (DbmsChangeTracker dbmsChangeTracker : activeChangeTrackers.values()) {
|
||||
dbmsChangeTracker.checkForChanges();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void onItemInserted(IntegryCustomerDB customerDB, String tableName, HashMap<String, Object> primaryKey) {
|
||||
logger.trace("Item inserted in profileDb {} table {} with primaryKey {}", customerDB.getValue(), tableName, primaryKey);
|
||||
applicationEventPublisher.publishEvent(new TableRecordInsertedEvent(this, customerDB, tableName, primaryKey));
|
||||
}
|
||||
|
||||
private void onItemUpdated(IntegryCustomerDB customerDB, String tableName, HashMap<String, Object> primaryKey) {
|
||||
logger.trace("Item updated in profileDb {} table {} with primaryKey {}", customerDB.getValue(), tableName, primaryKey);
|
||||
applicationEventPublisher.publishEvent(new TableRecordUpdatedEvent(this, customerDB, tableName, primaryKey));
|
||||
}
|
||||
|
||||
private void onItemDeleted(IntegryCustomerDB customerDB, String tableName, HashMap<String, Object> primaryKey) {
|
||||
logger.trace("Item deleted in profileDb {} table {} with primaryKey {}", customerDB.getValue(), tableName, primaryKey);
|
||||
applicationEventPublisher.publishEvent(new TableRecordDeletedEvent(this, customerDB, tableName, primaryKey));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package it.integry.ems.dbms_change_tracker.model;
|
||||
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
|
||||
public class ChangeTrackingConfigDTO {
|
||||
|
||||
@SqlField("database_name")
|
||||
private String databaseName;
|
||||
|
||||
@SqlField("is_auto_cleanup_on")
|
||||
private boolean autoCleanupOn;
|
||||
|
||||
@SqlField("retention_period")
|
||||
private int retentionPeriod;
|
||||
|
||||
@SqlField("retention_period_units_desc")
|
||||
private String retentionPeriodUnit;
|
||||
|
||||
// @SqlField("max_cleanup_version")
|
||||
private Object maxCleanupVersion;
|
||||
|
||||
|
||||
public String getDatabaseName() {
|
||||
return databaseName;
|
||||
}
|
||||
|
||||
public ChangeTrackingConfigDTO setDatabaseName(String databaseName) {
|
||||
this.databaseName = databaseName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isAutoCleanupOn() {
|
||||
return autoCleanupOn;
|
||||
}
|
||||
|
||||
public ChangeTrackingConfigDTO setAutoCleanupOn(boolean autoCleanupOn) {
|
||||
this.autoCleanupOn = autoCleanupOn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRetentionPeriod() {
|
||||
return retentionPeriod;
|
||||
}
|
||||
|
||||
public ChangeTrackingConfigDTO setRetentionPeriod(int retentionPeriod) {
|
||||
this.retentionPeriod = retentionPeriod;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRetentionPeriodUnit() {
|
||||
return retentionPeriodUnit;
|
||||
}
|
||||
|
||||
public ChangeTrackingConfigDTO setRetentionPeriodUnit(String retentionPeriodUnit) {
|
||||
this.retentionPeriodUnit = retentionPeriodUnit;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Object getMaxCleanupVersion() {
|
||||
return maxCleanupVersion;
|
||||
}
|
||||
|
||||
public ChangeTrackingConfigDTO setMaxCleanupVersion(Object maxCleanupVersion) {
|
||||
this.maxCleanupVersion = maxCleanupVersion;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package it.integry.ems.dbms_change_tracker.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import it.integry.ems_model.entity._enum.IBaseEnum;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class DetectedChangeDataDTO {
|
||||
|
||||
private long sysChangeVersion;
|
||||
private Long sysChangeCreationVersion;
|
||||
private Operation sysChangeOperation;
|
||||
|
||||
private String tableName;
|
||||
private HashMap<String, Object> primaryKey;
|
||||
|
||||
|
||||
public long getSysChangeVersion() {
|
||||
return sysChangeVersion;
|
||||
}
|
||||
|
||||
public DetectedChangeDataDTO setSysChangeVersion(long sysChangeVersion) {
|
||||
this.sysChangeVersion = sysChangeVersion;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Long getSysChangeCreationVersion() {
|
||||
return sysChangeCreationVersion;
|
||||
}
|
||||
|
||||
public DetectedChangeDataDTO setSysChangeCreationVersion(Long sysChangeCreationVersion) {
|
||||
this.sysChangeCreationVersion = sysChangeCreationVersion;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Operation getSysChangeOperation() {
|
||||
return sysChangeOperation;
|
||||
}
|
||||
|
||||
public DetectedChangeDataDTO setSysChangeOperation(Operation sysChangeOperation) {
|
||||
this.sysChangeOperation = sysChangeOperation;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public DetectedChangeDataDTO setTableName(String tableName) {
|
||||
this.tableName = tableName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public HashMap<String, Object> getPrimaryKey() {
|
||||
return primaryKey;
|
||||
}
|
||||
|
||||
public DetectedChangeDataDTO setPrimaryKey(HashMap<String, Object> primaryKey) {
|
||||
this.primaryKey = primaryKey;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public enum Operation implements IBaseEnum<Operation> {
|
||||
INSERT('I'),
|
||||
UPDATE('U'),
|
||||
DELETE('D');
|
||||
|
||||
private final char value;
|
||||
|
||||
Operation(char value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static Operation from(Object value) {
|
||||
if (value instanceof String && ((String) value).length() == 1) {
|
||||
value = ((String) value).charAt(0);
|
||||
}
|
||||
|
||||
char castValue = (char) value;
|
||||
for (Operation b : Operation.values()) {
|
||||
if (b.value == castValue)
|
||||
return b;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public char getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Operation fromInternal(Object val) {
|
||||
return from(val);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.ems.dbms_change_tracker.model.events;
|
||||
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.event.BaseCustomerDBEvent;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class TableRecordDeletedEvent extends BaseCustomerDBEvent {
|
||||
|
||||
private final String tableName;
|
||||
private final HashMap<String, Object> primaryKey;
|
||||
|
||||
public TableRecordDeletedEvent(Object source, IntegryCustomerDB integryCustomerDB, String tableName, HashMap<String, Object> primaryKey) {
|
||||
super(source, integryCustomerDB);
|
||||
|
||||
this.tableName = tableName;
|
||||
this.primaryKey = primaryKey;
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public HashMap<String, Object> getPrimaryKey() {
|
||||
return primaryKey;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.ems.dbms_change_tracker.model.events;
|
||||
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.event.BaseCustomerDBEvent;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class TableRecordInsertedEvent extends BaseCustomerDBEvent {
|
||||
|
||||
private final String tableName;
|
||||
private final HashMap<String, Object> primaryKey;
|
||||
|
||||
public TableRecordInsertedEvent(Object source, IntegryCustomerDB integryCustomerDB, String tableName, HashMap<String, Object> primaryKey) {
|
||||
super(source, integryCustomerDB);
|
||||
|
||||
this.tableName = tableName;
|
||||
this.primaryKey = primaryKey;
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public HashMap<String, Object> getPrimaryKey() {
|
||||
return primaryKey;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package it.integry.ems.dbms_change_tracker.model.events;
|
||||
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.event.BaseCustomerDBEvent;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class TableRecordUpdatedEvent extends BaseCustomerDBEvent {
|
||||
|
||||
private final String tableName;
|
||||
private final HashMap<String, Object> primaryKey;
|
||||
|
||||
public TableRecordUpdatedEvent(Object source, IntegryCustomerDB customerDB, String tableName, HashMap<String, Object> primaryKey) {
|
||||
super(source, customerDB);
|
||||
|
||||
this.tableName = tableName;
|
||||
this.primaryKey = primaryKey;
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
public HashMap<String, Object> getPrimaryKey() {
|
||||
return primaryKey;
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class DevicesRequestInterceptor implements HandlerInterceptor {
|
||||
RequestDataDTO requestDataDTO = ContextLoader.getCurrentWebApplicationContext().getBean(RequestDataDTO.class);
|
||||
|
||||
if (requestDataDTO.isValidProfileDB() && requestDataDTO.isValidDeviceId()) {
|
||||
deviceService.updateUsage(requestDataDTO.getApplication(), requestDataDTO.getDeviceId());
|
||||
deviceService.updateUsage(requestDataDTO.getDeviceId());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -37,8 +37,7 @@ public class DynamicCacheService {
|
||||
DATI_AZIENDA_KEY,
|
||||
ENTITY_LOGGER_SETUP,
|
||||
GRIGLIA_ACQUISTO_KEY,
|
||||
ENTITY_SYNC_KEY,
|
||||
STB_GEST_SETUP_KEY
|
||||
ENTITY_SYNC_KEY
|
||||
}
|
||||
|
||||
public void addItem(Keys key, int invalidateTimeInMins, RunnableWithReturn<Object> refreshAction) {
|
||||
|
||||
@@ -0,0 +1,248 @@
|
||||
package it.integry.ems.dynamic_cache;
|
||||
|
||||
import it.integry.annotations.PostContextAutowired;
|
||||
import it.integry.annotations.PostContextConstruct;
|
||||
import it.integry.ems.dbms_change_tracker.component.DbmsChangeTrackerComponent;
|
||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordDeletedEvent;
|
||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordInsertedEvent;
|
||||
import it.integry.ems.dbms_change_tracker.model.events.TableRecordUpdatedEvent;
|
||||
import it.integry.ems.dto.EntityHierarchy;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.utility.UtilityDebug;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.base.EntityPropertyHolder;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.exception.DataConverterNotFoundException;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityQuery;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Component
|
||||
public class EntityCacheComponent implements ApplicationListener {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
private final DbmsChangeTrackerComponent dbmsChangeTrackerComponent;
|
||||
private final EntityPropertyHolder entityPropertyHolder;
|
||||
|
||||
private final HashMap<IntegryCustomerDB, ConcurrentHashMap<String, ConcurrentHashMap<HashMap<String, Object>, EntityBase>>> entityCache = new HashMap<>();
|
||||
|
||||
private final HashMap<String, Class<? extends EntityBase>> enabledEntities = new HashMap<String, Class<? extends EntityBase>>() {{
|
||||
put(MtbAart.ENTITY, MtbAart.class);
|
||||
put(MtbAartBarCode.ENTITY, MtbAartBarCode.class);
|
||||
put(MtbUntMis.ENTITY, MtbUntMis.class);
|
||||
put(StbEditLimit.ENTITY, StbEditLimit.class);
|
||||
put(StbGestSetup.ENTITY, StbGestSetup.class);
|
||||
put(StbGestSetupDepo.ENTITY, StbGestSetupDepo.class);
|
||||
put(WtbGestSetupUser.ENTITY, WtbGestSetupUser.class);
|
||||
}};
|
||||
|
||||
public EntityCacheComponent(DbmsChangeTrackerComponent dbmsChangeTrackerComponent, EntityPropertyHolder entityPropertyHolder) {
|
||||
this.dbmsChangeTrackerComponent = dbmsChangeTrackerComponent;
|
||||
this.entityPropertyHolder = entityPropertyHolder;
|
||||
}
|
||||
|
||||
@PostContextAutowired
|
||||
private MultiDBTransactionManager multiDBTransactionManager;
|
||||
|
||||
@PostContextConstruct
|
||||
private void init() throws Exception {
|
||||
if (UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer())
|
||||
return;
|
||||
|
||||
for (Connection conn : multiDBTransactionManager.getActiveConnections()) {
|
||||
IntegryCustomerDB customerDB = IntegryCustomerDB.parse(conn.getDbName());
|
||||
|
||||
if (customerDB == null)
|
||||
throw new RuntimeException("Impossibile inizializzare IntegryCustomerDB per il database: " + conn.getDbName());
|
||||
|
||||
|
||||
for (Map.Entry<String, Class<? extends EntityBase>> enabledEntity : enabledEntities.entrySet()) {
|
||||
String tableName = enabledEntity.getKey();
|
||||
|
||||
refreshCacheForEntity(conn, customerDB, tableName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshCacheForEntity(IntegryCustomerDB customerDB, String tableName) throws Exception {
|
||||
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(customerDB)) {
|
||||
Connection conn = mdb.getPrimaryConnection();
|
||||
refreshCacheForEntity(conn, customerDB, tableName);
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshCacheForEntity(Connection connection, IntegryCustomerDB customerDB, String tableName) throws Exception {
|
||||
Class<? extends EntityBase> clazz = enabledEntities.get(tableName);
|
||||
// if (clazz == null)
|
||||
// throw new RuntimeException("Entity cache is not enabled for table " + tableName);
|
||||
|
||||
entityCache.putIfAbsent(customerDB, new ConcurrentHashMap<>());
|
||||
entityCache.get(customerDB).remove(tableName);
|
||||
|
||||
ConcurrentHashMap<HashMap<String, Object>, EntityBase> entities = retrieveEntityList(connection, tableName, clazz);
|
||||
entityCache.get(customerDB).put(tableName, entities);
|
||||
|
||||
logger.trace(String.format("[%s] Cached %d records for entity %s",
|
||||
customerDB.getValue(),
|
||||
entities.size(),
|
||||
clazz.getSimpleName()));
|
||||
}
|
||||
|
||||
public <T extends EntityBase> List<T> getCachedEntitiesList(IntegryCustomerDB customerDB, String tableName, Predicate<T> filterPredicate) {
|
||||
return getCachedEntitiesStream(customerDB, tableName, filterPredicate)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public <T extends EntityBase> Stream<T> getCachedEntitiesStream(IntegryCustomerDB customerDB, String tableName, Predicate<T> filterPredicate) {
|
||||
if (!isCacheEnabled(customerDB, tableName)) {
|
||||
try {
|
||||
refreshCacheForEntity(customerDB, tableName);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
return entityCache.get(customerDB).get(tableName)
|
||||
.values()
|
||||
.parallelStream()
|
||||
.map(x -> (T) x)
|
||||
.filter(filterPredicate)
|
||||
.map(x -> (T) x.clone());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationEvent event) {
|
||||
if (event instanceof TableRecordInsertedEvent) {
|
||||
handleRecordInserted((TableRecordInsertedEvent) event);
|
||||
|
||||
} else if (event instanceof TableRecordUpdatedEvent) {
|
||||
handleRecordUpdated((TableRecordUpdatedEvent) event);
|
||||
|
||||
} else if (event instanceof TableRecordDeletedEvent) {
|
||||
handleRecordDeleted((TableRecordDeletedEvent) event);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void handleRecordInserted(TableRecordInsertedEvent event) {
|
||||
if (!isCacheEnabled(event.getCustomerDB(), event.getTableName()))
|
||||
return;
|
||||
|
||||
HashMap<String, Object> entityPrimaryKey = convertSqlMapToEntityMap(event.getPrimaryKey(), enabledEntities.get(event.getTableName()));
|
||||
|
||||
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(event.getCustomerDB())) {
|
||||
EntityBase newItem = retrieveEntityItem(mdb.getPrimaryConnection(), event.getTableName(),
|
||||
enabledEntities.get(event.getTableName()),
|
||||
event.getPrimaryKey());
|
||||
|
||||
|
||||
entityCache.get(event.getCustomerDB())
|
||||
.get(event.getTableName())
|
||||
.put(entityPrimaryKey, newItem);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleRecordUpdated(TableRecordUpdatedEvent event) {
|
||||
if (!isCacheEnabled(event.getCustomerDB(), event.getTableName()))
|
||||
return;
|
||||
|
||||
HashMap<String, Object> entityPrimaryKey = convertSqlMapToEntityMap(event.getPrimaryKey(), enabledEntities.get(event.getTableName()));
|
||||
|
||||
try (MultiDBTransactionManager mdb = new MultiDBTransactionManager(event.getCustomerDB())) {
|
||||
EntityBase newItem = retrieveEntityItem(mdb.getPrimaryConnection(), event.getTableName(),
|
||||
enabledEntities.get(event.getTableName()),
|
||||
event.getPrimaryKey());
|
||||
|
||||
entityCache.get(event.getCustomerDB())
|
||||
.get(event.getTableName())
|
||||
.put(entityPrimaryKey, newItem);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleRecordDeleted(TableRecordDeletedEvent event) {
|
||||
if (!isCacheEnabled(event.getCustomerDB(), event.getTableName()))
|
||||
return;
|
||||
|
||||
HashMap<String, Object> entityPrimaryKey = convertSqlMapToEntityMap(event.getPrimaryKey(), enabledEntities.get(event.getTableName()));
|
||||
|
||||
final EntityBase removedItem = entityCache.get(event.getCustomerDB())
|
||||
.get(event.getTableName())
|
||||
.remove(entityPrimaryKey);
|
||||
}
|
||||
|
||||
|
||||
private ConcurrentHashMap<HashMap<String, Object>, EntityBase> retrieveEntityList(Connection connection, String tableName, Class<? extends EntityBase> clazz) throws SQLException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
|
||||
String sql = "SELECT * FROM " + tableName;
|
||||
|
||||
List<? extends EntityBase> objects = UtilityDB.executeSimpleQueryDTO(connection, sql, clazz);
|
||||
if (objects == null)
|
||||
objects = new ArrayList<>();
|
||||
final List<EntityHierarchy.Field> pkFields = entityPropertyHolder.getEntityFields(clazz, EntityHierarchy.Field::isPrimaryKey);
|
||||
|
||||
|
||||
ConcurrentHashMap<HashMap<String, Object>, EntityBase> objectsMap = new ConcurrentHashMap<>();
|
||||
for (EntityBase object : objects) {
|
||||
HashMap<String, Object> pkMap = new HashMap<>();
|
||||
for (EntityHierarchy.Field pkField : pkFields) {
|
||||
Object pkValue = pkField.getField().get(object);
|
||||
pkMap.put(pkField.getFieldName(), pkValue);
|
||||
}
|
||||
objectsMap.put(pkMap, object);
|
||||
}
|
||||
|
||||
return objectsMap;
|
||||
}
|
||||
|
||||
private EntityBase retrieveEntityItem(Connection connection, String tableName, Class<?> clazz, HashMap<String, Object> primaryKey) throws SQLException, DataConverterNotFoundException, InstantiationException, IllegalAccessException {
|
||||
String sql = "SELECT * FROM " + tableName + "\n" +
|
||||
" WHERE " + UtilityQuery.concatFieldsInWhereCond(primaryKey);
|
||||
|
||||
final EntityBase object = (EntityBase) UtilityDB.executeSimpleQueryOnlyFirstRowDTO(connection, sql, clazz);
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
private HashMap<String, Object> convertSqlMapToEntityMap(HashMap<String, Object> sqlMap, Class<? extends EntityBase> clazz) {
|
||||
HashMap<String, Object> entityMap = new HashMap<>();
|
||||
for (Map.Entry<String, Object> entry : sqlMap.entrySet()) {
|
||||
String fieldName = entityPropertyHolder.getEntityFields(clazz, f -> f.isSqlField() && f.getSqlField().value().equals(entry.getKey()))
|
||||
.stream()
|
||||
.findFirst()
|
||||
.map(EntityHierarchy.Field::getFieldName)
|
||||
.orElse(entry.getKey());
|
||||
entityMap.put(fieldName, entry.getValue());
|
||||
}
|
||||
return entityMap;
|
||||
}
|
||||
|
||||
|
||||
private boolean isCacheEnabled(IntegryCustomerDB customerDB, String tableName) {
|
||||
return (entityCache.containsKey(customerDB) && entityCache.get(customerDB).containsKey(tableName)) ||
|
||||
!(UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,8 +2,11 @@ package it.integry.ems.javabeans;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.json.ResponseJSONObjectMapper;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.model.IntegryApplicationEnum;
|
||||
import it.integry.ems.settings.Model.SettingsModel;
|
||||
import it.integry.ems.user.dto.UserDTO;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
@@ -138,6 +141,16 @@ public class RequestDataDTO {
|
||||
return profileDB;
|
||||
}
|
||||
|
||||
public IntegryCustomerDB getCustomerDB() {
|
||||
if (UtilityString.isNullOrEmpty(profileDB))
|
||||
return null;
|
||||
|
||||
final SettingsModel settingsModel = ApplicationContextProvider.getApplicationContext().getBean(SettingsModel.class);
|
||||
final String dbName = settingsModel.getDbNameFromProfileDb(profileDB);
|
||||
|
||||
return IntegryCustomerDB.parse(dbName);
|
||||
}
|
||||
|
||||
public Long getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
@@ -75,6 +75,10 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
return UtilityDB.executeSimpleQueryDTO(connection, sql, clazz);
|
||||
}
|
||||
|
||||
protected @NotNull <T> List<T> executeQueryOnlyFirstColumn(String sql) throws SQLException {
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstColumn(connection, sql);
|
||||
}
|
||||
|
||||
protected void executeStatement(String... sqls) throws SQLException {
|
||||
executeStatement(connection, sqls);
|
||||
}
|
||||
@@ -141,6 +145,10 @@ public abstract class BaseMigration implements MigrationModelInterface {
|
||||
}
|
||||
|
||||
private void alterObject(SqlObjectTypeEnum sqlObject, String objectName, String sql) throws SQLException, IOException {
|
||||
if (UtilityString.isNullOrEmpty(objectName)) {
|
||||
throw new IllegalArgumentException("ObjectName in createOrUpdateFunction(), createOrUpdateView(), createOrUpdateTrigger(), createOrUpdateProcedure() cannot be null or empty");
|
||||
}
|
||||
|
||||
executeStatement("IF EXISTS (SELECT * FROM SYSOBJECTS WHERE id = object_id('" + objectName + "'))\r\n" +
|
||||
"\tDROP " + sqlObject.toString() + " " + objectName,
|
||||
sql);
|
||||
|
||||
@@ -8,7 +8,7 @@ public enum IntegryCustomer {
|
||||
IntegryCustomerDB.Agricoper_IlVisone,
|
||||
IntegryCustomerDB.Agricoper_Luva),
|
||||
|
||||
ATI(IntegryCustomerDB.ATI_Finpart),
|
||||
ATI(IntegryCustomerDB.ATI, IntegryCustomerDB.ATI_Finpart),
|
||||
Auricchio(IntegryCustomerDB.Auricchio_Auricchio,
|
||||
IntegryCustomerDB.Auricchio_AuricchioMiki,
|
||||
IntegryCustomerDB.Auricchio_AuricchioSrl,
|
||||
|
||||
@@ -9,7 +9,9 @@ public enum IntegryCustomerDB {
|
||||
Agricoper_IlVisone("ilvisone"),
|
||||
Agricoper_Luva("luva"),
|
||||
|
||||
ATI("atisrl"),
|
||||
ATI_Finpart("Finpart"),
|
||||
|
||||
Auricchio_Auricchio("auricchio"),
|
||||
Auricchio_AuricchioMiki("auricchio_miki"),
|
||||
Auricchio_AuricchioSrl("auricchiosrl"),
|
||||
@@ -31,6 +33,7 @@ public enum IntegryCustomerDB {
|
||||
Carelli_Chiuso("chiuso"),
|
||||
Carelli_Format("format"),
|
||||
Carelli_Murgia("murgia"),
|
||||
Carelli_MurgiaTest("murgia_test"),
|
||||
Carelli_Panimal("panimal"),
|
||||
Carelli_Winact("winact"),
|
||||
Carelli_Csgr("csgr"),
|
||||
@@ -123,6 +126,7 @@ public enum IntegryCustomerDB {
|
||||
Levanplast_Perilflor("perilflor"),
|
||||
Levanplast_PerilflorSrl("perilflorsrl"),
|
||||
Levanplast_Levanplast("levanplast"),
|
||||
Levanplast_Levanplastsrl("levanplastsrl"),
|
||||
|
||||
Maggio_MaggioSrl("maggiosrl"),
|
||||
Maggio_GiovMaggio("giovmaggio"),
|
||||
|
||||
@@ -10,6 +10,8 @@ public class Migration_20251022125946 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("getListinoVendita", "CREATE FUNCTION [dbo].[getListinoVendita](@datavalidita DATETIME, @codvlis VARCHAR(5), @codmart VARCHAR(15))\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251024175524 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"exec DropForeignKey 'ctb_amac', 'mtb_depo_posizioni'",
|
||||
"exec DropForeignKey 'jrl_fase_posizioni', 'mtb_depo_posizioni'",
|
||||
|
||||
@@ -13,6 +13,9 @@ public class Migration_20251027172319 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE [dbo].[mtb_ssfam]("
|
||||
+ " [cod_mgrp] varchar(5) NOT NULL, "
|
||||
|
||||
@@ -14,6 +14,9 @@ public class Migration_20251027173518 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
IndexTableDTO indexTableDTO =
|
||||
new IndexTableDTO()
|
||||
.setTableName("mtb_aart_marchio")
|
||||
|
||||
@@ -10,6 +10,8 @@ public class Migration_20251029153203 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateView("[vw_tracciabUDCVend]", "CREATE VIEW [dbo].[vw_tracciabUDCVend] AS\n" +
|
||||
"SELECT mtb_colt.cod_anag AS codAnag,\n" +
|
||||
|
||||
@@ -10,6 +10,8 @@ public class Migration_20251029170931 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("getDettMatricoleDaOrdine", "CREATE Function [dbo].[getDettMatricoleDaOrdine] (@codJcom varchar(10)) \n" +
|
||||
"RETURNS @dettMatricole TABLE( cod_prod varchar(15),\n" +
|
||||
|
||||
@@ -21,6 +21,9 @@ public class Migration_20251029181607 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"EXEC sp_updateextendedproperty 'MS_Description',\n" +
|
||||
" 'Valori possibili: 0 -> Testo, 1 -> Boolean, 2 -> Intero, 3 -> Decimale, 4 -> Date, 5 -> Datetime, 6 -> Time, 7 -> DropdownList',\n" +
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251031092657 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("alter table dtb_tipi add flag_delete_plk bit not null default 0");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251031100008 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("exec sp_rename 'dtb_tipi.flag_delete_plk', 'flag_delete_pkl'");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251103175252 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"CREATE TABLE mtb_colori ("
|
||||
+ " cod_col varchar(6) NOT NULL, "
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251104122721 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"ALTER TABLE dbo.vtb_offt\n" +
|
||||
" ADD cod_banc VARCHAR(5)\n" +
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251105171403 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("delete dtb_ordr\n" +
|
||||
"from dtb_ordr \n" +
|
||||
"where not exists (select *\n" +
|
||||
|
||||
@@ -11,6 +11,9 @@ public class Migration_20251106104752 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
dropDefault("mtb_lisv", "flag_primario");
|
||||
|
||||
addDefault("mtb_lisv", "flag_primario", 1);
|
||||
|
||||
@@ -10,6 +10,9 @@ public class Migration_20251106113104 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction(
|
||||
"pvm_getassortimentoClientePedane",
|
||||
"CREATE FUNCTION [dbo].[pvm_getassortimentoClientePedane](\n" +
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251110095557 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetup("PVM","MRP", "COD_MDEP_PREF", null, "Inserire la lista dei depositi preselezionati per utente",
|
||||
"COD_MDEP", true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.utility.UtilityQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Migration_20251110100959 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Carelli_Winact))
|
||||
return;
|
||||
|
||||
final List<String> duplicatedBarcodes = executeQueryOnlyFirstColumn("SELECT cod_barre\n" +
|
||||
"FROM mtb_aart_bar_code\n" +
|
||||
"GROUP BY cod_barre\n" +
|
||||
"HAVING COUNT(cod_barre) > 1");
|
||||
|
||||
executeStatement("DELETE FROM dbo.mtb_aart_bar_code\n" +
|
||||
"WHERE cod_barre IN (" + UtilityQuery.concatStringFieldsWithSeparator(duplicatedBarcodes, ",") + ")");
|
||||
|
||||
|
||||
executeStatement("ALTER TABLE dbo.mtb_aart_bar_code\n" +
|
||||
" ALTER COLUMN cod_mart VARCHAR(15) NOT NULL",
|
||||
"ALTER TABLE dbo.mtb_aart_bar_code\n" +
|
||||
" ALTER COLUMN cod_barre VARCHAR(40) NOT NULL",
|
||||
"ALTER TABLE dbo.mtb_aart_bar_code\n" +
|
||||
" ADD CONSTRAINT pk_mtb_aart_bar_code\n" +
|
||||
" PRIMARY KEY (cod_mart, cod_barre)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251110104131 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement(
|
||||
"ALTER TABLE dbo.vtb_viaggi\n" +
|
||||
" ALTER COLUMN note_incoterms VARCHAR(40) NULL;"
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,9 @@ public class Migration_20251110111625 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createSetupQuery(null, null, "SELECT '1|Prezzo netto d''acquisto e ricalcola il prezzo di vendita (Ricarica fissa)' UNION SELECT '2|Prezzo netto d''acquisto e ricalcola ricarica (Prezzo di vendita fisso)' UNION SELECT '3|Prezzo netto d''acquisto e prezzo di vendita da prezzo lordo d''acquisto (Ricalcola ricarica)' UNION SELECT '4|Prezzo netto d''acquisto e ricalcola il prezzo di vendita (Ricarica fissa da Testata listino)' UNION SELECT '5|Prezzo netto d''acquisto, prezzo di vendita e ricarica fissa (Non ricalcolare prezzo)' UNION SELECT '6|Prezzo netto d''acquisto, prezzo di vendita = Prezzo Vendita Suggerito' UNION SELECT '7|Non ricalcolare il prezzo' ");
|
||||
createSetup("VTB_LIST", "LISV4LISA", "CALC_PRZ_BASE", null,
|
||||
"SELEZIONARE IL CRITERIO DI CALCOLO DEL PREZZO BASE", false, null, false, false,
|
||||
|
||||
@@ -0,0 +1,284 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251110175256 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
executeStatement("alter table vtb_list add tipo_um tinyint");
|
||||
createOrUpdateFunction("getListinoVendita","CREATE FUNCTION [dbo].[getListinoVendita](@datavalidita DATETIME, @codvlis VARCHAR(5), @codmart VARCHAR(15))\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN\n" +
|
||||
" SELECT vtb_list.cod_vlis,\n" +
|
||||
" vtb_list.descrizione,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN tmp_list.max_lisv IS NULL THEN NULL\n" +
|
||||
" ELSE CONVERT(DATETIME, LEFT(tmp_list.max_lisv, 10)) END AS data_iniz,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN tmp_list.max_lisv IS NULL THEN NULL\n" +
|
||||
" ELSE CONVERT(INT, RIGHT(tmp_list.max_lisv, 4)) END AS versione,\n" +
|
||||
" vtb_list.cod_divi,\n" +
|
||||
" vtb_list.cambio,\n" +
|
||||
" vtb_list.flag_arr_prz_iva,\n" +
|
||||
" vtb_list.arr_ric,\n" +
|
||||
" vtb_list.flag_list_iva_inclusa,\n" +
|
||||
" vtb_list.flag_lisv_margine,\n" +
|
||||
" vtb_list.flag_add_trasp,\n" +
|
||||
" tmp_list.cod_mart AS 'cod_mart',\n" +
|
||||
" mtb_lisv_data.unt_mis_ven AS unt_mis_ven,\n" +
|
||||
" ISNULL(mtb_lisv_data.rap_conv, 1) AS rap_conv,\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_base, 0) AS prz_base,\n" +
|
||||
" ISNULL(mtb_lisv_data.ricarica, 0) AS ricarico,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_vend IS NOT NULL AND mtb_lisv_data.prz_vend <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend, 0) * 100, 2)\n" +
|
||||
" ELSE 0 END AS margine_eff,\n" +
|
||||
" --dbo.f_calcMargineEffettivo(IsNull(mtb_lisv_data.prz_base, 0), IsNull(mtb_lisv_data.prz_vend, 0), mtb_aart.perc_sfrido) as margine_eff,\n" +
|
||||
" --dbo.f_calcRicaricoEffettivo(IsNull(mtb_lisv_data.prz_base, 0), IsNull(mtb_lisv_data.prz_vend, 0), mtb_aart.perc_sfrido) ricarico_eff, \n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_base IS NOT NULL AND mtb_lisv_data.prz_base <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100)) * 100, 2)\n" +
|
||||
" ELSE 0 END AS ricarico_eff,\n" +
|
||||
"\n" +
|
||||
" ISNULL(mtb_lisv_data.magg_prz_vend, 0) AS magg_prz_vend,\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend, 0) AS prz_vend,\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend_iva, 0) AS prz_vend_iva,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_sco1, 0) AS perc_sco1,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_sco2, 0) AS perc_sco2,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_sco3, 0) AS perc_sco3,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_sco4, 0) AS perc_sco4,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_prov, 0) AS perc_prov,\n" +
|
||||
" ISNULL(mtb_lisv_data.fisso_prov, 0) AS fisso_prov,\n" +
|
||||
" ISNULL(mtb_lisv_data.posizione, '') AS posizione,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_gest, 0) AS perc_gest,\n" +
|
||||
" ISNULL(mtb_lisv_data.val_gest, 0) AS val_gest,\n" +
|
||||
" mtb_lisv_data.data_agg_prz AS data_agg_prz,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_ispe, 0) AS perc_ispe,\n" +
|
||||
" ISNULL(mtb_lisv_data.val_ispe, 0) AS val_ispe,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_promo, 0) AS perc_promo,\n" +
|
||||
" ISNULL(mtb_lisv_data.val_promo, 0) AS val_promo,\n" +
|
||||
" ISNULL(mtb_lisv_data.perc_oneri, 0) AS perc_oneri,\n" +
|
||||
" ISNULL(mtb_lisv_data.val_oneri, 0) AS val_oneri,\n" +
|
||||
" mtb_lisv_data.tipo_variazione AS tipo_variazione,\n" +
|
||||
" mtb_lisv_data.note AS note,\n" +
|
||||
" mtb_lisv_data.aggiornato_da AS aggiornato_da,\n" +
|
||||
" mtb_lisv_data.prz_vend * (1 - mtb_lisv_data.perc_sco1 / 100) * (1 - mtb_lisv_data.perc_sco2 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco3 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco4 / 100) AS prz_vend_netto,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN ISNULL(mtb_lisv_data.colli_pedana, 0) <> 0 THEN mtb_lisv_data.colli_pedana\n" +
|
||||
" ELSE mtb_aart.colli_pedana END AS colli_pedana,\n" +
|
||||
" mtb_lisv_data.cod_tcol_ul AS cod_tcol_ul,\n" +
|
||||
" mtb_lisv_data.cod_tcol_ui AS cod_tcol_ui,\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend_sug, 0) AS prz_vend_sug,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN ISNULL(mtb_lisv_data.qta_cnf, 0) <> 0\n" +
|
||||
" AND dbo.getGestSetup('VTB_LIST', 'SETUP', 'QTA_CNF_LISTINO') = 'S' \n" +
|
||||
" THEN mtb_lisv_data.qta_cnf\n" +
|
||||
" ELSE mtb_aart.qta_cnf / ISNULL(mtb_lisv_data.rap_conv, 1) END AS qta_cnf,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN ISNULL(mtb_lisv_data.colli_strato, 0) <> 0 THEN mtb_lisv_data.colli_strato\n" +
|
||||
" ELSE mtb_aart.colli_strato END AS colli_strato,\n" +
|
||||
" mtb_lisv_data.descrizione_html AS descrizione_html,\n" +
|
||||
" mtb_lisv_data.colli_pedana AS colli_pedana_lisv,\n" +
|
||||
" mtb_lisv_data.qta_cnf AS qta_cnf_lisv,\n" +
|
||||
" mtb_lisv_data.colli_strato AS colli_strato_lisv,\n" +
|
||||
" mtb_lisv_data.sconto_cartoni,\n" +
|
||||
" mtb_lisv_data.sconto_strato,\n" +
|
||||
" mtb_lisv_data.sconto_pedane,\n" +
|
||||
" vtb_list.flag_attivo,\n" +
|
||||
" vtb_list_data.note AS note_testata,\n" +
|
||||
" ISNULL(mtb_lisv_data.flag_prz_bloccato, 'N') AS flag_prz_bloccato,\n" +
|
||||
" vtb_list_data.porto AS porto,\n" +
|
||||
" mtb_lisv_data.system_note,\n" +
|
||||
" mtb_lisv.add_val_spese,\n" +
|
||||
" mtb_lisv.add_ric_spese,\n" +
|
||||
" mtb_lisv.add_sco_spese,\n" +
|
||||
"\t\t\t mtb_aart.flag_incl_listino,\n" +
|
||||
"\t\t\t mtb_lisv.flag_primario,\n" +
|
||||
"\t\t\t mtb_aart.id_art_equi,\n" +
|
||||
"\t\t\t vtb_list.tipo_um\n" +
|
||||
" FROM (SELECT vtb_list.cod_vlis AS cod_vlis,\n" +
|
||||
" mtb_lisv_data.cod_mart,\n" +
|
||||
" MAX(CASE\n" +
|
||||
" WHEN vtb_list_data.versione IS NULL THEN NULL\n" +
|
||||
" ELSE CONVERT(VARCHAR(10), vtb_list_data.data_iniz, 111) + ' ' +\n" +
|
||||
" REPLICATE('0', 5 - LEN(vtb_list_data.versione)) +\n" +
|
||||
" CONVERT(VARCHAR(5), vtb_list_data.versione) END) AS max_lisv,\n" +
|
||||
" vtb_list.cod_vlis AS 'cod_vlis_rif'\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" INNER JOIN mtb_lisv_data ON vtb_list.cod_vlis = mtb_lisv_data.cod_vlis\n" +
|
||||
" LEFT OUTER JOIN vtb_list_data ON mtb_lisv_data.cod_vlis = vtb_list_data.cod_vlis AND\n" +
|
||||
" mtb_lisv_data.versione = vtb_list_data.versione AND\n" +
|
||||
" vtb_list_data.cod_promo IS NULL AND\n" +
|
||||
" vtb_list_data.data_iniz <= ISNULL(@datavalidita, GETDATE())\n" +
|
||||
" WHERE vtb_list.cod_vlis_rif IS NULL\n" +
|
||||
" GROUP BY vtb_list.cod_vlis,\n" +
|
||||
" mtb_lisv_data.cod_mart\n" +
|
||||
" UNION\n" +
|
||||
" SELECT vtb_list.cod_vlis AS cod_vlis,\n" +
|
||||
" mtb_lisv_data.cod_mart,\n" +
|
||||
" MAX(CASE\n" +
|
||||
" WHEN vtb_list_data.versione IS NULL THEN NULL\n" +
|
||||
" ELSE CONVERT(VARCHAR(10), vtb_list_data.data_iniz, 111) + ' ' +\n" +
|
||||
" REPLICATE('0', 5 - LEN(vtb_list_data.versione_rif)) +\n" +
|
||||
" CONVERT(VARCHAR(5), vtb_list_data.versione_rif) END) AS max_lisv,\n" +
|
||||
" vtb_list.cod_vlis_rif AS 'cod_vlis_rif'\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" INNER JOIN vtb_list_data ON vtb_list.cod_vlis = vtb_list_data.cod_vlis\n" +
|
||||
" INNER JOIN vtb_list_data vtb_list_data_rif\n" +
|
||||
" ON vtb_list_data.versione_rif = vtb_list_data_rif.versione AND\n" +
|
||||
" vtb_list_data.cod_vlis_rif = vtb_list_data_rif.cod_vlis\n" +
|
||||
" INNER JOIN mtb_lisv_data ON vtb_list_data_rif.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" vtb_list_data_rif.versione = mtb_lisv_data.versione\n" +
|
||||
"\n" +
|
||||
" WHERE vtb_list_data.data_iniz <= ISNULL(@datavalidita, GETDATE())\n" +
|
||||
" AND vtb_list.cod_vlis_rif IS NOT NULL\n" +
|
||||
" GROUP BY vtb_list.cod_vlis,\n" +
|
||||
" mtb_lisv_data.cod_mart,\n" +
|
||||
" vtb_list.cod_vlis_rif) tmp_list\n" +
|
||||
" INNER JOIN vtb_list ON vtb_list.cod_vlis = tmp_list.cod_vlis\n" +
|
||||
" INNER JOIN mtb_lisv\n" +
|
||||
" ON tmp_list.cod_vlis_rif = mtb_lisv.cod_vlis AND tmp_list.cod_mart = mtb_lisv.cod_mart\n" +
|
||||
" INNER JOIN mtb_aart ON tmp_list.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" LEFT OUTER JOIN mtb_lisv_data ON tmp_list.cod_vlis_rif = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" tmp_list.cod_mart = mtb_lisv_data.cod_mart AND\n" +
|
||||
" CONVERT(INT, RIGHT(tmp_list.max_lisv, 5)) = mtb_lisv_data.versione\n" +
|
||||
" LEFT OUTER JOIN vtb_list_data ON tmp_list.cod_vlis = vtb_list_data.cod_vlis AND\n" +
|
||||
" CONVERT(INT, RIGHT(tmp_list.max_lisv, 5)) = vtb_list_data.versione\n" +
|
||||
"\n" +
|
||||
" WHERE (@codmart IS NULL OR tmp_list.cod_mart = @codmart)\n" +
|
||||
" AND (@codvlis IS NULL OR tmp_list.cod_vlis = @codvlis)\n");
|
||||
|
||||
createOrUpdateFunction("getListinoVenditaPedane","CREATE FUNCTION [dbo].[getListinoVenditaPedane](@datavalidita DATETIME, @codvlis VARCHAR(5), @codmart VARCHAR(15), @pedane INT)\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN\n" +
|
||||
" WITH trasp AS (SELECT mtb_lisv_data_spese.cod_vlis,\n" +
|
||||
" mtb_lisv_data_spese.versione,\n" +
|
||||
" mtb_lisv_data_spese.cod_spes,\n" +
|
||||
" mtb_lisv_data_spese.perc_ricarico,\n" +
|
||||
" mtb_lisv_data_spese.val_ricarico,\n" +
|
||||
" mtb_lisv_data_spese.perc_sconto,\n" +
|
||||
" mtb_lisv_data_spese.da,\n" +
|
||||
" mtb_lisv_data_spese.a\n" +
|
||||
" FROM vtb_list_data\n" +
|
||||
" --riga Sotto Aggiunta da Massimo 08/01/25 per non fare uscire i range pedane quando il prezzo non deve essere addizionato del costo dei trasporti\n" +
|
||||
" --inner join vtb_list on vtb_list_data.cod_vlis = vtb_list.cod_vlis and vtb_list.flag_add_trasp = 1\n" +
|
||||
" INNER JOIN mtb_lisv_data_spese\n" +
|
||||
" ON vtb_list_data.cod_vlis = mtb_lisv_data_spese.cod_vlis AND\n" +
|
||||
" vtb_list_data.versione = mtb_lisv_data_spese.versione\n" +
|
||||
" CROSS APPLY (SELECT MAX(id_listino) AS max_id_listino\n" +
|
||||
" FROM vtb_list_data t\n" +
|
||||
" WHERE t.data_iniz <= ISNULL(@datavalidita, CAST(GETDATE() AS DATE))\n" +
|
||||
" AND vtb_list_data.cod_vlis = t.cod_vlis) max_lisv\n" +
|
||||
" WHERE vtb_list_data.id_listino = max_lisv.max_id_listino)\n" +
|
||||
"\n" +
|
||||
" SELECT list.cod_vlis,\n" +
|
||||
" list.descrizione,\n" +
|
||||
" list.data_iniz,\n" +
|
||||
" list.versione,\n" +
|
||||
" list.cod_divi,\n" +
|
||||
" list.cambio,\n" +
|
||||
" list.flag_arr_prz_iva,\n" +
|
||||
" list.arr_ric,\n" +
|
||||
" list.flag_list_iva_inclusa,\n" +
|
||||
" list.flag_lisv_margine,\n" +
|
||||
" list.flag_add_trasp,\n" +
|
||||
" list.cod_mart,\n" +
|
||||
" list.unt_mis_ven,\n" +
|
||||
" list.rap_conv,\n" +
|
||||
" list.prz_base,\n" +
|
||||
" list.ricarico,\n" +
|
||||
" list.margine_eff,\n" +
|
||||
" list.ricarico_eff,\n" +
|
||||
" list.magg_prz_vend,\n" +
|
||||
" list.prz_vend,\n" +
|
||||
" list.prz_vend_iva,\n" +
|
||||
" list.perc_sco1,\n" +
|
||||
" list.perc_sco2,\n" +
|
||||
" list.perc_sco3,\n" +
|
||||
" list.perc_sco4,\n" +
|
||||
" list.perc_prov,\n" +
|
||||
" list.fisso_prov,\n" +
|
||||
" list.posizione,\n" +
|
||||
" list.perc_gest,\n" +
|
||||
" list.val_gest,\n" +
|
||||
" list.data_agg_prz,\n" +
|
||||
" list.perc_ispe,\n" +
|
||||
" list.val_ispe,\n" +
|
||||
" list.perc_promo,\n" +
|
||||
" list.val_promo,\n" +
|
||||
" list.perc_oneri,\n" +
|
||||
" list.val_oneri,\n" +
|
||||
" list.tipo_variazione,\n" +
|
||||
" list.note,\n" +
|
||||
" list.aggiornato_da,\n" +
|
||||
" list.prz_vend_netto,\n" +
|
||||
" list.colli_pedana,\n" +
|
||||
" list.cod_tcol_ul,\n" +
|
||||
" list.cod_tcol_ui,\n" +
|
||||
" list.prz_vend_sug,\n" +
|
||||
" list.qta_cnf,\n" +
|
||||
" list.colli_strato,\n" +
|
||||
" list.descrizione_html,\n" +
|
||||
" list.colli_pedana_lisv,\n" +
|
||||
" list.qta_cnf_lisv,\n" +
|
||||
" list.colli_strato_lisv,\n" +
|
||||
" list.sconto_cartoni,\n" +
|
||||
" list.sconto_strato,\n" +
|
||||
" list.sconto_pedane,\n" +
|
||||
" list.flag_attivo,\n" +
|
||||
" list.note_testata,\n" +
|
||||
" list.flag_prz_bloccato,\n" +
|
||||
" list.porto,\n" +
|
||||
" list.system_note,\n" +
|
||||
" list.add_val_spese,\n" +
|
||||
" list.add_ric_spese,\n" +
|
||||
" list.add_sco_spese,\n" +
|
||||
" list.flag_incl_listino,\n" +
|
||||
" list.flag_primario,\n" +
|
||||
" list.id_art_equi,\n" +
|
||||
" trasp.cod_spes,\n" +
|
||||
" trasp.perc_ricarico,\n" +
|
||||
" trasp.val_ricarico,\n" +
|
||||
" trasp.perc_sconto,\n" +
|
||||
" trasp.da,\n" +
|
||||
" trasp.a,\n" +
|
||||
" (list.prz_vend +\n" +
|
||||
" IIF(list.flag_add_trasp = 1, --Questa condizione si potrebbe togliere per la modifica fatta l'8/01/25\n" +
|
||||
" ((ISNULL(val_ricarico, 0)) * list.add_val_spese) /\n" +
|
||||
" IIF(ISNULL(list.colli_pedana, 1) = 0, 1, list.colli_pedana), 0)) +\n" +
|
||||
" ((ISNULL(perc_ricarico, 0) * list.add_ric_spese * list.prz_vend) / 100) *\n" +
|
||||
" (1 - (ISNULL(perc_sconto, 0) * list.add_sco_spese) / 100) prz_vend_trasp,\n" +
|
||||
" ((list.prz_vend +\n" +
|
||||
" IIF(list.flag_add_trasp = 1, --Questa condizione si potrebbe togliere per la modifica fatta l'8/01/25\n" +
|
||||
" ((ISNULL(val_ricarico, 0)) * list.add_val_spese) /\n" +
|
||||
" IIF(ISNULL(list.colli_pedana, 1) = 0, 1, list.colli_pedana), 0)) +\n" +
|
||||
" ((ISNULL(perc_ricarico, 0) * list.add_ric_spese * list.prz_vend) / 100) *\n" +
|
||||
" (1 - (ISNULL(perc_sconto, 0) * list.add_sco_spese) / 100)) * (1 - list.perc_sco1 / 100) *\n" +
|
||||
" (1 - list.perc_sco2 / 100) *\n" +
|
||||
" (1 - list.perc_sco3 / 100) *\n" +
|
||||
" (1 - list.perc_sco4 / 100) AS prz_vend_trasp_netto,\n" +
|
||||
"\t\t\t list.tipo_um\n" +
|
||||
" FROM getlistinovendita(@datavalidita, @codvlis, @codmart) list\n" +
|
||||
" LEFT OUTER JOIN trasp ON list.cod_vlis = trasp.cod_vlis AND\n" +
|
||||
" (@pedane IS NULL OR @pedane BETWEEN da AND a OR\n" +
|
||||
" (@pedane IS NOT NULL AND da = 0 AND a = 0))");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
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.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251111110443 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isCustomer(IntegryCustomer.Salpar)){
|
||||
executeStatement("INSERT INTO stb_tipi_indirizzi\n" +
|
||||
"VALUES ('PUNTO VENDITA', 'ABRW'),\n" +
|
||||
" ('PUNTO VENDITA', 'ABTW'),\n" +
|
||||
" ('PUNTO VENDITA', 'BAMW'),\n" +
|
||||
" ('PUNTO VENDITA', 'BATW')");
|
||||
|
||||
executeStatement("UPDATE vtb_clie_pers_rif\n" +
|
||||
"SET tipo_indirizzo = 'PUNTO VENDITA'\n" +
|
||||
"WHERE tipo_indirizzo = 'UFFICIO ACQUISTI'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251111120322 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction(
|
||||
"pvm_getassortimentoCliente",
|
||||
"CREATE FUNCTION [dbo].[pvm_getassortimentoCliente](\n" +
|
||||
" @codAnag VARCHAR(5), @codVlis VARCHAR(5), @codVdes VARCHAR(5), @dataValidita DATETIME, @viewPromo BIT\n" +
|
||||
")\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN(SELECT cod_mart,\n" +
|
||||
" cod_mart_anag,\n" +
|
||||
" cod_vlis,\n" +
|
||||
" data_iniz,\n" +
|
||||
" data_fine,\n" +
|
||||
" da,\n" +
|
||||
" a,\n" +
|
||||
" prz_vend,\n" +
|
||||
" prz_vend_netto,\n" +
|
||||
" perc_sco1,\n" +
|
||||
" perc_sco2,\n" +
|
||||
" perc_sco3,\n" +
|
||||
" perc_sco4,\n" +
|
||||
" perc_prov,\n" +
|
||||
" qta_residua,\n" +
|
||||
" id_contratto,\n" +
|
||||
" rap_conv,\n" +
|
||||
" note,\n" +
|
||||
" cod_tcol_ul,\n" +
|
||||
" unt_mis_ven,\n" +
|
||||
" colli_pedana,\n" +
|
||||
" tipo_variazione,\n" +
|
||||
" tipo_promo,\n" +
|
||||
" cod_paga,\n" +
|
||||
" descr_paga,\n" +
|
||||
" porto,\n" +
|
||||
" qta_cnf,\n" +
|
||||
" art_lisv,\n" +
|
||||
" cod_vdes,\n" +
|
||||
" note_incoterms,\n" +
|
||||
" data_rif_scad,\n" +
|
||||
" note_carico,\n" +
|
||||
" term_cons,\n" +
|
||||
" cod_banc,\n" +
|
||||
" descr_banc,\n" +
|
||||
" flag_primario\n" +
|
||||
" FROM [dbo].pvm_getassortimentoClientePedane(\n" +
|
||||
" @codAnag, @codVlis, @codVdes, @dataValidita, @viewPromo,\n" +
|
||||
" DEFAULT))"
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251111151102 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
|
||||
return;
|
||||
|
||||
createSetup("W_VEDI_DESADV_DLG", "SETUP", "VERSIONE_C2835", "20",
|
||||
null, false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
createSetup("W_VEDI_DESADV_DLG", "SETUP", "DTM_C2835", "137",
|
||||
"Qualificatore data ora riferimento (Data documento), per default è impostato a 2", false, null, false, false,
|
||||
false, false, false, null, false, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
import it.integry.ems_model.entity.JtbCiclCq;
|
||||
import it.integry.ems_model.entity._enum.TipoValore;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityInteger;
|
||||
import it.integry.ems_model.utility.UtilityList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Migration_20251111170814 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
|
||||
return;
|
||||
|
||||
|
||||
String sql = "select distinct jtb_cicl.cod_prod,MAX(jtb_cicl_cq.num_fase) as num_fase,max(jtb_cicl_cq.id_riga) as id_riga\n" +
|
||||
"from jtb_dist_clav_dir dir\n" +
|
||||
" inner join jtb_cicl on dir.cod_prod = jtb_cicl.cod_prod\n" +
|
||||
" left outer join jtb_cicl_cq on jtb_cicl.cod_prod = jtb_cicl_cq.cod_prod\n" +
|
||||
"where dir.cod_jfas like 'SC%'\n" +
|
||||
" and jtb_cicl.flag_attiva = 'S'\n" +
|
||||
"group by jtb_cicl.cod_prod";
|
||||
|
||||
List<JtbCiclCq> distinteDaAggiornare = UtilityDB.executeSimpleQueryDTO(connection, sql, JtbCiclCq.class);
|
||||
if (UtilityList.isNullOrEmpty(distinteDaAggiornare))
|
||||
return;
|
||||
|
||||
for (JtbCiclCq jtbCiclCq : distinteDaAggiornare) {
|
||||
jtbCiclCq.setIdRiga(UtilityInteger.isNull(jtbCiclCq.getIdRiga(),0) + 1)
|
||||
.setNumFase(UtilityInteger.isNull(jtbCiclCq.getNumFase(),0))
|
||||
.setControllo("Check Etichetta Cartone")
|
||||
.setTipoValore(TipoValore.BOOLEAN)
|
||||
.setValoreRif("S")
|
||||
.setNumRip(0)
|
||||
.setTipologia("DETAILED_CQ")
|
||||
.setOperation(OperationType.INSERT);
|
||||
|
||||
jtbCiclCq.manageWithParentConnection(connection);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251111171747 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("lisv_getTipoUm", "CREATE FUNCTION dbo.lisv_getTipoUm\n" +
|
||||
"( \n" +
|
||||
" @codMart varchar(15), @tipoUmLisv tinyint\n" +
|
||||
")\n" +
|
||||
"RETURNS TABLE \n" +
|
||||
"AS\n" +
|
||||
"RETURN \n" +
|
||||
"(\n" +
|
||||
" with um as (\n" +
|
||||
"select cod_mart, unt_mis, rap_conv\n" +
|
||||
"from dbo.getUntMisArticolo(@codMart, null ) um\n" +
|
||||
"where @tipoUmLisv is not null\n" +
|
||||
"and ( (@tipoUmLisv = 1 and um.tipo_um = 'UI' ) or \n" +
|
||||
"(@tipoUmLisv = 2 and flag_unita_kg = 'S'))\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"select mtb_aart.cod_mart, \n" +
|
||||
"case \n" +
|
||||
"when @tipoUmLisv IS null then mtb_aart.unt_mis\n" +
|
||||
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf not in (0, 1) then mtb_aart.unt_mis\n" +
|
||||
"when @tipoUmLisv = 2 and mtb_aart.peso_kg not in (0, 1) then mtb_aart.unt_mis\n" +
|
||||
" else ISNULL(um.unt_mis, mtb_aart.unt_mis) end as unt_mis_ven, \n" +
|
||||
"case \n" +
|
||||
"when @tipoUmLisv IS null then 1\n" +
|
||||
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf not in (0, 1) then 1\n" +
|
||||
"when @tipoUmLisv = 2 and mtb_aart.peso_kg not in (0, 1) then 1\n" +
|
||||
" else ISNULL(um.rap_conv, 1) end as rap_conv_vend\n" +
|
||||
"from mtb_aart left outer join um on mtb_aart.cod_mart = um.cod_mart\n" +
|
||||
"where (@codMart is null or mtb_aart.cod_mart = @codMart )\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_20251113102040 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE vtb_list_data ADD promo_chiusa bit DEFAULT 0 NOT NULL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251113105159 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("exec sp_rename 'vtb_list_data.promo_chiusa', 'chiusura_immediata'");
|
||||
|
||||
|
||||
createOrUpdateFunction("getPromozioneVendita", "CREATE FUNCTION [dbo].[getPromozioneVendita](@dataIniz DATETIME, @dataFine DATETIME, @codVlis VARCHAR(5),\n" +
|
||||
" @codPromo VARCHAR(10), @codMart VARCHAR(15))\n" +
|
||||
" RETURNS TABLE AS\n" +
|
||||
" RETURN\n" +
|
||||
" SELECT vtb_list.cod_vlis,\n" +
|
||||
" vtb_list.descrizione,\n" +
|
||||
" vtb_list_data.data_iniz,\n" +
|
||||
" vtb_list_data.data_fine,\n" +
|
||||
" vtb_list_data.cod_promo,\n" +
|
||||
" vtb_list_data.versione,\n" +
|
||||
" vtb_list.cod_divi,\n" +
|
||||
" vtb_list.flag_arr_prz_iva,\n" +
|
||||
" vtb_list.arr_ric,\n" +
|
||||
" vtb_list.flag_list_iva_inclusa,\n" +
|
||||
" vtb_list.flag_lisv_margine,\n" +
|
||||
" mtb_lisv_data.cod_mart AS cod_mart,\n" +
|
||||
" mtb_lisv_data.unt_mis_ven AS unt_mis_ven,\n" +
|
||||
" mtb_lisv_data.rap_conv AS rap_conv,\n" +
|
||||
" mtb_lisv_data.prz_base AS prz_base,\n" +
|
||||
" mtb_lisv_data.ricarica AS ricarico,\n" +
|
||||
" --dbo.f_calcMargineEffettivo(mtb_lisv_data.prz_base, mtb_lisv_data.prz_vend, mtb_aart.perc_sfrido) as margine_eff,\n" +
|
||||
" --dbo.f_calcRicaricoEffettivo(mtb_lisv_data.prz_base, mtb_lisv_data.prz_vend, mtb_aart.perc_sfrido) as ricarico_eff, \n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_vend IS NOT NULL AND mtb_lisv_data.prz_vend <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend, 0) * 100, 2)\n" +
|
||||
" ELSE 0 END AS margine_eff,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_base IS NOT NULL AND mtb_lisv_data.prz_base <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100)) * 100, 2)\n" +
|
||||
" ELSE 0 END AS ricarico_eff,\n" +
|
||||
" mtb_lisv_data.prz_vend AS prz_vend,\n" +
|
||||
" mtb_lisv_data.prz_vend_iva AS prz_vend_iva,\n" +
|
||||
" mtb_lisv_data.perc_sco1 AS perc_sco1,\n" +
|
||||
" mtb_lisv_data.perc_sco2 AS perc_sco2,\n" +
|
||||
" mtb_lisv_data.perc_sco3 AS perc_sco3,\n" +
|
||||
" mtb_lisv_data.perc_sco4 AS perc_sco4,\n" +
|
||||
" mtb_lisv_data.perc_prov AS perc_prov,\n" +
|
||||
" mtb_lisv_data.fisso_prov AS fisso_prov,\n" +
|
||||
" mtb_lisv_data.posizione AS posizione,\n" +
|
||||
" mtb_lisv_data.perc_gest AS perc_gest,\n" +
|
||||
" mtb_lisv_data.val_gest AS val_gest,\n" +
|
||||
" mtb_lisv_data.data_agg_prz AS data_agg_prz,\n" +
|
||||
" mtb_lisv_data.perc_ispe AS perc_ispe,\n" +
|
||||
" mtb_lisv_data.val_ispe AS val_ispe,\n" +
|
||||
" mtb_lisv_data.perc_promo AS perc_promo,\n" +
|
||||
" mtb_lisv_data.val_promo AS val_promo,\n" +
|
||||
" mtb_lisv_data.perc_oneri AS perc_oneri,\n" +
|
||||
" mtb_lisv_data.val_oneri AS val_oneri,\n" +
|
||||
" mtb_lisv_data.tipo_variazione AS tipo_variazione,\n" +
|
||||
" mtb_lisv_data.note AS note,\n" +
|
||||
" mtb_lisv_data.aggiornato_da AS aggiornato_da,\n" +
|
||||
" mtb_lisv_data.prz_vend * (1 - mtb_lisv_data.perc_sco1 / 100) * (1 - mtb_lisv_data.perc_sco2 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco3 / 100) * (1 - mtb_lisv_data.perc_sco4 / 100) AS prz_vend_netto,\n" +
|
||||
" vtb_promo.descrizione AS 'descr_promo',\n" +
|
||||
" vtb_promo.data_iniz_sell_out,\n" +
|
||||
" vtb_promo.data_fine_sell_out,\n" +
|
||||
" vtb_promo.flag_tipo_promo,\n" +
|
||||
" mtb_lisv_data.sconto_cartoni,\n" +
|
||||
" mtb_lisv_data.sconto_strato,\n" +
|
||||
" mtb_lisv_data.sconto_pedane,\n" +
|
||||
" mtb_lisv_data.giacenza,\n" +
|
||||
" mtb_lisv_data.magg_prz_vend,\n" +
|
||||
" vtb_promo.flag_sconto_contrattuale,\n" +
|
||||
" vtb_promo.intercode_xml_variazioni,\n" +
|
||||
" vtb_list_data.note AS note_testata,\n" +
|
||||
" vtb_promo.flag_tipologia,\n" +
|
||||
" vtb_promo.flag_volantino,\n" +
|
||||
" mtb_lisv_data.inserito_da,\n" +
|
||||
" vtb_list_data.chiusura_immediata\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" INNER JOIN vtb_list_data ON vtb_list.cod_vlis = vtb_list_data.cod_vlis\n" +
|
||||
" INNER JOIN mtb_lisv_data ON vtb_list_data.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" vtb_list_data.versione = mtb_lisv_data.versione\n" +
|
||||
" INNER JOIN mtb_aart ON mtb_lisv_data.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" INNER JOIN vtb_promo ON vtb_list_data.cod_promo = vtb_promo.cod_promo\n" +
|
||||
" OUTER APPLY (SELECT COUNT(*) AS conta\n" +
|
||||
" FROM vtb_list_data rif\n" +
|
||||
" WHERE vtb_list_data.cod_vlis = rif.cod_vlis_rif\n" +
|
||||
" AND vtb_list_data.versione = rif.versione) list_rif\n" +
|
||||
" WHERE (@codMart IS NULL OR mtb_lisv_data.cod_mart = @codMart)\n" +
|
||||
" AND (@codvlis IS NULL OR vtb_list_data.cod_vlis = @codVlis)\n" +
|
||||
" AND vtb_list.cod_vlis_rif IS NULL\n" +
|
||||
" AND (@codPromo IS NULL OR vtb_list_data.cod_promo = @codPromo)\n" +
|
||||
" AND (((@dataFine IS NULL OR ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) = @dataFine) AND\n" +
|
||||
" ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine) OR\n" +
|
||||
" (@dataFine IS NOT NULL AND ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) <> @dataFine AND\n" +
|
||||
" (vtb_list_data.data_iniz BETWEEN ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) AND @dataFine OR\n" +
|
||||
" vtb_list_data.data_fine BETWEEN ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) AND @dataFine OR\n" +
|
||||
" ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine OR\n" +
|
||||
" @dataFine BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine)))\n" +
|
||||
" AND (vtb_promo.flag_sconto_contrattuale = 'N' OR\n" +
|
||||
" (vtb_promo.flag_sconto_contrattuale = 'S' AND list_rif.conta = 0))\n" +
|
||||
" UNION\n" +
|
||||
" SELECT vtb_list.cod_vlis,\n" +
|
||||
" vtb_list.descrizione,\n" +
|
||||
" vtb_list_data.data_iniz,\n" +
|
||||
" vtb_list_data.data_fine,\n" +
|
||||
" vtb_list_data.cod_promo,\n" +
|
||||
" vtb_list_data.versione,\n" +
|
||||
" vtb_list.cod_divi,\n" +
|
||||
" vtb_list.flag_arr_prz_iva,\n" +
|
||||
" vtb_list.arr_ric,\n" +
|
||||
" vtb_list.flag_list_iva_inclusa,\n" +
|
||||
" vtb_list.flag_lisv_margine,\n" +
|
||||
" mtb_lisv_data.cod_mart AS cod_mart,\n" +
|
||||
" mtb_lisv_data.unt_mis_ven AS unt_mis_ven,\n" +
|
||||
" mtb_lisv_data.rap_conv AS rap_conv,\n" +
|
||||
" mtb_lisv_data.prz_base AS prz_base,\n" +
|
||||
" mtb_lisv_data.ricarica AS ricarico,\n" +
|
||||
" --dbo.f_calcMargineEffettivo(mtb_lisv_data.prz_base, mtb_lisv_data.prz_vend, mtb_aart.perc_sfrido) as margine_eff,\n" +
|
||||
" --dbo.f_calcRicaricoEffettivo(mtb_lisv_data.prz_base, mtb_lisv_data.prz_vend, mtb_aart.perc_sfrido) as ricarico_eff, \n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_vend IS NOT NULL AND mtb_lisv_data.prz_vend <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" ISNULL(mtb_lisv_data.prz_vend, 0) * 100, 2)\n" +
|
||||
" ELSE 0 END AS margine_eff,\n" +
|
||||
" CASE\n" +
|
||||
" WHEN mtb_lisv_data.prz_base IS NOT NULL AND mtb_lisv_data.prz_base <> 0 THEN\n" +
|
||||
" ROUND((ISNULL(mtb_lisv_data.prz_vend, 0) -\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100))) /\n" +
|
||||
" (ISNULL(mtb_lisv_data.prz_base, 0) / (1 - mtb_aart.perc_sfrido / 100)) * 100, 2)\n" +
|
||||
" ELSE 0 END AS ricarico_eff,\n" +
|
||||
" mtb_lisv_data.prz_vend AS prz_vend,\n" +
|
||||
" mtb_lisv_data.prz_vend_iva AS prz_vend_iva,\n" +
|
||||
" mtb_lisv_data.perc_sco1 AS perc_sco1,\n" +
|
||||
" mtb_lisv_data.perc_sco2 AS perc_sco2,\n" +
|
||||
" mtb_lisv_data.perc_sco3 AS perc_sco3,\n" +
|
||||
" mtb_lisv_data.perc_sco4 AS perc_sco4,\n" +
|
||||
" mtb_lisv_data.perc_prov AS perc_prov,\n" +
|
||||
" mtb_lisv_data.fisso_prov AS fisso_prov,\n" +
|
||||
" mtb_lisv_data.posizione AS posizione,\n" +
|
||||
" mtb_lisv_data.perc_gest AS perc_gest,\n" +
|
||||
" mtb_lisv_data.val_gest AS val_gest,\n" +
|
||||
" mtb_lisv_data.data_agg_prz AS data_agg_prz,\n" +
|
||||
" mtb_lisv_data.perc_ispe AS perc_ispe,\n" +
|
||||
" mtb_lisv_data.val_ispe AS val_ispe,\n" +
|
||||
" mtb_lisv_data.perc_promo AS perc_promo,\n" +
|
||||
" mtb_lisv_data.val_promo AS val_promo,\n" +
|
||||
" mtb_lisv_data.perc_oneri AS perc_oneri,\n" +
|
||||
" mtb_lisv_data.val_oneri AS val_oneri,\n" +
|
||||
" mtb_lisv_data.tipo_variazione AS tipo_variazione,\n" +
|
||||
" mtb_lisv_data.note AS note,\n" +
|
||||
" mtb_lisv_data.aggiornato_da AS aggiornato_da,\n" +
|
||||
" mtb_lisv_data.prz_vend * (1 - mtb_lisv_data.perc_sco1 / 100) * (1 - mtb_lisv_data.perc_sco2 / 100) *\n" +
|
||||
" (1 - mtb_lisv_data.perc_sco3 / 100) * (1 - mtb_lisv_data.perc_sco4 / 100) AS prz_vend_netto,\n" +
|
||||
" vtb_promo.descrizione AS 'descr_promo',\n" +
|
||||
" vtb_promo.data_iniz_sell_out,\n" +
|
||||
" vtb_promo.data_fine_sell_out,\n" +
|
||||
" vtb_promo.flag_tipo_promo,\n" +
|
||||
" mtb_lisv_data.sconto_cartoni,\n" +
|
||||
" mtb_lisv_data.sconto_strato,\n" +
|
||||
" mtb_lisv_data.sconto_pedane,\n" +
|
||||
" mtb_lisv_data.giacenza,\n" +
|
||||
" mtb_lisv_data.magg_prz_vend,\n" +
|
||||
" vtb_promo.flag_sconto_contrattuale,\n" +
|
||||
" vtb_promo.intercode_xml_variazioni,\n" +
|
||||
" vtb_list_data.note AS note_testata,\n" +
|
||||
" vtb_promo.flag_tipologia,\n" +
|
||||
" vtb_promo.flag_volantino,\n" +
|
||||
" mtb_lisv_data.inserito_da,\n" +
|
||||
" vtb_list_data_rif.chiusura_immediata\n" +
|
||||
" FROM vtb_list\n" +
|
||||
" INNER JOIN vtb_list_data ON vtb_list.cod_vlis = vtb_list_data.cod_vlis\n" +
|
||||
" INNER JOIN vtb_list_data vtb_list_data_rif\n" +
|
||||
" ON vtb_list_data.cod_vlis_rif = vtb_list_data_rif.cod_vlis AND\n" +
|
||||
" vtb_list_data.versione_rif = vtb_list_data_rif.versione\n" +
|
||||
" INNER JOIN mtb_lisv_data ON vtb_list_data_rif.cod_vlis = mtb_lisv_data.cod_vlis AND\n" +
|
||||
" vtb_list_data_rif.versione = mtb_lisv_data.versione\n" +
|
||||
" INNER JOIN mtb_aart ON mtb_lisv_data.cod_mart = mtb_aart.cod_mart\n" +
|
||||
" INNER JOIN vtb_promo ON vtb_list_data_rif.cod_promo = vtb_promo.cod_promo\n" +
|
||||
" WHERE (@codMart IS NULL OR mtb_lisv_data.cod_mart = @codMart)\n" +
|
||||
" AND (@codvlis IS NULL OR vtb_list_data.cod_vlis = @codVlis)\n" +
|
||||
" AND (@codPromo IS NULL OR vtb_list_data.cod_promo = @codPromo)\n" +
|
||||
" AND (((@dataFine IS NULL OR ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) = @dataFine) AND\n" +
|
||||
" ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine) OR\n" +
|
||||
" (@dataFine IS NOT NULL AND ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) <> @dataFine AND\n" +
|
||||
" (vtb_list_data.data_iniz BETWEEN ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) AND @dataFine OR\n" +
|
||||
" vtb_list_data.data_fine BETWEEN ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) AND @dataFine OR\n" +
|
||||
" ISNULL(@dataIniz, CAST(GETDATE() AS DATE)) BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine OR\n" +
|
||||
" @dataFine BETWEEN vtb_list_data.data_iniz AND vtb_list_data.data_fine)))");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251113122313 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("lisv_getTipoUm", "CREATE FUNCTION [dbo].[lisv_getTipoUm]\n" +
|
||||
"(\t\n" +
|
||||
"\t@codMart varchar(15), @tipoUmLisv tinyint\n" +
|
||||
")\n" +
|
||||
"RETURNS TABLE \n" +
|
||||
"AS\n" +
|
||||
"RETURN \n" +
|
||||
"(\n" +
|
||||
"\twith um as (\n" +
|
||||
"select cod_mart, unt_mis, rap_conv\n" +
|
||||
"from dbo.getUntMisArticolo(@codMart, null ) um\n" +
|
||||
"where @tipoUmLisv is not null\n" +
|
||||
"and ( (@tipoUmLisv = 1 and um.tipo_um = 'UI' ) or \n" +
|
||||
"(@tipoUmLisv = 2 and flag_unita_kg = 'S'))\n" +
|
||||
")\n" +
|
||||
"\n" +
|
||||
"select mtb_aart.cod_mart, \n" +
|
||||
"case \n" +
|
||||
"when @tipoUmLisv IS null then mtb_aart.unt_mis\n" +
|
||||
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf in (0, 1) then mtb_aart.unt_mis\n" +
|
||||
"when @tipoUmLisv = 2 and mtb_aart.peso_kg in (0, 1) then mtb_aart.unt_mis\n" +
|
||||
"\telse ISNULL(um.unt_mis, mtb_aart.unt_mis) end as unt_mis_ven, \n" +
|
||||
"case \n" +
|
||||
"when @tipoUmLisv IS null then 1\n" +
|
||||
"when @tipoUmLisv = 1 and mtb_aart.qta_cnf in (0, 1) then 1\n" +
|
||||
"when @tipoUmLisv = 2 and mtb_aart.peso_kg in (0, 1) then 1\n" +
|
||||
"\telse ISNULL(um.rap_conv, 1) end as rap_conv_vend\n" +
|
||||
"from mtb_aart left outer join um on mtb_aart.cod_mart = um.cod_mart\n" +
|
||||
"where (@codMart is null or mtb_aart.cod_mart = @codMart )\n" +
|
||||
")");
|
||||
|
||||
executeStatement("alter table mtb_var_lisv_log alter column versione int null");
|
||||
}
|
||||
|
||||
@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_20251113170159 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE wdtb_doct ADD merce_ricevuta BIT DEFAULT 0 NOT NULL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251114114334 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
|
||||
executeStatement("ALTER TABLE ctb_amac DROP COLUMN cod_mdep;");
|
||||
}
|
||||
|
||||
@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_20251114150912 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE jtb_comt ADD data_mod DATETIME");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251114163222 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
executeStatement("ALTER TABLE vtb_dest ADD data_mod DATETIME");
|
||||
executeStatement("ALTER TABLE ptb_pros ADD data_mod DATETIME");
|
||||
executeStatement("ALTER TABLE ptb_pros_rif ADD data_mod DATETIME");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251117142928 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("W_jriep_presenze_dip_disp", "SETUP", "SET_DATA_FINE", "N",
|
||||
"imposta data fine = fine mese", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
|
||||
if (isCustomer(IntegryCustomer.Integry))
|
||||
updateSetupValue("W_jriep_presenze_dip_disp", "SETUP", "SET_DATA_FINE", "S");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20251117170957 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Gramm_Gramm))
|
||||
return;
|
||||
|
||||
executeStatement("update stb_gest_setup set value = 'S' where gest_name = 'DTB_ORDT' and key_section in ('NUOVA_PROCEDURA','DISABLE_TRIGGER_ORDL')");
|
||||
executeStatement("update stb_gest_sync set syncronize = 'R' where gest_name like 'lord%'");
|
||||
executeStatement("update stb_gest_sync set syncronize = 'R' where gest_name like 'pord%'");
|
||||
executeStatement("insert into stb_abil \n" +
|
||||
"select case when gest_name = 'lordi' then 'LG081' else 'AG031' end , user_name, 'S', case when gest_name = 'lordi' then 'lordi_tab' else 'pordi_tab' end from stb_abil \n" +
|
||||
"where gest_name in ('lordi','pordi') and case when gest_name = 'lordi' then 'LG081' else 'AG031' end + user_name not in (select cod_opz + user_name from stb_abil where cod_opz in ('LG081','AG031'))");
|
||||
executeStatement("update stb_abil set flag_abil = 'N' where gest_name in ('lordi','pordi')");
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class AccountingBusinessLogic {
|
||||
.setCodAnag(ctbMovt.getCodAnag())
|
||||
.setCodVage(ctbMovt.getCodVage())
|
||||
.setAnnoPart(annoPart)
|
||||
.setDataDoc(ctbMovt.getDataDoc())
|
||||
.setDataDoc(UtilityLocalDate.localDateFromDate(ctbMovt.getDataDoc()))
|
||||
.setSerDoc(ctbMovt.getSerDoc())
|
||||
.setNumDoc(ctbMovt.getNumDoc())
|
||||
.setCodDiviCont(ctbMovt.getCodDiviCont())
|
||||
@@ -120,7 +120,7 @@ public class AccountingBusinessLogic {
|
||||
"Convert(numeric(20,5), importo_enasarco * cambio_divi_cont) as importo_enasarco " +
|
||||
" FROM ctb_rit_acc " +
|
||||
" WHERE num_cmov_fat = " + UtilityDB.valueToString(testata.getNumCmov()) + " AND " +
|
||||
" data_doc = " + UtilityDB.valueDateToString(testata.getDataDoc(), CommonConstants.DATE_FORMAT_YMD) + " AND " +
|
||||
" data_doc = " + UtilityDB.valueToString(testata.getDataDoc()) + " AND " +
|
||||
" ser_doc = " + UtilityDB.valueToString(testata.getSerDoc()) + " AND " +
|
||||
" num_doc = " + UtilityDB.valueToString(testata.getNumDoc());
|
||||
|
||||
@@ -142,7 +142,7 @@ public class AccountingBusinessLogic {
|
||||
.setAnnoPart(annoPart)
|
||||
.setSerDoc(testata.getSerDoc())
|
||||
.setNumDoc(testata.getNumDoc())
|
||||
.setDataScad(testata.getDataDoc());
|
||||
.setDataScad(UtilityLocalDate.localDateFromDate(testata.getDataDoc()));
|
||||
if (testata.getTipoPartitaEnum() == TipoPartita.ATTIVA) {
|
||||
ctbScad.setImpDare(ritenuta);
|
||||
ctbScad.setImpAvere(BigDecimal.ZERO);
|
||||
@@ -166,7 +166,7 @@ public class AccountingBusinessLogic {
|
||||
.setAnnoPart(annoPart)
|
||||
.setSerDoc(testata.getSerDoc())
|
||||
.setNumDoc(testata.getNumDoc())
|
||||
.setDataScad(testata.getDataDoc());
|
||||
.setDataScad(UtilityLocalDate.localDateFromDate(testata.getDataDoc()));
|
||||
if (testata.getTipoPartitaEnum() == TipoPartita.ATTIVA) {
|
||||
ctbScad.setImpDare(enasarco);
|
||||
ctbScad.setImpAvere(BigDecimal.ZERO);
|
||||
@@ -413,10 +413,17 @@ public class AccountingBusinessLogic {
|
||||
}
|
||||
|
||||
public static BigDecimal pagaScadenze(Date dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze) {
|
||||
return pagaScadenze(dataCmov, residuo, elencoScadenze, null);
|
||||
return pagaScadenze(UtilityLocalDate.localDateFromDate(dataCmov), residuo, elencoScadenze, null);
|
||||
}
|
||||
|
||||
public static BigDecimal pagaScadenze(Date dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze, Integer idRigaMov) {
|
||||
return pagaScadenze(UtilityLocalDate.localDateFromDate(dataCmov), residuo, elencoScadenze, idRigaMov);
|
||||
}
|
||||
|
||||
public static BigDecimal pagaScadenze(LocalDate dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze) {
|
||||
return pagaScadenze(dataCmov, residuo, elencoScadenze, null);
|
||||
}
|
||||
public static BigDecimal pagaScadenze(LocalDate dataCmov, BigDecimal residuo, List<CtbScad> elencoScadenze, Integer idRigaMov) {
|
||||
long countScad =
|
||||
Stream.of(elencoScadenze)
|
||||
.distinctBy(x ->
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class AccountingRules extends QueryRules {
|
||||
@@ -182,7 +183,7 @@ public class AccountingRules extends QueryRules {
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(codBiva)) {
|
||||
for (CtbMovi ctbMovi : ctbMovt.getCtbMovi()) {
|
||||
if (UtilityString.isNullOrEmpty(ctbMovi.getCodBiva())) {
|
||||
if (UtilityString.isNullOrEmpty(ctbMovi.getCodBiva()) && !ctbMovi.getCodBiva().equalsIgnoreCase(EmsRestConstants.NULL)) {
|
||||
ctbMovi.setCodBiva(codBiva);
|
||||
}
|
||||
movi.add(ctbMovi);
|
||||
@@ -390,7 +391,7 @@ public class AccountingRules extends QueryRules {
|
||||
.setCodAnag(ctbMovt.getCodAnag())
|
||||
.setCodVage(ctbMovt.getCodVage())
|
||||
.setAnnoPart(annoPart)
|
||||
.setDataDoc(ctbMovt.getDataDoc())
|
||||
.setDataDoc(UtilityLocalDate.localDateFromDate(ctbMovt.getDataDoc()))
|
||||
.setSerDoc(ctbMovt.getSerDoc())
|
||||
.setNumDoc(ctbMovt.getNumDoc())
|
||||
.setCodDiviCont(ctbMovt.getCodDiviCont())
|
||||
@@ -658,7 +659,7 @@ public class AccountingRules extends QueryRules {
|
||||
.setAnnoPart(ctbScad.getAnnoPart())
|
||||
.setSerDoc(ctbScad.getSerDoc())
|
||||
.setNumDoc(ctbScad.getNumDoc())
|
||||
.setDataCmov(ctbMovr.getDataCmov())
|
||||
.setDataCmov(UtilityLocalDate.localDateFromDate(ctbMovr.getDataCmov()))
|
||||
.setIdRiga(ctbMovr.getIdRiga())
|
||||
.setImpDare(impDare)
|
||||
.setImpAvere(impAvere)
|
||||
@@ -736,7 +737,7 @@ public class AccountingRules extends QueryRules {
|
||||
.setAnnoPart(ctbMovr.getAnnoPart())
|
||||
.setSerDoc(ctbMovr.getSerDoc())
|
||||
.setNumDoc(ctbMovr.getNumDoc())
|
||||
.setDataCmov(ctbMovr.getDataCmov())
|
||||
.setDataCmov(UtilityLocalDate.localDateFromDate(ctbMovr.getDataCmov()))
|
||||
.setIdRiga(ctbMovr.getIdRiga())
|
||||
.setImpDare(ctbMovr.getImpDare())
|
||||
.setImpAvere(ctbMovr.getImpAvere())
|
||||
@@ -963,18 +964,16 @@ public class AccountingRules extends QueryRules {
|
||||
public static CtbMovt completeScadRitAcc(Connection conn, CtbRitAcc ctbRitAcc) throws Exception {
|
||||
String sql =
|
||||
"SELECT count(*) as count_partita " +
|
||||
" FROM ctb_part inner join ctb_parr on ctb_part.tipo_anag = ctb_parr.tipo_anag and " +
|
||||
"ctb_part.cod_anag = ctb_parr.cod_anag and " +
|
||||
"ctb_part.anno_part = ctb_parr.anno_part and " +
|
||||
"ctb_part.ser_doc = ctb_parr.ser_doc and " +
|
||||
"ctb_part.num_doc = ctb_parr.num_doc " +
|
||||
" WHERE ctb_parr.num_cmov = " + UtilityDB.valueToString(ctbRitAcc.getNumCmovFat()) + " AND " +
|
||||
" ( ctb_part.dare_part = 0 or ctb_part.avere_part = 0 ) ";
|
||||
" FROM ctb_part inner join ctb_parr on ctb_part.tipo_anag = ctb_parr.tipo_anag and " +
|
||||
"ctb_part.cod_anag = ctb_parr.cod_anag and " +
|
||||
"ctb_part.anno_part = ctb_parr.anno_part and " +
|
||||
"ctb_part.ser_doc = ctb_parr.ser_doc and " +
|
||||
"ctb_part.num_doc = ctb_parr.num_doc " +
|
||||
" WHERE ctb_parr.num_cmov = " + UtilityDB.valueToString(ctbRitAcc.getNumCmovFat());
|
||||
|
||||
Integer countPart = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
|
||||
if (countPart > 0) {
|
||||
|
||||
if (countPart <= 1) {
|
||||
CtbMovt ctbMovt = new CtbMovt();
|
||||
ctbMovt.setNumCmov(ctbRitAcc.getNumCmovFat());
|
||||
ctbMovt.setGeneraScad(ctbRitAcc.getGeneraScadenze());
|
||||
@@ -990,7 +989,7 @@ public class AccountingRules extends QueryRules {
|
||||
for (CtbScad ctbScad : ctbMovt.getCtbScad()) {
|
||||
ctbScad.setTipoAnag(UtilityString.isNullOrEmpty(ctbScad.getTipoAnag()) ? ctbMovt.getTipoAnag() : ctbScad.getTipoAnag());
|
||||
ctbScad.setCodAnag(UtilityString.isNullOrEmpty(ctbScad.getCodAnag()) ? ctbMovt.getCodAnag() : ctbScad.getCodAnag());
|
||||
ctbScad.setDataDoc(UtilityString.isNullOrEmpty(ctbScad.getDataDoc()) ? ctbMovt.getDataDoc() : ctbScad.getDataDoc());
|
||||
ctbScad.setDataDoc(UtilityLocalDate.isNull(ctbScad.getDataDoc(), UtilityLocalDate.localDateFromDate(ctbMovt.getDataDoc())));
|
||||
ctbScad.setSerDoc(UtilityString.isNullOrEmpty(ctbScad.getSerDoc()) ? ctbMovt.getSerDoc() : ctbScad.getSerDoc());
|
||||
ctbScad.setNumDoc(UtilityString.isNullOrEmpty(ctbScad.getNumDoc()) ? ctbMovt.getNumDoc() : ctbScad.getNumDoc());
|
||||
Integer annoPart = Integer.parseInt(new SimpleDateFormat("yyyy").format(ctbMovt.getDataDoc()));
|
||||
@@ -1127,5 +1126,16 @@ public class AccountingRules extends QueryRules {
|
||||
}
|
||||
return ventilazione;
|
||||
}
|
||||
|
||||
public static void checkRigaMovCtbParr( CtbMovt ctbMovt) {
|
||||
List<CtbMovr> row = ctbMovt.getCtbMovr().stream()
|
||||
.filter(x -> x.getCtbScad() != null && x.getCtbScad().size() > 0)
|
||||
.collect(Collectors.toList());
|
||||
for(CtbMovr r : row) {
|
||||
r.getCtbScad()
|
||||
.forEach(scad -> {scad.getCrlScadParr()
|
||||
.stream()
|
||||
.filter(x->x.getIdRigaMov() != r.getIdRiga())
|
||||
.forEach(x->x.setIdRigaMov(r.getIdRiga()));});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,7 @@ import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.db.ResultSetMapper;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.entity._enum.ListinoEnum;
|
||||
import it.integry.ems_model.entity.common.DtbBaseDocR;
|
||||
import it.integry.ems_model.entity.common.DtbDocOrdR;
|
||||
import it.integry.ems_model.entity.common.DtbDocOrdT;
|
||||
@@ -674,7 +675,11 @@ public class DocOrdCalTotaliRules extends QueryRules {
|
||||
if ("A".equals(gestione)) {
|
||||
costo = DocumentRules.completeCostoUntDocA(conn, ((DtbDocr) row));
|
||||
} else if ("L".equals(gestione)) {
|
||||
costo = DocumentRules.completeCostoUntDocL(conn, ((DtbDocr) row), flagValCosto);
|
||||
if (testata.getListino().equalsIgnoreCase(ListinoEnum.COSTO_ULTIMO.getValue()) && !UtilityBigDecimal.isNullOrZero(row.getValUnt())) {
|
||||
costo = row.getValUnt();
|
||||
} else {
|
||||
costo = DocumentRules.completeCostoUntDocL(conn, ((DtbDocr) row), flagValCosto);
|
||||
}
|
||||
}
|
||||
((DtbDocr) row).setCostoUnt(costo);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package it.integry.ems.rules.completing;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.rules.completing.dto.DatiPartitaMagDTO;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.entity.MtbColr;
|
||||
import it.integry.ems_model.entity.MtbCols;
|
||||
import it.integry.ems_model.entity.MtbColt;
|
||||
import it.integry.ems_model.entity.MtbPartitaMag;
|
||||
import it.integry.ems_model.entity.*;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.*;
|
||||
|
||||
@@ -255,7 +255,7 @@ public class PackagesRules extends QueryRules {
|
||||
int cifreDec;
|
||||
if (UtilityString.isNullOrEmpty(flagQtaCnfFissa)) {
|
||||
throw new Exception(String.format("Articolo %s non trovato", mtbColr.getCodMart()));
|
||||
}else if (flagQtaCnfFissa.equalsIgnoreCase("S")) {
|
||||
} else if (flagQtaCnfFissa.equalsIgnoreCase("S")) {
|
||||
cifreDec = EmsRestConstants.cifreDecMax;
|
||||
} else {
|
||||
cifreDec = 0;
|
||||
@@ -331,23 +331,28 @@ public class PackagesRules extends QueryRules {
|
||||
return datiOrd;
|
||||
}
|
||||
|
||||
public static HashMap<String, Object> calcPeso(Connection conn, MtbColr entity) throws Exception {
|
||||
String sql = "select cifre_dec from mtb_unt_mis where flag_unita_kg = 'S'";
|
||||
BigDecimal cifreDec = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
public static HashMap<String, Object> calcPeso(IntegryCustomerDB customerDB, Connection conn, MtbColr entity) throws Exception {
|
||||
|
||||
if ( cifreDec == null ) { cifreDec = BigDecimal.valueOf(5); }
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
sql =
|
||||
"SELECT mtb_aart.unt_mis, " +
|
||||
" mtb_aart.tara_kg, " +
|
||||
" mtb_aart.peso_kg, " +
|
||||
" case when mtb_aart.flag_peso_egalizzato = 1 THEN mtb_aart.qta_cnf ELSE 1 END * mtb_aart.peso_kg as 'peso_egalizzato', " +
|
||||
" mtb_unt_mis.flag_unita_kg, " +
|
||||
" mtb_aart.flag_peso_egalizzato " +
|
||||
" FROM mtb_aart INNER JOIN mtb_unt_mis ON mtb_aart.unt_mis = mtb_unt_mis.unt_mis " +
|
||||
" WHERE mtb_aart.cod_mart = " + UtilityDB.valueToString(entity.getCodMart());
|
||||
BigDecimal cifreDec = entityCacheComponent.<MtbUntMis>getCachedEntitiesStream(customerDB, MtbUntMis.ENTITY,
|
||||
x -> x.getFlagUnitaKg().equalsIgnoreCase("S"))
|
||||
.map(MtbUntMis::getCifreDec)
|
||||
.findFirst()
|
||||
.orElse(BigDecimal.valueOf(5));
|
||||
|
||||
HashMap<String, Object> anagArt = entityCacheComponent.<MtbAart>getCachedEntitiesStream(customerDB, MtbAart.ENTITY,
|
||||
x -> x.getCodMart().equalsIgnoreCase(entity.getCodMart()))
|
||||
.map(x -> new HashMap<String, Object>() {{
|
||||
put("unt_mis", x.getUntMis());
|
||||
put("tara_kg", x.getTaraKg());
|
||||
put("peso_kg", x.getPesoKg());
|
||||
put("flag_peso_egalizzato", x.getFlagPesoEgalizzato());
|
||||
put("peso_egalizzato", x.getFlagPesoEgalizzato() ? x.getQtaCnf().multiply(x.getPesoKg()) : null);
|
||||
}})
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
HashMap<String, Object> queryResults = UtilityDB.executeSimpleQueryOnlyFirstRow(conn, sql);
|
||||
|
||||
MtbColr originalEntity = ((MtbColr) entity.getOriginalEntity());
|
||||
if (originalEntity != null && originalEntity.getPesoNettoKg() != null && originalEntity.getPesoLordoKg() != null) {
|
||||
@@ -359,12 +364,17 @@ public class PackagesRules extends QueryRules {
|
||||
}
|
||||
|
||||
BigDecimal pesoNetto = BigDecimal.ZERO, pesoLordo = BigDecimal.ZERO;
|
||||
if (queryResults != null) {
|
||||
BigDecimal taraKg = (BigDecimal) queryResults.get("tara_kg");
|
||||
BigDecimal pesoKg = (BigDecimal) queryResults.get("peso_kg");
|
||||
String flagUnitaKg = (String) queryResults.get("flag_unita_kg");
|
||||
BigDecimal pesoKGEgalizzato = (BigDecimal) queryResults.get("peso_egalizzato");
|
||||
Boolean pesoEgalizzato = (Boolean) queryResults.get("flag_peso_egalizzato");
|
||||
if (anagArt != null) {
|
||||
String flagUnitaKg = entityCacheComponent.<MtbUntMis>getCachedEntitiesStream(customerDB, MtbUntMis.ENTITY,
|
||||
x -> x.getUntMis().equalsIgnoreCase(String.valueOf(anagArt.get("unt_mis"))))
|
||||
.map(MtbUntMis::getFlagUnitaKg)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
BigDecimal taraKg = (BigDecimal) anagArt.get("tara_kg");
|
||||
BigDecimal pesoKg = (BigDecimal) anagArt.get("peso_kg");
|
||||
BigDecimal pesoKGEgalizzato = (BigDecimal) anagArt.get("peso_egalizzato");
|
||||
Boolean pesoEgalizzato = (Boolean) anagArt.get("flag_peso_egalizzato");
|
||||
|
||||
if ("S".equalsIgnoreCase(flagUnitaKg)) {
|
||||
pesoNetto = entity.getQtaCol();
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -72,8 +73,8 @@ public class SalesRules extends QueryRules {
|
||||
|
||||
if (dataFine != null) {
|
||||
|
||||
if (dataFine.equals(UtilityLocalDate.localDateFromDate(vtbListData.getDataFine())) &&
|
||||
vtbListData.getDataIniz().before((UtilityDate.getTodayWithoutTime())) &&
|
||||
if (dataFine.equals(vtbListData.getDataFine()) &&
|
||||
vtbListData.getDataIniz().isBefore(LocalDate.now()) &&
|
||||
!vtbListData.getMtbLisvData().isEmpty()) {
|
||||
throw new Exception("Impossibile modificare gli articoli di una promozione con data inizio antecedente a oggi");
|
||||
|
||||
@@ -84,7 +85,7 @@ public class SalesRules extends QueryRules {
|
||||
|
||||
}
|
||||
|
||||
if (vtbListData.getDataIniz().before((UtilityDate.getTodayWithoutTime())))
|
||||
if (vtbListData.getDataIniz().isBefore(LocalDate.now()))
|
||||
throw new Exception(String.format("Impossibile inserire una %s data inizio antecedente a oggi",
|
||||
(vtbListData.getDataFine() != null ? "promozione" : "variazione")));
|
||||
|
||||
@@ -94,13 +95,13 @@ public class SalesRules extends QueryRules {
|
||||
|
||||
|
||||
public static boolean checkDataFine(Connection conn, VtbListData vtbListData) throws Exception {
|
||||
LocalDate dataIniz = UtilityLocalDate.localDateFromDate(vtbListData.getDataIniz());
|
||||
LocalDate dataFine = UtilityLocalDate.localDateFromDate(vtbListData.getDataFine());
|
||||
LocalDate dataIniz = vtbListData.getDataIniz();
|
||||
LocalDate dataFine = vtbListData.getDataFine();
|
||||
|
||||
if (dataFine.isBefore(dataIniz))
|
||||
throw new Exception(String.format("Impossibile inserire//modificare una promozione con data fine (%s) antecedente a data inizio ( %s )",
|
||||
new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(vtbListData.getDataFine()),
|
||||
new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(vtbListData.getDataIniz())));
|
||||
UtilityLocalDate.formatDate(vtbListData.getDataFine(), CommonConstants.DATE_FORMAT_DMY),
|
||||
UtilityLocalDate.formatDate(vtbListData.getDataIniz(), CommonConstants.DATE_FORMAT_DMY)));
|
||||
|
||||
String promoEscluse = setupGest.getSetup(conn, "VTB_LIST", "CHECK_DATA_FINE", "PROMO_ESCLUSE");
|
||||
if (!UtilityString.isNullOrEmpty(promoEscluse)) {
|
||||
@@ -112,7 +113,7 @@ public class SalesRules extends QueryRules {
|
||||
if (vtbListData.getCheckDataFine() != null && vtbListData.getCheckDataFine()) {
|
||||
if (UtilityLocalDate.isBeforeToday(dataFine))
|
||||
throw new Exception(String.format("Impossibile inserire//modificare una promozione con data fine (%s) antecedente ad oggi",
|
||||
new SimpleDateFormat(CommonConstants.DATE_FORMAT_DMY).format(vtbListData.getDataFine())));
|
||||
UtilityLocalDate.formatDate(vtbListData.getDataFine(), CommonConstants.DATE_FORMAT_DMY)));
|
||||
}
|
||||
|
||||
if (vtbListData.getCheckDataFine() != null && vtbListData.getCheckDataFine()) {
|
||||
@@ -254,8 +255,8 @@ public class SalesRules extends QueryRules {
|
||||
public static String completeCodPromo(Connection connection, VtbListData vtbListData) throws Exception {
|
||||
String partialCode =
|
||||
vtbListData.getCodVlis() + ";" +
|
||||
new SimpleDateFormat(CommonConstants.DATE_FORMAT_YMD).format(vtbListData.getDataIniz()) + ";" +
|
||||
new SimpleDateFormat(CommonConstants.DATE_FORMAT_YMD).format(vtbListData.getDataFine());
|
||||
UtilityLocalDate.formatDate(vtbListData.getDataIniz(), CommonConstants.DATE_FORMAT_YMD) + ";" +
|
||||
UtilityLocalDate.formatDate(vtbListData.getDataFine(), CommonConstants.DATE_FORMAT_YMD);
|
||||
|
||||
String sql = "SELECT dbo.f_suggestCodeCodPromoVend( " + UtilityDB.valueToString(partialCode) + " ) ";
|
||||
String codPromo = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
@@ -277,7 +278,7 @@ public class SalesRules extends QueryRules {
|
||||
"vtb_list_data.versione = mtb_lisv_data.versione " +
|
||||
"where mtb_lisv_data.cod_mart = " + UtilityDB.valueToString(mtbLisvData.getCodMart()) + " and " +
|
||||
"vtb_list_data.cod_vlis = " + UtilityDB.valueToString(mtbLisvData.getCodVlis()) + " and " +
|
||||
"vtb_list_data.data_iniz <= " + UtilityDB.valueDateToString(mtbLisvData.getDataIniz(), CommonConstants.DATE_FORMAT_YMD) +
|
||||
"vtb_list_data.data_iniz <= " + UtilityDB.valueToString(mtbLisvData.getDataIniz()) +
|
||||
(mtbLisvData.getVersione() != null ? " AND vtb_list_data.versione <> " + UtilityDB.valueToString(mtbLisvData.getVersione()) : "") +
|
||||
" ORDER BY vtb_list_data.data_iniz desc";
|
||||
|
||||
@@ -346,9 +347,9 @@ public class SalesRules extends QueryRules {
|
||||
|
||||
public static void setDataUltVar(Connection connection, VtbListData testata) throws Exception {
|
||||
if (testata.getOperation() == OperationType.INSERT || testata.getOperation() == OperationType.UPDATE || testata.getOperation() == OperationType.INSERT_OR_UPDATE) {
|
||||
testata.setDataUltVar(new Date());
|
||||
testata.setDataUltVar(LocalDateTime.now());
|
||||
} else if ( testata.getMtbLisvData() != null && testata.getMtbLisvData().stream().anyMatch(x-> x.getOperation() == OperationType.INSERT || x.getOperation() == OperationType.UPDATE || x.getOperation() == OperationType.INSERT_OR_UPDATE )){
|
||||
testata.setDataUltVar(new Date());
|
||||
testata.setDataUltVar(LocalDateTime.now());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,7 +372,7 @@ public class SalesRules extends QueryRules {
|
||||
" FROM vtb_list_data " +
|
||||
" WHERE cod_vlis = " + UtilityDB.valueToString(vtbListData.getCodVlis()) + " AND " +
|
||||
"versione = " + UtilityDB.valueToString(vtbListData.getVersione()) + " AND " +
|
||||
"data_iniz = " + UtilityDB.valueDateToString(vtbListData.getDataIniz(), CommonConstants.DATE_FORMAT_YMD);
|
||||
"data_iniz = " + UtilityDB.valueToString(vtbListData.getDataIniz());
|
||||
|
||||
boolean existLisv = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
|
||||
@@ -388,7 +389,7 @@ public class SalesRules extends QueryRules {
|
||||
+ " WHERE cod_vlis = "
|
||||
+ UtilityDB.valueToString(vtbListData.getCodVlis())
|
||||
+ " AND data_iniz = "
|
||||
+ UtilityDB.valueDateToString(vtbListData.getDataIniz(), CommonConstants.DATE_FORMAT_YMD)
|
||||
+ UtilityDB.valueToString(vtbListData.getDataIniz())
|
||||
+ " AND cod_promo IS NULL"
|
||||
+ " AND isNull(note, '') = IsNull(" + UtilityDB.valueToString(vtbListData.getNote()) + ", '') ";
|
||||
versioneNew = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
@@ -399,9 +400,9 @@ public class SalesRules extends QueryRules {
|
||||
+ " WHERE cod_vlis = "
|
||||
+ UtilityDB.valueToString(vtbListData.getCodVlis())
|
||||
+ " AND data_iniz = "
|
||||
+ UtilityDB.valueDateToString(vtbListData.getDataIniz(), CommonConstants.DATE_FORMAT_YMD)
|
||||
+ UtilityDB.valueToString(vtbListData.getDataIniz())
|
||||
+ " AND data_fine = "
|
||||
+ UtilityDB.valueDateToString(vtbListData.getDataFine(), CommonConstants.DATE_FORMAT_YMD) + " AND "
|
||||
+ UtilityDB.valueToString(vtbListData.getDataFine()) + " AND "
|
||||
+ " cod_promo = " + UtilityDB.valueToString(vtbListData.getCodPromo()) + " AND "
|
||||
+ " ( note = " + UtilityDB.valueToString(vtbListData.getNote()) + " OR "
|
||||
+ UtilityDB.valueToString(vtbListData.getNote()) + " is null ) ";
|
||||
@@ -413,17 +414,6 @@ public class SalesRules extends QueryRules {
|
||||
if (versioneNew == null || versioneNew == 0) {
|
||||
if (vtbListData.getOperation() == OperationType.INSERT_OR_UPDATE)
|
||||
vtbListData.setOperation(OperationType.INSERT);
|
||||
// query = " SELECT max(versione) versione"
|
||||
// + " FROM vtb_list_data "
|
||||
// + " WHERE cod_vlis = "
|
||||
// + UtilityDB.valueToString(vtbListData.getCodVlis());
|
||||
// versioneNew = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
//
|
||||
// if (versioneNew == null) {
|
||||
// versioneNew = 1;
|
||||
// } else {
|
||||
// versioneNew = versioneNew + 1;
|
||||
// }
|
||||
} else {
|
||||
vtbListData.setOperation(OperationType.UPDATE);
|
||||
}
|
||||
@@ -432,12 +422,11 @@ public class SalesRules extends QueryRules {
|
||||
return versioneNew;
|
||||
}
|
||||
|
||||
public static BigDecimal completeRicaricaRow(Connection connection, String codVlis, String codMart, Date dataIniz) throws Exception {
|
||||
public static BigDecimal completeRicaricaRow(Connection connection, String codVlis, String codMart, LocalDate dataIniz) throws Exception {
|
||||
|
||||
String sql = "SELECT distinct ricarico FROM dbo.ftx_getListinoVendita(" + UtilityDB.valueDateToString(dataIniz, CommonConstants.DATE_FORMAT_YMD) + ","
|
||||
String sql = "SELECT distinct ricarico FROM dbo.ftx_getListinoVendita(" + UtilityDB.valueToString(dataIniz) + ","
|
||||
+ UtilityDB.valueToString(codVlis) + "," + UtilityDB.valueToString(codMart) + ", 'N')";
|
||||
|
||||
|
||||
BigDecimal ricarico = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
|
||||
return ricarico;
|
||||
@@ -447,7 +436,7 @@ public class SalesRules extends QueryRules {
|
||||
if (entity.getListData() == null) {
|
||||
String codVlis = entity.getCodVlis();
|
||||
String codMart = entity.getCodMart();
|
||||
Date dataIniz = entity.getDataIniz();
|
||||
LocalDate dataIniz = entity.getDataIniz();
|
||||
|
||||
String sql =
|
||||
"SELECT Cast(count(*) as bit) as existLisv " +
|
||||
@@ -489,7 +478,7 @@ public class SalesRules extends QueryRules {
|
||||
+ "sconto_strato, "
|
||||
+ "sconto_pedane, "
|
||||
+ "flag_prz_bloccato "
|
||||
+ " FROM dbo.getListinoVendita(" + UtilityDB.valueDateToString(dataIniz, CommonConstants.DATE_FORMAT_YMD) + ","
|
||||
+ " FROM dbo.getListinoVendita(" + UtilityDB.valueToString(dataIniz) + ","
|
||||
+ UtilityDB.valueToString(codVlis) + ","
|
||||
+ UtilityDB.valueToString(codMart) + ") ";
|
||||
|
||||
@@ -947,15 +936,16 @@ public class SalesRules extends QueryRules {
|
||||
public static Boolean checkChangeRicarico(Connection conn, MtbLisvData entity) throws Exception {
|
||||
Boolean ret = false;
|
||||
String query =
|
||||
"SELECT user_name " +
|
||||
"SELECT Cast(count(*) as bit) " +
|
||||
" FROM stb_user " +
|
||||
" WHERE stb_user.user_name = " + UtilityDB.valueToString(entity.getUsername()) + " AND " +
|
||||
"stb_user.flag_dba = 'N' AND " +
|
||||
"stb_user.user_name not in (select user_name from stb_gest_setup_user WHERE section = 'W_VLIST_RC' AND key_section = 'DISABLE_CHK_RICARICO' and value = 'S') ";
|
||||
|
||||
PreparedStatement ps = conn.prepareStatement(query);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) {
|
||||
Boolean checkRicarico = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
if (checkRicarico == null) checkRicarico = false;
|
||||
|
||||
if (checkRicarico) {
|
||||
query =
|
||||
"SELECT ricarico_min, " +
|
||||
"ricarico_max, " +
|
||||
@@ -966,15 +956,12 @@ public class SalesRules extends QueryRules {
|
||||
" vtb_range_ricarico.cod_msgr = mtb_aart.cod_msgr " +
|
||||
" WHERE mtb_aart.cod_mart = " + UtilityDB.valueToString(entity.getCodMart()) + "AND " +
|
||||
"( vtb_range_ricarico.ricarico_min <> 0 OR vtb_range_ricarico.ricarico_max <> 0 )";
|
||||
ps = conn.prepareStatement(query);
|
||||
rs = ps.executeQuery();
|
||||
if (rs.next()) {
|
||||
BigDecimal ricaricoMin = rs.getBigDecimal(1);
|
||||
BigDecimal ricaricoMax = rs.getBigDecimal(2);
|
||||
String descrizioneArt = rs.getString(3);
|
||||
String flagTipoRicarico = rs.getString(4);
|
||||
rs.close();
|
||||
ps.close();
|
||||
HashMap<String, Object> dati = UtilityDB.executeSimpleQueryOnlyFirstRow(conn, query);
|
||||
if (UtilityHashMap.isPresent(dati)) {
|
||||
BigDecimal ricaricoMin = UtilityHashMap.getValueIfExists(dati, "ricarico_min");
|
||||
BigDecimal ricaricoMax = UtilityHashMap.getValueIfExists(dati, "ricarico_max");
|
||||
String descrizioneArt = UtilityHashMap.getValueIfExists(dati, "descrizione");
|
||||
String flagTipoRicarico = UtilityHashMap.getValueIfExists(dati, "flag_tipo_ricarico");
|
||||
|
||||
BigDecimal ricaricoCalc = BigDecimal.ZERO;
|
||||
if ("P".equals(flagTipoRicarico)) {
|
||||
@@ -984,14 +971,8 @@ public class SalesRules extends QueryRules {
|
||||
" mtb_aart.perc_sfrido)" +
|
||||
" FROM mtb_aart " +
|
||||
" WHERE mtb_aart.cod_mart = " + UtilityDB.valueToString(entity.getCodMart());
|
||||
ps = conn.prepareStatement(query);
|
||||
rs = ps.executeQuery();
|
||||
|
||||
if (rs.next()) {
|
||||
ricaricoCalc = rs.getBigDecimal(1);
|
||||
}
|
||||
rs.close();
|
||||
ps.close();
|
||||
ricaricoCalc = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
} else {
|
||||
ricaricoCalc = entity.getPrzVend().subtract(entity.getPrzBase());
|
||||
}
|
||||
@@ -1003,8 +984,6 @@ public class SalesRules extends QueryRules {
|
||||
}
|
||||
|
||||
}
|
||||
rs.close();
|
||||
ps.close();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1017,7 +996,7 @@ public class SalesRules extends QueryRules {
|
||||
String flagPrzBloccato = "N";
|
||||
if (chkPrzBloccato) {
|
||||
query = "SELECT flag_prz_bloccato " +
|
||||
"FROM dbo.GetListinoVendita(" + UtilityDB.valueDateToString(entity.getDataIniz(), CommonConstants.DATE_FORMAT_YMD) + ", " +
|
||||
"FROM dbo.GetListinoVendita(" + UtilityDB.valueToString(entity.getDataIniz()) + ", " +
|
||||
UtilityDB.valueToString(entity.getCodVlis()) + ", " +
|
||||
UtilityDB.valueToString(entity.getCodMart()) + ") lisv ";
|
||||
flagPrzBloccato = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, query);
|
||||
@@ -1357,7 +1336,7 @@ public class SalesRules extends QueryRules {
|
||||
public static Long completeIdMtbLisvDataSpese(Connection connection, MtbLisvDataSpese mtbLisvDataSpese) throws SQLException {
|
||||
VtbListData vtbListData = (VtbListData) mtbLisvDataSpese.getParent();
|
||||
|
||||
Date dataIniz = vtbListData.getDataIniz();
|
||||
LocalDate dataIniz = vtbListData.getDataIniz();
|
||||
|
||||
String sql = Query.format(
|
||||
"SELECT id\n" +
|
||||
@@ -1371,4 +1350,19 @@ public class SalesRules extends QueryRules {
|
||||
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
}
|
||||
|
||||
public static boolean checkMtbLisvDelete(Connection conn, MtbLisv mtbLisv) throws Exception {
|
||||
String sql = Query.format(
|
||||
"SELECT Cast(count(*) As BIT)\n" +
|
||||
"FROM mtb_lisv_data " +
|
||||
"WHERE cod_vlis = %s AND cod_mart = %s",
|
||||
mtbLisv.getCodVlis(),
|
||||
mtbLisv.getCodMart()
|
||||
);
|
||||
|
||||
Boolean exist = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
if (exist == null) exist = false;
|
||||
|
||||
return exist;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -186,8 +187,7 @@ public class AsyncManager {
|
||||
.orElse(null);
|
||||
|
||||
try (MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(connectionModel);
|
||||
SQLServerPreparedStatement insertBulkPs = (SQLServerPreparedStatement) multiDBTransactionManager.prepareStatement(insertSQL)) {
|
||||
|
||||
PreparedStatement insertBulkPs = multiDBTransactionManager.prepareStatement(insertSQL)) {
|
||||
insertBulkPs.setLong(1, stbTransactionLog.getPublicationGroupId());
|
||||
insertBulkPs.setObject(2, stbTransactionLog.getCreatedAt());
|
||||
insertBulkPs.setString(3, stbTransactionLog.getUserName());
|
||||
|
||||
@@ -21,7 +21,7 @@ public class BasicConnectionPool {
|
||||
@Autowired
|
||||
private SettingsModel settingsModel;
|
||||
|
||||
private final ConcurrentHashMap<String, DataSource> registeredDatasources = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<AvailableConnectionModel, DataSource> registeredDatasources = new ConcurrentHashMap<>();
|
||||
|
||||
private volatile boolean initialized = false;
|
||||
private final Object initLock = new Object(); // Lock più leggero solo per inizializzazione
|
||||
@@ -63,7 +63,7 @@ public class BasicConnectionPool {
|
||||
|
||||
private void initializeConnections() {
|
||||
final List<AvailableConnectionModel> availableConnections =
|
||||
settingsModel.getAvailableConnectionsWithoutDuplicatedProfiles(false);
|
||||
settingsModel.getAvailableConnections(false);
|
||||
|
||||
for (AvailableConnectionModel model : availableConnections) {
|
||||
try {
|
||||
@@ -89,14 +89,15 @@ public class BasicConnectionPool {
|
||||
try {
|
||||
registerDataSourceIfNotExists(connectionsModel);
|
||||
|
||||
String dbName = connectionsModel.getDbName();
|
||||
DataSource ds = registeredDatasources.get(dbName);
|
||||
DataSource ds = registeredDatasources.get(connectionsModel);
|
||||
|
||||
if (ds == null) {
|
||||
throw new IllegalArgumentException("No datasource registered for profile: " + connectionsModel.getProfileName());
|
||||
}
|
||||
|
||||
String dbName = connectionsModel.getDbName();
|
||||
Connection connection = ds.getConnection();
|
||||
|
||||
if (!connection.getCatalog().equalsIgnoreCase(dbName)) {
|
||||
throw new IllegalArgumentException("Connection for profile " + connectionsModel.getProfileName() + " is not for database " + dbName);
|
||||
}
|
||||
@@ -110,9 +111,8 @@ public class BasicConnectionPool {
|
||||
|
||||
|
||||
private void registerDataSourceIfNotExists(AvailableConnectionModel connectionModel) throws Exception {
|
||||
String dbName = connectionModel.getDbName();
|
||||
if (!registeredDatasources.containsKey(dbName)) {
|
||||
registeredDatasources.put(dbName, createNewDataSource(connectionModel));
|
||||
if (!registeredDatasources.containsKey(connectionModel)) {
|
||||
registeredDatasources.put(connectionModel, createNewDataSource(connectionModel));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.ALWAYS)
|
||||
public class UserDTO {
|
||||
public class UserDTO implements Cloneable{
|
||||
|
||||
@SqlField("user_name")
|
||||
private String username;
|
||||
@@ -288,4 +288,14 @@ public class UserDTO {
|
||||
this.availableProfiles = availableProfiles;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDTO clone() {
|
||||
try {
|
||||
UserDTO clone = (UserDTO) super.clone();
|
||||
return clone;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,4 @@ public interface EquatableEntityInterface<T> extends EntityInterface {
|
||||
boolean equalsKey(T other);
|
||||
|
||||
boolean equals(Object other);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1476,48 +1476,51 @@ public class GeneraOrdLav {
|
||||
activityID = (String) datiOrdL.get("activity_id");
|
||||
}
|
||||
|
||||
Integer ggDiff = Math.toIntExact(UtilityLocalDate.daysAfterDate(dataInizProdOld, dataInizNew));
|
||||
if (ggDiff != 0) {
|
||||
sql = "SELECT * FROM dtb_ordr";
|
||||
sql = UtilityDB.addwhereCond(sql, ordT.getPkWhereCond(), true);
|
||||
List<DtbOrdr> dtbOrdrL = UtilityDB.executeSimpleQueryDTO(conn, sql, DtbOrdr.class);
|
||||
|
||||
if (dtbOrdrL != null && !dtbOrdrL.isEmpty()) {
|
||||
dtbOrdrL.stream().forEach(x -> {
|
||||
x.setDataCons(UtilityDate.dateAdd(x.getDataCons(), ggDiff));
|
||||
if (dataInizProdOld != null && dataInizNew != null && dataInizProdOld != EmsRestConstants.LOCAL_DATE_NULL && dataInizNew != EmsRestConstants.LOCAL_DATE_NULL){
|
||||
Integer ggDiff = Math.toIntExact(UtilityLocalDate.daysAfterDate(dataInizProdOld, dataInizNew));
|
||||
if (ggDiff != 0) {
|
||||
sql = "SELECT * FROM dtb_ordr";
|
||||
sql = UtilityDB.addwhereCond(sql, ordT.getPkWhereCond(), true);
|
||||
List<DtbOrdr> dtbOrdrL = UtilityDB.executeSimpleQueryDTO(conn, sql, DtbOrdr.class);
|
||||
|
||||
if (dtbOrdrL != null && !dtbOrdrL.isEmpty()) {
|
||||
dtbOrdrL.stream().forEach(x -> {
|
||||
x.setDataCons(UtilityDate.dateAdd(x.getDataCons(), ggDiff));
|
||||
x.setOperation(OperationType.UPDATE);
|
||||
});
|
||||
|
||||
ordT.setDtbOrdr(dtbOrdrL);
|
||||
}
|
||||
|
||||
sql = "SELECT * FROM dtb_ord_steps";
|
||||
sql = UtilityDB.addwhereCond(sql, ordT.getPkWhereCond(), true);
|
||||
List<DtbOrdSteps> dtbOrdSteps = UtilityDB.executeSimpleQueryDTO(conn, sql, DtbOrdSteps.class);
|
||||
|
||||
dtbOrdSteps.stream().forEach(x -> {
|
||||
x.setDataIniz(x.getDataIniz() != null ? UtilityDate.dateAdd(x.getDataIniz(), ggDiff) : null);
|
||||
x.setDataFine(x.getDataFine() != null ? UtilityDate.dateAdd(x.getDataFine(), ggDiff) : null);
|
||||
x.setOperation(OperationType.UPDATE);
|
||||
});
|
||||
|
||||
ordT.setDtbOrdr(dtbOrdrL);
|
||||
}
|
||||
ordT.setDtbOrdSteps(dtbOrdSteps);
|
||||
|
||||
sql = "SELECT * FROM dtb_ord_steps";
|
||||
sql = UtilityDB.addwhereCond(sql, ordT.getPkWhereCond(), true);
|
||||
List<DtbOrdSteps> dtbOrdSteps = UtilityDB.executeSimpleQueryDTO(conn, sql, DtbOrdSteps.class);
|
||||
// FABIO: DA CAPIRE COME VALORIZZATA LE ATTIVITA MODIFICATE
|
||||
if (assegnaAttivita) {
|
||||
sql = "SELECT stb_activity.* " +
|
||||
" FROM stb_activity " +
|
||||
" where (activity_id = " + UtilityDB.valueToString(activityID) + " or " +
|
||||
" parent_activity_id = " + UtilityDB.valueToString(activityID) + ")";
|
||||
List<StbActivity> stbActivity = UtilityDB.executeSimpleQueryDTO(conn, sql, StbActivity.class);
|
||||
|
||||
dtbOrdSteps.stream().forEach(x -> {
|
||||
x.setDataIniz(x.getDataIniz() != null ? UtilityDate.dateAdd(x.getDataIniz(), ggDiff) : null);
|
||||
x.setDataFine(x.getDataFine() != null ? UtilityDate.dateAdd(x.getDataFine(), ggDiff) : null);
|
||||
x.setOperation(OperationType.UPDATE);
|
||||
});
|
||||
stbActivity.stream().forEach(x -> {
|
||||
x.setEstimatedTime(x.getEstimatedTime().plusDays(ggDiff));
|
||||
x.setEstimatedEndtime(x.getEstimatedEndtime().plusDays(ggDiff));
|
||||
x.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
});
|
||||
|
||||
ordT.setDtbOrdSteps(dtbOrdSteps);
|
||||
|
||||
// FABIO: DA CAPIRE COME VALORIZZATA LE ATTIVITA MODIFICATE
|
||||
if (assegnaAttivita) {
|
||||
sql = "SELECT stb_activity.* " +
|
||||
" FROM stb_activity " +
|
||||
" where (activity_id = " + UtilityDB.valueToString(activityID) + " or " +
|
||||
" parent_activity_id = " + UtilityDB.valueToString(activityID) + ")";
|
||||
List<StbActivity> stbActivity = UtilityDB.executeSimpleQueryDTO(conn, sql, StbActivity.class);
|
||||
|
||||
stbActivity.stream().forEach(x -> {
|
||||
x.setEstimatedTime(x.getEstimatedTime().plusDays(ggDiff));
|
||||
x.setEstimatedEndtime(x.getEstimatedEndtime().plusDays(ggDiff));
|
||||
x.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
});
|
||||
|
||||
row.setStbActivityList(stbActivity);
|
||||
row.setStbActivityList(stbActivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,6 +449,7 @@ public class AtbForn extends EntityBase implements EquatableEntityInterface<AtbF
|
||||
return Objects.equals(getCodAnag(), other.getCodAnag());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -65,9 +65,6 @@ public class CtbAmac extends EntityBase {
|
||||
@SqlField(value = "flag_attivo", nullable = false, defaultObjectValue = "1")
|
||||
private Boolean flagAttivo;
|
||||
|
||||
@SqlField(value = "cod_mdep")
|
||||
private String codMdep;
|
||||
|
||||
@SqlField(value = "posizione")
|
||||
@FK(tableName = MtbDepoPosizioni.ENTITY)
|
||||
private String posizione;
|
||||
@@ -241,15 +238,6 @@ public class CtbAmac extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public CtbAmac setCodMdep(String codMdep) {
|
||||
this.codMdep = codMdep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPosizione() {
|
||||
return posizione;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@PropertyReactive
|
||||
@@ -61,7 +61,7 @@ public class CtbParr extends EntityBase {
|
||||
|
||||
@ImportFromParent
|
||||
@SqlField(value = "data_cmov", nullable = false)
|
||||
private Date dataCmov;
|
||||
private LocalDate dataCmov;
|
||||
|
||||
@SqlField(value = "imp_dare", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal impDare;
|
||||
@@ -86,7 +86,7 @@ public class CtbParr extends EntityBase {
|
||||
private BigDecimal cambioDiviCont;
|
||||
|
||||
@ImportFromParent
|
||||
private Date dataDoc;
|
||||
private LocalDate dataDoc;
|
||||
|
||||
@ImportFromParent
|
||||
private String chiudiScad;
|
||||
@@ -174,11 +174,11 @@ public class CtbParr extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataCmov() {
|
||||
public LocalDate getDataCmov() {
|
||||
return dataCmov;
|
||||
}
|
||||
|
||||
public CtbParr setDataCmov(Date dataCmov) {
|
||||
public CtbParr setDataCmov(LocalDate dataCmov) {
|
||||
this.dataCmov = dataCmov;
|
||||
return this;
|
||||
}
|
||||
@@ -237,11 +237,11 @@ public class CtbParr extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
public LocalDate getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public CtbParr setDataDoc(Date dataDoc) {
|
||||
public CtbParr setDataDoc(LocalDate dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -46,7 +46,7 @@ public class CtbPart extends EntityBase {
|
||||
|
||||
@ImportFromParent (value = "data_doc")
|
||||
@SqlField(value = "data_doc")
|
||||
private Date dataDoc;
|
||||
private LocalDate dataDoc;
|
||||
|
||||
@SqlField(value = "tot_imponib", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal totImponib;
|
||||
@@ -185,11 +185,11 @@ public class CtbPart extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
public LocalDate getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public CtbPart setDataDoc(Date dataDoc) {
|
||||
public CtbPart setDataDoc(LocalDate dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@PropertyReactive
|
||||
@@ -58,11 +58,11 @@ public class CtbScad extends EntityBase {
|
||||
private String codPaga;
|
||||
|
||||
@ImportFromParent( value = "data_doc")
|
||||
@SqlField(value = "data_doc", nullable = false, format = CommonConstants.SYSDATE)
|
||||
private Date dataDoc;
|
||||
@SqlField(value = "data_doc", nullable = false)
|
||||
private LocalDate dataDoc;
|
||||
|
||||
@SqlField(value = "data_scad", nullable = false, format = CommonConstants.SYSDATE)
|
||||
private Date dataScad;
|
||||
@SqlField(value = "data_scad", nullable = false)
|
||||
private LocalDate dataScad;
|
||||
|
||||
@SqlField(value = "imp_dare", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal impDare;
|
||||
@@ -70,14 +70,14 @@ public class CtbScad extends EntityBase {
|
||||
@SqlField(value = "imp_avere", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal impAvere;
|
||||
|
||||
@SqlField(value = "data_pag", format = CommonConstants.SYSDATE)
|
||||
private Date dataPag;
|
||||
@SqlField(value = "data_pag")
|
||||
private LocalDate dataPag;
|
||||
|
||||
@SqlField(value = "descriz_pag", maxLength = 40)
|
||||
private String descrizPag;
|
||||
|
||||
@SqlField(value = "data_ult_soll")
|
||||
private Date dataUltSoll;
|
||||
private LocalDate dataUltSoll;
|
||||
|
||||
@SqlField(value = "ult_soll")
|
||||
private Integer ultSoll;
|
||||
@@ -85,17 +85,17 @@ public class CtbScad extends EntityBase {
|
||||
@SqlField(value = "note", maxLength = 40)
|
||||
private String note;
|
||||
|
||||
@SqlField(value = "data_ant_provv", format = CommonConstants.SYSDATE)
|
||||
private Date dataAntProvv;
|
||||
@SqlField(value = "data_ant_provv")
|
||||
private LocalDate dataAntProvv;
|
||||
|
||||
@SqlField(value = "data_titolo", format = CommonConstants.SYSDATE)
|
||||
private Date dataTitolo;
|
||||
@SqlField(value = "data_titolo")
|
||||
private LocalDate dataTitolo;
|
||||
|
||||
@SqlField(value = "gestione", maxLength = 1)
|
||||
private String gestione;
|
||||
|
||||
@SqlField(value = "data_ord", format = CommonConstants.SYSDATE)
|
||||
private Date dataOrd;
|
||||
private LocalDate dataOrd;
|
||||
|
||||
@SqlField(value = "num_ord")
|
||||
private Integer numOrd;
|
||||
@@ -203,24 +203,44 @@ public class CtbScad extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataDoc() {
|
||||
public LocalDate getDataDoc() {
|
||||
return dataDoc;
|
||||
}
|
||||
|
||||
public CtbScad setDataDoc(Date dataDoc) {
|
||||
public CtbScad setDataDoc(LocalDate dataDoc) {
|
||||
this.dataDoc = dataDoc;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataScad() {
|
||||
public LocalDate getDataScad() {
|
||||
return dataScad;
|
||||
}
|
||||
|
||||
public CtbScad setDataScad(Date dataScad) {
|
||||
public CtbScad setDataScad(LocalDate dataScad) {
|
||||
this.dataScad = dataScad;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CtbScad setDataUltSoll(LocalDate dataUltSoll) {
|
||||
this.dataUltSoll = dataUltSoll;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CtbScad setDataAntProvv(LocalDate dataAntProvv) {
|
||||
this.dataAntProvv = dataAntProvv;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CtbScad setDataTitolo(LocalDate dataTitolo) {
|
||||
this.dataTitolo = dataTitolo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CtbScad setDataOrd(LocalDate dataOrd) {
|
||||
this.dataOrd = dataOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getImpDare() {
|
||||
return impDare;
|
||||
}
|
||||
@@ -239,11 +259,11 @@ public class CtbScad extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataPag() {
|
||||
public LocalDate getDataPag() {
|
||||
return dataPag;
|
||||
}
|
||||
|
||||
public CtbScad setDataPag(Date dataPag) {
|
||||
public CtbScad setDataPag(LocalDate dataPag) {
|
||||
this.dataPag = dataPag;
|
||||
return this;
|
||||
}
|
||||
@@ -257,15 +277,6 @@ public class CtbScad extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataUltSoll() {
|
||||
return dataUltSoll;
|
||||
}
|
||||
|
||||
public CtbScad setDataUltSoll(Date dataUltSoll) {
|
||||
this.dataUltSoll = dataUltSoll;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getUltSoll() {
|
||||
return ultSoll;
|
||||
}
|
||||
@@ -284,21 +295,28 @@ public class CtbScad extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataAntProvv() {
|
||||
public LocalDate getDataUltSoll() {
|
||||
return dataUltSoll;
|
||||
}
|
||||
|
||||
public LocalDate getDataAntProvv() {
|
||||
return dataAntProvv;
|
||||
}
|
||||
|
||||
public CtbScad setDataAntProvv(Date dataAntProvv) {
|
||||
this.dataAntProvv = dataAntProvv;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataTitolo() {
|
||||
public LocalDate getDataTitolo() {
|
||||
return dataTitolo;
|
||||
}
|
||||
|
||||
public CtbScad setDataTitolo(Date dataTitolo) {
|
||||
this.dataTitolo = dataTitolo;
|
||||
public LocalDate getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public Boolean getInsoluto() {
|
||||
return isInsoluto;
|
||||
}
|
||||
|
||||
public CtbScad setInsoluto(Boolean insoluto) {
|
||||
isInsoluto = insoluto;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -311,15 +329,6 @@ public class CtbScad extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public CtbScad setDataOrd(Date dataOrd) {
|
||||
this.dataOrd = dataOrd;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getNumOrd() {
|
||||
return numOrd;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
@@ -132,6 +133,9 @@ public class JtbComt extends EntityBase {
|
||||
@SqlField(value = "rif_comm", maxLength = 255)
|
||||
private String rifComm;
|
||||
|
||||
@SqlField(value = "data_mod", defaultObjectValue = CommonConstants.TIMESTAMP)
|
||||
private LocalDateTime dataMod;
|
||||
|
||||
@EntityChild
|
||||
private List<JrlDisOrd> jrlDisOrd = new ArrayList<>();
|
||||
|
||||
@@ -468,6 +472,15 @@ public class JtbComt extends EntityBase {
|
||||
this.rifComm = rifComm;
|
||||
}
|
||||
|
||||
public LocalDateTime getDataMod() {
|
||||
return dataMod;
|
||||
}
|
||||
|
||||
public JtbComt setDataMod(LocalDateTime dataMod) {
|
||||
this.dataMod = dataMod;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<JrlDisOrd> getJrlDisOrd() {
|
||||
return jrlDisOrd;
|
||||
}
|
||||
|
||||
@@ -46,39 +46,44 @@ public class MtbAartBarCode extends EntityBase {
|
||||
return codBarre;
|
||||
}
|
||||
|
||||
public void setCodBarre(String codBarre) {
|
||||
public MtbAartBarCode setCodBarre(String codBarre) {
|
||||
this.codBarre = codBarre;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
|
||||
public void setCodMart(String codMart) {
|
||||
public MtbAartBarCode setCodMart(String codMart) {
|
||||
this.codMart = codMart;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BigDecimal getQtaCnf() {
|
||||
return qtaCnf;
|
||||
}
|
||||
|
||||
public void setQtaCnf(BigDecimal qtaCnf) {
|
||||
public MtbAartBarCode setQtaCnf(BigDecimal qtaCnf) {
|
||||
this.qtaCnf = qtaCnf;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagPrimario() {
|
||||
return flagPrimario;
|
||||
}
|
||||
|
||||
public void setFlagPrimario(String flagPrimario) {
|
||||
public MtbAartBarCode setFlagPrimario(String flagPrimario) {
|
||||
this.flagPrimario = flagPrimario;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTipoCodBarre() {
|
||||
return tipoCodBarre;
|
||||
}
|
||||
|
||||
public void setTipoCodBarre(String tipoCodBarre) {
|
||||
public MtbAartBarCode setTipoCodBarre(String tipoCodBarre) {
|
||||
this.tipoCodBarre = tipoCodBarre;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,13 @@ public class MtbGrup extends EntityBase implements EquatableEntityInterface<MtbG
|
||||
@EntityChild
|
||||
private List<MtbSfam> mtbSfam = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
private List<MtbSsfam> mtbSsfam;
|
||||
|
||||
{
|
||||
mtbSsfam = new ArrayList<>();
|
||||
}
|
||||
|
||||
public MtbGrup() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -169,6 +176,8 @@ public class MtbGrup extends EntityBase implements EquatableEntityInterface<MtbG
|
||||
|
||||
@Override
|
||||
protected void deleteChilds() throws Exception {
|
||||
MtbSsfam mtbSsfam = new MtbSsfam();
|
||||
mtbSsfam.deleteAllEntities(connection, this);
|
||||
MtbSfam mtbSfam = new MtbSfam();
|
||||
mtbSfam.deleteAllEntities(connection, this);
|
||||
MtbSgrp mtbSgrp = new MtbSgrp();
|
||||
|
||||
@@ -2,13 +2,13 @@ package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.types.ApplicationName;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
@@ -102,8 +102,8 @@ public class MtbLisvData extends EntityBase {
|
||||
@SqlField(value = "val_oneri", nullable = false, defaultObjectValue = "0")
|
||||
private BigDecimal valOneri;
|
||||
|
||||
@SqlField(value = "data_agg_prz", defaultObjectValue = CommonConstants.TIMESTAMP)
|
||||
private Date dataAggPrz;
|
||||
@SqlField(value = "data_agg_prz")
|
||||
private LocalDateTime dataAggPrz;
|
||||
|
||||
@SqlField(value = "tipo_variazione", maxLength = 1, nullable = false)
|
||||
private String tipoVariazione;
|
||||
@@ -183,11 +183,11 @@ public class MtbLisvData extends EntityBase {
|
||||
|
||||
@ImportFromParent
|
||||
@MapToTable("data_iniz")
|
||||
private Date dataIniz;
|
||||
private LocalDate dataIniz;
|
||||
|
||||
@ImportFromParent
|
||||
@MapToTable("data_fine")
|
||||
private Date dataFine;
|
||||
private LocalDate dataFine;
|
||||
|
||||
@ImportFromParent
|
||||
@MapToTable("cod_promo")
|
||||
@@ -210,6 +210,8 @@ public class MtbLisvData extends EntityBase {
|
||||
@JsonProperty("elenco_lisv_rif")
|
||||
private String elencoLisvRif;
|
||||
|
||||
private Boolean chiusuraImmediata;
|
||||
|
||||
@EntityChild
|
||||
private List<TtbLisvTaglieData> ttbLisvTaglieData = new ArrayList<>();
|
||||
|
||||
@@ -438,11 +440,11 @@ public class MtbLisvData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataAggPrz() {
|
||||
public LocalDateTime getDataAggPrz() {
|
||||
return dataAggPrz;
|
||||
}
|
||||
|
||||
public MtbLisvData setDataAggPrz(Date dataAggPrz) {
|
||||
public MtbLisvData setDataAggPrz(LocalDateTime dataAggPrz) {
|
||||
this.dataAggPrz = dataAggPrz;
|
||||
return this;
|
||||
}
|
||||
@@ -627,20 +629,20 @@ public class MtbLisvData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataIniz() {
|
||||
public LocalDate getDataIniz() {
|
||||
return dataIniz;
|
||||
}
|
||||
|
||||
public MtbLisvData setDataIniz(Date dataIniz) {
|
||||
public MtbLisvData setDataIniz(LocalDate dataIniz) {
|
||||
this.dataIniz = dataIniz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataFine() {
|
||||
public LocalDate getDataFine() {
|
||||
return dataFine;
|
||||
}
|
||||
|
||||
public MtbLisvData setDataFine(Date dataFine) {
|
||||
public MtbLisvData setDataFine(LocalDate dataFine) {
|
||||
this.dataFine = dataFine;
|
||||
return this;
|
||||
}
|
||||
@@ -699,6 +701,15 @@ public class MtbLisvData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getChiusuraImmediata() {
|
||||
return chiusuraImmediata;
|
||||
}
|
||||
|
||||
public MtbLisvData setChiusuraImmediata(Boolean chiusuraImmediata) {
|
||||
this.chiusuraImmediata = chiusuraImmediata;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFlagEquiPrezzo() {
|
||||
return flagEquiPrezzo;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@PropertyReactive
|
||||
@Table(MtbLisvDataSpese.ENTITY)
|
||||
@@ -53,7 +53,7 @@ public class MtbLisvDataSpese extends EntityBase {
|
||||
private Integer a;
|
||||
|
||||
@ImportFromParent
|
||||
private Date dataIniz;
|
||||
private LocalDate dataIniz;
|
||||
|
||||
public MtbLisvDataSpese() {
|
||||
super(logger);
|
||||
@@ -135,11 +135,11 @@ public class MtbLisvDataSpese extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataIniz() {
|
||||
public LocalDate getDataIniz() {
|
||||
return dataIniz;
|
||||
}
|
||||
|
||||
public void setDataIniz(Date dataIniz) {
|
||||
public void setDataIniz(LocalDate dataIniz) {
|
||||
this.dataIniz = dataIniz;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.ems_model.annotation.EntityChild;
|
||||
import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
@@ -10,6 +11,8 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@PropertyReactive
|
||||
@@ -38,6 +41,13 @@ public class MtbSfam extends EntityBase implements EquatableEntityInterface<MtbS
|
||||
@SqlField(value = "descrizione", maxLength = 40, nullable = false)
|
||||
private String descrizione;
|
||||
|
||||
@EntityChild
|
||||
private List<MtbSsfam> mtbSsfam;
|
||||
|
||||
{
|
||||
mtbSsfam = new ArrayList<>();
|
||||
}
|
||||
|
||||
public MtbSfam() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -74,6 +84,21 @@ public class MtbSfam extends EntityBase implements EquatableEntityInterface<MtbS
|
||||
this.descrizione = descrizione;
|
||||
}
|
||||
|
||||
public List<MtbSsfam> getMtbSsfam() {
|
||||
return mtbSsfam;
|
||||
}
|
||||
|
||||
public MtbSfam setMtbSsfam(List<MtbSsfam> mtbSsfam) {
|
||||
this.mtbSsfam = mtbSsfam;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void deleteChilds() throws Exception {
|
||||
MtbSsfam mtbSsfam = new MtbSsfam();
|
||||
mtbSsfam.deleteAllEntities(connection, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(MtbSfam other) {
|
||||
if (this == other)
|
||||
|
||||
@@ -59,6 +59,13 @@ public class MtbSgrp extends EntityBase implements EquatableEntityInterface<MtbS
|
||||
@EntityChild
|
||||
private List<MtbSfam> mtbSfam = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
private List<MtbSsfam> mtbSsfam;
|
||||
|
||||
{
|
||||
mtbSsfam = new ArrayList<>();
|
||||
}
|
||||
|
||||
public MtbSgrp() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -162,6 +169,8 @@ public class MtbSgrp extends EntityBase implements EquatableEntityInterface<MtbS
|
||||
|
||||
@Override
|
||||
protected void deleteChilds() throws Exception {
|
||||
MtbSsfam mtbSsfam = new MtbSsfam();
|
||||
mtbSsfam.deleteAllEntities(connection, this);
|
||||
MtbSfam mtbSfam = new MtbSfam();
|
||||
mtbSfam.deleteAllEntities(connection, this);
|
||||
}
|
||||
|
||||
131
ems-core/src/main/java/it/integry/ems_model/entity/MtbSsfam.java
Normal file
131
ems-core/src/main/java/it/integry/ems_model/entity/MtbSsfam.java
Normal file
@@ -0,0 +1,131 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.ems_model.annotation.FK;
|
||||
import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
@PropertyReactive()
|
||||
@Table(MtbSsfam.ENTITY)
|
||||
@JsonTypeName( MtbSsfam.ENTITY)
|
||||
public class MtbSsfam extends EntityBase implements EquatableEntityInterface<MtbSsfam> {
|
||||
|
||||
public final static String ENTITY = "mtb_ssfam";
|
||||
|
||||
private final static Long serialVersionUID = 1L;
|
||||
|
||||
private final static Logger logger = LogManager.getLogger();
|
||||
|
||||
public MtbSsfam() {
|
||||
super(logger);
|
||||
}
|
||||
|
||||
@PK()
|
||||
@SqlField(value = "cod_mgrp", maxLength = 5, nullable = false)
|
||||
@FK(tableName = MtbGrup.ENTITY, columnName = "cod_mgrp")
|
||||
@FK(tableName = MtbSfam.ENTITY, columnName = "cod_mgrp")
|
||||
@FK(tableName = MtbSgrp.ENTITY, columnName = "cod_mgrp")
|
||||
private String codMgrp;
|
||||
|
||||
@PK()
|
||||
@SqlField(value = "cod_msgr", maxLength = 5, nullable = false)
|
||||
@FK(tableName = MtbSfam.ENTITY, columnName = "cod_msgr")
|
||||
@FK(tableName = MtbSgrp.ENTITY, columnName = "cod_msgr")
|
||||
private String codMsgr;
|
||||
|
||||
@PK()
|
||||
@SqlField(value = "cod_msfa", maxLength = 6, nullable = false)
|
||||
@FK(tableName = MtbSfam.ENTITY, columnName = "cod_msfa")
|
||||
private String codMsfa;
|
||||
|
||||
@PK()
|
||||
@SqlField(value = "cod_mssfa", maxLength = 6, nullable = false)
|
||||
private String codMssfa;
|
||||
|
||||
@SqlField(value = "descrizione", maxLength = 40, nullable = false)
|
||||
private String descrizione;
|
||||
|
||||
public String getCodMgrp() {
|
||||
return codMgrp;
|
||||
}
|
||||
|
||||
public MtbSsfam setCodMgrp(String codMgrp) {
|
||||
this.codMgrp = codMgrp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMsgr() {
|
||||
return codMsgr;
|
||||
}
|
||||
|
||||
public MtbSsfam setCodMsgr(String codMsgr) {
|
||||
this.codMsgr = codMsgr;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMsfa() {
|
||||
return codMsfa;
|
||||
}
|
||||
|
||||
public MtbSsfam setCodMsfa(String codMsfa) {
|
||||
this.codMsfa = codMsfa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getCodMssfa() {
|
||||
return codMssfa;
|
||||
}
|
||||
|
||||
public MtbSsfam setCodMssfa(String codMssfa) {
|
||||
this.codMssfa = codMssfa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public MtbSsfam setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(MtbSsfam other) {
|
||||
if (this == other)
|
||||
return true;
|
||||
|
||||
if(hashCodeKey() != other.hashCodeKey())
|
||||
return false;
|
||||
|
||||
return Objects.equals(getCodMgrp(), other.getCodMgrp()) && Objects.equals(getCodMsgr(), other.getCodMsgr()) && Objects.equals(getCodMsfa(), other.getCodMsfa()) && Objects.equals(getCodMssfa(), other.getCodMssfa());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCodeKey() {
|
||||
return Objects.hash(getCodMgrp(), getCodMsgr(), getCodMsfa() , getCodMssfa());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof MtbSsfam)) return false;
|
||||
MtbSsfam mtbSsfam = (MtbSsfam) o;
|
||||
return Objects.equals(getCodMgrp(), mtbSsfam.getCodMgrp()) && Objects.equals(getCodMsgr(), mtbSsfam.getCodMsgr()) && Objects.equals(getCodMsfa(), mtbSsfam.getCodMsfa())&& Objects.equals(getCodMssfa(), mtbSsfam.getCodMssfa()) && Objects.equals(getDescrizione(), mtbSsfam.getDescrizione());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getCodMgrp(), getCodMsgr(), getCodMsfa(), getCodMssfa(), getDescrizione());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class MtbVarLisvLog extends EntityBase {
|
||||
@SqlField(value = "cod_vlis", maxLength = 5, nullable = false)
|
||||
private String codVlis;
|
||||
|
||||
@SqlField(value = "versione", nullable = false)
|
||||
@SqlField(value = "versione")
|
||||
private Integer versione;
|
||||
|
||||
@SqlField(value = "cod_promo", maxLength = 10, nullable = true)
|
||||
|
||||
@@ -6,6 +6,7 @@ import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
@@ -153,6 +154,9 @@ public class PtbPros extends EntityBase {
|
||||
@SqlField(value = "flag_stato_pros", nullable = false, defaultObjectValue = "1")
|
||||
private Boolean flagStatoPros;
|
||||
|
||||
@SqlField(value = "data_mod", defaultObjectValue = CommonConstants.TIMESTAMP)
|
||||
private LocalDateTime dataMod;
|
||||
|
||||
@EntityChild
|
||||
private List<PtbProsRif> ptbProsRif = new ArrayList<>();
|
||||
|
||||
@@ -558,6 +562,15 @@ public class PtbPros extends EntityBase {
|
||||
this.flagStatoPros = flagStatoPros;
|
||||
}
|
||||
|
||||
public LocalDateTime getDataMod() {
|
||||
return dataMod;
|
||||
}
|
||||
|
||||
public PtbPros setDataMod(LocalDateTime dataMod) {
|
||||
this.dataMod = dataMod;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<PtbDest> getPtbDest() {
|
||||
return ptbDest;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlDetailId;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
@@ -10,6 +11,8 @@ import org.kie.api.definition.type.PropertyReactive;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@PropertyReactive
|
||||
@Table(PtbProsRif.ENTITY)
|
||||
@JsonTypeName(PtbProsRif.ENTITY)
|
||||
@@ -48,6 +51,9 @@ public class PtbProsRif extends EntityBase {
|
||||
@SqlField(value = "telefono", maxLength = 40)
|
||||
private String telefono;
|
||||
|
||||
@SqlField(value = "data_mod", defaultObjectValue = CommonConstants.TIMESTAMP)
|
||||
private LocalDateTime dataMod;
|
||||
|
||||
public PtbProsRif() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -123,4 +129,13 @@ public class PtbProsRif extends EntityBase {
|
||||
this.telefono = telefono;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getDataMod() {
|
||||
return dataMod;
|
||||
}
|
||||
|
||||
public PtbProsRif setDataMod(LocalDateTime dataMod) {
|
||||
this.dataMod = dataMod;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||
import it.integry.ems_model.entity.key.StbGestSetupKey;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
@@ -11,12 +13,13 @@ import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Master
|
||||
@PropertyReactive
|
||||
@Table(StbGestSetup.ENTITY)
|
||||
@JsonTypeName(StbGestSetup.ENTITY)
|
||||
public class StbGestSetup extends EntityBase {
|
||||
public class StbGestSetup extends EntityBase implements EquatableEntityInterface<StbGestSetup> {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger();
|
||||
|
||||
@@ -94,6 +97,10 @@ public class StbGestSetup extends EntityBase {
|
||||
this.keySection = keySection;
|
||||
}
|
||||
|
||||
public StbGestSetupKey getKey() {
|
||||
return new StbGestSetupKey(gestName, section, keySection);
|
||||
}
|
||||
|
||||
public String getGestName() {
|
||||
return gestName;
|
||||
}
|
||||
@@ -184,6 +191,10 @@ public class StbGestSetup extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagSetupUserDepo() {
|
||||
return "S".equalsIgnoreCase(this.flagSetupDepo);
|
||||
}
|
||||
|
||||
public String getFlagSetupDepo() {
|
||||
return flagSetupDepo;
|
||||
}
|
||||
@@ -193,6 +204,10 @@ public class StbGestSetup extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isFlagSetupUserWeb() {
|
||||
return "S".equalsIgnoreCase(this.flagSetupUserWeb);
|
||||
}
|
||||
|
||||
public String getFlagSetupUserWeb() {
|
||||
return flagSetupUserWeb;
|
||||
}
|
||||
@@ -272,4 +287,31 @@ public class StbGestSetup extends EntityBase {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(StbGestSetup that) {
|
||||
if (this == that)
|
||||
return true;
|
||||
|
||||
if (hashCodeKey() != that.hashCodeKey())
|
||||
return false;
|
||||
|
||||
return Objects.equals(getGestName(), that.getGestName()) && Objects.equals(getSection(), that.getSection()) && Objects.equals(getKeySection(), that.getKeySection());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCodeKey() {
|
||||
return Objects.hash(getGestName(), getSection(), getKeySection());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof StbGestSetup)) return false;
|
||||
StbGestSetup that = (StbGestSetup) o;
|
||||
return Objects.equals(getGestName(), that.getGestName()) && Objects.equals(getSection(), that.getSection()) && Objects.equals(getKeySection(), that.getKeySection()) && Objects.equals(getValue(), that.getValue()) && Objects.equals(getDescription(), that.getDescription()) && Objects.equals(getFlagSync(), that.getFlagSync()) && Objects.equals(getQueryDefault(), that.getQueryDefault()) && Objects.equals(getFlagUserView(), that.getFlagUserView()) && Objects.equals(getDataModifica(), that.getDataModifica()) && Objects.equals(getModificatoDa(), that.getModificatoDa()) && Objects.equals(getFlagSetupDepo(), that.getFlagSetupDepo()) && Objects.equals(getFlagMultiValue(), that.getFlagMultiValue()) && Objects.equals(isFlagSetupUserWeb(), that.isFlagSetupUserWeb()) && Objects.equals(getCodQuery(), that.getCodQuery()) && Objects.equals(getFlagTipoJson(), that.getFlagTipoJson()) && Objects.equals(getFlagTipoColore(), that.getFlagTipoColore()) && Objects.equals(getTipoSetup(), that.getTipoSetup());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getGestName(), getSection(), getKeySection(), getValue(), getDescription(), getFlagSync(), getQueryDefault(), getFlagUserView(), getDataModifica(), getModificatoDa(), getFlagSetupDepo(), getFlagMultiValue(), isFlagSetupUserWeb(), getCodQuery(), getFlagTipoJson(), getFlagTipoColore(), getTipoSetup());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,15 +6,18 @@ import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Master
|
||||
@PropertyReactive
|
||||
@Table(StbGestSetupDepo.ENTITY)
|
||||
@JsonTypeName(StbGestSetupDepo.ENTITY)
|
||||
public class StbGestSetupDepo extends EntityBase {
|
||||
public class StbGestSetupDepo extends EntityBase implements EquatableEntityInterface<StbGestSetupDepo> {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger();
|
||||
|
||||
@@ -95,4 +98,34 @@ public class StbGestSetupDepo extends EntityBase {
|
||||
public void setFlagSync(String flagSync) {
|
||||
this.flagSync = flagSync;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof StbGestSetupDepo)) return false;
|
||||
StbGestSetupDepo that = (StbGestSetupDepo) o;
|
||||
return Objects.equals(getCodMdep(), that.getCodMdep()) && Objects.equals(getGestName(), that.getGestName()) && Objects.equals(getKeySection(), that.getKeySection()) && Objects.equals(getSection(), that.getSection()) && Objects.equals(getValue(), that.getValue()) && Objects.equals(getFlagSync(), that.getFlagSync());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCodeKey() {
|
||||
return Objects.hash(getCodMdep(), getGestName(), getKeySection(), getSection());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getCodMdep(), getGestName(), getKeySection(), getSection(), getValue(), getFlagSync());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(StbGestSetupDepo that) {
|
||||
if (this == that)
|
||||
return true;
|
||||
|
||||
if (hashCodeKey() != that.hashCodeKey())
|
||||
return false;
|
||||
|
||||
return Objects.equals(getCodMdep(), that.getCodMdep()) && Objects.equals(getGestName(), that.getGestName()) && Objects.equals(getSection(), that.getSection()) && Objects.equals(getKeySection(), that.getKeySection());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems_model.annotation.EntityChild;
|
||||
import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
@@ -12,6 +13,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -225,6 +227,9 @@ public class VtbDest extends EntityBase implements EquatableEntityInterface<VtbD
|
||||
@SqlField(value = "stampa_doc_cons", nullable = false, defaultObjectValue = "0")
|
||||
private Boolean stampaDocCons;
|
||||
|
||||
@SqlField(value = "data_mod", defaultObjectValue = CommonConstants.TIMESTAMP)
|
||||
private LocalDateTime dataMod;
|
||||
|
||||
private String precode;
|
||||
|
||||
@EntityChild
|
||||
@@ -828,6 +833,15 @@ public class VtbDest extends EntityBase implements EquatableEntityInterface<VtbD
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDateTime getDataMod() {
|
||||
return dataMod;
|
||||
}
|
||||
|
||||
public VtbDest setDataMod(LocalDateTime dataMod) {
|
||||
this.dataMod = dataMod;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertChilds() throws Exception {
|
||||
for (VtbDestIntercode vtbDestIntercode : getVtbDestIntercode()) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.entity._enum.IBaseEnum;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
@@ -111,6 +112,9 @@ public class VtbList extends EntityBase {
|
||||
@SqlField(value = "flag_add_trasp", nullable = false, defaultObjectValue = "1")
|
||||
private Boolean flagAddTrasp;
|
||||
|
||||
@SqlField(value = "tipo_um", nullable = true)
|
||||
private Short tipoUm;
|
||||
|
||||
@JsonProperty("versioneRif")
|
||||
private Integer versioneRif;
|
||||
|
||||
@@ -123,6 +127,9 @@ public class VtbList extends EntityBase {
|
||||
@EntityChild
|
||||
private List<VtbListPremi> vtbListPremi = new ArrayList<>();
|
||||
|
||||
@EntityChild
|
||||
private List<MtbLisv> mtbLisv = new ArrayList<>();
|
||||
|
||||
public VtbList() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -334,6 +341,15 @@ public class VtbList extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Short getTipoUm() {
|
||||
return tipoUm;
|
||||
}
|
||||
|
||||
public VtbList setTipoUm(Short tipoUm) {
|
||||
this.tipoUm = tipoUm;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Integer getVersioneRif() {
|
||||
return versioneRif;
|
||||
}
|
||||
@@ -370,18 +386,13 @@ public class VtbList extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void insertChilds() throws Exception {
|
||||
for (VtbListPremi vtbListPremi : getVtbListPremi()) {
|
||||
vtbListPremi.manageWithParentConnection(connection, vtbListPremi.getOperation(), dataCompleting, entityHolder);
|
||||
}
|
||||
public List<MtbLisv> getMtbLisv() {
|
||||
return mtbLisv;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateChilds() throws Exception {
|
||||
for (VtbListPremi vtbListPremi : getVtbListPremi()) {
|
||||
vtbListPremi.manageWithParentConnection(connection, vtbListPremi.getOperation(), dataCompleting, entityHolder);
|
||||
}
|
||||
public VtbList setMtbLisv(List<MtbLisv> mtbLisv) {
|
||||
this.mtbLisv = mtbLisv;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -389,4 +400,44 @@ public class VtbList extends EntityBase {
|
||||
VtbListPremi vtbListPremi = new VtbListPremi();
|
||||
vtbListPremi.deleteAllEntities(connection, this);
|
||||
}
|
||||
|
||||
public enum TipoUm implements IBaseEnum<TipoUm> {
|
||||
ARTICOLO(null),
|
||||
COLLI((short) 1),
|
||||
PESO_KG((short) 2);
|
||||
|
||||
private Short value;
|
||||
|
||||
TipoUm(Short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static TipoUm fromValue(Object value) {
|
||||
for (TipoUm tipoUm : TipoUm.values()) {
|
||||
if (tipoUm.value==value) {
|
||||
return tipoUm;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Short getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TipoUm fromInternal(Object val) {
|
||||
return fromValue(val);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,9 @@ import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Statement;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -41,13 +42,13 @@ public class VtbListData extends EntityBase {
|
||||
private Integer versione;
|
||||
|
||||
@SqlField(value = "data_iniz", nullable = false, defaultObjectValue = CommonConstants.SYSDATE)
|
||||
private Date dataIniz;
|
||||
private LocalDate dataIniz;
|
||||
|
||||
@SqlField(value = "data_fine")
|
||||
private Date dataFine;
|
||||
private LocalDate dataFine;
|
||||
|
||||
@SqlField(value = "data_att")
|
||||
private Date dataAtt;
|
||||
private LocalDate dataAtt;
|
||||
|
||||
@SqlField(value = "ricarica", nullable = false)
|
||||
private BigDecimal ricarica;
|
||||
@@ -59,14 +60,14 @@ public class VtbListData extends EntityBase {
|
||||
@SqlField(value = "cod_promo", maxLength = 10)
|
||||
private String codPromo;
|
||||
|
||||
@SqlField(value = "data_ult_var", defaultObjectValue = CommonConstants.TIMESTAMP)
|
||||
private Date dataUltVar;
|
||||
@SqlField(value = "data_ult_var")
|
||||
private LocalDateTime dataUltVar;
|
||||
|
||||
@SqlField(value = "data_trasmissione")
|
||||
private Date dataTrasmissione;
|
||||
private LocalDateTime dataTrasmissione;
|
||||
|
||||
@SqlField(value = "data_trasmissione_fine_promo")
|
||||
private Date dataTrasmissioneFinePromo;
|
||||
private LocalDateTime dataTrasmissioneFinePromo;
|
||||
|
||||
@SqlField(value = "porto", maxLength = 20)
|
||||
private String porto;
|
||||
@@ -83,6 +84,9 @@ public class VtbListData extends EntityBase {
|
||||
@SqlField(value = "condizioni_comm")
|
||||
private String condizioniComm;
|
||||
|
||||
@SqlField(value = "chiusura_immediata", nullable = false, defaultObjectValue = "0")
|
||||
private Boolean chiusuraImmediata;
|
||||
|
||||
@MapToTable("descr_promo")
|
||||
private String descrPromo;
|
||||
|
||||
@@ -137,29 +141,29 @@ public class VtbListData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataIniz() {
|
||||
public LocalDate getDataIniz() {
|
||||
return dataIniz;
|
||||
}
|
||||
|
||||
public VtbListData setDataIniz(Date dataIniz) {
|
||||
public VtbListData setDataIniz(LocalDate dataIniz) {
|
||||
this.dataIniz = dataIniz;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataFine() {
|
||||
public LocalDate getDataFine() {
|
||||
return dataFine;
|
||||
}
|
||||
|
||||
public VtbListData setDataFine(Date dataFine) {
|
||||
public VtbListData setDataFine(LocalDate dataFine) {
|
||||
this.dataFine = dataFine;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataAtt() {
|
||||
public LocalDate getDataAtt() {
|
||||
return dataAtt;
|
||||
}
|
||||
|
||||
public VtbListData setDataAtt(Date dataAtt) {
|
||||
public VtbListData setDataAtt(LocalDate dataAtt) {
|
||||
this.dataAtt = dataAtt;
|
||||
return this;
|
||||
}
|
||||
@@ -191,29 +195,29 @@ public class VtbListData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataUltVar() {
|
||||
public LocalDateTime getDataUltVar() {
|
||||
return dataUltVar;
|
||||
}
|
||||
|
||||
public VtbListData setDataUltVar(Date dataUltVar) {
|
||||
public VtbListData setDataUltVar(LocalDateTime dataUltVar) {
|
||||
this.dataUltVar = dataUltVar;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataTrasmissione() {
|
||||
public LocalDateTime getDataTrasmissione() {
|
||||
return dataTrasmissione;
|
||||
}
|
||||
|
||||
public VtbListData setDataTrasmissione(Date dataTrasmissione) {
|
||||
public VtbListData setDataTrasmissione(LocalDateTime dataTrasmissione) {
|
||||
this.dataTrasmissione = dataTrasmissione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataTrasmissioneFinePromo() {
|
||||
public LocalDateTime getDataTrasmissioneFinePromo() {
|
||||
return dataTrasmissioneFinePromo;
|
||||
}
|
||||
|
||||
public VtbListData setDataTrasmissioneFinePromo(Date dataTrasmissioneFinePromo) {
|
||||
public VtbListData setDataTrasmissioneFinePromo(LocalDateTime dataTrasmissioneFinePromo) {
|
||||
this.dataTrasmissioneFinePromo = dataTrasmissioneFinePromo;
|
||||
return this;
|
||||
}
|
||||
@@ -263,6 +267,15 @@ public class VtbListData extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getChiusuraImmediata() {
|
||||
return chiusuraImmediata;
|
||||
}
|
||||
|
||||
public VtbListData setChiusuraImmediata(Boolean chiusuraImmediata) {
|
||||
this.chiusuraImmediata = chiusuraImmediata;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrPromo() {
|
||||
return descrPromo;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import it.integry.ems_model.annotation.Table;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -33,16 +33,16 @@ public class VtbPromo extends EntityBase {
|
||||
private String descrizione;
|
||||
|
||||
@SqlField(value = "data_iniz_sell_in")
|
||||
private Date dataInizSellIn;
|
||||
private LocalDate dataInizSellIn;
|
||||
|
||||
@SqlField(value = "data_fine_sell_in")
|
||||
private Date dataFineSellIn;
|
||||
private LocalDate dataFineSellIn;
|
||||
|
||||
@SqlField(value = "data_iniz_sell_out")
|
||||
private Date dataInizSellOut;
|
||||
private LocalDate dataInizSellOut;
|
||||
|
||||
@SqlField(value = "data_fine_sell_out")
|
||||
private Date dataFineSellOut;
|
||||
private LocalDate dataFineSellOut;
|
||||
|
||||
@SqlField(value = "flag_promo_rimb", maxLength = 1, nullable = false, defaultObjectValue = "S")
|
||||
private String flagPromoRimb;
|
||||
@@ -123,42 +123,39 @@ public class VtbPromo extends EntityBase {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataInizSellIn() {
|
||||
public LocalDate getDataInizSellIn() {
|
||||
return dataInizSellIn;
|
||||
}
|
||||
|
||||
public VtbPromo setDataInizSellIn(Date dataInizSellIn) {
|
||||
public VtbPromo setDataInizSellIn(LocalDate dataInizSellIn) {
|
||||
this.dataInizSellIn = dataInizSellIn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataFineSellIn() {
|
||||
return dataFineSellIn;
|
||||
}
|
||||
|
||||
public VtbPromo setDataFineSellIn(Date dataFineSellIn) {
|
||||
this.dataFineSellIn = dataFineSellIn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataInizSellOut() {
|
||||
return dataInizSellOut;
|
||||
}
|
||||
|
||||
public VtbPromo setDataInizSellOut(Date dataInizSellOut) {
|
||||
public VtbPromo setDataInizSellOut(LocalDate dataInizSellOut) {
|
||||
this.dataInizSellOut = dataInizSellOut;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataFineSellOut() {
|
||||
public LocalDate getDataFineSellOut() {
|
||||
return dataFineSellOut;
|
||||
}
|
||||
|
||||
public VtbPromo setDataFineSellOut(Date dataFineSellOut) {
|
||||
public LocalDate getDataFineSellIn() {
|
||||
return dataFineSellIn;
|
||||
}
|
||||
|
||||
public VtbPromo setDataFineSellIn(LocalDate dataFineSellIn) {
|
||||
this.dataFineSellIn = dataFineSellIn;
|
||||
return this;
|
||||
}
|
||||
|
||||
public VtbPromo setDataFineSellOut(LocalDate dataFineSellOut) {
|
||||
this.dataFineSellOut = dataFineSellOut;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public String getFlagPromoRimb() {
|
||||
return flagPromoRimb;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class VtbViaggi extends EntityBase {
|
||||
@SqlField(value = "incoterms", maxLength = 20)
|
||||
private String incoterms;
|
||||
|
||||
@SqlField(value = "note_incoterms", maxLength = 20)
|
||||
@SqlField(value = "note_incoterms", maxLength = 40)
|
||||
private String noteIncoterms;
|
||||
|
||||
@Priority(value = 101, copyPk = false)
|
||||
|
||||
@@ -6,15 +6,18 @@ import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import it.integry.ems_model.base.EquatableEntityInterface;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Master
|
||||
@PropertyReactive
|
||||
@Table(WtbGestSetupUser.ENTITY)
|
||||
@JsonTypeName(WtbGestSetupUser.ENTITY)
|
||||
public class WtbGestSetupUser extends EntityBase {
|
||||
public class WtbGestSetupUser extends EntityBase implements EquatableEntityInterface<WtbGestSetupUser> {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger();
|
||||
|
||||
@@ -84,4 +87,34 @@ public class WtbGestSetupUser extends EntityBase {
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCodeKey() {
|
||||
return Objects.hash(getGestName(), getSection(), getKeySection(), getUserName());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equalsKey(WtbGestSetupUser that) {
|
||||
if (this == that)
|
||||
return true;
|
||||
|
||||
if (hashCodeKey() != that.hashCodeKey())
|
||||
return false;
|
||||
|
||||
return Objects.equals(getGestName(), that.getGestName()) && Objects.equals(getSection(), that.getSection()) && Objects.equals(getKeySection(), that.getKeySection()) && Objects.equals(getUserName(), that.getUserName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof WtbGestSetupUser)) return false;
|
||||
WtbGestSetupUser that = (WtbGestSetupUser) o;
|
||||
return Objects.equals(getGestName(), that.getGestName()) && Objects.equals(getKeySection(), that.getKeySection()) && Objects.equals(getSection(), that.getSection()) && Objects.equals(getUserName(), that.getUserName()) && Objects.equals(getValue(), that.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getGestName(), getKeySection(), getSection(), getUserName(), getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package it.integry.ems_model.entity._enum;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
public enum ListinoEnum implements IBaseEnum<ListinoEnum> {
|
||||
COSTO_MEDIO("CMED")
|
||||
, DISTINTA("DIST"), COSTO_ULTIMO("ULTC");
|
||||
|
||||
private final String value;
|
||||
|
||||
ListinoEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static ListinoEnum from(Object value) {
|
||||
String castValue = null;
|
||||
|
||||
if (value instanceof String)
|
||||
castValue = (String) value;
|
||||
|
||||
|
||||
for (ListinoEnum b : ListinoEnum.values()) {
|
||||
if (b.value == castValue)
|
||||
return b;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListinoEnum fromInternal(Object val) {
|
||||
return from(val);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,18 @@ public class DtbOrdtKey {
|
||||
this.numOrd = numOrd;
|
||||
}
|
||||
|
||||
public String getGestione() {
|
||||
return gestione;
|
||||
}
|
||||
|
||||
public Date getDataOrd() {
|
||||
return dataOrd;
|
||||
}
|
||||
|
||||
public Integer getNumOrd() {
|
||||
return numOrd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package it.integry.ems_model.entity.key;
|
||||
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MtbAartKey {
|
||||
|
||||
@SqlField("cod_mart")
|
||||
private String codMart;
|
||||
|
||||
public MtbAartKey() {
|
||||
}
|
||||
|
||||
public MtbAartKey(String codMart) {
|
||||
this.codMart = codMart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof MtbAartKey)) return false;
|
||||
MtbAartKey that = (MtbAartKey) o;
|
||||
return Objects.equals(codMart, that.codMart);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(codMart);
|
||||
}
|
||||
|
||||
|
||||
public String getCodMart() {
|
||||
return codMart;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package it.integry.ems_model.entity.key;
|
||||
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
public class StbGestSetupDepoKey {
|
||||
|
||||
private final String codMdep;
|
||||
private final String gestName;
|
||||
private final String section;
|
||||
private final String keySection;
|
||||
|
||||
public StbGestSetupDepoKey(String codMdep, String gestName, String section, String keySection) {
|
||||
this.codMdep = codMdep;
|
||||
this.gestName = gestName;
|
||||
this.section = section;
|
||||
this.keySection = keySection;
|
||||
}
|
||||
|
||||
|
||||
public String getCodMdep() {
|
||||
return codMdep;
|
||||
}
|
||||
|
||||
public String getGestName() {
|
||||
return gestName;
|
||||
}
|
||||
|
||||
public String getSection() {
|
||||
return section;
|
||||
}
|
||||
|
||||
public String getKeySection() {
|
||||
return keySection;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof StbGestSetupDepoKey)) return false;
|
||||
StbGestSetupDepoKey that = (StbGestSetupDepoKey) o;
|
||||
return Objects.equals(getCodMdep(), that.getCodMdep()) && Objects.equals(getGestName(), that.getGestName()) && Objects.equals(getSection(), that.getSection()) && Objects.equals(getKeySection(), that.getKeySection());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getCodMdep(), getGestName(), getSection(), getKeySection());
|
||||
}
|
||||
|
||||
|
||||
public static StbGestSetupDepoKey fromHashMap(HashMap<String, Object> inputData) {
|
||||
String codMdep = UtilityHashMap.getValueIfExists(inputData, "cod_mdep");
|
||||
String gestName = UtilityHashMap.getValueIfExists(inputData, "gest_name");
|
||||
String section = UtilityHashMap.getValueIfExists(inputData, "section");
|
||||
String keySection = UtilityHashMap.getValueIfExists(inputData, "key_section");
|
||||
|
||||
if (codMdep == null || gestName == null || section == null || keySection == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new StbGestSetupDepoKey(codMdep, gestName, section, keySection);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package it.integry.ems_model.entity.key;
|
||||
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
public class StbGestSetupKey {
|
||||
|
||||
private final String gestName;
|
||||
private final String section;
|
||||
private final String keySection;
|
||||
|
||||
public StbGestSetupKey(String gestName, String section, String keySection) {
|
||||
this.gestName = gestName;
|
||||
this.section = section;
|
||||
this.keySection = keySection;
|
||||
}
|
||||
|
||||
public String getGestName() {
|
||||
return gestName;
|
||||
}
|
||||
|
||||
public String getSection() {
|
||||
return section;
|
||||
}
|
||||
|
||||
public String getKeySection() {
|
||||
return keySection;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof StbGestSetupKey)) return false;
|
||||
StbGestSetupKey that = (StbGestSetupKey) o;
|
||||
return Objects.equals(getGestName(), that.getGestName()) && Objects.equals(getSection(), that.getSection()) && Objects.equals(getKeySection(), that.getKeySection());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getGestName(), getSection(), getKeySection());
|
||||
}
|
||||
|
||||
|
||||
public static StbGestSetupKey fromHashMap(HashMap<String, Object> inputData) {
|
||||
String gestName = UtilityHashMap.getValueIfExists(inputData, "gest_name");
|
||||
String section = UtilityHashMap.getValueIfExists(inputData, "section");
|
||||
String keySection = UtilityHashMap.getValueIfExists(inputData, "key_section");
|
||||
|
||||
if (gestName == null || section == null || keySection == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new StbGestSetupKey(gestName, section, keySection);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package it.integry.ems_model.entity.key;
|
||||
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
public class WtbGestSetupUserKey {
|
||||
|
||||
private final String gestName;
|
||||
private final String section;
|
||||
private final String keySection;
|
||||
private final String username;
|
||||
|
||||
public WtbGestSetupUserKey(String gestName, String section, String keySection, String username) {
|
||||
this.gestName = gestName;
|
||||
this.section = section;
|
||||
this.keySection = keySection;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getGestName() {
|
||||
return gestName;
|
||||
}
|
||||
|
||||
public String getSection() {
|
||||
return section;
|
||||
}
|
||||
|
||||
public String getKeySection() {
|
||||
return keySection;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof WtbGestSetupUserKey)) return false;
|
||||
WtbGestSetupUserKey that = (WtbGestSetupUserKey) o;
|
||||
return Objects.equals(getGestName(), that.getGestName()) && Objects.equals(getSection(), that.getSection()) && Objects.equals(getKeySection(), that.getKeySection()) && Objects.equals(getUsername(), that.getUsername());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getGestName(), getSection(), getKeySection(), getUsername());
|
||||
}
|
||||
|
||||
|
||||
public static WtbGestSetupUserKey fromHashMap(HashMap<String, Object> inputData) {
|
||||
String gestName = UtilityHashMap.getValueIfExists(inputData, "gest_name");
|
||||
String section = UtilityHashMap.getValueIfExists(inputData, "section");
|
||||
String keySection = UtilityHashMap.getValueIfExists(inputData, "key_section");
|
||||
String username = UtilityHashMap.getValueIfExists(inputData, "username");
|
||||
|
||||
if (gestName == null || section == null || keySection == null || username == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new WtbGestSetupUserKey(gestName, section, keySection, username);
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,15 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JavaType;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems_model.entity.StbGestSetup;
|
||||
import it.integry.ems_model.entity.StbGestSetupDepo;
|
||||
import it.integry.ems_model.entity.StbGestSetupDet;
|
||||
import it.integry.ems_model.entity.WtbGestSetupUser;
|
||||
import it.integry.ems_model.utility.Query;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
@@ -15,33 +21,16 @@ import org.json.JSONObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.context.ContextLoader;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class SetupGest {
|
||||
|
||||
// @Autowired
|
||||
// private DynamicCacheService dynamicCacheService;
|
||||
//
|
||||
// @Autowired
|
||||
// private SettingsModel settingsModel;
|
||||
//
|
||||
// @PostContextConstruct(priority = 30)
|
||||
// public void init() {
|
||||
// List<String> dbNames = settingsModel.getAvailableConnections(true).stream()
|
||||
// .map(AvailableConnectionsModel::getDbName)
|
||||
// .distinct()
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// dynamicCacheService.addQuery(DynamicCacheService.Keys.STB_GEST_SETUP_KEY, 1, "SELECT * FROM " + StbGestSetup.ENTITY, StbGestSetup.class, dbNames);
|
||||
// }
|
||||
|
||||
public String getImportSetup(Connection conn, String type, String format, String key) throws Exception {
|
||||
return getSetup(conn, type, format, key, "IMPORT");
|
||||
@@ -101,30 +90,70 @@ public class SetupGest {
|
||||
return !UtilityString.isNullOrEmpty(value) ? BigDecimal.valueOf(Double.parseDouble(value)) : defaultValue;
|
||||
}
|
||||
|
||||
private String getSetup(Connection connection, String gestName, String section, String keySection, String precode) throws SQLException {
|
||||
if (!precode.isEmpty()) {
|
||||
gestName = precode + "_" + gestName;
|
||||
|
||||
private String getSetup(Connection connection, String gestName, String section, String keySection, String precode) {
|
||||
final List<StbGestSetup> result = getGestSetupList(connection,
|
||||
Collections.singletonList(new StbGestSetup(gestName, section, keySection)), null, null, precode);
|
||||
|
||||
if (result == null || result.isEmpty() || result.get(0).getValue() == null)
|
||||
return "";
|
||||
|
||||
return result.get(0).getValue();
|
||||
}
|
||||
|
||||
public List<StbGestSetup> getGestSetupList(Connection connection,
|
||||
List<StbGestSetup> stbGestSetups,
|
||||
@Nullable String username,
|
||||
@Nullable String codMdep,
|
||||
@Nullable String precode) {
|
||||
final IntegryCustomerDB customerDB = IntegryCustomerDB.parse(connection.getDbName());
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
List<StbGestSetup> stbGestSetupDb = entityCacheComponent.getCachedEntitiesList(customerDB, StbGestSetup.ENTITY,
|
||||
x -> stbGestSetups.stream().anyMatch(y -> {
|
||||
String gestName = y.getGestName();
|
||||
if (!UtilityString.isNullOrEmpty(precode)) {
|
||||
gestName = precode + "_" + gestName;
|
||||
}
|
||||
|
||||
return x.getGestName().equalsIgnoreCase(gestName) &&
|
||||
x.getSection().equalsIgnoreCase(y.getSection()) &&
|
||||
x.getKeySection().equalsIgnoreCase(y.getKeySection());
|
||||
}
|
||||
));
|
||||
|
||||
|
||||
for (StbGestSetup stbGestSetup : stbGestSetupDb) {
|
||||
StbGestSetupDepo depoSetup = entityCacheComponent.<StbGestSetupDepo>getCachedEntitiesList(customerDB, StbGestSetupDepo.ENTITY,
|
||||
x -> stbGestSetup.getGestName().equalsIgnoreCase(x.getGestName()) &&
|
||||
stbGestSetup.getSection().equalsIgnoreCase(x.getSection()) &&
|
||||
stbGestSetup.getKeySection().equalsIgnoreCase(x.getKeySection()) &&
|
||||
(x.getCodMdep().equalsIgnoreCase(codMdep))
|
||||
).stream()
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
|
||||
WtbGestSetupUser userSetup = entityCacheComponent.<WtbGestSetupUser>getCachedEntitiesList(customerDB, WtbGestSetupUser.ENTITY,
|
||||
x -> stbGestSetup.getGestName().equalsIgnoreCase(x.getGestName()) &&
|
||||
stbGestSetup.getSection().equalsIgnoreCase(x.getSection()) &&
|
||||
stbGestSetup.getKeySection().equalsIgnoreCase(x.getKeySection()) &&
|
||||
x.getUserName().equalsIgnoreCase(username)
|
||||
).stream()
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
|
||||
if (stbGestSetup.isFlagSetupUserDepo()) {
|
||||
if (depoSetup != null)
|
||||
stbGestSetup.setValue(UtilityString.isNull(depoSetup.getValue(), stbGestSetup.getValue()));
|
||||
} else if (stbGestSetup.isFlagSetupUserWeb()) {
|
||||
if (userSetup != null)
|
||||
stbGestSetup.setValue(UtilityString.isNull(userSetup.getValue(), stbGestSetup.getValue()));
|
||||
}
|
||||
}
|
||||
// String finalGestName = gestName;
|
||||
//
|
||||
// final List<StbGestSetup> stbGestSetups = dynamicCacheService.getObject(DynamicCacheService.Keys.STB_GEST_SETUP_KEY, connection.getCatalog());
|
||||
// final StbGestSetup stbGestSetup = stbGestSetups.parallelStream().filter(x -> x.getGestName().equalsIgnoreCase(finalGestName) &&
|
||||
// x.getSection().equalsIgnoreCase(section) &&
|
||||
// x.getKeySection().equalsIgnoreCase(keySection))
|
||||
// .findFirst()
|
||||
// .orElse(null);
|
||||
//
|
||||
// if(stbGestSetup == null || stbGestSetup.getValue() == null)
|
||||
// return "";
|
||||
//
|
||||
// return stbGestSetup.getValue();
|
||||
|
||||
String query = "SELECT ISNULL(value, '') AS value FROM stb_gest_setup"
|
||||
+ " WHERE gest_name = " + UtilityDB.valueToString(gestName)
|
||||
+ " AND section = " + UtilityDB.valueToString(section)
|
||||
+ " AND key_section = " + UtilityDB.valueToString(keySection);
|
||||
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, query);
|
||||
return stbGestSetupDb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -62,11 +62,11 @@ public class DeviceService {
|
||||
return UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
}
|
||||
|
||||
public void updateUsage(IntegryApplicationEnum application, long deviceId) throws Exception {
|
||||
public void updateUsage(long deviceId) throws Exception {
|
||||
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
|
||||
String updateSql = Query.format("UPDATE stb_devices " +
|
||||
" SET last_use = {}, name = {}" +
|
||||
" WHERE id = {}", UtilityLocalDate.getNowTime(), application.name(), deviceId);
|
||||
" SET last_use = {}" +
|
||||
" WHERE id = {}", UtilityLocalDate.getNowTime(), deviceId);
|
||||
|
||||
UtilityDB.executeSimpleUpdate(multiDBTransactionManager.getPrimaryConnection(), updateSql);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -37,7 +37,7 @@ end
|
||||
rule "completeValUntDISTDocL"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$docR : DtbDocr(valUnt == null && rapConv != null && ("DIST" == listino || listino == null) && codMart != null && gestione == "L")
|
||||
$docR : DtbDocr(valUnt == null && rapConv != null && ("DIST" == listino) && codMart != null && gestione == "L")
|
||||
then
|
||||
BigDecimal valUnt = CommonRules.completeValUntDIST(conn, $docR);
|
||||
modify ( $docR ) { setValUnt(valUnt) }
|
||||
@@ -46,7 +46,7 @@ end
|
||||
rule "completeValUntCMEDDocL"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$docR : DtbDocr(valUnt == null && rapConv != null && ("CMED" == listino || listino == null) && codMart != null && gestione == "L")
|
||||
$docR : DtbDocr(valUnt == null && rapConv != null && ("CMED" == listino ) && codMart != null && gestione == "L")
|
||||
then
|
||||
BigDecimal valUnt= CommonRules.completeValUntCMED(conn, $docR);
|
||||
modify ( $docR ) { setValUnt(valUnt) }
|
||||
|
||||
@@ -11,6 +11,7 @@ import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import org.drools.core.util.bitmask.LongBitMask
|
||||
import it.integry.ems.utility.UtilityEntity
|
||||
import it.integry.ems_model.utility.UtilityDB
|
||||
import java.time.LocalDate
|
||||
|
||||
global Connection conn
|
||||
global String username
|
||||
@@ -53,7 +54,7 @@ when
|
||||
eval(completeRulesEnabled)
|
||||
$lisvData: VtbListData(dataIniz == null)
|
||||
then
|
||||
Date dataIniz = (Date) CommonRules.completeWithDefault(VtbListData.class, "dataIniz");
|
||||
LocalDate dataIniz = (LocalDate) CommonRules.completeWithDefault(VtbListData.class, "dataIniz");
|
||||
modify ( $lisvData ) { setDataIniz(dataIniz) }
|
||||
end
|
||||
|
||||
@@ -388,7 +389,7 @@ when
|
||||
eval(completeRulesEnabled)
|
||||
$entity : MtbLisvData(codVlis != null && operation != OperationType.DELETE)
|
||||
then
|
||||
modify ( $entity ) { setDataAggPrz(new Date()) }
|
||||
modify ( $entity ) { setDataAggPrz(LocalDateTime.now()) }
|
||||
end
|
||||
|
||||
rule "completeCodVlisRif"
|
||||
|
||||
@@ -174,4 +174,28 @@ when
|
||||
$entity: GtbAnagNote(dataIns == null)
|
||||
then
|
||||
modify ( $entity ) { setDataIns(UtilityLocalDate.getNow()) }
|
||||
end
|
||||
|
||||
rule "completeDataModVtbDest"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$entity : VtbDest(operation != OperationType.DELETE)
|
||||
then
|
||||
modify ( $entity ) { setDataMod(LocalDateTime.now()) }
|
||||
end
|
||||
|
||||
rule "completeDataModPtbPros"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$entity : PtbPros(operation != OperationType.DELETE)
|
||||
then
|
||||
modify ( $entity ) { setDataMod(LocalDateTime.now()) }
|
||||
end
|
||||
|
||||
rule "completeDataModPtbProsRif"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$entity : PtbProsRif(operation != OperationType.DELETE)
|
||||
then
|
||||
modify ( $entity ) { setDataMod(LocalDateTime.now()) }
|
||||
end
|
||||
@@ -456,3 +456,15 @@ then
|
||||
throw new CheckConstraintException(String.format("Attenzione! Email non valida per la persona di riferimento %s.",
|
||||
$vtbCliePersRif.getPersonaRif()));
|
||||
end
|
||||
|
||||
|
||||
rule "checkMtbLisvDelete"
|
||||
no-loop
|
||||
when
|
||||
eval(checkRulesEnabled)
|
||||
$entity : MtbLisv(operation == OperationType.DELETE)
|
||||
eval(SalesRules.checkMtbLisvDelete(conn, $entity))
|
||||
then
|
||||
throw new CheckConstraintException(
|
||||
String.format("Attezione!Impossibile cancellare l'articolo %s dal listino %s ci sono variazioni future. ", $entity.getCodMart(), $entity.getCodVlis()));
|
||||
end
|
||||
@@ -65,3 +65,13 @@ then
|
||||
String tipoAnag = CommesseRules.completeTipoAnag(conn, $comT.getCodAnag());
|
||||
modify($comT) {setTipoAnag(tipoAnag)}
|
||||
end
|
||||
|
||||
rule "completeDataMod"
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$entity : JtbComt(operation != OperationType.DELETE)
|
||||
then
|
||||
modify ( $entity ) {
|
||||
setDataMod(LocalDateTime.now())
|
||||
}
|
||||
end
|
||||
@@ -14,6 +14,7 @@ import it.integry.ems.utility.UtilityEntity
|
||||
import it.integry.ems_model.utility.UtilityHashMap
|
||||
import it.integry.ems_model.utility.UtilityDate
|
||||
import it.integry.ems_model.utility.UtilityDB
|
||||
import it.integry.ems_model.config.EmsRestConstants
|
||||
|
||||
global Connection conn
|
||||
global String username
|
||||
@@ -260,7 +261,7 @@ when
|
||||
eval(completeRulesEnabled)
|
||||
$entity: CtbPart(annoPart == null && dataDoc != null && operation != OperationType.DELETE )
|
||||
then
|
||||
int annoPart = UtilityDate.getYear($entity.getDataDoc());
|
||||
int annoPart = $entity.getDataDoc().getYear();
|
||||
modify ( $entity ) { setAnnoPart(annoPart)}
|
||||
end
|
||||
|
||||
@@ -424,7 +425,7 @@ then
|
||||
"ser_doc = '" + $entity.getSerDoc() + "' AND " +
|
||||
"num_doc = " + $entity.getNumDoc();
|
||||
Date dataDoc = (Date) QueryRules.getSingleValue(conn, sql);
|
||||
modify ( $entity ) { setDataDoc(dataDoc) }
|
||||
modify ( $entity ) { setDataDoc(UtilityLocalDate.localDateFromDate(dataDoc)) }
|
||||
end
|
||||
|
||||
|
||||
@@ -436,10 +437,9 @@ when
|
||||
$entity: CtbScad(riaperta != null && riaperta && numCmov !=null)
|
||||
then
|
||||
List<CrlScadParr> crlScadParrs = AccountingRules.completeCrlParrScadScad(conn, $entity);
|
||||
Date dataNull = new Date(-2208992400000L);
|
||||
modify ( $entity ) {
|
||||
setCrlScadParr(crlScadParrs),
|
||||
setDataPag(dataNull) }
|
||||
setDataPag(EmsRestConstants.LOCAL_DATE_NULL) }
|
||||
end
|
||||
|
||||
|
||||
@@ -479,8 +479,7 @@ when
|
||||
eval(completeRulesEnabled)
|
||||
$entity: CtbScad( (impAvere != null && impAvere == 0 ) || (impDare != null && impDare == 0 ))
|
||||
then
|
||||
Date dataNull = new Date(-2208992400000L);
|
||||
modify ( $entity ) { setDataPag(dataNull ) }//impostiamo la data a null
|
||||
modify ( $entity ) { setDataPag(EmsRestConstants.LOCAL_DATE_NULL ) }//impostiamo la data a null
|
||||
end
|
||||
|
||||
rule "completeInseritoDaCtbMovt"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user