Cambiata return in printDocument
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:
@@ -1025,9 +1025,10 @@ public class DocumentController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "printDocument", method = RequestMethod.POST)
|
||||
public ServiceRestResponse printDocument(HttpServletRequest request,
|
||||
@RequestBody PrintDocumentRequestDTO printDocumentRequest) throws Exception {
|
||||
public @ResponseBody
|
||||
byte[] printDocument(HttpServletRequest request,
|
||||
@RequestBody PrintDocumentRequestDTO printDocumentRequest) throws Exception {
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse(documentService.printDocument(printDocumentRequest));
|
||||
return documentService.printDocument(printDocumentRequest);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ public class PrintDocumentRequestDTO {
|
||||
private String serDoc;
|
||||
private Integer numDoc;
|
||||
|
||||
private boolean sendEmail;
|
||||
private boolean stampa;
|
||||
|
||||
public String getCodDtip() {
|
||||
@@ -72,6 +73,15 @@ public class PrintDocumentRequestDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isSendEmail() {
|
||||
return sendEmail;
|
||||
}
|
||||
|
||||
public PrintDocumentRequestDTO setSendEmail(boolean sendEmail) {
|
||||
this.sendEmail = sendEmail;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<PairsDTO> getReportParams(int copy) {
|
||||
List<PairsDTO> pairsDTOList = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -2149,64 +2149,66 @@ public class DocumentService {
|
||||
|
||||
FileItem fileItem = new FileItem(fileName, reportContent);
|
||||
|
||||
String sql = it.integry.ems_model.utility.Query.format(
|
||||
"SELECT e_mail\n" +
|
||||
"FROM vtb_clie_pers_rif\n" +
|
||||
" INNER JOIN stb_tipi_indirizzi ON stb_tipi_indirizzi.tipo_indirizzo = vtb_clie_pers_rif.tipo_indirizzo\n" +
|
||||
"WHERE tipo_documento = %s\n" +
|
||||
" AND cod_anag = %s",
|
||||
codDtip, printDocumentRequest.getCodAnag()
|
||||
);
|
||||
String elencoEmail = String.join(",", UtilityDB.executeSimpleQueryOnlyFirstColumn(conn, sql));
|
||||
if (printDocumentRequest.isSendEmail()){
|
||||
String sql = it.integry.ems_model.utility.Query.format(
|
||||
"SELECT e_mail\n" +
|
||||
"FROM vtb_clie_pers_rif\n" +
|
||||
" INNER JOIN stb_tipi_indirizzi ON stb_tipi_indirizzi.tipo_indirizzo = vtb_clie_pers_rif.tipo_indirizzo\n" +
|
||||
"WHERE tipo_documento = %s\n" +
|
||||
" AND cod_anag = %s",
|
||||
codDtip, printDocumentRequest.getCodAnag()
|
||||
);
|
||||
String elencoEmail = String.join(",", UtilityDB.executeSimpleQueryOnlyFirstColumn(conn, sql));
|
||||
|
||||
if (!elencoEmail.isEmpty()) {
|
||||
String fullName = userSession.getCurrentUser() == null ? "" : userSession.getFullname();
|
||||
sql = "SELECT * FROM stb_gest_setup WHERE gest_name = 'w_einviomail_docupdf_dlg' AND key_section = 'CLIENTI'";
|
||||
List<StbGestSetup> stbGestSetupList = UtilityDB.executeSimpleQueryDTO(conn, sql, StbGestSetup.class);
|
||||
if (!elencoEmail.isEmpty()) {
|
||||
String fullName = userSession.getCurrentUser() == null ? "" : userSession.getFullname();
|
||||
sql = "SELECT * FROM stb_gest_setup WHERE gest_name = 'w_einviomail_docupdf_dlg' AND key_section = 'CLIENTI'";
|
||||
List<StbGestSetup> stbGestSetupList = UtilityDB.executeSimpleQueryDTO(conn, sql, StbGestSetup.class);
|
||||
|
||||
String subject = "", msgText = "";
|
||||
if (stbGestSetupList != null && !stbGestSetupList.isEmpty()) {
|
||||
sql = it.integry.ems_model.utility.Query.format(
|
||||
"SELECT vtb_clie_pers_rif.persona_rif AS 'pers_rif',\n" +
|
||||
" dtb_doct.cod_anag AS 'cod_anag',\n" +
|
||||
" gtb_anag.rag_soc AS 'rag_soc',\n" +
|
||||
" cod_dtip AS 'cod_dtip',\n" +
|
||||
" %s AS 'des_modDoc',\n" +
|
||||
" FORMAT(data_doc, 'dd/MM/yyyy') AS 'data_doc',\n" +
|
||||
" ser_doc AS 'ser_doc',\n" +
|
||||
" CAST(num_doc AS VARCHAR) AS 'num_doc',\n" +
|
||||
" FORMAT(tot_imponib + dtb_doct.tot_iva, 'N', 'it-IT') AS 'tot_doc',\n" +
|
||||
" citta AS 'citta',\n" +
|
||||
" %s AS 'nome_utente'\n" +
|
||||
"FROM dtb_doct\n" +
|
||||
" INNER JOIN vtb_clie_pers_rif ON vtb_clie_pers_rif.cod_anag = dtb_doct.cod_anag\n" +
|
||||
" INNER JOIN gtb_anag ON dtb_doct.cod_anag = gtb_anag.cod_anag\n" +
|
||||
"WHERE num_doc = %s\n" +
|
||||
" AND ser_doc = %s\n" +
|
||||
" AND data_doc = %s\n" +
|
||||
" AND cod_dtip = %s\n" +
|
||||
" AND dtb_doct.cod_anag = %s",
|
||||
dtbTipi.getDescrizione(), fullName, printDocumentRequest.getNumDoc(),
|
||||
printDocumentRequest.getSerDoc(), printDocumentRequest.getDataDoc(), codDtip,
|
||||
printDocumentRequest.getCodAnag()
|
||||
);
|
||||
HashMap<String, Object> resultQuery = UtilityDB.executeSimpleQueryOnlyFirstRow(conn, sql);
|
||||
String subject = "", msgText = "";
|
||||
if (stbGestSetupList != null && !stbGestSetupList.isEmpty()) {
|
||||
sql = it.integry.ems_model.utility.Query.format(
|
||||
"SELECT vtb_clie_pers_rif.persona_rif AS 'pers_rif',\n" +
|
||||
" dtb_doct.cod_anag AS 'cod_anag',\n" +
|
||||
" gtb_anag.rag_soc AS 'rag_soc',\n" +
|
||||
" cod_dtip AS 'cod_dtip',\n" +
|
||||
" %s AS 'des_modDoc',\n" +
|
||||
" FORMAT(data_doc, 'dd/MM/yyyy') AS 'data_doc',\n" +
|
||||
" ser_doc AS 'ser_doc',\n" +
|
||||
" CAST(num_doc AS VARCHAR) AS 'num_doc',\n" +
|
||||
" FORMAT(tot_imponib + dtb_doct.tot_iva, 'N', 'it-IT') AS 'tot_doc',\n" +
|
||||
" citta AS 'citta',\n" +
|
||||
" %s AS 'nome_utente'\n" +
|
||||
"FROM dtb_doct\n" +
|
||||
" INNER JOIN vtb_clie_pers_rif ON vtb_clie_pers_rif.cod_anag = dtb_doct.cod_anag\n" +
|
||||
" INNER JOIN gtb_anag ON dtb_doct.cod_anag = gtb_anag.cod_anag\n" +
|
||||
"WHERE num_doc = %s\n" +
|
||||
" AND ser_doc = %s\n" +
|
||||
" AND data_doc = %s\n" +
|
||||
" AND cod_dtip = %s\n" +
|
||||
" AND dtb_doct.cod_anag = %s",
|
||||
dtbTipi.getDescrizione(), fullName, printDocumentRequest.getNumDoc(),
|
||||
printDocumentRequest.getSerDoc(), printDocumentRequest.getDataDoc(), codDtip,
|
||||
printDocumentRequest.getCodAnag()
|
||||
);
|
||||
HashMap<String, Object> resultQuery = UtilityDB.executeSimpleQueryOnlyFirstRow(conn, sql);
|
||||
|
||||
for (StbGestSetup stbGestSetup : stbGestSetupList) {
|
||||
String valueText = stbGestSetup.getValue();
|
||||
valueText = valueText.replace("%%_", "");
|
||||
for (StbGestSetup stbGestSetup : stbGestSetupList) {
|
||||
String valueText = stbGestSetup.getValue();
|
||||
valueText = valueText.replace("%%_", "");
|
||||
|
||||
for (String key : resultQuery.keySet()) {
|
||||
String value = resultQuery.get(key) == null ? "" : (String) resultQuery.get(key);
|
||||
valueText = valueText.replace(key, value);
|
||||
for (String key : resultQuery.keySet()) {
|
||||
String value = resultQuery.get(key) == null ? "" : (String) resultQuery.get(key);
|
||||
valueText = valueText.replace(key, value);
|
||||
}
|
||||
|
||||
subject = stbGestSetup.getSection().contains("OGGETTO") ? valueText : subject;
|
||||
msgText = stbGestSetup.getSection().contains("TESTO") ? valueText : msgText;
|
||||
}
|
||||
|
||||
subject = stbGestSetup.getSection().contains("OGGETTO") ? valueText : subject;
|
||||
msgText = stbGestSetup.getSection().contains("TESTO") ? valueText : msgText;
|
||||
}
|
||||
}
|
||||
|
||||
mailService.sendMail(null, null, elencoEmail, null, null, subject, msgText, false, fileItem);
|
||||
mailService.sendMail(null, null, elencoEmail, null, null, subject, msgText, false, fileItem);
|
||||
}
|
||||
}
|
||||
|
||||
if (dtbTipi.getFlagArchiviaPdf()) {
|
||||
|
||||
Reference in New Issue
Block a user