|
@@ -787,24 +787,132 @@ public class E63UploadFileService extends BaseUploadFileService {
|
|
|
* 生成风机上报文件
|
|
|
*/
|
|
|
private void generateFjFile(String fileName, Template template, ElectricField electricFieldInfo, Date date, Long startTime, Long endTime) {
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- // 创建上报文件
|
|
|
- File file = super.createTempFile(fileName);
|
|
|
- VelocityContext velocityContext = new VelocityContext();
|
|
|
- // 根据模板生成文件内容
|
|
|
- velocityContext.put("vList", null);
|
|
|
- // 场站标识
|
|
|
- velocityContext.put("sign", electricFieldInfo.getSign());
|
|
|
- // 场站装机容量
|
|
|
- velocityContext.put("capacity", electricFieldInfo.getCapacity());
|
|
|
- // 系统当前日期
|
|
|
- velocityContext.put("currentTime", DateFormatUtils.format(endTime + 1000, "yyyy-MM-dd_HH:mm") + ":00");
|
|
|
- // 上报数据开始日期
|
|
|
- velocityContext.put("uploadTime", DateFormatUtils.format(endTime + 1000, "yyyy-MM-dd_HH:mm"));
|
|
|
+ // 获取风机信息
|
|
|
+ List<WindTurbineInfo> windTurbineInfoList = windTurbineInfoRepository.findAll();
|
|
|
+ // 将测风塔信息过滤出上报的塔
|
|
|
+ List<WindTurbineInfo> filterWindTurbineInfoList = windTurbineInfoList.stream().filter(w -> w.getReport() == true).collect(Collectors.toList());
|
|
|
+ if (filterWindTurbineInfoList.size() > 0) {
|
|
|
+ List<Map<String, Object>> fanList = new ArrayList<>();
|
|
|
+ for (WindTurbineInfo windTurbineInfo : filterWindTurbineInfoList) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("name", windTurbineInfo.getName());
|
|
|
+ map.put("dtaStatus", windTurbineInfo);
|
|
|
+ map.put("sample", windTurbineInfo.getSample() ? "1" : "0");
|
|
|
+ map.put("modelNumber", windTurbineInfo.getModelNumber());
|
|
|
+ map.put("RatedCapacity", div(new BigDecimal(windTurbineInfo.getMaxPower()),new BigDecimal("1000"),2));
|
|
|
+ map.put("elName",electricFieldInfo.getName());
|
|
|
+ map.put("collectorCircuit",windTurbineInfo.getCollectorCircuit());
|
|
|
|
|
|
- StringWriter writer = new StringWriter();
|
|
|
- template.merge(velocityContext, writer);
|
|
|
- super.copyUploadFile(writer, file, FileTypeEnum.E9.name(), null, date, electricFieldInfo.getStationCode());
|
|
|
+ String windTurbineEquipmentNo = windTurbineInfo.getEquipmentNo();
|
|
|
+ Map<String, String> fjMap = redisUtils.hgetall("fj-" + electricFieldInfo.getStationCode() + "-" + windTurbineEquipmentNo);
|
|
|
+ DecimalFormat df = new DecimalFormat("0.00");
|
|
|
+
|
|
|
+ // 状态
|
|
|
+ String status = "1";
|
|
|
+ // 有功
|
|
|
+ BigDecimal activePower = new BigDecimal("0");
|
|
|
+ // 无功
|
|
|
+ BigDecimal reactivePower = new BigDecimal("0");
|
|
|
+ // 功率因数
|
|
|
+ BigDecimal powerFactor = new BigDecimal("0");
|
|
|
+ // 电压
|
|
|
+ BigDecimal voltage = new BigDecimal("0");
|
|
|
+ // 电流
|
|
|
+ BigDecimal electricalCurrent = new BigDecimal("0");
|
|
|
+ // 当日发电量
|
|
|
+ BigDecimal dayElectricQuantity = new BigDecimal("0");
|
|
|
+ // 转速
|
|
|
+ BigDecimal windWheelRatedSpeed = new BigDecimal("0");
|
|
|
+ // 风速
|
|
|
+ BigDecimal ws = new BigDecimal("0");
|
|
|
+ // 风向
|
|
|
+ BigDecimal wd = new BigDecimal("0");
|
|
|
+ // 温度
|
|
|
+ BigDecimal t = new BigDecimal("0");
|
|
|
+ // 桨距角
|
|
|
+ BigDecimal pitchAngle = new BigDecimal("0");
|
|
|
+ // 累积发电量
|
|
|
+ BigDecimal cumulativeGeneratedEnergy = new BigDecimal("0");
|
|
|
+
|
|
|
+ if (!fjMap.isEmpty()) {
|
|
|
+ String time = fjMap.get("time");
|
|
|
+ if (StrUtil.isNotBlank(time)) {
|
|
|
+ if (Long.parseLong(time) >= startTime && Long.parseLong(time) <= endTime) {
|
|
|
+ if (fjMap.get("status") != null) {
|
|
|
+ status = fjMap.get("status");
|
|
|
+ }
|
|
|
+ if (fjMap.get("activePower") != null) {
|
|
|
+ activePower = new BigDecimal(fjMap.get("activePower"));
|
|
|
+ }
|
|
|
+ if (fjMap.get("reactivePower") != null) {
|
|
|
+ reactivePower = new BigDecimal(fjMap.get("reactivePower"));
|
|
|
+ }
|
|
|
+ if (fjMap.get("powerFactor") != null) {
|
|
|
+ powerFactor = new BigDecimal(fjMap.get("powerFactor"));
|
|
|
+ }
|
|
|
+ if (fjMap.get("voltage") != null) {
|
|
|
+ voltage = new BigDecimal(fjMap.get("voltage"));
|
|
|
+ }
|
|
|
+ if (fjMap.get("electricalCurrent") != null) {
|
|
|
+ electricalCurrent = new BigDecimal(fjMap.get("electricalCurrent"));
|
|
|
+ }
|
|
|
+ if (fjMap.get("dayElectricQuantity") != null) {
|
|
|
+ dayElectricQuantity = new BigDecimal(fjMap.get("dayElectricQuantity"));
|
|
|
+ }
|
|
|
+ if (fjMap.get("cumulativeGeneratedEnergy") != null) {
|
|
|
+ cumulativeGeneratedEnergy = new BigDecimal(fjMap.get("cumulativeGeneratedEnergy"));
|
|
|
+ }
|
|
|
+ if (fjMap.get("windWheelRatedSpeed") != null) {
|
|
|
+ windWheelRatedSpeed = new BigDecimal(fjMap.get("windWheelRatedSpeed"));
|
|
|
+ }
|
|
|
+ if (fjMap.get("ws") != null) {
|
|
|
+ ws = new BigDecimal(fjMap.get("ws"));
|
|
|
+ }
|
|
|
+ if (fjMap.get("wd") != null) {
|
|
|
+ wd = new BigDecimal(fjMap.get("wd"));
|
|
|
+ }
|
|
|
+ if (fjMap.get("t") != null) {
|
|
|
+ t = new BigDecimal(fjMap.get("t"));
|
|
|
+ }
|
|
|
+ if (fjMap.get("pitchAngle") != null) {
|
|
|
+ pitchAngle = new BigDecimal(fjMap.get("pitchAngle"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("ActivePower", div(activePower, new BigDecimal("1000"), 2).toString());
|
|
|
+ map.put("ReActivePower", div(reactivePower, new BigDecimal("1000"), 2).toString());
|
|
|
+ map.put("RotationlSpeed", df.format(windWheelRatedSpeed));
|
|
|
+ map.put("WS", df.format(ws));
|
|
|
+ map.put("WD", df.format(wd));
|
|
|
+ map.put("T", df.format(t));
|
|
|
+ map.put("Voltage", df.format(voltage));
|
|
|
+ map.put("GalvanicCurrent", df.format(electricalCurrent));
|
|
|
+ map.put("PowerFactor", df.format(powerFactor));
|
|
|
+ map.put("GeneratingCap", df.format(cumulativeGeneratedEnergy));
|
|
|
+ map.put("dtaStatus", status);
|
|
|
+ map.put("DayElectricQuantity", df.format(dayElectricQuantity));
|
|
|
+ map.put("PropellerPitchAngle", df.format(pitchAngle));
|
|
|
+ fanList.add(map);
|
|
|
+ }
|
|
|
+ // 创建上报文件
|
|
|
+ File file = super.createTempFile(fileName);
|
|
|
+ VelocityContext velocityContext = new VelocityContext();
|
|
|
+ // 根据模板生成文件内容
|
|
|
+ velocityContext.put("vList", fanList);
|
|
|
+ // 场站标识
|
|
|
+ velocityContext.put("sign", electricFieldInfo.getSign());
|
|
|
+ // 场站装机容量
|
|
|
+ velocityContext.put("capacity", electricFieldInfo.getCapacity());
|
|
|
+ // 系统当前日期
|
|
|
+ velocityContext.put("currentTime", DateFormatUtils.format(endTime, "yyyy-MM-dd_HH:mm") + ":00");
|
|
|
+ // 上报数据开始日期
|
|
|
+ velocityContext.put("uploadTime", DateFormatUtils.format(endTime, "yyyy-MM-dd_HH:mm"));
|
|
|
+
|
|
|
+ StringWriter writer = new StringWriter();
|
|
|
+ template.merge(velocityContext, writer);
|
|
|
+ super.copyUploadFile(writer, file, FileTypeEnum.E9.name(), null, date, electricFieldInfo.getStationCode());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|