fix: cdr record
This commit is contained in:
@@ -93,6 +93,7 @@ public class UCdrServiceImpl extends ServiceImpl<UCdrMapper, UCdr> implements IU
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<SiteSummaryInfo> sites = siteResp.getBody().getResult().getData();
|
List<SiteSummaryInfo> sites = siteResp.getBody().getResult().getData();
|
||||||
|
List<UClient> allClients = clientService.list(Wrappers.<UClient>lambdaQuery().isNotNull(UClient::getUserId));
|
||||||
// 添加AP设备
|
// 添加AP设备
|
||||||
addDevices(sites);
|
addDevices(sites);
|
||||||
for (SiteSummaryInfo site : sites) {
|
for (SiteSummaryInfo site : sites) {
|
||||||
@@ -105,16 +106,19 @@ public class UCdrServiceImpl extends ServiceImpl<UCdrMapper, UCdr> implements IU
|
|||||||
// 添加用户设备
|
// 添加用户设备
|
||||||
UClient hasClient = addClient(client);
|
UClient hasClient = addClient(client);
|
||||||
// 添加话单
|
// 添加话单
|
||||||
Long cdrId = addCdr(client, hasClient);
|
addCdr(client, hasClient);
|
||||||
// 添加话单历史
|
}
|
||||||
addCdrHistory(site, client, cdrId);
|
for (UClient client : allClients) {
|
||||||
|
UCdr uCdr = this.getOne(Wrappers.<UCdr>lambdaQuery().eq(UCdr::getUserId, client.getUserId())
|
||||||
|
.eq(UCdr::getClientId, client.getId()));
|
||||||
|
addCdrHistory(site, client.getClientMac(), uCdr.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCdrHistory(SiteSummaryInfo site, ClientInfo client, Long cdrId) {
|
private void addCdrHistory(SiteSummaryInfo site, String mac, Long cdrId) {
|
||||||
// 话单历史
|
// 话单历史
|
||||||
ResponseEntity<OperationResponseGridVoClientHistoryInfo> pastConnResp = omadaClientInsightApi.getGridPastConnections(site.getSiteId(), 1, 1000, client.getMac());
|
ResponseEntity<OperationResponseGridVoClientHistoryInfo> pastConnResp = omadaClientInsightApi.getGridPastConnections(site.getSiteId(), 1, 1000, mac);
|
||||||
if (ObjectUtil.isNull(pastConnResp.getBody())) {
|
if (ObjectUtil.isNull(pastConnResp.getBody())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,14 +80,11 @@
|
|||||||
c.client_name,
|
c.client_name,
|
||||||
c.client_mac,
|
c.client_mac,
|
||||||
c.client_device_type,
|
c.client_device_type,
|
||||||
min( ch.start_time ) start_time,
|
ch.start_time,
|
||||||
max( ch.end_time ) end_time,
|
ch.end_time,
|
||||||
sum(
|
ifnull( ch.duration, 0 ) duration,
|
||||||
ifnull( ch.duration, 0 )) duration,
|
ifnull( ch.traffic_down, 0 ) traffic_down,
|
||||||
sum(
|
ifnull( ch.traffic_up, 0 ) traffic_up
|
||||||
ifnull( ch.traffic_down, 0 )) traffic_down,
|
|
||||||
sum(
|
|
||||||
ifnull( ch.traffic_up, 0 )) traffic_up
|
|
||||||
FROM
|
FROM
|
||||||
u_cdr cdr
|
u_cdr cdr
|
||||||
LEFT JOIN u_cdr_history ch ON cdr.id = ch.cdr_id
|
LEFT JOIN u_cdr_history ch ON cdr.id = ch.cdr_id
|
||||||
@@ -100,10 +97,7 @@
|
|||||||
<if test="userId != null and userId != ''">
|
<if test="userId != null and userId != ''">
|
||||||
AND cdr.user_id = #{userId}
|
AND cdr.user_id = #{userId}
|
||||||
</if>
|
</if>
|
||||||
GROUP BY
|
|
||||||
cdr.user_id,
|
|
||||||
cdr.client_id
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
min( ch.start_time ) DESC
|
ch.start_time DESC
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -31,11 +31,14 @@
|
|||||||
c.client_name,
|
c.client_name,
|
||||||
c.client_mac,
|
c.client_mac,
|
||||||
c.client_device_type,
|
c.client_device_type,
|
||||||
ch.start_time,
|
min( ch.start_time ) start_time,
|
||||||
ch.end_time,
|
max( ch.end_time ) end_time,
|
||||||
ifnull( ch.duration, 0 ) duration,
|
sum(
|
||||||
ifnull( ch.traffic_down, 0 ) traffic_down,
|
ifnull( ch.duration, 0 )) duration,
|
||||||
ifnull( ch.traffic_up, 0 ) traffic_up
|
sum(
|
||||||
|
ifnull( ch.traffic_down, 0 )) traffic_down,
|
||||||
|
sum(
|
||||||
|
ifnull( ch.traffic_up, 0 )) traffic_up
|
||||||
FROM
|
FROM
|
||||||
u_cdr cdr
|
u_cdr cdr
|
||||||
LEFT JOIN u_cdr_history ch ON cdr.id = ch.cdr_id
|
LEFT JOIN u_cdr_history ch ON cdr.id = ch.cdr_id
|
||||||
@@ -48,8 +51,11 @@
|
|||||||
<if test="userId != null and userId != ''">
|
<if test="userId != null and userId != ''">
|
||||||
AND cdr.user_id = #{userId}
|
AND cdr.user_id = #{userId}
|
||||||
</if>
|
</if>
|
||||||
|
GROUP BY
|
||||||
|
cdr.user_id,
|
||||||
|
cdr.client_id
|
||||||
ORDER BY
|
ORDER BY
|
||||||
ch.start_time DESC
|
min( ch.start_time ) DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user