|
@@ -448,8 +448,8 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
// 将气象站信息过滤出上报
|
|
|
List<WeatherStationInfo> weatherStationInfos = weatherStationInfoList.stream().filter(w -> w.getReport() == true).collect(Collectors.toList());
|
|
|
if (!weatherStationInfos.isEmpty()) {
|
|
|
- String uploadWeatherStationNo = weatherStationInfos.get(0).getEquipmentNo();
|
|
|
- Map<String, String> qxzMap = redisUtils.hgetall("qxz-" + electricFieldInfo.getStationCode() + "-" + uploadWeatherStationNo);
|
|
|
+ String id = String.valueOf(weatherStationInfos.get(0).getId());
|
|
|
+ Map<String, String> qxzMap = redisUtils.hgetall("qxz-" + electricFieldInfo.getStationCode() + "-" + id);
|
|
|
// 数据格式化
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
BigDecimal globalR = new BigDecimal(0);
|
|
@@ -544,8 +544,8 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
// 将测风塔信息过滤出上报的塔
|
|
|
List<WindTowerInfo> filterWindTowerInfoList = windTowerInfoList.stream().filter(w -> w.getReport() == true).collect(Collectors.toList());
|
|
|
if (!filterWindTowerInfoList.isEmpty()) {
|
|
|
- String uploadWindtowerStationNo = filterWindTowerInfoList.get(0).getEquipmentNo();
|
|
|
- Map<String, String> cftMap = redisUtils.hgetall("cft-" + electricFieldInfo.getStationCode() + "-" + uploadWindtowerStationNo);
|
|
|
+ String id = String.valueOf(filterWindTowerInfoList.get(0).getId());
|
|
|
+ Map<String, String> cftMap = redisUtils.hgetall("cft-" + electricFieldInfo.getStationCode() + "-" + id);
|
|
|
// 数据格式化
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
BigDecimal ws10 = new BigDecimal(0);
|
|
@@ -803,8 +803,8 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
map.put("elName",electricFieldInfo.getName());
|
|
|
map.put("collectorCircuit",windTurbineInfo.getCollectorCircuit());
|
|
|
|
|
|
- String windTurbineEquipmentNo = windTurbineInfo.getEquipmentNo();
|
|
|
- Map<String, String> fjMap = redisUtils.hgetall("fj-" + electricFieldInfo.getStationCode() + "-" + windTurbineEquipmentNo);
|
|
|
+ String id = String.valueOf(windTurbineInfo.getId());
|
|
|
+ Map<String, String> fjMap = redisUtils.hgetall("fj-" + electricFieldInfo.getStationCode() + "-" + id);
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
|
|
|
// 状态
|
|
@@ -943,8 +943,8 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
map.put("sample", inverterInfo.getSample() ? "1" : "0");
|
|
|
//是否组串
|
|
|
map.put("IsString", inverterInfo.getGroupSeries() ? "1" : "0");
|
|
|
- String inverterEquipmentNo = inverterInfo.getEquipmentNo();
|
|
|
- Map<String, String> nbqMap = redisUtils.hgetall("nbq-" + electricFieldInfo.getStationCode() + "-" + inverterEquipmentNo);
|
|
|
+ String id = String.valueOf(inverterInfo.getId());
|
|
|
+ Map<String, String> nbqMap = redisUtils.hgetall("nbq-" + electricFieldInfo.getStationCode() + "-" + id);
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
// 状态
|
|
|
String status = "1";
|
|
@@ -1050,23 +1050,21 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
if (date != null) {
|
|
|
systemDate = date;
|
|
|
}
|
|
|
- Long startTime = DateMomentUtil.getMomentTime(systemDate.getTime() - 5 * 60 * 1000, 1, 5 * 60 * 1000L);
|
|
|
- Long endTime = startTime + 5 * 60 * 1000 - 1000;
|
|
|
+ Long endTime = DateMomentUtil.getMomentTime(systemDate.getTime(), 1, 5 * 60 * 1000L);
|
|
|
+ Long startTime = endTime - 4 * 60 * 1000;
|
|
|
// 生成上报文件名格式
|
|
|
Template template = null;
|
|
|
if (electricFieldInfo.getElectricFieldTypeEnum().toString().equals("E1")) {
|
|
|
- // 获取气象站模板
|
|
|
- template = this.velocityEngine.getTemplate(this.vmsPath + "/THEROY.vm");
|
|
|
- fileName = e63UploadFileRuleService.getFileNameRule(electricFieldInfo, "E3", endTime + 1000);
|
|
|
+ fileName = e63UploadFileRuleService.getFileNameRule(electricFieldInfo, "E3", endTime);
|
|
|
if (getFileName(fileName, "E3", stationCode)) {
|
|
|
- // 理论功率光
|
|
|
+ template = this.velocityEngine.getTemplate(this.vmsPath + "/THEROY.vm");
|
|
|
generatePvTheroyFile(fileName, template, electricFieldInfo, date, startTime, endTime);
|
|
|
}
|
|
|
} else {
|
|
|
- template = this.velocityEngine.getTemplate(this.vmsPath + "/THEROY_F.vm");
|
|
|
- fileName = e63UploadFileRuleService.getFileNameRule(electricFieldInfo, "E85", endTime + 1000);
|
|
|
+ fileName = e63UploadFileRuleService.getFileNameRule(electricFieldInfo, "E85", endTime);
|
|
|
if (getFileName(fileName, "E85", stationCode)) {
|
|
|
// 理论功率风
|
|
|
+ template = this.velocityEngine.getTemplate(this.vmsPath + "/THEROY_F.vm");
|
|
|
generateWpTheroyFile(fileName, template, electricFieldInfo, date, startTime, endTime);
|
|
|
}
|
|
|
}
|
|
@@ -1080,36 +1078,41 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
* 生成理论功率光上报文件
|
|
|
*/
|
|
|
private void generatePvTheroyFile(String fileName, Template template, ElectricField electricFieldInfo, Date date, Long startTime, Long endTime) {
|
|
|
- // powerStationStatusDataList需要从缓存获取
|
|
|
- List<PowerStationStatusData> powerStationStatusDataList = new ArrayList<>();
|
|
|
// 样板机变量
|
|
|
float ableValueAfter = 0f;
|
|
|
// 辐照仪变量
|
|
|
float theoryValueAfter = 0f;
|
|
|
- if (powerStationStatusDataList.size() > 0) {
|
|
|
- // 实际功率按时间降序
|
|
|
- powerStationStatusDataList.sort(Comparator.comparing(PowerStationStatusData::getTime).reversed());
|
|
|
- // 对预测值保留2位小数显示输出
|
|
|
- DecimalFormat df = new DecimalFormat("0.00");
|
|
|
- // 取最后一个时间的数据
|
|
|
- PowerStationStatusData powerStationStatusData = powerStationStatusDataList.get(0);
|
|
|
- ableValueAfter = Float.parseFloat(df.format(powerStationStatusData.getAbleValue().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : powerStationStatusData.getAbleValue()));
|
|
|
- theoryValueAfter = Float.parseFloat(df.format(powerStationStatusData.getTheoryValue().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : powerStationStatusData.getTheoryValue()));
|
|
|
+ Map<String, String> powerMap = redisUtils.hgetall("power-" + electricFieldInfo.getStationCode());
|
|
|
+ if (!powerMap.isEmpty()) {
|
|
|
+ String time = powerMap.get("time");
|
|
|
+ if (StrUtil.isNotBlank(time)) {
|
|
|
+ if (Long.parseLong(time) >= startTime && Long.parseLong(time) <= endTime) {
|
|
|
+ // 对预测值保留2位小数显示输出
|
|
|
+ DecimalFormat df = new DecimalFormat("0.00");
|
|
|
+ if (powerMap.get("ableValue") != null) {
|
|
|
+ ableValueAfter = Float.parseFloat(powerMap.get("ableValue"));
|
|
|
+ }
|
|
|
+ if (powerMap.get("theoryValue") != null) {
|
|
|
+ theoryValueAfter = Float.parseFloat(powerMap.get("theoryValue"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ DecimalFormat df = new DecimalFormat("0.00");
|
|
|
// 创建上报文件
|
|
|
File file = super.createTempFile(fileName);
|
|
|
// 根据模板生成文件内容
|
|
|
VelocityContext velocityContext = new VelocityContext();
|
|
|
// 样板机
|
|
|
- velocityContext.put("ableValueAfter", ableValueAfter);
|
|
|
+ velocityContext.put("ableValueAfter", df.format(ableValueAfter));
|
|
|
// 辐照仪
|
|
|
- velocityContext.put("theoryValueAfter", theoryValueAfter);
|
|
|
+ velocityContext.put("theoryValueAfter", df.format(theoryValueAfter));
|
|
|
// 场站标识
|
|
|
velocityContext.put("sign", electricFieldInfo.getSign());
|
|
|
// 系统当前日期
|
|
|
- velocityContext.put("currentTime", DateFormatUtils.format(endTime + 1000, "yyyy-MM-dd_HH:mm") + ":00");
|
|
|
+ velocityContext.put("currentTime", DateFormatUtils.format(endTime, "yyyy-MM-dd_HH:mm") + ":00");
|
|
|
// 上报数据开始日期
|
|
|
- velocityContext.put("uploadTime", DateFormatUtils.format(endTime + 1000 * 60 * 5 + 1000, "yyyy-MM-dd_HH:mm"));
|
|
|
+ velocityContext.put("uploadTime", DateFormatUtils.format(endTime, "yyyy-MM-dd_HH:mm"));
|
|
|
StringWriter writer = new StringWriter();
|
|
|
template.merge(velocityContext, writer);
|
|
|
super.copyUploadFile(writer, file, FileTypeEnum.E3.name(), null, date, electricFieldInfo.getStationCode());
|
|
@@ -1129,37 +1132,45 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
float referencePowerBySampleAfter = 0f;
|
|
|
//测风
|
|
|
float referencePowerByMeasuringAfter = 0f;
|
|
|
-
|
|
|
- if (powerStationStatusDataList.size() > 0) {
|
|
|
- // 实际功率按时间降序
|
|
|
- powerStationStatusDataList.sort(Comparator.comparing(PowerStationStatusData::getTime).reversed());
|
|
|
- // 对预测值保留2位小数显示输出
|
|
|
- DecimalFormat df = new DecimalFormat("0.00");
|
|
|
- // 取最后一个时间的数据
|
|
|
- PowerStationStatusData powerStationStatusData = powerStationStatusDataList.get(0);
|
|
|
- ableValueAfter = Float.parseFloat(df.format(powerStationStatusData.getAbleValue().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : powerStationStatusData.getAbleValue()));
|
|
|
- theoryValueAfter = Float.parseFloat(df.format(powerStationStatusData.getTheoryValue().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : powerStationStatusData.getTheoryValue()));
|
|
|
- referencePowerBySampleAfter = Float.parseFloat(df.format(powerStationStatusData.getReferencePowerBySample().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : powerStationStatusData.getReferencePowerBySample()));
|
|
|
- referencePowerByMeasuringAfter = Float.parseFloat(df.format(powerStationStatusData.getReferencePowerByMeasuring().compareTo(new BigDecimal(-99)) == 0 ? new BigDecimal(0) : powerStationStatusData.getReferencePowerByMeasuring()));
|
|
|
+ Map<String, String> powerMap = redisUtils.hgetall("power-" + electricFieldInfo.getStationCode());
|
|
|
+ if (!powerMap.isEmpty()) {
|
|
|
+ String time = powerMap.get("time");
|
|
|
+ if (StrUtil.isNotBlank(time)) {
|
|
|
+ if (Long.parseLong(time) >= startTime && Long.parseLong(time) <= endTime) {
|
|
|
+ if (powerMap.get("ableValue") != null) {
|
|
|
+ ableValueAfter = Float.parseFloat(powerMap.get("ableValue"));
|
|
|
+ }
|
|
|
+ if (powerMap.get("theoryValue") != null) {
|
|
|
+ theoryValueAfter = Float.parseFloat(powerMap.get("theoryValue"));
|
|
|
+ }
|
|
|
+ if (powerMap.get("referencePowerBySample") != null) {
|
|
|
+ referencePowerBySampleAfter = Float.parseFloat(powerMap.get("referencePowerBySample"));
|
|
|
+ }
|
|
|
+ if (powerMap.get("referencePowerByMeasuring") != null) {
|
|
|
+ referencePowerByMeasuringAfter = Float.parseFloat(powerMap.get("referencePowerByMeasuring"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ DecimalFormat df = new DecimalFormat("0.00");
|
|
|
// 创建上报文件
|
|
|
File file = super.createTempFile(fileName);
|
|
|
// 根据模板生成文件内容
|
|
|
VelocityContext velocityContext = new VelocityContext();
|
|
|
// 样板机
|
|
|
- velocityContext.put("ableValueAfter", ableValueAfter);
|
|
|
+ velocityContext.put("ableValueAfter", df.format(ableValueAfter));
|
|
|
// 辐照仪
|
|
|
- velocityContext.put("theoryValueAfter", theoryValueAfter);
|
|
|
+ velocityContext.put("theoryValueAfter", df.format(theoryValueAfter));
|
|
|
// 样板机
|
|
|
- velocityContext.put("referencePowerBySampleAfter", referencePowerBySampleAfter);
|
|
|
+ velocityContext.put("referencePowerBySampleAfter", df.format(referencePowerBySampleAfter));
|
|
|
// 测风
|
|
|
- velocityContext.put("referencePowerByMeasuringAfter", referencePowerByMeasuringAfter);
|
|
|
+ velocityContext.put("referencePowerByMeasuringAfter", df.format(referencePowerByMeasuringAfter));
|
|
|
// 场站标识
|
|
|
velocityContext.put("sign", electricFieldInfo.getSign());
|
|
|
// 系统当前日期
|
|
|
- velocityContext.put("currentTime", DateFormatUtils.format(endTime + 1000, "yyyy-MM-dd_HH:mm") + ":00");
|
|
|
+ velocityContext.put("currentTime", DateFormatUtils.format(endTime, "yyyy-MM-dd_HH:mm") + ":00");
|
|
|
// 上报数据开始日期
|
|
|
- velocityContext.put("uploadTime", DateFormatUtils.format(endTime + 1000 * 60 * 5 + 1000, "yyyy-MM-dd_HH:mm") + ":00");
|
|
|
+ velocityContext.put("uploadTime", DateFormatUtils.format(endTime, "yyyy-MM-dd_HH:mm") + ":00");
|
|
|
StringWriter writer = new StringWriter();
|
|
|
template.merge(velocityContext, writer);
|
|
|
super.copyUploadFile(writer, file, FileTypeEnum.E85.name(), null, date, electricFieldInfo.getStationCode());
|