|
|
@ -376,25 +376,16 @@ public class CommonServiceImpl implements CommonService { |
|
|
* @return SimpleDataResponse containing the queried asset information or error response |
|
|
* @return SimpleDataResponse containing the queried asset information or error response |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public SimpleDataResponse queryAssetInfo(String apikey, MonitoringAssetSearchParams pageSearchParam) { |
|
|
public SimpleDataResponse queryAssetInfo(String authorization, MonitoringAssetSearchParams pageSearchParam) { |
|
|
try { |
|
|
try { |
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
|
|
|
paramMap.put("apikey", apikey); |
|
|
|
|
|
ApikeyInfo2 apikeyInfo = commonOpt.getAuroraInfoByApikey(paramMap); |
|
|
|
|
|
|
|
|
|
|
|
if (null == apikeyInfo) { |
|
|
|
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "Apikey is invalid"); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isBlank(pageSearchParam.getSymbol()) || |
|
|
if (StringUtils.isBlank(pageSearchParam.getSymbol()) || |
|
|
(StringUtils.isBlank(pageSearchParam.getBuildingName()) && StringUtils.isBlank(pageSearchParam.getUdfBuildingId()))) { |
|
|
(StringUtils.isBlank(pageSearchParam.getBuildingName()) && StringUtils.isBlank(pageSearchParam.getUdfBuildingId()))) { |
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "symbol or buildingName/udfBuildingId is required"); |
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "symbol or buildingName/udfBuildingId is required"); |
|
|
} |
|
|
} |
|
|
|
|
|
long companyId = ApiContext.getCompanyId(); |
|
|
ApikeyInfo2 companyInfo = basicCompanyMapperExt.getAuroraInfoByApikey(paramMap); |
|
|
|
|
|
long companyId = companyInfo.getId(); |
|
|
|
|
|
|
|
|
|
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ apikeyInfo.getId()); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ ApiContext.getTopCompanyId()); |
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(pageSearchParam.getCompanyIds())) { |
|
|
if (StringUtils.isBlank(pageSearchParam.getCompanyIds())) { |
|
|
pageSearchParam.setCompanyIdList(Arrays.asList(companyId)); |
|
|
pageSearchParam.setCompanyIdList(Arrays.asList(companyId)); |
|
|
@ -817,22 +808,13 @@ public class CommonServiceImpl implements CommonService { |
|
|
* or failure response on error |
|
|
* or failure response on error |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public SimpleDataResponse queryAssetInfoByClass(String apikey, |
|
|
public SimpleDataResponse queryAssetInfoByClass(String authorization, |
|
|
ApiAssetSearchByClassParams apiAssetSearchByClassParams) { |
|
|
ApiAssetSearchByClassParams apiAssetSearchByClassParams) { |
|
|
try { |
|
|
try { |
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
long companyId = ApiContext.getCompanyId(); |
|
|
paramMap.put("apikey", apikey); |
|
|
|
|
|
ApikeyInfo2 apikeyInfo = commonOpt.getAuroraInfoByApikey(paramMap); |
|
|
|
|
|
|
|
|
|
|
|
if (null == apikeyInfo) { |
|
|
|
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "Apikey is invalid"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ApikeyInfo2 companyInfo = basicCompanyMapperExt.getAuroraInfoByApikey(paramMap); |
|
|
|
|
|
long companyId = companyInfo.getId(); |
|
|
|
|
|
|
|
|
|
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ apikeyInfo.getId()); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ ApiContext.getTopCompanyId()); |
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(apiAssetSearchByClassParams.getCompanyIds())) { |
|
|
if (StringUtils.isBlank(apiAssetSearchByClassParams.getCompanyIds())) { |
|
|
apiAssetSearchByClassParams.setCompanyIdList(Arrays.asList(companyId)); |
|
|
apiAssetSearchByClassParams.setCompanyIdList(Arrays.asList(companyId)); |
|
|
@ -865,7 +847,7 @@ public class CommonServiceImpl implements CommonService { |
|
|
* or failure response on error |
|
|
* or failure response on error |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public SimpleDataResponse queryAlarmDevice(Long companyId, String apikey, ApiAlarmDeviceSearchParams apiAlarmDeviceSearchParams) { |
|
|
public SimpleDataResponse queryAlarmDevice(Long companyId, String authorization, ApiAlarmDeviceSearchParams apiAlarmDeviceSearchParams) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String hashKey = "lambda_device_alarm"; |
|
|
String hashKey = "lambda_device_alarm"; |
|
|
@ -874,13 +856,10 @@ public class CommonServiceImpl implements CommonService { |
|
|
List<ApiAlarmDeviceInfoVO> deviceInfoVOs = new ArrayList<>(); |
|
|
List<ApiAlarmDeviceInfoVO> deviceInfoVOs = new ArrayList<>(); |
|
|
try { |
|
|
try { |
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
if (null != companyId) { |
|
|
if (null == companyId) { //针对api接口
|
|
|
paramMap.put("companyId", companyId); |
|
|
companyId = ApiContext.getCompanyId(); |
|
|
} else { |
|
|
|
|
|
paramMap.put("apikey", apikey); |
|
|
|
|
|
ApikeyInfo2 selfInfo = basicCompanyMapperExt.getAuroraInfoByApikey(paramMap); |
|
|
|
|
|
companyId = selfInfo.getId(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
paramMap.put("companyId", companyId); |
|
|
|
|
|
|
|
|
Long topCompanyId = dataSourceInterceptor.getTopCompanyId(companyId+""); |
|
|
Long topCompanyId = dataSourceInterceptor.getTopCompanyId(companyId+""); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX +topCompanyId); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX +topCompanyId); |
|
|
@ -1059,21 +1038,12 @@ public class CommonServiceImpl implements CommonService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public SimpleDataResponse queryClass(String apikey, ApiAssetClassSearchParams apiAssetClassSearchParams) { |
|
|
public SimpleDataResponse queryClass(String authorization, ApiAssetClassSearchParams apiAssetClassSearchParams) { |
|
|
try { |
|
|
try { |
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
long companyId = ApiContext.getCompanyId(); |
|
|
paramMap.put("apikey", apikey); |
|
|
|
|
|
ApikeyInfo2 apikeyInfo = commonOpt.getAuroraInfoByApikey(paramMap); |
|
|
|
|
|
|
|
|
|
|
|
if (null == apikeyInfo) { |
|
|
|
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "Apikey is invalid"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ApikeyInfo2 companyInfo = basicCompanyMapperExt.getAuroraInfoByApikey(paramMap); |
|
|
|
|
|
long companyId = companyInfo.getId(); |
|
|
|
|
|
|
|
|
|
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ apikeyInfo.getId()); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ ApiContext.getTopCompanyId()); |
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(apiAssetClassSearchParams.getCompanyIds())) { |
|
|
if (StringUtils.isBlank(apiAssetClassSearchParams.getCompanyIds())) { |
|
|
apiAssetClassSearchParams.setCompanyIdList(Arrays.asList(companyId)); |
|
|
apiAssetClassSearchParams.setCompanyIdList(Arrays.asList(companyId)); |
|
|
@ -1133,16 +1103,8 @@ public class CommonServiceImpl implements CommonService { |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public SimpleDataResponse problemReportsSummaries(String apikey, ProblemReportsSummariesSearchParams params) { |
|
|
public SimpleDataResponse problemReportsSummaries(String authorization, ProblemReportsSummariesSearchParams params) { |
|
|
try { |
|
|
try { |
|
|
//apikey验证
|
|
|
|
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
|
|
|
paramMap.put("apikey", apikey); |
|
|
|
|
|
ApikeyInfo2 apikeyInfo = commonOpt.getAuroraInfoByApikey(paramMap); |
|
|
|
|
|
|
|
|
|
|
|
if (null == apikeyInfo) { |
|
|
|
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "Apikey is invalid"); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isBlank(params.getBuildingName()) && StringUtils.isBlank(params.getUdfBuildingId())) { |
|
|
if (StringUtils.isBlank(params.getBuildingName()) && StringUtils.isBlank(params.getUdfBuildingId())) { |
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "buildingName or udfBuildingId is required"); |
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "buildingName or udfBuildingId is required"); |
|
|
} |
|
|
} |
|
|
@ -1151,7 +1113,7 @@ public class CommonServiceImpl implements CommonService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ apikeyInfo.getId()); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ ApiContext.getTopCompanyId()); |
|
|
|
|
|
|
|
|
//资产关联的设备的targetId获取
|
|
|
//资产关联的设备的targetId获取
|
|
|
List<TargetIdOfAssetVO> targetIdOfAssetList = basicMonitoringAssetMapperExt.getTargetIdListByAssetName(params); |
|
|
List<TargetIdOfAssetVO> targetIdOfAssetList = basicMonitoringAssetMapperExt.getTargetIdListByAssetName(params); |
|
|
@ -1201,7 +1163,7 @@ public class CommonServiceImpl implements CommonService { |
|
|
return SimpleDataResponse.success(finalResponseList); |
|
|
return SimpleDataResponse.success(finalResponseList); |
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
logger.error("queryClass error", e); |
|
|
logger.error("problemReportsSummaries error", e); |
|
|
return SimpleDataResponse.fail(ResponseCode.SERVER_ERROR, ResponseCode.SERVER_ERROR_MSG); |
|
|
return SimpleDataResponse.fail(ResponseCode.SERVER_ERROR, ResponseCode.SERVER_ERROR_MSG); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -1387,7 +1349,7 @@ public class CommonServiceImpl implements CommonService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public SimpleDataResponse queryDeviceInfo(String apikey, ApiRiliDeviceSearchParams allDeviceSearchParams) { |
|
|
public SimpleDataResponse queryDeviceInfo(String authorization, ApiRiliDeviceSearchParams allDeviceSearchParams) { |
|
|
// Split response by [Rili persona] and [dpf]
|
|
|
// Split response by [Rili persona] and [dpf]
|
|
|
List<ApiRiliDeviceInfoVO> finalResponseVOs = new ArrayList<>(); |
|
|
List<ApiRiliDeviceInfoVO> finalResponseVOs = new ArrayList<>(); |
|
|
List<ApiRiliDeviceInfoVO> riliPersonaDeviceInfoVOs = new ArrayList<>(); |
|
|
List<ApiRiliDeviceInfoVO> riliPersonaDeviceInfoVOs = new ArrayList<>(); |
|
|
@ -1399,21 +1361,8 @@ public class CommonServiceImpl implements CommonService { |
|
|
List<String> riliPersonaDeviceSearchParams = new ArrayList<>(); |
|
|
List<String> riliPersonaDeviceSearchParams = new ArrayList<>(); |
|
|
List<String> dpfDeviceSearchParams = new ArrayList<>(); |
|
|
List<String> dpfDeviceSearchParams = new ArrayList<>(); |
|
|
|
|
|
|
|
|
// Select DB by apikey
|
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
Map<String, Object> apikeyParamMap = new HashMap<>(); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ ApiContext.getTopCompanyId()); |
|
|
apikeyParamMap.put("apikey", apikey); |
|
|
|
|
|
ApikeyInfo2 apikeyInfo = commonOpt.getAuroraInfoByApikey(apikeyParamMap); |
|
|
|
|
|
|
|
|
|
|
|
if (null == apikeyInfo) { |
|
|
|
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "Apikey is invalid", new ArrayList<>()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> companySearchMap = new HashMap<>(); |
|
|
|
|
|
companySearchMap.put("apikey", apikey); |
|
|
|
|
|
ApikeyInfo2 selfCompanyInfo = basicCompanyMapperExt.getAuroraInfoByApikey(companySearchMap); |
|
|
|
|
|
|
|
|
|
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
|
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ apikeyInfo.getId()); |
|
|
|
|
|
|
|
|
|
|
|
// Split deviceIds by [Rili persona] and [dpf]
|
|
|
// Split deviceIds by [Rili persona] and [dpf]
|
|
|
List<RiliPersonnasLatest> riliPersonaList = getRiliPersonaList(); |
|
|
List<RiliPersonnasLatest> riliPersonaList = getRiliPersonaList(); |
|
|
@ -1451,7 +1400,7 @@ public class CommonServiceImpl implements CommonService { |
|
|
if (deviceIdList.size() > 0) { |
|
|
if (deviceIdList.size() > 0) { |
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
paramMap.put("deviceIdList", deviceIdList); |
|
|
paramMap.put("deviceIdList", deviceIdList); |
|
|
paramMap.put("companyId", selfCompanyInfo.getId()); |
|
|
paramMap.put("companyId", ApiContext.getCompanyId()); |
|
|
dpfDeviceInfoVOs = deviceInfoMapperExt.getRiliDeviceInfo(paramMap); |
|
|
dpfDeviceInfoVOs = deviceInfoMapperExt.getRiliDeviceInfo(paramMap); |
|
|
|
|
|
|
|
|
// Retrieve the set of DeviceId from DeviceInfoVOs
|
|
|
// Retrieve the set of DeviceId from DeviceInfoVOs
|
|
|
@ -1721,30 +1670,19 @@ public class CommonServiceImpl implements CommonService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public SimpleDataResponse querySpaceInfo(String apikey, ApiSpaceSearchParams searchParams) { |
|
|
public SimpleDataResponse querySpaceInfo(String authorization, ApiSpaceSearchParams searchParams) { |
|
|
if (StringUtils.isBlank(searchParams.getUdfSpaceId()) || StringUtils.isBlank(searchParams.getUdfBuildingId())) { |
|
|
if (StringUtils.isBlank(searchParams.getUdfSpaceId()) || StringUtils.isBlank(searchParams.getUdfBuildingId())) { |
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "udfSpaceId or udfBuildingId is required"); |
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "udfSpaceId or udfBuildingId is required"); |
|
|
} |
|
|
} |
|
|
return getSpaceInfo(apikey, searchParams); |
|
|
return getSpaceInfo(authorization, searchParams); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private SimpleDataResponse getSpaceInfo(String apikey, ApiSpaceSearchParams searchParams) { |
|
|
private SimpleDataResponse getSpaceInfo(String authorization, ApiSpaceSearchParams searchParams) { |
|
|
try { |
|
|
try { |
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
|
|
|
paramMap.put("apikey", apikey); |
|
|
|
|
|
ApikeyInfo2 apikeyInfo = commonOpt.getAuroraInfoByApikey(paramMap); |
|
|
|
|
|
|
|
|
|
|
|
if (null == apikeyInfo) { |
|
|
|
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "Apikey is invalid"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ApikeyInfo2 companyInfo = basicCompanyMapperExt.getAuroraInfoByApikey(paramMap); |
|
|
|
|
|
long companyId = companyInfo.getId(); |
|
|
|
|
|
|
|
|
|
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ apikeyInfo.getId()); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ ApiContext.getTopCompanyId()); |
|
|
|
|
|
|
|
|
searchParams.setCompanyIdList(Arrays.asList(companyId)); |
|
|
searchParams.setCompanyIdList(Arrays.asList(ApiContext.getCompanyId())); |
|
|
|
|
|
|
|
|
List<ApiSpaceWithAssetVO> resultList = basicSpaceMapperExt.getApiQuerySpaceInfo(searchParams); |
|
|
List<ApiSpaceWithAssetVO> resultList = basicSpaceMapperExt.getApiQuerySpaceInfo(searchParams); |
|
|
if (CollectionUtils.isNotEmpty(resultList)) { |
|
|
if (CollectionUtils.isNotEmpty(resultList)) { |
|
|
@ -1780,31 +1718,23 @@ public class CommonServiceImpl implements CommonService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public SimpleDataResponse querySpaceInfoList(String apikey, ApiSpaceSearchParams searchParams) { |
|
|
public SimpleDataResponse querySpaceInfoList(String authorization, ApiSpaceSearchParams searchParams) { |
|
|
if (StringUtils.isBlank(searchParams.getUdfFloorId()) || StringUtils.isBlank(searchParams.getUdfBuildingId())) { |
|
|
if (StringUtils.isBlank(searchParams.getUdfFloorId()) || StringUtils.isBlank(searchParams.getUdfBuildingId())) { |
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "udfFloorId or udfBuildingId is required"); |
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "udfFloorId or udfBuildingId is required"); |
|
|
} |
|
|
} |
|
|
return getSpaceInfo(apikey, searchParams); |
|
|
return getSpaceInfo(authorization, searchParams); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public SimpleDataResponse getS3FileUrl(BatchGetFileTemporaryParams batchGetFileTemporaryParams, String apikey) { |
|
|
public SimpleDataResponse getS3FileUrl(BatchGetFileTemporaryParams batchGetFileTemporaryParams, String authorization) { |
|
|
if (CollectionUtils.isEmpty(batchGetFileTemporaryParams.getKeys())) { |
|
|
if (CollectionUtils.isEmpty(batchGetFileTemporaryParams.getKeys())) { |
|
|
return new SimpleDataResponse(ResponseCode.MSG_ERROR, "keys required"); |
|
|
return new SimpleDataResponse(ResponseCode.MSG_ERROR, "keys required"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
|
|
|
paramMap.put("apikey", apikey); |
|
|
|
|
|
ApikeyInfo2 apikeyInfo = commonOpt.getAuroraInfoByApikey(paramMap); |
|
|
|
|
|
|
|
|
|
|
|
if (null == apikeyInfo) { |
|
|
|
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "Apikey is invalid"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ apikeyInfo.getId()); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ ApiContext.getTopCompanyId()); |
|
|
|
|
|
|
|
|
String bucketName = awsBucketAdress; |
|
|
String bucketName = awsBucketAdress; |
|
|
String accessKey = awsAccessKeyId; |
|
|
String accessKey = awsAccessKeyId; |
|
|
@ -1895,20 +1825,11 @@ public class CommonServiceImpl implements CommonService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public SimpleDataResponse addBuilding(AddBuildingParams addBuildingParams, String apikey) { |
|
|
public SimpleDataResponse addBuilding(AddBuildingParams addBuildingParams, String authorization) { |
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
long companyId = ApiContext.getCompanyId(); |
|
|
paramMap.put("apikey", apikey); |
|
|
|
|
|
ApikeyInfo2 apikeyInfo = commonOpt.getAuroraInfoByApikey(paramMap); |
|
|
|
|
|
|
|
|
|
|
|
if (null == apikeyInfo) { |
|
|
|
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "Apikey is invalid"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ApikeyInfo2 companyInfo = basicCompanyMapperExt.getAuroraInfoByApikey(paramMap); |
|
|
|
|
|
long companyId = companyInfo.getId(); |
|
|
|
|
|
|
|
|
|
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ apikeyInfo.getId()); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ ApiContext.getTopCompanyId()); |
|
|
|
|
|
|
|
|
OptBuildingParams optBuildingParams = new OptBuildingParams(); |
|
|
OptBuildingParams optBuildingParams = new OptBuildingParams(); |
|
|
optBuildingParams.setBuildingBucket(addBuildingParams.getBuildingBucket()); |
|
|
optBuildingParams.setBuildingBucket(addBuildingParams.getBuildingBucket()); |
|
|
@ -1922,17 +1843,9 @@ public class CommonServiceImpl implements CommonService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public SimpleDataResponse queryBuilding(QueryBuilding queryBuilding, String apikey) { |
|
|
public SimpleDataResponse queryBuilding(QueryBuilding queryBuilding, String authorization) { |
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
|
|
|
paramMap.put("apikey", apikey); |
|
|
|
|
|
ApikeyInfo2 apikeyInfo = commonOpt.getAuroraInfoByApikey(paramMap); |
|
|
|
|
|
|
|
|
|
|
|
if (null == apikeyInfo) { |
|
|
|
|
|
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, "Apikey is invalid"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
DataSourceContextHolder.clearCurrentDataSourceKey(); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ apikeyInfo.getId()); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX+ ApiContext.getTopCompanyId()); |
|
|
|
|
|
|
|
|
BasicBuildingExample example = new BasicBuildingExample(); |
|
|
BasicBuildingExample example = new BasicBuildingExample(); |
|
|
BasicBuildingExample.Criteria criteria = example.createCriteria(); |
|
|
BasicBuildingExample.Criteria criteria = example.createCriteria(); |
|
|
@ -1960,7 +1873,7 @@ public class CommonServiceImpl implements CommonService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public SimpleDataResponse queryCancelAlarmDevice(Long companyId, String apikey, |
|
|
public SimpleDataResponse queryCancelAlarmDevice(Long companyId, String authorization, |
|
|
ApiAlarmDeviceSearchParams apiAlarmDeviceSearchParams) { |
|
|
ApiAlarmDeviceSearchParams apiAlarmDeviceSearchParams) { |
|
|
String redisKey = "device_cancel_alarm"; |
|
|
String redisKey = "device_cancel_alarm"; |
|
|
// Create Jedis connection
|
|
|
// Create Jedis connection
|
|
|
@ -1968,13 +1881,10 @@ public class CommonServiceImpl implements CommonService { |
|
|
List<ApiCancelAlarmDeviceInfoVO> deviceInfoVOs = new ArrayList<>(); |
|
|
List<ApiCancelAlarmDeviceInfoVO> deviceInfoVOs = new ArrayList<>(); |
|
|
try { |
|
|
try { |
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
if (null != companyId) { |
|
|
if (null == companyId) { |
|
|
paramMap.put("companyId", companyId); |
|
|
companyId = ApiContext.getCompanyId(); |
|
|
} else { |
|
|
|
|
|
paramMap.put("apikey", apikey); |
|
|
|
|
|
ApikeyInfo2 selfInfo = basicCompanyMapperExt.getAuroraInfoByApikey(paramMap); |
|
|
|
|
|
companyId = selfInfo.getId(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
paramMap.put("companyId", companyId); |
|
|
|
|
|
|
|
|
Long topCompanyId = dataSourceInterceptor.getTopCompanyId(companyId+""); |
|
|
Long topCompanyId = dataSourceInterceptor.getTopCompanyId(companyId+""); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX +topCompanyId); |
|
|
DataSourceContextHolder.setCurrentDataSourceKey(Constants.DATASOURCE_PREFIX +topCompanyId); |
|
|
|