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
9736b415
Commit
9736b415
authored
Aug 12, 2024
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
风电健康指数查询优化
parent
ac0daddf
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
17 deletions
+68
-17
DateUtils.java
...ava/com/yeejoin/amos/boot/biz/common/utils/DateUtils.java
+48
-7
TdInfoQueryController.java
...ot/module/jxiop/biz/controller/TdInfoQueryController.java
+0
-0
FanHealthIndexDto.java
...oin/amos/boot/module/jxiop/biz/dto/FanHealthIndexDto.java
+3
-0
PvHealthIndexDto.java
...join/amos/boot/module/jxiop/biz/dto/PvHealthIndexDto.java
+3
-0
PvHealthIndex.xml
...biz/src/main/resources/mapper/tdengine2/PvHealthIndex.xml
+14
-10
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/DateUtils.java
View file @
9736b415
...
...
@@ -8,6 +8,7 @@ import java.text.SimpleDateFormat;
import
java.time.Duration
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
...
...
@@ -664,13 +665,6 @@ public class DateUtils {
/*System.out.println(dateFormat(maxDateOfMonth(dateParse("2016-02", "yyyy-MM")), null));
System.out.println(dateFormat(minDateOfMonth(dateParse("2016-03-31", null)), null));*/
// System.out.println(dateFormat(new Date(), CHN_DATE_PATTERN_YEAR));
// System.out.println(dateFormat(new Date(), CHN_DATE_PATTERN_MONTH));
// System.out.println(getWeekOfYear(new Date()));
// System.out.println(getQuarterStr(getMonth(dateParse("2021-5-11", null))));
// System.out.println(getWeekBeginDate(dateParse("2021-10-11", null)));
// System.out.println(getWeekEndDate(dateParse("2021-10-11", null)));
System
.
out
.
println
(
secondsToTimeStr
(
3600
));
List
<
String
>
beforeCurrentMonth
=
getBeforeCurrentMonth
(
3
,
true
);
System
.
out
.
println
(
beforeCurrentMonth
);
...
...
@@ -688,6 +682,53 @@ public class DateUtils {
return
name
;
}
//获取当前时间下一整时分点 例如 传入17:18 返回 17:20
public
static
String
getNextWholeMinute
(
String
currentTimeString
)
{
// 定义日期时间字符串的格式
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
// 将字符串转换为 LocalDateTime
LocalDateTime
currentTime
=
LocalDateTime
.
parse
(
currentTimeString
,
formatter
);
int
currentMinute
=
currentTime
.
getMinute
();
int
seconds
=
currentTime
.
getSecond
();
int
nanos
=
currentTime
.
getNano
();
// 如果当前分钟已经是整时分点,则加上 60 分钟
if
(
currentMinute
%
10
==
0
&&
seconds
==
0
&&
nanos
==
0
)
{
return
currentTimeString
;
}
// 否则计算下一个整时分点
LocalDateTime
localDateTime
=
currentTime
.
withSecond
(
0
).
withNano
(
0
).
plusMinutes
(
10
-
currentMinute
%
10
);
return
localDateTime
.
format
(
formatter
);
}
//获取当前时间下一整时分点 例如 传入17:18 返回 17:20
public
static
String
getBeforeWholeMinute
(
String
currentTimeString
)
{
// 定义日期时间字符串的格式
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
// 将字符串转换为 LocalDateTime
LocalDateTime
currentTime
=
LocalDateTime
.
parse
(
currentTimeString
,
formatter
);
int
currentMinute
=
currentTime
.
getMinute
();
int
seconds
=
currentTime
.
getSecond
();
int
nanos
=
currentTime
.
getNano
();
// 如果当前分钟已经是整时分点,则加上 60 分钟
if
(
currentMinute
%
10
==
0
&&
seconds
==
0
&&
nanos
==
0
)
{
return
currentTimeString
;
}
// 否则计算下一个整时分点
LocalDateTime
localDateTime
=
currentTime
.
withSecond
(
0
).
withNano
(
0
).
minusMinutes
(
currentMinute
%
10
);
return
localDateTime
.
format
(
formatter
);
}
/**
* 获取某月的日期List
*
...
...
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 @
9736b415
This diff is collapsed.
Click to expand it.
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 @
9736b415
...
...
@@ -47,4 +47,7 @@ public class FanHealthIndexDto implements Serializable {
private
String
orgCode
;
private
List
<
String
>
gatewayIds
;
private
String
warningPeriod
;
private
String
tableName
;
private
Long
startDateTs
;
private
Long
endDateTs
;
}
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 @
9736b415
...
...
@@ -46,5 +46,8 @@ public class PvHealthIndexDto {
private
String
sortOne
;
private
String
sortsString
;
private
String
orgCode
;
private
String
tableName
;
private
Long
startDateTs
;
private
Long
endDateTs
;
private
List
<
String
>
gatewayIds
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/tdengine2/PvHealthIndex.xml
View file @
9736b415
...
...
@@ -199,12 +199,12 @@
</select>
<select
id=
"getInfoByPage"
resultType=
"com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex"
>
SELECT * FROM
pv_health_index_data
SELECT * FROM
${dto.tableName}
<where>
<if
test=
"dto.analysisObjType!= null and dto.analysisObjType!= ''"
>
analysis_obj_type = #{dto.analysisObjType}
</if>
<if
test=
"dto.analysisType!= null and dto.analysisType!= ''"
>
and analysis_type = #{dto.analysisType}
</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.endDate
Ts!= null and dto.endDateTs!= ''"
>
and ts
<
= #{dto.endDateTs
}
</if>
<if
test=
"dto.startDate
Ts!= null and dto.startDateTs!= ''"
>
and ts
>
= #{dto.startDateTs
}
</if>
<if
test=
"dto.area!= null and dto.area!= ''"
>
AND area = #{dto.area}
</if>
<if
test=
"dto.subarray!= null and dto.subarray!= ''"
>
AND subarray = #{dto.subarray}
</if>
<if
test=
"dto.pointName!= null and dto.pointName!= ''"
>
AND point_name = #{dto.pointName}
</if>
...
...
@@ -226,13 +226,18 @@
limit #{dto.current}, #{dto.size}
</select>
<select
id=
"getTsByRecDate"
resultType=
"long"
>
SELECT ts FROM analysis_data.${tableName}
where rec_date = #{recDate} order by ts ${sort} limit 1 ;
</select>
<select
id=
"getInfoByPageTotal"
resultType=
"java.lang.Integer"
>
SELECT count(1) FROM pv_health_index_data
<where>
<if
test=
"dto.analysisObjType!= null and dto.analysisObjType!= ''"
>
analysis_obj_type = #{dto.analysisObjType}
</if>
<if
test=
"dto.analysisType!= null and dto.analysisType!= ''"
>
and analysis_type = #{dto.analysisType}
</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.endDate
Ts!= null and dto.endDateTs!= ''"
>
and ts
<
= #{dto.endDateTs
}
</if>
<if
test=
"dto.startDate
Ts!= null and dto.startDateTs!= ''"
>
and ts
>
= #{dto.startDateTs
}
</if>
<if
test=
"dto.area!= null and dto.area!= ''"
>
AND area = #{dto.area}
</if>
<if
test=
"dto.subarray!= null and dto.subarray!= ''"
>
AND subarray = #{dto.subarray}
</if>
<if
test=
"dto.pointName!= null and dto.pointName!= ''"
>
AND point_name = #{dto.pointName}
</if>
...
...
@@ -320,13 +325,12 @@
</select>
<insert
id=
"saveBatchHealthIndexListNew"
>
insert into ${tableName}
using
pv_health_index_data_new TAGS (#{analysisTyp
e})
insert into
analysis_data.
${tableName}
using
analysis_data.pv_health_index_data_new TAGS (#{analysisType},#{recDat
e})
values
<foreach
collection=
"list"
separator=
","
item=
"item"
index=
"index"
>
(
now,
#{item.recDate, jdbcType=VARCHAR},
#{item.analysisObjType, jdbcType=VARCHAR},
#{item.analysisObjSeq, jdbcType=VARCHAR},
#{item.weight, jdbcType=FLOAT},
...
...
@@ -344,9 +348,9 @@
#{item.indexAddress, jdbcType=VARCHAR},
#{item.anomaly, jdbcType=FLOAT},
#{item.pointName, jdbcType=VARCHAR},
#{item.orgCode, jdbcType=VARCHAR},
#{item.analysisTime, jdbcType=VARCHAR},
#{item.kks, jdbcType=VARCHAR},
#{item.orgCode, jdbcType=VARCHAR}
#{item.kks, jdbcType=VARCHAR}
)
</foreach>
</insert>
...
...
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