From c8d37d8e6484dd135dc823b2c31a2db887b1222b Mon Sep 17 00:00:00 2001 From: ybret Date: Mon, 16 Jan 2023 11:42:49 +0100 Subject: [PATCH] =?UTF-8?q?mont=C3=A9e=20de=20version=20en=201.1.11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConditionReportDetail.java | 4 +- .../pgcn/domain/exchange/ImportedDocUnit.java | 3 +- .../DocUnitWorkflowRepositoryImpl.java | 1 - .../service/check/AutomaticCheckService.java | 28 ++++---- .../delivery/DeliveryAsyncService.java | 59 ++++++++++++---- .../delivery/DeliveryProcessService.java | 5 ++ .../ConditionReportExportService.java | 3 +- .../exchange/csv/ImportCSVService.java | 26 +++---- .../service/exchange/omeka/OmekaService.java | 2 +- .../service/storage/ImageMagickService.java | 67 +++++++++++++------ .../csv/StatisticsWorkflowCsvController.java | 22 +----- src/main/resources/config/application.yml | 4 +- src/main/scss/_numahop.scss | 6 ++ .../app/configuration/appconfiguration.html | 4 +- .../viewsFormat/viewsFormatEdit.html | 2 +- .../app/document/allOperations/workflow.html | 2 +- .../scripts/app/document/docUnitListCtrl.js | 24 ++++++- .../scripts/app/document/docUnitsList.html | 7 ++ .../modals/createItemInternetArchive.html | 4 +- .../scripts/app/main/informationsRight.html | 4 +- .../webapp/scripts/app/main/menuLeft.html | 2 +- .../scripts/app/statistics/projects.html | 10 +-- .../modal/common/configureCsvExport.html | 46 ++++++------- .../components/modal/common/getRevisions.html | 2 +- .../modal/modalConfigureCsvExportCtrl.js | 5 +- 25 files changed, 216 insertions(+), 126 deletions(-) diff --git a/src/main/java/fr/progilone/pgcn/domain/document/conditionreport/ConditionReportDetail.java b/src/main/java/fr/progilone/pgcn/domain/document/conditionreport/ConditionReportDetail.java index 3eb1b9f4..8ec508d8 100644 --- a/src/main/java/fr/progilone/pgcn/domain/document/conditionreport/ConditionReportDetail.java +++ b/src/main/java/fr/progilone/pgcn/domain/document/conditionreport/ConditionReportDetail.java @@ -139,7 +139,7 @@ public enum Type { /** * Propriétés du constat d'état */ - @OneToMany(mappedBy = "detail", orphanRemoval = true, fetch = FetchType.LAZY, cascade = CascadeType.ALL) + @OneToMany(mappedBy = "detail", orphanRemoval = true, fetch = FetchType.EAGER, cascade = CascadeType.ALL) @Field(type = FieldType.Nested) private final Set descriptions = new LinkedHashSet<>(); @@ -419,7 +419,7 @@ public Double getInsurance() { public void setInsurance(final Double insurance) { this.insurance = insurance; } - + /** * On force le chargement du createur en json.. */ diff --git a/src/main/java/fr/progilone/pgcn/domain/exchange/ImportedDocUnit.java b/src/main/java/fr/progilone/pgcn/domain/exchange/ImportedDocUnit.java index f317d812..cc8fbe09 100644 --- a/src/main/java/fr/progilone/pgcn/domain/exchange/ImportedDocUnit.java +++ b/src/main/java/fr/progilone/pgcn/domain/exchange/ImportedDocUnit.java @@ -3,6 +3,7 @@ import com.google.common.base.MoreObjects; import fr.progilone.pgcn.domain.AbstractDomainObject; import fr.progilone.pgcn.domain.document.DocUnit; +import org.apache.commons.lang3.RegExUtils; import javax.annotation.Nullable; import javax.persistence.CollectionTable; @@ -220,7 +221,7 @@ public String getDocUnitLabel() { } public void setDocUnitLabel(final String docUnitLabel) { - this.docUnitLabel = docUnitLabel; + this.docUnitLabel = RegExUtils.replaceAll(docUnitLabel, "[\u0088\u0089]", ""); } public String getParentDocUnit() { diff --git a/src/main/java/fr/progilone/pgcn/repository/workflow/DocUnitWorkflowRepositoryImpl.java b/src/main/java/fr/progilone/pgcn/repository/workflow/DocUnitWorkflowRepositoryImpl.java index e91c8dc2..a98406c6 100644 --- a/src/main/java/fr/progilone/pgcn/repository/workflow/DocUnitWorkflowRepositoryImpl.java +++ b/src/main/java/fr/progilone/pgcn/repository/workflow/DocUnitWorkflowRepositoryImpl.java @@ -488,7 +488,6 @@ public List findDocUnitWorkflowsForLocalExport(final String lib return new JPAQuery(em).from(qDocUnitWorkflow) .innerJoin(qDocUnitWorkflow.docUnit, qDocUnit) .leftJoin(qDocUnitWorkflow.states, qDocUnitState) - .fetch() .where(builder.getValue()) .distinct() .list(qDocUnitWorkflow); diff --git a/src/main/java/fr/progilone/pgcn/service/check/AutomaticCheckService.java b/src/main/java/fr/progilone/pgcn/service/check/AutomaticCheckService.java index 2a15c41d..743e7cb3 100644 --- a/src/main/java/fr/progilone/pgcn/service/check/AutomaticCheckService.java +++ b/src/main/java/fr/progilone/pgcn/service/check/AutomaticCheckService.java @@ -235,7 +235,7 @@ public List check(final List checkList * @param results * @param doc */ - private void checkFacile(final AutomaticCheckType checkType, final List results, + private void checkFacile(final AutomaticCheckType checkType, final List results, final DocUnit doc, final String libraryId) { final Set digitalDocs = doc.getDigitalDocuments(); final List batchResults = new ArrayList<>(); @@ -377,7 +377,7 @@ public AutomaticCheckResult checkFileCase(final AutomaticCheckResult result, .forEach((name) -> { if (splitNames.get(name).isPresent()) { // à priori toujours vrai.... - + final SplitFilename split = splitNames.get(name).get(); final String toTest = prefix.startsWith(bibPrefix) ? split.getLibrary().concat(seqSeparator).concat(split.getPrefix()) @@ -389,9 +389,9 @@ public AutomaticCheckResult checkFileCase(final AutomaticCheckResult result, LOG.debug("ERREUR DE CASSE DETECTEE : prefix={} - chaine testee:{}", bibPrefix, toTest); result.addErrorFile(name); - } + } } - + }); } @@ -481,6 +481,10 @@ public List checkMetadataOfFiles(final Map checkMetaDataFilesFormat(final Delivery delive final Map> extractedDmdSec) { final List allResults = new ArrayList<>(); - + // Format de fichier metadonnee AutomaticCheckResult tocResult = initializeAutomaticCheckResult(AutoCheckType.METADATA_FILE); handleLinkResultMetaDatas(tocResult, delivery, digitalIdDoc); @@ -736,13 +740,13 @@ public List checkMetaDataFilesFormat(final Delivery delive MetaDatasCheckService.METS_MIME_TYPE, FileRoleEnum.METS, extractedDmdSec); - + break; case EXCEL: // validation table des matieres excel. final Optional excelToCheck = files.stream().filter(file -> StringUtils.equalsIgnoreCase(file.getName(), dto.getName())).findFirst(); - + if (excelToCheck.isPresent()) { if (excelToCheck.get().getName().endsWith(".xlsx")) { tocResult = metaCheckService.checkMetaDataFileFormat(tocResult, @@ -760,7 +764,7 @@ public List checkMetaDataFilesFormat(final Delivery delive extractedDmdSec); } } - + break; case PDF_MULTI: // Validation pdf/A ocr. @@ -772,7 +776,7 @@ public List checkMetaDataFilesFormat(final Delivery delive MetaDatasCheckService.PDF_MIME_TYPE, FileRoleEnum.PDF_MULTI, extractedDmdSec); - + break; case OTHER: // rien pour le moment.... @@ -781,14 +785,14 @@ public List checkMetaDataFilesFormat(final Delivery delive // ?? COLOR, ?... Valider les elements de l'enum break; } - + if (isTocBlocking && tocResult.getResult().compareTo(AutoCheckResult.OK) != 0) { delivery.setTableOfContentsOK(false); } if (isPdfBlocking && pdfResult.getResult().compareTo(AutoCheckResult.OK) != 0) { delivery.setPdfMultiOK(false); } - + allResults.add(save(tocResult)); allResults.add(save(pdfResult)); } @@ -797,7 +801,7 @@ public List checkMetaDataFilesFormat(final Delivery delive tocResult.setMessage("Table des matières introuvable"); pdfResult.setResult(AutoCheckResult.OTHER); pdfResult.setMessage("PDF multicouches introuvable"); - + if (isTocBlocking && tocResult.getResult().compareTo(AutoCheckResult.OK) != 0) { delivery.setTableOfContentsOK(false); } diff --git a/src/main/java/fr/progilone/pgcn/service/delivery/DeliveryAsyncService.java b/src/main/java/fr/progilone/pgcn/service/delivery/DeliveryAsyncService.java index 604dd682..4a0d5199 100644 --- a/src/main/java/fr/progilone/pgcn/service/delivery/DeliveryAsyncService.java +++ b/src/main/java/fr/progilone/pgcn/service/delivery/DeliveryAsyncService.java @@ -327,14 +327,17 @@ public void processDelivery(final String identifier, final DeliveryProcessResult // Recuperation des fichiers de TOC et pdf multis / OCR. final Map>> tocOcrFiles = prepareTocAndOcrTreatment(delivery, processElement.getMetadatasDTOForPrefix()); - tocFiles = tocOcrFiles.get("tocFiles"); - // Si on ne doit pas generer les pdf ocr => on traite tout de suite - if (!isOcrPdfGeneration) { - multiPdfs = tocOcrFiles.get("multiPdfs"); - // Extraction text ocr des pdfs multi. - extractedOcr = extractOcrText(multiPdfs, documentsForPrefix.size()); + if(tocOcrFiles != null) { + tocFiles = tocOcrFiles.get("tocFiles"); + // Si on ne doit pas generer les pdf ocr => on traite tout de suite + if (!isOcrPdfGeneration) { + multiPdfs = tocOcrFiles.get("multiPdfs"); + // Extraction text ocr des pdfs multi. + extractedOcr = extractOcrText(multiPdfs, documentsForPrefix.size()); + } + } else { + LOG.warn("Fichiers TOC et pdf multi/OCR absents"); } - } /* @@ -456,7 +459,8 @@ public void processDelivery(final String identifier, final DeliveryProcessResult // Avec génération PDF/OCR. final AutomaticCheckRule generateWithoutOcrRule = processElement.getCheckingRules().get(AutoCheckType.GENER_PDF_WITHOUT_OCR); final boolean isPdfGenerationWithoutOcr = generateWithoutOcrRule != null && generateWithoutOcrRule.isActive(); - + LOG.debug("isOcrPdfGeneration {}", isOcrPdfGeneration); + LOG.debug("isPdfGenerationWithoutOcr {}", isPdfGenerationWithoutOcr); if (isOcrPdfGeneration) { multiPdfs = generateOcrPdf(documentsToTreat, libraryId); @@ -543,6 +547,17 @@ public void processDelivery(final String identifier, final DeliveryProcessResult // Moteur de recherche esDeliveryService.indexAsync(identifier); + //delete temporaries files + /* try { + File tmpDir = bm.getTmpDir(libraryId); + Path tmpDirPath = tmpDir.toPath(); + + FileUtils.cleanDirectory(tmpDirPath.getParent().toFile()); + } catch (IOException e) { + LOG.error("Impossible to delete temporaries files"); + LOG.error(e.getMessage(), e); + }*/ + }), SecurityContextHolder.getContext())); } @@ -613,12 +628,22 @@ private Map> generatePdfWithoutOcr(final Map { final Path tmpDir = getTemporaryDirectory(prefix, libraryId); - if(tmpDir != null && !prefixedDoc.getFiles().isEmpty()) { + final DigitalDocument unitializedDigitalDoc = Iterables.getOnlyElement(prefixedDoc.getDigitalDocuments()); + final DigitalDocument digitalDoc = digitalDocumentService.getOneWithDocUnitAndPages(unitializedDigitalDoc.getIdentifier()); + final List pagesIds = digitalDoc.getPages().stream().map(AbstractDomainObject::getIdentifier).collect(Collectors.toList()); + final List storedFiles = binaryRepository.getAllByPageIdentifiersAndFileFormat(pagesIds, ViewsFormatConfiguration.FileFormat.VIEW); + + + final List listNamesFile = getAndCreateDerivedFiles(storedFiles, libraryId); + + if(tmpDir != null) { List listToMap = new ArrayList<>(); - listToMap.add(imService.convertImgFromDirectoryToPdf(prefixedDoc.getFiles(), tmpDir.toString())); + listToMap.add(imService.convertImgFromDirectoryToPdf(prefix, listNamesFile, tmpDir.toString())); mapPdfs.put(prefix, listToMap); } else { //Log file and continue @@ -633,6 +658,8 @@ private Map> generatePdfWithoutOcr(final Map> generateOcrPdf(final Map pagesIds = digitalDoc.getPages().stream().map(AbstractDomainObject::getIdentifier).collect(Collectors.toList()); final List storedFiles = binaryRepository.getAllByPageIdentifiersAndFileFormat(pagesIds, - ViewsFormatConfiguration.FileFormat.ZOOM); + ViewsFormatConfiguration.FileFormat.VIEW); final List pdfs = new ArrayList<>(); mapPdfs.put(digitalDoc.getDigitalId(), pdfs); @@ -704,7 +731,7 @@ private File createTextPathsFile(final String prefix, final String tmpDir, .map(File::getAbsolutePath) .collect(Collectors.toList()); // liste les paths dans un simple fichier texte. - final File tmpFile = new File(tmpDir, prefix + "_input.txt"); + final File tmpFile = new File(tmpDir, prefix + "_input.txt"); try (final FileWriter writer = new FileWriter(tmpFile)) { for (final String p : filesPath) { writer.write(p + System.lineSeparator()); @@ -713,6 +740,14 @@ private File createTextPathsFile(final String prefix, final String tmpDir, return tmpFile; } + private List getAndCreateDerivedFiles(final List storedFiles, final String libraryId) { + + //get and create derived files + return storedFiles.stream() + .map(sf -> bm.getFileForStoredFile(sf, libraryId)) + .collect(Collectors.toList()); + } + /** * Récupération des fichiers masters */ diff --git a/src/main/java/fr/progilone/pgcn/service/delivery/DeliveryProcessService.java b/src/main/java/fr/progilone/pgcn/service/delivery/DeliveryProcessService.java index eccb6a40..c01c6bfe 100644 --- a/src/main/java/fr/progilone/pgcn/service/delivery/DeliveryProcessService.java +++ b/src/main/java/fr/progilone/pgcn/service/delivery/DeliveryProcessService.java @@ -174,6 +174,9 @@ public PreDeliveryDTO predeliver(final Delivery delivery, final boolean createDo return prefixForDirectory == null; }); + if(subDirectories.isEmpty()) { + LOG.info("Aucun repertoire correspondant au prefix: " + prefixes.toString()); + } } final DeliverySlip deliverySlip = new DeliverySlip(); @@ -344,6 +347,7 @@ private List getSubDirectories(final Delivery delivery, final PreDeliveryD LOG.debug("Recherche de fichiers dans le dossier : {}", deliveryPath); final File[] subDirectories = new File(deliveryPath).listFiles(File::isDirectory); + LOG.debug("sous dossier : {}", subDirectories); if (subDirectories == null) { final PgcnError error = buildError(DELIVERY_WRONG_FOLDER); preDeliveryDTO.addError(error); @@ -369,6 +373,7 @@ private Map getPrefixedDocuments(final Delivery deliv final PrefixedDocuments prefixedDocs = new PrefixedDocuments(); prefixedDocs.addPhysicalDocument(physicalDoc); documentsForPrefix.put(physicalDoc.getDigitalId(), prefixedDocs); + LOG.info("documentsForPrefix if: " + documentsForPrefix.toString()); } } else { final PhysicalDocumentDTO physicalDocDTOWorkflow = PhysicalDocumentMapper.INSTANCE.physicalDocumentToPhysicalDocumentDTO(physicalDoc); diff --git a/src/main/java/fr/progilone/pgcn/service/document/conditionreport/ConditionReportExportService.java b/src/main/java/fr/progilone/pgcn/service/document/conditionreport/ConditionReportExportService.java index cc45c446..1d99af59 100644 --- a/src/main/java/fr/progilone/pgcn/service/document/conditionreport/ConditionReportExportService.java +++ b/src/main/java/fr/progilone/pgcn/service/document/conditionreport/ConditionReportExportService.java @@ -98,7 +98,8 @@ public void writeReportTemplate(final OutputStream out, final List docUn templateBuilder.initWorkbook(); // Unités documentaires - final List docUnits = docUnitService.findAllById(docUnitIds).stream().sorted((f1, f2) -> f2.getLabel().compareTo(f1.getLabel())).collect(Collectors.toList()); + final List docUnits = docUnitService.findAllById(docUnitIds).stream() + .sorted((f1, f2) -> f1.getPgcnId().compareTo(f2.getPgcnId())).collect(Collectors.toList()); for (final DocUnit docUnit : docUnits) { final List configurations = propertyConfigurationService.findByLibrary(docUnit.getLibrary()); diff --git a/src/main/java/fr/progilone/pgcn/service/exchange/csv/ImportCSVService.java b/src/main/java/fr/progilone/pgcn/service/exchange/csv/ImportCSVService.java index 272b1f10..a8e16011 100644 --- a/src/main/java/fr/progilone/pgcn/service/exchange/csv/ImportCSVService.java +++ b/src/main/java/fr/progilone/pgcn/service/exchange/csv/ImportCSVService.java @@ -138,9 +138,9 @@ public void importCSVAsync(final File importFile, * @param mappingId * @param parentKeyExpr */ - private ImportReport importCSVRecords(final File importFile, - final ImportReport report, - final String mappingId, + private ImportReport importCSVRecords(final File importFile, + final ImportReport report, + final String mappingId, final String parentKeyExpr, final boolean archivable, final boolean distributable) throws PgcnTechnicalException { @@ -161,9 +161,9 @@ private ImportReport importCSVRecords(final File importFile, * @param mappingId * @param parentKeyExpr */ - private ImportReport importRecord(final Reader in, - final ImportReport importReport, - final String mappingId, + private ImportReport importRecord(final Reader in, + final ImportReport importReport, + final String mappingId, final String parentKeyExpr, final boolean archivable, final boolean distributable) throws PgcnTechnicalException { @@ -173,8 +173,8 @@ private ImportReport importRecord(final Reader in, final CSVMapping mapping = mappingService.findOne(mappingId); if (mapping == null) { throw new PgcnTechnicalException("Il n'existe pas de mapping avec l'identifiant " + mappingId); - } - + } + // Record iterator final CSVParser parser; try { @@ -193,7 +193,7 @@ private ImportReport importRecord(final Reader in, if (key.startsWith("dc:")) { propertyNames.put(key.substring(3), key.substring(3)); entetes.put(i, key); - + } else if (key.equals(parentKeyExpr)) { entetes.put(i, key); } else { @@ -208,7 +208,7 @@ private ImportReport importRecord(final Reader in, propertyNames.put(keyRule, key); entetes.put(i, key); } - + } } @@ -219,8 +219,8 @@ private ImportReport importRecord(final Reader in, propertyTypes.put(propertyNames.get(property), docPropertyTypeService.findOne(property)); } } - - + + // Résumé d'exécution importReport.setCsvMapping(mapping); // lien avec le mapping qui vient d'être chargé final ImportReport runningReport = importReportService.startReport(importReport); @@ -230,7 +230,7 @@ private ImportReport importRecord(final Reader in, // Création des unités documentaires pré-importées à partir des notices new TransactionalJobRunner(transactionService) // Configuration du job - .setCommit(BULK_SIZE).setMaxThreads(Runtime.getRuntime().availableProcessors() - 2) + .setCommit(BULK_SIZE).setMaxThreads(Runtime.getRuntime().availableProcessors()) // Traitement principal .forEach((record) -> { try { diff --git a/src/main/java/fr/progilone/pgcn/service/exchange/omeka/OmekaService.java b/src/main/java/fr/progilone/pgcn/service/exchange/omeka/OmekaService.java index 62b9e2b1..15e0a6c1 100644 --- a/src/main/java/fr/progilone/pgcn/service/exchange/omeka/OmekaService.java +++ b/src/main/java/fr/progilone/pgcn/service/exchange/omeka/OmekaService.java @@ -80,7 +80,7 @@ public class OmekaService { private static final String CSV_COL_SEP = "\t"; private static final String CSV_REPEATED_FIELD_SEP = "|"; - private static final String EMPTY_FIELD_VALUE = "Non renseigné"; + private static final String EMPTY_FIELD_VALUE = ""; private static final String NEW_LINE_SEPARATOR = "\n"; private static final String JPG_EXT = ".jpg"; diff --git a/src/main/java/fr/progilone/pgcn/service/storage/ImageMagickService.java b/src/main/java/fr/progilone/pgcn/service/storage/ImageMagickService.java index 9e771748..36efc149 100644 --- a/src/main/java/fr/progilone/pgcn/service/storage/ImageMagickService.java +++ b/src/main/java/fr/progilone/pgcn/service/storage/ImageMagickService.java @@ -14,6 +14,7 @@ import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; import fr.progilone.pgcn.service.delivery.PrefixedDocuments; import org.apache.commons.collections.MapUtils; @@ -46,6 +47,9 @@ public class ImageMagickService { private DefaultFileFormats defaultFileFormats; public static final String META_DATAS_SEPARATOR = " # "; + public static final String PATH_SEPARATOR = "/"; + public static final String PDF_EXTENSION = ".pdf"; + public static final String DIGIT_NUMBER = "%04d"; @Value("${exifTool.quot_char}") protected String quoteDelim; @@ -100,45 +104,55 @@ public boolean generateThumbnail(final File sourceFile, final File destTmpFile, * @param destPath * @return created pdf file */ - public File convertImgFromDirectoryToPdf(final List imgsToConvert, final String destPath) { + public File convertImgFromDirectoryToPdf(final String prefix, final List imgsToConvert, final String destPath) { //get the path of img File newPdf = null; - File img = imgsToConvert.stream().findAny().orElse(null); - if(img != null) { - Path imgPath = img.toPath(); - String directory = imgPath.getParent().toString(); + if(!imgsToConvert.isEmpty()) { + String destPdf = destPath+PATH_SEPARATOR+prefix+PDF_EXTENSION; + + for(int i=0; i infos = IOUtils.readLines(process.getInputStream(), StandardCharsets.UTF_8); + if (!infos.isEmpty()) { + LOG.debug("[ImageMagick] info during images extraction : {}", infos); + } final List errors = IOUtils.readLines(process.getErrorStream(), StandardCharsets.UTF_8); if (!errors.isEmpty()) { LOG.error("[ImageMagick] Error during images extraction : {}", errors); @@ -152,6 +166,21 @@ public File convertImgFromDirectoryToPdf(final List imgsToConvert, final S return newPdf; } + /** + * Remove the derived images after pdf generated + * @param imgsToConvert + * @param destPath + */ + private void removeDerivedFiles(final List imgsToConvert, final String destPath) { + for(int i=0; i extractImgFromPdf(final File sourceFile, final String destFile sourceFile.getAbsolutePath()+ interval, //NOSONAR destFile); //NOSONA - builder.redirectError(Redirect.INHERIT); - builder.redirectOutput(Redirect.INHERIT); final Process process = builder.start(); if (process.waitFor() == 0) { // ok, convert is done diff --git a/src/main/java/fr/progilone/pgcn/web/rest/statistics/csv/StatisticsWorkflowCsvController.java b/src/main/java/fr/progilone/pgcn/web/rest/statistics/csv/StatisticsWorkflowCsvController.java index 7bfde90f..99fda6a3 100644 --- a/src/main/java/fr/progilone/pgcn/web/rest/statistics/csv/StatisticsWorkflowCsvController.java +++ b/src/main/java/fr/progilone/pgcn/web/rest/statistics/csv/StatisticsWorkflowCsvController.java @@ -88,17 +88,7 @@ public void getWorkflowDeliveryProgressStatistics(final HttpServletRequest reque toDate, 0, Integer.MAX_VALUE); - - final List body = - result.getBody() - .getContent() - .stream() - .peek(workflowDeliveryProgress -> workflowDeliveryProgress.setWorkflow(workflowDeliveryProgress.getWorkflow() - .stream() - .filter(state -> states.contains(state.getKey())) - .collect(Collectors.toList()))) - .collect(Collectors.toList()); - + final List body = result.getBody().getContent(); final List dtos = StatisticsMapper.toWorkflowDeliveryProgressCsvDTO(body); try { @@ -146,15 +136,7 @@ public void getWorkflowDocUnitProgressStatistics(final HttpServletRequest reques 0, Integer.MAX_VALUE); - final List body = - result.getBody() - .getContent() - .stream() - .peek(workflowProgress -> workflowProgress.setWorkflow(workflowProgress.getWorkflow() - .stream() - .filter(state -> states.contains(state.getKey())) - .collect(Collectors.toList()))) - .collect(Collectors.toList()); + final List body = result.getBody().getContent(); final List dtos = StatisticsMapper.toWorkflowDocUnitProgressCsvDTO(body); try { diff --git a/src/main/resources/config/application.yml b/src/main/resources/config/application.yml index 3cffc1e6..e7811647 100644 --- a/src/main/resources/config/application.yml +++ b/src/main/resources/config/application.yml @@ -44,7 +44,7 @@ liquibase.change-log: classpath:/config/liquibase/master.xml spring: datasource: - url: jdbc:mariadb://localhost:3306/pgcn_bsg_preprod?cachePrepStmts=true&prepStmtCacheSize=250&prepStmtCacheSqlLimit=2048&useServerPrepStmts=true&characterEncoding=utf8&useUnicode=true + url: jdbc:mariadb://localhost:3306/pgcn?cachePrepStmts=true&prepStmtCacheSize=250&prepStmtCacheSqlLimit=2048&useServerPrepStmts=true&characterEncoding=utf8&useUnicode=true username: password: hikari: @@ -136,7 +136,7 @@ export: default_uri: http://numahop.fr/ ssh: knownHosts: - strictHostKeyChecking: "no" + strictHostKeyChecking: yes sftp: privateKey: /opt/pgcn/config/id_rsa diff --git a/src/main/scss/_numahop.scss b/src/main/scss/_numahop.scss index cf557575..0d1ffba9 100644 --- a/src/main/scss/_numahop.scss +++ b/src/main/scss/_numahop.scss @@ -12,3 +12,9 @@ margin: 1em; } .workflow__notExist--button {} + +/** Composant: menuLeft **/ +.longMenu { + max-height: 25rem; + overflow: auto; +} diff --git a/src/main/webapp/scripts/app/configuration/appconfiguration.html b/src/main/webapp/scripts/app/configuration/appconfiguration.html index 4d5e5467..3fd6482d 100644 --- a/src/main/webapp/scripts/app/configuration/appconfiguration.html +++ b/src/main/webapp/scripts/app/configuration/appconfiguration.html @@ -154,7 +154,7 @@
Administration
Configurations Bibliothèque Numérique
-
Configuration pour la diffusion la bibliohtèque numérique
+
Configuration pour la diffusion la bibliothèque numérique
Serveurs Z39.50 @@ -208,7 +208,7 @@
Administration
(Dé)clôturer 1 lot / 1 projet
-
+ diff --git a/src/main/webapp/scripts/app/configuration/viewsFormat/viewsFormatEdit.html b/src/main/webapp/scripts/app/configuration/viewsFormat/viewsFormatEdit.html index 64d12899..ec219194 100644 --- a/src/main/webapp/scripts/app/configuration/viewsFormat/viewsFormatEdit.html +++ b/src/main/webapp/scripts/app/configuration/viewsFormat/viewsFormatEdit.html @@ -62,7 +62,7 @@
Fiche
errors="{{ errors.viewWidth }}" default-text="0" onbeforesave="validation.gte0($data)" numa-readonly="formRO"> -
({{::configuration.viewDefaultValue}} par défaut
+
({{::configuration.viewDefaultValue}} par défaut)
Prints
diff --git a/src/main/webapp/scripts/app/document/allOperations/workflow.html b/src/main/webapp/scripts/app/document/allOperations/workflow.html index 181a89ab..6c8a6d4d 100644 --- a/src/main/webapp/scripts/app/document/allOperations/workflow.html +++ b/src/main/webapp/scripts/app/document/allOperations/workflow.html @@ -24,7 +24,7 @@ - + {{ ::workflowCtrl.code['workflow.model.' + state.key] || state.key }} diff --git a/src/main/webapp/scripts/app/document/docUnitListCtrl.js b/src/main/webapp/scripts/app/document/docUnitListCtrl.js index c955cb24..45aa7c21 100644 --- a/src/main/webapp/scripts/app/document/docUnitListCtrl.js +++ b/src/main/webapp/scripts/app/document/docUnitListCtrl.js @@ -50,6 +50,7 @@ mainCtrl.changePageSize = changePageSize; mainCtrl.massExport = massExport; + mainCtrl.massExportCSV = massExportCSV; mainCtrl.massCines = massCines; mainCtrl.massIA = massIA; mainCtrl.massOmeka = massOmeka; @@ -124,7 +125,7 @@ * Modèle pour le tri * @type {Object} */ - mainCtrl.sortModel = ["-label"]; + mainCtrl.sortModel = ["pgcnId"]; /** * La liste a déjà été chargé une première fois @@ -892,7 +893,6 @@ "sortAttributes": mainCtrl.sortModel }; var url = 'api/rest/condreport?' + $httpParamSerializer(params); - // on met la réponse dans un arraybuffer pour conserver l'encodage original dans le fichier sauvegardé $http.get(url, { responseType: 'arraybuffer' }) .then(function (response) { @@ -927,6 +927,26 @@ }); } + /** + * Zip download of selected doc units + * Zip file contains csv files + */ + function massExportCSV() { + ModalSrvc.configureCsvExport() + .then(function (params) { + params.docUnit = _.pluck(mainCtrl.selection, "identifier"); + var url = 'api/rest/export/csv?' + $httpParamSerializer(params); + + // on met la réponse dans un arraybuffer pour conserver l'encodage original dans le fichier sauvegardé + $http.get(url, { responseType: 'arraybuffer' }) + .then(function (response) { + var filename = "massDocUnits-" + new Date().getTime().toString(32) + ".csv"; + var blob = new Blob([response.data], { type: response.headers("content-type") }); + FileSaver.saveAs(blob, filename); + }); + }); + } + /** * Archivage CINES */ diff --git a/src/main/webapp/scripts/app/document/docUnitsList.html b/src/main/webapp/scripts/app/document/docUnitsList.html index b737db73..d5e3022c 100644 --- a/src/main/webapp/scripts/app/document/docUnitsList.html +++ b/src/main/webapp/scripts/app/document/docUnitsList.html @@ -99,6 +99,13 @@ {{::'Export de masse' | translate}} +
  • + + + {{::'Export CSV de masse' | translate}} + +
  • +
  • diff --git a/src/main/webapp/scripts/app/document/modals/createItemInternetArchive.html b/src/main/webapp/scripts/app/document/modals/createItemInternetArchive.html index 1a76560b..052fa4db 100644 --- a/src/main/webapp/scripts/app/document/modals/createItemInternetArchive.html +++ b/src/main/webapp/scripts/app/document/modals/createItemInternetArchive.html @@ -110,14 +110,14 @@ \ No newline at end of file +
  • diff --git a/src/main/webapp/scripts/app/main/menuLeft.html b/src/main/webapp/scripts/app/main/menuLeft.html index 2ca5c045..11a6ebcc 100644 --- a/src/main/webapp/scripts/app/main/menuLeft.html +++ b/src/main/webapp/scripts/app/main/menuLeft.html @@ -64,7 +64,7 @@ Statistiques -