mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-06 13:27:55 +08:00
[fix] 进出口流量转换成B、KB、MB、GB
This commit is contained in:
parent
369246e5c7
commit
27219eea2d
@ -1,13 +1,13 @@
|
||||
spring:
|
||||
lazy:
|
||||
netty:
|
||||
inet-host: 127.0.0.1
|
||||
inet-port: 7001
|
||||
# inet-host: 127.0.0.1
|
||||
# inet-port: 7001
|
||||
inet-path: wu-lazy-cloud-heartbeat-server
|
||||
inet-host: 124.222.48.62 # 服务端地址
|
||||
inet-port: 30676 #服务端端口
|
||||
# inet-path: wu-lazy-cloud-heartbeat-server
|
||||
# inet-host: 124.222.48.62 # 服务端地址
|
||||
# inet-port: 30676 #服务端端口
|
||||
# inet-path: wu-lazy-cloud-heartbeat-server
|
||||
client-id: local # 客户端ID
|
||||
client-id: wujiawei # 客户端ID
|
||||
data:
|
||||
redis:
|
||||
host: 192.168.17.221
|
||||
|
@ -1,5 +1,6 @@
|
||||
package wu.framework.lazy.cloud.heartbeat.server.application.dto;
|
||||
|
||||
import com.wu.framework.inner.layer.util.ByteSizeUtil;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
@ -63,4 +64,12 @@ public class VisitorFlowDTO {
|
||||
@Schema(description = "当前访客下所有端口的流量")
|
||||
private List<VisitorPortFlowDTO> visitorPortFlowDTOList;
|
||||
|
||||
|
||||
public String getInFlow() {
|
||||
return ByteSizeUtil.convertSize(inFlow);
|
||||
}
|
||||
|
||||
public String getOutFlow() {
|
||||
return ByteSizeUtil.convertSize(outFlow);
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package wu.framework.lazy.cloud.heartbeat.server.application.dto;
|
||||
|
||||
import com.wu.framework.inner.layer.util.ByteSizeUtil;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@ -77,4 +78,19 @@ public class VisitorPortFlowDTO {
|
||||
@Schema(description ="访客端口",name ="visitorPort",example = "")
|
||||
private Integer visitorPort;
|
||||
|
||||
public Integer getInFlowSize() {
|
||||
return inFlow;
|
||||
}
|
||||
|
||||
public Integer getOutFlowSize() {
|
||||
return outFlow;
|
||||
}
|
||||
public String getInFlow() {
|
||||
return ByteSizeUtil.convertSize(inFlow);
|
||||
}
|
||||
|
||||
public String getOutFlow() {
|
||||
return ByteSizeUtil.convertSize(outFlow);
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package wu.framework.lazy.cloud.heartbeat.server.application.impl;
|
||||
|
||||
import com.wu.framework.database.lazy.web.plus.stereotype.LazyApplication;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import wu.framework.lazy.cloud.heartbeat.server.application.VisitorPortFlowApplication;
|
||||
import com.wu.framework.response.Result;
|
||||
import wu.framework.lazy.cloud.heartbeat.server.application.assembler.VisitorPortFlowDTOAssembler;
|
||||
@ -165,12 +166,12 @@ public class VisitorPortFlowApplicationImpl implements VisitorPortFlowApplicatio
|
||||
Map<String/*客户端ID*/, Integer/*客户端进口流量*/> client_in_flow = visitorPortFlowDTOList.stream()
|
||||
.collect(
|
||||
Collectors.groupingBy(VisitorPortFlowDTO::getClientId,
|
||||
Collectors.summingInt(VisitorPortFlowDTO::getInFlow)));
|
||||
Collectors.summingInt(VisitorPortFlowDTO::getInFlowSize)));
|
||||
|
||||
Map<String/*客户端ID*/, Integer/*客户端出口流量*/> client_out_flow = visitorPortFlowDTOList.stream()
|
||||
.collect(
|
||||
Collectors.groupingBy(VisitorPortFlowDTO::getClientId,
|
||||
Collectors.summingInt(VisitorPortFlowDTO::getOutFlow)));
|
||||
Collectors.summingInt(VisitorPortFlowDTO::getOutFlowSize)));
|
||||
|
||||
return visitorPortFlowLazyPage.convert(visitorPortFlow1 -> {
|
||||
String clientId = visitorPortFlow1.getClientId();
|
||||
|
@ -1,11 +1,13 @@
|
||||
package wu.framework.lazy.cloud.heartbeat.server.infrastructure.persistence;
|
||||
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import wu.framework.lazy.cloud.heartbeat.server.domain.model.visitor.flow.VisitorPortFlow;
|
||||
import wu.framework.lazy.cloud.heartbeat.server.infrastructure.converter.VisitorPortFlowConverter;
|
||||
import wu.framework.lazy.cloud.heartbeat.server.domain.model.visitor.flow.VisitorPortFlowRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.wu.framework.inner.lazy.database.expand.database.persistence.stream.wrapper.LazyWrappers;
|
||||
@ -176,6 +178,9 @@ public class VisitorPortFlowRepositoryImpl implements VisitorPortFlowRepository
|
||||
*/
|
||||
@Override
|
||||
public List<VisitorPortFlow> findListByClientIds(List<String> clientIdList) {
|
||||
if(ObjectUtils.isEmpty(clientIdList)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return lazyLambdaStream.selectList(LazyWrappers.<VisitorPortFlowDO>lambdaWrapper()
|
||||
.in(VisitorPortFlowDO::getClientId,clientIdList), VisitorPortFlow.class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user