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
5833900e
Commit
5833900e
authored
Sep 22, 2023
by
litengwei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
42756d15
860196b7
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
217 additions
and
107 deletions
+217
-107
GolangRequestUtil.java
...eejoin/amos/api/householdapi/Utils/GolangRequestUtil.java
+21
-72
HouseholdTestController.java
.../api/householdapi/controller/HouseholdTestController.java
+3
-3
JpStation.java
...householdapi/face/orm/houseapi/entity/hygf/JpStation.java
+2
-1
GoLangDataAcquisitionService.java
...useholdapi/face/service/GoLangDataAcquisitionService.java
+21
-0
GoLangDataAcquisitionServiceImpl.java
...i/face/service/impl/GoLangDataAcquisitionServiceImpl.java
+23
-10
JpStationDto.java
...m/yeejoin/amos/boot/module/hygf/api/dto/JpStationDto.java
+1
-1
TdHygfJpInverterWarnDto.java
...mos/boot/module/hygf/api/dto/TdHygfJpInverterWarnDto.java
+10
-0
JpStation.java
...m/yeejoin/amos/boot/module/hygf/api/entity/JpStation.java
+1
-1
TimeUtil.java
.../com/yeejoin/amos/boot/module/hygf/api/util/TimeUtil.java
+47
-0
JpStationMapper.xml
...f-api/src/main/resources/mapper/mysql/JpStationMapper.xml
+60
-14
WindSpeedScheduled.java
...os/boot/module/hygf/biz/scheduled/WindSpeedScheduled.java
+3
-2
JpStationServiceImpl.java
...ot/module/hygf/biz/service/impl/JpStationServiceImpl.java
+12
-1
MonthPowerServiceImpl.java
...t/module/hygf/biz/service/impl/MonthPowerServiceImpl.java
+1
-1
TdHygfJpInverterWarnServiceImpl.java
...ygf/biz/service/impl/TdHygfJpInverterWarnServiceImpl.java
+12
-1
No files found.
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/Utils/GolangRequestUtil.java
View file @
5833900e
...
...
@@ -14,16 +14,17 @@ import org.springframework.util.ObjectUtils;
import
org.typroject.tyboot.component.cache.Redis
;
import
java.util.*
;
@Component
public
class
GolangRequestUtil
{
private
final
static
String
API_REDIS_PREFIX
=
"HOUSEHOLD_API_CACHE_"
;
@Autowired
private
HouseholdPvProducerInfoServiceImpl
householdPvProducerInfoServiceImpl
;
@Autowired
private
GolangStationMapper
golangStationMapper
;
/**
* @return HashMap<String, Object> 发送请求前的准备 准备header信息
* @deprecated 根据厂商编码获取厂商的hearer
...
...
@@ -43,9 +44,16 @@ public class GolangRequestUtil {
}
/**
* @return String 请求返回的response字符串
* @desc 根据请求参数发送http请求并且对于返回的数据进行处理
* @param apiurl 请求url
* @param requestMethod 请求方式
* @param requestParmInfo 请求参数mapper
* @param ResultResolveRule 请求的解析
* @param tClass 需要转换成的bean
* @return List<T> list<Result>
* @param <T> 泛型数据
*/
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
params
=
""
;
JSONArray
jsonArray
=
null
;
...
...
@@ -55,29 +63,15 @@ public class GolangRequestUtil {
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
);
JLYHeaderMapHandler
(
params
,
headMap
,
orginalAuthorization
,
appsecret
,
apiurl
);
respone
=
sendRequest
(
requestMethod
,
url
,
requestParmInfo
,
headMap
);
jsonArray
=
handlerResponseByResultResolverule
(
ResultResolveRule
,
respone
);
List
<
T
>
result
=
JSONArray
.
parseArray
(
jsonArray
.
toJSONString
(),
tClass
);
List
<
T
>
result
=
JSONArray
.
parseArray
(
jsonArray
.
toJSONString
(),
tClass
);
return
result
;
}
// public JSONArray getResPonse(String apiurl,String requestMethod,String requestParmInfo,String ResultResolveRule) {
// String respone = "";
// String params = "";
// JSONArray jsonArray = null;
// 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);
// return jsonArray;
// }
/**
* @desc 根据解析规则解析请求返回数据
* @param resultResovle 请求返回的解析规则 来源与数据库
* @param response 请求返回的字符串
* @return 解析后的数据
...
...
@@ -106,57 +100,6 @@ public class GolangRequestUtil {
return
jsonArray
;
}
/**
* @param seq apiID
* @param cacheField 要缓存的字段
* @param jsonArray 处理后的数据请求
* @param measurement 要在influxdb中存储的数
* @describe 该方法用于缓存需要缓存的字段 且将需要入库的数据进行入库
*/
public
void
handleResponseAndCacheData
(
String
seq
,
String
cacheField
,
JSONArray
jsonArray
,
String
measurement
,
String
produceID
)
{
String
apiID
=
API_REDIS_PREFIX
+
seq
;
List
list
=
new
ArrayList
();
List
saveList
=
new
ArrayList
();
if
(
jsonArray
.
size
()
>
0
)
{
for
(
Object
o
:
jsonArray
)
{
List
<
Map
<
String
,
Object
>>
lines
=
new
ArrayList
<>();
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
LinkedHashMap
<
String
,
Object
>
sortHashMap
=
new
LinkedHashMap
<>();
sortHashMap
.
put
(
"station_list"
,
"station_list."
+
measurement
);
sortHashMap
.
put
(
"timestamp"
,
System
.
currentTimeMillis
());
sortHashMap
.
put
(
"value"
,
10.1
);
Set
<
String
>
keys
=
maps1
.
keySet
();
keys
.
forEach
((
key
)
->
{
maps1
.
put
(
key
,
ObjectUtils
.
isEmpty
(
maps1
.
get
(
key
))
?
"null"
:
maps1
.
get
(
key
).
toString
());
});
if
(!
ObjectUtils
.
isEmpty
(
"cacheField"
))
{
list
.
add
(
maps1
.
get
(
cacheField
));
}
sortHashMap
.
put
(
"tags"
,
maps1
);
lines
.
add
(
sortHashMap
);
// Map<String, String> maps2 = new HashMap<>();
// maps2.put("key", UUID.randomUUID().toString());
if
(!
ObjectUtils
.
isEmpty
(
measurement
))
{
// influxDbConnection.insert(measurement, maps2, maps1);
// log.error(JSONObject.toJSONString(lines));
// tdEngineUtils.writeDataIntoTdEngine(JSONObject.toJSONString(lines));
}
}
}
// tdEngineUtils.writeDataIntoTdEngine(lines.stream().map(s -> String.valueOf(s)).toArray(String[]::new));
if
(!
ObjectUtils
.
isEmpty
(
cacheField
))
{
saveList
=
Redis
.
getRedisTemplate
().
opsForList
().
range
(
apiID
,
0
,
-
1
);
if
(
saveList
.
size
()
==
0
)
{
Redis
.
getRedisTemplate
().
opsForList
().
leftPushAll
(
apiID
,
list
);
}
saveList
=
Redis
.
getRedisTemplate
().
opsForList
().
range
(
apiID
,
0
,
-
1
);
if
(
saveList
.
size
()
!=
list
.
size
())
{
Redis
.
getRedisTemplate
().
delete
(
apiID
);
Redis
.
getRedisTemplate
().
opsForList
().
leftPushAll
(
apiID
,
list
);
}
}
}
public
String
sendRequest
(
String
requestMethod
,
String
url
,
String
params
,
HashMap
<
String
,
String
>
headMap
)
{
String
respone
=
""
;
if
(
requestMethod
.
equals
(
"POST"
))
{
...
...
@@ -192,6 +135,12 @@ public class GolangRequestUtil {
headMap
.
put
(
"Authorization"
,
orginalAuthorization
+
sign
);
}
/**
* @desc 根据分页规则 获取分页数
* @param pageSizeResovle
* @param response
* @return
*/
public
Integer
getPagesize
(
String
pageSizeResovle
,
String
response
)
{
Integer
pageSize
=
0
;
String
[]
rules
=
pageSizeResovle
.
split
(
","
);
...
...
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/controller/HouseholdTestController.java
View file @
5833900e
...
...
@@ -56,11 +56,11 @@ public class HouseholdTestController {
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"锦浪云"
,
notes
=
"锦浪云"
)
public
void
golangnew
()
throws
IOException
{
// goLangDataAcquisitionService.stationList();
goLangDataAcquisitionService
.
stationDetail
();
//
goLangDataAcquisitionService.stationDetail();
// goLangDataAcquisitionService.collectorList();
//// goLangDataAcquisitionService.inverterList();
//
goLangDataAcquisitionService.collectorDetail();
//
goLangDataAcquisitionService.inverterDetail();
goLangDataAcquisitionService
.
collectorDetail
();
goLangDataAcquisitionService
.
inverterDetail
();
// goLangDataAcquisitionService.inverAlramInfo();
}
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/orm/houseapi/entity/hygf/JpStation.java
View file @
5833900e
...
...
@@ -215,5 +215,6 @@ public class JpStation implements Serializable {
private
Double
monthPowerPse
;
// 月用电量
@TableField
(
"year_power_use"
)
private
Double
yearPowerUse
;
// 年用电量
@TableField
(
"email"
)
private
String
email
;
// 电子邮箱
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/GoLangDataAcquisitionService.java
View file @
5833900e
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
service
;
public
interface
GoLangDataAcquisitionService
{
/**
* @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 @
5833900e
...
...
@@ -22,14 +22,11 @@ import com.yeejoin.amos.api.householdapi.face.service.GoLangDataAcquisitionServi
import
com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper
;
import
com.yeejoin.amos.openapi.enums.PVProducerInfoEnum
;
import
fastjson.JSON
;
import
org.bouncycastle.crypto.engines.AESLightEngine
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -39,44 +36,59 @@ import java.util.concurrent.TimeUnit;
@Async
@Service
public
class
GoLangDataAcquisitionServiceImpl
implements
GoLangDataAcquisitionService
{
//定时任务执行频率 当前为10分钟一次
private
final
String
dataRequstScheduled
=
"0 0/10 * * * *"
;
//锦浪云请求工具封装
@Autowired
private
GolangRequestUtil
golangRequestUtil
;
//锦浪云场站mapper
@Autowired
private
GolangStationMapper
golangStationMapper
;
//监盘场站mapper
@Autowired
private
JpStationMapper
jpStationMapper
;
//监盘采集器mapper
@Autowired
private
JpCollectorMapper
jpCollectorMapper
;
//监盘逆变器mapper
@Autowired
private
JpInverterMapper
jpInverterMapper
;
//监盘逆变器电量mapper
@Autowired
private
JpInverterElectricityMapper
jpInverterElectricityMapper
;
//锦浪云场站详情mapper
@Autowired
private
GolangStationDetailMapper
golangStationDetailMapper
;
//锦浪云采集器列表mapper
@Autowired
private
GolangCollectorListMapper
golangCollectorListMapper
;
//锦浪云逆变器列表
@Autowired
private
GolangInverterListMapper
golangInverterListMapper
;
//户用光伏
场站历史
//户用光伏
场站历史mapper
@Autowired
private
HYGFJPStationPowerHistoryMapper
hygfjpStationPowerHistoryMapper
;
//
//
户用光伏逆变器历史mapper
@Autowired
private
HYGFJPInverterHistoryMapper
hygfjpInverterHistoryMapper
;
//户用光伏采集器历史mapper
@Autowired
private
HYGFJPCollectorHistoryMapper
hygfjpCollectorHistoryMapper
;
//户用光伏逆变器告警
@Autowired
private
HYGFJPInverterWarnMapper
hygfjpInverterWarnMapper
;
//户用光伏逆变器历史mapper
@Autowired
private
HYGFJPInverterElecHistoryMapper
hygfjpInverterElecHistoryMapper
;
//户用光伏日发电量
@Autowired
private
HYGFJPDayPowerMapper
hygfjpDayPowerMapper
;
@Scheduled
(
cron
=
dataRequstScheduled
)
@Override
public
void
stationList
()
{
HashMap
<
String
,
Object
>
requestInfo
=
new
HashMap
<>();
requestInfo
.
put
(
"pageNo"
,
1
);
requestInfo
.
put
(
"pageSize"
,
100
);
...
...
@@ -134,7 +146,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpStation
.
setLatitude
(
golangStationDetail
.
getLatitude
());
jpStation
.
setUserName
(
golangStationDetail
.
getUsername
());
jpStation
.
setUserPhone
(
String
.
valueOf
(
golangStationDetail
.
getUsermobile
()));
jpStation
.
setStationContact
(
Str
Util
.
nullToDefault
(
String
.
valueOf
(
golangStationDetail
.
getMobile
()),
""
));
jpStation
.
setStationContact
(
Str
ing
.
valueOf
(
golangStationDetail
.
getMobile
()).
toLowerCase
().
replace
(
"null"
,
""
));
jpStation
.
setModuleCount
(
Math
.
toIntExact
(
golangStationDetail
.
getModule
()));
//并网类型
jpStation
.
setOnGridType
(
GoLangConstant
.
stationStaus
.
get
(
String
.
valueOf
(
golangStationDetail
.
getState
())));
...
...
@@ -150,6 +162,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpStation
.
setYearIncome
(
golangStationDetail
.
getYearincome
());
jpStation
.
setCumulativeIncome
(
golangStationDetail
.
getAllincome
());
jpStation
.
setArea
(
golangStationDetail
.
getRegionstr
());
jpStation
.
setEmail
(
golangStationDetail
.
getUseremail
());
if
(!
ObjectUtils
.
isEmpty
(
jpStation
.
getSequenceNbr
()))
{
jpStationMapper
.
updateById
(
jpStation
);
}
else
{
...
...
@@ -315,15 +328,15 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
@Scheduled
(
cron
=
dataRequstScheduled
)
@Override
public
void
inverterDetail
()
{
List
<
Long
>
inverterIds
=
golangInverterListMapper
.
getInverterId
s
();
for
(
int
i
=
0
;
i
<
inverter
Id
s
.
size
();
i
++)
{
List
<
String
>
inverterSns
=
golangInverterListMapper
.
getInverterSn
s
();
for
(
int
i
=
0
;
i
<
inverter
Sn
s
.
size
();
i
++)
{
try
{
TimeUnit
.
SECONDS
.
sleep
(
1
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
HashMap
<
String
,
Object
>
requestInfo
=
new
HashMap
<>();
requestInfo
.
put
(
"
id"
,
Long
.
valueOf
(
inverterIds
.
get
(
i
)
));
requestInfo
.
put
(
"
sn"
,
inverterSns
.
get
(
i
));
String
requestParaminfo
=
JSON
.
toJSONString
(
requestInfo
);
List
<
InverterDetailDto
>
result
=
golangRequestUtil
.
getResPonse
(
GoLangConstant
.
inverterDetailUrl
,
GoLangConstant
.
requestPost
,
...
...
@@ -420,7 +433,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
hygfjpInverterElecHistory
.
setWAcCurrent
(
inverterDetailDto
.
getIAc3
());
hygfjpInverterElecHistory
.
setUAcVoltage
(
inverterDetailDto
.
getUAc1
());
hygfjpInverterElecHistory
.
setVAcVoltage
(
inverterDetailDto
.
getUAc2
());
hygfjpInverterElecHistory
.
set
U
AcVoltage
(
inverterDetailDto
.
getUAc3
());
hygfjpInverterElecHistory
.
set
W
AcVoltage
(
inverterDetailDto
.
getUAc3
());
hygfjpInverterElecHistory
.
setThirdCode
(
PVProducerInfoEnum
.
JLY
.
getCode
());
hygfjpInverterElecHistory
.
setTime
(
System
.
currentTimeMillis
());
hygfjpInverterElecHistoryMapper
.
insert
(
hygfjpInverterElecHistory
);
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/dto/JpStationDto.java
View file @
5833900e
...
...
@@ -127,7 +127,7 @@ public class JpStationDto extends BaseDto {
private
Double
cumulativeIncome
;
private
Double
dayPowerUse
;
// 日用电量
private
Double
month
_power_u
se
;
// 月用电量
private
Double
month
PowerU
se
;
// 月用电量
private
Double
yearPowerUse
;
// 年用电量
private
int
countBuiltNum
;
// 已建设场站数量
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/dto/TdHygfJpInverterWarnDto.java
View file @
5833900e
...
...
@@ -53,6 +53,8 @@ public class TdHygfJpInverterWarnDto {
@ApiModelProperty
(
value
=
"时间"
)
private
Long
time
;
private
String
stationName
;
private
String
stationContact
;
private
String
userName
;
...
...
@@ -63,8 +65,16 @@ public class TdHygfJpInverterWarnDto {
private
String
address
;
private
String
area
;
private
Long
createdTime
;
private
String
timeLongFormat
;
private
String
startTimeFormat
;
private
String
recoverTimeFormat
;
private
List
<
String
>
stationIds
;
private
List
<
String
>
states
;
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/entity/JpStation.java
View file @
5833900e
...
...
@@ -202,7 +202,7 @@ public class JpStation extends BaseEntity {
@TableField
(
"email"
)
private
Double
email
;
//邮箱
private
String
email
;
//邮箱
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/util/TimeUtil.java
View file @
5833900e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
api
.
util
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
...
...
@@ -23,4 +24,50 @@ public class TimeUtil {
todayEnd
.
set
(
Calendar
.
MILLISECOND
,
999
);
return
todayEnd
.
getTime
().
getTime
();
}
public
static
String
dateFormat
(
Long
time
)
{
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
return
dateFormat
.
format
(
new
Date
(
time
));
}
public
static
String
longFormat
(
Long
time
)
{
if
(
time
<
1000
)
{
return
"0"
+
"秒"
;
}
long
second
=
time
/
1000
;
long
seconds
=
second
%
60
;
long
minutes
=
second
/
60
;
long
hours
=
0
;
if
(
minutes
>=
60
)
{
hours
=
minutes
/
60
;
minutes
=
minutes
%
60
;
}
String
timeString
=
""
;
String
secondString
=
""
;
String
minuteString
=
""
;
String
hourString
=
""
;
if
(
seconds
<
10
)
{
secondString
=
"0"
+
seconds
+
"秒"
;
}
else
{
secondString
=
seconds
+
"秒"
;
}
if
(
minutes
<
10
&&
hours
<
1
)
{
minuteString
=
minutes
+
"分"
;
}
else
if
(
minutes
<
10
)
{
minuteString
=
"0"
+
minutes
+
"分"
;
}
else
{
minuteString
=
minutes
+
"分"
;
}
if
(
hours
<
10
)
{
hourString
=
hours
+
"时"
;
}
else
{
hourString
=
hours
+
""
+
"时"
;
}
if
(
hours
!=
0
)
{
timeString
=
hourString
+
minuteString
+
secondString
;
}
else
{
timeString
=
minuteString
+
secondString
;
}
return
timeString
;
}
}
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/resources/mapper/mysql/JpStationMapper.xml
View file @
5833900e
...
...
@@ -5,7 +5,53 @@
<select
id=
"queryForDealerReviewPage"
resultType=
"com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto"
>
select * from hygf_jp_station
select
`sequence_nbr` sequenceNbr,
`rec_date` recDate,
`rec_user_id` recUserId,
`rec_user_name` recUserName,
`sn_code` snCode,
`capacity` capacity,
`name` ,
`code` ,
`system_code` systemCode,
`access_time` accessTime,
`create_time` createTime,
`address` ,
`longitude` ,
`latitude` ,
`price` ,
`user_name` userName,
`user_phone` userPhone,
`station_contact` stationContact,
`module_count` moduleCount,
`on_grid_type` onGridType,
`on_grid_time` onGridTime,
`third_station_id` thirdStationId,
`third_code` thirdCode,
`station_id` stationId,
`day_power_use` dayPowerUse,
`month_power_use` monthPowerUse,
`year_power_use` yearPowerUse,
FORMAT(`real_time_power`,3) realTimePower,
FORMAT(`accumulated_power`/1000,3) accumulatedPower,
`state` ,
`type`,
`organizational_code` organizationalCode,
`is_delete` isDelete,
FORMAT(`day_generate`,3) dayGenerate,
`month_generate` monthGenerate,
`year_generate` yearGenerate,
`day_income` dayIncome,
`month_income` monthIncome,
`year_income` yearIncome,
`area` ,
`cumulative_income` cumulativeIncome,
`email`
from hygf_jp_station
<where>
<if
test=
"dto.name!=null"
>
and hygf_jp_station.name like concat(concat("%",#{dto.name}),"%")
...
...
@@ -37,19 +83,19 @@
select
sum(real_time_power
) realTimePower,
sum(capacity
) capacity,
sum(day_generate
) dayGenerate,
sum(month_generate)
monthGenerate,
sum(year_generate
) yearGenerate,
sum(accumulated_power
) accumulatedPower,
sum(day_income
) dayIncome,
sum(month_income
) monthIncome,
sum(year_income
) yearIncome,
sum(cumulative_income)
cumulativeIncome,
sum(day_power_use
) dayPowerUse,
sum(month_power_use
) monthPowerUse,
sum(year_power_use
) yearPowerUse,
FORMAT(sum(real_time_power),3
) realTimePower,
FORMAT(sum(capacity)/1000,3
) capacity,
FORMAT(sum(day_generate)/1000,3
) dayGenerate,
FORMAT(sum(month_generate)/1000,3)
monthGenerate,
FORMAT(sum(year_generate)/1000,3
) yearGenerate,
FORMAT(sum(accumulated_power)/1000,3
) accumulatedPower,
FORMAT( sum(day_income),3
) dayIncome,
FORMAT(sum(month_income)/10000,3
) monthIncome,
FORMAT(sum(year_income)/10000,3
) yearIncome,
FORMAT(sum(cumulative_income)/10000,3)
cumulativeIncome,
FORMAT(sum(day_power_use)/1000,3
) dayPowerUse,
FORMAT(sum(month_power_use)/1000,3
) monthPowerUse,
FORMAT(sum(year_power_use)/1000,3
) yearPowerUse,
count(*) countBuiltNum
from hygf_jp_station
<where>
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/scheduled/WindSpeedScheduled.java
View file @
5833900e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
scheduled
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.JpStationServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
...
...
@@ -17,7 +18,7 @@ import com.yeejoin.amos.boot.module.hygf.biz.service.impl.TdHygfJpInvertorElecHi
public
class
WindSpeedScheduled
{
@Autowired
MonthPowerServiceImpl
monthPower
ServiceImpl
;
JpStationServiceImpl
jpStation
ServiceImpl
;
@Autowired
TdHygfJpCollectorHistoryServiceImpl
tdHygfJpCollectorHistoryServiceImpl
;
...
...
@@ -27,7 +28,7 @@ public class WindSpeedScheduled {
@Scheduled
(
cron
=
"${cheduled.crons}"
)
private
void
initData
()
{
monthPower
ServiceImpl
.
getMonthPower
();
jpStation
ServiceImpl
.
getMonthPower
();
tdHygfJpCollectorHistoryServiceImpl
.
syncData
();
tdHygfJpInvertorElecHistoryServiceImpl
.
syncData
();
}
...
...
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 @
5833900e
...
...
@@ -12,10 +12,12 @@ import com.yeejoin.amos.boot.module.hygf.api.dto.JpStationDto;
import
com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.MonthPowerMapper
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.text.DecimalFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -32,6 +34,8 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
JpStationMapper
jpStationMapper
;
@Autowired
MonthPowerMapper
monthPowerMapper
;
@Autowired
MonthPowerServiceImpl
monthPowerServiceImpl
;
/**
* 分页查询
*/
...
...
@@ -46,6 +50,12 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
pagenew
.
setRecords
(
page
.
getList
());
return
pagenew
;
}
@Async
public
void
getMonthPower
()
{
monthPowerServiceImpl
.
getMonthPower
();
}
@Override
...
...
@@ -78,7 +88,8 @@ public class JpStationServiceImpl extends BaseService<JpStationDto,JpStation,JpS
for
(
int
i
=
0
;
i
<
listx
.
size
();
i
++)
{
if
(
datum
.
getDate
().
equals
(
listx
.
get
(
i
).
toString
())){
listy
.
remove
(
i
);
listy
.
add
(
i
,
datum
.
getNum
());
String
format
=
new
DecimalFormat
(
"#.000"
).
format
(
datum
.
getNum
());
listy
.
add
(
i
,
format
);
break
;
}
}
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/MonthPowerServiceImpl.java
View file @
5833900e
...
...
@@ -52,7 +52,7 @@ public class MonthPowerServiceImpl extends BaseService<MonthPowerDto,MonthPower,
@Override
@
Async
@
Transactional
public
void
getMonthPower
()
{
List
<
MonthPower
>
list
=
monthPowerMapper
.
getMonthPowerint
();
LocalDateTime
now
=
LocalDateTime
.
now
();
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/TdHygfJpInverterWarnServiceImpl.java
View file @
5833900e
...
...
@@ -6,6 +6,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
...
...
@@ -23,6 +24,7 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.JpStation;
import
com.yeejoin.amos.boot.module.hygf.api.entity.TdHygfJpInverterWarn
;
import
com.yeejoin.amos.boot.module.hygf.api.service.ITdHygfJpInverterWarnService
;
import
com.yeejoin.amos.boot.module.hygf.api.tdenginemapper.TdHygfJpInverterWarnMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.util.TimeUtil
;
/**
* 户用光伏监盘逆变器报警表服务实现类
...
...
@@ -74,11 +76,20 @@ public class TdHygfJpInverterWarnServiceImpl
JpStation
jpStation
=
jpStationServiceImpl
.
getOne
(
new
LambdaQueryWrapper
<
JpStation
>()
.
eq
(
JpStation:
:
getThirdStationId
,
tdHygfJpInverterWarnDto
.
getThirdStationId
()));
if
(
jpStation
!=
null
)
{
tdHygfJpInverterWarnDto
.
setStationName
(
jpStation
.
getName
());
tdHygfJpInverterWarnDto
.
setStationContact
(
jpStation
.
getStationContact
());
tdHygfJpInverterWarnDto
.
setUserName
(
jpStation
.
getUserName
());
tdHygfJpInverterWarnDto
.
setUserPhone
(
jpStation
.
getUserPhone
());
tdHygfJpInverterWarnDto
.
setEmail
(
null
);
tdHygfJpInverterWarnDto
.
setEmail
(
jpStation
.
getEmail
()
);
tdHygfJpInverterWarnDto
.
setAddress
(
jpStation
.
getAddress
());
tdHygfJpInverterWarnDto
.
setArea
(
jpStation
.
getArea
());
if
(
tdHygfJpInverterWarnDto
.
getRecoverTime
()
!=
null
)
{
tdHygfJpInverterWarnDto
.
setRecoverTimeFormat
(
TimeUtil
.
dateFormat
(
tdHygfJpInverterWarnDto
.
getRecoverTime
()));
tdHygfJpInverterWarnDto
.
setTimeLongFormat
(
TimeUtil
.
longFormat
(
tdHygfJpInverterWarnDto
.
getRecoverTime
()
-
tdHygfJpInverterWarnDto
.
getStartTime
()));
}
tdHygfJpInverterWarnDto
.
setStartTimeFormat
(
TimeUtil
.
dateFormat
(
tdHygfJpInverterWarnDto
.
getStartTime
()));
}
return
tdHygfJpInverterWarnDto
;
...
...
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