Commit 83408ffc authored by Cristian Aguirre's avatar Cristian Aguirre

Updating TotalSession Method

parent 07f47cc6
...@@ -14,6 +14,9 @@ public class SessionByClientBean implements Serializable { ...@@ -14,6 +14,9 @@ public class SessionByClientBean implements Serializable {
@Expose @Expose
private BigInteger user_id; private BigInteger user_id;
@Expose
private String sender_id;
@Expose @Expose
private BigInteger count; private BigInteger count;
} }
...@@ -81,11 +81,12 @@ public class OperativeDashboardService extends DashboardService { ...@@ -81,11 +81,12 @@ public class OperativeDashboardService extends DashboardService {
ArrayList<BigInteger> totalsessions = new ArrayList<BigInteger>(); // Total de sesiones ArrayList<BigInteger> totalsessions = new ArrayList<BigInteger>(); // Total de sesiones
sessions_by_user.stream().forEach(x ->{ sessions_by_user.stream().forEach(x ->{
ArrayList<Object> session = new ArrayList<Object>(); ArrayList<Object> session = new ArrayList<Object>();
session.add(x.getUser_id().toString()); // Split de la data para obtener el número
String sender_id = x.getSender_id().split(":")[1];
session.add(sender_id);
session.add(x.getCount()); session.add(x.getCount());
totalsessions.add(x.getCount()); totalsessions.add(x.getCount());
totalSessions.getHistory().add(session); totalSessions.getHistory().add(session);
}); });
int sum = totalsessions.stream().mapToInt(BigInteger::intValue).sum(); int sum = totalsessions.stream().mapToInt(BigInteger::intValue).sum();
BigInteger total = BigInteger.valueOf(sum); BigInteger total = BigInteger.valueOf(sum);
......
...@@ -13,13 +13,13 @@ ...@@ -13,13 +13,13 @@
</select> </select>
<select id="countSessionsInRange" resultType="SessionByClient" flushCache="true"> <select id="countSessionsInRange" resultType="SessionByClient" flushCache="true">
select bas.user_id as user_id, select au.user_ident as sender_id,
count(session_id) as count count(session_id) as count
FROM AVB_SESSION bas FROM AVB_SESSION bas
join avb_user au on au.user_id=bas.user_id join avb_user au on au.user_id=bas.user_id
WHERE SESSION_LEDAT &lt;= #{endDate} WHERE SESSION_LEDAT &lt;= #{endDate}
AND SESSION_LEDAT &gt;= #{startDate} AND SESSION_LEDAT &gt;= #{startDate}
group by bas.user_id group by au.user_ident
</select> </select>
<select id="avgSessionsByCustomerInRange" resultType="Double" flushCache="true"> <select id="avgSessionsByCustomerInRange" resultType="Double" flushCache="true">
......
...@@ -13,13 +13,13 @@ ...@@ -13,13 +13,13 @@
</select> </select>
<select id="countSessionsInRange" resultType="SessionByClient" flushCache="true"> <select id="countSessionsInRange" resultType="SessionByClient" flushCache="true">
select bas.user_id as user_id, select au.user_ident as sender_id,
count(session_id) as count count(session_id) as count
FROM AVB_SESSION bas FROM AVB_SESSION bas
join avb_user au on au.user_id=bas.user_id join avb_user au on au.user_id=bas.user_id
WHERE SESSION_LEDAT &lt;= #{endDate} WHERE SESSION_LEDAT &lt;= #{endDate}
AND SESSION_LEDAT &gt;= #{startDate} AND SESSION_LEDAT &gt;= #{startDate}
group by bas.user_id group by au.user_ident
</select> </select>
<select id="avgSessionsByCustomerInRange" resultType="Double" flushCache="true"> <select id="avgSessionsByCustomerInRange" resultType="Double" flushCache="true">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment