yang_shj
5 months ago
5 changed files with 215 additions and 0 deletions
@ -0,0 +1,61 @@
|
||||
package com.hnac.hzims.operational.history.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.hnac.hzims.operational.history.service.AlarmService; |
||||
import com.hnac.hzims.operational.history.service.PointService; |
||||
import com.hnac.hzinfo.dataconfig.entity.Device; |
||||
import com.hnac.hzinfo.datasearch.soe.domian.SoeData; |
||||
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryCondition; |
||||
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/history") |
||||
@Api(value = "历史数据查询", tags = "历史数据查询") |
||||
@AllArgsConstructor |
||||
public class HistoryController extends BladeController { |
||||
|
||||
|
||||
private final PointService pointService; |
||||
|
||||
private final AlarmService alarmService; |
||||
|
||||
@PostMapping("/alarm") |
||||
@ApiOperationSupport(order = 1) |
||||
@ApiOperation(value = "告警数据查询", notes = "根据站点查询数据") |
||||
public R<IPage<SoeData>> alarm(@RequestBody SoeQueryCondition soeQueryCondition) { |
||||
return R.data(alarmService.alarm(soeQueryCondition)); |
||||
} |
||||
|
||||
@GetMapping("/projectSid") |
||||
@ApiOperationSupport(order = 2) |
||||
@ApiOperation(value = "查询站点sid", notes = "根据站点id查询sid") |
||||
public R<String> projectSid(@RequestParam(value = "stationId") String projectId) { |
||||
return R.data(pointService.projectSid(projectId)); |
||||
} |
||||
|
||||
@GetMapping("/projectGroup") |
||||
@ApiOperationSupport(order = 3) |
||||
@ApiOperation(value = "站点分组信息", notes = "根据站点sid查询厂信息分组") |
||||
public R<List<Device>> projectGroup(@RequestParam(value = "sid") String sid) { |
||||
return R.data(pointService.projectGroup(sid)); |
||||
} |
||||
|
||||
@GetMapping("/onlineAttr") |
||||
@ApiOperationSupport(order = 3) |
||||
@ApiOperation(value = "分组点位信息", notes = "根据分组Id查询分组点位") |
||||
public R<List<DeviceInstanceAttrVO>> onlineAttr(@RequestParam(value = "groupId") String groupId) { |
||||
return R.data(pointService.onlineAttr(groupId)); |
||||
} |
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.hnac.hzims.operational.history.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.hnac.hzinfo.datasearch.soe.domian.SoeData; |
||||
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryCondition; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface AlarmService { |
||||
|
||||
|
||||
IPage<SoeData> alarm(SoeQueryCondition soeQueryCondition); |
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.hnac.hzims.operational.history.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.hnac.hzinfo.dataconfig.entity.Device; |
||||
import com.hnac.hzinfo.datasearch.soe.domian.SoeData; |
||||
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryCondition; |
||||
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface PointService { |
||||
|
||||
|
||||
String projectSid(String projectId); |
||||
|
||||
List<Device> projectGroup(String projectId); |
||||
|
||||
List<DeviceInstanceAttrVO> onlineAttr(String groupId); |
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.hnac.hzims.operational.history.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.hnac.hzims.operational.history.service.AlarmService; |
||||
import com.hnac.hzinfo.dataconfig.entity.Device; |
||||
import com.hnac.hzinfo.datasearch.soe.ISoeClient; |
||||
import com.hnac.hzinfo.datasearch.soe.domian.SoeData; |
||||
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryCondition; |
||||
import com.hnac.hzinfo.sdk.core.response.HzPage; |
||||
import com.hnac.hzinfo.sdk.core.response.Result; |
||||
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.tool.utils.ObjectUtil; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Slf4j |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class AlarmServiceImpl implements AlarmService { |
||||
|
||||
private final ISoeClient soeClient; |
||||
|
||||
private final DeviceClient deviceClient; |
||||
|
||||
@Override |
||||
public IPage<SoeData> alarm(SoeQueryCondition soeQueryCondition) { |
||||
IPage<SoeData> page = new Page<>(soeQueryCondition.getPage(), soeQueryCondition.getLimit()); |
||||
Result<HzPage<SoeData>> result = soeClient.getByTypeAndTimeRangeOfPage(soeQueryCondition); |
||||
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData())){ |
||||
return page; |
||||
} |
||||
page.setPages(result.getData().getCurrent()); |
||||
page.setSize(result.getData().getSize()); |
||||
page.setTotal(result.getData().getTotal()); |
||||
page.setRecords(result.getData().getRecords()); |
||||
return page; |
||||
} |
||||
} |
@ -0,0 +1,73 @@
|
||||
package com.hnac.hzims.operational.history.service.impl; |
||||
|
||||
import com.hnac.hzims.operational.history.service.PointService; |
||||
import com.hnac.hzinfo.dataconfig.entity.Device; |
||||
import com.hnac.hzinfo.sdk.core.response.Result; |
||||
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; |
||||
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; |
||||
import com.hnac.hzinfo.sdk.v5.project.ProjectClient; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.CollectionUtil; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Slf4j |
||||
@Service |
||||
@AllArgsConstructor |
||||
public class PointServiceImpl implements PointService { |
||||
|
||||
private final ProjectClient projectClient; |
||||
|
||||
private final DeviceClient deviceClient; |
||||
|
||||
/** |
||||
* 查询站点厂信息分组 |
||||
* @param projectId |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public String projectSid(String projectId) { |
||||
Result<String> result = projectClient.getProjectBySid(projectId); |
||||
if(!result.isSuccess() || StringUtil.isBlank(result.getData())){ |
||||
return ""; |
||||
} |
||||
return result.getData(); |
||||
} |
||||
|
||||
/** |
||||
* 厂信息分组 |
||||
* @param sid |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public List<Device> projectGroup(String sid) { |
||||
Result<List<Device>> result = deviceClient.facDeviceByProjectId(sid); |
||||
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
||||
return new ArrayList<>(); |
||||
} |
||||
return result.getData(); |
||||
} |
||||
|
||||
/** |
||||
* 查询分组点位信息 |
||||
* @param groupId |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public List<DeviceInstanceAttrVO> onlineAttr(String groupId) { |
||||
R<List<DeviceInstanceAttrVO>> result = deviceClient.getOnlineAttr(groupId); |
||||
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ |
||||
return new ArrayList<>(); |
||||
} |
||||
return result.getData(); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue