Commit db62d2f3 authored by xuxin's avatar xuxin

调试 分配店铺的功能

parent 7ae19afb
......@@ -290,7 +290,7 @@ public class ShopServiceImpl implements ShopService {
throw new ClientRequestException(AccountErrorCode.NOPERMISSION);
}
logger.info("assign shops step-1" + account.getPermission());
logger.info("assign shops step-1 " + account.getPermission());
// 2. 校验当前用户是否绑定了对应的 shops,并获取 usershops信息
List<UserShop> userShops = userShopRepository.findByUsernameAndShopIdIn(username, shopIds);
......@@ -298,7 +298,7 @@ public class ShopServiceImpl implements ShopService {
throw new ClientRequestException(BrowserErrorCode.USER_NOT_BIND_SHOP);
}
logger.info("assign shops step-2" + userShops.stream().map(UserShop::getShopId).collect(Collectors.toList()).toArray().toString());
logger.info("assign shops step-2 " + userShops.stream().map(UserShop::getShopId).collect(Collectors.toList()).toArray().toString());
// 3. 查询 目标 账户是否存在,并获取账户信息。注意:目标账户只能是当前用户的子账户
List<Account> accounts = accountRepository.findByNameIn(users);
......@@ -309,7 +309,7 @@ public class ShopServiceImpl implements ShopService {
if (ac.getParent() == null || !ac.getParent().equals(username)) {
throw new ClientRequestException(AccountErrorCode.NOPERMISSION);
}
logger.info("assign shops step-3" + ac.getName());
logger.info("assign shops step-3 " + ac.getName());
}
// 4. 获取 shop 信息 并校验
......@@ -318,7 +318,7 @@ public class ShopServiceImpl implements ShopService {
if (shops == null || shops.size() < 1) {
throw new ClientRequestException(BrowserErrorCode.SHOPNOTEXIST);
}
logger.info("assign shops step-4" + shops.size());
logger.info("assign shops step-4 " + shops.size());
try {
if (shops.size() == 1) {
// 5. 删除除当前用户外的所有 usershop 信息
......@@ -334,7 +334,7 @@ public class ShopServiceImpl implements ShopService {
// 6. 封装 目标账户的 usershop信息并保存
userShop1 = new UserShop(account1.getName(), shops.get(0).getShopId(), "-1");
userShopRepository.save(userShop1);
logger.info("assign shops step-5.2" + userShop1.toString());
logger.info("assign shops step-5.2 " + userShop1.toString());
}
} else {
shops.forEach(
......@@ -343,11 +343,11 @@ public class ShopServiceImpl implements ShopService {
UserShop userShop1 = userShopRepository.findByUsernameAndShopId(account1.getName(), shop.getShopId());
logger.info("assign shops step-5.1 " + (userShop1 == null));
if (userShop1 != null) {
return;
continue;
}
userShop1 = new UserShop(account1.getName(), shop.getShopId(), "-1");
userShopRepository.save(userShop1);
logger.info("assign shops step-5.2" + userShop1.toString());
logger.info("assign shops step-5.2 " + userShop1.toString());
}
}
);
......
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