Fix compileWordFile

This commit is contained in:
2024-07-25 09:15:29 +02:00
parent 0330046f69
commit e3765a9638

View File

@@ -60,19 +60,19 @@ public class DataSheetServices {
Optional<StbFilesAttached> document = Optional.empty();
String sql = "SELECT stb_files_attached.*\n" +
"FROM mtb_aart_link\n" +
" INNER JOIN stb_files_attached ON stb_files_attached.id_attach = mtb_aart_link.id_attach\n" +
"WHERE type_attach = 'ST'\n" +
" AND mtb_aart_link.cod_mart = " + UtilityDB.valueToString(codMart) + "\n" +
" AND mime_type NOT LIKE '%image%'";
"FROM mtb_aart_link\n" +
" INNER JOIN stb_files_attached ON stb_files_attached.id_attach = mtb_aart_link.id_attach\n" +
"WHERE type_attach = 'ST'\n" +
" AND mtb_aart_link.cod_mart = " + UtilityDB.valueToString(codMart) + "\n" +
" AND mime_type NOT LIKE '%image%'";
List<StbFilesAttached> stbFilesAttacheds = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, StbFilesAttached.class);
if (!UtilityList.isNullOrEmpty(stbFilesAttacheds)){
if (!UtilityList.isNullOrEmpty(stbFilesAttacheds)) {
document = stbFilesAttacheds.stream().findFirst();
}
if (UtilityList.isNullOrEmpty(stbFilesAttacheds) || !document.isPresent()){
if (UtilityList.isNullOrEmpty(stbFilesAttacheds) || !document.isPresent()) {
throw new Exception("Scheda prodotto non trovata");
}
@@ -103,21 +103,22 @@ public class DataSheetServices {
.map(x -> x.substring(x.indexOf("_") + 1))
.collect(Collectors.toList());
sql = String.format(
"SELECT 'descrizione_' + cod_lingua as cod_var, IsNull(descrizione_estesa, descrizione) as descrizione from mtb_aart_desc WHERE cod_mart = %s and cod_lingua in (%s)",
UtilityDB.valueToString(codMart),
UtilityDB.listValueToString( codLingua )
);
if (!codLingua.isEmpty()) {
sql = String.format(
"SELECT 'descrizione_' + cod_lingua as cod_var, IsNull(descrizione_estesa, descrizione) as descrizione from mtb_aart_desc WHERE cod_mart = %s and cod_lingua in (%s)",
UtilityDB.valueToString(codMart),
UtilityDB.listValueToString(codLingua)
);
List<HashMap<String, Object>> descrizioni = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), sql);
List<HashMap<String, Object>> descrizioni = UtilityDB.executeSimpleQuery(multiDBTransactionManager.getPrimaryConnection(), sql);
if (!descrizioni.isEmpty())
hashMaps.addAll(descrizioni);
if (!descrizioni.isEmpty())
hashMaps.addAll(descrizioni);
}
HashMap<String, String> resultMap = new HashMap<>();
allVariables.forEach(variable -> {
if (mtb_aart.containsKey(variable)){
if (mtb_aart.containsKey(variable)) {
resultMap.put(variable, (String) mtb_aart.get(variable));
}
@@ -134,7 +135,7 @@ public class DataSheetServices {
});
});
return resultMap;
return resultMap;
}
private HashMap<String, UtilityDocx.ImageData> getImage(String codMart, List<UtilityDocx.ImageData> allImgVariables) throws Exception {