aggiunto invio email a responsabile di commessa
This commit is contained in:
@@ -52,6 +52,7 @@ import net.schmizz.sshj.sftp.SFTPClient;
|
|||||||
import net.schmizz.sshj.transport.verification.PromiscuousVerifier;
|
import net.schmizz.sshj.transport.verification.PromiscuousVerifier;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.text.WordUtils;
|
import org.apache.commons.lang3.text.WordUtils;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@@ -736,27 +737,48 @@ public class SystemController {
|
|||||||
entityProcessor.processEntity(stbActivity, multiDBTransactionManager);
|
entityProcessor.processEntity(stbActivity, multiDBTransactionManager);
|
||||||
|
|
||||||
// se ok
|
// se ok
|
||||||
|
String emailTo = "";
|
||||||
if (!UtilityString.isNullOrEmpty(emailPersRif)) {
|
if (!UtilityString.isNullOrEmpty(emailPersRif)) {
|
||||||
String ccn = "", emailAssegnatoA;
|
emailTo = emailPersRif;
|
||||||
|
|
||||||
if (!activity.getUserCreator().equals(activity.getUserName())) {
|
|
||||||
// SE SONO DIVERSI (E NON E' "CC") MANDA UN EMAIL AD
|
|
||||||
// "ASSEGNATO A"
|
|
||||||
String query =
|
|
||||||
"SELECT stb_user.e_mail\n" +
|
|
||||||
" FROM stb_user inner join jrl_flav_users on stb_user.user_name = jrl_flav_users.user_name\n" +
|
|
||||||
" WHERE jrl_flav_users.cod_jflav = " + UtilityDB.valueToString(activity.getUserName()) + " AND " +
|
|
||||||
"jrl_flav_users.flag_jflav_default = 'S'";
|
|
||||||
|
|
||||||
emailAssegnatoA = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), query);
|
|
||||||
|
|
||||||
if (!UtilityString.isNullOrEmpty(emailAssegnatoA)) {
|
|
||||||
ccn = emailAssegnatoA;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
notifica(stbActivity.getActivityId(), personaRif, emailPersRif, activity.getUserCreator(), ccn, notificationType, null, multiDBTransactionManager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<String> listEmailCcn= new ArrayList<>();
|
||||||
|
if (!activity.getUserCreator().equals(activity.getUserName())) {
|
||||||
|
// SE SONO DIVERSI (E NON E' "CC") MANDA UN EMAIL AD
|
||||||
|
// "ASSEGNATO A"
|
||||||
|
String query =
|
||||||
|
"SELECT stb_user.e_mail\n" +
|
||||||
|
" FROM stb_user inner join jrl_flav_users on stb_user.user_name = jrl_flav_users.user_name\n" +
|
||||||
|
" WHERE jrl_flav_users.cod_jflav = " + UtilityDB.valueToString(activity.getUserName()) + " AND " +
|
||||||
|
"jrl_flav_users.flag_jflav_default = 'S'";
|
||||||
|
|
||||||
|
String emailAssegnatoA = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(emailAssegnatoA)) {
|
||||||
|
if (UtilityString.isNullOrEmpty(emailTo))
|
||||||
|
emailTo = emailAssegnatoA;
|
||||||
|
else
|
||||||
|
listEmailCcn.add( emailAssegnatoA );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String query =
|
||||||
|
Query.format(
|
||||||
|
"select stb_user.e_mail\n" +
|
||||||
|
"from jtb_comt \n" +
|
||||||
|
"inner join jrl_flav_users on jtb_comt.cod_jflav_tec = jrl_flav_users.cod_jflav and jrl_flav_users.flag_jflav_default = 's'\n" +
|
||||||
|
"inner join stb_user on jrl_flav_users.user_name =stb_user.user_name "+
|
||||||
|
"where cod_jcom = %S ", activity.getCodJcom());
|
||||||
|
String emailResponsabile = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(emailResponsabile) && !listEmailCcn.contains(emailResponsabile))
|
||||||
|
listEmailCcn.add( emailResponsabile );
|
||||||
|
|
||||||
|
|
||||||
|
if (!UtilityString.isNullOrEmpty(emailTo)) {
|
||||||
|
String ccn = StringUtils.join(listEmailCcn, ";");
|
||||||
|
notifica(stbActivity.getActivityId(), personaRif, emailPersRif, activity.getUserCreator(), ccn, notificationType, null, multiDBTransactionManager);
|
||||||
|
}
|
||||||
activity.setActivityId(stbActivity.getActivityId());
|
activity.setActivityId(stbActivity.getActivityId());
|
||||||
return ServiceRestResponse.createPositiveResponse(activity);
|
return ServiceRestResponse.createPositiveResponse(activity);
|
||||||
|
|
||||||
@@ -910,15 +932,11 @@ public class SystemController {
|
|||||||
* Chiusura, 'F' - Note feedback, 'S' - Sollecito
|
* Chiusura, 'F' - Note feedback, 'S' - Sollecito
|
||||||
*/
|
*/
|
||||||
|
|
||||||
String htmlNotifyMail, subject, codAnag = "", includeFb = "", activityResultId, emailUtente = "", emailTo = "", query;
|
String htmlNotifyMail, subject, includeFb = "", emailTo = "", query, emailUtente = "";
|
||||||
String webUrl = "https://www.studioml.it/integry/";
|
String webUrl = "https://www.studioml.it/integry/";
|
||||||
String taskUrl = "https://task.studioml.it/";
|
String taskUrl = "https://task.studioml.it/";
|
||||||
String emailHelpdesk = "helpdesk@integry.it";
|
String emailHelpdesk = "helpdesk@integry.it";
|
||||||
|
|
||||||
PreparedStatement info;
|
|
||||||
ResultSet res;
|
|
||||||
|
|
||||||
|
|
||||||
/** VALUTARE SE IL SEGUENTE CONTROLLO LO SI DEBBA FARE IN WINACT: */
|
/** VALUTARE SE IL SEGUENTE CONTROLLO LO SI DEBBA FARE IN WINACT: */
|
||||||
// CONTROLLO PER INSERIRE LINK FEEDBACK DEL CLIENTE SE ...
|
// CONTROLLO PER INSERIRE LINK FEEDBACK DEL CLIENTE SE ...
|
||||||
includeFb = "";
|
includeFb = "";
|
||||||
@@ -929,16 +947,11 @@ public class SystemController {
|
|||||||
// ... OPPURE AGG. A STATO "RISCONTRO CLIE."
|
// ... OPPURE AGG. A STATO "RISCONTRO CLIE."
|
||||||
query = " SELECT activity_result_id FROM stb_activity WHERE activity_id = "
|
query = " SELECT activity_result_id FROM stb_activity WHERE activity_id = "
|
||||||
+ UtilityDB.valueToString(activityID);
|
+ UtilityDB.valueToString(activityID);
|
||||||
info = multiDBTransactionManager.prepareStatement(query);
|
String activityResultId = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||||
res = info.executeQuery();
|
|
||||||
if (res.next()) {
|
if (UtilityString.equalsIgnoreCase(activityResultId, "RISCONTRO CLIE.")) {
|
||||||
activityResultId = res.getString(1);
|
includeFb = "&linkfb=1";
|
||||||
if ("RISCONTRO CLIE.".equals(activityResultId)) {
|
|
||||||
includeFb = "&linkfb=1";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
res.close();
|
|
||||||
info.close();
|
|
||||||
|
|
||||||
} else if ("F".equals(azione) || "S".equals(azione)) {
|
} else if ("F".equals(azione) || "S".equals(azione)) {
|
||||||
// RECUPERA EMAIL UTENTE PER INVIO NOTIFICA FEEDBACK NEGATIVO O
|
// RECUPERA EMAIL UTENTE PER INVIO NOTIFICA FEEDBACK NEGATIVO O
|
||||||
@@ -946,16 +959,12 @@ public class SystemController {
|
|||||||
query = "SELECT e_mail " +
|
query = "SELECT e_mail " +
|
||||||
"FROM stb_activity INNER JOIN jtb_flav ON cod_jflav = user_name " +
|
"FROM stb_activity INNER JOIN jtb_flav ON cod_jflav = user_name " +
|
||||||
"WHERE activity_id = " + UtilityDB.valueToString(activityID);
|
"WHERE activity_id = " + UtilityDB.valueToString(activityID);
|
||||||
info = multiDBTransactionManager.prepareStatement(query);
|
emailUtente = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||||
res = info.executeQuery();
|
|
||||||
if (res.next()) {
|
|
||||||
emailUtente = res.getString(1);
|
|
||||||
}
|
|
||||||
if (emailUtente.length() == 0) {
|
if (emailUtente.length() == 0) {
|
||||||
emailUtente = emailHelpdesk;
|
emailUtente = emailHelpdesk;
|
||||||
}
|
}
|
||||||
res.close();
|
|
||||||
info.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
URL url = new URL(webUrl + "mail_models/ticket_mail.php?act=" + azione + includeFb);
|
URL url = new URL(webUrl + "mail_models/ticket_mail.php?act=" + azione + includeFb);
|
||||||
@@ -992,7 +1001,7 @@ public class SystemController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!emailTo.isEmpty()) {
|
if (!emailTo.isEmpty()) {
|
||||||
mailService.sendMailPrimary("noreply@integry.it", "Integry Ticketing", emailTo, null, ccn, subject, htmlNotifyMail, true, true, null, null, null);
|
mailService.sendMailPrimary("noreply@integry.it", "Integry Ticketing", emailTo, "", ccn, subject, htmlNotifyMail, true, true, null, null, null);
|
||||||
|
|
||||||
StbActivity activity = new StbActivity();
|
StbActivity activity = new StbActivity();
|
||||||
activity.setOperation(OperationType.NO_OP);
|
activity.setOperation(OperationType.NO_OP);
|
||||||
@@ -1014,13 +1023,7 @@ public class SystemController {
|
|||||||
+ " vtb_clie_pers_rif.e_mail IS NULL " + "WHERE stb_activity.activity_id = "
|
+ " vtb_clie_pers_rif.e_mail IS NULL " + "WHERE stb_activity.activity_id = "
|
||||||
+ UtilityDB.valueToString(activityID) + " AND "
|
+ UtilityDB.valueToString(activityID) + " AND "
|
||||||
+ " vtb_clie_pers_rif.e_mail IS NULL";
|
+ " vtb_clie_pers_rif.e_mail IS NULL";
|
||||||
|
String codAnag = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||||
info = multiDBTransactionManager.prepareStatement(query);
|
|
||||||
res = info.executeQuery();
|
|
||||||
if (res.next())
|
|
||||||
codAnag = res.getString(1);
|
|
||||||
res.close();
|
|
||||||
info.close();
|
|
||||||
|
|
||||||
String domainIntegry = "integry.it";
|
String domainIntegry = "integry.it";
|
||||||
if (!UtilityString.isNullOrEmpty(codAnag) && !UtilityString.isNullOrEmpty(personaRif)
|
if (!UtilityString.isNullOrEmpty(codAnag) && !UtilityString.isNullOrEmpty(personaRif)
|
||||||
|
|||||||
Reference in New Issue
Block a user