新能源专项分析算法迁移
This commit is contained in:
@@ -18,10 +18,7 @@ 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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -54,7 +51,14 @@ public class DataLimitRateDetailController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLimitRateDetailTime")
|
||||
@ApiOperation("根据监测点id获取所有超标时间")
|
||||
public HttpResult< List<String>> getLimitRateDetailTime(@RequestParam("id") String id, @RequestParam("time") String time) {
|
||||
String methodDescribe = getMethodDescribe("getLimitRateDetailTime");
|
||||
List<String> limitRateDetailTime = limitRateDetailInsert.getLimitRateDetailTime(id, time);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, limitRateDetailTime, methodDescribe);
|
||||
}
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getRawData")
|
||||
@ApiOperation("获取原始数据")
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
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.pojo.dto.RActivePowerRangeDto;
|
||||
import com.njcn.dataProcess.pojo.dto.SpThroughDto;
|
||||
import com.njcn.dataProcess.service.IRActivePowerRangeService;
|
||||
import com.njcn.dataProcess.service.ISpThroughService;
|
||||
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("/specialAnalysis")
|
||||
@Api(tags = "有功功率数据获取")
|
||||
public class RActivePowerRangeController extends BaseController {
|
||||
|
||||
@InsertBean
|
||||
private IRActivePowerRangeService irActivePowerRangeService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/batchInsertionPower")
|
||||
@ApiOperation("有功功率批量插入")
|
||||
public HttpResult<String> batchInsertionPower(@RequestBody List<RActivePowerRangeDto> dtoList) {
|
||||
String methodDescribe = getMethodDescribe("batchInsertionPower");
|
||||
irActivePowerRangeService.batchInsertion(dtoList);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
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.pojo.dto.SpThroughDto;
|
||||
import com.njcn.dataProcess.service.ISpThroughService;
|
||||
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.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0
|
||||
* @data 2024/11/6 19:48
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RestController
|
||||
@RequestMapping("/specialAnalysis")
|
||||
@Api(tags = "高低电压穿越数据获取")
|
||||
public class SpThroughController extends BaseController {
|
||||
|
||||
@InsertBean
|
||||
private ISpThroughService spThroughService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/batchInsertionThrough")
|
||||
@ApiOperation("高低电压穿越批量插入")
|
||||
public HttpResult<String> batchInsertionThrough(@RequestBody List<SpThroughDto> dtoList) {
|
||||
String methodDescribe = getMethodDescribe("batchInsertionThrough");
|
||||
spThroughService.batchInsertion(dtoList);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.njcn.dataProcess.dao.relation.mapper;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.dataProcess.pojo.po.RActivePowerRange;
|
||||
|
||||
/**
|
||||
* 有功功率趋势 Mapper 接口
|
||||
* @author guofeihu
|
||||
* @since 2024-08-20
|
||||
*/
|
||||
public interface RActivePowerRangeMapper extends MppBaseMapper<RActivePowerRange> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.njcn.dataProcess.dao.relation.mapper;
|
||||
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||
import com.njcn.dataProcess.pojo.po.SpThrough;
|
||||
|
||||
/**
|
||||
* @Description: 高低电压穿越
|
||||
* @Author: wr
|
||||
* @Date: 2025/4/1 16:03
|
||||
*/
|
||||
public interface SpThroughMapper extends MppBaseMapper<SpThrough> {
|
||||
|
||||
}
|
||||
@@ -15,6 +15,15 @@ import java.util.List;
|
||||
*/
|
||||
public interface IDataLimitRateDetail extends IMppService<RStatLimitRateDetailD> {
|
||||
|
||||
/**
|
||||
* 根据监测点id获取所有超标时间
|
||||
* @param id
|
||||
* @return: java.util.List<java.lang.String>
|
||||
* @Author: wr
|
||||
* @Date: 2025/4/2 10:49
|
||||
*/
|
||||
List<String> getLimitRateDetailTime(String id,String time);
|
||||
|
||||
/**
|
||||
* 批量插入数据
|
||||
* @param limitRateDetailList
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.dataProcess.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.dataProcess.pojo.dto.RActivePowerRangeDto;
|
||||
import com.njcn.dataProcess.pojo.po.RActivePowerRange;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 有功功率趋势 服务类
|
||||
* @author guofeihu
|
||||
* @since 2024-08-22
|
||||
*/
|
||||
public interface IRActivePowerRangeService extends IMppService<RActivePowerRange> {
|
||||
|
||||
|
||||
/**
|
||||
* 批量插入数据
|
||||
* @param dtoList
|
||||
* @Author: wr
|
||||
* @Date: 2025/3/14 14:03
|
||||
*/
|
||||
void batchInsertion(List<RActivePowerRangeDto> dtoList);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.dataProcess.service;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.dataProcess.pojo.dto.SpThroughDto;
|
||||
import com.njcn.dataProcess.pojo.po.SpThrough;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 高低电压穿越
|
||||
* @Author: wr
|
||||
* @Date: 2025/4/1 16:09
|
||||
*/
|
||||
public interface ISpThroughService extends IMppService<SpThrough> {
|
||||
|
||||
/**
|
||||
* 批量插入数据
|
||||
* @param dtoList
|
||||
* @Author: wr
|
||||
* @Date: 2025/3/14 14:03
|
||||
*/
|
||||
void batchInsertion(List<SpThroughDto> dtoList);
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import com.njcn.dataProcess.service.IDataLimitRateDetail;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -20,6 +21,11 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
public class InfluxdbDataLimitRateDetailImpl extends MppServiceImpl<RStatLimitRateDetailRelationMapper, RStatLimitRateDetailD> implements IDataLimitRateDetail {
|
||||
|
||||
@Override
|
||||
public List<String> getLimitRateDetailTime(String id,String time) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchInsertion(List<DataLimitRateDetailDto> limitRateList) {
|
||||
|
||||
|
||||
@@ -2,20 +2,25 @@ package com.njcn.dataProcess.service.impl.relation;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.RStatLimitRateDetailRelationMapper;
|
||||
import com.njcn.dataProcess.pojo.dto.AbnormalData;
|
||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||
import com.njcn.dataProcess.pojo.dto.DataLimitRateDetailDto;
|
||||
import com.njcn.dataProcess.pojo.dto.DataQualifiedDetail;
|
||||
import com.njcn.dataProcess.pojo.po.RStatLimitQualifiedD;
|
||||
import com.njcn.dataProcess.pojo.po.RStatLimitRateDetailD;
|
||||
import com.njcn.dataProcess.service.IDataLimitRateDetail;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -28,10 +33,50 @@ import java.util.List;
|
||||
public class RelationDataLimitRateDetailImpl extends MppServiceImpl<RStatLimitRateDetailRelationMapper, RStatLimitRateDetailD> implements IDataLimitRateDetail {
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> getLimitRateDetailTime(String id, String time) {
|
||||
RStatLimitRateDetailD one = this.getOne(new LambdaQueryWrapper<RStatLimitRateDetailD>()
|
||||
.eq(RStatLimitRateDetailD::getLineId, id)
|
||||
.eq(RStatLimitRateDetailD::getTime, time)
|
||||
);
|
||||
if (ObjectUtil.isNotNull(one)) {
|
||||
List<AbnormalData.Json> json = new ArrayList<>();
|
||||
try {
|
||||
// 获取类的Class对象
|
||||
Class<RStatLimitRateDetailD> clazz = RStatLimitRateDetailD.class;
|
||||
// 获取类中声明的所有字段
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
// 遍历字段数组
|
||||
for (Field field : fields) {
|
||||
if (!"lineId".equals(field.getName()) && !"time".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object o = field.get(one);
|
||||
if (ObjectUtil.isNotNull(o)) {
|
||||
String string = o.toString();
|
||||
json.addAll(JSON.parseArray(string, AbnormalData.Json.class));
|
||||
}
|
||||
}
|
||||
// 获取字段的类型
|
||||
Class<?> fieldType = field.getType();
|
||||
System.out.println("Field name: " + field.getName() + ", Type: " + fieldType.getName());
|
||||
}
|
||||
} catch (SecurityException |IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (CollUtil.isNotEmpty(json)){
|
||||
List<String> times = json.stream().map(AbnormalData.Json::getTime).collect(Collectors.toList());
|
||||
String join = String.join(",", times);
|
||||
String[] split = join.split(",");
|
||||
return Arrays.stream(split).distinct().collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchInsertion(List<DataLimitRateDetailDto> limitRateList) {
|
||||
List<RStatLimitRateDetailD> result = new ArrayList<>();
|
||||
limitRateList.forEach(item->{
|
||||
limitRateList.forEach(item -> {
|
||||
RStatLimitRateDetailD limitRate = new RStatLimitRateDetailD();
|
||||
BeanUtils.copyProperties(item, limitRate);
|
||||
result.add(limitRate);
|
||||
|
||||
@@ -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.RActivePowerRangeMapper;
|
||||
import com.njcn.dataProcess.pojo.dto.RActivePowerRangeDto;
|
||||
import com.njcn.dataProcess.pojo.po.RActivePowerRange;
|
||||
import com.njcn.dataProcess.service.IRActivePowerRangeService;
|
||||
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/4/1 16:03
|
||||
*/
|
||||
@Service("RelationRActivePowerRangeServiceImpl")
|
||||
@RequiredArgsConstructor
|
||||
public class RelationRActivePowerRangeServiceImpl extends MppServiceImpl<RActivePowerRangeMapper, RActivePowerRange> implements IRActivePowerRangeService {
|
||||
|
||||
|
||||
@Override
|
||||
public void batchInsertion(List<RActivePowerRangeDto> dtoList) {
|
||||
List<RActivePowerRange> result = new ArrayList<>();
|
||||
dtoList.forEach(item->{
|
||||
RActivePowerRange powerRange = new RActivePowerRange();
|
||||
BeanUtils.copyProperties(item, powerRange);
|
||||
powerRange.setState(1);
|
||||
result.add(powerRange);
|
||||
});
|
||||
this.saveOrUpdateBatchByMultiId(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.dataProcess.service.impl.relation;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.dataProcess.dao.relation.mapper.SpThroughMapper;
|
||||
import com.njcn.dataProcess.pojo.dto.SpThroughDto;
|
||||
import com.njcn.dataProcess.pojo.po.RStatPollutionSubstationY;
|
||||
import com.njcn.dataProcess.pojo.po.SpThrough;
|
||||
import com.njcn.dataProcess.service.ISpThroughService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 高低电压穿越
|
||||
* @Author: wr
|
||||
* @Date: 2025/4/1 16:03
|
||||
*/
|
||||
@Service("RelationSpThroughServiceImpl")
|
||||
@RequiredArgsConstructor
|
||||
public class RelationSpThroughServiceImpl extends MppServiceImpl<SpThroughMapper, SpThrough> implements ISpThroughService {
|
||||
|
||||
|
||||
@Override
|
||||
public void batchInsertion(List<SpThroughDto> dtoList) {
|
||||
List<String> eventIds = dtoList.stream().map(SpThroughDto::getEventId).distinct().collect(Collectors.toList());
|
||||
List<SpThrough> result = new ArrayList<>();
|
||||
dtoList.forEach(item->{
|
||||
SpThrough limitRate = new SpThrough();
|
||||
BeanUtils.copyProperties(item, limitRate);
|
||||
limitRate.setId(IdUtil.simpleUUID());
|
||||
limitRate.setState(true);
|
||||
result.add(limitRate);
|
||||
});
|
||||
this.remove(new LambdaQueryWrapper<SpThrough>().in(SpThrough::getEventId,eventIds));
|
||||
this.saveBatch(result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user