Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
833cde98
Commit
833cde98
authored
Jan 29, 2024
by
KeYong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交列表查询逻辑
parent
3349e2e3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
127 additions
and
1 deletion
+127
-1
TdInfoQueryController.java
...ot/module/jxiop/biz/controller/TdInfoQueryController.java
+5
-0
GatewayIdAutowired.java
...t/module/jxiop/biz/core/framework/GatewayIdAutowired.java
+23
-0
GatewayIdAutowiredAspect.java
...le/jxiop/biz/core/framework/GatewayIdAutowiredAspect.java
+86
-0
FanHealthIndexDto.java
...oin/amos/boot/module/jxiop/biz/dto/FanHealthIndexDto.java
+2
-0
PvHealthIndexDto.java
...join/amos/boot/module/jxiop/biz/dto/PvHealthIndexDto.java
+1
-1
FanWarningRecord.xml
.../src/main/resources/mapper/tdengine2/FanWarningRecord.xml
+10
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/TdInfoQueryController.java
View file @
833cde98
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.jxiop.biz.core.framework.GatewayIdAutowired
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.FanHealthIndexDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.FanHealthIndexDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallInfoDTO
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallInfoDTO
;
...
@@ -71,6 +72,7 @@ public class TdInfoQueryController {
...
@@ -71,6 +72,7 @@ public class TdInfoQueryController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
value
=
"/getFanHealthIndexInfo"
)
@PostMapping
(
value
=
"/getFanHealthIndexInfo"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"分页查询健康指数信息 - 风电"
,
notes
=
"分页查询健康指数信息 - 风电"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"分页查询健康指数信息 - 风电"
,
notes
=
"分页查询健康指数信息 - 风电"
)
@GatewayIdAutowired
public
ResponseModel
<
Page
<
FanHealthIndex
>>
getFanHealthIndexInfo
(
@RequestBody
FanHealthIndexDto
dto
)
throws
ParseException
{
public
ResponseModel
<
Page
<
FanHealthIndex
>>
getFanHealthIndexInfo
(
@RequestBody
FanHealthIndexDto
dto
)
throws
ParseException
{
if
(
CharSequenceUtil
.
isNotEmpty
(
dto
.
getStartDate
()))
{
if
(
CharSequenceUtil
.
isNotEmpty
(
dto
.
getStartDate
()))
{
String
startDate
=
dto
.
getStartDate
();
String
startDate
=
dto
.
getStartDate
();
...
@@ -138,6 +140,7 @@ public class TdInfoQueryController {
...
@@ -138,6 +140,7 @@ public class TdInfoQueryController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
value
=
"/getPvHealthIndexInfo"
)
@PostMapping
(
value
=
"/getPvHealthIndexInfo"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"分页查询健康指数信息 - 光伏"
,
notes
=
"分页查询健康指数信息 - 光伏"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"分页查询健康指数信息 - 光伏"
,
notes
=
"分页查询健康指数信息 - 光伏"
)
@GatewayIdAutowired
public
ResponseModel
<
Page
<
PvHealthIndex
>>
getPvHealthIndexInfo
(
@RequestBody
PvHealthIndexDto
dto
)
throws
ParseException
{
public
ResponseModel
<
Page
<
PvHealthIndex
>>
getPvHealthIndexInfo
(
@RequestBody
PvHealthIndexDto
dto
)
throws
ParseException
{
if
(
CharSequenceUtil
.
isNotEmpty
(
dto
.
getStartDate
()))
{
if
(
CharSequenceUtil
.
isNotEmpty
(
dto
.
getStartDate
()))
{
String
startDate
=
dto
.
getStartDate
();
String
startDate
=
dto
.
getStartDate
();
...
@@ -188,6 +191,7 @@ public class TdInfoQueryController {
...
@@ -188,6 +191,7 @@ public class TdInfoQueryController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
value
=
"/getFanWarningRecordInfo"
)
@PostMapping
(
value
=
"/getFanWarningRecordInfo"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"分页查询健康指数信息 - 风电"
,
notes
=
"分页查询健康指数信息 - 风电"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"分页查询健康指数信息 - 风电"
,
notes
=
"分页查询健康指数信息 - 风电"
)
@GatewayIdAutowired
public
ResponseModel
<
Page
<
FanWarningRecord
>>
getFanWarningRecordInfo
(
@RequestBody
FanHealthIndexDto
dto
)
throws
ParseException
{
public
ResponseModel
<
Page
<
FanWarningRecord
>>
getFanWarningRecordInfo
(
@RequestBody
FanHealthIndexDto
dto
)
throws
ParseException
{
if
(
CharSequenceUtil
.
isNotEmpty
(
dto
.
getStartDate
()))
{
if
(
CharSequenceUtil
.
isNotEmpty
(
dto
.
getStartDate
()))
{
String
startDate
=
dto
.
getStartDate
();
String
startDate
=
dto
.
getStartDate
();
...
@@ -237,6 +241,7 @@ public class TdInfoQueryController {
...
@@ -237,6 +241,7 @@ public class TdInfoQueryController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
value
=
"/getPvWarningRecordInfo"
)
@PostMapping
(
value
=
"/getPvWarningRecordInfo"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"分页查询健康指数信息 - 光伏"
,
notes
=
"分页查询健康指数信息 - 光伏"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"分页查询健康指数信息 - 光伏"
,
notes
=
"分页查询健康指数信息 - 光伏"
)
@GatewayIdAutowired
public
ResponseModel
<
Page
<
PvWarningRecord
>>
getPvWarningRecordInfo
(
@RequestBody
FanHealthIndexDto
dto
)
throws
ParseException
{
public
ResponseModel
<
Page
<
PvWarningRecord
>>
getPvWarningRecordInfo
(
@RequestBody
FanHealthIndexDto
dto
)
throws
ParseException
{
if
(
CharSequenceUtil
.
isNotEmpty
(
dto
.
getStartDate
()))
{
if
(
CharSequenceUtil
.
isNotEmpty
(
dto
.
getStartDate
()))
{
String
startDate
=
dto
.
getStartDate
();
String
startDate
=
dto
.
getStartDate
();
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/core/framework/GatewayIdAutowired.java
0 → 100644
View file @
833cde98
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
core
.
framework
;
import
java.lang.annotation.*
;
/**
* @author keyong
* @title: GatewayIdAutowired
* <pre>
* @description: TODO
* </pre>
* @date 2024/1/25 9:39
*/
@Target
(
ElementType
.
METHOD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
public
@interface
GatewayIdAutowired
{
/**
* 是否添加当前登录人的gatewayId为参数进行过滤权限查询
* @return boolean
*/
boolean
isNeedGatewayId
()
default
true
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/core/framework/GatewayIdAutowiredAspect.java
0 → 100644
View file @
833cde98
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
core
.
framework
;
import
com.alibaba.fastjson.JSON
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Before
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Modifier
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* @author keyong
* @title: GatewayIdAutowiredAspect
* <pre>
* @description: TODO
* </pre>
* @date 2024/1/25 10:21
*/
@Component
@Aspect
public
class
GatewayIdAutowiredAspect
{
private
static
final
transient
Logger
log
=
LoggerFactory
.
getLogger
(
GatewayIdAutowiredAspect
.
class
);
@Autowired
private
IPermissionService
permissionService
;
@Before
(
value
=
"@annotation(com.yeejoin.amos.boot.module.jxiop.biz.core.framework.GatewayIdAutowired) && @annotation(gatewayIdAutowired)"
)
public
void
doBefore
(
JoinPoint
joinPoint
,
GatewayIdAutowired
gatewayIdAutowired
)
{
if
(
gatewayIdAutowired
.
isNeedGatewayId
())
{
try
{
//获取入参列表
Object
[]
args
=
joinPoint
.
getArgs
();
log
.
info
(
"args: {}"
,
JSON
.
toJSONString
(
args
));
//入参判空
if
(
null
==
args
||
args
.
length
==
0
)
{
log
.
info
(
"No fields!"
);
return
;
}
// 只有一个参数主要针对@RequestBody,一般只会有一个入参,若遇到多个@RequestParam,需循环处理
if
(
args
.
length
==
1
)
{
Object
arg
=
args
[
0
];
List
<
String
>
ids
=
permissionService
.
getCurrentUserPermissions
();
//获取字段域
Field
[]
fields
=
arg
.
getClass
().
getDeclaredFields
();
log
.
info
(
"getDeclaredFields: {}"
,
JSON
.
toJSONString
(
fields
));
if
(
Arrays
.
stream
(
fields
).
noneMatch
(
item
->
"gatewayIds"
.
equals
(
item
.
getName
())))
{
log
.
info
(
"No gatewayId field !!!"
);
return
;
}
//入参中有"gatewayIds",获取该字段
Field
field
=
arg
.
getClass
().
getDeclaredField
(
"gatewayIds"
);
//判断是否可使用
boolean
accessible
=
((!
Modifier
.
isPublic
(
field
.
getModifiers
())
||
!
Modifier
.
isPublic
(
field
.
getDeclaringClass
().
getModifiers
())
||
Modifier
.
isFinal
(
field
.
getModifiers
()))
&&
!
field
.
isAccessible
());
//若不可用,则需要进行setAccessible
if
(
accessible
)
{
ServletRequestAttributes
attributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
// 获取request对象
HttpServletRequest
request
=
attributes
.
getRequest
();
log
.
info
(
"Method name: {}"
,
request
.
getRequestURI
());
field
.
setAccessible
(
true
);
//参数替换
field
.
set
(
arg
,
ids
);
}
}
// 若是get方法,有多个参数则需要扩展
}
catch
(
Exception
e
)
{
log
.
error
(
"切面参数设置异常"
,
e
);
}
}
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/dto/FanHealthIndexDto.java
View file @
833cde98
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.dto;
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.Data
;
import
org.apache.poi.ss.formula.functions.T
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -43,4 +44,5 @@ public class FanHealthIndexDto implements Serializable {
...
@@ -43,4 +44,5 @@ public class FanHealthIndexDto implements Serializable {
private
String
subarray
;
private
String
subarray
;
private
String
sortOne
;
private
String
sortOne
;
private
String
sortsString
;
private
String
sortsString
;
private
List
<
String
>
gatewayIds
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/dto/PvHealthIndexDto.java
View file @
833cde98
...
@@ -45,5 +45,5 @@ public class PvHealthIndexDto {
...
@@ -45,5 +45,5 @@ public class PvHealthIndexDto {
private
String
orderColumns
;
private
String
orderColumns
;
private
String
sortOne
;
private
String
sortOne
;
private
String
sortsString
;
private
String
sortsString
;
private
List
<
String
>
gatewayIds
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/tdengine2/FanWarningRecord.xml
View file @
833cde98
...
@@ -220,6 +220,11 @@
...
@@ -220,6 +220,11 @@
<if
test=
"dto.disposotionState!= null and dto.disposotionState!= ''"
>
AND disposotion_state = #{dto.disposotionState}
</if>
<if
test=
"dto.disposotionState!= null and dto.disposotionState!= ''"
>
AND disposotion_state = #{dto.disposotionState}
</if>
<if
test=
"dto.endDate!= null and dto.endDate!= '' "
>
and ts
<
= #{dto.endDate}
</if>
<if
test=
"dto.endDate!= null and dto.endDate!= '' "
>
and ts
<
= #{dto.endDate}
</if>
<if
test=
"dto.startDate!= null and dto.startDate!= ''"
>
and ts
>
= #{dto.startDate}
</if>
<if
test=
"dto.startDate!= null and dto.startDate!= ''"
>
and ts
>
= #{dto.startDate}
</if>
<if
test=
"dto.gatewayIds != null and dto.gatewayIds.size() > 0"
>
and GATEWAY_ID in
<foreach
item=
"item"
index=
"index"
collection=
"dto.gatewayIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</where>
</where>
<if
test=
"dto.orderColumns != null and dto.orderColumns != ''"
>
<if
test=
"dto.orderColumns != null and dto.orderColumns != ''"
>
order by ${dto.orderColumns}
order by ${dto.orderColumns}
...
@@ -242,6 +247,11 @@
...
@@ -242,6 +247,11 @@
<if
test=
"dto.disposotionState!= null and dto.disposotionState!= ''"
>
AND disposotion_state = #{dto.disposotionState}
</if>
<if
test=
"dto.disposotionState!= null and dto.disposotionState!= ''"
>
AND disposotion_state = #{dto.disposotionState}
</if>
<if
test=
"dto.endDate!= null and dto.endDate!= '' "
>
and ts
<
= #{dto.endDate}
</if>
<if
test=
"dto.endDate!= null and dto.endDate!= '' "
>
and ts
<
= #{dto.endDate}
</if>
<if
test=
"dto.startDate!= null and dto.startDate!= ''"
>
and ts
>
= #{dto.startDate}
</if>
<if
test=
"dto.startDate!= null and dto.startDate!= ''"
>
and ts
>
= #{dto.startDate}
</if>
<if
test=
"dto.gatewayIds != null and dto.gatewayIds.size() > 0"
>
and GATEWAY_ID in
<foreach
item=
"item"
index=
"index"
collection=
"dto.gatewayIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</where>
</where>
</select>
</select>
...
...
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