1.监测点超标信息详情统计
2.终端在线率统计
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.njcn.dataProcess.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.dataProcess.api.fallback.DataOnlineRateFeignClientFallbackFactory;
|
||||
import com.njcn.dataProcess.pojo.dto.DataLimitRateDto;
|
||||
import com.njcn.dataProcess.pojo.dto.RStatOnlineRateDto;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2025/3/7 9:30
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.PLATFORM_DATA_PROCESSING_BOOT, path = "/dataOnlineRate", fallbackFactory = DataOnlineRateFeignClientFallbackFactory.class, contextId = "dataOnlineRate")
|
||||
public interface DataOnlineRateFeignClient {
|
||||
|
||||
@PostMapping("/batchInsertion")
|
||||
HttpResult<String> batchInsertion(@RequestBody List<RStatOnlineRateDto.Detail> dataIDTOList);
|
||||
|
||||
}
|
||||
@@ -21,19 +21,23 @@ import java.util.List;
|
||||
* @version 1.0.0
|
||||
* @date 2022年01月05日 15:11
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.PLATFORM_DATA_PROCESSING_BOOT, path = "/dataV", fallbackFactory = DataVFeignClientFallbackFactory.class, contextId = "dataV")
|
||||
@FeignClient(value = ServerInfo.PLATFORM_DATA_PROCESSING_BOOT, path = "/dataV", fallbackFactory = DataVFeignClientFallbackFactory.class, contextId = "dataV")
|
||||
public interface DataVFeignClient {
|
||||
|
||||
@PostMapping("/batchInsertion")
|
||||
HttpResult<String> batchInsertion(@RequestBody List<DataVDTO> dataVDTOList);
|
||||
|
||||
@PostMapping("/monitoringTime")
|
||||
HttpResult<List<LocalDateTime>> monitoringTime(@RequestParam("lineId") String lineId, @RequestParam("localData") String localData) ;
|
||||
HttpResult<List<LocalDateTime>> monitoringTime(@RequestParam("lineId") String lineId, @RequestParam("localData") String localData);
|
||||
|
||||
//获取原始数据
|
||||
@PostMapping("/getRawData")
|
||||
HttpResult<List<DataVDto>> getRawData(@RequestBody LineCountEvaluateParam lineParam);
|
||||
|
||||
//获取总条目数量
|
||||
@PostMapping("/getCountRawData")
|
||||
HttpResult<Integer> getCountRawData(@RequestBody LineCountEvaluateParam lineParam);
|
||||
|
||||
//获取算法基础数据
|
||||
@PostMapping("/getBaseData")
|
||||
HttpResult<List<CommonMinuteDto>> getBaseData(@RequestBody LineCountEvaluateParam lineParam);
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.njcn.dataProcess.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.dataProcess.api.DataOnlineRateFeignClient;
|
||||
import com.njcn.dataProcess.pojo.dto.DataLimitRateDto;
|
||||
import com.njcn.dataProcess.pojo.dto.RStatOnlineRateDto;
|
||||
import com.njcn.dataProcess.util.DataProcessingEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2025/3/7 9:30
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DataOnlineRateFeignClientFallbackFactory implements FallbackFactory<DataOnlineRateFeignClient> {
|
||||
|
||||
|
||||
/**
|
||||
* 输出远程请求接口异常日志
|
||||
* @param cause RPC请求异常
|
||||
*/
|
||||
@Override
|
||||
public DataOnlineRateFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if(cause.getCause() instanceof BusinessException){
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
exceptionEnum = DataProcessingEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new DataOnlineRateFeignClient() {
|
||||
@Override
|
||||
public HttpResult<String> batchInsertion(List<RStatOnlineRateDto.Detail> dataIDTOList) {
|
||||
log.error("{}异常,降级处理,异常为:{}","批量插入数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,12 @@ public class DataVFeignClientFallbackFactory implements FallbackFactory<DataVFei
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Integer> getCountRawData(LineCountEvaluateParam lineParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取总条目数量",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CommonMinuteDto>> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取算法基础数据",cause.toString());
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.njcn.dataProcess.pojo.dto;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
@@ -11,10 +14,15 @@ import lombok.Data;
|
||||
@Data
|
||||
public class AbnormalData {
|
||||
|
||||
|
||||
/**
|
||||
* 超标时间
|
||||
*/
|
||||
private String time;
|
||||
/**
|
||||
* 相别
|
||||
*/
|
||||
private String phasic;
|
||||
|
||||
/**
|
||||
* 数据类型(最大值:max、最小值:min、平均值:avg、95值:cp95)
|
||||
@@ -29,4 +37,34 @@ public class AbnormalData {
|
||||
* 限值
|
||||
*/
|
||||
private float overLimitValue;
|
||||
|
||||
@Data
|
||||
public static class Json {
|
||||
|
||||
|
||||
/**
|
||||
* 相别
|
||||
*/
|
||||
@JSONField(ordinal = 1)
|
||||
private String phasic;
|
||||
|
||||
/**
|
||||
* 数据类型(最大值:max、最小值:min、平均值:avg、95值:cp95)
|
||||
*/
|
||||
@JSONField(ordinal = 2)
|
||||
private String valueType;
|
||||
|
||||
/**
|
||||
* 超标时间
|
||||
*/
|
||||
@JSONField(ordinal = 3)
|
||||
private String time;
|
||||
/**
|
||||
* 异常值
|
||||
*/
|
||||
@JSONField(ordinal = 4)
|
||||
private String value;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,24 +15,11 @@ public class DataLimitRateDetailDto implements Serializable {
|
||||
*/
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 数据类型,’A’表示A相,’B’表示B相,’C’表示C相,’’M’表示ABC三项总和,T’表示总
|
||||
*/
|
||||
private String phasicType;
|
||||
|
||||
/**
|
||||
* 合格率时间
|
||||
*/
|
||||
private LocalDate time;
|
||||
|
||||
/**
|
||||
* 总计算次数
|
||||
*/
|
||||
private Integer allTime;
|
||||
/**
|
||||
* 闪变总计算次数
|
||||
*/
|
||||
private Integer flickerAllTime;
|
||||
/**
|
||||
* 闪变越限次数
|
||||
*/
|
||||
|
||||
@@ -19,13 +19,6 @@ public class RStatLimitRateDetailD implements Serializable {
|
||||
@TableField(value = "my_index")
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 数据类型,’A’表示A相,’B’表示B相,’C’表示C相,’’M’表示ABC三项总和,T’表示总
|
||||
*/
|
||||
@MppMultiId
|
||||
@TableField(value = "phasic_type")
|
||||
private String phasicType;
|
||||
|
||||
/**
|
||||
* 合格率时间
|
||||
*/
|
||||
@@ -34,18 +27,6 @@ public class RStatLimitRateDetailD implements Serializable {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
|
||||
private LocalDate time;
|
||||
|
||||
/**
|
||||
* 总计算次数
|
||||
*/
|
||||
@TableField(value = "all_time")
|
||||
private Integer allTime;
|
||||
|
||||
/**
|
||||
* 闪变总计算次数
|
||||
*/
|
||||
@TableField(value = "flicker_all_time")
|
||||
private Integer flickerAllTime;
|
||||
|
||||
/**
|
||||
* 闪变越限次数
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,7 @@ public class RStatOnlineRateD {
|
||||
*/
|
||||
@MppMultiId
|
||||
@TableField(value = "time_id")
|
||||
private LocalDateTime timeId;
|
||||
private String timeId;
|
||||
|
||||
/**
|
||||
* 装置id
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.njcn.dataProcess.controller;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
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.dataProcess.annotation.InsertBean;
|
||||
import com.njcn.dataProcess.annotation.QueryBean;
|
||||
import com.njcn.dataProcess.pojo.dto.RStatOnlineRateDto;
|
||||
import com.njcn.dataProcess.service.IOnlineRate;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0
|
||||
* @data 2024/11/6 19:48
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RestController
|
||||
@RequestMapping("/dataOnlineRate")
|
||||
@Api(tags = "终端在线率获取")
|
||||
public class DataOnlineRateController extends BaseController {
|
||||
|
||||
@QueryBean
|
||||
private IOnlineRate onlineRateQuery;
|
||||
|
||||
@InsertBean
|
||||
private IOnlineRate onlineRateInsert;
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/batchInsertion")
|
||||
@ApiOperation("批量插入")
|
||||
public HttpResult<String> batchInsertion(@RequestBody List<RStatOnlineRateDto.Detail> dataVDTOList) {
|
||||
String methodDescribe = getMethodDescribe("batchInsertion");
|
||||
onlineRateInsert.batchInsertion(dataVDTOList);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -95,6 +95,15 @@ public class DataVController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, data, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY)
|
||||
@PostMapping("/getCountRawData")
|
||||
@ApiOperation("获取总条目数量")
|
||||
public HttpResult<Integer> getCountRawData(@RequestBody LineCountEvaluateParam lineParam) {
|
||||
String methodDescribe = getMethodDescribe("getCountRawData");
|
||||
Integer data = dataVQuery.getCountRawData(lineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, data, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY)
|
||||
@PostMapping("/getBaseData")
|
||||
@ApiOperation("获取算法基础数据")
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.dataProcess.dao.relation.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.dataProcess.pojo.po.RStatOnlineRateD;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
* @author web2023
|
||||
*/
|
||||
public interface RStatOnlineRateDMapper extends MppBaseMapper<RStatOnlineRateD> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -38,6 +38,13 @@ public interface IDataV extends IMppService<RStatDataVD> {
|
||||
*/
|
||||
List<DataVDto> getRawData(LineCountEvaluateParam lineParam);
|
||||
|
||||
/**
|
||||
* 获取总条目数量
|
||||
* @param lineParam
|
||||
* @return
|
||||
*/
|
||||
Integer getCountRawData(LineCountEvaluateParam lineParam);
|
||||
|
||||
/**
|
||||
* 获取监测点原始数据
|
||||
* @param lineParam 监测点参数
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.dataProcess.service;
|
||||
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.pojo.dto.DataLimitRateDto;
|
||||
import com.njcn.dataProcess.pojo.dto.PqsCommunicateDto;
|
||||
import com.njcn.dataProcess.pojo.dto.RStatOnlineRateDto;
|
||||
import com.njcn.dataProcess.pojo.po.RStatLimitRateD;
|
||||
import com.njcn.dataProcess.pojo.po.RStatOnlineRateD;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2025/3/6 10:22
|
||||
*/
|
||||
public interface IOnlineRate extends IMppService<RStatOnlineRateD>{
|
||||
|
||||
/**
|
||||
* 批量插入数据
|
||||
* @param onlineRateList
|
||||
*/
|
||||
void batchInsertion(List<RStatOnlineRateDto.Detail> onlineRateList);
|
||||
|
||||
}
|
||||
@@ -140,6 +140,33 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getCountRawData(LineCountEvaluateParam lineParam) {
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||
influxQueryWrapper.regular(DataV::getLineId,lineParam.getLineId())
|
||||
.select(DataV::getLineId)
|
||||
.select(DataV::getPhasicType)
|
||||
.select(DataV::getValueType)
|
||||
.select(DataV::getFreq)
|
||||
.select(DataV::getFreqDev)
|
||||
.select(DataV::getRms)
|
||||
.select(DataV::getRmsLvr)
|
||||
.select(DataV::getVNeg)
|
||||
.select(DataV::getVPos)
|
||||
.select(DataV::getVThd)
|
||||
.select(DataV::getVUnbalance)
|
||||
.select(DataV::getVZero)
|
||||
.select(DataV::getVlDev)
|
||||
.select(DataV::getVuDev)
|
||||
.select(DataV::getQualityFlag)
|
||||
.between(DataV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.limit(1)
|
||||
;
|
||||
List<DataV> dataVS = dataVMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
return dataVS.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
List<CommonMinuteDto> result = new ArrayList<>();
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.njcn.dataProcess.service.impl.influxdb;
|
||||
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatOnlineRateDMapper;
|
||||
import com.njcn.dataProcess.pojo.dto.RStatOnlineRateDto;
|
||||
import com.njcn.dataProcess.pojo.po.RStatOnlineRateD;
|
||||
import com.njcn.dataProcess.service.IOnlineRate;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2025/3/6 10:22
|
||||
*/
|
||||
@Service("InfluxdbOnlineRateImpl")
|
||||
@RequiredArgsConstructor
|
||||
public class InfluxdbOnlineRateImpl extends MppServiceImpl<RStatOnlineRateDMapper, RStatOnlineRateD> implements IOnlineRate {
|
||||
|
||||
|
||||
@Override
|
||||
public void batchInsertion(List<RStatOnlineRateDto.Detail> onlineRateList) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -91,6 +91,11 @@ public class RelationDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getCountRawData(LineCountEvaluateParam lineParam) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||
return Collections.emptyList();
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.njcn.dataProcess.service.impl.relation;
|
||||
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatOnlineRateDMapper;
|
||||
import com.njcn.dataProcess.pojo.dto.RStatOnlineRateDto;
|
||||
import com.njcn.dataProcess.pojo.po.RStatOnlineRateD;
|
||||
import com.njcn.dataProcess.service.IOnlineRate;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2025/3/6 10:22
|
||||
*/
|
||||
@Service("RelationOnlineRateImpl")
|
||||
@RequiredArgsConstructor
|
||||
public class RelationOnlineRateImpl extends MppServiceImpl<RStatOnlineRateDMapper, RStatOnlineRateD> implements IOnlineRate {
|
||||
|
||||
|
||||
@Override
|
||||
public void batchInsertion(List<RStatOnlineRateDto.Detail> onlineRateList) {
|
||||
List<RStatOnlineRateD> result = new ArrayList<>();
|
||||
onlineRateList.forEach(item->{
|
||||
RStatOnlineRateD onlineRate = new RStatOnlineRateD();
|
||||
BeanUtils.copyProperties(item, onlineRate);
|
||||
result.add(onlineRate);
|
||||
});
|
||||
this.saveOrUpdateBatchByMultiId(result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user