有功功率趋势2

This commit is contained in:
guofeihu
2024-08-29 16:30:46 +08:00
parent ee1f36617d
commit e13b1f156e
15 changed files with 320 additions and 62 deletions

View File

@@ -1,6 +1,11 @@
package com.njcn.device.pq.constant; package com.njcn.device.pq.constant;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @author qijian * @author qijian
*/ */
@@ -31,4 +36,34 @@ public interface Param {
//字典(sys_dict_data):风电场的ID //字典(sys_dict_data):风电场的ID
String WINDFARM = "f9145acb79cbf136b9ee89fd38d72583"; String WINDFARM = "f9145acb79cbf136b9ee89fd38d72583";
/**
* 以下的四个Map为有功功率页面查看指标详情的四个指标分组下的具体指标(指标对应的可能不对 到时候直接改map里的key即可)
* 页面展示的指标名称 对应 的表ele_epd_pqd中的名称
* map的key为的表ele_epd_pqd中的名称value为页面上展示的名称
*/
Map<String,String> DATABSEMAP = new HashMap(){{
put("频率偏差","频率偏差");
put("线电压偏差","电压偏差");
put("相电压长时闪变","长时闪变");
put("线电压总有效值","谐波电压");
put("电流总有效值","谐波电流");
put("相电压总有效值","间谐波电压");
put("电压负序不平衡度","负序电压不平衡度");
put("电流负序不平衡度","负序电流");
put("总稳态指标","三相总有功功率");
put("相电压谐波总畸变率","电压总谐波畸变率");
}};
Map<String,String> UHARMMAP = new HashMap(){{
put("相电压谐波含有率序列","电压");
}};
Map<String,String> IHARMMAP = new HashMap(){{
put("谐波电流有效值","电流");
}};
Map<String,String> INTERHARMONICMAP = new HashMap(){{
put("间谐波电压有效值序列","间谐波电压含有率");
}};
} }

View File

@@ -26,7 +26,34 @@ public class PowerStatisticsParam extends BaseParam {
@ApiModelProperty(name = "field", value = "区间字段(用于查询指标越限列表)") @ApiModelProperty(name = "field", value = "区间字段(用于查询指标越限列表)")
private String field; private String field;
@ApiModelProperty(name = "ids", value = "ids") @ApiModelProperty(name = "time0", value = "区间1时间集合")
private List<String> ids; private List<String> time0;
@ApiModelProperty(name = "time1", value = "区间2时间集合")
private List<String> time1;
@ApiModelProperty(name = "time2", value = "区间3时间集合")
private List<String> time2;
@ApiModelProperty(name = "time3", value = "区间4时间集合")
private List<String> time3;
@ApiModelProperty(name = "time4", value = "区间5时间集合")
private List<String> time4;
@ApiModelProperty(name = "time5", value = "区间6时间集合")
private List<String> time5;
@ApiModelProperty(name = "time6", value = "区间7时间集合")
private List<String> time6;
@ApiModelProperty(name = "time7", value = "区间8时间集合")
private List<String> time7;
@ApiModelProperty(name = "time8", value = "区间9时间集合")
private List<String> time8;
@ApiModelProperty(name = "time9", value = "区间10时间集合")
private List<String> time9;
} }

View File

@@ -9,9 +9,22 @@ import lombok.Data;
*/ */
@Data @Data
public class ThdDataVO { public class ThdDataVO {
private String phase;
private String statMethod;
private String anotherName; private String anotherName;
private String frequency; private Double AVGPhaseA;
private Double statisticalData; private Double AVGPhaseB;
private Double AVGPhaseC;
private Double CP95PhaseA;
private Double CP95PhaseB;
private Double CP95PhaseC;
private Double MINPhaseA;
private Double MINPhaseB;
private Double MINPhaseC;
private Double MAXPhaseA;
private Double MAXPhaseB;
private Double MAXPhaseC;
} }

View File

