Browse Source

#运行月报

zhongwei
yang_shj 7 months ago
parent
commit
0025a49638
  1. 7
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java
  2. 14
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java
  3. 41
      hzims-service/operational/src/main/resources/db/2.0.2.sql

7
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmServiceImpl.java

@ -184,7 +184,7 @@ public class AlarmServiceImpl implements AlarmService {
query.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); query.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
query.setEndTime(LocalDateTime.parse(DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER)); query.setEndTime(LocalDateTime.parse(DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER));
calendar.add(Calendar.MINUTE,-360); calendar.add(Calendar.MINUTE,-10);
query.setBeginTime(LocalDateTime.parse(DateUtil.format(calendar.getTime() , DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER)); query.setBeginTime(LocalDateTime.parse(DateUtil.format(calendar.getTime() , DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER));
query.setNeedPage(false); query.setNeedPage(false);
query.setPage(1); query.setPage(1);
@ -207,6 +207,7 @@ public class AlarmServiceImpl implements AlarmService {
entity.setStationName(soeStations.get(0).getName()); entity.setStationName(soeStations.get(0).getName());
entity.setCreateDept(soeStations.get(0).getRefDept()); entity.setCreateDept(soeStations.get(0).getRefDept());
entity.setTenantId(soeStations.get(0).getTenantId()); entity.setTenantId(soeStations.get(0).getTenantId());
entity.setCreateUser(soeStations.get(0).getCreateUser());
} }
entity.setAlarmId(soe.getId()); entity.setAlarmId(soe.getId());
entity.setRealId(soe.getRealId()); entity.setRealId(soe.getRealId());
@ -230,11 +231,11 @@ public class AlarmServiceImpl implements AlarmService {
*/ */
private List<InterruptionEntity> saveInterruptions(List<String> stations) { private List<InterruptionEntity> saveInterruptions(List<String> stations) {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY)); calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND));
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
return this.interruptionAlarmService.list(Wrappers.<InterruptionEntity>lambdaQuery() return this.interruptionAlarmService.list(Wrappers.<InterruptionEntity>lambdaQuery()
.in(InterruptionEntity::getStationId,stations) .in(InterruptionEntity::getStationId,stations)
.ge(InterruptionEntity::getCreateTime,start) .ge(InterruptionEntity::getCreateTime,start)

14
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java

@ -686,8 +686,7 @@ public class ReportServiceImpl implements ReportService {
*/ */
private Double generate(int type,String deviceCode,double ride) { private Double generate(int type,String deviceCode,double ride) {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(DateUtil.parse("2024-01-01 00:00:00",DateUtil.PATTERN_DATETIME)); calendar.setTime(new Date());
//calendar.setTime(new Date());
String end = null,start = null; String end = null,start = null;
int cycleType = 5; int cycleType = 5;
switch (type){ switch (type){
@ -723,8 +722,7 @@ public class ReportServiceImpl implements ReportService {
*/ */
private Double planGenerate(int type, String stationCode,List<PlanGenerationEntity> plans) { private Double planGenerate(int type, String stationCode,List<PlanGenerationEntity> plans) {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(DateUtil.parse("2024-01-01 00:00:00",DateUtil.PATTERN_DATETIME)); calendar.setTime(new Date());
//calendar.setTime(new Date());
if(type == 0){ if(type == 0){
calendar.add(Calendar.DAY_OF_MONTH,-1); calendar.add(Calendar.DAY_OF_MONTH,-1);
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY) + 1); calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY) + 1);
@ -761,8 +759,7 @@ public class ReportServiceImpl implements ReportService {
// 确定查询时间范围: 年、月 // 确定查询时间范围: 年、月
Date startDate,endDate; Date startDate,endDate;
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(DateUtil.parse("2024-01-01 00:00:00",DateUtil.PATTERN_DATETIME)); calendar.setTime(new Date());
//calendar.setTime(new Date());
endDate = calendar.getTime(); endDate = calendar.getTime();
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
@ -835,7 +832,7 @@ public class ReportServiceImpl implements ReportService {
*/ */
private String alarmData(String code) { private String alarmData(String code) {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(DateUtil.parse("2024-01-01 00:00:00",DateUtil.PATTERN_DATETIME)); calendar.setTime(new Date());
calendar.add(Calendar.DAY_OF_MONTH,-1); calendar.add(Calendar.DAY_OF_MONTH,-1);
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.MONTH,-1); calendar.add(Calendar.MONTH,-1);
@ -942,8 +939,7 @@ public class ReportServiceImpl implements ReportService {
*/ */
private List<EchartVo> curve(List<AttributeVo> attributes, String deviceCode) { private List<EchartVo> curve(List<AttributeVo> attributes, String deviceCode) {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
//calendar.setTime(new Date()); calendar.setTime(new Date());
calendar.setTime(DateUtil.parse("2024-01-01 00:00:00",DateUtil.PATTERN_DATETIME));
calendar.add(Calendar.DAY_OF_MONTH,-1); calendar.add(Calendar.DAY_OF_MONTH,-1);
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.MONTH,-1); calendar.add(Calendar.MONTH,-1);

41
hzims-service/operational/src/main/resources/db/2.0.2.sql

@ -28,6 +28,26 @@ CREATE TABLE IF NOT EXISTS `HZIMS_OPER_CONSTRUCTION` (
PRIMARY KEY (`ID`) USING BTREE PRIMARY KEY (`ID`) USING BTREE
) ENGINE = INNODB CHARACTER SET = UTF8MB4 COLLATE = UTF8MB4_GENERAL_CI ROW_FORMAT = DYNAMIC; ) ENGINE = INNODB CHARACTER SET = UTF8MB4 COLLATE = UTF8MB4_GENERAL_CI ROW_FORMAT = DYNAMIC;
CREATE TABLE IF NOT EXISTS `HZIMS_RUN_MONTH_REPORT` (
`ID` bigint(20) NOT NULL COMMENT '主键ID',
`STATION_CODE` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点编码',
`STATION_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '站点名称',
`MONTH` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '月份 : \"yyyy-MM\"',
`RUN_DATA` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '运行数据',
`ALARM_DATA` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '告警数据',
`CURVE_DATA` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '曲线数据',
`ANALYSIS_DATA` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '分析数据',
`RUN_PROPOSE` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '运行建议',
`TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID',
`STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '业务状态',
`CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建单位',
`IS_DELETED` tinyint(4) NOT NULL DEFAULT 0,
`CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
`CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间',
`UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
`UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `HZIMS_AREA_MAP_CONFIG` ( CREATE TABLE IF NOT EXISTS `HZIMS_AREA_MAP_CONFIG` (
`ID` BIGINT(20) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT COMMENT '主键ID', `ID` BIGINT(20) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT COMMENT '主键ID',
@ -107,24 +127,3 @@ ALTER TABLE `HZIMS_OPER_ACCESS_TASK` ADD COLUMN `HANDLER_NAME` VARCHAR(255) CHAR
ALTER TABLE `HZIMS_OPER_ACCESS_TASK_DETAIL` ADD COLUMN `UPDATE_USER_NAME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '修改人名称' ; ALTER TABLE `HZIMS_OPER_ACCESS_TASK_DETAIL` ADD COLUMN `UPDATE_USER_NAME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '修改人名称' ;
ALTER TABLE `HZIMS_OPER_ACCESS_TASK_DETAIL` ADD COLUMN `CREATE_USER_NAME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '创建人名称' ; ALTER TABLE `HZIMS_OPER_ACCESS_TASK_DETAIL` ADD COLUMN `CREATE_USER_NAME` VARCHAR(255) CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI NULL DEFAULT NULL COMMENT '创建人名称' ;
CREATE TABLE IF NOT EXISTS `HZIMS_RUN_MONTH_REPORT` (
`ID` BIGINT(20) NOT NULL COMMENT '主键ID',
`STATION_CODE` VARCHAR(64) DEFAULT NULL COMMENT '站点编码',
`STATION_NAME` VARCHAR(255) DEFAULT NULL COMMENT '站点名称',
`MONTH` VARCHAR(255) DEFAULT NULL COMMENT '月份 : "YYYY-MM"',
`RUN_DATA` TEXT COMMENT '运行数据',
`ALARM_DATA` TEXT COMMENT '告警数据',
`CURVE_DATA` TEXT COMMENT '曲线数据',
`ANALYSIS_DATA` TEXT COMMENT '分析数据',
`RUN_PROPOSE` TEXT COMMENT '运行建议',
`TENANT_ID` VARCHAR(12) DEFAULT NULL COMMENT '租户ID',
`STATUS` TINYINT(4) DEFAULT NULL COMMENT '业务状态',
`CREATE_DEPT` BIGINT(20) DEFAULT NULL COMMENT '创建单位',
`IS_DELETED` TINYINT(4) NOT NULL DEFAULT '0',
`CREATE_USER` BIGINT(20) DEFAULT NULL COMMENT '创建人',
`CREATE_TIME` DATETIME DEFAULT NULL COMMENT '创建时间',
`UPDATE_USER` BIGINT(20) DEFAULT NULL COMMENT '修改人',
`UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`ID`)
) ENGINE=INNODB DEFAULT CHARSET=UTF8;
Loading…
Cancel
Save