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,9 +269,23 @@ public class ShopServiceImpl implements ShopService { ...@@ -269,9 +269,23 @@ public class ShopServiceImpl implements ShopService {
throw new ClientRequestException(AccountErrorCode.NOPERMISSION); throw new ClientRequestException(AccountErrorCode.NOPERMISSION);
} }
} }
if (shops.size() == 1) {
try {
userShopRepository.deleteByShopIdExceptOwner(shops.get(0).getShopId(), shops.get(0).getOwner());
for (Account account1 : accounts) {
UserShop userShop1 = userShopRepository.findByUsernameAndShopId(account1.getName(), shops.get(0).getShopId());
if (userShop1 != null)
return;
userShop1 = new UserShop(account1.getName(), shops.get(0).getShopId(), "-1");
userShopRepository.save(userShop1);
}
} catch (Exception e) {
logger.error("fail to assign", e.getMessage());
throw new ClientRequestException(BrowserErrorCode.UNKNOWN);
}
} else {
shops.stream().forEach(shop -> { shops.stream().forEach(shop -> {
try { try {
userShopRepository.deleteByShopIdExceptOwner(shop.getShopId(), shop.getOwner());
for (Account account1 : accounts) { for (Account account1 : accounts) {
UserShop userShop1 = userShopRepository.findByUsernameAndShopId(account1.getName(), shop.getShopId()); UserShop userShop1 = userShopRepository.findByUsernameAndShopId(account1.getName(), shop.getShopId());
if (userShop1 != null) if (userShop1 != null)
...@@ -285,6 +299,7 @@ public class ShopServiceImpl implements ShopService { ...@@ -285,6 +299,7 @@ public class ShopServiceImpl implements ShopService {
} }
}); });
} }
}
@Override @Override
public ShopPageResultDto getShopList(String username, String groupId, int page, int amount, ShopFilterDto shopFilterDto) { public ShopPageResultDto getShopList(String username, String groupId, int page, int amount, ShopFilterDto shopFilterDto) {
......
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