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
b20197e3
Commit
b20197e3
authored
Mar 11, 2024
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首航采集
parent
c8cfba5f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
143 additions
and
22 deletions
+143
-22
SofarRequestUtil.java
...yeejoin/amos/api/householdapi/Utils/SofarRequestUtil.java
+52
-7
SoFarConstant.java
...yeejoin/amos/api/householdapi/constant/SoFarConstant.java
+18
-5
SofarInverterDto.java
...join/amos/api/householdapi/face/dto/SofarInverterDto.java
+18
-0
Sofarhistorical.java
...ejoin/amos/api/householdapi/face/dto/Sofarhistorical.java
+19
-0
SofarInverter.java
...api/face/orm/houseapi/entity/tdeingine/SofarInverter.java
+20
-0
SofarDataAcquisitionService.java
...ouseholdapi/face/service/SofarDataAcquisitionService.java
+10
-3
SofarDataAcquisitionServiceImpl.java
...pi/face/service/impl/SofarDataAcquisitionServiceImpl.java
+0
-0
SunlightServiceImpl.java
...i/householdapi/face/service/impl/SunlightServiceImpl.java
+6
-7
No files found.
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/Utils/SofarRequestUtil.java
View file @
b20197e3
...
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray;
...
@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.api.householdapi.constant.GoodWeConstant
;
import
com.yeejoin.amos.api.householdapi.constant.GoodWeConstant
;
import
com.yeejoin.amos.api.householdapi.constant.SoFarConstant
;
import
com.yeejoin.amos.api.householdapi.constant.SoFarConstant
;
import
com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.Sunlight
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
...
@@ -21,6 +22,32 @@ public class SofarRequestUtil {
...
@@ -21,6 +22,32 @@ public class SofarRequestUtil {
private
final
String
redisKey
=
"SOFAR_REQUEST_TOKEN"
;
private
final
String
redisKey
=
"SOFAR_REQUEST_TOKEN"
;
public
static
final
HashMap
<
String
,
String
>
intoNetWorkStatus
=
new
HashMap
<
String
,
String
>()
{
{
put
(
"DISTRIBUTED_FULLY"
,
"分布式全额上网"
);
put
(
"EXCESS"
,
"分布式自发自用余电上网"
);
put
(
"OFF_GRID"
,
"离网"
);
put
(
"BATTERY_BACKUP"
,
"储能系统"
);
put
(
"GROUND_FULLY"
,
"地面全额上网"
);
}
};
@Autowired
@Autowired
private
RedisUtils
redisUtils
;
private
RedisUtils
redisUtils
;
...
@@ -65,8 +92,6 @@ public class SofarRequestUtil {
...
@@ -65,8 +92,6 @@ public class SofarRequestUtil {
*/
*/
public
<
T
>
List
<
T
>
getResPonse
(
String
apiurl
,
String
requestMethod
,
String
requestParmInfo
,
String
ResultResolveRule
,
Class
<
T
>
tClass
)
{
public
<
T
>
List
<
T
>
getResPonse
(
String
apiurl
,
String
requestMethod
,
String
requestParmInfo
,
String
ResultResolveRule
,
Class
<
T
>
tClass
)
{
String
respone
=
""
;
String
respone
=
""
;
String
params
=
""
;
JSONArray
jsonArray
=
null
;
List
<
T
>
result
=
new
ArrayList
<>();
List
<
T
>
result
=
new
ArrayList
<>();
try
{
try
{
...
@@ -74,16 +99,36 @@ public class SofarRequestUtil {
...
@@ -74,16 +99,36 @@ public class SofarRequestUtil {
String
url
=
SoFarConstant
.
baseurl
+
apiurl
;
String
url
=
SoFarConstant
.
baseurl
+
apiurl
;
respone
=
sendRequest
(
requestMethod
,
url
,
requestParmInfo
,
headMap
);
respone
=
sendRequest
(
requestMethod
,
url
,
requestParmInfo
,
headMap
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
respone
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
respone
);
// jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone);
if
(
jsonObject
!=
null
&&
jsonObject
.
get
(
ResultResolveRule
)!=
null
){
// if (!ObjectUtils.isEmpty(jsonArray)) {
result
=
JSONArray
.
parseArray
(
fastjson
.
JSON
.
toJSONString
(
jsonObject
.
get
(
ResultResolveRule
)),
tClass
);
// result = JSONArray.parseArray(jsonArray.toJSONString(), tClass);
//
}
}
}
catch
(
Exception
exception
)
{
}
catch
(
Exception
exception
)
{
return
result
;
exception
.
printStackTrace
()
;
}
}
return
result
;
return
result
;
}
}
public
JSONObject
getResPonseobj
(
String
apiurl
,
String
requestMethod
,
String
requestParmInfo
,
String
ResultResolveRule
)
{
String
respone
=
""
;
JSONObject
jsonObject
=
null
;
try
{
HashMap
<
String
,
String
>
headMap
=
getHeaderOfSofar
();
String
url
=
SoFarConstant
.
baseurl
+
apiurl
;
respone
=
sendRequest
(
requestMethod
,
url
,
requestParmInfo
,
headMap
);
if
(
respone
!=
null
&&
JSONObject
.
parseObject
(
respone
).
get
(
ResultResolveRule
)!=
null
&&
ResultResolveRule
!=
null
){
jsonObject
=
JSONObject
.
parseObject
(
JSONObject
.
parseObject
(
respone
).
get
(
ResultResolveRule
).
toString
());
}
else
{
jsonObject
=
JSONObject
.
parseObject
(
respone
);
}
}
catch
(
Exception
exception
)
{
exception
.
printStackTrace
();
}
return
jsonObject
;
}
/**
/**
* @param resultResovle 请求返回的解析规则 来源与数据库
* @param resultResovle 请求返回的解析规则 来源与数据库
* @param response 请求返回的字符串
* @param response 请求返回的字符串
...
...
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/constant/SoFarConstant.java
View file @
b20197e3
...
@@ -9,13 +9,16 @@ import java.util.HashMap;
...
@@ -9,13 +9,16 @@ import java.util.HashMap;
public
class
SoFarConstant
{
public
class
SoFarConstant
{
public
static
final
HashMap
<
String
,
String
>
stationStaus
=
new
HashMap
<
String
,
String
>()
{
public
static
final
HashMap
<
String
,
String
>
stationStaus
=
new
HashMap
<
String
,
String
>()
{
{
{
put
(
"-1"
,
"离线"
);
put
(
"1"
,
"在线"
);
put
(
"0"
,
"待机"
);
put
(
"0"
,
"离线"
);
put
(
"1"
,
"正常"
);
put
(
"2"
,
"报警"
);
put
(
"2"
,
"停机"
);
}
}
};
};
public
static
String
baseurl
=
"https://openapi.sofarsolarmonitor.com"
;
public
static
String
baseurl
=
"https://openapi.sofarsolarmonitor.com"
;
public
static
String
appId
=
"447430219192733696"
;
public
static
String
appId
=
"447430219192733696"
;
public
static
String
appSecret
=
"5881ee8c062817016a2b34425c45937d"
;
public
static
String
appSecret
=
"5881ee8c062817016a2b34425c45937d"
;
...
@@ -26,6 +29,12 @@ public class SoFarConstant {
...
@@ -26,6 +29,12 @@ public class SoFarConstant {
public
static
String
tokenurl
=
"/account/auth/createToken"
;
public
static
String
tokenurl
=
"/account/auth/createToken"
;
public
static
String
stationListUrl
=
"/station/v1.0/list"
;
public
static
String
stationListUrl
=
"/station/v1.0/list"
;
public
static
String
stationUrl
=
"/station/v1.0/base"
;
public
static
String
currentData
=
"/device/v1.0/currentData"
;
public
static
String
nbqlist
=
"/station/v1.0/device?language=zh"
;
public
static
String
historical
=
"/device/v1.0/historical"
;
public
static
String
stationListStatusUrl
=
"/api/OpenApi/QueryPowerStationMonitor"
;
public
static
String
stationListStatusUrl
=
"/api/OpenApi/QueryPowerStationMonitor"
;
public
static
String
stationDetailUrl
=
"/api/OpenApi/GetPowerStationMonitorDetail"
;
public
static
String
stationDetailUrl
=
"/api/OpenApi/GetPowerStationMonitorDetail"
;
public
static
String
collectorListUrl
=
"/v1/api/collectorList"
;
public
static
String
collectorListUrl
=
"/v1/api/collectorList"
;
...
@@ -42,7 +51,11 @@ public class SoFarConstant {
...
@@ -42,7 +51,11 @@ public class SoFarConstant {
public
static
String
resovleRule_data_page_records
=
"data,page,records"
;
public
static
String
resovleRule_data_page_records
=
"data,page,records"
;
public
static
String
resovleRule_data_list
=
"data,list"
;
public
static
String
resovleRule_data_list
=
"data,list"
;
public
static
String
resovleRule_data_records
=
"data,records"
;
public
static
String
resovleRule_data_records
=
"data,records"
;
public
static
String
resovleRule_data
=
"data"
;
public
static
String
resovleRule_data
=
"stationList"
;
public
static
String
deviceListItems
=
"deviceListItems"
;
public
static
String
dataList
=
"dataList"
;
public
static
String
paramDataList
=
"paramDataList"
;
public
static
String
requestPost
=
"POST"
;
public
static
String
requestPost
=
"POST"
;
public
static
String
requestGet
=
"GET"
;
public
static
String
requestGet
=
"GET"
;
public
static
String
datePattern
=
"yyyy-MM-dd HH:mm:ss.SSS"
;
public
static
String
datePattern
=
"yyyy-MM-dd HH:mm:ss.SSS"
;
...
...
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/dto/SofarInverterDto.java
0 → 100644
View file @
b20197e3
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
;
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/dto/Sofarhistorical.java
0 → 100644
View file @
b20197e3
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
;
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/orm/houseapi/entity/tdeingine/SofarInverter.java
0 → 100644
View file @
b20197e3
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
;
// 设备更新时间
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/SofarDataAcquisitionService.java
View file @
b20197e3
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
service
;
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
service
;
import
com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation
;
import
com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.SofarInverter
;
import
com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.SofarStationList
;
import
java.util.List
;
import
java.util.Map
;
public
interface
SofarDataAcquisitionService
{
public
interface
SofarDataAcquisitionService
{
/**
/**
* @descrption 场站列表数据入库
* @descrption 场站列表数据入库
...
@@ -8,11 +15,11 @@ public interface SofarDataAcquisitionService {
...
@@ -8,11 +15,11 @@ public interface SofarDataAcquisitionService {
/**
/**
* @descrption 场站详情数据入库
* @descrption 场站详情数据入库
*/
*/
void
stationDetail
();
void
stationDetail
(
List
<
SofarStationList
>
jsonObject
);
/**
/**
* @descrption 采集器列表数据入库
* @descrption 采集器列表数据入库
*/
*/
void
collectorList
();
void
collectorList
(
List
<
SofarStationList
>
jsonObject
);
/**
/**
* @descrption 采集器详情数据入库
* @descrption 采集器详情数据入库
*/
*/
...
@@ -20,7 +27,7 @@ public interface SofarDataAcquisitionService {
...
@@ -20,7 +27,7 @@ public interface SofarDataAcquisitionService {
/**
/**
* @descrption 逆变器列表数据入库
* @descrption 逆变器列表数据入库
*/
*/
void
inverterList
();
void
inverterList
(
SofarInverter
sofarInverter
,
JpStation
jpStation
,
Map
<
String
,
String
>
maps
);
/**
/**
* @descrption 逆变器详情数据入库
* @descrption 逆变器详情数据入库
*/
*/
...
...
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/impl/SofarDataAcquisitionServiceImpl.java
View file @
b20197e3
This diff is collapsed.
Click to expand it.
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/impl/SunlightServiceImpl.java
View file @
b20197e3
...
@@ -99,7 +99,6 @@ public class SunlightServiceImpl implements SunlightService {
...
@@ -99,7 +99,6 @@ public class SunlightServiceImpl implements SunlightService {
List
<
Sunlight
>
list
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
data
.
get
(
"pageList"
)),
Sunlight
.
class
);
List
<
Sunlight
>
list
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
data
.
get
(
"pageList"
)),
Sunlight
.
class
);
this
.
stationDetail
(
data
);
this
.
stationDetail
(
data
);
sunlightMapper
.
delete
(
null
);
for
(
Sunlight
sunlight
:
list
)
{
for
(
Sunlight
sunlight
:
list
)
{
sunlight
.
setCreatedTime
(
System
.
currentTimeMillis
());
sunlight
.
setCreatedTime
(
System
.
currentTimeMillis
());
...
@@ -115,7 +114,7 @@ public class SunlightServiceImpl implements SunlightService {
...
@@ -115,7 +114,7 @@ public class SunlightServiceImpl implements SunlightService {
//电站数据如库,电站统计数据入库
public
void
stationDetail
(
JSONObject
data
){
public
void
stationDetail
(
JSONObject
data
){
//所有场站信息
//所有场站信息
List
<
SunlightDto
>
list
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
data
.
get
(
"pageList"
)),
SunlightDto
.
class
);
List
<
SunlightDto
>
list
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
data
.
get
(
"pageList"
)),
SunlightDto
.
class
);
...
@@ -390,7 +389,7 @@ public class SunlightServiceImpl implements SunlightService {
...
@@ -390,7 +389,7 @@ public class SunlightServiceImpl implements SunlightService {
}
}
//逆变器
//逆变器
数据入库,逆变器参数入库
public
void
setJpInverte
(
Device
device
,
JpStation
jpStation
){
public
void
setJpInverte
(
Device
device
,
JpStation
jpStation
){
new
Thread
(
new
Runnable
(){
new
Thread
(
new
Runnable
(){
...
@@ -726,7 +725,7 @@ public class SunlightServiceImpl implements SunlightService {
...
@@ -726,7 +725,7 @@ public class SunlightServiceImpl implements SunlightService {
li
.
add
(
SunlightUtil
.
alarmstatus
.
get
(
"4"
));
li
.
add
(
SunlightUtil
.
alarmstatus
.
get
(
"4"
));
li
.
add
(
SunlightUtil
.
alarmstatus
.
get
(
"5"
));
li
.
add
(
SunlightUtil
.
alarmstatus
.
get
(
"5"
));
List
<
HYGFJPInverterWarn
>
hygfjpInverterWarnlist
=
hygfjpInverterWarnMapper
.
selectList
(
new
QueryWrapper
<
HYGFJPInverterWarn
>()
List
<
HYGFJPInverterWarn
>
hygfjpInverterWarnlist
=
hygfjpInverterWarnMapper
.
selectList
(
new
QueryWrapper
<
HYGFJPInverterWarn
>()
.
i
n
(
"`state`"
,
li
)
.
notI
n
(
"`state`"
,
li
)
.
eq
(
"third_code"
,
PVProducerInfoEnum
.
YG
.
getCode
())
.
eq
(
"third_code"
,
PVProducerInfoEnum
.
YG
.
getCode
())
);
);
...
@@ -755,12 +754,12 @@ public class SunlightServiceImpl implements SunlightService {
...
@@ -755,12 +754,12 @@ public class SunlightServiceImpl implements SunlightService {
hygfjpInverterWarn
.
setTime
(
System
.
currentTimeMillis
());
hygfjpInverterWarn
.
setTime
(
System
.
currentTimeMillis
());
hygfjpInverterWarn
.
setSnCode
(!
jpInverterbodyparam
.
isEmpty
()&&
jpInverterbodyparam
.
containsKey
(
sunlightWarm
.
getUuid
().
toString
())?
jpInverterbodyparam
.
get
(
sunlightWarm
.
getUuid
().
toString
()):
null
);
hygfjpInverterWarn
.
setSnCode
(!
jpInverterbodyparam
.
isEmpty
()&&
jpInverterbodyparam
.
containsKey
(
sunlightWarm
.
getUuid
().
toString
())?
jpInverterbodyparam
.
get
(
sunlightWarm
.
getUuid
().
toString
()):
null
);
hygfjpInverterWarn
.
setThirdStationId
(
sunlightWarm
.
getPs_id
().
toString
());
hygfjpInverterWarn
.
setThirdStationId
(
sunlightWarm
.
getPs_id
().
toString
());
hygfjpInverterWarn
.
setLevel
(
SunlightUtil
.
alarmLevel
.
get
(
sunlightWarm
.
getFault_level
()));
hygfjpInverterWarn
.
setLevel
(
SunlightUtil
.
alarmLevel
.
get
(
sunlightWarm
.
getFault_level
()
.
toString
()
));
hygfjpInverterWarn
.
setContent
(
sunlightWarm
.
getFault_name
());
hygfjpInverterWarn
.
setContent
(
sunlightWarm
.
getFault_name
());
hygfjpInverterWarn
.
setThirdCode
(
PVProducerInfoEnum
.
YG
.
getCode
());
hygfjpInverterWarn
.
setThirdCode
(
PVProducerInfoEnum
.
YG
.
getCode
());
hygfjpInverterWarn
.
setTreatment
(
sunlightWarm
.
getFault_desc
());
hygfjpInverterWarn
.
setTreatment
(
sunlightWarm
.
getFault_desc
());
hygfjpInverterWarn
.
setStartTime
(
DateUtil
.
parse
(
sunlightWarm
.
getCreate_time
(),
DatePattern
.
NORM_DATETIME_PATTERN
).
getTime
());
hygfjpInverterWarn
.
setStartTime
(
DateUtil
.
parse
(
sunlightWarm
.
getCreate_time
(),
DatePattern
.
NORM_DATETIME_PATTERN
).
getTime
());
hygfjpInverterWarn
.
setState
(
SunlightUtil
.
alarmstatus
.
get
(
sunlightWarm
.
getProcess_status
()));
hygfjpInverterWarn
.
setState
(
SunlightUtil
.
alarmstatus
.
get
(
sunlightWarm
.
getProcess_status
()
.
toString
()
));
hygfjpInverterWarn
.
setTimeLong
(
null
);
hygfjpInverterWarn
.
setTimeLong
(
null
);
hygfjpInverterWarn
.
setRecoverTime
(
null
);
hygfjpInverterWarn
.
setRecoverTime
(
null
);
hygfjpInverterWarn
.
setTimeLong
(
null
);
hygfjpInverterWarn
.
setTimeLong
(
null
);
...
@@ -777,7 +776,7 @@ public class SunlightServiceImpl implements SunlightService {
...
@@ -777,7 +776,7 @@ public class SunlightServiceImpl implements SunlightService {
}
}
//更新td已消除告警
//更新td已消除告警
,由于第三方获取会出现请求次数超限,状态只能手动修改,没有消除时间,
if
(!
bodyparam
.
isEmpty
()){
if
(!
bodyparam
.
isEmpty
()){
Object
[]
ids
=
bodyparam
.
keySet
().
toArray
();
Object
[]
ids
=
bodyparam
.
keySet
().
toArray
();
...
...
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