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,16 +33,11 @@ public class JpInverter implements Serializable { ...@@ -34,16 +33,11 @@ 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;
/** /**
* 状态 * 状态
*/ */
...@@ -165,6 +159,11 @@ public class JpInverter implements Serializable { ...@@ -165,6 +159,11 @@ public class JpInverter implements Serializable {
private String thirdStationId; private String thirdStationId;
/** /**
* 第三方电站id
*/
@TableField("third_code")
private String thirdCode;
/**
* 装机容量 * 装机容量
*/ */
@TableField("capacity") @TableField("capacity")
...@@ -176,22 +175,4 @@ public class JpInverter implements Serializable { ...@@ -176,22 +175,4 @@ public class JpInverter implements Serializable {
@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();
} }
...@@ -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,12 +14,11 @@ import java.util.Date; ...@@ -14,12 +14,11 @@ 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编码") @ApiModelProperty(value = "sn编码")
private String snCode; private String snCode;
...@@ -38,4 +37,6 @@ public class JpCollectorHistoryYearDto { ...@@ -38,4 +37,6 @@ public class JpCollectorHistoryYearDto {
@ApiModelProperty(value = "年") @ApiModelProperty(value = "年")
private String year; private String year;
private long createdTime;
} }
...@@ -52,4 +52,6 @@ public class JpInvertorElecHistoryAllDto { ...@@ -52,4 +52,6 @@ public class JpInvertorElecHistoryAllDto {
@ApiModelProperty(value = "年") @ApiModelProperty(value = "年")
private String year; private String year;
private Long createdTime;
} }
...@@ -56,4 +56,5 @@ public class JpInvertorElecHistoryMonthDto { ...@@ -56,4 +56,5 @@ public class JpInvertorElecHistoryMonthDto {
@ApiModelProperty(value = "年月") @ApiModelProperty(value = "年月")
private String yearMonth; private String yearMonth;
private Long createdTime;
} }
...@@ -15,12 +15,11 @@ import java.util.Date; ...@@ -15,12 +15,11 @@ 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编码") @ApiModelProperty(value = "sn编码")
private String snCode; private String snCode;
...@@ -48,10 +47,12 @@ public class JpInvertorElecHistoryYearDto { ...@@ -48,10 +47,12 @@ public class JpInvertorElecHistoryYearDto {
@ApiModelProperty(value = "第三方厂商标识") @ApiModelProperty(value = "第三方厂商标识")
private String thirdCode; private String thirdCode;
@ApiModelProperty(value = "日期") @ApiModelProperty(value = "月")
private String day; private String month;
@ApiModelProperty(value = "年")
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;
} }
...@@ -51,4 +51,6 @@ public class TdHygfJpInvertorElecHistoryDto { ...@@ -51,4 +51,6 @@ 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}
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
<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>
...@@ -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;
/** /**
* 户用光伏监盘逆变器历史表 * 户用光伏监盘逆变器历史表
...@@ -53,7 +64,8 @@ public class TdHygfJpInverterHistoryController extends BaseController { ...@@ -53,7 +64,8 @@ public class TdHygfJpInverterHistoryController extends BaseController {
@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(
@RequestBody TdHygfJpInverterHistoryDto model, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(tdHygfJpInverterHistoryServiceImpl.updateWithModel(model)); return ResponseHelper.buildResponse(tdHygfJpInverterHistoryServiceImpl.updateWithModel(model));
} }
...@@ -66,7 +78,8 @@ public class TdHygfJpInverterHistoryController extends BaseController { ...@@ -66,7 +78,8 @@ public class TdHygfJpInverterHistoryController extends BaseController {
@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,
@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(tdHygfJpInverterHistoryServiceImpl.removeById(sequenceNbr)); return ResponseHelper.buildResponse(tdHygfJpInverterHistoryServiceImpl.removeById(sequenceNbr));
} }
...@@ -78,7 +91,7 @@ public class TdHygfJpInverterHistoryController extends BaseController { ...@@ -78,7 +91,7 @@ public class TdHygfJpInverterHistoryController extends BaseController {
*/ */
@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));
} }
...@@ -92,13 +105,14 @@ public class TdHygfJpInverterHistoryController extends BaseController { ...@@ -92,13 +105,14 @@ public class TdHygfJpInverterHistoryController extends BaseController {
*/ */
@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));
} }
/** /**
...@@ -107,9 +121,23 @@ public class TdHygfJpInverterHistoryController extends BaseController { ...@@ -107,9 +121,23 @@ public class TdHygfJpInverterHistoryController extends BaseController {
* @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));
}
} }
...@@ -109,6 +109,19 @@ public class TdHygfJpInverterWarnController extends BaseController { ...@@ -109,6 +109,19 @@ public class TdHygfJpInverterWarnController extends BaseController {
} }
/** /**
* 根据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));
}
/**
* 列表分页查询 * 列表分页查询
* *
* @param current 当前页 * @param current 当前页
......
...@@ -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,7 +21,9 @@ import java.util.List; ...@@ -16,7 +21,9 @@ 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 {
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -27,7 +34,10 @@ public class JpInverterElectricityServiceImpl extends BaseService<JpInverterElec ...@@ -27,7 +34,10 @@ public class JpInverterElectricityServiceImpl extends BaseService<JpInverterElec
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
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,7 +24,13 @@ import java.util.List; ...@@ -16,7 +24,13 @@ 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 {
@Autowired
private JpInverterServiceImpl jpInverterServiceImpl;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -28,6 +42,35 @@ public class TdHygfJpInverterHistoryServiceImpl extends BaseService<TdHygfJpInve ...@@ -28,6 +42,35 @@ public class TdHygfJpInverterHistoryServiceImpl extends BaseService<TdHygfJpInve
* 列表查询 示例 * 列表查询 示例
*/ */
public List<TdHygfJpInverterHistoryDto> queryForTdHygfJpInverterHistoryList() { public List<TdHygfJpInverterHistoryDto> queryForTdHygfJpInverterHistoryList() {
return this.queryForList("" , false); 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) {
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)) ; return ResponseHelper.buildResponse(commonServiceImpl.getInfluxdbDataByConditon(stationType,pointId,startTime, endTime)) ;
} }
} }
...@@ -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;
}
} }
...@@ -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