Commit 03a22d5b authored by 吴江's avatar 吴江

Merge branch 'developer' into 'dev0124'

# Conflicts: # amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/mapper/JpStationMapper.java # amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/mapper/PowerStationMapper.java # amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/service/IJpStationService.java # amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/resources/mapper/mysql/JpStationMapper.xml # amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/resources/mapper/mysql/PowerStationMapper.xml # amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/JpStationController.java # amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/PowerStationController.java # amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/JpStationServiceImpl.java # amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/PowerStationServiceImpl.java # amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/UnitInfoServiceImpl.java
parents 66998d12 fedd94ca
......@@ -34,10 +34,10 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
@EnableTransactionManagement
@EnableConfigurationProperties
@ServletComponentScan
@EnableDiscoveryClient
@EnableFeignClients
//@EnableDiscoveryClient
//@EnableFeignClients
@EnableAsync
@EnableEurekaClient
//@EnableEurekaClient
@EnableScheduling
@MapperScan(value = { "org.typroject.tyboot.*.*.face.orm.dao", "com.yeejoin.amos.api.*.face.orm.dao",
"org.typroject.tyboot.face.*.orm.dao*", "com.yeejoin.amos.boot.biz.common.dao.mapper" })
......
......@@ -125,7 +125,7 @@ public class GolangRequestUtil {
body(params).execute().body();
}
housepvapiRecords.setResponse(respone);
housepvapiRecordsMapper.insert(housepvapiRecords);
// housepvapiRecordsMapper.insert(housepvapiRecords);
log.info("锦浪云数据请求详情:"+JSONObject.toJSONString(housepvapiRecords));
return respone;
}
......
......@@ -2,44 +2,48 @@ package com.yeejoin.amos.api.householdapi.Utils;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.GolangStationMapper;
import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl;
import com.yeejoin.amos.api.householdapi.constant.GoodWeConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.*;
@Component
public class GoodWeRequestUtil {
private final String redisKey = "GOODWE_REQUEST_TOKEN";
@Autowired
private HouseholdPvProducerInfoServiceImpl householdPvProducerInfoServiceImpl;
@Autowired
private GolangStationMapper golangStationMapper;
private RedisUtils redisUtils;
/**
* @return HashMap<String, Object> 发送请求前的准备 准备header信息
* @deprecated 根据厂商编码获取厂商的hearer
*/
public HashMap<String, Object> getHeaderOfGolang() {
HashMap<String, Object> hashMap = new HashMap<>();
HashMap<String, String> hashMaphead = new HashMap<>();
String url = GoLangConstant.baseurl + GoLangConstant.tokenurl;
hashMap.put("apiurl", GoLangConstant.baseurl);
hashMaphead.put("Content-type", "application/json;charset=UTF-8");
hashMaphead.put("Authorization", "API " + GoLangConstant.prodcerappid);
hashMaphead.put("Content-MD5", null);
hashMaphead.put("Date", GoLangHeaderUtils.getGMTTime());
hashMap.put("header", hashMaphead);
hashMap.put("appsecret", GoLangConstant.prodcerappsecret);
public HashMap<String, String> getHeaderOfGoodWE() {
HashMap<String,String> requestHeader = new HashMap<>();
if(ObjectUtil.isNotEmpty(redisUtils.get(redisKey))){
requestHeader.put("token",redisUtils.get(redisKey).toString());
return requestHeader;
}
HashMap<String, String> hashMap = new HashMap<>();
String url = GoodWeConstant.baseurl+GoodWeConstant.tokenurl;
Map<String,String> params = new HashMap<>();
params.put("account",GoodWeConstant.account);
params.put("pwd",GoodWeConstant.password);
String requestParams = JSON.toJSONString(params);
String respone = HttpUtil.createPost(url).headerMap(null, false).
body(requestParams).execute().body();
JSONObject jsonObject = JSON.parseObject(respone);
if(jsonObject.getString("code").equals("0")){
JSONObject jsonObject1 = jsonObject.getJSONObject("data");
String token = jsonObject1.getString("token");
hashMap.put("token",token);
redisUtils.set(redisKey,token,jsonObject1.getLong("expired")-10);
}
return hashMap;
}
......@@ -59,13 +63,8 @@ public class GoodWeRequestUtil {
JSONArray jsonArray = null;
List<T> result = new ArrayList<>();
try {
HashMap<String, Object> producerInfo = getHeaderOfGolang();
String baseurl = (String) producerInfo.get("apiurl");
HashMap<String, String> headMap = (HashMap<String, String>) producerInfo.get("header");
String orginalAuthorization = headMap.get("Authorization") + ":";
String url = baseurl + apiurl;
String appsecret = (String) producerInfo.get("appsecret");
JLYHeaderMapHandler(params, headMap, orginalAuthorization, appsecret, apiurl);
HashMap<String, String> headMap = getHeaderOfGoodWE();
String url = GoodWeConstant.baseurl + apiurl;
respone = sendRequest(requestMethod, url, requestParmInfo, headMap);
jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone);
if (!ObjectUtils.isEmpty(jsonArray)) {
......@@ -100,9 +99,9 @@ public class GoodWeRequestUtil {
}
}
}
if (jsonArray.size() == 0) {
jsonArray.add(jsonObject);
}
// if (jsonArray.size() == 0) {
// jsonArray.add(jsonObject);
// }
}
return jsonArray;
}
......@@ -120,27 +119,6 @@ public class GoodWeRequestUtil {
return respone;
}
/***
*
* @param params 参数字符窜
* @param headMap header头
* @param orginalAuthorization 原始的orginalAuthorization
* @param appsecret appsecret
* @desc 锦浪云请求参数及head头处理
*/
public void JLYHeaderMapHandler(String params, HashMap<String, String> headMap, String orginalAuthorization, String appsecret, String apiurl) {
String contentMD5 = GoLangHeaderUtils.getDigest(params);
headMap.put("Date", GoLangHeaderUtils.getGMTTime());
String param = "POST" + "\n" + contentMD5 + "\n" + "application/json" + "\n" + headMap.get("Date") + "\n" + apiurl;
String sign = "";
try {
sign = GoLangHeaderUtils.HmacSHA1Encrypt(param, appsecret);
} catch (Exception e) {
throw new RuntimeException(e);
}
headMap.put("Content-MD5", contentMD5);
headMap.put("Authorization", orginalAuthorization + sign);
}
/**
* @param pageSizeResovle
......
......@@ -253,7 +253,7 @@ public class ImasterUtils {
body(params).execute().body();
}
housepvapiRecords.setResponse(respone);
housepvapiRecordsMapper.insert(housepvapiRecords);
// housepvapiRecordsMapper.insert(housepvapiRecords);
log.info("华为数据请求详情:"+JSONObject.toJSONString(housepvapiRecords));
return respone;
}
......
......@@ -133,7 +133,7 @@ public class KsolarRequestUtil {
body(params).execute().body();
}
housepvapiRecords.setResponse(respone);
housepvapiRecordsMapper.insert(housepvapiRecords);
// housepvapiRecordsMapper.insert(housepvapiRecords);
log.info("科士达数据请求详情:"+JSONObject.toJSONString(housepvapiRecords));
return respone;
}
......
......@@ -2,9 +2,13 @@ package com.yeejoin.amos.api.householdapi.Utils;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
import com.yeejoin.amos.api.householdapi.constant.GoodWeConstant;
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.stereotype.Component;
import org.springframework.util.ObjectUtils;
......@@ -16,23 +20,71 @@ import java.util.List;
public class SofarRequestUtil {
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", "地面全额上网");
}
};
public static final HashMap<String, String> alarmLevel = new HashMap<String, String>() {
{
put("2", "故障");
put("1", "警告");
put("0", "提示");
}
};
@Autowired
private RedisUtils redisUtils;
/**
* @return HashMap<String, Object> 发送请求前的准备 准备header信息
* @deprecated 根据厂商编码获取厂商的hearer
*/
public HashMap<String, Object> getHeaderOfGolang() {
HashMap<String, Object> hashMap = new HashMap<>();
HashMap<String, String> hashMaphead = new HashMap<>();
String url = GoLangConstant.baseurl + GoLangConstant.tokenurl;
hashMap.put("apiurl", GoLangConstant.baseurl);
hashMaphead.put("Content-type", "application/json;charset=UTF-8");
hashMaphead.put("Authorization", "API " + GoLangConstant.prodcerappid);
hashMaphead.put("Content-MD5", null);
hashMaphead.put("Date", GoLangHeaderUtils.getGMTTime());
hashMap.put("header", hashMaphead);
hashMap.put("appsecret", GoLangConstant.prodcerappsecret);
return hashMap;
public HashMap<String, String> getHeaderOfSofar() {
HashMap<String,String> requestHeader = new HashMap<>();
if(ObjectUtil.isNotEmpty(redisUtils.get(redisKey))){
requestHeader.put("authorization",redisUtils.get(redisKey).toString());
return requestHeader;
}
HashMap<String, Object> map = new HashMap<>();
map.put("accountName", SoFarConstant.account);
map.put("appId",SoFarConstant.appId);
map.put("appSecret", SoFarConstant.appSecret);
map.put("corporationId", SoFarConstant.corporationId);
map.put("accountType", 2);
String body = JSON.toJSONString(map);
String url = SoFarConstant.baseurl+SoFarConstant.tokenurl;
String response = HttpUtil.createPost(url).body(body).execute().body();
JSONObject jsonObject = JSON.parseObject(response);
if(jsonObject.getString("msg").equals("success")){
String token = jsonObject.getString("data");
requestHeader.put("authorization",token);
redisUtils.set(redisKey,token,5183900);
}
return requestHeader;
}
/**
......@@ -47,28 +99,43 @@ public class SofarRequestUtil {
*/
public <T> List<T> getResPonse(String apiurl, String requestMethod, String requestParmInfo, String ResultResolveRule, Class<T> tClass) {
String respone = "";
String params = "";
JSONArray jsonArray = null;
List<T> result = new ArrayList<>();
try {
HashMap<String, Object> producerInfo = getHeaderOfGolang();
String baseurl = (String) producerInfo.get("apiurl");
HashMap<String, String> headMap = (HashMap<String, String>) producerInfo.get("header");
String orginalAuthorization = headMap.get("Authorization") + ":";
String url = baseurl + apiurl;
String appsecret = (String) producerInfo.get("appsecret");
JLYHeaderMapHandler(params, headMap, orginalAuthorization, appsecret, apiurl);
HashMap<String, String> headMap = getHeaderOfSofar();
String url = SoFarConstant.baseurl + apiurl;
respone = sendRequest(requestMethod, url, requestParmInfo, headMap);
jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone);
if (!ObjectUtils.isEmpty(jsonArray)) {
result = JSONArray.parseArray(jsonArray.toJSONString(), tClass);
JSONObject jsonObject = JSONObject.parseObject(respone);
if(jsonObject!=null&&jsonObject.get(ResultResolveRule)!=null){
result = JSONArray.parseArray(fastjson.JSON.toJSONString(jsonObject.get(ResultResolveRule)), tClass);
}
} catch (Exception exception) {
return result;
exception.printStackTrace();
}
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 response 请求返回的字符串
......@@ -112,27 +179,6 @@ public class SofarRequestUtil {
return respone;
}
/***
*
* @param params 参数字符窜
* @param headMap header头
* @param orginalAuthorization 原始的orginalAuthorization
* @param appsecret appsecret
* @desc 锦浪云请求参数及head头处理
*/
public void JLYHeaderMapHandler(String params, HashMap<String, String> headMap, String orginalAuthorization, String appsecret, String apiurl) {
String contentMD5 = GoLangHeaderUtils.getDigest(params);
headMap.put("Date", GoLangHeaderUtils.getGMTTime());
String param = "POST" + "\n" + contentMD5 + "\n" + "application/json" + "\n" + headMap.get("Date") + "\n" + apiurl;
String sign = "";
try {
sign = GoLangHeaderUtils.HmacSHA1Encrypt(param, appsecret);
} catch (Exception e) {
throw new RuntimeException(e);
}
headMap.put("Content-MD5", contentMD5);
headMap.put("Authorization", orginalAuthorization + sign);
}
/**
* @param pageSizeResovle
......
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());
}
}
}
//package com.yeejoin.amos.api.householdapi.Utils;
//
//import com.taosdata.jdbc.SchemalessWriter;
//import com.taosdata.jdbc.enums.SchemalessProtocolType;
//import com.taosdata.jdbc.enums.SchemalessTimestampType;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Component;
//
//import java.sql.Connection;
//import java.sql.DriverManager;
//import java.sql.SQLException;
//
//@Component
//public class TdEngineUtils {
// @Value("${tdengine-server.jdbc-url}")
// private String url;
// @Value("${tdengine-server.username}")
// private String user;
// @Value("${tdengine-server.password}")
// private String password;
// public void writeDataIntoTdEngine(String lines){
// try (Connection conn = this.getConnection()) {
// SchemalessWriter writer = new SchemalessWriter(conn);
// writer.write(lines, SchemalessProtocolType.JSON, SchemalessTimestampType.NOT_CONFIGURED);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// public Connection getConnection() throws SQLException {
// String jdbcUrl = String.format(url, user, password);
// return DriverManager.getConnection(jdbcUrl);
// }
//
//}
package com.yeejoin.amos.api.householdapi.constant;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
/**
* 首航常量
*/
public class SoFarConstant {
public static final HashMap<String, String> stationStaus = new HashMap<String, String>() {
{
put("1", "在线");
put("0", "离线");
put("2", "报警");
}
};
public static String baseurl = "https://openapi.sofarsolarmonitor.com";
public static String appId = "447430219192733696";
public static String appSecret = "5881ee8c062817016a2b34425c45937d";
public static String corporationId = "447430928264990720";
public static String account = "18120415291";
public static String password = "ZXNK123456..";
public static String tokenurl = "/account/auth/createToken";
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 stationhisUrl = "/station/v1.0/plantHistory";
public static String alert = "/station/v1.0/alert";
public static String equipComm = "/device/v1.0/equipComm";
public static String alertDetail = "/device/v1.0/alertDetail";
public static String stationListStatusUrl = "/api/OpenApi/QueryPowerStationMonitor";
public static String stationDetailUrl = "/api/OpenApi/GetPowerStationMonitorDetail";
public static String collectorListUrl = "/v1/api/collectorList";
public static String collectorDetailUrl = "/v1/api/collectorDetail";
public static String inverterListUrl = "/v1/api/inverterList";
public static String inverterDetailUrl = "/v1/api/inverterDetail";
public static String alarmListUrl = "/v1/api/alarmList";
public static String stationDayGenUrl = "/v1/api/stationDayEnergyList";
public static String stationMonthEnergyList = "/v1/api/stationDayEnergyList";
public static String stationYearEnergyList = "/v1/api/stationDayEnergyList";
public static String inverterDayURL = "/v1/api/inverterDay";
public static String inverterMonthURL = "/v1/api/inverterMonth";
public static String inverterYearURL = "/v1/api/inverterYear";
public static String resovleRule_data_page_records = "data,page,records";
public static String resovleRule_data_list = "data,list";
public static String resovleRule_data_records = "data,records";
public static String resovleRule_data = "stationList";
public static String deviceListItems = "deviceListItems";
public static String communication = "communication";
public static String stationAlertItems = "stationAlertItems";
public static String dataList = "dataList";
public static String paramDataList = "paramDataList";
public static String requestPost = "POST";
public static String requestGet = "GET";
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;
}
package com.yeejoin.amos.api.householdapi.controller;
import com.yeejoin.amos.api.householdapi.Utils.GoodWeRequestUtil;
import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
import com.yeejoin.amos.api.householdapi.face.service.GoLangDataAcquisitionService;
import com.yeejoin.amos.api.householdapi.face.service.ImasterDataService;
import com.yeejoin.amos.api.householdapi.face.service.KSolarDataAcquisitionService;
import com.yeejoin.amos.api.householdapi.face.dto.GoodWEGenStation;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.*;
import com.yeejoin.amos.api.householdapi.face.service.*;
import com.yeejoin.amos.api.householdapi.face.service.business.*;
import com.yeejoin.amos.api.householdapi.face.service.impl.ImasterDataServiceImpl;
import com.yeejoin.amos.api.householdapi.face.service.impl.SofarDataAcquisitionServiceImpl;
import fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
......@@ -36,6 +37,43 @@ public class HouseholdTestController {
private KSolarDataAcquisitionService kSolarDataAcquisitionService;
@Autowired
private ImasterDataService imasterDataService;
@Autowired
private GoodWeDataAcquisitionService goodWeDataAcquisitionService;
@Autowired
private SofarDataAcquisitionService sofarDataAcquisitionService;
@Autowired
private TdHYGFInverterDayGenerateImpl tdHYGFInverterDayGenerateImpl;
@Autowired
private TdHYGFInverterMonthGenerateImpl tdHYGFInverterMonthGenerateImpl;
@Autowired
private TdHYGFInverterYearGenerateImpl tdHYGFInverterYearGenerateImpl;
@Autowired
private TdHYGFStationDayGenerateImpl tdHYGFStationDayGenerateImpl;
@Autowired
private TdHYGFStationMonthGenerateImpl tdHYGFStationMonthGenerateImpl;
@Autowired
private TdHYGFInverterTotalGenerateImpl tdHYGFInverterTotalGenerateImpl;
@Autowired
TdHYGFStationYearGenerateImpl tdHYGFStationYearGenerateImpl;
//户用光伏日发电量
@Autowired
private HYGFJPDayPowerImpl hygfjpDayPowerImpl;
@Autowired
private HYGFJPStationPowerHistoryImpl hygfjpStationPowerHistoryImpl;
@Autowired
private HYGFJPInverterWarnImpl hygfjpInverterWarnImpl;
/**
......@@ -44,10 +82,19 @@ public class HouseholdTestController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/gdwdemo")
@PostMapping(value = "/goodweDemo")
@ApiOperation(httpMethod = "POST", value = "固德威示例", notes = "固德威示例")
public String save(Long seq) throws IOException {
return householdPvUtils.gerResponseByAPiID(seq);
public void goodweDemo() throws IOException {
goodWeDataAcquisitionService.stationList();
// goodWeDataAcquisitionService.stationDetail();
// goodWeDataAcquisitionService.inverAlramInfo();
// goodWeDataAcquisitionService.inverterList();
// goodWeDataAcquisitionService.inverterDetail();
// goodWeDataAcquisitionService.stationMonthGen();
// goodWeDataAcquisitionService.stationYearGen();
// goodWeDataAcquisitionService.inverterDetail();
// goodWeDataAcquisitionService.inverterMonthGen();
// goodWeDataAcquisitionService.inverterYearGen();
}
/**
......@@ -64,8 +111,8 @@ public class HouseholdTestController {
// goLangDataAcquisitionService.collectorList();
// goLangDataAcquisitionService.inverterList();
// goLangDataAcquisitionService.collectorDetail();
goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo();
// goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo();
}
......@@ -78,13 +125,13 @@ public class HouseholdTestController {
@PostMapping(value = "/sofarnew")
@ApiOperation(httpMethod = "POST", value = "首航", notes = "首航")
public void sofarnew() throws IOException {
// goLangDataAcquisitionService.stationList();
// sofarDataAcquisitionService.stationList();
// goLangDataAcquisitionService.stationDetail();
// goLangDataAcquisitionService.collectorList();
// goLangDataAcquisitionService.inverterList();
// goLangDataAcquisitionService.collectorDetail();
// goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo();
goLangDataAcquisitionService.inverAlramInfo();
}
/**
......@@ -102,7 +149,7 @@ public class HouseholdTestController {
//// goLangDataAcquisitionService.inverterList();
// goLangDataAcquisitionService.collectorDetail();
// goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo();
// goLangDataAcquisitionService.inverAlramInfo();
}
/**
......@@ -144,4 +191,75 @@ public class HouseholdTestController {
// imasterDataService.inverterDetail(null);
kSolarDataAcquisitionService.collectorDetail();
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping (value = "/updateAscription")
@ApiOperation(httpMethod = "GET", value = "手动同步数据", notes = "手动同步数据")
public void updateAscription(
@RequestParam(value = "table",required=false) String table,//表名
@RequestParam(value = "time",required=false) String time
){
AscriptionService ascriptionService= this.updateAscriptionlist(table);
ascriptionService.updateAscription(time);
}
public AscriptionService updateAscriptionlist( String table){
AscriptionService ascriptionService=null;
switch (table) {
case "td_hygf_day_power":
ascriptionService=hygfjpDayPowerImpl;
break;
case "td_hygf_jp_inverter_warn":
ascriptionService=hygfjpInverterWarnImpl;
break;
case "td_hygf_jp_station_power_history":
ascriptionService=hygfjpStationPowerHistoryImpl;
break;
case "td_hygf_station_day_generate":
ascriptionService=tdHYGFStationDayGenerateImpl;
break;
case "td_hygf_station_month_generate":
ascriptionService=tdHYGFStationMonthGenerateImpl;
break;
case "td_hygf_station_year_generate":
ascriptionService=tdHYGFStationYearGenerateImpl;
break;
case "td_hygf_inverter_day_generate":
ascriptionService=tdHYGFInverterDayGenerateImpl;
break;
case "td_hygf_inverter_month_generate":
ascriptionService=tdHYGFInverterMonthGenerateImpl;
break;
case "td_hygf_inverter_year_generate":
ascriptionService=tdHYGFInverterYearGenerateImpl;
break;
case "td_hygf_inverter_total_generate":
ascriptionService=tdHYGFInverterTotalGenerateImpl;
break;
default:
break;
}
return ascriptionService;
}
}
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;//设备型号名称
private Integer getPs_fault_status;
}
package com.yeejoin.amos.api.householdapi.face.dto;
import fastjson.JSONArray;
import lombok.Data;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/11
*/
@Data
public class EquipComm {
private Object childList; // 子设备
private Long deviceId; // 设备ID
private String deviceSn; // 设备S//
private Integer deviceState ; // 设备当前状态
private String deviceType; // 设备类型
private String parentSn ; // 父设备S//
private String timeZone; // 设备时区
private Long updateTime ; // 设备更新时间
private String plantId; // 设备所属电站ID
}
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;
/**
* @description:
* @author: tw
* @createDate: 2024/4/11
*/
@Data
public class SofarWarm {
private Long deviceId;//254292152459468801,
private String deviceSn;//SF4ES010M1R047,
private String deviceType;//INVERTER,
private String addr;//2701_yz_97,
private Long alertTime;//1663046926,
private String code;//2701_yz_97,
private String level;//0,
private Long ruleId;//289113052832604160,
private String showName;//002电网欠压,
private int influence;//1
}
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 ;// 故障的恢复时间
}
......@@ -212,7 +212,7 @@ public class JpStation implements Serializable {
@TableField("day_power_use")
private Double dayPowerUse; // 日用电量
@TableField("month_power_use")
private Double monthPowerPse; // 月用电量
private Double monthPowerUse; // 月用电量
@TableField("year_power_use")
private Double yearPowerUse; // 年用电量
@TableField("email")
......
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName(value = "goodwe_station_detail", autoResultMap = true)
public class GoodWeStationDetail {
@TableField("created_time")
private long createdTime;
@TableField("powerstation_id")
private String powerstation_id;
@TableField("stationname")
private String stationname;
@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;
@TableField("capacity")
private Double capacity;
@TableField("longitude")
private String longitude;
@TableField("latitude")
private String latitude;
@TableField("powerstation_type")
private String powerstation_type;
@TableField("status")
private Integer status;
@TableField("pac")
private Double pac;
@TableField("eday")
private Double eday;
@TableField(exist = false)
private Double emonth;
@TableField(exist = false)
private Double eday_income;
@TableField("etotal")
private Double etotal;
@TableField(exist = false)
private Double etotal_income;
@TableField(exist = false)
private Double yield_rate;
}
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName(value = "goodwe_station_monitor_list", autoResultMap = true)
public class GoodWeStationMonitorList {
@TableField("created_time")
private long createdTime;
@TableField("powerstation_id")
private String powerstation_id;
@TableField("stationname")
private String stationname;
@TableField("adcode")
private String adcode;
@TableField("location")
private String location;
@TableField("status")
private Integer status;
@TableField("pac")
private Double pac;
@TableField("capacity")
private Double capacity;
@TableField("eday")
private Double eday;
@TableField(exist = false)
private Double eday_income;
@TableField("etotal")
private Double etotal;
@TableField(exist = false)
private Double emonth;
@TableField(exist = false)
private Double etotal_income;
@TableField("powerstation_type")
private String powerstation_type;
@TableField("longitude")
private String longitude;
@TableField("latitude")
private String latitude;
@TableField("pac_kw")
private Double pac_kw;
@TableField("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;
}
......@@ -13,4 +13,13 @@ public class HYGFJPDayPower implements Serializable {
private String hour;
private String yearMonthDay;
private Double power;
private String stationName; //名称
private String regionalCompaniesCode; //区域公司code
private String amosCompanyCode; //经销商code
private String stationState;//电站状态
}
......@@ -21,4 +21,11 @@ public class HYGFJPInverterWarn implements Serializable {
private String thirdStationId;
private String thirdCode;
private String state;
private String warnId;
private String handlerStatus;
private String stationName; //名称
private String regionalCompaniesCode; //区域公司code
private String amosCompanyCode; //经销商code
private String stationState;//电站状态
}
......@@ -14,4 +14,12 @@ public class HYGFJPStationPowerHistory implements Serializable {
private long time;
private String thirdStationId;
private String thirdCode;
private String stationName; //名称
private String regionalCompaniesCode; //区域公司code
private String amosCompanyCode; //经销商code
private String stationState;//电站状态
}
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 String locationLat ;// 纬度
private String 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; //电站故障状态
}
......@@ -143,5 +143,11 @@ public class TdHYGFInverterDayGenerate implements Serializable {
private Double income;
private Double fullhour;
private String name;
private String stationName; //名称
private String regionalCompaniesCode; //区域公司code
private String amosCompanyCode; //经销商code
private String stationState;//电站状态
}
......@@ -41,5 +41,11 @@ public class TdHYGFInverterMonthGenerate implements Serializable {
private Double fullhour;
private Double income;
private String name;
private String stationName; //名称
private String regionalCompaniesCode; //区域公司code
private String amosCompanyCode; //经销商code、
private String stationState;//电站状态
}
......@@ -42,5 +42,12 @@ public class TdHYGFInverterTotalGenerate implements Serializable {
private Double fullhour;
private Double income;
private String name;
private String stationName; //名称
private String regionalCompaniesCode; //区域公司code
private String amosCompanyCode; //经销商code
private String stationState;//电站状态
}
......@@ -42,5 +42,11 @@ public class TdHYGFInverterYearGenerate implements Serializable {
private Double income;
private String name;
private String stationName; //名称
private String regionalCompaniesCode; //区域公司code
private String amosCompanyCode; //经销商code
private String stationState;//电站状态
}
......@@ -39,5 +39,11 @@ public class TdHYGFStationDayGenerate implements Serializable {
* 收益
*/
private Double income;
private String stationName; //名称
private String regionalCompaniesCode; //区域公司code
private String amosCompanyCode; //经销商code
private String stationState;//电站状态
}
......@@ -39,5 +39,11 @@ public class TdHYGFStationMonthGenerate implements Serializable {
* 收益
*/
private Double income;
private String stationName; //名称
private String regionalCompaniesCode; //区域公司code
private String amosCompanyCode; //经销商code
private String stationState;//电站状态
}
......@@ -39,5 +39,11 @@ public class TdHYGFStationYearGenerate implements Serializable {
* 收益
*/
private Double income;
private String stationName; //名称
private String regionalCompaniesCode; //区域公司code
private String amosCompanyCode; //经销商code
private String stationState;//电站状态
}
......@@ -19,5 +19,5 @@ public class TdJpStation implements Serializable {
private String regionalCompaniesCode; //区域公司code
private String amosCompanyCode; //经销商code
private String thirdCode ;//厂商标识
private int isDelete;
}
......@@ -4,7 +4,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverter;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface JpInverterMapper extends BaseMapper<JpInverter> {
@Select("SELECT sum(current_power) FROM hygf_jp_inverter WHERE third_code='HW'")
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.GoodWeStationDetail;
public interface GoodWeStationDetailMapper extends BaseMapper<GoodWeStationDetail> {
}
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.GoodWeStationMonitorList;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface GoodWeStationMonitorListMapper extends BaseMapper<GoodWeStationMonitorList> {
@Select("select powerstation_id from goodwe_station_monitor_list group by powerstation_id")
List<String> getStationIds ();
}
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();
}
package com.yeejoin.amos.api.householdapi.face.service;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
public interface AscriptionService {
void updateAscription( String today);
}
......@@ -9,6 +9,9 @@ public interface GoodWeDataAcquisitionService {
* @descrption 场站详情数据入库
*/
void stationDetail();
void stationMonthGen();
void stationYearGen();
/**
* @descrption 采集器列表数据入库
*/
......@@ -25,8 +28,12 @@ public interface GoodWeDataAcquisitionService {
* @descrption 逆变器详情数据入库
*/
void inverterDetail();
void inverterMonthGen();
void inverterYearGen();
/**
* @descrption 采集器告警列表数据入库
*/
void inverAlramInfo();
void inverAlramInfo(String stationid);
}
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 {
/**
* @descrption 场站列表数据入库
......@@ -8,7 +15,7 @@ public interface SofarDataAcquisitionService {
/**
* @descrption 场站详情数据入库
*/
void stationDetail();
void stationDetail(List<SofarStationList> jsonObject);
/**
* @descrption 采集器列表数据入库
*/
......@@ -16,11 +23,11 @@ public interface SofarDataAcquisitionService {
/**
* @descrption 采集器详情数据入库
*/
void collectorDetail();
void collectorDetail(List<SofarInverter> sofarInverter, JpStation jpStation);
/**
* @descrption 逆变器列表数据入库
*/
void inverterList();
void inverterList(List<SofarInverter> sofarInverter, JpStation jpStation, Map<String, String> maps);
/**
* @descrption 逆变器详情数据入库
*/
......@@ -28,5 +35,5 @@ public interface SofarDataAcquisitionService {
/**
* @descrption 采集器告警列表数据入库
*/
void inverAlramInfo();
void inverAlramInfo(JpStation jpStation);
}
package com.yeejoin.amos.api.householdapi.face.service;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.SofarStationList;
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();
}
package com.yeejoin.amos.api.householdapi.face.service.business;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPDayPower;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.HYGFJPDayPowerMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class HYGFJPDayPowerImpl implements AscriptionService {
@Autowired
private HYGFJPDayPowerMapper hygfjpDayPowerMapper;
@Autowired
private JpStationMapper jpStationMapper;
@Override
public void updateAscription( String today) {
List<HYGFJPDayPower> hygfjpDayPower = hygfjpDayPowerMapper.selectList(
new QueryWrapper<HYGFJPDayPower>().
eq("year_month_day", today).and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (HYGFJPDayPower dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getTationId()));
if(jpStation!=null) {
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
hygfjpDayPowerMapper.insert(dayPower);
}
}
}
}
}
\ No newline at end of file
package com.yeejoin.amos.api.householdapi.face.service.business;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPDayPower;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPInverterWarn;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.HYGFJPInverterWarnMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class HYGFJPInverterWarnImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private HYGFJPInverterWarnMapper hygfjpInverterWarnMapper;
@Override
public void updateAscription(String timeNum) {
try {
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
Date star = dft.parse(timeNum);//开始时间
Date endDay= dft.parse(dft.format(new Date()));//结束时间
Long starTime=star.getTime();
Long endTime=endDay.getTime();
Long num=endTime-starTime;//时间戳相差的毫秒数
Long d= num/24/60/60/1000;
int day=d.intValue();
String sql="";
if(day==0){
sql=" and created_time>=TODAY() and created_time< TODAY() + 1d ";
}else{
sql=" and created_time>=TODAY() - "+day+"d and created_time< TODAY() - "+(day-1)+"d ";
}
List<HYGFJPInverterWarn> hygfjpDayPower = hygfjpInverterWarnMapper.selectList(
new QueryWrapper<HYGFJPInverterWarn>().last(sql)
.and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (HYGFJPInverterWarn dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
if(jpStation!=null) {
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
hygfjpInverterWarnMapper.insert(dayPower);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
package com.yeejoin.amos.api.householdapi.face.service.business;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPDayPower;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPInverterWarn;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPStationPowerHistory;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.HYGFJPStationPowerHistoryMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class HYGFJPStationPowerHistoryImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private HYGFJPStationPowerHistoryMapper hygfjpStationPowerHistoryMapper;
@Override
public void updateAscription(String timeNum) {
try {
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
Date star = dft.parse(timeNum);//开始时间
Date endDay= dft.parse(dft.format(new Date()));//结束时间
Long starTime=star.getTime();
Long endTime=endDay.getTime();
Long num=endTime-starTime;//时间戳相差的毫秒数
Long d= num/24/60/60/1000;
int day=d.intValue();
String sql="";
if(day==0){
sql=" and created_time>=TODAY() and created_time< TODAY() + 1d ";
}else{
sql=" and created_time>=TODAY() - "+day+"d and created_time< TODAY() - "+(day-1)+"d ";
}
List<HYGFJPStationPowerHistory> hygfjpDayPower = hygfjpStationPowerHistoryMapper.selectList(
new QueryWrapper<HYGFJPStationPowerHistory>().last(sql)
.and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (HYGFJPStationPowerHistory dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
if(jpStation!=null) {
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
hygfjpStationPowerHistoryMapper.insert(dayPower);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
package com.yeejoin.amos.api.householdapi.face.service.business;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPStationPowerHistory;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterDayGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFInverterDayGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class TdHYGFInverterDayGenerateImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private TdHYGFInverterDayGenerateMapper tdHYGFInverterDayGenerateMapper;
@Override
public void updateAscription(String timeNum) {
try {
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
Date star = dft.parse(timeNum);//开始时间
Date endDay= dft.parse(dft.format(new Date()));//结束时间
Long starTime=star.getTime();
Long endTime=endDay.getTime();
Long num=endTime-starTime;//时间戳相差的毫秒数
Long d= num/24/60/60/1000;
int day=d.intValue();
String sql="";
if(day==0){
sql=" and created_time>=TODAY() and created_time< TODAY() + 1d ";
}else{
sql=" and created_time>=TODAY() - "+day+"d and created_time< TODAY() - "+(day-1)+"d ";
}
List<TdHYGFInverterDayGenerate> hygfjpDayPower = tdHYGFInverterDayGenerateMapper.selectList(
new QueryWrapper<TdHYGFInverterDayGenerate>().last(sql)
.and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (TdHYGFInverterDayGenerate dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
if(jpStation!=null) {
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
tdHYGFInverterDayGenerateMapper.insert(dayPower);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
package com.yeejoin.amos.api.householdapi.face.service.business;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPDayPower;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterMonthGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFInverterMonthGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class TdHYGFInverterMonthGenerateImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private TdHYGFInverterMonthGenerateMapper tdHYGFInverterMonthGenerateMapper;
@Override
public void updateAscription(String timeNum) {
try {
// DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
// DateFormat dfty = new SimpleDateFormat("yyyy-MM");
//
// Date star = dft.parse(timeNum);//开始时间
// String yearMonth= dfty.format(star);
List<TdHYGFInverterMonthGenerate> hygfjpDayPower = tdHYGFInverterMonthGenerateMapper.selectList(
new QueryWrapper<TdHYGFInverterMonthGenerate>().
eq("day_time", timeNum).and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (TdHYGFInverterMonthGenerate dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
if(jpStation!=null) {
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
tdHYGFInverterMonthGenerateMapper.insert(dayPower);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
package com.yeejoin.amos.api.householdapi.face.service.business;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterMonthGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterTotalGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFInverterTotalGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class TdHYGFInverterTotalGenerateImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private TdHYGFInverterTotalGenerateMapper tdHYGFInverterTotalGenerateMapper;
@Override
public void updateAscription(String timeNum) {
try {
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
DateFormat dfty = new SimpleDateFormat("yyyy");
Date star = dft.parse(timeNum);//开始时间
String yearMonth= dfty.format(star);
List<TdHYGFInverterTotalGenerate> hygfjpDayPower = tdHYGFInverterTotalGenerateMapper.selectList(
new QueryWrapper<TdHYGFInverterTotalGenerate>().
eq("year_time", yearMonth).and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (TdHYGFInverterTotalGenerate dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
if(jpStation!=null) {
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
tdHYGFInverterTotalGenerateMapper.insert(dayPower);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
package com.yeejoin.amos.api.householdapi.face.service.business;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterTotalGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterYearGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFInverterYearGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class TdHYGFInverterYearGenerateImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private TdHYGFInverterYearGenerateMapper tdHYGFInverterYearGenerateMapper;
@Override
public void updateAscription(String timeNum) {
try {
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
DateFormat dfty = new SimpleDateFormat("yyyy-MM");
Date star = dft.parse(timeNum);//开始时间
String yearMonth= dfty.format(star);
List<TdHYGFInverterYearGenerate> hygfjpDayPower = tdHYGFInverterYearGenerateMapper.selectList(
new QueryWrapper<TdHYGFInverterYearGenerate>().
eq("month_time", yearMonth).and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (TdHYGFInverterYearGenerate dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
if(jpStation!=null) {
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
tdHYGFInverterYearGenerateMapper.insert(dayPower);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
package com.yeejoin.amos.api.householdapi.face.service.business;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.HYGFJPDayPower;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterMonthGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFStationDayGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFStationDayGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class TdHYGFStationDayGenerateImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private TdHYGFStationDayGenerateMapper tdHYGFStationDayGenerateMapper;
@Override
public void updateAscription(String timeNum) {
try {
// DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
// DateFormat dfty = new SimpleDateFormat("yyyy-MM");
//
// Date star = dft.parse(timeNum);//开始时间
// String yearMonth= dfty.format(star);
List<TdHYGFStationDayGenerate> hygfjpDayPower = tdHYGFStationDayGenerateMapper.selectList(
new QueryWrapper<TdHYGFStationDayGenerate>().
eq("day_time", timeNum).and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (TdHYGFStationDayGenerate dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
if(jpStation!=null){
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
tdHYGFStationDayGenerateMapper.insert(dayPower);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
package com.yeejoin.amos.api.householdapi.face.service.business;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFInverterYearGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFStationMonthGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFStationMonthGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class TdHYGFStationMonthGenerateImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private TdHYGFStationMonthGenerateMapper tdHYGFStationMonthGenerateMapper;
@Override
public void updateAscription(String timeNum) {
try {
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
DateFormat dfty = new SimpleDateFormat("yyyy-MM");
Date star = dft.parse(timeNum);//开始时间
String yearMonth= dfty.format(star);
List<TdHYGFStationMonthGenerate> hygfjpDayPower = tdHYGFStationMonthGenerateMapper.selectList(
new QueryWrapper<TdHYGFStationMonthGenerate>().
eq("month_time", yearMonth).and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (TdHYGFStationMonthGenerate dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
if(jpStation!=null){
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
tdHYGFStationMonthGenerateMapper.insert(dayPower);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
\ No newline at end of file
package com.yeejoin.amos.api.householdapi.face.service.business;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFStationMonthGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.TdHYGFStationYearGenerate;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.TdHYGFStationYearGenerateMapper;
import com.yeejoin.amos.api.householdapi.face.service.AscriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2024/4/9
*/
@Service
public class TdHYGFStationYearGenerateImpl implements AscriptionService {
@Autowired
private JpStationMapper jpStationMapper;
@Autowired
private TdHYGFStationYearGenerateMapper tdHYGFStationYearGenerateMapper;
@Override
public void updateAscription(String timeNum) {
try {
DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
DateFormat dfty = new SimpleDateFormat("yyyy");
Date star = dft.parse(timeNum);//开始时间
String yearMonth= dfty.format(star);
List<TdHYGFStationYearGenerate> hygfjpDayPower = tdHYGFStationYearGenerateMapper.selectList(
new QueryWrapper<TdHYGFStationYearGenerate>().
eq("year", yearMonth).and(wrapper -> {
wrapper.isNull("regional_companies_code")
.or()
.isNull("amos_company_code")
.or()
.isNull("station_name")
.or()
.isNull("station_state");
})
);
if(hygfjpDayPower!=null&&!hygfjpDayPower.isEmpty()){
for (TdHYGFStationYearGenerate dayPower : hygfjpDayPower) {
JpStation jpStation = jpStationMapper.selectOne(new QueryWrapper<JpStation>().
eq("third_station_id", dayPower.getThirdStationId()));
if(jpStation!=null) {
dayPower.setAmosCompanyCode(jpStation.getAmosCompanyCode());
dayPower.setRegionalCompaniesCode(jpStation.getRegionalCompaniesCode());
dayPower.setStationName(jpStation.getName());
dayPower.setStationState(jpStation.getState());
tdHYGFStationYearGenerateMapper.insert(dayPower);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
//package com.yeejoin.amos.dockingData;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
//import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
//import com.yeejoin.amos.api.householdapi.face.orm.entity.HouseholdPvApi;
//import com.yeejoin.amos.api.householdapi.face.orm.entity.HouseholdPvProducerInfo;
//import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvApiServiceImpl;
//import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl;
//import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
//import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
//import org.jetbrains.annotations.TestOnly;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.actuate.influx.InfluxDbHealthIndicator;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.PostConstruct;
//import java.util.*;
//import java.util.zip.Inflater;
//
///**
// * @description:
// * @author: tw
// * @createDate: 2023/6/16
// */
//@Component
//public class DockingData {
// @Autowired
// InfluxDbConnection influxDbConnection;
// @Autowired
// HouseholdPvUtils householdPvUtils;
// @Autowired
// private HouseholdPvProducerInfoServiceImpl householdPvProducerInfoServiceImpl;
// @Autowired
// private HouseholdPvApiServiceImpl householdPvApiServiceImpl;
//
// //初始化执行
// @PostConstruct
// public void init() {
// //锦浪云
// this.getDataGolong();
// //固德威
//// this.getDataGoodWE();
// //首航
//// this.getDataSoFar();
// }
//
// //每二十分钟执行一次
// @Scheduled(cron = "0 0/20 * * * ?")
// public void fixedRateGolong() {
// this.getDataGolong();
// }
//
// @Scheduled(cron = "0 0/20 * * * ?")
//// public void fixedRateGoodWE() {
//// this.getDataGoodWE();
//// }
//
//
// @Scheduled(cron = "0 0/20 * * * ?")
//// public void fixedRateSoFar() {
//// this.getDataSoFar();
//// }
//
// //请求获取数据
// public void getDataGolong() {
// List<HouseholdPvApi> householdPvApiList = householdPvApiServiceImpl.list();
// householdPvApiList.stream().filter(householdPvApi -> householdPvApi.getProducerId().equals(PVProducerInfoEnum.JLY.getCode())).forEach(householdPvApi -> householdPvUtils.gerResponseByAPiID(householdPvApi.getSequenceNbr()));
// }
//
// public void getDataGoodWE() {
// List<HouseholdPvApi> householdPvApiList = householdPvApiServiceImpl.list();
// householdPvApiList.stream().filter(householdPvApi -> householdPvApi.getProducerId().equals(PVProducerInfoEnum.GDW.getCode())).forEach(householdPvApi -> householdPvUtils.gerResponseByAPiID(householdPvApi.getSequenceNbr()));
// }
//
// public void getDataSoFar() {
// List<HouseholdPvApi> householdPvApiList = householdPvApiServiceImpl.list();
// householdPvApiList.stream().filter(householdPvApi -> householdPvApi.getProducerId().equals(PVProducerInfoEnum.SH.getCode())).forEach(householdPvApi -> householdPvUtils.gerResponseByAPiID(householdPvApi.getSequenceNbr()));
// }
//}
......@@ -4,10 +4,11 @@ package com.yeejoin.amos.openapi.enums;
public enum PVProducerInfoEnum {
GDW("固德威","GDW"),
GDW("固德威","GOODWE"),
SH("首航","SH"),
JLY("锦浪云","JLY"),
KSOLAR("科士达","KSD"),
YG("阳光","YG"),
HUAWEI("华为","HW");
private String name;
......
......@@ -5,19 +5,19 @@ server.port=11006
## DB properties hygf
## db1-production database
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.password=Yeejoin@2020
spring.db1.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
## db2-sync_data
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.password=Yeejoin@2020
spring.db2.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
## db3-taosiData
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.password=taosdata
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)
spring.redis.database=1
spring.redis.host=172.16.10.220
spring.redis.host=47.92.234.253
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
......@@ -35,7 +35,7 @@ spring.redis.lettuce.pool.min-idle=0
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
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
......@@ -49,7 +49,7 @@ eureka.instance.instance-id=${eureka.instance.ip-address}:${server.port}
##emqx
emqx.clean-session=true
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-password=public
......@@ -69,6 +69,11 @@ biz.lxyd.lift.url=http://39.106.181.149:8088/elevatorapi
# ??????????
dataRequstScheduled.jinlangyun=0 0/10 * * * *
dataRequstScheduled.huawei=0 0/10 * * * *
dataRequstScheduled.keshida=0 0/10 * * * *
\ No newline at end of file
dataRequstScheduled.jinlangyun=0 0/50 * * * *
dataRequstScheduled.huawei=0 0/50 * * * *
dataRequstScheduled.keshida=0 0/50 * * * *
dataRequstScheduled.Sunlight=0 0/50 * * * *
dataRequstScheduled.GoodWe=0 0/3 * * * *
dataRequstScheduled.Sofar=0 0/50 * * * *
\ No newline at end of file
package com.yeejoin.amos.kgd.config;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.IOException;
import java.io.InputStream;
import java.text.NumberFormat;
import java.util.*;
public class ExcelTool {
private static NumberFormat numberFormat = null;
/**
* 解析xls和xlsx不兼容问题
*
* @param pfs
* @param workbook
* @param inputStream
* @return
*/
public static Workbook getWorkBook(POIFSFileSystem pfs, Workbook workbook, InputStream inputStream, String filename) throws IOException {
if (filename.endsWith("xls")) {
pfs = new POIFSFileSystem(inputStream);
workbook = new HSSFWorkbook(pfs);
return workbook;
} else if (filename.endsWith("xlsx")) {
try {
workbook = new XSSFWorkbook(inputStream);
return workbook;
} catch (IOException e) {
return null;
}
} else {
return null;
}
}
/**
* 解析Excel
*
* @param inputStream 文件
* @return
*/
public static Map<String, Object> readFromExcel(InputStream inputStream, String filename) throws Exception {
Map<String, Object> resultTableMap = new HashMap<>();
POIFSFileSystem pfs = null;
Workbook workbook = null;
try {
// 解析xls和xlsx不兼容问题
workbook = getWorkBook(pfs, workbook, inputStream, filename);
} catch (IOException e) {
e.printStackTrace();
throw new Exception("模板保存异常。");
}
if (workbook == null) {
throw new Exception("请使用模板上传文件");
}
// 拿第一个sheet表
Sheet sheet = workbook.getSheetAt(0);
// 校验sheet是否合法
if (Objects.isNull(sheet)) {
return null;
}
List<String> titleList = new LinkedList<>();
numberFormat = NumberFormat.getNumberInstance();
// 创建一个集合根据下标来确定每个单元格对应对象的什么属性
List<List<String>> dataList = new ArrayList<>();
// 获取第一行数据(假如第一行就是列名)
Row sheetTitleRow = sheet.getRow(sheet.getFirstRowNum());
// 取出最后一列
short lastCellNum = sheetTitleRow.getLastCellNum();
for (int i = 0; i < lastCellNum; i++) {
// 取出每一列的名
String cellValue = sheetTitleRow.getCell(i).getStringCellValue();
titleList.add(cellValue);
}
resultTableMap.put("tableColumns", titleList);
// 获得sheet总行数
int lastRowNum = sheet.getLastRowNum();
if (lastRowNum < 1) {
throw new Exception("数据错误");
}
// 开始读取,不读取表头所以从第二行开始
for (int i = 1; i <= lastRowNum; i++) {
// 获取每一行
Row row = sheet.getRow(i);
// 行为空不读取
if (row == null) {
continue;
}
Cell cell = row.getCell(0);
//列为空不读取
if (cell == null || StringUtils.isEmpty(convertData(cell))) {
continue;
}
List<String> rowList = new ArrayList<>();
//添加数据
short lastCellNum2 = row.getLastCellNum();
for (int j = 0; j < lastCellNum2; j++) {
Cell cellOne = row.getCell(j);
try {
String item = convertData(cellOne);
rowList.add(item.trim());
} catch (Exception e) {
System.out.println("-------------------Err-----------------------");
System.out.println(i + "行" + j + "列数据转换出现异常");
rowList.add("");
}
}
dataList.add(rowList);
//规避行数数据后几行为空
if (rowList.size() < lastCellNum2) {
for (int k = 0; k < 15 - rowList.size(); k++) {
rowList.add("");
}
}
}
resultTableMap.put("tableDatas", dataList);
return resultTableMap;
}
/**
* 表格数据转换
*
* @param cell
* @return
*/
public static String convertData(Cell cell) {
String str = "";
switch (cell.getCellTypeEnum()) {
case NUMERIC:
//判断是否是整数
str = numberFormat.format(cell.getNumericCellValue());
break;
case STRING:
str = cell.getStringCellValue();
break;
case FORMULA:
try {
str = String.valueOf(cell.getNumericCellValue());
} catch (IllegalArgumentException e) {
str = String.valueOf(cell.getRichStringCellValue());
}
break;
default:
str = "";
}
return str;
}
}
package com.yeejoin.amos.kgd.config;
import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
public class InputStreamCacher {
private static final Logger log = LoggerFactory.getLogger(InputStreamCacher.class);
/**
* 将InputStream中的字节保存到ByteArrayOutputStream中
*/
private ByteArrayOutputStream byteArrayOutputStream;
private InputStream inputStream;
public InputStreamCacher(InputStream inputStream){
if(inputStream == null){
return;
}
this.inputStream = inputStream;
initCache();
}
/**
* 初始化
*/
private void initCache(){
byteArrayOutputStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len;
try{
while ((len = inputStream.read(buffer)) >-1 ){
byteArrayOutputStream.write(buffer, 0 , len);
}
byteArrayOutputStream.flush();
}catch (IOException e){
log.error(e.getMessage(), e);
}
}
/**
* 获取缓存流
* @return InputStream
*/
public InputStream getInputStream(){
if(byteArrayOutputStream == null){
return this.inputStream;
}
return new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
}
/**
* 销毁
*/
public void destroyCache(){
this.byteArrayOutputStream = null;
if(this.inputStream != null){
try {
this.inputStream.close();
}catch (IOException e){
e.printStackTrace();
}
}
}
}
......@@ -2,7 +2,9 @@ package com.yeejoin.amos.kgd.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
......@@ -29,6 +31,23 @@ public class SocketConfig {
@Value("${amos.system.maas.url}")
private String hostAndPort;
@Value("${spring.datasource.url}")
private String url;
@Value("${spring.datasource.username}")
private String username;
@Value("${spring.datasource.password}")
private String password;
@Value("${kgd.datasource.password.secretKey}")
private String passwordSecretKey;
@Value("${kgd.datasource.group_id}")
private String dataSourcesGroupId;
private static final ThreadPoolExecutor threadpool = new ThreadPoolExecutor(15, 15,
10L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
......@@ -49,7 +68,7 @@ public class SocketConfig {
clientSocket.setSoTimeout(10000);
// 创建新线程处理连接
log.info("接收到客户端socket: {}", clientSocket.getRemoteSocketAddress());
threadpool.execute(new ClientHandler(clientSocket,hostAndPort));
threadpool.execute(new ClientHandler(clientSocket, hostAndPort, url, username, password, passwordSecretKey, dataSourcesGroupId));
}
} catch (IOException e) {
throw new RuntimeException(e);
......
package com.yeejoin.amos.kgd.message.model;
import lombok.Data;
@Data
public class TableFieldModel {
// 字段类型
private String fieldType="String";
// 字段名称
private String fieldName;
// 字段长度
private String fieldLength;
// 数值类型时,小数点长度
private String decimalPoint;
// 主键
private String primaryKey;
// 是否为空
private String isNull="1";
// 不为空时,需设置得值
private String fieldRemark;
}
package com.yeejoin.amos.kgd.message.model;
import lombok.Data;
import java.util.List;
@Data
public class TableModel {
// 表名称
private String tableName;
// 表字段
private List<TableFieldModel> tableFields;
}
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.hygf.api.hwsms;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import springfox.bean.validators.plugins.schema.MinMaxAnnotationPlugin;
import javax.net.ssl.*;
import java.io.*;
......@@ -151,6 +152,16 @@ public class HwSendSms {
}
}
public static void main(String[] args) {
String appSecret="SnD8QvdkfDgNeLi8W2H6oDJnoNTZ";
String appKey="n7F6k8BorRkog9q5n6pq315reGk8";
String wsseHeader = buildWsseHeader(appKey, appSecret);
System.out.println(wsseHeader);
}
/**
* 构造请求Body体
* @param sender
......
......@@ -180,8 +180,7 @@ public class JpStationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryPage")
@ApiOperation(httpMethod = "GET", value = "场站列表", notes = "场站列表")
public ResponseModel<Page<JpStationDto>> queryForDealerReviewPage(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size, JpStationDto reviewDto) {
public ResponseModel<Page<JpStationDto>> queryForDealerReviewPage(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size, JpStationDto reviewDto) {
List<JpPersonStation> pPersonStation = null;
if (reviewDto.getName() != null && !"".equals(reviewDto.getName())) {
......@@ -556,31 +555,31 @@ public class JpStationController extends BaseController {
map.put("name1", "实时功率(kW)");
map.put("name2", "组件总容量(MWp)");
map.put("value1", jpStation.getRealTimePower()!=null?format2.format(jpStation.getRealTimePower()):0);
map.put("value1", jpStation.getRealTimePower() != null ? format2.format(jpStation.getRealTimePower()) : 0);
//硫
map.put("value2", jpStation.getCapacity()!=null?format2.format(jpStation.getCapacity()):0);
map.put("value2", jpStation.getCapacity() != null ? format2.format(jpStation.getCapacity()) : 0);
Map<String, Object> map2 = new HashMap<>();
map2.put("name1", "当日电量(MWh)");
map2.put("name2", "当日收益(元)");
//炭
map2.put("value1", jpStation.getDayGenerate()!=null?format2.format(jpStation.getDayGenerate()):0);
map2.put("value1", jpStation.getDayGenerate() != null ? format2.format(jpStation.getDayGenerate()) : 0);
//硫
map2.put("value2", jpStation.getDayIncome()!=null?format2.format(jpStation.getDayIncome()):0);
map2.put("value2", jpStation.getDayIncome() != null ? format2.format(jpStation.getDayIncome()) : 0);
Map<String, Object> map3 = new HashMap<>();
map3.put("name1", "当月电量(MWh)");
map3.put("name2", "当月收益(万元)");
//炭
map3.put("value1", jpStation.getMonthGenerate()!=null?format2.format(jpStation.getMonthGenerate()):0);
map3.put("value1", jpStation.getMonthGenerate() != null ? format2.format(jpStation.getMonthGenerate()) : 0);
//硫
map3.put("value2", jpStation.getMonthIncome()!=null?format2.format(jpStation.getMonthIncome()):0);
map3.put("value2", jpStation.getMonthIncome() != null ? format2.format(jpStation.getMonthIncome()) : 0);
Map<String, Object> map4 = new HashMap<>();
map4.put("name1", "累计电量(MWh)");
map4.put("name2", "累计收益(万元)");
//炭
map4.put("value1", jpStation.getAccumulatedPower()!=null?format2.format(jpStation.getAccumulatedPower()):0);
map4.put("value1", jpStation.getAccumulatedPower() != null ? format2.format(jpStation.getAccumulatedPower()) : 0);
//硫
map4.put("value2", jpStation.getCumulativeIncome()!=null?format2.format(jpStation.getCumulativeIncome()):0);
map4.put("value2", jpStation.getCumulativeIncome() != null ? format2.format(jpStation.getCumulativeIncome()) : 0);
date.add(map);
date.add(map2);
......@@ -696,7 +695,7 @@ public class JpStationController extends BaseController {
map.put("id", jpStation.getSequenceNbr());
map.put("name", jpStation.getName());
map.put("address", jpStation.getAddress());
map.put("fullhour", dayGenerate.getFullhour()!=null?format2.format(dayGenerate.getFullhour()):0);
map.put("fullhour", dayGenerate.getFullhour() != null ? format2.format(dayGenerate.getFullhour()) : 0);
li.add(map);
break;
}
......@@ -766,8 +765,7 @@ public class JpStationController extends BaseController {
@GetMapping(value = "/queryPagenew")
@ApiOperation(httpMethod = "GET", value = "场站列表", notes = "场站列表")
@UserLimits
public ResponseModel<Page<JpStationDto>> queryPagenew(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size, JpStationDto reviewDto) {
public ResponseModel<Page<JpStationDto>> queryPagenew(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size, JpStationDto reviewDto) {
Page<JpStationDto> page = jpStationServiceImpl.queryForJpStationPagenew(current, size, reviewDto);
return ResponseHelper.buildResponse(page);
}
......@@ -775,8 +773,7 @@ public class JpStationController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/queryReport")
@ApiOperation(httpMethod = "POST", value = "场站报表", notes = "场站报表")
public ResponseModel<Page<JpStationDto>> queryReport(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size, @RequestBody JpStationDto reviewDto, @RequestParam(value = "type") String type) {
public ResponseModel<Page<JpStationDto>> queryReport(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size, @RequestBody JpStationDto reviewDto, @RequestParam(value = "type") String type) {
Page<JpStationDto> page = jpStationServiceImpl.queryReport(current, size, reviewDto, type);
......@@ -846,4 +843,27 @@ public class JpStationController extends BaseController {
}
//查询当前登录人权限区域公司统计数据
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询当前登录人权限区域公司统计数据", notes = "查询当前登录人权限区域公司统计数据")
@GetMapping(value = "/getRegionStatistics")
// @UserLimits
public ResponseModel<Page<PowerStationStatistics>> getRegionStatistics(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, @RequestParam(required = false) String regionName) {
Page<PowerStationStatistics> poserStatisticsData = jpStationServiceImpl.getRegionStatistics(current, size, regionName);
return ResponseHelper.buildResponse(poserStatisticsData);
}
//查询经销商统计数据(根据区域公司orgCode)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询经销商统计数据", notes = "查询经销商统计数据")
@GetMapping(value = "/getDealerStatistics")
// @UserLimits
public ResponseModel<Page<PowerStationStatistics>> getDealerStatistics(@RequestParam(defaultValue = "1") Integer current, @RequestParam(defaultValue = "10") Integer size, String regionCompanyOrgCode, @RequestParam(required = false) String dealerName) {
Page<PowerStationStatistics> poserStatisticsData = jpStationServiceImpl.getDealerStatistics(current, size, regionCompanyOrgCode, dealerName);
return ResponseHelper.buildResponse(poserStatisticsData);
}
}
......@@ -176,7 +176,7 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
//增加人员权限
List<String> lisk=new ArrayList<>();
StdUserEmpower stdUserEmpower= new StdUserEmpower();
// lisk.add(publicAgencyUser.getAmosOrgCode());
lisk.add(re.getRegionalCompaniesCode());
stdUserEmpower.setAmosUserId(publicAgencyUser.getAmosUserId());
stdUserEmpower.setAmosOrgCode(lisk);
......
......@@ -936,7 +936,7 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
LambdaQueryWrapper<StdUserEmpower> uo=new LambdaQueryWrapper();
uo.eq(StdUserEmpower::getAmosUserId,unitInfo.getAdminUserId());
StdUserEmpower stdUserEmpower= userEmpowerMapper.selectOne(uo);
//lisk.add(unitInfo.getAmosCompanyCode());
if(stdUserEmpower!=null){
stdUserEmpower.setAmosUserId(unitInfo.getAdminUserId());
stdUserEmpower.setAmosOrgCode(lisk);
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos;
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.listener.SyncDasSuccessMqttListener;
import com.yeejoin.amos.boot.module.jxiop.biz.listener.SyncESDataToTdengineMqttListener;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
......@@ -62,6 +63,8 @@ public class AmosJxiopAnalyseApplication {
Boolean openHealth;
@Autowired
private SyncESDataToTdengineMqttListener syncESDataToTdengineMqttListener;
@Autowired
private SyncDasSuccessMqttListener syncDasSuccessMqttListener;
private static final Logger logger = LoggerFactory.getLogger(AmosJxiopAnalyseApplication.class);
......@@ -82,6 +85,8 @@ public class AmosJxiopAnalyseApplication {
if (openHealth) {
//订阅固化周期性数据成功的消息
emqKeeper.subscript("sync_esdata_to_tdengine_notice", 1, syncESDataToTdengineMqttListener);
//订阅业务固化同步数据成功消息
emqKeeper.subscript("sync_iotdata_to_tdengine_notice", 1, syncDasSuccessMqttListener);
}
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.Enum;
public enum SmartAnalyseEnum {
FAN_QJHF("FAN_QJHF", "风机区间变量划分"),
FAN_XGX("FAN_XGX","风机相关性"),
FAN_ZXZ("FAN_ZXZ","风机中心值"),
FAN_QJHF("FAN_QJHF", "风机区间变量划分"),
PV_QJHF("PV_QJHF","光伏区间变量划分"),
FAN_XGX("FAN_XGX", "风机相关性"),
PV_XGX("PV_XGX","光伏相关性"),
FAN_ZXZ("FAN_ZXZ", "风机中心值"),
PV_ZXZ("PV_ZXZ","光伏中心值");
PV_QJHF("PV_QJHF", "光伏区间变量划分"),
private String key;
private String name;
PV_XGX("PV_XGX", "光伏相关性"),
public String getKey() {
return key;
}
PV_ZXZ("PV_ZXZ", "光伏中心值");
public void setKey(String key) {
this.key = key;
}
private String key;
public String getName() {
return name;
}
private String name;
public void setName(String name) {
this.name = name;
}
public String getKey() {
return key;
}
SmartAnalyseEnum(String key, String name) {
this.key = key;
this.name = name;
}
public void setKey(String key) {
this.key = key;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
SmartAnalyseEnum(String key, String name) {
this.key = key;
this.name = name;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.Enum;
public enum WarningPeriodEnum {
DAY(1, "按天"),
HOUR(2,"按小时"),
MINUTES(3,"按10分钟");
private int code;
private String name;
WarningPeriodEnum(int code, String name) {
this.code = code;
this.name = name;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.config;
import org.springframework.format.Formatter;
import org.springframework.stereotype.Component;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
@Component
public class FlexibleDateFormatter implements Formatter<Date> {
private static final String FORMAT_WITH_SECONDS = "yyyy-MM-dd HH:mm:ss";
private static final String FORMAT_WITH_HOURS = "yyyy-MM-dd HH";
private static final String FORMAT_WITHOUT_TIME = "yyyy-MM-dd";
@Override
public Date parse(String text, Locale locale) throws ParseException {
for (String format : new String[]{FORMAT_WITH_SECONDS, FORMAT_WITH_HOURS, FORMAT_WITHOUT_TIME}) {
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
dateFormat.setLenient(false);
try {
return dateFormat.parse(text);
} catch (ParseException e) {
}
}
throw new ParseException("Unable to parse date: " + text, 0);
}
@Override
public String print(Date object, Locale locale) {
return null;
}
}
\ No newline at end of file
......@@ -76,7 +76,7 @@ public class TdEngineConfig {
final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
sessionFactory.setDataSource(culsterDataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources(TdEngineConfig.MAPPER_LOCATION));
.getResources(MAPPER_LOCATION));
sessionFactory.setTypeAliasesPackage("com.yeejoin.amos.boot.module.jxiop.biz.entity");
//mybatis 数据库字段与实体类属性驼峰映射配置
sessionFactory.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
......
......@@ -79,35 +79,15 @@ public class CommonConstans {
};
//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 Onedecimalplaces= "%.1f";
public static final String Fourdecimalplaces = "%.4f";
public static final String QueryStringFrontMoudleNotKeyWord = "frontModule";
public static final HashMap<String, String> waringPeriodStatus = new HashMap<String, String>() {
{
put("按时刻", "按10分钟周期");
put("按10分钟", "按10分钟周期");
put("按小时", "按1小时周期");
put("按天", "按1天周期");
}
......@@ -115,7 +95,7 @@ public class CommonConstans {
public static final HashMap<String, String> waringPeriodTowaringCycle = new HashMap<String, String>() {
{
put("按时刻", "分钟");
put("按10分钟", "分钟");
put("按小时", "小时");
put("按天", "天");
}
......@@ -124,15 +104,10 @@ public class CommonConstans {
public static final HashMap<String, String> waringPeriodDateFormate = new HashMap<String, String>() {
{
put("按时刻", DatePattern.NORM_DATETIME_PATTERN);
put("按10分钟", DatePattern.NORM_DATETIME_PATTERN);
put("按小时", DatePattern.NORM_DATETIME_PATTERN);
put("按天", DatePattern.NORM_DATE_PATTERN);
}
};
public static final String ANALYSE_TYPE_MOMENT = "按时刻";
public static final String ANALYSE_TYPE_HOUR = "按小时";
public static final String ANALYSE_TYPE_DAY = "按天";
}
......@@ -5,6 +5,9 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanPointProcessVariableClassificationDto;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizTableService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanPointProcessVariableClassificationServiceImpl;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -15,6 +18,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -124,13 +129,24 @@ public class IdxBizFanPointProcessVariableClassificationController extends BaseC
* 列表全部数据查询
*
* @return
* @throws UnsupportedEncodingException
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询")
@GetMapping(value = "/selectParams")
public ResponseModel<List<Map<String,Object>>> selectParams(String tableName,String column,@RequestParam(required = false) String isFx) {
public ResponseModel<List<Map<String,Object>>> selectParams() throws UnsupportedEncodingException {
String queryString = request.getQueryString();
String[] paramPairs = queryString.split("&");
Map<String, String> params = new HashMap<>();
for (String paramPair : paramPairs) {
String[] keyValue = paramPair.split("=");
String key = keyValue[0];
String value = keyValue[1];
value= URLDecoder.decode(value, "utf-8");
params.put(key, value);
}
// return ResponseHelper.buildResponse(idxBizFanPointProcessVariableClassificationServiceImpl.selectParams(column,tableName,isFx));
List<Map<String, Object>> selectOptions = idxBizTableService.getSelectOptions(tableName, column, null,null, null, isFx);
List<Map<String, Object>> selectOptions = idxBizTableService.getSelectOptions(params);
return ResponseHelper.buildResponse(selectOptions);
}
......
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanPointVarCorrelationDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanPointVarCorrelation;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanPointVarCorrelationServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -15,6 +19,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
*
......@@ -112,4 +117,32 @@ public class IdxBizFanPointVarCorrelationController extends BaseController {
public ResponseModel<List<IdxBizFanPointVarCorrelationDto>> selectForList() {
return ResponseHelper.buildResponse(idxBizFanPointVarCorrelationServiceImpl.queryForIdxBizFanPointVarCorrelationList());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "查询当前点位所选择的工况变量", notes = "查询当前点位所选择的工况变量")
@GetMapping(value = "/getCurrentChoosePoint")
public ResponseModel<Map<String,Object>> getCurrentChoosePoint(String gatewayId,String analysePointId) {
return ResponseHelper.buildResponse(idxBizFanPointVarCorrelationServiceImpl.getCurrentChoosePoint(gatewayId,analysePointId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "查询当前点位所选择的工况变量", notes = "查询当前点位所选择的工况变量")
@PostMapping(value = "/updatePointChoose")
public ResponseModel updatePointChoose(@RequestBody IdxBizFanPointVarCorrelationDto dto) {
idxBizFanPointVarCorrelationServiceImpl.updatePointChoose(dto.getAnalysisGatewayId(),dto.getAnalysisPointId(),dto.getProcessPointIds());
return CommonResponseUtil.success();
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "查询当前点位的工况变量", notes = "查询当前点位的工况变量")
@GetMapping(value = "/getPointProcess")
public ResponseModel<Map<String,Object>> getPointProcess(String gatewayId, String analysePointId) {
return ResponseHelper.buildResponse(idxBizFanPointVarCorrelationServiceImpl.getPointProcess(gatewayId,analysePointId));
}
}
......@@ -5,7 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.biz.amosprojectentity.StdUserEmpower;
import com.yeejoin.amos.boot.module.jxiop.biz.amosprojectmapper.UserEmpowerMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBiz3yudDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWeight;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWeight;
......@@ -15,6 +18,7 @@ import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.exception.BaseException;
......@@ -43,12 +47,20 @@ public class IdxBizFanWeightController extends BaseController {
@Autowired
IdxBizFanWeightMapper idxBizFanWeightMapper;
@Autowired
UserEmpowerMapper userEmpowerMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/queryPage")
@ApiOperation(httpMethod = "GET",value = "场站列表", notes = "场站列表")
public ResponseModel<com.baomidou.mybatisplus.extension.plugins.pagination.Page<IdxBizFanWeight>> queryForDealerReviewPage(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size, IdxBizFanWeight reviewDto) {
ReginParams reginParams = getSelectedOrgInfo();
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
String orgCode = "86";
if (!ObjectUtils.isEmpty(stdUserEmpower)) {
orgCode = stdUserEmpower.getAmosOrgCode().get(0);
}
LambdaQueryWrapper<IdxBizFanWeight> qu=new LambdaQueryWrapper<>();
qu.eq(!StringUtils.isEmpty(reviewDto.getType()),IdxBizFanWeight::getType,reviewDto.getType());
qu.eq(!StringUtils.isEmpty(reviewDto.getArae()),IdxBizFanWeight::getArae,reviewDto.getArae());
......@@ -56,6 +68,7 @@ public class IdxBizFanWeightController extends BaseController {
qu.eq(!StringUtils.isEmpty(reviewDto.getSubarray()),IdxBizFanWeight::getSubarray,reviewDto.getSubarray());
qu.eq(!StringUtils.isEmpty(reviewDto.getEquipmentName()),IdxBizFanWeight::getEquipmentName,reviewDto.getEquipmentName());
qu.eq(!StringUtils.isEmpty(reviewDto.getPointName()),IdxBizFanWeight::getPointName,reviewDto.getPointName());
qu.like(IdxBizFanWeight::getOrgCode,orgCode);
Integer total = idxBizFanWeightMapper.selectCount(qu);
qu.orderByAsc(IdxBizFanWeight::getType);
......@@ -105,6 +118,14 @@ public class IdxBizFanWeightController extends BaseController {
// ,String subarray
// ,String pointName
) {
ReginParams reginParams = getSelectedOrgInfo();
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
String orgCode = "86";
if (!ObjectUtils.isEmpty(stdUserEmpower)) {
orgCode = stdUserEmpower.getAmosOrgCode().get(0);
}
QueryWrapper< IdxBizFanWeight> qu=new QueryWrapper<>();
String name="";
switch(type){
......@@ -139,6 +160,7 @@ public class IdxBizFanWeightController extends BaseController {
// qu.eq("POINT_NAME",pointName);
break;
}
qu.like("ORG_CODE",orgCode);
qu.isNotNull(name);
qu.groupBy(name);
qu.orderByAsc(name);
......
......@@ -2,7 +2,11 @@ package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanPointVarCorrelationDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizPvPointVarCorrelationDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanPointVarCorrelation;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvPointVarCorrelation;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvPointVarCorrelationServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -15,6 +19,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
*
......@@ -112,4 +117,32 @@ public class IdxBizPvPointVarCorrelationController extends BaseController {
public ResponseModel<List<IdxBizPvPointVarCorrelationDto>> selectForList() {
return ResponseHelper.buildResponse(idxBizPvPointVarCorrelationServiceImpl.queryForIdxBizPvPointVarCorrelationList());
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "查询当前点位所选择的工况变量", notes = "查询当前点位所选择的工况变量")
@GetMapping(value = "/getCurrentChoosePoint")
public ResponseModel<Map<String,Object>> getCurrentChoosePoint(String gatewayId, String analysePointId) {
return ResponseHelper.buildResponse(idxBizPvPointVarCorrelationServiceImpl.getCurrentChoosePoint(gatewayId,analysePointId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "查询当前点位所选择的工况变量", notes = "查询当前点位所选择的工况变量")
@PostMapping(value = "/updatePointChoose")
public ResponseModel updatePointChoose(@RequestBody IdxBizFanPointVarCorrelationDto dto) {
idxBizPvPointVarCorrelationServiceImpl.updatePointChoose(dto.getAnalysisGatewayId(),dto.getAnalysisPointId(),dto.getProcessPointIds());
return CommonResponseUtil.success();
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "查询当前点位的工况变量", notes = "查询当前点位的工况变量")
@GetMapping(value = "/getPointProcess")
public ResponseModel<Map<String,Object>> getPointProcess(String gatewayId, String analysePointId) {
return ResponseHelper.buildResponse(idxBizPvPointVarCorrelationServiceImpl.getPointProcess(gatewayId,analysePointId));
}
}
......@@ -8,7 +8,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.biz.amosprojectentity.StdUserEmpower;
import com.yeejoin.amos.boot.module.jxiop.biz.amosprojectmapper.UserEmpowerMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBiz3yudDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWeight;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWeight;
......@@ -20,6 +23,7 @@ import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.exception.BaseException;
......@@ -48,13 +52,20 @@ public class IdxBizPvWeightController extends BaseController {
@Autowired
IdxBizPvWeightMapper idxBizPvWeightMapper;
@Autowired
UserEmpowerMapper userEmpowerMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/queryPage")
@ApiOperation(httpMethod = "GET",value = "场站列表", notes = "场站列表")
public ResponseModel<Page<IdxBizPvWeight>> queryForDealerReviewPage(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size, IdxBizPvWeight reviewDto) {
ReginParams reginParams = getSelectedOrgInfo();
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
String orgCode = "86";
if (!ObjectUtils.isEmpty(stdUserEmpower)) {
orgCode = stdUserEmpower.getAmosOrgCode().get(0);
}
LambdaQueryWrapper<IdxBizPvWeight> qu=new LambdaQueryWrapper<>();
qu.eq(!StringUtils.isEmpty(reviewDto.getType()),IdxBizPvWeight::getType,reviewDto.getType());
qu.eq(!StringUtils.isEmpty(reviewDto.getArae()),IdxBizPvWeight::getArae,reviewDto.getArae());
......@@ -62,8 +73,7 @@ public class IdxBizPvWeightController extends BaseController {
qu.eq(!StringUtils.isEmpty(reviewDto.getSubarray()),IdxBizPvWeight::getSubarray,reviewDto.getSubarray());
qu.eq(!StringUtils.isEmpty(reviewDto.getEquipmentName()),IdxBizPvWeight::getEquipmentName,reviewDto.getEquipmentName());
qu.eq(!StringUtils.isEmpty(reviewDto.getPointName()),IdxBizPvWeight::getPointName,reviewDto.getPointName());
qu.like(IdxBizPvWeight::getOrgCode,orgCode);
Integer total = idxBizPvWeightMapper.selectCount(qu);
qu.orderByAsc(IdxBizPvWeight::getType);
qu.last(" limit "+ (current-1)*size+","+size);
......@@ -116,6 +126,13 @@ public class IdxBizPvWeightController extends BaseController {
if(type==null){
return ResponseHelper.buildResponse(null);
}
ReginParams reginParams = getSelectedOrgInfo();
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
String orgCode = "86";
if (!ObjectUtils.isEmpty(stdUserEmpower)) {
orgCode = stdUserEmpower.getAmosOrgCode().get(0);
}
QueryWrapper< IdxBizPvWeight> qu=new QueryWrapper<>();
String name="";
IdxBizPvWeight qt=new IdxBizPvWeight();
......@@ -152,7 +169,7 @@ public class IdxBizPvWeightController extends BaseController {
// qu.eq("POINT_NAME",pointName);
break;
}
qu.like("ORG_CODE",orgCode);
qu.isNotNull(name);
qu.groupBy(name);
qu.orderByAsc(name);
......
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizTableService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -14,36 +15,49 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@Api(tags = "idx业务前置接口")
@RequestMapping(value = "/idx")
public class IdxBizTableController {
public class IdxBizTableController extends BaseController{
@Autowired
IIdxBizTableService idxBizTableService;
@Autowired
IIdxBizTableService idxBizTableService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "分页查询业务事实表的数据", notes = "分页查询业务事实表的数据-IDX前置接口")
@GetMapping(value = "/table/getPage")
public ResponseModel<Page<Map<String, Object>>> getTablePage(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(idxBizTableService.getPage(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "分页查询业务事实表的数据", notes = "分页查询业务事实表的数据-IDX前置接口")
@GetMapping(value = "/table/getPage")
public ResponseModel<Page<Map<String, Object>>> getTablePage(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(idxBizTableService.getPage(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "列表下拉框选项数据", notes = "列表下拉框选项数据")
@GetMapping(value = "/select-options")
public ResponseModel<List<Map<String, Object>>> getSelectOptions(
@RequestParam(value = "tableName") String tableName,
@RequestParam(value = "column") String column,
@RequestParam(value = "valueColumn", required = false) String valueColumn,
@RequestParam(value = "conditionColumn", required = false) String conditionColumn,
@RequestParam(value = "conditionValue", required = false) String conditionValue,
@RequestParam(value = "isFx", required = false) String isFx
) {
List<Map<String, Object>> selectOptions = idxBizTableService.getSelectOptions(tableName, column, valueColumn, conditionColumn, conditionValue, isFx);
return ResponseHelper.buildResponse(selectOptions);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "分页查询业务事实表的数据", notes = "分页查询业务事实表的数据-IDX前置接口")
@GetMapping(value = "/table/getPageO")
public ResponseModel<Page<Map<String, Object>>> getPageO(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(idxBizTableService.getPageO(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "列表下拉框选项数据", notes = "列表下拉框选项数据")
@GetMapping(value = "/select-options")
public ResponseModel<List<Map<String, Object>>> getSelectOptions() throws UnsupportedEncodingException {
String queryString = request.getQueryString();
String[] paramPairs = queryString.split("&");
Map<String, String> params = new HashMap<>();
for (String paramPair : paramPairs) {
String[] keyValue = paramPair.split("=");
String key = keyValue[0];
String value = keyValue[1];
value = URLDecoder.decode(value, "utf-8");
params.put(key, value);
}
List<Map<String, Object>> selectOptions = idxBizTableService.getSelectOptions(params);
return ResponseHelper.buildResponse(selectOptions);
}
}
This diff is collapsed.
This diff is collapsed.
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