<%@page session="true" contentType="text/html; charset=UTF-8" %> <%@ page import="java.util.Map.Entry" %> <%@ page import="java.util.Date" %> <%@ page import="java.text.NumberFormat" %> <%@ page import="java.util.ArrayList" %> <%@ page import="java.util.HashMap" %> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="com.edeal.frontline.FlLocale" %> <%@ page import="com.edeal.frontline.controller.actions.PopulationMassEmailingAction" %> <%@ page import="com.edeal.frontline.controller.actions.BackgroundAjaxAction" %> <%@ page import="com.edeal.frontline.controller.actions.GetMassEmailingStatsAction" %> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <% final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass()); ArrayList arrEmailingStats = (ArrayList)request.getAttribute(GetMassEmailingStatsAction.ARR_EMAILING_STATS); ArrayList arrEmailingStatsHavingSameRegrouping = (ArrayList)request.getAttribute(GetMassEmailingStatsAction.ARR_EMAILING_STATS_HAVING_SAME_REGROUPING); HashMap hmapLinkStatsRegrouped = (HashMap)request.getAttribute(GetMassEmailingStatsAction.HMAP_LINK_STATS_REGROUPED); HashMap hmapLinkStats = (HashMap)request.getAttribute(GetMassEmailingStatsAction.HMAP_LINK_STATS); HashMap hmapLinkStatsHavingSameRegrouping = (HashMap)request.getAttribute(GetMassEmailingStatsAction.HMAP_LINK_STATS_HAVING_SAME_REGROUPING); Date emlSentDate = (Date) request.getAttribute(GetMassEmailingStatsAction.EML_SENT_DATE); String period = request.getParameter(GetMassEmailingStatsAction.PERIOD_ANALYSE); NumberFormat floatFormat = FlLocale.getInstance(session).getDecimalFormat("#,##0"); String strDate = ""; if (emlSentDate != null) { strDate = Utils.formatToWeb(session, emlSentDate, false, "datetime" ); } FlRequest flRequest = new FlRequest(request); FlContext context = flRequest.getContext(); String id = (String)request.getParameter("id"); Date lastStatsDate = (Date)flRequest.getAttribute(GetMassEmailingStatsAction.LAST_STATS_DATE); String strLastStatsDate = "N/A"; if (lastStatsDate != null) { strLastStatsDate = Utils.formatToWeb(session, lastStatsDate, false, "datetime" ); } //Synthèse de l'e-mailing float volumeCible = 0, hardBounces = 0, softBounces = 0, presumesArrives = 0, ouvert = 0, sentError = 0, desabonne = 0, spam = 0; if (arrEmailingStats != null && !arrEmailingStats.isEmpty()) { try { hardBounces = arrEmailingStats.get(0);//EstNbFatalError } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'hardBounces'", ex); } try { softBounces = arrEmailingStats.get(1);//EstNbTempError } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'softBounces'", ex); } try { presumesArrives = arrEmailingStats.get(2);//EstNbSent } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'presumesArrives'", ex); } try { ouvert = arrEmailingStats.get(3);//EstNbOpened } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'ouvert'", ex); } //inclure dans le comptage des présumés arrivés les ouverts presumesArrives = presumesArrives + ouvert; try { sentError = arrEmailingStats.get(4);//EstNbSentError } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'erreur envoi'", ex); } try { volumeCible = arrEmailingStats.get(5);//EstNbTotal } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'total'", ex); } try { desabonne = arrEmailingStats.get(6);//EstNbUnsubscribed } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'nombre de désabonné'", ex); } try { spam = arrEmailingStats.get(7);//EstNbSpam } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'nombre de spam'", ex); } logger.debug("volumeCible vaut" + volumeCible); } //Synthèse de l'e-mailing en % float perHardBounces = 0, perSoftBounces = 0, perPresumesArrives = 0, perOuvert = 0, perSentError = 0, perDesabonne = 0, perSpam = 0; if (volumeCible > 0) { try { perHardBounces = hardBounces / volumeCible * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perHardBounces'", ex); } try { perSoftBounces = softBounces / volumeCible * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perSoftBounces'", ex); } try { perPresumesArrives = presumesArrives / volumeCible * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perPresumesArrives'", ex); } try { perOuvert = ouvert / volumeCible * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perOuvert'", ex); } try { perSentError = sentError / volumeCible * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perSentError'", ex); } try { perDesabonne = desabonne / volumeCible * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perDesabonne'", ex); } try { perSpam = spam / volumeCible * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perSpam'", ex); } } //Moyenne des e-mailings de même regroupement float volumeCibleRg = 0, hardBouncesRg = 0, softBouncesRg = 0, presumesArrivesRg = 0, ouvertRg = 0, sentErrorRg = 0, desabonneRg = 0, spamRg = 0; if (arrEmailingStatsHavingSameRegrouping != null && !arrEmailingStatsHavingSameRegrouping.isEmpty()) { try { hardBouncesRg = arrEmailingStatsHavingSameRegrouping.get(0); } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de récupérer 'hardBouncesRg'", ex); } try { softBouncesRg = arrEmailingStatsHavingSameRegrouping.get(1); } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de récupérer 'softBouncesRg'", ex); } try { presumesArrivesRg = arrEmailingStatsHavingSameRegrouping.get(2); } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de récupérer 'presumesArrivesRg'", ex); } try { ouvertRg = arrEmailingStatsHavingSameRegrouping.get(3); } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de récupérer 'ouvertRg'", ex); } try { sentErrorRg = arrEmailingStatsHavingSameRegrouping.get(4); } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'erreur envoi'", ex); } try { volumeCibleRg = arrEmailingStatsHavingSameRegrouping.get(5); } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'total'", ex); } try { desabonneRg = arrEmailingStatsHavingSameRegrouping.get(6); } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'desabonneRg'", ex); } try { spamRg = arrEmailingStatsHavingSameRegrouping.get(7); } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'spamRg'", ex); } //volumeCibleRg = hardBouncesRg + softBouncesRg + presumesArrivesRg ;//+ ouvertRg; logger.debug("VolumeCibleRg vaut" + volumeCibleRg); } //Moyenne des e-mailings de même regroupement en % float perHardBouncesRg = 0, perSoftBouncesRg = 0, perPresumesArrivesRg = 0, perOuvertRg = 0, perSentErrorRg = 0, perDesabonneRg = 0, perSpamRg = 0; float evolHardBounces = 0, evolSoftBounces = 0, evolPresumesArrives = 0, evolOuvert = 0,evolCible = 0, evolSentError = 0, evolDesabonne = 0, evolSpam = 0; if (volumeCibleRg > 0) { try { perHardBouncesRg = hardBouncesRg / volumeCibleRg * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perHardBouncesRg'", ex); } try { perSoftBouncesRg = softBouncesRg / volumeCibleRg * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perSoftBouncesRg'", ex); } try { perPresumesArrivesRg = presumesArrivesRg / volumeCibleRg * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perPresumesArrivesRg'", ex); } try { perOuvertRg = ouvertRg / volumeCibleRg * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perOuvertRg'", ex); } try { perSentErrorRg = sentErrorRg / volumeCibleRg * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perSentErrorRg'", ex); } try { perDesabonneRg = desabonneRg / volumeCibleRg * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perDesabonneRg'", ex); } try { perSpamRg = spamRg / volumeCibleRg * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perSpamRg'", ex); } try { evolCible = (volumeCible - volumeCibleRg) / volumeCibleRg * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perOuvertRg'", ex); } if (hardBouncesRg > 0) { try { evolHardBounces = (hardBounces - hardBouncesRg) / hardBouncesRg * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'evolHardBounces'", ex); } } if (softBouncesRg > 0) { try { evolSoftBounces = (softBounces - softBouncesRg) / softBouncesRg * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'evolSoftBounces'", ex); } } if (presumesArrivesRg > 0) { try { evolPresumesArrives = (presumesArrives - presumesArrivesRg) / presumesArrivesRg * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'evolPresumesArrives'", ex); } } if (ouvertRg > 0) { try { evolOuvert = (ouvert - ouvertRg) / ouvertRg * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'evolOuvert'", ex); } } if (sentErrorRg > 0) { try { evolSentError = (sentError - sentErrorRg) / sentErrorRg * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'evolOuvert'", ex); } } if (desabonneRg > 0) { try { evolDesabonne = (desabonne - desabonneRg) / desabonneRg * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'evolDesabonne'", ex); } } if (spamRg > 0) { try { evolSpam = (spam - spamRg) / spamRg * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'evolSpam'", ex); } } } %>
: <%= strDate %>, : <%= strLastStatsDate %>
<%= (int)volumeCible %> <%= (int)volumeCibleRg %> <%= floatFormat.format(evolCible) %>%
<%= (int)sentError %> <%= floatFormat.format(perSentError) %>% <%= (int)sentErrorRg %> <%= floatFormat.format(perSentErrorRg) %>% <%= floatFormat.format(evolSentError) %>%
<%= (int)spam %> <%= floatFormat.format(perSpam) %>% <%= (int)spamRg %> <%= floatFormat.format(perSpamRg) %>% <%= floatFormat.format(evolSpam) %>%
<%= (int)hardBounces %> <%= floatFormat.format(perHardBounces) %>% <%= (int)hardBouncesRg %> <%= floatFormat.format(perHardBouncesRg) %>% <%= floatFormat.format(evolHardBounces) %>%
<%= (int)softBounces %> <%= floatFormat.format(perSoftBounces) %>% <%= (int)softBouncesRg %> <%= floatFormat.format(perSoftBouncesRg) %>% <%= floatFormat.format(evolSoftBounces) %>%
<%= (int)presumesArrives %> <%= floatFormat.format(perPresumesArrives) %>% <%= (int)presumesArrivesRg %> <%= floatFormat.format(perPresumesArrivesRg) %>% <%= floatFormat.format(evolPresumesArrives) %>%
<%= (int)ouvert %> <%= floatFormat.format(perOuvert) %>% <%= (int)ouvertRg %> <%= floatFormat.format(perOuvertRg) %>% <%= floatFormat.format(evolOuvert) %>%
<%= (int)desabonne %> <%= floatFormat.format(perDesabonne) %>% <%= (int)desabonneRg %> <%= floatFormat.format(perDesabonneRg) %>% <%= floatFormat.format(evolDesabonne) %>%

