|
|
@@ -27,6 +27,7 @@ import org.springframework.util.StopWatch;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -109,7 +110,7 @@ public class DevicePermissVerifyService {
|
|
|
boolean hasPermission = false;
|
|
|
String projectOid = deviceInfo.getProjectOid();
|
|
|
|
|
|
- stopWatch.start("设备权限");
|
|
|
+ stopWatch.start("查询绑定的设备权限");
|
|
|
DevicePermiss devicePermiss = devicePermissDao.findTopByUserIdAndDeviceIdAndProjectOidAndDataState(userId, deviceId, projectOid, DataState.Enable);
|
|
|
if (ObjectUtils.isNotEmpty(devicePermiss)) {
|
|
|
hasPermission = true;
|
|
|
@@ -119,9 +120,10 @@ public class DevicePermissVerifyService {
|
|
|
if (!hasPermission) {
|
|
|
|
|
|
stopWatch.start("查询用户项目权限数据");
|
|
|
- UserCacheModel userCacheModel = userPermissDataCacheService.getUserCacheModel(userId, projectOid);
|
|
|
+ Map<String, UserCacheModel> map = userPermissDataCacheService.getUserAndDeviceCacheData(userId, deviceId, projectOid);
|
|
|
stopWatch.stop();
|
|
|
|
|
|
+ UserCacheModel userCacheModel = map.get(userId);
|
|
|
stopWatch.start("查询当前时间段");
|
|
|
// 查找当前时间对应的时段信息
|
|
|
List<PermissTimeSlot> permissTimeSlots = getCurrentTimeSlot(projectOid);
|
|
|
@@ -144,9 +146,7 @@ public class DevicePermissVerifyService {
|
|
|
search.setSex(userCacheModel.getSex());
|
|
|
search.setDataIds(userCacheModel.getDataIds());
|
|
|
|
|
|
- stopWatch.start("设备权限");
|
|
|
- UserCacheModel deviceCacheModel = userPermissDataCacheService.getDeviceCacheModel(deviceId, projectOid);
|
|
|
- stopWatch.stop();
|
|
|
+ UserCacheModel deviceCacheModel = map.get(deviceId);
|
|
|
|
|
|
if (deviceCacheModel != null && deviceCacheModel.isSuccess()) {
|
|
|
search.setDeviceTypes(List.of(deviceCacheModel.getDeviceType()));
|