Commit c3abce67 authored by renjie's avatar renjie

删除IpBug

parent 2a265d3d
......@@ -362,16 +362,18 @@ public class IpResourceServiceImpl implements IpResourceService {
}
UserShop userShop = null;
Shop shop = shopRepository.findById(ipResource.getShopId()).orElse(null);
if (shop != null) {
userShop = userShopRepository.findByUsernameAndShopId(username, shop.getShopId());
if (userShop == null) {
if (ipResource.getShopId() != null) {
Shop shop = shopRepository.findById(ipResource.getShopId()).orElse(null);
if (shop != null) {
userShop = userShopRepository.findByUsernameAndShopId(username, shop.getShopId());
if (userShop == null) {
ipOperationResultDto.getFailList().add(ipAddr);
return;
}
} else if (!ipResource.getOwner().equals(username)) {
ipOperationResultDto.getFailList().add(ipAddr);
return;
}
} else if (!ipResource.getOwner().equals(username)) {
ipOperationResultDto.getFailList().add(ipAddr);
return;
}
try {
ResponseEntity<String> result = restTemplate.exchange(URL + "/intelligroup/ipresources?accountId=browser&ip={ip}", HttpMethod.DELETE, httpEntity, String.class, ipAddr);
......@@ -407,16 +409,18 @@ public class IpResourceServiceImpl implements IpResourceService {
DeleteIpResultDto deleteIpResultDto = JSON.parseObject(result.getBody(), DeleteIpResultDto.class);
}
UserShop userShop = null;
Shop shop = shopRepository.findById(ipResource.getShopId()).orElse(null);
if (shop != null) {
userShop = userShopRepository.findByUsernameAndShopId(username, shop.getShopId());
if (userShop == null) {
if (ipResource.getShopId() != null) {
Shop shop = shopRepository.findById(ipResource.getShopId()).orElse(null);
if (shop != null) {
userShop = userShopRepository.findByUsernameAndShopId(username, shop.getShopId());
if (userShop == null) {
ipOperationResultDto.getFailList().add(ipId);
return;
}
} else if (!ipResource.getOwner().equals(username)) {
ipOperationResultDto.getFailList().add(ipId);
return;
}
} else if (!ipResource.getOwner().equals(username)) {
ipOperationResultDto.getFailList().add(ipId);
return;
}
ipResource.setDeleted(true);
ipResource.setShopId(null);
......
package com.edgec.browserbackend.common.utils;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.util.StringUtils;
import sun.misc.BASE64Decoder;
......@@ -149,17 +150,16 @@ public class Aes {
return StringUtils.isEmpty(encryptStr) ? null : aesDecryptByBytes(base64Decode(encryptStr), decryptKey);
}
private static final BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
/**
* 测试
*/
public static void main(String[] args) throws Exception {
String content = "VHRg3tocHf9i2Q27COKDhw==";
// System.out.println("加密前:" + content);
// System.out.println("加密密钥和解密密钥:" + KEY);
// String encrypt = aesEncrypt(content, KEY);
// System.out.println("加密后:" + encrypt);
String decrypt = aesDecrypt(content, KEY);
System.out.println("解密后:" + decrypt);
String content = "abc123456";
System.out.println("加密前:" + content);
System.out.println("加密密钥和解密密钥:" + KEY);
String encrypt = encoder.encode(content);
System.out.println("加密后:" + encrypt);
}
}
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