Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
d1eac0ba
Commit
d1eac0ba
authored
Jul 25, 2024
by
hezhuozhi
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
359cb987
65b8929a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
572 additions
and
59 deletions
+572
-59
HouseholdTestController.java
.../api/householdapi/controller/HouseholdTestController.java
+7
-0
TanYinDataAcquisitionServiceImpl.java
...i/face/service/impl/TanYinDataAcquisitionServiceImpl.java
+11
-3
TestController.java
.../amos/boot/module/hygf/biz/controller/TestController.java
+115
-0
TestController.java
...amos/boot/module/jxiop/biz/controller/TestController.java
+78
-3
HealthIndexDTO.java
...eejoin/amos/boot/module/jxiop/biz/dto/HealthIndexDTO.java
+3
-0
SyncESDataToTdengineMqttListener.java
.../jxiop/biz/listener/SyncESDataToTdengineMqttListener.java
+79
-42
IFanHealthIndexService.java
...boot/module/jxiop/biz/service/IFanHealthIndexService.java
+26
-0
FanHealthIndexServiceImpl.java
...ule/jxiop/biz/service/impl/FanHealthIndexServiceImpl.java
+7
-7
PvHealthIndexServiceImpl.java
...dule/jxiop/biz/service/impl/PvHealthIndexServiceImpl.java
+4
-4
TdengineTimeServiceImpl.java
...odule/jxiop/biz/service/impl/TdengineTimeServiceImpl.java
+0
-0
FanHealthIndex.xml
...iz/src/main/resources/mapper/tdengine2/FanHealthIndex.xml
+4
-0
PvHealthIndex.xml
...biz/src/main/resources/mapper/tdengine2/PvHealthIndex.xml
+6
-0
TestController.java
...amos/boot/module/jxiop/biz/controller/TestController.java
+82
-0
application-dev1.properties
...-jxiop-biz/src/main/resources/application-dev1.properties
+105
-0
logback-dev1.xml
...boot-module-jxiop-biz/src/main/resources/logback-dev1.xml
+45
-0
No files found.
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/controller/HouseholdTestController.java
View file @
d1eac0ba
...
@@ -279,4 +279,11 @@ public class HouseholdTestController {
...
@@ -279,4 +279,11 @@ public class HouseholdTestController {
public
void
tanyinCustomer
()
{
public
void
tanyinCustomer
()
{
tanYinDataAcquisitionService
.
customerInfoList
();
tanYinDataAcquisitionService
.
customerInfoList
();
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
PUBLIC
,
needAuth
=
false
)
@PostMapping
(
value
=
"/tanyin/inverAlram"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"电站逆变器故障接口"
,
notes
=
"电站逆变器故障接口"
)
public
void
tanyinInverAlram
()
{
tanYinDataAcquisitionService
.
inverAlramInfo
();
}
}
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/impl/TanYinDataAcquisitionServiceImpl.java
View file @
d1eac0ba
...
@@ -64,6 +64,7 @@ import org.springframework.util.ObjectUtils;
...
@@ -64,6 +64,7 @@ import org.springframework.util.ObjectUtils;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.ZoneId
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -474,11 +475,16 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
...
@@ -474,11 +475,16 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
.
put
(
"endDate"
,
endDate
).
build
();
.
put
(
"endDate"
,
endDate
).
build
();
PageInfo
<
TanYinAlramInfo
>
tanYinInveterInfo
=
tanYinApiUtils
.
postPage
(
"电站逆变器故障信息"
,
apiUrl
+
TanYinConstant
.
inverterAlramUrl
,
JSON
.
toJSONString
(
params
),
null
,
TanYinAlramInfo
.
class
);
PageInfo
<
TanYinAlramInfo
>
tanYinInveterInfo
=
tanYinApiUtils
.
postPage
(
"电站逆变器故障信息"
,
apiUrl
+
TanYinConstant
.
inverterAlramUrl
,
JSON
.
toJSONString
(
params
),
null
,
TanYinAlramInfo
.
class
);
List
<
TanYinAlramInfo
>
tanYinAlramInfos
=
tanYinInveterInfo
.
getList
();
List
<
TanYinAlramInfo
>
tanYinAlramInfos
=
tanYinInveterInfo
.
getList
();
if
(
CollectionUtils
.
isEmpty
(
tanYinAlramInfos
))
{
log
.
warn
(
"-------碳银同步电站逆变器故障信息结束: 未获取到逆变器故障信息 ------- "
);
return
;
}
for
(
TanYinAlramInfo
tanYinAlramInfo
:
tanYinAlramInfos
)
{
for
(
TanYinAlramInfo
tanYinAlramInfo
:
tanYinAlramInfos
)
{
tanYinAlramInfo
.
setCreateTime
(
System
.
currentTimeMillis
());
tanYinAlramInfo
.
setCreateTime
(
System
.
currentTimeMillis
());
tanYinAlramInfoMapper
.
insert
(
tanYinAlramInfo
);
tanYinAlramInfoMapper
.
insert
(
tanYinAlramInfo
);
HYGFJPInverterWarn
hygfjpInverterWarn
=
new
HYGFJPInverterWarn
();
HYGFJPInverterWarn
hygfjpInverterWarn
=
new
HYGFJPInverterWarn
();
// 做查询
hygfjpInverterWarn
.
setTime
(
System
.
currentTimeMillis
());
hygfjpInverterWarn
.
setTime
(
System
.
currentTimeMillis
());
hygfjpInverterWarn
.
setSnCode
(
tanYinAlramInfo
.
getSn
());
hygfjpInverterWarn
.
setSnCode
(
tanYinAlramInfo
.
getSn
());
hygfjpInverterWarn
.
setThirdStationId
(
jpStation
.
getThirdStationId
());
hygfjpInverterWarn
.
setThirdStationId
(
jpStation
.
getThirdStationId
());
...
@@ -494,14 +500,16 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
...
@@ -494,14 +500,16 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
hygfjpInverterWarn
.
setTreatment
(
tanYinAlramInfo
.
getSolution
());
hygfjpInverterWarn
.
setTreatment
(
tanYinAlramInfo
.
getSolution
());
hygfjpInverterWarn
.
setState
(
tanYinAlramInfo
.
getStatus
());
hygfjpInverterWarn
.
setState
(
tanYinAlramInfo
.
getStatus
());
if
(!
ObjectUtils
.
isEmpty
(
tanYinAlramInfo
.
getFaultEndTime
()))
{
if
(!
ObjectUtils
.
isEmpty
(
tanYinAlramInfo
.
getFaultEndTime
()))
{
hygfjpInverterWarn
.
setRecoverTime
(
Long
.
valueOf
(
tanYinAlramInfo
.
getFaultEndTime
()));
Date
faultEndTimeDt
=
Date
.
from
(
LocalDate
.
parse
(
tanYinAlramInfo
.
getFaultEndTime
(),
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
)).
atStartOfDay
(
ZoneId
.
systemDefault
()).
toInstant
());
hygfjpInverterWarn
.
setRecoverTime
(
faultEndTimeDt
.
getTime
());
}
}
if
(!
ObjectUtils
.
isEmpty
(
tanYinAlramInfo
.
getFaultOccurTime
()))
{
if
(!
ObjectUtils
.
isEmpty
(
tanYinAlramInfo
.
getFaultOccurTime
()))
{
hygfjpInverterWarn
.
setStartTime
(
Long
.
valueOf
(
tanYinAlramInfo
.
getFaultOccurTime
()));
Date
faultOccurTimeDt
=
Date
.
from
(
LocalDate
.
parse
(
tanYinAlramInfo
.
getFaultOccurTime
(),
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
)).
atStartOfDay
(
ZoneId
.
systemDefault
()).
toInstant
());
hygfjpInverterWarn
.
setStartTime
(
faultOccurTimeDt
.
getTime
());
}
}
hygfjpInverterWarn
.
setTimeLong
(
null
);
hygfjpInverterWarn
.
setTimeLong
(
null
);
if
((!
ObjectUtils
.
isEmpty
(
tanYinAlramInfo
.
getFaultOccurTime
()))
&&
(!
ObjectUtils
.
isEmpty
(
tanYinAlramInfo
.
getFaultEndTime
())))
{
if
((!
ObjectUtils
.
isEmpty
(
tanYinAlramInfo
.
getFaultOccurTime
()))
&&
(!
ObjectUtils
.
isEmpty
(
tanYinAlramInfo
.
getFaultEndTime
())))
{
hygfjpInverterWarn
.
setTimeLong
(
this
.
convertDate
(
hygfjpInverterWarn
.
getRecoverTime
())
-
this
.
convertDate
(
hygfjpInverterWarn
.
getStartTime
()));
hygfjpInverterWarn
.
setTimeLong
(
this
.
convertDate
(
hygfjpInverterWarn
.
getRecoverTime
())
-
this
.
convertDate
(
hygfjpInverterWarn
.
getStartTime
()));
}
}
if
(
ObjectUtils
.
isEmpty
(
hygfjpInverterWarn
.
getCreatedTime
()))
{
if
(
ObjectUtils
.
isEmpty
(
hygfjpInverterWarn
.
getCreatedTime
()))
{
hygfjpInverterWarn
.
setCreatedTime
(
System
.
currentTimeMillis
());
hygfjpInverterWarn
.
setCreatedTime
(
System
.
currentTimeMillis
());
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/TestController.java
0 → 100644
View file @
d1eac0ba
package
com
.
yeejoin
.
amos
.
boot
.
module
.
hygf
.
biz
.
controller
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.hygf.api.entity.UnitInfo
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.PersonnelBusinessMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.mapper.UnitInfoMapper
;
import
com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.PeasantHouseholdServiceImpl
;
import
com.yeejoin.amos.boot.module.hygf.biz.service.impl.SurveyInformationServiceImpl
;
import
com.yeejoin.amos.boot.module.standard.api.entity.PublicAgencyUser
;
import
com.yeejoin.amos.boot.module.standard.api.mapper.PublicAgencyUserMapper
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.util.AesUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
/**
* 农户信息
*
* @author system_generator
* @date 2023-07-07
*/
@RestController
@Api
(
tags
=
"农户信息Api"
)
@RequestMapping
(
value
=
"/test"
)
public
class
TestController
extends
BaseController
{
@Autowired
SurveyInformationServiceImpl
surveyInformationServiceImpl
;
@Autowired
PeasantHouseholdServiceImpl
peasantHouseholdServiceImpl
;
@Autowired
RedisUtils
redisUtils
;
private
static
final
String
regionRedis
=
"app_region_redis"
;
@Autowired
PersonnelBusinessMapper
personnelBusinessMapper
;
@Autowired
UnitInfoMapper
unitInfoMapper
;
@Autowired
PublicAgencyUserMapper
publicAgencyUserMapper
;
/**
* 新增农户信息
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/initpw"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"新增农户信息"
,
notes
=
"新增农户信息"
)
public
ResponseModel
<
Object
>
initpw
()
{
// 经销商管理员
List
<
UnitInfo
>
list
=
unitInfoMapper
.
selectList
(
null
);
for
(
UnitInfo
unitInfo
:
list
)
{
try
{
int
ph
=
unitInfo
.
getAdminPhone
().
length
();
String
npwd
=
"Zxnk_"
+
unitInfo
.
getAdminPhone
().
substring
(
ph
-
4
,
ph
);
String
npwdm
=
AesUtil
.
encode
(
npwd
,
"qaz"
);
unitInfo
.
setAdminLoginPwd
(
npwdm
);
FeignClientResult
<
AgencyUserModel
>
re
=
Privilege
.
agencyUserClient
.
queryByUserId
(
unitInfo
.
getAdminUserId
());
AgencyUserModel
ag
=
re
.
getResult
();
ag
.
setPassword
(
AesUtil
.
encode
(
npwd
,
"qaz"
));
ag
.
setRePassword
(
AesUtil
.
encode
(
npwd
,
"qaz"
));
Privilege
.
agencyUserClient
.
restorePassword
(
unitInfo
.
getAdminUserId
());
ag
.
setOriginalPassword
(
AesUtil
.
encode
(
"Z2%Op9.q"
,
"qaz"
));
Privilege
.
agencyUserClient
.
modifyPassword
(
unitInfo
.
getAdminUserId
(),
ag
);
unitInfoMapper
.
updateById
(
unitInfo
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
// 经销商子人员
List
<
PublicAgencyUser
>
list2
=
publicAgencyUserMapper
.
selectList
(
null
);
for
(
PublicAgencyUser
unitInfo
:
list2
)
{
try
{
int
ph
=
unitInfo
.
getEmergencyTelephone
().
length
();
String
npwd
=
"Zxnk_"
+
unitInfo
.
getEmergencyTelephone
().
substring
(
ph
-
4
,
ph
);
String
npwdm
=
AesUtil
.
encode
(
npwd
,
"qaz"
);
unitInfo
.
setPassword
(
npwdm
);
FeignClientResult
<
AgencyUserModel
>
re
=
Privilege
.
agencyUserClient
.
queryByUserId
(
unitInfo
.
getAmosUserId
());
AgencyUserModel
ag
=
re
.
getResult
();
ag
.
setPassword
(
AesUtil
.
encode
(
npwd
,
"qaz"
));
ag
.
setRePassword
(
AesUtil
.
encode
(
npwd
,
"qaz"
));
Privilege
.
agencyUserClient
.
restorePassword
(
unitInfo
.
getAmosUserId
());
ag
.
setOriginalPassword
(
AesUtil
.
encode
(
"Z2%Op9.q"
,
"qaz"
));
Privilege
.
agencyUserClient
.
modifyPassword
(
unitInfo
.
getAmosUserId
(),
ag
);
publicAgencyUserMapper
.
updateById
(
unitInfo
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
return
CommonResponseNewUtil
.
success
();
}
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/TestController.java
View file @
d1eac0ba
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.date.DateUtil
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
@@ -22,11 +26,16 @@ import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
...
@@ -22,11 +26,16 @@ import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.TdengineTimeServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.TdengineTimeServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanWaringRecordMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanWaringRecordMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvHealthIndexMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvWaringRecordMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvWaringRecordMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvWarningRecord
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvWarningRecord
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.utils.TimeRangeUtil
;
import
cn.hutool.core.date.DateUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -187,7 +196,7 @@ public class TestController extends BaseController {
...
@@ -187,7 +196,7 @@ public class TestController extends BaseController {
time
=
DateUtil
.
offsetMinute
(
time
,
-
DateUtil
.
minute
(
time
)
%
10
);
time
=
DateUtil
.
offsetMinute
(
time
,
-
DateUtil
.
minute
(
time
)
%
10
);
String
format
=
DateUtil
.
format
(
time
,
"yyyy-MM-dd HH:mm:00"
);
String
format
=
DateUtil
.
format
(
time
,
"yyyy-MM-dd HH:mm:00"
);
time
=
DateUtil
.
parse
(
format
,
"yyyy-MM-dd HH:mm:00"
);
time
=
DateUtil
.
parse
(
format
,
"yyyy-MM-dd HH:mm:00"
);
tdengineTimeService
.
insertMomentDataTest
(
"2024-07-2
5
08:00:00"
);
tdengineTimeService
.
insertMomentDataTest
(
"2024-07-2
4
08:00:00"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -202,9 +211,75 @@ public class TestController extends BaseController {
...
@@ -202,9 +211,75 @@ public class TestController extends BaseController {
time
=
DateUtil
.
offsetMinute
(
time
,
-
DateUtil
.
minute
(
time
)
%
10
);
time
=
DateUtil
.
offsetMinute
(
time
,
-
DateUtil
.
minute
(
time
)
%
10
);
String
format
=
DateUtil
.
format
(
time
,
"yyyy-MM-dd HH:mm:00"
);
String
format
=
DateUtil
.
format
(
time
,
"yyyy-MM-dd HH:mm:00"
);
time
=
DateUtil
.
parse
(
format
,
"yyyy-MM-dd HH:mm:00"
);
time
=
DateUtil
.
parse
(
format
,
"yyyy-MM-dd HH:mm:00"
);
tdengineTimeService
.
insertMomentDataPvTest
(
"2024-07-25 08:00:00"
);
tdengineTimeService
.
insertMomentDataPvTest
(
"2024-07-24 08:00:00"
);
//区域 全域最后统一生成
tdengineTimeService
.
insertMomentDataAllTest
(
"2024-07-24 08:00:00"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
@Autowired
PvHealthIndexMapper
pvHealthIndexMapper
;
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"test2"
,
notes
=
"test1"
)
@GetMapping
(
"/clear-health-cf"
)
public
void
clearHealthCf
(
@RequestParam
(
value
=
"startTime"
,
required
=
false
)
String
startTime
)
throws
ParseException
{
List
<
String
>
type
=
new
ArrayList
<>();
type
.
add
(
"按10分钟"
);
type
.
add
(
"按小时"
);
type
.
add
(
"按天"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
List
<
String
>
mList
=
TimeRangeUtil
.
getMomentInfo
(
sdf
.
parse
(
startTime
),
new
Date
());
for
(
String
d
:
mList
)
{
LambdaQueryWrapper
<
FanHealthIndex
>
wf
=
new
LambdaQueryWrapper
<>();
wf
.
eq
(
FanHealthIndex:
:
getAnalysisTime
,
d
);
wf
.
orderByAsc
(
FanHealthIndex:
:
getTs
);
wf
.
eq
(
FanHealthIndex:
:
getAnalysisObjType
,
"测点"
);
for
(
String
s
:
type
)
{
wf
.
eq
(
FanHealthIndex:
:
getAnalysisType
,
s
);
List
<
FanHealthIndex
>
list
=
fanHealthIndexMapper
.
selectList
(
wf
);
Map
<
String
,
List
<
FanHealthIndex
>>
lm
=
list
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
FanHealthIndex:
:
getIndexAddress
));
for
(
Entry
<
String
,
List
<
FanHealthIndex
>>
m
:
lm
.
entrySet
())
{
List
<
FanHealthIndex
>
pl
=
m
.
getValue
();
if
(
pl
.
size
()
>
1
)
{
pl
=
pl
.
subList
(
1
,
pl
.
size
());
}
List
<
Long
>
ts
=
pl
.
stream
().
map
(
FanHealthIndex:
:
getTs
).
collect
(
Collectors
.
toList
());
LambdaQueryWrapper
<
FanHealthIndex
>
df
=
new
LambdaQueryWrapper
<>();
for
(
Long
ts1
:
ts
)
{
df
.
eq
(
FanHealthIndex:
:
getTs
,
ts1
);
fanHealthIndexMapper
.
delete
(
df
);
}
}
}
LambdaQueryWrapper
<
PvHealthIndex
>
pf
=
new
LambdaQueryWrapper
<>();
pf
.
eq
(
PvHealthIndex:
:
getAnalysisTime
,
d
);
pf
.
orderByAsc
(
PvHealthIndex:
:
getTs
);
pf
.
eq
(
PvHealthIndex:
:
getAnalysisObjType
,
"测点"
);
for
(
String
s
:
type
)
{
pf
.
eq
(
PvHealthIndex:
:
getAnalysisType
,
s
);
List
<
PvHealthIndex
>
listp
=
pvHealthIndexMapper
.
selectList
(
pf
);
Map
<
String
,
List
<
PvHealthIndex
>>
lmp
=
listp
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
PvHealthIndex:
:
getIndexAddress
));
for
(
Entry
<
String
,
List
<
PvHealthIndex
>>
m
:
lmp
.
entrySet
())
{
List
<
PvHealthIndex
>
pl
=
m
.
getValue
();
if
(
pl
.
size
()
>
1
)
{
pl
=
pl
.
subList
(
1
,
pl
.
size
());
}
List
<
Long
>
ts
=
pl
.
stream
().
map
(
PvHealthIndex:
:
getTs
).
collect
(
Collectors
.
toList
());
LambdaQueryWrapper
<
PvHealthIndex
>
df
=
new
LambdaQueryWrapper
<>();
for
(
Long
ts1
:
ts
)
{
df
.
eq
(
PvHealthIndex:
:
getTs
,
ts1
);
pvHealthIndexMapper
.
delete
(
df
);
}
}
}
}
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/dto/HealthIndexDTO.java
View file @
d1eac0ba
...
@@ -37,4 +37,7 @@ public class HealthIndexDTO {
...
@@ -37,4 +37,7 @@ public class HealthIndexDTO {
private
String
analysisTime
;
private
String
analysisTime
;
private
String
kks
;
private
String
kks
;
private
String
orgCode
;
private
String
orgCode
;
private
String
manufacturer
;
private
String
deviceType
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/listener/SyncESDataToTdengineMqttListener.java
View file @
d1eac0ba
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
listener
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
listener
;
import
com.alibaba.fastjson.JSON
;
import
java.text.ParseException
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.Date
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl
;
import
java.util.concurrent.CountDownLatch
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
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.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.impl.TdengineTimeServiceImpl
;
import
cn.hutool.core.date.DateUtil
;
import
lombok.extern.slf4j.Slf4j
;
/**
/**
* @author Administrator
* @author Administrator
*/
*/
...
@@ -16,43 +26,70 @@ import org.typroject.tyboot.component.emq.EmqxListener;
...
@@ -16,43 +26,70 @@ import org.typroject.tyboot.component.emq.EmqxListener;
@Slf4j
@Slf4j
public
class
SyncESDataToTdengineMqttListener
extends
EmqxListener
{
public
class
SyncESDataToTdengineMqttListener
extends
EmqxListener
{
@Autowired
private
CommonServiceImpl
commonServiceImpl
;
@Autowired
@Autowired
CommonServiceImpl
commonServiceImpl
;
private
TdengineTimeServiceImpl
tdengineTimeService
;
@Override
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
mqttMessage
)
{
public
void
processMessage
(
String
topic
,
MqttMessage
mqttMessage
)
throws
InterruptedException
,
ParseException
{
log
.
info
(
topic
+
"收到数据同步成功,开始计算健康指数!"
);
log
.
info
(
topic
+
"收到数据同步成功,开始计算健康指数!"
);
byte
[]
payload
=
mqttMessage
.
getPayload
();
byte
[]
payload
=
mqttMessage
.
getPayload
();
String
str
=
new
String
(
payload
);
String
str
=
new
String
(
payload
);
String
msg
=
JSON
.
parse
(
str
).
toString
();
String
msg
=
JSON
.
parse
(
str
).
toString
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
msg
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
msg
);
String
flag
=
jsonObject
.
get
(
"sync_flag"
).
toString
();
String
flag
=
jsonObject
.
get
(
"sync_flag"
).
toString
();
if
(
"success"
.
equals
(
flag
)){
if
(
"success"
.
equals
(
flag
))
{
//开始异步计算光伏的健康指数算法
new
Thread
(()->{
Date
time
=
new
Date
();
//调用光伏的健康指数算法
time
=
DateUtil
.
offsetMinute
(
time
,
-
DateUtil
.
minute
(
time
)
%
10
);
commonServiceImpl
.
healthWarningMinuteByPv
();
String
format
=
DateUtil
.
format
(
time
,
"yyyy-MM-dd HH:mm:00"
);
}).
start
();
time
=
DateUtil
.
parse
(
format
,
"yyyy-MM-dd HH:mm:00"
);
//开始异步计算风机的健康指数算法
new
Thread
(()->{
ExecutorService
excutorService
=
Executors
.
newFixedThreadPool
(
4
);
//调用风机的健康指数算法
int
taskCount
=
2
;
commonServiceImpl
.
healthWarningMinuteByFan
();
final
CountDownLatch
latch
=
new
CountDownLatch
(
taskCount
);
}).
start
();
excutorService
.
submit
(()->{
commonServiceImpl
.
healthWarningMinuteByFan
();
}
latch
.
countDown
();
if
(
"pvsuccess"
.
equals
(
flag
)){
});
//开始异步计算光伏的健康指数算法
excutorService
.
submit
(()->{
new
Thread
(()->{
commonServiceImpl
.
healthWarningMinuteByPv
();
//调用光伏的健康指数算法
latch
.
countDown
();
commonServiceImpl
.
healthWarningMinuteByPv
();
});
}).
start
();
}
System
.
out
.
println
(
"等待所有任务完成.."
);
if
(
"fansuccess"
.
equals
(
flag
)){
latch
.
await
();
//开始异步计算光伏的健康指数算法
System
.
out
.
println
(
"所有任务完成"
);
new
Thread
(()->{
//调用光伏的健康指数算法
//区域 全域最后统一生成
commonServiceImpl
.
healthWarningMinuteByFan
();
tdengineTimeService
.
insertMomentDataAll
(
format
);
}).
start
();
}
// // 开始异步计算光伏的健康指数算法
}
// new Thread(() -> {
// // 调用光伏的健康指数算法
// commonServiceImpl.healthWarningMinuteByPv();
// }).start();
// // 开始异步计算风机的健康指数算法
// new Thread(() -> {
// // 调用风机的健康指数算法
// commonServiceImpl.healthWarningMinuteByFan();
// }).start();
}
if
(
"pvsuccess"
.
equals
(
flag
))
{
// 开始异步计算光伏的健康指数算法
new
Thread
(()
->
{
// 调用光伏的健康指数算法
commonServiceImpl
.
healthWarningMinuteByPv
();
}).
start
();
}
if
(
"fansuccess"
.
equals
(
flag
))
{
// 开始异步计算光伏的健康指数算法
new
Thread
(()
->
{
// 调用光伏的健康指数算法
commonServiceImpl
.
healthWarningMinuteByFan
();
}).
start
();
}
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/IFanHealthIndexService.java
View file @
d1eac0ba
...
@@ -90,8 +90,34 @@ public interface IFanHealthIndexService {
...
@@ -90,8 +90,34 @@ public interface IFanHealthIndexService {
*/
*/
List
<
FanHealthIndex
>
getInfoListByGroupByQgFan
(
String
startTime
,
String
tableName
,
String
analysisObjectType
);
List
<
FanHealthIndex
>
getInfoListByGroupByQgFan
(
String
startTime
,
String
tableName
,
String
analysisObjectType
);
/**
* 光伏 & 风电加权平均计算 :区域
*
*
* @param startTime startTime
* @param fanTableName fanTableName
* @param pvTableName pvTableName
* @param analysisObjectType analysisObjectType
* @return {@link List< HealthIndexDTO>}
* @author yangyang
* @throws
* @date 2024/7/25 14:01
*/
List
<
HealthIndexDTO
>
getInfoListByGroupByQy
(
String
startTime
,
String
fanTableName
,
String
pvTableName
,
String
analysisObjectType
);
List
<
HealthIndexDTO
>
getInfoListByGroupByQy
(
String
startTime
,
String
fanTableName
,
String
pvTableName
,
String
analysisObjectType
);
/**
* 光伏 & 风电加权平均计算 :全域【所有 / 全国】
*
*
* @param startTime startTime
* @param fanTableName fanTableName
* @param pvTableName pvTableName
* @param analysisObjectType analysisObjectType
* @return {@link List< HealthIndexDTO>}
* @author yangyang
* @throws
* @date 2024/7/25 14:01
*/
List
<
HealthIndexDTO
>
getInfoListByGroupByQg
(
String
startTime
,
String
fanTableName
,
String
pvTableName
,
String
analysisObjectType
);
List
<
HealthIndexDTO
>
getInfoListByGroupByQg
(
String
startTime
,
String
fanTableName
,
String
pvTableName
,
String
analysisObjectType
);
FanHealthIndex
toFanHealthIndex
(
HealthIndexDTO
healthIndex
);
FanHealthIndex
toFanHealthIndex
(
HealthIndexDTO
healthIndex
);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/FanHealthIndexServiceImpl.java
View file @
d1eac0ba
...
@@ -58,14 +58,14 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
...
@@ -58,14 +58,14 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
List
<
IdxBizFanWeight
>
idxBizFanWeights
=
idxBizFanWeightMapper
.
selectList
(
idxBizFanWeightQueryWrapper
);
List
<
IdxBizFanWeight
>
idxBizFanWeights
=
idxBizFanWeightMapper
.
selectList
(
idxBizFanWeightQueryWrapper
);
Map
<
String
,
Float
>
weightMap
=
idxBizFanWeights
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
.
getArae
()
+
o
.
getStation
()
+
o
.
getEquipmentName
()
+
o
.
getSubarray
()
+
o
.
getPointName
(),
IdxBizFanWeight:
:
getValue
));
Map
<
String
,
Float
>
weightMap
=
idxBizFanWeights
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
.
getArae
()
+
o
.
getStation
()
+
o
.
getEquipmentName
()
+
o
.
getSubarray
()
+
o
.
getPointName
(),
IdxBizFanWeight:
:
getValue
));
// 开始计算加权平均
// 开始计算加权平均
Map
<
String
,
List
<
FanHealthIndex
>>
fanHealthIndicesZxtMap
=
fanHealthIndicesZxt
.
stream
().
collect
(
Collectors
.
groupingBy
(
o
->
o
.
getGatewayId
()
+
o
.
get
Station
()
+
o
.
getAnalysisObjType
()
+
o
.
getArea
()
+
o
.
getSubSystem
()
+
o
.
getEquipmentName
()
+
o
.
getNumber
()
+
o
.
getOrgCode
()));
Map
<
String
,
List
<
FanHealthIndex
>>
fanHealthIndicesZxtMap
=
fanHealthIndicesZxt
.
stream
().
collect
(
Collectors
.
groupingBy
(
o
->
o
.
getGatewayId
()
+
o
.
get
IndexAddress
()
+
o
.
getStation
()
+
o
.
getAnalysisObjType
()
+
o
.
getAnalysisObjSeq
()
+
o
.
getWeight
()
+
o
.
getArea
()
+
o
.
getSubSystem
()
+
o
.
getEquipmentName
()
+
o
.
getNumber
()
+
o
.
getPointName
()
+
o
.
getKks
()
+
o
.
getOrgCode
()));
List
<
FanHealthIndex
>
fanHealthIndicesZxtNews
=
new
ArrayList
<>();
List
<
FanHealthIndex
>
fanHealthIndicesZxtNews
=
new
ArrayList
<>();
fanHealthIndicesZxtMap
.
forEach
((
k
,
v
)
->
{
fanHealthIndicesZxtMap
.
forEach
((
k
,
v
)
->
{
FanHealthIndex
fanHealthIndex
=
new
FanHealthIndex
();
FanHealthIndex
fanHealthIndex
=
new
FanHealthIndex
();
fanHealthIndex
.
setIndexAddress
(
v
.
get
(
0
).
getIndexAddress
());
fanHealthIndex
.
setIndexAddress
(
v
.
get
(
0
).
getIndexAddress
());
fanHealthIndex
.
setGatewayId
(
v
.
get
(
0
).
getGatewayId
());
fanHealthIndex
.
setGatewayId
(
v
.
get
(
0
).
getGatewayId
());
fanHealthIndex
.
setStation
(
v
.
get
(
0
).
getStation
());
fanHealthIndex
.
setStation
(
v
.
get
(
0
).
getStation
());
fanHealthIndex
.
setAnalysisObjType
(
"测点"
);
fanHealthIndex
.
setAnalysisObjType
(
v
.
get
(
0
).
getAnalysisObjType
()
);
fanHealthIndex
.
setAnalysisObjSeq
(
v
.
get
(
0
).
getAnalysisObjSeq
());
fanHealthIndex
.
setAnalysisObjSeq
(
v
.
get
(
0
).
getAnalysisObjSeq
());
fanHealthIndex
.
setWeight
(
v
.
get
(
0
).
getWeight
());
fanHealthIndex
.
setWeight
(
v
.
get
(
0
).
getWeight
());
fanHealthIndex
.
setArea
(
v
.
get
(
0
).
getArea
());
fanHealthIndex
.
setArea
(
v
.
get
(
0
).
getArea
());
...
@@ -73,7 +73,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
...
@@ -73,7 +73,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
fanHealthIndex
.
setNumber
(
v
.
get
(
0
).
getNumber
());
fanHealthIndex
.
setNumber
(
v
.
get
(
0
).
getNumber
());
fanHealthIndex
.
setEquipmentName
(
v
.
get
(
0
).
getEquipmentName
());
fanHealthIndex
.
setEquipmentName
(
v
.
get
(
0
).
getEquipmentName
());
fanHealthIndex
.
setPointName
(
v
.
get
(
0
).
getPointName
());
fanHealthIndex
.
setPointName
(
v
.
get
(
0
).
getPointName
());
fanHealthIndex
.
setKks
(
v
.
get
(
0
).
get
Number
());
fanHealthIndex
.
setKks
(
v
.
get
(
0
).
get
Kks
());
fanHealthIndex
.
setOrgCode
(
v
.
get
(
0
).
getOrgCode
());
fanHealthIndex
.
setOrgCode
(
v
.
get
(
0
).
getOrgCode
());
// 例如 子系统 = (测点1 * 测点1权重 + 测点2 * 测点2权重 + .... 测点n权重) / (测点1权重 + 测点2权重 + .... 测点n权重)
// 例如 子系统 = (测点1 * 测点1权重 + 测点2 * 测点2权重 + .... 测点n权重) / (测点1权重 + 测点2权重 + .... 测点n权重)
// 但是测点是没有权重的,所以子系统无法计算加权平均
// 但是测点是没有权重的,所以子系统无法计算加权平均
...
@@ -380,7 +380,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
...
@@ -380,7 +380,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
weightMap
.
putAll
(
fanWeightMap
);
weightMap
.
putAll
(
fanWeightMap
);
weightMap
.
putAll
(
pvWeightMap
);
weightMap
.
putAll
(
pvWeightMap
);
// 开始计算加权平均
// 开始计算加权平均
Map
<
String
,
List
<
HealthIndexDTO
>>
fanHealthIndicesZxtMap
=
healthIndexDTOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
o
->
o
.
getAnalysisObjType
()
+
o
.
getArea
()
+
o
.
getOrgCode
()
));
Map
<
String
,
List
<
HealthIndexDTO
>>
fanHealthIndicesZxtMap
=
healthIndexDTOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
o
->
o
.
getAnalysisObjType
()
+
o
.
getArea
()));
List
<
HealthIndexDTO
>
fanHealthIndicesZxtNews
=
new
ArrayList
<>();
List
<
HealthIndexDTO
>
fanHealthIndicesZxtNews
=
new
ArrayList
<>();
fanHealthIndicesZxtMap
.
forEach
((
k
,
v
)
->
{
fanHealthIndicesZxtMap
.
forEach
((
k
,
v
)
->
{
HealthIndexDTO
healthIndex
=
new
HealthIndexDTO
();
HealthIndexDTO
healthIndex
=
new
HealthIndexDTO
();
...
@@ -426,7 +426,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
...
@@ -426,7 +426,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
weightMap
.
putAll
(
pvWeightMap
);
weightMap
.
putAll
(
pvWeightMap
);
// 开始计算加权平均
// 开始计算加权平均
Map
<
String
,
List
<
HealthIndexDTO
>>
fanHealthIndicesZxtMap
=
healthIndexDTOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
o
->
o
.
getAnalysisObjType
()
+
o
.
getOrgCode
()
));
Map
<
String
,
List
<
HealthIndexDTO
>>
fanHealthIndicesZxtMap
=
healthIndexDTOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
o
->
o
.
getAnalysisObjType
()));
List
<
HealthIndexDTO
>
fanHealthIndicesZxtNews
=
new
ArrayList
<>();
List
<
HealthIndexDTO
>
fanHealthIndicesZxtNews
=
new
ArrayList
<>();
fanHealthIndicesZxtMap
.
forEach
((
k
,
v
)
->
{
fanHealthIndicesZxtMap
.
forEach
((
k
,
v
)
->
{
HealthIndexDTO
healthIndex
=
new
HealthIndexDTO
();
HealthIndexDTO
healthIndex
=
new
HealthIndexDTO
();
...
@@ -475,8 +475,8 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
...
@@ -475,8 +475,8 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
public
Double
getWeight
(
Supplier
<
String
>
key
,
Map
<
String
,
Float
>
weightMap
)
{
public
Double
getWeight
(
Supplier
<
String
>
key
,
Map
<
String
,
Float
>
weightMap
)
{
Float
weight
=
weightMap
.
get
(
key
.
get
());
Float
weight
=
weightMap
.
get
(
key
.
get
());
if
(
weight
==
null
)
{
if
(
weight
==
null
)
{
log
.
error
(
"计算加权平均异常【"
+
key
.
get
()
+
"】
没有配置测点
权重"
);
log
.
error
(
"计算加权平均异常【"
+
key
.
get
()
+
"】
未配置
权重"
);
throw
new
RuntimeException
(
"【"
+
key
.
get
()
+
"】
没有配置测点
权重"
);
throw
new
RuntimeException
(
"【"
+
key
.
get
()
+
"】
未配置
权重"
);
}
}
return
weight
.
doubleValue
();
return
weight
.
doubleValue
();
}
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/PvHealthIndexServiceImpl.java
View file @
d1eac0ba
...
@@ -162,7 +162,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
...
@@ -162,7 +162,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
String
analysisObjectType
)
{
String
analysisObjectType
)
{
List
<
PvHealthIndex
>
pvHealthIndices
=
pvHealthIndexMapper
.
getInfoList
(
startTime
,
tableName
,
analysisObjectType
);
List
<
PvHealthIndex
>
pvHealthIndices
=
pvHealthIndexMapper
.
getInfoList
(
startTime
,
tableName
,
analysisObjectType
);
QueryWrapper
<
IdxBizPvWeight
>
queryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
IdxBizPvWeight
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
"
4
"
);
queryWrapper
.
eq
(
"type"
,
"
3
"
);
queryWrapper
.
isNotNull
(
"value"
);
queryWrapper
.
isNotNull
(
"value"
);
List
<
IdxBizPvWeight
>
idxBizFanWeights
=
idxBizPvWeightMapper
.
selectList
(
queryWrapper
);
List
<
IdxBizPvWeight
>
idxBizFanWeights
=
idxBizPvWeightMapper
.
selectList
(
queryWrapper
);
Map
<
String
,
Float
>
weightMap
=
idxBizFanWeights
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
.
getArae
()
+
o
.
getStation
()
+
o
.
getEquipmentName
()
+
o
.
getSubarray
(),
IdxBizPvWeight:
:
getValue
));
Map
<
String
,
Float
>
weightMap
=
idxBizFanWeights
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
.
getArae
()
+
o
.
getStation
()
+
o
.
getEquipmentName
()
+
o
.
getSubarray
(),
IdxBizPvWeight:
:
getValue
));
...
@@ -218,7 +218,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
...
@@ -218,7 +218,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
String
analysisObjectType
)
{
String
analysisObjectType
)
{
List
<
PvHealthIndex
>
pvHealthIndices
=
pvHealthIndexMapper
.
getInfoList
(
startTime
,
tableName
,
analysisObjectType
);
List
<
PvHealthIndex
>
pvHealthIndices
=
pvHealthIndexMapper
.
getInfoList
(
startTime
,
tableName
,
analysisObjectType
);
QueryWrapper
<
IdxBizPvWeight
>
queryWrapper
=
new
QueryWrapper
<>();
QueryWrapper
<
IdxBizPvWeight
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
"
3
"
);
queryWrapper
.
eq
(
"type"
,
"
4
"
);
queryWrapper
.
isNotNull
(
"value"
);
queryWrapper
.
isNotNull
(
"value"
);
List
<
IdxBizPvWeight
>
idxBizFanWeights
=
idxBizPvWeightMapper
.
selectList
(
queryWrapper
);
List
<
IdxBizPvWeight
>
idxBizFanWeights
=
idxBizPvWeightMapper
.
selectList
(
queryWrapper
);
Map
<
String
,
Float
>
weightMap
=
idxBizFanWeights
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
.
getArae
()
+
o
.
getStation
()
+
o
.
getEquipmentName
(),
IdxBizPvWeight:
:
getValue
));
Map
<
String
,
Float
>
weightMap
=
idxBizFanWeights
.
stream
().
collect
(
Collectors
.
toMap
(
o
->
o
.
getArae
()
+
o
.
getStation
()
+
o
.
getEquipmentName
(),
IdxBizPvWeight:
:
getValue
));
...
@@ -371,8 +371,8 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
...
@@ -371,8 +371,8 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
public
Double
getWeight
(
Supplier
<
String
>
key
,
Map
<
String
,
Float
>
weightMap
)
{
public
Double
getWeight
(
Supplier
<
String
>
key
,
Map
<
String
,
Float
>
weightMap
)
{
Float
weight
=
weightMap
.
get
(
key
.
get
());
Float
weight
=
weightMap
.
get
(
key
.
get
());
if
(
weight
==
null
)
{
if
(
weight
==
null
)
{
log
.
error
(
"计算加权平均异常【"
+
key
.
get
()
+
"】
没有配置测点
权重"
);
log
.
error
(
"计算加权平均异常【"
+
key
.
get
()
+
"】
未配置
权重"
);
throw
new
RuntimeException
(
"
没有配置测点
权重"
);
throw
new
RuntimeException
(
"
未配置
权重"
);
}
}
return
weight
.
doubleValue
();
return
weight
.
doubleValue
();
}
}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/TdengineTimeServiceImpl.java
View file @
d1eac0ba
This diff is collapsed.
Click to expand it.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/tdengine2/FanHealthIndex.xml
View file @
d1eac0ba
...
@@ -533,9 +533,12 @@
...
@@ -533,9 +533,12 @@
<select
id=
"getInfoList"
resultType=
"com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex"
>
<select
id=
"getInfoList"
resultType=
"com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex"
>
select
select
index_address,
gateway_id ,
gateway_id ,
station,
station,
analysis_obj_type,
analysis_obj_type,
analysis_obj_seq,
weight,
area,
area,
sub_system,
sub_system,
equipment_name,
equipment_name,
...
@@ -543,6 +546,7 @@
...
@@ -543,6 +546,7 @@
anomaly,
anomaly,
org_code,
org_code,
health_index,
health_index,
kks,
point_name
point_name
from
from
#{tableName}
#{tableName}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/tdengine2/PvHealthIndex.xml
View file @
d1eac0ba
...
@@ -296,15 +296,21 @@
...
@@ -296,15 +296,21 @@
<select
id=
"getInfoList"
resultType=
"com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex"
>
<select
id=
"getInfoList"
resultType=
"com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex"
>
select
select
index_address,
gateway_id ,
gateway_id ,
station,
station,
analysis_obj_type,
analysis_obj_type,
analysis_obj_seq,
weight,
area,
area,
subarray,
subarray,
manufacturer,
equipment_name,
equipment_name,
anomaly,
anomaly,
org_code,
org_code,
health_index,
health_index,
device_type,
kks,
point_name
point_name
from
from
#{tableName}
#{tableName}
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/TestController.java
0 → 100644
View file @
d1eac0ba
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.PersonAccount
;
import
com.yeejoin.amos.boot.module.jxiop.api.entity.PersonBasic
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonAccountMapper
;
import
com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonBasicMapper
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.util.AesUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
/**
* 农户信息
*
* @author system_generator
* @date 2023-07-07
*/
@RestController
@Api
(
tags
=
"农户信息Api"
)
@RequestMapping
(
value
=
"/test"
)
public
class
TestController
extends
BaseController
{
@Autowired
PersonBasicMapper
personBasicMapper
;
@Autowired
PersonAccountMapper
personAccountMapper
;
/**
* 新增农户信息
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@GetMapping
(
value
=
"/initpw"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"刷新基础管理信息"
,
notes
=
"刷新基础管理信息"
)
public
ResponseModel
<
Object
>
initpw
()
{
// 基础管理员
List
<
PersonAccount
>
list
=
personAccountMapper
.
selectList
(
null
);
int
i
=
0
;
for
(
PersonAccount
unitInfo
:
list
)
{
System
.
out
.
println
();
System
.
out
.
println
(++
i
+
"/"
+
list
.
size
());
try
{
PersonBasic
personBasic
=
personBasicMapper
.
selectById
(
unitInfo
.
getPersonId
());
int
ph
=
personBasic
.
getPhone
().
length
();
String
npwd
=
"Zxnk_"
+
personBasic
.
getPhone
().
substring
(
ph
-
4
,
ph
);
String
npwdm
=
AesUtil
.
encode
(
npwd
,
"qaz"
);
unitInfo
.
setPassword
(
npwdm
);
unitInfo
.
setSecondaryPassword
(
npwdm
);
FeignClientResult
<
AgencyUserModel
>
re
=
Privilege
.
agencyUserClient
.
queryByUserId
(
unitInfo
.
getPuserId
());
AgencyUserModel
ag
=
re
.
getResult
();
ag
.
setPassword
(
AesUtil
.
encode
(
npwd
,
"qaz"
));
ag
.
setRePassword
(
AesUtil
.
encode
(
npwd
,
"qaz"
));
Privilege
.
agencyUserClient
.
restorePassword
(
unitInfo
.
getPuserId
());
ag
.
setOriginalPassword
(
AesUtil
.
encode
(
"Z2%Op9.q"
,
"qaz"
));
Privilege
.
agencyUserClient
.
modifyPassword
(
unitInfo
.
getPuserId
(),
ag
);
personAccountMapper
.
updateById
(
unitInfo
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
return
new
ResponseModel
<>();
}
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/resources/application-dev1.properties
0 → 100644
View file @
d1eac0ba
## DB properties:
spring.db1.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
spring.db1.datasource.url
=
jdbc:mysql://10.20.1.157:3306/production?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db1.datasource.username
=
root
spring.db1.datasource.password
=
Yeejoin@2020
spring.db2.datasource.driver-class-name
=
com.mysql.cj.jdbc.Driver
spring.db2.datasource.url
=
jdbc:mysql://10.20.1.157:3306/amos_project?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.db2.datasource.username
=
root
spring.db2.datasource.password
=
Yeejoin@2020
spring.db3.datasource.driver-class-name
:
com.mysql.cj.jdbc.Driver
spring.db3.datasource.url
=
jdbc:mysql://10.20.1.157:3306/amos_mcb?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull
spring.db3.datasource.username
=
root
spring.db3.datasource.password
=
Yeejoin@2020
## eureka properties:
eureka.instance.hostname
=
10.20.1.160
eureka.client.serviceUrl.defaultZone
=
http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/
## redis properties:
spring.redis.database
=
1
spring.redis.host
=
10.20.1.210
spring.redis.port
=
6379
spring.redis.password
=
yeejoin@2020
spring.cache.type
=
GENERIC
j2cache.open-spring-cache
=
true
j2cache.cache-clean-mode
=
passive
j2cache.allow-null-values
=
true
j2cache.redis-client
=
lettuce
j2cache.l2-cache-open
=
true
j2cache.broadcast
=
net.oschina.j2cache.cache.support.redis.SpringRedisPubSubPolicy
j2cache.L1.provider_class
=
caffeine
j2cache.L2.provider_class
=
net.oschina.j2cache.cache.support.redis.SpringRedisProvider
j2cache.L2.config_section
=
lettuce
j2cache.sync_ttl_to_redis
=
true
j2cache.default_cache_null_object
=
false
j2cache.serialization
=
fst
caffeine.properties
=
/caffeine.properties
lettuce.mode
=
single
lettuce.namespace
=
lettuce.storage
=
generic
lettuce.channel
=
j2cache
lettuce.scheme
=
redis
lettuce.hosts
=
${spring.redis.host}:${spring.redis.port}
lettuce.password
=
${spring.redis.password}
lettuce.database
=
${spring.redis.database}
lettuce.sentinelMasterId
=
lettuce.maxTotal
=
100
lettuce.maxIdle
=
10
lettuce.minIdle
=
10
lettuce.timeout
=
10000
emqx.clean-session
=
true
emqx.client-id
=
${spring.application.name}-${random.int[1024,65536]}
emqx.broker
=
tcp://10.20.1.210:2883
emqx.user-name
=
super
emqx.password
=
a123456
emqx.max-inflight
=
1000
spring.influx.url
=
http://39.98.246.31:8086
spring.influx.password
=
Yeejoin@2020
spring.influx.user
=
root
spring.influx.database
=
iot_platform
spring.influx.retention_policy
=
default
spring.influx.retention_policy_time
=
30d
spring.influx.actions
=
10000
spring.influx.bufferLimit
=
20000
knife4j.production
=
false
knife4j.enable
=
true
knife4j.basic.enable
=
true
knife4j.basic.username
=
admin
knife4j.basic.password
=
a1234560
management.security.enabled
=
true
spring.security.user.name
=
admin
spring.security.user.password
=
a1234560
fire-rescue
=
123
mybatis-plus.global-config.db-config.update-strategy
=
ignored
# user-amos setting : This value is the secretkey for person manage moudle accout password encryption.please don't change it!!!
amos.secret.key
=
qaz
# if your service can't be access ,you can use this setting , you need change ip as your.
#eureka.instance.prefer-ip-address=true
#eureka.instance.ip-address=172.16.3.122
spring.activemq.broker-url
=
tcp://10.20.1.210:61616
spring.activemq.user
=
admin
spring.activemq.password
=
admin
spring.jms.pub-sub-domain
=
false
myqueue
=
amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness
modifypasswordqueue
=
amos.privilege.v1.JXIOP.AMOS_ADMIN.modifyPassword
yth.qg.id
=
1
emqx.client-user-name
=
admin
emqx.client-password
=
public
logic
=
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-jxiop-biz/src/main/resources/logback-dev1.xml
0 → 100644
View file @
d1eac0ba
<?xml version="1.0" encoding="UTF-8"?>
<configuration
debug=
"false"
>
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property
name=
"LOG_HOME"
value=
"log"
/>
<property
name=
"LOG_PATTERN"
value=
"%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %-50.50logger{50} - %msg [%file:%line] %n"
/>
<!-- 按照每天生成日志文件 -->
<appender
name=
"FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<!--日志文件输出的文件名-->
<FileNamePattern>
${LOG_HOME}/ccs.log.%d{yyyy-MM-dd}.log
</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>
7
</MaxHistory>
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>
${LOG_PATTERN}
</pattern>
</encoder>
<!--日志文件最大的大小-->
<triggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"
>
<MaxFileSize>
30mb
</MaxFileSize>
</triggeringPolicy>
</appender>
<!-- 控制台输出 -->
<appender
name=
"STDOUT"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>
${LOG_PATTERN}
</pattern>
</encoder>
</appender>
<!--myibatis log configure-->
<logger
name=
"com.apache.ibatis"
level=
"DEBUG"
/>
<logger
name=
"java.sql.Connection"
level=
"DEBUG"
/>
<logger
name=
"java.sql.Statement"
level=
"DEBUG"
/>
<logger
name=
"java.sql.PreparedStatement"
level=
"DEBUG"
/>
<logger
name=
"com.baomidou.mybatisplus"
level=
"DEBUG"
/>
<logger
name=
"org.springframework"
level=
"DEBUG"
/>
<logger
name=
"org.typroject"
level=
"DEBUG"
/>
<logger
name=
"com.yeejoin"
level=
"DEBUG"
/>
<!-- 日志输出级别 -->
<root
level=
"INFO"
>
<appender-ref
ref=
"FILE"
/>
<appender-ref
ref=
"STDOUT"
/>
</root>
</configuration>
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