Commit 42730c0c authored by Hando Lukats's avatar Hando Lukats
Browse files

TEIS-2378 implemented changes from testing

parent bf35c5b9
......@@ -30,7 +30,6 @@ import static ee.sm.ti.teis.logging.LoggingHelper.logAdminAlertMessage;
import static ee.sm.ti.teis.servicerequest.UserType.SYSTEM;
import static ee.sm.ti.teis.types.enums.FileScanStatusType.CLEAN;
import static ee.sm.ti.teis.types.enums.FileStatusType.*;
import static ee.sm.ti.teis.types.enums.ObjectStatus.CURRENT;
import static java.util.Collections.emptyList;
import static java.util.UUID.randomUUID;
import static liquibase.util.file.FilenameUtils.getBaseName;
......@@ -72,7 +71,7 @@ public class InitialFileUploadService {
filesInFolder.forEach(file -> {
UUID fileId = UUID.fromString(getBaseName(file.getName()));
fileReferenceRepository.findByFileIdAndObjectTypeAndObjectStatus(fileId, objectType.getId(), CURRENT)
fileReferenceRepository.findByIdAndObjectType(fileId, objectType.getId())
.ifPresentOrElse(
fileReference -> {
if (PENDING.equals(fileReference.getFileStatus()) || ACTIVE.equals(fileReference.getFileStatus())) {
......
......@@ -7,7 +7,6 @@ import ee.sm.ti.teis.riskassessments.riskfactor.service.RiskFactorPublicBusiness
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
import java.util.List;
......@@ -21,8 +20,6 @@ public class RiskFactorPublicGwListener {
private final RiskFactorPublicBusinessService service;
@RabbitListener(queues = {GW_RISK_FACTORS_QUEUE})
@PreAuthorize("@accessController.hasAnyPrivilege('TI_VIEW_RISK_ASSESSMENTS', #request.requestMetaDTO.companyId, " +
"'EX_VIEW_RISK_ASSESSMENTS', null)")
public RiskFactorsPublicResponse getRiskFactors(RiskFactorsPublicRequest request) {
RequestMetaDTO requestMetaDTO = request.getRequestMetaDTO();
List<RiskFactorPublicDto> dtoList = service.getRiskFactors(request.getPayload(), requestMetaDTO);
......
......@@ -76,7 +76,7 @@ public interface RiskFactorRepository extends CrudRepository<RiskFactorEntity, U
"and riskFactor.general = true ")
List<RiskFactorEntity> queryCurrentGeneralByStatus(String status);
@Query("select riskFactor " +
@Query("select distinct riskFactor " +
"from RiskFactorEntity riskFactor " +
" left join BusinessTypeRiskFactorEntity businessTypeRiskFactor " +
" on riskFactor.id = businessTypeRiskFactor.riskFactorId " +
......@@ -86,7 +86,7 @@ public interface RiskFactorRepository extends CrudRepository<RiskFactorEntity, U
"order by riskFactor.name")
List<RiskFactorEntity> queryCurrentActiveByBusinessTypeId(UUID businessTypeId, String status);
@Query("select riskFactor " +
@Query("select distinct riskFactor " +
"from RiskFactorEntity riskFactor " +
" left join BusinessTypeRiskFactorEntity businessTypeRiskFactor " +
" on riskFactor.id = businessTypeRiskFactor.riskFactorId " +
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment