Commit 1c989b65 authored by renjie's avatar renjie

Ip接口

parent 0ccd72a6
package com.edgec.browserbackend.browser.controller;
import com.edgec.browserbackend.account.dto.ResultDto;
import com.edgec.browserbackend.browser.domain.IpResource;
import com.edgec.browserbackend.browser.dto.*;
import com.edgec.browserbackend.browser.service.IpResourceService;
import com.edgec.browserbackend.common.commons.error.ClientRequestException;
......@@ -30,10 +29,10 @@ public class IpControlloer {
List<IpResourceDto> ipResourceDto = ipResourceService.buyIp(principal.getName(), ipResourceRequestDto);
resultDto.setData(ipResourceDto);
resultDto.setStatus(0);
}catch (ClientRequestException e) {
}catch (Exception e) {
resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", e.getErrorCode());
statusInfo.put("code", 80001);
statusInfo.put("message", e.getMessage());
resultDto.setStatusInfo(statusInfo);
}
......
......@@ -3,7 +3,7 @@ package com.edgec.browserbackend.browser.controller;
import com.edgec.browserbackend.account.dto.ResultDto;
import com.edgec.browserbackend.browser.domain.Shop;
import com.edgec.browserbackend.browser.dto.ShopPageResultDto;
import com.edgec.browserbackend.browser.dto.ShopDto;
import com.edgec.browserbackend.browser.dto.ShopResultDto;
import com.edgec.browserbackend.browser.dto.ShopRequestDto;
import com.edgec.browserbackend.browser.dto.ShopStringResultDto;
import com.edgec.browserbackend.browser.service.ShopService;
......@@ -27,11 +27,11 @@ public class ShopController {
private ShopService shopService;
@RequestMapping(value = "/add", method = RequestMethod.POST)
public ResultDto addShop(Principal principal, @RequestBody ShopDto shopDto) {
public ResultDto addShop(Principal principal, @RequestBody ShopResultDto shopResultDto) {
ResultDto resultDto = new ResultDto();
try {
ShopStringResultDto shopStringResultDto = new ShopStringResultDto();
shopStringResultDto.setId(shopService.addShop(principal.getName(), shopDto));
shopStringResultDto.setId(shopService.addShop(principal.getName(), shopResultDto));
resultDto.setData(shopStringResultDto);
resultDto.setStatus(0);
}catch (ClientRequestException e) {
......@@ -50,11 +50,11 @@ public class ShopController {
}
@RequestMapping(value = "/update", method = RequestMethod.POST)
public ResultDto updateShop(Principal principal, @RequestBody ShopDto shopDto) {
public ResultDto updateShop(Principal principal, @RequestBody ShopResultDto shopResultDto) {
ResultDto resultDto = new ResultDto();
try {
ShopStringResultDto shopStringResultDto = new ShopStringResultDto();
shopStringResultDto.setId(shopService.updateShop(principal.getName(), shopDto));
shopStringResultDto.setId(shopService.updateShop(principal.getName(), shopResultDto));
resultDto.setData(shopStringResultDto);
resultDto.setStatus(0);
}catch (ClientRequestException e) {
......
......@@ -15,13 +15,11 @@ public class IpResource {
private String addr;
private IpType ipType = IpType.VENDOR;
private String vendor;
private String ipRegion;
private String region;
private IpStatus ipStatus;
private Platform platform;
private List<Interval> port;
private long purchasedTime;
private long validTime;
private long leftTime;
private String details;
List<String> bindHistory;
private boolean isDeleted;
......@@ -29,6 +27,8 @@ public class IpResource {
private String userParent;
private String shopId;
private String shopName;
private List<String> protocol;
private String password;
public String getDetails() {
return details;
......@@ -46,12 +46,12 @@ public class IpResource {
this.id = id;
}
public String getIpRegion() {
return ipRegion;
public String getRegion() {
return region;
}
public void setIpRegion(String ipRegion) {
this.ipRegion = ipRegion;
public void setRegion(String region) {
this.region = region;
}
public IpStatus getIpStatus() {
......@@ -86,14 +86,6 @@ public class IpResource {
this.purchasedTime = purchasedTime;
}
public long getLeftTime() {
return leftTime;
}
public void setLeftTime(long leftTime) {
this.leftTime = leftTime;
}
public long getValidTime() {
return validTime;
}
......@@ -126,14 +118,6 @@ public class IpResource {
isDeleted = deleted;
}
public List<Interval> getPorts() {
return port;
}
public void setPorts(List<Interval> ports) {
this.port = ports;
}
public String getUsername() {
return username;
}
......@@ -182,11 +166,19 @@ public class IpResource {
this.shopId = shopId;
}
public Platform getPlatform() {
return platform;
public List<String> getProtocol() {
return protocol;
}
public void setProtocol(List<String> protocol) {
this.protocol = protocol;
}
public String getPassword() {
return password;
}
public void setPlatform(Platform platform) {
this.platform = platform;
public void setPassword(String password) {
this.password = password;
}
}
package com.edgec.browserbackend.browser.domain;
import com.edgec.browserbackend.browser.dto.ShopDto;
import com.edgec.browserbackend.browser.dto.ShopResultDto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
......@@ -41,7 +41,7 @@ public class Shop {
}
//创建店铺使用
public Shop of(ShopDto shop) {
public Shop of(ShopResultDto shop) {
if (shop.getShopUrl() != null)
this.setShopUrl(shop.getShopUrl());
if (shop.getOwner() != null)
......
package com.edgec.browserbackend.browser.dto;
public class DeleteIpResultDto {
private String errorCode = "";
private String result;
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
}
\ No newline at end of file
package com.edgec.browserbackend.browser.dto;
import com.edgec.browserbackend.browser.domain.IpResource;
import com.edgec.browserbackend.browser.domain.IpStatus;
import com.edgec.browserbackend.browser.domain.IpType;
import com.edgec.browserbackend.browser.domain.Shop;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.springframework.data.annotation.Id;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public class IpResourceDto {
private String id;
private String ipAddr;
private IpType ipType;
private String ipProvider;
private String ipRegion;
private String addr;
private String vendor;
private String region;
private IpStatus ipStatus;
private List<Interval> ports;
private List<Interval> port;
private long purchasedTIme;
private long validTime;
private long leftTime;
private String username;
private String details;
List<String> bindHistory;
private String shopId;
private String shopName;
private String password;
ShopDto shopDto;
public String getShopId() {
return shopId;
public IpResourceDto(){
}
public void setShopId(String shopId) {
this.shopId = shopId;
}
public String getShopName() {
return shopName;
}
public void setShopName(String shopName) {
this.shopName = shopName;
public IpResourceDto(IpResource ipResource, ShopDto shopDto){
this.id = ipResource.getId();
this.addr = ipResource.getAddr();
this.vendor = ipResource.getVendor();
this.region = ipResource.getRegion();
this.ipStatus = ipResource.getIpStatus();
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.shopDto = shopDto;
}
public String getId() {
......@@ -49,44 +49,36 @@ public class IpResourceDto {
this.id = id;
}
public List<Interval> getPorts() {
return ports;
}
public void setPorts(List<Interval> ports) {
this.ports = ports;
public List<Interval> getPort() {
return port;
}
public String getIpRegion() {
return ipRegion;
public void setPort(List<Interval> port) {
this.port = port;
}
public void setIpRegion(String ipRegion) {
this.ipRegion = ipRegion;
public String getRegion() {
return region;
}
public List<String> getBindHistory() {
return bindHistory;
public void setRegion(String region) {
this.region = region;
}
public void setBindHistory(List<String> bindHistory) {
this.bindHistory = bindHistory;
public String getVendor() {
return vendor;
}
public String getIpProvider() {
return ipProvider;
public void setVendor(String vendor) {
this.vendor = vendor;
}
public void setIpProvider(String ipProvider) {
this.ipProvider = ipProvider;
public String getAddr() {
return addr;
}
public String getIpAddr() {
return ipAddr;
}
public void setIpAddr(String ipAddr) {
this.ipAddr = ipAddr;
public void setAddr(String addr) {
this.addr = addr;
}
public long getValidTime() {
......@@ -97,14 +89,6 @@ public class IpResourceDto {
this.validTime = validTime;
}
public long getLeftTime() {
return leftTime;
}
public void setLeftTime(long leftTime) {
this.leftTime = leftTime;
}
public long getPurchasedTIme() {
return purchasedTIme;
}
......@@ -113,14 +97,6 @@ public class IpResourceDto {
this.purchasedTIme = purchasedTIme;
}
public IpType getIpType() {
return ipType;
}
public void setIpType(IpType ipType) {
this.ipType = ipType;
}
public IpStatus getIpStatus() {
return ipStatus;
}
......@@ -144,4 +120,20 @@ public class IpResourceDto {
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public ShopDto getShopDto() {
return shopDto;
}
public void setShopDto(ShopDto shopDto) {
this.shopDto = shopDto;
}
}
package com.edgec.browserbackend.browser.dto;
import java.util.ArrayList;
import java.util.List;
public class RenewIpResultDto {
private String errorCode="";
private int balance = 0;
private List<IpBuyResultDto.IPData> iplist = new ArrayList<>();
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public int getBalance() {
return balance;
}
public void setBalance(int balance) {
this.balance = balance;
}
public List<IpBuyResultDto.IPData> getIplist() {
return iplist;
}
public void setIplist(List<IpBuyResultDto.IPData> iplist) {
this.iplist = iplist;
}
public static class IPData {
private String ip;
private String validTill;
public IPData(String ip, String validTill) {
this.ip = ip;
this.validTill = validTill;
}
public IPData() {
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getValidTill() {
return validTill;
}
public void setValidTill(String validTill) {
this.validTill = validTill;
}
}
}
\ No newline at end of file
package com.edgec.browserbackend.browser.dto;
import com.edgec.browserbackend.browser.domain.IpResource;
import com.edgec.browserbackend.browser.domain.Shop;
import com.edgec.browserbackend.browser.domain.TransferStatus;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public class ShopDto {
private String shopId;
private String shopName;
private String owner;
private TransferStatus transferStatus;
private String group;
private String shopUrl;
private String shopPlatform;
private String shopAccount;
private String shopPassword;
private String shopUA;
private String shopCookie;
private IpResource bindIp;
public static ShopDto of(Shop shop, String group, IpResource ipResources) {
ShopDto shopDto = new ShopDto();
shopDto.setShopId(shop.getShopId());
if (shop.getShopName() != null)
shopDto.setShopName(shop.getShopName());
if (shop.getShopPlatform() != null)
shopDto.setShopPlatform(shop.getShopPlatform());
if (shop.getShopPassword() != null)
shopDto.setShopPassword(shop.getShopPassword());
if (shop.getTransferStatus() != null)
shopDto.setTransferStatus(shop.getTransferStatus());
if (shop.getOwner() != null)
shopDto.setOwner(shop.getOwner());
if (shop.getShopUrl() != null)
shopDto.setShopUrl(shop.getShopUrl());
if (shop.getShopUA() != null)
shopDto.setShopUA(shop.getShopUA());
if (shop.getShopCookie() != null)
shopDto.setShopCookie(shop.getShopCookie());
if (shop.getShopAccount() != null)
shopDto.setShopAccount(shop.getShopAccount());
shopDto.setGroup(group);
shopDto.setBindIp(ipResources);
return shopDto;
}
public String getShopPlatform() {
return shopPlatform;
}
public void setShopPlatform(String shopPlatform) {
this.shopPlatform = shopPlatform;
}
public String getGroup() {
return group;
}
public void setGroup(String group) {
this.group = group;
}
public String getShopPassword() {
return shopPassword;
}
public void setShopPassword(String shopPassword) {
this.shopPassword = shopPassword;
}
public String getShopAccount() {
return shopAccount;
}
public void setShopAccount(String shopAccount) {
this.shopAccount = shopAccount;
}
public String getShopName() {
return shopName;
}
public void setShopName(String shopName) {
this.shopName = shopName;
}
private String shopPlatform;
public String getShopId() {
return shopId;
......@@ -108,51 +19,35 @@ public class ShopDto {
this.shopId = shopId;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public TransferStatus getTransferStatus() {
return transferStatus;
}
public void setTransferStatus(TransferStatus transferStatus) {
this.transferStatus = transferStatus;
}
public String getShopUrl() {
return shopUrl;
public String getShopName() {
return shopName;
}
public void setShopUrl(String shopUrl) {
this.shopUrl = shopUrl;
public void setShopName(String shopName) {
this.shopName = shopName;
}
public IpResource getBindIp() {
return bindIp;
public String getShopAccount() {
return shopAccount;
}
public void setBindIp(IpResource bindIp) {
this.bindIp = bindIp;
public void setShopAccount(String shopAccount) {
this.shopAccount = shopAccount;
}
public String getShopUA() {
return shopUA;
public String getShopPassword() {
return shopPassword;
}
public void setShopUA(String shopUA) {
this.shopUA = shopUA;
public void setShopPassword(String shopPassword) {
this.shopPassword = shopPassword;
}
public String getShopCookie() {
return shopCookie;
public String getShopPlatform() {
return shopPlatform;
}
public void setShopCookie(String shopCookie) {
this.shopCookie = shopCookie;
public void setShopPlatform(String shopPlatform) {
this.shopPlatform = shopPlatform;
}
}
......@@ -3,14 +3,14 @@ package com.edgec.browserbackend.browser.dto;
import java.util.List;
public class ShopPageResultDto {
List<ShopDto> shopList;
List<ShopResultDto> shopList;
ShopPageInfo shopPage;
public List<ShopDto> getShopList() {
public List<ShopResultDto> getShopList() {
return shopList;
}
public void setShopList(List<ShopDto> shopList) {
public void setShopList(List<ShopResultDto> shopList) {
this.shopList = shopList;
}
......
package com.edgec.browserbackend.browser.dto;
import com.edgec.browserbackend.browser.domain.IpResource;
import com.edgec.browserbackend.browser.domain.Shop;
import com.edgec.browserbackend.browser.domain.TransferStatus;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class ShopResultDto {
private String shopId;
private String shopName;
private String owner;
private TransferStatus transferStatus;
private String group;
private String shopUrl;
private String shopPlatform;
private String shopAccount;
private String shopPassword;
private String shopUA;
private String shopCookie;
private IpResource bindIp;
public static ShopResultDto of(Shop shop, String group, IpResource ipResources) {
ShopResultDto shopResultDto = new ShopResultDto();
shopResultDto.setShopId(shop.getShopId());
if (shop.getShopName() != null)
shopResultDto.setShopName(shop.getShopName());
if (shop.getShopPlatform() != null)
shopResultDto.setShopPlatform(shop.getShopPlatform());
if (shop.getShopPassword() != null)
shopResultDto.setShopPassword(shop.getShopPassword());
if (shop.getTransferStatus() != null)
shopResultDto.setTransferStatus(shop.getTransferStatus());
if (shop.getOwner() != null)
shopResultDto.setOwner(shop.getOwner());
if (shop.getShopUrl() != null)
shopResultDto.setShopUrl(shop.getShopUrl());
if (shop.getShopUA() != null)
shopResultDto.setShopUA(shop.getShopUA());
if (shop.getShopCookie() != null)
shopResultDto.setShopCookie(shop.getShopCookie());
if (shop.getShopAccount() != null)
shopResultDto.setShopAccount(shop.getShopAccount());
shopResultDto.setGroup(group);
shopResultDto.setBindIp(ipResources);
return shopResultDto;
}
public String getShopPlatform() {
return shopPlatform;
}
public void setShopPlatform(String shopPlatform) {
this.shopPlatform = shopPlatform;
}
public String getGroup() {
return group;
}
public void setGroup(String group) {
this.group = group;
}
public String getShopPassword() {
return shopPassword;
}
public void setShopPassword(String shopPassword) {
this.shopPassword = shopPassword;
}
public String getShopAccount() {
return shopAccount;
}
public void setShopAccount(String shopAccount) {
this.shopAccount = shopAccount;
}
public String getShopName() {
return shopName;
}
public void setShopName(String shopName) {
this.shopName = shopName;
}
public String getShopId() {
return shopId;
}
public void setShopId(String shopId) {
this.shopId = shopId;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public TransferStatus getTransferStatus() {
return transferStatus;
}
public void setTransferStatus(TransferStatus transferStatus) {
this.transferStatus = transferStatus;
}
public String getShopUrl() {
return shopUrl;
}
public void setShopUrl(String shopUrl) {
this.shopUrl = shopUrl;
}
public IpResource getBindIp() {
return bindIp;
}
public void setBindIp(IpResource bindIp) {
this.bindIp = bindIp;
}
public String getShopUA() {
return shopUA;
}
public void setShopUA(String shopUA) {
this.shopUA = shopUA;
}
public String getShopCookie() {
return shopCookie;
}
public void setShopCookie(String shopCookie) {
this.shopCookie = shopCookie;
}
}
......@@ -9,7 +9,7 @@ import com.edgec.browserbackend.browser.domain.IpResource;
import com.edgec.browserbackend.browser.domain.Shop;
import com.edgec.browserbackend.browser.domain.UserShop;
import com.edgec.browserbackend.browser.dto.FilterDto;
import com.edgec.browserbackend.browser.dto.ShopDto;
import com.edgec.browserbackend.browser.dto.ShopResultDto;
import com.edgec.browserbackend.browser.dto.ShopPageInfo;
import com.edgec.browserbackend.browser.dto.ShopPageResultDto;
import com.edgec.browserbackend.browser.repository.GroupRepository;
......@@ -18,7 +18,6 @@ import com.edgec.browserbackend.browser.repository.ShopRepository;
import com.edgec.browserbackend.browser.repository.UserShopRepository;
import com.edgec.browserbackend.browser.service.ShopService;
import com.edgec.browserbackend.common.commons.error.ClientRequestException;
import com.edgec.browserbackend.common.commons.error.ErrorCode;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -56,7 +55,7 @@ public class ShopServiceImpl implements ShopService {
IpResourceRepository ipResourceRepository;
@Override
public String addShop(String username, ShopDto shopDto) {
public String addShop(String username, ShopResultDto shopResultDto) {
Account account = accountRepository.findByName(username);
String id = null;
if (account == null) {
......@@ -68,21 +67,21 @@ public class ShopServiceImpl implements ShopService {
if (account.getShopCount() >= 10000) {
throw new ClientRequestException(AccountErrorCode.SHOPMAX);
}
UserShop us = userShopRepository.findByUsernameAndShopId(username, shopDto.getShopId());
Group group = groupRepository.findById(shopDto.getGroup()).orElse(null);
UserShop us = userShopRepository.findByUsernameAndShopId(username, shopResultDto.getShopId());
Group group = groupRepository.findById(shopResultDto.getGroup()).orElse(null);
if (group == null) {
throw new ClientRequestException(BrowserErrorCode.GROUPNOTEXIST);
}
try {
shopDto.setOwner(username);
shopResultDto.setOwner(username);
Shop shop = new Shop();
shop.of(shopDto);
shop.of(shopResultDto);
id = shopRepository.save(shop).getShopId();
UserShop userShop = new UserShop();
userShop.setUsername(username);
userShop.setShopId(id);
if (shopDto.getGroup() != null && us == null) {
userShop.setGroupId(shopDto.getGroup());
if (shopResultDto.getGroup() != null && us == null) {
userShop.setGroupId(shopResultDto.getGroup());
}
userShopRepository.save(userShop);
}catch (Exception e) {
......@@ -97,23 +96,23 @@ public class ShopServiceImpl implements ShopService {
}
@Override
public String updateShop(String username, ShopDto shopDto) {
public String updateShop(String username, ShopResultDto shopResultDto) {
Account account = accountRepository.findByName(username);
if (account == null) {
throw new ClientRequestException(AccountErrorCode.NAMENOTEXIST);
}
if (shopDto == null || StringUtils.isBlank(shopDto.getShopId())) {
if (shopResultDto == null || StringUtils.isBlank(shopResultDto.getShopId())) {
throw new ClientRequestException(AccountErrorCode.OTHERS);
}
UserShop userShop = userShopRepository.findByUsernameAndShopId(username, shopDto.getShopId());
UserShop userShop = userShopRepository.findByUsernameAndShopId(username, shopResultDto.getShopId());
if (account.getPermission() < 4 || userShop == null) {
throw new ClientRequestException(AccountErrorCode.NOPERMISSION);
}
Shop shop_old = shopRepository.findById(shopDto.getShopId()).orElseGet(null);
Shop shop_old = shopRepository.findById(shopResultDto.getShopId()).orElseGet(null);
if (shop_old == null)
throw new ClientRequestException(BrowserErrorCode.SHOPNOTEXIST);
try {
shop_old = shop_old.of(shopDto);
shop_old = shop_old.of(shopResultDto);
shopRepository.save(shop_old);
}catch (Exception e) {
logger.error("fail to update", e.getMessage());
......@@ -170,7 +169,7 @@ public class ShopServiceImpl implements ShopService {
try {
shop.setIp(ipAddr);
shop.setIpId(ipResource.getId());
shop.setIpRegion(ipResource.getIpRegion());
shop.setIpRegion(ipResource.getRegion());
shopRepository.save(shop);
List<String> history = ipResource.getBindHistory();
history.add(shop.getShopId());
......@@ -308,15 +307,15 @@ public class ShopServiceImpl implements ShopService {
shops = shopRepository.findByShopIdIn(shopIds, pageable);
if (shops == null || shops.getNumberOfElements() < 1)
return new ShopPageResultDto();
List<ShopDto> shopDtos = new ArrayList<>();
List<ShopResultDto> shopResultDtos = new ArrayList<>();
shops.getContent().stream().forEach(x -> {
IpResource ipResource = ipResourceRepository.findByAddrAndIsDeleted(x.getIp(), false);
if (ipResource == null)
ipResource = new IpResource();
String group1 = userShopRepository.findByUsernameAndShopId(username, x.getShopId()).getGroupId();
shopDtos.add(ShopDto.of(x, group1, ipResource));
shopResultDtos.add(ShopResultDto.of(x, group1, ipResource));
});
Page<ShopDto> shopDtoPage = new PageImpl<>(shopDtos, pageable, shopDtos.size());
Page<ShopResultDto> shopDtoPage = new PageImpl<>(shopResultDtos, pageable, shopIds.size());
ShopPageResultDto shopPageResultDto = new ShopPageResultDto();
shopPageResultDto.setShopList(shopDtoPage.getContent());
ShopPageInfo shopPageInfo = new ShopPageInfo();
......
package com.edgec.browserbackend.browser.service;
import com.edgec.browserbackend.browser.domain.IpResource;
import com.edgec.browserbackend.browser.dto.FilterDto;
import com.edgec.browserbackend.browser.dto.IpBuyResultDto;
import com.edgec.browserbackend.browser.dto.IpResourceDto;
import com.edgec.browserbackend.browser.dto.IpResourceRequestDto;
......@@ -12,9 +10,9 @@ public interface IpResourceService {
List<IpResourceDto> buyIp(String username, IpResourceRequestDto ipResourceRequestDto);
void renewIp(String username, IpResourceRequestDto ipResourceRequestDto);
void renewIp(String username, IpResourceRequestDto ipResourceRequestDto) throws Exception;
void deleteIp(String username, String ipAddr);
void deleteIp(String username, String ipAddr) throws Exception;
List<IpResourceDto> getIpList(String username, int type, int page, int amount, FilterDto filterDto);
}
......@@ -3,17 +3,17 @@ package com.edgec.browserbackend.browser.service;
import com.edgec.browserbackend.browser.domain.Shop;
import com.edgec.browserbackend.browser.dto.FilterDto;
import com.edgec.browserbackend.browser.dto.ShopPageResultDto;
import com.edgec.browserbackend.browser.dto.ShopDto;
import com.edgec.browserbackend.browser.dto.ShopResultDto;
import java.util.List;
public interface ShopService {
String addShop(String useranme, ShopDto shopDto);
String addShop(String useranme, ShopResultDto shopResultDto);
List<String> addShops(String username, List<Shop> shops);
String updateShop(String username, ShopDto shopDto);
String updateShop(String username, ShopResultDto shopResultDto);
void deleteShop(String username, String shopId);
......
package com.edgec.browserbackend.browser.task;
import com.edgec.browserbackend.browser.ErrorCode.BrowserErrorCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
public class BrowserTask {
private static final Logger log = LoggerFactory.getLogger(BrowserTask.class);
// 每天
@Scheduled(cron = "0 * * * * ?")
// @Scheduled(cron = "0 * * * * ?")
public void checkIpStatus() {
}
}
......@@ -26,6 +26,10 @@ public class ClientRequestException extends IllegalArgumentException {
this.errorCode = errorCode;
}
public ClientRequestException(int errorCode, String message){
super(message);
}
public String getAdditionalInfo() {
return additionalInfo;
}
......@@ -37,4 +41,5 @@ public class ClientRequestException extends IllegalArgumentException {
public Object[] getArgs() {
return this.args;
}
}
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