Commit a96f40a2 authored by renjie's avatar renjie

专线

parent b438395c
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 {
private String proxyProtocol;
private List<String> proxyPort;
private String speicalLineIp;
public IpResourceDto(){
}
......@@ -59,6 +61,32 @@ public class IpResourceDto {
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() {
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 {
@Autowired
private IpAndShopService ipAndShopService;
@Autowired
private SpecialLineRepository specialLineRepository;
public HttpHeaders buildPostHeader() {
HttpHeaders header = new HttpHeaders();
header.setContentType(MediaType.APPLICATION_JSON);
......@@ -577,7 +580,11 @@ public class IpResourceServiceImpl implements IpResourceService {
if (x.getStatus() == 3) {
x.setAddr("");
}
ipResourceDtos.add(new IpResourceDto(x, shopDto, false));
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));
});
}
......
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