|
|
@ -2,7 +2,7 @@ package com.hnac.hzims.operational.history.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.hnac.hzims.operational.history.service.PointService; |
|
|
|
import com.hnac.hzims.operational.history.service.PointService; |
|
|
|
import com.hnac.hzims.operational.history.vo.HistoricalCurveVo; |
|
|
|
import com.hnac.hzims.operational.history.vo.HistoricalCurveVo; |
|
|
|
import com.hnac.hzinfo.dataconfig.entity.Device; |
|
|
|
import com.hnac.hzinfo.sdk.core.response.DataResultCode; |
|
|
|
import com.hnac.hzinfo.sdk.core.response.Result; |
|
|
|
import com.hnac.hzinfo.sdk.core.response.Result; |
|
|
|
import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient; |
|
|
|
import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient; |
|
|
|
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; |
|
|
|
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; |
|
|
@ -14,14 +14,11 @@ import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceVO; |
|
|
|
import com.hnac.hzinfo.sdk.v5.project.ProjectClient; |
|
|
|
import com.hnac.hzinfo.sdk.v5.project.ProjectClient; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
@ -51,7 +48,7 @@ public class PointServiceImpl implements PointService { |
|
|
|
public List<FacDeviceVO> projectFacDevice(String projectId,String attrName) { |
|
|
|
public List<FacDeviceVO> projectFacDevice(String projectId,String attrName) { |
|
|
|
Result<List<FacDeviceVO>> result = hzFacClient.facDeviceByProjectId(projectId,attrName); |
|
|
|
Result<List<FacDeviceVO>> result = hzFacClient.facDeviceByProjectId(projectId,attrName); |
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
return new ArrayList<>(); |
|
|
|
throw new ServiceException(DataResultCode.FAIL,result.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
return result.getData(); |
|
|
|
return result.getData(); |
|
|
|
} |
|
|
|
} |
|
|
@ -66,7 +63,7 @@ public class PointServiceImpl implements PointService { |
|
|
|
public List<FacDeviceAttrVO> projectFacDeviceAttr(String facDeviceId, String attrName) { |
|
|
|
public List<FacDeviceAttrVO> projectFacDeviceAttr(String facDeviceId, String attrName) { |
|
|
|
Result<List<FacDeviceAttrVO>> result = hzFacClient.facDeviceAttrList(facDeviceId,attrName); |
|
|
|
Result<List<FacDeviceAttrVO>> result = hzFacClient.facDeviceAttrList(facDeviceId,attrName); |
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
return new ArrayList<>(); |
|
|
|
throw new ServiceException(DataResultCode.FAIL,result.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
return result.getData(); |
|
|
|
return result.getData(); |
|
|
|
} |
|
|
|
} |
|
|
@ -80,7 +77,7 @@ public class PointServiceImpl implements PointService { |
|
|
|
public List<DeviceInstanceVO> projectDeviceInstance(String projectId,String attrName) { |
|
|
|
public List<DeviceInstanceVO> projectDeviceInstance(String projectId,String attrName) { |
|
|
|
R<List<DeviceInstanceVO>> result = deviceClient.getOnlineDeviceInstanceSearchName(projectId,attrName); |
|
|
|
R<List<DeviceInstanceVO>> result = deviceClient.getOnlineDeviceInstanceSearchName(projectId,attrName); |
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
return new ArrayList<>(); |
|
|
|
throw new ServiceException(DataResultCode.FAIL,result.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
return result.getData(); |
|
|
|
return result.getData(); |
|
|
|
} |
|
|
|
} |
|
|
@ -95,7 +92,7 @@ public class PointServiceImpl implements PointService { |
|
|
|
public List<DeviceInstanceAttrVO> projectDeviceInstanceAttr(String deviceCode, String attrName) { |
|
|
|
public List<DeviceInstanceAttrVO> projectDeviceInstanceAttr(String deviceCode, String attrName) { |
|
|
|
Result<List<DeviceInstanceAttrVO>> result = deviceClient.getDeviceAttrByName(deviceCode,attrName); |
|
|
|
Result<List<DeviceInstanceAttrVO>> result = deviceClient.getDeviceAttrByName(deviceCode,attrName); |
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
return new ArrayList<>(); |
|
|
|
throw new ServiceException(DataResultCode.FAIL,result.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
return result.getData(); |
|
|
|
return result.getData(); |
|
|
|
} |
|
|
|
} |
|
|
@ -121,7 +118,7 @@ public class PointServiceImpl implements PointService { |
|
|
|
curve.getPageSize() |
|
|
|
curve.getPageSize() |
|
|
|
); |
|
|
|
); |
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
return new HashMap<>(); |
|
|
|
throw new ServiceException(DataResultCode.FAIL,result.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
return result.getData(); |
|
|
|
return result.getData(); |
|
|
|
} |
|
|
|
} |
|
|
@ -144,7 +141,7 @@ public class PointServiceImpl implements PointService { |
|
|
|
curve.getDimension(), |
|
|
|
curve.getDimension(), |
|
|
|
curve.getIntervalType()); |
|
|
|
curve.getIntervalType()); |
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
|
|
|
return new HashMap<>(); |
|
|
|
throw new ServiceException(DataResultCode.FAIL,result.getMsg()); |
|
|
|
} |
|
|
|
} |
|
|
|
return result.getData(); |
|
|
|
return result.getData(); |
|
|
|
} |
|
|
|
} |
|
|
|