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
89380ffe
Commit
89380ffe
authored
Jul 18, 2024
by
lilongyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、全域、片区、风电场站、光伏场站健康状态指数与趋势,改成10分钟汇总
2、全域、片区各片区健康状态指数,改成10分钟汇总 3、风电场站风电站各设备状态、设备各分析变量预警、子系统状态指数,改成10分钟汇总 4、光伏场站风电站各子阵状态、设备各分析变量预警、子阵设备健康状态指数,改成10分钟汇总
parent
78a511f0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
792 additions
and
747 deletions
+792
-747
IPersonnelBusinessService.java
...ot/module/hygf/api/service/IPersonnelBusinessService.java
+2
-0
PersonnelBusinessController.java
...dule/hygf/biz/controller/PersonnelBusinessController.java
+13
-0
PersonnelBusinessServiceImpl.java
...e/hygf/biz/service/impl/PersonnelBusinessServiceImpl.java
+198
-176
TDBigScreenAnalyseController.java
...le/jxiop/biz/controller/TDBigScreenAnalyseController.java
+2
-2
IdxBizFanHealthIndexMapper.xml
...n/resources/mapper/cluster/IdxBizFanHealthIndexMapper.xml
+577
-569
No files found.
amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/service/IPersonnelBusinessService.java
View file @
89380ffe
...
...
@@ -17,4 +17,6 @@ public interface IPersonnelBusinessService {
UserDataDto
getPersonnelBusinessById
(
String
id
);
Object
deleteAllBySequenceNbr
(
Long
sequenceNbr
);
Boolean
deleteBySequenceNbrs
(
String
sequenceNbrs
);
}
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/PersonnelBusinessController.java
View file @
89380ffe
...
...
@@ -108,6 +108,19 @@ public class PersonnelBusinessController extends BaseController {
}
/**
* 根据sequenceNbrs批量删除
*
* @param sequenceNbrs 主键
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@DeleteMapping
(
value
=
"/deleteDealerPerson"
)
@ApiOperation
(
httpMethod
=
"DELETE"
,
value
=
"根据sequenceNbrs批量删除经销商人员信息"
,
notes
=
"根据sequenceNbrs批量删除经销商人员信息"
)
public
ResponseModel
<
Boolean
>
deleteBySequenceNbrs
(
@RequestParam
(
value
=
"sequenceNbrs"
)
String
sequenceNbrs
){
return
ResponseHelper
.
buildResponse
(
personnelBusinessServiceImpl
.
deleteBySequenceNbrs
(
sequenceNbrs
));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
...
...
amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/service/impl/PersonnelBusinessServiceImpl.java
View file @
89380ffe
...
...
@@ -27,6 +27,8 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -68,24 +70,27 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
@Value
(
"${hygf.user.group.empty}"
)
private
long
userGroupempty
;
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
PersonnelBusinessServiceImpl
.
class
);
/**
* 分页查询
*/
public
Page
<
PersonnelBusinessDto
>
queryForPersonnelBusinessPage
(
Page
<
PersonnelBusinessDto
>
page
)
{
public
Page
<
PersonnelBusinessDto
>
queryForPersonnelBusinessPage
(
Page
<
PersonnelBusinessDto
>
page
)
{
return
this
.
queryForPage
(
page
,
null
,
false
);
}
/**
* 列表查询 示例
*/
public
List
<
PersonnelBusinessDto
>
queryForPersonnelBusinessList
()
{
return
this
.
queryForList
(
""
,
false
);
public
List
<
PersonnelBusinessDto
>
queryForPersonnelBusinessList
()
{
return
this
.
queryForList
(
""
,
false
);
}
@Override
public
IPage
<
CompanyDtoUserDto
>
getCompanyDtoUserDto
(
CompanyDtoUserDto
dto
)
{
Map
<
String
,
String
>
map
=
personnelBusinessMapper
.
getorgcode
(
dto
.
getAmosUnitId
());
Map
<
String
,
String
>
map
=
personnelBusinessMapper
.
getorgcode
(
dto
.
getAmosUnitId
());
dto
.
setAmosUnitOrgCode
(
map
.
get
(
"orgCode"
));
IPage
<
CompanyDtoUserDto
>
pag
=
personnelBusinessMapper
.
getCompanyDtoUserDtopage
(
dto
);
...
...
@@ -93,11 +98,11 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
}
@Transactional
public
void
savePersonnelBusiness
(
UserDataDto
model
)
{
UserDataZHDto
userDataZHDto
=
model
.
getUserDataZHDto
();
UserDataJBDto
userDataJBDto
=
model
.
getUserDataJBDto
();
FeignClientResult
<
AgencyUserModel
>
userResult
=
null
;
//新增平台用户
public
void
savePersonnelBusiness
(
UserDataDto
model
)
{
UserDataZHDto
userDataZHDto
=
model
.
getUserDataZHDto
();
UserDataJBDto
userDataJBDto
=
model
.
getUserDataJBDto
();
FeignClientResult
<
AgencyUserModel
>
userResult
=
null
;
//新增平台用户
try
{
// 1 创建平台用户
List
<
RoleModel
>
userRoleList
=
new
ArrayList
<>();
...
...
@@ -114,13 +119,13 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
Map
<
Long
,
List
<
RoleModel
>>
orgRoles
=
new
HashMap
<>();
roleSeqMap
.
put
(
Long
.
valueOf
(
userDataJBDto
.
getAmosUnitId
()),
userDataZHDto
.
getRole
());
orgRoles
.
put
(
Long
.
valueOf
(
userDataJBDto
.
getAmosUnitId
()),
userRoleList
);
// agencyUserModel.setAppCodes(split);
// agencyUserModel.setAppCodes(split);
agencyUserModel
.
setOrgRoles
(
orgRoles
);
agencyUserModel
.
setOrgRoleSeqs
(
roleSeqMap
);
// 将创建用户加入用户组
userResult
=
Privilege
.
agencyUserClient
.
create
(
agencyUserModel
);
if
(
userResult
==
null
||
userResult
.
getStatus
()
!=
200
)
{
throw
new
BadRequest
(
"新增人员失败!"
+
userResult
.
getDevMessage
());
userResult
=
Privilege
.
agencyUserClient
.
create
(
agencyUserModel
);
if
(
userResult
==
null
||
userResult
.
getStatus
()
!=
200
)
{
throw
new
BadRequest
(
"新增人员失败!"
+
userResult
.
getDevMessage
());
}
List
<
String
>
userId
=
new
ArrayList
<>();
userId
.
add
(
userResult
.
getResult
().
getUserId
());
...
...
@@ -130,7 +135,7 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
//新增人员基础信息表
PublicAgencyUser
publicAgencyUser
=
new
PublicAgencyUser
();
PublicAgencyUser
publicAgencyUser
=
new
PublicAgencyUser
();
publicAgencyUser
.
setRealName
(
userDataJBDto
.
getRealName
());
publicAgencyUser
.
setGender
(
userDataJBDto
.
getGender
());
publicAgencyUser
.
setJobNumber
(
userDataJBDto
.
getJobNumber
());
...
...
@@ -139,35 +144,35 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
publicAgencyUser
.
setAmosId
(
userDataJBDto
.
getAmosUnitId
());
FeignClientResult
<
CompanyModel
>
companyResult
=
Privilege
.
companyClient
.
seleteOne
(
userDataJBDto
.
getAmosUnitId
());
if
(
companyResult
==
null
||
companyResult
.
getStatus
()
!=
200
)
{
throw
new
BadRequest
(
"新增人员失败!"
+
companyResult
.
getDevMessage
());
if
(
companyResult
==
null
||
companyResult
.
getStatus
()
!=
200
)
{
throw
new
BadRequest
(
"新增人员失败!"
+
companyResult
.
getDevMessage
());
}
publicAgencyUser
.
setAmosOrgCode
(
companyResult
.
getResult
().
getOrgCode
());
publicAgencyUser
.
setAmosUserId
(
userResult
.
getResult
().
getUserId
());
publicAgencyUser
.
setAmosUserName
(
userDataZHDto
.
getUserName
());
publicAgencyUser
.
setPassword
(
DesUtil
.
encode
(
userDataZHDto
.
getPassword
(),
secretKey
));
publicAgencyUser
.
setRole
(
JSON
.
toJSONString
(
userDataZHDto
.
getRole
()));
publicAgencyUser
.
setRole
(
JSON
.
toJSONString
(
userDataZHDto
.
getRole
()));
publicAgencyUser
.
setLockStatus
(
"UNLOCK"
);
publicAgencyUser
.
setLockTime
(
new
Date
());
publicAgencyUser
.
setHeight
(
userDataJBDto
.
getHeight
());
publicAgencyUser
.
setWeight
(
userDataJBDto
.
getWeight
());
publicAgencyUser
.
setEmergencyTelephone
(
userDataJBDto
.
getEmergencyTelephone
());
publicAgencyUser
.
setDomicileAddress
(
userDataJBDto
.
getDomicileAddress
());
publicAgencyUser
.
setPosition
(
userDataJBDto
.
getPosition
()
!=
null
?
JSON
.
toJSONString
(
userDataJBDto
.
getPosition
()):
null
);
publicAgencyUser
.
setPosition
(
userDataJBDto
.
getPosition
()
!=
null
?
JSON
.
toJSONString
(
userDataJBDto
.
getPosition
())
:
null
);
publicAgencyUser
.
setNowAddress
(
userDataJBDto
.
getNowAddress
());
publicAgencyUser
.
setNativePlace
(
userDataJBDto
.
getNativePlace
());
publicAgencyUser
.
setPoliticalOutlook
(
userDataJBDto
.
getPoliticalOutlook
());
publicAgencyUserMapper
.
insert
(
publicAgencyUser
);
PersonnelBusiness
re
=
new
PersonnelBusiness
();
PersonnelBusiness
re
=
new
PersonnelBusiness
();
FeignClientResult
<
CompanyModel
>
companyResult1
=
Privilege
.
companyClient
.
seleteOne
(
Long
.
valueOf
(
userDataJBDto
.
getRegionalCompaniesSeq
()));
if
(
companyResult1
==
null
||
companyResult1
.
getStatus
()
!=
200
)
{
throw
new
BadRequest
(
"新增人员失败!"
+
companyResult1
.
getDevMessage
());
if
(
companyResult1
==
null
||
companyResult1
.
getStatus
()
!=
200
)
{
throw
new
BadRequest
(
"新增人员失败!"
+
companyResult1
.
getDevMessage
());
}
re
.
setRegionalCompaniesSeq
(
Long
.
valueOf
(
userDataJBDto
.
getRegionalCompaniesSeq
()));
re
.
setRegionalCompaniesName
(
companyResult1
.
getResult
().
getCompanyName
());
re
.
setRegionalCompaniesCode
(
companyResult1
.
getResult
().
getOrgCode
());
re
.
setCertificate
(
model
.
getUserDataZZDto
()
!=
null
?
JSON
.
toJSONString
(
model
.
getUserDataZZDto
().
getCertificate
()):
null
);
re
.
setCertificate
(
model
.
getUserDataZZDto
()
!=
null
?
JSON
.
toJSONString
(
model
.
getUserDataZZDto
().
getCertificate
())
:
null
);
re
.
setAmosUnitId
(
companyResult
.
getResult
().
getSequenceNbr
());
re
.
setAmosUnitName
(
companyResult
.
getResult
().
getCompanyName
());
re
.
setAmosUnitOrgCode
(
companyResult
.
getResult
().
getOrgCode
());
...
...
@@ -176,8 +181,8 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
personnelBusinessMapper
.
insert
(
re
);
//增加人员权限
List
<
String
>
lisk
=
new
ArrayList
<>();
StdUserEmpower
stdUserEmpower
=
new
StdUserEmpower
();
List
<
String
>
lisk
=
new
ArrayList
<>();
StdUserEmpower
stdUserEmpower
=
new
StdUserEmpower
();
lisk
.
add
(
re
.
getRegionalCompaniesCode
());
stdUserEmpower
.
setAmosUserId
(
publicAgencyUser
.
getAmosUserId
());
...
...
@@ -186,10 +191,7 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
userEmpowerMapper
.
insert
(
stdUserEmpower
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
)
{
if
(
userResult
!=
null
&&
userResult
.
getResult
()
!=
null
&&
StringUtils
.
isNotEmpty
(
userResult
.
getResult
().
getUserId
()))
{
Privilege
.
agencyUserClient
.
multDeleteUser
(
userResult
.
getResult
().
getUserId
());
...
...
@@ -202,20 +204,20 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
@Transactional
public
void
updatePersonnelBusiness
(
UserDataDto
model
,
long
id
)
{
public
void
updatePersonnelBusiness
(
UserDataDto
model
,
long
id
)
{
PublicAgencyUser
publicAgencyUser
=
publicAgencyUserMapper
.
selectById
(
id
);
PublicAgencyUser
publicAgencyUser
=
publicAgencyUserMapper
.
selectById
(
id
);
UserDataZHDto
userDataZHDto
=
model
.
getUserDataZHDto
();
UserDataJBDto
userDataJBDto
=
model
.
getUserDataJBDto
();
FeignClientResult
<
AgencyUserModel
>
userResult
=
null
;
UserDataZHDto
userDataZHDto
=
model
.
getUserDataZHDto
();
UserDataJBDto
userDataJBDto
=
model
.
getUserDataJBDto
();
FeignClientResult
<
AgencyUserModel
>
userResult
=
null
;
try
{
List
<
Long
>
newRole
=
userDataZHDto
.
getRole
();
List
<
Long
>
oldRole
=
JSONArray
.
parseArray
(
publicAgencyUser
.
getRole
(),
Long
.
class
);
for
(
Long
item
:
oldRole
)
{
if
(!
newRole
.
contains
(
item
))
{
for
(
Long
item
:
oldRole
)
{
if
(!
newRole
.
contains
(
item
))
{
throw
new
BadRequest
(
"角色只能增加, 不能删除"
);
}
}
...
...
@@ -238,9 +240,9 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
agencyUserModel
.
setOrgRoles
(
orgRoles
);
agencyUserModel
.
setOrgRoleSeqs
(
roleSeqMap
);
// 将创建用户加入用户组
userResult
=
Privilege
.
agencyUserClient
.
update
(
agencyUserModel
,
publicAgencyUser
.
getAmosUserId
());
if
(
userResult
==
null
||
userResult
.
getStatus
()
!=
200
)
{
throw
new
BadRequest
(
"修改人员失败!"
+
userResult
.
getDevMessage
());
userResult
=
Privilege
.
agencyUserClient
.
update
(
agencyUserModel
,
publicAgencyUser
.
getAmosUserId
());
if
(
userResult
==
null
||
userResult
.
getStatus
()
!=
200
)
{
throw
new
BadRequest
(
"修改人员失败!"
+
userResult
.
getDevMessage
());
}
List
<
String
>
userId
=
new
ArrayList
<>();
userId
.
add
(
userResult
.
getResult
().
getUserId
());
...
...
@@ -258,56 +260,56 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
publicAgencyUser
.
setAmosId
(
userDataJBDto
.
getAmosUnitId
());
FeignClientResult
<
CompanyModel
>
companyResult
=
Privilege
.
companyClient
.
seleteOne
(
userDataJBDto
.
getAmosUnitId
());
if
(
companyResult
==
null
||
companyResult
.
getStatus
()
!=
200
)
{
throw
new
BadRequest
(
"修改人员失败!"
+
companyResult
.
getDevMessage
());
if
(
companyResult
==
null
||
companyResult
.
getStatus
()
!=
200
)
{
throw
new
BadRequest
(
"修改人员失败!"
+
companyResult
.
getDevMessage
());
}
publicAgencyUser
.
setAmosOrgCode
(
companyResult
.
getResult
().
getOrgCode
());
publicAgencyUser
.
setAmosUserName
(
userDataZHDto
.
getUserName
());
publicAgencyUser
.
setPassword
(
DesUtil
.
encode
(
userDataZHDto
.
getPassword
(),
secretKey
));
publicAgencyUser
.
setRole
(
JSON
.
toJSONString
(
userDataZHDto
.
getRole
()));
publicAgencyUser
.
setRole
(
JSON
.
toJSONString
(
userDataZHDto
.
getRole
()));
publicAgencyUser
.
setLockStatus
(
"UNLOCK"
);
publicAgencyUser
.
setLockTime
(
new
Date
());
publicAgencyUser
.
setHeight
(
userDataJBDto
.
getHeight
());
publicAgencyUser
.
setWeight
(
userDataJBDto
.
getWeight
());
publicAgencyUser
.
setEmergencyTelephone
(
userDataJBDto
.
getEmergencyTelephone
());
publicAgencyUser
.
setDomicileAddress
(
userDataJBDto
.
getDomicileAddress
());
publicAgencyUser
.
setPosition
(
userDataJBDto
.
getPosition
()
!=
null
?
JSON
.
toJSONString
(
userDataJBDto
.
getPosition
()):
null
);
publicAgencyUser
.
setPosition
(
userDataJBDto
.
getPosition
()
!=
null
?
JSON
.
toJSONString
(
userDataJBDto
.
getPosition
())
:
null
);
publicAgencyUser
.
setNowAddress
(
userDataJBDto
.
getNowAddress
());
publicAgencyUser
.
setNativePlace
(
userDataJBDto
.
getNativePlace
());
publicAgencyUser
.
setPoliticalOutlook
(
userDataJBDto
.
getPoliticalOutlook
());
publicAgencyUserMapper
.
updateById
(
publicAgencyUser
);
LambdaQueryWrapper
<
PersonnelBusiness
>
qug
=
new
LambdaQueryWrapper
<>();
qug
.
eq
(
PersonnelBusiness:
:
getFoundationId
,
publicAgencyUser
.
getSequenceNbr
());
PersonnelBusiness
re
=
personnelBusinessMapper
.
selectOne
(
qug
);
LambdaQueryWrapper
<
PersonnelBusiness
>
qug
=
new
LambdaQueryWrapper
<>();
qug
.
eq
(
PersonnelBusiness:
:
getFoundationId
,
publicAgencyUser
.
getSequenceNbr
());
PersonnelBusiness
re
=
personnelBusinessMapper
.
selectOne
(
qug
);
FeignClientResult
<
CompanyModel
>
companyResult1
=
Privilege
.
companyClient
.
seleteOne
(
Long
.
valueOf
(
userDataJBDto
.
getRegionalCompaniesSeq
()));
if
(
companyResult1
==
null
||
companyResult1
.
getStatus
()
!=
200
)
{
throw
new
BadRequest
(
"修改人员失败!"
+
companyResult1
.
getDevMessage
());
if
(
companyResult1
==
null
||
companyResult1
.
getStatus
()
!=
200
)
{
throw
new
BadRequest
(
"修改人员失败!"
+
companyResult1
.
getDevMessage
());
}
re
.
setRegionalCompaniesSeq
(
Long
.
valueOf
(
userDataJBDto
.
getRegionalCompaniesSeq
()));
re
.
setRegionalCompaniesName
(
companyResult1
.
getResult
().
getCompanyName
());
re
.
setRegionalCompaniesCode
(
companyResult1
.
getResult
().
getOrgCode
());
re
.
setCertificate
(
model
.
getUserDataZZDto
()
!=
null
?
JSON
.
toJSONString
(
model
.
getUserDataZZDto
().
getCertificate
()):
null
);
re
.
setCertificate
(
model
.
getUserDataZZDto
()
!=
null
?
JSON
.
toJSONString
(
model
.
getUserDataZZDto
().
getCertificate
())
:
null
);
re
.
setAmosUnitId
(
companyResult
.
getResult
().
getSequenceNbr
());
re
.
setAmosUnitName
(
companyResult
.
getResult
().
getCompanyName
());
re
.
setAmosUnitOrgCode
(
companyResult
.
getResult
().
getOrgCode
());
personnelBusinessMapper
.
updateById
(
re
);
//增加人员权限
List
<
String
>
lisk
=
new
ArrayList
<>();
LambdaQueryWrapper
<
StdUserEmpower
>
uo
=
new
LambdaQueryWrapper
();
uo
.
eq
(
StdUserEmpower:
:
getAmosUserId
,
publicAgencyUser
.
getAmosUserId
());
StdUserEmpower
stdUserEmpower
=
userEmpowerMapper
.
selectOne
(
uo
);
// lisk.add(publicAgencyUser.getAmosOrgCode());
List
<
String
>
lisk
=
new
ArrayList
<>();
LambdaQueryWrapper
<
StdUserEmpower
>
uo
=
new
LambdaQueryWrapper
();
uo
.
eq
(
StdUserEmpower:
:
getAmosUserId
,
publicAgencyUser
.
getAmosUserId
());
StdUserEmpower
stdUserEmpower
=
userEmpowerMapper
.
selectOne
(
uo
);
// lisk.add(publicAgencyUser.getAmosOrgCode());
lisk
.
add
(
re
.
getRegionalCompaniesCode
());
if
(
stdUserEmpower
!=
null
)
{
if
(
stdUserEmpower
!=
null
)
{
stdUserEmpower
.
setAmosUserId
(
publicAgencyUser
.
getAmosUserId
());
stdUserEmpower
.
setAmosOrgCode
(
lisk
);
userEmpowerMapper
.
updateById
(
stdUserEmpower
);
}
else
{
stdUserEmpower
=
new
StdUserEmpower
();
}
else
{
stdUserEmpower
=
new
StdUserEmpower
();
stdUserEmpower
.
setAmosUserId
(
publicAgencyUser
.
getAmosUserId
());
stdUserEmpower
.
setAmosOrgCode
(
lisk
);
stdUserEmpower
.
setPermissionType
(
"HYGF"
);
...
...
@@ -315,11 +317,7 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
BadRequest
(
e
.
getMessage
());
...
...
@@ -328,48 +326,40 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
}
@Transactional
public
void
replace
(
String
id
){
public
void
replace
(
String
id
)
{
try
{
//获取当前用户
LambdaQueryWrapper
<
PublicAgencyUser
>
qud
=
new
LambdaQueryWrapper
<>();
qud
.
eq
(
PublicAgencyUser:
:
getSequenceNbr
,
id
);
PublicAgencyUser
publicAgencyUse
=
publicAgencyUserMapper
.
selectOne
(
qud
);
LambdaQueryWrapper
<
PersonnelBusiness
>
qug
=
new
LambdaQueryWrapper
<>();
qug
.
eq
(
PersonnelBusiness:
:
getFoundationId
,
publicAgencyUse
.
getSequenceNbr
());
PersonnelBusiness
personnelBusines
=
personnelBusinessMapper
.
selectOne
(
qug
);
personnelBusines
.
setUserType
(
"2"
);
personnelBusinessMapper
.
updateById
(
personnelBusines
);
//获取经销商管理员
LambdaQueryWrapper
<
UnitInfo
>
qudg
=
new
LambdaQueryWrapper
<>();
qudg
.
eq
(
UnitInfo:
:
getAmosCompanySeq
,
personnelBusines
.
getAmosDealerId
());
UnitInfo
unitInfo
=
unitInfoMapper
.
selectOne
(
qudg
);
LambdaQueryWrapper
<
PublicAgencyUser
>
qudx
=
new
LambdaQueryWrapper
<>();
qudx
.
eq
(
PublicAgencyUser:
:
getAmosUserId
,
unitInfo
.
getAdminUserId
());
PublicAgencyUser
publicAgencyUsex
=
publicAgencyUserMapper
.
selectOne
(
qudx
);
LambdaQueryWrapper
<
PersonnelBusiness
>
qugf
=
new
LambdaQueryWrapper
<>();
qugf
.
eq
(
PersonnelBusiness:
:
getFoundationId
,
publicAgencyUsex
.
getSequenceNbr
());
PersonnelBusiness
personnelBusinesx
=
personnelBusinessMapper
.
selectOne
(
qugf
);
personnelBusinesx
.
setUserType
(
"1"
);
personnelBusinessMapper
.
updateById
(
personnelBusinesx
);
unitInfo
.
setAdminLoginName
(
publicAgencyUse
.
getAmosUserName
());
unitInfo
.
setAdminPhone
(
publicAgencyUse
.
getEmergencyTelephone
());
unitInfo
.
setAdminUserId
(
publicAgencyUse
.
getAmosUserId
());
unitInfo
.
setAdminUserName
(
publicAgencyUse
.
getRealName
());
unitInfoMapper
.
updateById
(
unitInfo
);
//修改管理员
List
<
Long
>
roidx
=
JSONArray
.
parseArray
(
publicAgencyUsex
.
getRole
(),
Long
.
class
);
//获取当前用户
LambdaQueryWrapper
<
PublicAgencyUser
>
qud
=
new
LambdaQueryWrapper
<>();
qud
.
eq
(
PublicAgencyUser:
:
getSequenceNbr
,
id
);
PublicAgencyUser
publicAgencyUse
=
publicAgencyUserMapper
.
selectOne
(
qud
);
LambdaQueryWrapper
<
PersonnelBusiness
>
qug
=
new
LambdaQueryWrapper
<>();
qug
.
eq
(
PersonnelBusiness:
:
getFoundationId
,
publicAgencyUse
.
getSequenceNbr
());
PersonnelBusiness
personnelBusines
=
personnelBusinessMapper
.
selectOne
(
qug
);
personnelBusines
.
setUserType
(
"2"
);
personnelBusinessMapper
.
updateById
(
personnelBusines
);
//获取经销商管理员
LambdaQueryWrapper
<
UnitInfo
>
qudg
=
new
LambdaQueryWrapper
<>();
qudg
.
eq
(
UnitInfo:
:
getAmosCompanySeq
,
personnelBusines
.
getAmosDealerId
());
UnitInfo
unitInfo
=
unitInfoMapper
.
selectOne
(
qudg
);
LambdaQueryWrapper
<
PublicAgencyUser
>
qudx
=
new
LambdaQueryWrapper
<>();
qudx
.
eq
(
PublicAgencyUser:
:
getAmosUserId
,
unitInfo
.
getAdminUserId
());
PublicAgencyUser
publicAgencyUsex
=
publicAgencyUserMapper
.
selectOne
(
qudx
);
LambdaQueryWrapper
<
PersonnelBusiness
>
qugf
=
new
LambdaQueryWrapper
<>();
qugf
.
eq
(
PersonnelBusiness:
:
getFoundationId
,
publicAgencyUsex
.
getSequenceNbr
());
PersonnelBusiness
personnelBusinesx
=
personnelBusinessMapper
.
selectOne
(
qugf
);
personnelBusinesx
.
setUserType
(
"1"
);
personnelBusinessMapper
.
updateById
(
personnelBusinesx
);
unitInfo
.
setAdminLoginName
(
publicAgencyUse
.
getAmosUserName
());
unitInfo
.
setAdminPhone
(
publicAgencyUse
.
getEmergencyTelephone
());
unitInfo
.
setAdminUserId
(
publicAgencyUse
.
getAmosUserId
());
unitInfo
.
setAdminUserName
(
publicAgencyUse
.
getRealName
());
unitInfoMapper
.
updateById
(
unitInfo
);
//修改管理员
List
<
Long
>
roidx
=
JSONArray
.
parseArray
(
publicAgencyUsex
.
getRole
(),
Long
.
class
);
//修改平台用户
...
...
@@ -377,43 +367,42 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
userId
.
add
(
publicAgencyUse
.
getAmosUserId
());
System
.
out
.
println
(
"删除旧管理员===================================:"
+
publicAgencyUsex
.
getAmosUserId
());
System
.
out
.
println
(
"删除旧管理员===================================:"
+
publicAgencyUsex
.
getAmosUserId
());
List
<
String
>
userId1
=
new
ArrayList
<>();
if
(
roidx
!=
null
&&!
roidx
.
isEmpty
()&&
roidx
.
size
()==
1
&&
roidx
.
get
(
0
).
longValue
()==
userGroupId
)
{
//新增空角色防止单位丢失
if
(
roidx
!=
null
&&
!
roidx
.
isEmpty
()
&&
roidx
.
size
()
==
1
&&
roidx
.
get
(
0
).
longValue
()
==
userGroupId
)
{
//新增空角色防止单位丢失
userId1
.
add
(
publicAgencyUsex
.
getAmosUserId
());
Privilege
.
groupUserClient
.
create
(
userGroupempty
,
userId1
);
}
userId1
.
add
(
publicAgencyUsex
.
getAmosUserId
());
Privilege
.
groupUserClient
.
create
(
userGroupempty
,
userId1
);
}
//删除旧管理员
Privilege
.
groupUserClient
.
deleteGroupUser
(
userGroupId
,
publicAgencyUsex
.
getAmosUserId
());
Privilege
.
groupUserClient
.
deleteGroupUser
(
userGroupId
,
publicAgencyUsex
.
getAmosUserId
());
// 1 修改平台用户
Privilege
.
groupUserClient
.
create
(
userGroupId
,
userId
);
System
.
out
.
println
(
"新增角色用户===================================:"
+
userId
);
System
.
out
.
println
(
"新增角色用户===================================:"
+
userId
);
//修改权限
if
(
roidx
==
null
)
{
if
(
roidx
==
null
)
{
publicAgencyUsex
.
setRole
(
null
);
}
else
{
}
else
{
roidx
.
remove
(
userGroupId
);
publicAgencyUsex
.
setRole
(
CollectionUtil
.
isEmpty
(
roidx
)
?
JSON
.
toJSONString
(
Arrays
.
asList
(
userGroupempty
)):
JSON
.
toJSONString
(
roidx
));
publicAgencyUsex
.
setRole
(
CollectionUtil
.
isEmpty
(
roidx
)
?
JSON
.
toJSONString
(
Arrays
.
asList
(
userGroupempty
))
:
JSON
.
toJSONString
(
roidx
));
}
//修改当前用户角色权限
List
<
Long
>
roid
=
JSONArray
.
parseArray
(
publicAgencyUse
.
getRole
(),
Long
.
class
);
if
(
roid
==
null
)
{
roid
=
new
ArrayList
<>();
List
<
Long
>
roid
=
JSONArray
.
parseArray
(
publicAgencyUse
.
getRole
(),
Long
.
class
);
if
(
roid
==
null
)
{
roid
=
new
ArrayList
<>();
}
roid
.
add
(
userGroupId
);
if
(
roid
.
contains
(
userGroupempty
)){
if
(
roid
.
contains
(
userGroupempty
))
{
roid
.
remove
(
userGroupempty
);
Privilege
.
groupUserClient
.
deleteGroupUser
(
userGroupempty
,
publicAgencyUsex
.
getAmosUserId
());
Privilege
.
groupUserClient
.
deleteGroupUser
(
userGroupempty
,
publicAgencyUsex
.
getAmosUserId
());
}
publicAgencyUse
.
setRole
(
JSON
.
toJSONString
(
roid
));
...
...
@@ -421,58 +410,51 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
publicAgencyUserMapper
.
updateById
(
publicAgencyUse
);
//旧管理员去除
List
<
String
>
li
=
null
;
LambdaQueryWrapper
<
StdUserEmpower
>
uo
=
new
LambdaQueryWrapper
();
uo
.
eq
(
StdUserEmpower:
:
getAmosUserId
,
publicAgencyUsex
.
getAmosUserId
());
StdUserEmpower
stdUserEmpower
=
userEmpowerMapper
.
selectOne
(
uo
);
li
=
stdUserEmpower
.
getAmosOrgCode
();
if
(
stdUserEmpower
!=
null
)
{
stdUserEmpower
.
setAmosOrgCode
(
null
);
userEmpowerMapper
.
updateById
(
stdUserEmpower
);
//旧管理员去除
List
<
String
>
li
=
null
;
LambdaQueryWrapper
<
StdUserEmpower
>
uo
=
new
LambdaQueryWrapper
();
uo
.
eq
(
StdUserEmpower:
:
getAmosUserId
,
publicAgencyUsex
.
getAmosUserId
());
StdUserEmpower
stdUserEmpower
=
userEmpowerMapper
.
selectOne
(
uo
);
li
=
stdUserEmpower
.
getAmosOrgCode
();
if
(
stdUserEmpower
!=
null
){
stdUserEmpower
.
setAmosOrgCode
(
null
);
userEmpowerMapper
.
updateById
(
stdUserEmpower
);
}
else
{
stdUserEmpower
=
new
StdUserEmpower
();
stdUserEmpower
.
setAmosOrgCode
(
null
);
stdUserEmpower
.
setPermissionType
(
"HYGF"
);
stdUserEmpower
.
setAmosUserId
(
publicAgencyUsex
.
getAmosUserId
());
userEmpowerMapper
.
insert
(
stdUserEmpower
);
}
//新管理员新增
LambdaQueryWrapper
<
StdUserEmpower
>
uo1
=
new
LambdaQueryWrapper
();
uo1
.
eq
(
StdUserEmpower:
:
getAmosUserId
,
publicAgencyUse
.
getAmosUserId
());
StdUserEmpower
stdUserEmpower1
=
userEmpowerMapper
.
selectOne
(
uo1
);
}
else
{
stdUserEmpower
=
new
StdUserEmpower
();
stdUserEmpower
.
setAmosOrgCode
(
null
);
stdUserEmpower
.
setPermissionType
(
"HYGF"
);
stdUserEmpower
.
setAmosUserId
(
publicAgencyUsex
.
getAmosUserId
());
userEmpowerMapper
.
insert
(
stdUserEmpower
);
}
if
(
stdUserEmpower1
!=
null
){
stdUserEmpower1
.
setAmosOrgCode
(
li
);
userEmpowerMapper
.
updateById
(
stdUserEmpower1
);
//新管理员新增
LambdaQueryWrapper
<
StdUserEmpower
>
uo1
=
new
LambdaQueryWrapper
();
uo1
.
eq
(
StdUserEmpower:
:
getAmosUserId
,
publicAgencyUse
.
getAmosUserId
());
StdUserEmpower
stdUserEmpower1
=
userEmpowerMapper
.
selectOne
(
uo1
);
}
else
{
stdUserEmpower1
=
new
StdUserEmpower
();
stdUserEmpower1
.
setAmosOrgCode
(
li
);
stdUserEmpower1
.
setPermissionType
(
"HYGF"
);
stdUserEmpower1
.
setAmosUserId
(
publicAgencyUse
.
getAmosUserId
());
userEmpowerMapper
.
insert
(
stdUserEmpower1
);
}
if
(
stdUserEmpower1
!=
null
)
{
stdUserEmpower1
.
setAmosOrgCode
(
li
);
userEmpowerMapper
.
updateById
(
stdUserEmpower1
);
}
else
{
stdUserEmpower1
=
new
StdUserEmpower
();
stdUserEmpower1
.
setAmosOrgCode
(
li
);
stdUserEmpower1
.
setPermissionType
(
"HYGF"
);
stdUserEmpower1
.
setAmosUserId
(
publicAgencyUse
.
getAmosUserId
());
userEmpowerMapper
.
insert
(
stdUserEmpower1
);
}
UserMessage
userMessage
=
new
UserMessage
(
TaskTypeStationEnum
.
设置管理员
.
getCode
(),
personnelBusines
.
getSequenceNbr
()
,
publicAgencyUse
.
getAmosUserId
(),
new
Date
(),
"您已成为单位管理员。"
,
personnelBusines
.
getAmosUnitOrgCode
());
UserMessage
userMessage
=
new
UserMessage
(
TaskTypeStationEnum
.
设置管理员
.
getCode
(),
personnelBusines
.
getSequenceNbr
(),
publicAgencyUse
.
getAmosUserId
(),
new
Date
(),
"您已成为单位管理员。"
,
personnelBusines
.
getAmosUnitOrgCode
());
userMessageMapper
.
insert
(
userMessage
);
emqKeeper
.
getMqttClient
().
publish
(
"MY_MESSAGE"
,
JSON
.
toJSONString
(
userMessage
).
getBytes
(),
2
,
false
);
userMessageMapper
.
insert
(
userMessage
);
emqKeeper
.
getMqttClient
().
publish
(
"MY_MESSAGE"
,
JSON
.
toJSONString
(
userMessage
).
getBytes
(),
2
,
false
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
BadRequest
(
"设置失败!"
);
}
...
...
@@ -480,27 +462,27 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
@Override
public
UserDataDto
getPersonnelBusinessById
(
String
id
)
{
public
UserDataDto
getPersonnelBusinessById
(
String
id
)
{
LambdaQueryWrapper
<
PublicAgencyUser
>
qud
=
new
LambdaQueryWrapper
<>();
qud
.
eq
(
PublicAgencyUser:
:
getSequenceNbr
,
id
);
PublicAgencyUser
publicAgencyUse
=
publicAgencyUserMapper
.
selectOne
(
qud
);
LambdaQueryWrapper
<
PublicAgencyUser
>
qud
=
new
LambdaQueryWrapper
<>();
qud
.
eq
(
PublicAgencyUser:
:
getSequenceNbr
,
id
);
PublicAgencyUser
publicAgencyUse
=
publicAgencyUserMapper
.
selectOne
(
qud
);
LambdaQueryWrapper
<
PersonnelBusiness
>
qug
=
new
LambdaQueryWrapper
<>();
qug
.
eq
(
PersonnelBusiness:
:
getFoundationId
,
publicAgencyUse
.
getSequenceNbr
());
PersonnelBusiness
personnelBusines
=
personnelBusinessMapper
.
selectOne
(
qug
);
LambdaQueryWrapper
<
PersonnelBusiness
>
qug
=
new
LambdaQueryWrapper
<>();
qug
.
eq
(
PersonnelBusiness:
:
getFoundationId
,
publicAgencyUse
.
getSequenceNbr
());
PersonnelBusiness
personnelBusines
=
personnelBusinessMapper
.
selectOne
(
qug
);
UserDataZHDto
userDataZHDto
=
new
UserDataZHDto
();
UserDataJBDto
userDataJBDto
=
new
UserDataJBDto
();
UserDataZZDto
userDataZZDto
=
new
UserDataZZDto
();
UserDataZHDto
userDataZHDto
=
new
UserDataZHDto
();
UserDataJBDto
userDataJBDto
=
new
UserDataJBDto
();
UserDataZZDto
userDataZZDto
=
new
UserDataZZDto
();
userDataZZDto
.
setCertificate
(
personnelBusines
.
getCertificate
()
!=
null
?
JSONArray
.
parseArray
(
personnelBusines
.
getCertificate
(),
JSONObject
.
class
):
null
);
userDataZHDto
.
setRole
(
JSONArray
.
parseArray
(
publicAgencyUse
.
getRole
(),
long
.
class
));
userDataZZDto
.
setCertificate
(
personnelBusines
.
getCertificate
()
!=
null
?
JSONArray
.
parseArray
(
personnelBusines
.
getCertificate
(),
JSONObject
.
class
)
:
null
);
userDataZHDto
.
setRole
(
JSONArray
.
parseArray
(
publicAgencyUse
.
getRole
(),
long
.
class
));
userDataZHDto
.
setUserName
(
publicAgencyUse
.
getAmosUserName
());
BeanUtils
.
copyProperties
(
publicAgencyUse
,
userDataJBDto
);
userDataJBDto
.
setPosition
(
JSONArray
.
parseArray
(
publicAgencyUse
.
getPosition
(),
String
.
class
));
userDataJBDto
.
setRegionalCompaniesSeq
(
personnelBusines
.
getRegionalCompaniesSeq
()
!=
null
?
personnelBusines
.
getRegionalCompaniesSeq
().
toString
():
null
);
BeanUtils
.
copyProperties
(
publicAgencyUse
,
userDataJBDto
);
userDataJBDto
.
setPosition
(
JSONArray
.
parseArray
(
publicAgencyUse
.
getPosition
(),
String
.
class
));
userDataJBDto
.
setRegionalCompaniesSeq
(
personnelBusines
.
getRegionalCompaniesSeq
()
!=
null
?
personnelBusines
.
getRegionalCompaniesSeq
().
toString
()
:
null
);
userDataJBDto
.
setAmosUnitId
(
personnelBusines
.
getAmosUnitId
());
Boolean
hasOperationRecords
=
hasOperationRecords
(
id
);
...
...
@@ -517,17 +499,16 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
userDataJBDto
.
setUnallowModify
(
hasOperationRecords
?
"unallow"
:
"allow"
);
}
return
new
UserDataDto
(
userDataZHDto
,
userDataJBDto
,
userDataZZDto
);
return
new
UserDataDto
(
userDataZHDto
,
userDataJBDto
,
userDataZZDto
);
}
/**
* 用户是否有业务操作
*
*
* @param id id
* @return {@link Boolean}
* @author yangyang
* @throws
* @author yangyang
* @date 2024/7/3 16:24
*/
public
Boolean
hasOperationRecords
(
String
id
)
{
...
...
@@ -598,4 +579,44 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
}
@Override
public
Boolean
deleteBySequenceNbrs
(
String
sequenceNbrs
)
{
//根据sequenceNbr查询用户userId
if
(
StringUtils
.
isEmpty
(
sequenceNbrs
))
{
throw
new
BadRequest
(
"入参:sequenceNbrs为空"
);
}
List
<
String
>
sequenceNbrList
=
new
ArrayList
<>();
String
[]
sequenceNbrArray
=
sequenceNbrs
.
split
(
","
);
for
(
String
sequenceNbr
:
sequenceNbrArray
)
{
String
userId
=
personnelBusinessMapper
.
selectUserInfo
(
Long
.
valueOf
(
sequenceNbr
));
//添加校验,如果业务表里面有相关的用户id不能删除
List
<
String
>
tableName
=
personnelBusinessMapper
.
selectHygfTableName
();
if
(
CollectionUtil
.
isNotEmpty
(
tableName
))
{
for
(
String
table
:
tableName
)
{
int
count
=
personnelBusinessMapper
.
countByUserId
(
table
,
userId
);
if
(
count
>
0
)
{
logger
.
error
(
"sequenceNbr:{}对应的用户:{},对应的表:{}有操作记录无法删除"
,
sequenceNbr
,
userId
,
table
);
sequenceNbrList
.
add
(
sequenceNbr
);
return
false
;
}
}
}
try
{
//删除平台表账号
Privilege
.
agencyUserClient
.
multDeleteUser
(
userId
);
personnelBusinessMapper
.
deleteSubByUserId
(
userId
);
//删除hygf_personnel_business表中数据
personnelBusinessMapper
.
deleteHpbByFoundationId
(
Long
.
valueOf
(
sequenceNbr
));
//删除std_user_empower表中数据
personnelBusinessMapper
.
deleteSueByUserId
(
userId
);
return
null
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"sequenceNbr:{}对应删除失败"
,
sequenceNbr
);
sequenceNbrList
.
add
(
sequenceNbr
);
}
}
return
true
;
}
}
\ 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/TDBigScreenAnalyseController.java
View file @
89380ffe
...
...
@@ -176,7 +176,7 @@ public class TDBigScreenAnalyseController extends BaseController {
String
finalStationCode
=
stationCode
;
// List<String> dateList = dateInfoBy15.stream().map(i -> i.get("date")).collect(Collectors.toList());
String
finalAreaCode
=
areaCode
;
if
((
WarningPeriodEnum
.
DAY
.
getName
().
equals
(
analysisType
)
||
analysisType
==
null
))
{
if
((
WarningPeriodEnum
.
DAY
.
getName
().
equals
(
analysisType
)))
{
List
<
String
>
fullDateList
=
dateList
.
stream
().
map
(
s
->
{
return
s
+
" 00:00:00"
;
}).
collect
(
Collectors
.
toList
());
...
...
@@ -198,7 +198,7 @@ public class TDBigScreenAnalyseController extends BaseController {
String
value
=
map
.
get
(
date
)
!=
null
?
String
.
valueOf
(
map
.
get
(
date
))
:
"100"
;
valueList
.
add
(
String
.
valueOf
(
Math
.
round
(
Double
.
valueOf
(
value
)
*
10.0
)
/
10.0
));
}
}
else
if
(
WarningPeriodEnum
.
MINUTES
.
getName
().
equals
(
analysisType
))
{
}
else
if
(
WarningPeriodEnum
.
MINUTES
.
getName
().
equals
(
analysisType
)
||
analysisType
==
null
)
{
List
<
Map
<
String
,
Object
>>
healthListInfo
=
fanHealthIndexMapper
.
getInfoByMoment
(
finalAreaCode
,
finalStationCode
,
dateList
);
Map
<
String
,
Object
>
map
=
healthListInfo
.
stream
().
collect
(
Collectors
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/cluster/IdxBizFanHealthIndexMapper.xml
View file @
89380ffe
...
...
@@ -129,96 +129,97 @@
FROM
${tableName}
<where>
ANALYSIS_TYPE = '按
天
'
ANALYSIS_TYPE = '按
10分钟
'
<!-- AND DATE_ADD(DATE_FORMAT( REC_DATE, '%Y-%m-%d' ),INTERVAL 1 DAY) = CURRENT_DATE-->
AND CURRENT_DATE = get_time_add(1,'DAY')
<if
test=
"stationCode != null and stationCode != ''"
>
AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if>
</where>
limit 1
</select>
<select
id=
"getHealthListInfo"
resultType=
"java.util.Map"
>
SELECT
CEILING(IFNULL( AVG( HEALTH_INDEX ), 100 )) AS avgHealthIndex,
DATE_ADD( a.date, INTERVAL - 1 DAY ) as date
FROM
(
SELECT
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD( now(), INTERVAL - 15 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
DATEDIFF( now(), DATE( DATE_ADD( now(), INTERVAL - 15 DAY )) ) >= @s
) a
LEFT JOIN (
SELECT
HEALTH_INDEX,
DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) AS recDate
FROM
idx_biz_pv_health_index
<where>
ANALYSIS_TYPE = '按天'
<if
test=
"areaCode != null and areaCode != ''"
>
AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if
test=
"stationCode != null and stationCode != ''"
>
AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if>
<if
test=
"(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')"
>
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if
test=
"gatewayIds != null and gatewayIds.size() > 0"
>
AND GATEWAY_ID IN
<foreach
collection=
"gatewayIds"
item=
"item"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</if>
</where>
UNION ALL
(
SELECT
HEALTH_INDEX,
DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) AS recDate
FROM
idx_biz_fan_health_index
<where>
ANALYSIS_TYPE = '按天'
<if
test=
"areaCode != null and areaCode != ''"
>
AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if
test=
"stationCode != null and stationCode != ''"
>
AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if>
<if
test=
"(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')"
>
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if
test=
"gatewayIds != null and gatewayIds.size() > 0"
>
AND GATEWAY_ID IN
<foreach
collection=
"gatewayIds"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</where>
)
) b ON DATE_FORMAT( b.recDate, '%Y-%m-%d' ) = a.date
GROUP BY
a.date
</select>
<select
id=
"getAllEquipAlarmInfo"
resultType=
"java.util.Map"
>
SELECT ARAE as area,
WARNING_NAME as warningName,
count(1) as num
FROM ${tableName} a
where (a.DISPOSOTION_STATE = '待确认')
<!-- or (a.DISPOSOTION_STATE = '已确认' and a.DISPOSOTION_DATE > DATE_ADD(now(), INTERVAL - 3 DAY ))-->
<!-- AND CURRENT_DATE = get_time_add(1,'DAY')-->
AND REC_DATE >= get_time_sub(9,'MINUTE')
<if
test=
"stationCode != null and stationCode != ''"
>
AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if>
</where>
limit 1
</select>
<select
id=
"getHealthListInfo"
resultType=
"java.util.Map"
>
SELECT
CEILING(IFNULL( AVG( HEALTH_INDEX ), 100 )) AS avgHealthIndex,
DATE_ADD( a.date, INTERVAL - 1 DAY ) as date
FROM
(
SELECT
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD( now(), INTERVAL - 15 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
DATEDIFF( now(), DATE( DATE_ADD( now(), INTERVAL - 15 DAY )) ) >= @s
) a
LEFT JOIN (
SELECT
HEALTH_INDEX,
DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) AS recDate
FROM
idx_biz_pv_health_index
<where>
ANALYSIS_TYPE = '按天'
<if
test=
"areaCode != null and areaCode != ''"
>
AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if
test=
"stationCode != null and stationCode != ''"
>
AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if>
<if
test=
"(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')"
>
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if
test=
"gatewayIds != null and gatewayIds.size() > 0"
>
AND GATEWAY_ID IN
<foreach
collection=
"gatewayIds"
item=
"item"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</if>
</where>
UNION ALL
(
SELECT
HEALTH_INDEX,
DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) AS recDate
FROM
idx_biz_fan_health_index
<where>
ANALYSIS_TYPE = '按天'
<if
test=
"areaCode != null and areaCode != ''"
>
AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if
test=
"stationCode != null and stationCode != ''"
>
AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if>
<if
test=
"(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')"
>
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if
test=
"gatewayIds != null and gatewayIds.size() > 0"
>
AND GATEWAY_ID IN
<foreach
collection=
"gatewayIds"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</where>
)
) b ON DATE_FORMAT( b.recDate, '%Y-%m-%d' ) = a.date
GROUP BY
a.date
</select>
<select
id=
"getAllEquipAlarmInfo"
resultType=
"java.util.Map"
>
SELECT ARAE as area,
WARNING_NAME as warningName,
count(1) as num
FROM ${tableName} a
where (a.DISPOSOTION_STATE = '待确认')
<!-- or (a.DISPOSOTION_STATE = '已确认' and a.DISPOSOTION_DATE > DATE_ADD(now(), INTERVAL - 3 DAY ))-->
or (a.DISPOSOTION_STATE = '已确认' and a.DISPOSOTION_DATE > get_time_sub(3,'DAY')
group by ARAE,
WARNING_NAME
...
...
@@ -231,35 +232,37 @@
ARAE
FROM fan_health_index_latest_data
WHERE ANALYSIS_OBJ_TYPE = '片区'
AND ANALYSIS_TYPE = '按
天
'
AND ANALYSIS_TYPE = '按
10分钟
'
<!-- AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = CURRENT_DATE - INTERVAL 1 DAY-->
AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = get_time_sub(1,'DAY')
GROUP BY ARAE
UNION ALL
(
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
ARAE
FROM pv_health_index_latest_data
WHERE ANALYSIS_OBJ_TYPE = '片区'
AND ANALYSIS_TYPE = '按天'
<!--AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = CURRENT_DATE - INTERVAL 1 DAY-->
AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = get_time_sub(1,'DAY')
GROUP BY ARAE
)
) a
GROUP BY a.ARAE
</select>
<select
id=
"getAllEquipAlarmInfoByStation"
resultType=
"java.util.Map"
>
SELECT a.*
FROM (
SELECT STATION AS station,
WARNING_NAME AS warningName,
count(1) AS num,
(SELECT count(1)
FROM idx_biz_fan_warning_record wr
WHERE ((wr.DISPOSOTION_STATE = '待确认')
or (wr.DISPOSOTION_STATE = '已确认' and
<!--wr.DISPOSOTION_DATE > DATE_ADD(now(), INTERVAL - 3 DAY )))-->
<!--AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = get_time_sub(1,'DAY')-->
AND REC_DATE >= get_time_sub(9,'MINUTE')
GROUP BY ARAE
UNION ALL
(
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
ARAE
FROM pv_health_index_latest_data
WHERE ANALYSIS_OBJ_TYPE = '片区'
AND ANALYSIS_TYPE = '按10分钟'
<!--AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = CURRENT_DATE - INTERVAL 1 DAY-->
<!--AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = get_time_sub(1,'DAY')-->
AND REC_DATE >= get_time_sub(9,'MINUTE')
GROUP BY ARAE
)
) a
GROUP BY a.ARAE
</select>
<select
id=
"getAllEquipAlarmInfoByStation"
resultType=
"java.util.Map"
>
SELECT a.*
FROM (
SELECT STATION AS station,
WARNING_NAME AS warningName,
count(1) AS num,
(SELECT count(1)
FROM idx_biz_fan_warning_record wr
WHERE ((wr.DISPOSOTION_STATE = '待确认')
or (wr.DISPOSOTION_STATE = '已确认' and
<!--wr.DISPOSOTION_DATE > DATE_ADD(now(), INTERVAL - 3 DAY )))-->
wr.DISPOSOTION_DATE > get_time_sub(3,'DAY')
AND wr.STATION = STATION
) AS allNum
...
...
@@ -303,9 +306,10 @@
fan_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '场站'
AND ANALYSIS_TYPE = '按
天
'
AND ANALYSIS_TYPE = '按
10分钟
'
<!--AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = CURRENT_DATE - INTERVAL 1 DAY-->
AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = get_time_sub(1,'DAY')
<!--AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = get_time_sub(1,'DAY')-->
AND REC_DATE >= get_time_sub(9,'MINUTE')
<if
test=
"areaCode != null and areaCode != ''"
>
AND ARAE like concat('%', #{areaCode}, '%')
</if>
...
...
@@ -476,9 +480,10 @@
fan_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '子系统'
AND ANALYSIS_TYPE = '按
天
'
AND ANALYSIS_TYPE = '按
10分钟
'
<!--AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = CURRENT_DATE - INTERVAL 1 DAY-->
AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = get_time_sub(1,'DAY')
<!--AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = get_time_sub(1,'DAY')-->
AND REC_DATE >= get_time_sub(9,'MINUTE')
<if
test=
"equipmentName != null and equipmentName != ''"
>
AND EQUIPMENT_NAME like concat( '%', #{equipmentName} ,'风机')
</if>
...
...
@@ -573,7 +578,7 @@
fan_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE= '测点'
AND ANALYSIS_TYPE = '按
天
'
AND ANALYSIS_TYPE = '按
10分钟
'
AND POINT_NAME IS NOT NULL
AND POINT_NAME != ''
<if
test=
"subSystem != null and subSystem != ''"
>
...
...
@@ -651,418 +656,419 @@
pv_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '设备'
AND ANALYSIS_TYPE = '按
天
'
AND ANALYSIS_TYPE = '按
10分钟
'
<!--AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = CURRENT_DATE - INTERVAL 1 DAY-->
AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = get_time_sub(1,'DAY')
<if
test=
"subarray != null and subarray != ''"
>
AND SUBARRAY = concat('#', #{subarray})
</if>
<if
test=
"gatewayId != null and gatewayId != ''"
>
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
group by EQUIPMENT_NAME
</select>
<select
id=
"getPvSumSystemListByEquipment"
resultType=
"java.util.Map"
>
SELECT
EQUIPMENT_NAME as equipmentName
FROM
idx_biz_pv_point_process_variable_classification
<where>
EQUIPMENT_NAME IS NOT NULL
AND EQUIPMENT_NAME != ''
AND TAG_CODE = '分析变量'
<if
test=
"subarray != null and subarray != ''"
>
AND SUBARRAY = concat('#', #{subarray})
</if>
<if
test=
"gatewayId != null and gatewayId != ''"
>
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
EQUIPMENT_NAME
</select>
<select
id=
"getPvHealthInfoBySubSystem"
resultType=
"java.util.Map"
>
SELECT
IFNULL(HEALTH_INDEX, 100) AS healthIndex,
POINT_NAME AS pointName
FROM
pv_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '测点'
AND ANALYSIS_TYPE = '按天'
AND POINT_NAME IS NOT NULL
AND POINT_NAME != ''
<if
test=
"equipmentName != null and equipmentName != ''"
>
AND EQUIPMENT_NAME = #{equipmentName}
</if>
<if
test=
"gatewayId != null and gatewayId != ''"
>
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
POINT_NAME
</select>
<select
id=
"getPvWarningInfoBySubSystem"
resultType=
"java.util.Map"
>
SELECT
POINT_NAME as pointName,
WARNING_NAME as warningName
FROM
idx_biz_pv_warning_record
<where>
DISPOSOTION_STATE = '待确认'
<if
test=
"equipmentName != null and equipmentName != ''"
>
AND EQUIPMENT_NAME = #{equipmentName}
</if>
<if
test=
"gatewayId != null and gatewayId != ''"
>
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
POINT_NAME
ORDER BY
WARNING_NAME ASC
</select>
<select
id=
"getPvPointNameListBySumSystem"
resultType=
"java.util.Map"
>
SELECT
POINT_NAME as pointName,
INDEX_ADDRESS as indexAddress,
STATION AS station
FROM
idx_biz_pv_point_process_variable_classification
<where>
TAG_CODE = '分析变量'
<if
test=
"equipmentName != null and equipmentName != ''"
>
AND EQUIPMENT_NAME = #{equipmentName}
</if>
<if
test=
"gatewayId != null and gatewayId != ''"
>
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
POINT_NAME
</select>
<select
id=
"getPointNameByIndexAddress"
resultType=
"java.lang.String"
>
select POINT_NAME
from ${tableName}
where INDEX_ADDRESS = #{varDesc}
and GATEWAY_ID = #{gatewayId}
limit 1
<!--AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = get_time_sub(1,'DAY')-->
AND REC_DATE >= get_time_sub(9,'MINUTE')
<if
test=
"subarray != null and subarray != ''"
>
AND SUBARRAY = concat('#', #{subarray})
</if>
<if
test=
"gatewayId != null and gatewayId != ''"
>
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
group by EQUIPMENT_NAME
</select>
<select
id=
"getPvSumSystemListByEquipment"
resultType=
"java.util.Map"
>
SELECT
EQUIPMENT_NAME as equipmentName
FROM
idx_biz_pv_point_process_variable_classification
<where>
EQUIPMENT_NAME IS NOT NULL
AND EQUIPMENT_NAME != ''
AND TAG_CODE = '分析变量'
<if
test=
"subarray != null and subarray != ''"
>
AND SUBARRAY = concat('#', #{subarray})
</if>
<if
test=
"gatewayId != null and gatewayId != ''"
>
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
EQUIPMENT_NAME
</select>
<select
id=
"getPvHealthInfoBySubSystem"
resultType=
"java.util.Map"
>
SELECT
IFNULL(HEALTH_INDEX, 100) AS healthIndex,
POINT_NAME AS pointName
FROM
pv_health_index_latest_data
<where>
ANALYSIS_OBJ_TYPE = '测点'
AND ANALYSIS_TYPE = '按10分钟'
AND POINT_NAME IS NOT NULL
AND POINT_NAME != ''
<if
test=
"equipmentName != null and equipmentName != ''"
>
AND EQUIPMENT_NAME = #{equipmentName}
</if>
<if
test=
"gatewayId != null and gatewayId != ''"
>
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
POINT_NAME
</select>
<select
id=
"getPvWarningInfoBySubSystem"
resultType=
"java.util.Map"
>
SELECT
POINT_NAME as pointName,
WARNING_NAME as warningName
FROM
idx_biz_pv_warning_record
<where>
DISPOSOTION_STATE = '待确认'
<if
test=
"equipmentName != null and equipmentName != ''"
>
AND EQUIPMENT_NAME = #{equipmentName}
</if>
<if
test=
"gatewayId != null and gatewayId != ''"
>
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
POINT_NAME
ORDER BY
WARNING_NAME ASC
</select>
<select
id=
"getPvPointNameListBySumSystem"
resultType=
"java.util.Map"
>
SELECT
POINT_NAME as pointName,
INDEX_ADDRESS as indexAddress,
STATION AS station
FROM
idx_biz_pv_point_process_variable_classification
<where>
TAG_CODE = '分析变量'
<if
test=
"equipmentName != null and equipmentName != ''"
>
AND EQUIPMENT_NAME = #{equipmentName}
</if>
<if
test=
"gatewayId != null and gatewayId != ''"
>
AND GATEWAY_ID = #{gatewayId}
</if>
</where>
GROUP BY
POINT_NAME
</select>
<select
id=
"getPointNameByIndexAddress"
resultType=
"java.lang.String"
>
select POINT_NAME
from ${tableName}
where INDEX_ADDRESS = #{varDesc}
and GATEWAY_ID = #{gatewayId}
limit 1
</select>
<select
id=
"getFullViewRecall"
resultType=
"com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO"
>
SELECT a.*,
row_number() over ( ORDER BY pointName ) AS id
FROM (
(SELECT ARAE AS area,
STATION AS station,
EQUIPMENT_NAME AS equipmentName,
SUB_SYSTEM AS subSystem,
POINT_NAME AS pointName,
INDEX_ADDRESS AS indexAddress,
KKS
FROM idx_biz_fan_point_process_variable_classification
WHERE TAG_CODE = '分析变量'
AND ARAE is not null
AND STATION is not null
AND EQUIPMENT_NAME is not null
AND SUB_SYSTEM is not null
AND POINT_NAME is not null
AND INDEX_ADDRESS is not null
<if
test=
"gatewayIds != null and gatewayIds.size() > 0"
>
and GATEWAY_ID in
<foreach
item=
"item"
index=
"index"
collection=
"gatewayIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
)
UNION ALL
(SELECT ARAE AS area,
STATION AS station,
SUBARRAY AS equipmentName,
EQUIPMENT_NAME AS subSystem,
POINT_NAME AS pointName,
INDEX_ADDRESS AS indexAddress,
KKS
FROM idx_biz_pv_point_process_variable_classification
WHERE TAG_CODE = '分析变量'
AND ARAE is not null
AND STATION is not null
AND SUBARRAY is not null
AND EQUIPMENT_NAME is not null
AND POINT_NAME is not null
AND INDEX_ADDRESS is not null
<if
test=
"gatewayIds != null and gatewayIds.size() > 0"
>
and GATEWAY_ID in
<foreach
item=
"item"
index=
"index"
collection=
"gatewayIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
)
) a
ORDER BY a.station ASC, a.equipmentName ASC, a.equipmentName asc, a.subSystem asc
</select>
<select
id=
"getStationIndexInfo"
resultType=
"java.util.Map"
>
SELECT a.STATION AS station,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
FROM (
</select>
<select
id=
"getFullViewRecall"
resultType=
"com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO"
>
SELECT a.*,
row_number() over ( ORDER BY pointName ) AS id
FROM (
(SELECT ARAE AS area,
STATION AS station,
EQUIPMENT_NAME AS equipmentName,
SUB_SYSTEM AS subSystem,
POINT_NAME AS pointName,
INDEX_ADDRESS AS indexAddress,
KKS
FROM idx_biz_fan_point_process_variable_classification
WHERE TAG_CODE = '分析变量'
AND ARAE is not null
AND STATION is not null
AND EQUIPMENT_NAME is not null
AND SUB_SYSTEM is not null
AND POINT_NAME is not null
AND INDEX_ADDRESS is not null
<if
test=
"gatewayIds != null and gatewayIds.size() > 0"
>
and GATEWAY_ID in
<foreach
item=
"item"
index=
"index"
collection=
"gatewayIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
)
UNION ALL
(SELECT ARAE AS area,
STATION AS station,
SUBARRAY AS equipmentName,
EQUIPMENT_NAME AS subSystem,
POINT_NAME AS pointName,
INDEX_ADDRESS AS indexAddress,
KKS
FROM idx_biz_pv_point_process_variable_classification
WHERE TAG_CODE = '分析变量'
AND ARAE is not null
AND STATION is not null
AND SUBARRAY is not null
AND EQUIPMENT_NAME is not null
AND POINT_NAME is not null
AND INDEX_ADDRESS is not null
<if
test=
"gatewayIds != null and gatewayIds.size() > 0"
>
and GATEWAY_ID in
<foreach
item=
"item"
index=
"index"
collection=
"gatewayIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
)
) a
ORDER BY a.station ASC, a.equipmentName ASC, a.equipmentName asc, a.subSystem asc
</select>
<select
id=
"getStationIndexInfo"
resultType=
"java.util.Map"
>
SELECT a.STATION AS station,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
FROM (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
STATION AS STATION
FROM idx_biz_fan_health_index
WHERE ANALYSIS_OBJ_TYPE = '场站'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = CURRENT_DATE
GROUP BY STATION
UNION ALL
(
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
STATION AS STATION
FROM idx_biz_
fan
_health_index
FROM idx_biz_
pv
_health_index
WHERE ANALYSIS_OBJ_TYPE = '场站'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = CURRENT_DATE
GROUP BY STATION
UNION ALL
(
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
STATION AS STATION
FROM idx_biz_pv_health_index
WHERE ANALYSIS_OBJ_TYPE = '场站'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = CURRENT_DATE
GROUP BY STATION
)
) a
GROUP BY a.STATION
</select>
<select
id=
"getEquipmentIndexInfo"
resultType=
"java.util.Map"
>
SELECT a.equipmentName AS equipmentName,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
FROM
(
)
) a
GROUP BY a.STATION
</select>
<select
id=
"getEquipmentIndexInfo"
resultType=
"java.util.Map"
>
SELECT a.equipmentName AS equipmentName,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
FROM (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
EQUIPMENT_NAME AS equipmentName
FROM idx_biz_fan_health_index
WHERE ANALYSIS_OBJ_TYPE = '设备'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = CURRENT_DATE
GROUP BY EQUIPMENT_NAME
UNION ALL
(
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
EQUIPMENT_NAME
AS equipmentName
FROM idx_biz_
fan
_health_index
WHERE ANALYSIS_OBJ_TYPE = '
设备
'
SUBARRAY
AS equipmentName
FROM idx_biz_
pv
_health_index
WHERE ANALYSIS_OBJ_TYPE = '
子阵
'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = CURRENT_DATE
GROUP BY EQUIPMENT_NAME
UNION ALL
(
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
SUBARRAY AS equipmentName
FROM idx_biz_pv_health_index
WHERE ANALYSIS_OBJ_TYPE = '子阵'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = CURRENT_DATE
GROUP BY SUBARRAY
)
) a
where equipmentName is not null
and equipmentName != ''
GROUP BY
a.equipmentName
</select>
<select
id=
"getSubSystemIndexInfo"
resultType=
"java.util.Map"
>
GROUP BY SUBARRAY
)
) a
where equipmentName is not null
and equipmentName != ''
GROUP BY
a.equipmentName
</select>
<select
id=
"getSubSystemIndexInfo"
resultType=
"java.util.Map"
>
SELECT a.subSystem AS subSystem,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
FROM (
SELECT a.subSystem AS subSystem,
ROUND(avg(a.avgHealthIndex), 2) AS healthIndex
FROM (
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
SUB_SYSTEM AS subSystem
FROM idx_biz_fan_health_index
WHERE ANALYSIS_OBJ_TYPE = '子系统'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = CURRENT_DATE
GROUP BY SUB_SYSTEM
UNION ALL
(
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
SUB_SYSTEM
AS subSystem
FROM idx_biz_
fan
_health_index
WHERE ANALYSIS_OBJ_TYPE = '
子系统
'
EQUIPMENT_NAME
AS subSystem
FROM idx_biz_
pv
_health_index
WHERE ANALYSIS_OBJ_TYPE = '
设备
'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = CURRENT_DATE
GROUP BY SUB_SYSTEM
UNION ALL
(
SELECT IFNULL(AVG(HEALTH_INDEX), 100) AS avgHealthIndex,
EQUIPMENT_NAME AS subSystem
FROM idx_biz_pv_health_index
WHERE ANALYSIS_OBJ_TYPE = '设备'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = CURRENT_DATE
GROUP BY EQUIPMENT_NAME
)
) a
where subSystem is not null
and subSystem != ''
GROUP BY
a.subSystem
GROUP BY EQUIPMENT_NAME
)
) a
where subSystem is not null
and subSystem != ''
GROUP BY
a.subSystem
</select>
<select
id=
"getPointNameIndexInfo"
resultType=
"java.util.Map"
>
</select>
<select
id=
"getPointNameIndexInfo"
resultType=
"java.util.Map"
>
SELECT IFNULL(MAX(HEALTH_INDEX), 100) AS healthIndex,
concat(MAX(STATION), '_', INDEX_ADDRESS) as gatewayIndexAddress
FROM idx_biz_fan_health_index
WHERE ANALYSIS_OBJ_TYPE = '测点'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = CURRENT_DATE
GROUP BY INDEX_ADDRESS
UNION ALL
(
SELECT IFNULL(MAX(HEALTH_INDEX), 100) AS healthIndex,
concat(MAX(STATION), '_', INDEX_ADDRESS) as gatewayIndexAddress
FROM idx_biz_
fan
_health_index
FROM idx_biz_
pv
_health_index
WHERE ANALYSIS_OBJ_TYPE = '测点'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = CURRENT_DATE
GROUP BY INDEX_ADDRESS
UNION ALL
(
SELECT IFNULL(MAX(HEALTH_INDEX), 100) AS healthIndex,
concat(MAX(STATION), '_', INDEX_ADDRESS) as gatewayIndexAddress
FROM idx_biz_pv_health_index
WHERE ANALYSIS_OBJ_TYPE = '测点'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT(REC_DATE, '%Y-%m-%d') = CURRENT_DATE
GROUP BY INDEX_ADDRESS
)
</select>
<select
id=
"getHealthLevelInfoList"
resultType=
"com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel"
>
SELECT CONCAT(`STATUS`, '_', ANALYSIS_OBJ_TYPE) AS analysisObjType,
HEALTH_LEVEL AS healthLevel,
GROUP_LOWER_LIMIT AS groupLowerLimit,
GROUP_UPPER_LIMIT AS groupUpperLimit
FROM idx_biz_fan_health_level
WHERE (STATUS IS NOT NULL
OR STATUS != '')
<if
test=
"gatewayIds != null and gatewayIds.size() > 0"
>
and GATEWAY_ID in
<foreach
item=
"item"
index=
"index"
collection=
"gatewayIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
)
</select>
<select
id=
"getHealthLevelInfoList"
resultType=
"com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthLevel"
>
SELECT CONCAT(`STATUS`, '_', ANALYSIS_OBJ_TYPE) AS analysisObjType,
HEALTH_LEVEL AS healthLevel,
GROUP_LOWER_LIMIT AS groupLowerLimit,
GROUP_UPPER_LIMIT AS groupUpperLimit
FROM idx_biz_fan_health_level
WHERE (STATUS IS NOT NULL
OR STATUS != '')
<if
test=
"gatewayIds != null and gatewayIds.size() > 0"
>
and GATEWAY_ID in
<foreach
item=
"item"
index=
"index"
collection=
"gatewayIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
UNION ALL
SELECT CONCAT(`STATUS`, '_', ANALYSIS_OBJ_TYPE) AS analysisObjType,
HEALTH_LEVEL AS healthLevel,
GROUP_LOWER_LIMIT AS groupLowerLimit,
GROUP_UPPER_LIMIT AS groupUpperLimit
FROM idx_biz_pv_health_level
WHERE (STATUS IS NOT NULL
OR STATUS != '')
<if
test=
"gatewayIds != null and gatewayIds.size() > 0"
>
and GATEWAY_ID in
<foreach
item=
"item"
index=
"index"
collection=
"gatewayIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</select>
<select
id=
"getAddressInfo"
resultType=
"java.lang.String"
>
select index_address
from wl_equipment_specific_index
where gateway_id = '1668801435891929089'
and data_type = 'analog' limit 100
</select>
<select
id=
"queryForLeftTableList"
resultType=
"map"
>
SELECT
b.*,
IFNULL(CAST(HEALTH_INDEX AS UNSIGNED), 100 ) as HEALTH_INDEX ,
IFNULL( ibfhi.HEALTH_LEVEL, '安全' ) as HEALTH_LEVEL,
(case ibfhi.HEALTH_LEVEL
WHEN '危险' THEN 3
WHEN '警告' THEN 2
WHEN '注意' THEN 1
ELSE 0 end) as status
FROM
(
SELECT
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME` AS `EQUIPMENT_NAME`,
`idx_biz_fan_point_process_variable_classification`.`STATION` AS `STATION`
FROM
`idx_biz_fan_point_process_variable_classification`
WHERE
`idx_biz_fan_point_process_variable_classification`.`TAG_CODE` = '分析变量'
GROUP BY
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME`
ORDER BY
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME` ASC
) b
LEFT JOIN `idx_biz_fan_health_index` `ibfhi` ON ( ( `b`.`EQUIPMENT_NAME` = `ibfhi`.`EQUIPMENT_NAME` ) )
AND ibfhi.ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_TYPE = '按天' AND
DATE_FORMAT(ibfhi.REC_DATE,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
<where>
<if
test=
"STATION != '' and STATION != null"
>
b.STATION = #{STATION}
</if>
UNION ALL
SELECT CONCAT(`STATUS`, '_', ANALYSIS_OBJ_TYPE) AS analysisObjType,
HEALTH_LEVEL AS healthLevel,
GROUP_LOWER_LIMIT AS groupLowerLimit,
GROUP_UPPER_LIMIT AS groupUpperLimit
FROM idx_biz_pv_health_level
WHERE (STATUS IS NOT NULL
OR STATUS != '')
<if
test=
"gatewayIds != null and gatewayIds.size() > 0"
>
and GATEWAY_ID in
<foreach
item=
"item"
index=
"index"
collection=
"gatewayIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
<if
test=
"HEALTHLEVEL != '' and HEALTHLEVEL != null"
>
AND HEALTH_LEVEL = #{HEALTHLEVEL}
</if>
</select>
<select
id=
"getAddressInfo"
resultType=
"java.lang.String"
>
select index_address
from wl_equipment_specific_index
where gateway_id = '1668801435891929089'
and data_type = 'analog' limit 100
</select>
<select
id=
"queryForLeftTableList"
resultType=
"map"
>
SELECT
b.*,
IFNULL(CAST(HEALTH_INDEX AS UNSIGNED), 100 ) as HEALTH_INDEX ,
IFNULL( ibfhi.HEALTH_LEVEL, '安全' ) as HEALTH_LEVEL,
(case ibfhi.HEALTH_LEVEL
WHEN '危险' THEN 3
WHEN '警告' THEN 2
WHEN '注意' THEN 1
ELSE 0 end) as status
FROM
(
SELECT
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME` AS `EQUIPMENT_NAME`,
`idx_biz_fan_point_process_variable_classification`.`STATION` AS `STATION`
FROM
`idx_biz_fan_point_process_variable_classification`
WHERE
`idx_biz_fan_point_process_variable_classification`.`TAG_CODE` = '分析变量'
GROUP BY
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME`
ORDER BY
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME` ASC
) b
LEFT JOIN `idx_biz_fan_health_index` `ibfhi` ON ( ( `b`.`EQUIPMENT_NAME` = `ibfhi`.`EQUIPMENT_NAME` ) )
AND ibfhi.ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_TYPE = '按天' AND
DATE_FORMAT(ibfhi.REC_DATE,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
<where>
<if
test=
"STATION != '' and STATION != null"
>
b.STATION = #{STATION}
</if>
<if
test=
"HEALTHLEVEL != '' and HEALTHLEVEL != null"
>
AND HEALTH_LEVEL = #{HEALTHLEVEL}
</if>
<if
test=
"EQUIPMENTNAME != '' and EQUIPMENTNAME != null"
>
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
</where>
order by HEALTH_INDEX ASC
limit ${current},${size}
</select>
<select
id=
"queryForLeftTableListCount"
resultType=
"int"
>
SELECT
count(1)
FROM
(
SELECT
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME` AS `EQUIPMENT_NAME`,
`idx_biz_fan_point_process_variable_classification`.`STATION` AS `STATION`
FROM
`idx_biz_fan_point_process_variable_classification`
WHERE
`idx_biz_fan_point_process_variable_classification`.`TAG_CODE` = '分析变量'
GROUP BY
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME`
ORDER BY
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME` ASC
) b
LEFT JOIN `idx_biz_fan_health_index` `ibfhi` ON ( ( `b`.`EQUIPMENT_NAME` = `ibfhi`.`EQUIPMENT_NAME` ) )
AND ibfhi.ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_TYPE = '按天' AND
DATE_FORMAT(ibfhi.REC_DATE,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
<where>
<if
test=
"STATION != '' and STATION != null"
>
b.STATION = #{STATION}
</if>
<if
test=
"HEALTHLEVEL != '' and HEALTHLEVEL != null"
>
AND HEALTH_LEVEL = #{HEALTHLEVEL}
</if>
<if
test=
"EQUIPMENTNAME != '' and EQUIPMENTNAME != null"
>
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
</where>
</select>
<select
id=
"queryForLeftTableListNum"
resultType=
"map"
>
SELECT
<if
test=
"EQUIPMENTNAME != '' and EQUIPMENTNAME != null"
>
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
</where>
order by HEALTH_INDEX ASC
limit ${current},${size}
</select>
<select
id=
"queryForLeftTableListCount"
resultType=
"int"
>
SELECT
count(1)
FROM
(
SELECT
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME` AS `EQUIPMENT_NAME`,
`idx_biz_fan_point_process_variable_classification`.`STATION` AS `STATION`
FROM
`idx_biz_fan_point_process_variable_classification`
WHERE
`idx_biz_fan_point_process_variable_classification`.`TAG_CODE` = '分析变量'
GROUP BY
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME`
ORDER BY
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME` ASC
) b
LEFT JOIN `idx_biz_fan_health_index` `ibfhi` ON ( ( `b`.`EQUIPMENT_NAME` = `ibfhi`.`EQUIPMENT_NAME` ) )
AND ibfhi.ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_TYPE = '按天' AND
DATE_FORMAT(ibfhi.REC_DATE,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
<where>
<if
test=
"STATION != '' and STATION != null"
>
b.STATION = #{STATION}
</if>
<if
test=
"HEALTHLEVEL != '' and HEALTHLEVEL != null"
>
AND HEALTH_LEVEL = #{HEALTHLEVEL}
</if>
<if
test=
"EQUIPMENTNAME != '' and EQUIPMENTNAME != null"
>
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
</where>
</select>
<select
id=
"queryForLeftTableListNum"
resultType=
"map"
>
SELECT
CAST(ibfhi.HEALTH_INDEX AS UNSIGNED) as value
FROM
(
SELECT
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME` AS `EQUIPMENT_NAME`,
`idx_biz_fan_point_process_variable_classification`.`STATION` AS `STATION`
FROM
`idx_biz_fan_point_process_variable_classification`
WHERE
`idx_biz_fan_point_process_variable_classification`.`TAG_CODE` = '分析变量'
GROUP BY
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME`
ORDER BY
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME` ASC
) b
LEFT JOIN `idx_biz_fan_health_index` `ibfhi` ON ( ( `b`.`EQUIPMENT_NAME` = `ibfhi`.`EQUIPMENT_NAME` ) )
AND ibfhi.ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_TYPE = '按天' AND
DATE_FORMAT(ibfhi.REC_DATE,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
<where>
<if
test=
"STATION != '' and STATION != null"
>
b.STATION = #{STATION}
</if>
<if
test=
"HEALTHLEVEL != '' and HEALTHLEVEL != null"
>
AND HEALTH_LEVEL = #{HEALTHLEVEL}
</if>
<if
test=
"EQUIPMENTNAME != '' and EQUIPMENTNAME != null"
>
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
</where>
</select>
<select
id=
"queryForLeftTableListByPoint"
resultType=
"map"
>
SELECT
b.*
FROM
(
SELECT
POINT_NAME ,
STATION,
CAST(HEALTH_INDEX AS UNSIGNED) as HEALTH_INDEX,
CAST(HEALTH_INDEX AS UNSIGNED) as value,
HEALTH_LEVEL,
( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status,
SUB_SYSTEM,
REC_DATE,
EQUIPMENT_NAME,
INDEX_ADDRESS,
ANALYSIS_OBJ_SEQ,
ANALYSIS_TYPE
FROM
`idx_biz_fan_health_index`
WHERE
ANALYSIS_OBJ_TYPE = '测点'
<!--AND ( ANALYSIS_TYPE = '按小时' AND REC_DATE >= DATE_SUB( NOW( ), INTERVAL 1 HOUR ) )-->
CAST(ibfhi.HEALTH_INDEX AS UNSIGNED) as value
FROM
(
SELECT
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME` AS `EQUIPMENT_NAME`,
`idx_biz_fan_point_process_variable_classification`.`STATION` AS `STATION`
FROM
`idx_biz_fan_point_process_variable_classification`
WHERE
`idx_biz_fan_point_process_variable_classification`.`TAG_CODE` = '分析变量'
GROUP BY
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME`
ORDER BY
`idx_biz_fan_point_process_variable_classification`.`EQUIPMENT_NAME` ASC
) b
LEFT JOIN `idx_biz_fan_health_index` `ibfhi` ON ( ( `b`.`EQUIPMENT_NAME` = `ibfhi`.`EQUIPMENT_NAME` ) )
AND ibfhi.ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_OBJ_TYPE = '设备' AND ANALYSIS_TYPE = '按天' AND
DATE_FORMAT(ibfhi.REC_DATE,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
<where>
<if
test=
"STATION != '' and STATION != null"
>
b.STATION = #{STATION}
</if>
<if
test=
"HEALTHLEVEL != '' and HEALTHLEVEL != null"
>
AND HEALTH_LEVEL = #{HEALTHLEVEL}
</if>
<if
test=
"EQUIPMENTNAME != '' and EQUIPMENTNAME != null"
>
AND b.EQUIPMENT_NAME = #{EQUIPMENTNAME}
</if>
</where>
</select>
<select
id=
"queryForLeftTableListByPoint"
resultType=
"map"
>
SELECT
b.*
FROM
(
SELECT
POINT_NAME ,
STATION,
CAST(HEALTH_INDEX AS UNSIGNED) as HEALTH_INDEX,
CAST(HEALTH_INDEX AS UNSIGNED) as value,
HEALTH_LEVEL,
( CASE HEALTH_LEVEL WHEN '危险' THEN 3 WHEN '警告' THEN 2 WHEN '注意' THEN 1 ELSE 0 END ) AS status,
SUB_SYSTEM,
REC_DATE,
EQUIPMENT_NAME,
INDEX_ADDRESS,
ANALYSIS_OBJ_SEQ,
ANALYSIS_TYPE
FROM
`idx_biz_fan_health_index`
WHERE
ANALYSIS_OBJ_TYPE = '测点'
<!--AND ( ANALYSIS_TYPE = '按小时' AND REC_DATE >= DATE_SUB( NOW( ), INTERVAL 1 HOUR ) )-->
AND ( ANALYSIS_TYPE = '按小时' AND REC_DATE >= get_time_sub(1,'HOUR') )
OR ( REC_DATE >= CURRENT_DATE ( ) AND ANALYSIS_TYPE = '按天' )
<!--OR ( ANALYSIS_TYPE = '按10分钟' AND REC_DATE >= DATE_SUB( NOW( ), INTERVAL 10 MINUTE ) )-->
...
...
@@ -1688,9 +1694,10 @@
FROM
fan_health_index_latest_data
<where>
ANALYSIS_TYPE = '按天'
<!-- AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = CURDATE() - INTERVAL 1 DAY-->
AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = get_time_sub(1,'DAY')
ANALYSIS_TYPE = '按10分钟'
<!--AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = CURDATE() - INTERVAL 1 DAY-->
<!--AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = get_time_sub(1,'DAY') -->
AND REC_DATE >= get_time_sub(9,'MINUTE')
<if
test=
"areaCode != null and areaCode != ''"
>
AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
...
...
@@ -1710,64 +1717,65 @@
FROM
pv_health_index_latest_data
<where>
ANALYSIS_TYPE = '按天
'
ANALYSIS_TYPE = '按10分钟
'
<!-- AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = CURDATE() - INTERVAL 1 DAY-->
AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = get_time_sub(1,'DAY')
<if
test=
"areaCode != null and areaCode != ''"
>
AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if
test=
"stationCode != null and stationCode != ''"
>
AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if>
<if
test=
"(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')"
>
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
</where>
)
) a
</select>
<!--<select id="getDateInfoBy15" resultType="java.util.Map">
SELECT
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD( CURDATE() - INTERVAL 1 DAY, INTERVAL - 15 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
DATEDIFF( CURDATE() - INTERVAL 1 DAY, DATE( DATE_ADD( CURDATE() - INTERVAL 1 DAY, INTERVAL - 15 DAY )) ) >= @s
</select>
<select id="getDateInfo" resultType="java.util.Map">
SELECT
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD( #{endTime}, INTERVAL - DATEDIFF( #{endTime}, #{startTime})-1 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
DATEDIFF( #{endTime}, DATE( DATE_ADD( #{endTime}, INTERVAL - DATEDIFF( #{endTime}, #{startTime})-1 DAY )) ) >= @s
</select>
<select id="getHourInfo" resultType="java.util.Map">
SELECT
DATE_FORMAT( DATE_ADD(( DATE(#{startTime})), INTERVAL @s-1 HOUR ), '%Y-%m-%d %H:%i:%s' ) AS date,
( @s := @s + 1 )- 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
TIMESTAMPDIFF( HOUR, #{startTime} , #{endTime}) >= @s-1
</select>
<select id="getMomentInfo" resultType="java.util.Map">
SELECT
DATE_FORMAT( DATE_ADD(( DATE(#{startTime})), INTERVAL (@s-1)*10 MINUTE ), '%Y-%m-%d %H:%i:%s' ) AS date,
( @s := @s + 1 )- 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
TIMESTAMPDIFF( MINUTE, #{startTime} , #{endTime})/10 >= @s-1
</select>-->
<!--AND DATE_FORMAT( REC_DATE, '%Y-%m-%d' ) = get_time_sub(1,'DAY')-->
AND REC_DATE >= get_time_sub(9,'MINUTE')
<if
test=
"areaCode != null and areaCode != ''"
>
AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if
test=
"stationCode != null and stationCode != ''"
>
AND GATEWAY_ID = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if>
<if
test=
"(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')"
>
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
</where>
)
) a
</select>
<!--<select id="getDateInfoBy15" resultType="java.util.Map">
SELECT
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD( CURDATE() - INTERVAL 1 DAY, INTERVAL - 15 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
DATEDIFF( CURDATE() - INTERVAL 1 DAY, DATE( DATE_ADD( CURDATE() - INTERVAL 1 DAY, INTERVAL - 15 DAY )) ) >= @s
</select>
<select id="getDateInfo" resultType="java.util.Map">
SELECT
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD( #{endTime}, INTERVAL - DATEDIFF( #{endTime}, #{startTime})-1 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
DATEDIFF( #{endTime}, DATE( DATE_ADD( #{endTime}, INTERVAL - DATEDIFF( #{endTime}, #{startTime})-1 DAY )) ) >= @s
</select>
<select id="getHourInfo" resultType="java.util.Map">
SELECT
DATE_FORMAT( DATE_ADD(( DATE(#{startTime})), INTERVAL @s-1 HOUR ), '%Y-%m-%d %H:%i:%s' ) AS date,
( @s := @s + 1 )- 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
TIMESTAMPDIFF( HOUR, #{startTime} , #{endTime}) >= @s-1
</select>
<select id="getMomentInfo" resultType="java.util.Map">
SELECT
DATE_FORMAT( DATE_ADD(( DATE(#{startTime})), INTERVAL (@s-1)*10 MINUTE ), '%Y-%m-%d %H:%i:%s' ) AS date,
( @s := @s + 1 )- 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
WHERE
TIMESTAMPDIFF( MINUTE, #{startTime} , #{endTime})/10 >= @s-1
</select>-->
<select
id=
"getHealthIndexByIndexAddress"
resultType=
"java.util.Map"
>
select ROUND(ifnull(HEALTH_INDEX, 100.0), 1) as healthIndex,
...
...
@@ -1777,7 +1785,7 @@
INDEX_ADDRESS = #{indexAddress}
and GATEWAY_ID = #{gatewayId}
and ANALYSIS_OBJ_TYPE = '测点'
and ANALYSIS_TYPE = '按
天
'
and ANALYSIS_TYPE = '按
10分钟
'
limit 1
</select>
...
...
@@ -1789,7 +1797,7 @@
INDEX_ADDRESS = #{indexAddress}
and GATEWAY_ID = #{gatewayId}
and ANALYSIS_OBJ_TYPE = '测点'
and ANALYSIS_TYPE = '按
天
'
and ANALYSIS_TYPE = '按
10分钟
'
limit 1
</select>
</mapper>
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