From a5d1048bb85ac754257f04e4e3a4d60096acd573 Mon Sep 17 00:00:00 2001 From: hongawen <83944980@qq.com> Date: Wed, 9 Aug 2023 13:57:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=88=E7=AB=AF=E6=A8=A1=E5=9D=97=E8=B0=83?= =?UTF-8?q?=E6=95=B4influx=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pqs-device/common-device-biz/pom.xml | 12 + pqs-device/pms-device/pms-device-api/pom.xml | 12 - pqs-device/pms-device/pms-device-boot/pom.xml | 6 - .../impl/SubstationExpendServiceImpl.java | 45 +- .../majornetwork/EventDetailPmsService.java | 19 - .../impl/EventDetailPmsServiceImpl.java | 48 -- .../njcn/device/pq/pojo/po/Communicate.java | 52 -- .../pq/pojo/po/influxdb/DeviceDayFlow.java | 28 -- .../pq/pojo/vo/TerminalDaliyFlowVO.java | 5 +- pqs-device/pq-device/pq-device-boot/pom.xml | 6 - .../pq/controller/AreaCensusController.java | 78 --- .../AreaIntegrityDataController.java | 59 --- .../DeviceRunExceptionController.java | 61 --- .../pq/controller/LogManageController.java | 10 - .../controller/OperationContrController.java | 48 -- .../pq/controller/TabCensusController.java | 58 --- .../pq/mapper/AreaIntegrityDataMapper.java | 2 - .../device/pq/mapper/CommunicateMapper.java | 18 - .../pq/mapper/mapping/CommunicateMapper.xml | 5 - .../pq/service/AreaDeviceOnlineService.java | 17 - .../pq/service/AreaIntegrityDataService.java | 23 - .../pq/service/AreaIntegrityService.java | 17 - .../pq/service/DeviceOnlineDataService.java | 17 - .../pq/service/DeviceRunExceptionService.java | 23 - .../njcn/device/pq/service/LineService.java | 32 +- .../device/pq/service/LogManageService.java | 6 - .../impl/AreaDeviceOnlineServiceImpl.java | 177 ------- .../impl/AreaIntegrityDataServiceImpl.java | 55 --- .../impl/AreaIntegrityServiceImpl.java | 141 ------ .../service/impl/CommunicateServiceImpl.java | 35 +- .../impl/DeviceOnlineDataServiceImpl.java | 152 ------ .../impl/DeviceRunExceptionServiceImpl.java | 331 ------------- .../impl/LineIntegrityDataServiceImpl.java | 38 -- .../pq/service/impl/LineServiceImpl.java | 444 +----------------- .../pq/service/impl/LogManageServiceImpl.java | 99 ---- .../pq/service/impl/RunManageServiceImpl.java | 7 - .../impl/SubstationExpendServiceImpl.java | 58 +-- .../impl/TerminalMaintainServiceImpl.java | 44 +- .../imapper/CldStatisticsFlowMapper.java | 5 + .../influx/imapper/PqsCommunicateMapper.java | 13 + .../influx/pojo/dto/DeviceDayFlowDTO.java | 19 + .../influx/service/PqsCommunicateService.java | 9 + .../impl/PqsCommunicateServiceImpl.java | 13 + 43 files changed, 151 insertions(+), 2196 deletions(-) delete mode 100644 pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/EventDetailPmsService.java delete mode 100644 pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/EventDetailPmsServiceImpl.java delete mode 100644 pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/Communicate.java delete mode 100644 pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/influxdb/DeviceDayFlow.java delete mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/AreaCensusController.java delete mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/AreaIntegrityDataController.java delete mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/DeviceRunExceptionController.java delete mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/TabCensusController.java delete mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/CommunicateMapper.java delete mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/CommunicateMapper.xml delete mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/AreaDeviceOnlineService.java delete mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/AreaIntegrityDataService.java delete mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/AreaIntegrityService.java delete mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/DeviceOnlineDataService.java delete mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/DeviceRunExceptionService.java delete mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/AreaDeviceOnlineServiceImpl.java delete mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/AreaIntegrityDataServiceImpl.java delete mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/AreaIntegrityServiceImpl.java delete mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeviceOnlineDataServiceImpl.java delete mode 100644 pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeviceRunExceptionServiceImpl.java create mode 100644 pqs-influx/src/main/java/com/njcn/influx/imapper/PqsCommunicateMapper.java create mode 100644 pqs-influx/src/main/java/com/njcn/influx/pojo/dto/DeviceDayFlowDTO.java create mode 100644 pqs-influx/src/main/java/com/njcn/influx/service/PqsCommunicateService.java create mode 100644 pqs-influx/src/main/java/com/njcn/influx/service/impl/PqsCommunicateServiceImpl.java diff --git a/pqs-device/common-device-biz/pom.xml b/pqs-device/common-device-biz/pom.xml index e663ab869..c06a3a41d 100644 --- a/pqs-device/common-device-biz/pom.xml +++ b/pqs-device/common-device-biz/pom.xml @@ -55,6 +55,18 @@ user-api ${project.version} + + com.njcn + pqs-influx + 0.0.1-SNAPSHOT + + + + com.squareup.okhttp3 + * + + + diff --git a/pqs-device/pms-device/pms-device-api/pom.xml b/pqs-device/pms-device/pms-device-api/pom.xml index 03b10389d..7ffaf2a15 100644 --- a/pqs-device/pms-device/pms-device-api/pom.xml +++ b/pqs-device/pms-device/pms-device-api/pom.xml @@ -28,17 +28,5 @@ 1.0.0 compile - - com.njcn - pqs-influx - 0.0.1-SNAPSHOT - - - - com.squareup.okhttp3 - * - - - \ No newline at end of file diff --git a/pqs-device/pms-device/pms-device-boot/pom.xml b/pqs-device/pms-device/pms-device-boot/pom.xml index e2437ea57..b904c242d 100644 --- a/pqs-device/pms-device/pms-device-boot/pom.xml +++ b/pqs-device/pms-device/pms-device-boot/pom.xml @@ -40,12 +40,6 @@ common-web ${project.version} - - com.njcn - common-influxDB - ${project.version} - compile - com.njcn common-oss diff --git a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/impl/SubstationExpendServiceImpl.java b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/impl/SubstationExpendServiceImpl.java index b53a301d3..348ce20f7 100644 --- a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/impl/SubstationExpendServiceImpl.java +++ b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/impl/SubstationExpendServiceImpl.java @@ -29,10 +29,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.njcn.device.pms.service.majornetwork.IPmsGeneralDeviceService; import com.njcn.device.pms.service.majornetwork.ITerminalService; import com.njcn.device.pq.pojo.param.CommunicateParam; -import com.njcn.device.pq.pojo.po.Communicate; import com.njcn.device.pq.pojo.vo.CommunicateVO; -import com.njcn.influxdb.param.InfluxDBPublicParam; -import com.njcn.influxdb.utils.InfluxDbUtils; +import com.njcn.influx.imapper.PqsCommunicateMapper; +import com.njcn.influx.pojo.constant.InfluxDBTableConstant; +import com.njcn.influx.pojo.po.PqsCommunicate; +import com.njcn.influx.query.InfluxQueryWrapper; import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.enums.DicDataTypeEnum; import com.njcn.system.pojo.po.DictData; @@ -41,8 +42,6 @@ import com.njcn.user.pojo.dto.DeptDTO; import com.njcn.user.pojo.po.Dept; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.influxdb.dto.QueryResult; -import org.influxdb.impl.InfluxDBResultMapper; import org.springframework.stereotype.Service; import java.math.BigDecimal; @@ -71,10 +70,13 @@ public class SubstationExpendServiceImpl extends ServiceImpl> getSubstationExpendInfo(StatisticsBizBaseParam param) { Map> map = new HashMap<>(); @@ -253,36 +255,23 @@ public class SubstationExpendServiceImpl extends ServiceImpl terminalIds = generalDeviceDTOS.stream().flatMap(dto -> dto.getTerminalIdList().stream()).collect(Collectors.toList()); List info =new ArrayList<>(); - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(param.getStartTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(param.getEndTime()))).append("' "); + + InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class); + influxQueryWrapper.between(InfluxDBTableConstant.TIME,DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())),DateUtil.beginOfDay(DateUtil.parse(param.getEndTime()))); if(CollUtil.isNotEmpty(terminalIds)){ - stringBuilder.append(" and ").append("("); - for (int i = 0; i < terminalIds.size(); i++) { - if (terminalIds.size() - i != 1) { - stringBuilder.append("dev_id = '").append(terminalIds.get(i)).append("' or "); - } else { - stringBuilder.append("dev_id = '").append(terminalIds.get(i)).append("')"); - } - } + influxQueryWrapper.or(PqsCommunicate::getDevId,terminalIds); } - stringBuilder.append(" limit "+param.getLimit()); - String sql = "select * from " + InfluxDBPublicParam.PQS_COMMUNICATE + " where " + stringBuilder + InfluxDBPublicParam.TIME_ZONE; - // 获取暂降事件 - QueryResult result = influxDbUtils.query(sql); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List communicates = influxDBResultMapper.toPOJO(result, Communicate.class); - if(CollUtil.isEmpty(communicates)){ - return info; - } - List ids = communicates.stream().map(Communicate::getDevId).distinct().collect(Collectors.toList()); + influxQueryWrapper.limit(param.getLimit()); + List communicates = pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper); + List ids = communicates.stream().map(PqsCommunicate::getDevId).distinct().collect(Collectors.toList()); if(CollUtil.isNotEmpty(ids)){ List terminalSelectByIds = iTerminalService.getTerminalSelectByIds(ids); Map terminalNameIp = terminalSelectByIds.stream().collect(Collectors.toMap(PmsTerminal::getId, x -> x.getName() + "_" + x.getIp())); CommunicateVO.PVCommunicateVO communicate; - for (Communicate cate : communicates) { + for (PqsCommunicate cate : communicates) { communicate=new CommunicateVO.PVCommunicateVO(); BeanUtil.copyProperties(cate, communicate); - communicate.setTime(cate.getUpdateTime()); + communicate.setTime(cate.getTime()); if(terminalNameIp.containsKey(cate.getDevId())){ communicate.setDevIp(terminalNameIp.get(cate.getDevId())); } diff --git a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/EventDetailPmsService.java b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/EventDetailPmsService.java deleted file mode 100644 index a8dc6607f..000000000 --- a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/EventDetailPmsService.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.njcn.device.pms.service.majornetwork; - -import com.njcn.event.pojo.po.EventDetail; - -/** - * @author qijian - * @version 1.0.0 - * @date 2022年12月14日 09:39 - */ -public interface EventDetailPmsService { - - /** - * 根据监测点id和时区时间time获取暂降事件 - * - * @param id 监测点id - * @return 暂降事件详情 - */ - EventDetail getEventDetailByTime(String id, String time); -} \ No newline at end of file diff --git a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/EventDetailPmsServiceImpl.java b/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/EventDetailPmsServiceImpl.java deleted file mode 100644 index 72e9da89a..000000000 --- a/pqs-device/pms-device/pms-device-boot/src/main/java/com/njcn/device/pms/service/majornetwork/impl/EventDetailPmsServiceImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.njcn.device.pms.service.majornetwork.impl; - -import cn.hutool.core.date.DateUtil; -import com.njcn.device.pms.service.majornetwork.EventDetailPmsService; -import com.njcn.event.pojo.po.EventDetail; -import com.njcn.influxdb.utils.InfluxDbUtils; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.influxdb.dto.QueryResult; -import org.influxdb.impl.InfluxDBResultMapper; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import java.util.List; -import java.util.Objects; - -/** - * @author qijian - * @version 1.0.0 - * @date 2022年12月14日 09:39 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class EventDetailPmsServiceImpl implements EventDetailPmsService { - - private final InfluxDbUtils influxDbUtils; - - @Override - public EventDetail getEventDetailByTime(String id, String time) { - EventDetail eventDetail = new EventDetail(); - //组装sql语句 - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("time = '").append(time).append("' and ").append("line_id ='").append(id).append("' limit 1 tz('Asia/Shanghai')"); - - String sql = "select * from pqs_eventdetail where " + stringBuilder; - //获取暂降事件 - QueryResult result = influxDbUtils.query(sql); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - if (!Objects.isNull(result)) { - List detailList = influxDBResultMapper.toPOJO(result, EventDetail.class); - if (!CollectionUtils.isEmpty(detailList)) { - eventDetail = detailList.get(0); - } - } - return eventDetail; - } -} diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/Communicate.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/Communicate.java deleted file mode 100644 index 45939488c..000000000 --- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/Communicate.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.njcn.device.pq.pojo.po; - -import lombok.Data; -import org.influxdb.annotation.Column; -import org.influxdb.annotation.Measurement; - -import java.time.Instant; - -/** - *

- * - *

