Commit 462e1115 authored by wujiang's avatar wujiang

Merge branch 'developer' of http://36.40.66.175:5000/moa/amos-boot-biz into developer

parents 64b87016 a27d92f2
...@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray; ...@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.api.householdapi.constant.GoodWeConstant; import com.yeejoin.amos.api.householdapi.constant.GoodWeConstant;
import com.yeejoin.amos.api.householdapi.constant.SoFarConstant; import com.yeejoin.amos.api.householdapi.constant.SoFarConstant;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.Sunlight;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -21,6 +22,32 @@ public class SofarRequestUtil { ...@@ -21,6 +22,32 @@ public class SofarRequestUtil {
private final String redisKey = "SOFAR_REQUEST_TOKEN"; private final String redisKey = "SOFAR_REQUEST_TOKEN";
public static final HashMap<String, String> intoNetWorkStatus = new HashMap<String, String>() {
{
put("DISTRIBUTED_FULLY", "分布式全额上网");
put("EXCESS", "分布式自发自用余电上网");
put("OFF_GRID", "离网");
put("BATTERY_BACKUP", "储能系统");
put("GROUND_FULLY", "地面全额上网");
}
};
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
...@@ -65,8 +92,6 @@ public class SofarRequestUtil { ...@@ -65,8 +92,6 @@ public class SofarRequestUtil {
*/ */
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 = "";
JSONArray jsonArray = null;
List<T> result = new ArrayList<>(); List<T> result = new ArrayList<>();
try { try {
...@@ -74,16 +99,36 @@ public class SofarRequestUtil { ...@@ -74,16 +99,36 @@ public class SofarRequestUtil {
String url = SoFarConstant.baseurl + apiurl; String url = SoFarConstant.baseurl + apiurl;
respone = sendRequest(requestMethod, url, requestParmInfo, headMap); respone = sendRequest(requestMethod, url, requestParmInfo, headMap);
JSONObject jsonObject = JSONObject.parseObject(respone); JSONObject jsonObject = JSONObject.parseObject(respone);
// jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone); if(jsonObject!=null&&jsonObject.get(ResultResolveRule)!=null){
// if (!ObjectUtils.isEmpty(jsonArray)) { result = JSONArray.parseArray(fastjson.JSON.toJSONString(jsonObject.get(ResultResolveRule)), tClass);
// result = JSONArray.parseArray(jsonArray.toJSONString(), tClass);
// } }
} catch (Exception exception) { } catch (Exception exception) {
return result; exception.printStackTrace();
} }
return result; return result;
} }
public JSONObject getResPonseobj(String apiurl, String requestMethod, String requestParmInfo, String ResultResolveRule) {
String respone = "";
JSONObject jsonObject = null;
try {
HashMap<String, String> headMap = getHeaderOfSofar();
String url = SoFarConstant.baseurl + apiurl;
respone = sendRequest(requestMethod, url, requestParmInfo, headMap);
if(respone!=null&&JSONObject.parseObject(respone).get(ResultResolveRule)!=null&&ResultResolveRule!=null){
jsonObject = JSONObject.parseObject(JSONObject.parseObject(respone).get(ResultResolveRule).toString());
}else{
jsonObject = JSONObject.parseObject(respone);
}
} catch (Exception exception) {
exception.printStackTrace();
}
return jsonObject;
}
/** /**
* @param resultResovle 请求返回的解析规则 来源与数据库 * @param resultResovle 请求返回的解析规则 来源与数据库
* @param response 请求返回的字符串 * @param response 请求返回的字符串
......
package com.yeejoin.amos.api.householdapi.Utils;
import cn.hutool.core.text.UnicodeUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.google.gson.Gson;
import com.yeejoin.amos.api.householdapi.face.dto.SunlightDto;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.houseapi.HousepvapiRecordsMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClients;
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.naming.Name;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
/**
* @description:
* @author阳光电站采集
* @createDate: 2024/2/29
*/
@Component
@Slf4j
public class SunlightUtil {
public static String dfurl="https://gateway.isolarcloud.com";
public static String appkey="D9A9B8A58FD193EEEFEE0C6BD4664626";
public static String access_key="vz47buat1ibrkf66jfiksmvm7att6sk4";
public static String name="jxiop_jdxny";
public static String pasword="tA9WAgmG4z:48gp";
//场站接口
public static String getPowerStationList= "/openapi/getPowerStationList";
//电站详情
public static String getPowerStationDetail="/openapi/getPowerStationDetail";
//电站设备
public static String getDeviceList="/openapi/getDeviceList";
//月,年
public static String getDevicePointsDayMonthYearDataList="/openapi/getDevicePointsDayMonthYearDataList";
//逆变器参数
public static String getPVInverterRealTimeData="/openapi/getPVInverterRealTimeData";
//告警
public static String getFaultAlarmInfo= "/openapi/getFaultAlarmInfo";
public static final HashMap<String, String> intoNetWorkStatus = new HashMap<String, String>() {
{
put("1", "全额上网");
put("2", ":自发自用,余电上网");
put("3", "自发自用,无馈网");
put("4", "离网");
}
};
// public static final HashMap<String, Double> co = new HashMap<String, Double>() {
// {
// put("克",0.001 );
// put("千克", );
// put("吨", );
// put("千吨", );
// }
// };
public static final HashMap<String, Double> zj = new HashMap<String, Double>() {
{
put("Wp", 0.001);
put("kWp", 1.0);
put("MWp",1000.0 );
put("GWp", 1000000.0);
}
};
public static final HashMap<String, Double> fd = new HashMap<String, Double>() {
{
put("度", 1.0);
put("千度", 1000.0);
put("万度", 10000.0);
put("亿度", 100000000.0);
}
};
public static final HashMap<String, Double> sy = new HashMap<String, Double>() {
{
put("元", 1.0);
put("万元", 10000.0);
put("亿元", 100000000.0);
}
};
public static final HashMap<String, Double> GL = new HashMap<String, Double>() {
{
put("W", 0.001);
put("kW", 1.0);
put("MW", 1000.0);
put("GW", 1000000.0);
}
};
public static final HashMap<String, String> zt= new HashMap<String, String>() {
{
put("1", "在线");
put("0", "离线");
put("2","报警" );
}
};
public static final HashMap<String, String> alarmLevel = new HashMap<String, String>() {
{
put("1", "重要");
put("2", "次要");
put("3", "一般");
put("3", "轻微");
}
};
public static final HashMap<String, String> alarmstatus = new HashMap<String, String>() {
{
put("1", "未确认");
put("2", "待处理");
put("3", "处理中");
put("4", "已解决");
put("5", "已关闭");
}
};
private static final String redisKey = "YG-TOKEN";
@Autowired
RedisUtils redisUtils;
/*
*
* 登录获取token
* */
public String getSunlightToken(){
String token=null;
try {
Object o = redisUtils.get(redisKey);
if(o != null) {
return o.toString();
}
//请求头
HttpRequest request = HttpUtil.createPost(dfurl+"/openapi/login");
request.header("Content-Type", "application/json;charset=UTF-8");
request.header("sys_code", "901");
request.header("x-access-key", access_key);
//请求body
Map<String, String> param = new HashMap();
param.put("appkey", appkey);
param.put("user_account", name);
param.put("user_password", pasword);
Gson gson = new Gson();
String body = gson.toJson(param);
request.body(body);
HttpResponse execute = request.execute();
if (!execute.isOk()) {
log.error("请求token失败,body={},execute={}", execute.body(), execute);
throw new RuntimeException(execute.body());
}
String res = UnicodeUtil.toString(execute.body());
JSONObject jsonObject = JSONUtil.parseObj(res, true);
if (!jsonObject.get("result_msg").toString().equals("success")){
log.error("请求失败,code={},result={}", jsonObject.get("result_msg"), jsonObject);
throw new RuntimeException("请求失败!");
}
JSONObject resultData = JSONUtil.parseObj(jsonObject.get("result_data"), true);
if (!resultData.get("login_state").toString().equals("1")) {
log.error("获取token失败,code={},msg={},result={}", resultData.get("login_state"), resultData.get("msg"), resultData);
throw new RuntimeException("获取token失败,code=" + resultData.get("login_state") + ",msg=" + resultData.get("msg"));
}
redisUtils.set(redisKey,resultData.get("token").toString(),14400 );
return resultData.get("token").toString();
} catch (Exception e) {
log.error("requestToken失败,msg={}", e.getMessage());
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
//获取接口数据
public JSONObject getdata(String url,Map<String, Object> bodyparam ){
String data=null;
try {
//请求头
HttpRequest request = HttpUtil.createPost(dfurl+url);
request.header("Content-Type", "application/json;charset=UTF-8");
request.header("sys_code", "901");
request.header("x-access-key", access_key);
//请求body
bodyparam.put("appkey", appkey);
bodyparam.put("token", this.getSunlightToken());
Gson gson = new Gson();
String body = gson.toJson(bodyparam);
request.body(body);
HttpResponse execute = request.execute();
if (!execute.isOk()) {
throw new RuntimeException(execute.body());
}
String res = UnicodeUtil.toString(execute.body());
JSONObject jsonObject = JSONUtil.parseObj(res, true);
JSONObject resultData = JSONUtil.parseObj(jsonObject.get("result_data"), true);
return resultData;
} catch (Exception e) {
log.error("失败,msg={}", e.getMessage());
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
}
}
...@@ -9,13 +9,16 @@ import java.util.HashMap; ...@@ -9,13 +9,16 @@ import java.util.HashMap;
public class SoFarConstant { public class SoFarConstant {
public static final HashMap<String, String> stationStaus = new HashMap<String, String>() { public static final HashMap<String, String> stationStaus = new HashMap<String, String>() {
{ {
put("-1", "离线"); put("1", "在线");
put("0", "待机"); put("0", "离线");
put("1", "正常"); put("2","报警" );
put("2", "停机");
} }
}; };
public static String baseurl = "https://openapi.sofarsolarmonitor.com"; public static String baseurl = "https://openapi.sofarsolarmonitor.com";
public static String appId = "447430219192733696"; public static String appId = "447430219192733696";
public static String appSecret = "5881ee8c062817016a2b34425c45937d"; public static String appSecret = "5881ee8c062817016a2b34425c45937d";
...@@ -26,6 +29,12 @@ public class SoFarConstant { ...@@ -26,6 +29,12 @@ public class SoFarConstant {
public static String tokenurl = "/account/auth/createToken"; public static String tokenurl = "/account/auth/createToken";
public static String stationListUrl = "/station/v1.0/list"; public static String stationListUrl = "/station/v1.0/list";
public static String stationUrl = "/station/v1.0/base";
public static String currentData = "/device/v1.0/currentData";
public static String nbqlist = "/station/v1.0/device?language=zh";
public static String historical = "/device/v1.0/historical";
public static String stationListStatusUrl = "/api/OpenApi/QueryPowerStationMonitor"; public static String stationListStatusUrl = "/api/OpenApi/QueryPowerStationMonitor";
public static String stationDetailUrl = "/api/OpenApi/GetPowerStationMonitorDetail"; public static String stationDetailUrl = "/api/OpenApi/GetPowerStationMonitorDetail";
public static String collectorListUrl = "/v1/api/collectorList"; public static String collectorListUrl = "/v1/api/collectorList";
...@@ -42,7 +51,11 @@ public class SoFarConstant { ...@@ -42,7 +51,11 @@ public class SoFarConstant {
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_list = "data,list"; public static String resovleRule_data_list = "data,list";
public static String resovleRule_data_records = "data,records"; public static String resovleRule_data_records = "data,records";
public static String resovleRule_data = "data"; public static String resovleRule_data = "stationList";
public static String deviceListItems = "deviceListItems";
public static String dataList = "dataList";
public static String paramDataList = "paramDataList";
public static String requestPost = "POST"; public static String requestPost = "POST";
public static String requestGet = "GET"; public static String requestGet = "GET";
public static String datePattern = "yyyy-MM-dd HH:mm:ss.SSS"; public static String datePattern = "yyyy-MM-dd HH:mm:ss.SSS";
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.api.householdapi.controller; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.api.householdapi.controller;
import com.yeejoin.amos.api.householdapi.Utils.GoodWeRequestUtil; import com.yeejoin.amos.api.householdapi.Utils.GoodWeRequestUtil;
import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils; import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
import com.yeejoin.amos.api.householdapi.face.dto.GoodWEGenStation;
import com.yeejoin.amos.api.householdapi.face.service.*; import com.yeejoin.amos.api.householdapi.face.service.*;
import com.yeejoin.amos.api.householdapi.face.service.impl.ImasterDataServiceImpl; import com.yeejoin.amos.api.householdapi.face.service.impl.ImasterDataServiceImpl;
import com.yeejoin.amos.api.householdapi.face.service.impl.SofarDataAcquisitionServiceImpl; import com.yeejoin.amos.api.householdapi.face.service.impl.SofarDataAcquisitionServiceImpl;
...@@ -52,7 +53,15 @@ public class HouseholdTestController { ...@@ -52,7 +53,15 @@ public class HouseholdTestController {
@ApiOperation(httpMethod = "POST", value = "固德威示例", notes = "固德威示例") @ApiOperation(httpMethod = "POST", value = "固德威示例", notes = "固德威示例")
public void goodweDemo() throws IOException { public void goodweDemo() throws IOException {
// goodWeDataAcquisitionService.stationList(); // goodWeDataAcquisitionService.stationList();
goodWeDataAcquisitionService.stationDetail(); // goodWeDataAcquisitionService.stationDetail();
// goodWeDataAcquisitionService.inverAlramInfo();
// goodWeDataAcquisitionService.inverterList();
// goodWeDataAcquisitionService.inverterDetail();
// goodWeDataAcquisitionService.stationMonthGen();
// goodWeDataAcquisitionService.stationYearGen();
// goodWeDataAcquisitionService.inverterDetail();
goodWeDataAcquisitionService.inverterMonthGen();
goodWeDataAcquisitionService.inverterYearGen();
} }
/** /**
......
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
// 固德威实时数据
@Data
public class D {
public double vpv3;
public double vpv2;
public double vpv1;
public double fac3;
public double fac2;
public double fac1;
public double vpv4;
public double ipv2;
public double pac;
public double ipv1;
public double ipv4;
public double ipv3;
public double eDay;
public double vac3;
public String creationDate;
public double istr9;
public double vac2;
public double istr8;
public double vac1;
public double istr5;
public double istr10;
public double istr4;
public double eTotal;
public double istr7;
public double istr6;
public double istr1;
public double iac2;
public double istr3;
public double iac1;
public double hTotal;
public double istr2;
public double iac3;
public double istr16;
public double istr15;
public double istr14;
public double istr13;
public double istr12;
public double istr11;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
/**
* @description:
* @author: tw
* @createDate: 2024/3/4
*/
@Data
public class Device {
private Integer chnnl_id;//设备通道 ID
private String type_name;//设备类型名称
private String ps_key;//设备的 ps_key,查询设备数据需要用到
private String device_sn;//设备的 SN
private String dev_status;//设备当前在线离线状态
private String dev_fault_status;//设备当前故障状态设备故障状态:
private Integer device_type;//设备类型编码
private String factory_name;//生产厂家名
private Integer uuid;//设备 uuid
private String grid_connection_date;//电网连接日期
private String device_name;//设备名称
private Integer rel_state;//设备认领状态:
private Integer device_code;//设备地址编码
private Integer ps_id;//电站id
private Integer device_model_id;//设备型号 ID
private String communication_dev_sn;//设备对应的通信设备的 SN
private String device_model_code;//设备型号名称
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
@Data
public class GoodWEGenStation {
private String date;
private String power;
private String income;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
import org.joda.time.DateTime;
@Data
public class GoodWeAlarmDto {
// stationId string 电站 ID
// adcode string 区域编码
// stationname string 电站名称
// devicesn string 设备 SN
// warningid string 告警 id
// warningname string 告警名称
// status int 状态 1:已处理 0:未处理
// happentime Datetime? 发生时间
// recoverytime Datetime? 恢复时间
// is_add_task Int 是否派送 1:已派送 2:未派送
// error_code string 错误编码-详细参考 3.3 告警错误
private String stationId;
private String adcode;
private String stationname;
private String devicesn;
private String warningid;
private String warningname;
private Integer status;
private DateTime happentime;
private DateTime recoverytime;
private Integer is_add_task;
private String error_code;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
@Data
public class GoodWeINverterDetailDto {
private String id;
private String pw_id;
private String it_name;
private String it_sn;
private String it_type;
private Double it_capacity;
private Double it_checkcode;
private String conn_date;
private Boolean it_change_flag;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
@Data
public class GoodWeInverterCurrentDataDto {
public int error_original;
public D d;
public double out_pac;
public String type;
public double etotal;
public double capacity;
public double tempperature;
public String turnon_time;
public String check_code;
public String name;
public double eday;
public boolean it_change_flag;
public String sn;
public double in_pac;
public int status;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
@Data
public class GoodWeStationMonitorDto {
private String powerstation_id;
private String stationname;
private String first_letter;
private String adcode;
private String location;
private Integer status;
private Double pac;
private Double capacity;
private Double eday;
private Double emonth;
private Double eday_income;
private Double etotal;
private Double etotal_income;
private String powerstation_type;
private String pre_org_id;
private String org_id;
private String longitude;
private String latitude;
private Double pac_kw;
private Double to_hour;
private String currency;
private Double yield_rate;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
/**
* @description:
* @author: tw
* @createDate: 2024/3/8
*/
@Data
public class SofarInverterDto {
private String key;
private String value;
private String name;
private String unit;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/3/8
*/
@Data
public class Sofarhistorical {
private String collectTime;
private List<SofarInverterDto> dataList;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
import java.util.Map;
/**
* @description:
* @author: tw
* @createDate: 2024/3/4
*/
@Data
public class SunlightDto {
private Integer ps_id ;// 11 电站 ID
private String ps_name ;// 电站名称
private String share_type; // 1 电站的分享类型 1:分享类型(浏览权限)2:分享类型(管理权限)0:非分享电站(本人电站)
// 1:地面电站
//3:分布式光伏
//4:户用光伏
//5:户用储能
//6;村级电站
//7:分布式储能
//8:扶贫电站
//9:风能电站
private Integer ps_type ;
private Integer valid_flag ; //电站状态1:正常,2:停用, 3:接入中
private String install_date;// 建站时间
private String ps_current_time_zone;// 电站当前时区
private String ps_location ; //电站位置
private String description ;//电站简介
private Double longitude; // 32 经度
private Double latitude;// Double 32 纬度
private Integer fault_count; //故障数量
private Integer alarm_count;// 告警数量
private Integer ps_status ;// 电站状态
private Integer ps_fault_status;// 电站故障状态
private Integer build_status ;// 电站建设状态
private Integer connect_type;// 并网类型:
private String total_energy_update_time;//电站累计发电量最后更新时间格式:yyyy-MM-dd'T'HH:mm:ssXXX
private String today_energy_update_time; //今日发电量最后更新时间格式:yyyy-MM-dd'T'HH:mm:ssXXX
private String cur_power_update_time;//当前功率最后更新时间
private String today_income_update_time;//今日收益最后更新时间
private String total_income_update_time;//累计收益最后更新时间
private String co2_reduce_update_time;//减排最后更新时间格式:yyyy-MM-dd'T'HH:mm:ssXXX
private String co2_reduce_total_update_time;//co2 减排最后更新时间格式:yyyy-MM-dd'T'HH:mm:ssXXX
private String total_capcity_update_time;//总装机量最后更新时间
private String equivalent_hour_update_time;//今日等效小时最后更新时间格式:yyyy-MM-dd'T'HH:mm:ssXXX
private Map<String,String> total_energy ;// 电站累计发电<value,unit>
private Map<String,String> today_energy ;// 电站今日发电<value,unit>
private Map<String,String> curr_power ;// 当前功率<value,unit>
private Map<String,String> today_income ;// 今日收益<value,unit>
private Map<String,String> total_income ;// 累计收益<value,unit>
private Map<String,String> co2_reduce ;// 今日 CO2 减排<value,unit>
private Map<String,String> co2_reduce_total ;// 累计 CO2 减排<value,unit>
private Map<String,String> total_capcity ;// 总装机量<value,unit>
private Map<String,String> equivalent_hour ;// 今日等效小时<value,unit>
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
/**
* @description:
* @author: tw
* @createDate: 2024/3/4
*/
@Data
public class SunlightMap {
private String unit ;// 数值单位
private String value ;//数值
}
package com.yeejoin.amos.api.householdapi.face.dto;
import lombok.Data;
/**
* @description:
* @author: tw
* @createDate: 2024/3/6
*/
@Data
public class SunlightWarm {
private Integer ps_id;//电站 id
private String ps_key ;// 设备 ps_key
private String fault_code ;// 故障唯一 id
private Integer fault_type_code ;// 故障类型编码
private Integer fault_type ;// 故障类型:
private Integer fault_level ;// 故障级别:
private Integer process_status ;// 故障处理状态:
private String fault_name ;// 故障名称
private String fault_desc ;// 故障描述
private String type_name ;// 设备类型名称
private String ps_name ;// 电站名称
private String device_name ;// 设备名称
private String device_model_code ;// 设备型号
private Integer uuid ;// 设备的 uuid
private String create_time ;// 故障发生时间
private String over_time ;// 故障的恢复时间
}
...@@ -35,7 +35,15 @@ public class GoodWeStationDetail { ...@@ -35,7 +35,15 @@ public class GoodWeStationDetail {
private Double pac; private Double pac;
@TableField("eday") @TableField("eday")
private Double eday; private Double eday;
@TableField(exist = false)
private Double emonth;
@TableField(exist = false)
private Double eday_income;
@TableField("etotal") @TableField("etotal")
private Double etotal; private Double etotal;
@TableField(exist = false)
private Double etotal_income;
@TableField(exist = false)
private Double yield_rate;
} }
...@@ -25,8 +25,14 @@ public class GoodWeStationMonitorList { ...@@ -25,8 +25,14 @@ public class GoodWeStationMonitorList {
private Double capacity; private Double capacity;
@TableField("eday") @TableField("eday")
private Double eday; private Double eday;
@TableField(exist = false)
private Double eday_income;
@TableField("etotal") @TableField("etotal")
private Double etotal; private Double etotal;
@TableField(exist = false)
private Double emonth;
@TableField(exist = false)
private Double etotal_income;
@TableField("powerstation_type") @TableField("powerstation_type")
private String powerstation_type; private String powerstation_type;
@TableField("longitude") @TableField("longitude")
...@@ -37,4 +43,17 @@ public class GoodWeStationMonitorList { ...@@ -37,4 +43,17 @@ public class GoodWeStationMonitorList {
private Double pac_kw; private Double pac_kw;
@TableField("to_hour") @TableField("to_hour")
private Double to_hour; private Double to_hour;
@TableField(exist = false)
private Double currency;
@TableField(exist = false)
private Double yield_rate;
@TableField("address")
private String address;
@TableField("owner_name")
private String owner_name;
@TableField("owner_phone")
private String owner_phone;
@TableField("turnon_time")
private String turnon_time;
} }
...@@ -21,4 +21,5 @@ public class HYGFJPInverterWarn implements Serializable { ...@@ -21,4 +21,5 @@ public class HYGFJPInverterWarn implements Serializable {
private String thirdStationId; private String thirdStationId;
private String thirdCode; private String thirdCode;
private String state; private String state;
private String warnId;
} }
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* @description:
* @author: tw
* @createDate: 2024/3/7
*/
@Data
@TableName(value = "sofar_inverter_list" ,autoResultMap = true)
public class SofarInverter {
private Long deviceId;// 设备ID
private String deviceSn;// 设备SN
private Integer connectStatus;// 设备当前状态(1在线;2报警;3离线)
private String deviceType;// 设备类型(1逆变器;2采集器;3电表;4电池;5汇流箱;)
private Long collectionTime;// 设备更新时间
}
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* @description:
* @author: tw
* @createDate: 2024/3/7
*/
//电站
@Data
@TableName(value = "sofar_station_list" ,autoResultMap = true)
public class SofarStationList {
private Long createdTime;
private Integer batterySoc;//电池容量
private Long createDate ;//创建时间
private Integer generationPower ;// 发电功率
private String gridInterconnectionType ;// 并网类型,如:DISTRIBUTED_FULLY
private Long id ;//电站id
private Integer installedCapacity ;// 装机容量
private Long lastUpdateTime ;//电站的最后一条数据更新时间
private String locationAddress ;// 详细地址
private Integer locationLat ;// 纬度
private Integer locationLng ;// 经度
private String name ;// 电站名称
private String networkStatus ;// 通信状态
private Integer regionLevel1 ;// 行政区1
private Integer regionLevel2 ;// 行政区2
private Integer regionLevel3 ;// 行政区3
private Integer regionLevel4 ;// 行政区4
private Integer regionLevel5 ;// 行政区5
private String stationImage ;// 电站封面
private Long startOperatingTime ;//开始运行时间
private String type ;// 电站类型,如:HOUSE_ROOF
}
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* @description:
* @author: tw
* @createDate: 2024/3/4
*/
@Data
@TableName(value = "sunlight_station_list" ,autoResultMap = true)
public class Sunlight implements Serializable {
private Long createdTime;
private Integer psId ; //id
private String psName ; //电站名称
private Integer validFlag ;// 电站状态
private String psLocation; //电站位置
private String description; //电站简介
private Double longitude; //经度
private Double latitude; //纬度
private Integer psStatus; //电站状态
private Integer psFaultStatus; //电站故障状态
}
...@@ -4,7 +4,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,7 +4,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverter; import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverter;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface JpInverterMapper extends BaseMapper<JpInverter> { public interface JpInverterMapper extends BaseMapper<JpInverter> {
@Select("SELECT sum(current_power) FROM hygf_jp_inverter WHERE third_code='HW'") @Select("SELECT sum(current_power) FROM hygf_jp_inverter WHERE third_code='HW'")
Double getHuaWeiStationCurrentPower(); Double getHuaWeiStationCurrentPower();
@Select("select sn_code from hygf_jp_inverter where third_code='GOODWE'")
List<String> getGoodWeSnCodes();
} }
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.SofarStationList;
/**
* @description:
* @author: tw
* @createDate: 2024/3/7
*/
public interface SofarStationListMapper extends BaseMapper<SofarStationList> {
}
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.Sunlight;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/3/4
*/
public interface SunlightMapper extends BaseMapper<Sunlight> {
@Select("select psId from sunlight_station_list group by psId")
List<String> getStationIds();
}
...@@ -9,6 +9,9 @@ public interface GoodWeDataAcquisitionService { ...@@ -9,6 +9,9 @@ public interface GoodWeDataAcquisitionService {
* @descrption 场站详情数据入库 * @descrption 场站详情数据入库
*/ */
void stationDetail(); void stationDetail();
void stationMonthGen();
void stationYearGen();
/** /**
* @descrption 采集器列表数据入库 * @descrption 采集器列表数据入库
*/ */
...@@ -25,6 +28,10 @@ public interface GoodWeDataAcquisitionService { ...@@ -25,6 +28,10 @@ public interface GoodWeDataAcquisitionService {
* @descrption 逆变器详情数据入库 * @descrption 逆变器详情数据入库
*/ */
void inverterDetail(); void inverterDetail();
void inverterMonthGen();
void inverterYearGen();
/** /**
* @descrption 采集器告警列表数据入库 * @descrption 采集器告警列表数据入库
*/ */
......
package com.yeejoin.amos.api.householdapi.face.service; package com.yeejoin.amos.api.householdapi.face.service;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.SofarInverter;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.SofarStationList;
import java.util.List;
import java.util.Map;
public interface SofarDataAcquisitionService { public interface SofarDataAcquisitionService {
/** /**
* @descrption 场站列表数据入库 * @descrption 场站列表数据入库
...@@ -8,11 +15,11 @@ public interface SofarDataAcquisitionService { ...@@ -8,11 +15,11 @@ public interface SofarDataAcquisitionService {
/** /**
* @descrption 场站详情数据入库 * @descrption 场站详情数据入库
*/ */
void stationDetail(); void stationDetail(List<SofarStationList> jsonObject);
/** /**
* @descrption 采集器列表数据入库 * @descrption 采集器列表数据入库
*/ */
void collectorList(); void collectorList( List<SofarStationList> jsonObject);
/** /**
* @descrption 采集器详情数据入库 * @descrption 采集器详情数据入库
*/ */
...@@ -20,7 +27,7 @@ public interface SofarDataAcquisitionService { ...@@ -20,7 +27,7 @@ public interface SofarDataAcquisitionService {
/** /**
* @descrption 逆变器列表数据入库 * @descrption 逆变器列表数据入库
*/ */
void inverterList(); void inverterList(SofarInverter sofarInverter, JpStation jpStation, Map<String, String> maps);
/** /**
* @descrption 逆变器详情数据入库 * @descrption 逆变器详情数据入库
*/ */
......
package com.yeejoin.amos.api.householdapi.face.service;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.KsolarStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.SunlightMapper;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @description:
* @author: tw
* @createDate: 2024/3/4
*/
public interface SunlightService {
/**
* @descrption 场站列表数据入td库
*/
void stationList();
/**
* 告警信息
* */
void inverAlramInfo();
}
...@@ -4,10 +4,11 @@ package com.yeejoin.amos.openapi.enums; ...@@ -4,10 +4,11 @@ package com.yeejoin.amos.openapi.enums;
public enum PVProducerInfoEnum { public enum PVProducerInfoEnum {
GDW("固德威","GDW"), GDW("固德威","GOODWE"),
SH("首航","SH"), SH("首航","SH"),
JLY("锦浪云","JLY"), JLY("锦浪云","JLY"),
KSOLAR("科士达","KSD"), KSOLAR("科士达","KSD"),
YG("阳光","YG"),
HUAWEI("华为","HW"); HUAWEI("华为","HW");
private String name; private String name;
......
...@@ -5,19 +5,19 @@ server.port=11006 ...@@ -5,19 +5,19 @@ server.port=11006
## DB properties hygf ## DB properties hygf
## db1-production database ## db1-production database
spring.db1.datasource.type: com.alibaba.druid.pool.DruidDataSource spring.db1.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db1.datasource.url=jdbc:mysql://172.16.10.220:3306/amos_openapi?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8 spring.db1.datasource.url=jdbc:mysql://47.92.234.253:3306/amos_openapi?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db1.datasource.username=root spring.db1.datasource.username=root
spring.db1.datasource.password=Yeejoin@2020 spring.db1.datasource.password=Yeejoin@2020
spring.db1.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.db1.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
## db2-sync_data ## db2-sync_data
spring.db2.datasource.type: com.alibaba.druid.pool.DruidDataSource spring.db2.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db2.datasource.url=jdbc:mysql://47.92.234.253:3306/amos_project_2023?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8 spring.db2.datasource.url=jdbc:mysql://47.92.234.253:3306/amos_project?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db2.datasource.username=root spring.db2.datasource.username=root
spring.db2.datasource.password=Yeejoin@2020 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&characterEncoding=utf8 spring.db3.datasource.url=jdbc:TAOS-RS://47.92.234.253: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
...@@ -25,7 +25,7 @@ spring.db3.datasource.driver-class-name=com.taosdata.jdbc.rs.RestfulDriver ...@@ -25,7 +25,7 @@ spring.db3.datasource.driver-class-name=com.taosdata.jdbc.rs.RestfulDriver
# REDIS (RedisProperties) # REDIS (RedisProperties)
spring.redis.database=1 spring.redis.database=1
spring.redis.host=172.16.10.220 spring.redis.host=47.92.234.253
spring.redis.port=6379 spring.redis.port=6379
spring.redis.password=yeejoin@2020 spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200 spring.redis.lettuce.pool.max-active=200
...@@ -35,7 +35,7 @@ spring.redis.lettuce.pool.min-idle=0 ...@@ -35,7 +35,7 @@ spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300 spring.redis.expire.time=300
#注册中心地址 #注册中心地址
eureka.client.service-url.defaultZone =http://172.16.10.220:10001/eureka/ eureka.client.service-url.defaultZone =http://admin:a1234560@47.92.234.253:10001/eureka/
eureka.instance.prefer-ip-address=true eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=* management.endpoints.web.exposure.include=*
...@@ -49,7 +49,7 @@ eureka.instance.instance-id=${eureka.instance.ip-address}:${server.port} ...@@ -49,7 +49,7 @@ eureka.instance.instance-id=${eureka.instance.ip-address}:${server.port}
##emqx ##emqx
emqx.clean-session=true emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.220:1883 emqx.broker=tcp://47.92.234.253:1883
emqx.client-user-name=admin emqx.client-user-name=admin
emqx.client-password=public emqx.client-password=public
...@@ -69,6 +69,11 @@ biz.lxyd.lift.url=http://39.106.181.149:8088/elevatorapi ...@@ -69,6 +69,11 @@ biz.lxyd.lift.url=http://39.106.181.149:8088/elevatorapi
# ?????????? # ??????????
dataRequstScheduled.jinlangyun=0 0/10 * * * * dataRequstScheduled.jinlangyun=0 0/50 * * * *
dataRequstScheduled.huawei=0 0/10 * * * * dataRequstScheduled.huawei=0 0/50 * * * *
dataRequstScheduled.keshida=0 0/10 * * * * dataRequstScheduled.keshida=0 0/50 * * * *
\ No newline at end of file
dataRequstScheduled.Sunlight=0 0/50 * * * *
dataRequstScheduled.Sofar=0 0/3 * * * *
\ No newline at end of file
...@@ -391,6 +391,9 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -391,6 +391,9 @@ public class IdxBizFanHealthIndexController extends BaseController {
startTimeTop = formatter.format(startDate); startTimeTop = formatter.format(startDate);
} }
List<String> gatewayIds = this.getGatewayIds(); List<String> gatewayIds = this.getGatewayIds();
if(this.getGatewayIds().size()==0){
gatewayIds= Arrays.asList("qweqweqweqweqweqwe");
}
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, gatewayIds); List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, gatewayIds);
fanHealthIndexDays.forEach(item -> { fanHealthIndexDays.forEach(item -> {
...@@ -568,8 +571,10 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -568,8 +571,10 @@ public class IdxBizFanHealthIndexController extends BaseController {
@RequestParam(value = "subSystem",required = false) String subSystem, @RequestParam(value = "subSystem",required = false) String subSystem,
@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){
List<String> gatewayIds = this.getGatewayIds();
if(this.getGatewayIds().size()==0){
gatewayIds= Arrays.asList("qweqweqweqweqweqwe");
}
if (requiredType.equals("按天")){ if (requiredType.equals("按天")){
// if (null != type && type.equals("0")){ // if (null != type && type.equals("0")){
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date()); Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
...@@ -583,7 +588,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -583,7 +588,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); // Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate); // startTimeTop = formatter.format(startDate);
// } // }
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, null); List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, gatewayIds);
fanHealthIndexDays.forEach(item -> { fanHealthIndexDays.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex()))); item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
}); });
...@@ -608,7 +613,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -608,7 +613,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); // Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate); // startTimeTop = formatter.format(startDate);
// } // }
List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, null); List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, gatewayIds);
fanHealthIndexHours.forEach(item -> { fanHealthIndexHours.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex()))); item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
}); });
...@@ -632,7 +637,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -632,7 +637,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); // Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate); // startTimeTop = formatter.format(startDate);
// } // }
List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, null); List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, gatewayIds);
fanHealthIndexMoments.forEach(item -> { fanHealthIndexMoments.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex()))); item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
}); });
......
...@@ -265,6 +265,9 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -265,6 +265,9 @@ public class IdxBizPvHealthIndexController extends BaseController {
List<String> gatewayIds = this.getGatewayIds(); List<String> gatewayIds = this.getGatewayIds();
if(gatewayIds.size()==0){
gatewayIds = Arrays.asList("qweqweqweqeqwqweqw");
}
if (requiredType.equals("按天")){ if (requiredType.equals("按天")){
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date()); Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -9); Date date = DateUtils.dateAddHours(startDayTime, -9);
......
...@@ -380,13 +380,14 @@ public class KafkaAnalyseController { ...@@ -380,13 +380,14 @@ public class KafkaAnalyseController {
if (rootNodeName.equals("all")) { if (rootNodeName.equals("all")) {
return fullViewRecallInfoDTOS; return fullViewRecallInfoDTOS;
} else { } else {
List<FullViewRecallInfoDTO> fullViewRecallInfoDTOS1 = fullViewRecallInfoDTOS.get(0).getChildren().stream().filter(item -> item.getName().equals(rootNodeName)).collect(Collectors.toList()); List<String> stringList = Arrays.asList(rootNodeName,rootNodeName.replace("片区","区域"),rootNodeName.replace("区域","片区"),rootNodeName.replace("电站","电场"),rootNodeName.replace("电场","电站"));
List<FullViewRecallInfoDTO> fullViewRecallInfoDTOS1 = fullViewRecallInfoDTOS.get(0).getChildren().stream().filter(item -> stringList.contains(item.getName())).collect(Collectors.toList());
if (fullViewRecallInfoDTOS1.size() > 0) { if (fullViewRecallInfoDTOS1.size() > 0) {
return fullViewRecallInfoDTOS1; return fullViewRecallInfoDTOS1;
} else { } else {
List<FullViewRecallInfoDTO> fullViewRecallInfoDTOS2 = fullViewRecallInfoDTOS.get(0).getChildren(); List<FullViewRecallInfoDTO> fullViewRecallInfoDTOS2 = fullViewRecallInfoDTOS.get(0).getChildren();
for (FullViewRecallInfoDTO fullViewRecallInfoDTO : fullViewRecallInfoDTOS2) { for (FullViewRecallInfoDTO fullViewRecallInfoDTO : fullViewRecallInfoDTOS2) {
List<FullViewRecallInfoDTO> fullViewRecallInfoDTOS3=fullViewRecallInfoDTO.getChildren().stream().filter(item -> item.getName().equals(rootNodeName)).collect(Collectors.toList()); List<FullViewRecallInfoDTO> fullViewRecallInfoDTOS3=fullViewRecallInfoDTO.getChildren().stream().filter(item -> stringList.contains(item.getName())).collect(Collectors.toList());
if (fullViewRecallInfoDTOS3.size()>0){ if (fullViewRecallInfoDTOS3.size()>0){
return fullViewRecallInfoDTOS3; return fullViewRecallInfoDTOS3;
} }
......
...@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.FanWarningRecordServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.FanWarningRecordServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.HealthStatusIndicatorServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.HealthStatusIndicatorServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.PvWarningRecordServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.PvWarningRecordServiceImpl;
...@@ -28,25 +29,20 @@ import java.util.stream.Collectors; ...@@ -28,25 +29,20 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class WarningRecordStatusMessage extends EmqxListener { public class WarningRecordStatusMessage extends EmqxListener {
@Autowired
protected EmqKeeper emqKeeper;
/** /**
* 预警状态修改消息 - 标准化 * 预警状态修改消息 - 标准化
*/ */
public static final String WARNING_CHANGE_MESSAGE = "+/warning/change"; public static final String WARNING_CHANGE_MESSAGE = "+/warning/change";
@Autowired
private FanWaringRecordMapper fanWaringRecordMapper;
@Autowired @Autowired
private PvWaringRecordMapper pvWaringRecordMapper; protected EmqKeeper emqKeeper;
@Autowired @Autowired
FanWarningRecordServiceImpl fanWarningRecordService; FanWarningRecordServiceImpl fanWarningRecordService;
@Autowired @Autowired
PvWarningRecordServiceImpl pvWarningRecordService; PvWarningRecordServiceImpl pvWarningRecordService;
@Autowired
private FanWaringRecordMapper fanWaringRecordMapper;
@Autowired
private PvWaringRecordMapper pvWaringRecordMapper;
@PostConstruct @PostConstruct
void init() throws Exception { void init() throws Exception {
...@@ -71,8 +67,29 @@ public class WarningRecordStatusMessage extends EmqxListener { ...@@ -71,8 +67,29 @@ public class WarningRecordStatusMessage extends EmqxListener {
public void jxIopUpdateFan(JSONArray analysisResult) { public void jxIopUpdateFan(JSONArray analysisResult) {
log.info("修改预警状态信息:{}", analysisResult); log.info("修改预警状态信息:{}", analysisResult);
List<JSONObject> taskList = JSONObject.parseArray(analysisResult.toJSONString(), JSONObject.class); List<JSONObject> taskList = JSONObject.parseArray(analysisResult.toJSONString(), JSONObject.class);
taskList = taskList.stream().filter(t-> "2".equals(t.getString("processingStatus"))).collect(Collectors.toList()); taskList = taskList.stream().filter(t -> "2".equals(t.getString("processingStatus"))).collect(Collectors.toList());
List<String> traceIds = taskList.stream().map(t -> t.get("extAttr1").toString()).collect(Collectors.toList()); taskList.stream().forEach(jsonObject -> {
String[] params = jsonObject.getString("extAttr1").split("@");
QueryWrapper<FanWarningRecord> queryWrapper =new QueryWrapper<>();
queryWrapper.eq("station",jsonObject.getString("sourceAttributionDesc"));
queryWrapper.eq("equipment_name",jsonObject.getString("objectName"));
queryWrapper.eq("point_name",jsonObject.getString("objectIndexValue"));
queryWrapper.eq("kks",jsonObject.getString("objectId"));
if(params.length==3){
queryWrapper.eq("sub_system",params[0]);
queryWrapper.eq("health_level",params[1]);
queryWrapper.eq("warning_period",params[2]);
}
List<FanWarningRecord> fanWarningRecords = fanWaringRecordMapper.selectList(queryWrapper);
fanWarningRecords.stream().forEach(fanWarningRecord -> {
fanWarningRecord.setDisposotionDate(DateUtil.now());
fanWarningRecord.setStatus("1");
fanWarningRecord.setDisposotionState("已确认");
fanWaringRecordMapper.insert(fanWarningRecord);
});
});
// List<String> traceIds = taskList.stream().map(t -> t.get("extAttr1").toString()).collect(Collectors.toList());
// LambdaUpdateWrapper<IdxBizFanWarningRecord> lambda = new LambdaUpdateWrapper<>(); // LambdaUpdateWrapper<IdxBizFanWarningRecord> lambda = new LambdaUpdateWrapper<>();
// lambda.set(IdxBizFanWarningRecord::getDisposotionState, "已确认"); // lambda.set(IdxBizFanWarningRecord::getDisposotionState, "已确认");
// lambda.set(IdxBizFanWarningRecord::getStatus, "1"); // lambda.set(IdxBizFanWarningRecord::getStatus, "1");
...@@ -80,19 +97,19 @@ public class WarningRecordStatusMessage extends EmqxListener { ...@@ -80,19 +97,19 @@ public class WarningRecordStatusMessage extends EmqxListener {
// lambda.in(IdxBizFanWarningRecord::getSequenceNbr, traceIds); // lambda.in(IdxBizFanWarningRecord::getSequenceNbr, traceIds);
// idxBizFanWarningRecordService.update(lambda); // idxBizFanWarningRecordService.update(lambda);
List<FanWarningRecord> list = new ArrayList<>(); // List<FanWarningRecord> list = new ArrayList<>();
for (String traceId : traceIds) { // for (String traceId : traceIds) {
FanWarningRecord fanWarningRecord = new FanWarningRecord(); // FanWarningRecord fanWarningRecord = new FanWarningRecord();
fanWarningRecord.setTs(Long.valueOf(traceId)); // fanWarningRecord.setTs(Long.valueOf(traceId));
fanWarningRecord.setDisposotionDate(DateUtil.now()); // fanWarningRecord.setDisposotionDate(DateUtil.now());
fanWarningRecord.setStatus("1"); // fanWarningRecord.setStatus("1");
fanWarningRecord.setDisposotionState("已确认"); // fanWarningRecord.setDisposotionState("已确认");
list.add(fanWarningRecord); // list.add(fanWarningRecord);
} // }
if(list.size()>0){ // if(list.size()>0){
log.info("XXXXXXXXXXXX风电修改预警状态XXXXXXXXXXXXXXXXXX",JSON.toJSONString(list)); // log.info("XXXXXXXXXXXX风电修改预警状态XXXXXXXXXXXXXXXXXX",JSON.toJSONString(list));
fanWaringRecordMapper.updateStatusByTs(list); // fanWaringRecordMapper.updateStatusByTs(list);
} // }
} }
...@@ -100,27 +117,48 @@ public class WarningRecordStatusMessage extends EmqxListener { ...@@ -100,27 +117,48 @@ public class WarningRecordStatusMessage extends EmqxListener {
public void jxIopUpdatePv(JSONArray analysisResult) { public void jxIopUpdatePv(JSONArray analysisResult) {
log.info("修改预警状态信息:{}", analysisResult); log.info("修改预警状态信息:{}", analysisResult);
List<JSONObject> taskList = JSONObject.parseArray(analysisResult.toJSONString(), JSONObject.class); List<JSONObject> taskList = JSONObject.parseArray(analysisResult.toJSONString(), JSONObject.class);
taskList = taskList.stream().filter(t-> "2".equals(t.getString("processingStatus"))).collect(Collectors.toList()); taskList = taskList.stream().filter(t -> "2".equals(t.getString("processingStatus"))).collect(Collectors.toList());
List<String> traceIds = taskList.stream().map(t -> t.get("extAttr1").toString()).collect(Collectors.toList());
// LambdaUpdateWrapper<IdxBizPvWarningRecord> lambda = new LambdaUpdateWrapper<>(); taskList.stream().forEach(jsonObject -> {
// lambda.set(IdxBizPvWarningRecord::getDisposotionState, "已处置"); String[] params = jsonObject.getString("extAttr1").split("@");
// lambda.set(IdxBizPvWarningRecord::getStatus, "1"); QueryWrapper<PvWarningRecord> queryWrapper =new QueryWrapper<>();
// lambda.set(IdxBizPvWarningRecord::getDisposotionDate, new Date()); queryWrapper.eq("station",jsonObject.getString("sourceAttributionDesc"));
// lambda.in(IdxBizPvWarningRecord::getSequenceNbr, traceIds); queryWrapper.eq("equipment_name",jsonObject.getString("objectName"));
// idxBizPvWarningRecordService.update(lambda); queryWrapper.eq("point_name",jsonObject.getString("objectIndexValue"));
// td queryWrapper.eq("kks",jsonObject.getString("objectId"));
List<PvWarningRecord> list = new ArrayList<>(); if(params.length==3){
for (String traceId : traceIds) { queryWrapper.eq("subarray",params[0]);
PvWarningRecord pvWarningRecord = new PvWarningRecord(); queryWrapper.eq("health_level",params[1]);
pvWarningRecord.setTs(Long.valueOf(traceId)); queryWrapper.eq("warning_period",params[2]);
}
List<PvWarningRecord> pvWarningRecords = pvWaringRecordMapper.selectList(queryWrapper);
pvWarningRecords.stream().forEach(pvWarningRecord -> {
pvWarningRecord.setDisposotionDate(DateUtil.now()); pvWarningRecord.setDisposotionDate(DateUtil.now());
pvWarningRecord.setStatus("1"); pvWarningRecord.setStatus("1");
pvWarningRecord.setDisposotionState("已确认"); pvWarningRecord.setDisposotionState("已确认");
list.add(pvWarningRecord); pvWaringRecordMapper.insert(pvWarningRecord);
} });
if(list.size()>0){ });
log.info("XXXXXXXXXXXX光伏修改预警状态XXXXXXXXXXXXXXXXXX",JSON.toJSONString(list)); // List<String> traceIds = taskList.stream().map(t -> t.get("extAttr1").toString()).collect(Collectors.toList());
pvWaringRecordMapper.updateStatusByTs(list); //// LambdaUpdateWrapper<IdxBizPvWarningRecord> lambda = new LambdaUpdateWrapper<>();
} //// lambda.set(IdxBizPvWarningRecord::getDisposotionState, "已处置");
//// lambda.set(IdxBizPvWarningRecord::getStatus, "1");
//// lambda.set(IdxBizPvWarningRecord::getDisposotionDate, new Date());
//// lambda.in(IdxBizPvWarningRecord::getSequenceNbr, traceIds);
//// idxBizPvWarningRecordService.update(lambda);
// // td
// List<PvWarningRecord> list = new ArrayList<>();
// for (String traceId : traceIds) {
// PvWarningRecord pvWarningRecord = new PvWarningRecord();
// pvWarningRecord.setTs(Long.valueOf(traceId));
// pvWarningRecord.setDisposotionDate(DateUtil.now());
// pvWarningRecord.setStatus("1");
// pvWarningRecord.setDisposotionState("已确认");
// list.add(pvWarningRecord);
// }
// if (list.size() > 0) {
// log.info("XXXXXXXXXXXX光伏修改预警状态XXXXXXXXXXXXXXXXXX", JSON.toJSONString(list));
// pvWaringRecordMapper.updateStatusByTs(list);
// }
} }
} }
...@@ -1548,14 +1548,12 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -1548,14 +1548,12 @@ public class HealthStatusIndicatorServiceImpl {
tabContent.add(tableContentVo10); tabContent.add(tableContentVo10);
tabContent.add(tableContentVo11); tabContent.add(tableContentVo11);
dynamicDetailsVo.setTabContent(tabContent); dynamicDetailsVo.setTabContent(tabContent);
detailsVos.add(dynamicDetailsVo); detailsVos.add(dynamicDetailsVo);
riskBizInfoVo.setDynamicDetails(detailsVos); riskBizInfoVo.setDynamicDetails(detailsVos);
bizMessage.setBizInfo(riskBizInfoVo); bizMessage.setBizInfo(riskBizInfoVo);
bizMessage.setTraceId2(idxBizPvWarningRecord.getTs().toString()); // 子系统@健康指数@预警周期
String traceId2 = idxBizPvWarningRecord.getSubarray()+"@"+idxBizPvWarningRecord.getHealthLevel()+"@"+idxBizPvWarningRecord.getWarningPeriod();
bizMessage.setTraceId2(traceId2);
try { try {
emqKeeper.getMqttClient().publish(SMART_ANALYSE_PV + "/data/analysis", JSON.toJSONString(bizMessage).getBytes(StandardCharsets.UTF_8), 2, false); emqKeeper.getMqttClient().publish(SMART_ANALYSE_PV + "/data/analysis", JSON.toJSONString(bizMessage).getBytes(StandardCharsets.UTF_8), 2, false);
} catch (MqttException e) { } catch (MqttException e) {
...@@ -1615,7 +1613,9 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -1615,7 +1613,9 @@ public class HealthStatusIndicatorServiceImpl {
detailsVos.add(dynamicDetailsVo); detailsVos.add(dynamicDetailsVo);
riskBizInfoVo.setDynamicDetails(detailsVos); riskBizInfoVo.setDynamicDetails(detailsVos);
bizMessage.setBizInfo(riskBizInfoVo); bizMessage.setBizInfo(riskBizInfoVo);
bizMessage.setTraceId2(idxBizFanWarningRecord.getTs().toString()); // 子系统@健康指数@预警周期
String traceId2 = idxBizFanWarningRecord.getSubSystem()+"@"+idxBizFanWarningRecord.getHealthLevel()+"@"+idxBizFanWarningRecord.getWarningPeriod();
bizMessage.setTraceId2(traceId2);
try { try {
emqKeeper.getMqttClient().publish(SMART_ANALYSE_FAN + "/data/analysis", JSON.toJSONString(bizMessage).getBytes(StandardCharsets.UTF_8), 2, false); emqKeeper.getMqttClient().publish(SMART_ANALYSE_FAN + "/data/analysis", JSON.toJSONString(bizMessage).getBytes(StandardCharsets.UTF_8), 2, false);
} catch (MqttException e) { } catch (MqttException e) {
......
...@@ -101,18 +101,18 @@ public class IPermissionServiceImpl implements IPermissionService { ...@@ -101,18 +101,18 @@ public class IPermissionServiceImpl implements IPermissionService {
@Override @Override
public String getCurrentUserPersmissions() { public String getCurrentUserPersmissions() {
String rootNodeName = "all"; String rootNodeName = "";
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String userId = reginParams.getUserModel().getUserId(); String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH")); StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
if (ObjectUtils.isEmpty(stdUserEmpower)) { if (ObjectUtils.isEmpty(stdUserEmpower)) {
return rootNodeName; return rootNodeName+"_111";
} else { } else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0); String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode); Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.get("level").toString(); String companyLevel = companyInfo.get("level").toString();
if (companyLevel.equals("categroy_leve2")) { if (companyLevel.equals("categroy_leve2")) {
return rootNodeName; return "all";
} }
if (companyLevel.equals("area")) { if (companyLevel.equals("area")) {
List<StationBasic> stationBasics = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("project_org_code", permissionOrgCode)); List<StationBasic> stationBasics = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("project_org_code", permissionOrgCode));
......
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