提交 ac57b053 authored 作者: zhoushaopan's avatar zhoushaopan

fix(装备模块): 打印接口时间日志

打印接口时间日志
上级 d62fae41
...@@ -29,6 +29,7 @@ import com.tykj.dev.device.user.subject.service.UserPublicService; ...@@ -29,6 +29,7 @@ import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.*; import com.tykj.dev.misc.utils.*;
import javafx.scene.paint.Stop;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -42,6 +43,7 @@ import org.springframework.http.ResponseEntity; ...@@ -42,6 +43,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StopWatch;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.persistence.Transient; import javax.persistence.Transient;
...@@ -1310,11 +1312,17 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -1310,11 +1312,17 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
}else { }else {
or = predicateBuilder.build(); or = predicateBuilder.build();
} }
StopWatch stopWatch = new StopWatch("条件查询结果集");
stopWatch.start();
List<DeviceLibrary> deviceLibraries = deviceLibraryDao.findAll(or); List<DeviceLibrary> deviceLibraries = deviceLibraryDao.findAll(or);
deviceLibraries.forEach(DeviceLibrary::setConfigName); deviceLibraries.forEach(DeviceLibrary::setConfigName);
stopWatch.stop();
log.info("条件查询结果集时间为:{}",stopWatch.getTotalTimeSeconds());
//拿到所有的装备id //拿到所有的装备id
List<Integer> deviceIds = deviceLibraries.stream().map(DeviceLibrary::getId).collect(Collectors.toList()); List<Integer> deviceIds = deviceLibraries.stream().map(DeviceLibrary::getId).collect(Collectors.toList());
//3D位置的map //3D位置的map
StopWatch stopWatch1 = new StopWatch("查询和拼接");
stopWatch1.start();
Map<Integer, DeviceLibraryPosition> positionMap = Map<Integer, DeviceLibraryPosition> positionMap =
deviceLibraryPositionService.findByDeviceIds(deviceIds).stream().collect(toMap(DeviceLibraryPosition::getDeviceId, Function.identity())); deviceLibraryPositionService.findByDeviceIds(deviceIds).stream().collect(toMap(DeviceLibraryPosition::getDeviceId, Function.identity()));
//取出key 在3d的装备id //取出key 在3d的装备id
...@@ -1363,6 +1371,8 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService { ...@@ -1363,6 +1371,8 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
}else { }else {
pageAllVo.addAll(allVOS); pageAllVo.addAll(allVOS);
} }
stopWatch1.stop();
log.info("查询和拼接时间:{}",stopWatch1.getTotalTimeMillis()+"ms");
Page<AllVO> allVOPage = PageUtil.getPerPage(queryTheWarehouseVo.getPage(), Page<AllVO> allVOPage = PageUtil.getPerPage(queryTheWarehouseVo.getPage(),
queryTheWarehouseVo.getSize(), pageAllVo, queryTheWarehouseVo.getPageable()); queryTheWarehouseVo.getSize(), pageAllVo, queryTheWarehouseVo.getPageable());
//不分页的数据 //不分页的数据
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论