@@ -8,7 +8,6 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil; import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pq.pojo.bo.excel.TerminalBaseExcel; import com.njcn.device.pq.pojo.bo.excel.TerminalBaseExcel;
import com.njcn.device.pq.utils.ExcelStyleUtil;
import com.njcn.harmonic.pojo.param.PowerStatisticsParam; import com.njcn.harmonic.pojo.param.PowerStatisticsParam;
import com.njcn.harmonic.pojo.vo.PowerStatisticsTargetVO; import com.njcn.harmonic.pojo.vo.PowerStatisticsTargetVO;
import com.njcn.harmonic.pojo.vo.PowerStatisticsVO; import com.njcn.harmonic.pojo.vo.PowerStatisticsVO;
@@ -45,18 +44,18 @@ public class PowerStatisticsController extends BaseController {
* 根据监测点ID及时间获取有功功率趋势 * 根据监测点ID及时间获取有功功率趋势
*/ */
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getDataByLineId") @PostMapping("/getDataByLineId")
@ApiOperation("根据监测点ID及时间获取有功功率趋势") @ApiOperation("根据监测点ID及时间获取有功功率趋势")
public HttpResult<PowerStatisticsVO> getDataByLineId(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) { public HttpResult<PowerStatisticsVO> getDataByLineId(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) {
String methodDescribe = getMethodDescribe("getDataByLineId"); String methodDescribe = getMethodDescribe("getDataByLineId");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, powerStatisticsService.getDataByLine(powerStatisticsParam), methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, powerStatisticsService.getDataByLineId(powerStatisticsParam), methodDescribe);
} }
/** /**
* 根据监测点ID、有功功率趋势区间字段、时间获取该有功功率趋势下指标越限列表 * 根据监测点ID、有功功率趋势区间字段、时间获取该有功功率趋势下指标越限列表
*/ */
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getTargetLimitById") @PostMapping("/getTargetLimitById")
@ApiOperation("根据监测点ID、有功功率趋势区间字段、时间获取该有功功率趋势下指标越限列表") @ApiOperation("根据监测点ID、有功功率趋势区间字段、时间获取该有功功率趋势下指标越限列表")
public HttpResult<List<PowerStatisticsTargetVO>> getTargetLimitById(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) { public HttpResult<List<PowerStatisticsTargetVO>> getTargetLimitById(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) {
String methodDescribe = getMethodDescribe("getTargetLimitById"); String methodDescribe = getMethodDescribe("getTargetLimitById");
@@ -67,7 +66,7 @@ public class PowerStatisticsController extends BaseController {
* 点击越限列表时间查询指标的详细数据 * 点击越限列表时间查询指标的详细数据
*/ */
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getTargetByTime") @PostMapping("/getTargetByTime")
@ApiOperation("点击越限列表时间查询指标的详细数据") @ApiOperation("点击越限列表时间查询指标的详细数据")
public HttpResult<List<ThdDataVO>> getTargetByTime(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) { public HttpResult<List<ThdDataVO>> getTargetByTime(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) {
String methodDescribe = getMethodDescribe("getTargetByTime"); String methodDescribe = getMethodDescribe("getTargetByTime");
@@ -75,13 +74,23 @@ public class PowerStatisticsController extends BaseController {
} }
@ResponseBody @ResponseBody
@ApiOperation("导出设备基础数据模板") @ApiOperation("导出区间数据")
@GetMapping(value = "getExcelTemplate") @PostMapping(value = "exportExcelRangTemplate")
public HttpResult<String> getExcelTemplate(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) { public HttpResult<String> getExcelRangTemplate(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) {
ExportParams exportParams = new ExportParams("数据", "数据"); ExportParams exportParams = new ExportParams("区间数据", "区间数据");
exportParams.setStyle(ExcelStyleUtil.class);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, TerminalBaseExcel.class, new ArrayList<TerminalBaseExcel>()); Workbook workbook = ExcelExportUtil.exportExcel(exportParams, TerminalBaseExcel.class, new ArrayList<TerminalBaseExcel>());
String fileName = "数据.xlsx"; String fileName = "导出区间数据.xlsx";
PoiUtil.exportFileByWorkbook(workbook, fileName, response);
return null;
}
@ResponseBody
@ApiOperation("导出指标越限列表数据")
@PostMapping(value = "exportExcelListTemplate")
public HttpResult<String> getExcelListTemplate(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) {
ExportParams exportParams = new ExportParams("指标越限列表数据", "指标越限列表数据");
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, TerminalBaseExcel.class, new ArrayList<TerminalBaseExcel>());
String fileName = "导出指标越限列表数据.xlsx";
PoiUtil.exportFileByWorkbook(workbook, fileName, response); PoiUtil.exportFileByWorkbook(workbook, fileName, response);
return null; return null;
} }

View File

@@ -18,7 +18,7 @@ public interface PowerStatisticsService {
* @param powerStatisticsParam * @param powerStatisticsParam
* @return * @return
*/ */
PowerStatisticsVO getDataByLine(PowerStatisticsParam powerStatisticsParam); PowerStatisticsVO getDataByLineId(PowerStatisticsParam powerStatisticsParam);
/** /**
* 根据监测点ID、有功功率趋势区间字段、时间获取该有功功率趋势下指标越限列表 * 根据监测点ID、有功功率趋势区间字段、时间获取该有功功率趋势下指标越限列表

View File

@@ -13,13 +13,14 @@ import com.njcn.influx.pojo.dto.StatisticalDataDTO;
import com.njcn.influx.service.CommonService; import com.njcn.influx.service.CommonService;
import com.njcn.prepare.harmonic.api.event.RActivePowerRangeFeignClient; import com.njcn.prepare.harmonic.api.event.RActivePowerRangeFeignClient;
import com.njcn.prepare.harmonic.pojo.po.RActivePowerRangePO; import com.njcn.prepare.harmonic.pojo.po.RActivePowerRangePO;
import com.njcn.system.api.CsStatisticalSetFeignClient; import com.njcn.system.api.EpdFeignClient;
import com.njcn.system.pojo.po.EleEpdPqd; import com.njcn.system.pojo.po.EleEpdPqd;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -34,15 +35,20 @@ public class PowerStatisticsServiceImpl implements PowerStatisticsService {
private final RActivePowerRangeFeignClient rActivePowerRangeFeignClient; private final RActivePowerRangeFeignClient rActivePowerRangeFeignClient;
private final CsStatisticalSetFeignClient csStatisticalSetFeignClient;
private final CommonService commonService; private final CommonService commonService;
private final DecimalFormat df = new DecimalFormat(Param.DECIMAL_FORMATSTR); private final DecimalFormat df = new DecimalFormat(Param.DECIMAL_FORMATSTR);
private final EpdFeignClient epdFeignClient;
private List<String> METHODS = Arrays.asList("AVG","CP95","MIN","MAX");
private List<String> PHASE = Arrays.asList("A","B","C");
@Override @Override
public PowerStatisticsVO getDataByLine(PowerStatisticsParam powerStatisticsParam) { public PowerStatisticsVO getDataByLineId(PowerStatisticsParam powerStatisticsParam) {
RActivePowerRangePO rActivePowerRangePO = rActivePowerRangeFeignClient.getDataByLineId(powerStatisticsParam.getLineId()).getData(); RActivePowerRangePO rActivePowerRangePO = rActivePowerRangeFeignClient.getDataByLineId(powerStatisticsParam.getLineId(),
powerStatisticsParam.getSearchBeginTime(),powerStatisticsParam.getSearchEndTime()).getData();
if(rActivePowerRangePO == null){ if(rActivePowerRangePO == null){
throw new BusinessException(HarmonicResponseEnum.NO_LINE_DATA.getMessage()); throw new BusinessException(HarmonicResponseEnum.NO_LINE_DATA.getMessage());
} }
@@ -56,7 +62,7 @@ public class PowerStatisticsServiceImpl implements PowerStatisticsService {
List<PowerStatisticsTargetVO> list = new ArrayList(); List<PowerStatisticsTargetVO> list = new ArrayList();
for (int i = 0; i < (int) (Math.random() * 10 + 1); i++) { for (int i = 0; i < (int) (Math.random() * 10 + 1); i++) {
PowerStatisticsTargetVO powerStatisticsTargetVO = new PowerStatisticsTargetVO(); PowerStatisticsTargetVO powerStatisticsTargetVO = new PowerStatisticsTargetVO();
powerStatisticsTargetVO.setTime("2024-06-01 18:00:00"); powerStatisticsTargetVO.setTime("2023-02-10 09:00:0" + i);
powerStatisticsTargetVO.setVoltageOffset(1); powerStatisticsTargetVO.setVoltageOffset(1);
powerStatisticsTargetVO.setVTimes(0); powerStatisticsTargetVO.setVTimes(0);
powerStatisticsTargetVO.setITimes(1); powerStatisticsTargetVO.setITimes(1);
@@ -73,29 +79,152 @@ public class PowerStatisticsServiceImpl implements PowerStatisticsService {
@Override @Override
public List<ThdDataVO> getTargetByTime(PowerStatisticsParam powerStatisticsParam) { public List<ThdDataVO> getTargetByTime(PowerStatisticsParam powerStatisticsParam) {
List<ThdDataVO> result = new ArrayList(); List<ThdDataVO> result = new ArrayList();
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(powerStatisticsParam.getStatisticalId()).getData(); List<EleEpdPqd> eleEpdPqds = new ArrayList<>();
if("1".equals(powerStatisticsParam.getStatisticalId())){
com.njcn.device.pq.constant.Param.DATABSEMAP.forEach((key,value) ->{
List<EleEpdPqd> epdPqds = epdFeignClient.findListByShowName(key).getData();
for(EleEpdPqd epdPqd : epdPqds){
epdPqd.setShowName(value);
}
if(!epdPqds.isEmpty()){
//这边相别只需要获得一个即可
eleEpdPqds.add(epdPqds.get(0));
}
});
}
if("2".equals(powerStatisticsParam.getStatisticalId())){
com.njcn.device.pq.constant.Param.UHARMMAP.forEach((key,value) ->{
List<EleEpdPqd> epdPqds = epdFeignClient.findListByShowName(key).getData();
for(EleEpdPqd epdPqd : epdPqds){
epdPqd.setShowName(value);
}
if(!epdPqds.isEmpty()){
//这边相别只需要获得一个即可
eleEpdPqds.add(epdPqds.get(0));
}
});
}
if("3".equals(powerStatisticsParam.getStatisticalId())){
com.njcn.device.pq.constant.Param.IHARMMAP.forEach((key,value) ->{
List<EleEpdPqd> epdPqds = epdFeignClient.findListByShowName(key).getData();
for(EleEpdPqd epdPqd : epdPqds){
epdPqd.setShowName(value);
}
if(!epdPqds.isEmpty()){
//这边相别只需要获得一个即可
eleEpdPqds.add(epdPqds.get(0));
}
});
}
if("4".equals(powerStatisticsParam.getStatisticalId())){
com.njcn.device.pq.constant.Param.INTERHARMONICMAP.forEach((key,value) ->{
List<EleEpdPqd> epdPqds = epdFeignClient.findListByShowName(key).getData();
for(EleEpdPqd epdPqd : epdPqds){
epdPqd.setShowName(value);
}
if(!epdPqds.isEmpty()){
//这边相别只需要获得一个即可
eleEpdPqds.add(epdPqds.get(0));
}
});
}
eleEpdPqds.forEach(epdPqd->{ eleEpdPqds.forEach(epdPqd->{
List<CommonQueryParam> commonQueryParams = new ArrayList<>(); List<CommonQueryParam> commonQueryParams = new ArrayList<>();
commonQueryParams.clear(); commonQueryParams.clear();
CommonQueryParam commonQueryParam = new CommonQueryParam(); if(epdPqd.getHarmEnd()!=null && epdPqd.getHarmStart()!=null){
commonQueryParam.setLineId(powerStatisticsParam.getLineId()); for (int i = epdPqd.getHarmStart().intValue(); i <= epdPqd.getHarmEnd().intValue(); i++) {
commonQueryParam.setTableName(epdPqd.getClassId()); ThdDataVO thdDataVO = new ThdDataVO();
commonQueryParam.setColumnName(epdPqd.getName()); String index = i+"";
commonQueryParam.setStartTime(powerStatisticsParam.getSearchBeginTime()); if(epdPqd.getShowName().equals("间谐波电压含有率")){
commonQueryParam.setEndTime(powerStatisticsParam.getSearchEndTime()); thdDataVO.setAnotherName(Integer.parseInt(index) - 0.5 + "");
commonQueryParams.add(commonQueryParam); }else{
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams); thdDataVO.setAnotherName(index + "");
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> { }
ThdDataVO vo = new ThdDataVO(); getThdDataVO(epdPqd.getOtherName()+"_"+index,thdDataVO,epdPqd,powerStatisticsParam);
vo.setPhase(temp.getPhaseType()); result.add(thdDataVO);
vo.setStatMethod(temp.getValueType()); }
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue()))); }else{
vo.setAnotherName(epdPqd.getShowName()); ThdDataVO thdDataVO = new ThdDataVO();
return vo; thdDataVO.setAnotherName(epdPqd.getShowName());
}).collect(Collectors.toList()); getThdDataVO(null,thdDataVO,epdPqd,powerStatisticsParam);
result.addAll(collect1); result.add(thdDataVO);
}
}); });
return result; return result;
} }
private ThdDataVO getThdDataVO(String columnName,ThdDataVO thdDataVO,EleEpdPqd epdPqd,PowerStatisticsParam powerStatisticsParam){
List<CommonQueryParam> commonQueryParams = new ArrayList<>();
CommonQueryParam commonQueryParam = new CommonQueryParam();
commonQueryParam.setLineId(powerStatisticsParam.getLineId());
commonQueryParam.setTableName(epdPqd.getClassId());
commonQueryParam.setColumnName(columnName == null ? epdPqd.getOtherName():columnName);
commonQueryParam.setStartTime(powerStatisticsParam.getSearchBeginTime());
commonQueryParam.setEndTime(powerStatisticsParam.getSearchEndTime());
commonQueryParam.setDataType(METHODS.get(0));
commonQueryParam.setPhasic(PHASE.get(0));
commonQueryParams.add(commonQueryParam);
List<StatisticalDataDTO> deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
if(!deviceRtData.isEmpty()) thdDataVO.setAVGPhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue())));
commonQueryParam.setDataType(METHODS.get(0));
commonQueryParam.setPhasic(PHASE.get(1));
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
if(!deviceRtData.isEmpty()) thdDataVO.setAVGPhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue())));
commonQueryParam.setDataType(METHODS.get(0));
commonQueryParam.setPhasic(PHASE.get(2));
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
if(!deviceRtData.isEmpty()) thdDataVO.setAVGPhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue())));
commonQueryParam.setDataType(METHODS.get(1));
commonQueryParam.setPhasic(PHASE.get(0));
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
if(!deviceRtData.isEmpty()) thdDataVO.setCP95PhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue())));
commonQueryParam.setDataType(METHODS.get(1));
commonQueryParam.setPhasic(PHASE.get(1));
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
if(!deviceRtData.isEmpty()) thdDataVO.setCP95PhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue())));
commonQueryParam.setDataType(METHODS.get(1));
commonQueryParam.setPhasic(PHASE.get(2));
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
if(!deviceRtData.isEmpty()) thdDataVO.setCP95PhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue())));
commonQueryParam.setDataType(METHODS.get(2));
commonQueryParam.setPhasic(PHASE.get(0));
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
if(!deviceRtData.isEmpty()) thdDataVO.setMINPhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue())));
commonQueryParam.setDataType(METHODS.get(2));
commonQueryParam.setPhasic(PHASE.get(1));
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
if(!deviceRtData.isEmpty()) thdDataVO.setMINPhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue())));
commonQueryParam.setDataType(METHODS.get(2));
commonQueryParam.setPhasic(PHASE.get(2));
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
if(!deviceRtData.isEmpty()) thdDataVO.setMINPhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue())));
commonQueryParam.setDataType(METHODS.get(3));
commonQueryParam.setPhasic(PHASE.get(0));
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
if(!deviceRtData.isEmpty()) thdDataVO.setMAXPhaseA(Double.valueOf(df.format(deviceRtData.get(0).getValue())));
commonQueryParam.setDataType(METHODS.get(3));
commonQueryParam.setPhasic(PHASE.get(1));
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
if(!deviceRtData.isEmpty()) thdDataVO.setMAXPhaseB(Double.valueOf(df.format(deviceRtData.get(0).getValue())));
commonQueryParam.setDataType(METHODS.get(3));
commonQueryParam.setPhasic(PHASE.get(2));
deviceRtData = commonService.getNewDeviceRtDataByTime(commonQueryParams);
if(!deviceRtData.isEmpty()) thdDataVO.setMAXPhaseC(Double.valueOf(df.format(deviceRtData.get(0).getValue())));
return thdDataVO;
}
} }

View File

@@ -25,6 +25,6 @@ public interface RActivePowerRangeFeignClient {
HttpResult<Boolean> record(); HttpResult<Boolean> record();
@GetMapping("/getDataByLineId") @GetMapping("/getDataByLineId")
HttpResult<RActivePowerRangePO> getDataByLineId(@RequestParam("lineId") String lineId); HttpResult<RActivePowerRangePO> getDataByLineId(@RequestParam("lineId") String lineId,@RequestParam("startTime") String startTime,@RequestParam("endTime") String endTime);
} }

View File

@@ -36,7 +36,7 @@ public class RActivePowerRangeFeignClientFallbackFactory implements FallbackFact
} }
@Override @Override
public HttpResult<RActivePowerRangePO> getDataByLineId(String lineId) { public HttpResult<RActivePowerRangePO> getDataByLineId(String lineId,String startTime,String endTime) {
log.error("{}异常,降级处理,异常为:{}", "根据监测点ID获取有功功率趋势信息: ", throwable.toString()); log.error("{}异常,降级处理,异常为:{}", "根据监测点ID获取有功功率趋势信息: ", throwable.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }

View File

@@ -44,7 +44,7 @@ public class RActivePowerRangePO extends BaseEntity {
/** /**
* 0%~10%区间是否越限 * 0%~10%区间是否越限
*/ */
private Integer isOrNot0; private Integer isOrNot0 = 0;
/** /**
* 10%~20%区间时间Json * 10%~20%区间时间Json
@@ -59,7 +59,7 @@ public class RActivePowerRangePO extends BaseEntity {
/** /**
* 10%~20%区间是否越限 * 10%~20%区间是否越限
*/ */
private Integer isOrNot1; private Integer isOrNot1 = 0;
/** /**
* 20%~30%区间时间Json * 20%~30%区间时间Json
@@ -74,7 +74,7 @@ public class RActivePowerRangePO extends BaseEntity {
/** /**
* 20%~30%区间是否越限 * 20%~30%区间是否越限
*/ */
private Integer isOrNot2; private Integer isOrNot2 = 0;
/** /**
* 30%~40%区间时间Json * 30%~40%区间时间Json
@@ -89,7 +89,7 @@ public class RActivePowerRangePO extends BaseEntity {
/** /**
* 30%~40%区间是否越限 * 30%~40%区间是否越限
*/ */
private Integer isOrNot3; private Integer isOrNot3 = 0;
/** /**
* 40%~50%区间时间Json * 40%~50%区间时间Json
@@ -104,7 +104,7 @@ public class RActivePowerRangePO extends BaseEntity {
/** /**
* 40%~50%区间是否越限 * 40%~50%区间是否越限
*/ */
private Integer isOrNot4; private Integer isOrNot4 = 0;
/** /**
* 50%~60%区间时间Json * 50%~60%区间时间Json
@@ -119,7 +119,7 @@ public class RActivePowerRangePO extends BaseEntity {
/** /**
* 50%~60%区间是否越限 * 50%~60%区间是否越限
*/ */
private Integer isOrNot5; private Integer isOrNot5 = 0;
/** /**
* 60%~70%区间时间Json * 60%~70%区间时间Json
@@ -134,7 +134,7 @@ public class RActivePowerRangePO extends BaseEntity {
/** /**
* 60%~70%区间是否越限 * 60%~70%区间是否越限
*/ */
private Integer isOrNot6; private Integer isOrNot6 = 0;
/** /**
* 70%~80%区间时间Json * 70%~80%区间时间Json
@@ -149,7 +149,7 @@ public class RActivePowerRangePO extends BaseEntity {
/** /**
* 70%~80%区间是否越限 * 70%~80%区间是否越限
*/ */
private Integer isOrNot7; private Integer isOrNot7 = 0;
/** /**
* 80%~90%区间时间Json * 80%~90%区间时间Json
@@ -164,7 +164,7 @@ public class RActivePowerRangePO extends BaseEntity {
/** /**
* 80%~90%区间是否越限 * 80%~90%区间是否越限
*/ */
private Integer isOrNot8; private Integer isOrNot8 = 0;
/** /**
* 90%~100%区间时间Json * 90%~100%区间时间Json
@@ -179,7 +179,7 @@ public class RActivePowerRangePO extends BaseEntity {
/** /**
* 90%~100%区间是否越限 * 90%~100%区间是否越限
*/ */
private Integer isOrNot9; private Integer isOrNot9 = 0;
/** /**
* 状态0-删除 1-正常 * 状态0-删除 1-正常

View File

@@ -42,10 +42,10 @@ public class RActivePowerRangeController extends BaseController {
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY) @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY)
@GetMapping("/getDataByLineId") @GetMapping("/getDataByLineId")
@ApiOperation("根据监测点ID获取有功功率趋势信息") @ApiOperation("根据监测点ID及时间获取有功功率趋势")
public HttpResult<RActivePowerRangePO> getDataByLineId(@RequestParam("lineId") String lineId) { public HttpResult<RActivePowerRangePO> getDataByLineId(@RequestParam("lineId") String lineId,@RequestParam("startTime") String startTime,@RequestParam("endTime") String endTime) {
String methodDescribe = getMethodDescribe("getDataByLineId"); String methodDescribe = getMethodDescribe("getDataByLineId");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rActivePowerRangeService.getDataByLineId(lineId), methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rActivePowerRangeService.getDataByLineId(lineId,startTime,endTime), methodDescribe);
} }
} }

View File

@@ -121,9 +121,34 @@ public class RActivePowerRangeServiceImpl extends MppServiceImpl<RActivePowerRan
} }
@Override @Override
public RActivePowerRangePO getDataByLineId(String lineId) { public RActivePowerRangePO getDataByLineId(String lineId,String startTime,String endTime) {
LambdaQueryWrapper<RActivePowerRangePO> lambdaQueryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<RActivePowerRangePO> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.eq(RActivePowerRangePO::getLineId,lineId).eq(RActivePowerRangePO::getState,"1"); lambdaQueryWrapper.eq(RActivePowerRangePO::getLineId,lineId).eq(RActivePowerRangePO::getState,"1")
return this.baseMapper.selectOne(lambdaQueryWrapper); .between(RActivePowerRangePO::getTimeId,startTime,endTime);
List<RActivePowerRangePO> rActivePowerRangePOS = this.baseMapper.selectList(lambdaQueryWrapper);
RActivePowerRangePO rActivePowerRangePO = new RActivePowerRangePO();
for(RActivePowerRangePO rangePO : rActivePowerRangePOS){
rActivePowerRangePO.setMinsNum0(rangePO.getMinsNum0()+rActivePowerRangePO.getMinsNum0());
rActivePowerRangePO.setMinsNum1(rangePO.getMinsNum1()+rActivePowerRangePO.getMinsNum1());
rActivePowerRangePO.setMinsNum2(rangePO.getMinsNum2()+rActivePowerRangePO.getMinsNum2());
rActivePowerRangePO.setMinsNum3(rangePO.getMinsNum3()+rActivePowerRangePO.getMinsNum3());
rActivePowerRangePO.setMinsNum4(rangePO.getMinsNum4()+rActivePowerRangePO.getMinsNum4());
rActivePowerRangePO.setMinsNum5(rangePO.getMinsNum5()+rActivePowerRangePO.getMinsNum5());
rActivePowerRangePO.setMinsNum6(rangePO.getMinsNum6()+rActivePowerRangePO.getMinsNum6());
rActivePowerRangePO.setMinsNum7(rangePO.getMinsNum7()+rActivePowerRangePO.getMinsNum7());
rActivePowerRangePO.setMinsNum8(rangePO.getMinsNum8()+rActivePowerRangePO.getMinsNum8());
rActivePowerRangePO.setMinsNum9(rangePO.getMinsNum9()+rActivePowerRangePO.getMinsNum9());
rActivePowerRangePO.setIsOrNot0(rangePO.getIsOrNot0()+rActivePowerRangePO.getIsOrNot0());
rActivePowerRangePO.setIsOrNot1(rangePO.getIsOrNot1()+rActivePowerRangePO.getIsOrNot1());
rActivePowerRangePO.setIsOrNot2(rangePO.getIsOrNot2()+rActivePowerRangePO.getIsOrNot2());
rActivePowerRangePO.setIsOrNot3(rangePO.getIsOrNot3()+rActivePowerRangePO.getIsOrNot3());
rActivePowerRangePO.setIsOrNot4(rangePO.getIsOrNot4()+rActivePowerRangePO.getIsOrNot4());
rActivePowerRangePO.setIsOrNot5(rangePO.getIsOrNot5()+rActivePowerRangePO.getIsOrNot5());
rActivePowerRangePO.setIsOrNot6(rangePO.getIsOrNot6()+rActivePowerRangePO.getIsOrNot6());
rActivePowerRangePO.setIsOrNot7(rangePO.getIsOrNot7()+rActivePowerRangePO.getIsOrNot7());
rActivePowerRangePO.setIsOrNot8(rangePO.getIsOrNot8()+rActivePowerRangePO.getIsOrNot8());
rActivePowerRangePO.setIsOrNot9(rangePO.getIsOrNot9()+rActivePowerRangePO.getIsOrNot9());
}
return rActivePowerRangePO;
} }
} }

View File

@@ -16,8 +16,8 @@ public interface RActivePowerRangeService extends IMppService<RActivePowerRangeP
void record(); void record();
/** /**
* 根据监测点ID获取有功功率趋势信息 * 根据监测点ID及时间获取有功功率趋势
*/ */
RActivePowerRangePO getDataByLineId(String lineId); RActivePowerRangePO getDataByLineId(String lineId,String startTime,String endTime);
} }

View File

@@ -55,4 +55,7 @@ public interface EpdFeignClient {
@PostMapping("/findByName") @PostMapping("/findByName")
HttpResult<EleEpdPqd> findByName(@RequestParam("name") String name); HttpResult<EleEpdPqd> findByName(@RequestParam("name") String name);
@PostMapping("/findListByShowName")
HttpResult<List<EleEpdPqd>> findListByShowName(@RequestParam("name") String name);
} }

View File

@@ -100,6 +100,12 @@ public class EpdFeignClientFallbackFactory implements FallbackFactory<EpdFeignCl
log.error("{}异常,降级处理,异常为:{}","根据名称查询字典信息",cause.toString()); log.error("{}异常,降级处理,异常为:{}","根据名称查询字典信息",cause.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<List<EleEpdPqd>> findListByShowName(String name) {
log.error("{}异常,降级处理,异常为:{}","根据名称查询字典信息集合",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
}; };
} }
} }

View File

@@ -214,5 +214,16 @@ public class EleEpdPqdController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
} }
@PostMapping("/findListByShowName")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("根据名称查询字典信息集合")
@ApiImplicitParam(name = "name", value = "指标名称", required = true)
@ApiIgnore
public HttpResult<List<EleEpdPqd>> findListByShowName(@RequestParam("name") @Validated String name){
String methodDescribe = getMethodDescribe("findListByShowName");
List<EleEpdPqd> po = eleEpdPqdService.lambdaQuery().eq(EleEpdPqd::getShowName,name).list();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
}
} }