Merge tag 'Hotfix-62' into develop
Finish Hotfix-62
This commit is contained in:
@@ -68,14 +68,13 @@ public class ImportListiniVenditaService {
|
||||
entityList = importFromLisa(aggiornaLisvDTO);
|
||||
} else if ("V".equalsIgnoreCase(aggiornaLisvDTO.getTipoAggiornamento())) {
|
||||
entityList = inserisciVariazioni(aggiornaLisvDTO);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new Exception("Fonte di aggioramento non trovata.");
|
||||
}
|
||||
|
||||
entityList = importAnagListiniService.importAnagListinoAcq(entityList, "V", null, null);
|
||||
|
||||
if (aggiornaLisvDTO.getAggArtCommerciali() != null ) {
|
||||
if (aggiornaLisvDTO.getAggArtCommerciali() != null) {
|
||||
if (Stream.of(entityList).anyMatch(x -> x.getException() == null)) {
|
||||
if (aggiornaLisvDTO.getAggArtCommerciali()) {
|
||||
List<EntityBase> entitySave = aggArtCommerciali(entityList);
|
||||
@@ -273,7 +272,7 @@ public class ImportListiniVenditaService {
|
||||
|
||||
String calcPrzVendIva = "dbo.f_calcPrzVendIva(tmp.cod_vlis, tmp.cod_mart, tmp.prz_vend) ";
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(aggiornaLisvDTO.getTipoArrotondamento()) ) {
|
||||
if (!UtilityString.isNullOrEmpty(aggiornaLisvDTO.getTipoArrotondamento())) {
|
||||
calcPrzVendIva = "dbo.f_roundFromUnit( " + calcPrzVendIva + ", " + UtilityDB.valueToString(aggiornaLisvDTO.getTipoArrotondamento()) + " , " + UtilityDB.valueToString(aggiornaLisvDTO.getMultiplo()) + ") ";
|
||||
}
|
||||
|
||||
@@ -526,12 +525,11 @@ public class ImportListiniVenditaService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void aggiornaLisv4Lisa() throws Exception {
|
||||
public void aggiornaLisv4Lisa() throws Exception {
|
||||
Date dataPopolamento = new Date();
|
||||
Date dataValidita = UtilityDate.RelativeDateTime(dataPopolamento, 1);
|
||||
//Svuota la tabella
|
||||
UtilityDB.executeSimpleUpdate( multiDBTransactionManager.getPrimaryConnection(), "DELETE FROM mtb_lisv_agg_4_lisa");
|
||||
UtilityDB.executeSimpleUpdate(multiDBTransactionManager.getPrimaryConnection(), "DELETE FROM mtb_lisv_agg_4_lisa");
|
||||
MtbLisvAgg4Lisa agg4Lisa = new MtbLisvAgg4Lisa();
|
||||
agg4Lisa.setOperation(OperationType.UPDATE);
|
||||
agg4Lisa.setNativeSql("DELETE FROM mtb_lisv_agg_4_lisa");
|
||||
@@ -568,11 +566,11 @@ public class ImportListiniVenditaService {
|
||||
" on mtb_aart.cod_mart = kit.cod_mart ";
|
||||
|
||||
List<MtbLisvAgg4Lisa> entitiesToProcess = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), query, MtbLisvAgg4Lisa.class);
|
||||
if (entitiesToProcess != null && entitiesToProcess.size() > 0){
|
||||
if (entitiesToProcess != null && entitiesToProcess.size() > 0) {
|
||||
Stream.of(entitiesToProcess)
|
||||
.forEach(lisv -> lisv.setOperation(OperationType.INSERT));
|
||||
List<EntityBase> entityReturn = entityProcessor.processEntityList(entitiesToProcess, true);
|
||||
try{
|
||||
try {
|
||||
UtilityEntity.throwEntitiesException(entityReturn);
|
||||
} catch (Exception e) {
|
||||
if (!UtilityDebug.isDebugExecution()) {
|
||||
@@ -588,7 +586,7 @@ public class ImportListiniVenditaService {
|
||||
multiDBTransactionManager.commitAll();
|
||||
}
|
||||
|
||||
public void aggiornaLisv4Cedi() throws Exception {
|
||||
public void aggiornaLisv4Cedi() throws Exception {
|
||||
Date dataPopolamento = new Date();
|
||||
Date dataValidita = UtilityDate.RelativeDateTime(dataPopolamento, 1);
|
||||
|
||||
@@ -655,7 +653,7 @@ public class ImportListiniVenditaService {
|
||||
Stream.of(entitiesToProcess)
|
||||
.forEach(lisv -> lisv.setOperation(OperationType.INSERT));
|
||||
List<EntityBase> entityReturn = entityProcessor.processEntityList(entitiesToProcess, true);
|
||||
try{
|
||||
try {
|
||||
UtilityEntity.throwEntitiesException(entityReturn);
|
||||
} catch (Exception e) {
|
||||
if (!UtilityDebug.isDebugExecution()) {
|
||||
@@ -677,7 +675,7 @@ public class ImportListiniVenditaService {
|
||||
List<String> listini = UtilityDB.executeSimpleQueryOnlyFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
List<EntityBase> entityList = new ArrayList<>();
|
||||
for (String codVlis: listini) {
|
||||
for (String codVlis : listini) {
|
||||
VtbListData vtbListData = new VtbListData()
|
||||
.setCodVlis(codVlis)
|
||||
.setDataIniz(aggiornaLisvDTO.getDataValidita())
|
||||
@@ -698,7 +696,10 @@ public class ImportListiniVenditaService {
|
||||
List<MtbLisvData> listMtbLisvData = new ArrayList<>();
|
||||
|
||||
Map<String, String> setup = setupGest.getImportSetupSection(multiDBTransactionManager.getPrimaryConnection(), type, format);
|
||||
|
||||
String path = setup.get("PATH_FILE");
|
||||
if (!path.endsWith("\\") || !path.endsWith("/"))
|
||||
path = path + File.separator;
|
||||
|
||||
String fileName = requestDTO.getFileName();
|
||||
if (UtilityString.isNullOrEmpty(fileName))
|
||||
@@ -735,18 +736,18 @@ public class ImportListiniVenditaService {
|
||||
}
|
||||
|
||||
// Controlla se la data di inizio è diversa dalla prima data
|
||||
if(dataInizio != null) {
|
||||
if (dataInizio != null) {
|
||||
if (!currentDataInizio.equals(dataInizio)) {
|
||||
areDatesEqual = false;
|
||||
}
|
||||
}
|
||||
|
||||
dataInizio = currentDataInizio;
|
||||
}else{
|
||||
} else {
|
||||
throw new Exception(String.format("La data inizio è vuota. (Riga: %s)", row.getRowNum() + 1));
|
||||
}
|
||||
|
||||
if (!dataFineString.isEmpty()){
|
||||
if (!dataFineString.isEmpty()) {
|
||||
currentDataFine = formatDate.parse(dataFineString);
|
||||
|
||||
// Verifica che dataFine sia maggiore di dataInizio
|
||||
@@ -755,14 +756,14 @@ public class ImportListiniVenditaService {
|
||||
}
|
||||
|
||||
// Controlla se la data di inizio è diversa dalla prima data
|
||||
if(dataFine != null) {
|
||||
if (dataFine != null) {
|
||||
if (!currentDataFine.equals(dataFine)) {
|
||||
areDatesEqual = false;
|
||||
}
|
||||
}
|
||||
|
||||
dataFine = currentDataFine;
|
||||
}else{
|
||||
} else {
|
||||
throw new Exception(String.format("La data fine è vuota. (Riga: %s)", row.getRowNum() + 1));
|
||||
}
|
||||
|
||||
@@ -772,9 +773,9 @@ public class ImportListiniVenditaService {
|
||||
"SETUP",
|
||||
"MAX_GG_PROMO"));
|
||||
|
||||
if(maxGiorni != 0){
|
||||
if (maxGiorni != 0) {
|
||||
int count = UtilityDate.DaysAfter(dataInizio, dataFine);
|
||||
if(count > maxGiorni){
|
||||
if (count > maxGiorni) {
|
||||
throw new Exception(String.format("Differenza tra data inizio e data fine maggiore di: %s (Riga: %s)", maxGiorni, row.getRowNum() + 1));
|
||||
}
|
||||
}
|
||||
@@ -813,7 +814,7 @@ public class ImportListiniVenditaService {
|
||||
}
|
||||
|
||||
// Verifica che tutte le date siano uguali
|
||||
if(isVolantino && !areDatesEqual) {
|
||||
if (isVolantino && !areDatesEqual) {
|
||||
throw new Exception("Le date non sono tutte uguali.");
|
||||
}
|
||||
|
||||
@@ -835,21 +836,21 @@ public class ImportListiniVenditaService {
|
||||
}).toList();
|
||||
|
||||
List<EntityBase> entitySave = new ArrayList<>();
|
||||
for (Map.Entry<VtbListData, List<MtbLisvData>> l: listini){
|
||||
for (Map.Entry<VtbListData, List<MtbLisvData>> l : listini) {
|
||||
VtbListData vtbListData = l.getKey();
|
||||
vtbListData.setMtbLisvData(l.getValue());
|
||||
checkArticoliListino(vtbListData, anomalie, sepString);
|
||||
entitySave.add(vtbListData);
|
||||
}
|
||||
|
||||
if (anomalie == null || anomalie.size() == 0 ) {
|
||||
if (anomalie == null || anomalie.size() == 0) {
|
||||
entityList = entityProcessor.processEntityList(entitySave, true);
|
||||
|
||||
UtilityEntity.throwEntitiesException(entityList);
|
||||
|
||||
String emailForLog = setup.get("EMAIL_FOR_LOG");
|
||||
if (!UtilityString.isNullOrEmpty(emailForLog) && headless) {
|
||||
String oggetto = "Importazione " + (isVolantino?"volantini":"promozioni") + " andata a buon fine";
|
||||
String oggetto = "Importazione " + (isVolantino ? "volantini" : "promozioni") + " andata a buon fine";
|
||||
String messaggio = oggetto + CommonConstants.A_CAPO +
|
||||
"Sono stati importati " + entityList.size() + " listini";
|
||||
mailService.sendMail(emailForLog, null, oggetto, messaggio);
|
||||
@@ -883,11 +884,11 @@ public class ImportListiniVenditaService {
|
||||
"SELECT cod_mart, descrizione, flag_stato\n" +
|
||||
"FROM mtb_aart\n" +
|
||||
"WHERE cod_mart IN ('%s') ",
|
||||
whereCondArticoli );
|
||||
whereCondArticoli);
|
||||
|
||||
List<HashMap<String, Object>> articoli = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
if (articoli == null || (articoli != null && articoli.size() != elencoArticoli.size())){
|
||||
if (articoli == null || (articoli != null && articoli.size() != elencoArticoli.size())) {
|
||||
List<String> artDb = Stream.of(articoli).map(x -> UtilityHashMap.<String>getValueIfExists(x, "cod_mart")).toList();
|
||||
|
||||
List<String> articoliInesistenti = Stream.of(elencoArticoli).filterNot(x -> artDb.contains(x)).toList();
|
||||
@@ -905,19 +906,19 @@ public class ImportListiniVenditaService {
|
||||
|
||||
List<String> artDisattivi =
|
||||
Stream.of(articoli)
|
||||
.filter(x->UtilityHashMap.<String>getValueIfExists(x, "flag_stato").equalsIgnoreCase("I"))
|
||||
.map(x-> UtilityHashMap.<String>getValueIfExists(x, "cod_mart") + " " + UtilityHashMap.<String>getValueIfExists(x, "descrizione") )
|
||||
.filter(x -> UtilityHashMap.<String>getValueIfExists(x, "flag_stato").equalsIgnoreCase("I"))
|
||||
.map(x -> UtilityHashMap.<String>getValueIfExists(x, "cod_mart") + " " + UtilityHashMap.<String>getValueIfExists(x, "descrizione"))
|
||||
.toList();
|
||||
|
||||
if (artDisattivi != null && artDisattivi.size() > 0 ) {
|
||||
if (artDisattivi != null && artDisattivi.size() > 0) {
|
||||
anomalie.add(
|
||||
AnomalieDTO.error(
|
||||
"I seguenti articoli sono disattivi in anagrafica articoli: " +
|
||||
CommonConstants.A_CAPO +
|
||||
CommonConstants.TAB +
|
||||
CommonConstants.TAB +
|
||||
StringUtils.join(artDisattivi, sep)
|
||||
)
|
||||
CommonConstants.A_CAPO +
|
||||
CommonConstants.TAB +
|
||||
CommonConstants.TAB +
|
||||
StringUtils.join(artDisattivi, sep)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -928,25 +929,25 @@ public class ImportListiniVenditaService {
|
||||
String whereCondArticoli = StringUtils.join(elencoArticoli, "','");
|
||||
String sql =
|
||||
String.format(
|
||||
"SELECT lisv.cod_mart + ' ' + mtb_aart.descrizione\n" +
|
||||
"FROM dbo.getlistinovendita(%s, %s, NULL) lisv\n" +
|
||||
" INNER JOIN mtb_aart ON lisv.cod_mart = mtb_aart.cod_mart\n" +
|
||||
"WHERE lisv.tipo_variazione = 'D'\n" +
|
||||
" AND lisv.cod_mart IN ('%s')\n",
|
||||
"SELECT lisv.cod_mart + ' ' + mtb_aart.descrizione\n" +
|
||||
"FROM dbo.getlistinovendita(%s, %s, NULL) lisv\n" +
|
||||
" INNER JOIN mtb_aart ON lisv.cod_mart = mtb_aart.cod_mart\n" +
|
||||
"WHERE lisv.tipo_variazione = 'D'\n" +
|
||||
" AND lisv.cod_mart IN ('%s')\n",
|
||||
UtilityDB.valueToString(vtbListData.getDataIniz()),
|
||||
UtilityDB.valueToString(vtbListData.getCodVlis()),
|
||||
whereCondArticoli
|
||||
);
|
||||
);
|
||||
|
||||
List<String> artDisattivi = UtilityDB.executeSimpleQueryOnlyFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
if (artDisattivi != null && artDisattivi.size() > 0 ) {
|
||||
if (artDisattivi != null && artDisattivi.size() > 0) {
|
||||
anomalie.add(
|
||||
AnomalieDTO.error(
|
||||
String.format(
|
||||
"Nel listino %s i seguenti articoli sono disattivi in nel listino: " +
|
||||
CommonConstants.A_CAPO +
|
||||
CommonConstants.TAB +
|
||||
CommonConstants.TAB + "%s",
|
||||
CommonConstants.TAB + "%s",
|
||||
vtbListData.getCodVlis(),
|
||||
StringUtils.join(artDisattivi, sep)
|
||||
))
|
||||
@@ -972,7 +973,7 @@ public class ImportListiniVenditaService {
|
||||
|
||||
List<HashMap<String, Object>> artInPromo = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
if (artInPromo != null && artInPromo.size() > 0 ) {
|
||||
if (artInPromo != null && artInPromo.size() > 0) {
|
||||
List<String> listArt = Stream.of(artInPromo)
|
||||
.map(row -> {
|
||||
String s =
|
||||
@@ -1003,10 +1004,10 @@ public class ImportListiniVenditaService {
|
||||
|
||||
}
|
||||
|
||||
private String fillString(String string, int length){
|
||||
if(string.length() < length){
|
||||
private String fillString(String string, int length) {
|
||||
if (string.length() < length) {
|
||||
return UtilityString.fillString(string, '0', length, UtilityString.H_POSITION.LEFT);
|
||||
}else{
|
||||
} else {
|
||||
return string;
|
||||
}
|
||||
}
|
||||
@@ -1052,18 +1053,18 @@ public class ImportListiniVenditaService {
|
||||
}
|
||||
}
|
||||
|
||||
private String dataInizioFine (Boolean inizio, Row row) throws Exception {
|
||||
private String dataInizioFine(Boolean inizio, Row row) throws Exception {
|
||||
String data;
|
||||
Cell dataInizioCell;
|
||||
|
||||
if (inizio){
|
||||
if (inizio) {
|
||||
dataInizioCell = row.getCell(2);
|
||||
|
||||
if (dataInizioCell == null) {
|
||||
throw new Exception("Cella vuota");
|
||||
}
|
||||
|
||||
}else{
|
||||
} else {
|
||||
dataInizioCell = row.getCell(3);
|
||||
|
||||
if (dataInizioCell == null) {
|
||||
|
||||
Reference in New Issue
Block a user