<%-- Regroupement : l'ensemble des regroupements des web opérations correspondants à cet e-mail --%> <% int k = 0; if (hmapLinkStatsRegrouped != null && !hmapLinkStatsRegrouped.isEmpty()){ for (Entry currentEntry : hmapLinkStatsRegrouped.entrySet()) { k ++; String regroupement = ""; float countLink = 0, countLinkRg = 0, perCountLinkC = 0, perCountLinkRgC = 0, perCountLinkA = 0, perCountLinkRgA = 0, evolCountLink = 0; try { regroupement = currentEntry.getKey(); logger.debug("regroupement vaut : " + regroupement); } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de récupérer 'regroupement'", ex); } try { countLink = currentEntry.getValue(); logger.debug("countLink vaut : " + countLink); } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de récupérer 'countLink'", ex); } if (volumeCible > 0) { try { perCountLinkC = countLink / volumeCible * 100; logger.debug("perCountLink vaut : " + perCountLinkC); } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perCountLinkC'", ex); } } if (presumesArrives > 0) { try { perCountLinkA = countLink / presumesArrives * 100; logger.debug("perCountLink vaut : " + perCountLinkA); } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'perCountLinkA'", ex); } } if (hmapLinkStatsHavingSameRegrouping != null && !hmapLinkStatsHavingSameRegrouping.isEmpty() && hmapLinkStatsHavingSameRegrouping.containsKey(regroupement)) { try { countLinkRg = hmapLinkStatsHavingSameRegrouping.get(regroupement); } catch (Exception ex) { } if (volumeCibleRg > 0) { try { perCountLinkRgC = countLinkRg / volumeCibleRg * 100; } catch (Exception ex) { } } if (presumesArrives > 0) { try { perCountLinkRgA = countLinkRg / presumesArrives * 100; } catch (Exception ex) { } } if (countLinkRg > 0) { try { evolCountLink = (countLink - countLinkRg) / countLinkRg * 100; } catch (Exception ex) { logger.error("Une Exception s'est produite quand on tente de calculer 'evolCountLink'", ex); } } } %> "> <%-- Nom --%> <%-- Evolution --%> <% } } %>
<%= regroupement %> <%= (int)countLink %> <%= floatFormat.format(perCountLinkA) %>% / <%= floatFormat.format(perCountLinkC) %>% <%= (int)countLinkRg %> <%= floatFormat.format(perCountLinkRgA) %>% / <%= floatFormat.format(perCountLinkRgC) %>% <%= floatFormat.format(evolCountLink) %>%

<%-- l'ensemble des liens correspondants à cet e-mail --%> <% int j = 0; if (hmapLinkStats != null && !hmapLinkStats.isEmpty()) { for (Entry currentEntry : hmapLinkStats.entrySet()) { j++; String wopName = ""; float nbLink = 0, perNbLinkC = 0, perNbLinkA = 0; try { wopName = currentEntry.getKey(); } catch (Exception ex) { } try { nbLink = currentEntry.getValue(); } catch (Exception ex) { } if (volumeCible > 0) { try { perNbLinkC = nbLink / volumeCible * 100; } catch (Exception ex) { } } if (presumesArrives > 0) { try { perNbLinkA = nbLink / presumesArrives * 100; } catch (Exception ex) { } } %> "> <% } } %>
<%= wopName %> <%= (int)nbLink %> <%= floatFormat.format(perNbLinkA) %>% / <%= floatFormat.format(perNbLinkC) %>%

<%-- Graphe --%>