Merge branch 'master' into feature/RefactoringGestioneColli
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
# Conflicts: # ems-engine/src/main/java/it/integry/ems/document/Import/service/DocumentiDialogoImportServices.java
This commit is contained in:
@@ -1654,13 +1654,18 @@ public class DocumentiDialogoImportServices {
|
||||
|
||||
boolean existOrd = isExistOrdA(codAnag, codMdep, dataOrd, numOrd);
|
||||
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(rifOrd)) {
|
||||
if (!existOrd) {
|
||||
//Vs. Ord. N. 11490 del 06-09-2013
|
||||
String[] datiOrdine = rifOrd.split(" ");
|
||||
numOrd = Integer.parseInt(datiOrdine[3]);
|
||||
dataOrd = UtilityString.parseLocalDate(datiOrdine[5]);
|
||||
if ( UtilityString.isNumber(datiOrdine[3]))
|
||||
numOrd = Integer.parseInt(datiOrdine[3]);
|
||||
|
||||
try {
|
||||
dataOrd = UtilityString.parseLocalDate(datiOrdine[5]);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
existOrd = isExistOrdA(codAnag, codMdep, dataOrd, numOrd);
|
||||
|
||||
@@ -392,6 +392,8 @@ public class DocumentiExportManagerService {
|
||||
query = UtilityDB.addwhereCond(query, whereCondDoc, false);
|
||||
|
||||
List<HashMap<String, Object>> listaDoc = UtilityDB.executeSimpleQuery(conn, query);
|
||||
if (listaDoc == null || listaDoc.isEmpty())
|
||||
throw new Exception("Nessun documento esportato");
|
||||
|
||||
for (HashMap<String, Object> doc : listaDoc) {
|
||||
String codAnag = UtilityHashMap.getValueIfExists(doc, "cod_anag");
|
||||
@@ -735,7 +737,21 @@ public class DocumentiExportManagerService {
|
||||
query = UtilityDB.addwhereCond(query, whereCond, true);
|
||||
query = UtilityDB.addwhereCond(query, whereCondFiltro, true);
|
||||
|
||||
String stringFile = new ResultSetMapper().mapQueryToCSV(conn, query, DocumentiDialogoDTO.Export.class, '\t', true, true);
|
||||
PreparedStatement psRow = multiDBTransactionManager.getPrimaryConnection()
|
||||
.prepareStatement(query,
|
||||
ResultSet.TYPE_SCROLL_INSENSITIVE,
|
||||
ResultSet.CONCUR_READ_ONLY);
|
||||
ResultSet rsRow = psRow.executeQuery();
|
||||
rsRow.last();
|
||||
int count = rsRow.getRow(); // numero righe
|
||||
rsRow.beforeFirst();
|
||||
String stringFile = new ResultSetMapper().mapResultSetToCSV(rsRow, DocumentiDialogoDTO.Export.class, '\t', true, true);
|
||||
rsRow.close();
|
||||
psRow.close();
|
||||
|
||||
if (count == 0 ) {
|
||||
throw new Exception("La query di estrazione righe non ha ritornato nessun risultato");
|
||||
}
|
||||
|
||||
if (!UtilityString.isNullOrEmpty(stringFile)) {
|
||||
String filePath = pathFile + File.separator + fileName;
|
||||
|
||||
@@ -26,14 +26,6 @@ public class AnomalieController {
|
||||
this.anomalieProdService = anomalieProdService;
|
||||
}
|
||||
|
||||
@GetMapping(value = "/lista")
|
||||
public ServiceRestResponse listaAnomalie(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestBody PageableRequestDTO requestData) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(anomalieProdService.getAnomalieProd(requestData, multiDBTransactionManager.getPrimaryConnection()));
|
||||
|
||||
}
|
||||
|
||||
@GetMapping(value = "/livelli/lista")
|
||||
public ServiceRestResponse listaLivelliAnomalie(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB) throws Exception {
|
||||
@@ -53,6 +45,27 @@ public class AnomalieController {
|
||||
}
|
||||
|
||||
}
|
||||
@PostMapping(value = "/livelli/{id}/elimina")
|
||||
public ServiceRestResponse deleteLivelloAnomalia(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@PathVariable Long id) throws Exception {
|
||||
try {
|
||||
anomalieProdService.deleteLivelloAnomalia(multiDBTransactionManager, id);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
} catch (Exception e) {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping(value = "/lista")
|
||||
public ServiceRestResponse listaAnomalie(HttpServletRequest request,
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@RequestBody PageableRequestDTO requestData) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(anomalieProdService.getAnomalieProd(requestData, multiDBTransactionManager.getPrimaryConnection()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/{id}/ul")
|
||||
public ServiceRestResponse getUlAnomalia(HttpServletRequest request,
|
||||
@@ -66,7 +79,8 @@ public class AnomalieController {
|
||||
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
|
||||
@PathVariable Long id) throws Exception {
|
||||
try {
|
||||
return ServiceRestResponse.createPositiveResponse(anomalieProdService.deleteAnomalia(multiDBTransactionManager, id));
|
||||
anomalieProdService.deleteAnomalia(multiDBTransactionManager, id);
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
} catch (Exception e) {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
throw e;
|
||||
|
||||
@@ -151,7 +151,7 @@ public class AnomalieUlService {
|
||||
return anomalia;
|
||||
}
|
||||
|
||||
public Object deleteAnomalia(MultiDBTransactionManager multiDBTransactionManager, Long id) throws Exception {
|
||||
public void deleteAnomalia(MultiDBTransactionManager multiDBTransactionManager, Long id) throws Exception {
|
||||
List<EntityBase> entities = new ArrayList<>();
|
||||
MtbAnomalieUl anomalia = new MtbAnomalieUl();
|
||||
anomalia.setId(id)
|
||||
@@ -160,13 +160,30 @@ public class AnomalieUlService {
|
||||
List<MtbColt> ulAnomalia = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(),
|
||||
"SELECT gestione,data_collo,ser_collo,num_collo, id_anomalia from mtb_colt where id_anomalia = " + id,
|
||||
MtbColt.class);
|
||||
|
||||
ulAnomalia.forEach(x -> AnomalieUlUtility.detachAnomaliaFromUl(x));
|
||||
entities.addAll(ulAnomalia);
|
||||
if (!UtilityList.isNullOrEmpty(ulAnomalia)) {
|
||||
ulAnomalia.forEach(x -> AnomalieUlUtility.detachAnomaliaFromUl(x));
|
||||
entities.addAll(ulAnomalia);
|
||||
}
|
||||
entities.add(anomalia);
|
||||
entityProcessor.processEntityList(entities, multiDBTransactionManager, true);
|
||||
UtilityEntity.throwEntitiesException(entities);
|
||||
return entities;
|
||||
}
|
||||
|
||||
public void deleteLivelloAnomalia(MultiDBTransactionManager multiDBTransactionManager, Long id) throws Exception {
|
||||
|
||||
|
||||
Integer count = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(),"SELECT count(*) from "+MtbAnomalieUl.ENTITY+" \n\r" +
|
||||
"where id_livello_anomalia = " + UtilityDB.valueToString(id) + "");
|
||||
|
||||
if (count > 0)
|
||||
throw new Exception("Impossibile eliminare il livello di anomalia se esistono anomalie associate");
|
||||
|
||||
|
||||
|
||||
MtbLivelliAnomalie anomalia = new MtbLivelliAnomalie();
|
||||
anomalia.setId(id)
|
||||
.setOperation(OperationType.DELETE);
|
||||
entityProcessor.processEntity(anomalia, true, multiDBTransactionManager);
|
||||
}
|
||||
|
||||
public List<MtbLivelliAnomalie> listaLivelliAnomalie(Connection connection) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user