Commit 860a7d9e authored by caotao's avatar caotao

户用光伏新增科士达信息

parent 798be0cc
package com.yeejoin.amos.api.householdapi.Utils;
import org.apache.commons.codec.binary.Base64;
import org.springframework.stereotype.Component;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
@Component
/**
* Created by jhb on 2022-08-03 14:16
*/
public class AESUtils {
public static final String DEFAULT_SECRET_KEY = "kstar_ase_keysfo";
/**
* 加密
* @param sSrc 需要加密的字符串
* @param sKey 此处使用AES-128-ECB加密模式,key需要为16位。
* @return
* @throws Exception
*/
public static String Encrypt(String sSrc, String sKey) throws Exception {
// 判断Key是否为16位
if (sKey.length() != 16) {
System.out.print("Key长度不是16位");
return null;
}
byte[] raw = sKey.getBytes("utf-8");
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");//"算法/模式/补码方式"
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
byte[] encrypted = cipher.doFinal(sSrc.getBytes("utf-8"));
return new Base64().encodeToString(encrypted);//此处使用BASE64做转码功能,同时能起到2次加密的作用。
}
/**
* 解密
* @param sSrc 需要解密的字符串
* @param sKey 此处使用AES-128-ECB加密模式,key需要为16位。
* @return
* @throws Exception
*/
public static String Decrypt(String sSrc, String sKey) throws Exception {
try {
// 判断Key是否正确
if (sKey == null) {
System.out.print("Key为空null");
return null;
}
// 判断Key是否为16位
if (sKey.length() != 16) {
System.out.print("Key长度不是16位");
return null;
}
byte[] raw = sKey.getBytes("utf-8");
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, skeySpec);
byte[] encrypted1 = new Base64().decode(sSrc);//先用base64解密
try {
byte[] original = cipher.doFinal(encrypted1);
String originalString = new String(original,"utf-8");
return originalString;
} catch (Exception e) {
System.out.println(e.toString());
return null;
}
} catch (Exception ex) {
System.out.println(ex.toString());
return null;
}
}
public static void main(String[] args) throws Exception {
/*
* 此处使用AES-128-ECB加密模式,key需要为16位。
*/
String cKey = "kstar_ase_keysfo";
// 需要加密的字串
String cSrc = "sygn2022";
System.out.println(cSrc);
// 加密
String enString = AESUtils.Encrypt(cSrc, cKey);
System.out.println("加密后的字串是:" + enString);
// 解密
String DeString = AESUtils.Decrypt(enString, cKey);
System.out.println("解密后的字串是:" + DeString);
}
}
...@@ -5,13 +5,8 @@ import cn.hutool.http.HttpUtil; ...@@ -5,13 +5,8 @@ import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant; import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.GolangStationList;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.GolangStationMapper;
import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.cache.Redis;
import java.util.*; import java.util.*;
...@@ -19,11 +14,6 @@ import java.util.*; ...@@ -19,11 +14,6 @@ import java.util.*;
public class GolangRequestUtil { public class GolangRequestUtil {
@Autowired
private HouseholdPvProducerInfoServiceImpl householdPvProducerInfoServiceImpl;
@Autowired
private GolangStationMapper golangStationMapper;
/** /**
* @return HashMap<String, Object> 发送请求前的准备 准备header信息 * @return HashMap<String, Object> 发送请求前的准备 准备header信息
......
package com.yeejoin.amos.api.householdapi.Utils;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpUtil;
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 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;
@Component
public class GoodWeRequestUtil {
@Autowired
private HouseholdPvProducerInfoServiceImpl householdPvProducerInfoServiceImpl;
@Autowired
private GolangStationMapper golangStationMapper;
/**
* @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;
}
/**
* @param apiurl 请求url
* @param requestMethod 请求方式
* @param requestParmInfo 请求参数mapper
* @param ResultResolveRule 请求的解析
* @param tClass 需要转换成的bean
* @param <T> 泛型数据
* @return List<T> list<Result>
* @desc 根据请求参数发送http请求并且对于返回的数据进行处理
*/
public <T> List<T> getResPonse(String apiurl, String requestMethod, String requestParmInfo, String ResultResolveRule, Class<T> tClass) {
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);
respone = sendRequest(requestMethod, url, requestParmInfo, headMap);
jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone);
if (!ObjectUtils.isEmpty(jsonArray)) {
result = JSONArray.parseArray(jsonArray.toJSONString(), tClass);
}
} catch (Exception exception) {
return result;
}
return result;
}
/**
* @param resultResovle 请求返回的解析规则 来源与数据库
* @param response 请求返回的字符串
* @return 解析后的数据
* @desc 根据解析规则解析请求返回数据
*/
public JSONArray handlerResponseByResultResolverule(String resultResovle, String response) {
JSONObject jsonObject = JSONObject.parseObject(response);
JSONArray jsonArray = new JSONArray();
if (ObjectUtil.isNotEmpty(resultResovle)) {
String[] rules = resultResovle.split(",");
if (rules.length > 0) {
for (int i = 0; i < rules.length; i++) {
try {
jsonObject = (JSONObject) jsonObject.get(rules[i]);
if (jsonObject == null) {
jsonArray = (JSONArray) jsonObject.get(rules[i]);
}
} catch (Exception exception) {
jsonArray = (JSONArray) jsonObject.get(rules[i]);
}
}
}
if (jsonArray.size() == 0) {
jsonArray.add(jsonObject);
}
}
return jsonArray;
}
public String sendRequest(String requestMethod, String url, String params, HashMap<String, String> headMap) {
String respone = "";
if (requestMethod.equals("POST")) {
respone = HttpUtil.createPost(url).headerMap(headMap, false).
body(params).execute().body();
}
if (requestMethod.equals("GET")) {
respone = HttpUtil.createGet(url).headerMap(headMap, true).
body(params).execute().body();
}
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
* @param response
* @return
* @desc 根据分页规则 获取分页数
*/
public Integer getPagesize(String pageSizeResovle, String response) {
Integer pageSize = 0;
String[] rules = pageSizeResovle.split(",");
JSONObject jsonObject = JSONObject.parseObject(response);
if (rules.length > 0) {
for (int i = 0; i < rules.length - 1; i++) {
jsonObject = (JSONObject) jsonObject.get(rules[i]);
}
}
pageSize = (Integer) jsonObject.get(rules[rules.length - 1]);
return pageSize;
}
}
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.KSolarConstant;
import org.bouncycastle.jcajce.provider.symmetric.AES;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Base64;
import java.util.HashMap;
import java.util.List;
@Component
public class KSolarRequestUtil {
@Autowired
private AESUtils aesUtils;
/**
* @return HashMap<String, Object> 发送请求前的准备 准备header信息
* @deprecated 根据厂商编码获取厂商的hearer
*/
public HashMap<String, Object> getHeader() {
HashMap<String, Object> hashMap = new HashMap<>();
HashMap<String, Object> requsetParams = new HashMap<>();
HashMap<String, String> hashMaphead = new HashMap<>();
requsetParams.put("username", KSolarConstant.account);
try {
requsetParams.put("password", AESUtils.Encrypt(KSolarConstant.password, AESUtils.DEFAULT_SECRET_KEY));
} catch (Exception e) {
throw new RuntimeException(e);
}
String url = KSolarConstant.baseurl + KSolarConstant.tokenUrl;
hashMaphead.put("Authorization", "Basic " + Base64.getUrlEncoder().encodeToString((KSolarConstant.authUsername + ":" + KSolarConstant.authPassword).getBytes(StandardCharsets.UTF_8)));
String ResPonse = HttpUtil.createPost(url).headerMap(hashMaphead, false).body(JSONObject.toJSONString(requsetParams)).execute().body();
return hashMap;
}
/**
* @param apiurl 请求url
* @param requestMethod 请求方式
* @param requestParmInfo 请求参数mapper
* @param ResultResolveRule 请求的解析
* @param tClass 需要转换成的bean
* @param <T> 泛型数据
* @return List<T> list<Result>
* @desc 根据请求参数发送http请求并且对于返回的数据进行处理
*/
public <T> List<T> getResPonse(String apiurl, String requestMethod, String requestParmInfo, String ResultResolveRule, Class<T> tClass) {
String respone = "";
String params = "";
JSONArray jsonArray = null;
List<T> result = new ArrayList<>();
try {
HashMap<String, Object> producerInfo = getHeader();
String baseurl = (String) producerInfo.get("apiurl");
HashMap<String, String> headMap = (HashMap<String, String>) producerInfo.get("header");
String orginalAuthorization = headMap.get("Authorization") + ":";
String url = baseurl + apiurl;
String appsecret = (String) producerInfo.get("appsecret");
JLYHeaderMapHandler(params, headMap, orginalAuthorization, appsecret, apiurl);
respone = sendRequest(requestMethod, url, requestParmInfo, headMap);
jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone);
if (!ObjectUtils.isEmpty(jsonArray)) {
result = JSONArray.parseArray(jsonArray.toJSONString(), tClass);
}
} catch (Exception exception) {
return result;
}
return result;
}
/**
* @param resultResovle 请求返回的解析规则 来源与数据库
* @param response 请求返回的字符串
* @return 解析后的数据
* @desc 根据解析规则解析请求返回数据
*/
public JSONArray handlerResponseByResultResolverule(String resultResovle, String response) {
JSONObject jsonObject = JSONObject.parseObject(response);
JSONArray jsonArray = new JSONArray();
if (ObjectUtil.isNotEmpty(resultResovle)) {
String[] rules = resultResovle.split(",");
if (rules.length > 0) {
for (int i = 0; i < rules.length; i++) {
try {
jsonObject = (JSONObject) jsonObject.get(rules[i]);
if (jsonObject == null) {
jsonArray = (JSONArray) jsonObject.get(rules[i]);
}
} catch (Exception exception) {
jsonArray = (JSONArray) jsonObject.get(rules[i]);
}
}
}
if (jsonArray.size() == 0) {
jsonArray.add(jsonObject);
}
}
return jsonArray;
}
public String sendRequest(String requestMethod, String url, String params, HashMap<String, String> headMap) {
String respone = "";
if (requestMethod.equals("POST")) {
respone = HttpUtil.createPost(url).headerMap(headMap, false).
body(params).execute().body();
}
if (requestMethod.equals("GET")) {
respone = HttpUtil.createGet(url).headerMap(headMap, true).
body(params).execute().body();
}
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
* @param response
* @return
* @desc 根据分页规则 获取分页数
*/
public Integer getPagesize(String pageSizeResovle, String response) {
Integer pageSize = 0;
String[] rules = pageSizeResovle.split(",");
JSONObject jsonObject = JSONObject.parseObject(response);
if (rules.length > 0) {
for (int i = 0; i < rules.length - 1; i++) {
jsonObject = (JSONObject) jsonObject.get(rules[i]);
}
}
pageSize = (Integer) jsonObject.get(rules[rules.length - 1]);
return pageSize;
}
}
package com.yeejoin.amos.api.householdapi.Utils;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@Component
public class SofarRequestUtil {
/**
* @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;
}
/**
* @param apiurl 请求url
* @param requestMethod 请求方式
* @param requestParmInfo 请求参数mapper
* @param ResultResolveRule 请求的解析
* @param tClass 需要转换成的bean
* @param <T> 泛型数据
* @return List<T> list<Result>
* @desc 根据请求参数发送http请求并且对于返回的数据进行处理
*/
public <T> List<T> getResPonse(String apiurl, String requestMethod, String requestParmInfo, String ResultResolveRule, Class<T> tClass) {
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);
respone = sendRequest(requestMethod, url, requestParmInfo, headMap);
jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone);
if (!ObjectUtils.isEmpty(jsonArray)) {
result = JSONArray.parseArray(jsonArray.toJSONString(), tClass);
}
} catch (Exception exception) {
return result;
}
return result;
}
/**
* @param resultResovle 请求返回的解析规则 来源与数据库
* @param response 请求返回的字符串
* @return 解析后的数据
* @desc 根据解析规则解析请求返回数据
*/
public JSONArray handlerResponseByResultResolverule(String resultResovle, String response) {
JSONObject jsonObject = JSONObject.parseObject(response);
JSONArray jsonArray = new JSONArray();
if (ObjectUtil.isNotEmpty(resultResovle)) {
String[] rules = resultResovle.split(",");
if (rules.length > 0) {
for (int i = 0; i < rules.length; i++) {
try {
jsonObject = (JSONObject) jsonObject.get(rules[i]);
if (jsonObject == null) {
jsonArray = (JSONArray) jsonObject.get(rules[i]);
}
} catch (Exception exception) {
jsonArray = (JSONArray) jsonObject.get(rules[i]);
}
}
}
if (jsonArray.size() == 0) {
jsonArray.add(jsonObject);
}
}
return jsonArray;
}
public String sendRequest(String requestMethod, String url, String params, HashMap<String, String> headMap) {
String respone = "";
if (requestMethod.equals("POST")) {
respone = HttpUtil.createPost(url).headerMap(headMap, false).
body(params).execute().body();
}
if (requestMethod.equals("GET")) {
respone = HttpUtil.createGet(url).headerMap(headMap, true).
body(params).execute().body();
}
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
* @param response
* @return
* @desc 根据分页规则 获取分页数
*/
public Integer getPagesize(String pageSizeResovle, String response) {
Integer pageSize = 0;
String[] rules = pageSizeResovle.split(",");
JSONObject jsonObject = JSONObject.parseObject(response);
if (rules.length > 0) {
for (int i = 0; i < rules.length - 1; i++) {
jsonObject = (JSONObject) jsonObject.get(rules[i]);
}
}
pageSize = (Integer) jsonObject.get(rules[rules.length - 1]);
return pageSize;
}
}
...@@ -5,6 +5,9 @@ import org.apache.xmlbeans.impl.xb.xsdschema.Public; ...@@ -5,6 +5,9 @@ import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.HashMap; import java.util.HashMap;
/**
* 锦浪云常量
*/
public class GoLangConstant { public class GoLangConstant {
public static final HashMap<String, String> stationStaus = new HashMap<String, String>() { public static final HashMap<String, String> stationStaus = new HashMap<String, String>() {
{ {
......
package com.yeejoin.amos.api.householdapi.constant;
/**
* 固德威常量
*/
public class GoodWeConstant {
}
package com.yeejoin.amos.api.householdapi.constant;
public class KSolarConstant {
public static String baseurl ="http://111.230.136.62:8092";
public static String account ="三一硅能";
public static String password ="sygn2022";
public static String tokenUrl ="/authentication/form";
public static String authUsername ="kstar";
public static String authPassword ="kstarSecret";
}
package com.yeejoin.amos.api.householdapi.constant;
/**
* 首航常量
*/
public class SoFarConstant {
}
package com.yeejoin.amos.api.householdapi.controller; package com.yeejoin.amos.api.householdapi.controller;
import com.yeejoin.amos.api.householdapi.Utils.GolangRequestUtil;
import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils; import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant; import com.yeejoin.amos.api.householdapi.Utils.KSolarRequestUtil;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.GolangStationList;
import com.yeejoin.amos.api.householdapi.face.service.GoLangDataAcquisitionService; import com.yeejoin.amos.api.householdapi.face.service.GoLangDataAcquisitionService;
import fastjson.JSON; import fastjson.JSON;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -32,7 +30,9 @@ public class HouseholdTestController { ...@@ -32,7 +30,9 @@ public class HouseholdTestController {
@Autowired @Autowired
private HouseholdPvUtils householdPvUtils; private HouseholdPvUtils householdPvUtils;
@Autowired @Autowired
private GoLangDataAcquisitionService goLangDataAcquisitionService; private GoLangDataAcquisitionService goLangDataAcquisitionService;
@Autowired
private KSolarRequestUtil kSolarRequestUtil;
/** /**
...@@ -46,6 +46,7 @@ public class HouseholdTestController { ...@@ -46,6 +46,7 @@ public class HouseholdTestController {
public String save(Long seq) throws IOException { public String save(Long seq) throws IOException {
return householdPvUtils.gerResponseByAPiID(seq); return householdPvUtils.gerResponseByAPiID(seq);
} }
/** /**
* 新增户用光伏-厂商API haders * 新增户用光伏-厂商API haders
* *
...@@ -60,7 +61,62 @@ public class HouseholdTestController { ...@@ -60,7 +61,62 @@ public class HouseholdTestController {
// goLangDataAcquisitionService.collectorList(); // goLangDataAcquisitionService.collectorList();
//// goLangDataAcquisitionService.inverterList(); //// goLangDataAcquisitionService.inverterList();
goLangDataAcquisitionService.collectorDetail(); goLangDataAcquisitionService.collectorDetail();
goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo();
}
/**
* 新增户用光伏-厂商API haders
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/sofarnew")
@ApiOperation(httpMethod = "POST", value = "首航", notes = "首航")
public void sofarnew() throws IOException {
// goLangDataAcquisitionService.stationList();
// goLangDataAcquisitionService.stationDetail();
// goLangDataAcquisitionService.collectorList();
//// goLangDataAcquisitionService.inverterList();
// goLangDataAcquisitionService.collectorDetail();
// goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo();
}
/**
* 新增户用光伏-厂商API haders
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/goodWenew")
@ApiOperation(httpMethod = "POST", value = "固德威", notes = "固德威")
public void goodWenew() throws IOException {
// goLangDataAcquisitionService.stationList();
// goLangDataAcquisitionService.stationDetail();
// goLangDataAcquisitionService.collectorList();
//// goLangDataAcquisitionService.inverterList();
// goLangDataAcquisitionService.collectorDetail();
// goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo();
}
/**
* 新增户用光伏-厂商API haders
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/ksolarnew")
@ApiOperation(httpMethod = "POST", value = "科士达", notes = "科士达")
public void ksolarnew() throws IOException {
// goLangDataAcquisitionService.stationList();
// goLangDataAcquisitionService.stationDetail();
// goLangDataAcquisitionService.collectorList();
//// goLangDataAcquisitionService.inverterList();
// goLangDataAcquisitionService.collectorDetail();
// goLangDataAcquisitionService.inverterDetail(); // goLangDataAcquisitionService.inverterDetail();
// goLangDataAcquisitionService.inverAlramInfo(); // goLangDataAcquisitionService.inverAlramInfo();
kSolarRequestUtil.getHeader();
} }
} }
package com.yeejoin.amos.api.householdapi.face.service;
public interface GoodWeDataAcquisitionService {
/**
* @descrption 场站列表数据入库
*/
void stationList();
/**
* @descrption 场站详情数据入库
*/
void stationDetail();
/**
* @descrption 采集器列表数据入库
*/
void collectorList();
/**
* @descrption 采集器详情数据入库
*/
void collectorDetail();
/**
* @descrption 逆变器列表数据入库
*/
void inverterList();
/**
* @descrption 逆变器详情数据入库
*/
void inverterDetail();
/**
* @descrption 采集器告警列表数据入库
*/
void inverAlramInfo();
}
package com.yeejoin.amos.api.householdapi.face.service;
public interface SofarDataAcquisitionService {
/**
* @descrption 场站列表数据入库
*/
void stationList();
/**
* @descrption 场站详情数据入库
*/
void stationDetail();
/**
* @descrption 采集器列表数据入库
*/
void collectorList();
/**
* @descrption 采集器详情数据入库
*/
void collectorDetail();
/**
* @descrption 逆变器列表数据入库
*/
void inverterList();
/**
* @descrption 逆变器详情数据入库
*/
void inverterDetail();
/**
* @descrption 采集器告警列表数据入库
*/
void inverAlramInfo();
}
...@@ -2,9 +2,7 @@ package com.yeejoin.amos.api.householdapi.face.service.impl; ...@@ -2,9 +2,7 @@ package com.yeejoin.amos.api.householdapi.face.service.impl;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.core.JsonParser;
import com.yeejoin.amos.api.householdapi.Utils.GolangRequestUtil; import com.yeejoin.amos.api.householdapi.Utils.GolangRequestUtil;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant; import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
import com.yeejoin.amos.api.householdapi.face.dto.AlarmDto; import com.yeejoin.amos.api.householdapi.face.dto.AlarmDto;
...@@ -39,7 +37,7 @@ import java.util.concurrent.TimeUnit; ...@@ -39,7 +37,7 @@ import java.util.concurrent.TimeUnit;
@Service @Service
public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionService { public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionService {
//定时任务执行频率 当前为10分钟一次 //定时任务执行频率 当前为10分钟一次
private final String dataRequstScheduled = "0 0/10 * * * *"; private final String dataRequstScheduled = "0 0/60 * * * *";
//锦浪云请求工具封装 //锦浪云请求工具封装
@Autowired @Autowired
......
...@@ -6,7 +6,9 @@ public enum PVProducerInfoEnum { ...@@ -6,7 +6,9 @@ public enum PVProducerInfoEnum {
GDW("固德威","GDW"), GDW("固德威","GDW"),
SH("首航","SH"), SH("首航","SH"),
JLY("锦浪云","JLY"); JLY("锦浪云","JLY"),
KSOLAR("科士达","KSD"),
HUAWEI("华为","HW");
private String name; private String name;
......
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