feat:联调bug修改
parent
ce6d7acc92
commit
7c61f3454b
|
|
@ -2,11 +2,13 @@
|
|||
// Network.java - 网络信息对象
|
||||
package com.unisinsight.project.entity.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class Network {
|
||||
@JsonProperty("network_name")
|
||||
private String networkName;
|
||||
|
|
@ -18,7 +20,7 @@ public class Network {
|
|||
private String state;
|
||||
|
||||
@JsonProperty("autostart")
|
||||
private Boolean autostart;
|
||||
private Integer autostart;
|
||||
|
||||
private Integer persistent;
|
||||
|
||||
|
|
@ -53,6 +55,13 @@ public class Network {
|
|||
@JsonProperty("vlan_id")
|
||||
private Integer vlanId;
|
||||
|
||||
// 新增字段
|
||||
@JsonProperty("connected_devices")
|
||||
private Integer connectedDevices;
|
||||
|
||||
@JsonProperty("traffic_stats")
|
||||
private TrafficStats trafficStats;
|
||||
|
||||
// 自定义 setter,在设置 name 时同步到 networkName
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
|
|
@ -61,12 +70,12 @@ public class Network {
|
|||
}
|
||||
}
|
||||
|
||||
// 自定义 setter,在设置 poolName 时同步到 name
|
||||
// 自定义 setter,在设置 networkName 时同步到 name
|
||||
@JsonSetter("network_name")
|
||||
public void setPoolName(String poolName) {
|
||||
this.networkName = poolName;
|
||||
if (poolName != null) {
|
||||
this.name = poolName;
|
||||
public void setNetworkName(String networkName) {
|
||||
this.networkName = networkName;
|
||||
if (networkName != null) {
|
||||
this.name = networkName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,13 @@
|
|||
package com.unisinsight.project.entity.dto;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class NetworkData {
|
||||
private List<Network> networks;
|
||||
private Pagination pagination;
|
||||
|
||||
// Getters and Setters
|
||||
public List<Network> getNetworks() {
|
||||
return networks;
|
||||
}
|
||||
|
||||
public void setNetworks(List<Network> networks) {
|
||||
this.networks = networks;
|
||||
}
|
||||
|
||||
public Pagination getPagination() {
|
||||
return pagination;
|
||||
}
|
||||
|
||||
public void setPagination(Pagination pagination) {
|
||||
this.pagination = pagination;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,42 +1,15 @@
|
|||
// Pagination.java - 分页信息对象
|
||||
package com.unisinsight.project.entity.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class Pagination {
|
||||
private Integer currentPage;
|
||||
private Integer pageSize;
|
||||
private Integer total;
|
||||
private Integer totalPages;
|
||||
|
||||
// Getters and Setters
|
||||
public Integer getCurrentPage() {
|
||||
return currentPage;
|
||||
}
|
||||
|
||||
public void setCurrentPage(Integer currentPage) {
|
||||
this.currentPage = currentPage;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Integer total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public Integer getTotalPages() {
|
||||
return totalPages;
|
||||
}
|
||||
|
||||
public void setTotalPages(Integer totalPages) {
|
||||
this.totalPages = totalPages;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
package com.unisinsight.project.entity.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class TrafficStats {
|
||||
private Long upload;
|
||||
private Long download;
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@ public class StoragePoolReq {
|
|||
|
||||
@ApiModelProperty("自动启动,默认是")
|
||||
@JsonProperty("autostart")
|
||||
private boolean autostart = true;
|
||||
private Integer autostart =1;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
@NotBlank(message = "名称不能为空")
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class NetworkManageServiceImpl extends ServiceImpl<NetworkManageMapper, N
|
|||
try {
|
||||
Network network = new Network();
|
||||
BeanUtils.copyProperties(networkManageReq, network);
|
||||
network.setAutostart(networkManageReq.getAutostart() == 1);
|
||||
// network.setAutostart(networkManageReq.getAutostart() == 1);
|
||||
network.setDhcpEnabled(networkManageReq.getDhcpEnabled() == 1);
|
||||
ApiResponse response = client.createNetwork(network);
|
||||
if (!"200".equals(response.getCode())) {
|
||||
|
|
@ -116,7 +116,7 @@ public class NetworkManageServiceImpl extends ServiceImpl<NetworkManageMapper, N
|
|||
setNetworkManageReq(existing, networkManageReq);
|
||||
Network network = new Network();
|
||||
BeanUtils.copyProperties(networkManageReq, network);
|
||||
network.setAutostart(networkManageReq.getAutostart() == 1);
|
||||
// network.setAutostart(networkManageReq.getAutostart() == 1);
|
||||
network.setDhcpEnabled(networkManageReq.getDhcpEnabled() == 1);
|
||||
ApiResponse response = client.updateNetwork(network);
|
||||
if (!"200".equals(response.getCode())) {
|
||||
|
|
@ -324,7 +324,7 @@ public class NetworkManageServiceImpl extends ServiceImpl<NetworkManageMapper, N
|
|||
BeanUtils.copyProperties(network, networkManage);
|
||||
networkManage.setNetworkName(StringUtil.isEmpty(network.getNetworkName()) ? network.getName() : networkManage.getNetworkName());
|
||||
networkManage.setStatus("active".equals(network.getState()) ? 1 : 0);
|
||||
networkManage.setAutostart(network.getAutostart() ? 1 : 0);
|
||||
// networkManage.setAutostart(network.getAutostart() ? 1 : 0);
|
||||
networkManage.setDhcpEnabled(network.getDhcpEnabled() ? 1 : 0);
|
||||
networkManage.setUpdateTime(new Date());
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ spring:
|
|||
data-locations: classpath*:db/*.sql
|
||||
jackson:
|
||||
property-naming-strategy: SNAKE_CASE
|
||||
deserialization:
|
||||
fail-on-unknown-properties: false
|
||||
|
||||
knife4j:
|
||||
production: false
|
||||
|
|
|
|||
Loading…
Reference in New Issue