Commit 8df1dbcb authored by chenzhao's avatar chenzhao

Merge remote-tracking branch 'origin/developer' into developer

parents 137fff5f 48541dab
...@@ -14,16 +14,17 @@ import org.springframework.util.ObjectUtils; ...@@ -14,16 +14,17 @@ import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.cache.Redis; import org.typroject.tyboot.component.cache.Redis;
import java.util.*; import java.util.*;
@Component @Component
public class GolangRequestUtil { public class GolangRequestUtil {
private final static String API_REDIS_PREFIX = "HOUSEHOLD_API_CACHE_";
@Autowired @Autowired
private HouseholdPvProducerInfoServiceImpl householdPvProducerInfoServiceImpl; private HouseholdPvProducerInfoServiceImpl householdPvProducerInfoServiceImpl;
@Autowired @Autowired
private GolangStationMapper golangStationMapper; private GolangStationMapper golangStationMapper;
/** /**
* @return HashMap<String, Object> 发送请求前的准备 准备header信息 * @return HashMap<String, Object> 发送请求前的准备 准备header信息
* @deprecated 根据厂商编码获取厂商的hearer * @deprecated 根据厂商编码获取厂商的hearer
...@@ -43,22 +44,36 @@ public class GolangRequestUtil { ...@@ -43,22 +44,36 @@ public class GolangRequestUtil {
} }
/** /**
* @return String 请求返回的response字符串 * @param apiurl 请求url
* @param requestMethod 请求方式
* @param requestParmInfo 请求参数mapper
* @param ResultResolveRule 请求的解析
* @param tClass 需要转换成的bean
* @param <T> 泛型数据
* @return List<T> list<Result>
* @desc 根据请求参数发送http请求并且对于返回的数据进行处理
*/ */
public <T> List<T> getResPonse(String apiurl,String requestMethod,String requestParmInfo,String ResultResolveRule,Class <T> tClass) { public <T> List<T> getResPonse(String apiurl, String requestMethod, String requestParmInfo, String ResultResolveRule, Class<T> tClass) {
String respone = ""; String respone = "";
String params = ""; String params = "";
JSONArray jsonArray = null; JSONArray jsonArray = null;
List<T> result = new ArrayList<>();
try {
HashMap<String, Object> producerInfo = getHeaderOfGolang(); HashMap<String, Object> producerInfo = getHeaderOfGolang();
String baseurl = (String) producerInfo.get("apiurl"); String baseurl = (String) producerInfo.get("apiurl");
HashMap<String, String> headMap = (HashMap<String, String>) producerInfo.get("header"); HashMap<String, String> headMap = (HashMap<String, String>) producerInfo.get("header");
String orginalAuthorization = headMap.get("Authorization") + ":"; String orginalAuthorization = headMap.get("Authorization") + ":";
String url = baseurl + apiurl; String url = baseurl + apiurl;
String appsecret = (String) producerInfo.get("appsecret"); String appsecret = (String) producerInfo.get("appsecret");
JLYHeaderMapHandler(params, headMap, orginalAuthorization, appsecret,apiurl); JLYHeaderMapHandler(params, headMap, orginalAuthorization, appsecret, apiurl);
respone = sendRequest(requestMethod, url,requestParmInfo, headMap); respone = sendRequest(requestMethod, url, requestParmInfo, headMap);
jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone); jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone);
List<T> result = JSONArray.parseArray(jsonArray.toJSONString(),tClass); if (!ObjectUtils.isEmpty(jsonArray)) {
result = JSONArray.parseArray(jsonArray.toJSONString(), tClass);
}
} catch (Exception exception) {
return result;
}
return result; return result;
} }
...@@ -66,6 +81,7 @@ public class GolangRequestUtil { ...@@ -66,6 +81,7 @@ public class GolangRequestUtil {
* @param resultResovle 请求返回的解析规则 来源与数据库 * @param resultResovle 请求返回的解析规则 来源与数据库
* @param response 请求返回的字符串 * @param response 请求返回的字符串
* @return 解析后的数据 * @return 解析后的数据
* @desc 根据解析规则解析请求返回数据
*/ */
public JSONArray handlerResponseByResultResolverule(String resultResovle, String response) { public JSONArray handlerResponseByResultResolverule(String resultResovle, String response) {
JSONObject jsonObject = JSONObject.parseObject(response); JSONObject jsonObject = JSONObject.parseObject(response);
...@@ -91,57 +107,6 @@ public class GolangRequestUtil { ...@@ -91,57 +107,6 @@ public class GolangRequestUtil {
return jsonArray; return jsonArray;
} }
/**
* @param seq apiID
* @param cacheField 要缓存的字段
* @param jsonArray 处理后的数据请求
* @param measurement 要在influxdb中存储的数
* @describe 该方法用于缓存需要缓存的字段 且将需要入库的数据进行入库
*/
public void handleResponseAndCacheData(String seq, String cacheField, JSONArray jsonArray, String measurement, String produceID) {
String apiID = API_REDIS_PREFIX + seq;
List list = new ArrayList();
List saveList = new ArrayList();
if (jsonArray.size() > 0) {
for (Object o : jsonArray) {
List<Map<String, Object>> lines = new ArrayList<>();
Map<String, Object> maps1 = (Map<String, Object>) o;
LinkedHashMap<String, Object> sortHashMap = new LinkedHashMap<>();
sortHashMap.put("station_list", "station_list." + measurement);
sortHashMap.put("timestamp", System.currentTimeMillis());
sortHashMap.put("value", 10.1);
Set<String> keys = maps1.keySet();
keys.forEach((key) -> {
maps1.put(key, ObjectUtils.isEmpty(maps1.get(key)) ? "null" : maps1.get(key).toString());
});
if (!ObjectUtils.isEmpty("cacheField")) {
list.add(maps1.get(cacheField));
}
sortHashMap.put("tags", maps1);
lines.add(sortHashMap);
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
if (!ObjectUtils.isEmpty(measurement)) {
// influxDbConnection.insert(measurement, maps2, maps1);
// log.error(JSONObject.toJSONString(lines));
// tdEngineUtils.writeDataIntoTdEngine(JSONObject.toJSONString(lines));
}
}
}
// tdEngineUtils.writeDataIntoTdEngine(lines.stream().map(s -> String.valueOf(s)).toArray(String[]::new));
if (!ObjectUtils.isEmpty(cacheField)) {
saveList = Redis.getRedisTemplate().opsForList().range(apiID, 0, -1);
if (saveList.size() == 0) {
Redis.getRedisTemplate().opsForList().leftPushAll(apiID, list);
}
saveList = Redis.getRedisTemplate().opsForList().range(apiID, 0, -1);
if (saveList.size() != list.size()) {
Redis.getRedisTemplate().delete(apiID);
Redis.getRedisTemplate().opsForList().leftPushAll(apiID, list);
}
}
}
public String sendRequest(String requestMethod, String url, String params, HashMap<String, String> headMap) { public String sendRequest(String requestMethod, String url, String params, HashMap<String, String> headMap) {
String respone = ""; String respone = "";
if (requestMethod.equals("POST")) { if (requestMethod.equals("POST")) {
...@@ -177,6 +142,12 @@ public class GolangRequestUtil { ...@@ -177,6 +142,12 @@ public class GolangRequestUtil {
headMap.put("Authorization", orginalAuthorization + sign); headMap.put("Authorization", orginalAuthorization + sign);
} }
/**
* @param pageSizeResovle
* @param response
* @return
* @desc 根据分页规则 获取分页数
*/
public Integer getPagesize(String pageSizeResovle, String response) { public Integer getPagesize(String pageSizeResovle, String response) {
Integer pageSize = 0; Integer pageSize = 0;
String[] rules = pageSizeResovle.split(","); String[] rules = pageSizeResovle.split(",");
......
...@@ -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,13 @@ public class GoLangConstant { ...@@ -32,7 +49,13 @@ 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);
public static Double kwhToMwh = 0.0001;
public static Double mwhTokwh = 1000.0;
} }
...@@ -56,7 +56,11 @@ public class HouseholdTestController { ...@@ -56,7 +56,11 @@ public class HouseholdTestController {
@ApiOperation(httpMethod = "POST", value = "锦浪云", notes = "锦浪云") @ApiOperation(httpMethod = "POST", value = "锦浪云", notes = "锦浪云")
public void golangnew() throws IOException { public void golangnew() throws IOException {
// goLangDataAcquisitionService.stationList(); // goLangDataAcquisitionService.stationList();
goLangDataAcquisitionService.stationDetail();
// 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;
private String addr;
private String stationName;
}
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;
...@@ -116,5 +115,16 @@ public class JpCollector implements Serializable { ...@@ -116,5 +115,16 @@ public class JpCollector implements Serializable {
*/ */
@TableField("third_code") @TableField("third_code")
private String thirdCode; private String thirdCode;
/**
* 场站名称
*/
@TableField("station_name")
private String stationName;
/**
* 场站地址
*/
@TableField("addr")
private String addr;
} }
...@@ -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")
...@@ -175,23 +174,15 @@ public class JpInverter implements Serializable { ...@@ -175,23 +174,15 @@ 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") @TableField("station_name")
private Double monthPowerUse; private String stationName;
/** /**
* 年用电量 * 场站地址
*/ */
@TableField("year_power_use") @TableField("addr")
private Double yearPowerUse; private String addr;
} }
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;
} }
...@@ -215,5 +215,8 @@ public class JpStation implements Serializable { ...@@ -215,5 +215,8 @@ public class JpStation implements Serializable {
private Double monthPowerPse; // 月用电量 private Double monthPowerPse; // 月用电量
@TableField("year_power_use") @TableField("year_power_use")
private Double yearPowerUse; // 年用电量 private Double yearPowerUse; // 年用电量
@TableField("email")
private String email; // 电子邮箱
@TableField("rated_power")
private Double ratedPower; // 额定功率
} }
...@@ -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;
import java.io.Serializable;
@Data
@TableName(value = "td_hygf_day_power",autoResultMap = true)
public class HYGFJPDayPower implements Serializable {
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),"));
}
}
...@@ -7,6 +7,6 @@ import org.apache.ibatis.annotations.Select; ...@@ -7,6 +7,6 @@ import org.apache.ibatis.annotations.Select;
import java.util.List; import java.util.List;
public interface GolangCollectorListMapper extends BaseMapper<GolangCollectorList> { public interface GolangCollectorListMapper extends BaseMapper<GolangCollectorList> {
@Select("select id from golang_collector_list group by id") @Select("select id from golang_collector_list where sn is not null group by id")
List<Long> getCollectIds(); List<Long> getCollectIds();
} }
...@@ -7,6 +7,6 @@ import org.apache.ibatis.annotations.Select; ...@@ -7,6 +7,6 @@ import org.apache.ibatis.annotations.Select;
import java.util.List; 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 sn from golang_inveter_list where sn is not null group by sn")
List<Long> getInverterIds(); 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 {
}
package com.yeejoin.amos.api.householdapi.face.service; package com.yeejoin.amos.api.householdapi.face.service;
public interface GoLangDataAcquisitionService { public interface GoLangDataAcquisitionService {
/**
* @descrption 场站列表数据入库
*/
void stationList(); void stationList();
/**
* @descrption 场站详情数据入库
*/
void stationDetail(); void stationDetail();
/**
* @descrption 采集器列表数据入库
*/
void collectorList(); void collectorList();
/**
* @descrption 采集器详情数据入库
*/
void collectorDetail(); void collectorDetail();
/**
* @descrption 逆变器列表数据入库
*/
void inverterList(); void inverterList();
/**
* @descrption 逆变器详情数据入库
*/
void inverterDetail(); void inverterDetail();
/**
* @descrption 采集器告警列表数据入库
*/
void inverAlramInfo();
} }
package com.yeejoin.amos.api.householdapi.face.service.impl; package com.yeejoin.amos.api.householdapi.face.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.core.JsonParser;
import com.yeejoin.amos.api.householdapi.Utils.GolangRequestUtil; import com.yeejoin.amos.api.householdapi.Utils.GolangRequestUtil;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant; import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
import com.yeejoin.amos.api.householdapi.face.dto.AlarmDto;
import com.yeejoin.amos.api.householdapi.face.dto.CollectorDetailDto;
import com.yeejoin.amos.api.householdapi.face.dto.InverterDetailDto;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpCollector;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverter;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverterElectricity;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation; import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.*; import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.*;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpCollectorMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpInverterElectricityMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpInverterMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.*; import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.*;
import com.yeejoin.amos.api.householdapi.face.service.GoLangDataAcquisitionService; import com.yeejoin.amos.api.householdapi.face.service.GoLangDataAcquisitionService;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper; import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum; import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import fastjson.JSON; import fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@Async
@Service @Service
public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionService { public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionService {
//定时任务执行频率 当前为10分钟一次
private final String dataRequstScheduled = "0 0/10 * * * *";
//锦浪云请求工具封装
@Autowired @Autowired
private GolangRequestUtil golangRequestUtil; private GolangRequestUtil golangRequestUtil;
//锦浪云场站mapper
@Autowired @Autowired
private GolangStationMapper golangStationMapper; private GolangStationMapper golangStationMapper;
//监盘场站mapper
@Autowired @Autowired
private JpStationMapper jpStationMapper; private JpStationMapper jpStationMapper;
//监盘采集器mapper
@Autowired
private JpCollectorMapper jpCollectorMapper;
//监盘逆变器mapper
@Autowired
private JpInverterMapper jpInverterMapper;
//监盘逆变器电量mapper
@Autowired
private JpInverterElectricityMapper jpInverterElectricityMapper;
//锦浪云场站详情mapper
@Autowired @Autowired
private GolangStationDetailMapper golangStationDetailMapper; private GolangStationDetailMapper golangStationDetailMapper;
//锦浪云采集器列表mapper
@Autowired @Autowired
private GolangCollectorListMapper golangCollectorListMapper; private GolangCollectorListMapper golangCollectorListMapper;
//锦浪云逆变器列表
@Autowired @Autowired
private GolangInverterListMapper golangInverterListMapper; private GolangInverterListMapper golangInverterListMapper;
//户用光伏 场站历史 //户用光伏场站历史mapper
@Autowired @Autowired
private HYGFJPStationPowerHistoryMapper hygfjpStationPowerHistoryMapper; private HYGFJPStationPowerHistoryMapper hygfjpStationPowerHistoryMapper;
// //户用光伏逆变器历史mapper
@Autowired @Autowired
private HYGFJPInverterHistoryMapper hygfjpInverterHistoryMapper; private HYGFJPInverterHistoryMapper hygfjpInverterHistoryMapper;
//户用光伏采集器历史mapper
@Autowired @Autowired
private HYGFJPCollectorHistoryMapper hygfjpCollectorHistoryMapper; private HYGFJPCollectorHistoryMapper hygfjpCollectorHistoryMapper;
//户用光伏逆变器告警
@Autowired @Autowired
private HYGFJPInverterWarnMapper hygfjpInverterWarnMapper; private HYGFJPInverterWarnMapper hygfjpInverterWarnMapper;
//户用光伏逆变器历史mapper
@Autowired @Autowired
private HYGFJPInverterElecHistoryMapper hygfjpInverterElecHistoryMapper; private HYGFJPInverterElecHistoryMapper hygfjpInverterElecHistoryMapper;
//户用光伏日发电量
@Autowired
private HYGFJPDayPowerMapper hygfjpDayPowerMapper;
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void stationList() { public void stationList() {
HashMap<String, Object> requestInfo = new HashMap<>(); HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("pageNo", 1); requestInfo.put("pageNo", 1);
requestInfo.put("pageSize", 100); requestInfo.put("pageSize", 100);
...@@ -63,14 +103,17 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -63,14 +103,17 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
); );
for (int i = 0; i < result.size(); i++) { for (int i = 0; i < result.size(); i++) {
GolangStationList golangStationList = result.get(i); GolangStationList golangStationList = result.get(i);
golangStationList.setCreatedTime(new Date()); golangStationList.setCreatedTime(System.currentTimeMillis());
golangStationMapper.insert(golangStationList); golangStationMapper.insert(golangStationList);
} }
} }
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void stationDetail() { public void stationDetail() {
List<String> stationIds = golangStationMapper.getStationIds(); List<String> stationIds = golangStationMapper.getStationIds();
String today = DateUtil.today();
String hour = new Date().getHours() + ":00";
for (int i = 0; i < stationIds.size(); i++) { for (int i = 0; i < stationIds.size(); i++) {
try { try {
TimeUnit.SECONDS.sleep(1); TimeUnit.SECONDS.sleep(1);
...@@ -88,8 +131,10 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -88,8 +131,10 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
); );
for (int j = 0; j < result.size(); j++) { for (int j = 0; j < result.size(); j++) {
GolangStationDetail golangStationDetail = result.get(j); GolangStationDetail golangStationDetail = result.get(j);
golangStationDetail.setCreatedTime(new Date()); golangStationDetail.setCreatedTime(System.currentTimeMillis());
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().eq("third_code", PVProducerInfoEnum.JLY.getCode()).eq("third_station_id", stationIds.get(i))); JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_code", PVProducerInfoEnum.JLY.getCode()).
eq("third_station_id", stationIds.get(i)));
//给户用光伏存储的数据赋值 //给户用光伏存储的数据赋值
if (ObjectUtils.isEmpty(jpStation)) { if (ObjectUtils.isEmpty(jpStation)) {
jpStation = new JpStation(); jpStation = new JpStation();
...@@ -103,8 +148,8 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -103,8 +148,8 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpStation.setLatitude(golangStationDetail.getLatitude()); jpStation.setLatitude(golangStationDetail.getLatitude());
jpStation.setUserName(golangStationDetail.getUsername()); jpStation.setUserName(golangStationDetail.getUsername());
jpStation.setUserPhone(String.valueOf(golangStationDetail.getUsermobile())); jpStation.setUserPhone(String.valueOf(golangStationDetail.getUsermobile()));
jpStation.setStationContact(String.valueOf(golangStationDetail.getMobile())); jpStation.setStationContact(String.valueOf(golangStationDetail.getMobile()).toLowerCase().replace("null", ""));
jpStation.setModuleCount(Math.toIntExact(golangStationDetail.getModule())); jpStation.setModuleCount(ObjectUtils.isEmpty(Math.toIntExact(golangStationDetail.getModule()))?0:Math.toIntExact(golangStationDetail.getModule()));
//并网类型 //并网类型
jpStation.setOnGridType(GoLangConstant.stationStaus.get(String.valueOf(golangStationDetail.getState()))); jpStation.setOnGridType(GoLangConstant.stationStaus.get(String.valueOf(golangStationDetail.getState())));
jpStation.setThirdStationId(String.valueOf(golangStationDetail.getId())); jpStation.setThirdStationId(String.valueOf(golangStationDetail.getId()));
...@@ -112,30 +157,56 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -112,30 +157,56 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpStation.setRealTimePower(golangStationDetail.getPower()); jpStation.setRealTimePower(golangStationDetail.getPower());
jpStation.setState(GoLangConstant.intoNetWorkStatus.get(String.valueOf(golangStationDetail.getStationtypenew()))); jpStation.setState(GoLangConstant.intoNetWorkStatus.get(String.valueOf(golangStationDetail.getStationtypenew())));
jpStation.setDayGenerate(golangStationDetail.getDayenergy()); jpStation.setDayGenerate(golangStationDetail.getDayenergy());
jpStation.setMonthGenerate(golangStationDetail.getMonthenergy()); jpStation.setMonthGenerate(golangStationDetail.getMonthenergy() * GoLangConstant.mwhTokwh);
jpStation.setYearGenerate(golangStationDetail.getYearenergy()); jpStation.setYearGenerate(golangStationDetail.getYearenergy() * GoLangConstant.mwhTokwh);
jpStation.setAccumulatedPower(golangStationDetail.getAllenergy() * GoLangConstant.mwhTokwh);
jpStation.setDayIncome(golangStationDetail.getDayincome()); jpStation.setDayIncome(golangStationDetail.getDayincome());
jpStation.setMonthIncome(golangStationDetail.getMonthincome()); jpStation.setMonthIncome(golangStationDetail.getMonthincome());
jpStation.setYearIncome(golangStationDetail.getYearincome()); jpStation.setYearIncome(golangStationDetail.getYearincome());
jpStation.setCumulativeIncome(golangStationDetail.getAllincome()); jpStation.setCumulativeIncome(golangStationDetail.getAllincome());
jpStation.setArea(golangStationDetail.getRegionstr()); jpStation.setArea(golangStationDetail.getRegionstr());
jpStation.setEmail(golangStationDetail.getUseremail());
jpStation.setOnGridTime(new Date(golangStationDetail.getFispowertime()));
jpStation.setAccessTime(new Date(golangStationDetail.getFisgeneratetime()));
jpStation.setCreateTime(new Date(golangStationDetail.getCreatedate()));
jpStation.setRatedPower(Double.valueOf(golangStationDetail.getInverterpower()));
if (!ObjectUtils.isEmpty(jpStation.getSequenceNbr())) { if (!ObjectUtils.isEmpty(jpStation.getSequenceNbr())) {
jpStationMapper.updateById(jpStation); jpStationMapper.updateById(jpStation);
} else { } else {
jpStationMapper.insert(jpStation); jpStationMapper.insert(jpStation);
} }
HYGFJPStationPowerHistory hygfjpStationPowerHistory = new HYGFJPStationPowerHistory(); HYGFJPStationPowerHistory hygfjpStationPowerHistory = new HYGFJPStationPowerHistory();
hygfjpStationPowerHistory.setCreatedTime(new Date()); hygfjpStationPowerHistory.setCreatedTime(System.currentTimeMillis());
hygfjpStationPowerHistory.setThirdStationId(jpStation.getThirdStationId()); hygfjpStationPowerHistory.setThirdStationId(jpStation.getThirdStationId());
hygfjpStationPowerHistory.setPower(jpStation.getRealTimePower()); hygfjpStationPowerHistory.setPower(golangStationDetail.getPower());
hygfjpStationPowerHistory.setThirdCode(jpStation.getThirdCode()); hygfjpStationPowerHistory.setThirdCode(jpStation.getThirdCode());
hygfjpStationPowerHistory.setTime(System.currentTimeMillis()); hygfjpStationPowerHistory.setTime(System.currentTimeMillis());
golangStationDetailMapper.insert(golangStationDetail); hygfjpStationPowerHistoryMapper.insert(hygfjpStationPowerHistory);
HYGFJPDayPower hygfjpDayPower = hygfjpDayPowerMapper.selectOne(
new QueryWrapper<HYGFJPDayPower>().
eq("tation_id", stationIds.get(i)).
eq("year_month_day", today).
eq("hour", hour)
);
if (ObjectUtils.isEmpty(hygfjpDayPower)) {
hygfjpDayPower = new HYGFJPDayPower();
} }
hygfjpDayPower.setTationId(stationIds.get(i));
hygfjpDayPower.setHour(hour);
hygfjpDayPower.setYearMonthDay(today);
hygfjpDayPower.setPower(golangStationDetail.getPower());
if (ObjectUtils.isEmpty(hygfjpDayPower.getCreatedTime())) {
hygfjpDayPower.setCreatedTime(System.currentTimeMillis());
hygfjpDayPowerMapper.insert(hygfjpDayPower);
} else {
hygfjpDayPowerMapper.insert(hygfjpDayPower);
} }
} }
}
}
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void collectorList() { public void collectorList() {
List<String> stationIds = golangStationMapper.getStationIds(); List<String> stationIds = golangStationMapper.getStationIds();
...@@ -158,18 +229,83 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -158,18 +229,83 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
); );
for (int j = 0; j < result.size(); j++) { for (int j = 0; j < result.size(); j++) {
GolangCollectorList golangCollectorList = result.get(j); GolangCollectorList golangCollectorList = result.get(j);
golangCollectorList.setCreatedTime(new Date()); golangCollectorList.setCreatedTime(System.currentTimeMillis());
golangCollectorListMapper.insert(golangCollectorList); golangCollectorListMapper.insert(golangCollectorList);
} }
} }
} }
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void collectorDetail() { public void collectorDetail() {
List<Long> collectorIds = golangCollectorListMapper.getCollectIds(); List<Long> collectorIds = golangCollectorListMapper.getCollectIds();
for (int i = 0; i < collectorIds.size(); i++) {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("id", Long.valueOf(collectorIds.get(i)));
String requestParaminfo = JSON.toJSONString(requestInfo);
List<CollectorDetailDto> result = golangRequestUtil.getResPonse(GoLangConstant.collectorDetailUrl,
GoLangConstant.requestPost,
requestParaminfo,
GoLangConstant.resovleRule_data,
CollectorDetailDto.class
);
for (int j = 0; j < result.size(); j++) {
CollectorDetailDto collectorDetailDto = result.get(j);
JpCollector jpCollector = jpCollectorMapper.selectOne(new QueryWrapper<JpCollector>().
eq("third_station_id", collectorDetailDto.getStationId()).
eq("third_code", PVProducerInfoEnum.JLY.getCode()).
eq("sn_code", collectorDetailDto.getSn()));
if (ObjectUtils.isEmpty(jpCollector)) {
jpCollector = new JpCollector();
}
//sn编码
jpCollector.setSnCode(collectorDetailDto.getSn());
//类型
jpCollector.setType(collectorDetailDto.getModel());
//更新时间
jpCollector.setUpdateTime(new Date());
//出场日期
jpCollector.setDischargeDate(new Date(collectorDetailDto.getFactoryTime()));
//生产日期
jpCollector.setProductDate(new Date(collectorDetailDto.getFactoryTime()));
//数据上传间隔
jpCollector.setDataPeriod(collectorDetailDto.getDataUploadCycle());
//本次上电时间
jpCollector.setThisWorkTime(new DateTime(collectorDetailDto.getCurrentWorkingTime()));
//累计工作时间
jpCollector.setTotalWorkTime(new DateTime(collectorDetailDto.getTotalWorkingTime()));
//第三方电站id
jpCollector.setThirdStationId(collectorDetailDto.getStationId());
//第三方厂商标识
jpCollector.setThirdCode(PVProducerInfoEnum.JLY.getCode());
//第三方厂商标识
jpCollector.setState(GoLangConstant.stationStaus.get(collectorDetailDto.getState()));
jpCollector.setStationName(collectorDetailDto.getStationName());
jpCollector.setAddr(collectorDetailDto.getAddr());
if (ObjectUtils.isEmpty(jpCollector.getSequenceNbr())) {
jpCollectorMapper.insert(jpCollector);
} else {
jpCollectorMapper.updateById(jpCollector);
}
// td-collector-history
HYGFJPCollectorHistory hygfjpCollectorHistory = new HYGFJPCollectorHistory();
hygfjpCollectorHistory.setTime(System.currentTimeMillis());
hygfjpCollectorHistory.setCreatedTime(System.currentTimeMillis());
hygfjpCollectorHistory.setSnCode(collectorDetailDto.getSn());
hygfjpCollectorHistory.setSignalStrength(Double.valueOf(collectorDetailDto.getRssiLevel()));
hygfjpCollectorHistory.setThirdStationId(collectorDetailDto.getStationId());
hygfjpCollectorHistory.setThirdCode(PVProducerInfoEnum.JLY.getCode());
hygfjpCollectorHistoryMapper.insert(hygfjpCollectorHistory);
}
}
} }
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void inverterList() { public void inverterList() {
List<String> stationIds = golangStationMapper.getStationIds(); List<String> stationIds = golangStationMapper.getStationIds();
...@@ -187,19 +323,207 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe ...@@ -187,19 +323,207 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
List<GolangInverterList> result = golangRequestUtil.getResPonse(GoLangConstant.inverterListUrl, List<GolangInverterList> result = golangRequestUtil.getResPonse(GoLangConstant.inverterListUrl,
GoLangConstant.requestPost, GoLangConstant.requestPost,
requestParaminfo, requestParaminfo,
GoLangConstant.resovleRule_data_page_records, GoLangConstant.resovleRule_data,
GolangInverterList.class GolangInverterList.class
); );
for (int j = 0; j < result.size(); j++) { for (int j = 0; j < result.size(); j++) {
GolangInverterList golangInverterList = result.get(j); GolangInverterList golangInverterList = result.get(j);
golangInverterList.setCreatedTime(new Date()); golangInverterList.setCreatedTime(System.currentTimeMillis());
golangInverterListMapper.insert(golangInverterList); golangInverterListMapper.insert(golangInverterList);
} }
} }
} }
@Scheduled(cron = dataRequstScheduled)
@Override @Override
public void inverterDetail() { public void inverterDetail() {
List<Long> inverterIds = golangInverterListMapper.getInverterIds(); List<String> inverterSns = golangInverterListMapper.getInverterSns();
for (int i = 0; i < inverterSns.size(); i++) {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
} }
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("sn", inverterSns.get(i));
String requestParaminfo = JSON.toJSONString(requestInfo);
List<InverterDetailDto> result = golangRequestUtil.getResPonse(GoLangConstant.inverterDetailUrl,
GoLangConstant.requestPost,
requestParaminfo,
GoLangConstant.resovleRule_data,
InverterDetailDto.class
);
for (int j = 0; j < result.size(); j++) {
InverterDetailDto inverterDetailDto = result.get(j);
JpInverter jpInverter = jpInverterMapper.selectOne(new QueryWrapper<JpInverter>().
eq("third_station_id", inverterDetailDto.getStationId()).
eq("third_code", PVProducerInfoEnum.JLY.getCode()).
eq("sn_code", inverterDetailDto.getSn()));
if (ObjectUtils.isEmpty(jpInverter)) {
jpInverter = new JpInverter();
}
jpInverter.setSnCode(inverterDetailDto.getSn());
jpInverter.setState(GoLangConstant.stationStaus.get(inverterDetailDto.getCurrentState()));
jpInverter.setCollectorId(inverterDetailDto.getCollectorId());
jpInverter.setCollectorSnCode(inverterDetailDto.getCollectorsn());
jpInverter.setUpdateTime(new Date());
jpInverter.setCurrentPower(inverterDetailDto.getPac());
jpInverter.setDayPowerGeneration(inverterDetailDto.getEToday());
jpInverter.setMonthPowerGeneration(inverterDetailDto.getEMonth() * GoLangConstant.mwhTokwh);
jpInverter.setYearPowerGeneration(inverterDetailDto.getEYear() * GoLangConstant.mwhTokwh);
jpInverter.setTotalPowerGeneration(inverterDetailDto.getETotal() * GoLangConstant.mwhTokwh);
jpInverter.setBrand(inverterDetailDto.getName());
jpInverter.setModel(inverterDetailDto.getProductModel());
jpInverter.setNationalStandard(inverterDetailDto.getNationalStandards());
jpInverter.setVersion(inverterDetailDto.getVersion());
jpInverter.setGenerationHours(String.valueOf(inverterDetailDto.getFullHour()));
jpInverter.setId(inverterDetailDto.getId());
jpInverter.setCapacity(inverterDetailDto.getPower().intValue());
jpInverter.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
jpInverter.setThirdCode(PVProducerInfoEnum.JLY.getCode());
jpInverter.setStationName(inverterDetailDto.getStationName());
if (!ObjectUtils.isEmpty(jpInverter.getSequenceNbr())) {
jpInverterMapper.updateById(jpInverter);
} else {
jpInverterMapper.insert(jpInverter);
}
String jsonString = JSON.toJSONString(inverterDetailDto);
Map<String, Object> hanlderResult = JSON.parseObject(jsonString, Map.class);
for (int k = 1; k < 4; k++) {
JpInverterElectricity jpInverterElectricity = jpInverterElectricityMapper.selectOne(new QueryWrapper<JpInverterElectricity>().
eq("sn_code", inverterDetailDto.getSn()).
eq("type", "交流").
eq("name", "AC" + k)
);
if (ObjectUtils.isEmpty(jpInverterElectricity)) {
jpInverterElectricity = new JpInverterElectricity();
}
jpInverterElectricity.setInverterId(inverterDetailDto.getId());
jpInverterElectricity.setSnCode(inverterDetailDto.getSn());
jpInverterElectricity.setThirdCode(PVProducerInfoEnum.JLY.getCode());
jpInverterElectricity.setType("交流");
jpInverterElectricity.setName("AC" + k);
jpInverterElectricity.setVoltage(Double.valueOf(hanlderResult.get("uAc" + k).toString()));
jpInverterElectricity.setCurrent(Double.valueOf(hanlderResult.get("iAc" + k).toString()));
if (ObjectUtils.isEmpty(jpInverterElectricity.getSequenceNbr())) {
jpInverterElectricityMapper.insert(jpInverterElectricity);
} else {
jpInverterElectricityMapper.updateById(jpInverterElectricity);
}
}
for (int k1 = 1; k1 < 33; k1++) {
JpInverterElectricity jpInverterElectricity = jpInverterElectricityMapper.selectOne(new QueryWrapper<JpInverterElectricity>().
eq("sn_code", inverterDetailDto.getSn()).
eq("type", "直流").
eq("name", "PV" + k1)
);
if (ObjectUtils.isEmpty(jpInverterElectricity)) {
jpInverterElectricity = new JpInverterElectricity();
}
jpInverterElectricity.setInverterId(inverterDetailDto.getId());
jpInverterElectricity.setSnCode(inverterDetailDto.getSn());
jpInverterElectricity.setThirdCode(PVProducerInfoEnum.JLY.getCode());
jpInverterElectricity.setType("直流");
jpInverterElectricity.setName("PV" + k1);
jpInverterElectricity.setVoltage(Double.valueOf(hanlderResult.get("uPv" + k1).toString()));
jpInverterElectricity.setCurrent(Double.valueOf(hanlderResult.get("iPv" + k1).toString()));
jpInverterElectricity.setPower(Double.valueOf(hanlderResult.get("pow" + k1).toString()));
if (ObjectUtils.isEmpty(jpInverterElectricity.getSequenceNbr())) {
jpInverterElectricityMapper.insert(jpInverterElectricity);
} else {
jpInverterElectricityMapper.updateById(jpInverterElectricity);
}
}
HYGFJPInverterElecHistory hygfjpInverterElecHistory = new HYGFJPInverterElecHistory();
hygfjpInverterElecHistory.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
hygfjpInverterElecHistory.setCreatedTime(System.currentTimeMillis());
hygfjpInverterElecHistory.setSnCode(inverterDetailDto.getSn());
hygfjpInverterElecHistory.setUAcCurrent(inverterDetailDto.getIAc1());
hygfjpInverterElecHistory.setVAcCurrent(inverterDetailDto.getIAc2());
hygfjpInverterElecHistory.setWAcCurrent(inverterDetailDto.getIAc3());
hygfjpInverterElecHistory.setUAcVoltage(inverterDetailDto.getUAc1());
hygfjpInverterElecHistory.setVAcVoltage(inverterDetailDto.getUAc2());
hygfjpInverterElecHistory.setWAcVoltage(inverterDetailDto.getUAc3());
hygfjpInverterElecHistory.setThirdCode(PVProducerInfoEnum.JLY.getCode());
hygfjpInverterElecHistory.setTime(System.currentTimeMillis());
hygfjpInverterElecHistoryMapper.insert(hygfjpInverterElecHistory);
// 逆变器历史
String today = DateUtil.today();
HYGFJPInverterHistory hygfjpInverterHistory = hygfjpInverterHistoryMapper.selectOne(new QueryWrapper<HYGFJPInverterHistory>().eq("sn_code", inverterDetailDto.getSn()).eq("date", today));
if (ObjectUtils.isEmpty(hygfjpInverterHistory)) {
hygfjpInverterHistory = new HYGFJPInverterHistory();
}
hygfjpInverterHistory.setDate(today);
hygfjpInverterHistory.setThirdStationId(String.valueOf(inverterDetailDto.getStationId()));
hygfjpInverterHistory.setInverterId(inverterDetailDto.getId());
hygfjpInverterHistory.setSnCode(inverterDetailDto.getSn());
hygfjpInverterHistory.setThirdCode(PVProducerInfoEnum.JLY.getCode());
hygfjpInverterHistory.setGenerationHours(inverterDetailDto.getFullHour());
hygfjpInverterHistory.setPowerGeneration(inverterDetailDto.getEToday());
if (ObjectUtils.isEmpty(hygfjpInverterHistory.getCreatedTime())) {
hygfjpInverterHistory.setCreatedTime(System.currentTimeMillis());
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
} else {
hygfjpInverterHistoryMapper.insert(hygfjpInverterHistory);
}
}
}
}
@Scheduled(cron = dataRequstScheduled)
@Override
public void inverAlramInfo() {
List<String> inverterIds = golangInverterListMapper.getInverterSns();
for (int i = 0; i < inverterIds.size(); i++) {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("pageNo", 1);
requestInfo.put("pageSize", 100);
requestInfo.put("alarmDeviceSn", inverterIds.get(i));
requestInfo.put("alarmBeginTime", DateUtil.today());
requestInfo.put("alarmEndTime", DateUtil.today());
String requestParaminfo = JSON.toJSONString(requestInfo);
List<AlarmDto> result = golangRequestUtil.getResPonse(GoLangConstant.alarmListUrl,
GoLangConstant.requestPost,
requestParaminfo,
GoLangConstant.resovleRule_data_records,
AlarmDto.class
);
for (int j = 0; j < result.size(); j++) {
AlarmDto alarmDto = result.get(j);
if (!ObjectUtils.isEmpty(alarmDto.getAlarmDeviceSn())) {
HYGFJPInverterWarn hygfjpInverterWarn = hygfjpInverterWarnMapper.selectOne(new QueryWrapper<HYGFJPInverterWarn>()
.eq("sn_code", alarmDto.getAlarmDeviceSn())
.eq("start_time", alarmDto.getAlarmBeginTime())
.eq("third_station_id", String.valueOf(alarmDto.getStationId()))
);
if (ObjectUtils.isEmpty(hygfjpInverterWarn)) {
hygfjpInverterWarn = new HYGFJPInverterWarn();
}
hygfjpInverterWarn.setTime(System.currentTimeMillis());
hygfjpInverterWarn.setTimeLong(System.currentTimeMillis());
hygfjpInverterWarn.setSnCode(alarmDto.getAlarmDeviceSn());
hygfjpInverterWarn.setThirdStationId(String.valueOf(alarmDto.getStationId()));
hygfjpInverterWarn.setLevel(GoLangConstant.alarmLevel.get(alarmDto.getAlarmLevel()));
hygfjpInverterWarn.setContent(alarmDto.getAlarmMsg());
hygfjpInverterWarn.setThirdCode(PVProducerInfoEnum.JLY.getCode());
hygfjpInverterWarn.setTreatment(alarmDto.getAdvice());
hygfjpInverterWarn.setStartTime(alarmDto.getAlarmBeginTime());
hygfjpInverterWarn.setRecoverTime(alarmDto.getAlarmEndTime());
hygfjpInverterWarn.setState(GoLangConstant.alarmstatus.get(alarmDto.getState()));
if (ObjectUtils.isEmpty(hygfjpInverterWarn.getCreatedTime())) {
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis());
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
} else {
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
}
}
}
}
}
} }
...@@ -17,7 +17,7 @@ spring.db2.datasource.password=Yeejoin@2020 ...@@ -17,7 +17,7 @@ spring.db2.datasource.password=Yeejoin@2020
spring.db2.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.db2.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
## db3-taosiData ## db3-taosiData
spring.db3.datasource.type: com.alibaba.druid.pool.DruidDataSource spring.db3.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db3.datasource.url=jdbc:TAOS-RS://139.9.170.47:6041/house_pv_data?user=root&password=taosdata&timezone=GMT%2B8&characterEncoding=utf8 spring.db3.datasource.url=jdbc:TAOS-RS://139.9.170.47:6041/house_pv_data?user=root&password=taosdata&characterEncoding=utf8
spring.db3.datasource.username=root spring.db3.datasource.username=root
spring.db3.datasource.password=taosdata spring.db3.datasource.password=taosdata
spring.db3.datasource.driver-class-name=com.taosdata.jdbc.rs.RestfulDriver spring.db3.datasource.driver-class-name=com.taosdata.jdbc.rs.RestfulDriver
......
package com.yeejoin.amos.boot.module.hygf.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
*
*
* @author system_generator
* @date 2023-09-21
*/
@Data
@ApiModel(value="DayPowerDto", description="")
public class DayPowerDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "第三方电站id")
private String thirdStationId;
@ApiModelProperty(value = " 小时")
private String hour;
@ApiModelProperty(value = "平均功率")
private Double power;
@ApiModelProperty(value = "年月日")
private String yearMonthDay;
}
package com.yeejoin.amos.boot.module.hygf.api.dto; package com.yeejoin.amos.boot.module.hygf.api.dto;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpInverter;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date;
/** /**
* 户用光伏监盘采集器表 * 户用光伏监盘采集器表
...@@ -63,4 +68,17 @@ public class JpCollectorDto extends BaseDto { ...@@ -63,4 +68,17 @@ public class JpCollectorDto extends BaseDto {
@ApiModelProperty(value = "第三方厂商标识") @ApiModelProperty(value = "第三方厂商标识")
private String thirdCode; private String thirdCode;
@ApiModelProperty(value = "所属电站")
private String stationName;
@ApiModelProperty(value = "电站地址")
private String addr;
@ApiModelProperty(value = "采集器列表")
private List<JpInverter> jpInverters;
private List<String> stationIds;
@ApiModelProperty(value = "采集器名称")
private String name;
} }
...@@ -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;
} }
...@@ -7,6 +7,7 @@ import com.yeejoin.amos.boot.biz.common.dto.BaseDto; ...@@ -7,6 +7,7 @@ import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 户用光伏监盘逆变器表 * 户用光伏监盘逆变器表
...@@ -91,4 +92,8 @@ public class JpInverterDto extends BaseDto { ...@@ -91,4 +92,8 @@ public class JpInverterDto extends BaseDto {
@ApiModelProperty(value = "累计发电量") @ApiModelProperty(value = "累计发电量")
private Double totalPowerGeneration; private Double totalPowerGeneration;
@ApiModelProperty(value = "所属电站")
private String stationName;
private List<String> stationIds;
} }
...@@ -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;
} }
...@@ -21,12 +21,11 @@ import java.util.List; ...@@ -21,12 +21,11 @@ import java.util.List;
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value="JpStationDto", description="第三方场站") @ApiModel(value = "JpStationDto", description = "第三方场站")
public class JpStationDto extends BaseDto { public class JpStationDto extends BaseDto {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "sn编码") @ApiModelProperty(value = "sn编码")
private String snCode; private String snCode;
...@@ -101,44 +100,48 @@ public class JpStationDto extends BaseDto { ...@@ -101,44 +100,48 @@ public class JpStationDto extends BaseDto {
/** /**
* 电站类型 * 电站类型
*/ */
private String type ; private String type;
/** /**
* 组织编码 * 组织编码
*/ */
private String organizationalCode ; private String organizationalCode;
//日发电量 // 日发电量
private Double dayGenerate; private Double dayGenerate;
//月发电量 // 月发电量
private Double monthGenerate; private Double monthGenerate;
//年发电量 // 年发电量
private Double yearGenerate; private Double yearGenerate;
//日收益 // 日收益
private Double dayIncome; private Double dayIncome;
//月收益 // 月收益
private Double monthIncome; private Double monthIncome;
// 年收益 // 年收益
private Double yearIncome; private Double yearIncome;
//地区 // 地区
private String area; private String area;
List<JpPersonStation> statioId; List<JpPersonStation> statioId;
//累计收益 // 累计收益
private Double cumulativeIncome; private Double cumulativeIncome;
private Double dayPowerUse; // 日用电量 private Double dayPowerUse; // 日用电量
private Double month_power_use; // 月用电量 private Double monthPowerUse; // 月用电量
private Double yearPowerUse; // 年用电量 private Double yearPowerUse; // 年用电量
private int countBuiltNum;//已建设场站数量 private int countBuiltNum;// 已建设场站数量
private int countNBuiltNum;//未建设场站数量 private int countNBuiltNum;// 未建设场站数量
List<JpInverter> jpInverter; List<JpInverter> jpInverter;
List<JpCollector> JpCollector; List<JpCollector> JpCollector;
// 时间
String dateType;
private String email;
private Double ratedPower;
} }
...@@ -36,18 +36,18 @@ public class MonthPowerDto { ...@@ -36,18 +36,18 @@ public class MonthPowerDto {
private Double power; private Double power;
public void setDay(String day) {
public MonthPowerDto() {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("YYYY-MM-dd"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("YYYY-MM-dd");
String formattedDate = now.format(formatter); String formattedDate = now.format(formatter);
this.day = formattedDate; this.day = formattedDate;
}
public void setYearMonth(String yearMonth) { DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("YYYY-MM");
LocalDateTime now = LocalDateTime.now(); String formattedDate1 = now.format(formatter1);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("YYYY-MM"); this.yearMonth = formattedDate1;
String formattedDate = now.format(formatter);
this.yearMonth = formattedDate;
} }
} }
package com.yeejoin.amos.boot.module.hygf.api.dto;
import lombok.Data;
/**
* @description:
* @author: tw
* @createDate: 2023/9/21
*/
@Data
public class PowerCurveDto {
private Object date;
private Double num;
}
...@@ -14,12 +14,11 @@ import java.util.Date; ...@@ -14,12 +14,11 @@ import java.util.Date;
* @date 2023-09-19 * @date 2023-09-19
*/ */
@Data @Data
@ApiModel(value="TdHygfJpCollectorHistoryDto", description="户用光伏监盘采集器历史表") @ApiModel(value = "TdHygfJpCollectorHistoryDto", description = "户用光伏监盘采集器历史表")
public class TdHygfJpCollectorHistoryDto { public class TdHygfJpCollectorHistoryDto {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "sn编码") @ApiModelProperty(value = "sn编码")
private String snCode; private String snCode;
...@@ -35,4 +34,6 @@ public class TdHygfJpCollectorHistoryDto { ...@@ -35,4 +34,6 @@ public class TdHygfJpCollectorHistoryDto {
@ApiModelProperty(value = "第三方厂商标识") @ApiModelProperty(value = "第三方厂商标识")
private String thirdCode; private String thirdCode;
private String timeFormat;
} }
...@@ -53,6 +53,30 @@ public class TdHygfJpInverterWarnDto { ...@@ -53,6 +53,30 @@ public class TdHygfJpInverterWarnDto {
@ApiModelProperty(value = "时间") @ApiModelProperty(value = "时间")
private Long time; private Long time;
private String stationName;
private String stationContact;
private String userName;
private String userPhone;
private String email;
private String address;
private String area;
private Long createdTime;
private String timeLongFormat;
private String startTimeFormat;
private String recoverTimeFormat;
private List<String> stationIds; private List<String> stationIds;
private List<String> states;
} }
...@@ -15,12 +15,11 @@ import java.util.Date; ...@@ -15,12 +15,11 @@ import java.util.Date;
* @date 2023-09-19 * @date 2023-09-19
*/ */
@Data @Data
@ApiModel(value="TdHygfJpInvertorElecHistoryDto", description="户用光伏监盘逆变器电能历史表") @ApiModel(value = "TdHygfJpInvertorElecHistoryDto", description = "户用光伏监盘逆变器电能历史表")
public class TdHygfJpInvertorElecHistoryDto { public class TdHygfJpInvertorElecHistoryDto {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "sn编码") @ApiModelProperty(value = "sn编码")
private String snCode; private String snCode;
...@@ -51,4 +50,8 @@ public class TdHygfJpInvertorElecHistoryDto { ...@@ -51,4 +50,8 @@ public class TdHygfJpInvertorElecHistoryDto {
@ApiModelProperty(value = "第三方厂商标识") @ApiModelProperty(value = "第三方厂商标识")
private String thirdCode; private String thirdCode;
private Long createdTime;
private String timeFormat;
} }
package com.yeejoin.amos.boot.module.hygf.api.entity; package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
/** /**
...@@ -20,11 +25,12 @@ import java.util.Date; ...@@ -20,11 +25,12 @@ import java.util.Date;
public class AllPower { public class AllPower {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId(value = "created_time")
private Long createdTime;
/** /**
* 第三方电站id * 第三方电站id
*/ */
@TableField("third_station_id") @TableField("tation_id")
private String thirdStationId; private String thirdStationId;
/** /**
...@@ -39,4 +45,18 @@ public class AllPower { ...@@ -39,4 +45,18 @@ public class AllPower {
@TableField("power") @TableField("power")
private Double power; private Double power;
public AllPower() throws InterruptedException{
Thread.sleep(0L,1);
this.createdTime=System.currentTimeMillis();
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("YYYY");
String formattedDate1 = now.format(formatter1);
this.year = formattedDate1;
}
} }
package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
*
*
* @author system_generator
* @date 2023-09-21
*/
@Data
@Accessors(chain = true)
@TableName("td_hygf_day_power")
public class DayPower {
private static final long serialVersionUID = 1L;
@TableId(value = "created_time")
private Long createdTime;
/**
* 第三方电站id
*/
@TableField("tation_id")
private String thirdStationId;
/**
* 小时
*/
@TableField("hour")
private String hour;
/**
* 平均功率
*/
@TableField("power")
private Double power;
/**
* 年月日
*/
@TableField("year_month_day")
private String yearMonthDay;
}
...@@ -106,4 +106,21 @@ public class JpCollector extends BaseEntity { ...@@ -106,4 +106,21 @@ public class JpCollector extends BaseEntity {
@TableField("third_code") @TableField("third_code")
private String thirdCode; private String thirdCode;
/**
* 所属电站
*/
@TableField("station_name")
private String stationName;
/**
* 电站地址
*/
@TableField("addr")
private String addr;
/**
* 采集器名称
*/
@TableField("name")
private String name;
} }
...@@ -160,4 +160,16 @@ public class JpInverter extends BaseEntity { ...@@ -160,4 +160,16 @@ public class JpInverter extends BaseEntity {
@TableField("total_power_generation") @TableField("total_power_generation")
private Double totalPowerGeneration; private Double totalPowerGeneration;
/**
* 所属电站
*/
@TableField("station_name")
private String stationName;
/**
* 电站地址
*/
@TableField("addr")
private String addr;
} }
...@@ -201,9 +201,9 @@ public class JpStation extends BaseEntity { ...@@ -201,9 +201,9 @@ public class JpStation extends BaseEntity {
private Double yearPowerUse; // 年用电量 private Double yearPowerUse; // 年用电量
@TableField("email")
private String email; //邮箱
@TableField("rated_power")
private Double ratedPower;
} }
package com.yeejoin.amos.boot.module.hygf.api.entity; package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
/** /**
...@@ -21,10 +27,17 @@ public class MonthPower { ...@@ -21,10 +27,17 @@ public class MonthPower {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId(value = "created_time")
private Long createdTime;
/** /**
* 第三方电站id * 第三方电站id
*/ */
@TableField("third_station_id") @TableField("tation_id")
private String thirdStationId; private String thirdStationId;
/** /**
...@@ -45,4 +58,24 @@ public class MonthPower { ...@@ -45,4 +58,24 @@ public class MonthPower {
@TableField("power") @TableField("power")
private Double power; private Double power;
public MonthPower()throws InterruptedException {
Thread.sleep(0L,1);
this.createdTime=System.currentTimeMillis();
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("YYYY-MM-dd");
String formattedDate = now.format(formatter);
this.day = formattedDate;
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("YYYY-MM");
String formattedDate1 = now.format(formatter1);
this.yearMonth = formattedDate1;
}
} }
package com.yeejoin.amos.boot.module.hygf.api.entity; package com.yeejoin.amos.boot.module.hygf.api.entity;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
/** /**
...@@ -20,11 +25,12 @@ import java.util.Date; ...@@ -20,11 +25,12 @@ import java.util.Date;
public class YearPower { public class YearPower {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId(value = "created_time")
private Long createdTime;
/** /**
* 第三方电站id * 第三方电站id
*/ */
@TableField("third_station_id") @TableField("tation_id")
private String thirdStationId; private String thirdStationId;
/** /**
...@@ -45,4 +51,19 @@ public class YearPower { ...@@ -45,4 +51,19 @@ public class YearPower {
@TableField("power") @TableField("power")
private Double power; private Double power;
public YearPower() throws InterruptedException{
Thread.sleep(0L,1);
this.createdTime=System.currentTimeMillis();
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("YYYY-MM");
String formattedDate = now.format(formatter);
this.month = formattedDate;
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("YYYY");
String formattedDate1 = now.format(formatter1);
this.year = formattedDate1;
}
} }
...@@ -19,5 +19,6 @@ public interface JpStationMapper extends BaseMapper<JpStation> { ...@@ -19,5 +19,6 @@ public interface JpStationMapper extends BaseMapper<JpStation> {
List<JpStationDto> queryForDealerReviewPage(@Param("dto") JpStationDto reviewDto); List<JpStationDto> queryForDealerReviewPage(@Param("dto") JpStationDto reviewDto);
JpStationDto queryCount(@Param("dto") JpStationDto reviewDto); JpStationDto queryCount(@Param("dto") JpStationDto reviewDto);
List<Map<String,Object>> countState(@Param("dto") JpStationDto reviewDto); List<Map<String,Object>> countState(@Param("dto") JpStationDto reviewDto);
List<Map<String,Double>> getPowerqx(String dateType);
} }
package com.yeejoin.amos.boot.module.hygf.api.service;
/**
* 接口类
*
* @author system_generator
* @date 2023-09-21
*/
public interface IDayPowerService {
}
package com.yeejoin.amos.boot.module.hygf.api.service; package com.yeejoin.amos.boot.module.hygf.api.service;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/** /**
* 第三方场站接口类 * 第三方场站接口类
* *
...@@ -9,4 +14,5 @@ package com.yeejoin.amos.boot.module.hygf.api.service; ...@@ -9,4 +14,5 @@ package com.yeejoin.amos.boot.module.hygf.api.service;
*/ */
public interface IJpStationService { public interface IJpStationService {
Map<String, List<Object>> getPowerqx(String date, String type, List<Long> statioId);
} }
package com.yeejoin.amos.boot.module.hygf.api.tdenginemapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.DayPower;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* Mapper 接口
*
* @author system_generator
* @date 2023-09-21
*/
public interface DayPowerMapper extends BaseMapper<DayPower> {
}
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.MonthPowerDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.AllPower;
import com.yeejoin.amos.boot.module.hygf.api.entity.MonthPower; import com.yeejoin.amos.boot.module.hygf.api.entity.MonthPower;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.YearPower;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -13,5 +18,20 @@ import java.util.List; ...@@ -13,5 +18,20 @@ import java.util.List;
*/ */
public interface MonthPowerMapper extends BaseMapper<MonthPower> { public interface MonthPowerMapper extends BaseMapper<MonthPower> {
List<MonthPower> getMonthPower(); List<MonthPower> getMonthPowerint();
List<YearPower> getSumMonthPower(@Param("date") String month);
List<AllPower> getSumYearPower(@Param("date") String ear);
List<PowerCurveDto> getDayPower(@Param("startTime") Long startTime, @Param("endTime") Long endTime,@Param("dto")List<Long> statioId);
List<PowerCurveDto> getMonthPower(@Param("date") String month,@Param("dto")List<Long> statioId);
List<PowerCurveDto> getYearPower(@Param("date") String month,@Param("dto")List<Long> statioId);
List<PowerCurveDto> getAllPower(@Param("date") String month,@Param("dto")List<Long> statioId);
List<PowerCurveDto> getDayPowercount(@Param("date") String month,@Param("dto")List<Long> statioId);
} }
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.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);
} }
...@@ -13,5 +13,5 @@ import java.util.Map; ...@@ -13,5 +13,5 @@ import java.util.Map;
* @date 2023-09-19 * @date 2023-09-19
*/ */
public interface TdHygfJpStationPowerHistoryMapper extends BaseMapper<TdHygfJpStationPowerHistory> { public interface TdHygfJpStationPowerHistoryMapper extends BaseMapper<TdHygfJpStationPowerHistory> {
Map<String,Double> getacgNum(@Param("date") String date); // Map<String,Double> getacgNum(@Param("date") String date);
} }
package com.yeejoin.amos.boot.module.hygf.api.util; package com.yeejoin.amos.boot.module.hygf.api.util;
import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
...@@ -23,4 +24,55 @@ public class TimeUtil { ...@@ -23,4 +24,55 @@ public class TimeUtil {
todayEnd.set(Calendar.MILLISECOND, 999); todayEnd.set(Calendar.MILLISECOND, 999);
return todayEnd.getTime().getTime(); return todayEnd.getTime().getTime();
} }
public static String dateFormat(Long time) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return dateFormat.format(new Date(time));
}
public static String minuteFormat(Long time) {
SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm");
return dateFormat.format(new Date(time));
}
public static String longFormat(Long time) {
if (time < 1000) {
return "0" + "秒";
}
long second = time / 1000;
long seconds = second % 60;
long minutes = second / 60;
long hours = 0;
if (minutes >= 60) {
hours = minutes / 60;
minutes = minutes % 60;
}
String timeString = "";
String secondString = "";
String minuteString = "";
String hourString = "";
if (seconds < 10) {
secondString = "0" + seconds + "秒";
} else {
secondString = seconds + "秒";
}
if (minutes < 10 && hours < 1) {
minuteString = minutes + "分";
} else if (minutes < 10) {
minuteString = "0" + minutes + "分";
} else {
minuteString = minutes + "分";
}
if (hours < 10) {
hourString = hours + "时";
} else {
hourString = hours + "" + "时";
}
if (hours != 0) {
timeString = hourString + minuteString + secondString;
} else {
timeString = minuteString + secondString;
}
return timeString;
}
} }
<?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.mapper.JpCollectorMapper"> <mapper namespace="com.yeejoin.amos.boot.module.hygf.api.mapper.JpCollectorMapper">
<select id="queryCollectorCountStatus" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto"> <select id="queryCollectorCountStatus" resultType="Map">
select select
hygf_jp_collector.`status`, hygf_jp_collector.`state`,
count(hygf_jp_collector.sequence_nbr) num count(hygf_jp_collector.sequence_nbr) num
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
on hygf_jp_station.third_station_id=hygf_jp_collector.third_station_id on hygf_jp_station.third_station_id=hygf_jp_collector.third_station_id
<where> <where>
<if test="dto.nauserNameme!=null"> <if test="dto.name!=null">
and hygf_jp_station.user_name like concat(concat("%",#{dto.userName}),"%") and hygf_jp_station.name like concat(concat("%",#{dto.name}),"%")
</if> </if>
<if test="dto.area!=null"> <if test="dto.area!=null">
and hygf_jp_station.area like concat(concat("%",#{dto.area}),"%") and hygf_jp_station.area like concat(concat("%",#{dto.area}),"%")
...@@ -28,7 +28,12 @@ ...@@ -28,7 +28,12 @@
<if test="dto.thirdStationId!=null"> <if test="dto.thirdStationId!=null">
and hygf_jp_station.third_station_id =#{dto.thirdStationId} and hygf_jp_station.third_station_id =#{dto.thirdStationId}
</if> </if>
and hygf_jp_collector.`state` is not null and hygf_jp_collector.`state` in ("在线","报警","离线")
</where> </where>
GROUP BY hygf_jp_collector.`status`
GROUP BY hygf_jp_collector.`state`
</select> </select>
</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.mapper.JpInverterMapper"> <mapper namespace="com.yeejoin.amos.boot.module.hygf.api.mapper.JpInverterMapper">
<select id="queryInverterCountStatus" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto"> <select id="queryInverterCountStatus" resultType="Map">
select select
hygf_jp_inverter.`status`, hygf_jp_inverter.`state`,
count(hygf_jp_inverter.sequence_nbr) num count(hygf_jp_inverter.sequence_nbr) num
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
on hygf_jp_station.third_station_id=hygf_jp_inverter.third_station_id on hygf_jp_station.third_station_id=hygf_jp_inverter.third_station_id
<where> <where>
<if test="dto.nauserNameme!=null"> <if test="dto.name!=null">
and hygf_jp_station.user_name like concat(concat("%",#{dto.userName}),"%") and hygf_jp_station.name like concat(concat("%",#{dto.name}),"%")
</if> </if>
<if test="dto.area!=null"> <if test="dto.area!=null">
and hygf_jp_station.area like concat(concat("%",#{dto.area}),"%") and hygf_jp_station.area like concat(concat("%",#{dto.area}),"%")
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
<if test="dto.thirdStationId!=null"> <if test="dto.thirdStationId!=null">
and hygf_jp_station.third_station_id =#{dto.thirdStationId} and hygf_jp_station.third_station_id =#{dto.thirdStationId}
</if> </if>
and hygf_jp_inverter.`state` is not null and hygf_jp_inverter.`state` in ("在线","报警","离线")
</where> </where>
GROUP BY hygf_jp_inverter.`status` GROUP BY hygf_jp_inverter.`state`
</select> </select>
</mapper> </mapper>
...@@ -5,7 +5,53 @@ ...@@ -5,7 +5,53 @@
<select id="queryForDealerReviewPage" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto"> <select id="queryForDealerReviewPage" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto">
select * from hygf_jp_station select
`sequence_nbr` sequenceNbr,
`rec_date` recDate,
`rec_user_id` recUserId,
`rec_user_name` recUserName,
`sn_code` snCode,
`capacity` capacity,
`name` ,
`code` ,
`system_code` systemCode,
`access_time` accessTime,
`create_time` createTime,
`address` ,
`longitude` ,
`latitude` ,
`price` ,
`user_name` userName,
`user_phone` userPhone,
`station_contact` stationContact,
`module_count` moduleCount,
`on_grid_type` onGridType,
`on_grid_time` onGridTime,
`third_station_id` thirdStationId,
`third_code` thirdCode,
`station_id` stationId,
`day_power_use` dayPowerUse,
`month_power_use` monthPowerUse,
`year_power_use` yearPowerUse,
FORMAT(`real_time_power`,3) realTimePower,
FORMAT(`accumulated_power`/1000,3) accumulatedPower,
`state` ,
`type`,
`organizational_code` organizationalCode,
`is_delete` isDelete,
FORMAT(`day_generate`,3) dayGenerate,
`month_generate` monthGenerate,
`year_generate` yearGenerate,
`day_income` dayIncome,
`month_income` monthIncome,
`year_income` yearIncome,
`area` ,
`cumulative_income` cumulativeIncome,
`email`,
rated_power ratedPower
from hygf_jp_station
<where> <where>
<if test="dto.name!=null"> <if test="dto.name!=null">
and hygf_jp_station.name like concat(concat("%",#{dto.name}),"%") and hygf_jp_station.name like concat(concat("%",#{dto.name}),"%")
...@@ -37,24 +83,25 @@ ...@@ -37,24 +83,25 @@
select select
sum(real_time_power) realTimePower, FORMAT(sum(real_time_power),3) realTimePower,
sum(capacity) capacity, FORMAT(sum(capacity)/1000,3) capacity,
sum(day_generate) dayGenerate, FORMAT(sum(day_generate)/1000,3) dayGenerate,
sum(month_generate) monthGenerate, FORMAT(sum(month_generate)/1000,3) monthGenerate,
sum(year_generate) yearGenerate, FORMAT(sum(year_generate)/1000,3) yearGenerate,
sum(accumulated_power) accumulatedPower, FORMAT(sum(accumulated_power)/1000,3) accumulatedPower,
sum(day_income) dayIncome, FORMAT( sum(day_income),3) dayIncome,
sum(month_income) monthIncome, FORMAT(sum(month_income)/10000,3) monthIncome,
sum(year_income) yearIncome, FORMAT(sum(year_income)/10000,3) yearIncome,
sum(cumulative_income) cumulativeIncome, FORMAT(sum(cumulative_income)/10000,3) cumulativeIncome,
sum(day_power_use) dayPowerUse, FORMAT(sum(day_power_use)/1000,3) dayPowerUse,
sum(month_power_use) monthPowerUse, FORMAT(sum(month_power_use)/1000,3) monthPowerUse,
sum(year_power_use) yearPowerUse, FORMAT(sum(year_power_use)/1000,3) yearPowerUse,
FORMAT(sum(rated_power),3) ratedPower,
count(*) countBuiltNum count(*) countBuiltNum
from hygf_jp_station from hygf_jp_station
<where> <where>
<if test="dto.userName!=null"> <if test="dto.name!=null">
and hygf_jp_station.user_name like concat(concat("%",#{dto.userName}),"%") and hygf_jp_station.name like concat(concat("%",#{dto.name}),"%")
</if> </if>
<if test="dto.area!=null"> <if test="dto.area!=null">
and hygf_jp_station.area like concat(concat("%",#{dto.area}),"%") and hygf_jp_station.area like concat(concat("%",#{dto.area}),"%")
...@@ -86,13 +133,19 @@ ...@@ -86,13 +133,19 @@
<if test="dto.userName!=null"> <if test="dto.userName!=null">
and hygf_jp_station.user_name like concat(concat("%",#{dto.userName}),"%") and hygf_jp_station.user_name like concat(concat("%",#{dto.userName}),"%")
</if> </if>
<if test="dto.address!=null">
and hygf_jp_station.address like concat(concat("%",#{dto.address}),"%")
</if>
<if test="dto.area!=null">
and hygf_jp_station.area like concat(concat("%",#{dto.area}),"%")
</if>
<if test="dto.statioId!=null"> <if test="dto.statioId!=null">
and hygf_jp_station.third_station_id in and hygf_jp_station.third_station_id in
<foreach collection="dto.statioId" item="item" index="index" open="(" separator="," close=")"> <foreach collection="dto.statioId" item="item" index="index" open="(" separator="," close=")">
#{item.stationId} #{item.stationId}
</foreach> </foreach>
</if> </if>
and hygf_jp_station.`state` is not null and hygf_jp_station.`state` in ("在线","报警","离线")
</where> </where>
</select> </select>
......
<?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">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.DayPowerMapper">
</mapper>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.MonthPowerMapper"> <mapper namespace="com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.MonthPowerMapper">
<select id="getMonthPower" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.MonthPowerDto"> <select id="getMonthPowerint" resultType="com.yeejoin.amos.boot.module.hygf.api.entity.MonthPower">
SELECT SELECT
avg(power) power, avg(power) power,
third_station_id thirdStationId third_station_id thirdStationId
...@@ -11,4 +11,80 @@ ...@@ -11,4 +11,80 @@
</select> </select>
<select id="getSumMonthPower" resultType="com.yeejoin.amos.boot.module.hygf.api.entity.YearPower">
SELECT
sum(power) power,
tation_id thirdStationId
FROM house_pv_data.td_hygf_month_power where year_month=#{date} GROUP BY tation_id
</select>
<select id="getSumYearPower" resultType="com.yeejoin.amos.boot.module.hygf.api.entity.AllPower">
SELECT
sum(power) power,
tation_id thirdStationId
FROM house_pv_data.td_hygf_year_power where year=#{date} GROUP BY tation_id
</select>
<select id="getDayPower" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto">
SELECT
sum(power)num,
`time` date
FROM house_pv_data.td_hygf_jp_station_power_history where third_station_id in
<foreach collection="dto" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and `time` <![CDATA[>=]]> #{startTime} and `time` <![CDATA[<]]> #{endTime}
GROUP BY `time`
</select>
<select id="getMonthPower" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto">
SELECT
sum(power)num,
`day` date
FROM house_pv_data.td_hygf_month_power where tation_id in
<foreach collection="dto" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and year_month = #{date}
GROUP BY `day`
</select>
<select id="getYearPower" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto">
SELECT
sum(power)num,
`month` date
FROM house_pv_data.td_hygf_year_power where tation_id in
<foreach collection="dto" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and `year` = #{date}
GROUP BY `month`
</select>
<select id="getAllPower" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto">
SELECT
sum(power)num,
`year` date
FROM house_pv_data.td_hygf_all_power where tation_id in
<foreach collection="dto" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY `year`
</select>
<select id="getDayPowercount" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto">
SELECT
sum(power)num,
`hour` date
FROM house_pv_data.td_hygf_day_power where tation_id in
<foreach collection="dto" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and year_month_day = #{date}
GROUP BY `hour`
</select>
</mapper> </mapper>
...@@ -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>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
AND `third_station_id` = #{thirdStationId} AND `third_station_id` = #{thirdStationId}
</if> </if>
<if test="date!=null"> <if test="date!=null">
AND `date` LIKE '%'#{date}'%' AND `date` LIKE #{date}
</if> </if>
</where> </where>
</select> </select>
......
...@@ -9,18 +9,23 @@ ...@@ -9,18 +9,23 @@
<if test="dto!=null"> <if test="dto!=null">
third_station_id in third_station_id in
<foreach collection="dto" item="item" index="index" open="(" separator="," close=")"> <foreach collection="dto" item="item" index="index" open="(" separator="," close=")">
#{item.stationId} #{item.thirdStationId}
</foreach> </foreach>
</if> </if>
and `state` in ('未处理','已处理','已恢复')
</where> </where>
GROUP BY `state` GROUP BY `state`
</select> </select>
<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
...@@ -30,4 +35,13 @@ ...@@ -30,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>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</parent> </parent>
<artifactId>amos-boot-module-hygf-biz</artifactId> <artifactId>amos-boot-module-hygf-biz</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
<name>amos-boot-module-jxiop-hygf</name> <name>amos-boot-module-hygf-biz</name>
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
......
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.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.DayPowerServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
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.yeejoin.amos.boot.module.hygf.api.dto.DayPowerDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/**
*
*
* @author system_generator
* @date 2023-09-21
*/
@RestController
@Api(tags = "Api")
@RequestMapping(value = "/day-power")
public class DayPowerController extends BaseController {
@Autowired
DayPowerServiceImpl dayPowerServiceImpl;
/**
* 新增
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public ResponseModel<DayPowerDto> save(@RequestBody DayPowerDto model) {
model = dayPowerServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<DayPowerDto> updateBySequenceNbrDayPower(@RequestBody DayPowerDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
return ResponseHelper.buildResponse(dayPowerServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(dayPowerServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个", notes = "根据sequenceNbr查询单个")
public ResponseModel<DayPowerDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(dayPowerServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "分页查询", notes = "分页查询")
public ResponseModel<Page<DayPowerDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<DayPowerDto> page = new Page<DayPowerDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(dayPowerServiceImpl.queryForDayPowerPage(page));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<DayPowerDto>> selectForList() {
return ResponseHelper.buildResponse(dayPowerServiceImpl.queryForDayPowerList());
}
}
package com.yeejoin.amos.boot.module.hygf.biz.controller; package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpInverter;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpInverterServiceImpl;
import org.springframework.web.bind.annotation.RequestMapping; 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 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 java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpCollectorServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpCollectorServiceImpl;
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 org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
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 com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterWarnDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpPersonStation;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpPersonStationMapper;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
...@@ -31,6 +43,12 @@ public class JpCollectorController extends BaseController { ...@@ -31,6 +43,12 @@ public class JpCollectorController extends BaseController {
@Autowired @Autowired
JpCollectorServiceImpl jpCollectorServiceImpl; JpCollectorServiceImpl jpCollectorServiceImpl;
@Autowired
JpPersonStationMapper pPersonStationMapper;
@Autowired
JpInverterServiceImpl jpInverterServiceImpl;
/** /**
* 新增户用光伏监盘采集器表 * 新增户用光伏监盘采集器表
* *
...@@ -53,7 +71,8 @@ public class JpCollectorController extends BaseController { ...@@ -53,7 +71,8 @@ public class JpCollectorController 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<JpCollectorDto> updateBySequenceNbrJpCollector(@RequestBody JpCollectorDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) { public ResponseModel<JpCollectorDto> updateBySequenceNbrJpCollector(@RequestBody JpCollectorDto model,
@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr); model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(jpCollectorServiceImpl.updateWithModel(model)); return ResponseHelper.buildResponse(jpCollectorServiceImpl.updateWithModel(model));
} }
...@@ -67,7 +86,8 @@ public class JpCollectorController extends BaseController { ...@@ -67,7 +86,8 @@ public class JpCollectorController 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(jpCollectorServiceImpl.removeById(sequenceNbr)); return ResponseHelper.buildResponse(jpCollectorServiceImpl.removeById(sequenceNbr));
} }
...@@ -81,7 +101,14 @@ public class JpCollectorController extends BaseController { ...@@ -81,7 +101,14 @@ public class JpCollectorController extends BaseController {
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个户用光伏监盘采集器表", notes = "根据sequenceNbr查询单个户用光伏监盘采集器表") @ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个户用光伏监盘采集器表", notes = "根据sequenceNbr查询单个户用光伏监盘采集器表")
public ResponseModel<JpCollectorDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<JpCollectorDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(jpCollectorServiceImpl.queryBySeq(sequenceNbr)); JpCollectorDto jpCollectorDto = jpCollectorServiceImpl.queryBySeq(sequenceNbr);
LambdaQueryWrapper<JpInverter> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JpInverter::getCollectorSnCode, jpCollectorDto.getSnCode());
List<JpInverter> list = jpInverterServiceImpl.list(queryWrapper);
jpCollectorDto.setJpInverters(list);
return ResponseHelper.buildResponse(jpCollectorDto);
} }
/** /**
...@@ -93,13 +120,22 @@ public class JpCollectorController extends BaseController { ...@@ -93,13 +120,22 @@ public class JpCollectorController 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<JpCollectorDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam public ResponseModel<Page<JpCollectorDto>> queryForPage(@RequestParam(value = "current") int current,
(value = "size") int size,JpCollectorDto jpCollectorDto) { @RequestParam(value = "size") int size, JpCollectorDto jpCollectorDto) {
LambdaQueryWrapper<JpPersonStation> qug = new LambdaQueryWrapper<>();
qug.eq(JpPersonStation::getPersonId, getUserInfo().getUserId());
List<JpPersonStation> pPersonStation = pPersonStationMapper.selectList(qug);
if (!pPersonStation.isEmpty()) {
Page<JpCollectorDto> page = new Page<JpCollectorDto>(); Page<JpCollectorDto> page = new Page<JpCollectorDto>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
return ResponseHelper.buildResponse(jpCollectorServiceImpl.queryForJpCollectorPage(page,jpCollectorDto)); List<String> ids = pPersonStation.stream().map(i -> i.getStationId()).collect(Collectors.toList());
jpCollectorDto.setStationIds(ids);
return ResponseHelper.buildResponse(jpCollectorServiceImpl.queryForJpCollectorPage(page, jpCollectorDto));
} else {
return ResponseHelper.buildResponse(new Page<JpCollectorDto>());
}
} }
/** /**
...@@ -108,7 +144,7 @@ public class JpCollectorController extends BaseController { ...@@ -108,7 +144,7 @@ public class JpCollectorController 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<JpCollectorDto>> selectForList() { public ResponseModel<List<JpCollectorDto>> selectForList() {
return ResponseHelper.buildResponse(jpCollectorServiceImpl.queryForJpCollectorList()); return ResponseHelper.buildResponse(jpCollectorServiceImpl.queryForJpCollectorList());
......
...@@ -6,14 +6,22 @@ import io.swagger.annotations.Api; ...@@ -6,14 +6,22 @@ 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 com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpInverterServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpInverterServiceImpl;
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 org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
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 com.yeejoin.amos.boot.module.hygf.api.dto.JpCollectorDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpPersonStation;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpPersonStationMapper;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
...@@ -31,6 +39,10 @@ public class JpInverterController extends BaseController { ...@@ -31,6 +39,10 @@ public class JpInverterController extends BaseController {
@Autowired @Autowired
JpInverterServiceImpl jpInverterServiceImpl; JpInverterServiceImpl jpInverterServiceImpl;
@Autowired
JpPersonStationMapper pPersonStationMapper;
/** /**
* 新增户用光伏监盘逆变器表 * 新增户用光伏监盘逆变器表
* *
...@@ -98,10 +110,20 @@ public class JpInverterController extends BaseController { ...@@ -98,10 +110,20 @@ public class JpInverterController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器表分页查询", notes = "户用光伏监盘逆变器表分页查询") @ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器表分页查询", notes = "户用光伏监盘逆变器表分页查询")
public ResponseModel<Page<JpInverterDto>> queryForPage(@RequestParam(value = "current") int current, public ResponseModel<Page<JpInverterDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size, JpInverterDto jpInverterDto) { @RequestParam(value = "size") int size, JpInverterDto jpInverterDto) {
LambdaQueryWrapper<JpPersonStation> qug = new LambdaQueryWrapper<>();
qug.eq(JpPersonStation::getPersonId, getUserInfo().getUserId());
List<JpPersonStation> pPersonStation = pPersonStationMapper.selectList(qug);
if (!pPersonStation.isEmpty()) {
Page<JpInverterDto> page = new Page<JpInverterDto>(); Page<JpInverterDto> page = new Page<JpInverterDto>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
List<String> ids = pPersonStation.stream().map(i -> i.getStationId()).collect(Collectors.toList());
jpInverterDto.setStationIds(ids);
return ResponseHelper.buildResponse(jpInverterServiceImpl.queryForJpInverterPage(page, jpInverterDto)); return ResponseHelper.buildResponse(jpInverterServiceImpl.queryForJpInverterPage(page, jpInverterDto));
} else {
return ResponseHelper.buildResponse(new Page<JpInverterDto>());
}
} }
/** /**
......
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));
} }
} }
...@@ -99,9 +99,10 @@ public class JpStationController extends BaseController { ...@@ -99,9 +99,10 @@ public class JpStationController extends BaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}") @GetMapping(value = "/getBysequenceNbr")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个第三方场站", notes = "根据sequenceNbr查询单个第三方场站") @ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个第三方场站", notes = "根据sequenceNbr查询单个第三方场站")
public ResponseModel<JpStationDto> selectOne(@PathVariable Long sequenceNbr) { public ResponseModel<JpStationDto> selectOne( String id) {
Long sequenceNbr=Long.valueOf(id);
JpStationDto jpStationDto= jpStationServiceImpl.queryBySeq(sequenceNbr); JpStationDto jpStationDto= jpStationServiceImpl.queryBySeq(sequenceNbr);
LambdaQueryWrapper<JpInverter> qug=new LambdaQueryWrapper<>(); LambdaQueryWrapper<JpInverter> qug=new LambdaQueryWrapper<>();
qug.eq(JpInverter::getThirdStationId,jpStationDto.getThirdStationId()); qug.eq(JpInverter::getThirdStationId,jpStationDto.getThirdStationId());
...@@ -145,16 +146,30 @@ public class JpStationController extends BaseController { ...@@ -145,16 +146,30 @@ public class JpStationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/countState") @GetMapping(value = "/countState")
@ApiOperation(httpMethod = "GET",value = "场站列表", notes = "场站列表") @ApiOperation(httpMethod = "GET",value = "场站列表", notes = "场站列表")
public ResponseModel< List<Map<String,Object>>> countState(JpStationDto reviewDto) { public ResponseModel< Map<String,Object> > countState(JpStationDto reviewDto) {
//获取当前人管理场站 //获取当前人管理场站
LambdaQueryWrapper<JpPersonStation> qug=new LambdaQueryWrapper<>(); LambdaQueryWrapper<JpPersonStation> qug=new LambdaQueryWrapper<>();
qug.eq(JpPersonStation::getPersonId,getUserInfo().getUserId()); qug.eq(JpPersonStation::getPersonId,getUserInfo().getUserId());
List<JpPersonStation> pPersonStation=pPersonStationMapper.selectList(qug); List<JpPersonStation> pPersonStation=pPersonStationMapper.selectList(qug);
reviewDto.setStatioId(pPersonStation.isEmpty()?null:pPersonStation); reviewDto.setStatioId(pPersonStation.isEmpty()?null:pPersonStation);
List<Map<String,Object>> list= jpStationMapper.countState(reviewDto);
return ResponseHelper.buildResponse(jpStationMapper.countState(reviewDto)); Map<String,Object> collector =new HashMap<>();
collector.put("zx",0);
collector.put("bj",0);
collector.put("lx",0);
if(list!=null&&list.isEmpty()){
for (Map<String, Object> map : list) {
if("在线".equals(map.get("state").toString())){
collector.put("zx",Integer.valueOf(map.get("num").toString()));
}else if("离线".equals(map.get("state").toString())){
collector.put("lx",Integer.valueOf(map.get("num").toString()));
}else if("报警".equals(map.get("state").toString())){
collector.put("bj",Integer.valueOf(map.get("num").toString()));
}
}
}
return ResponseHelper.buildResponse(collector);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
...@@ -174,9 +189,39 @@ public class JpStationController extends BaseController { ...@@ -174,9 +189,39 @@ public class JpStationController extends BaseController {
} }
List<Map<String,Object>> listCollector= jpCollectorMapper.queryCollectorCountStatus(reviewDto); List<Map<String,Object>> listCollector= jpCollectorMapper.queryCollectorCountStatus(reviewDto);
List<Map<String,Object>> listInverter= jpInverterMapper.queryInverterCountStatus(reviewDto); List<Map<String,Object>> listInverter= jpInverterMapper.queryInverterCountStatus(reviewDto);
Map<String,Object> collector =new HashMap<>();
collector.put("zx",0);
collector.put("gj",0);
collector.put("lx",0);
Map<String,Object> inverter =new HashMap<>();
inverter.put("zx",0);
inverter.put("gj",0);
inverter.put("lx",0);
if(!listCollector.isEmpty()){
for (Map<String, Object> map : listCollector) {
if("在线".equals(map.get("state").toString())){
collector.put("zx",Integer.valueOf(map.get("num").toString()));
}else if("离线".equals(map.get("state").toString())){
collector.put("lx",Integer.valueOf(map.get("num").toString()));
}else if("报警".equals(map.get("state").toString())){
collector.put("gj",Integer.valueOf(map.get("num").toString()));
}
}
}
if(!listInverter.isEmpty()){
for (Map<String, Object> map : listInverter) {
if("在线".equals(map.get("state").toString())){
inverter.put("zx",Integer.valueOf(map.get("num").toString()));
}else if("离线".equals(map.get("state").toString())){
inverter.put("lx",Integer.valueOf(map.get("num").toString()));
}else if("报警".equals(map.get("state").toString())){
inverter.put("gj",Integer.valueOf(map.get("num").toString()));
}
}
}
Map<String,Object> map=new HashMap<>(); Map<String,Object> map=new HashMap<>();
map.put("collector",listCollector); map.put("collector",collector);
map.put("inverter",listInverter); map.put("inverter",inverter);
return ResponseHelper.buildResponse(map); return ResponseHelper.buildResponse(map);
} }
...@@ -197,12 +242,12 @@ public class JpStationController extends BaseController { ...@@ -197,12 +242,12 @@ public class JpStationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryUserListyz") @GetMapping(value = "/queryUserListyz")
@ApiOperation(httpMethod = "GET",value = "登陆人管理场站业主列表", notes = "登陆人管理场站业主列表") @ApiOperation(httpMethod = "GET",value = "登陆人管理场站业主列表", notes = "登陆人管理场站业主列表")
public ResponseModel<Set<String>> queryUserList( ) { public ResponseModel<List<String>> queryUserList( ) {
//获取当前人管理场站 //获取当前人管理场站
LambdaQueryWrapper<JpPersonStation> qug=new LambdaQueryWrapper<>(); LambdaQueryWrapper<JpPersonStation> qug=new LambdaQueryWrapper<>();
qug.eq(JpPersonStation::getPersonId,getUserInfo().getUserId()); qug.eq(JpPersonStation::getPersonId,getUserInfo().getUserId());
List<JpPersonStation> pPersonStation=pPersonStationMapper.selectList(qug); List<JpPersonStation> pPersonStation=pPersonStationMapper.selectList(qug);
Set data=new HashSet(); List data=new ArrayList();
if(pPersonStation!=null&& !pPersonStation.isEmpty()){ if(pPersonStation!=null&& !pPersonStation.isEmpty()){
for (JpPersonStation jpPersonStation : pPersonStation) { for (JpPersonStation jpPersonStation : pPersonStation) {
data.add(jpPersonStation.getOwner()); data.add(jpPersonStation.getOwner());
...@@ -232,7 +277,30 @@ public class JpStationController extends BaseController { ...@@ -232,7 +277,30 @@ public class JpStationController extends BaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "工率曲线", notes = "电站监控电量收益")
@GetMapping(value = "/getPowerqx")
public ResponseModel< Map<String, List<Object>>> getPowerqx(JpStationDto reviewDto,String date, String type) {
//获取当前人管理场站
List<Long> data=new ArrayList();
if(reviewDto.getThirdStationId()==null){
//获取当前人管理场站
LambdaQueryWrapper<JpPersonStation> qug=new LambdaQueryWrapper<>();
qug.eq(JpPersonStation::getPersonId,getUserInfo().getUserId());
List<JpPersonStation> pPersonStation=pPersonStationMapper.selectList(qug);
if(pPersonStation!=null&&!pPersonStation.isEmpty()){
for (JpPersonStation jpPersonStation : pPersonStation) {
data.add(Long.valueOf(jpPersonStation.getStationId()));
}
}else{
return ResponseHelper.buildResponse(null);
}
}else{
data.add(Long.valueOf(reviewDto.getThirdStationId()));
}
return ResponseHelper.buildResponse(jpStationServiceImpl.getPowerqx( date, type,data));
}
......
package com.yeejoin.amos.boot.module.hygf.biz.controller; package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpPersonStation;
import org.springframework.web.bind.annotation.RequestMapping; 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;
...@@ -111,9 +113,8 @@ public class MonthPowerController extends BaseController { ...@@ -111,9 +113,8 @@ public class MonthPowerController extends BaseController {
@GetMapping(value = "/list") @GetMapping(value = "/list")
public ResponseModel<List<MonthPowerDto>> selectForList() { public ResponseModel<List<MonthPowerDto>> selectForList() {
monthPowerServiceImpl.getMonthPower(); monthPowerServiceImpl.getMonthPower();
return ResponseHelper.buildResponse(monthPowerServiceImpl.queryForMonthPowerList()); return ResponseHelper.buildResponse(null);
} }
} }
...@@ -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());
}
} }
...@@ -135,7 +135,7 @@ public class TdHygfJpInverterHistoryController extends BaseController { ...@@ -135,7 +135,7 @@ public class TdHygfJpInverterHistoryController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器历史表列表全部数据查询", notes = "户用光伏监盘逆变器历史表列表全部数据查询") @ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器历史表列表全部数据查询", notes = "户用光伏监盘逆变器历史表列表全部数据查询")
@GetMapping(value = "/statistics") @GetMapping(value = "/statistics")
public ResponseModel<Map<String, Object>> day(@RequestParam(value = "id") Long id, public ResponseModel<Map<String, Object>> day(@RequestParam(value = "id") String id,
@RequestParam(value = "type") String type, @RequestParam(value = "date") String date) { @RequestParam(value = "type") String type, @RequestParam(value = "date") String date) {
return ResponseHelper.buildResponse(tdHygfJpInverterHistoryServiceImpl.statistics(id,type,date)); return ResponseHelper.buildResponse(tdHygfJpInverterHistoryServiceImpl.statistics(id,type,date));
} }
......
...@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -16,6 +16,7 @@ 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.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -108,6 +109,19 @@ public class TdHygfJpInverterWarnController extends BaseController { ...@@ -108,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 当前页
...@@ -155,7 +169,7 @@ public class TdHygfJpInverterWarnController extends BaseController { ...@@ -155,7 +169,7 @@ public class TdHygfJpInverterWarnController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器报警表列表全部数据查询", notes = "户用光伏监盘逆变器报警表列表全部数据查询") @ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器报警表列表全部数据查询", notes = "户用光伏监盘逆变器报警表列表全部数据查询")
@GetMapping(value = "/selectcount") @GetMapping(value = "/selectcount")
public ResponseModel< List<Map<String,Object>>> selectcount(JpStationDto reviewDto) { public ResponseModel< Map<String,Object> > selectcount(JpStationDto reviewDto) {
LambdaQueryWrapper<JpStation> qugda=new LambdaQueryWrapper<>(); LambdaQueryWrapper<JpStation> qugda=new LambdaQueryWrapper<>();
//获取当前人管理场站 //获取当前人管理场站
if(reviewDto.getThirdStationId()==null){ if(reviewDto.getThirdStationId()==null){
...@@ -184,41 +198,19 @@ public class TdHygfJpInverterWarnController extends BaseController { ...@@ -184,41 +198,19 @@ public class TdHygfJpInverterWarnController extends BaseController {
qugda.like(reviewDto.getArea()!=null,JpStation::getArea,reviewDto.getArea()); qugda.like(reviewDto.getArea()!=null,JpStation::getArea,reviewDto.getArea());
List<JpStation> pPersonStation=jpStationMapper.selectList(qugda); List<JpStation> pPersonStation=jpStationMapper.selectList(qugda);
List<Map<String,Object>> datalist= tdHygfJpInverterWarnMapper.getCountTdHygfJpInverterWarn(pPersonStation!=null&&!pPersonStation.isEmpty()?pPersonStation:null); List<Map<String,Object>> datalist= tdHygfJpInverterWarnMapper.getCountTdHygfJpInverterWarn(pPersonStation!=null&&!pPersonStation.isEmpty()?pPersonStation:null);
return ResponseHelper.buildResponse(datalist); Map<String,Object> collector =new HashMap<>();
} collector.put("wcl",0);
collector.put("ycl",0);
// /** if(datalist!=null&&!datalist.isEmpty()){
// * 获取告警统计 for (Map<String, Object> map : datalist) {
// **/ if("未处理".equals(map.get("state").toString())){
// @TycloudOperation(ApiLevel = UserType.AGENCY) collector.put("wcl",map.get("num"));
// @ApiOperation(httpMethod = "GET", value = "户用光伏监盘逆变器报警表列表全部数据查询", notes = "户用光伏监盘逆变器报警表列表全部数据查询") }else if("已处理".equals(map.get("state").toString())||"已恢复".equals(map.get("state").toString())){
// @GetMapping(value = "/selectcount") collector.put("ycl",map.get("num"));
// public ResponseModel<List<Map<String, Object>>> selectcount(JpStationDto reviewDto) { }
// LambdaQueryWrapper<JpStation> qugda = new LambdaQueryWrapper<>(); }
// // 获取当前人管理场站 }
// if (reviewDto.getThirdStationId() == null) { return ResponseHelper.buildResponse(collector);
// // 获取当前人管理场站 }
// LambdaQueryWrapper<JpPersonStation> qug = new LambdaQueryWrapper<>();
// qug.eq(JpPersonStation::getPersonId, getUserInfo().getUserId());
// List<JpPersonStation> pPersonStation = pPersonStationMapper.selectList(qug);
// List ids = null;
// if (pPersonStation != null && !pPersonStation.isEmpty()) {
// ids = new ArrayList();
// for (JpPersonStation jpPersonStation : pPersonStation) {
// ids.add(jpPersonStation.getStationId());
// }
// qugda.in(ids != null, JpStation::getThirdStationId, ids);
// }
// } else {
// qugda.eq(JpStation::getThirdStationId, reviewDto.getThirdStationId());
// }
// qugda.like(reviewDto.getUserName() != null, JpStation::getUserName, reviewDto.getUserName());
// qugda.like(reviewDto.getArea() != null, JpStation::getArea, reviewDto.getArea());
// List<JpStation> pPersonStation = jpStationMapper.selectList(qugda);
// List<Map<String, Object>> datalist = tdHygfJpInverterWarnMapper.getCountTdHygfJpInverterWarn(pPersonStation);
// return ResponseHelper.buildResponse(datalist);
// }
} }
...@@ -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.scheduled;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpStationServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.MonthPowerServiceImpl;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpCollectorHistoryServiceImpl;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpInvertorElecHistoryServiceImpl;
/**
* @description:
* @author: tw
* @createDate: 2023/9/21
*/
@EnableScheduling
public class WindSpeedScheduled {
@Autowired
JpStationServiceImpl jpStationServiceImpl;
@Autowired
TdHygfJpCollectorHistoryServiceImpl tdHygfJpCollectorHistoryServiceImpl;
@Autowired
TdHygfJpInvertorElecHistoryServiceImpl tdHygfJpInvertorElecHistoryServiceImpl;
@Scheduled(cron = "${cheduled.crons}")
private void initData() {
jpStationServiceImpl.getMonthPower();
tdHygfJpCollectorHistoryServiceImpl.syncData();
tdHygfJpInvertorElecHistoryServiceImpl.syncData();
}
}
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.yeejoin.amos.boot.module.hygf.api.entity.DayPower;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.DayPowerMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IDayPowerService;
import com.yeejoin.amos.boot.module.hygf.api.dto.DayPowerDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* 服务实现类
*
* @author system_generator
* @date 2023-09-21
*/
@Service
public class DayPowerServiceImpl extends BaseService<DayPowerDto,DayPower,DayPowerMapper> implements IDayPowerService {
/**
* 分页查询
*/
public Page<DayPowerDto> queryForDayPowerPage(Page<DayPowerDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<DayPowerDto> queryForDayPowerList() {
return this.queryForList("" , false);
}
}
\ No newline at end of file
...@@ -39,6 +39,9 @@ public class JpCollectorServiceImpl extends BaseService<JpCollectorDto, JpCollec ...@@ -39,6 +39,9 @@ public class JpCollectorServiceImpl extends BaseService<JpCollectorDto, JpCollec
if (jpCollectorDto.getState() != null) { if (jpCollectorDto.getState() != null) {
wrapper.eq(JpCollector::getState, jpCollectorDto.getState()); wrapper.eq(JpCollector::getState, jpCollectorDto.getState());
} }
if (!jpCollectorDto.getStationIds().isEmpty()) {
wrapper.in(JpCollector::getThirdStationId, jpCollectorDto.getStationIds());
}
entiryPage = (Page<JpCollector>) this.page(entiryPage, wrapper); entiryPage = (Page<JpCollector>) this.page(entiryPage, wrapper);
if (!ValidationUtil.isEmpty(entiryPage.getRecords())) { if (!ValidationUtil.isEmpty(entiryPage.getRecords())) {
page.setTotal(entiryPage.getTotal()); page.setTotal(entiryPage.getTotal());
......
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.beans.factory.annotation.Autowired;
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 +22,16 @@ import java.util.List; ...@@ -16,7 +22,16 @@ 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 {
@Autowired
private JpStationServiceImpl jpStationServiceImpl;
@Autowired
private JpInverterServiceImpl JpInverterServiceImpl;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -27,7 +42,12 @@ public class JpInverterElectricityServiceImpl extends BaseService<JpInverterElec ...@@ -27,7 +42,12 @@ public class JpInverterElectricityServiceImpl extends BaseService<JpInverterElec
/** /**
* 列表查询 示例 * 列表查询 示例
*/ */
public List<JpInverterElectricityDto> queryForJpInverterElectricityList() { public List<JpInverterElectricityDto> queryForJpInverterElectricityList(String id) {
return this.queryForList("" , false); JpInverter jpInverter = JpInverterServiceImpl.getById(id);
LambdaQueryWrapper<JpInverterElectricity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(JpInverterElectricity::getSnCode, jpInverter.getSnCode());
wrapper.eq(JpInverterElectricity::getThirdStationId, jpInverter.getThirdStationId());
List<JpInverterElectricity> list = this.list(wrapper);
return Bean.toModels(list, this.getModelClass());
} }
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -10,6 +11,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService; ...@@ -10,6 +11,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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 com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDto; import com.yeejoin.amos.boot.module.hygf.api.dto.JpInverterDto;
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.JpInverter;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpInverterMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.JpInverterMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IJpInverterService; import com.yeejoin.amos.boot.module.hygf.api.service.IJpInverterService;
...@@ -32,6 +34,13 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter ...@@ -32,6 +34,13 @@ public class JpInverterServiceImpl extends BaseService<JpInverterDto, JpInverter
if (jpInverterDto.getState() != null) { if (jpInverterDto.getState() != null) {
wrapper.eq(JpInverter::getState, jpInverterDto.getState()); wrapper.eq(JpInverter::getState, jpInverterDto.getState());
} }
if(StringUtils.isNotEmpty(jpInverterDto.getSnCode())) {
wrapper.likeRight(JpInverter::getSnCode, jpInverterDto.getSnCode());
}
if (!jpInverterDto.getStationIds().isEmpty()) {
wrapper.in(JpInverter::getThirdStationId, jpInverterDto.getStationIds());
}
wrapper.orderByDesc(JpInverter::getUpdateTime);
entiryPage = (Page<JpInverter>) this.page(entiryPage, wrapper); entiryPage = (Page<JpInverter>) this.page(entiryPage, wrapper);
if (!ValidationUtil.isEmpty(entiryPage.getRecords())) { if (!ValidationUtil.isEmpty(entiryPage.getRecords())) {
page.setTotal(entiryPage.getTotal()); page.setTotal(entiryPage.getTotal());
......
...@@ -3,16 +3,23 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl; ...@@ -3,16 +3,23 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerCurveDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.ReviewDto; import com.yeejoin.amos.boot.module.hygf.api.dto.ReviewDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation; import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
import com.yeejoin.amos.boot.module.hygf.api.mapper.JpStationMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.JpStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IJpStationService; import com.yeejoin.amos.boot.module.hygf.api.service.IJpStationService;
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.tdenginemapper.MonthPowerMapper;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
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.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
/** /**
* 第三方场站服务实现类 * 第三方场站服务实现类
...@@ -25,7 +32,10 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -25,7 +32,10 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
@Autowired @Autowired
JpStationMapper jpStationMapper; JpStationMapper jpStationMapper;
@Autowired
MonthPowerMapper monthPowerMapper;
@Autowired
MonthPowerServiceImpl monthPowerServiceImpl;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -40,6 +50,146 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS ...@@ -40,6 +50,146 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
pagenew.setRecords(page.getList()); pagenew.setRecords(page.getList());
return pagenew; return pagenew;
} }
@Async
public void getMonthPower() {
monthPowerServiceImpl.getMonthPower();
}
@Override
public Map<String, List<Object>> getPowerqx(String date, String type,List<Long> statioId) {
List<PowerCurveDto> data=null;
List<Object> listx =new ArrayList<>();
List<Object> listy =new ArrayList<>();
Map<String, List<Object>> map =new HashMap<>();
try {
if(type.equals("day")){
map= gethourList();
data =monthPowerMapper.getDayPowercount(date, statioId);
}else if(type.equals("month")){
map= getDayListOfMonth(date);
data=monthPowerMapper.getMonthPower(date, statioId);
}else if(type.equals("year")){
map= getyearListOfMonth(date);
data= monthPowerMapper.getYearPower(date,statioId);
}else{
map= getyearList();
data= monthPowerMapper.getAllPower(date, statioId);
}
listx =map.get("x");
listy =map.get("y");
if(data!=null&&!data.isEmpty()){
for (PowerCurveDto datum : data) {
for (int i = 0; i < listx.size(); i++) {
if(datum.getDate().equals(listx.get(i).toString())){
listy.remove(i);
String format = new DecimalFormat("#.000").format(datum.getNum());
listy.add(i,format);
break;
}
}
}
}
map.put("x",listx);
map.put("y",listy);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
return map;
}
public static Map<String, List<Object>> getDayListOfMonth(String date) {
Map<String, List<Object>> map =new HashMap<>();
try {
List<Object> listx =new ArrayList<>();
List<Object> listy =new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
Date dat = sdf.parse(date);
Calendar aCalendar = Calendar.getInstance();
aCalendar.setTime(dat);
int month = aCalendar.get(Calendar.MONTH) + 1;//月份
int day = aCalendar.getActualMaximum(Calendar.DATE);
for (int i = 1; i <= day; i++) {
String aDate = month+"-"+i;
listx.add(aDate);
listy.add(0);
}
map.put("x",listx);
map.put("y",listy);
}catch (Exception e){
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
return map;
}
public static Map<String, List<Object>> getyearListOfMonth(String date) {
Map<String, List<Object>> map =new HashMap<>();
List<Object> listx =new ArrayList<>();
List<Object> listy =new ArrayList<>();
for (int i = 1; i <= 12; i++) {
String aDate = date+"-"+i;
listx.add(aDate);
listy.add(0);
}
map.put("x",listx);
map.put("y",listy);
return map;
}
public static Map<String, List<Object>> getyearList() {
Map<String, List<Object>> map =new HashMap<>();
List<Object> listx =new ArrayList<>();
List<Object> listy =new ArrayList<>();
Calendar aCalendar = Calendar.getInstance(Locale.CHINA);
int year = aCalendar.get(Calendar.YEAR);//年份
for (int i = 1; i <= 10; i++) {
int aDate = year-(10-i);
listx.add(String.valueOf(aDate));
listy.add(0);
}
map.put("x",listx);
map.put("y",listy);
return map;
}
public static Map<String, List<Object>> gethourList() {
Map<String, List<Object>> map =new HashMap<>();
List<Object> listx =new ArrayList<>();
List<Object> listy =new ArrayList<>();
try {
ArrayList<String> dates = new ArrayList<String>();
for (int i = 0; i < 24; i++) {
String s1 =i+":00";
listx.add(s1);
listy.add(0);
}
}catch (Exception e){
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
map.put("x",listx);
map.put("y",listy);
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 com.yeejoin.amos.boot.module.hygf.api.entity.MonthPower; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.AllPowerMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.MonthPowerMapper; import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.MonthPowerMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IMonthPowerService; import com.yeejoin.amos.boot.module.hygf.api.service.IMonthPowerService;
import com.yeejoin.amos.boot.module.hygf.api.dto.MonthPowerDto; import com.yeejoin.amos.boot.module.hygf.api.dto.MonthPowerDto;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.YearPowerMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.transaction.annotation.Transactional;
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.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
/** /**
...@@ -22,6 +29,12 @@ public class MonthPowerServiceImpl extends BaseService<MonthPowerDto,MonthPower, ...@@ -22,6 +29,12 @@ public class MonthPowerServiceImpl extends BaseService<MonthPowerDto,MonthPower,
@Autowired @Autowired
MonthPowerMapper monthPowerMapper; MonthPowerMapper monthPowerMapper;
@Autowired
YearPowerServiceImpl yearPowerServiceImpl;
@Autowired
AllPowerServiceImpl allPowerServiceImpl;
@Autowired
YearPowerMapper YearPowerMapper;
/** /**
* 分页查询 * 分页查询
...@@ -39,10 +52,72 @@ public class MonthPowerServiceImpl extends BaseService<MonthPowerDto,MonthPower, ...@@ -39,10 +52,72 @@ public class MonthPowerServiceImpl extends BaseService<MonthPowerDto,MonthPower,
@Override @Override
@Async @Transactional
public void getMonthPower() { public void getMonthPower() {
List<MonthPower> list= monthPowerMapper.getMonthPower(); List<MonthPower> list= monthPowerMapper.getMonthPowerint();
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter formatterday = DateTimeFormatter.ofPattern("YYYY-MM-dd");
String formattedDateday = now.format(formatterday);
LambdaQueryWrapper<MonthPower> wrapperday = new LambdaQueryWrapper<>();
wrapperday.eq(MonthPower::getDay, formattedDateday);
List<MonthPower> listdday= this.list(wrapperday);
if(listdday!=null&&!listdday.isEmpty()){
for (MonthPower monthPower : listdday) {
for (MonthPower power : list) {
if(monthPower.getThirdStationId().equals(power.getThirdStationId())){
monthPower.setPower(power.getPower());
}
}
}
this.saveBatch(listdday);
}else{
this.saveBatch(list); this.saveBatch(list);
}
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("YYYY-MM");
String formattedDate = now.format(formatter);
List<YearPower> listd= monthPowerMapper.getSumMonthPower(formattedDate);
LambdaQueryWrapper<YearPower> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YearPower::getMonth, formattedDate);
List<YearPower> listdY= yearPowerServiceImpl.list(wrapper);
if(listdY!=null&&!listdY.isEmpty()){
for (YearPower yearPower : listdY) {
for (YearPower power : listd) {
if(yearPower.getThirdStationId().equals(power.getThirdStationId())){
yearPower.setPower(power.getPower());
}
}
}
yearPowerServiceImpl.saveBatch(listdY);
}else{
yearPowerServiceImpl.saveBatch(listd);
} }
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("YYYY");
String formattedDate1 = now.format(formatter1);
List<AllPower> listdy= monthPowerMapper.getSumYearPower(formattedDate1);
LambdaQueryWrapper<AllPower> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(AllPower::getYear, formattedDate1);
List<AllPower> listdall= allPowerServiceImpl.list(wrapper1);
if(listdall!=null&&!listdall.isEmpty()){
for (AllPower yearPower : listdall) {
for (AllPower power : listdy) {
if(yearPower.getThirdStationId().equals(power.getThirdStationId())){
yearPower.setPower(power.getPower());
}
}
}
allPowerServiceImpl.saveBatch(listdall);
}else{
allPowerServiceImpl.saveBatch(listdy);
}
}
} }
\ 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.scheduling.annotation.Async;
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;
...@@ -48,8 +54,14 @@ public class TdHygfJpCollectorHistoryServiceImpl ...@@ -48,8 +54,14 @@ public class TdHygfJpCollectorHistoryServiceImpl
JpCollector collector = jpCollectorServiceImpl.getById(id); JpCollector collector = jpCollectorServiceImpl.getById(id);
if (collector != null) { if (collector != null) {
return this.baseMapper.dayList(collector.getSnCode(), collector.getThirdStationId(), List<TdHygfJpCollectorHistoryDto> list = this.baseMapper.dayList(collector.getSnCode(),
TimeUtil.getStartTimeOfDay(day), TimeUtil.getEndTimeOfDay(day)); collector.getThirdStationId(), TimeUtil.getStartTimeOfDay(day), TimeUtil.getEndTimeOfDay(day));
if (!list.isEmpty()) {
list.forEach(i -> {
i.setTimeFormat(TimeUtil.minuteFormat(i.getTime()));
});
}
return list;
} }
return new ArrayList<>(); return new ArrayList<>();
} }
...@@ -59,10 +71,11 @@ public class TdHygfJpCollectorHistoryServiceImpl ...@@ -59,10 +71,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 +85,11 @@ public class TdHygfJpCollectorHistoryServiceImpl ...@@ -72,10 +85,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 +105,74 @@ public class TdHygfJpCollectorHistoryServiceImpl ...@@ -91,4 +105,74 @@ public class TdHygfJpCollectorHistoryServiceImpl
} }
return new ArrayList<>(); return new ArrayList<>();
} }
@Async
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
...@@ -45,11 +45,12 @@ public class TdHygfJpInverterHistoryServiceImpl ...@@ -45,11 +45,12 @@ public class TdHygfJpInverterHistoryServiceImpl
return this.queryForList("", false); return this.queryForList("", false);
} }
public Map<String, Object> statistics(Long id, String type, String date) { public Map<String, Object> statistics(String id, String type, String date) {
JpInverter inverter = jpInverterServiceImpl.getById(id); JpInverter inverter = jpInverterServiceImpl.getById(id);
Double power = null, dailyReturn = null, hours = null; Double power = null, dailyReturn = null, hours = null;
Map<String, Object> map = new HashMap(); Map<String, Object> map = new HashMap();
if (inverter != null) { if (inverter != null) {
date = "%" + date + "%";
if ("day".equals(type)) { if ("day".equals(type)) {
map = this.baseMapper.sum(inverter.getSnCode(), inverter.getThirdStationId(), date); map = this.baseMapper.sum(inverter.getSnCode(), inverter.getThirdStationId(), date);
} else if ("month".equals(type)) { } else if ("month".equals(type)) {
...@@ -60,6 +61,10 @@ public class TdHygfJpInverterHistoryServiceImpl ...@@ -60,6 +61,10 @@ public class TdHygfJpInverterHistoryServiceImpl
map = this.baseMapper.sum(inverter.getSnCode(), inverter.getThirdStationId(), date); map = this.baseMapper.sum(inverter.getSnCode(), inverter.getThirdStationId(), date);
} }
} }
if(!map.containsKey("return"))
{
map.put("return", null);
}
if (map == null) { if (map == null) {
map = new HashMap(); map = new HashMap();
map.put("power", power); map.put("power", power);
......
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.ArrayList;
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;
import java.util.stream.Collectors;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -16,9 +22,11 @@ import com.github.pagehelper.PageInfo; ...@@ -16,9 +22,11 @@ import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.module.hygf.api.dto.ReviewDto; import com.yeejoin.amos.boot.module.hygf.api.dto.ReviewDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterWarnDto; import com.yeejoin.amos.boot.module.hygf.api.dto.TdHygfJpInverterWarnDto;
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.JpStation;
import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpInverterWarn; import com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpInverterWarn;
import com.yeejoin.amos.boot.module.hygf.api.service.ITdHygfJpInverterWarnService; import com.yeejoin.amos.boot.module.hygf.api.service.ITdHygfJpInverterWarnService;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpInverterWarnMapper; import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpInverterWarnMapper;
import com.yeejoin.amos.boot.module.hygf.api.util.TimeUtil;
/** /**
* 户用光伏监盘逆变器报警表服务实现类 * 户用光伏监盘逆变器报警表服务实现类
...@@ -30,6 +38,10 @@ import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpInverterWarn ...@@ -30,6 +38,10 @@ import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpInverterWarn
public class TdHygfJpInverterWarnServiceImpl public class TdHygfJpInverterWarnServiceImpl
extends BaseService<TdHygfJpInverterWarnDto, TdHygfJpInverterWarn, TdHygfJpInverterWarnMapper> extends BaseService<TdHygfJpInverterWarnDto, TdHygfJpInverterWarn, TdHygfJpInverterWarnMapper>
implements ITdHygfJpInverterWarnService { implements ITdHygfJpInverterWarnService {
@Autowired
JpStationServiceImpl jpStationServiceImpl;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -38,7 +50,40 @@ public class TdHygfJpInverterWarnServiceImpl ...@@ -38,7 +50,40 @@ 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);
List<TdHygfJpInverterWarnDto> list = this.baseMapper.list(tdHygfJpInverterWarnDto); if (tdHygfJpInverterWarnDto.getState() != null) {
String[] s = tdHygfJpInverterWarnDto.getState().split(",");
tdHygfJpInverterWarnDto.setStates(Arrays.asList(s));
}
if (tdHygfJpInverterWarnDto.getStationName() != null) {
LambdaQueryWrapper<JpStation> wapper = new LambdaQueryWrapper<JpStation>().like(JpStation::getName,
tdHygfJpInverterWarnDto.getStationName());
if (!tdHygfJpInverterWarnDto.getStationIds().isEmpty()) {
wapper.in(JpStation::getThirdStationId, tdHygfJpInverterWarnDto.getStationIds());
}
List<JpStation> sList = jpStationServiceImpl.list(wapper);
List<String> ids = sList.stream().map(i -> i.getThirdStationId()).collect(Collectors.toList());
tdHygfJpInverterWarnDto.setStationIds(ids);
}
List<TdHygfJpInverterWarnDto> list = new ArrayList<>();
if (tdHygfJpInverterWarnDto.getStationIds().isEmpty()) {
} else {
list = this.baseMapper.list(tdHygfJpInverterWarnDto);
if (!list.isEmpty()) {
list.forEach(i -> {
JpStation jpStation = jpStationServiceImpl.getOne(new LambdaQueryWrapper<JpStation>()
.eq(JpStation::getThirdStationId, i.getThirdStationId()));
if (jpStation != null) {
i.setAddress(jpStation.getAddress());
i.setStationName(jpStation.getName());
i.setArea(jpStation.getArea());
}
if (i.getStartTime() != null) {
i.setStartTimeFormat(TimeUtil.dateFormat(i.getStartTime()));
}
});
}
}
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>();
pagenew.setCurrent(pageNum); pagenew.setCurrent(pageNum);
...@@ -54,4 +99,32 @@ public class TdHygfJpInverterWarnServiceImpl ...@@ -54,4 +99,32 @@ 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);
JpStation jpStation = jpStationServiceImpl.getOne(new LambdaQueryWrapper<JpStation>()
.eq(JpStation::getThirdStationId, tdHygfJpInverterWarnDto.getThirdStationId()));
if (jpStation != null) {
tdHygfJpInverterWarnDto.setStationName(jpStation.getName());
tdHygfJpInverterWarnDto.setStationContact(jpStation.getStationContact());
tdHygfJpInverterWarnDto.setUserName(jpStation.getUserName());
tdHygfJpInverterWarnDto.setUserPhone(jpStation.getUserPhone());
tdHygfJpInverterWarnDto.setEmail(jpStation.getEmail());
tdHygfJpInverterWarnDto.setAddress(jpStation.getAddress());
tdHygfJpInverterWarnDto.setArea(jpStation.getArea());
if (tdHygfJpInverterWarnDto.getRecoverTime() != null) {
tdHygfJpInverterWarnDto
.setRecoverTimeFormat(TimeUtil.dateFormat(tdHygfJpInverterWarnDto.getRecoverTime()));
tdHygfJpInverterWarnDto.setTimeLongFormat(TimeUtil
.longFormat(tdHygfJpInverterWarnDto.getRecoverTime() - tdHygfJpInverterWarnDto.getStartTime()));
}
if (tdHygfJpInverterWarnDto.getStartTime() != null) {
tdHygfJpInverterWarnDto.setStartTimeFormat(TimeUtil.dateFormat(tdHygfJpInverterWarnDto.getStartTime()));
}
}
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.scheduling.annotation.Async;
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;
...@@ -48,8 +51,14 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends ...@@ -48,8 +51,14 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends
public List<TdHygfJpInvertorElecHistoryDto> dayList(long id, Date day) { public List<TdHygfJpInvertorElecHistoryDto> dayList(long id, Date day) {
JpInverter invertor = jpInvertorServiceImpl.getById(id); JpInverter invertor = jpInvertorServiceImpl.getById(id);
if (invertor != null) { if (invertor != null) {
return this.baseMapper.dayList(invertor.getSnCode(), invertor.getThirdStationId(), List<TdHygfJpInvertorElecHistoryDto> list = this.baseMapper.dayList(invertor.getSnCode(),
TimeUtil.getStartTimeOfDay(day), TimeUtil.getEndTimeOfDay(day)); invertor.getThirdStationId(), TimeUtil.getStartTimeOfDay(day), TimeUtil.getEndTimeOfDay(day));
if (!list.isEmpty()) {
list.forEach(i -> {
i.setTimeFormat(TimeUtil.minuteFormat(i.getTime()));
});
}
return list;
} }
return new ArrayList<>(); return new ArrayList<>();
} }
...@@ -59,9 +68,11 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends ...@@ -59,9 +68,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 +82,11 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends ...@@ -71,9 +82,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 +102,74 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends ...@@ -89,4 +102,74 @@ public class TdHygfJpInvertorElecHistoryServiceImpl extends
} }
return new ArrayList<>(); return new ArrayList<>();
} }
@Async
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.hygf.biz.service.impl; package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.hygf.api.entity.JpPersonStation;
import com.yeejoin.amos.boot.module.hygf.api.entity.MonthPower;
import com.yeejoin.amos.boot.module.hygf.api.entity.YearPower; import com.yeejoin.amos.boot.module.hygf.api.entity.YearPower;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.MonthPowerMapper;
import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.YearPowerMapper; import com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.YearPowerMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IYearPowerService; import com.yeejoin.amos.boot.module.hygf.api.service.IYearPowerService;
import com.yeejoin.amos.boot.module.hygf.api.dto.YearPowerDto; import com.yeejoin.amos.boot.module.hygf.api.dto.YearPowerDto;
import org.springframework.beans.factory.annotation.Autowired;
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.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -17,6 +22,10 @@ import java.util.List; ...@@ -17,6 +22,10 @@ import java.util.List;
*/ */
@Service @Service
public class YearPowerServiceImpl extends BaseService<YearPowerDto,YearPower,YearPowerMapper> implements IYearPowerService { public class YearPowerServiceImpl extends BaseService<YearPowerDto,YearPower,YearPowerMapper> implements IYearPowerService {
@Autowired
MonthPowerMapper monthPowerMapper;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -30,4 +39,8 @@ public class YearPowerServiceImpl extends BaseService<YearPowerDto,YearPower,Yea ...@@ -30,4 +39,8 @@ public class YearPowerServiceImpl extends BaseService<YearPowerDto,YearPower,Yea
public List<YearPowerDto> queryForYearPowerList() { public List<YearPowerDto> queryForYearPowerList() {
return this.queryForList("" , false); return this.queryForList("" , false);
} }
} }
\ No newline at end of file
...@@ -201,3 +201,7 @@ dealer.group=1681241774938419202 ...@@ -201,3 +201,7 @@ dealer.group=1681241774938419202
#户用光伏工程角色 #户用光伏工程角色
dealer.engineering=1679674919488614401 dealer.engineering=1679674919488614401
#定时任务获取曲线信息
cheduled.crons=0 0 1 * * ?
\ 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 cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic; import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.feign.RiskWarningFeign;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ESEquipmentsDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanPointProcessVariableClassification;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanWarningRecordMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanWarningRecordMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
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.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -41,10 +56,27 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -41,10 +56,27 @@ public class BigScreenAnalyseController extends BaseController {
@Autowired @Autowired
StationBasicMapper stationBasicMapper; StationBasicMapper stationBasicMapper;
@Autowired
CommonServiceImpl commonServiceImpl;
@Autowired
IdxBizFanHealthLevelMapper idxBizFanHealthLevelMapper;
@Autowired
IndicatorDataMapper indicatorDataMapper;
@Autowired
RiskWarningFeign riskWarningFeign;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 仪表盘", notes = "场站设备健康状态指数与趋势 - 仪表盘") @ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 仪表盘", notes = "场站设备健康状态指数与趋势 - 仪表盘")
@GetMapping(value = "/getHealthScoreInfo") @GetMapping(value = "/getHealthScoreInfo")
public ResponseModel<Map<String, BigDecimal>> getHealthScoreInfo(@RequestParam(required = false) String areaCode, @RequestParam(required = false) String stationCode) { public ResponseModel<Map<String, BigDecimal>> getHealthScoreInfo(@RequestParam(required = false) String areaCode, @RequestParam(required = false) String stationCode) {
if (StrUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getStationName();
}
HashMap<String, BigDecimal> stringBigDecimalHashMap = new HashMap<>(); HashMap<String, BigDecimal> stringBigDecimalHashMap = new HashMap<>();
stringBigDecimalHashMap.put("value", idxBizFanHealthIndexMapper.getHealthScoreInfo(areaCode, stationCode)); stringBigDecimalHashMap.put("value", idxBizFanHealthIndexMapper.getHealthScoreInfo(areaCode, stationCode));
return ResponseHelper.buildResponse(stringBigDecimalHashMap); return ResponseHelper.buildResponse(stringBigDecimalHashMap);
...@@ -55,6 +87,12 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -55,6 +87,12 @@ public class BigScreenAnalyseController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 折线图", notes = "场站设备健康状态指数与趋势 - 折线图") @ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 折线图", notes = "场站设备健康状态指数与趋势 - 折线图")
@GetMapping(value = "/getHealthListInfo") @GetMapping(value = "/getHealthListInfo")
public ResponseModel<Map<String, Object>> getHealthListInfo(@RequestParam(required = false) String areaCode, @RequestParam(required = false) String stationCode) { public ResponseModel<Map<String, Object>> getHealthListInfo(@RequestParam(required = false) String areaCode, @RequestParam(required = false) String stationCode) {
if (StrUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getStationName();
}
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthListInfo(areaCode, stationCode); List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthListInfo(areaCode, stationCode);
List<String> time = new ArrayList<>(); List<String> time = new ArrayList<>();
...@@ -132,7 +170,7 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -132,7 +170,7 @@ public class BigScreenAnalyseController extends BaseController {
Map<String, BigDecimal> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(), t -> new BigDecimal(t.get("healthIndex").toString()))); Map<String, BigDecimal> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(), t -> new BigDecimal(t.get("healthIndex").toString())));
List<String> list = Arrays.asList("华中片区", "西北片区", "西南片区", "华南片区", "华东片区", "东北片区", "华北片区"); List<String> list = Arrays.asList("华中片区", "西北片区", "西南片区", "华南片区", "华东片区", "东北片区", "华北片区");
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
list.forEach(item -> seriesData.add(collect.getOrDefault(item, new BigDecimal("0")))); list.forEach(item -> seriesData.add(collect.getOrDefault(item, new BigDecimal("100"))));
resultMap.put("axisData", list); resultMap.put("axisData", list);
resultMap.put("seriesData", seriesData); resultMap.put("seriesData", seriesData);
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
...@@ -147,9 +185,16 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -147,9 +185,16 @@ public class BigScreenAnalyseController extends BaseController {
@RequestParam(value = "stationType", required = false) String stationType, @RequestParam(value = "stationType", required = false) String stationType,
@RequestParam(value = "current", required = false) Integer current, @RequestParam(value = "current", required = false) Integer current,
@RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "size", required = false) Integer size,
@RequestParam(value = "warningName", required = false) String warningName) { @RequestParam(value = "warningName", required = false) String warningName,
Integer count = idxBizFanWarningRecordMapper.getEquipWarningInfoByPageCount(arae, station, stationType); @RequestParam(value = "stationId", required = false) String stationId) {
List<IdxBizFanWarningRecord> idxBizFanWarningRecordIPage = idxBizFanWarningRecordMapper.getEquipWarningInfoByPage(arae, station, stationType, (current - 1) * size, size, warningName);
if (StrUtil.isNotEmpty(stationId)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
stationId = stationBasic.getFanGatewayId();
}
Integer count = idxBizFanWarningRecordMapper.getEquipWarningInfoByPageCount(arae, station, stationType, warningName, stationId);
List<IdxBizFanWarningRecord> idxBizFanWarningRecordIPage = idxBizFanWarningRecordMapper.getEquipWarningInfoByPage(arae, station, stationType, (current - 1) * size, size, warningName, stationId);
Page<IdxBizFanWarningRecord> idxBizFanWarningRecordPage = new Page<>(current, size); Page<IdxBizFanWarningRecord> idxBizFanWarningRecordPage = new Page<>(current, size);
idxBizFanWarningRecordPage.setRecords(idxBizFanWarningRecordIPage); idxBizFanWarningRecordPage.setRecords(idxBizFanWarningRecordIPage);
idxBizFanWarningRecordPage.setTotal(count); idxBizFanWarningRecordPage.setTotal(count);
...@@ -211,14 +256,14 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -211,14 +256,14 @@ public class BigScreenAnalyseController extends BaseController {
public ResponseModel<Map<String, Object>> getHealthInfoByArea(@RequestParam(required = false) String areaCode) { public ResponseModel<Map<String, Object>> getHealthInfoByArea(@RequestParam(required = false) String areaCode) {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoByStation(areaCode); List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoByStation(areaCode);
Map<String, BigDecimal> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("area").toString(), t -> new BigDecimal(t.get("healthIndex").toString()))); Map<String, BigDecimal> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("station").toString(), t -> new BigDecimal(t.get("healthIndex").toString())));
List<StationBasic> stationBasics = stationBasicMapper.selectList(new LambdaQueryWrapper<StationBasic>().eq(StationBasic::getAreaName, areaCode)); List<StationBasic> stationBasics = stationBasicMapper.selectList(new LambdaQueryWrapper<StationBasic>().like(StationBasic::getAreaName, areaCode));
List<String> list = stationBasics.stream().map(StationBasic::getStationName).collect(Collectors.toList()); List<String> list = stationBasics.stream().map(StationBasic::getStationName).collect(Collectors.toList());
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
list.forEach(item -> seriesData.add(collect.getOrDefault(item, new BigDecimal("0")))); list.forEach(item -> seriesData.add(collect.getOrDefault(item, new BigDecimal("100"))));
resultMap.put("axisData", list); resultMap.put("axisData", list);
resultMap.put("seriesData", seriesData); resultMap.put("seriesData", seriesData);
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
...@@ -230,21 +275,40 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -230,21 +275,40 @@ public class BigScreenAnalyseController extends BaseController {
@ApiOperation(value = "场站预警信息统计图 - 雷达图", httpMethod = "GET") @ApiOperation(value = "场站预警信息统计图 - 雷达图", httpMethod = "GET")
@GetMapping("/equipWarningRadarMap") @GetMapping("/equipWarningRadarMap")
public ResponseModel<Map<String, Object>> assessIndexRadarMap(@RequestParam(required = false, value = "stationCode") String stationCode) { public ResponseModel<Map<String, Object>> assessIndexRadarMap(@RequestParam(required = false, value = "stationCode") String stationCode) {
if (StrUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getBoosterGatewayId();
}
List<Map<String, Object>> list = idxBizFanHealthIndexMapper.equipWarningRadarMap(stationCode); List<Map<String, Object>> list = idxBizFanHealthIndexMapper.equipWarningRadarMap(stationCode);
HashMap<String, Object> resultMap = new HashMap<>(); Map<String, Integer> warningNumMap = list.stream().collect(Collectors.toMap(t -> t.get("warningName").toString(), t -> Integer.parseInt(t.get("num").toString())));
List<List<String>> resultData = new ArrayList<>(); List<String> warningList = Arrays.asList("危险", "注意", "警告");
List<Integer> data = new ArrayList<>();
List<List<Integer>> resultData = new ArrayList<>();
List<Map<String, Object>> resultList = new ArrayList<>(); List<Map<String, Object>> resultList = new ArrayList<>();
List<String> data = new ArrayList<>(); warningList.forEach(item -> {
list.forEach(item -> {
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put("text", item.get("warningName")); map.put("text", item);
resultList.add(map); resultList.add(map);
data.add(item.get("num").toString()); data.add(warningNumMap.getOrDefault(item, 0));
}); });
resultData.add(data); resultData.add(data);
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("radar", resultList); resultMap.put("radar", resultList);
resultMap.put("array", resultData); resultMap.put("array", resultData);
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
// HashMap<String, Object> resultMap = new HashMap<>();
// List<String> data = new ArrayList<>();
// list.forEach(item -> {
// HashMap<String, Object> map = new HashMap<>();
// map.put("text", item.get("warningName"));
// resultList.add(map);
// data.add(item.get("num").toString());
// });
//
} }
...@@ -305,4 +369,272 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -305,4 +369,272 @@ public class BigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站 左侧风机信息列表")
@GetMapping("/getFanInfoByPage")
public ResponseModel<Page<Map<String, Object>>> getFanInfoByPage(@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper.getFanInfoByPage(stationBasic.getFanGatewayId());
List<Map<String, Object>> healthInfoList = idxBizFanHealthIndexMapper.getFanHealthInfoList(stationBasic.getFanGatewayId());
Map<Object, Double> equipmentHealthIndexMap = healthInfoList.stream().collect(Collectors.toMap(t -> t.get("equipmentName"), t -> Double.parseDouble(t.get("avgHealthIndex").toString())));
equipmentList.forEach(item -> {
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("equipmentName"), 100.0);
if (100.0 == equipmentHealthScore) {
item.put("warningName", "安全");
} else {
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备");
query.eq(IdxBizFanHealthLevel::getStatus, stationBasic.getStationName());
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, equipmentHealthScore);
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, equipmentHealthScore);
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
item.put("warningName", idxBizFanHealthLevel.getHealthLevel());
}
item.put("healthIndex", equipmentHealthScore);
String equipmentName = CharSequenceUtil.replace(item.get("equipmentName").toString(), "集电Ⅳ线#", "");
String replace = CharSequenceUtil.replace(equipmentName, "集电Ⅲ线#", "");
String replace1 = CharSequenceUtil.replace(replace, "集电Ⅱ线#", "");
String replace2 = CharSequenceUtil.replace(replace1, "集电Ⅰ线#", "");
String replace3 = CharSequenceUtil.replace(replace2, "风机系统", "");
item.put("equipmentNameSimple", replace3);
});
Page<Map<String, Object>> mapPage = new Page<>();
mapPage.setSize(equipmentList.size());
mapPage.setTotal(equipmentList.size());
mapPage.setCurrent(1);
mapPage.setRecords(equipmentList);
return ResponseHelper.buildResponse(mapPage);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站 风机子系统状态指数 柱状图")
@GetMapping("/getSubSystemInfo")
public ResponseModel<Map<String, Object>> getSubSystemInfo(@RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getSubSystemInfo(equipmentName, stationBasic.getFanGatewayId());
Map<Object, Double> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("subSystem"), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>();
List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper.getSumSystemListByEquipment(stationBasic.getFanGatewayId(), equipmentName);
equipmentList.forEach(item -> {
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("subSystem"), 100.0);
seriesData.add(equipmentHealthScore);
axisData.add(item.get("subSystem"));
});
resultMap.put("axisData", axisData);
resultMap.put("seriesData", seriesData);
return ResponseHelper.buildResponse(resultMap);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "该子系统各指标预警 - 风站中间 下方列表")
@GetMapping("/getSubSystemPointInfo")
public ResponseModel<Page<Map<String, Object>>> getSubSystemPointInfo(@RequestParam(value = "subSystem", required = false) String subSystem,
@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoBySubSystem(subSystem, stationBasic.getFanGatewayId());
Map<Object, Double> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("pointName"), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper.getPointNameListBySumSystem(stationBasic.getFanGatewayId(), subSystem);
pointNameList.forEach(item -> {
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("pointName"), 100.0);
if (100.0 == equipmentHealthScore) {
item.put("warningName", "安全");
} else {
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备");
query.eq(IdxBizFanHealthLevel::getStatus, stationBasic.getStationName());
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, equipmentHealthScore);
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, equipmentHealthScore);
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
item.put("warningName", idxBizFanHealthLevel.getHealthLevel());
}
item.put("healthIndex", equipmentHealthScore);
});
Page<Map<String, Object>> mapPage = new Page<>();
mapPage.setSize(pointNameList.size());
mapPage.setTotal(pointNameList.size());
mapPage.setCurrent(1);
mapPage.setRecords(pointNameList);
return ResponseHelper.buildResponse(mapPage);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "光伏 左侧风机信息列表")
@GetMapping("/getPvInfoByPage")
public ResponseModel<Page<Map<String, Object>>> getPvInfoByPage(@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper.getPvInfoByPage(stationBasic.getFanGatewayId());
List<Map<String, Object>> healthInfoList = idxBizFanHealthIndexMapper.getPvHealthInfoList(stationBasic.getFanGatewayId());
Map<Object, Double> equipmentHealthIndexMap = healthInfoList.stream().collect(Collectors.toMap(t -> t.get("subarray"), t -> Double.parseDouble(t.get("avgHealthIndex").toString())));
equipmentList.forEach(item -> {
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("subarray"), 100.0);
if (100.0 == equipmentHealthScore) {
item.put("warningName", "安全");
} else {
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备");
query.eq(IdxBizFanHealthLevel::getStatus, stationBasic.getStationName());
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, equipmentHealthScore);
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, equipmentHealthScore);
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
item.put("warningName", idxBizFanHealthLevel.getHealthLevel());
}
item.put("healthIndex", equipmentHealthScore);
});
Page<Map<String, Object>> mapPage = new Page<>();
mapPage.setSize(equipmentList.size());
mapPage.setTotal(equipmentList.size());
mapPage.setCurrent(1);
mapPage.setRecords(equipmentList);
return ResponseHelper.buildResponse(mapPage);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "光伏 子阵下各设备状态指数 柱状图")
@GetMapping("/getPvSubSystemInfo")
public ResponseModel<Map<String, Object>> getPvSubSystemInfo(@RequestParam(value = "subarray", required = false) String subarray,
@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvSubSystemInfo(subarray, stationBasic.getFanGatewayId());
Map<Object, Double> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("equipmentName"), t -> Double.parseDouble(t.get("avgHealthIndex").toString())));
List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>();
List<Map<String, Object>> equipmentList = idxBizFanHealthIndexMapper.getPvSumSystemListByEquipment(stationBasic.getFanGatewayId(), subarray);
equipmentList.forEach(item -> {
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("equipmentName"), 100.0);
seriesData.add(equipmentHealthScore);
axisData.add(item.get("equipmentName"));
});
resultMap.put("axisData", axisData);
resultMap.put("seriesData", seriesData);
return ResponseHelper.buildResponse(resultMap);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "光伏 该装备下各指标预警 - 风站中间 下方列表")
@GetMapping("/getPvSubSystemPointInfo")
public ResponseModel<Page<Map<String, Object>>> getPvSubSystemPointInfo(@RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getPvHealthInfoBySubSystem(equipmentName, stationBasic.getFanGatewayId());
Map<Object, Double> equipmentHealthIndexMap = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("pointName"), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> pointNameList = idxBizFanHealthIndexMapper.getPvPointNameListBySumSystem(stationBasic.getFanGatewayId(), equipmentName);
pointNameList.forEach(item -> {
Double equipmentHealthScore = equipmentHealthIndexMap.getOrDefault(item.get("pointName"), 100.0);
if (100.0 == equipmentHealthScore) {
item.put("warningName", "安全");
} else {
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备");
query.eq(IdxBizFanHealthLevel::getStatus, stationBasic.getStationName());
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, equipmentHealthScore);
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, equipmentHealthScore);
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
item.put("warningName", idxBizFanHealthLevel.getHealthLevel());
}
item.put("healthIndex", equipmentHealthScore);
});
Page<Map<String, Object>> mapPage = new Page<>();
mapPage.setSize(pointNameList.size());
mapPage.setTotal(pointNameList.size());
mapPage.setCurrent(1);
mapPage.setRecords(pointNameList);
return ResponseHelper.buildResponse(mapPage);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站/光伏 右下实时趋势")
@GetMapping("/getTrendInfoByAddress")
public ResponseModel<Map<String, Object>> getTrendInfoByAddress(@RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "stationId", required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
String startTime = DateUtils.convertDateToString(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
String endTime = DateUtils.convertDateToString(currentDayEndTime, DateUtils.DATE_TIME_PATTERN);
List<IndicatorData> indicatorData = indicatorDataMapper.selectDataByAddressAndtime(indexAddress, startTime, endTime, stationBasic.getFanGatewayId());
HashMap<String, Object> resultMap = new HashMap<>();
List<String> time = new ArrayList<>();
List<Object> valueList = new ArrayList<>();
indicatorData.forEach(item -> {
String date = DateUtils.convertDateToString(item.getCreatedTime(), "HH:mm:ss");
time.add(date);
String value = StrUtil.isEmpty(item.getValue()) ? "0.0" : item.getValue();
double v = Double.parseDouble(value);
valueList.add(v);
});
List<Map<String, Object>> arrayList = new ArrayList<>();
HashMap<String, Object> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("data", valueList);
arrayList.add(stringStringHashMap);
resultMap.put("axisData", time);
resultMap.put("seriesData", arrayList);
return ResponseHelper.buildResponse(resultMap);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站/光伏 右下诊断分析")
@GetMapping("/getRiskHandleByVarDesc")
public ResponseModel<Map<String, String>> getRiskHandleByVarDesc(@RequestParam(value = "varDesc", required = false) String varDesc) {
FeignClientResult<List<String>> sevenEntityMcb = null;
try {
sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc);
} catch (Exception e) {
e.printStackTrace();
}
StringBuilder resultString = new StringBuilder();
List<String> result = sevenEntityMcb.getResult();
for (String s : result) {
resultString.append(s);
}
HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("content", resultString.toString());
return ResponseHelper.buildResponse(stringStringHashMap);
}
} }
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;
} }
...@@ -37,4 +37,39 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -37,4 +37,39 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> getAllEquipAlarmInfoAnalysisByArea(@Param("areaCode") String areaCode); 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);
} }
...@@ -19,9 +19,12 @@ public interface IdxBizFanWarningRecordMapper extends BaseMapper<IdxBizFanWarnin ...@@ -19,9 +19,12 @@ public interface IdxBizFanWarningRecordMapper extends BaseMapper<IdxBizFanWarnin
@Param("stationType") String stationType, @Param("stationType") String stationType,
@Param("current") Integer current, @Param("current") Integer current,
@Param("size") Integer size, @Param("size") Integer size,
@Param("warningName") String warningName); @Param("warningName") String warningName,
@Param("stationId") String stationId);
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,
@Param("stationId") String stationId);
} }
...@@ -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;
...@@ -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;
}
} }
...@@ -11,7 +11,7 @@ import java.util.List; ...@@ -11,7 +11,7 @@ import java.util.List;
@Repository @Repository
public interface IndicatorDataMapper extends BaseMapper<IndicatorData> { public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {
@Select("select `value` from iot_data.indicator_data where address=#{address} and createdtime >= #{startTime} and createdtime <= #{endTime} and gateway_id =#{gatewayId}") @Select("select `value`, createdTime, `value_f` as valueF from iot_data.indicator_data where address=#{address} and createdtime >= #{startTime} and createdtime <= #{endTime} and gateway_id =#{gatewayId}")
List<IndicatorData> selectDataByAddressAndtime(@Param("address")String address,@Param("startTime") String startTime, @Param("endTime")String endTime, @Param("gatewayId")String gatewayId); List<IndicatorData> selectDataByAddressAndtime(@Param("address")String address,@Param("startTime") String startTime, @Param("endTime")String endTime, @Param("gatewayId")String gatewayId);
} }
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
AND AND
DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" ) DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode} AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode} AND STATION = #{stationCode}
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" ) AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode} AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode} AND STATION = #{stationCode}
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<where> <where>
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode} AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode} AND STATION = #{stationCode}
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
<where> <where>
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode} AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode} AND STATION = #{stationCode}
...@@ -185,11 +185,12 @@ ...@@ -185,11 +185,12 @@
FROM FROM
idx_biz_fan_health_index idx_biz_fan_health_index
<where> <where>
( STATION IS NOT NULL OR STATION != '' ) STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" ) AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode} AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
GROUP BY GROUP BY
...@@ -197,15 +198,16 @@ ...@@ -197,15 +198,16 @@
( (
SELECT SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex, IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
ARAE STATION
FROM FROM
idx_biz_pv_health_index idx_biz_pv_health_index
<where> <where>
( STATION IS NOT NULL OR STATION != '' ) STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" ) AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE = #{areaCode} AND ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
GROUP BY GROUP BY
...@@ -228,7 +230,7 @@ ...@@ -228,7 +230,7 @@
idx_biz_fan_warning_record idx_biz_fan_warning_record
<where> <where>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
station = #{stationCode} GATEWAY_ID = #{stationCode}
</if> </if>
</where> </where>
UNION ALL UNION ALL
...@@ -238,7 +240,7 @@ ...@@ -238,7 +240,7 @@
idx_biz_pv_warning_record idx_biz_pv_warning_record
<where> <where>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
station = #{stationCode} GATEWAY_ID = #{stationCode}
</if> </if>
</where> </where>
) a ) a
...@@ -255,7 +257,7 @@ ...@@ -255,7 +257,7 @@
${tableName} a ${tableName} a
<where> <where>
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
a.ARAE = #{areaCode} a.ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
group by pointName, group by pointName,
...@@ -277,7 +279,7 @@ ...@@ -277,7 +279,7 @@
idx_biz_pv_warning_record idx_biz_pv_warning_record
<where> <where>
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
ARAE = #{areaCode} ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
GROUP BY GROUP BY
...@@ -291,7 +293,7 @@ ...@@ -291,7 +293,7 @@
idx_biz_fan_warning_record idx_biz_fan_warning_record
<where> <where>
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
ARAE = #{areaCode} ARAE like concat('%', #{areaCode}, '%')
</if> </if>
</where> </where>
GROUP BY GROUP BY
...@@ -302,4 +304,261 @@ ...@@ -302,4 +304,261 @@
a.pointName IS NOT NULL a.pointName IS NOT NULL
AND a.pointName != '' AND a.pointName != ''
</select> </select>
<select id="getSubSystemInfo" resultType="java.util.Map">
SELECT
IFNULL( HEALTH_INDEX, 0 ) AS healthIndex,
SUB_SYSTEM AS subSystem
FROM
idx_biz_fan_health_index
<where>
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="equipmentName != null and equipmentName != ''">
AND EQUIPMENT_NAME = #{equipmentName}
</if>
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
</select>
<select id="getFanInfoByPage" resultType="java.util.Map">
SELECT
EQUIPMENT_NAME as equipmentName,
INDEX_ADDRESS as indexAddress
FROM
idx_biz_fan_point_process_variable_classification
<where>
EQUIPMENT_NAME LIKE '%#%'
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
EQUIPMENT_NAME
ORDER BY
RIGHT(EQUIPMENT_NAME, 6) ASC
</select>
<select id="getFanHealthInfoList" resultType="java.util.Map">
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
EQUIPMENT_NAME as equipmentName
FROM
idx_biz_fan_health_index
<where>
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
EQUIPMENT_NAME
</select>
<select id="getSumSystemListByEquipment" resultType="java.util.Map">
SELECT
SUB_SYSTEM as subSystem,
INDEX_ADDRESS as indexAddress
FROM
idx_biz_fan_point_process_variable_classification
<where>
<if test="equipmentName != null and equipmentName != ''">
AND EQUIPMENT_NAME = #{equipmentName}
</if>
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
SUB_SYSTEM
</select>
<select id="getPointNameListBySumSystem" resultType="java.util.Map">
SELECT
POINT_NAME as pointName,
INDEX_ADDRESS as indexAddress
FROM
idx_biz_fan_point_process_variable_classification
<where>
<if test="subSystem != null and subSystem != ''">
AND SUB_SYSTEM = #{subSystem}
</if>
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
POINT_NAME
</select>
<select id="getHealthInfoBySubSystem" resultType="java.util.Map">
SELECT
IFNULL( avg( HEALTH_INDEX ), 0 ) AS healthIndex,
POINT_NAME AS pointName
FROM
idx_biz_fan_health_index
<where>
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
AND POINT_NAME IS NOT NULL
AND POINT_NAME != ''
<if test="subSystem != null and subSystem != ''">
AND SUB_SYSTEM = #{subSystem}
</if>
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
POINT_NAME
</select>
<select id="getPvInfoByPage" resultType="java.util.Map">
SELECT
SUBARRAY as subarray
FROM
idx_biz_pv_point_process_variable_classification
<where>
<if test="gatewayId != null and gatewayId != ''">
GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
SUBARRAY
</select>
<select id="getPvHealthInfoList" resultType="java.util.Map">
SELECT
IFNULL( round(AVG( HEALTH_INDEX ), 2), 0 ) AS avgHealthIndex,
SUBARRAY as subarray
FROM
idx_biz_pv_health_index
<where>
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = DATE_FORMAT( NOW(), "%Y-%m-%d" )
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY SUBARRAY
order by SUBARRAY
</select>
<select id="getPvSubSystemInfo" resultType="java.util.Map">
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
EQUIPMENT_NAME AS equipmentName
FROM
idx_biz_pv_health_index
<where>
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="subarray != null and subarray != ''">
AND SUBARRAY = #{subarray}
</if>
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
group by EQUIPMENT_NAME
</select>
<select id="getPvSumSystemListByEquipment" resultType="java.util.Map">
SELECT
EQUIPMENT_NAME as equipmentName
FROM
idx_biz_pv_point_process_variable_classification
<where>
<if test="subarray != null and subarray != ''">
AND SUBARRAY = #{subarray}
</if>
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
EQUIPMENT_NAME
</select>
<select id="getPvHealthInfoBySubSystem" resultType="java.util.Map">
SELECT
IFNULL( ROUND(avg( HEALTH_INDEX ), 2), 0 ) AS healthIndex,
POINT_NAME AS pointName
FROM
idx_biz_pv_health_index
<where>
STATION IS NOT NULL
AND STATION != ''
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
AND POINT_NAME IS NOT NULL
AND POINT_NAME != ''
<if test="equipmentName != null and equipmentName != ''">
AND EQUIPMENT_NAME = #{equipmentName}
</if>
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
POINT_NAME
</select>
<select id="getPvPointNameListBySumSystem" resultType="java.util.Map">
SELECT
POINT_NAME as pointName
FROM
idx_biz_pv_point_process_variable_classification
<where>
<if test="equipmentName != null and equipmentName != ''">
AND EQUIPMENT_NAME = #{equipmentName}
</if>
<if test="gatewayId != null and gatewayId != ''">
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
POINT_NAME
</select>
</mapper> </mapper>
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
WARNING_NAME AS warningName, WARNING_NAME AS warningName,
DISPOSOTION_STATE AS disposotionState, DISPOSOTION_STATE AS disposotionState,
ARAE AS arae, ARAE AS arae,
'pv' AS stationType 'pv' AS stationType,
GATEWAY_ID
FROM FROM
idx_biz_pv_warning_record UNION ALL idx_biz_pv_warning_record UNION ALL
SELECT SELECT
...@@ -27,13 +28,14 @@ ...@@ -27,13 +28,14 @@
WARNING_NAME AS warningName, WARNING_NAME AS warningName,
DISPOSOTION_STATE AS disposotionState, DISPOSOTION_STATE AS disposotionState,
ARAE AS arae, ARAE AS arae,
'fan' AS stationType 'fan' AS stationType,
GATEWAY_ID
FROM FROM
idx_biz_fan_warning_record idx_biz_fan_warning_record
) 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('%', #{arae}, '%')
</if> </if>
<if test="station != '' and station != null"> <if test="station != '' and station != null">
AND a.station = #{station} AND a.station = #{station}
...@@ -42,7 +44,10 @@ ...@@ -42,7 +44,10 @@
AND a.stationType = #{stationType} AND a.stationType = #{stationType}
</if> </if>
<if test="warningName != '' and warningName != null"> <if test="warningName != '' and warningName != null">
AND a.WARNING_NAME = #{warningName} AND a.warningName = #{warningName}
</if>
<if test="stationId != '' and stationId != null">
AND a.GATEWAY_ID = #{stationId}
</if> </if>
</where> </where>
limit #{current}, #{size} limit #{current}, #{size}
...@@ -61,7 +66,8 @@ ...@@ -61,7 +66,8 @@
WARNING_NAME AS warningName, WARNING_NAME AS warningName,
DISPOSOTION_STATE AS disposotionState, DISPOSOTION_STATE AS disposotionState,
ARAE AS arae, ARAE AS arae,
'pv' AS stationType 'pv' AS stationType,
GATEWAY_ID
FROM FROM
idx_biz_pv_warning_record UNION ALL idx_biz_pv_warning_record UNION ALL
SELECT SELECT
...@@ -72,13 +78,14 @@ ...@@ -72,13 +78,14 @@
WARNING_NAME AS warningName, WARNING_NAME AS warningName,
DISPOSOTION_STATE AS disposotionState, DISPOSOTION_STATE AS disposotionState,
ARAE AS arae, ARAE AS arae,
'fan' AS stationType 'fan' AS stationType,
GATEWAY_ID
FROM FROM
idx_biz_fan_warning_record idx_biz_fan_warning_record
) 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('%', #{arae}, '%')
</if> </if>
<if test="station != '' and station != null"> <if test="station != '' and station != null">
AND a.station = #{station} AND a.station = #{station}
...@@ -87,7 +94,10 @@ ...@@ -87,7 +94,10 @@
AND a.stationType = #{stationType} AND a.stationType = #{stationType}
</if> </if>
<if test="warningName != '' and warningName != null"> <if test="warningName != '' and warningName != null">
AND a.WARNING_NAME = #{warningName} AND a.warningName = #{warningName}
</if>
<if test="stationId != '' and stationId != null">
AND a.GATEWAY_ID = #{stationId}
</if> </if>
</where> </where>
</select> </select>
......
package com.yeejoin.amos.boot.module.jxiop.api.feign;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
@FeignClient(name = "${mcb.warning.name:MCB-SERVER}", path = "risk", configuration = {FeignConfiguration.class})
public interface RiskWarningFeign {
/**
* 根据风险来源查询人员红黄绿吗信息
*/
@GetMapping("/model-risk-handle/getRiskHandleByVarDesc")
FeignClientResult<List<String>> getRiskHandleByVarDesc(@RequestParam(required = false, value = "varDesc") String varDesc);
}
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