Commit b06977e9 authored by Administrator's avatar Administrator

Merge branch 'fix-hotbugs' into 'master'

页面打开慢加日志

See merge request !187
parents ab375c07 7b0c5ab5
...@@ -159,6 +159,7 @@ public class ShopController { ...@@ -159,6 +159,7 @@ public class ShopController {
@RequestMapping(value = "/list", method = RequestMethod.POST) @RequestMapping(value = "/list", method = RequestMethod.POST)
public ResultDto getShopList(Principal principal, @RequestBody ShopRequestDto shopRequestDto) { public ResultDto getShopList(Principal principal, @RequestBody ShopRequestDto shopRequestDto) {
logger.info("shop list params {}", JSONObject.toJSONString(shopRequestDto)); logger.info("shop list params {}", JSONObject.toJSONString(shopRequestDto));
long start = System.currentTimeMillis();
ResultDto resultDto = new ResultDto(); ResultDto resultDto = new ResultDto();
try { try {
ShopPageResultDto shopDtos = shopService.getShopList(principal.getName(), shopRequestDto.getGroup(), ShopPageResultDto shopDtos = shopService.getShopList(principal.getName(), shopRequestDto.getGroup(),
...@@ -168,6 +169,7 @@ public class ShopController { ...@@ -168,6 +169,7 @@ public class ShopController {
} catch (ClientRequestException e) { } catch (ClientRequestException e) {
dealClientRequestException(resultDto, e); dealClientRequestException(resultDto, e);
} }
logger.info("getshoplist totalTime:{}, {}", principal.getName(), System.currentTimeMillis() - start);
return resultDto; return resultDto;
} }
......
...@@ -407,7 +407,7 @@ public class ShopServiceImpl implements ShopService { ...@@ -407,7 +407,7 @@ public class ShopServiceImpl implements ShopService {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
// 1. 校验当前登录用户的账户是否存在 // 1. 校验当前登录用户的账户是否存在
Account account = accountRepository.findByName(username).orElseThrow(() -> new ClientRequestException(AccountErrorCode.NAMENOTEXIST)); Account account = accountRepository.findByName(username).orElseThrow(() -> new ClientRequestException(AccountErrorCode.NAMENOTEXIST));
logger.info("getshoplist step-1:{}", System.currentTimeMillis() - start); logger.info("getshoplist step-1:{},{}", username, System.currentTimeMillis() - start);
// 2. 如有有分组校验当前查询的分组信息是否正确 // 2. 如有有分组校验当前查询的分组信息是否正确
start = System.currentTimeMillis(); start = System.currentTimeMillis();
...@@ -418,7 +418,7 @@ public class ShopServiceImpl implements ShopService { ...@@ -418,7 +418,7 @@ public class ShopServiceImpl implements ShopService {
throw new ClientRequestException(AccountErrorCode.NOPERMISSION); throw new ClientRequestException(AccountErrorCode.NOPERMISSION);
} }
} }
logger.info("getshoplist step-2:{}", System.currentTimeMillis() - start); logger.info("getshoplist step-2:{},{}", username, System.currentTimeMillis() - start);
// 3. 根据 groupId 与 username 来查询 shopIds (如果当前用户是父账户,则查询结果包含子账户的shopId) // 3. 根据 groupId 与 username 来查询 shopIds (如果当前用户是父账户,则查询结果包含子账户的shopId)
start = System.currentTimeMillis(); start = System.currentTimeMillis();
...@@ -436,7 +436,7 @@ public class ShopServiceImpl implements ShopService { ...@@ -436,7 +436,7 @@ public class ShopServiceImpl implements ShopService {
if ("penghai".equals(tag)) { if ("penghai".equals(tag)) {
allIds = userShopRepository.findByUsernameAndGroupId(username, groupId).stream().map(UserShop::getShopId).collect(Collectors.toList()); allIds = userShopRepository.findByUsernameAndGroupId(username, groupId).stream().map(UserShop::getShopId).collect(Collectors.toList());
} }
logger.info("getshoplist step-3:{}", System.currentTimeMillis() - start); logger.info("getshoplist step-3:{},{}", username, System.currentTimeMillis() - start);
// 4. 根据传入的过滤条件得到 shopIds // 4. 根据传入的过滤条件得到 shopIds
start = System.currentTimeMillis(); start = System.currentTimeMillis();
...@@ -467,14 +467,14 @@ public class ShopServiceImpl implements ShopService { ...@@ -467,14 +467,14 @@ public class ShopServiceImpl implements ShopService {
allIds.removeAll(shopIds2); allIds.removeAll(shopIds2);
shopIds = allIds; shopIds = allIds;
} }
logger.info("getshoplist step-4:{}", System.currentTimeMillis() - start); logger.info("getshoplist step-4:{},{}", username, System.currentTimeMillis() - start);
amount = amount > 100 ? 100 : amount; amount = amount > 100 ? 100 : amount;
Pageable pageable = PageRequest.of(pageNum, amount); Pageable pageable = PageRequest.of(pageNum, amount);
// 5. 根据过滤后的商铺ids 与 其他过滤条件 得到商铺信息并分页 // 5. 根据过滤后的商铺ids 与 其他过滤条件 得到商铺信息并分页
start = System.currentTimeMillis(); start = System.currentTimeMillis();
Page<Shop> shops = getShopsByFilter(shopFilterDto, shopIds, pageable); Page<Shop> shops = getShopsByFilter(shopFilterDto, shopIds, pageable);
logger.info("getshoplist step-5:{}", System.currentTimeMillis() - start); logger.info("getshoplist step-5:{},{}", username, System.currentTimeMillis() - start);
// 6. 封装 shopResultDtos 信息并返回 // 6. 封装 shopResultDtos 信息并返回
start = System.currentTimeMillis(); start = System.currentTimeMillis();
...@@ -535,7 +535,7 @@ public class ShopServiceImpl implements ShopService { ...@@ -535,7 +535,7 @@ public class ShopServiceImpl implements ShopService {
ShopResultDto shopResultDto = getShopResultDto(username, x, ipResource); ShopResultDto shopResultDto = getShopResultDto(username, x, ipResource);
shopResultDtos.add(shopResultDto); shopResultDtos.add(shopResultDto);
logger.info("getshoplist step-6.x:{}", System.currentTimeMillis() - start1); logger.info("getshoplist step-6.x:{},{}", username, System.currentTimeMillis() - start1);
} }
); );
...@@ -544,7 +544,7 @@ public class ShopServiceImpl implements ShopService { ...@@ -544,7 +544,7 @@ public class ShopServiceImpl implements ShopService {
PageInfo pageInfo = new PageInfo(shopDtoPage.getPageable().getPageNumber(), shopDtoPage.getTotalPages(), shopIds.size()); PageInfo pageInfo = new PageInfo(shopDtoPage.getPageable().getPageNumber(), shopDtoPage.getTotalPages(), shopIds.size());
shopPageResultDto.setShopPage(pageInfo); shopPageResultDto.setShopPage(pageInfo);
} }
logger.info("getshoplist step-6:{}", System.currentTimeMillis() - start); logger.info("getshoplist step-6:{},{}", username, System.currentTimeMillis() - start);
return shopPageResultDto; return shopPageResultDto;
} }
......
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