Commit 2fb169b3 authored by jim's avatar jim

shop

parent 0c2ed716
...@@ -2,6 +2,7 @@ package com.edgec.browserbackend.browser.dto; ...@@ -2,6 +2,7 @@ package com.edgec.browserbackend.browser.dto;
import com.edgec.browserbackend.browser.domain.*; import com.edgec.browserbackend.browser.domain.*;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -34,10 +35,10 @@ public class IpResourceDto { ...@@ -34,10 +35,10 @@ public class IpResourceDto {
private String specialLineIp; private String specialLineIp;
public IpResourceDto(){ public IpResourceDto() {
} }
public IpResourceDto(IpResource ipResource, List<ShopDto> shopDtos, boolean useHistory){ public IpResourceDto(IpResource ipResource, List<ShopDto> shopDtos, boolean useHistory) {
this.id = ipResource.getId(); this.id = ipResource.getId();
this.addr = ipResource.getAddr(); this.addr = ipResource.getAddr();
this.vendor = ipResource.getVendor(); this.vendor = ipResource.getVendor();
...@@ -51,18 +52,21 @@ public class IpResourceDto { ...@@ -51,18 +52,21 @@ public class IpResourceDto {
this.password = ipResource.getPassword(); this.password = ipResource.getPassword();
this.protocol = ipResource.getProtocol(); this.protocol = ipResource.getProtocol();
this.specialLine = ipResource.isSpecialLine(); this.specialLine = ipResource.isSpecialLine();
if (shopDtos != null) if (CollectionUtils.isNotEmpty(shopDtos)) {
this.bindShops = shopDtos; this.bindShops = shopDtos;
else this.bindShop = shopDtos.get(0);
} else {
this.bindShops = new ArrayList<>(); this.bindShops = new ArrayList<>();
this.bindShop = new ShopDto();
}
if (useHistory) if (useHistory)
this.bindHistories = ipResource.getBindHistory(); this.bindHistories = ipResource.getBindHistory();
else else
this.bindHistories = new ArrayList<>(); this.bindHistories = new ArrayList<>();
this.bindShop = new ShopDto();
} }
public IpResourceDto(IpResource ipResource, List<ShopDto> shopDtos, boolean useHistory, SpecialLine specialLine1){ public IpResourceDto(IpResource ipResource, List<ShopDto> shopDtos, boolean useHistory, SpecialLine specialLine1) {
this.id = ipResource.getId(); this.id = ipResource.getId();
this.addr = ipResource.getAddr(); this.addr = ipResource.getAddr();
this.vendor = ipResource.getVendor(); this.vendor = ipResource.getVendor();
...@@ -80,16 +84,18 @@ public class IpResourceDto { ...@@ -80,16 +84,18 @@ public class IpResourceDto {
this.proxyPort = specialLine1.getProxyPort(); this.proxyPort = specialLine1.getProxyPort();
this.proxyProtocol = specialLine1.getProxyProtocol(); this.proxyProtocol = specialLine1.getProxyProtocol();
this.specialLine = ipResource.isSpecialLine(); this.specialLine = ipResource.isSpecialLine();
if (shopDtos != null) if (CollectionUtils.isNotEmpty(shopDtos)) {
this.bindShops = shopDtos; this.bindShops = shopDtos;
else this.bindShop = shopDtos.get(0);
} else {
this.bindShops = new ArrayList<>(); this.bindShops = new ArrayList<>();
this.bindShop = new ShopDto();
}
this.specialLineIp = specialLine1.getIp(); this.specialLineIp = specialLine1.getIp();
if (useHistory) if (useHistory)
this.bindHistories = ipResource.getBindHistory(); this.bindHistories = ipResource.getBindHistory();
else else
this.bindHistories = new ArrayList<>(); this.bindHistories = new ArrayList<>();
this.bindShop = new ShopDto();
} }
public String getId() { public String getId() {
......
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