Merge branch 'hotfix/Hotfix-1' into develop
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -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