Browse Source

#集中监控关联历史数据查询

zhongwei
yang_shj 12 months ago
parent
commit
6539903e23
  1. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java
  2. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/CentralMonitorService.java
  3. 17
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java

@ -15,6 +15,7 @@ import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List; import java.util.List;
@ -58,8 +59,10 @@ public class CentralMonitorController extends BladeController {
@GetMapping("/selectCommunication/{page}/{size}") @GetMapping("/selectCommunication/{page}/{size}")
public R selectCommunication(@PathVariable Integer page, public R selectCommunication(@PathVariable Integer page,
@PathVariable Integer size, @PathVariable Integer size,
String roleId){ String roleId,
IPage<PointDataVo> result = monitorService.selectOriginalDataByRealIds(page, size, roleId); Date start,
Date end){
IPage<PointDataVo> result = monitorService.selectOriginalDataByRealIds(page, size, roleId,start,end);
return R.data(result); return R.data(result);
} }
} }

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/CentralMonitorService.java

@ -7,6 +7,7 @@ import com.hnac.hzims.operational.main.vo.RealStationVo;
import com.hnac.hzinfo.datasearch.PointData; import com.hnac.hzinfo.datasearch.PointData;
import com.hnac.hzinfo.sdk.core.response.HzPage; import com.hnac.hzinfo.sdk.core.response.HzPage;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -28,6 +29,6 @@ public interface CentralMonitorService{
* @param roleId * @param roleId
* @return * @return
*/ */
IPage<PointDataVo> selectOriginalDataByRealIds(Integer page, Integer size, String roleId); IPage<PointDataVo> selectOriginalDataByRealIds(Integer page, Integer size, String roleId, Date start, Date end);
} }

17
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java

@ -91,14 +91,21 @@ public class CentralMonitorServiceImpl implements CentralMonitorService {
* @return * @return
*/ */
@Override @Override
public IPage<PointDataVo> selectOriginalDataByRealIds(Integer page, Integer size, String roleId) { public IPage<PointDataVo> selectOriginalDataByRealIds(Integer page, Integer size, String roleId,Date start,Date end) {
OriginalDataQuery originalDataQuery = new OriginalDataQuery(); OriginalDataQuery originalDataQuery = new OriginalDataQuery();
originalDataQuery.setRealId(roleId); originalDataQuery.setRealId(roleId);
originalDataQuery.setLimit(size); originalDataQuery.setLimit(size);
Calendar calendar = Calendar.getInstance(); // 当日
originalDataQuery.setEndTime(calendar.getTime()); if(ObjectUtil.isEmpty(start) && ObjectUtil.isEmpty(end)){
calendar.add(Calendar.HOUR_OF_DAY,-1); Calendar calendar = Calendar.getInstance();
originalDataQuery.setBeginTime(calendar.getTime()); originalDataQuery.setEndTime(calendar.getTime());
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
originalDataQuery.setBeginTime(calendar.getTime());
}
originalDataQuery.setBeginTime(start);
originalDataQuery.setEndTime(end);
Result<HzPage<PointData>> originalDataByRealIds = historyDataSearchClient.getOriginalDataByRealIds(originalDataQuery); Result<HzPage<PointData>> originalDataByRealIds = historyDataSearchClient.getOriginalDataByRealIds(originalDataQuery);
if (!originalDataByRealIds.isSuccess()) { if (!originalDataByRealIds.isSuccess()) {
throw new ServiceException("数据不存在"); throw new ServiceException("数据不存在");

Loading…
Cancel
Save