diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java index a86b507..4f64964 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java +++ b/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.springframework.web.bind.annotation.*; +import java.util.Date; import java.util.List; @@ -58,8 +59,10 @@ public class CentralMonitorController extends BladeController { @GetMapping("/selectCommunication/{page}/{size}") public R selectCommunication(@PathVariable Integer page, @PathVariable Integer size, - String roleId){ - IPage result = monitorService.selectOriginalDataByRealIds(page, size, roleId); + String roleId, + Date start, + Date end){ + IPage result = monitorService.selectOriginalDataByRealIds(page, size, roleId,start,end); return R.data(result); } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/CentralMonitorService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/CentralMonitorService.java index 887026e..1a8c211 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/CentralMonitorService.java +++ b/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.sdk.core.response.HzPage; +import java.util.Date; import java.util.List; /** @@ -28,6 +29,6 @@ public interface CentralMonitorService{ * @param roleId * @return */ - IPage selectOriginalDataByRealIds(Integer page, Integer size, String roleId); + IPage selectOriginalDataByRealIds(Integer page, Integer size, String roleId, Date start, Date end); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java index 6f92abc..6a6bbc9 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java +++ b/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 */ @Override - public IPage selectOriginalDataByRealIds(Integer page, Integer size, String roleId) { + public IPage selectOriginalDataByRealIds(Integer page, Integer size, String roleId,Date start,Date end) { OriginalDataQuery originalDataQuery = new OriginalDataQuery(); originalDataQuery.setRealId(roleId); originalDataQuery.setLimit(size); - Calendar calendar = Calendar.getInstance(); - originalDataQuery.setEndTime(calendar.getTime()); - calendar.add(Calendar.HOUR_OF_DAY,-1); - originalDataQuery.setBeginTime(calendar.getTime()); + // 当日 + if(ObjectUtil.isEmpty(start) && ObjectUtil.isEmpty(end)){ + Calendar calendar = Calendar.getInstance(); + 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> originalDataByRealIds = historyDataSearchClient.getOriginalDataByRealIds(originalDataQuery); if (!originalDataByRealIds.isSuccess()) { throw new ServiceException("数据不存在");