Commit 6d737e4a authored by renjie's avatar renjie

Merge branch 'dev-zrj' into 'staging'

店铺bug

See merge request !83
parents d44e96c5 e9069583
...@@ -223,7 +223,7 @@ public class ShopServiceImpl implements ShopService { ...@@ -223,7 +223,7 @@ public class ShopServiceImpl implements ShopService {
Shop shop = shopRepository.findById(shopId).orElse(null); Shop shop = shopRepository.findById(shopId).orElse(null);
if (shop == null) if (shop == null)
throw new ClientRequestException(BrowserErrorCode.SHOPNOTEXIST); throw new ClientRequestException(BrowserErrorCode.SHOPNOTEXIST);
IpResource ipResource = ipResourceRepository.findByShopIdAndIsDeleted(shop.getShopId(), false); IpResource ipResource = ipResourceRepository.findFirstByShopIdAndIsDeleted(shop.getShopId(), false);
if (ipResource != null) { if (ipResource != null) {
ipResource.setShopName(null); ipResource.setShopName(null);
ipResource.setShopId(null); ipResource.setShopId(null);
...@@ -330,7 +330,7 @@ public class ShopServiceImpl implements ShopService { ...@@ -330,7 +330,7 @@ public class ShopServiceImpl implements ShopService {
if (shop == null) { if (shop == null) {
throw new ClientRequestException(BrowserErrorCode.SHOPNOTEXIST); throw new ClientRequestException(BrowserErrorCode.SHOPNOTEXIST);
} }
IpResource ipResource = ipResourceRepository.findByShopIdAndIsDeleted(shopId, false); IpResource ipResource = ipResourceRepository.findFirstByShopIdAndIsDeleted(shopId, false);
if (ipResource == null) if (ipResource == null)
throw new ClientRequestException(BrowserErrorCode.IPNOTEXIST); throw new ClientRequestException(BrowserErrorCode.IPNOTEXIST);
String group = userShopRepository.findByUsernameAndShopId(username, shop.getShopId()).getGroupId(); String group = userShopRepository.findByUsernameAndShopId(username, shop.getShopId()).getGroupId();
...@@ -376,7 +376,7 @@ public class ShopServiceImpl implements ShopService { ...@@ -376,7 +376,7 @@ public class ShopServiceImpl implements ShopService {
List<String> allIds = userShopRepository.findByUsername(username).stream() List<String> allIds = userShopRepository.findByUsername(username).stream()
.map(x -> x.getShopId()).collect(Collectors.toList()); .map(x -> x.getShopId()).collect(Collectors.toList());
for (String id:allIds) { for (String id:allIds) {
IpResource ipResource = ipResourceRepository.findByShopIdAndIsDeleted(id, false); IpResource ipResource = ipResourceRepository.findFirstByShopIdAndIsDeleted(id, false);
if (ipResource == null) if (ipResource == null)
shopIds.add(id); shopIds.add(id);
} }
...@@ -395,7 +395,7 @@ public class ShopServiceImpl implements ShopService { ...@@ -395,7 +395,7 @@ public class ShopServiceImpl implements ShopService {
List<String> allIds = userShopRepository.findByUsernameAndGroupId(username, groupId).stream() List<String> allIds = userShopRepository.findByUsernameAndGroupId(username, groupId).stream()
.map(x -> x.getShopId()).collect(Collectors.toList()); .map(x -> x.getShopId()).collect(Collectors.toList());
for (String id:allIds) { for (String id:allIds) {
IpResource ipResource = ipResourceRepository.findByShopIdAndIsDeleted(id, false); IpResource ipResource = ipResourceRepository.findFirstByShopIdAndIsDeleted(id, false);
if (ipResource == null) if (ipResource == null)
shopIds.add(id); shopIds.add(id);
} }
...@@ -419,7 +419,7 @@ public class ShopServiceImpl implements ShopService { ...@@ -419,7 +419,7 @@ public class ShopServiceImpl implements ShopService {
logger.error("shops.size" + shops.getNumberOfElements()); logger.error("shops.size" + shops.getNumberOfElements());
logger.error("shops.content.size " + shops.getContent().size()); logger.error("shops.content.size " + shops.getContent().size());
shops.getContent().stream().forEach(x -> { shops.getContent().stream().forEach(x -> {
IpResource ipResource = ipResourceRepository.findByShopIdAndIsDeleted(x.getShopId(), false); IpResource ipResource = ipResourceRepository.findFirstByShopIdAndIsDeleted(x.getShopId(), false);
if (ipResource == null) if (ipResource == null)
ipResource = new IpResource(); ipResource = new IpResource();
String group1 = userShopRepository.findByUsernameAndShopId(username, x.getShopId()).getGroupId(); String group1 = userShopRepository.findByUsernameAndShopId(username, x.getShopId()).getGroupId();
...@@ -453,7 +453,7 @@ public class ShopServiceImpl implements ShopService { ...@@ -453,7 +453,7 @@ public class ShopServiceImpl implements ShopService {
List<String> unbind = new ArrayList<>(); List<String> unbind = new ArrayList<>();
if (allShopIds != null && allShopIds.size() > 0) { if (allShopIds != null && allShopIds.size() > 0) {
for (String id:allShopIds) { for (String id:allShopIds) {
IpResource ipResource = ipResourceRepository.findByShopIdAndIsDeleted(id, false); IpResource ipResource = ipResourceRepository.findFirstByShopIdAndIsDeleted(id, false);
if (ipResource == null) { if (ipResource == null) {
unbind.add(id); unbind.add(id);
} }
......
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