Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
f84ef9ab
Commit
f84ef9ab
authored
Sep 25, 2023
by
chenzhao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://39.98.45.134:8090/moa/amos-boot-biz
into developer
parents
4b32b581
860a7d9e
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
789 additions
and
42 deletions
+789
-42
AESUtils.java
...ava/com/yeejoin/amos/api/householdapi/Utils/AESUtils.java
+94
-0
GolangRequestUtil.java
...eejoin/amos/api/householdapi/Utils/GolangRequestUtil.java
+0
-10
GoodWeRequestUtil.java
...eejoin/amos/api/householdapi/Utils/GoodWeRequestUtil.java
+163
-0
KSolarRequestUtil.java
...eejoin/amos/api/householdapi/Utils/KSolarRequestUtil.java
+165
-0
SofarRequestUtil.java
...yeejoin/amos/api/householdapi/Utils/SofarRequestUtil.java
+155
-0
GoLangConstant.java
...eejoin/amos/api/householdapi/constant/GoLangConstant.java
+3
-0
GoodWeConstant.java
...eejoin/amos/api/householdapi/constant/GoodWeConstant.java
+8
-0
KSolarConstant.java
...eejoin/amos/api/householdapi/constant/KSolarConstant.java
+11
-0
SoFarConstant.java
...yeejoin/amos/api/householdapi/constant/SoFarConstant.java
+8
-0
HouseholdTestController.java
.../api/householdapi/controller/HouseholdTestController.java
+61
-5
CollectorDetailDto.java
...in/amos/api/householdapi/face/dto/CollectorDetailDto.java
+1
-0
JpCollector.java
...useholdapi/face/orm/houseapi/entity/hygf/JpCollector.java
+5
-1
GoodWeDataAcquisitionService.java
...useholdapi/face/service/GoodWeDataAcquisitionService.java
+32
-0
SofarDataAcquisitionService.java
...ouseholdapi/face/service/SofarDataAcquisitionService.java
+32
-0
GoLangDataAcquisitionServiceImpl.java
...i/face/service/impl/GoLangDataAcquisitionServiceImpl.java
+7
-5
PVProducerInfoEnum.java
...va/com/yeejoin/amos/openapi/enums/PVProducerInfoEnum.java
+3
-1
JpStationController.java
.../boot/module/hygf/biz/controller/JpStationController.java
+1
-1
TdHygfJpInverterWarnController.java
...e/hygf/biz/controller/TdHygfJpInverterWarnController.java
+2
-2
WindSpeedScheduled.java
...os/boot/module/hygf/biz/scheduled/WindSpeedScheduled.java
+2
-0
JpStationServiceImpl.java
...ot/module/hygf/biz/service/impl/JpStationServiceImpl.java
+14
-2
IdxBizFanHealthIndexMapper.xml
...n/resources/mapper/cluster/IdxBizFanHealthIndexMapper.xml
+14
-13
HouseholdPvController.java
...ot/module/jxiop/biz/controller/HouseholdPvController.java
+8
-2
No files found.
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/Utils/AESUtils.java
0 → 100644
View file @
f84ef9ab
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
);
}
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/Utils/GolangRequestUtil.java
View file @
f84ef9ab
...
@@ -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信息
...
...
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/Utils/GoodWeRequestUtil.java
0 → 100644
View file @
f84ef9ab
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
;
}
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/Utils/KSolarRequestUtil.java
0 → 100644
View file @
f84ef9ab
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
;
}
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/Utils/SofarRequestUtil.java
0 → 100644
View file @
f84ef9ab
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
;
}
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/constant/GoLangConstant.java
View file @
f84ef9ab
...
@@ -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
>()
{
{
{
...
...
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/constant/GoodWeConstant.java
0 → 100644
View file @
f84ef9ab
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
constant
;
/**
* 固德威常量
*/
public
class
GoodWeConstant
{
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/constant/KSolarConstant.java
0 → 100644
View file @
f84ef9ab
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"
;
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/constant/SoFarConstant.java
0 → 100644
View file @
f84ef9ab
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
constant
;
/**
* 首航常量
*/
public
class
SoFarConstant
{
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/controller/HouseholdTestController.java
View file @
f84ef9ab
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
*
*
...
@@ -56,11 +57,66 @@ public class HouseholdTestController {
...
@@ -56,11 +57,66 @@ public class HouseholdTestController {
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"锦浪云"
,
notes
=
"锦浪云"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"锦浪云"
,
notes
=
"锦浪云"
)
public
void
golangnew
()
throws
IOException
{
public
void
golangnew
()
throws
IOException
{
// goLangDataAcquisitionService.stationList();
// goLangDataAcquisitionService.stationList();
goLangDataAcquisitionService
.
stationDetail
();
//
goLangDataAcquisitionService.stationDetail();
// goLangDataAcquisitionService.collectorList();
// goLangDataAcquisitionService.collectorList();
//// goLangDataAcquisitionService.inverterList();
//// goLangDataAcquisitionService.inverterList();
goLangDataAcquisitionService
.
collectorDetail
();
goLangDataAcquisitionService
.
collectorDetail
();
goLangDataAcquisitionService
.
inverterDetail
();
goLangDataAcquisitionService
.
inverterDetail
();
// goLangDataAcquisitionService.inverAlramInfo();
// 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.inverAlramInfo();
kSolarRequestUtil
.
getHeader
();
}
}
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/dto/CollectorDetailDto.java
View file @
f84ef9ab
...
@@ -13,6 +13,7 @@ public class CollectorDetailDto {
...
@@ -13,6 +13,7 @@ public class CollectorDetailDto {
private
String
stationId
;
private
String
stationId
;
private
String
rssiLevel
;
private
String
rssiLevel
;
private
String
model
;
private
String
model
;
private
String
name
;
private
String
addr
;
private
String
addr
;
private
String
stationName
;
private
String
stationName
;
}
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/orm/houseapi/entity/hygf/JpCollector.java
View file @
f84ef9ab
...
@@ -126,5 +126,9 @@ public class JpCollector implements Serializable {
...
@@ -126,5 +126,9 @@ public class JpCollector implements Serializable {
*/
*/
@TableField
(
"addr"
)
@TableField
(
"addr"
)
private
String
addr
;
private
String
addr
;
/**
* 场站地址
*/
@TableField
(
"name"
)
private
String
name
;
}
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/GoodWeDataAcquisitionService.java
0 → 100644
View file @
f84ef9ab
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
();
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/SofarDataAcquisitionService.java
0 → 100644
View file @
f84ef9ab
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
();
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/impl/GoLangDataAcquisitionServiceImpl.java
View file @
f84ef9ab
...
@@ -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/
1
0 * * * *"
;
private
final
String
dataRequstScheduled
=
"0 0/
6
0 * * * *"
;
//锦浪云请求工具封装
//锦浪云请求工具封装
@Autowired
@Autowired
...
@@ -151,11 +149,11 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
...
@@ -151,11 +149,11 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpStation
.
setStationContact
(
String
.
valueOf
(
golangStationDetail
.
getMobile
()).
toLowerCase
().
replace
(
"null"
,
""
));
jpStation
.
setStationContact
(
String
.
valueOf
(
golangStationDetail
.
getMobile
()).
toLowerCase
().
replace
(
"null"
,
""
));
jpStation
.
setModuleCount
(
ObjectUtils
.
isEmpty
(
Math
.
toIntExact
(
golangStationDetail
.
getModule
()))?
0
:
Math
.
toIntExact
(
golangStationDetail
.
getModule
()));
jpStation
.
setModuleCount
(
ObjectUtils
.
isEmpty
(
Math
.
toIntExact
(
golangStationDetail
.
getModule
()))?
0
:
Math
.
toIntExact
(
golangStationDetail
.
getModule
()));
//并网类型
//并网类型
jpStation
.
set
OnGridTyp
e
(
GoLangConstant
.
stationStaus
.
get
(
String
.
valueOf
(
golangStationDetail
.
getState
())));
jpStation
.
set
Stat
e
(
GoLangConstant
.
stationStaus
.
get
(
String
.
valueOf
(
golangStationDetail
.
getState
())));
jpStation
.
setThirdStationId
(
String
.
valueOf
(
golangStationDetail
.
getId
()));
jpStation
.
setThirdStationId
(
String
.
valueOf
(
golangStationDetail
.
getId
()));
jpStation
.
setThirdCode
(
PVProducerInfoEnum
.
JLY
.
getCode
());
jpStation
.
setThirdCode
(
PVProducerInfoEnum
.
JLY
.
getCode
());
jpStation
.
setRealTimePower
(
golangStationDetail
.
getPower
());
jpStation
.
setRealTimePower
(
golangStationDetail
.
getPower
());
jpStation
.
set
Stat
e
(
GoLangConstant
.
intoNetWorkStatus
.
get
(
String
.
valueOf
(
golangStationDetail
.
getStationtypenew
())));
jpStation
.
set
OnGridTyp
e
(
GoLangConstant
.
intoNetWorkStatus
.
get
(
String
.
valueOf
(
golangStationDetail
.
getStationtypenew
())));
jpStation
.
setDayGenerate
(
golangStationDetail
.
getDayenergy
());
jpStation
.
setDayGenerate
(
golangStationDetail
.
getDayenergy
());
jpStation
.
setMonthGenerate
(
golangStationDetail
.
getMonthenergy
()
*
GoLangConstant
.
mwhTokwh
);
jpStation
.
setMonthGenerate
(
golangStationDetail
.
getMonthenergy
()
*
GoLangConstant
.
mwhTokwh
);
jpStation
.
setYearGenerate
(
golangStationDetail
.
getYearenergy
()
*
GoLangConstant
.
mwhTokwh
);
jpStation
.
setYearGenerate
(
golangStationDetail
.
getYearenergy
()
*
GoLangConstant
.
mwhTokwh
);
...
@@ -285,8 +283,10 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
...
@@ -285,8 +283,10 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpCollector
.
setThirdCode
(
PVProducerInfoEnum
.
JLY
.
getCode
());
jpCollector
.
setThirdCode
(
PVProducerInfoEnum
.
JLY
.
getCode
());
//第三方厂商标识
//第三方厂商标识
jpCollector
.
setState
(
GoLangConstant
.
stationStaus
.
get
(
collectorDetailDto
.
getState
()));
jpCollector
.
setState
(
GoLangConstant
.
stationStaus
.
get
(
collectorDetailDto
.
getState
()));
jpCollector
.
setStationName
(
collectorDetailDto
.
getStationName
());
jpCollector
.
setStationName
(
collectorDetailDto
.
getStationName
());
jpCollector
.
setAddr
(
collectorDetailDto
.
getAddr
());
jpCollector
.
setAddr
(
collectorDetailDto
.
getAddr
());
jpCollector
.
setName
(
collectorDetailDto
.
getName
());
if
(
ObjectUtils
.
isEmpty
(
jpCollector
.
getSequenceNbr
()))
{
if
(
ObjectUtils
.
isEmpty
(
jpCollector
.
getSequenceNbr
()))
{
jpCollectorMapper
.
insert
(
jpCollector
);
jpCollectorMapper
.
insert
(
jpCollector
);
}
else
{
}
else
{
...
@@ -401,6 +401,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
...
@@ -401,6 +401,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpInverterElectricity
.
setInverterId
(
inverterDetailDto
.
getId
());
jpInverterElectricity
.
setInverterId
(
inverterDetailDto
.
getId
());
jpInverterElectricity
.
setSnCode
(
inverterDetailDto
.
getSn
());
jpInverterElectricity
.
setSnCode
(
inverterDetailDto
.
getSn
());
jpInverterElectricity
.
setThirdCode
(
PVProducerInfoEnum
.
JLY
.
getCode
());
jpInverterElectricity
.
setThirdCode
(
PVProducerInfoEnum
.
JLY
.
getCode
());
jpInverterElectricity
.
setThirdStationId
(
String
.
valueOf
(
inverterDetailDto
.
getStationId
()));
jpInverterElectricity
.
setType
(
"交流"
);
jpInverterElectricity
.
setType
(
"交流"
);
jpInverterElectricity
.
setName
(
"AC"
+
k
);
jpInverterElectricity
.
setName
(
"AC"
+
k
);
jpInverterElectricity
.
setVoltage
(
Double
.
valueOf
(
hanlderResult
.
get
(
"uAc"
+
k
).
toString
()));
jpInverterElectricity
.
setVoltage
(
Double
.
valueOf
(
hanlderResult
.
get
(
"uAc"
+
k
).
toString
()));
...
@@ -423,6 +424,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
...
@@ -423,6 +424,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpInverterElectricity
.
setInverterId
(
inverterDetailDto
.
getId
());
jpInverterElectricity
.
setInverterId
(
inverterDetailDto
.
getId
());
jpInverterElectricity
.
setSnCode
(
inverterDetailDto
.
getSn
());
jpInverterElectricity
.
setSnCode
(
inverterDetailDto
.
getSn
());
jpInverterElectricity
.
setThirdCode
(
PVProducerInfoEnum
.
JLY
.
getCode
());
jpInverterElectricity
.
setThirdCode
(
PVProducerInfoEnum
.
JLY
.
getCode
());
jpInverterElectricity
.
setThirdStationId
(
String
.
valueOf
(
inverterDetailDto
.
getStationId
()));
jpInverterElectricity
.
setType
(
"直流"
);
jpInverterElectricity
.
setType
(
"直流"
);
jpInverterElectricity
.
setName
(
"PV"
+
k1
);
jpInverterElectricity
.
setName
(
"PV"
+
k1
);
jpInverterElectricity
.
setVoltage
(
Double
.
valueOf
(
hanlderResult
.
get
(
"uPv"
+
k1
).
toString
()));
jpInverterElectricity
.
setVoltage
(
Double
.
valueOf
(
hanlderResult
.
get
(
"uPv"
+
k1
).
toString
()));
...
...
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/openapi/enums/PVProducerInfoEnum.java
View file @
f84ef9ab
...
@@ -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
;
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/JpStationController.java
View file @
f84ef9ab
...
@@ -158,7 +158,7 @@ public class JpStationController extends BaseController {
...
@@ -158,7 +158,7 @@ public class JpStationController extends BaseController {
collector
.
put
(
"zx"
,
0
);
collector
.
put
(
"zx"
,
0
);
collector
.
put
(
"bj"
,
0
);
collector
.
put
(
"bj"
,
0
);
collector
.
put
(
"lx"
,
0
);
collector
.
put
(
"lx"
,
0
);
if
(
list
!=
null
&&
list
.
isEmpty
()){
if
(
list
!=
null
&&
!
list
.
isEmpty
()){
for
(
Map
<
String
,
Object
>
map
:
list
)
{
for
(
Map
<
String
,
Object
>
map
:
list
)
{
if
(
"在线"
.
equals
(
map
.
get
(
"state"
).
toString
())){
if
(
"在线"
.
equals
(
map
.
get
(
"state"
).
toString
())){
collector
.
put
(
"zx"
,
Integer
.
valueOf
(
map
.
get
(
"num"
).
toString
()));
collector
.
put
(
"zx"
,
Integer
.
valueOf
(
map
.
get
(
"num"
).
toString
()));
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/TdHygfJpInverterWarnController.java
View file @
f84ef9ab
...
@@ -205,9 +205,9 @@ public class TdHygfJpInverterWarnController extends BaseController {
...
@@ -205,9 +205,9 @@ public class TdHygfJpInverterWarnController extends BaseController {
if
(
datalist
!=
null
&&!
datalist
.
isEmpty
()){
if
(
datalist
!=
null
&&!
datalist
.
isEmpty
()){
for
(
Map
<
String
,
Object
>
map
:
datalist
)
{
for
(
Map
<
String
,
Object
>
map
:
datalist
)
{
if
(
"未处理"
.
equals
(
map
.
get
(
"state"
).
toString
())){
if
(
"未处理"
.
equals
(
map
.
get
(
"state"
).
toString
())){
collector
.
put
(
"wcl"
,
map
.
get
(
"num"
));
collector
.
put
(
"wcl"
,
Integer
.
valueOf
(
map
.
get
(
"num"
).
toString
()
));
}
else
if
(
"已处理"
.
equals
(
map
.
get
(
"state"
).
toString
())||
"已恢复"
.
equals
(
map
.
get
(
"state"
).
toString
())){
}
else
if
(
"已处理"
.
equals
(
map
.
get
(
"state"
).
toString
())||
"已恢复"
.
equals
(
map
.
get
(
"state"
).
toString
())){
collector
.
put
(
"ycl"
,
map
.
get
(
"num"
));
collector
.
put
(
"ycl"
,
Integer
.
valueOf
(
map
.
get
(
"num"
).
toString
()
));
}
}
}
}
}
}
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/scheduled/WindSpeedScheduled.java
View file @
f84ef9ab
...
@@ -8,6 +8,7 @@ import org.springframework.scheduling.annotation.Scheduled;
...
@@ -8,6 +8,7 @@ import org.springframework.scheduling.annotation.Scheduled;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.MonthPowerServiceImpl
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.MonthPowerServiceImpl
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpCollectorHistoryServiceImpl
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpCollectorHistoryServiceImpl
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpInvertorElecHistoryServiceImpl
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpInvertorElecHistoryServiceImpl
;
import
org.springframework.stereotype.Component
;
/**
/**
* @description:
* @description:
...
@@ -15,6 +16,7 @@ import com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpInvertorElecHi
...
@@ -15,6 +16,7 @@ import com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpInvertorElecHi
* @createDate: 2023/9/21
* @createDate: 2023/9/21
*/
*/
@EnableScheduling
@EnableScheduling
@Component
public
class
WindSpeedScheduled
{
public
class
WindSpeedScheduled
{
@Autowired
@Autowired
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/JpStationServiceImpl.java
View file @
f84ef9ab
...
@@ -128,7 +128,13 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
...
@@ -128,7 +128,13 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
int
month
=
aCalendar
.
get
(
Calendar
.
MONTH
)
+
1
;
//月份
int
month
=
aCalendar
.
get
(
Calendar
.
MONTH
)
+
1
;
//月份
int
day
=
aCalendar
.
getActualMaximum
(
Calendar
.
DATE
);
int
day
=
aCalendar
.
getActualMaximum
(
Calendar
.
DATE
);
for
(
int
i
=
1
;
i
<=
day
;
i
++)
{
for
(
int
i
=
1
;
i
<=
day
;
i
++)
{
String
aDate
=
month
+
"-"
+
i
;
String
aDate
=
null
;
if
(
i
<
10
){
aDate
=
date
+
"-0"
+
i
;
}
else
{
aDate
=
date
+
"-"
+
i
;
}
listx
.
add
(
aDate
);
listx
.
add
(
aDate
);
listy
.
add
(
0
);
listy
.
add
(
0
);
}
}
...
@@ -145,7 +151,13 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
...
@@ -145,7 +151,13 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
List
<
Object
>
listx
=
new
ArrayList
<>();
List
<
Object
>
listx
=
new
ArrayList
<>();
List
<
Object
>
listy
=
new
ArrayList
<>();
List
<
Object
>
listy
=
new
ArrayList
<>();
for
(
int
i
=
1
;
i
<=
12
;
i
++)
{
for
(
int
i
=
1
;
i
<=
12
;
i
++)
{
String
aDate
=
date
+
"-"
+
i
;
String
aDate
=
null
;
if
(
i
<
10
){
aDate
=
date
+
"-0"
+
i
;
}
else
{
aDate
=
date
+
"-"
+
i
;
}
listx
.
add
(
aDate
);
listx
.
add
(
aDate
);
listy
.
add
(
0
);
listy
.
add
(
0
);
}
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/cluster/IdxBizFanHealthIndexMapper.xml
View file @
f84ef9ab
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
FROM
FROM
(
(
SELECT
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex
IFNULL( AVG( HEALTH_INDEX ),
10
0 ) AS avgHealthIndex
FROM
FROM
idx_biz_fan_health_index
idx_biz_fan_health_index
<where>
ANALYSIS_TYPE = '按天'
<where>
ANALYSIS_TYPE = '按天'
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
UNION ALL
UNION ALL
(
(
SELECT
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex
IFNULL( AVG( HEALTH_INDEX ),
10
0 ) AS avgHealthIndex
FROM
FROM
idx_biz_pv_health_index
idx_biz_pv_health_index
<where>
<where>
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
<select
id=
"getHealthListInfo"
resultType=
"java.util.Map"
>
<select
id=
"getHealthListInfo"
resultType=
"java.util.Map"
>
SELECT
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
IFNULL( AVG( HEALTH_INDEX ),
10
0 ) AS avgHealthIndex,
a.date
a.date
FROM
FROM
(
(
...
@@ -123,7 +123,7 @@
...
@@ -123,7 +123,7 @@
FROM
FROM
(
(
SELECT
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
IFNULL( AVG( HEALTH_INDEX ),
10
0 ) AS avgHealthIndex,
ARAE
ARAE
FROM
FROM
idx_biz_fan_health_index
idx_biz_fan_health_index
...
@@ -135,7 +135,7 @@
...
@@ -135,7 +135,7 @@
ARAE UNION ALL
ARAE UNION ALL
(
(
SELECT
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
IFNULL( AVG( HEALTH_INDEX ),
10
0 ) AS avgHealthIndex,
ARAE
ARAE
FROM
FROM
idx_biz_pv_health_index
idx_biz_pv_health_index
...
@@ -180,7 +180,7 @@
...
@@ -180,7 +180,7 @@
FROM
FROM
(
(
SELECT
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
IFNULL( AVG( HEALTH_INDEX ),
10
0 ) AS avgHealthIndex,
STATION
STATION
FROM
FROM
idx_biz_fan_health_index
idx_biz_fan_health_index
...
@@ -197,7 +197,7 @@
...
@@ -197,7 +197,7 @@
STATION UNION ALL
STATION UNION ALL
(
(
SELECT
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
IFNULL( AVG( HEALTH_INDEX ),
10
0 ) AS avgHealthIndex,
STATION
STATION
FROM
FROM
idx_biz_pv_health_index
idx_biz_pv_health_index
...
@@ -307,7 +307,7 @@
...
@@ -307,7 +307,7 @@
<select
id=
"getSubSystemInfo"
resultType=
"java.util.Map"
>
<select
id=
"getSubSystemInfo"
resultType=
"java.util.Map"
>
SELECT
SELECT
IFNULL( HEALTH_INDEX, 0 ) AS healthIndex,
IFNULL( HEALTH_INDEX,
10
0 ) AS healthIndex,
SUB_SYSTEM AS subSystem
SUB_SYSTEM AS subSystem
FROM
FROM
idx_biz_fan_health_index
idx_biz_fan_health_index
...
@@ -317,7 +317,7 @@
...
@@ -317,7 +317,7 @@
AND ANALYSIS_TYPE = '按天'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if
test=
"equipmentName != null and equipmentName != ''"
>
<if
test=
"equipmentName != null and equipmentName != ''"
>
AND EQUIPMENT_NAME
= #{equipmentName}
AND EQUIPMENT_NAME
like concat( '%', #{equipmentName} '风机系统')
</if>
</if>
<if
test=
"gatewayId != null and gatewayId != ''"
>
<if
test=
"gatewayId != null and gatewayId != ''"
>
AND GATEWAY_ID = #{gatewayId}
AND GATEWAY_ID = #{gatewayId}
...
@@ -346,7 +346,7 @@
...
@@ -346,7 +346,7 @@
<select
id=
"getFanHealthInfoList"
resultType=
"java.util.Map"
>
<select
id=
"getFanHealthInfoList"
resultType=
"java.util.Map"
>
SELECT
SELECT
IFNULL( AVG( HEALTH_INDEX ), 0 ) AS avgHealthIndex,
IFNULL( AVG( HEALTH_INDEX ),
10
0 ) AS avgHealthIndex,
EQUIPMENT_NAME as equipmentName
EQUIPMENT_NAME as equipmentName
FROM
FROM
idx_biz_fan_health_index
idx_biz_fan_health_index
...
@@ -371,7 +371,7 @@
...
@@ -371,7 +371,7 @@
idx_biz_fan_point_process_variable_classification
idx_biz_fan_point_process_variable_classification
<where>
<where>
<if
test=
"equipmentName != null and equipmentName != ''"
>
<if
test=
"equipmentName != null and equipmentName != ''"
>
AND EQUIPMENT_NAME
= #{equipmentName}
AND EQUIPMENT_NAME
like concat( '%', #{equipmentName} '风机系统')
</if>
</if>
<if
test=
"gatewayId != null and gatewayId != ''"
>
<if
test=
"gatewayId != null and gatewayId != ''"
>
AND GATEWAY_ID = #{gatewayId}
AND GATEWAY_ID = #{gatewayId}
...
@@ -401,7 +401,7 @@
...
@@ -401,7 +401,7 @@
<select
id=
"getHealthInfoBySubSystem"
resultType=
"java.util.Map"
>
<select
id=
"getHealthInfoBySubSystem"
resultType=
"java.util.Map"
>
SELECT
SELECT
IFNULL( avg( HEALTH_INDEX ), 0 ) AS healthIndex,
IFNULL( avg( HEALTH_INDEX ),
10
0 ) AS healthIndex,
POINT_NAME AS pointName
POINT_NAME AS pointName
FROM
FROM
idx_biz_fan_health_index
idx_biz_fan_health_index
...
@@ -547,7 +547,8 @@
...
@@ -547,7 +547,8 @@
<select
id=
"getPvPointNameListBySumSystem"
resultType=
"java.util.Map"
>
<select
id=
"getPvPointNameListBySumSystem"
resultType=
"java.util.Map"
>
SELECT
SELECT
POINT_NAME as pointName
POINT_NAME as pointName,
INDEX_ADDRESS as indexAddress
FROM
FROM
idx_biz_pv_point_process_variable_classification
idx_biz_pv_point_process_variable_classification
<where>
<where>
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/HouseholdPvController.java
View file @
f84ef9ab
...
@@ -257,8 +257,14 @@ public class HouseholdPvController extends BaseController {
...
@@ -257,8 +257,14 @@ public class HouseholdPvController extends BaseController {
row
.
createCell
(
4
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getPhone
())
?
""
:
item
.
getPhone
());
row
.
createCell
(
4
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getPhone
())
?
""
:
item
.
getPhone
());
row
.
createCell
(
5
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getInstallAddress
())
?
""
:
item
.
getInstallAddress
());
row
.
createCell
(
5
).
setCellValue
(
ObjectUtils
.
isEmpty
(
item
.
getInstallAddress
())
?
""
:
item
.
getInstallAddress
());
// 安装总功率
// 安装总功率
if
(!
ObjectUtils
.
isEmpty
(
item
)&&
!
ObjectUtils
.
isEmpty
(
item
.
getActualCapacity
())
&&
!
ObjectUtils
.
isEmpty
(
item
.
getInstallCount
()))
{
//updateTime: 2023年9月22日 14点26分
long
multiplyExact
=
Math
.
multiplyExact
(
Long
.
parseLong
(
item
.
getActualCapacity
()),
Long
.
parseLong
(
item
.
getInstallCount
()));
//desc:客户提出导出时该值由原来的 预计功率*安装数量 修改为 组件单片功率 * 安装数量
//changer: 曹涛
// if (!ObjectUtils.isEmpty(item)&& !ObjectUtils.isEmpty(item.getActualCapacity()) && !ObjectUtils.isEmpty(item.getInstallCount())) {
// long multiplyExact = Math.multiplyExact(Long.parseLong(item.getActualCapacity()), Long.parseLong(item.getInstallCount()));
// row.createCell(6).setCellValue(String.valueOf(multiplyExact));
if
(!
ObjectUtils
.
isEmpty
(
item
)&&
!
ObjectUtils
.
isEmpty
(
item
.
getMonolithicPower
())
&&
!
ObjectUtils
.
isEmpty
(
item
.
getInstallCount
()))
{
long
multiplyExact
=
Math
.
multiplyExact
(
Long
.
parseLong
(
item
.
getMonolithicPower
()),
Long
.
parseLong
(
item
.
getInstallCount
()));
row
.
createCell
(
6
).
setCellValue
(
String
.
valueOf
(
multiplyExact
));
row
.
createCell
(
6
).
setCellValue
(
String
.
valueOf
(
multiplyExact
));
}
else
{
}
else
{
row
.
createCell
(
6
).
setCellValue
(
0
);
row
.
createCell
(
6
).
setCellValue
(
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment