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
00840374
Commit
00840374
authored
Nov 23, 2023
by
zhangsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
风电、光伏 健康指数页面 排序问题处理,兼容平台组件问题
parent
a7f257a3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
4 deletions
+59
-4
TdInfoQueryController.java
...ot/module/jxiop/biz/controller/TdInfoQueryController.java
+49
-4
FanHealthIndexDto.java
...oin/amos/boot/module/jxiop/biz/dto/FanHealthIndexDto.java
+2
-0
PvHealthIndexDto.java
...join/amos/boot/module/jxiop/biz/dto/PvHealthIndexDto.java
+2
-0
FanHealthIndex.xml
...iz/src/main/resources/mapper/tdengine2/FanHealthIndex.xml
+3
-0
PvHealthIndex.xml
...biz/src/main/resources/mapper/tdengine2/PvHealthIndex.xml
+3
-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 @
00840374
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
cn.hutool.core.text.CharSequenceUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.FanHealthIndexDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO
;
...
...
@@ -82,15 +84,31 @@ public class TdInfoQueryController {
}
Page
<
FanHealthIndex
>
resultPage
=
new
Page
<>(
dto
.
getCurrent
(),
dto
.
getSize
());
dto
.
setCurrent
((
dto
.
getCurrent
()
-
1
)
*
dto
.
getSize
());
if
(
CharSequenceUtil
.
isNotEmpty
(
dto
.
getSortsString
()))
{
ObjectMapper
objectMapper
=
new
ObjectMapper
();
try
{
List
<
Map
<
String
,
String
>>
list
=
objectMapper
.
readValue
(
dto
.
getSortsString
(),
new
TypeReference
<
List
<
Map
<
String
,
String
>>>(){});
dto
.
setSorts
(
list
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
List
<
Map
<
String
,
String
>>
orderWeight
=
dto
.
getSorts
().
stream
().
sorted
(
Comparator
.
comparing
(
t
->
Integer
.
parseInt
(
t
.
get
(
"orderWeight"
)))).
collect
(
Collectors
.
toList
());
List
<
String
>
orderByList
=
new
ArrayList
<>();
for
(
Map
<
String
,
String
>
map
:
orderWeight
)
{
String
replace
=
map
.
get
(
"order"
).
replace
(
"end"
,
""
);
String
columnOrder
=
map
.
get
(
"columnKey"
)
+
" "
+
replace
;
String
columnOrder
=
convert
(
map
.
get
(
"columnKey"
)
)
+
" "
+
replace
;
orderByList
.
add
(
columnOrder
);
}
String
join
=
String
.
join
(
","
,
orderByList
);
dto
.
setOrderColumns
(
join
);
if
(
CharSequenceUtil
.
isNotEmpty
(
dto
.
getSortOne
()))
{
String
[]
split
=
dto
.
getSortOne
().
split
(
","
);
String
replace
=
split
[
1
].
replace
(
"end"
,
""
);
String
orderColumn
=
convert
(
split
[
0
])
+
" "
+
replace
;
dto
.
setSortOne
(
orderColumn
);
}
List
<
FanHealthIndex
>
fanHealthIndexIPage
=
fanHealthIndexMapper
.
getInfoByPage
(
dto
);
Integer
infoByPageTotal
=
fanHealthIndexMapper
.
getInfoByPageTotal
(
dto
);
resultPage
.
setRecords
(
fanHealthIndexIPage
);
...
...
@@ -98,6 +116,19 @@ public class TdInfoQueryController {
return
ResponseHelper
.
buildResponse
(
resultPage
);
}
public
static
String
convert
(
String
camelCase
)
{
StringBuilder
result
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
camelCase
.
length
();
i
++)
{
char
currentChar
=
camelCase
.
charAt
(
i
);
if
(
Character
.
isUpperCase
(
currentChar
))
{
result
.
append
(
"_"
).
append
(
Character
.
toLowerCase
(
currentChar
));
}
else
{
result
.
append
(
currentChar
);
}
}
return
result
.
toString
();
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
value
=
"/getPvHealthIndexInfo"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"分页查询健康指数信息 - 光伏"
,
notes
=
"分页查询健康指数信息 - 光伏"
)
...
...
@@ -114,16 +145,30 @@ public class TdInfoQueryController {
String
endDateString
=
DateUtils
.
dateFormat
(
DateUtils
.
dateAddHours
(
endDateDate
,
-
8
),
DATE_TIME_PATTERN
);
dto
.
setEndDate
(
endDateString
);
}
if
(
CharSequenceUtil
.
isNotEmpty
(
dto
.
getSortsString
()))
{
ObjectMapper
objectMapper
=
new
ObjectMapper
();
try
{
List
<
Map
<
String
,
String
>>
list
=
objectMapper
.
readValue
(
dto
.
getSortsString
(),
new
TypeReference
<
List
<
Map
<
String
,
String
>>>(){});
dto
.
setSorts
(
list
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
Page
<
PvHealthIndex
>
resultPage
=
new
Page
<>(
dto
.
getCurrent
(),
dto
.
getSize
());
dto
.
setCurrent
((
dto
.
getCurrent
()
-
1
)
*
dto
.
getSize
());
List
<
Map
<
String
,
String
>>
orderWeight
=
dto
.
getSorts
().
stream
().
sorted
(
Comparator
.
comparing
(
t
->
Integer
.
parseInt
(
t
.
get
(
"orderWeight"
)))).
collect
(
Collectors
.
toList
());
List
<
String
>
orderByList
=
new
ArrayList
<>();
for
(
Map
<
String
,
String
>
map
:
orderWeight
)
{
String
replace
=
map
.
get
(
"order"
).
replace
(
"end"
,
""
);
String
columnOrder
=
map
.
get
(
"columnKey"
)
+
" "
+
replace
;
String
columnOrder
=
convert
(
map
.
get
(
"columnKey"
)
)
+
" "
+
replace
;
orderByList
.
add
(
columnOrder
);
}
if
(
CharSequenceUtil
.
isNotEmpty
(
dto
.
getSortOne
()))
{
String
[]
split
=
dto
.
getSortOne
().
split
(
","
);
String
replace
=
split
[
1
].
replace
(
"end"
,
""
);
String
orderColumn
=
convert
(
split
[
0
])
+
" "
+
replace
;
dto
.
setSortOne
(
orderColumn
);
}
String
join
=
String
.
join
(
","
,
orderByList
);
dto
.
setOrderColumns
(
join
);
List
<
PvHealthIndex
>
pvHealthIndexIPage
=
pvHealthIndexMapper
.
getInfoByPage
(
dto
);
...
...
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 @
00840374
...
...
@@ -41,4 +41,6 @@ public class FanHealthIndexDto implements Serializable {
private
String
warningStatus
;
private
String
disposotionState
;
private
String
subarray
;
private
String
sortOne
;
private
String
sortsString
;
}
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 @
00840374
...
...
@@ -43,5 +43,7 @@ public class PvHealthIndexDto {
private
Integer
current
;
private
Integer
size
;
private
String
orderColumns
;
private
String
sortOne
;
private
String
sortsString
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/tdengine2/FanHealthIndex.xml
View file @
00840374
...
...
@@ -174,6 +174,9 @@
<if
test=
"dto.orderColumns != null and dto.orderColumns != ''"
>
order by ${dto.orderColumns}
</if>
<if
test=
"(dto.orderColumns == null or dto.orderColumns == '') and dto.sortOne != null and dto.sortOne != ''"
>
order by ${dto.sortOne}
</if>
limit #{dto.current}, #{dto.size}
</select>
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/tdengine2/PvHealthIndex.xml
View file @
00840374
...
...
@@ -205,6 +205,9 @@
<if
test=
"dto.orderColumns != null and dto.orderColumns != ''"
>
order by ${dto.orderColumns}
</if>
<if
test=
"(dto.orderColumns == null or dto.orderColumns == '') and dto.sortOne != null and dto.sortOne != ''"
>
order by ${dto.sortOne}
</if>
limit #{dto.current}, #{dto.size}
</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