Commit 54138c3c authored by renjie's avatar renjie

付费功能

删除ip修改
parent ab204c18
......@@ -7,8 +7,10 @@ public class IpChargeRequestDto {
private String unit="month";
private String target;
//0 -- newip, 1 --renew, 2 --ipkeptfee, 3 --deleteip, 4 -- stopinstanceonly , 5 -- bindinstance, 6 -- refundipkeptfee
//0 -- 充值, 1 -- newip, 2 --renew, 3 --ipkeptfee, 4 --deleteip,
private int chargeType = 0;
//0 -- 余额, 2 -- 支付宝, 3 -- 微信
private int payMethod = 0;
private float daysPerMonth = 0;
......@@ -87,4 +89,12 @@ public class IpChargeRequestDto {
public void setAmount(int amount) {
this.amount = amount;
}
public int getPayMethod() {
return payMethod;
}
public void setPayMethod(int payMethod) {
this.payMethod = payMethod;
}
}
......@@ -35,6 +35,9 @@ public class UserPrePaidBilling {
private BillStatus status;
//0 -- 余额, 2 -- 支付宝, 3 -- 微信
private int payMethod;
private boolean isPrepaid;
private String user;
......@@ -46,8 +49,7 @@ public class UserPrePaidBilling {
private float ownBillingCost = 0;
private float total;
//0 -- newip, 1 --renew, 2 --ipkeptfee, 3 --deleteip, 4 -- stopinstanceonly , 5 -- bindinstance, 6 -- refundipkeptfee
//7 -- newcvm , 8 -- renewcvm , 9 -- intelligroup
//0 -- 充值, 1 -- newip, 2 --renew, 3 --ipkeptfee, 4 --deleteip,
private int chargeType;
private String target;
......@@ -221,4 +223,12 @@ public class UserPrePaidBilling {
public void setUser(String user) {
this.user = user;
}
public int getPayMethod() {
return payMethod;
}
public void setPayMethod(int payMethod) {
this.payMethod = payMethod;
}
}
......@@ -53,8 +53,10 @@ public enum AccountErrorCode implements ErrorCode {
NOPERMISSION(ACCOUNT_BASE+140, "You have no right to do this operarion"),
GROUPMAX(ACCOUNT_BASE+141, "You can not have more groups"),
SHOPMAX(ACCOUNT_BASE+141, "You can not have more shops"),
CHILDMAX(ACCOUNT_BASE+141, "You can not have more subUsers");
SHOPMAX(ACCOUNT_BASE+142, "You can not have more shops"),
CHILDMAX(ACCOUNT_BASE+143, "You can not have more subUsers"),
NOTENOUGHBALANCE(ErrorCode.ACCOUNT_BASE+150, "Your balance is not enough");
......
......@@ -213,21 +213,19 @@ public class AccountServiceImpl implements AccountService {
userBalanceRepository.incrementBalance(userBalance, -(float) money, (float) money);
userBalance = userBalanceRepository.findById(name).orElse(null);
charge.setBalance(Math.round(userBalance.getBalanced()));
charge.setSuccess(true);
UserPrePaidBilling bill = new UserPrePaidBilling();
bill.setChargeType(requestDto.getChargeType());
bill.setServices(Services.valueOf(requestDto.getServices()));
bill.setAmount(requestDto.getAmount());
bill.setUnit(requestDto.getUnit());
bill.setPeriod(requestDto.getPeriod());
bill.setPayMethod(requestDto.getPayMethod());
bill.setUsername(name);
bill.setTotal((float) money);
bill.setStatus(BillStatus.PAID);
bill.setPrepaid(true);
bill.setUsername(name);
bill.setTimestamp(Instant.now().toEpochMilli());
......
......@@ -3,6 +3,7 @@ package com.edgec.browserbackend.browser.controller;
import com.edgec.browserbackend.account.dto.ResultDto;
import com.edgec.browserbackend.browser.dto.*;
import com.edgec.browserbackend.browser.service.IpResourceService;
import com.edgec.browserbackend.common.commons.error.ClientRequestException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -28,7 +29,13 @@ public class IpControlloer {
List<IpResourceDto> ipResourceDto = ipResourceService.buyIp(principal.getName(), ipResourceRequestDto);
resultDto.setData(ipResourceDto);
resultDto.setStatus(0);
}catch (Exception e) {
} catch (ClientRequestException e) {
resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", e.getErrorCode());
statusInfo.put("message", e.getMessage());
resultDto.setStatusInfo(statusInfo);
} catch (Exception e) {
resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", 80001);
......@@ -44,7 +51,13 @@ public class IpControlloer {
try {
resultDto.setData(ipResourceService.renewIp(principal.getName(), ipResourceRequestDto));
resultDto.setStatus(0);
}catch (Exception e) {
} catch (ClientRequestException e) {
resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", e.getErrorCode());
statusInfo.put("message", e.getMessage());
resultDto.setStatusInfo(statusInfo);
} catch (Exception e) {
resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", 80001);
......@@ -60,7 +73,7 @@ public class IpControlloer {
try {
resultDto.setData(ipResourceService.deleteIp(principal.getName(), ipResourceRequestDto.getAddr()));
resultDto.setStatus(0);
}catch (Exception e) {
} catch (Exception e) {
resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", 80001);
......@@ -78,10 +91,10 @@ public class IpControlloer {
ipListRequestDto.getAmount(), ipListRequestDto.getIpFilterDto());
resultDto.setData(ipResourceDto);
resultDto.setStatus(0);
}catch (Exception e) {
}catch (ClientRequestException e) {
resultDto.setStatus(-1);
Map<String, Object> statusInfo = new HashMap<>();
statusInfo.put("code", 80001);
statusInfo.put("code", e.getErrorCode());
statusInfo.put("message", e.getMessage());
resultDto.setStatusInfo(statusInfo);
}
......
......@@ -15,8 +15,9 @@ public class IpResource {
private String id;
private String addr;
private IpType ipType = IpType.VENDOR;
private String vendor;
private Vendor vendor;
private String region;
private String regionCn;
//0:正常, 1:已过期, 2:即将过期
private int status;
private List<String> port;
......@@ -57,6 +58,14 @@ public class IpResource {
this.region = region;
}
public String getRegionCn() {
return regionCn;
}
public void setRegionCn(String regionCn) {
this.regionCn = regionCn;
}
public int getStatus() {
return status;
}
......@@ -105,11 +114,11 @@ public class IpResource {
this.addr = ipAddr;
}
public String getVendor() {
public Vendor getVendor() {
return vendor;
}
public void setVendor(String vendor) {
public void setVendor(Vendor vendor) {
this.vendor = vendor;
}
......
package com.edgec.browserbackend.browser.domain;
/**
* @Desc
* @Author jason
* @CreateTime 2020/3/12 4:01 下午
**/
public enum Vendor {
aliyun("阿里云"), JDCLOUD("京东云"), aws("亚马逊云"), awscn("亚马逊中国"), tencent("腾讯云");
private String value;
private Vendor(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}
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.edgec.browserbackend.browser.domain.*;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.util.List;
......@@ -12,7 +9,7 @@ import java.util.List;
public class IpResourceDto {
private String id;
private String addr;
private String vendor;
private Vendor vendor;
private String region;
private int status;
private List<String> port;
......@@ -67,11 +64,11 @@ public class IpResourceDto {
this.region = region;
}
public String getVendor() {
public Vendor getVendor() {
return vendor;
}
public void setVendor(String vendor) {
public void setVendor(Vendor vendor) {
this.vendor = vendor;
}
......
......@@ -2,6 +2,8 @@ package com.edgec.browserbackend.browser.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import java.util.ArrayList;
import java.util.List;
......@@ -9,8 +11,12 @@ import java.util.List;
public class IpResourceRequestDto {
private String name;
private String region;
private String regionCn;
private String vendor="aliyun";
private String logintype = "password";
@Max(12)
@Min(1)
private int period = 1;
private String unit="month";
private int amount = 1;
......@@ -83,6 +89,14 @@ public class IpResourceRequestDto {
this.region = region;
}
public String getRegionCn() {
return regionCn;
}
public void setAutorenew(boolean autorenew) {
this.autorenew = autorenew;
}
public int getIpkeptperiod() {
return ipkeptperiod;
}
......
......@@ -10,11 +10,11 @@ import java.util.List;
public interface IpResourceRepository extends MongoRepository<IpResource, String> {
IpResource findByAddrAndIsDeleted(String addr, boolean isDeleted);
List<IpResource> findByIdIn(List<String> ipIds);
List<IpResource> findByOwnerAndShopIdIsNull(String owner);
List<IpResource> findByOwnerAndStatusAndShopIdIsNull(String owner, int status);
List<IpResource> findByStatusAndIdIn(int status, List<String> ipIds);
Page<IpResource> findByAddrLikeAndIdIn(String addr, List<String> ipIds, Pageable pageable);
Page<IpResource> findByVendorLikeAndIdIn(String vendor, List<String> ipIds, Pageable pageable);
Page<IpResource> findByRegionLikeAndIdIn(String region, List<String> ipIds, Pageable pageable);
List<IpResource> findByIdInAndIsDeleted(List<String> ipIds, boolean isDeleted);
List<IpResource> findByOwnerAndIsDeletedAndShopIdIsNull(String owner, boolean isDeleted);
List<IpResource> findByOwnerAndStatusAndIsDeletedAndShopIdIsNull(String owner, int status, boolean isDeleted);
List<IpResource> findByStatusAndIdInAndIsDeleted(int status, List<String> ipIds, boolean isDeleted);
Page<IpResource> findByAddrLikeAndIdInAndIsDeleted(String addr, List<String> ipIds, boolean isDeleted, Pageable pageable);
Page<IpResource> findByVendorLikeAndIdInAndIsDeleted(String vendor, List<String> ipIds, boolean isDeleted, Pageable pageable);
Page<IpResource> findByRegionLikeAndIdInAndIsDeleted(String region, List<String> ipIds, boolean isDeleted, Pageable pageable);
}
......@@ -3,6 +3,10 @@ package com.edgec.browserbackend.browser.service.Impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.edgec.browserbackend.account.domain.Account;
import com.edgec.browserbackend.account.domain.IpChargeRequestDto;
import com.edgec.browserbackend.account.domain.IpChargeResultDto;
import com.edgec.browserbackend.account.dto.CvmChargeRegion;
import com.edgec.browserbackend.account.dto.ResultDto;
import com.edgec.browserbackend.account.exception.AccountErrorCode;
import com.edgec.browserbackend.account.repository.AccountRepository;
import com.edgec.browserbackend.account.service.AccountService;
......@@ -12,6 +16,8 @@ import com.edgec.browserbackend.browser.dto.*;
import com.edgec.browserbackend.browser.repository.*;
import com.edgec.browserbackend.browser.service.IpResourceService;
import com.edgec.browserbackend.common.commons.error.ClientRequestException;
import com.edgec.browserbackend.common.commons.error.ErrorCode;
import com.edgec.browserbackend.common.dto.Result;
import com.edgec.browserbackend.common.utils.FileUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
......@@ -25,9 +31,12 @@ import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import javax.swing.text.Document;
import java.io.File;
import java.text.MessageFormat;
import java.time.Instant;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@Service
......@@ -89,6 +98,17 @@ public class IpResourceServiceImpl implements IpResourceService {
return sb.toString();
}
private IpChargeRequestDto buildIpChargeRequestDto(IpResourceRequestDto request, int chargeType) {
IpChargeRequestDto ipChargeRequestDto = new IpChargeRequestDto();
ipChargeRequestDto.setAmount(request.getAmount());
ipChargeRequestDto.setChargeType(chargeType);
ipChargeRequestDto.setRegion(request.getRegion());
ipChargeRequestDto.setPeriod(request.getPeriod());
ipChargeRequestDto.setUnit(request.getUnit());
ipChargeRequestDto.setPayMethod(0);
return ipChargeRequestDto;
}
@Override
public List<IpResourceDto> buyIp(String username, IpResourceRequestDto ipResourceRequestDto) throws Exception {
Account account = accountRepository.findByName(username);
......@@ -96,9 +116,21 @@ public class IpResourceServiceImpl implements IpResourceService {
throw new ClientRequestException(AccountErrorCode.NAMENOTEXIST);
if (account.getPermission() < 8)
throw new ClientRequestException(AccountErrorCode.NOPERMISSION);
//todo 预扣费
Map<String, List<String>> priceList = ipOptionsRepository.findAll().get(0).getIpPlatForm();
if (ipResourceRequestDto.getRegionCn() == null)
throw new ClientRequestException(BrowserErrorCode.INFORMATIONNOTCOMPELETE);
List<String> vendorPrices = priceList.get(ipResourceRequestDto.getRegionCn());
String price = vendorPrices.stream()
.filter(x -> Vendor.valueOf(ipResourceRequestDto.getVendor()).getValue().equals(x.substring(0, x.indexOf("-"))))
.map(x -> x.substring(x.lastIndexOf("-") + 1)).collect(Collectors.joining());
IpChargeResultDto ipChargeResultDto = accountService.preChargeByMoney(username, Double.valueOf(price));
if (!ipChargeResultDto.isSuccess()) {
throw new ClientRequestException(AccountErrorCode.NOTENOUGHBALANCE);
}
List<IpResourceDto> ipResourceDtos = new ArrayList<>();
RestTemplate restTemplate = new RestTemplate();
HttpHeaders header = buildPostHeader();
HashMap<String, Object> map = new HashMap<>();
......@@ -145,12 +177,13 @@ public class IpResourceServiceImpl implements IpResourceService {
else if (ipResourceRequestDto.getUnit().equals("week"))
ipResource.setValidTime(Instant.now().plusSeconds(60*60*24*7).toEpochMilli());
ipResource.setPort(port);
ipResource.setVendor(ipResourceRequestDto.getVendor());
ipResource.setVendor(Vendor.valueOf(ipResourceRequestDto.getVendor()));
ipResource.setStatus(0);
ipResource.setUsername(USERNAME);
if (account.getParent() != null)
ipResource.setUserParent(account.getParent());
ipResource.setRegion(ipResourceRequestDto.getRegion());
ipResource.setRegionCn(ipResourceRequestDto.getRegionCn());
ipResource.setProtocol(protocol);
ipResource.setPassword(password);
ipResource.setOwner(username);
......@@ -164,55 +197,70 @@ public class IpResourceServiceImpl implements IpResourceService {
logger.error(e.getMessage());
throw new ClientRequestException(BrowserErrorCode.UNKNOWN);
}
IpChargeRequestDto ipChargeRequestDto = buildIpChargeRequestDto(ipResourceRequestDto, 0);
accountService.chargeByMoney(username, Double.valueOf(price), ipChargeRequestDto);
return ipResourceDtos;
}
@Override
public IpOperationResultDto renewIp(String username, IpResourceRequestDto ipResourceRequestDto) throws Exception {
public IpOperationResultDto renewIp(String username, IpResourceRequestDto ipResourceRequestDto) {
Account account = accountRepository.findByName(username);
if (account == null)
throw new ClientRequestException(AccountErrorCode.NAMENOTEXIST);
ipResourceRequestDto.getAddr().forEach(x -> {
IpResource ipResource = ipResourceRepository.findByAddrAndIsDeleted(x, false);
if (ipResource == null)
throw new ClientRequestException(BrowserErrorCode.IPNOTEXIST);
if (ipResource.getShopId() != null) {
UserShop userShop = userShopRepository.findByUsernameAndShopId(username, ipResource.getShopId());
if (userShop == null)
throw new ClientRequestException(AccountErrorCode.NOPERMISSION);
} else if (!ipResource.getOwner().equals(username)) {
throw new ClientRequestException(AccountErrorCode.NOPERMISSION);
List<String> failedList = ipResourceRequestDto.getAddr();
Map<String, List<String>> priceList = ipOptionsRepository.findAll().get(0).getIpPlatForm();
double totalprice = ipResourceRequestDto.getAddr().stream().map(x -> ipResourceRepository.findByAddrAndIsDeleted(x, false)).map(ipResource -> priceList.get(ipResource.getRegionCn())).map(vendorPrices -> vendorPrices.stream()
.filter(vendorprice -> Vendor.valueOf(ipResourceRequestDto.getVendor()).getValue().equals(vendorprice.substring(0, vendorprice.indexOf("-"))))
.map(vendorprice -> vendorprice.substring(vendorprice.lastIndexOf("-") + 1)).collect(Collectors.joining())).mapToDouble(Double::valueOf).sum();
IpChargeResultDto ipChargeResultDto = accountService.preChargeByMoney(username, Double.valueOf(totalprice));
if (!ipChargeResultDto.isSuccess()) {
throw new ClientRequestException(AccountErrorCode.NOTENOUGHBALANCE);
}
});
//todo 预扣费
RestTemplate restTemplate = new RestTemplate();
HashMap<String, Object> map = new HashMap<>();
map.put("iplist", ipResourceRequestDto.getAddr());
map.put("period", ipResourceRequestDto.getPeriod());
HttpHeaders headers = buildPostHeader();
HttpEntity<Map<String, Object>> entity = new HttpEntity<>(map, headers);
try {
ResponseEntity<String> result = restTemplate.exchange(TESTURL + "/intelligroup/renewip?accountId=browser", HttpMethod.PUT, entity, String.class);
RenewIpResultDto renewIpResultDto = JSON.parseObject(result.getBody(), RenewIpResultDto.class);
if (StringUtils.isNotBlank(renewIpResultDto.getErrorCode()))
throw new Exception(renewIpResultDto.getErrorCode());
if (StringUtils.isNotBlank(renewIpResultDto.getErrorCode())) {
logger.error(renewIpResultDto.getErrorCode());
throw new ClientRequestException(BrowserErrorCode.UNKNOWN);
}
IpOperationResultDto ipOperationResultDto = new IpOperationResultDto();
renewIpResultDto.getIplist().forEach(x -> {
IpResource ipResource = ipResourceRepository.findByAddrAndIsDeleted(x.getIp(), false);
List<String> vendorPrices = priceList.get(ipResource.getRegionCn());
String price = vendorPrices.stream()
.filter(vendorprice -> Vendor.valueOf(ipResourceRequestDto.getVendor()).getValue().equals(vendorprice.substring(0, vendorprice.indexOf("-"))))
.map(vendorprice -> vendorprice.substring(vendorprice.lastIndexOf("-") + 1)).collect(Collectors.joining());
IpChargeRequestDto ipChargeRequestDto = buildIpChargeRequestDto(ipResourceRequestDto, 0);
accountService.chargeByMoney(username, Double.valueOf(price), ipChargeRequestDto);
ipResource.setValidTime(Instant.parse(x.getValidTill()).toEpochMilli());
ipResourceRepository.save(ipResource);
ipOperationResultDto.getSuccessList().add(x.getIp());
failedList.remove(x.getIp());
});
ipOperationResultDto.setFailList(failedList);
return ipOperationResultDto;
} catch (Exception e) {
logger.error("fail to renew ip", e.getMessage());
logger.error(e.getMessage());
throw new Exception(e.getMessage());
}
}
@Override
public IpOperationResultDto deleteIp(String username, List<String> ipAddrs) throws Exception {
public IpOperationResultDto deleteIp(String username, List<String> ipAddrs) {
Account account = accountRepository.findByName(username);
if (account == null)
throw new ClientRequestException(AccountErrorCode.NAMENOTEXIST);
......@@ -231,6 +279,7 @@ public class IpResourceServiceImpl implements IpResourceService {
return;
}
} else if (!ipResource.getOwner().equals(username)) {
ipOperationResultDto.getFailList().add(ipAddr);
return;
}
RestTemplate restTemplate = new RestTemplate();
......@@ -242,7 +291,8 @@ public class IpResourceServiceImpl implements IpResourceService {
DeleteIpResultDto deleteIpResultDto = JSON.parseObject(result.getBody(), DeleteIpResultDto.class);
if (StringUtils.isNotBlank(deleteIpResultDto.getErrorCode()))
throw new Exception(deleteIpResultDto.getErrorCode());
ipResourceRepository.delete(ipResource);
ipResource.setDeleted(true);
ipResourceRepository.save(ipResource);
if (userShop != null){
Shop shop = shopRepository.findById(ipResource.getShopId()).orElse(null);
if (shop != null) {
......@@ -258,7 +308,7 @@ public class IpResourceServiceImpl implements IpResourceService {
} catch (Exception e) {
logger.error("fail to renew ip", e.getMessage());
ipOperationResultDto.getFailList().add(ipAddr);
throw new ClientRequestException(BrowserErrorCode.UNKNOWN);
return;
}
});
return ipOperationResultDto;
......@@ -280,19 +330,19 @@ public class IpResourceServiceImpl implements IpResourceService {
List<IpResource> notUsed = null;
switch (groupType) {
case 1:
ipResources = ipResourceRepository.findByIdIn(ipIds);;
notUsed = ipResourceRepository.findByOwnerAndShopIdIsNull(username);
ipResources = ipResourceRepository.findByIdInAndIsDeleted(ipIds, false);;
notUsed = ipResourceRepository.findByOwnerAndIsDeletedAndShopIdIsNull(username, false);
break;
case 2:
ipResources = ipResourceRepository.findByStatusAndIdIn(2, ipIds);
notUsed = ipResourceRepository.findByOwnerAndStatusAndShopIdIsNull(username, 2);
ipResources = ipResourceRepository.findByStatusAndIdInAndIsDeleted(2, ipIds, false);
notUsed = ipResourceRepository.findByOwnerAndStatusAndIsDeletedAndShopIdIsNull(username, 2, false);
break;
case 3:
ipResources = ipResourceRepository.findByStatusAndIdIn(1, ipIds);
notUsed = ipResourceRepository.findByOwnerAndStatusAndShopIdIsNull(username, 1);
ipResources = ipResourceRepository.findByStatusAndIdInAndIsDeleted(1, ipIds, false);
notUsed = ipResourceRepository.findByOwnerAndStatusAndIsDeletedAndShopIdIsNull(username, 1, false);
break;
case 4:
notUsed = ipResourceRepository.findByOwnerAndShopIdIsNull(username);
notUsed = ipResourceRepository.findByOwnerAndIsDeletedAndShopIdIsNull(username, false);
break;
}
if (notUsed != null)
......@@ -300,7 +350,7 @@ public class IpResourceServiceImpl implements IpResourceService {
List<IpResourceDto> ipResourceDtos = new ArrayList<>();
List<String> allIpIds = ipResources.stream().map(x -> x.getId()).collect(Collectors.toList());
if (ipFilterDto != null && StringUtils.isNotBlank(ipFilterDto.getRegion())) {
Page<IpResource> ipResources1 = ipResourceRepository.findByRegionLikeAndIdIn(ipFilterDto.getRegion(), allIpIds, pageable);
Page<IpResource> ipResources1 = ipResourceRepository.findByRegionLikeAndIdInAndIsDeleted(ipFilterDto.getRegion(), allIpIds, false, pageable);
ipResources1.getContent().forEach(x -> {
ShopDto shopDto;
if (x.getShopId() == null) {
......@@ -316,7 +366,7 @@ public class IpResourceServiceImpl implements IpResourceService {
});
}
else if (ipFilterDto != null && StringUtils.isNotBlank(ipFilterDto.getAddr())) {
Page<IpResource> ipResources1 = ipResourceRepository.findByAddrLikeAndIdIn(ipFilterDto.getAddr(), allIpIds, pageable);
Page<IpResource> ipResources1 = ipResourceRepository.findByAddrLikeAndIdInAndIsDeleted(ipFilterDto.getAddr(), allIpIds, false, pageable);
ipResources1.getContent().forEach(x -> {
ShopDto shopDto;
if (x.getShopId() == null) {
......@@ -332,7 +382,7 @@ public class IpResourceServiceImpl implements IpResourceService {
});
}
else if (ipFilterDto != null && StringUtils.isNotBlank(ipFilterDto.getVendor())) {
Page<IpResource> ipResources1 = ipResourceRepository.findByVendorLikeAndIdIn(ipFilterDto.getVendor(), allIpIds, pageable);
Page<IpResource> ipResources1 = ipResourceRepository.findByVendorLikeAndIdInAndIsDeleted(ipFilterDto.getVendor(), allIpIds, false, pageable);
ipResources1.getContent().forEach(x -> {
ShopDto shopDto;
if (x.getShopId() == null) {
......
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