mppt模块

This commit is contained in:
2026-02-26 15:00:18 +08:00
parent 658b84faeb
commit 2d1371033c
50 changed files with 1906 additions and 443 deletions

View File

@ -1597,7 +1597,47 @@ public class Device001ApiController {
}
return DataResult.success(list);
}
/**
* 冻结光伏-Mppt日发电量
* @param query
* @return
*/
@PostMapping("getToDayPVMpptCharge")
public DataResult<StationHomeRespVo> getToDayPVMpptCharge(@RequestBody TdBaseTimeQuery query){
//拼接后缀表名
Map<Integer, String> colNameMap = query.getMap();
String modelName = query.getModelName();
StationHomeRespVo stationHomeRespVo = new StationHomeRespVo();
if (colNameMap != null) {
//查询发电量
String charge = colNameMap.get(query.getSrcId());
if (charge != null) {
query.setBeginLong(query.getBegin().getTime());
query.setEndLong(query.getEnd().getTime());
query.setCol(charge);
String tableName = getTableName(query);
log.info("charge != null");
//计算昨日发电量
BigDecimal ele = getPvBigDecimal(query, tableName, modelName, charge, DeviceTypeConstant.PV_DAILY_CHARGE_START);
stationHomeRespVo.setDigital(ele);
// 缓存今日发电量起始值
query.setBeginLong(DateUtil.beginOfDay(DateUtil.date()).getTime());
query.setEndLong(DateUtil.endOfDay(DateUtil.date()).getTime());
List<StationHomeRespVo> stationHomeRespVos = null;
if (DeviceTypeConstant.DEVICE_SIMPLE.equals(modelName)) {
stationHomeRespVos = deviceSimpleMapper.selectAll(query, tableName);
} else if (DeviceTypeConstant.DEVICE_COMPLEX.equals(modelName)) {
stationHomeRespVos = deviceComplexMapper.selectAll(query, tableName);
}
if (stationHomeRespVos != null && stationHomeRespVos.size() > 0) {
BigDecimal startEle = stationHomeRespVos.get(0).getDigital();
query.setBegin(DateUtil.beginOfDay(new Date()));
cacheObj(query, DeviceTypeConstant.PV_DAILY_CHARGE_START, startEle);
}
}
}
return DataResult.success(stationHomeRespVo);
}
/**
* 光伏累计充
*/
@ -1780,6 +1820,31 @@ public class Device001ApiController {
return ele;
}
@NotNull
private BigDecimal getPvBigDecimal(TdBaseTimeQuery query, String tableName, String modelName, String col, String dayCol) {
long start = System.currentTimeMillis();
List<StationHomeRespVo> stationHomeRespVos = null;
if (DeviceTypeConstant.DEVICE_SIMPLE.equals(modelName)) {
stationHomeRespVos = deviceSimpleMapper.selectAll(query, tableName);
} else if (DeviceTypeConstant.DEVICE_COMPLEX.equals(modelName)) {
stationHomeRespVos = deviceComplexMapper.selectAll(query, tableName);
}
BigDecimal ele = BigDecimal.ZERO;
if (stationHomeRespVos != null && stationHomeRespVos.size() > 0) {
int len = stationHomeRespVos.size();
BigDecimal startEle = stationHomeRespVos.get(0).getDigital();
BigDecimal endEle = stationHomeRespVos.get(len - 1).getDigital();
ele = endEle.subtract(startEle);
//处理异常值
ele = handleEle(ele, startEle, endEle, stationHomeRespVos);
} else {
log.info("getDayPowerGeneration get stationHomeRespVos is empty,col:{},tableName:{},time:{}", col, tableName, new Date());
}
long end = System.currentTimeMillis();
log.info("getBigDecimal used1:" + (end - start));
return ele;
}
/**
* 异常值处理
*