Commit a4d43e3e authored by renjie's avatar renjie

日志时间

parent 5e9a7946
...@@ -30,7 +30,7 @@ public class LoginHistoryDto { ...@@ -30,7 +30,7 @@ public class LoginHistoryDto {
if (loginHistory.getLoginPlace() != null) if (loginHistory.getLoginPlace() != null)
this.loginPlace = loginHistory.getLoginPlace(); this.loginPlace = loginHistory.getLoginPlace();
if (loginHistory.getLoginTime() != 0) if (loginHistory.getLoginTime() != 0)
this.loginTime = Instant.ofEpochMilli(loginHistory.getLoginTime()).atZone(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); this.loginTime = Instant.ofEpochMilli(loginHistory.getLoginTime()).atZone(ZoneId.of("Asia/Shanghai")).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
} }
public String getNickname() { public String getNickname() {
......
...@@ -269,21 +269,36 @@ public class ShopServiceImpl implements ShopService { ...@@ -269,21 +269,36 @@ public class ShopServiceImpl implements ShopService {
throw new ClientRequestException(AccountErrorCode.NOPERMISSION); throw new ClientRequestException(AccountErrorCode.NOPERMISSION);
} }
} }
shops.stream().forEach(shop -> { if (shops.size() == 1) {
try { try {
userShopRepository.deleteByShopIdExceptOwner(shop.getShopId(), shop.getOwner()); userShopRepository.deleteByShopIdExceptOwner(shops.get(0).getShopId(), shops.get(0).getOwner());
for (Account account1 : accounts) { for (Account account1 : accounts) {
UserShop userShop1 = userShopRepository.findByUsernameAndShopId(account1.getName(), shop.getShopId()); UserShop userShop1 = userShopRepository.findByUsernameAndShopId(account1.getName(), shops.get(0).getShopId());
if (userShop1 != null) if (userShop1 != null)
return; return;
userShop1 = new UserShop(account1.getName(), shop.getShopId(), "-1"); userShop1 = new UserShop(account1.getName(), shops.get(0).getShopId(), "-1");
userShopRepository.save(userShop1); userShopRepository.save(userShop1);
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("fail to assign", e.getMessage()); logger.error("fail to assign", e.getMessage());
throw new ClientRequestException(BrowserErrorCode.UNKNOWN); throw new ClientRequestException(BrowserErrorCode.UNKNOWN);
} }
}); } else {
shops.stream().forEach(shop -> {
try {
for (Account account1 : accounts) {
UserShop userShop1 = userShopRepository.findByUsernameAndShopId(account1.getName(), shop.getShopId());
if (userShop1 != null)
return;
userShop1 = new UserShop(account1.getName(), shop.getShopId(), "-1");
userShopRepository.save(userShop1);
}
} catch (Exception e) {
logger.error("fail to assign", e.getMessage());
throw new ClientRequestException(BrowserErrorCode.UNKNOWN);
}
});
}
} }
@Override @Override
......
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