Commit ec3b3c7b authored by tangwei's avatar tangwei

解决冲突

parents a644ac9a 1c41e359
...@@ -62,6 +62,21 @@ public class GolangRequestUtil { ...@@ -62,6 +62,21 @@ public class GolangRequestUtil {
return result; return result;
} }
// public JSONArray getResPonse(String apiurl,String requestMethod,String requestParmInfo,String ResultResolveRule) {
// String respone = "";
// String params = "";
// JSONArray jsonArray = null;
// HashMap<String, Object> producerInfo = getHeaderOfGolang();
// String baseurl = (String) producerInfo.get("apiurl");
// HashMap<String, String> headMap = (HashMap<String, String>) producerInfo.get("header");
// String orginalAuthorization = headMap.get("Authorization") + ":";
// String url = baseurl + apiurl;
// String appsecret = (String) producerInfo.get("appsecret");
// JLYHeaderMapHandler(params, headMap, orginalAuthorization, appsecret,apiurl);
// respone = sendRequest(requestMethod, url,requestParmInfo, headMap);
// jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone);
// return jsonArray;
// }
/** /**
* @param resultResovle 请求返回的解析规则 来源与数据库 * @param resultResovle 请求返回的解析规则 来源与数据库
* @param response 请求返回的字符串 * @param response 请求返回的字符串
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.api.householdapi.constant; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.api.householdapi.constant;
import org.apache.xmlbeans.impl.xb.xsdschema.Public; import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import java.time.format.DateTimeFormatter;
import java.util.HashMap; import java.util.HashMap;
public class GoLangConstant { public class GoLangConstant {
...@@ -22,6 +23,22 @@ public class GoLangConstant { ...@@ -22,6 +23,22 @@ public class GoLangConstant {
put("5", "外置电表"); put("5", "外置电表");
} }
}; };
public static final HashMap<String, String> alarmLevel = new HashMap<String, String>() {
{
put("1", "提示");
put("2", "一般");
put("3", "紧急");
}
};
public static final HashMap<String, String> alarmstatus = new HashMap<String, String>() {
{
put("0", "未处理");
put("1", "已处理");
put("2", "已恢复");
}
};
public static String baseurl = "https://api.ginlong.com:13333"; public static String baseurl = "https://api.ginlong.com:13333";
public static String tokenurl = ""; public static String tokenurl = "";
public static String prodcerappid = "1300386381676732593"; public static String prodcerappid = "1300386381676732593";
...@@ -32,7 +49,11 @@ public class GoLangConstant { ...@@ -32,7 +49,11 @@ public class GoLangConstant {
public static String collectorDetailUrl = "/v1/api/collectorDetail"; public static String collectorDetailUrl = "/v1/api/collectorDetail";
public static String inverterListUrl = "/v1/api/inverterList"; public static String inverterListUrl = "/v1/api/inverterList";
public static String inverterDetailUrl = "/v1/api/inverterDetail"; public static String inverterDetailUrl = "/v1/api/inverterDetail";
public static String alarmListUrl = "/v1/api/alarmList";
public static String resovleRule_data_page_records = "data,page,records"; public static String resovleRule_data_page_records = "data,page,records";
public static String resovleRule_data_records = "data,records";
public static String resovleRule_data = "data"; public static String resovleRule_data = "data";
public static String requestPost = "POST"; public static String requestPost = "POST";
public static String datePattern = "yyyy-MM-dd HH:mm:ss.SSS";
public static DateTimeFormatter formatter = DateTimeFormatter.ofPattern(datePattern);
} }
...@@ -57,6 +57,9 @@ public class HouseholdTestController { ...@@ -57,6 +57,9 @@ public class HouseholdTestController {
public void golangnew() throws IOException { public void golangnew() throws IOException {
// goLangDataAcquisitionService.stationList(); // goLangDataAcquisitionService.stationList();
// goLangDataAcquisitionService.collectorList(); // goLangDataAcquisitionService.collectorList();
goLangDataAcquisitionService.inverterList(); //// goLangDataAcquisitionService.inverterList();
// goLangDataAcquisitionService.collectorDetail();
goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo();
} }
} }
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
@Data
public class AlarmDto {
private Long stationId;
private String stationName;
private String alarmDeviceSn;
private String alarmCode;
private String alarmLevel;
private Long alarmBeginTime;
private Long alarmEndTime;
private String alarmMsg;
private String advice;
private String state;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
@Data
public class CollectorDetailDto {
private String sn;
private String state;
private Long factoryTime;
private Double dataUploadCycle;
private Long currentWorkingTime;
private Long totalWorkingTime;
private String stationId;
private String rssiLevel;
private String model;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
import java.awt.print.PrinterGraphics;
@Data
public class InverterDetailDto {
private Long id;
private String sn;
private Long stationId;
private String stationName;
private Long collectorId;
private String collectorsn;
private String currentState;
private Double pac;
private Double eToday;
private Double eMonth;
private Double eYear;
private String name;
private String productModel;
private String nationalStandards;
private String version;
private Double fullHour;
private Double power;
private Double eTotal;
private Double iAc1;
private Double iAc2;
private Double iAc3;
private Double uAc1;
private Double uAc2;
private Double uAc3;
private Double iPv1;
private Double iPv2;
private Double iPv3;
private Double iPv4;
private Double iPv5;
private Double iPv6;
private Double iPv7;
private Double iPv8;
private Double iPv9;
private Double iPv10;
private Double iPv11;
private Double iPv12;
private Double iPv13;
private Double iPv14;
private Double iPv15;
private Double iPv16;
private Double iPv17;
private Double iPv18;
private Double iPv19;
private Double iPv20;
private Double iPv21;
private Double iPv22;
private Double iPv23;
private Double iPv24;
private Double iPv25;
private Double iPv26;
private Double iPv27;
private Double iPv28;
private Double iPv29;
private Double iPv30;
private Double iPv31;
private Double iPv32;
private Double uPv1;
private Double uPv2;
private Double uPv3;
private Double uPv4;
private Double uPv5;
private Double uPv6;
private Double uPv7;
private Double uPv8;
private Double uPv9;
private Double uPv10;
private Double uPv11;
private Double uPv12;
private Double uPv13;
private Double uPv14;
private Double uPv15;
private Double uPv16;
private Double uPv17;
private Double uPv18;
private Double uPv19;
private Double uPv20;
private Double uPv21;
private Double uPv22;
private Double uPv23;
private Double uPv24;
private Double uPv25;
private Double uPv26;
private Double uPv27;
private Double uPv28;
private Double uPv29;
private Double uPv30;
private Double uPv31;
private Double uPv32;
private Double pow1;
private Double pow2;
private Double pow3;
private Double pow4;
private Double pow5;
private Double pow6;
private Double pow7;
private Double pow8;
private Double pow9;
private Double pow10;
private Double pow11;
private Double pow12;
private Double pow13;
private Double pow14;
private Double pow15;
private Double pow16;
private Double pow17;
private Double pow18;
private Double pow19;
private Double pow20;
private Double pow21;
private Double pow22;
private Double pow23;
private Double pow24;
private Double pow25;
private Double pow26;
private Double pow27;
private Double pow28;
private Double pow29;
private Double pow30;
private Double pow31;
private Double pow32;
}
...@@ -2,7 +2,6 @@ package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf; ...@@ -2,7 +2,6 @@ package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
......
...@@ -2,7 +2,6 @@ package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf; ...@@ -2,7 +2,6 @@ package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
...@@ -34,164 +33,146 @@ public class JpInverter implements Serializable { ...@@ -34,164 +33,146 @@ public class JpInverter implements Serializable {
protected String recUserName; protected String recUserName;
/** /**
* 是否删除
*/
@TableField(value = "is_delete")
public Boolean isDelete=false;
/**
* sn编码 * sn编码
*/ */
@TableField("sn_code") @TableField("sn_code")
private String snCode; private String snCode;
/** /**
* 状态 * 状态
*/ */
@TableField("state") @TableField("state")
private String state; private String state;
/** /**
* 额定功率 * 额定功率
*/ */
@TableField("rated_power") @TableField("rated_power")
private Double ratedPower; private Double ratedPower;
/** /**
* 采集器id * 采集器id
*/ */
@TableField("collector_id") @TableField("collector_id")
private Long collectorId; private Long collectorId;
/** /**
* 采集器sn编码 * 采集器sn编码
*/ */
@TableField("collector_sn_code") @TableField("collector_sn_code")
private String collectorSnCode; private String collectorSnCode;
/** /**
* 更新时间 * 更新时间
*/ */
@TableField("update_time") @TableField("update_time")
private Date updateTime; private Date updateTime;
/** /**
* 实时功率 * 实时功率
*/ */
@TableField("current_power") @TableField("current_power")
private Double currentPower; private Double currentPower;
/** /**
* 日发电量 * 日发电量
*/ */
@TableField("day_power_generation") @TableField("day_power_generation")
private Double dayPowerGeneration; private Double dayPowerGeneration;
/** /**
* 月发电量 * 月发电量
*/ */
@TableField("month_power_generation") @TableField("month_power_generation")
private Double monthPowerGeneration; private Double monthPowerGeneration;
/** /**
* 年发电量 * 年发电量
*/ */
@TableField("year_power_generation") @TableField("year_power_generation")
private Double yearPowerGeneration; private Double yearPowerGeneration;
/** /**
* 品牌 * 品牌
*/ */
@TableField("brand") @TableField("brand")
private String brand; private String brand;
/** /**
* 型号 * 型号
*/ */
@TableField("model") @TableField("model")
private String model; private String model;
/** /**
* 国标 * 国标
*/ */
@TableField("national_standard") @TableField("national_standard")
private String nationalStandard; private String nationalStandard;
/** /**
* 版本号 * 版本号
*/ */
@TableField("version") @TableField("version")
private String version; private String version;
/** /**
* 满发小时数 * 满发小时数
*/ */
@TableField("generation_hours") @TableField("generation_hours")
private String generationHours; private String generationHours;
/** /**
* 质保期 * 质保期
*/ */
@TableField("warranty_period") @TableField("warranty_period")
private String warrantyPeriod; private String warrantyPeriod;
/** /**
* IGBT温度 * IGBT温度
*/ */
@TableField("IGBT_temperature") @TableField("IGBT_temperature")
private String igbtTemperature; private String igbtTemperature;
/** /**
* AFCI方案 * AFCI方案
*/ */
@TableField("AFCI_programme") @TableField("AFCI_programme")
private String afciProgramme; private String afciProgramme;
/** /**
* AFCI版本 * AFCI版本
*/ */
@TableField("AFCI_version") @TableField("AFCI_version")
private String afciVersion; private String afciVersion;
/** /**
* ID * ID
*/ */
@TableField("ID") @TableField("ID")
private Long id; private Long id;
/** /**
* 第三方电站id * 第三方电站id
*/ */
@TableField("third_station_id") @TableField("third_station_id")
private String thirdStationId; private String thirdStationId;
/** /**
* 第三方电站id
*/
@TableField("third_code")
private String thirdCode;
/**
* 装机容量 * 装机容量
*/ */
@TableField("capacity") @TableField("capacity")
private Integer capacity; private Integer capacity;
/** /**
* 累计发电量 * 累计发电量
*/ */
@TableField("total_power_generation") @TableField("total_power_generation")
private Double totalPowerGeneration; private Double totalPowerGeneration;
/**
* 日用电量
*/
@TableField("day_power_use")
private Double dayPowerUse;
/**
* 月用电量
*/
@TableField("month_power_use")
private Double monthPowerUse;
/**
* 年用电量
*/
@TableField("year_power_use")
private Double yearPowerUse;
} }
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf; package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import io.swagger.models.auth.In;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
...@@ -97,5 +98,4 @@ public class JpInverterElectricity implements Serializable { ...@@ -97,5 +98,4 @@ public class JpInverterElectricity implements Serializable {
*/ */
@TableField("third_code") @TableField("third_code")
private String thirdCode; private String thirdCode;
} }
...@@ -8,7 +8,7 @@ import java.util.Date; ...@@ -8,7 +8,7 @@ import java.util.Date;
@Data @Data
@TableName(value = "golang_collector_detail", autoResultMap = true) @TableName(value = "golang_collector_detail", autoResultMap = true)
public class GolangCollectorDetail { public class GolangCollectorDetail {
private Date createdTime; private Long createdTime;
private Long id; private Long id;
private String sn; private String sn;
private Long stationid; private Long stationid;
......
...@@ -8,7 +8,7 @@ import java.util.Date; ...@@ -8,7 +8,7 @@ import java.util.Date;
@Data @Data
@TableName(value = "golang_collector_list", autoResultMap = true) @TableName(value = "golang_collector_list", autoResultMap = true)
public class GolangCollectorList { public class GolangCollectorList {
private Date createdTime; private Long createdTime;
private Long id; private Long id;
private String stationname; private String stationname;
private Long stationid; private Long stationid;
......
...@@ -8,7 +8,7 @@ import java.util.Date; ...@@ -8,7 +8,7 @@ import java.util.Date;
@Data @Data
@TableName(value = "golang_inveter_detail", autoResultMap = true) @TableName(value = "golang_inveter_detail", autoResultMap = true)
public class GolangInverterDetail { public class GolangInverterDetail {
private Date createdTime; private Long createdTime;
private String gridSellYearEnergy; private String gridSellYearEnergy;
private String batteryAlarm; private String batteryAlarm;
private String storageBatteryVoltageStr; private String storageBatteryVoltageStr;
......
...@@ -8,7 +8,7 @@ import java.util.Date; ...@@ -8,7 +8,7 @@ import java.util.Date;
@Data @Data
@TableName(value = "golang_inveter_list", autoResultMap = true) @TableName(value = "golang_inveter_list", autoResultMap = true)
public class GolangInverterList { public class GolangInverterList {
private Date createdTime; private Long createdTime;
private Long id; private Long id;
private String sn; private String sn;
private Long stationid; private Long stationid;
......
...@@ -10,7 +10,7 @@ import java.util.Date; ...@@ -10,7 +10,7 @@ import java.util.Date;
@Data @Data
@TableName(value = "golang_station_detail", autoResultMap = true) @TableName(value = "golang_station_detail", autoResultMap = true)
public class GolangStationDetail implements Serializable { public class GolangStationDetail implements Serializable {
private Date createdTime; private Long createdTime;
private Long id; private Long id;
private String stationname; private String stationname;
private String addr; private String addr;
......
...@@ -7,7 +7,7 @@ import java.util.Date; ...@@ -7,7 +7,7 @@ import java.util.Date;
@Data @Data
@TableName(value = "golang_station_list" ,autoResultMap = true) @TableName(value = "golang_station_list" ,autoResultMap = true)
public class GolangStationList implements Serializable { public class GolangStationList implements Serializable {
private Date createdTime; private Long createdTime;
private String id; private String id;
private String stationName; private String stationName;
private String addr; private String addr;
......
...@@ -9,9 +9,9 @@ import java.util.Date; ...@@ -9,9 +9,9 @@ import java.util.Date;
@Data @Data
@TableName(value = "td_hygf_jp_collector_history" ,autoResultMap = true) @TableName(value = "td_hygf_jp_collector_history" ,autoResultMap = true)
public class HYGFJPCollectorHistory implements Serializable { public class HYGFJPCollectorHistory implements Serializable {
private Date createdTime; private Long createdTime;
private String snCode; private String snCode;
private Date time; private Long time;
private Double signalStrength; private Double signalStrength;
private String thirdStationId; private String thirdStationId;
private String thirdCode; private String thirdCode;
......
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName(value = "td_hygf_day_power" ,autoResultMap = true)
public class HYGFJPDayPower {
private Long createdTime;
private String tationId;
private String hour;
private String yearMonthDay;
private Double power;
}
...@@ -9,7 +9,7 @@ import java.util.Date; ...@@ -9,7 +9,7 @@ import java.util.Date;
@Data @Data
@TableName(value = "td_hygf_jp_invertor_elec_history" ,autoResultMap = true) @TableName(value = "td_hygf_jp_invertor_elec_history" ,autoResultMap = true)
public class HYGFJPInverterElecHistory implements Serializable { public class HYGFJPInverterElecHistory implements Serializable {
private Date createdTime; private Long createdTime;
private String snCode; private String snCode;
private Double uAcVoltage; private Double uAcVoltage;
private Double vAcVoltage; private Double vAcVoltage;
......
...@@ -4,12 +4,13 @@ import com.baomidou.mybatisplus.annotation.TableName; ...@@ -4,12 +4,13 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
@Data @Data
@TableName(value = "td_hygf_jp_inverter_history" ,autoResultMap = true) @TableName(value = "td_hygf_jp_inverter_history" ,autoResultMap = true)
public class HYGFJPInverterHistory implements Serializable { public class HYGFJPInverterHistory implements Serializable {
private Date createdTime; private Long createdTime;
private String snCode; private String snCode;
private String date; private String date;
private Double powerGeneration; private Double powerGeneration;
......
...@@ -7,17 +7,18 @@ import java.io.Serializable; ...@@ -7,17 +7,18 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
@Data @Data
@TableName(value = "td_hygf_jp_inverter_history" ,autoResultMap = true) @TableName(value = "td_hygf_jp_inverter_warn" ,autoResultMap = true)
public class HYGFJPInverterWarn implements Serializable { public class HYGFJPInverterWarn implements Serializable {
private Date createdTime; private Long createdTime;
private long time; private long time;
private String snCode; private String snCode;
private String content; private String content;
private String level; private String level;
private Long time_long; private Long timeLong;
private Long start_time; private Long startTime;
private Long recover_time; private Long recoverTime;
private String treatment; private String treatment;
private String thirdStationId; private String thirdStationId;
private String thirdCode; private String thirdCode;
private String state;
} }
...@@ -7,9 +7,9 @@ import java.io.Serializable; ...@@ -7,9 +7,9 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
@Data @Data
@TableName(value = "td_hygf_jp_invertor_elec_history" ,autoResultMap = true) @TableName(value = "td_hygf_jp_station_power_history" ,autoResultMap = true)
public class HYGFJPStationPowerHistory implements Serializable { public class HYGFJPStationPowerHistory implements Serializable {
private Date createdTime; private Long createdTime;
private Double power; private Double power;
private long time; private long time;
private String thirdStationId; private String thirdStationId;
......
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import fastjson.JSON;
import fastjson.JSONObject;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
public class Test {
public static void main(String[] args) {
String JsonString = "{\"id\":\"1299184088035566532\",\"userId\":\"1300386381676732593\",\"sn\":\"2805435232050486\",\"inverterMeterModel\":1,\"collectorsn\":\"404231046E215B4B\",\"collectorId\":\"1301093458381870472\",\"contractTime\":1838563200000,\"state\":1,\"stateExceptionFlag\":0,\"simFlowState\":-1,\"fullHour\":2.27,\"fullHourStr\":\"h\",\"currentState\":\"3\",\"warningInfoData\":0,\"timeZone\":8,\"timeZoneStr\":\"UTC+08:00\",\"daylight\":0,\"daylightSwitch\":0,\"model\":\"543\",\"productModel\":\"543\",\"ctrlCommand\":1,\"nationalStandardstr\":\"GN-380L\",\"inverterTemperature\":63.1,\"inverterTemperatureUnit\":\"℃\",\"temp\":150,\"tempName\":\"IGBT温度\",\"stationName\":\"陈益庆\",\"sno\":\"1A4C24\",\"stationId\":\"1299184320438728736\",\"version\":\"81003A\",\"acOutputType\":1,\"dcInputtype\":3,\"rs485ComAddr\":\"101\",\"dataTimestamp\":\"1684996442378\",\"timeStr\":\"2023-05-25 14:34:02\",\"reactivePower\":10,\"apparentPower\":8.3,\"dcPac\":9.128,\"uInitGnd\":0,\"uInitGndStr\":\"V\",\"dcBus\":706.6,\"dcBusStr\":\"V\",\"dcBusHalf\":351.9,\"dcBusHalfStr\":\"V\",\"power\":25,\"powerStr\":\"kWp\",\"powerPec\":\"1\",\"porwerPercent\":0.332,\"pac\":8.31,\"pacStr\":\"kW\",\"pacPec\":\"1\",\"oneSelf\":0,\"eToday\":56.8,\"eTodayStr\":\"kWh\",\"eMonth\":2.266,\"eMonthStr\":\"MWh\",\"eYear\":3.635,\"eYearStr\":\"MWh\",\"eTotal\":3.635,\"eTotalStr\":\"MWh\",\"uPv1\":674.3,\"uPv1Str\":\"V\",\"iPv1\":6.9,\"iPv1Str\":\"A\",\"uPv2\":668,\"uPv2Str\":\"V\",\"iPv2\":6.6,\"iPv2Str\":\"A\",\"uPv3\":0,\"uPv3Str\":\"V\",\"iPv3\":0,\"iPv3Str\":\"A\",\"uPv4\":0,\"uPv4Str\":\"V\",\"iPv4\":0,\"iPv4Str\":\"A\",\"uPv5\":0,\"uPv5Str\":\"V\",\"iPv5\":0,\"iPv5Str\":\"A\",\"uPv6\":0,\"uPv6Str\":\"V\",\"iPv6\":0,\"iPv6Str\":\"A\",\"uPv7\":0,\"uPv7Str\":\"V\",\"iPv7\":0,\"iPv7Str\":\"A\",\"uPv8\":0,\"uPv8Str\":\"V\",\"iPv8\":0,\"iPv8Str\":\"A\",\"uPv9\":0,\"uPv9Str\":\"V\",\"iPv9\":0,\"iPv9Str\":\"A\",\"uPv10\":0,\"uPv10Str\":\"V\",\"iPv10\":0,\"iPv10Str\":\"A\",\"uPv11\":0,\"uPv11Str\":\"V\",\"iPv11\":0,\"iPv11Str\":\"A\",\"uPv12\":0,\"uPv12Str\":\"V\",\"iPv12\":0,\"iPv12Str\":\"A\",\"uPv13\":0,\"uPv13Str\":\"V\",\"iPv13\":0,\"iPv13Str\":\"A\",\"uPv14\":0,\"uPv14Str\":\"V\",\"iPv14\":0,\"iPv14Str\":\"A\",\"uPv15\":0,\"uPv15Str\":\"V\",\"iPv15\":0,\"iPv15Str\":\"A\",\"uPv16\":0,\"uPv16Str\":\"V\",\"iPv16\":0,\"iPv16Str\":\"A\",\"uPv17\":0,\"uPv17Str\":\"V\",\"iPv17\":0,\"iPv17Str\":\"A\",\"uPv18\":0,\"uPv18Str\":\"V\",\"iPv18\":0,\"iPv18Str\":\"A\",\"uPv19\":0,\"uPv19Str\":\"V\",\"iPv19\":0,\"iPv19Str\":\"A\",\"uPv20\":0,\"uPv20Str\":\"V\",\"iPv20\":0,\"iPv20Str\":\"A\",\"uPv21\":0,\"uPv21Str\":\"V\",\"iPv21\":0,\"iPv21Str\":\"A\",\"uPv22\":0,\"uPv22Str\":\"V\",\"iPv22\":0,\"iPv22Str\":\"A\",\"uPv23\":0,\"uPv23Str\":\"V\",\"iPv23\":0,\"iPv23Str\":\"A\",\"uPv24\":0,\"uPv24Str\":\"V\",\"iPv24\":0,\"iPv24Str\":\"A\",\"uPv25\":0,\"uPv25Str\":\"V\",\"iPv25\":0,\"iPv25Str\":\"A\",\"uPv26\":0,\"uPv26Str\":\"V\",\"iPv26\":0,\"iPv26Str\":\"A\",\"uPv27\":0,\"uPv27Str\":\"V\",\"iPv27\":0,\"iPv27Str\":\"A\",\"uPv28\":0,\"uPv28Str\":\"V\",\"iPv28\":0,\"iPv28Str\":\"A\",\"uPv29\":0,\"uPv29Str\":\"V\",\"iPv29\":0,\"iPv29Str\":\"A\",\"uPv30\":0,\"uPv30Str\":\"V\",\"iPv30\":0,\"iPv30Str\":\"A\",\"uPv31\":0,\"uPv31Str\":\"V\",\"iPv31\":0,\"iPv31Str\":\"A\",\"uPv32\":0,\"uPv32Str\":\"V\",\"iPv32\":0,\"iPv32Str\":\"A\",\"pow1\":4653,\"pow1Str\":\"W\",\"pow2\":4409,\"pow2Str\":\"W\",\"pow3\":0,\"pow3Str\":\"W\",\"pow4\":0,\"pow4Str\":\"W\",\"pow5\":0,\"pow5Str\":\"W\",\"pow6\":0,\"pow6Str\":\"W\",\"pow7\":0,\"pow7Str\":\"W\",\"pow8\":0,\"pow8Str\":\"W\",\"pow9\":0,\"pow9Str\":\"W\",\"pow10\":0,\"pow10Str\":\"W\",\"pow11\":0,\"pow11Str\":\"W\",\"pow12\":0,\"pow12Str\":\"W\",\"pow13\":0,\"pow13Str\":\"W\",\"pow14\":0,\"pow14Str\":\"W\",\"pow15\":0,\"pow15Str\":\"W\",\"pow16\":0,\"pow16Str\":\"W\",\"pow17\":0,\"pow17Str\":\"W\",\"pow18\":0,\"pow18Str\":\"W\",\"pow19\":0,\"pow19Str\":\"W\",\"pow20\":0,\"pow20Str\":\"W\",\"pow21\":0,\"pow21Str\":\"W\",\"pow22\":0,\"pow22Str\":\"W\",\"pow23\":0,\"pow23Str\":\"W\",\"pow24\":0,\"pow24Str\":\"W\",\"pow25\":0,\"pow25Str\":\"W\",\"pow26\":0,\"pow26Str\":\"W\",\"pow27\":0,\"pow27Str\":\"W\",\"pow28\":0,\"pow28Str\":\"W\",\"pow29\":0,\"pow29Str\":\"W\",\"pow30\":0,\"pow30Str\":\"W\",\"pow31\":0,\"pow31Str\":\"W\",\"pow32\":0,\"pow32Str\":\"W\",\"uAc1\":229.9,\"uAc1Str\":\"V\",\"iAc1\":12,\"iAc1Str\":\"A\",\"uAc2\":229.8,\"uAc2Str\":\"V\",\"iAc2\":11.8,\"iAc2Str\":\"A\",\"uAc3\":229,\"uAc3Str\":\"V\",\"iAc3\":11.9,\"iAc3Str\":\"A\",\"powerFactor\":1,\"batteryDischargeEnergy\":0,\"batteryDischargeEnergyStr\":\"kWh\",\"batteryChargeEnergy\":0,\"batteryChargeEnergyStr\":\"kWh\",\"homeLoadEnergy\":0,\"homeLoadEnergyStr\":\"kWh\",\"gridPurchasedEnergy\":0,\"gridPurchasedEnergyStr\":\"kWh\",\"gridSellEnergy\":0,\"gridSellEnergyStr\":\"kWh\",\"fac\":49.96,\"facStr\":\"Hz\",\"batteryPower\":0,\"batteryPowerStr\":\"kW\",\"batteryPowerPec\":\"1\",\"batteryPowerZheng\":0,\"batteryPowerFu\":0,\"storageBatteryVoltage\":0,\"storageBatteryVoltageStr\":\"V\",\"storageBatteryCurrent\":0,\"storageBatteryCurrentStr\":\"A\",\"batteryCapacitySoc\":0,\"batteryHealthSoh\":0,\"batteryVoltage\":0,\"batteryVoltageStr\":\"V\",\"bstteryCurrent\":0,\"bstteryCurrentStr\":\"A\",\"batteryPowerBms\":0,\"batteryPowerBmsStr\":\"kW\",\"internalBatteryI\":0,\"batteryChargingCurrent\":0,\"batteryChargingCurrentStr\":\"A\",\"batteryDischargeLimiting\":0,\"batteryDischargeLimitingStr\":\"A\",\"batteryFailureInformation01\":\"0\",\"batteryFailureInformation02\":\"0\",\"batteryTotalChargeEnergy\":0,\"batteryTotalChargeEnergyStr\":\"kWh\",\"batteryTodayChargeEnergy\":0,\"batteryTodayChargeEnergyStr\":\"kWh\",\"batteryMonthChargeEnergy\":0,\"batteryMonthChargeEnergyStr\":\"kWh\",\"batteryYearChargeEnergy\":0,\"batteryYearChargeEnergyStr\":\"kWh\",\"batteryYesterdayChargeEnergy\":0,\"batteryYesterdayChargeEnergyStr\":\"kWh\",\"batteryTotalDischargeEnergy\":0,\"batteryTotalDischargeEnergyStr\":\"kWh\",\"batteryTodayDischargeEnergy\":0,\"batteryTodayDischargeEnergyStr\":\"kWh\",\"batteryMonthDischargeEnergy\":0,\"batteryMonthDischargeEnergyStr\":\"kWh\",\"batteryYearDischargeEnergy\":0,\"batteryYearDischargeEnergyStr\":\"kWh\",\"batteryYesterdayDischargeEnergy\":0,\"batteryYesterdayDischargeEnergyStr\":\"kWh\",\"gridPurchasedTotalEnergy\":0,\"gridPurchasedTotalEnergyStr\":\"kWh\",\"gridPurchasedYearEnergy\":0,\"gridPurchasedYearEnergyStr\":\"kWh\",\"gridPurchasedMonthEnergy\":0,\"gridPurchasedMonthEnergyStr\":\"kWh\",\"gridPurchasedTodayEnergy\":0,\"gridPurchasedTodayEnergyStr\":\"kWh\",\"gridPurchasedYesterdayEnergy\":0,\"gridPurchasedYesterdayEnergyStr\":\"kWh\",\"gridSellTotalEnergy\":0,\"gridSellTotalEnergyStr\":\"kWh\",\"gridSellYearEnergy\":0,\"gridSellYearEnergyStr\":\"kWh\",\"gridSellMonthEnergy\":0,\"gridSellMonthEnergyStr\":\"kWh\",\"gridSellTodayEnergy\":0,\"gridSellTodayEnergyStr\":\"kWh\",\"gridSellYesterdayEnergy\":0,\"gridSellYesterdayEnergyStr\":\"kWh\",\"homeLoadTotalEnergy\":0,\"homeLoadTotalEnergyStr\":\"kWh\",\"homeLoadTodayEnergy\":0,\"homeLoadTodayEnergyStr\":\"kWh\",\"totalLoadPower\":0,\"totalLoadPowerStr\":\"kW\",\"homeLoadYesterdayEnergy\":0,\"homeLoadYesterdayEnergyStr\":\"kWh\",\"familyLoadPower\":0,\"familyLoadPowerStr\":\"kW\",\"familyLoadPercent\":0,\"homeGridYesterdayEnergy\":0,\"homeGridYesterdayEnergyStr\":\"kWh\",\"homeGridTodayEnergy\":0,\"homeGridTodayEnergyStr\":\"kWh\",\"homeGridMonthEnergy\":0,\"homeGridMonthEnergyStr\":\"kWh\",\"homeGridYearEnergy\":0,\"homeGridYearEnergyStr\":\"kWh\",\"homeGridTotalEnergy\":0,\"homeGridTotalEnergyStr\":\"kWh\",\"bypassLoadPower\":0,\"bypassLoadPowerStr\":\"kW\",\"backupYesterdayEnergy\":0,\"backupYesterdayEnergyStr\":\"kWh\",\"backupTodayEnergy\":0,\"backupTodayEnergyStr\":\"kWh\",\"backupMonthEnergy\":0,\"backupMonthEnergyStr\":\"kWh\",\"backupYearEnergy\":0,\"backupYearEnergyStr\":\"kWh\",\"backupTotalEnergy\":0,\"backupTotalEnergyStr\":\"kWh\",\"bypassAcVoltage\":0,\"bypassAcVoltageB\":0,\"bypassAcVoltageC\":0,\"bypassAcCurrent\":0,\"bypassAcCurrentB\":0,\"bypassAcCurrentC\":0,\"pLimitSet\":110,\"pFactorLimitSet\":10,\"pReactiveLimitSet\":0,\"batteryType\":\"0.0\",\"socDischargeSet\":0,\"socChargingSet\":0,\"pEpmSet\":0,\"pEpmSetStr\":\"kW\",\"epmFailSafe\":0,\"epmSafe\":0,\"pEpm\":0,\"pEpmStr\":\"kW\",\"psumCalPec\":\"1\",\"insulationResistance\":0,\"dispersionRate\":0,\"sirRealtime\":1176,\"iLeakLimt\":0,\"upvTotal\":0,\"upvTotalStr\":\"V\",\"ipvTotal\":0,\"ipvTotalStr\":\"A\",\"powTotal\":0,\"powTotalStr\":\"W\",\"parallelStatus\":0,\"parallelAddr\":0,\"parallelPhase\":0,\"parallelBattery\":0,\"batteryAlarm\":\"0\",\"bypassAcOnoffSet\":0,\"bypassAcVoltageSet\":0,\"bypassAcCurrentSet\":0,\"batteryCDEnableSet\":0,\"batteryCDSet\":0,\"batteryCDISet\":0,\"batteryCMaxiSet\":0,\"batteryDMaxiSet\":0,\"batteryUvpSet\":0,\"batteryFcvSet\":0,\"batteryAcvSet\":0,\"batteryOvpSet\":0,\"batteryOlvEnableSet\":0,\"batteryLaTemp\":0,\"offGridDDepth\":0,\"epsDDepth\":0,\"epsSwitchTime\":\"0\",\"acInType\":0,\"energyStorageControl\":\"0\",\"meter1Type\":0,\"meter2Type\":0,\"meter1SiteHigh\":0,\"meter2SiteHigh\":0,\"meter1TypeLow\":0,\"meter2TypeLow\":0,\"psum\":0,\"dcPacStr\":\"kVA\",\"reactivePowerStr\":\"Var\",\"apparentPowerStr\":\"kVA\",\"psumCal\":8.31,\"familyLoadPowerPec\":\"1\",\"psumStr\":\"kW\",\"psumCalStr\":\"kW\"}";
Map<String, Object> map = JSON.parseObject(JsonString, Map.class);
map.keySet().forEach(s -> System.out.println(s.toLowerCase(Locale.ROOT)+" varchar(100),"));
}
}
...@@ -9,4 +9,6 @@ import java.util.List; ...@@ -9,4 +9,6 @@ import java.util.List;
public interface GolangInverterListMapper extends BaseMapper<GolangInverterList> { public interface GolangInverterListMapper extends BaseMapper<GolangInverterList> {
@Select("select id from golang_inveter_list group by id") @Select("select id from golang_inveter_list group by id")
List<Long> getInverterIds(); List<Long> getInverterIds();
@Select("select sn from golang_inveter_list group by sn")
List<String> getInverterSns();
} }
package com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPDayPower;
public interface HYGFJPDayPowerMapper extends BaseMapper<HYGFJPDayPower> {
}
package com.yeejoin.amos.api.householdapi.face.service;
public interface GoLangDataAcquisition {
}
...@@ -7,4 +7,5 @@ public interface GoLangDataAcquisitionService { ...@@ -7,4 +7,5 @@ public interface GoLangDataAcquisitionService {
void collectorDetail(); void collectorDetail();
void inverterList(); void inverterList();
void inverterDetail(); void inverterDetail();
void inverAlramInfo();
} }
package com.yeejoin.amos.api.householdapi.face.service.impl; package com.yeejoin.amos.api.householdapi.face.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.Utils.GolangRequestUtil; import com.yeejoin.amos.api.householdapi.Utils.GolangRequestUtil;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant; import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
import com.yeejoin.amos.api.householdapi.face.dto.AlarmDto;
import com.yeejoin.amos.api.householdapi.face.dto.CollectorDetailDto;
import com.yeejoin.amos.api.householdapi.face.dto.InverterDetailDto;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpCollector;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverter;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverterElectricity;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation; import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.*; import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.*;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpCollectorMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpInverterElectricityMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpInverterMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.*; import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.*;
import com.yeejoin.amos.api.householdapi.face.service.GoLangDataAcquisitionService; import com.yeejoin.amos.api.householdapi.face.service.GoLangDataAcquisitionService;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper; import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum; import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import fastjson.JSON; import fastjson.JSON;
import org.bouncycastle.crypto.engines.AESLightEngine;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@Async
@Service @Service
public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionService { public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionService {
private final String dataRequstScheduled = "0 0/10 * * * *";
private final String stationPowerScheduled = "0 0 * * * *";
@Autowired @Autowired
private GolangRequestUtil golangRequestUtil; private GolangRequestUtil golangRequestUtil;
@Autowired @Autowired
...@@ -29,6 +48,12 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -29,6 +48,12 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
@Autowired @Autowired
private JpStationMapper jpStationMapper; private JpStationMapper jpStationMapper;
@Autowired @Autowired
private JpCollectorMapper jpCollectorMapper;
@Autowired
private JpInverterMapper jpInverterMapper;
@Autowired
private JpInverterElectricityMapper jpInverterElectricityMapper;
@Autowired
private GolangStationDetailMapper golangStationDetailMapper; private GolangStationDetailMapper golangStationDetailMapper;
@Autowired @Autowired
private GolangCollectorListMapper golangCollectorListMapper; private GolangCollectorListMapper golangCollectorListMapper;
...@@ -46,10 +71,11 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -46,10 +71,11 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
private HYGFJPInverterWarnMapper hygfjpInverterWarnMapper; private HYGFJPInverterWarnMapper hygfjpInverterWarnMapper;
@Autowired @Autowired
private HYGFJPInverterElecHistoryMapper hygfjpInverterElecHistoryMapper; private HYGFJPInverterElecHistoryMapper hygfjpInverterElecHistoryMapper;
@Autowired
private HYGFJPDayPowerMapper hygfjpDayPowerMapper;
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void stationList() { public void stationList() {
HashMap<String, Object> requestInfo = new HashMap<>(); HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("pageNo", 1); requestInfo.put("pageNo", 1);
...@@ -63,14 +89,17 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -63,14 +89,17 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
); );
for (int i = 0; i < result.size(); i++) { for (int i = 0; i < result.size(); i++) {
GolangStationList golangStationList = result.get(i); GolangStationList golangStationList = result.get(i);
golangStationList.setCreatedTime(new Date()); golangStationList.setCreatedTime(System.currentTimeMillis());
golangStationMapper.insert(golangStationList); golangStationMapper.insert(golangStationList);
} }
} }
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void stationDetail() { public void stationDetail() {
List<String> stationIds = golangStationMapper.getStationIds(); List<String> stationIds = golangStationMapper.getStationIds();
String today = DateUtil.today();
String hour = new Date().getHours() + ":00";
for (int i = 0; i < stationIds.size(); i++) { for (int i = 0; i < stationIds.size(); i++) {
try { try {
TimeUnit.SECONDS.sleep(1); TimeUnit.SECONDS.sleep(1);
...@@ -88,8 +117,10 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -88,8 +117,10 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
); );
for (int j = 0; j < result.size(); j++) { for (int j = 0; j < result.size(); j++) {
GolangStationDetail golangStationDetail = result.get(j); GolangStationDetail golangStationDetail = result.get(j);
golangStationDetail.setCreatedTime(new Date()); golangStationDetail.setCreatedTime(System.currentTimeMillis());
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().eq("third_code", PVProducerInfoEnum.JLY.getCode()).eq("third_station_id", stationIds.get(i))); JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_code", PVProducerInfoEnum.JLY.getCode()).
eq("third_station_id", stationIds.get(i)));
//给户用光伏存储的数据赋值 //给户用光伏存储的数据赋值
if (ObjectUtils.isEmpty(jpStation)) { if (ObjectUtils.isEmpty(jpStation)) {
jpStation = new JpStation(); jpStation = new JpStation();
...@@ -103,7 +134,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -103,7 +134,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpStation.setLatitude(golangStationDetail.getLatitude()); jpStation.setLatitude(golangStationDetail.getLatitude());
jpStation.setUserName(golangStationDetail.getUsername()); jpStation.setUserName(golangStationDetail.getUsername());
jpStation.setUserPhone(String.valueOf(golangStationDetail.getUsermobile())); jpStation.setUserPhone(String.valueOf(golangStationDetail.getUsermobile()));
jpStation.setStationContact(String.valueOf(golangStationDetail.getMobile())); jpStation.setStationContact(StrUtil.nullToDefault(String.valueOf(golangStationDetail.getMobile()), ""));
jpStation.setModuleCount(Math.toIntExact(golangStationDetail.getModule())); jpStation.setModuleCount(Math.toIntExact(golangStationDetail.getModule()));
//并网类型 //并网类型
jpStation.setOnGridType(GoLangConstant.stationStaus.get(String.valueOf(golangStationDetail.getState()))); jpStation.setOnGridType(GoLangConstant.stationStaus.get(String.valueOf(golangStationDetail.getState())));
...@@ -119,23 +150,43 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -119,23 +150,43 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpStation.setYearIncome(golangStationDetail.getYearincome()); jpStation.setYearIncome(golangStationDetail.getYearincome());
jpStation.setCumulativeIncome(golangStationDetail.getAllincome()); jpStation.setCumulativeIncome(golangStationDetail.getAllincome());
jpStation.setArea(golangStationDetail.getRegionstr()); jpStation.setArea(golangStationDetail.getRegionstr());
if (!ObjectUtils.isEmpty(jpStation.getSequenceNbr())) { if (!ObjectUtils.isEmpty(jpStation.getSequenceNbr())) {
jpStationMapper.updateById(jpStation); jpStationMapper.updateById(jpStation);
} else { } else {
jpStationMapper.insert(jpStation); jpStationMapper.insert(jpStation);
} }
HYGFJPStationPowerHistory hygfjpStationPowerHistory = new HYGFJPStationPowerHistory(); HYGFJPStationPowerHistory hygfjpStationPowerHistory = new HYGFJPStationPowerHistory();
hygfjpStationPowerHistory.setCreatedTime(new Date()); hygfjpStationPowerHistory.setCreatedTime(System.currentTimeMillis());
hygfjpStationPowerHistory.setThirdStationId(jpStation.getThirdStationId()); hygfjpStationPowerHistory.setThirdStationId(jpStation.getThirdStationId());
hygfjpStationPowerHistory.setPower(jpStation.getRealTimePower()); hygfjpStationPowerHistory.setPower(jpStation.getRealTimePower());
hygfjpStationPowerHistory.setThirdCode(jpStation.getThirdCode()); hygfjpStationPowerHistory.setThirdCode(jpStation.getThirdCode());
hygfjpStationPowerHistory.setTime(System.currentTimeMillis()); hygfjpStationPowerHistory.setTime(System.currentTimeMillis());
golangStationDetailMapper.insert(golangStationDetail); hygfjpStationPowerHistoryMapper.insert(hygfjpStationPowerHistory);
HYGFJPDayPower hygfjpDayPower = hygfjpDayPowerMapper.selectOne(new QueryWrapper<HYGFJPDayPower>().
eq("tation_id", String.valueOf(golangStationDetail.getId())).
eq("year_month_day", today).
eq("hour", hour)
);
if (ObjectUtils.isEmpty(hygfjpDayPower)) {
hygfjpDayPower = new HYGFJPDayPower();
}
hygfjpDayPower = new HYGFJPDayPower();
hygfjpDayPower.setTationId(String.valueOf(golangStationDetail.getId()));
hygfjpDayPower.setHour(hour);
hygfjpDayPower.setYearMonthDay(today);
hygfjpDayPower.setPower(golangStationDetail.getPower());
if (ObjectUtils.isEmpty(hygfjpDayPower.getCreatedTime())) {
hygfjpDayPower.setCreatedTime(System.currentTimeMillis());
hygfjpDayPowerMapper.insert(hygfjpDayPower);
} else {
hygfjpDayPowerMapper.insert(hygfjpDayPower);
}
} }
} }
} }
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void collectorList() { public void collectorList() {
List<String> stationIds = golangStationMapper.getStationIds(); List<String> stationIds = golangStationMapper.getStationIds();
...@@ -158,18 +209,81 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -158,18 +209,81 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
); );
for (int j = 0; j < result.size(); j++) { for (int j = 0; j < result.size(); j++) {
GolangCollectorList golangCollectorList = result.get(j); GolangCollectorList golangCollectorList = result.get(j);
golangCollectorList.setCreatedTime(new Date()); golangCollectorList.setCreatedTime(System.currentTimeMillis());
golangCollectorListMapper.insert(golangCollectorList); golangCollectorListMapper.insert(golangCollectorList);
} }
} }
} }
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void collectorDetail() { public void collectorDetail() {
List<Long> collectorIds = golangCollectorListMapper.getCollectIds(); List<Long> collectorIds = golangCollectorListMapper.getCollectIds();
for (int i = 0; i < collectorIds.size(); i++) {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("id", Long.valueOf(collectorIds.get(i)));
String requestParaminfo = JSON.toJSONString(requestInfo);
List<CollectorDetailDto> result = golangRequestUtil.getResPonse(GoLangConstant.collectorDetailUrl,
GoLangConstant.requestPost,
requestParaminfo,
GoLangConstant.resovleRule_data,
CollectorDetailDto.class
);
for (int j = 0; j < result.size(); j++) {
CollectorDetailDto collectorDetailDto = result.get(j);
JpCollector jpCollector = jpCollectorMapper.selectOne(new QueryWrapper<JpCollector>().
eq("third_station_id", collectorDetailDto.getStationId()).
eq("third_code", PVProducerInfoEnum.JLY.getCode()).
eq("sn_code", collectorDetailDto.getSn()));
if (ObjectUtils.isEmpty(jpCollector)) {
jpCollector = new JpCollector();
}
//sn编码
jpCollector.setSnCode(collectorDetailDto.getSn());
//类型
jpCollector.setType(collectorDetailDto.getModel());
//更新时间
jpCollector.setUpdateTime(new Date());
//出场日期
jpCollector.setDischargeDate(new Date(collectorDetailDto.getFactoryTime()));
//生产日期
jpCollector.setProductDate(new Date(collectorDetailDto.getFactoryTime()));
//数据上传间隔
jpCollector.setDataPeriod(collectorDetailDto.getDataUploadCycle());
//本次上电时间
jpCollector.setThisWorkTime(new DateTime(collectorDetailDto.getCurrentWorkingTime()));
//累计工作时间
jpCollector.setTotalWorkTime(new DateTime(collectorDetailDto.getTotalWorkingTime()));
//第三方电站id
jpCollector.setThirdStationId(collectorDetailDto.getStationId());
//第三方厂商标识
jpCollector.setThirdCode(PVProducerInfoEnum.JLY.getCode());
//第三方厂商标识
jpCollector.setState(GoLangConstant.stationStaus.get(collectorDetailDto.getState()));
if (ObjectUtils.isEmpty(jpCollector.getSequenceNbr())) {
jpCollectorMapper.insert(jpCollector);
} else {
jpCollectorMapper.updateById(jpCollector);
}
// td-collector-history
HYGFJPCollectorHistory hygfjpCollectorHistory = new HYGFJPCollectorHistory();
hygfjpCollectorHistory.setTime(System.currentTimeMillis());
hygfjpCollectorHistory.setCreatedTime(System.currentTimeMillis());
hygfjpCollectorHistory.setSnCode(collectorDetailDto.getSn());
hygfjpCollectorHistory.setSignalStrength(Double.valueOf(collectorDetailDto.getRssiLevel()));
hygfjpCollectorHistory.setThirdStationId(collectorDetailDto.getStationId());
hygfjpCollectorHistory.setThirdCode(PVProducerInfoEnum.JLY.getCode());
hygfjpCollectorHistoryMapper.insert(hygfjpCollectorHistory);
}
}
} }
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void inverterList() { public void inverterList() {
List<String> stationIds = golangStationMapper.getStationIds(); List<String> stationIds = golangStationMapper.getStationIds();
...@@ -187,19 +301,207 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -187,19 +301,207 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
List<GolangInverterList> result = golangRequestUtil.getResPonse(GoLangConstant.inverterListUrl, List<GolangInverterList> result = golangRequestUtil.getResPonse(GoLangConstant.inverterListUrl,
GoLangConstant.requestPost, GoLangConstant.requestPost,
requestParaminfo, requestParaminfo,
GoLangConstant.resovleRule_data_page_records, GoLangConstant.resovleRule_data,
GolangInverterList.class GolangInverterList.class
); );
for (int j = 0; j < result.size(); j++) { for (int j = 0; j < result.size(); j++) {
GolangInverterList golangInverterList = result.get(j); GolangInverterList golangInverterList = result.get(j);
golangInverterList.setCreatedTime(new Date()); golangInverterList.setCreatedTime(System.currentTimeMillis());
golangInverterListMapper.insert(golangInverterList); golangInverterListMapper.insert(golangInverterList);
} }
} }
} }
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void inverterDetail() { public void inverterDetail() {
List<Long> inverterIds = golangInverterListMapper.getInverterIds(); List<Long> inverterIds = golangInverterListMapper.getInverterIds();
for (int i = 0; i < inverterIds.size(); i++) {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("id", Long.valueOf(inverterIds.get(i)));
String requestParaminfo = JSON.toJSONString(requestInfo);
List<InverterDetailDto> result = golangRequestUtil.getResPonse(GoLangConstant.inverterDetailUrl,
GoLangConstant.requestPost,
requestParaminfo,
GoLangConstant.resovleRule_data,
InverterDetailDto.class
);
for (int j = 0; j < result.size(); j++) {
InverterDetailDto inverterDetailDto = result.get(j);
JpInverter jpInverter = jpInverterMapper.selectOne(new QueryWrapper<JpInverter>().
eq("third_station_id", inverterDetailDto.getStationId()).
eq("third_code", PVProducerInfoEnum.JLY.getCode()).
eq("sn_code", inverterDetailDto.getSn()));
if (ObjectUtils.isEmpty(jpInverter)) {
jpInverter = new JpInverter();
}
jpInverter.setSnCode(inverterDetailDto.getSn());
jpInverter.setState(GoLangConstant.stationStaus.get(inverterDetailDto.getCurrentState()));
jpInverter.setCollectorId(inverterDetailDto.getCollectorId());
jpInverter.setCollectorSnCode(inverterDetailDto.getCollectorsn());
jpInverter.setUpdateTime(new Date());
jpInverter.setCurrentPower(inverterDetailDto.getPac());
jpInverter.setDayPowerGeneration(inverterDetailDto.getEToday());
jpInverter.setMonthPowerGeneration(inverterDetailDto.getEMonth());
jpInverter.setYearPowerGeneration(inverterDetailDto.getEYear());
jpInverter.setTotalPowerGeneration(inverterDetailDto.getETotal());
jpInverter.setBrand(inverterDetailDto.getName());
jpInverter.setModel(inverterDetailDto.getProductModel());
jpInverter.setNationalStandard(inverterDetailDto.getNationalStandards());
jpInverter.setVersion(inverterDetailDto.getVersion());
jpInverter.setGenerationHours(String.valueOf(inverterDetailDto.getFullHour()));
jpInverter.setId(inverterDetailDto.getId());
jpInverter.setCapacity(inverterDetailDto.getPower().intValue());
jpInverter.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
jpInverter.setThirdCode(PVProducerInfoEnum.JLY.getCode());
if (!ObjectUtils.isEmpty(jpInverter.getSequenceNbr())) {
jpInverterMapper.updateById(jpInverter);
} else {
jpInverterMapper.insert(jpInverter);
}
String jsonString = JSON.toJSONString(inverterDetailDto);
Map<String, Object> hanlderResult = JSON.parseObject(jsonString, Map.class);
for (int k = 1; k < 4; k++) {
JpInverterElectricity jpInverterElectricity = jpInverterElectricityMapper.selectOne(new QueryWrapper<JpInverterElectricity>().
eq("sn_code", inverterDetailDto.getSn()).
eq("type", "交流").
eq("name", "AC" + k)
);
if (ObjectUtils.isEmpty(jpInverterElectricity)) {
jpInverterElectricity = new JpInverterElectricity();
}
jpInverterElectricity.setInverterId(inverterDetailDto.getId());
jpInverterElectricity.setSnCode(inverterDetailDto.getSn());
jpInverterElectricity.setThirdCode(PVProducerInfoEnum.JLY.getCode());
jpInverterElectricity.setType("交流");
jpInverterElectricity.setName("AC" + k);
jpInverterElectricity.setVoltage(Double.valueOf(hanlderResult.get("uAc" + k).toString()));
jpInverterElectricity.setCurrent(Double.valueOf(hanlderResult.get("iAc" + k).toString()));
if (ObjectUtils.isEmpty(jpInverterElectricity.getSequenceNbr())) {
jpInverterElectricityMapper.insert(jpInverterElectricity);
} else {
jpInverterElectricityMapper.updateById(jpInverterElectricity);
}
}
for (int k1 = 1; k1 < 33; k1++) {
JpInverterElectricity jpInverterElectricity = jpInverterElectricityMapper.selectOne(new QueryWrapper<JpInverterElectricity>().
eq("sn_code", inverterDetailDto.getSn()).
eq("type", "直流").
eq("name", "PV" + k1)
);
if (ObjectUtils.isEmpty(jpInverterElectricity)) {
jpInverterElectricity = new JpInverterElectricity();
}
jpInverterElectricity.setInverterId(inverterDetailDto.getId());
jpInverterElectricity.setSnCode(inverterDetailDto.getSn());
jpInverterElectricity.setThirdCode(PVProducerInfoEnum.JLY.getCode());
jpInverterElectricity.setType("直流");
jpInverterElectricity.setName("PV" + k1);
jpInverterElectricity.setVoltage(Double.valueOf(hanlderResult.get("uPv" + k1).toString()));
jpInverterElectricity.setCurrent(Double.valueOf(hanlderResult.get("iPv" + k1).toString()));
jpInverterElectricity.setPower(Double.valueOf(hanlderResult.get("pow" + k1).toString()));
if (ObjectUtils.isEmpty(jpInverterElectricity.getSequenceNbr())) {
jpInverterElectricityMapper.insert(jpInverterElectricity);
} else {
jpInverterElectricityMapper.updateById(jpInverterElectricity);
}
}
HYGFJPInverterElecHistory hygfjpInverterElecHistory = new HYGFJPInverterElecHistory();
hygfjpInverterElecHistory.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
hygfjpInverterElecHistory.setCreatedTime(System.currentTimeMillis());
hygfjpInverterElecHistory.setSnCode(inverterDetailDto.getSn());
hygfjpInverterElecHistory.setUAcCurrent(inverterDetailDto.getIAc1());
hygfjpInverterElecHistory.setVAcCurrent(inverterDetailDto.getIAc2());
hygfjpInverterElecHistory.setWAcCurrent(inverterDetailDto.getIAc3());
hygfjpInverterElecHistory.setUAcVoltage(inverterDetailDto.getUAc1());
hygfjpInverterElecHistory.setVAcVoltage(inverterDetailDto.getUAc2());
hygfjpInverterElecHistory.setUAcVoltage(inverterDetailDto.getUAc3());
hygfjpInverterElecHistory.setThirdCode(PVProducerInfoEnum.JLY.getCode());
hygfjpInverterElecHistory.setTime(System.currentTimeMillis());
hygfjpInverterElecHistoryMapper.insert(hygfjpInverterElecHistory);
// 逆变器历史
String today = DateUtil.today();
HYGFJPInverterHistory hygfjpInverterHistory = hygfjpInverterHistoryMapper.selectOne(new QueryWrapper<HYGFJPInverterHistory>().eq("sn_code", inverterDetailDto.getSn()).eq("date", today));
if (ObjectUtils.isEmpty(hygfjpInverterHistory)) {
hygfjpInverterHistory = new HYGFJPInverterHistory();
}
hygfjpInverterHistory.setDate(today);
hygfjpInverterHistory.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
hygfjpInverterHistory.setInverterId(inverterDetailDto.getId());
hygfjpInverterHistory.setSnCode(inverterDetailDto.getSn());
hygfjpInverterHistory.setThirdCode(PVProducerInfoEnum.JLY.getCode());
hygfjpInverterHistory.setGenerationHours(inverterDetailDto.getFullHour());
hygfjpInverterHistory.setPowerGeneration(inverterDetailDto.getEToday());
SimpleDateFormat format = new SimpleDateFormat(GoLangConstant.datePattern);
if (ObjectUtils.isEmpty(hygfjpInverterHistory.getCreatedTime())) {
hygfjpInverterHistory.setCreatedTime(System.currentTimeMillis());
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
} else {
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
}
}
}
} }
@Scheduled(cron = dataRequstScheduled)
@Override
public void inverAlramInfo() {
List<String> inverterIds = golangInverterListMapper.getInverterSns();
for (int i = 0; i < inverterIds.size(); i++) {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("pageNo", 1);
requestInfo.put("pageSize", 100);
requestInfo.put("alarmDeviceSn", inverterIds.get(i));
requestInfo.put("alarmBeginTime", DateUtil.today());
requestInfo.put("alarmEndTime", DateUtil.today());
String requestParaminfo = JSON.toJSONString(requestInfo);
List<AlarmDto> result = golangRequestUtil.getResPonse(GoLangConstant.alarmListUrl,
GoLangConstant.requestPost,
requestParaminfo,
GoLangConstant.resovleRule_data_records,
AlarmDto.class
);
for (int j = 0; j < result.size(); j++) {
AlarmDto alarmDto = result.get(j);
if (!ObjectUtils.isEmpty(alarmDto.getAlarmDeviceSn())) {
HYGFJPInverterWarn hygfjpInverterWarn = hygfjpInverterWarnMapper.selectOne(new QueryWrapper<HYGFJPInverterWarn>()
.eq("sn_code", alarmDto.getAlarmDeviceSn())
.eq("start_time", alarmDto.getAlarmBeginTime())
.eq("third_station_id", String.valueOf(alarmDto.getStationId()))
);
if (ObjectUtils.isEmpty(hygfjpInverterWarn)) {
hygfjpInverterWarn = new HYGFJPInverterWarn();
}
hygfjpInverterWarn.setTime(System.currentTimeMillis());
hygfjpInverterWarn.setTimeLong(System.currentTimeMillis());
hygfjpInverterWarn.setSnCode(alarmDto.getAlarmDeviceSn());
hygfjpInverterWarn.setThirdStationId(String.valueOf(alarmDto.getStationId()));
hygfjpInverterWarn.setLevel(GoLangConstant.alarmLevel.get(alarmDto.getAlarmLevel()));
hygfjpInverterWarn.setContent(alarmDto.getAlarmMsg());
hygfjpInverterWarn.setThirdCode(PVProducerInfoEnum.JLY.getCode());
hygfjpInverterWarn.setTreatment(alarmDto.getAdvice());
hygfjpInverterWarn.setStartTime(alarmDto.getAlarmBeginTime());
hygfjpInverterWarn.setRecoverTime(alarmDto.getAlarmEndTime());
hygfjpInverterWarn.setState(GoLangConstant.alarmstatus.get(alarmDto.getState()));
if (ObjectUtils.isEmpty(hygfjpInverterWarn.getCreatedTime())) {
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis());
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
} else {
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
}
}
}
}
}
} }
...@@ -17,7 +17,7 @@ spring.db2.datasource.password=Yeejoin@2020 ...@@ -17,7 +17,7 @@ spring.db2.datasource.password=Yeejoin@2020
spring.db2.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.db2.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
## db3-taosiData ## db3-taosiData
spring.db3.datasource.type: com.alibaba.druid.pool.DruidDataSource spring.db3.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db3.datasource.url=jdbc:TAOS-RS://139.9.170.47:6041/house_pv_data?user=root&password=taosdata&timezone=GMT%2B8&characterEncoding=utf8 spring.db3.datasource.url=jdbc:TAOS-RS://139.9.170.47:6041/house_pv_data?user=root&password=taosdata&characterEncoding=utf8
spring.db3.datasource.username=root spring.db3.datasource.username=root
spring.db3.datasource.password=taosdata spring.db3.datasource.password=taosdata
spring.db3.datasource.driver-class-name=com.taosdata.jdbc.rs.RestfulDriver spring.db3.datasource.driver-class-name=com.taosdata.jdbc.rs.RestfulDriver
......
...@@ -35,4 +35,5 @@ public class JpCollectorHistoryAllDto { ...@@ -35,4 +35,5 @@ public class JpCollectorHistoryAllDto {
@ApiModelProperty(value = "年") @ApiModelProperty(value = "年")
private String year; private String year;
private long createdTime;
} }
...@@ -14,28 +14,29 @@ import java.util.Date; ...@@ -14,28 +14,29 @@ import java.util.Date;
* @date 2023-09-20 * @date 2023-09-20
*/ */
@Data @Data
@ApiModel(value="JpCollectorHistoryYearDto", description="户用光伏监盘采集器历史表") @ApiModel(value = "JpCollectorHistoryYearDto", description = "户用光伏监盘采集器历史表")
public class JpCollectorHistoryYearDto { public class JpCollectorHistoryYearDto {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "sn编码")
private String snCode;
@ApiModelProperty(value = "sn编码") @ApiModelProperty(value = "信号强度")
private String snCode; private Double signalStrength;
@ApiModelProperty(value = "信号强度") @ApiModelProperty(value = "第三方电站id")
private Double signalStrength; private String thirdStationId;
@ApiModelProperty(value = "第三方电站id") @ApiModelProperty(value = "第三方厂商标识")
private String thirdStationId; private String thirdCode;
@ApiModelProperty(value = "第三方厂商标识") @ApiModelProperty(value = "日期")
private String thirdCode; private String month;
@ApiModelProperty(value = "日期") @ApiModelProperty(value = "年")
private String month; private String year;
@ApiModelProperty(value = "年") private long createdTime;
private String year;
} }
...@@ -51,5 +51,7 @@ public class JpInvertorElecHistoryAllDto { ...@@ -51,5 +51,7 @@ public class JpInvertorElecHistoryAllDto {
@ApiModelProperty(value = "年") @ApiModelProperty(value = "年")
private String year; private String year;
private Long createdTime;
} }
...@@ -55,5 +55,6 @@ public class JpInvertorElecHistoryMonthDto { ...@@ -55,5 +55,6 @@ public class JpInvertorElecHistoryMonthDto {
@ApiModelProperty(value = "年月") @ApiModelProperty(value = "年月")
private String yearMonth; private String yearMonth;
private Long createdTime;
} }
...@@ -15,43 +15,44 @@ import java.util.Date; ...@@ -15,43 +15,44 @@ import java.util.Date;
* @date 2023-09-20 * @date 2023-09-20
*/ */
@Data @Data
@ApiModel(value="JpInvertorElecHistoryYearDto", description="户用光伏监盘逆变器电能历史表") @ApiModel(value = "JpInvertorElecHistoryYearDto", description = "户用光伏监盘逆变器电能历史表")
public class JpInvertorElecHistoryYearDto { public class JpInvertorElecHistoryYearDto {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "sn编码")
private String snCode;
@ApiModelProperty(value = "sn编码") @ApiModelProperty(value = "U交流电压")
private String snCode; private Double uAcVoltage;
@ApiModelProperty(value = "U交流电压") @ApiModelProperty(value = "V交流电压")
private Double uAcVoltage; private Double vAcVoltage;
@ApiModelProperty(value = "V交流电压") @ApiModelProperty(value = "W交流电压")
private Double vAcVoltage; private Double wAcVoltage;
@ApiModelProperty(value = "W交流电压") @ApiModelProperty(value = "U交流电流")
private Double wAcVoltage; private Double uAcCurrent;
@ApiModelProperty(value = "U交流电流") @ApiModelProperty(value = "V交流电流")
private Double uAcCurrent; private Double vAcCurrent;
@ApiModelProperty(value = "V交流电流") @ApiModelProperty(value = "W交流电流")
private Double vAcCurrent; private Double wAcCurrent;
@ApiModelProperty(value = "W交流电流") @ApiModelProperty(value = "第三方电站id")
private Double wAcCurrent; private String thirdStationId;
@ApiModelProperty(value = "第三方电站id") @ApiModelProperty(value = "第三方厂商标识")
private String thirdStationId; private String thirdCode;
@ApiModelProperty(value = "第三方厂商标识") @ApiModelProperty(value = "月")
private String thirdCode; private String month;
@ApiModelProperty(value = "日期") @ApiModelProperty(value = "年")
private String day; private String year;
@ApiModelProperty(value = "年月") private Long createdTime;
private String yearMonth;
} }
...@@ -53,6 +53,10 @@ public class TdHygfJpInverterWarnDto { ...@@ -53,6 +53,10 @@ public class TdHygfJpInverterWarnDto {
@ApiModelProperty(value = "时间") @ApiModelProperty(value = "时间")
private Long time; private Long time;
private Long createdTime;
private List<String> stationIds; private List<String> stationIds;
private List<String> states;
} }
...@@ -50,5 +50,7 @@ public class TdHygfJpInvertorElecHistoryDto { ...@@ -50,5 +50,7 @@ public class TdHygfJpInvertorElecHistoryDto {
@ApiModelProperty(value = "第三方厂商标识") @ApiModelProperty(value = "第三方厂商标识")
private String thirdCode; private String thirdCode;
private Long createdTime;
} }
package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper; package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import java.util.List; import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -31,4 +32,16 @@ public interface TdHygfJpCollectorHistoryMapper extends BaseMapper<TdHygfJpColle ...@@ -31,4 +32,16 @@ public interface TdHygfJpCollectorHistoryMapper extends BaseMapper<TdHygfJpColle
List<JpCollectorHistoryAllDto> allList(@Param("snCode") String snCode, List<JpCollectorHistoryAllDto> allList(@Param("snCode") String snCode,
@Param("thirdStationId") String thirdStationId); @Param("thirdStationId") String thirdStationId);
List<Map<String, Object>> dayToMonth(@Param("startTime") long startTime, @Param("endTime") long endTime);
List<Map<String, Object>> monthToYear(@Param("month") String month);
List<Map<String, Object>> yearToAll(@Param("year") String year);
void updateMonth(@Param("list") List<Map<String, Object>> list);
void updateYear(@Param("list") List<Map<String, Object>> list);
void updateAll(@Param("list") List<Map<String, Object>> list);
} }
package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper; package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpInverterHistory; import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpInverterHistory;
/** /**
* 户用光伏监盘逆变器历史表 Mapper 接口 * 户用光伏监盘逆变器历史表 Mapper 接口
...@@ -11,4 +15,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -11,4 +15,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface TdHygfJpInverterHistoryMapper extends BaseMapper<TdHygfJpInverterHistory> { public interface TdHygfJpInverterHistoryMapper extends BaseMapper<TdHygfJpInverterHistory> {
Map<String, Object> sum(@Param("snCode") String snCode, @Param("thirdStationId") String thirdStationId,
@Param("date") String date);
} }
package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper; package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterWarnDto; import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterWarnDto;
...@@ -25,4 +24,5 @@ public interface TdHygfJpInverterWarnMapper extends BaseMapper<TdHygfJpInverterW ...@@ -25,4 +24,5 @@ public interface TdHygfJpInverterWarnMapper extends BaseMapper<TdHygfJpInverterW
List<TdHygfJpInverterWarnDto> list(@Param("param") TdHygfJpInverterWarnDto tdHygfJpInverterWarnDto); List<TdHygfJpInverterWarnDto> list(@Param("param") TdHygfJpInverterWarnDto tdHygfJpInverterWarnDto);
TdHygfJpInverterWarnDto getByTime(@Param("createdTime") long createdTime);
} }
package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper; package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import java.util.List; import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -31,4 +32,16 @@ public interface TdHygfJpInvertorElecHistoryMapper extends BaseMapper<TdHygfJpIn ...@@ -31,4 +32,16 @@ public interface TdHygfJpInvertorElecHistoryMapper extends BaseMapper<TdHygfJpIn
List<JpInvertorElecHistoryAllDto> allList(@Param("snCode") String snCode, List<JpInvertorElecHistoryAllDto> allList(@Param("snCode") String snCode,
@Param("thirdStationId") String thirdStationId); @Param("thirdStationId") String thirdStationId);
List<Map<String, Object>> dayToMonth(@Param("startTime") long startTime, @Param("endTime") long endTime);
List<Map<String, Object>> monthToYear(@Param("month") String month);
List<Map<String, Object>> yearToAll(@Param("year") String year);
void updateMonth(@Param("list") List<Map<String, Object>> list);
void updateYear(@Param("list") List<Map<String, Object>> list);
void updateAll(@Param("list") List<Map<String, Object>> list);
} }
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
AND `third_station_id` = #{thirdStationId} AND `third_station_id` = #{thirdStationId}
</if> </if>
<if test="startTime!=null and endTime!=null"> <if test="startTime!=null and endTime!=null">
AND time BETWEEN #{startTime} AND #{endTime} AND time &gt;= #{startTime} AND time &lt;= #{endTime}
</if> </if>
</where> </where>
</select> </select>
...@@ -54,4 +54,49 @@ ...@@ -54,4 +54,49 @@
</if> </if>
</where> </where>
</select> </select>
<select id="dayToMonth" resultType="Map">
SELECT sn_code,AVG(signal_strength) AS signal_strength,third_station_id,third_code FROM house_pv_data.td_hygf_jp_collector_history
<where>
<if test="startTime!=null and endTime!=null">
AND time &gt;= #{startTime} AND time &lt;= #{endTime}
</if>
</where>
GROUP BY sn_code,third_station_id,third_code
</select>
<select id="monthToYear" resultType="Map">
SELECT sn_code,AVG(signal_strength) AS signal_strength,third_station_id,third_code FROM house_pv_data.td_hygf_jp_collector_history_month
<where>
<if test="month!=null">
AND year_month = #{month}
</if>
</where>
GROUP BY sn_code,third_station_id,third_code
</select>
<select id="yearToAll" resultType="Map">
SELECT sn_code,AVG(signal_strength) AS signal_strength,third_station_id,third_code FROM house_pv_data.td_hygf_jp_collector_history_year
<where>
<if test="year!=null">
AND year = #{year}
</if>
</where>
GROUP BY sn_code,third_station_id,third_code
</select>
<insert id="updateMonth">
INSERT INTO house_pv_data.td_hygf_jp_collector_history_month VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.created_time},#{item.sn_code},#{item.signal_strength},#{item.third_station_id},#{item.third_code},#{item.day},#{item.year_month})
</foreach>
</insert>
<insert id="updateYear">
INSERT INTO house_pv_data.td_hygf_jp_collector_history_year VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.created_time},#{item.sn_code},#{item.signal_strength},#{item.third_station_id},#{item.third_code},#{item.month},#{item.year})
</foreach>
</insert>
<insert id="updateAll">
INSERT INTO house_pv_data.td_hygf_jp_collector_history_all VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.created_time},#{item.sn_code},#{item.signal_strength},#{item.third_station_id},#{item.third_code},#{item.year})
</foreach>
</insert>
</mapper> </mapper>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpInverterHistoryMapper"> <mapper namespace="com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpInverterHistoryMapper">
<select id="dayList" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpCollectorHistoryDto"> <select id="sum" resultType="Map">
SELECT * FROM house_pv_data.td_hygf_jp_collector_history SELECT sum(power_generation) AS power,sum(daily_return) AS dailyReturn,sum(generation_hours) AS hours FROM house_pv_data.td_hygf_jp_inverter_history
<where> <where>
<if test="snCode!=null"> <if test="snCode!=null">
AND `sn_code` = #{snCode} AND `sn_code` = #{snCode}
</if> </if>
<if test="thirdStationId!=null"> <if test="thirdStationId!=null">
AND `third_station_id` = #{thirdStationId} AND `third_station_id` = #{thirdStationId}
</if> </if>
<if test="startTime!=null and endTime!=null"> <if test="date!=null">
AND time BETWEEN #{startTime} AND #{endTime} AND `date` LIKE #{date}
</if> </if>
</where> </where>
</select> </select>
......
...@@ -21,8 +21,11 @@ ...@@ -21,8 +21,11 @@
<select id="list" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterWarnDto"> <select id="list" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterWarnDto">
SELECT * FROM house_pv_data.td_hygf_jp_inverter_warn SELECT * FROM house_pv_data.td_hygf_jp_inverter_warn
<where> <where>
<if test="param.state!=null"> <if test="param.states!=null">
`state` = #{param.state} AND `state` IN
<foreach collection="param.states" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if> </if>
<if test="param.stationIds!=null"> <if test="param.stationIds!=null">
AND third_station_id IN AND third_station_id IN
...@@ -32,4 +35,13 @@ ...@@ -32,4 +35,13 @@
</if> </if>
</where> </where>
</select> </select>
<select id="getByTime" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterWarnDto">
SELECT * FROM house_pv_data.td_hygf_jp_inverter_warn
<where>
<if test="createdTime!=null">
AND created_time = #{createdTime}
</if>
</where>
</select>
</mapper> </mapper>
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<if test="snCode!=null"> <if test="snCode!=null">
AND `sn_code` = #{snCode} AND `sn_code` = #{snCode}
</if> </if>
<if test="thirdStationId!=null"> <if test="thirdStationId!=null">
AND `third_station_id` = #{thirdStationId} AND `third_station_id` = #{thirdStationId}
</if> </if>
<if test="startTime!=null and endTime!=null"> <if test="startTime!=null and endTime!=null">
...@@ -54,4 +54,55 @@ ...@@ -54,4 +54,55 @@
</if> </if>
</where> </where>
</select> </select>
<select id="dayToMonth" resultType="Map">
SELECT sn_code,AVG(u_ac_voltage) AS u_ac_voltage,AVG(v_ac_voltage) AS v_ac_voltage,AVG(w_ac_voltage) AS w_ac_voltage,
AVG(u_ac_current) AS u_ac_current,AVG(v_ac_current) AS v_ac_current,AVG(w_ac_current) AS w_ac_current,third_station_id,third_code FROM house_pv_data.td_hygf_jp_invertor_elec_history
<where>
<if test="startTime!=null and endTime!=null">
AND time &gt;= #{startTime} AND time &lt;= #{endTime}
</if>
</where>
GROUP BY sn_code,third_station_id,third_code
</select>
<select id="monthToYear" resultType="Map">
SELECT sn_code,AVG(u_ac_voltage) AS u_ac_voltage,AVG(v_ac_voltage) AS v_ac_voltage,AVG(w_ac_voltage) AS w_ac_voltage,
AVG(u_ac_current) AS u_ac_current,AVG(v_ac_current) AS v_ac_current,AVG(w_ac_current) AS w_ac_current,third_station_id,third_code FROM house_pv_data.td_hygf_jp_invertor_elec_history_month
<where>
<if test="month!=null">
AND year_month = #{month}
</if>
</where>
GROUP BY sn_code,third_station_id,third_code
</select>
<select id="yearToAll" resultType="Map">
SELECT sn_code,AVG(u_ac_voltage) AS u_ac_voltage,AVG(v_ac_voltage) AS v_ac_voltage,AVG(w_ac_voltage) AS w_ac_voltage,
AVG(u_ac_current) AS u_ac_current,AVG(v_ac_current) AS v_ac_current,AVG(w_ac_current) AS w_ac_current,third_station_id,third_code FROM house_pv_data.td_hygf_jp_invertor_elec_history_year
<where>
<if test="year!=null">
AND year = #{year}
</if>
</where>
GROUP BY sn_code,third_station_id,third_code
</select>
<insert id="updateMonth">
INSERT INTO house_pv_data.td_hygf_jp_invertor_elec_history_month VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.created_time},#{item.sn_code},#{item.u_ac_voltage},#{item.v_ac_voltage},#{item.w_ac_voltage},
#{item.u_ac_current},#{item.v_ac_current},#{item.w_ac_current},#{item.third_station_id},#{item.third_code},#{item.day},#{item.year_month})
</foreach>
</insert>
<insert id="updateYear">
INSERT INTO house_pv_data.td_hygf_jp_invertor_elec_history_year VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.created_time},#{item.sn_code},#{item.u_ac_voltage},#{item.v_ac_voltage},#{item.w_ac_voltage},
#{item.u_ac_current},#{item.v_ac_current},#{item.w_ac_current},#{item.third_station_id},#{item.third_code},#{item.month},#{item.year})
</foreach>
</insert>
<insert id="updateAll">
INSERT INTO house_pv_data.td_hygf_jp_invertor_elec_history_all VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.created_time},#{item.sn_code},#{item.u_ac_voltage},#{item.v_ac_voltage},#{item.w_ac_voltage},
#{item.u_ac_current},#{item.v_ac_current},#{item.w_ac_current},#{item.third_station_id},#{item.third_code},#{item.year})
</foreach>
</insert>
</mapper> </mapper>
package com.yeejoin.amos.boot.module.hygf.biz.controller; package com.yeejoin.amos.boot.module.hygf.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List; import java.util.List;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpInverterElectricityServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpInverterElectricityServiceImpl;
...@@ -110,7 +109,7 @@ public class JpInverterElectricityController extends BaseController { ...@@ -110,7 +109,7 @@ public class JpInverterElectricityController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "户用光伏监盘逆变器电能表列表全部数据查询", notes = "户用光伏监盘逆变器电能表列表全部数据查询") @ApiOperation(httpMethod = "GET",value = "户用光伏监盘逆变器电能表列表全部数据查询", notes = "户用光伏监盘逆变器电能表列表全部数据查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public ResponseModel<List<JpInverterElectricityDto>> selectForList() { public ResponseModel<List<JpInverterElectricityDto>> selectForList(@RequestParam(value = "id") String id) {
return ResponseHelper.buildResponse(jpInverterElectricityServiceImpl.queryForJpInverterElectricityList()); return ResponseHelper.buildResponse(jpInverterElectricityServiceImpl.queryForJpInverterElectricityList(id));
} }
} }
...@@ -171,4 +171,16 @@ public class TdHygfJpCollectorHistoryController extends BaseController { ...@@ -171,4 +171,16 @@ public class TdHygfJpCollectorHistoryController extends BaseController {
public ResponseModel<List<JpCollectorHistoryAllDto>> allList(@RequestParam(value = "id") long id) { public ResponseModel<List<JpCollectorHistoryAllDto>> allList(@RequestParam(value = "id") long id) {
return ResponseHelper.buildResponse(tdHygfJpCollectorHistoryServiceImpl.allList(id)); return ResponseHelper.buildResponse(tdHygfJpCollectorHistoryServiceImpl.allList(id));
} }
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "户用光伏监盘采集器历史表列表全部数据查询", notes = "户用光伏监盘采集器历史表列表全部数据查询")
@GetMapping(value = "/syncData")
public ResponseModel<Object> syncData() {
return ResponseHelper.buildResponse(tdHygfJpCollectorHistoryServiceImpl.syncData());
}
} }
package com.yeejoin.amos.boot.module.hygf.biz.controller; package com.yeejoin.amos.boot.module.hygf.biz.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.RequestParam;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.List; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpInverterHistoryServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterHistoryDto; import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterHistoryDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpInverterHistoryServiceImpl;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/** /**
* 户用光伏监盘逆变器历史表 * 户用光伏监盘逆变器历史表
...@@ -28,88 +39,105 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType; ...@@ -28,88 +39,105 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
@RequestMapping(value = "/td-hygf-jp-inverter-history") @RequestMapping(value = "/td-hygf-jp-inverter-history")
public class TdHygfJpInverterHistoryController extends BaseController { public class TdHygfJpInverterHistoryController extends BaseController {
@Autowired @Autowired
TdHygfJpInverterHistoryServiceImpl tdHygfJpInverterHistoryServiceImpl; TdHygfJpInverterHistoryServiceImpl tdHygfJpInverterHistoryServiceImpl;
/** /**
* 新增户用光伏监盘逆变器历史表 * 新增户用光伏监盘逆变器历史表
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增户用光伏监盘逆变器历史表", notes = "新增户用光伏监盘逆变器历史表") @ApiOperation(httpMethod = "POST", value = "新增户用光伏监盘逆变器历史表", notes = "新增户用光伏监盘逆变器历史表")
public ResponseModel<TdHygfJpInverterHistoryDto> save(@RequestBody TdHygfJpInverterHistoryDto model) { public ResponseModel<TdHygfJpInverterHistoryDto> save(@RequestBody TdHygfJpInverterHistoryDto model) {
model = tdHygfJpInverterHistoryServiceImpl.createWithModel(model); model = tdHygfJpInverterHistoryServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model); return ResponseHelper.buildResponse(model);
} }
/** /**
* 根据sequenceNbr更新 * 根据sequenceNbr更新
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}") @PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新户用光伏监盘逆变器历史表", notes = "根据sequenceNbr更新户用光伏监盘逆变器历史表") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新户用光伏监盘逆变器历史表", notes = "根据sequenceNbr更新户用光伏监盘逆变器历史表")
public ResponseModel<TdHygfJpInverterHistoryDto> updateBySequenceNbrTdHygfJpInverterHistory(@RequestBody TdHygfJpInverterHistoryDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<TdHygfJpInverterHistoryDto> updateBySequenceNbrTdHygfJpInverterHistory(
return ResponseHelper.buildResponse(tdHygfJpInverterHistoryServiceImpl.updateWithModel(model)); @RequestBody TdHygfJpInverterHistoryDto model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(tdHygfJpInverterHistoryServiceImpl.updateWithModel(model));
} }
/** /**
* 根据sequenceNbr删除 * 根据sequenceNbr删除
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}") @DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除户用光伏监盘逆变器历史表", notes = "根据sequenceNbr删除户用光伏监盘逆变器历史表") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除户用光伏监盘逆变器历史表", notes = "根据sequenceNbr删除户用光伏监盘逆变器历史表")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request,
return ResponseHelper.buildResponse(tdHygfJpInverterHistoryServiceImpl.removeById(sequenceNbr)); @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
} return ResponseHelper.buildResponse(tdHygfJpInverterHistoryServiceImpl.removeById(sequenceNbr));
}
/** /**
* 根据sequenceNbr查询 * 根据sequenceNbr查询
* *
* @param sequenceNbr 主键 * @param sequenceNbr 主键
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个户用光伏监盘逆变器历史表", notes = "根据sequenceNbr查询单个户用光伏监盘逆变器历史表") @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个户用光伏监盘逆变器历史表", notes = "根据sequenceNbr查询单个户用光伏监盘逆变器历史表")
public ResponseModel<TdHygfJpInverterHistoryDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<TdHygfJpInverterHistoryDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(tdHygfJpInverterHistoryServiceImpl.queryBySeq(sequenceNbr)); return ResponseHelper.buildResponse(tdHygfJpInverterHistoryServiceImpl.queryBySeq(sequenceNbr));
} }
/** /**
* 列表分页查询 * 列表分页查询
* *
* @param current 当前页 * @param current 当前页
* @param current 每页大小 * @param current 每页大小
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "户用光伏监盘逆变器历史表分页查询", notes = "户用光伏监盘逆变器历史表分页查询") @ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器历史表分页查询", notes = "户用光伏监盘逆变器历史表分页查询")
public ResponseModel<Page<TdHygfJpInverterHistoryDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam public ResponseModel<Page<TdHygfJpInverterHistoryDto>> queryForPage(@RequestParam(value = "current") int current,
(value = "size") int size) { @RequestParam(value = "size") int size) {
Page<TdHygfJpInverterHistoryDto> page = new Page<TdHygfJpInverterHistoryDto>(); Page<TdHygfJpInverterHistoryDto> page = new Page<TdHygfJpInverterHistoryDto>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
return ResponseHelper.buildResponse(tdHygfJpInverterHistoryServiceImpl.queryForTdHygfJpInverterHistoryPage(page)); return ResponseHelper
.buildResponse(tdHygfJpInverterHistoryServiceImpl.queryForTdHygfJpInverterHistoryPage(page));
} }
/** /**
* 列表全部数据查询 * 列表全部数据查询
* *
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "户用光伏监盘逆变器历史表列表全部数据查询", notes = "户用光伏监盘逆变器历史表列表全部数据查询") @ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器历史表列表全部数据查询", notes = "户用光伏监盘逆变器历史表列表全部数据查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public ResponseModel<List<TdHygfJpInverterHistoryDto>> selectForList() { public ResponseModel<List<TdHygfJpInverterHistoryDto>> selectForList() {
return ResponseHelper.buildResponse(tdHygfJpInverterHistoryServiceImpl.queryForTdHygfJpInverterHistoryList()); return ResponseHelper.buildResponse(tdHygfJpInverterHistoryServiceImpl.queryForTdHygfJpInverterHistoryList());
} }
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器历史表列表全部数据查询", notes = "户用光伏监盘逆变器历史表列表全部数据查询")
@GetMapping(value = "/statistics")
public ResponseModel<Map<String, Object>> day(@RequestParam(value = "id") String id,
@RequestParam(value = "type") String type, @RequestParam(value = "date") String date) {
return ResponseHelper.buildResponse(tdHygfJpInverterHistoryServiceImpl.statistics(id,type,date));
}
} }
...@@ -107,6 +107,19 @@ public class TdHygfJpInverterWarnController extends BaseController { ...@@ -107,6 +107,19 @@ public class TdHygfJpInverterWarnController extends BaseController {
public ResponseModel<TdHygfJpInverterWarnDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<TdHygfJpInverterWarnDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(tdHygfJpInverterWarnServiceImpl.queryBySeq(sequenceNbr)); return ResponseHelper.buildResponse(tdHygfJpInverterWarnServiceImpl.queryBySeq(sequenceNbr));
} }
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "time/{createdTime}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个户用光伏监盘逆变器报警表", notes = "根据sequenceNbr查询单个户用光伏监盘逆变器报警表")
public ResponseModel<TdHygfJpInverterWarnDto> selectCreatedTime(@PathVariable Long createdTime) {
return ResponseHelper.buildResponse(tdHygfJpInverterWarnServiceImpl.queryByCreatedTime(createdTime));
}
/** /**
* 列表分页查询 * 列表分页查询
......
...@@ -171,4 +171,16 @@ public class TdHygfJpInvertorElecHistoryController extends BaseController { ...@@ -171,4 +171,16 @@ public class TdHygfJpInvertorElecHistoryController extends BaseController {
public ResponseModel<List<JpInvertorElecHistoryAllDto>> allList(@RequestParam(value = "id") long id) { public ResponseModel<List<JpInvertorElecHistoryAllDto>> allList(@RequestParam(value = "id") long id) {
return ResponseHelper.buildResponse(tdHygfJpInvertorElecHistoryServiceImpl.allList(id)); return ResponseHelper.buildResponse(tdHygfJpInvertorElecHistoryServiceImpl.allList(id));
} }
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "户用光伏监盘采集器历史表列表全部数据查询", notes = "户用光伏监盘采集器历史表列表全部数据查询")
@GetMapping(value = "/syncData")
public ResponseModel<Object> syncData() {
return ResponseHelper.buildResponse(tdHygfJpInvertorElecHistoryServiceImpl.syncData());
}
} }
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpInverter;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpInverterElectricity; import com.yeejoin.amos.boot.module.hygf.api.entity.JpInverterElectricity;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpInverterElectricityMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.JpInverterElectricityMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IJpInverterElectricityService; import com.yeejoin.amos.boot.module.hygf.api.service.IJpInverterElectricityService;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterElectricityDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterElectricityDto;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List; import java.util.List;
...@@ -16,18 +21,23 @@ import java.util.List; ...@@ -16,18 +21,23 @@ import java.util.List;
* @date 2023-09-19 * @date 2023-09-19
*/ */
@Service @Service
public class JpInverterElectricityServiceImpl extends BaseService<JpInverterElectricityDto,JpInverterElectricity,JpInverterElectricityMapper> implements IJpInverterElectricityService { public class JpInverterElectricityServiceImpl
/** extends BaseService<JpInverterElectricityDto, JpInverterElectricity, JpInverterElectricityMapper>
* 分页查询 implements IJpInverterElectricityService {
*/ /**
public Page<JpInverterElectricityDto> queryForJpInverterElectricityPage(Page<JpInverterElectricityDto> page) { * 分页查询
return this.queryForPage(page, null, false); */
} public Page<JpInverterElectricityDto> queryForJpInverterElectricityPage(Page<JpInverterElectricityDto> page) {
return this.queryForPage(page, null, false);
}
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<JpInverterElectricityDto> queryForJpInverterElectricityList() { public List<JpInverterElectricityDto> queryForJpInverterElectricityList(String id) {
return this.queryForList("" , false); LambdaQueryWrapper<JpInverterElectricity> wrapper = new LambdaQueryWrapper<>();
} wrapper.eq(JpInverterElectricity::getInverterId, id);
List<JpInverterElectricity> list = this.list(wrapper);
return Bean.toModels(list, this.getModelClass());
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorHistoryAllDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorHistoryAllDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorHistoryMonthDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorHistoryMonthDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorHistoryYearDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorHistoryYearDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpInvertorElecHistoryAllDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpInvertorElecHistoryYearDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpCollectorHistoryDto; import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpCollectorHistoryDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpCollector; import com.yeejoin.amos.boot.module.hygf.api.entity.JpCollector;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpCollectorHistory; import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpCollectorHistory;
...@@ -59,10 +64,11 @@ public class TdHygfJpCollectorHistoryServiceImpl ...@@ -59,10 +64,11 @@ public class TdHygfJpCollectorHistoryServiceImpl
*/ */
public List<JpCollectorHistoryMonthDto> monthList(long id, Date month) { public List<JpCollectorHistoryMonthDto> monthList(long id, Date month) {
JpCollector collector = jpCollectorServiceImpl.getById(id); JpCollector collector = jpCollectorServiceImpl.getById(id);
Calendar cal = Calendar.getInstance();
cal.setTime(month);
String monthStr = String.valueOf(cal.get(Calendar.YEAR)) + "-" + String.valueOf(cal.get(Calendar.MONTH) + 1);
if (collector != null) { if (collector != null) {
return this.baseMapper.monthList(collector.getSnCode(), collector.getThirdStationId(), return this.baseMapper.monthList(collector.getSnCode(), collector.getThirdStationId(), monthStr);
month.toString());
} }
return new ArrayList<>(); return new ArrayList<>();
} }
...@@ -72,10 +78,11 @@ public class TdHygfJpCollectorHistoryServiceImpl ...@@ -72,10 +78,11 @@ public class TdHygfJpCollectorHistoryServiceImpl
*/ */
public List<JpCollectorHistoryYearDto> yearList(long id, Date year) { public List<JpCollectorHistoryYearDto> yearList(long id, Date year) {
JpCollector collector = jpCollectorServiceImpl.getById(id); JpCollector collector = jpCollectorServiceImpl.getById(id);
Calendar cal = Calendar.getInstance();
cal.setTime(year);
String yearStr = String.valueOf(cal.get(Calendar.YEAR));
if (collector != null) { if (collector != null) {
return this.baseMapper.yearList(collector.getSnCode(), collector.getThirdStationId(), return this.baseMapper.yearList(collector.getSnCode(), collector.getThirdStationId(), yearStr);
year.toString());
} }
return new ArrayList<>(); return new ArrayList<>();
} }
...@@ -91,4 +98,73 @@ public class TdHygfJpCollectorHistoryServiceImpl ...@@ -91,4 +98,73 @@ public class TdHygfJpCollectorHistoryServiceImpl
} }
return new ArrayList<>(); return new ArrayList<>();
} }
public Object syncData() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
Date dayTime = cal.getTime();
int day = cal.get(Calendar.DATE);
int month = cal.get(Calendar.MONTH) + 1;
int year = cal.get(Calendar.YEAR);
// 月表
List<Map<String, Object>> monthList = this.baseMapper.dayToMonth(TimeUtil.getStartTimeOfDay(dayTime),
TimeUtil.getEndTimeOfDay(dayTime));
for (int i = 0; i < monthList.size(); i++) {
monthList.get(i).put("created_time", dayTime.getTime() + i);
monthList.get(i).put("day", day);
monthList.get(i).put("year_month", year + "-" + month);
}
if (!monthList.isEmpty()) {
this.baseMapper.updateMonth(monthList);
// 年表
List<Map<String, Object>> yearList = this.baseMapper.monthToYear(String.valueOf(year + "-" + month));
List<JpCollectorHistoryYearDto> oldYearList = this.baseMapper.yearList(null, null, String.valueOf(year));
for (int i = 0; i < yearList.size(); i++) {
Map<String, Object> map = yearList.get(i);
map.put("month", month);
map.put("year", year);
long time = dayTime.getTime() + i;
for (JpCollectorHistoryYearDto dto : oldYearList) {
if (dto.getThirdStationId() != null && dto.getSnCode() != null
&& map.get("third_station_id") != null && map.get("sn_code") != null
&& map.get("month") != null && map.get("year") != null
&& dto.getThirdStationId().equals(map.get("third_station_id").toString())
&& dto.getSnCode().equals(map.get("sn_code").toString())
&& dto.getYear().equals(map.get("year").toString())
&& dto.getMonth().equals(map.get("month").toString())) {
time = dto.getCreatedTime();
break;
}
}
yearList.get(i).put("created_time", time);
}
if (!yearList.isEmpty()) {
this.baseMapper.updateYear(yearList);
// 总表
List<Map<String, Object>> allList = this.baseMapper.yearToAll(String.valueOf(year));
List<JpCollectorHistoryAllDto> oldAllList = this.baseMapper.allList(null, null);
for (int i = 0; i < allList.size(); i++) {
Map<String, Object> map = allList.get(i);
map.put("year", year);
long time = dayTime.getTime() + i;
for (JpCollectorHistoryAllDto dto : oldAllList) {
if (dto.getThirdStationId() != null && dto.getSnCode() != null
&& map.get("third_station_id") != null && map.get("sn_code") != null
&& map.get("year") != null
&& dto.getThirdStationId().equals(map.get("third_station_id").toString())
&& dto.getSnCode().equals(map.get("sn_code").toString())
&& dto.getYear().equals(map.get("year").toString())) {
time = dto.getCreatedTime();
break;
}
}
map.put("created_time", time);
}
if (!allList.isEmpty()) {
this.baseMapper.updateAll(allList);
}
}
}
return null;
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpInverterHistory; import java.util.Date;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpInverterHistoryMapper; import java.util.HashMap;
import com.yeejoin.amos.boot.module.hygf.api.service.ITdHygfJpInverterHistoryService; import java.util.List;
import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterHistoryDto; import java.util.Map;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List; import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterHistoryDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpCollector;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpInverter;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpInverterHistory;
import com.yeejoin.amos.boot.module.hygf.api.service.ITdHygfJpInverterHistoryService;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpInverterHistoryMapper;
/** /**
* 户用光伏监盘逆变器历史表服务实现类 * 户用光伏监盘逆变器历史表服务实现类
...@@ -16,18 +24,53 @@ import java.util.List; ...@@ -16,18 +24,53 @@ import java.util.List;
* @date 2023-09-19 * @date 2023-09-19
*/ */
@Service @Service
public class TdHygfJpInverterHistoryServiceImpl extends BaseService<TdHygfJpInverterHistoryDto,TdHygfJpInverterHistory,TdHygfJpInverterHistoryMapper> implements ITdHygfJpInverterHistoryService { public class TdHygfJpInverterHistoryServiceImpl
/** extends BaseService<TdHygfJpInverterHistoryDto, TdHygfJpInverterHistory, TdHygfJpInverterHistoryMapper>
* 分页查询 implements ITdHygfJpInverterHistoryService {
*/
public Page<TdHygfJpInverterHistoryDto> queryForTdHygfJpInverterHistoryPage(Page<TdHygfJpInverterHistoryDto> page) { @Autowired
return this.queryForPage(page, null, false); private JpInverterServiceImpl jpInverterServiceImpl;
}
/**
/** * 分页查询
* 列表查询 示例 */
*/ public Page<TdHygfJpInverterHistoryDto> queryForTdHygfJpInverterHistoryPage(Page<TdHygfJpInverterHistoryDto> page) {
public List<TdHygfJpInverterHistoryDto> queryForTdHygfJpInverterHistoryList() { return this.queryForPage(page, null, false);
return this.queryForList("" , false); }
}
/**
* 列表查询 示例
*/
public List<TdHygfJpInverterHistoryDto> queryForTdHygfJpInverterHistoryList() {
return this.queryForList("", false);
}
public Map<String, Object> statistics(String id, String type, String date) {
JpInverter inverter = jpInverterServiceImpl.getById(id);
Double power = null, dailyReturn = null, hours = null;
Map<String, Object> map = new HashMap();
if (inverter != null) {
date = "%" + date + "%";
if ("day".equals(type)) {
map = this.baseMapper.sum(inverter.getSnCode(), inverter.getThirdStationId(), date);
} else if ("month".equals(type)) {
map = this.baseMapper.sum(inverter.getSnCode(), inverter.getThirdStationId(), date);
} else if ("year".equals(type)) {
map = this.baseMapper.sum(inverter.getSnCode(), inverter.getThirdStationId(), date);
} else if ("all".equals(type)) {
map = this.baseMapper.sum(inverter.getSnCode(), inverter.getThirdStationId(), date);
}
}
if(!map.containsKey("return"))
{
map.put("return", null);
}
if (map == null) {
map = new HashMap();
map.put("power", power);
map.put("return", dailyReturn);
map.put("hours", hours);
}
return map;
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -38,6 +40,10 @@ public class TdHygfJpInverterWarnServiceImpl ...@@ -38,6 +40,10 @@ public class TdHygfJpInverterWarnServiceImpl
int pageNum = (int) pageParam.getCurrent(); int pageNum = (int) pageParam.getCurrent();
int pageSize = (int) pageParam.getSize(); int pageSize = (int) pageParam.getSize();
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
if (tdHygfJpInverterWarnDto.getState() != null) {
String[] s = tdHygfJpInverterWarnDto.getState().split(",");
tdHygfJpInverterWarnDto.setStates(Arrays.asList(s));
}
List<TdHygfJpInverterWarnDto> list = this.baseMapper.list(tdHygfJpInverterWarnDto); List<TdHygfJpInverterWarnDto> list = this.baseMapper.list(tdHygfJpInverterWarnDto);
PageInfo<TdHygfJpInverterWarnDto> page = new PageInfo(list); PageInfo<TdHygfJpInverterWarnDto> page = new PageInfo(list);
com.baomidou.mybatisplus.extension.plugins.pagination.Page<TdHygfJpInverterWarnDto> pagenew = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<TdHygfJpInverterWarnDto>(); com.baomidou.mybatisplus.extension.plugins.pagination.Page<TdHygfJpInverterWarnDto> pagenew = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<TdHygfJpInverterWarnDto>();
...@@ -54,4 +60,11 @@ public class TdHygfJpInverterWarnServiceImpl ...@@ -54,4 +60,11 @@ public class TdHygfJpInverterWarnServiceImpl
public List<TdHygfJpInverterWarnDto> queryForTdHygfJpInverterWarnList() { public List<TdHygfJpInverterWarnDto> queryForTdHygfJpInverterWarnList() {
return this.queryForList("", false); return this.queryForList("", false);
} }
public TdHygfJpInverterWarnDto queryByCreatedTime(long createdTime) {
Map map = new HashMap<>();
map.put("created_time", createdTime);
TdHygfJpInverterWarnDto tdHygfJpInverterWarnDto = this.baseMapper.getByTime(createdTime);
return tdHygfJpInverterWarnDto;
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -59,9 +61,11 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends ...@@ -59,9 +61,11 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends
*/ */
public List<JpInvertorElecHistoryMonthDto> monthList(long id, Date month) { public List<JpInvertorElecHistoryMonthDto> monthList(long id, Date month) {
JpInverter invertor = jpInvertorServiceImpl.getById(id); JpInverter invertor = jpInvertorServiceImpl.getById(id);
Calendar cal = Calendar.getInstance();
cal.setTime(month);
String monthStr = String.valueOf(cal.get(Calendar.YEAR)) + "-" + String.valueOf(cal.get(Calendar.MONTH) + 1);
if (invertor != null) { if (invertor != null) {
return this.baseMapper.monthList(invertor.getSnCode(), invertor.getThirdStationId(), month.toString()); return this.baseMapper.monthList(invertor.getSnCode(), invertor.getThirdStationId(), monthStr);
} }
return new ArrayList<>(); return new ArrayList<>();
} }
...@@ -71,9 +75,11 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends ...@@ -71,9 +75,11 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends
*/ */
public List<JpInvertorElecHistoryYearDto> yearList(long id, Date year) { public List<JpInvertorElecHistoryYearDto> yearList(long id, Date year) {
JpInverter invertor = jpInvertorServiceImpl.getById(id); JpInverter invertor = jpInvertorServiceImpl.getById(id);
Calendar cal = Calendar.getInstance();
cal.setTime(year);
String yearStr = String.valueOf(cal.get(Calendar.YEAR));
if (invertor != null) { if (invertor != null) {
return this.baseMapper.yearList(invertor.getSnCode(), invertor.getThirdStationId(), year.toString()); return this.baseMapper.yearList(invertor.getSnCode(), invertor.getThirdStationId(), yearStr);
} }
return new ArrayList<>(); return new ArrayList<>();
} }
...@@ -89,4 +95,72 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends ...@@ -89,4 +95,72 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends
} }
return new ArrayList<>(); return new ArrayList<>();
} }
public Object syncData() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
Date dayTime = cal.getTime();
int day = cal.get(Calendar.DATE);
int month = cal.get(Calendar.MONTH) + 1;
int year = cal.get(Calendar.YEAR);
// 月表
List<Map<String, Object>> monthList = this.baseMapper.dayToMonth(TimeUtil.getStartTimeOfDay(dayTime),
TimeUtil.getEndTimeOfDay(dayTime));
for (int i = 0; i < monthList.size(); i++) {
monthList.get(i).put("created_time", dayTime.getTime() + i);
monthList.get(i).put("day", day);
monthList.get(i).put("year_month", year + "-" + month);
}
if (!monthList.isEmpty()) {
this.baseMapper.updateMonth(monthList);
// 年表
List<Map<String, Object>> yearList = this.baseMapper.monthToYear(String.valueOf(year + "-" + month));
List<JpInvertorElecHistoryYearDto> oldYearList = this.baseMapper.yearList(null, null, String.valueOf(year));
for (int i = 0; i < yearList.size(); i++) {
Map<String, Object> map = yearList.get(i);
yearList.get(i).put("year", year);
yearList.get(i).put("month", month);
long time = dayTime.getTime() + i;
for (JpInvertorElecHistoryYearDto dto : oldYearList) {
if (dto.getThirdStationId() != null && dto.getSnCode() != null
&& map.get("third_station_id") != null && map.get("sn_code") != null
&& map.get("month") != null && map.get("year") != null
&& dto.getThirdStationId().equals(map.get("third_station_id").toString())
&& dto.getSnCode().equals(map.get("sn_code").toString()) && dto.getYear().equals(map.get("year").toString())
&& dto.getMonth().equals(map.get("month").toString())) {
time = dto.getCreatedTime();
break;
}
}
yearList.get(i).put("created_time", time);
}
if (!yearList.isEmpty()) {
this.baseMapper.updateYear(yearList);
// 总表
List<Map<String, Object>> allList = this.baseMapper.yearToAll(String.valueOf(year));
List<JpInvertorElecHistoryAllDto> oldAllList = this.baseMapper.allList(null, null);
for (int i = 0; i < allList.size(); i++) {
Map<String, Object> map = allList.get(i);
allList.get(i).put("year", year);
long time = dayTime.getTime() + i;
for (JpInvertorElecHistoryAllDto dto : oldAllList) {
if (dto.getThirdStationId() != null && dto.getSnCode() != null
&& map.get("third_station_id") != null && map.get("sn_code") != null
&& map.get("year") != null
&& dto.getThirdStationId().equals(map.get("third_station_id").toString())
&& dto.getSnCode().equals(map.get("sn_code").toString())
&& dto.getYear().equals(map.get("year").toString())) {
time = dto.getCreatedTime();
break;
}
}
allList.get(i).put("created_time", time);
}
if (!allList.isEmpty()) {
this.baseMapper.updateAll(allList);
}
}
}
return null;
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.jxiop.biz.constants;
import java.util.HashMap;
public class CommonConstans {
//光伏发电量系数
public static final Double pvGenPoweActor = 0.000001;
// 风电站:
// (日/月/年)发电量=场站所有风机(日/月/年)发电量总和
// 装机容量=场站所有风机装机容量总和
//
// 光伏站:
// (日/月/年)发电量=场站所有逆变器(日/月/年)发电量总和
// 装机容量=场站所有逆变器装机容量总和
//
// 通用:
// 发电量完成率=(月/年)发电量/(月/年)发电量指标
// 小时数完成率=(月/年)可利用小时/(月/年)可利用小时数指标
// 可利用小时(h)=(日/月/年)发电量(万kW·h)/装机容量(万kW)
// 二氧化碳减排量(万t)=发电量(万kW·h)*0.997 * 10 / 10000
public static final Double carbonDioxide = 0.997 * 10 / 10000;
// 节约标准煤(万t)=发电量(万kW·h)*0.29
public static final Double standardCoal = 0.29;
// 炭粉尘减排量(t)=发电量(万kW·h)*0.30
public static final Double toner = 0.30;
// 二氧化硫减排量(t)=发电量(万kW·h)*1.51
public static final Double sulfurDioxide = 1.51;
// 氮氧化物减排量(t)=发电量(万kW·h)*1.69
public static final Double oxynitride = 1.69;
//吨转万吨
public static final Double tToWT = 0.0001;
//万Kwh转MV
public static final Integer wkwhToMv = 10;
// 正常运行 发电状态=1
// 告警运行 报警状态=1
// 正常停机 停机状态=1
// 故障停机 故障状态=1
// 限功率
// 待机状态 待机状态=1
// 维护状态 维护状态=1
// 通讯中断
public static final HashMap<String, String> fanStatus = new HashMap<String, String>() {
{
put("发电状态", "正常运行");
put("报警状态", "报警运行");
put("停机状态", "停机状态");
put("故障状态", "故障状态");
put("待机状态", "待机状态");
put("维护状态", "维护状态");
put("限功率", "限功率");
put("通讯中断", "通讯中断");
}
};
// 正常运行 运行=1
// 正常停机 停机=1
// 限功率 限额运行=1
// 限电停机 降额运行=1
// 告警运行 告警运行=1
// 故障停机 故障停机=1
// 待机状态 待机=1
// 通讯中断 通讯故障=1
public static final HashMap<String, String> pvStatus = new HashMap<String, String>() {
{
put("运行", "正常运行");
put("停机", "正常停机");
put("限额运行", "限功率");
put("降额运行", "限电停机");
put("告警运行", "告警运行");
put("故障停机", "故障停机");
put("待机", "待机状态");
put("通讯故障", "通讯中断");
}
};
//es EquipIndexName 查绚关键字
public static final String QueryStringEquipmentIndexName = "equipmentIndexName.keyword";
//es EquipIndexName 查绚关键字
public static final String QueryStringEquipmentIndexNameNotKeyword = "equipmentIndexName";
//es gatewayId 查绚关键字
public static final String QueryStringGateWayId = "gatewayId.keyword";
public static final String QueryStringFrontMoudle = "frontModule.keyword";
public static final String QueryStringSystemType = "systemType";
public static final String QueryStringSystemTypeKeyword = "systemType.keyword";
public static final String QueryStringEquipmentNumber = "equipmentNumber";
public static final String QueryStringEquipmentNumberKeyword = "equipmentNumber.keyword";
public static final String QueryStringValue = "value";
public static final String QueryStringValueKeyword = "value.keyword";
public static final String QueryStringValueLabel = "valueLabel";
public static final String QueryStringValueLabelKeyword = "valueLabel.keyword";
public static final String QueryStringDataType = "dataType";
public static final String QueryStringDisplayName = "displayName";
public static final String QueryStringDisplayNameKeyword = "displayName.keyword";
public static final String QueryStringIsAlarm = "isAlarm";
public static final String QueryStringIsAlarmKeyword = "isAlarm.keyword";
public static final String Twodecimalplaces= "%.2f";
public static final String Fourdecimalplaces = "%.4f";
public static final String QueryStringFrontMoudleNotKeyWord = "frontModule";
}
package com.yeejoin.amos.boot.module.jxiop.biz.controller; package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
...@@ -11,6 +13,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -11,6 +13,7 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -29,37 +32,73 @@ public class AnalyseController extends BaseController { ...@@ -29,37 +32,73 @@ public class AnalyseController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "工况测点区间划分-风机", notes = "工况测点区间划分-风机") @ApiOperation(httpMethod = "GET", value = "工况测点区间划分-风机", notes = "工况测点区间划分-风机")
@GetMapping(value = "/getFanConditionVariablesByTime") @GetMapping(value = "/getFanConditionVariablesByTime")
public ResponseModel<String> getFanConditionVariablesByTime(@RequestParam String startTime, @RequestParam String endTime) { public ResponseModel<String> getFanConditionVariablesByTime(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) {
if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime) ){
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
}
return ResponseHelper.buildResponse(commonServiceImpl.getFanConditionVariablesByTimeThread(startTime, endTime)); return ResponseHelper.buildResponse(commonServiceImpl.getFanConditionVariablesByTimeThread(startTime, endTime));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "工况测点区间划分-光伏", notes = "工况测点区间划分-光伏") @ApiOperation(httpMethod = "GET", value = "工况测点区间划分-光伏", notes = "工况测点区间划分-光伏")
@GetMapping(value = "/getPvConditionVariablesByTime") @GetMapping(value = "/getPvConditionVariablesByTime")
public ResponseModel<String> getPvConditionVariablesByTime(@RequestParam String startTime, @RequestParam String endTime) { public ResponseModel<String> getPvConditionVariablesByTime(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) {
if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime) ){
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
}
return ResponseHelper.buildResponse(commonServiceImpl.getPvConditionVariablesByTimeThread(startTime, endTime)); return ResponseHelper.buildResponse(commonServiceImpl.getPvConditionVariablesByTimeThread(startTime, endTime));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "相关性分析-风机", notes = "相关性分析-风机") @ApiOperation(httpMethod = "GET", value = "相关性分析-风机", notes = "相关性分析-风机")
@GetMapping(value = "/getFanConditionVariablesByTimeAnalyse") @GetMapping(value = "/getFanConditionVariablesByTimeAnalyse")
public ResponseModel<String> getFanConditionVariablesByTimeAnalyse(@RequestParam String startTime, @RequestParam String endTime) { public ResponseModel<String> getFanConditionVariablesByTimeAnalyse(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) {
if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime) ){
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
}
return ResponseHelper.buildResponse(commonServiceImpl.getFanConditionVariablesByTimeAnalyseThread(startTime, endTime)); return ResponseHelper.buildResponse(commonServiceImpl.getFanConditionVariablesByTimeAnalyseThread(startTime, endTime));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "相关性分析-风机", notes = "相关性分析-风机") @ApiOperation(httpMethod = "GET", value = "相关性分析-风机", notes = "相关性分析-风机")
@GetMapping(value = "/getPvConditionVariablesByTimeAnalyse") @GetMapping(value = "/getPvConditionVariablesByTimeAnalyse")
public ResponseModel<String> getPvConditionVariablesByTimeAnalyse(@RequestParam String startTime, @RequestParam String endTime) { public ResponseModel<String> getPvConditionVariablesByTimeAnalyse(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) {
if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime) ){
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
}
return ResponseHelper.buildResponse(commonServiceImpl.getPvConditionVariablesByTimeAnalyseThread(startTime, endTime)); return ResponseHelper.buildResponse(commonServiceImpl.getPvConditionVariablesByTimeAnalyseThread(startTime, endTime));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "中心值计算-风机", notes = "中心值计算-风机") @ApiOperation(httpMethod = "GET", value = "中心值计算-风机", notes = "中心值计算-风机")
@GetMapping(value = "/getFanConditionVariablesByTimeAnalyse1") @GetMapping(value = "/getFanConditionVariablesByTimeAnalyse1")
public ResponseModel<String> getFanConditionVariablesByTimeAnalyse1(@RequestParam String startTime, @RequestParam String endTime) { public ResponseModel<String> getFanConditionVariablesByTimeAnalyse1(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) {
if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime) ){
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
}
return ResponseHelper.buildResponse(commonServiceImpl.getFanConditionVariablesByTimeAnalyse1Thread(startTime, endTime)); return ResponseHelper.buildResponse(commonServiceImpl.getFanConditionVariablesByTimeAnalyse1Thread(startTime, endTime));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "中心值计算-光伏", notes = "中心值计算-光伏") @ApiOperation(httpMethod = "GET", value = "中心值计算-光伏", notes = "中心值计算-光伏")
@GetMapping(value = "/getPvConditionVariablesByTimeAnalyse1") @GetMapping(value = "/getPvConditionVariablesByTimeAnalyse1")
public ResponseModel<String> getPvConditionVariablesByTimeAnalyse1(@RequestParam String startTime, @RequestParam String endTime) { public ResponseModel<String> getPvConditionVariablesByTimeAnalyse1(@RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) {
if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime) ){
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
}
return ResponseHelper.buildResponse(commonServiceImpl.getPvConditionVariablesByTimeAnalyse1Thread(startTime, endTime)); return ResponseHelper.buildResponse(commonServiceImpl.getPvConditionVariablesByTimeAnalyse1Thread(startTime, endTime));
} }
...@@ -67,6 +106,12 @@ public class AnalyseController extends BaseController { ...@@ -67,6 +106,12 @@ public class AnalyseController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "获取influxdb数据", notes = "获取influxdb数据") @ApiOperation(httpMethod = "GET", value = "获取influxdb数据", notes = "获取influxdb数据")
@GetMapping(value = "/getInfluxdbDataByConditon") @GetMapping(value = "/getInfluxdbDataByConditon")
public ResponseModel<Map<String, Object>> getInfluxdbDataByConditon(@RequestParam String stationType, @RequestParam String pointId, @RequestParam String startTime, @RequestParam String endTime) { public ResponseModel<Map<String, Object>> getInfluxdbDataByConditon(@RequestParam String stationType, @RequestParam String pointId, @RequestParam String startTime, @RequestParam String endTime) {
return ResponseHelper.buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType,pointId,startTime, endTime)) ; if (StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime) ){
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
}
return ResponseHelper.buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType,pointId,startTime, endTime)) ;
} }
} }
package com.yeejoin.amos.boot.module.jxiop.biz.controller; package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic; import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ESEquipmentsDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanPointProcessVariableClassification;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanWarningRecordMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanWarningRecordMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -40,10 +49,21 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -40,10 +49,21 @@ public class BigScreenAnalyseController extends BaseController {
@Autowired @Autowired
StationBasicMapper stationBasicMapper; StationBasicMapper stationBasicMapper;
@Autowired
CommonServiceImpl commonServiceImpl;
@Autowired
IdxBizFanHealthLevelMapper idxBizFanHealthLevelMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 仪表盘", notes = "场站设备健康状态指数与趋势 - 仪表盘") @ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 仪表盘", notes = "场站设备健康状态指数与趋势 - 仪表盘")
@GetMapping(value = "/getHealthScoreInfo") @GetMapping(value = "/getHealthScoreInfo")
public ResponseModel<Map<String, BigDecimal>> getHealthScoreInfo(@RequestParam(required = false) String areaCode, @RequestParam(required = false) String stationCode) { public ResponseModel<Map<String, BigDecimal>> getHealthScoreInfo(@RequestParam(required = false) String areaCode, @RequestParam(required = false) String stationCode) {
if (StrUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getStationName();
}
HashMap<String, BigDecimal> stringBigDecimalHashMap = new HashMap<>(); HashMap<String, BigDecimal> stringBigDecimalHashMap = new HashMap<>();
stringBigDecimalHashMap.put("value", idxBizFanHealthIndexMapper.getHealthScoreInfo(areaCode, stationCode)); stringBigDecimalHashMap.put("value", idxBizFanHealthIndexMapper.getHealthScoreInfo(areaCode, stationCode));
return ResponseHelper.buildResponse(stringBigDecimalHashMap); return ResponseHelper.buildResponse(stringBigDecimalHashMap);
...@@ -54,6 +74,12 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -54,6 +74,12 @@ public class BigScreenAnalyseController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 折线图", notes = "场站设备健康状态指数与趋势 - 折线图") @ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 折线图", notes = "场站设备健康状态指数与趋势 - 折线图")
@GetMapping(value = "/getHealthListInfo") @GetMapping(value = "/getHealthListInfo")
public ResponseModel<Map<String, Object>> getHealthListInfo(@RequestParam(required = false) String areaCode, @RequestParam(required = false) String stationCode) { public ResponseModel<Map<String, Object>> getHealthListInfo(@RequestParam(required = false) String areaCode, @RequestParam(required = false) String stationCode) {
if (StrUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getStationName();
}
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthListInfo(areaCode, stationCode); List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthListInfo(areaCode, stationCode);
List<String> time = new ArrayList<>(); List<String> time = new ArrayList<>();
...@@ -131,7 +157,7 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -131,7 +157,7 @@ public class BigScreenAnalyseController extends BaseController {
Map<String, BigDecimal> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(), t -> new BigDecimal(t.get("healthIndex").toString()))); Map<String, BigDecimal> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(), t -> new BigDecimal(t.get("healthIndex").toString())));
List<String> list = Arrays.asList("华中片区", "西北片区", "西南片区", "华南片区", "华东片区", "东北片区", "华北片区"); List<String> list = Arrays.asList("华中片区", "西北片区", "西南片区", "华南片区", "华东片区", "东北片区", "华北片区");
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
list.forEach(item -> seriesData.add(collect.getOrDefault(item, new BigDecimal("0")))); list.forEach(item -> seriesData.add(collect.getOrDefault(item, new BigDecimal("100"))));
resultMap.put("axisData", list); resultMap.put("axisData", list);
resultMap.put("seriesData", seriesData); resultMap.put("seriesData", seriesData);
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
...@@ -147,8 +173,8 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -147,8 +173,8 @@ public class BigScreenAnalyseController extends BaseController {
@RequestParam(value = "current", required = false) Integer current, @RequestParam(value = "current", required = false) Integer current,
@RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "size", required = false) Integer size,
@RequestParam(value = "warningName", required = false) String warningName) { @RequestParam(value = "warningName", required = false) String warningName) {
Integer count = idxBizFanWarningRecordMapper.getEquipWarningInfoByPageCount(arae, station, stationType); Integer count = idxBizFanWarningRecordMapper.getEquipWarningInfoByPageCount(arae, station, stationType, warningName);
List<IdxBizFanWarningRecord> idxBizFanWarningRecordIPage = idxBizFanWarningRecordMapper.getEquipWarningInfoByPage(arae, station, stationType, current, size, warningName); List<IdxBizFanWarningRecord> idxBizFanWarningRecordIPage = idxBizFanWarningRecordMapper.getEquipWarningInfoByPage(arae, station, stationType, (current - 1) * size, size, warningName);
Page<IdxBizFanWarningRecord> idxBizFanWarningRecordPage = new Page<>(current, size); Page<IdxBizFanWarningRecord> idxBizFanWarningRecordPage = new Page<>(current, size);
idxBizFanWarningRecordPage.setRecords(idxBizFanWarningRecordIPage); idxBizFanWarningRecordPage.setRecords(idxBizFanWarningRecordIPage);
idxBizFanWarningRecordPage.setTotal(count); idxBizFanWarningRecordPage.setTotal(count);
...@@ -210,7 +236,7 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -210,7 +236,7 @@ public class BigScreenAnalyseController extends BaseController {
public ResponseModel<Map<String, Object>> getHealthInfoByArea(@RequestParam(required = false) String areaCode) { public ResponseModel<Map<String, Object>> getHealthInfoByArea(@RequestParam(required = false) String areaCode) {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoByStation(areaCode); List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoByStation(areaCode);
Map<String, BigDecimal> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(), t -> new BigDecimal(t.get("healthIndex").toString()))); Map<String, BigDecimal> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("station").toString(), t -> new BigDecimal(t.get("healthIndex").toString())));
...@@ -229,6 +255,10 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -229,6 +255,10 @@ public class BigScreenAnalyseController extends BaseController {
@ApiOperation(value = "场站预警信息统计图 - 雷达图", httpMethod = "GET") @ApiOperation(value = "场站预警信息统计图 - 雷达图", httpMethod = "GET")
@GetMapping("/equipWarningRadarMap") @GetMapping("/equipWarningRadarMap")
public ResponseModel<Map<String, Object>> assessIndexRadarMap(@RequestParam(required = false, value = "stationCode") String stationCode) { public ResponseModel<Map<String, Object>> assessIndexRadarMap(@RequestParam(required = false, value = "stationCode") String stationCode) {
if (StrUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getStationName();
}
List<Map<String, Object>> list = idxBizFanHealthIndexMapper.equipWarningRadarMap(stationCode); List<Map<String, Object>> list = idxBizFanHealthIndexMapper.equipWarningRadarMap(stationCode);
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
List<List<String>> resultData = new ArrayList<>(); List<List<String>> resultData = new ArrayList<>();
...@@ -246,4 +276,274 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -246,4 +276,274 @@ public class BigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "片区设备预警统计分析 - 右下角柱状图 ", notes = "片区设备预警统计分析 - 右下角柱状图 ")
@GetMapping(value = "/getAllEquipAlarmInfoAnalysis")
public ResponseModel<Map<String, Object>> getAllEquipAlarmInfoAnalysis(@RequestParam(required = false) String stationType,
@RequestParam(required = false) String areaCode) {
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> allEquipAlarmInfo = new ArrayList<>();
if (CharSequenceUtil.isNotEmpty(stationType)) {
if ("fan".equals(stationType)) {
allEquipAlarmInfo = idxBizFanHealthIndexMapper.getAllEquipAlarmInfoAnalysisByStationType("idx_biz_fan_warning_record", areaCode, "idx_biz_fan_point_process_variable_classification");
} else if ("pv".equals(stationType)) {
allEquipAlarmInfo = idxBizFanHealthIndexMapper.getAllEquipAlarmInfoAnalysisByStationType("idx_biz_pv_warning_record", areaCode, "idx_biz_pv_point_process_variable_classification");
}
} else {
allEquipAlarmInfo = idxBizFanHealthIndexMapper.getAllEquipAlarmInfoAnalysisByArea(areaCode);
}
HashMap<String, Integer> wxMap = new HashMap<>();
HashMap<String, Integer> zyMap = new HashMap<>();
HashMap<String, Integer> jgMap = new HashMap<>();
allEquipAlarmInfo.forEach(item -> {
if ("危险".equals(item.get("warningName"))) {
wxMap.put(item.get("pointName").toString(), Integer.parseInt(item.get("num").toString()));
} else if ("注意".equals(item.get("warningName"))) {
zyMap.put(item.get("pointName").toString(), Integer.parseInt(item.get("num").toString()));
} else if ("警告".equals(item.get("warningName"))) {
jgMap.put(item.get("pointName").toString(), Integer.parseInt(item.get("num").toString()));
}
});
List<Integer> wxList = new ArrayList<>();
List<Integer> zyList = new ArrayList<>();
List<Integer> jgList = new ArrayList<>();
List<String> list = allEquipAlarmInfo.stream().map(t -> t.get("pointName").toString()).collect(Collectors.toList());
list.forEach(item -> {
wxList.add(wxMap.getOrDefault(item, 0));
zyList.add(zyMap.getOrDefault(item, 0));
jgList.add(jgMap.getOrDefault(item, 0));
});
HashMap<String, Object> wxMapResult = new HashMap<>();
wxMapResult.put("data", wxList);
wxMapResult.put("name", "危险");
HashMap<String, Object> zyMapResult = new HashMap<>();
zyMapResult.put("data", zyList);
zyMapResult.put("name", "注意");
HashMap<String, Object> jgMapResult = new HashMap<>();
jgMapResult.put("data", jgList);
jgMapResult.put("name", "警告");
List<Map<String, Object>> hashMaps = Arrays.asList(wxMapResult, zyMapResult, jgMapResult);
resultMap.put("axisData", list);
resultMap.put("seriesData", hashMaps);
return ResponseHelper.buildResponse(resultMap);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站 左侧风机信息列表")
@GetMapping("/getFanInfoByPage")
public ResponseModel<Page<Map<String, Object>>> getFanInfoByPage(@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper.getFanInfoByPage(stationBasic.getFanGatewayId());
List<Map<String, Object>> healthInfoList = idxBizFanHealthIndexMapper.getFanHealthInfoList(stationBasic.getFanGatewayId());
Map<Object, Double> equipmentHealthIndexMap = healthInfoList.stream().collect(Collectors.toMap(t -> t.get("equipmentName"), t -> Double.parseDouble(t.get("avgHealthIndex").toString())));
equipmentList.forEach(item -> {
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("equipmentName"), 100.0);
if (100.0 == equipmentHealthScore) {
item.put("warningName", "安全");
} else {
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备");
query.eq(IdxBizFanHealthLevel::getStatus, stationBasic.getStationName());
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, equipmentHealthScore);
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, equipmentHealthScore);
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
item.put("warningName", idxBizFanHealthLevel.getHealthLevel());
}
item.put("healthIndex", equipmentHealthScore);
String equipmentName = CharSequenceUtil.replace(item.get("equipmentName").toString(), "集电Ⅳ线#", "");
String replace = CharSequenceUtil.replace(equipmentName, "集电Ⅲ线#", "");
String replace1 = CharSequenceUtil.replace(replace, "集电Ⅱ线#", "");
String replace2 = CharSequenceUtil.replace(replace1, "集电Ⅰ线#", "");
String replace3 = CharSequenceUtil.replace(replace2, "风机系统", "");
item.put("equipmentNameSimple", replace3);
});
Page<Map<String, Object>> mapPage = new Page<>();
mapPage.setSize(equipmentList.size());
mapPage.setTotal(equipmentList.size());
mapPage.setCurrent(1);
mapPage.setRecords(equipmentList);
return ResponseHelper.buildResponse(mapPage);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站 风机子系统状态指数 柱状图")
@GetMapping("/getSubSystemInfo")
public ResponseModel<Map<String, Object>> getSubSystemInfo(@RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getSubSystemInfo(equipmentName, stationBasic.getFanGatewayId());
Map<Object, Double> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("subSystem"), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>();
List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper.getSumSystemListByEquipment(stationBasic.getFanGatewayId(), equipmentName);
equipmentList.forEach(item -> {
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("subSystem"), 100.0);
seriesData.add(equipmentHealthScore);
axisData.add(item.get("subSystem"));
});
resultMap.put("axisData", axisData);
resultMap.put("seriesData", seriesData);
return ResponseHelper.buildResponse(resultMap);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "该子系统各指标预警 - 风站中间 下方列表")
@GetMapping("/getSubSystemPointInfo")
public ResponseModel<Page<Map<String, Object>>> getSubSystemPointInfo(@RequestParam(value = "subSystem", required = false) String subSystem,
@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoBySubSystem(subSystem, stationBasic.getFanGatewayId());
Map<Object, Double> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("pointName"), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper.getPointNameListBySumSystem(stationBasic.getFanGatewayId(), subSystem);
pointNameList.forEach(item -> {
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("pointName"), 100.0);
if (100.0 == equipmentHealthScore) {
item.put("warningName", "安全");
} else {
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备");
query.eq(IdxBizFanHealthLevel::getStatus, stationBasic.getStationName());
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, equipmentHealthScore);
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, equipmentHealthScore);
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
item.put("warningName", idxBizFanHealthLevel.getHealthLevel());
}
item.put("healthIndex", equipmentHealthScore);
});
Page<Map<String, Object>> mapPage = new Page<>();
mapPage.setSize(pointNameList.size());
mapPage.setTotal(pointNameList.size());
mapPage.setCurrent(1);
mapPage.setRecords(pointNameList);
return ResponseHelper.buildResponse(mapPage);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "光伏 左侧风机信息列表")
@GetMapping("/getPvInfoByPage")
public ResponseModel<Page<Map<String, Object>>> getPvInfoByPage(@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper.getPvInfoByPage(stationBasic.getFanGatewayId());
List<Map<String, Object>> healthInfoList = idxBizFanHealthIndexMapper.getPvHealthInfoList(stationBasic.getFanGatewayId());
Map<Object, Double> equipmentHealthIndexMap = healthInfoList.stream().collect(Collectors.toMap(t -> t.get("subarray"), t -> Double.parseDouble(t.get("avgHealthIndex").toString())));
equipmentList.forEach(item -> {
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("subarray"), 100.0);
if (100.0 == equipmentHealthScore) {
item.put("warningName", "安全");
} else {
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备");
query.eq(IdxBizFanHealthLevel::getStatus, stationBasic.getStationName());
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, equipmentHealthScore);
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, equipmentHealthScore);
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
item.put("warningName", idxBizFanHealthLevel.getHealthLevel());
}
item.put("healthIndex", equipmentHealthScore);
});
Page<Map<String, Object>> mapPage = new Page<>();
mapPage.setSize(equipmentList.size());
mapPage.setTotal(equipmentList.size());
mapPage.setCurrent(1);
mapPage.setRecords(equipmentList);
return ResponseHelper.buildResponse(mapPage);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "光伏 子阵下各设备状态指数 柱状图")
@GetMapping("/getPvSubSystemInfo")
public ResponseModel<Map<String, Object>> getPvSubSystemInfo(@RequestParam(value = "subarray", required = false) String subarray,
@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvSubSystemInfo(subarray, stationBasic.getFanGatewayId());
Map<Object, Double> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("equipmentName"), t -> Double.parseDouble(t.get("avgHealthIndex").toString())));
List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>();
List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper.getPvSumSystemListByEquipment(stationBasic.getFanGatewayId(), subarray);
equipmentList.forEach(item -> {
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("equipmentName"), 100.0);
seriesData.add(equipmentHealthScore);
axisData.add(item.get("equipmentName"));
});
resultMap.put("axisData", axisData);
resultMap.put("seriesData", seriesData);
return ResponseHelper.buildResponse(resultMap);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "光伏 该装备下各指标预警 - 风站中间 下方列表")
@GetMapping("/getPvSubSystemPointInfo")
public ResponseModel<Page<Map<String, Object>>> getPvSubSystemPointInfo(@RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvHealthInfoBySubSystem(equipmentName, stationBasic.getFanGatewayId());
Map<Object, Double> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("pointName"), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper.getPvPointNameListBySumSystem(stationBasic.getFanGatewayId(), equipmentName);
pointNameList.forEach(item -> {
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("pointName"), 100.0);
if (100.0 == equipmentHealthScore) {
item.put("warningName", "安全");
} else {
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备");
query.eq(IdxBizFanHealthLevel::getStatus, stationBasic.getStationName());
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, equipmentHealthScore);
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, equipmentHealthScore);
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
item.put("warningName", idxBizFanHealthLevel.getHealthLevel());
}
item.put("healthIndex", equipmentHealthScore);
});
Page<Map<String, Object>> mapPage = new Page<>();
mapPage.setSize(pointNameList.size());
mapPage.setTotal(pointNameList.size());
mapPage.setCurrent(1);
mapPage.setRecords(pointNameList);
return ResponseHelper.buildResponse(mapPage);
}
} }
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.controller; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -22,6 +23,8 @@ import java.util.List; ...@@ -22,6 +23,8 @@ import java.util.List;
public class TestController extends BaseController { public class TestController extends BaseController {
@Autowired @Autowired
IndicatorDataMapper indicatorDataMapper; IndicatorDataMapper indicatorDataMapper;
@Autowired
CommonServiceImpl commonService;
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET", value = "test1", notes = "test1") @ApiOperation(httpMethod = "GET", value = "test1", notes = "test1")
...@@ -32,4 +35,17 @@ public class TestController extends BaseController { ...@@ -32,4 +35,17 @@ public class TestController extends BaseController {
return indicatorData; return indicatorData;
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET", value = "test2", notes = "test1")
@GetMapping("/test2")
public void test2 () {
commonService.healthWarningMinuteByFJ();
}
} }
package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import lombok.Data;
import java.util.Date;
@Data
public class ESEquipmentsDTO {
private String id;
private String address;
private String dataType;
private String equipmentSpecificName;
private String gatewayId;
private String isAlarm;
private Date createdTime;
private String unit;
private String value;
private Float valueF;
private String valueLabel;
private String traceId;
private String equipmentIndexName;
private String equipmentNumber;
private String frontModule;
private String systemType;
private String pictureName;
private String displayName;
private String state;
private String color;
}
...@@ -153,4 +153,10 @@ public class IdxBizFanHealthIndex { ...@@ -153,4 +153,10 @@ public class IdxBizFanHealthIndex {
@TableField("ANOMALY") @TableField("ANOMALY")
private Double ANOMALY; private Double ANOMALY;
/**
* 分析变量名称
*/
@TableField("POINT_NAME")
private String pointName;
} }
...@@ -162,4 +162,11 @@ public class IdxBizPvHealthIndex{ ...@@ -162,4 +162,11 @@ public class IdxBizPvHealthIndex{
@TableField("ANOMALY") @TableField("ANOMALY")
private Double ANOMALY; private Double ANOMALY;
/**
* 分析变量名称
*/
@TableField("POINT_NAME")
private String pointName;
} }
...@@ -30,4 +30,46 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -30,4 +30,46 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> getHealthInfoByStation(@Param("areaCode") String areaCode); List<Map<String, Object>> getHealthInfoByStation(@Param("areaCode") String areaCode);
List<Map<String, Object>> equipWarningRadarMap(@Param("stationCode") String stationCode); List<Map<String, Object>> equipWarningRadarMap(@Param("stationCode") String stationCode);
List<Map<String, Object>> getAllEquipAlarmInfoAnalysisByStationType(@Param("tableName") String tableName,
@Param("areaCode") String areaCode,
@Param("tableName2") String tableName2);
List<Map<String, Object>> getAllEquipAlarmInfoAnalysisByArea(@Param("areaCode") String areaCode);
List<Map<String, Object>> getSubSystemInfo(@Param("equipmentName") String equipmentName, @Param("gatewayId") String gatewayId);
List<Map<String, Object>> getFanInfoByPage(@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getFanHealthInfoList(@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getSumSystemListByEquipment(@Param("gatewayId") String gatewayId, @Param("equipmentName") String equipmentName);
List<Map<String, Object>> getPointNameListBySumSystem(@Param("gatewayId") String gatewayId, @Param("subSystem") String subSystem);
List<Map<String, Object>> getHealthInfoBySubSystem(@Param("subSystem") String subSystem, @Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvInfoByPage(@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvHealthInfoList(@Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvSubSystemInfo(@Param("subarray") String subarray, @Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvSumSystemListByEquipment(@Param("gatewayId") String gatewayId, @Param("subarray") String subarray);
List<Map<String, Object>> getPvHealthInfoBySubSystem(@Param("equipmentName") String equipmentName, @Param("gatewayId") String gatewayId);
List<Map<String, Object>> getPvPointNameListBySumSystem(@Param("gatewayId") String gatewayId, @Param("equipmentName") String equipmentName);
} }
...@@ -22,6 +22,7 @@ public interface IdxBizFanWarningRecordMapper extends BaseMapper<IdxBizFanWarnin ...@@ -22,6 +22,7 @@ public interface IdxBizFanWarningRecordMapper extends BaseMapper<IdxBizFanWarnin
@Param("warningName") String warningName); @Param("warningName") String warningName);
Integer getEquipWarningInfoByPageCount(@Param("arae") String arae, Integer getEquipWarningInfoByPageCount(@Param("arae") String arae,
@Param("station") String station, @Param("station") String station,
@Param("stationType") String stationType); @Param("stationType") String stationType,
@Param("warningName") String warningName);
} }
...@@ -27,6 +27,7 @@ import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate; ...@@ -27,6 +27,7 @@ import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.SearchHit; import org.springframework.data.elasticsearch.core.SearchHit;
import org.springframework.data.elasticsearch.core.SearchHits; import org.springframework.data.elasticsearch.core.SearchHits;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import org.springframework.data.elasticsearch.core.query.Query;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -976,7 +977,7 @@ public class CommonServiceImpl { ...@@ -976,7 +977,7 @@ public class CommonServiceImpl {
} }
@Scheduled(cron = "0 0/10 * * * ?") @Scheduled(cron = "0 0/10 * * * ?")
private void healthWarningMinuteByFJ() { public void healthWarningMinuteByFJ() {
Date time = new Date(); Date time = new Date();
List<IdxBizFanPointProcessVariableClassificationDto> data = idxBizFanPointProcessVariableClassificationMapper.getInfluxDBData(); List<IdxBizFanPointProcessVariableClassificationDto> data = idxBizFanPointProcessVariableClassificationMapper.getInfluxDBData();
Map<String, List<IdxBizFanPointProcessVariableClassificationDto>> maps = data.stream().collect(Collectors.groupingBy(IdxBizFanPointProcessVariableClassificationDto::getGatewayId)); Map<String, List<IdxBizFanPointProcessVariableClassificationDto>> maps = data.stream().collect(Collectors.groupingBy(IdxBizFanPointProcessVariableClassificationDto::getGatewayId));
...@@ -1028,16 +1029,16 @@ public class CommonServiceImpl { ...@@ -1028,16 +1029,16 @@ public class CommonServiceImpl {
double value4 = 0.00; double value4 = 0.00;
for (IdxBizFanPointProcessVariableClassificationDto datum : data) { for (IdxBizFanPointProcessVariableClassificationDto datum : data) {
if (idxBizUhef.getProcessPoint1Id().equals(datum.getSequenceNbr())) { if (idxBizUhef.getProcessPoint1Id().equals(datum.getSequenceNbr())) {
value1 = datum.getCurrentValue(); value1 = datum.getCurrentValue() == null?0.0: datum.getCurrentValue();
} }
if (idxBizUhef.getProcessPoint2Id().equals(datum.getSequenceNbr())) { if (idxBizUhef.getProcessPoint2Id().equals(datum.getSequenceNbr())) {
value2 = datum.getCurrentValue(); value2 = datum.getCurrentValue() == null?0.0: datum.getCurrentValue();
} }
if (idxBizUhef.getProcessPoint3Id().equals(datum.getSequenceNbr())) { if (idxBizUhef.getProcessPoint3Id().equals(datum.getSequenceNbr())) {
value3 = datum.getCurrentValue(); value3 = datum.getCurrentValue() == null?0.0: datum.getCurrentValue();
} }
if (idxBizUhef.getAnalysisPointId().equals(datum.getSequenceNbr())) { if (idxBizUhef.getAnalysisPointId().equals(datum.getSequenceNbr())) {
value4 = datum.getCurrentValue(); value4 = datum.getCurrentValue() == null?0.0: datum.getCurrentValue();
} }
} }
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
...@@ -1057,8 +1058,8 @@ public class CommonServiceImpl { ...@@ -1057,8 +1058,8 @@ public class CommonServiceImpl {
String response = HttpUtil.createPost(baseUrl + jkzsjsfjurl).body(JSON.toJSONString(realParams)).execute().body(); String response = HttpUtil.createPost(baseUrl + jkzsjsfjurl).body(JSON.toJSONString(realParams)).execute().body();
JSONObject result = JSON.parseObject(response).getJSONObject("result"); JSONObject result = JSON.parseObject(response).getJSONObject("result");
if (null != result) { if (null != result) {
JSONObject jsonObject = result.getJSONObject("result1").getJSONObject("rows"); JSONObject jsonObject = result.getJSONObject("result1");
List<JSONObject> jsonObjects = JSON.parseArray(JSON.toJSONString(jsonObject), JSONObject.class); List<JSONObject> jsonObjects = JSON.parseArray(JSON.toJSONString(jsonObject.getJSONArray("rows")), JSONObject.class);
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
jsonObjects.stream().forEach(e -> ids.add(e.getString("analysisVariableId"))); jsonObjects.stream().forEach(e -> ids.add(e.getString("analysisVariableId")));
...@@ -1070,7 +1071,7 @@ public class CommonServiceImpl { ...@@ -1070,7 +1071,7 @@ public class CommonServiceImpl {
for (JSONObject object : jsonObjects) { for (JSONObject object : jsonObjects) {
if (obj.getSequenceNbr().equals(object.getString("analysisVariableId"))) { if (obj.getSequenceNbr().equals(object.getString("analysisVariableId"))) {
IdxBizFanHealthIndex idxBizFanHealthIndex = new IdxBizFanHealthIndex(); IdxBizFanHealthIndex idxBizFanHealthIndex = new IdxBizFanHealthIndex();
BeanUtils.copyProperties(idxBizFanHealthIndex, obj); BeanUtils.copyProperties(obj,idxBizFanHealthIndex );
idxBizFanHealthIndex.setHealthIndex(object.getDouble("indexValue")); idxBizFanHealthIndex.setHealthIndex(object.getDouble("indexValue"));
idxBizFanHealthIndex.setAnalysisObjSeq(obj.getSequenceNbr()); idxBizFanHealthIndex.setAnalysisObjSeq(obj.getSequenceNbr());
idxBizFanHealthIndex.setRecDate(time); idxBizFanHealthIndex.setRecDate(time);
...@@ -1102,7 +1103,7 @@ public class CommonServiceImpl { ...@@ -1102,7 +1103,7 @@ public class CommonServiceImpl {
} }
} }
// @Scheduled(cron = "0 */3 * * * ?") @Scheduled(cron = "0 0/10 * * * ?")
private void healthWarningMinuteByGF() { private void healthWarningMinuteByGF() {
Date time = new Date(); Date time = new Date();
List<IdxBizPvPointProcessVariableClassificationDto> data = idxBizPvPointProcessVariableClassificationMapper.getInfluxDBData(); List<IdxBizPvPointProcessVariableClassificationDto> data = idxBizPvPointProcessVariableClassificationMapper.getInfluxDBData();
...@@ -1183,8 +1184,8 @@ public class CommonServiceImpl { ...@@ -1183,8 +1184,8 @@ public class CommonServiceImpl {
String response = HttpUtil.createPost(baseUrl + jkzsgfurl).body(JSON.toJSONString(realParams)).execute().body(); String response = HttpUtil.createPost(baseUrl + jkzsgfurl).body(JSON.toJSONString(realParams)).execute().body();
JSONObject result = JSON.parseObject(response).getJSONObject("result"); JSONObject result = JSON.parseObject(response).getJSONObject("result");
if (null != result) { if (null != result) {
JSONObject jsonObject = result.getJSONObject("result1").getJSONObject("rows"); JSONObject jsonObject = result.getJSONObject("result1");
List<JSONObject> jsonObjects = JSON.parseArray(JSON.toJSONString(jsonObject), JSONObject.class); List<JSONObject> jsonObjects = JSON.parseArray(JSON.toJSONString(jsonObject.getJSONArray("rows")), JSONObject.class);
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
jsonObjects.stream().forEach(e -> ids.add(e.getString("analysisVariableId"))); jsonObjects.stream().forEach(e -> ids.add(e.getString("analysisVariableId")));
...@@ -1196,7 +1197,7 @@ public class CommonServiceImpl { ...@@ -1196,7 +1197,7 @@ public class CommonServiceImpl {
for (JSONObject object : jsonObjects) { for (JSONObject object : jsonObjects) {
if (obj.getSequenceNbr().equals(object.getString("analysisVariableId"))) { if (obj.getSequenceNbr().equals(object.getString("analysisVariableId"))) {
IdxBizPvHealthIndex idxBizFanHealthIndex = new IdxBizPvHealthIndex(); IdxBizPvHealthIndex idxBizFanHealthIndex = new IdxBizPvHealthIndex();
BeanUtils.copyProperties(idxBizFanHealthIndex, obj); BeanUtils.copyProperties(obj,idxBizFanHealthIndex );
idxBizFanHealthIndex.setHealthIndex(object.getDouble("indexValue")); idxBizFanHealthIndex.setHealthIndex(object.getDouble("indexValue"));
idxBizFanHealthIndex.setAnalysisObjSeq(obj.getSequenceNbr()); idxBizFanHealthIndex.setAnalysisObjSeq(obj.getSequenceNbr());
idxBizFanHealthIndex.setRecDate(time); idxBizFanHealthIndex.setRecDate(time);
...@@ -1225,4 +1226,41 @@ public class CommonServiceImpl { ...@@ -1225,4 +1226,41 @@ public class CommonServiceImpl {
} }
} }
} }
/**
* 根据查询条件获取列表信息
*
* @param mustQuerCondtion
* @param shouldQuerCondtion
* @param tClass
* @param <T>
* @return
*/
public <T> List<T> getListDataByCondtions(Map<String, List<String>> mustQuerCondtion, Map<String, String> shouldQuerCondtion, Class<T> tClass) {
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
if (!ObjectUtils.isEmpty(mustQuerCondtion)) {
for (String key : mustQuerCondtion.keySet()) {
List<String> va = mustQuerCondtion.get(key);
queryBuilder.must(QueryBuilders.termsQuery(key, va));
}
}
if (!ObjectUtils.isEmpty(shouldQuerCondtion)) {
for (String key : shouldQuerCondtion.keySet()) {
queryBuilder.should(QueryBuilders.wildcardQuery(key, shouldQuerCondtion.get(key)));
}
}
Query query = new NativeSearchQueryBuilder()
.withQuery(queryBuilder)
.build();
query.setTrackTotalHits(true);
SearchHits search = elasticsearchTemplate.search(query, tClass);
if (search.hasSearchHits()) {
List<SearchHit<T>> searchHitList = search.getSearchHits();
List<T> list = searchHitList.stream().map(hit -> hit.getContent()).collect(Collectors.toList());
return list;
}
return null;
}
} }
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
AND AND
DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" ) DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode} AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode} AND STATION = #{stationCode}
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" ) AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode} AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode} AND STATION = #{stationCode}
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<where> <where>
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode} AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode} AND STATION = #{stationCode}
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
<where> <where>
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode} AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode} AND STATION = #{stationCode}
...@@ -185,11 +185,12 @@ ...@@ -185,11 +185,12 @@
FROM FROM
idx_biz_fan_health_index idx_biz_fan_health_index
<where> <where>
( STATION IS NOT NULL OR STATION != '' ) STATION IS NOT NULL
AND ANALYSIS_TYPE = '按天' AND STATION != ''
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" ) AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode} AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
GROUP BY GROUP BY
...@@ -197,15 +198,16 @@ ...@@ -197,15 +198,16 @@
( (
SELECT SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex, IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
ARAE STATION
FROM FROM
idx_biz_pv_health_index idx_biz_pv_health_index
<where> <where>
( STATION IS NOT NULL OR STATION != '' ) STATION IS NOT NULL
AND ANALYSIS_TYPE = '按天' AND STATION != ''
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" ) AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode} AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
GROUP BY GROUP BY
...@@ -245,4 +247,299 @@ ...@@ -245,4 +247,299 @@
GROUP BY GROUP BY
a.warningName a.warningName
</select> </select>
<select id="getAllEquipAlarmInfoAnalysisByStationType" resultType="java.util.Map">
SELECT
( SELECT POINT_NAME FROM ${tableName2} WHERE GATEWAY_ID = a.GATEWAY_ID AND INDEX_ADDRESS = a.INDEX_ADDRESS ) AS pointName,
a.WARNING_NAME as warningName,
count(1) as num
FROM
${tableName} a
<where>
<if test="areaCode != null and areaCode != ''">
a.ARAE like concat('%', #{areaCode}, '%')
</if>
</where>
group by pointName,
a.WARNING_NAME
having pointName IS NOT NULL
AND pointName != ''
</select>
<select id="getAllEquipAlarmInfoAnalysisByArea" resultType="java.util.Map">
SELECT
a.*
FROM
(
SELECT
( SELECT POINT_NAME FROM idx_biz_pv_point_process_variable_classification WHERE GATEWAY_ID = idx_biz_pv_warning_record.GATEWAY_ID AND INDEX_ADDRESS = idx_biz_pv_warning_record.INDEX_ADDRESS ) AS pointName,
WARNING_NAME AS warningName,
count( 1 ) AS num
FROM
idx_biz_pv_warning_record
<where>
<if test="areaCode != null and areaCode != ''">
ARAE like concat('%', #{areaCode}, '%')
</if>
</where>
GROUP BY
pointName,
WARNING_NAME UNION ALL
SELECT
( SELECT POINT_NAME FROM idx_biz_fan_point_process_variable_classification WHERE GATEWAY_ID = idx_biz_fan_warning_record.GATEWAY_ID AND INDEX_ADDRESS = idx_biz_fan_warning_record.INDEX_ADDRESS ) AS pointName,
WARNING_NAME AS warningName,
count( 1 ) AS num
FROM
idx_biz_fan_warning_record
<where>
<if test="areaCode != null and areaCode != ''">
ARAE like concat('%', #{areaCode}, '%')
</if>
</where>
GROUP BY
pointName,
WARNING_NAME
) a
WHERE
a.pointName IS NOT NULL
AND a.pointName != ''
</select>
<select id="getSubSystemInfo" resultType="java.util.Map">
SELECT
IFNULL( HEALTH_INDEX, 0 ) AS healthIndex,
SUB_SYSTEM AS subSystem
FROM
idx_biz_fan_health_index
<where>
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="equipmentName != null and equipmentName != ''">
AND EQUIPMENT_NAME = #{equipmentName}
</if>
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
</select>
<select id="getFanInfoByPage" resultType="java.util.Map">
SELECT
EQUIPMENT_NAME as equipmentName
FROM
idx_biz_fan_point_process_variable_classification
<where>
EQUIPMENT_NAME LIKE '%#%'
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
EQUIPMENT_NAME
ORDER BY
RIGHT(EQUIPMENT_NAME, 6) ASC
</select>
<select id="getFanHealthInfoList" resultType="java.util.Map">
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
EQUIPMENT_NAME as equipmentName
FROM
idx_biz_fan_health_index
<where>
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
EQUIPMENT_NAME
</select>
<select id="getSumSystemListByEquipment" resultType="java.util.Map">
SELECT
SUB_SYSTEM as subSystem
FROM
idx_biz_fan_point_process_variable_classification
<where>
EQUIPMENT_NAME = #{equipmentName}
AND GATEWAY_ID = #{gatewayId}
</where>
GROUP BY
SUB_SYSTEM
</select>
<select id="getPointNameListBySumSystem" resultType="java.util.Map">
SELECT
POINT_NAME as pointName
FROM
idx_biz_fan_point_process_variable_classification
<where>
SUB_SYSTEM = #{subSystem}
AND GATEWAY_ID = #{gatewayId}
</where>
GROUP BY
POINT_NAME
</select>
<select id="getHealthInfoBySubSystem" resultType="java.util.Map">
SELECT
IFNULL( avg( HEALTH_INDEX ), 0 ) AS healthIndex,
POINT_NAME AS pointName
FROM
idx_biz_fan_health_index
<where>
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
AND POINT_NAME IS NOT NULL
AND POINT_NAME != ''
<if test="subSystem != null and subSystem != ''">
AND SUB_SYSTEM = #{subSystem}
</if>
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
POINT_NAME
</select>
<select id="getPvInfoByPage" resultType="java.util.Map">
SELECT
SUBARRAY as subarray
FROM
idx_biz_pv_point_process_variable_classification
<where>
<if test="gatewayId != null and gatewayId != ''">
GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
SUBARRAY
</select>
<select id="getPvHealthInfoList" resultType="java.util.Map">
SELECT
IFNULL( round(AVG( HEALTH_INDEX ), 2), 0 ) AS avgHealthIndex,
SUBARRAY as subarray
FROM
idx_biz_pv_health_index
<where>
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY SUBARRAY
order by SUBARRAY
</select>
<select id="getPvSubSystemInfo" resultType="java.util.Map">
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
EQUIPMENT_NAME AS equipmentName
FROM
idx_biz_pv_health_index
<where>
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="subarray != null and subarray != ''">
AND SUBARRAY = #{subarray}
</if>
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
group by EQUIPMENT_NAME
</select>
<select id="getPvSumSystemListByEquipment" resultType="java.util.Map">
SELECT
EQUIPMENT_NAME as equipmentName
FROM
idx_biz_pv_point_process_variable_classification
<where>
SUBARRAY = #{subarray}
AND GATEWAY_ID = #{gatewayId}
</where>
GROUP BY
EQUIPMENT_NAME
</select>
<select id="getPvHealthInfoBySubSystem" resultType="java.util.Map">
SELECT
IFNULL( ROUND(avg( HEALTH_INDEX ), 2), 0 ) AS healthIndex,
POINT_NAME AS pointName
FROM
idx_biz_pv_health_index
<where>
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
AND POINT_NAME IS NOT NULL
AND POINT_NAME != ''
<if test="equipmentName != null and equipmentName != ''">
AND EQUIPMENT_NAME = #{equipmentName}
</if>
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
POINT_NAME
</select>
<select id="getPvPointNameListBySumSystem" resultType="java.util.Map">
SELECT
POINT_NAME as pointName
FROM
idx_biz_pv_point_process_variable_classification
<where>
EQUIPMENT_NAME = #{equipmentName}
AND GATEWAY_ID = #{gatewayId}
</where>
GROUP BY
POINT_NAME
</select>
</mapper> </mapper>
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
) a ) a
<where> <where>
<if test="arae != '' and arae != null"> <if test="arae != '' and arae != null">
AND a.arae = #{arae} AND a.arae like concat('%', #{areaCode}, '%')
</if> </if>
<if test="station != '' and station != null"> <if test="station != '' and station != null">
AND a.station = #{station} AND a.station = #{station}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment