Merge branch 'master' into feature/RefactoringGestioneColli
Some checks failed
IntegryManagementSystem_Multi/pipeline/head There was a failure building this commit

This commit is contained in:
2025-10-30 16:13:46 +01:00
17 changed files with 111 additions and 34 deletions

View File

@@ -20,6 +20,7 @@ public enum IntegryCustomer {
Biolevante(IntegryCustomerDB.Biolevante_Biolevante,
IntegryCustomerDB.Biolevante_BiolevanteStorico,
IntegryCustomerDB.Biolevante_TenutaSanMartino),
CapelliMonelli(IntegryCustomerDB.CapelliMonelli_CapelliMonelli),
Carelli(IntegryCustomerDB.Carelli_Carelli,
IntegryCustomerDB.Carelli_GestFood,
IntegryCustomerDB.Carelli_Chiuso,

View File

@@ -24,6 +24,7 @@ public enum IntegryCustomerDB {
Biolevante_BiolevanteStorico("biolevante_storico"),
Biolevante_TenutaSanMartino("tenutasanmartino"),
CapelliMonelli_CapelliMonelli("capelli_monelli"),
Carelli_Carelli("carelli"),
Carelli_GestFood("gestfood"),

View File

@@ -175,7 +175,7 @@ public class UtilityUser {
throw new Exception("Attenzione la nuova password non può coincidere con quella attuale.");
int passwordLen = 8;
if (newPassword.length() <= passwordLen)
if (newPassword.length() < passwordLen)
throw new Exception(String.format("Attenzione la password deve essere lunga almeno %s caratteri.", passwordLen));
// validationPasswordChar(newPassword, Caratteri.UPPER);

View File

@@ -4,6 +4,8 @@ import it.integry.ems_model.annotation.*;
import it.integry.ems_model.base.EntityBase;
import org.kie.api.definition.type.PropertyReactive;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.time.LocalDateTime;
import java.util.Date;
import org.apache.logging.log4j.LogManager;
@@ -34,7 +36,7 @@ public class NtbVariazioniExportLog extends EntityBase {
private String codVlis;
@SqlField(value = "data_export")
private Date dataExport;
private LocalDateTime dataExport;
@SqlField(value = "json_string", maxLength = -1)
private String jsonString;
@@ -66,11 +68,11 @@ public class NtbVariazioniExportLog extends EntityBase {
return this;
}
public Date getDataExport() {
public LocalDateTime getDataExport() {
return dataExport;
}
public NtbVariazioniExportLog setDataExport(Date dataExport) {
public NtbVariazioniExportLog setDataExport(LocalDateTime dataExport) {
this.dataExport = dataExport;
return this;
}

View File

@@ -155,3 +155,15 @@ then
setEffectiveEndtime($entity.getEffectiveEndtime() == null?LocalDateTime.now(): $entity.getEffectiveEndtime()) }
end
rule "completeOraAndUserModifier"
no-loop
when
eval(completeRulesEnabled)
$entity : StbActivity(operation != OperationType.DELETE)
then
modify ( $entity ) {
setOraModAct(LocalDateTime.now()),
setUserModifier(username)
}
end

View File

@@ -1,5 +1,6 @@
package it.integry.ems.activity.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import it.integry.common.var.CommonConstants;
import it.integry.ems.activity.dto.SteUPEntryDTO;
import it.integry.ems.activity.dto.SteUpScoreDTO;
@@ -12,9 +13,11 @@ import it.integry.ems.response.StatusResponse;
import it.integry.ems.service.LoginService;
import it.integry.ems.service.dto.LoginAziendaDTO;
import it.integry.ems.status.ServiceChecker;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems_model.config.EmsRestConstants;
import it.integry.ems_model.entity.StbActivity;
import it.integry.ems_model.utility.UtilityDate;
import it.integry.ems_model.utility.Query;
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;
@@ -25,11 +28,14 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.lang.reflect.Method;
import java.nio.file.Files;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
@RestController
@Scope(value = "request")
@@ -46,6 +52,8 @@ public class SteUPController {
private ServiceChecker serviceChecker;
@Autowired
private RequestDataDTO requestDataDTO;
@Autowired
private MultiDBTransactionManager multiDBTransactionManager;
@RequestMapping(value = "/status", method = RequestMethod.GET)
public @ResponseBody
@@ -377,10 +385,61 @@ public class SteUPController {
public @ResponseBody
ServiceRestResponse deleteInspections(HttpServletRequest request,
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd",fallbackPatterns = "yyyy/MM/dd") Date dataInizio,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd",fallbackPatterns = "yyyy/MM/dd") Date dataFine) throws Exception {
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd", fallbackPatterns = "yyyy/MM/dd") Date dataInizio,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd", fallbackPatterns = "yyyy/MM/dd") Date dataFine) throws Exception {
steUPService.deleteInspections(dataInizio, dataFine);
return ServiceRestResponse.createPositiveResponse();
}
@RequestMapping(value = "recuperoIspezioni", method = RequestMethod.POST)
public @ResponseBody
ServiceRestResponse recuperoIspezioni(HttpServletRequest request,
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
@RequestParam String pathFile,
@RequestParam String userName) throws Exception {
File fileInput = new File(pathFile);
Pattern pattern = Pattern.compile(".*json", Pattern.CASE_INSENSITIVE);
File[] filesList = fileInput.listFiles((dir, name) -> pattern.matcher(name).matches());
for (File file : filesList) {
try {
String json = new String(Files.readAllBytes(file.toPath()));
SteUPEntryDTO entry = new ObjectMapper().readValue(json, SteUPEntryDTO.class);
String query = "";
if (entry.getParentActivityId() == null) {
query = Query.format(
"update stb_activity \n" +
"set effective_time = %s \n" +
"where activity_type_id = %s\n" +
"AND cod_jfas = %s\n" +
"AND EXISTS (SELECT * FROM WTB_DEPO WHERE WTB_DEPO.cod_mdep = %s AND WTB_DEPO.user_name = stb_activity.user_name )\n" +
"AND user_creator = %s",
entry.getDataCreation(),
entry.getActivityTypeId(),
entry.getCodJfas(),
entry.getCodMdep(),
userName);
} else {
query = Query.format(
"update stb_activity \n" +
"set effective_time = %s \n" +
"where parent_activity_id = %s\n" +
"AND activity_type_id = %s\n" +
"AND cod_jfas = %s\n" +
"AND user_creator = %s",
entry.getDataCreation(),
entry.getParentActivityId(),
entry.getActivityTypeId(),
entry.getCodJfas(),
userName);
}
System.out.println(query);
UtilityDB.executeStatement(multiDBTransactionManager.getPrimaryConnection(), query);
} catch (Exception e) {
logger.error(request.getRequestURI(), e);
}
}
return ServiceRestResponse.createPositiveResponse();
}
}

View File

@@ -709,7 +709,7 @@ public class ActivityService {
String fullname = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
String title = String.format("Nuova attività pianificata su: %s", commessa);
String message = String.format("Ti è stata pianificata un'attività da: %s (#%s)", fullname, newStbActivity.getActivityId());
String message = String.format("Ti è stata pianificata un'attività da: %s (#%s)", user.getUsername(), newStbActivity.getActivityId());
if (attvitaHelpDesk) {
message = String.format("Il ticket #%s è stato pianificato all'utente %s", newStbActivity.getActivityId(), newStbActivity.getUserName());
}

View File

@@ -456,7 +456,7 @@ public class SteUPService {
String codJfas = entry.getCodJfas();
String codCmac = entry.getCodCmac();
String md5User = entry.getMd5User();
LocalDate dataCreation = UtilityString.parseLocalDate(entry.getDataCreation());
LocalDateTime dataCreation = UtilityString.parseLocalDateTime(entry.getDataCreation());
if (UtilityString.isNullOrEmpty(activityTypeId))
@@ -494,7 +494,7 @@ public class SteUPService {
.setUserModifier(userNameCreator)
.setActivityTypeId(activityTypeIdIspezione)
.setOraInsAct(now)
.setEffectiveTime(dataCreation.atStartOfDay());
.setEffectiveTime(dataCreation);
flag_isNewIspezione = true;
} else { // AGGIORNO ORA ULTIMA MODIFICA
@@ -529,7 +529,7 @@ public class SteUPService {
}
activityItem.setPersonaRif(entry.getPersonaRif());
activityItem.setPriorita(entry.getPriorita());
activityItem.setEffectiveTime(dataCreation.atStartOfDay());
activityItem.setEffectiveTime(dataCreation);
List<String> barcodes = entry.getBarcodes();

View File

@@ -501,6 +501,6 @@ public class MovimentiContabiliDocfinanceDTO {
.setCodCcau(mov.getCausaleCoge())
.setDescrizioneCaus(String.valueOf(mov.hashCode()))
.setNumDoc(Integer.valueOf(mov.getMovimento()))
.setRifImport(mov.getAnnoCoge() + "_" + mov.getMovimento() + "_" + mov.getNumeroRitornoCoge());
.setRifImport(mov.getAnnoCoge() + "_" + mov.getMovimento() + "_" + mov.getProgressivo() + "_" + mov.getNumeroRitornoCoge());
}
}

View File

@@ -21,11 +21,12 @@ import java.util.List;
public class MovimentiContabiliService {
@Autowired
private EntityProcessor entityProcessor;
public CtbMovt save(MultiDBTransactionManager multiDBTransactionManager, CtbMovt ctbMovt) throws Exception {
List<EntityBase> entitiesToSave = new ArrayList<>();
if (ctbMovt.getNumCmov() != null && ctbMovt.getOperation() != OperationType.DELETE) {
if(ctbMovt.getCodAnag()!= null) {
if (ctbMovt.getCodAnag() != null) {
String sql =
Query.format("SELECT cod_anag FROM ctb_movt WHERE num_cmov = %s", ctbMovt.getNumCmov());
@@ -63,7 +64,7 @@ public class MovimentiContabiliService {
List<EntityBase> entityRet = entityProcessor.processEntityList(entitiesToSave, multiDBTransactionManager, true);
UtilityEntity.throwEntitiesException(entityRet);
CtbMovt ctbMovtRet = entityRet.stream().filter(x->x instanceof CtbMovt).map(x->(CtbMovt)x).findFirst().orElse(null);
CtbMovt ctbMovtRet = entityRet.stream().filter(x -> x instanceof CtbMovt).map(x -> (CtbMovt) x).findFirst().orElse(null);
return ctbMovtRet;
}
@@ -89,11 +90,13 @@ public class MovimentiContabiliService {
List<CtbMovt> ctbMovts = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, CtbMovt.class);
if ( ctbMovts == null || ctbMovts.isEmpty()) {
if (ctbMovts == null || ctbMovts.isEmpty()) {
throw new Exception("Impossibile nessun movimento da cancellare.");
}
ctbMovts.stream().forEach(x->{x.setOperation(OperationType.DELETE);});
ctbMovts.stream().forEach(x -> {
x.setOperation(OperationType.DELETE);
});
List<EntityBase> entityBaseList = entityProcessor.processEntityList(ctbMovts, multiDBTransactionManager, false);

View File

@@ -856,7 +856,6 @@ public class VariazioniPvService {
" cod_mdep,\n" +
" MAX(data_ins) AS last_ins\n" +
" FROM doc\n" +
" WHERE data_reg <= '2025/10/14'\n" +
" GROUP BY cod_mdep, cod_mart),\n" +
" last_doc_tot AS (SELECT doc.*\n" +
" FROM max_doc\n" +

View File

@@ -160,7 +160,7 @@ public class MmposServices {
"FROM venduto\n" +
" INNER JOIN relaz_pdv_mag\n" +
" ON venduto._codazienda = relaz_pdv_mag._codazienda AND venduto._codpv = relaz_pdv_mag._codpv\n" +
"WHERE venduto.fltrans NOT IN ('FS', 'PC', 'SS', 'IP', 'VO', 'BB', 'CP')\n" +
"WHERE venduto.fltrans NOT IN ('FS', 'PC', 'SS', 'IP', 'VO', 'BB', 'CP', 'RS')\n" +
"ORDER BY idx\n";
sql = UtilityDB.addwhereCond(sql, whereCond, false);
@@ -263,9 +263,7 @@ public class MmposServices {
multiDBTransactionManager.commitAll();
entityReturn.add(ntbDoct);
} catch (Exception e) {
if (!(e instanceof EntityException && ((EntityException) e).getSqlErrorCode() == 2627)) {
anomalie.add(ScontriniImporterUtilities.setAnomalia(e));
}
anomalie.add(ScontriniImporterUtilities.setAnomalia(e));
multiDBTransactionManager.rollbackAll();
}
}
@@ -387,10 +385,10 @@ public class MmposServices {
NtbDocr ntbDocr = new NtbDocr();
righe.add(ntbDocr);
ntbDocr
.setBarCode(row.getCodice().trim())
.setCodMart(row.getCodInter().trim())
.setReparto(row.getCodRep().trim())
.setDescrizione(row.getDesRidot().trim());
.setBarCode(row.getCodice() != null ? row.getCodice().trim() : null)
.setCodMart(row.getCodInter() != null ? row.getCodInter().trim() : null)
.setReparto(row.getCodRep() != null ? row.getCodRep().trim() : null)
.setDescrizione(row.getDesRidot() != null ? row.getDesRidot().trim() : null);
String promozione = row.getKeysRef();
@@ -524,7 +522,8 @@ public class MmposServices {
}
String opTrans = row.getOpTrans();
if (!UtilityString.isNullOrEmpty(opTrans) && !opTrans.toUpperCase().startsWith("ORD")) {
if (!UtilityString.isNullOrEmpty(opTrans) &&
!opTrans.toUpperCase().startsWith("ORD") ) {
ntbDocr.setCausaleReso(opTrans);
}

View File

@@ -35,11 +35,7 @@ public class ScontriniImporterUtilities {
return AnomalieDTO.warning(e.getMessage());
} else if (e instanceof FileNotFoundException) {
return AnomalieDTO.error(e);
} else {
return AnomalieDTO.error(e);
}
return null;
return AnomalieDTO.error(e);
}
}

View File

@@ -6,6 +6,8 @@ import it.integry.ems.export.base.EntityExportResponse;
import it.integry.ems.file_formatter.csv.CsvMapper;
import it.integry.ems.retail.dto.ZucchettiHrDTO;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems.utility.UtilityDirs;
import it.integry.ems.utility.UtilityFile;
import it.integry.ems_model.service.SetupGest;
import it.integry.ems_model.utility.Query;
import it.integry.ems_model.utility.UtilityDB;
@@ -175,7 +177,7 @@ public class ScontriniZucchettiExportServices {
if ( !dati.isEmpty()) {
String fileName = "Forecast_" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".csv";
String fileName = UtilityDirs.getDirectoryExport(multiDBTransactionManager.getPrimaryConnection().getDbName(), type, format) + "//" + "Forecast_" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".csv";
File file = new File(fileName);
CsvMapper<ZucchettiHrDTO> mapper = new CsvMapper<>();

View File

@@ -217,7 +217,7 @@ public class VariazioniPvExportServices {
}
NtbVariazioniExportLog ntbVariazioniExportLog =
new NtbVariazioniExportLog()
.setDataExport(new Date())
.setDataExport(UtilityLocalDate.getNowTime())
.setCodVlis(variazioniPvDTO.getCodVlis())
.setFormatFile(format)
.setJsonString(json)

View File

@@ -280,7 +280,7 @@ public class GiacenzaService {
" isNull(SUM(movimenti.qta_car * art.qta_std) , 0) + IsNull(giac.qta_iniz, 0) as qta_car,\n" +
" isNull(SUM(movimenti.qta_scar * art.qta_std), 0) as qta_scar,\n" +
" getdate() as data_ins,\n" +
" min(COALESCE(giac.data_reg, movimenti.data_car, getdate())) as data_reg\n" +
" min(COALESCE(giac.data_reg, movimenti.data_car, DATEADD(WEEK, -1, getdate()))) as data_reg\n" +
"FROM movimenti\n" +
" INNER JOIN art ON movimenti.cod_mart = art.cod_mart\n" +
" LEFT OUTER JOIN carelli_giacenza_prog giac ON giac.cod_mdep = movimenti.cod_mdep AND giac.cod_mart = art.cod_mart_mov\n" +

View File

@@ -188,6 +188,9 @@ public class RecuperoScontriniService {
if (listScontrini.size() > 0)
listaCond.add(
"(" + whereCond + " AND venduto.n_scontr in (" + UtilityDB.listValueToString(listScontrini) + ") AND fltrans not in ('UP','UC', 'EP') ) ");
else
listaCond.add(
"(" + whereCond + " AND fltrans not in ('UP','UC', 'EP') ) ");
if (maxIdScontr != null)
listaCond.add(