- * - * @author cdf - * @since 2022-01-07 - */ -@Data -@Measurement(name = "pqs_communicate") -public class Communicate { - - private static final long serialVersionUID = 1L; - - /** - * 更新时间 - */ - @Column(name = "time") - private Instant updateTime; - /** - * 监测点id - */ - @Column(name = "line_id") - private String id; - /** - * 终端Id - */ - @Column(name = "dev_id") - private String devId; - - /** - * 事件类型(0:中断;1:正常;2:退出) - */ - @Column(name = "type") - private Integer type; - - /** - * 备注 - */ - @Column(name = "description") - private String remark; - - -} diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/influxdb/DeviceDayFlow.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/influxdb/DeviceDayFlow.java deleted file mode 100644 index c454b3aed..000000000 --- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/po/influxdb/DeviceDayFlow.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.njcn.device.pq.pojo.po.influxdb; - -import lombok.Data; -import org.influxdb.annotation.Column; -import org.influxdb.annotation.Measurement; - -import java.time.Instant; -import java.time.LocalDateTime; - -@Data -@Measurement(name = "cld_statis_flow") -public class DeviceDayFlow { - - @Column(name="time") - private Instant time; - - @Column(name="actual_value") - private Integer actualValue; - - @Column(name="dev_id") - private String devId; - - private float dailyActualValue; - - private String date; - - private String month; -} diff --git a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/TerminalDaliyFlowVO.java b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/TerminalDaliyFlowVO.java index d234eaba4..4777c055b 100644 --- a/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/TerminalDaliyFlowVO.java +++ b/pqs-device/pq-device/pq-device-api/src/main/java/com/njcn/device/pq/pojo/vo/TerminalDaliyFlowVO.java @@ -1,14 +1,13 @@ package com.njcn.device.pq.pojo.vo; import com.njcn.device.pq.pojo.po.DevFuction; -import com.njcn.device.pq.pojo.po.influxdb.DeviceDayFlow; +import com.njcn.influx.pojo.dto.DeviceDayFlowDTO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDateTime; import java.util.List; @Data @@ -32,7 +31,7 @@ public class TerminalDaliyFlowVO { @ApiModelProperty(name = "flowMeal",value = "套餐流量(基础+拓展)") private Float flowMeal; @ApiModelProperty(name = "deviceDayFlowsList",value = "装置日流量统计集合") - private List deviceDayFlowsList; + private List deviceDayFlowsList; @ApiModelProperty(name = "functions",value = "装置功能码集合") private List functions; diff --git a/pqs-device/pq-device/pq-device-boot/pom.xml b/pqs-device/pq-device/pq-device-boot/pom.xml index ee127bc0c..c2dfa7ba3 100644 --- a/pqs-device/pq-device/pq-device-boot/pom.xml +++ b/pqs-device/pq-device/pq-device-boot/pom.xml @@ -39,12 +39,6 @@ common-web ${project.version}
- - com.njcn - common-influxDB - ${project.version} - compile - com.njcn common-oss diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/AreaCensusController.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/AreaCensusController.java deleted file mode 100644 index 8ebef6aae..000000000 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/AreaCensusController.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.njcn.device.pq.controller; - -import com.njcn.common.pojo.annotation.OperateInfo; -import com.njcn.common.pojo.enums.common.LogEnum; -import com.njcn.common.pojo.enums.response.CommonResponseEnum; -import com.njcn.common.pojo.response.HttpResult; -import com.njcn.common.utils.HttpResultUtil; -import com.njcn.common.utils.LogUtil; -import com.njcn.device.pq.pojo.param.AreaCensusParam; -import com.njcn.device.pq.pojo.vo.AreaDeviceOnlineVO; -import com.njcn.device.pq.pojo.vo.AreaIntegrityVO; -import com.njcn.device.pq.service.AreaDeviceOnlineService; -import com.njcn.device.pq.service.AreaIntegrityService; -import com.njcn.web.controller.BaseController; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.util.CollectionUtils; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -/** - * @version 1.0.0 - * @author: chenchao - * @date: 2022/08/11 14:05 - */ -@Validated -@Slf4j -@RestController -@RequestMapping("/areaCensus") -@Api(tags = "区域统计") -@AllArgsConstructor -public class AreaCensusController extends BaseController { - - private final AreaDeviceOnlineService areaDeviceOnlineService; - - private final AreaIntegrityService areaIntegrityService; - - @OperateInfo(info = LogEnum.BUSINESS_COMMON) - @PostMapping("/getAreaDeviceOnline") - @ApiOperation("获取区域终端在线率") - @ApiImplicitParam(name = "areaCensusParam", value = "区域统计查询参数", required = true) - public HttpResult> getAreaDeviceOnline(@RequestBody @Validated AreaCensusParam areaCensusParam) { - String methodDescribe = getMethodDescribe("getAreaDeviceOnline"); - LogUtil.njcnDebug(log, "{}", methodDescribe, areaCensusParam); - List result = areaDeviceOnlineService.getAreaDeviceOnline(areaCensusParam); - if (CollectionUtils.isEmpty(result)) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.NO_DATA, null, methodDescribe); - } else { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); - } - } - - - @OperateInfo(info = LogEnum.BUSINESS_COMMON) - @PostMapping("/getAreaIntegrity") - @ApiOperation("获取区域数据完整性") - @ApiImplicitParam(name = "areaCensusParam", value = "查询参数实体", required = true) - public HttpResult> getAreaIntegrity(@RequestBody @Validated AreaCensusParam areaCensusParam) { - String methodDescribe = getMethodDescribe("getAreaIntegrity"); - LogUtil.njcnDebug(log, "{}", methodDescribe, areaCensusParam); - List result = areaIntegrityService.getAreaIntegrity(areaCensusParam); - if (CollectionUtils.isEmpty(result)) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.NO_DATA, null, methodDescribe); - } else { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); - } - } - - -} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/AreaIntegrityDataController.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/AreaIntegrityDataController.java deleted file mode 100644 index 3d2e74df8..000000000 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/AreaIntegrityDataController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.njcn.device.pq.controller; - -import com.njcn.common.pojo.annotation.OperateInfo; -import com.njcn.common.pojo.enums.common.LogEnum; -import com.njcn.common.pojo.enums.response.CommonResponseEnum; -import com.njcn.common.pojo.response.HttpResult; -import com.njcn.common.utils.HttpResultUtil; -import com.njcn.device.pq.pojo.param.AreaIntegrityDataParam; -import com.njcn.device.pq.pojo.vo.AreaIntegrityDataVO; -import com.njcn.device.pq.service.AreaIntegrityDataService; -import com.njcn.web.controller.BaseController; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -/** - * 区域数据完整性 - * - * @author yzh - * @date 2022/9/22 - */ - -@Slf4j -@Api(tags = "区域数据完整性") -@RestController -@RequestMapping("/areaIntegrityData") -@RequiredArgsConstructor -public class AreaIntegrityDataController extends BaseController { - - private AreaIntegrityDataService getIntegrityDataOfLine; - - /** - * 区域数据完整性 - */ - @OperateInfo(info = LogEnum.BUSINESS_COMMON) - @PostMapping("/getAreaIntegrityData") - @ApiOperation("区域数据完整性") - @ApiImplicitParam(name = "areaIntegrityDataParam", value = "参数实体", required = true) - public HttpResult> getAreaIntegrityData(@RequestBody AreaIntegrityDataParam areaIntegrityDataParam) { - - long start = System.currentTimeMillis(); - - String methodDescribe = getMethodDescribe("getAreaIntegrityData"); - List areaIntegrityData = getIntegrityDataOfLine.getAreaIntegrityData(areaIntegrityDataParam); - - long end = System.currentTimeMillis(); - System.out.println("当前程序运行多少毫秒:" + "=" + (end - start)); - - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, areaIntegrityData, methodDescribe); - } -} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/DeviceRunExceptionController.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/DeviceRunExceptionController.java deleted file mode 100644 index 1aea51204..000000000 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/DeviceRunExceptionController.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.njcn.device.pq.controller; - -import com.njcn.common.pojo.annotation.OperateInfo; -import com.njcn.common.pojo.enums.common.LogEnum; -import com.njcn.common.pojo.enums.response.CommonResponseEnum; -import com.njcn.common.pojo.response.HttpResult; -import com.njcn.common.utils.HttpResultUtil; -import com.njcn.device.pq.pojo.param.DeviceRunExceptionParam; -import com.njcn.device.pq.pojo.vo.DeviceRunExceptionVO; -import com.njcn.device.pq.service.DeviceRunExceptionService; -import com.njcn.web.controller.BaseController; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -/** - * 终端异常统计 - * @author yzh - * @date 2022/9/27 - */ - -@Slf4j -@Api(tags = "终端异常统计") -@RestController -@RequestMapping("/deviceRunException") -@RequiredArgsConstructor -public class DeviceRunExceptionController extends BaseController { - - private final DeviceRunExceptionService deviceRunExceptionService; - - - /** - * 终端异常统计 - */ - @OperateInfo(info = LogEnum.BUSINESS_COMMON) - @PostMapping("/getDeviceRunException") - @ApiOperation("终端异常统计") - @ApiImplicitParam(name = "deviceRunExceptionParam", value = "参数实体", required = true) - public HttpResult> getDeviceRunException(@RequestBody DeviceRunExceptionParam deviceRunExceptionParam) { - // 开始时间 - long start=System.currentTimeMillis(); - - String methodDescribe = getMethodDescribe("getDeviceRunException"); - List deviceRunException = deviceRunExceptionService.getDeviceRunException(deviceRunExceptionParam); - - // 结束时间 - long end=System.currentTimeMillis(); - // 计算运行时间 - System.out.println("当前程序运行多少毫秒:" + "=" + (end-start)); - - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,deviceRunException,methodDescribe); - } -} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/LogManageController.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/LogManageController.java index 28b71434d..f9ade7f86 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/LogManageController.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/LogManageController.java @@ -38,16 +38,6 @@ public class LogManageController extends BaseController { private final LogManageService deviceLogService; - @OperateInfo(info = LogEnum.BUSINESS_COMMON) - @PostMapping("/getDeviceLogData") - @ApiOperation("终端运维日志") - @ApiImplicitParam(name = "deviceLogParam", value = "查询终端日志信息", required = true) - public HttpResult> getDeviceLogData(@RequestBody @Validated DeviceLogParam deviceLogParam){ - String methodDescribe = getMethodDescribe("getDeviceLogData"); - Page list = deviceLogService.getDeviceLogData(deviceLogParam); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); - } - @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/getEventLogData") @ApiOperation("暂降推送日志") diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/OperationContrController.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/OperationContrController.java index fc63dcac4..0298ba77a 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/OperationContrController.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/OperationContrController.java @@ -75,30 +75,6 @@ public class OperationContrController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); } - @OperateInfo(info = LogEnum.BUSINESS_COMMON) - @PostMapping("/getLineRunStatistics") - @ApiOperation("获取监测点运行统计") - @ApiImplicitParam(name = "deviceInfoParam", value = "实体", required = true) - public HttpResult> getLineRunStatistics(@RequestBody @Validated DeviceInfoParam.BusinessParam deviceInfoParam) { - String methodDescribe = getMethodDescribe("getLineRunStatistics"); - LogUtil.njcnDebug(log, "{},参数集合:{}", methodDescribe, deviceInfoParam); - List result = lineService.getLineRunStatistics(deviceInfoParam); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); - } - - @OperateInfo(info = LogEnum.BUSINESS_COMMON) - @PostMapping("/getDeviceRunStatistics") - @ApiOperation("获取终端运行统计") - @ApiImplicitParam(name = "deviceInfoParam", value = "实体", required = true) - public HttpResult> getDeviceRunStatistics(@RequestBody DeviceInfoParam.BusinessParam deviceInfoParam){ - String methodDescribe = getMethodDescribe("getDeviceRunStatistics"); - DeviceInfoParam param = new DeviceInfoParam(RequestUtil.getDeptIndex(),null); - deviceInfoParam.setDeptIndex(param.getDeptIndex()); - LogUtil.njcnDebug(log, "{},参数集合:{}", methodDescribe, deviceInfoParam); - List result = lineService.getDeviceRunStatistics(deviceInfoParam); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); - } - @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/getNewDeviceRunStatistics") @@ -116,30 +92,6 @@ public class OperationContrController extends BaseController { } - @OperateInfo(info = LogEnum.BUSINESS_COMMON) - @PostMapping("/getLineStaticsView") - @ApiOperation("获取详细的监测点统计") - @ApiImplicitParams({ - @ApiImplicitParam(name = "startTime", value = "起始时间", required = true), - @ApiImplicitParam(name = "endTime", value = "结束时间", required = true), - @ApiImplicitParam(name = "lineId", value = "监测点id", required = true) - }) - public HttpResult getLineStaticsView(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("lineId") String lineId) { - String methodDescribe = getMethodDescribe("getLineStaticsView"); - LineStaticsViewVO result = lineService.getLineStaticsView(startTime, endTime, lineId); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); - } - - @OperateInfo(info = LogEnum.BUSINESS_COMMON) - @PostMapping("/getComunicateStatics") - @ApiOperation("获取中断异常统计") - @ApiImplicitParam(name = "conditionBusinessParam", value = "实体", required = true) - public HttpResult getComunicateStatics(@RequestBody @Validated DeviceInfoParam.BusinessParam conditionBusinessParam) { - String methodDescribe = getMethodDescribe("getComunicateStatics"); - DeviceAbnormalVO result = lineService.getComunicateStatics(conditionBusinessParam); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); - } - @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/getDailyDeviceAbnormalStatistics") @ApiOperation("获取终端异常统计") diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/TabCensusController.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/TabCensusController.java deleted file mode 100644 index 3aaa7c9b3..000000000 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/controller/TabCensusController.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.njcn.device.pq.controller; - -import cn.hutool.core.collection.CollectionUtil; -import com.njcn.common.pojo.annotation.OperateInfo; -import com.njcn.common.pojo.enums.common.LogEnum; -import com.njcn.common.pojo.enums.response.CommonResponseEnum; -import com.njcn.common.pojo.response.HttpResult; -import com.njcn.common.utils.HttpResultUtil; -import com.njcn.common.utils.LogUtil; -import com.njcn.device.pq.pojo.param.TabCensusParam; -import com.njcn.device.pq.pojo.vo.DeviceOnlineTabVO; -import com.njcn.device.pq.service.DeviceOnlineDataService; -import com.njcn.web.controller.BaseController; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -/** - * @version 1.0.0 - * @author: chenchao - * @date: 2022/08/16 14:34 - */ -@Validated -@Slf4j -@RestController -@RequestMapping("/tabCensus") -@Api(tags = "列表统计") -@AllArgsConstructor -public class TabCensusController extends BaseController { - - private final DeviceOnlineDataService deviceOnlineDataService; - - @OperateInfo(info = LogEnum.BUSINESS_COMMON) - @PostMapping("/getDeviceOnlineData") - @ApiOperation("获取终端在线率列表") - @ApiImplicitParam(name = "tabCensusParam", value = "区域统计查询参数", required = true) - public HttpResult> getDeviceOnlineData(@RequestBody @Validated TabCensusParam tabCensusParam) { - String methodDescribe = getMethodDescribe("getDeviceOnlineData"); - LogUtil.njcnDebug(log, "{}", methodDescribe, tabCensusParam); - List result = deviceOnlineDataService.getDeviceOnlineData(tabCensusParam); - if (CollectionUtil.isEmpty(result)) { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.NO_DATA, null, methodDescribe); - } else { - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); - } - } - - -} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/AreaIntegrityDataMapper.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/AreaIntegrityDataMapper.java index be0076a53..3d3480945 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/AreaIntegrityDataMapper.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/AreaIntegrityDataMapper.java @@ -1,8 +1,6 @@ package com.njcn.device.pq.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.njcn.device.pq.pojo.param.AreaIntegrityDataParam; -import com.njcn.device.pq.pojo.po.Communicate; import com.njcn.device.pq.pojo.vo.AreaIntegrityDataVO; import org.apache.ibatis.annotations.Mapper; diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/CommunicateMapper.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/CommunicateMapper.java deleted file mode 100644 index 87b7323b0..000000000 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/CommunicateMapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.njcn.device.pq.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.njcn.device.pq.pojo.po.Communicate; -import org.apache.ibatis.annotations.Param; - -import java.time.LocalDateTime; -import java.util.Date; -import java.util.List; - -/** - * @author denghuajun - * @date 2022/2/28 - * - */ -public interface CommunicateMapper extends BaseMapper { - List getCommunicate(@Param("id") String id, @Param("startTime") Date startTime, @Param("endTime")Date endTime); -} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/CommunicateMapper.xml b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/CommunicateMapper.xml deleted file mode 100644 index 5706ab4c2..000000000 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/CommunicateMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/AreaDeviceOnlineService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/AreaDeviceOnlineService.java deleted file mode 100644 index 244436198..000000000 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/AreaDeviceOnlineService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.njcn.device.pq.service; - -import com.njcn.device.pq.pojo.param.AreaCensusParam; -import com.njcn.device.pq.pojo.vo.AreaDeviceOnlineVO; - -import java.util.List; - -/** - * @version 1.0.0 - * @author: chenchao - * @date: 2022/08/11 20:52 - */ -public interface AreaDeviceOnlineService { - - List getAreaDeviceOnline(AreaCensusParam areaCensusParam); - -} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/AreaIntegrityDataService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/AreaIntegrityDataService.java deleted file mode 100644 index 993d19ca9..000000000 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/AreaIntegrityDataService.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.njcn.device.pq.service; - -import com.njcn.device.pq.pojo.param.AreaIntegrityDataParam; -import com.njcn.device.pq.pojo.vo.AreaIntegrityDataVO; - -import java.util.List; - -/** - * 区域数据完整性 - * @author yzh - * @date 2022/9/22 - */ - -public interface AreaIntegrityDataService { - - /** - * 获取区域数据完整性 - * @param areaIntegrityDataParam - * @return - */ - List getAreaIntegrityData(AreaIntegrityDataParam areaIntegrityDataParam); - -} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/AreaIntegrityService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/AreaIntegrityService.java deleted file mode 100644 index 3006818ea..000000000 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/AreaIntegrityService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.njcn.device.pq.service; - -import com.njcn.device.pq.pojo.param.AreaCensusParam; -import com.njcn.device.pq.pojo.vo.AreaIntegrityVO; - -import java.util.List; - -/** - * @version 1.0.0 - * @author: chenchao - * @date: 2022/08/15 15:43 - */ -public interface AreaIntegrityService { - - List getAreaIntegrity(AreaCensusParam areaCensusParam); - -} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/DeviceOnlineDataService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/DeviceOnlineDataService.java deleted file mode 100644 index da521bc5c..000000000 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/DeviceOnlineDataService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.njcn.device.pq.service; - -import com.njcn.device.pq.pojo.param.TabCensusParam; -import com.njcn.device.pq.pojo.vo.DeviceOnlineTabVO; - -import java.util.List; - -/** - * @version 1.0.0 - * @author: chenchao - * @date: 2022/08/16 14:53 - */ -public interface DeviceOnlineDataService { - - List getDeviceOnlineData(TabCensusParam tabCensusParam); - -} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/DeviceRunExceptionService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/DeviceRunExceptionService.java deleted file mode 100644 index a42790bd4..000000000 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/DeviceRunExceptionService.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.njcn.device.pq.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.njcn.device.pq.pojo.param.DeviceRunExceptionParam; -import com.njcn.device.pq.pojo.vo.DeviceRunExceptionVO; - -import java.util.List; - -/** - * 终端异常统计业务层 - * @author yzh - * @date 2022/9/27 - */ - -public interface DeviceRunExceptionService extends IService { - - /** - * 终端异常统计 - * @param deviceRunExceptionParam - * @return - */ - List getDeviceRunException(DeviceRunExceptionParam deviceRunExceptionParam); -} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/LineService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/LineService.java index 5662a3d64..4ef339838 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/LineService.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/LineService.java @@ -107,31 +107,6 @@ public interface LineService { */ List getLineStatisticsTable(DeviceInfoParam.BusinessParam deviceInfoParam); - /** - * 获取监测点运行统计 - * @param deviceInfoParam 参数 - * @return 结果 - */ - List getLineRunStatistics(DeviceInfoParam.BusinessParam deviceInfoParam); - - /** - * 获取终端运行统计 - * @param deviceInfoParam - * @return - */ - - List getDeviceRunStatistics(DeviceInfoParam.BusinessParam deviceInfoParam); - - - - /** - * 获取详细的统计数据 - * @param startTime 起始时间 - * @param endTime 结束时间 - * @param lineId 监测点id - * @return 结果 - */ - LineStaticsViewVO getLineStaticsView(String startTime,String endTime,String lineId); /** * 获取监测点限值信息 @@ -154,12 +129,7 @@ public interface LineService { */ List getBaseLineList(List lineIndex); - /** - * 获取终端异常数据 - * @param deviceInfoParam 参数 - * @return 结果 - */ - DeviceAbnormalVO getComunicateStatics(DeviceInfoParam.BusinessParam deviceInfoParam); + /** * @Description: 通过部门索引查询其下监测点数 * @Param: [deviceInfoParam] 监测点查询条件 diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/LogManageService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/LogManageService.java index d82239322..8d3b39593 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/LogManageService.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/LogManageService.java @@ -13,12 +13,6 @@ import com.njcn.device.pq.pojo.vo.EventLogVO; */ public interface LogManageService { - /** - * 获取终端日志列表 - * @param deviceLogParam - * @return - */ - Page getDeviceLogData(DeviceLogParam deviceLogParam); /** * 获取暂降推送日志列表 * @param eventLogParam diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/AreaDeviceOnlineServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/AreaDeviceOnlineServiceImpl.java deleted file mode 100644 index 18ceb6aaf..000000000 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/AreaDeviceOnlineServiceImpl.java +++ /dev/null @@ -1,177 +0,0 @@ -package com.njcn.device.pq.service.impl; - -import cn.hutool.core.date.DateUtil; -import com.njcn.device.pq.controller.GeneralDeviceInfoController; -import com.njcn.device.pq.mapper.AreaDeviceOnlineMapper; -import com.njcn.device.pq.mapper.DeviceMapper; -import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO; -import com.njcn.device.pq.pojo.param.AreaCensusParam; -import com.njcn.device.pq.pojo.po.Device; -import com.njcn.device.pq.pojo.vo.AreaDeviceOnlineVO; -import com.njcn.device.pq.pojo.vo.LineInfluxDbOnlineVO; -import com.njcn.device.pq.service.AreaDeviceOnlineService; -import com.njcn.influxdb.param.InfluxDBPublicParam; -import com.njcn.influxdb.utils.InfluxDbUtils; -import lombok.AllArgsConstructor; -import org.influxdb.dto.QueryResult; -import org.influxdb.impl.InfluxDBResultMapper; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.function.BiFunction; -import java.util.stream.Collectors; - -/** - * @version 1.0.0 - * @author: chenchao - * @date: 2022/08/11 20:53 - */ -@Service -@AllArgsConstructor -public class AreaDeviceOnlineServiceImpl implements AreaDeviceOnlineService { - - private final GeneralDeviceInfoController generalDeviceInfoController; - - private final AreaDeviceOnlineMapper areaDeviceOnlineMapper; - - private final DeviceMapper deviceMapper; - - private final InfluxDbUtils influxDbUtils; - - @Override - public List getAreaDeviceOnline(AreaCensusParam areaCensusParam) { - List areaDeviceOnlineVOS = new ArrayList<>(); - List generalDeviceDTOS = generalDeviceInfoController.getPracticalAllDeviceInfo(areaCensusParam).getData(); - - // //区域下的所有终端id集合 - // List deviceIds = generalDeviceDTOS.stream().flatMap(dto -> dto.getDeviceIndexes().stream()).collect(Collectors.toList()); - if (!CollectionUtils.isEmpty(generalDeviceDTOS)) { - for (GeneralDeviceDTO generalDeviceDTO: generalDeviceDTOS) { - AreaDeviceOnlineVO areaDeviceOnlineVO = new AreaDeviceOnlineVO(); - List deviceIndexes = generalDeviceDTO.getDeviceIndexes(); - if (CollectionUtils.isEmpty(deviceIndexes)) { - areaDeviceOnlineVO.setAreaName(generalDeviceDTO.getName()); - areaDeviceOnlineVOS.add(areaDeviceOnlineVO); - continue; - } - areaDeviceOnlineVO.setAreaName(generalDeviceDTO.getName()); - switch (areaCensusParam.getLineLevel()) { - case 0: - // 查全部 - areaDeviceOnlineVO.setNumber(deviceIndexes.size()); - areaDeviceOnlineVO = deviceToAreaDeviceOnlineVO(deviceIndexes, areaDeviceOnlineVO, areaCensusParam); - - break; - case 1: - // 查极重要 - String firstLevel = "486927bc1c09c14f1e54a5b1757bf5c4"; - int deviceNumberFirst = getDeviceNumber(firstLevel, deviceIndexes, generalDeviceDTO.getLineIndexes()); - areaDeviceOnlineVO.setNumber(deviceNumberFirst); - areaDeviceOnlineVO = deviceToAreaDeviceOnlineVO(deviceIndexes, areaDeviceOnlineVO, areaCensusParam); - - break; - case 2: - // 查重要 - String secLevel = "eae449e73806a5c810fa2d3b01bc3e50"; - int deviceNumberSec = getDeviceNumber(secLevel, deviceIndexes, generalDeviceDTO.getLineIndexes()); - areaDeviceOnlineVO.setNumber(deviceNumberSec); - areaDeviceOnlineVO = deviceToAreaDeviceOnlineVO(deviceIndexes, areaDeviceOnlineVO, areaCensusParam); - - break; - case 3: - // 查普通 - String thiLevel = "64b4afe96e874c3c3dc634ea3ef79a21"; - int deviceNumberThi = getDeviceNumber(thiLevel, deviceIndexes, generalDeviceDTO.getLineIndexes()); - areaDeviceOnlineVO.setNumber(deviceNumberThi); - areaDeviceOnlineVO = deviceToAreaDeviceOnlineVO(deviceIndexes, areaDeviceOnlineVO, areaCensusParam); - - break; - case 4: - // 查不重要 - String fourLevel = "d3dac5ffa1daf6564e29e989e465135e"; - int deviceNumberFour = getDeviceNumber(fourLevel, deviceIndexes, generalDeviceDTO.getLineIndexes()); - areaDeviceOnlineVO.setNumber(deviceNumberFour); - areaDeviceOnlineVO = deviceToAreaDeviceOnlineVO(deviceIndexes, areaDeviceOnlineVO, areaCensusParam); - - break; - } - areaDeviceOnlineVOS.add(areaDeviceOnlineVO); - } - } - - return areaDeviceOnlineVOS; - } - - - private AreaDeviceOnlineVO deviceToAreaDeviceOnlineVO(List deviceIndexes, AreaDeviceOnlineVO areaDeviceOnlineVO, AreaCensusParam areaCensusParam) { - List devices = deviceMapper.selectBatchIds(deviceIndexes); - BiFunction, Long> integerListLongBiFunction = countDeviceRunStatus(devices); - areaDeviceOnlineVO.setNormal(integerListLongBiFunction.apply(0, deviceIndexes).intValue()); - areaDeviceOnlineVO.setBreaks(integerListLongBiFunction.apply(1, deviceIndexes).intValue()); - areaDeviceOnlineVO.setShutdown(integerListLongBiFunction.apply(2, deviceIndexes).intValue()); - double normalRate = areaDeviceOnlineVO.getNormal().doubleValue() / deviceIndexes.size() * 100; - areaDeviceOnlineVO.setNormalRate(new BigDecimal(normalRate).setScale(2, RoundingMode.HALF_UP).doubleValue()); - double breaksRate = areaDeviceOnlineVO.getBreaks().doubleValue() / deviceIndexes.size() * 100; - areaDeviceOnlineVO.setBreaksRate(new BigDecimal(breaksRate).setScale(2, RoundingMode.HALF_UP).doubleValue()); - double shutdownRate = areaDeviceOnlineVO.getShutdown().doubleValue() / deviceIndexes.size() * 100; - areaDeviceOnlineVO.setShutdownRate(new BigDecimal(shutdownRate).setScale(2, RoundingMode.HALF_UP).doubleValue()); - List onlineData = getOnlineData(deviceIndexes, areaCensusParam.getSearchBeginTime(), areaCensusParam.getSearchEndTime()); - if (!CollectionUtils.isEmpty(onlineData)) { - double avgOnline = onlineData.stream().mapToDouble(LineInfluxDbOnlineVO::getOnlineRate).sum() / onlineData.size(); - areaDeviceOnlineVO.setOnlineRate(new BigDecimal(avgOnline).setScale(2, RoundingMode.HALF_UP).doubleValue()); - } - return areaDeviceOnlineVO; - } - - - private int getDeviceNumber(String lineLevel, List deviceIndexes, List lineIndexes) { - List lineIdList = areaDeviceOnlineMapper.selectLineIdBylineLevel(lineLevel); - List result = lineIdList.stream().filter(item -> lineIndexes.contains(item)).collect(Collectors.toList()); - int i = 0; - for (String id: deviceIndexes) { - List strings = areaDeviceOnlineMapper.selectLineIds(id); - List lineIds = result.stream().filter(item -> strings.contains(item)).collect(Collectors.toList()); - if (CollectionUtils.isEmpty(lineIds)) { - ++i; - } - } - return i; - } - - /** 获取终端运行状态*/ - private BiFunction, Long> countDeviceRunStatus(List pqDeviceList) { - return (runFlag, deviceIndexes) -> pqDeviceList.stream() - .filter(t -> Objects.equals(t.getRunFlag(), runFlag)) - .filter(t -> deviceIndexes.contains(t.getId())) - .count(); - } - - /** 获取按终端分组的终端在线率*/ - public List getOnlineData(List deviceIndexes, String searchBeginTime, String searchEndTime) { - //组装sql语句 - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(searchBeginTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(searchEndTime))).append("' and "); - - for (int i = 0; i < deviceIndexes.size(); i++) { - if (deviceIndexes.size() - i != 1) { - stringBuilder.append("dev_id ='").append(deviceIndexes.get(i)).append("' or "); - } else { - stringBuilder.append("dev_id ='").append(deviceIndexes.get(i)).append("' "); - } - } - String sql = "select sum(onlinemin)/(sum(onlinemin) +sum(offlinemin))*100 as onlinerate from pqs_onlinerate where " + stringBuilder + "group by dev_id " + InfluxDBPublicParam.TIME_ZONE; - System.out.println("sql>>>>>>>>>>>>>>>>>>>>>"+sql); - //获取暂降事件 - QueryResult result = influxDbUtils.query(sql); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List lineInfluxDbOnlineVOS = influxDBResultMapper.toPOJO(result, LineInfluxDbOnlineVO.class); - return lineInfluxDbOnlineVOS; - } - - -} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/AreaIntegrityDataServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/AreaIntegrityDataServiceImpl.java deleted file mode 100644 index 98d5592a5..000000000 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/AreaIntegrityDataServiceImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.njcn.device.pq.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.njcn.device.pq.api.AlarmClient; -import com.njcn.device.pq.mapper.AreaIntegrityDataMapper; -import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO; -import com.njcn.device.pq.pojo.param.AreaIntegrityDataParam; -import com.njcn.device.pq.pojo.vo.AreaIntegrityDataVO; -import com.njcn.device.pq.service.AreaIntegrityDataService; -import com.njcn.influxdb.utils.InfluxDbUtils; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - * @author yzh - * @date 2022/9/22 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class AreaIntegrityDataServiceImpl extends ServiceImpl implements AreaIntegrityDataService { - - private final AreaIntegrityDataMapper areaIntegrityDataMapper; - - private final InfluxDbUtils influxDbUtils; - - private final AlarmClient alarmClient; - - private final GeneralDeviceService generalDeviceService; - - /** - * 获取区域数据完整性 - * - * @param areaIntegrityDataParam - * @return - */ - @Override - public List getAreaIntegrityData(AreaIntegrityDataParam areaIntegrityDataParam) { - - // TODO 获取部门id -// areaIntegrityDataParam.setDeptIndex(RequestUtil.getDeptIndex()); - - // 获取所有数据 - List generalDeviceDTOList = generalDeviceService.getDeviceInfo(areaIntegrityDataParam, Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList())); - - - - return null; - } -} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/AreaIntegrityServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/AreaIntegrityServiceImpl.java deleted file mode 100644 index 32b8e75e6..000000000 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/AreaIntegrityServiceImpl.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.njcn.device.pq.service.impl; - -import cn.hutool.core.date.DateUtil; -import com.njcn.device.pq.controller.GeneralDeviceInfoController; -import com.njcn.device.pq.mapper.AreaDeviceOnlineMapper; -import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO; -import com.njcn.device.pq.pojo.param.AreaCensusParam; -import com.njcn.device.pq.pojo.param.DeviceInfoParam; -import com.njcn.device.pq.pojo.vo.AreaIntegrityVO; -import com.njcn.device.pq.pojo.vo.LineInfluxDbInegrityVO; -import com.njcn.device.pq.service.AreaIntegrityService; -import com.njcn.influxdb.param.InfluxDBPublicParam; -import com.njcn.influxdb.utils.InfluxDbUtils; -import lombok.AllArgsConstructor; -import org.influxdb.dto.QueryResult; -import org.influxdb.impl.InfluxDBResultMapper; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @version 1.0.0 - * @author: chenchao - * @date: 2022/08/15 15:53 - */ -@Service -@AllArgsConstructor -public class AreaIntegrityServiceImpl implements AreaIntegrityService { - - private final GeneralDeviceInfoController generalDeviceInfoController; - - private final AreaDeviceOnlineMapper areaDeviceOnlineMapper; - - private final InfluxDbUtils influxDbUtils; - - @Override - public List getAreaIntegrity(AreaCensusParam areaCensusParam) { - List areaIntegrityVOS = new ArrayList<>(); - List generalDeviceDTOS = generalDeviceInfoController.getPracticalAllDeviceInfo(areaCensusParam).getData(); - if (!CollectionUtils.isEmpty(generalDeviceDTOS)) { - for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOS) { - AreaIntegrityVO areaIntegrityVO = new AreaIntegrityVO(); - List lineIndexes = generalDeviceDTO.getLineIndexes(); - if (CollectionUtils.isEmpty(lineIndexes)) { - areaIntegrityVO.setAreaName(generalDeviceDTO.getName()); - areaIntegrityVOS.add(areaIntegrityVO); - continue; - } - areaIntegrityVO.setAreaName(generalDeviceDTO.getName()); - switch (areaCensusParam.getLineLevel()) { - case 0: - // 查全部 - areaIntegrityVO.setNumber(lineIndexes.size()); - areaIntegrityVO = lineIdsToAreaOnlineVO(lineIndexes, areaIntegrityVO, areaCensusParam); - areaIntegrityVOS.add(areaIntegrityVO); - - break; - case 1: - // 查极重要 - String firstLevel = "486927bc1c09c14f1e54a5b1757bf5c4"; - List firstLineIdList = areaDeviceOnlineMapper.selectLineIdBylineLevel(firstLevel); - List firstResult = firstLineIdList.stream().filter(item -> lineIndexes.contains(item)).collect(Collectors.toList()); - areaIntegrityVO.setNumber(firstResult.size()); - areaIntegrityVO = lineIdsToAreaOnlineVO(lineIndexes, areaIntegrityVO, areaCensusParam); - areaIntegrityVOS.add(areaIntegrityVO); - - break; - case 2: - // 查重要 - String secLevel = "eae449e73806a5c810fa2d3b01bc3e50"; - List secLineIdList = areaDeviceOnlineMapper.selectLineIdBylineLevel(secLevel); - List secResult = secLineIdList.stream().filter(item -> lineIndexes.contains(item)).collect(Collectors.toList()); - areaIntegrityVO.setNumber(secResult.size()); - areaIntegrityVO = lineIdsToAreaOnlineVO(lineIndexes, areaIntegrityVO, areaCensusParam); - areaIntegrityVOS.add(areaIntegrityVO); - - break; - case 3: - // 查普通 - String thiLevel = "64b4afe96e874c3c3dc634ea3ef79a21"; - List thiLineIdList = areaDeviceOnlineMapper.selectLineIdBylineLevel(thiLevel); - List thiResult = thiLineIdList.stream().filter(item -> lineIndexes.contains(item)).collect(Collectors.toList()); - areaIntegrityVO.setNumber(thiResult.size()); - areaIntegrityVO = lineIdsToAreaOnlineVO(lineIndexes, areaIntegrityVO, areaCensusParam); - areaIntegrityVOS.add(areaIntegrityVO); - - break; - case 4: - // 查不重要 - String fourLevel = "d3dac5ffa1daf6564e29e989e465135e"; - List fourLineIdList = areaDeviceOnlineMapper.selectLineIdBylineLevel(fourLevel); - List fourResult = fourLineIdList.stream().filter(item -> lineIndexes.contains(item)).collect(Collectors.toList()); - areaIntegrityVO.setNumber(fourResult.size()); - areaIntegrityVO = lineIdsToAreaOnlineVO(lineIndexes, areaIntegrityVO, areaCensusParam); - areaIntegrityVOS.add(areaIntegrityVO); - - break; - } - - areaIntegrityVO.setAreaName(generalDeviceDTO.getName()); - } - } - return areaIntegrityVOS; - } - - private AreaIntegrityVO lineIdsToAreaOnlineVO(List lineIndexes, AreaIntegrityVO areaIntegrityVO, AreaCensusParam areaCensusParam) { - List integrityData = getIntegrityData(lineIndexes, areaCensusParam); - if (!CollectionUtils.isEmpty(integrityData)) { - double avgIntegrity = integrityData.stream().mapToDouble(LineInfluxDbInegrityVO::getIntegrity).sum() / integrityData.size(); - areaIntegrityVO.setIntegrity(new BigDecimal(avgIntegrity).setScale(2, RoundingMode.HALF_UP).doubleValue()); - } - return areaIntegrityVO; - } - - /** 获取按监测点分组的数据完整性*/ - public List getIntegrityData(List lineIndexes, DeviceInfoParam.BusinessParam deviceInfoParam) { - //组装sql语句 - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))).append("' and "); - for (int i = 0; i < lineIndexes.size(); i++) { - if (lineIndexes.size() - i != 1) { - stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' or "); - } else { - stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' "); - } - } - String sql = "select sum(real)/(sum(due))*100 as integrity from pqs_integrity where " + stringBuilder + "group by line_id " + InfluxDBPublicParam.TIME_ZONE; - //获取暂降事件 - QueryResult result = influxDbUtils.query(sql); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List eventDetailList = influxDBResultMapper.toPOJO(result, LineInfluxDbInegrityVO.class); - return eventDetailList; - } - - -} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/CommunicateServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/CommunicateServiceImpl.java index 2b34ab8d2..9ec2b21ff 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/CommunicateServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/CommunicateServiceImpl.java @@ -11,7 +11,6 @@ import com.njcn.device.pq.pojo.vo.*; import com.njcn.device.pq.service.CommunicateService; import com.njcn.device.pq.service.LineService; import com.njcn.device.pq.utils.PublicDateUtil; -import com.njcn.influxdb.utils.InfluxDbUtils; import lombok.AllArgsConstructor; import lombok.SneakyThrows; import org.apache.commons.lang.StringUtils; @@ -33,9 +32,8 @@ public class CommunicateServiceImpl implements CommunicateService { private final LineService lineService; - private final InfluxDbUtils influxDbUtils; - private final RStatOnlinerateDMapper onlinerateDMapper; + private final RStatIntegrityDMapper integrityDMapper; @Override @@ -166,37 +164,6 @@ public class CommunicateServiceImpl implements CommunicateService { } } return resultList[0]; - -// -// //组装sql语句 -// StringBuilder stringBuilder = new StringBuilder(); -// stringBuilder.append(TIME + " >= '").append(startTime).append(START_TIME).append("' and ").append(TIME).append(" <= '").append(endTime).append(END_TIME).append("' and ("); -// //sql语句 -// String sql = ""; -// if (state == 0) { -// stringBuilder.append(LINE_ID + "='").append(lineList).append("')"); -// sql = "SELECT SUM(" + REAL + ")/SUM(" + DUE + ") AS integrity FROM pqs_integrity WHERE " + stringBuilder.toString() + " group by " + LINE_ID + " tz('Asia/Shanghai')"; -// } else { -// stringBuilder.append(DEV_INDEX + "='").append(lineList).append("')"); -// sql = "SELECT SUM(" + ONLINE_MIN + ")/(SUM(" + OFFLINE_MIN + ")+SUM(" + ONLINE_MIN + ")) AS onlineRate FROM pqs_onlinerate WHERE " + stringBuilder.toString() + " group by " + DEV_INDEX + " tz('Asia/Shanghai')"; -// } -// //结果集 -// QueryResult result = influxDbUtils.query(sql); -// //处理结果集 -// List list = result.getResults().get(0).getSeries(); -// if (!CollectionUtils.isEmpty(list)) { -// list.forEach(po -> { -// List> valueList = po.getValues(); -// if (!CollectionUtils.isEmpty(valueList)) { -// for (List value : valueList) { -// //数据完整性 保留四位小数 -// resultList[0] = value.get(1) == null ? null : BigDecimal.valueOf(Float.parseFloat(value.get(1).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue(); -// } -// } -// }); -// } -// -// return resultList[0]; } /** diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeviceOnlineDataServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeviceOnlineDataServiceImpl.java deleted file mode 100644 index 93ce6d792..000000000 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeviceOnlineDataServiceImpl.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.njcn.device.pq.service.impl; - -import com.njcn.device.pq.mapper.DeviceOnlineDataMapper; -import com.njcn.device.pq.pojo.dto.DeviceOnlineDataDTO; -import com.njcn.device.pq.pojo.param.TabCensusParam; -import com.njcn.device.pq.pojo.po.TopMsg; -import com.njcn.device.pq.pojo.vo.DeviceOnlineTabVO; -import com.njcn.device.pq.pojo.vo.LineInfluxDbOnlineVO; -import com.njcn.device.pq.service.DeviceOnlineDataService; -import com.njcn.influxdb.param.InfluxDBPublicParam; -import com.njcn.influxdb.utils.InfluxDbUtils; -import lombok.AllArgsConstructor; -import org.influxdb.dto.QueryResult; -import org.influxdb.impl.InfluxDBResultMapper; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * @version 1.0.0 - * @author: chenchao - * @date: 2022/08/16 14:55 - */ -@Service -@AllArgsConstructor -public class DeviceOnlineDataServiceImpl implements DeviceOnlineDataService { - - private final DeviceOnlineDataMapper deviceOnlineDataMapper; - - private final InfluxDbUtils influxDbUtils; - - private final AreaDeviceOnlineServiceImpl areaDeviceOnlineService; - - @Override - public List getDeviceOnlineData(TabCensusParam tabCensusParam) { - List deviceOnlineTabVOS = new ArrayList<>(); - - List topMsg = getTopMsg(tabCensusParam.getSearchBeginTime(), tabCensusParam.getSearchEndTime()); - if (!CollectionUtils.isEmpty(topMsg)) { - List deviceIds = topMsg.stream().map(TopMsg::getDeviceId).collect(Collectors.toList()); - List onlineData = areaDeviceOnlineService.getOnlineData(deviceIds, tabCensusParam.getSearchBeginTime(), tabCensusParam.getSearchEndTime()); - if (!CollectionUtils.isEmpty(onlineData)) { - for (LineInfluxDbOnlineVO onlineVO: onlineData) { - onlineVO.setOnlineRate(new BigDecimal(onlineVO.getOnlineRate()).setScale(2, RoundingMode.HALF_UP).doubleValue()); - } - Integer qualify = tabCensusParam.getQualify(); - if (qualify==1) { - onlineData = onlineData.stream().filter(item -> item.getOnlineRate() < 95).collect(Collectors.toList()); - } if (qualify==2) { - onlineData = onlineData.stream().filter(item -> item.getOnlineRate() >= 95).collect(Collectors.toList()); - } - List devIndexes = onlineData.stream().map(LineInfluxDbOnlineVO::getDevIndex).collect(Collectors.toList()); - - List devIndexesByLevel = getDevIndexesByLevel(devIndexes, tabCensusParam.getLevel()); - topMsg = topMsg.stream().filter(item -> devIndexesByLevel.contains(item.getDeviceId())).collect(Collectors.toList()); - if (!CollectionUtils.isEmpty(topMsg)) { - List deviceFatherData = deviceOnlineDataMapper.getDeviceFatherData(devIndexesByLevel); - for (TopMsg msg: topMsg) { - DeviceOnlineTabVO deviceOnlineTabVO = new DeviceOnlineTabVO(); - DeviceOnlineTabVO tabVO = deviceFatherData.stream().filter(item -> item.getDeviceId().equals(msg.getDeviceId())).collect(Collectors.toList()).get(0); - BeanUtils.copyProperties(tabVO, deviceOnlineTabVO); - deviceOnlineTabVO.setDeviceId(msg.getDeviceId()); - deviceOnlineTabVO.setComOutNumber(msg.getComOutNum()); - Double onlineRate = onlineData.stream().filter(item -> item.getDevIndex().equals(msg.getDeviceId())).collect(Collectors.toList()).get(0).getOnlineRate(); - deviceOnlineTabVO.setOnlineRate(onlineRate); - switch (tabCensusParam.getLevel()) { - case 0: - DeviceOnlineDataDTO minDeviceLevelById = deviceOnlineDataMapper.getMinDeviceLevelById(msg.getDeviceId()); - deviceOnlineTabVO.setLevel(minDeviceLevelById.getLevelName()); - break; - case 1: - deviceOnlineTabVO.setLevel("极重要"); - break; - case 2: - deviceOnlineTabVO.setLevel("重要"); - break; - case 3: - deviceOnlineTabVO.setLevel("普通"); - break; - case 4: - deviceOnlineTabVO.setLevel("不重要"); - break; - } - deviceOnlineTabVOS.add(deviceOnlineTabVO); - } - - } - - } - - } - - return deviceOnlineTabVOS; - } - - - /**通过监测点等级获取终端集合 */ - public List getDevIndexesByLevel(List deviceIds, Integer level) { - switch (level) { - case 0: - return deviceIds; - case 1: - List minDeviceLevelOne = deviceOnlineDataMapper.getMinDeviceLevel(deviceIds); - List collectListOne = minDeviceLevelOne.stream().filter(item -> item.getLineGrade().equals("486927bc1c09c14f1e54a5b1757bf5c4")).collect(Collectors.toList()); - deviceIds = collectListOne.stream().map(DeviceOnlineDataDTO::getDeviceId).distinct().collect(Collectors.toList()); - return deviceIds; - case 2: - List minDeviceLevelTwo = deviceOnlineDataMapper.getMinDeviceLevel(deviceIds); - List collectListTwo = minDeviceLevelTwo.stream().filter(item -> item.getLineGrade().equals("eae449e73806a5c810fa2d3b01bc3e50")).collect(Collectors.toList()); - deviceIds = collectListTwo.stream().map(DeviceOnlineDataDTO::getDeviceId).collect(Collectors.toList()); - return deviceIds; - case 3: - List minDeviceLevelThr = deviceOnlineDataMapper.getMinDeviceLevel(deviceIds); - List collectListThr = minDeviceLevelThr.stream().filter(item -> item.getLineGrade().equals("64b4afe96e874c3c3dc634ea3ef79a21")).collect(Collectors.toList()); - deviceIds = collectListThr.stream().map(DeviceOnlineDataDTO::getDeviceId).collect(Collectors.toList()); - return deviceIds; - case 4: - List minDeviceLevelFour = deviceOnlineDataMapper.getMinDeviceLevel(deviceIds); - List collectListFour = minDeviceLevelFour.stream().filter(item -> item.getLineGrade().equals("d3dac5ffa1daf6564e29e989e465135e")).collect(Collectors.toList()); - deviceIds = collectListFour.stream().map(DeviceOnlineDataDTO::getDeviceId).collect(Collectors.toList()); - return deviceIds; - } - - return null; - } - - - - /**查询按终端分组的中断次数 */ - private List getTopMsg(String startTime, String endTime) { - //组装sql语句 - StringBuilder string = new StringBuilder(); - string.append(InfluxDBPublicParam.TIME + " >= '" + startTime + InfluxDBPublicParam.START_TIME + "' and " + InfluxDBPublicParam.TIME + " <= '" + endTime + InfluxDBPublicParam.END_TIME + "'"); - //sql语句 - String sql = "SELECT sum(com_out_num) as com_out_num FROM pqs_top_msg WHERE " + string + " group by dev_id " + InfluxDBPublicParam.TIME_ZONE ; - //结果集 - QueryResult results = influxDbUtils.query(sql); - //结果集映射到对象中 - InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); - List topMsgList = resultMapper.toPOJO(results, TopMsg.class); - - return topMsgList; - } - - -} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeviceRunExceptionServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeviceRunExceptionServiceImpl.java deleted file mode 100644 index bbd06a561..000000000 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/DeviceRunExceptionServiceImpl.java +++ /dev/null @@ -1,331 +0,0 @@ -package com.njcn.device.pq.service.impl; - -import cn.hutool.core.collection.CollectionUtil; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.njcn.device.pq.mapper.DeviceRunExceptionMapper; -import com.njcn.device.pq.pojo.param.DeviceRunExceptionParam; -import com.njcn.device.pq.pojo.po.DeviceRunException; -import com.njcn.device.pq.pojo.vo.DeviceRunExceptionVO; -import com.njcn.device.pq.service.DeviceRunExceptionService; -import com.njcn.device.pq.utils.SpiltDateUtil; -import com.njcn.influxdb.param.InfluxDBPublicParam; -import com.njcn.influxdb.utils.InfluxDBCommUtils; -import com.njcn.influxdb.utils.InfluxDbUtils; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.influxdb.dto.QueryResult; -import org.influxdb.impl.InfluxDBResultMapper; -import org.springframework.stereotype.Service; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.stream.Collectors; - -/** - * 终端异常统计业务层实现类 - * - * @author yzh - * @date 2022/9/27 - */ - -@Slf4j -@Service -@RequiredArgsConstructor -public class DeviceRunExceptionServiceImpl extends ServiceImpl implements DeviceRunExceptionService { - - private final DeviceRunExceptionMapper deviceRunExceptionMapper; - - private final InfluxDbUtils influxDbUtils; - - /** - * 终端异常统计 - * - * @param deviceRunExceptionParam 全段参数 - * @return - */ - @Override - public List getDeviceRunException(DeviceRunExceptionParam deviceRunExceptionParam) { - // 创建集合,用于返回数据 - List deviceRunExceptionList = new ArrayList<>(); - // 获取终端等级信息 - List deviceLevelData = deviceRunExceptionMapper.getDeviceLevelData(deviceRunExceptionParam.getSearchBeginTime(), deviceRunExceptionParam.getSearchEndTime()); - // 判断终端等级 - judgeDeviceLevel(deviceLevelData, deviceRunExceptionParam.getAlgoDescribe()); - // 查询influxdb数据库 - List pqsTopMsg = getPqsTopMsg(deviceRunExceptionParam, deviceLevelData); - - // 根据前端传入的时间区间选择不同的返回结果 - switch (deviceRunExceptionParam.getTimeFlag()) { - // 年或季 - case 0: - try { - // 将时间段按照月分割 - List ranges = SpiltDateUtil.splitToMonths(deviceRunExceptionParam.getSearchBeginTime(), deviceRunExceptionParam.getSearchEndTime()); - // 数据处理(年或季) - deviceRunExceptionList = getData(pqsTopMsg, ranges, deviceRunExceptionParam); - - } catch (ParseException e) { - e.printStackTrace(); - } - break; - - // 月或周或自定义 - case 1: - try { - // 时间段中的每个日期 - List dates = findDates(deviceRunExceptionParam.getSearchBeginTime(), deviceRunExceptionParam.getSearchEndTime()); - // 数据处理(月或周) - deviceRunExceptionList = getData(pqsTopMsg, dates); - deviceRunExceptionList = deviceRunExceptionList.stream().peek(deviceRunExceptionVO -> deviceRunExceptionVO.setAlgoDescribe(deviceRunExceptionParam.getAlgoDescribe())).collect(Collectors.toList()); - - } catch (ParseException e) { - e.printStackTrace(); - } - break; - - default: - break; - } - return deviceRunExceptionList; - } - - /** - * 数据处理(月或周) - * - * @param pqsTopMsg influxdb中数据 - * @param dates 时间段中的每个日期 - * @return - */ - private List getData(List pqsTopMsg, List dates) { - List deviceRunExceptionList = new ArrayList<>(); - // 将influxdb中的数据根据时间进行分类 - Map> groupByTime = pqsTopMsg.stream().collect(Collectors.groupingBy(DeviceRunException::getTime)); - // 将map集合中的key取出 - Set times = groupByTime.keySet(); - - for (String date : dates) { - // 创建对象用于封装数据 - DeviceRunExceptionVO deviceRunExceptionVO = new DeviceRunExceptionVO(); - - if (CollectionUtil.isNotEmpty(groupByTime)) { - // 遍历时间key - for (String time : times) { - - // 创建变量,用于统计当前时间的异常次数 - int sumDeviceRunException = 0; - - // 将key对应的值取出 - List deviceRunExceptions = groupByTime.get(time); - // 变量值的集合 - for (DeviceRunException deviceRunException : deviceRunExceptions) { - // 计算当前时间的异常次数 - sumDeviceRunException += deviceRunException.getAlarmNum() + deviceRunException.getComOutNum(); - } - if (date.equals(time)) { - if (sumDeviceRunException == 0) { - deviceRunExceptionVO.setDeviceRunExceptionFrequency(3.14159); - } else { - deviceRunExceptionVO.setDeviceRunExceptionFrequency((double) sumDeviceRunException); - } - } - } - deviceRunExceptionVO.setDay(date); - deviceRunExceptionList.add(deviceRunExceptionVO); - }else { - deviceRunExceptionVO.setDay(date); - deviceRunExceptionVO.setDeviceRunExceptionFrequency(3.14159); - deviceRunExceptionList.add(deviceRunExceptionVO); - } - } - return deviceRunExceptionList; - } - - /** - * 数据处理(年或季) - * - * @param pqsTopMsg influxdb中数据 - * @param ranges 分割后的月份 - * @param deviceRunExceptionParam 前端参数 - * @return - * @throws ParseException - */ - private List getData - (List pqsTopMsg, List ranges, DeviceRunExceptionParam - deviceRunExceptionParam) throws ParseException { - // 获取年份 - String years = SpiltDateUtil.getYears(deviceRunExceptionParam.getSearchBeginTime(), deviceRunExceptionParam.getSearchEndTime()); - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - List deviceRunExceptionList = new ArrayList<>(); - // 将influxdb中的数据根据时间进行分类 - Map> groupByTime = pqsTopMsg.stream().collect(Collectors.groupingBy(DeviceRunException::getTime)); - // 将map集合中的key取出 - Set times = groupByTime.keySet(); - - // 遍历时间key - for (SpiltDateUtil.Range range : ranges) { - int sumDeviceRunException = 0; - // 创建变量,用于统计当前时间的异常次数 - DeviceRunExceptionVO deviceRunExceptionVO = new DeviceRunExceptionVO(); - for (String time : times) { - long compareTime = sdf.parse(time).getTime(); - long startTime = range.getStart().getTime(); - long endTime = range.getEnd().getTime(); - if (compareTime >= startTime && compareTime <= endTime) { - // 将key对应的值取出 - List deviceRunExceptions = groupByTime.get(time); - // 变量值的集合 - for (DeviceRunException deviceRunException : deviceRunExceptions) { - // 计算当前时间的异常次数 - sumDeviceRunException += deviceRunException.getAlarmNum() + deviceRunException.getComOutNum(); - } - - } - - } - if (sumDeviceRunException == 0) { - deviceRunExceptionVO.setDeviceRunExceptionFrequency(3.14159); - } else { - deviceRunExceptionVO.setDeviceRunExceptionFrequency((double) sumDeviceRunException); - } - deviceRunExceptionVO.setAlgoDescribe(deviceRunExceptionParam.getAlgoDescribe()); - deviceRunExceptionVO.setMonth(range.getMonth()); - deviceRunExceptionVO.setYear(years); - deviceRunExceptionList.add(deviceRunExceptionVO); - } - - return deviceRunExceptionList; - } - - /** - * 判断终端等级 - * - * @param deviceLevelData 终端等级信息集合 - * @param algoDescribe 前端传入终端等级 - */ - private void judgeDeviceLevel(List deviceLevelData, Integer algoDescribe) { - if (algoDescribe != null) { - switch (algoDescribe) { - // 极重要 - case 0: - deviceLevelData = deviceLevelData.stream().filter(dev -> dev.getAlgoDescribe() != null && dev.getAlgoDescribe() == 0).collect(Collectors.toList()); - break; - // 重要 - case 1: - deviceLevelData = deviceLevelData.stream().filter(dev -> dev.getAlgoDescribe() != null && dev.getAlgoDescribe() == 1).collect(Collectors.toList()); - break; - // 普通 - case 2: - deviceLevelData = deviceLevelData.stream().filter(dev -> dev.getAlgoDescribe() != null && dev.getAlgoDescribe() == 2).collect(Collectors.toList()); - break; - //不重要 - case 3: - deviceLevelData = deviceLevelData.stream().filter(dev -> dev.getAlgoDescribe() != null && dev.getAlgoDescribe() == 3).collect(Collectors.toList()); - break; - default: - break; - } - } - } - - /** - * 解析时间 - * - * @param time - * @return - */ - private String dateFormat(String time) { - String dateString = null; - try { - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - // String -> Date - Date date = dateFormat.parse(time); - // Date -> String - dateString = dateFormat.format(date); - } catch (ParseException e) { - e.printStackTrace(); - } - return dateString; - } - - /** - * 查询influxdb数据 - * - * @param deviceRunExceptionParam - * @param deviceLevelData - * @return - */ - private List getPqsTopMsg(DeviceRunExceptionParam - deviceRunExceptionParam, List deviceLevelData) { - // 获取终端id - List devId = deviceLevelData.stream().map(DeviceRunExceptionVO::getDevId).collect(Collectors.toList()); - - List deviceRunExceptions = new ArrayList<>(); - - if (CollectionUtil.isNotEmpty(devId)) { - // 将终端id - StringBuilder lineIdsForInfluxdb = InfluxDBCommUtils.assToInfluxParam(devId); - // 组装sql语句 - StringBuilder queryCriteria = new StringBuilder(); - // 构造sql查询条件 - queryCriteria.append(lineIdsForInfluxdb) - .append(" and ") - .append(InfluxDBPublicParam.TIME) - .append(" >= '") - .append(deviceRunExceptionParam.getSearchBeginTime()) - .append(InfluxDBPublicParam.START_TIME) - .append("' and ") - .append(InfluxDBPublicParam.TIME) - .append(" <= '") - .append(deviceRunExceptionParam.getSearchEndTime()) - .append(InfluxDBPublicParam.END_TIME) - .append("' ") - .append(InfluxDBPublicParam.TIME_ZONE); - //sql语句 - - String sql = "SELECT * FROM \"pqs_top_msg\" WHERE " + queryCriteria; - // 结果集 - QueryResult results = influxDbUtils.query(sql); - // 结果集映射到对象中 - InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); - deviceRunExceptions = resultMapper.toPOJO(results, DeviceRunException.class); - } - - // 返回结果 - return deviceRunExceptions; - - } - - /** - * 传入两个时间范围,返回这两个时间范围内的所有时间,并保存在一个集合中 - * - * @param beginTime - * @param endTime - * @return - * @throws ParseException - */ - public static List findDates(String beginTime, String endTime) throws ParseException { - List allDate = new ArrayList(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - - Date dBegin = sdf.parse(beginTime); - Date dEnd = sdf.parse(endTime); - allDate.add(sdf.format(dBegin)); - Calendar calBegin = Calendar.getInstance(); - // 使用给定的 Date 设置此 Calendar 的时间 - calBegin.setTime(dBegin); - Calendar calEnd = Calendar.getInstance(); - // 使用给定的 Date 设置此 Calendar 的时间 - calEnd.setTime(dEnd); - // 测试此日期是否在指定日期之后 - while (dEnd.after(calBegin.getTime())) { - // 根据日历的规则,为给定的日历字段添加或减去指定的时间量 - calBegin.add(Calendar.DAY_OF_MONTH, 1); - allDate.add(sdf.format(calBegin.getTime())); - } - System.out.println("时间==" + allDate); - return allDate; - } - -} diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineIntegrityDataServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineIntegrityDataServiceImpl.java index 489033031..ee2e3ffdb 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineIntegrityDataServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineIntegrityDataServiceImpl.java @@ -25,8 +25,6 @@ import com.njcn.device.pq.pojo.vo.RStatIntegrityVO; import com.njcn.device.pq.service.LineIntegrityDataService; import com.njcn.device.pq.utils.DataStatisticsUtil; import com.njcn.harmonic.pojo.vo.IntegrityIconVO; -import com.njcn.influxdb.param.InfluxDBPublicParam; -import com.njcn.influxdb.utils.InfluxDbUtils; import com.njcn.system.pojo.enums.StatisticsEnum; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -56,8 +54,6 @@ public class LineIntegrityDataServiceImpl extends ServiceImpl getPercentageOfCompleteData(String startTime, String endTime, StringBuilder lineIdsForInfluxdb) { - - //组装sql语句 - StringBuilder queryCriteria = new StringBuilder(); - // 构造sql查询条件 - queryCriteria.append(lineIdsForInfluxdb) - .append(" and ") - .append(InfluxDBPublicParam.TIME) - .append(" >= '") - .append(startTime) - .append(InfluxDBPublicParam.START_TIME) - .append("' and ") - .append(InfluxDBPublicParam.TIME) - .append(" <= '") - .append(endTime) - .append(InfluxDBPublicParam.END_TIME) - .append("'"); - //sql语句 - String sql = "SELECT sum(real)/sum(due) as integrityData FROM pqs_integrity WHERE " + queryCriteria + " group by line_id " + InfluxDBPublicParam.TIME_ZONE; - // 结果集 - QueryResult results = influxDbUtils.query(sql); - // 结果集映射到对象中 - InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); - // 返回结果 - return resultMapper.toPOJO(results, LineDataIntegrity.class); - } - } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineServiceImpl.java index 911a355f6..9f5e27840 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineServiceImpl.java @@ -28,9 +28,10 @@ import com.njcn.device.pq.pojo.po.*; import com.njcn.device.pq.pojo.vo.*; import com.njcn.device.pq.mapper.*; import com.njcn.device.pq.service.LineService; -import com.njcn.device.pq.utils.PublicDateUtil; -import com.njcn.influxdb.param.InfluxDBPublicParam; -import com.njcn.influxdb.utils.InfluxDbUtils; +import com.njcn.influx.constant.InfluxDbSqlConstant; +import com.njcn.influx.imapper.PqsCommunicateMapper; +import com.njcn.influx.pojo.po.PqsCommunicate; +import com.njcn.influx.query.InfluxQueryWrapper; import com.njcn.system.api.AreaFeignClient; import com.njcn.system.api.DicDataFeignClient; import com.njcn.web.pojo.vo.LineDataVO; @@ -39,17 +40,12 @@ import com.njcn.web.utils.RequestUtil; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; -import org.influxdb.dto.QueryResult; -import org.influxdb.impl.InfluxDBResultMapper; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import java.math.BigDecimal; -import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.time.Instant; import java.util.*; -import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -82,11 +78,9 @@ public class LineServiceImpl extends ServiceImpl implements Li private final LineMapper lineMapper; - private final InfluxDbUtils influxDbUtils; - private final TopMsgMapper topMsgMapper; -// private final PqsCommunicateService pqsCommunicateService; + private final PqsCommunicateMapper pqsCommunicateMapper; @Override public LineDetailDataVO getLineDetailData(String id) { @@ -172,15 +166,14 @@ public class LineServiceImpl extends ServiceImpl implements Li public CommunicateVO getComFlagInfoData(String id, String searchBeginTime, String searchEndTime) { String devId = lineMapper.getDevIndex(id); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - List communicateList = getCommunicate(devId, searchBeginTime, searchEndTime); - + List communicateList = getCommunicate(devId, searchBeginTime, searchEndTime); CommunicateVO communicateVOList = new CommunicateVO(); List updateTime = new ArrayList<>(); List comType = new ArrayList<>(); //开始时间 Boolean beginFly =false; if(CollUtil.isNotEmpty(communicateList)){ - if(!communicateList.get(0).getUpdateTime().equals(DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toInstant())){ + if(!communicateList.get(0).getTime().equals(DateUtil.beginOfDay(DateUtil.parse(searchBeginTime)).toInstant())){ beginFly =true; } }else{ @@ -203,9 +196,9 @@ public class LineServiceImpl extends ServiceImpl implements Li } } - for (Communicate communicate : communicateList) { + for (PqsCommunicate communicate : communicateList) { //转化时间 - Instant now = communicate.getUpdateTime(); + Instant now = communicate.getTime(); Long time = now.toEpochMilli(); String timeText = df.format(time); updateTime.add(timeText); @@ -219,7 +212,7 @@ public class LineServiceImpl extends ServiceImpl implements Li Boolean endFly =false; if(CollUtil.isNotEmpty(communicateList)){ - if(!communicateList.get(communicateList.size()-1).getUpdateTime().equals(endTime)){ + if(!communicateList.get(communicateList.size()-1).getTime().equals(endTime)){ endFly =true; } }else{ @@ -467,185 +460,11 @@ public class LineServiceImpl extends ServiceImpl implements Li return topMsgDetails; } - @Override - public List getDeviceRunStatistics(DeviceInfoParam.BusinessParam deviceInfoParam) { - ArrayList lineFlowMealDetailList = new ArrayList<>(); - List deviceInfoList = generalDeviceService.getDeviceInfo(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList())); - for (GeneralDeviceDTO generalDeviceDTO : deviceInfoList) { - List lineIndexes = generalDeviceDTO.getLineIndexes(); - List deviceIndexes = generalDeviceDTO.getDeviceIndexes(); - if (CollectionUtils.isEmpty(deviceIndexes)) { - continue; - } - LineFlowMealDetailVO lineFlowMealDetailVO = new LineFlowMealDetailVO(); - lineFlowMealDetailVO.setId(generalDeviceDTO.getIndex()); - lineFlowMealDetailVO.setName(generalDeviceDTO.getName()); - lineFlowMealDetailVO.setLevel(1); - //组装父级数据树 - List treeList = getFlowTreeData(lineIndexes, deviceIndexes, deviceInfoParam); - lineFlowMealDetailVO.setChildren(treeList); - lineFlowMealDetailList.add(lineFlowMealDetailVO); - - } - - return lineFlowMealDetailList; - } - - @Override - public List getLineRunStatistics(DeviceInfoParam.BusinessParam deviceInfoParam) { - List lineFlowMealDetailList = new ArrayList<>(); - List generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList())); - for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) { - List lineIndexes = generalDeviceDTO.getLineIndexes(); - List devIndexs = generalDeviceDTO.getDeviceIndexes(); - if (CollectionUtils.isEmpty(lineIndexes)) { - continue; - } - LineFlowMealDetailVO lineFlowMealDetailVO = new LineFlowMealDetailVO(); - lineFlowMealDetailVO.setId(generalDeviceDTO.getIndex()); - lineFlowMealDetailVO.setName(generalDeviceDTO.getName()); - lineFlowMealDetailVO.setLevel(1); - //组装父级数据树 - List treeList = getFlowTreeData(lineIndexes, devIndexs, deviceInfoParam); - lineFlowMealDetailVO.setChildren(treeList); - lineFlowMealDetailList.add(lineFlowMealDetailVO); - } - return lineFlowMealDetailList; - } - - - - @Override - public LineStaticsViewVO getLineStaticsView(String startTime, String endTime, String lineId) { - //根据监测点id获取终端id - String devIndex = lineMapper.getDevIndex(lineId); - //获取在线率 - List onlineRateValue = getDevOnline(devIndex, startTime, endTime); - //获取数据完整性 - List integrityValue = getInegrity(lineId, startTime, endTime); - //获取流量占比 - List flowMealValue = new ArrayList<>(); - //组装 - LineStaticsViewVO lineStaticsViewVO = new LineStaticsViewVO(); - lineStaticsViewVO.setOnlineRateValue(onlineRateValue); - lineStaticsViewVO.setIntegrityValue(integrityValue); - lineStaticsViewVO.setFlowMealValue(flowMealValue); - - return lineStaticsViewVO; - } - @Override public List getOverLimitByList(PollutionParamDTO pollutionParamDTO) { return overlimitMapper.selectBatchIds(pollutionParamDTO.getLineList()); } - /** - * 获取父级每层数据 - */ - private List getFlowTreeData(List lineIndexes, List devIndexs, DeviceInfoParam.BusinessParam deviceInfoParam) { - // 在线率(设备) - List lineInfluxDbOnlineVO = getOnlineData(devIndexs, deviceInfoParam); - // 数据完整性(监测点) - List lineInfluxDbInegrityVO = getInegrityData(lineIndexes, deviceInfoParam); - // 监测点运行统计 - List monitorList = lineMapper.getLineRunStatistics(lineIndexes, DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())), DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))); - // List monitorList = lineMapper.getDeviceRunStatistics(devIndexs, DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())), DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))); - for (LineFlowMealDetailVO lineFlowMealDetailVO : monitorList) { - for (LineInfluxDbInegrityVO lineInfluxDbInegrity : lineInfluxDbInegrityVO) { - if (lineFlowMealDetailVO.getId().equals(lineInfluxDbInegrity.getLineId())) { - lineFlowMealDetailVO.setDue(lineInfluxDbInegrity.getDue()); - lineFlowMealDetailVO.setReal(lineInfluxDbInegrity.getReal()); - } else { - lineFlowMealDetailVO.setDue(1440); - lineFlowMealDetailVO.setReal(1440); - } - } - } - // 母线集合 - List busBarList = lineMapper.getFlowLineInfoByTableList(monitorList.stream().map(LineFlowMealDetailVO::getPid).distinct().collect(Collectors.toList())); - // 终端集合 - List deviceList = lineMapper.getFlowLineRunStatistics(busBarList.stream().map(LineFlowMealDetailVO::getPid).distinct().collect(Collectors.toList()), DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())), DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))); - for (LineFlowMealDetailVO lineFlowMealDetailVO : deviceList) { - int deviceDue=0,deviceReal=0; - Float staticsValue = getStatisValueFlow(lineFlowMealDetailVO.getId(), deviceInfoParam); - BigDecimal b = new BigDecimal(staticsValue); - float f1 = b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue(); - lineFlowMealDetailVO.setStatisValue(f1); - BigDecimal flow = new BigDecimal(f1 / lineFlowMealDetailVO.getFlowMeal() * 100); - // 获取流量占比 - lineFlowMealDetailVO.setFlowProportion(flow.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue()); - - // 在线率 - for (LineInfluxDbOnlineVO lineInfluxDbOnline : lineInfluxDbOnlineVO) { - if (lineFlowMealDetailVO.getId().equals(lineInfluxDbOnline.getDevIndex())) { - BigDecimal flowValue = new BigDecimal(lineInfluxDbOnline.getOnlineRate().floatValue()); - lineFlowMealDetailVO.setOnlineRate(flowValue.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue()); - } - } - - // 数据完整性 - for (LineFlowMealDetailVO monitor : monitorList) { - if (monitor.getDeviceId().equals(lineFlowMealDetailVO.getId())){ - deviceDue+=monitor.getDue(); - deviceReal+=monitor.getReal(); - } - } - float integrity = BigDecimal.valueOf((double) deviceReal / deviceDue).setScale(2, RoundingMode.HALF_UP).floatValue(); - lineFlowMealDetailVO.setIntegrity(integrity); - - } - // 变电站集合 - List substationList = lineMapper.getFlowLineInfoByTableList(deviceList.stream().map(LineFlowMealDetailVO::getPid).distinct().collect(Collectors.toList())); - // 供电公司集合 - List powerCompanyList = lineMapper.getFlowLineInfoByTableList(substationList.stream().map(LineFlowMealDetailVO::getPid).distinct().collect(Collectors.toList())); - - setFlowChildesList(substationList, deviceList); - - // setFlowDeChildesList(deviceList, monitorList); - - powerCompanyList.stream() - .peek(item -> item.setChildren(getFlowChildCategoryList(item, substationList))) - .collect(Collectors.toList()); - - return powerCompanyList; - } - - private void setFlowDeChildesList(List item, List childes) { - Map> groupLine; - groupLine = childes.stream().collect(Collectors.groupingBy(steadyQualifyVO -> { - String[] pid = steadyQualifyVO.getPids().split(","); - List value = new ArrayList<>(); - value.add(pid[LineBaseEnum.DEVICE_LEVEL.getCode()]); - System.out.printf(steadyQualifyVO.getName()); - return pid[LineBaseEnum.DEVICE_LEVEL.getCode()]; - })); - item.stream().peek(steadyQualifyVO -> { - if (!CollectionUtils.isEmpty(groupLine.get(steadyQualifyVO.getId()))) { - steadyQualifyVO.setChildren(groupLine.get(steadyQualifyVO.getId())); - } - }).collect(Collectors.toList()); - } - - private void setFlowChildesList(List item, List childrenList) { - Map> groupLine; - groupLine = childrenList.stream().collect(Collectors.groupingBy(steadyQualifyVO -> { - String[] pid = steadyQualifyVO.getPids().split(","); - return pid[LineBaseEnum.SUB_LEVEL.getCode()]; - })); - item.stream().peek(steadyQualifyVO -> { - if (!CollectionUtils.isEmpty(groupLine.get(steadyQualifyVO.getId()))) { - steadyQualifyVO.setChildren(groupLine.get(steadyQualifyVO.getId())); - } - }).collect(Collectors.toList()); - } - - /** - * 组装树层级 - */ - private List getFlowChildCategoryList(LineFlowMealDetailVO item, List child) { - return child.stream().filter(allItem -> allItem.getPid().equals(item.getId())).collect(Collectors.toList()); - } - /** * 获取父级每层数据 */ @@ -688,134 +507,11 @@ public class LineServiceImpl extends ServiceImpl implements Li return child.stream().filter(allItem -> allItem.getPid().equals(item.getId())).collect(Collectors.toList()); } - public List getOnlineData(List devIndexs, DeviceInfoParam.BusinessParam deviceInfoParam) { - // 组装sql语句 - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))).append("' and "); - - for (int i = 0; i < devIndexs.size(); i++) { - if (devIndexs.size() - i != 1) { - stringBuilder.append("dev_id ='").append(devIndexs.get(i)).append("' or "); - } else { - stringBuilder.append("dev_id ='").append(devIndexs.get(i)).append("' "); - } - } - // stringBuilder.append(InfluxDBPublicParam.TIME_ZONE); - String sql = "select sum(online_min)/(sum(online_min) +sum(offline_min))*100 as online_rate from pqs_onlinerate where " + stringBuilder.toString() + " group by dev_id "+InfluxDBPublicParam.TIME_ZONE; - // 获取暂降事件 - QueryResult result = influxDbUtils.query(sql); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List eventDetailList = influxDBResultMapper.toPOJO(result, LineInfluxDbOnlineVO.class); - return eventDetailList; - } - - public List getInegrityData(List lineIndexes, DeviceInfoParam.BusinessParam deviceInfoParam) { - // 组装sql语句 - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))).append("' and "); - for (int i = 0; i < lineIndexes.size(); i++) { - if (lineIndexes.size() - i != 1) { - stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' or "); - } else { - stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' "); - } - } - - //String sql = "select sum(real)/(sum(due))*100 as integrity from pqs_integrity where " + stringBuilder.toString() + "group by line_id"; - String sql = "select due as due, real as real from pqs_integrity where " + stringBuilder.toString() + "group by line_id"; - // 获取暂降事件 - QueryResult result = influxDbUtils.query(sql); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List eventDetailList = influxDBResultMapper.toPOJO(result, LineInfluxDbInegrityVO.class); - return eventDetailList; - } - - @SneakyThrows - public List getDevOnline(String devIndex, String startTime, String endTime) { - //组装sql语句 - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and "); - stringBuilder.append("dev_index ='").append(devIndex).append("' "); - - String sql = "select time,onlinemin/(onlinemin+offlinemin)*100 as value from pqs_onlinerate where " + stringBuilder.toString() + "group by dev_index tz('Asia/Shanghai')"; - //获取在线率 - List lineInfluxDbOnline = new ArrayList<>(); - QueryResult result = influxDbUtils.query(sql); - List list = result.getResults().get(0).getSeries(); - if (!CollectionUtils.isEmpty(list)) { - List> listData = list.get(0).getValues(); - for (int i = 0; i < listData.size(); i++) { - LineStaticsValueVO lineStaticsValueVO = new LineStaticsValueVO(); - List objectList = listData.get(i); - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); - lineStaticsValueVO.setTime(formatter.parse(objectList.get(0).toString()).toString()); - lineStaticsValueVO.setValue((Double) objectList.get(1)); - lineInfluxDbOnline.add(lineStaticsValueVO); - } - } - return lineInfluxDbOnline; - } - - @SneakyThrows - public List getInegrity(String lineIndex, String startTime, String endTime) { - //组装sql语句 - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and "); - stringBuilder.append("line_id ='").append(lineIndex).append("' "); - String sql = "select time,(real/due)*100 as value from pqs_integrity where " + stringBuilder.toString() + " group by line_id tz('Asia/Shanghai')"; - //获取数据完整性 - List lineInfluxDbInegrity = new ArrayList<>(); - QueryResult result = influxDbUtils.query(sql); - List list = result.getResults().get(0).getSeries(); - if (!CollectionUtils.isEmpty(list)) { - List> listData = list.get(0).getValues(); - for (int i = 0; i < listData.size(); i++) { - LineStaticsValueVO lineStaticsValueVO = new LineStaticsValueVO(); - List objectList = listData.get(i); - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); - lineStaticsValueVO.setTime(formatter.parse(objectList.get(0).toString()).toString()); - lineStaticsValueVO.setValue((Double) objectList.get(1)); - lineInfluxDbInegrity.add(lineStaticsValueVO); - } - } - return lineInfluxDbInegrity; - } - - @SneakyThrows - public Float getStatisValueFlow(String lineIndex, DeviceInfoParam.BusinessParam steadyParam) { - //组装sql语句 - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(steadyParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(steadyParam.getSearchEndTime()))).append("' and "); - stringBuilder.append("device_id ='").append(lineIndex).append("' "); - String sql = "select sum(actual_value)/1024/1024 as statisValue from pqs_month_flow where " + stringBuilder.toString() + " group by device_id tz('Asia/Shanghai')"; - //获取统计流量 - Float staticsValue = 0f; - QueryResult result = influxDbUtils.query(sql); - List list = result.getResults().get(0).getSeries(); - if (!CollectionUtils.isEmpty(list)) { - List> listData = list.get(0).getValues(); - List objectList = listData.get(0); - staticsValue = ((Double) objectList.get(1)).floatValue(); - } else { - staticsValue = 0f; - } - return staticsValue; - } - - public List getCommunicate(String devId, String startTime, String endTime) { -// List communicateList = pqsCommunicateService.getPqsCommunicate(devId, DateUtil.beginOfDay(DateUtil.parse(startTime)).toString(), DateUtil.beginOfDay(DateUtil.parse(endTime)).toString()); - - - //组装sql语句 - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and "); - stringBuilder.append("dev_id = '").append(devId).append("' group by dev_id ").append(InfluxDBPublicParam.TIME_ZONE); - String sql = "select * from " + InfluxDBPublicParam.PQS_COMMUNICATE + " where " + stringBuilder.toString(); - //获取暂降事件 - QueryResult result = influxDbUtils.query(sql); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List communicateList = influxDBResultMapper.toPOJO(result, Communicate.class); - return communicateList; + public List getCommunicate(String devId, String startTime, String endTime) { + InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class); + influxQueryWrapper.between(InfluxDbSqlConstant.TIME,DateUtil.beginOfDay(DateUtil.parse(startTime)),DateUtil.beginOfDay(DateUtil.parse(endTime))) + .eq(PqsCommunicate::getDevId,devId); + return pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper); } @Override @@ -830,68 +526,6 @@ public class LineServiceImpl extends ServiceImpl implements Li return this.list(lambdaQueryWrapper); } - @SneakyThrows - @Override - public DeviceAbnormalVO getComunicateStatics(DeviceInfoParam.BusinessParam conditionBusinessParam) { - DeviceAbnormalVO deviceAbnormalVO = new DeviceAbnormalVO(); - //获取所有监测点 - List generalDeviceDTOList = generalDeviceService.getDeviceInfo(conditionBusinessParam, null, Stream.of(1).collect(Collectors.toList())); - List lineIndexs = generalDeviceDTOList.stream() - .flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList()); - if (conditionBusinessParam.getTimeFlag() == 0) { - List intervalTime = this.getIntervalTime(conditionBusinessParam.getSearchBeginTime(), conditionBusinessParam.getSearchEndTime()); - List abnomalCommuncateVOS = new ArrayList<>(); - deviceAbnormalVO.setIsPid(true); - for (String interTime : intervalTime) { - System.out.println(lineIndexs); - AbnomalCommuncateVO inter = new AbnomalCommuncateVO(); - String startTime, endTime; - inter.setMonth(interTime.substring(5)); - inter.setYear(interTime.substring(0, 4)); - startTime = PublicDateUtil.getFisrtDayOfMonth(Integer.parseInt(interTime.substring(0, 4)), Integer.parseInt(interTime.substring(5))); - endTime = PublicDateUtil.getLastDayOfMonth(Integer.parseInt(interTime.substring(0, 4)), Integer.parseInt(interTime.substring(5))); - List communicateList = getCommunicateAbnorm(lineIndexs, startTime, endTime); - inter.setDay("/"); - if (communicateList.size() == 0) { - inter.setAbnormalTimes("3.14159"); - } else { - inter.setAbnormalTimes(String.valueOf(communicateList.size())); - } - abnomalCommuncateVOS.add(inter); - } - deviceAbnormalVO.setData(abnomalCommuncateVOS); - } else { - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - Date dt = simpleDateFormat.parse(conditionBusinessParam.getSearchBeginTime()); - Date dtDate = simpleDateFormat.parse(conditionBusinessParam.getSearchEndTime()); - Integer year = Integer.valueOf(String.format("%tY", dt)); - Integer mon = Integer.valueOf(String.format("%tm", dt)); - Integer day = Integer.valueOf(String.format("%td", dtDate)); - List intervalTime = this.getIntervalDateTime(year, mon, day); - List abnomalCommuncateVOS = new ArrayList<>(); - deviceAbnormalVO.setIsPid(false); - for (String interTime : intervalTime) { - AbnomalCommuncateVO inter = new AbnomalCommuncateVO(); - String startTime, endTime; - inter.setMonth(interTime.substring(5, 7)); - inter.setYear(interTime.substring(0, 4)); - inter.setDay(interTime.substring(8)); - startTime = sdf.format(DateUtil.beginOfDay(DateUtil.parse(interTime))); - endTime = sdf.format(DateUtil.endOfDay(DateUtil.parse(interTime))); - List communicateList = getCommunicateAbnorm(lineIndexs, startTime, endTime); - if (communicateList.size() == 0) { - inter.setAbnormalTimes("3.14159"); - } else { - inter.setAbnormalTimes(String.valueOf(communicateList.size())); - } - abnomalCommuncateVOS.add(inter); - } - deviceAbnormalVO.setData(abnomalCommuncateVOS); - } - - return deviceAbnormalVO; - } /** * @Description: 通过部门索引查询其下监测点数 @@ -1086,52 +720,4 @@ public class LineServiceImpl extends ServiceImpl implements Li } return times; } - - @SneakyThrows - private List getIntervalDateTime(Integer startTime, Integer endTime, Integer dd) { - List list = new ArrayList<>(); - Calendar calendar = Calendar.getInstance(Locale.CHINA); - calendar.set(startTime, endTime - 1, 1); - int year = calendar.get(Calendar.YEAR);//年份 - int month = calendar.get(Calendar.MONTH) + 1;//月份 - for (int i = 1; i <= dd; i++) { - String date = null; - if (month < 10 && i < 10) { - date = year + "-0" + month + "-0" + i; - } - if (month < 10 && i >= 10) { - date = year + "-0" + month + "-" + i; - } - if (month >= 10 && i < 10) { - date = year + "-" + month + "-0" + i; - } - if (month >= 10 && i >= 10) { - date = year + "-" + month + "-" + i; - } - - list.add(date); - } - return list; - } - - public List getCommunicateAbnorm(List lineIndex, String startTime, String endTime) { - //组装sql语句 - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and "); - stringBuilder.append("("); - for (int i = 0; i < lineIndex.size(); i++) { - if (lineIndex.size() - i != 1) { - stringBuilder.append("line_id = '").append(lineIndex.get(i)).append("' or "); - } else { - stringBuilder.append("line_id = '").append(lineIndex.get(i)).append("')"); - } - } - stringBuilder.append("and type = 0").append(" group by line_id ").append(InfluxDBPublicParam.TIME_ZONE); - String sql = "select * from " + InfluxDBPublicParam.PQS_COMMUNICATE + " where " + stringBuilder.toString(); - QueryResult result = influxDbUtils.query(sql); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List communicateList = influxDBResultMapper.toPOJO(result, Communicate.class); - return communicateList; - } - } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LogManageServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LogManageServiceImpl.java index 38134584e..b2279444e 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LogManageServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LogManageServiceImpl.java @@ -23,8 +23,6 @@ import com.njcn.device.pq.pojo.vo.EventLogVO; import com.njcn.device.pq.service.LogManageService; import com.njcn.event.api.EventDetailFeignClient; import com.njcn.event.pojo.po.EventDetail; -import com.njcn.influxdb.param.InfluxDBPublicParam; -import com.njcn.influxdb.utils.InfluxDbUtils; import lombok.AllArgsConstructor; import org.influxdb.dto.QueryResult; import org.influxdb.impl.InfluxDBResultMapper; @@ -50,58 +48,15 @@ import java.util.stream.Collectors; @AllArgsConstructor public class LogManageServiceImpl implements LogManageService { - private final LogManageMapper logManageMapper; - private final EventDetailFeignClient eventDetailFeignClient; - private final InfluxDbUtils influxDbUtils; - private final EventPushLogsMapper eventPushLogsMapper; private final LineMapper lineMapper; - @Override - public Page getDeviceLogData(DeviceLogParam deviceLogParam) { - Page page = new Page<>(); - page.setSize(deviceLogParam.getPageSize()); - page.setCurrent(deviceLogParam.getPageNum()); - - List logData = new ArrayList<>(); - List terminalLogs = getTerminalLogs(deviceLogParam.getSearchBeginTime(), deviceLogParam.getSearchEndTime(), deviceLogParam.getType()); - //待分页数据总量 - page.setTotal(terminalLogs.size()); - //分页总页数 - int pages = (int) Math.ceil(terminalLogs.size() * 1.0 / deviceLogParam.getPageSize()); - page.setPages(pages); - - if (!CollectionUtils.isEmpty(terminalLogs)) { - List> partition = Lists.partition(terminalLogs, deviceLogParam.getPageSize()); - List pageLogs = partition.get(deviceLogParam.getPageNum() - 1); - - if (!CollectionUtils.isEmpty(pageLogs)) { - for (TerminalLogs logs : pageLogs) { - DeviceLogVO deviceLogVO = logManageMapper.getDeviceLogData(logs.getLineId(), logs.getTerminalType(), logs.getUpdateBy()); - if (Objects.isNull(deviceLogVO)) { - continue; - } - LocalDateTime localDateTime = LocalDateTime.ofInstant(logs.getTimeId(), ZoneId.systemDefault()); - DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); - String time = dateTimeFormatter.format(localDateTime); - deviceLogVO.setUpdateTime(time); - deviceLogVO.setRemark(logs.getTerminalDescribe()); - logData.add(deviceLogVO); - } - } - //当前页数据 - page.setRecords(logData); - } - return page; - } - @Override public Page getEventLogData(EventLogParam eventLogParam) { - //查询全部时间 List lineByIDs = lineMapper.getLineByIDs(eventLogParam.getSearchValue()); if (CollUtil.isEmpty(lineByIDs)) { @@ -188,59 +143,5 @@ public class LogManageServiceImpl implements LogManageService { return flag; } - /** - * influxDB查询终端运维日志相关信息 - * - * @param startTime - * @param endTime - * @param type - */ - private List getTerminalLogs(String startTime, String endTime, String type) { - List terminalLogs; - //组装sql语句 - StringBuilder string = new StringBuilder(); - string.append(InfluxDBPublicParam.TIME + " >= '" + startTime + InfluxDBPublicParam.START_TIME + "' and " + InfluxDBPublicParam.TIME + " <= '" + endTime + InfluxDBPublicParam.END_TIME + "'"); - if (!type.isEmpty()) { - string.append(" and terminal_type = '" + type + "'"); - } - //sql语句 - String sql = "SELECT * FROM " + InfluxDBPublicParam.PQS_TERMINAL_LOGS + " WHERE " + string + InfluxDBPublicParam.TIME_ZONE; - System.out.println("sql===========" + sql); - //结果集 - QueryResult results = influxDbUtils.query(sql); - //结果集映射到对象中 - InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); - terminalLogs = resultMapper.toPOJO(results, TerminalLogs.class); - - return terminalLogs; - } - - /** - * influxDB查询暂降事件相关信息 - * - * @param startTime - * @param endTime - * @param result - */ - private List getEventPushLogs(String startTime, String endTime, Integer result) { - List logsList; - //组装sql语句 - StringBuilder string = new StringBuilder(); - string.append(DeviceValidMessage.TIME + " >= '" + startTime + DeviceValidMessage.START_TIME + "' and " + DeviceValidMessage.TIME + " <= '" + endTime + DeviceValidMessage.END_TIME + "'"); - if (result == 1 || result == 2) { - string.append(" and result=" + result); - } - //sql语句 - String sql = "SELECT * FROM pqs_event_push_logs WHERE " + string + InfluxDBPublicParam.TIME_ZONE; - System.out.println("sql===========" + sql); - //结果集 - QueryResult results = influxDbUtils.query(sql); - //结果集映射到对象中 - InfluxDBResultMapper resultMapper = new InfluxDBResultMapper(); - logsList = resultMapper.toPOJO(results, EventPushLogs.class); - - return logsList; - } - } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/RunManageServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/RunManageServiceImpl.java index 29b70e2a3..c91413543 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/RunManageServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/RunManageServiceImpl.java @@ -22,30 +22,23 @@ import com.njcn.device.pq.pojo.vo.TerminalLedgerVO; import com.njcn.device.pq.service.LineService; import com.njcn.device.pq.service.RunManageService; import com.njcn.device.pq.service.TerminalBaseService; -import com.njcn.influxdb.utils.InfluxDBCommUtils; -import com.njcn.influxdb.utils.InfluxDbUtils; import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.enums.DicDataTypeEnum; import com.njcn.system.pojo.enums.StatisticsEnum; import com.njcn.system.pojo.po.DictData; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.influxdb.dto.QueryResult; -import org.influxdb.impl.InfluxDBResultMapper; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Date; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.Stream; -import static com.njcn.influxdb.param.InfluxDBPublicParam.PQS_ONLINERATE; -import static com.njcn.influxdb.param.InfluxDBPublicParam.TIME_ZONE; /** * @author denghuajun diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/SubstationExpendServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/SubstationExpendServiceImpl.java index 7aa9d7756..d5f621db6 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/SubstationExpendServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/SubstationExpendServiceImpl.java @@ -7,17 +7,16 @@ import cn.hutool.core.date.DateUtil; import com.njcn.device.pq.pojo.bo.DeviceType; import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO; import com.njcn.device.pq.pojo.param.DeviceInfoParam; -import com.njcn.device.pq.pojo.po.Communicate; import com.njcn.device.pq.pojo.vo.CommunicateVO; import com.njcn.device.pq.pojo.vo.TerminalBaseVO; import com.njcn.device.pq.service.ISubstationExpendService; import com.njcn.device.pq.service.TerminalBaseService; -import com.njcn.influxdb.param.InfluxDBPublicParam; -import com.njcn.influxdb.utils.InfluxDbUtils; +import com.njcn.influx.imapper.PqsCommunicateMapper; +import com.njcn.influx.pojo.constant.InfluxDBTableConstant; +import com.njcn.influx.pojo.po.PqsCommunicate; +import com.njcn.influx.query.InfluxQueryWrapper; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.influxdb.dto.QueryResult; -import org.influxdb.impl.InfluxDBResultMapper; import org.springframework.stereotype.Service; import java.util.*; @@ -26,7 +25,7 @@ import java.util.stream.Stream; /** *

- * 服务实现类 + * 服务实现类 *

* * @author wr @@ -35,49 +34,40 @@ import java.util.stream.Stream; @Slf4j @Service @RequiredArgsConstructor -public class SubstationExpendServiceImpl implements ISubstationExpendService { +public class SubstationExpendServiceImpl implements ISubstationExpendService { + + private final PqsCommunicateMapper pqsCommunicateMapper; private final GeneralDeviceService generalDeviceService; - private final InfluxDbUtils influxDbUtils; - private final TerminalBaseService terminalBaseService; + + private final TerminalBaseService terminalBaseService; @Override public List getCommunicationStatus(DeviceInfoParam.CompareLimitParam param) { List generalDeviceDTOS = generalDeviceService.getDeviceInfo(param, Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList())); //获取所有终端id List terminalIds = generalDeviceDTOS.stream().flatMap(dto -> dto.getDeviceIndexes().stream()).collect(Collectors.toList()); - List info =new ArrayList<>(); - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime()))).append("' "); - if(CollUtil.isNotEmpty(terminalIds)){ - stringBuilder.append(" and ").append("("); - for (int i = 0; i < terminalIds.size(); i++) { - if (terminalIds.size() - i != 1) { - stringBuilder.append("dev_id = '").append(terminalIds.get(i)).append("' or "); - } else { - stringBuilder.append("dev_id = '").append(terminalIds.get(i)).append("')"); - } - } + List info = new ArrayList<>(); + InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class); + influxQueryWrapper.between(InfluxDBTableConstant.TIME, DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())), DateUtil.beginOfDay(DateUtil.parse(param.getSearchEndTime()))); + if (CollUtil.isNotEmpty(terminalIds)) { + influxQueryWrapper.or(PqsCommunicate::getDevId, terminalIds); } - stringBuilder.append(" limit "+param.getLimit()); - String sql = "select * from " + InfluxDBPublicParam.PQS_COMMUNICATE + " where " + stringBuilder + InfluxDBPublicParam.TIME_ZONE; - // 获取暂降事件 - QueryResult result = influxDbUtils.query(sql); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List communicates = influxDBResultMapper.toPOJO(result, Communicate.class); - if(CollUtil.isEmpty(communicates)){ + influxQueryWrapper.limit(param.getLimit()); + List communicates = pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper); + if (CollUtil.isEmpty(communicates)) { return info; } - List ids = communicates.stream().map(Communicate::getDevId).distinct().collect(Collectors.toList()); - if(CollUtil.isNotEmpty(ids)){ + List ids = communicates.stream().map(PqsCommunicate::getDevId).distinct().collect(Collectors.toList()); + if (CollUtil.isNotEmpty(ids)) { List deviceByIds = terminalBaseService.getDeviceByIdOnOrOff(ids, new DeviceType(), 0); Map terminalNameIp = deviceByIds.stream().collect(Collectors.toMap(TerminalBaseVO::getDevId, x -> x.getDevName() + "_" + x.getIp())); CommunicateVO.PVCommunicateVO communicate; - for (Communicate cate : communicates) { - communicate=new CommunicateVO.PVCommunicateVO(); + for (PqsCommunicate cate : communicates) { + communicate = new CommunicateVO.PVCommunicateVO(); BeanUtil.copyProperties(cate, communicate); - communicate.setTime(cate.getUpdateTime()); - if(terminalNameIp.containsKey(cate.getDevId())){ + communicate.setTime(cate.getTime()); + if (terminalNameIp.containsKey(cate.getDevId())) { communicate.setDevIp(terminalNameIp.get(cate.getDevId())); } info.add(communicate); diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalMaintainServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalMaintainServiceImpl.java index 6ead2344b..289b26889 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalMaintainServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalMaintainServiceImpl.java @@ -14,13 +14,15 @@ import com.njcn.device.pq.mapper.SuperDataMapper; import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO; import com.njcn.device.pq.pojo.param.*; import com.njcn.device.pq.pojo.po.*; -import com.njcn.device.pq.pojo.po.influxdb.DeviceDayFlow; import com.njcn.device.pq.pojo.vo.LineFlowMealDetailVO; import com.njcn.device.pq.pojo.vo.TerminalDaliyFlowVO; import com.njcn.device.pq.pojo.vo.TerminalMaintainVO; import com.njcn.device.pq.service.*; -import com.njcn.influxdb.param.InfluxDBPublicParam; -import com.njcn.influxdb.utils.InfluxDbUtils; +import com.njcn.influx.constant.InfluxDbSqlConstant; +import com.njcn.influx.imapper.CldStatisticsFlowMapper; +import com.njcn.influx.pojo.dto.DeviceDayFlowDTO; +import com.njcn.influx.pojo.po.CldStatisFlow; +import com.njcn.influx.query.InfluxQueryWrapper; import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.enums.DicDataEnum; import com.njcn.system.pojo.enums.StatisticsEnum; @@ -29,8 +31,6 @@ import com.njcn.user.api.DeptFeignClient; import com.njcn.web.utils.RequestUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.influxdb.dto.QueryResult; -import org.influxdb.impl.InfluxDBResultMapper; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -65,8 +65,6 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService { private final DeptFeignClient deptFeignClient; - private final InfluxDbUtils influxDbUtils; - private final SuperDataMapper superDataMapper; private final DicDataFeignClient dicDataFeignClient; @@ -75,6 +73,8 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService { private final DevFuctionMapper devFuctionMapper; + private final CldStatisticsFlowMapper cldStatisticsFlowMapper; + @Override public List getTerminalMainList(TerminalMainQueryParam terminalMainQueryParam) { List resList = new ArrayList<>(); @@ -287,8 +287,8 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService { funQueryWrapper.lambda().eq(DevFuction::getLineId,param.getDevId()); List functions = devFuctionMapper.selectList(funQueryWrapper); flowManageDetail.setFunctions(functions); - List deviceDayFlowList = getFlowManageDetailFromInfluxDB(param); - float sum = (float) deviceDayFlowList.stream().mapToDouble(DeviceDayFlow::getDailyActualValue).sum(); + List deviceDayFlowList = getFlowManageDetailFromInfluxDB(param); + float sum = (float) deviceDayFlowList.stream().mapToDouble(DeviceDayFlowDTO::getDailyActualValue).sum(); flowManageDetail.setDeviceDayFlowsList(deviceDayFlowList); flowManageDetail.setActualValue(sum); list.add(flowManageDetail); @@ -305,28 +305,24 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService { return list; } - private List getFlowManageDetailFromInfluxDB(TerminalMainQueryParam param) { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime()))).append("' and "); - stringBuilder.append("dev_id ='").append(param.getDevId()).append("'"); - String sql = "select * from " + InfluxDBPublicParam.CLD_STATIS_FLOW + " where " + stringBuilder.toString() + InfluxDBPublicParam.TIME_ZONE; - QueryResult result = influxDbUtils.query(sql); - InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper(); - List deviceDayFlow = influxDBResultMapper.toPOJO(result, DeviceDayFlow.class); + private List getFlowManageDetailFromInfluxDB(TerminalMainQueryParam param) { + InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(CldStatisFlow.class,DeviceDayFlowDTO.class); + influxQueryWrapper.between(InfluxDbSqlConstant.TIME,DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())),DateUtil.beginOfDay(DateUtil.parse(param.getSearchEndTime()))) + .eq(CldStatisFlow::getDevId,param.getDevId()); + List deviceDayFlow = cldStatisticsFlowMapper.selectDeviceDayFlowByQueryWrapper(influxQueryWrapper); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); deviceDayFlow.forEach(t -> t.setDate(formatter.format(Date.from(t.getTime())))); - Map> dayFlowMap = deviceDayFlow.stream().collect(Collectors.groupingBy(DeviceDayFlow::getDate)); - List list = new ArrayList<>(); - for (Map.Entry> entry : dayFlowMap.entrySet()) { - DeviceDayFlow dayFlow = new DeviceDayFlow(); + Map> dayFlowMap = deviceDayFlow.stream().collect(Collectors.groupingBy(DeviceDayFlowDTO::getDate)); + List list = new ArrayList<>(); + for (Map.Entry> entry : dayFlowMap.entrySet()) { + DeviceDayFlowDTO dayFlow = new DeviceDayFlowDTO(); dayFlow.setDevId(entry.getValue().get(0).getDevId()); - BigDecimal bigDecimal = new BigDecimal((float) entry.getValue().stream().mapToInt(DeviceDayFlow::getActualValue).sum() / (float) 1024 / (float) 1024); + BigDecimal bigDecimal = new BigDecimal((float) entry.getValue().stream().mapToInt(DeviceDayFlowDTO::getActualValue).sum() / (float) 1024 / (float) 1024); dayFlow.setDailyActualValue(bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue()); dayFlow.setDate(entry.getKey()); list.add(dayFlow); } - list = list.stream().sorted(Comparator.comparing(DeviceDayFlow::getDate)).collect(Collectors.toList()); - + list = list.stream().sorted(Comparator.comparing(DeviceDayFlowDTO::getDate)).collect(Collectors.toList()); return list; } diff --git a/pqs-influx/src/main/java/com/njcn/influx/imapper/CldStatisticsFlowMapper.java b/pqs-influx/src/main/java/com/njcn/influx/imapper/CldStatisticsFlowMapper.java index 808ab0581..0ac48c83a 100644 --- a/pqs-influx/src/main/java/com/njcn/influx/imapper/CldStatisticsFlowMapper.java +++ b/pqs-influx/src/main/java/com/njcn/influx/imapper/CldStatisticsFlowMapper.java @@ -1,7 +1,11 @@ package com.njcn.influx.imapper; import com.njcn.influx.base.InfluxDbBaseMapper; +import com.njcn.influx.pojo.dto.DeviceDayFlowDTO; import com.njcn.influx.pojo.po.CldStatisFlow; +import com.njcn.influx.query.InfluxQueryWrapper; + +import java.util.List; /** * @author hongawen @@ -11,4 +15,5 @@ import com.njcn.influx.pojo.po.CldStatisFlow; public interface CldStatisticsFlowMapper extends InfluxDbBaseMapper{ + List selectDeviceDayFlowByQueryWrapper(InfluxQueryWrapper influxQueryWrapper); } diff --git a/pqs-influx/src/main/java/com/njcn/influx/imapper/PqsCommunicateMapper.java b/pqs-influx/src/main/java/com/njcn/influx/imapper/PqsCommunicateMapper.java new file mode 100644 index 000000000..511295a79 --- /dev/null +++ b/pqs-influx/src/main/java/com/njcn/influx/imapper/PqsCommunicateMapper.java @@ -0,0 +1,13 @@ +package com.njcn.influx.imapper; + +import com.njcn.influx.base.InfluxDbBaseMapper; +import com.njcn.influx.pojo.po.PqsCommunicate; + +/** + * @author hongawen + * @version 1.0.0 + * @date 2023年08月09日 09:29 + */ +public interface PqsCommunicateMapper extends InfluxDbBaseMapper { + +} diff --git a/pqs-influx/src/main/java/com/njcn/influx/pojo/dto/DeviceDayFlowDTO.java b/pqs-influx/src/main/java/com/njcn/influx/pojo/dto/DeviceDayFlowDTO.java new file mode 100644 index 000000000..20ff1f140 --- /dev/null +++ b/pqs-influx/src/main/java/com/njcn/influx/pojo/dto/DeviceDayFlowDTO.java @@ -0,0 +1,19 @@ +package com.njcn.influx.pojo.dto; + +import com.njcn.influx.pojo.po.CldStatisFlow; +import lombok.Data; +import org.influxdb.annotation.Column; +import org.influxdb.annotation.Measurement; + +import java.time.Instant; + +@Data +@Measurement(name = "cld_statis_flow") +public class DeviceDayFlowDTO extends CldStatisFlow { + + private float dailyActualValue; + + private String date; + + private String month; +} diff --git a/pqs-influx/src/main/java/com/njcn/influx/service/PqsCommunicateService.java b/pqs-influx/src/main/java/com/njcn/influx/service/PqsCommunicateService.java new file mode 100644 index 000000000..4eab844c6 --- /dev/null +++ b/pqs-influx/src/main/java/com/njcn/influx/service/PqsCommunicateService.java @@ -0,0 +1,9 @@ +package com.njcn.influx.service; + +/** + * @author hongawen + * @version 1.0.0 + * @date 2023年08月09日 09:28 + */ +public interface PqsCommunicateService { +} diff --git a/pqs-influx/src/main/java/com/njcn/influx/service/impl/PqsCommunicateServiceImpl.java b/pqs-influx/src/main/java/com/njcn/influx/service/impl/PqsCommunicateServiceImpl.java new file mode 100644 index 000000000..e6db5d66d --- /dev/null +++ b/pqs-influx/src/main/java/com/njcn/influx/service/impl/PqsCommunicateServiceImpl.java @@ -0,0 +1,13 @@ +package com.njcn.influx.service.impl; + +import com.njcn.influx.service.PqsCommunicateService; +import org.springframework.stereotype.Service; + +/** + * @author hongawen + * @version 1.0.0 + * @date 2023年08月09日 09:28 + */ +@Service +public class PqsCommunicateServiceImpl implements PqsCommunicateService { +}