Commit 638c568b authored by renjie's avatar renjie

Merge branch 'dev-zrj' into 'staging'

专线

See merge request !38
parents 22140f88 a96f40a2
package com.edgec.browserbackend.browser.domain;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Document("specailline")
public class SpecialLine {
@Id
private String Id;
private String ip;
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getId() {
return Id;
}
public void setId(String id) {
Id = id;
}
}
...@@ -31,6 +31,8 @@ public class IpResourceDto { ...@@ -31,6 +31,8 @@ public class IpResourceDto {
private String proxyProtocol; private String proxyProtocol;
private List<String> proxyPort; private List<String> proxyPort;
private String speicalLineIp;
public IpResourceDto(){ public IpResourceDto(){
} }
...@@ -59,6 +61,32 @@ public class IpResourceDto { ...@@ -59,6 +61,32 @@ public class IpResourceDto {
this.bindHistories = new ArrayList<>(); this.bindHistories = new ArrayList<>();
} }
public IpResourceDto(IpResource ipResource, ShopDto shopDto, boolean useHistory, String speicalLineIp){
this.id = ipResource.getId();
this.addr = ipResource.getAddr();
this.vendor = ipResource.getVendor();
this.region = ipResource.getRegion();
this.status = ipResource.getStatus();
this.port = ipResource.getPort();
this.purchasedTime = ipResource.getPurchasedTime();
this.validTime = ipResource.getValidTime();
this.username = ipResource.getUsername();
this.details = ipResource.getDetails();
this.password = ipResource.getPassword();
this.protocol = ipResource.getProtocol();
this.proxyUsername = ipResource.getProxyUsername();
this.proxyPassword = ipResource.getProxyPassword();
this.proxyPort = ipResource.getProxyPort();
this.proxyProtocol = ipResource.getProxyProtocol();
this.specialLine = ipResource.isSpecialLine();
this.bindShop = shopDto;
this.speicalLineIp = speicalLineIp;
if (useHistory)
this.bindHistories = ipResource.getBindHistory();
else
this.bindHistories = new ArrayList<>();
}
public String getId() { public String getId() {
return id; return id;
} }
......
package com.edgec.browserbackend.browser.repository;
import com.edgec.browserbackend.browser.domain.SpecialLine;
import org.springframework.data.mongodb.repository.MongoRepository;
public interface SpecialLineRepository extends MongoRepository<SpecialLine, String> {
}
...@@ -83,6 +83,9 @@ public class IpResourceServiceImpl implements IpResourceService { ...@@ -83,6 +83,9 @@ public class IpResourceServiceImpl implements IpResourceService {
@Autowired @Autowired
private IpAndShopService ipAndShopService; private IpAndShopService ipAndShopService;
@Autowired
private SpecialLineRepository specialLineRepository;
public HttpHeaders buildPostHeader() { public HttpHeaders buildPostHeader() {
HttpHeaders header = new HttpHeaders(); HttpHeaders header = new HttpHeaders();
header.setContentType(MediaType.APPLICATION_JSON); header.setContentType(MediaType.APPLICATION_JSON);
...@@ -577,6 +580,10 @@ public class IpResourceServiceImpl implements IpResourceService { ...@@ -577,6 +580,10 @@ public class IpResourceServiceImpl implements IpResourceService {
if (x.getStatus() == 3) { if (x.getStatus() == 3) {
x.setAddr(""); x.setAddr("");
} }
SpecialLine specialLine = specialLineRepository.findAll().get(0);
if (x.isSpecialLine())
ipResourceDtos.add(new IpResourceDto(x, shopDto, false, specialLine.getIp()));
else
ipResourceDtos.add(new IpResourceDto(x, shopDto, false)); ipResourceDtos.add(new IpResourceDto(x, shopDto, false));
}); });
} }
......
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