Commit 9a6088da authored by jim's avatar jim

ip

parent 97cad9d7
......@@ -106,7 +106,7 @@ public class ShopServiceImpl implements ShopService {
//可以优化
account.setShopCount(account.getShopCount() + 1);
accountRepository.save(account);
}catch (Exception e) {
} catch (Exception e) {
throw new ClientRequestException(BrowserErrorCode.INFORMATIONNOTCOMPELETE);
}
return id;
......@@ -170,7 +170,7 @@ public class ShopServiceImpl implements ShopService {
account.setShopCount(account.getShopCount() + 1);
accountRepository.save(account);
ids.add(id);
}catch (Exception e) {
} catch (Exception e) {
logger.error("fail to add shops", e.getMessage());
throw new ClientRequestException(BrowserErrorCode.INFORMATIONNOTCOMPELETE);
}
......@@ -197,7 +197,7 @@ public class ShopServiceImpl implements ShopService {
try {
shop_old = shop_old.of(shopResultDto);
shopRepository.save(shop_old);
}catch (Exception e) {
} catch (Exception e) {
logger.error("fail to update", e.getMessage());
throw new ClientRequestException(BrowserErrorCode.INFORMATIONNOTCOMPELETE);
}
......@@ -277,8 +277,7 @@ public class ShopServiceImpl implements ShopService {
if (accounts == null || accounts.size() != users.size())
throw new ClientRequestException(AccountErrorCode.NAMENOTEXIST);
for (Account ac : accounts) {
if (ac.getParent() == null || !ac.getParent().equals(username))
{
if (ac.getParent() == null || !ac.getParent().equals(username)) {
throw new ClientRequestException(AccountErrorCode.NOPERMISSION);
}
}
......@@ -336,8 +335,7 @@ public class ShopServiceImpl implements ShopService {
if (ipResource.isSpecialLine()) {
SpecialLine specialLine = specialLineRepository.findAll().get(0);
shopResultDto = ShopResultDto.of(shop, group, new IpResourceDto(ipResource, null, false, specialLine));
}
else
} else
shopResultDto = ShopResultDto.of(shop, group, new IpResourceDto(ipResource, null, false));
return shopResultDto;
}
......@@ -369,11 +367,10 @@ public class ShopServiceImpl implements ShopService {
.map(x -> x.getShopId()).collect(Collectors.toList());
shopIds = ipResourceRepository.findShopIdInList(allIds, false)
.stream().flatMap((x -> x.getShopIds().stream())).collect(Collectors.toList());
}
else {
} else {
List<String> allIds = userShopRepository.findByUsername(username).stream()
.map(x -> x.getShopId()).collect(Collectors.toList());
for (String id:allIds) {
for (String id : allIds) {
IpResource ipResource = ipResourceRepository.findFirstByShopIdsIsAndIsDeleted(id, false);
if (ipResource == null) {
shopIds.add(id);
......@@ -389,11 +386,10 @@ public class ShopServiceImpl implements ShopService {
map(x -> x.getShopId()).collect(Collectors.toList());
shopIds = ipResourceRepository.findShopIdInList(allIds, false)
.stream().flatMap((x -> x.getShopIds().stream())).collect(Collectors.toList());
}
else {
} else {
List<String> allIds = userShopRepository.findByUsernameAndGroupId(username, groupId).stream()
.map(x -> x.getShopId()).collect(Collectors.toList());
for (String id:allIds) {
for (String id : allIds) {
IpResource ipResource = ipResourceRepository.findFirstByShopIdsIsAndIsDeleted(id, false);
if (ipResource == null)
shopIds.add(id);
......@@ -405,8 +401,7 @@ public class ShopServiceImpl implements ShopService {
List<String> filter = ipResourceRepository.findShopIdInListAndRegionLike(shopIds, false, shopFilterDto.getIpRegion())
.stream().flatMap((x -> x.getShopIds().stream())).collect(Collectors.toList());
shops = shopRepository.findByShopIdInOrderByCreateTimeDesc(filter, pageable);
}
else if (shopFilterDto != null && StringUtils.isNotBlank(shopFilterDto.getShopAccount()))
} else if (shopFilterDto != null && StringUtils.isNotBlank(shopFilterDto.getShopAccount()))
shops = shopRepository.findByShopIdInAndShopAccountLikeOrderByCreateTimeDesc(shopIds, shopFilterDto.getShopAccount(), pageable);
else if (shopFilterDto != null && StringUtils.isNotBlank(shopFilterDto.getShopName()))
shops = shopRepository.findByShopIdInAndShopNameLikeOrderByCreateTimeDesc(shopIds, shopFilterDto.getShopName(), pageable);
......@@ -464,8 +459,7 @@ public class ShopServiceImpl implements ShopService {
if (ipResource.isSpecialLine()) {
SpecialLine specialLine = specialLineRepository.findAll().get(0);
shopResultDto = ShopResultDto.of(x, group1, new IpResourceDto(ipResource, null, false, specialLine));
}
else
} else
shopResultDto = ShopResultDto.of(x, group1, new IpResourceDto(ipResource, null, false));
shopResultDtos.add(shopResultDto);
});
......@@ -489,7 +483,7 @@ public class ShopServiceImpl implements ShopService {
List<String> allShopIds = userShopRepository.findByUsername(username).stream().map(x -> x.getShopId()).collect(Collectors.toList());
List<String> unbind = new ArrayList<>();
if (allShopIds != null && allShopIds.size() > 0) {
for (String id:allShopIds) {
for (String id : allShopIds) {
IpResource ipResource = ipResourceRepository.findFirstByShopIdsIsAndIsDeleted(id, false);
if (ipResource == null) {
unbind.add(id);
......@@ -529,7 +523,7 @@ public class ShopServiceImpl implements ShopService {
if (shopIds != null && shopIds.size() > 0) {
String maxShopId = null;
int max = 0;
for (String shopId:shopIds) {
for (String shopId : shopIds) {
int userCount = userShopRepository.countByShopId(shopId);
if (userCount > max) {
max = userCount;
......
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