Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
E
energyai_java
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
葛齐林
energyai_java
Commits
b845d14a
Commit
b845d14a
authored
Jun 17, 2024
by
史志龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资阳西站提交初版--shizhilong
parent
66773fa3
Changes
60
Show whitespace changes
Inline
Side-by-side
Showing
60 changed files
with
3024 additions
and
662 deletions
+3024
-662
InitRunner.java
...a/com/devplatform/admin/common/scheduling/InitRunner.java
+9
-8
SimpleJob.java
...va/com/devplatform/admin/common/scheduling/SimpleJob.java
+16
-5
Constants.java
...in/java/com/devplatform/admin/common/utils/Constants.java
+33
-0
KqcljInfo.java
...java/com/devplatform/admin/modules/eq/bean/KqcljInfo.java
+39
-0
KqcljInfoHour.java
.../com/devplatform/admin/modules/eq/bean/KqcljInfoHour.java
+36
-0
SwqxzInfo.java
...java/com/devplatform/admin/modules/eq/bean/SwqxzInfo.java
+7
-0
SwqxzInfoHour.java
.../com/devplatform/admin/modules/eq/bean/SwqxzInfoHour.java
+3
-0
TimedTask.java
...java/com/devplatform/admin/modules/eq/bean/TimedTask.java
+4
-1
WarnInfo.java
.../java/com/devplatform/admin/modules/eq/bean/WarnInfo.java
+50
-0
ZyFlrbInfo.java
...ava/com/devplatform/admin/modules/eq/bean/ZyFlrbInfo.java
+60
-0
ZyJfktpInfo.java
...va/com/devplatform/admin/modules/eq/bean/ZyJfktpInfo.java
+76
-0
AnalysisController.java
...tform/admin/modules/eq/controller/AnalysisController.java
+27
-1
EquipmentController.java
...form/admin/modules/eq/controller/EquipmentController.java
+539
-442
EquipmentController2.java
...orm/admin/modules/eq/controller/EquipmentController2.java
+511
-0
EquipmentController3.java
...orm/admin/modules/eq/controller/EquipmentController3.java
+577
-0
KqcljInfoDao.java
...va/com/devplatform/admin/modules/eq/dao/KqcljInfoDao.java
+22
-0
KqcljInfoHourDao.java
...om/devplatform/admin/modules/eq/dao/KqcljInfoHourDao.java
+21
-0
SnqxzInfoDao.java
...va/com/devplatform/admin/modules/eq/dao/SnqxzInfoDao.java
+2
-0
SwqxzInfoDao.java
...va/com/devplatform/admin/modules/eq/dao/SwqxzInfoDao.java
+2
-0
WarnInfoDao.java
...ava/com/devplatform/admin/modules/eq/dao/WarnInfoDao.java
+16
-0
ZyFlrbInfoDao.java
...a/com/devplatform/admin/modules/eq/dao/ZyFlrbInfoDao.java
+25
-0
ZyJfktpInfoDao.java
.../com/devplatform/admin/modules/eq/dao/ZyJfktpInfoDao.java
+23
-0
AnalysisService.java
...devplatform/admin/modules/eq/service/AnalysisService.java
+2
-0
EquipmentService.java
...evplatform/admin/modules/eq/service/EquipmentService.java
+2
-0
KqcljInfoHourService.java
...atform/admin/modules/eq/service/KqcljInfoHourService.java
+19
-0
KqcljInfoService.java
...evplatform/admin/modules/eq/service/KqcljInfoService.java
+22
-0
SnqxzInfoService.java
...evplatform/admin/modules/eq/service/SnqxzInfoService.java
+2
-0
SwqxzInfoService.java
...evplatform/admin/modules/eq/service/SwqxzInfoService.java
+1
-0
WarnInfoService.java
...devplatform/admin/modules/eq/service/WarnInfoService.java
+18
-0
ZyFlrbInfoService.java
...vplatform/admin/modules/eq/service/ZyFlrbInfoService.java
+21
-0
ZyJfktpInfoService.java
...platform/admin/modules/eq/service/ZyJfktpInfoService.java
+21
-0
AnalysisServiceImpl.java
...rm/admin/modules/eq/service/impl/AnalysisServiceImpl.java
+172
-123
EquipmentServiceImpl.java
...m/admin/modules/eq/service/impl/EquipmentServiceImpl.java
+151
-35
FlrbInfoServiceImpl.java
...rm/admin/modules/eq/service/impl/FlrbInfoServiceImpl.java
+2
-1
JfktpInfoServiceImpl.java
...m/admin/modules/eq/service/impl/JfktpInfoServiceImpl.java
+2
-1
KqcljInfoHourServiceImpl.java
...min/modules/eq/service/impl/KqcljInfoHourServiceImpl.java
+25
-0
KqcljServiceImpl.java
...tform/admin/modules/eq/service/impl/KqcljServiceImpl.java
+47
-0
SnqxzInfoServiceImpl.java
...m/admin/modules/eq/service/impl/SnqxzInfoServiceImpl.java
+5
-0
SwqxzInfoServiceImpl.java
...m/admin/modules/eq/service/impl/SwqxzInfoServiceImpl.java
+4
-0
WarnInfoServiceImpl.java
...rm/admin/modules/eq/service/impl/WarnInfoServiceImpl.java
+24
-0
ZyFlrbInfoServiceImpl.java
.../admin/modules/eq/service/impl/ZyFlrbInfoServiceImpl.java
+35
-0
ZyJfktpInfoServiceImpl.java
...admin/modules/eq/service/impl/ZyJfktpInfoServiceImpl.java
+35
-0
LiResourceDao.java
...vplatform/admin/modules/liresource/dao/LiResourceDao.java
+2
-0
LiResourceService.java
...m/admin/modules/liresource/service/LiResourceService.java
+2
-0
LiResourceServiceImpl.java
...odules/liresource/service/impl/LiResourceServiceImpl.java
+4
-0
SysLoginController.java
...form/admin/modules/sys/controller/SysLoginController.java
+4
-4
application.yml
microservice-admin/src/main/resources/application.yml
+4
-0
FlrbInfoMapper.xml
...ice-admin/src/main/resources/mapper/eq/FlrbInfoMapper.xml
+32
-32
JfktpInfoMapper.xml
...ce-admin/src/main/resources/mapper/eq/JfktpInfoMapper.xml
+1
-1
KqcljInfoHourMapper.xml
...dmin/src/main/resources/mapper/eq/KqcljInfoHourMapper.xml
+47
-0
KqcljInfoMapper.xml
...ce-admin/src/main/resources/mapper/eq/KqcljInfoMapper.xml
+48
-0
SnqxzInfoMapper.xml
...ce-admin/src/main/resources/mapper/eq/SnqxzInfoMapper.xml
+9
-1
SwqxzInfoHourMapper.xml
...dmin/src/main/resources/mapper/eq/SwqxzInfoHourMapper.xml
+3
-1
SwqxzInfoMapper.xml
...ce-admin/src/main/resources/mapper/eq/SwqxzInfoMapper.xml
+9
-3
WarnInfoMapper.xml
...ice-admin/src/main/resources/mapper/eq/WarnInfoMapper.xml
+6
-0
ZyFlrbInfoMapper.xml
...e-admin/src/main/resources/mapper/eq/ZyFlrbInfoMapper.xml
+66
-0
ZyJfktpInfoMapper.xml
...-admin/src/main/resources/mapper/eq/ZyJfktpInfoMapper.xml
+70
-0
LiResourceMapper.xml
...src/main/resources/mapper/liResource/LiResourceMapper.xml
+5
-0
SysFaulalarmMapper.xml
...dmin/src/main/resources/mapper/sys/SysFaulalarmMapper.xml
+2
-1
application-dev.yml
...vice-config-server/src/main/resources/application-dev.yml
+2
-2
No files found.
microservice-admin/src/main/java/com/devplatform/admin/common/scheduling/InitRunner.java
View file @
b845d14a
...
...
@@ -36,16 +36,17 @@ public class InitRunner implements CommandLineRunner {
List
<
TimedTask
>
timedTasks
=
timedTaskService
.
list
(
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getStatus
,
Constants
.
INT_1
));
if
(
timedTasks
!=
null
&&
timedTasks
.
size
()
>
0
){
for
(
TimedTask
timedTask
:
timedTasks
){
//人工模式
if
(
sysSystemParams
.
getType
()
==
1
&&
timedTask
.
getBusinessType
()
!=
Constants
.
INT_3
)
{
// R r = equipmentController.timedTask(timedTask.getId(), timedTask.getStartTime(), timedTask.getEndTime(), Constants.INT_1,
// timedTask.getBusinessType(), timedTask.getType(), Constants.STRING_1,Constants.INT_3);
// if (!Constants.STRING_0.equals(r.get(Constants.CODE_WORD).toString())) {
// System.err.println("定时任务启动失败!!");
// }
}
else
if
(
sysSystemParams
.
getType
()
==
2
&&
timedTask
.
getBusinessType
()
==
Constants
.
INT_3
)
{
//开启节能大小循环
R
r
=
equipmentController
.
timedTask
(
timedTask
.
getId
(),
timedTask
.
getStartTime
(),
timedTask
.
getEndTime
(),
Constants
.
INT_1
,
timedTask
.
getBusinessType
(),
timedTask
.
getType
(),
Constants
.
STRING_1
);
if
(!
Constants
.
STRING_0
.
equals
(
r
.
get
(
Constants
.
CODE_WORD
).
toString
()))
{
System
.
err
.
println
(
"定时任务启动失败!!"
);
}
}
else
if
(
sysSystemParams
.
getType
()
==
2
&&
timedTask
.
getBusinessType
()
==
Constants
.
INT_3
)
{
R
r
=
equipmentController
.
timedTask
(
timedTask
.
getId
(),
timedTask
.
getStartTime
(),
timedTask
.
getEndTime
(),
Constants
.
INT_1
,
timedTask
.
getBusinessType
(),
timedTask
.
getType
(),
Constants
.
STRING_1
);
timedTask
.
getBusinessType
(),
timedTask
.
getType
(),
Constants
.
STRING_1
,
timedTask
.
getBusinessSonType
());
if
(!
Constants
.
STRING_0
.
equals
(
r
.
get
(
Constants
.
CODE_WORD
).
toString
()))
{
System
.
err
.
println
(
"定时任务启动失败!!"
);
}
...
...
microservice-admin/src/main/java/com/devplatform/admin/common/scheduling/SimpleJob.java
View file @
b845d14a
...
...
@@ -26,6 +26,7 @@ public class SimpleJob implements Job {
Integer
status
=
(
Integer
)
jobDataMap
.
get
(
"status"
);
Integer
type
=
(
Integer
)
jobDataMap
.
get
(
"type"
);
Integer
businessType
=
(
Integer
)
jobDataMap
.
get
(
"businessType"
);
Integer
businessSonType
=
(
Integer
)
jobDataMap
.
get
(
"businessSonType"
);
Map
<
String
,
String
>
postParam
=
new
HashMap
<
String
,
String
>(
10
);
...
...
@@ -49,12 +50,22 @@ public class SimpleJob implements Job {
}
}
else
if
(
businessType
==
Constants
.
INT_3
){
LOG
.
info
(
"执行节能任务"
);
if
(
businessSonType
==
Constants
.
INT_1
){
String
postUrl
=
"http://localhost:8089/command/energyTask"
;
Map
<
String
,
Object
>
resultMap
=
TestClient
.
uploadText
(
postUrl
,
postParam
);
Map
<
String
,
Object
>
map
=
null
;
if
(
Constants
.
STRING_200
.
equals
(
resultMap
.
get
(
Constants
.
STATUS_CODE
).
toString
()))
{
map
=
JSONObject
.
parseObject
(
resultMap
.
get
(
"data"
).
toString
(),
Map
.
class
);
}
}
else
if
(
businessSonType
==
Constants
.
INT_2
){
String
postUrl
=
"http://localhost:8089/command/energyTask2"
;
Map
<
String
,
Object
>
resultMap
=
TestClient
.
uploadText
(
postUrl
,
postParam
);
Map
<
String
,
Object
>
map
=
null
;
if
(
Constants
.
STRING_200
.
equals
(
resultMap
.
get
(
Constants
.
STATUS_CODE
).
toString
()))
{
map
=
JSONObject
.
parseObject
(
resultMap
.
get
(
"data"
).
toString
(),
Map
.
class
);
}
}
}
}
}
microservice-admin/src/main/java/com/devplatform/admin/common/utils/Constants.java
View file @
b845d14a
...
...
@@ -697,5 +697,38 @@ public class Constants {
* 右热泵主机2
*/
public
static
final
String
ID_FLRBJZ_4
=
"21b83b939a3848ae8a38368a59ca0004"
;
/**
* 组合式空调机组A
*/
public
static
final
String
KTJZ_A
=
"组合式空调机组A"
;
/**
* 组合式空调机组C
*/
public
static
final
String
KTJZ_C
=
"组合式空调机组C"
;
/**
* 一体化风冷热泵A
*/
public
static
final
String
FLRB_A
=
"一体化风冷热泵A"
;
/**
* 一体化风冷热泵C
*/
public
static
final
String
FLRB_C
=
"一体化风冷热泵C"
;
/**设备类型ID*/
/**
* 资阳西站空调机组
*/
public
static
final
String
ZY_KTJZ
=
"2"
;
/**
* 资阳西站一体化风冷热泵机组
*/
public
static
final
String
ZY_FLRB
=
"3"
;
/**
* 资阳西站空气处理机
*/
public
static
final
String
ZY_KQCLJ
=
"1"
;
/**
* 资阳西站全部能耗统计
*/
public
static
final
String
ZY_QB
=
"999"
;
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/bean/KqcljInfo.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
bean
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author dxw
*/
@Data
@ApiModel
(
value
=
"空气处理器信息对象"
,
description
=
"空气处理器信息对象"
)
@TableName
(
"kqclj_info"
)
public
class
KqcljInfo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** 主键id */
@ApiModelProperty
(
value
=
"主键ID"
,
name
=
"id"
)
@TableId
private
String
id
;
/** 资源点id */
@ApiModelProperty
(
value
=
"资源点id"
,
name
=
"resourceId"
)
private
String
resourceId
;
/** 空气处理机能耗 */
@ApiModelProperty
(
value
=
"空气处理机能耗"
,
name
=
"energy"
)
private
String
energy
;
/** 类型(1手动,2节能) */
@ApiModelProperty
(
value
=
"类型(1手动,2节能)"
,
name
=
"type"
)
private
Integer
type
;
/** 站点表id */
@ApiModelProperty
(
value
=
"站点表id"
,
name
=
"stationId"
)
private
String
stationId
;
/** 创建时间 */
@ApiModelProperty
(
value
=
"创建时间"
,
name
=
"createTime"
)
private
java
.
util
.
Date
createTime
;
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/bean/KqcljInfoHour.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
bean
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
@ApiModel
(
value
=
"空气处理机信息-时对象"
,
description
=
"空气处理机信息-时对象"
)
@TableName
(
"kqclj_info_hour"
)
public
class
KqcljInfoHour
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** 主键id */
@ApiModelProperty
(
value
=
"主键ID"
,
name
=
"id"
)
@TableId
private
String
id
;
/** 资源点id */
@ApiModelProperty
(
value
=
"资源点id"
,
name
=
"resourceId"
)
private
String
resourceId
;
/** 空气处理机能耗 */
@ApiModelProperty
(
value
=
"空气处理机能耗"
,
name
=
"electricEnergy"
)
private
String
electricEnergy
;
/** 类型(1手动,2节能) */
@ApiModelProperty
(
value
=
"类型(1手动,2节能)"
,
name
=
"type"
)
private
Integer
type
;
/** 站点表id */
@ApiModelProperty
(
value
=
"站点表id"
,
name
=
"stationId"
)
private
String
stationId
;
/** 创建时间 */
@ApiModelProperty
(
value
=
"创建时间"
,
name
=
"createTime"
)
private
java
.
util
.
Date
createTime
;
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/bean/SwqxzInfo.java
View file @
b845d14a
...
...
@@ -36,6 +36,9 @@ public class SwqxzInfo implements Serializable {
/** 风向 */
@ApiModelProperty
(
value
=
"风向"
,
name
=
"windDirection"
)
private
java
.
lang
.
String
windDirection
;
/** 风向360 */
@ApiModelProperty
(
value
=
"风向360"
,
name
=
"windDirectionNum"
)
private
String
windDirectionNum
;
/** 光照度 */
@ApiModelProperty
(
value
=
"光照度"
,
name
=
"illuminance"
)
private
java
.
lang
.
String
illuminance
;
...
...
@@ -51,6 +54,10 @@ public class SwqxzInfo implements Serializable {
/** 电表通讯故障 */
@ApiModelProperty
(
value
=
"电表通讯故障"
,
name
=
"communicationFailure"
)
private
java
.
lang
.
String
communicationFailure
;
/** 气压 */
@ApiModelProperty
(
value
=
"气压"
,
name
=
"pressure"
)
private
java
.
lang
.
String
pressure
;
/** 类型(1手动,2节能) */
@ApiModelProperty
(
value
=
"类型(1手动,2节能)"
,
name
=
"type"
)
private
Integer
type
;
...
...
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/bean/SwqxzInfoHour.java
View file @
b845d14a
...
...
@@ -46,6 +46,9 @@ public class SwqxzInfoHour implements Serializable {
/** 辐射 */
@ApiModelProperty
(
value
=
"辐射"
,
name
=
"radiation"
)
private
java
.
lang
.
String
radiation
;
/** 气压 */
@ApiModelProperty
(
value
=
"气压"
,
name
=
"pressure"
)
private
java
.
lang
.
String
pressure
;
/** 类型(1手动,2节能) */
@ApiModelProperty
(
value
=
"类型(1手动,2节能)"
,
name
=
"type"
)
private
Integer
type
;
...
...
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/bean/TimedTask.java
View file @
b845d14a
...
...
@@ -54,7 +54,7 @@ public class TimedTask implements Serializable {
/** 备用项3 */
@ApiModelProperty
(
value
=
"备用项3"
,
name
=
"byx3"
)
private
java
.
lang
.
String
byx3
;
/** 业务类型(1
候车大厅全局 2 电动门帘
) */
/** 业务类型(1
人工 3节能
) */
@ApiModelProperty
(
value
=
"业务类型(1 候车大厅全局 2 电动门帘)"
,
name
=
"businessType"
)
private
Integer
businessType
;
/** 类型(1 上升 2 下降) */
...
...
@@ -63,4 +63,7 @@ public class TimedTask implements Serializable {
/** 温度 */
@ApiModelProperty
(
value
=
"温度"
,
name
=
"temperature"
)
private
java
.
lang
.
String
temperature
;
/** 业务子类型:节能(1:大循环,2:小循环)3:人工模式 */
@ApiModelProperty
(
value
=
"业务子类型:节能(1:大循环,2:小循环)3:人工模式"
,
name
=
"businessSonType"
)
private
Integer
businessSonType
;
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/bean/WarnInfo.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
bean
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @author dxw
*/
@Data
@ApiModel
(
value
=
"算法模块预警信息表"
,
description
=
"算法模块预警信息表"
)
@TableName
(
"warn_info"
)
public
class
WarnInfo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** 主键id */
@ApiModelProperty
(
value
=
"主键ID"
,
name
=
"id"
)
@TableId
private
String
id
;
/** 预警类型(1:数值范围错误,2:网络问题连接不上,3:空调机组滤网压差故障,4:空调机组故障,5:恢复) */
@ApiModelProperty
(
value
=
"预警类型"
,
name
=
"infoStatus"
)
private
Integer
infoStatus
;
/** 资源点id */
@ApiModelProperty
(
value
=
"资源点id"
,
name
=
"resourceId"
)
private
String
resourceId
;
/** 资源点名称 */
@ApiModelProperty
(
value
=
"资源点名称"
,
name
=
"resourceName"
)
private
String
resourceName
;
/** 点位名称 */
@ApiModelProperty
(
value
=
"点位名称"
,
name
=
"pointName"
)
private
String
pointName
;
/** 点位id */
@ApiModelProperty
(
value
=
"点位id"
,
name
=
"pointId"
)
private
String
pointId
;
/** 预警信息 */
@ApiModelProperty
(
value
=
"预警信息"
,
name
=
"info"
)
private
String
info
;
/** 创建时间 */
@ApiModelProperty
(
value
=
"创建时间"
,
name
=
"createTime"
)
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/bean/ZyFlrbInfo.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
bean
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author dxw
*/
@Data
@ApiModel
(
value
=
"资阳西站风冷热泵机组信息对象"
,
description
=
"风冷热泵机组信息对象"
)
@TableName
(
"zy_flrb_info"
)
public
class
ZyFlrbInfo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** 主键id */
@ApiModelProperty
(
value
=
"主键ID"
,
name
=
"id"
)
@TableId
private
String
id
;
/** 资源点id */
@ApiModelProperty
(
value
=
"资源点id"
,
name
=
"resourceId"
)
private
String
resourceId
;
/** 供水实时温度 */
@ApiModelProperty
(
value
=
"供水温度"
,
name
=
"waterSupplyTemperature"
)
private
String
waterSupplyTemperature
;
/** 回水实时温度 */
@ApiModelProperty
(
value
=
"回水温度"
,
name
=
"returnWaterTemperature"
)
private
String
returnWaterTemperature
;
/** 总管水流量 */
@ApiModelProperty
(
value
=
"总管水流量"
,
name
=
"waterRate"
)
private
String
waterRate
;
/** 制热温度 */
@ApiModelProperty
(
value
=
"制热温度"
,
name
=
"heatingTem"
)
private
String
heatingTem
;
/** 制冷温度 */
@ApiModelProperty
(
value
=
"制冷温度"
,
name
=
"refrigerationTem"
)
private
String
refrigerationTem
;
/** 制冷制热模式切换 */
@ApiModelProperty
(
value
=
"制冷制热模式切换"
,
name
=
"switchMode"
)
private
String
switchMode
;
/** 主机状态 */
@ApiModelProperty
(
value
=
"主机状态"
,
name
=
"hostStatus"
)
private
String
hostStatus
;
/** 冷热源能耗 */
@ApiModelProperty
(
value
=
"冷热源能耗"
,
name
=
"energy"
)
private
String
energy
;
/** 类型(1手动,2节能) */
@ApiModelProperty
(
value
=
"类型(1手动,2节能)"
,
name
=
"type"
)
private
Integer
type
;
/** 站点表id */
@ApiModelProperty
(
value
=
"站点表id"
,
name
=
"stationId"
)
private
String
stationId
;
/** 创建时间 */
@ApiModelProperty
(
value
=
"创建时间"
,
name
=
"createTime"
)
private
java
.
util
.
Date
createTime
;
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/bean/ZyJfktpInfo.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
bean
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author dxw
*/
@Data
@ApiModel
(
value
=
"资阳西站空调机组信息对象"
,
description
=
"机房空调信息对象"
)
@TableName
(
"zy_jfktp_info"
)
public
class
ZyJfktpInfo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/** 主键id */
@ApiModelProperty
(
value
=
"主键ID"
,
name
=
"id"
)
@TableId
private
String
id
;
/** 资源点id */
@ApiModelProperty
(
value
=
"资源点id"
,
name
=
"resourceId"
)
private
String
resourceId
;
/** 空调回风温度 */
@ApiModelProperty
(
value
=
"空调回风温度"
,
name
=
"windTem"
)
private
String
windTem
;
/** 水阀反馈 */
@ApiModelProperty
(
value
=
"水阀反馈"
,
name
=
"waterFeedback"
)
private
String
waterFeedback
;
/** 新风温度 */
@ApiModelProperty
(
value
=
"新风温度"
,
name
=
"newTem"
)
private
String
newTem
;
/** 季节 */
@ApiModelProperty
(
value
=
"季节"
,
name
=
"season"
)
private
String
season
;
/** 滤网压差 */
@ApiModelProperty
(
value
=
"滤网压差"
,
name
=
"filterPressure"
)
private
String
filterPressure
;
/** 风机压差 */
@ApiModelProperty
(
value
=
"风机压差"
,
name
=
"fanPressure"
)
private
String
fanPressure
;
/** 状态 */
@ApiModelProperty
(
value
=
"状态"
,
name
=
"status"
)
private
String
status
;
/** 故障 */
@ApiModelProperty
(
value
=
"故障"
,
name
=
"failure"
)
private
String
failure
;
/** 手自动 */
@ApiModelProperty
(
value
=
"手自动"
,
name
=
"automatic"
)
private
String
automatic
;
/** 空调能耗 */
@ApiModelProperty
(
value
=
"空调能耗"
,
name
=
"energy"
)
private
String
energy
;
/** 类型(1手动,2节能) */
@ApiModelProperty
(
value
=
"类型(1手动,2节能)"
,
name
=
"type"
)
private
Integer
type
;
/** 站点表id */
@ApiModelProperty
(
value
=
"站点表id"
,
name
=
"stationId"
)
private
String
stationId
;
/** 创建时间 */
@ApiModelProperty
(
value
=
"创建时间"
,
name
=
"createTime"
)
private
java
.
util
.
Date
createTime
;
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/controller/AnalysisController.java
View file @
b845d14a
...
...
@@ -65,23 +65,36 @@ public class AnalysisController extends AbstractController {
startTime
=
DateUtil
.
getStringOfFirstDay
(
startTime
);
endTime
=
DateUtil
.
getStringOfLastDay
(
endTime
);
List
<
SwqxzInfoHour
>
list
=
swqxzInfoHourService
.
getList
(
startTime
,
endTime
);
//温度
List
<
List
<
String
>>
temperatureList
=
new
ArrayList
<
List
<
String
>>();
//湿度
List
<
List
<
String
>>
humidityList
=
new
ArrayList
<
List
<
String
>>();
//风速
List
<
List
<
String
>>
windSpeedList
=
new
ArrayList
<
List
<
String
>>();
//照度
List
<
List
<
String
>>
illuminanceList
=
new
ArrayList
<
List
<
String
>>();
//co2
List
<
List
<
String
>>
carbonDioxideList
=
new
ArrayList
<
List
<
String
>>();
//细粒度
List
<
List
<
String
>>
fineParticlesList
=
new
ArrayList
<
List
<
String
>>();
//辐射
List
<
List
<
String
>>
radiationList
=
new
ArrayList
<
List
<
String
>>();
List
<
List
<
String
>>
bjList
=
new
ArrayList
<
List
<
String
>>();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
//温度详情
List
<
String
>
temperatureListDetail
=
new
ArrayList
<
String
>();
//湿度详情
List
<
String
>
humidityListDetail
=
new
ArrayList
<
String
>();
//风速详情
List
<
String
>
windSpeedListDetail
=
new
ArrayList
<
String
>();
//照度详情
List
<
String
>
illuminanceListDetail
=
new
ArrayList
<
String
>();
//co2详情
List
<
String
>
carbonDioxideListDetail
=
new
ArrayList
<
String
>();
//细粒度详情
List
<
String
>
fineParticlesListDetail
=
new
ArrayList
<
String
>();
//辐射详情
List
<
String
>
radiationListDetail
=
new
ArrayList
<
String
>();
String
time
=
DateUtils
.
format
(
list
.
get
(
i
).
getCreateTime
(),
"yyyy-MM-dd HH:mm:ss"
);
...
...
@@ -236,6 +249,19 @@ public class AnalysisController extends AbstractController {
List
<
List
<
String
>>
list
=
analysisService
.
getEnergyListFx
(
startTime
,
endTime
,
resourceType
);
return
R
.
ok
().
put
(
"list"
,
list
);
}
/**
* 资阳西站获取能耗数据分析
*
* @return
*/
@ApiOperation
(
value
=
"资阳西站获取能耗数据分析"
,
notes
=
"资阳西站获取能耗数据分析"
)
@GetMapping
(
"/getZyEnergyFx"
)
public
R
getZyEnergyFx
(
String
startTime
,
String
endTime
,
String
resourceType
)
{
startTime
=
DateUtil
.
getStringOfFirstDay
(
startTime
);
endTime
=
DateUtil
.
getStringOfLastDay
(
endTime
);
List
<
List
<
String
>>
list
=
analysisService
.
getZyEnergyFx
(
startTime
,
endTime
,
resourceType
);
return
R
.
ok
().
put
(
"list"
,
list
);
}
/**
* 数据分析-能耗数据-导出
...
...
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/controller/EquipmentController.java
View file @
b845d14a
...
...
@@ -2,6 +2,7 @@ package com.devplatform.admin.modules.eq.controller;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.devplatform.admin.common.scheduling.SimpleJob
;
import
com.devplatform.admin.common.utils.AbstractController
;
import
com.devplatform.admin.common.utils.Constants
;
...
...
@@ -29,9 +30,11 @@ import org.apache.commons.lang.StringUtils;
import
org.quartz.*
;
import
org.quartz.impl.StdSchedulerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -39,10 +42,11 @@ import java.util.Map;
/**
* 设备控制
*
* @author dxw
*/
@ToString
@Api
(
tags
=
{
"设备接口"
})
@Api
(
tags
=
{
"设备接口"
})
@RestController
@RequestMapping
(
"/equipment"
)
public
class
EquipmentController
extends
AbstractController
{
...
...
@@ -63,38 +67,71 @@ public class EquipmentController extends AbstractController {
private
WebSocket
webSocket
;
@Autowired
private
LiResourceService
liResourceService
;
//节能大循环节能算法间隔分钟
@Value
(
"${bigTime}"
)
private
String
bigTime
;
//节能小循环节能算法间隔分钟
@Value
(
"${smallTime}"
)
private
String
smallTime
;
/**
* 资阳西站获取首页数据接口
*
* @return
*/
@ApiOperation
(
value
=
"资阳西站获取首页数据接口"
,
notes
=
"资阳西站获取首页数据接口"
)
@GetMapping
(
"/getHome"
)
public
R
getHome
(
String
startTime
,
String
endTime
,
String
resourceType
)
{
Map
<
String
,
Object
>
list2
=
equipmentService
.
getList2
(
startTime
,
endTime
,
resourceType
);
return
R
.
ok
().
put
(
"bean"
,
list2
);
}
/**
* 发送首页最新数据
*
* @return
*/
@ApiOperation
(
value
=
"发送首页最新数据"
,
notes
=
"发送首页最新数据"
)
@PostMapping
(
"/sendHomeInfo"
)
public
R
sendHomeInfo
(
String
startTime
,
String
endTime
,
String
resourceType
)
{
Map
<
String
,
Object
>
list2
=
equipmentService
.
getList2
(
startTime
,
endTime
,
resourceType
);
webSocket
.
sendAllMessage
(
JSONObject
.
toJSONString
(
list2
));
return
R
.
ok
();
}
/**
* 获取每个设备最新的参数值
*
* @return
*/
@ApiOperation
(
value
=
"获取每个设备最新的参数值"
,
notes
=
"获取每个设备最新的参数值"
)
@ApiOperation
(
value
=
"获取每个设备最新的参数值"
,
notes
=
"获取每个设备最新的参数值"
)
@GetMapping
(
"/getListParam"
)
public
R
getListParam
()
{
Map
<
String
,
Object
>
list
=
equipmentService
.
getList
();
Map
<
String
,
Object
>
list
=
equipmentService
.
getList
();
return
R
.
ok
().
put
(
"bean"
,
list
);
}
/**
* 发送每个设备最新的参数值
*
* @return
*/
@ApiOperation
(
value
=
"发送每个设备最新的参数值"
,
notes
=
"发送每个设备最新的参数值"
)
@ApiOperation
(
value
=
"发送每个设备最新的参数值"
,
notes
=
"发送每个设备最新的参数值"
)
@PostMapping
(
"/sendParamsInfo"
)
public
R
sendParamsInfo
()
{
Map
<
String
,
Object
>
list
=
equipmentService
.
getList
();
Map
<
String
,
Object
>
list
=
equipmentService
.
getList
();
webSocket
.
sendAllMessage
(
JSONObject
.
toJSONString
(
list
));
return
R
.
ok
();
}
/**
* 切换人工/节能模式
*
* @return
*/
@ApiOperation
(
value
=
"切换人工/节能模式"
,
notes
=
"切换人工/节能模式"
)
@ApiOperation
(
value
=
"切换人工/节能模式"
,
notes
=
"切换人工/节能模式"
)
@GetMapping
(
"/changeType"
)
public
R
changeType
(
Integer
type
)
{
public
R
changeType
(
Integer
type
)
throws
InterruptedException
{
Date
time
=
new
Date
();
//关闭全局得供暖、机械通风、自然通风模式
SysSystemParams
sysSystemParams
=
new
SysSystemParams
();
sysSystemParams
.
setId
(
Constants
.
STRING_1
);
sysSystemParams
.
setType
(
type
);
...
...
@@ -102,16 +139,18 @@ public class EquipmentController extends AbstractController {
sysSystemParams
.
setSun
(
Constants
.
INT_2
);
sysSystemParams
.
setFan
(
Constants
.
INT_2
);
sysSystemParams
.
setNan
(
Constants
.
INT_2
);
sysSystemParamsService
.
update
(
sysSystemParams
,
new
LambdaQueryWrapper
<
SysSystemParams
>()
.
eq
(
SysSystemParams:
:
getId
,
Constants
.
STRING_1
));
sysSystemParamsService
.
update
(
sysSystemParams
,
new
LambdaQueryWrapper
<
SysSystemParams
>()
.
eq
(
SysSystemParams:
:
getId
,
Constants
.
STRING_1
));
//修改全局系统运行得结束时间
SysSystemRunningTime
sysSystemRunningTime
=
sysSystemRunningTimeService
.
getOne
(
new
LambdaQueryWrapper
<
SysSystemRunningTime
>()
.
orderByDesc
(
SysSystemRunningTime:
:
getUpdateTime
).
last
(
"limit 1"
));
sysSystemRunningTime
.
setEndTime
(
time
);
sysSystemRunningTime
.
setUpdateTime
(
time
);
sysSystemRunningTimeService
.
update
(
sysSystemRunningTime
,
new
LambdaQueryWrapper
<
SysSystemRunningTime
>()
.
eq
(
SysSystemRunningTime:
:
getId
,
sysSystemRunningTime
.
getId
()));
sysSystemRunningTimeService
.
update
(
sysSystemRunningTime
,
new
LambdaQueryWrapper
<
SysSystemRunningTime
>()
.
eq
(
SysSystemRunningTime:
:
getId
,
sysSystemRunningTime
.
getId
()));
//新增全局系统运行时间为当前时间
SysSystemRunningTime
temp
=
new
SysSystemRunningTime
();
temp
.
setStartTime
(
time
);
temp
.
setType
(
type
);
...
...
@@ -119,31 +158,67 @@ public class EquipmentController extends AbstractController {
temp
.
setUpdateTime
(
time
);
sysSystemRunningTimeService
.
save
(
temp
);
if
(
type
==
Constants
.
INT_1
){
TimedTask
timedTaskJn
=
timedTaskService
.
getOne
(
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getStatus
,
Constants
.
INT_1
).
eq
(
TimedTask:
:
getBusinessType
,
Constants
.
INT_3
).
last
(
"limit 1"
));
if
(
timedTaskJn
!=
null
){
this
.
timedTask
(
timedTaskJn
.
getId
(),
timedTaskJn
.
getStartTime
(),
timedTaskJn
.
getEndTime
(),
Constants
.
INT_2
,
Constants
.
INT_3
,
null
,
""
);
}
}
else
if
(
type
==
Constants
.
INT_2
){
//如果切换成节能模式,则关闭人工模式的定时任务,打开节能模式定时任务
TimedTask
timedTask
=
timedTaskService
.
getOne
(
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getStatus
,
Constants
.
INT_1
)
.
eq
(
TimedTask:
:
getBusinessType
,
Constants
.
INT_1
)
.
last
(
"limit 1"
));
if
(
timedTask
!=
null
){
this
.
timedTask
(
timedTask
.
getId
(),
timedTask
.
getStartTime
(),
timedTask
.
getEndTime
(),
Constants
.
INT_2
,
1
,
null
,
""
);
}
TimedTask
timedTaskJn
=
timedTaskService
.
getOne
(
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getStatus
,
Constants
.
INT_2
).
eq
(
TimedTask:
:
getBusinessType
,
Constants
.
INT_3
).
last
(
"limit 1"
));
if
(
timedTaskJn
!=
null
){
this
.
timedTask
(
timedTaskJn
.
getId
(),
DateUtil
.
convertDateToMinute
(
time
),
timedTaskJn
.
getEndTime
(),
Constants
.
INT_1
,
Constants
.
INT_3
,
null
,
""
);
}
else
{
this
.
timedTask
(
""
,
DateUtil
.
convertDateToMinute
(
time
),
""
,
Constants
.
INT_1
,
Constants
.
INT_3
,
null
,
""
);
}
//执行节能任务
//人工
if
(
type
==
Constants
.
INT_1
)
{
//查询定时任务(状态为开启、业务类型为节能),并且关闭节能模式
//关闭节能大循环定时任务
TimedTask
timedTaskJnBig
=
timedTaskService
.
getOne
(
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getStatus
,
Constants
.
INT_1
).
eq
(
TimedTask:
:
getBusinessType
,
Constants
.
INT_3
).
eq
(
TimedTask:
:
getBusinessSonType
,
Constants
.
INT_1
));
if
(
timedTaskJnBig
!=
null
)
{
this
.
timedTask
(
timedTaskJnBig
.
getId
(),
timedTaskJnBig
.
getStartTime
(),
timedTaskJnBig
.
getEndTime
(),
Constants
.
INT_2
,
Constants
.
INT_3
,
null
,
""
,
Constants
.
INT_1
);
}
//关闭节能小循环定时任务
TimedTask
timedTaskJnSmall
=
timedTaskService
.
getOne
(
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getStatus
,
Constants
.
INT_1
).
eq
(
TimedTask:
:
getBusinessType
,
Constants
.
INT_3
).
eq
(
TimedTask:
:
getBusinessSonType
,
Constants
.
INT_2
));
if
(
timedTaskJnSmall
!=
null
)
{
this
.
timedTask
(
timedTaskJnSmall
.
getId
(),
timedTaskJnSmall
.
getStartTime
(),
timedTaskJnSmall
.
getEndTime
(),
Constants
.
INT_2
,
Constants
.
INT_3
,
null
,
""
,
Constants
.
INT_2
);
}
// //查询人工定时任务
// TimedTask timedTask = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus, Constants.INT_2)
// .eq(TimedTask::getBusinessType, Constants.INT_1)
// .last("limit 1"));
// if(timedTask != null){
// //开启人工定时任务
// this.timedTask(timedTask.getId(),timedTask.getStartTime() , timedTask.getEndTime(), Constants.INT_1, Constants.INT_1, null, "",Constants.INT_3);
// }
}
else
if
(
type
==
Constants
.
INT_2
)
{
//如果切换成节能模式,则关闭人工模式的定时任务,打开节能模式定时任务
// TimedTask timedTask = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus, Constants.INT_1)
// .eq(TimedTask::getBusinessType, Constants.INT_1)
// .last("limit 1"));
// //关闭人工模式的定时任务
// if (timedTask != null) {
// //候车大厅全局
// this.timedTask(timedTask.getId(), timedTask.getStartTime(), timedTask.getEndTime(), Constants.INT_2, 1, null, "",Constants.INT_3);
// }
//查询关闭得节能大循环节能模式
TimedTask
timedTaskJnBig
=
timedTaskService
.
getOne
(
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getStatus
,
Constants
.
INT_2
).
eq
(
TimedTask:
:
getBusinessType
,
Constants
.
INT_3
).
eq
(
TimedTask:
:
getBusinessSonType
,
Constants
.
INT_1
));
if
(
timedTaskJnBig
!=
null
)
{
//打开节能大循环节能模式定时任务
this
.
timedTask
(
timedTaskJnBig
.
getId
(),
DateUtil
.
convertDateToMinute
(
time
),
timedTaskJnBig
.
getEndTime
(),
Constants
.
INT_1
,
Constants
.
INT_3
,
null
,
""
,
Constants
.
INT_1
);
}
else
{
this
.
timedTask
(
""
,
DateUtil
.
convertDateToMinute
(
time
),
""
,
Constants
.
INT_1
,
Constants
.
INT_3
,
null
,
""
,
Constants
.
INT_1
);
}
//查询关闭得节能小循环节能模式
TimedTask
timedTaskJnsmall
=
timedTaskService
.
getOne
(
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getStatus
,
Constants
.
INT_2
).
eq
(
TimedTask:
:
getBusinessType
,
Constants
.
INT_3
).
eq
(
TimedTask:
:
getBusinessSonType
,
Constants
.
INT_2
));
if
(
timedTaskJnsmall
!=
null
)
{
//打开节能小循环节能模式定时任务
this
.
timedTask
(
timedTaskJnsmall
.
getId
(),
DateUtil
.
convertDateToMinute
(
time
),
timedTaskJnsmall
.
getEndTime
(),
Constants
.
INT_1
,
Constants
.
INT_3
,
null
,
""
,
Constants
.
INT_2
);
}
else
{
this
.
timedTask
(
""
,
DateUtil
.
convertDateToMinute
(
time
),
""
,
Constants
.
INT_1
,
Constants
.
INT_3
,
null
,
""
,
Constants
.
INT_2
);
}
//获取当前月、日、小时
Calendar
calendar
=
Calendar
.
getInstance
();
Integer
month
=
calendar
.
get
(
java
.
util
.
Calendar
.
MONTH
)
+
1
;
// 月份是从0开始的,所以加1
if
(
month
!=
3
&&
month
!=
4
)
{
//执行节能任务大循环算法
energyTask
();
Thread
.
sleep
(
10000
);
//执行节能任务小循环算法
energyTask2
();
}
Map
<
String
,
Object
>
list
=
equipmentService
.
getList
();
}
//原来的数据返回
//Map<String, Object> list = equipmentService.getList();
Map
<
String
,
Object
>
list
=
equipmentService
.
getList2
(
""
,
""
,
""
);
webSocket
.
sendAllMessage
(
JSONObject
.
toJSONString
(
list
));
return
R
.
ok
();
}
...
...
@@ -152,10 +227,10 @@ public class EquipmentController extends AbstractController {
* @param jobName @Description 移除任务(使用默认的任务组名 , 触发器名 , 触发器组名)
*/
public
static
void
removeJob
(
String
jobName
)
{
TriggerKey
triggerKey1
=
TriggerKey
.
triggerKey
(
jobName
+
"-start"
,
TRIGGER_GROUP_NAME
);
TriggerKey
triggerKey2
=
TriggerKey
.
triggerKey
(
jobName
+
"-end"
,
TRIGGER_GROUP_NAME
);
JobKey
jobKey1
=
JobKey
.
jobKey
(
jobName
+
"-start"
,
JOB_GROUP_NAME
);
JobKey
jobKey2
=
JobKey
.
jobKey
(
jobName
+
"-end"
,
JOB_GROUP_NAME
);
TriggerKey
triggerKey1
=
TriggerKey
.
triggerKey
(
jobName
+
"-start"
,
TRIGGER_GROUP_NAME
);
TriggerKey
triggerKey2
=
TriggerKey
.
triggerKey
(
jobName
+
"-end"
,
TRIGGER_GROUP_NAME
);
JobKey
jobKey1
=
JobKey
.
jobKey
(
jobName
+
"-start"
,
JOB_GROUP_NAME
);
JobKey
jobKey2
=
JobKey
.
jobKey
(
jobName
+
"-end"
,
JOB_GROUP_NAME
);
try
{
Scheduler
sched
=
gSchedulerFactory
.
getScheduler
();
Trigger
trigger1
=
(
Trigger
)
sched
.
getTrigger
(
triggerKey1
);
...
...
@@ -163,23 +238,23 @@ public class EquipmentController extends AbstractController {
if
(
trigger1
==
null
&&
trigger2
==
null
)
{
return
;
}
if
(
trigger1
!=
null
)
{
if
(
trigger1
!=
null
)
{
// 停止触发器
sched
.
pauseTrigger
(
triggerKey1
);
// 移除触发器
sched
.
unscheduleJob
(
triggerKey1
);
// 删除任务
sched
.
deleteJob
(
jobKey1
);
System
.
err
.
println
(
"移除任务:"
+
jobName
+
"-start"
);
System
.
err
.
println
(
"移除任务:"
+
jobName
+
"-start"
);
}
if
(
trigger2
!=
null
)
{
if
(
trigger2
!=
null
)
{
// 停止触发器
sched
.
pauseTrigger
(
triggerKey2
);
// 移除触发器
sched
.
unscheduleJob
(
triggerKey2
);
// 删除任务
sched
.
deleteJob
(
jobKey2
);
System
.
err
.
println
(
"移除任务:"
+
jobName
+
"-end"
);
System
.
err
.
println
(
"移除任务:"
+
jobName
+
"-end"
);
}
}
catch
(
Exception
ignored
)
{
System
.
err
.
println
(
"移除定时任务出错"
);
...
...
@@ -189,12 +264,12 @@ public class EquipmentController extends AbstractController {
@ApiOperation
(
value
=
"定时任务开启/关闭"
,
notes
=
"定时任务开启"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"主键"
,
required
=
true
,
dataType
=
"String"
)
@PostMapping
(
"/timedTask"
)
public
R
timedTask
(
String
taskId
,
String
startTime
,
String
endTime
,
Integer
status
,
Integer
businessType
,
Integer
type
,
String
isReboot
)
{
public
R
timedTask
(
String
taskId
,
String
startTime
,
String
endTime
,
Integer
status
,
Integer
businessType
,
Integer
type
,
String
isReboot
,
Integer
businessSonType
)
{
TimedTask
timedTask
=
null
;
//如果重启是启动的定时任务,不用更新数据库
if
(
StringUtils
.
isBlank
(
isReboot
))
{
if
(
StringUtils
.
isBlank
(
isReboot
))
{
SysUserEntity
user
=
getUser
();
if
(
StringUtils
.
isBlank
(
taskId
))
{
if
(
StringUtils
.
isBlank
(
taskId
))
{
timedTask
=
new
TimedTask
();
timedTask
.
setStartTime
(
startTime
);
timedTask
.
setBusinessType
(
businessType
);
...
...
@@ -204,9 +279,10 @@ public class EquipmentController extends AbstractController {
timedTask
.
setCreateUserId
(
user
.
getUserId
());
timedTask
.
setStatus
(
status
);
timedTaskService
.
save
(
timedTask
);
}
else
{
timedTask
=
timedTaskService
.
getOne
(
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getBusinessType
,
businessType
)
.
eq
(
type
!=
null
,
TimedTask:
:
getType
,
type
).
last
(
"limit 1"
));
}
else
{
timedTask
=
timedTaskService
.
getOne
(
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getBusinessType
,
businessType
)
.
eq
(
type
!=
null
,
TimedTask:
:
getType
,
type
).
eq
(
businessSonType
!=
null
,
TimedTask:
:
getBusinessSonType
,
businessSonType
).
last
(
"limit 1"
));
timedTask
.
setStartTime
(
startTime
);
timedTask
.
setBusinessType
(
businessType
);
timedTask
.
setType
(
type
);
...
...
@@ -214,7 +290,7 @@ public class EquipmentController extends AbstractController {
timedTask
.
setStatus
(
status
);
timedTask
.
setUpdateTime
(
new
Date
());
timedTask
.
setUpdateUserId
(
user
.
getUserId
());
timedTaskService
.
update
(
timedTask
,
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getId
,
taskId
));
timedTaskService
.
update
(
timedTask
,
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getId
,
taskId
));
}
taskId
=
timedTask
.
getId
();
...
...
@@ -223,11 +299,11 @@ public class EquipmentController extends AbstractController {
//开启
if
(
status
==
1
)
{
//设置定时任务
R
error
=
setTimeTask
(
taskId
,
businessType
,
type
,
startTime
,
endTim
e
);
R
error
=
setTimeTask
(
taskId
,
businessType
,
type
,
startTime
,
endTime
,
businessSonTyp
e
);
if
(
error
!=
null
)
{
return
error
;
}
}
else
{
}
else
{
//关闭定时任务
removeJob
(
taskId
);
}
...
...
@@ -236,74 +312,75 @@ public class EquipmentController extends AbstractController {
/**
* 设置定时任务
*
* @param id
* @param startTime
* @param endTime
* @return
*/
private
R
setTimeTask
(
String
id
,
Integer
businessType
,
Integer
type
,
String
startTime
,
String
endTime
)
{
private
R
setTimeTask
(
String
id
,
Integer
businessType
,
Integer
type
,
String
startTime
,
String
endTime
,
Integer
businessSonType
)
{
try
{
Scheduler
sched
=
gSchedulerFactory
.
getScheduler
();
JobDetail
job1
=
null
;
Trigger
trigger1
=
null
;
JobDetail
job2
=
null
;
Trigger
trigger2
=
null
;
if
(
StringUtils
.
isNotBlank
(
startTime
))
{
if
(
StringUtils
.
isNotBlank
(
startTime
))
{
JobDataMap
resJobDataMap1
=
new
JobDataMap
();
//设备开启
resJobDataMap1
.
put
(
"status"
,
Constants
.
INT_1
);
resJobDataMap1
.
put
(
"businessType"
,
businessType
);
resJobDataMap1
.
put
(
"type"
,
type
);
job1
=
JobBuilder
.
newJob
(
SimpleJob
.
class
).
withIdentity
(
id
+
"-start"
,
JOB_GROUP_NAME
).
usingJobData
(
resJobDataMap1
).
build
();
resJobDataMap1
.
put
(
"businessSonType"
,
businessSonType
);
job1
=
JobBuilder
.
newJob
(
SimpleJob
.
class
).
withIdentity
(
id
+
"-start"
,
JOB_GROUP_NAME
).
usingJobData
(
resJobDataMap1
).
build
();
String
cron1
=
""
;
if
(
businessType
==
Constants
.
INT_3
)
{
int
time
=
Integer
.
valueOf
(
startTime
)
+
30
;
int
time2
=
time
<
60
?
time
:
(
time
-
60
);
if
(
Integer
.
valueOf
(
startTime
).
intValue
()
>
time2
){
cron1
=
createCron2
(
String
.
valueOf
(
time2
),
startTime
);
}
else
{
cron1
=
createCron2
(
startTime
,
String
.
valueOf
(
time2
)
);
if
(
businessType
==
Constants
.
INT_3
)
{
if
(
businessSonType
==
Constants
.
INT_1
){
trigger1
=
TriggerBuilder
.
newTrigger
().
withIdentity
(
id
+
"-start"
,
TRIGGER_GROUP_NAME
).
startNow
()
.
withSchedule
(
SimpleScheduleBuilder
.
repeatMinutelyForever
(
Integer
.
valueOf
(
bigTime
))).
build
();
}
else
{
trigger1
=
TriggerBuilder
.
newTrigger
().
withIdentity
(
id
+
"-start"
,
TRIGGER_GROUP_NAME
).
startNow
()
.
withSchedule
(
SimpleScheduleBuilder
.
repeatMinutelyForever
(
Integer
.
valueOf
(
smallTime
))).
build
(
);
}
}
else
{
}
else
{
cron1
=
createCron
(
startTime
);
}
trigger1
=
TriggerBuilder
.
newTrigger
().
withIdentity
(
id
+
"-start"
,
TRIGGER_GROUP_NAME
).
startAt
(
new
Date
())
trigger1
=
TriggerBuilder
.
newTrigger
().
withIdentity
(
id
+
"-start"
,
TRIGGER_GROUP_NAME
).
startAt
(
new
Date
())
.
withSchedule
(
CronScheduleBuilder
.
cronSchedule
(
cron1
).
withMisfireHandlingInstructionDoNothing
()).
build
();
}
if
(
StringUtils
.
isNotBlank
(
endTime
)){
}
if
(
StringUtils
.
isNotBlank
(
endTime
))
{
JobDataMap
resJobDataMap2
=
new
JobDataMap
();
//设备关闭
resJobDataMap2
.
put
(
"status"
,
Constants
.
INT_2
);
resJobDataMap2
.
put
(
"businessType"
,
businessType
);
resJobDataMap2
.
put
(
"type"
,
type
);
job2
=
JobBuilder
.
newJob
(
SimpleJob
.
class
).
withIdentity
(
id
+
"-end"
,
JOB_GROUP_NAME
).
usingJobData
(
resJobDataMap2
).
build
();
job2
=
JobBuilder
.
newJob
(
SimpleJob
.
class
).
withIdentity
(
id
+
"-end"
,
JOB_GROUP_NAME
).
usingJobData
(
resJobDataMap2
).
build
();
String
cron2
=
""
;
if
(
businessType
==
Constants
.
INT_3
)
{
if
(
businessType
==
Constants
.
INT_3
)
{
int
time
=
Integer
.
valueOf
(
endTime
)
+
30
;
int
time2
=
time
<
60
?
time
:
(
time
-
60
);
if
(
Integer
.
valueOf
(
endTime
).
intValue
()
>
time2
)
{
cron2
=
createCron2
(
String
.
valueOf
(
time2
),
endTime
);
}
else
{
cron2
=
createCron2
(
endTime
,
String
.
valueOf
(
time2
));
if
(
Integer
.
valueOf
(
endTime
).
intValue
()
>
time2
)
{
cron2
=
createCron2
(
String
.
valueOf
(
time2
),
endTime
);
}
else
{
cron2
=
createCron2
(
endTime
,
String
.
valueOf
(
time2
));
}
}
else
{
}
else
{
cron2
=
createCron
(
endTime
);
}
trigger2
=
TriggerBuilder
.
newTrigger
().
withIdentity
(
id
+
"-end"
,
TRIGGER_GROUP_NAME
).
startAt
(
new
Date
())
trigger2
=
TriggerBuilder
.
newTrigger
().
withIdentity
(
id
+
"-end"
,
TRIGGER_GROUP_NAME
).
startAt
(
new
Date
())
.
withSchedule
(
CronScheduleBuilder
.
cronSchedule
(
cron2
).
withMisfireHandlingInstructionDoNothing
()).
build
();
}
if
(
job1
!=
null
&&
trigger1
!=
null
)
{
if
(
job1
!=
null
&&
trigger1
!=
null
)
{
// 交给scheduler去调度
sched
.
scheduleJob
(
job1
,
trigger1
);
}
if
(
job2
!=
null
&&
trigger2
!=
null
)
{
if
(
job2
!=
null
&&
trigger2
!=
null
)
{
sched
.
scheduleJob
(
job2
,
trigger2
);
}
// 启动
...
...
@@ -311,7 +388,7 @@ public class EquipmentController extends AbstractController {
sched
.
start
();
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
System
.
err
.
println
(
"设置定时任务1:"
+
id
+
"\n\t下次
运行时间:"
+
sdf
.
format
(
trigger1
.
getNextFireTime
()));
System
.
err
.
println
(
"设置定时任务1:"
+
id
+
"\n\t
运行时间:"
+
sdf
.
format
(
trigger1
.
getNextFireTime
()));
// System.err.println("设置定时任务2:" + id + "\n\t下次运行时间:" + sdf.format(trigger2.getNextFireTime()));
}
catch
(
SchedulerException
e
)
{
e
.
printStackTrace
();
...
...
@@ -322,10 +399,11 @@ public class EquipmentController extends AbstractController {
/**
* 生成cron表达
*
* @param time 时间
* @return cron
*/
public
String
createCron
(
String
time
)
{
public
String
createCron
(
String
time
)
{
String
[]
strs
=
time
.
split
(
":"
);
StringBuilder
sb
=
new
StringBuilder
()
.
append
(
0
).
append
(
" "
)
...
...
@@ -336,11 +414,13 @@ public class EquipmentController extends AbstractController {
/**
* 生成cron表达
*
* @param time 时间
* @return cron
*/
public
String
createCron2
(
String
time
,
String
time2
)
{
public
String
createCron2
(
String
time
,
String
time2
)
{
//0 26,29,33 * * * ?
//0 45,45,* * * * ?
StringBuilder
sb
=
new
StringBuilder
()
.
append
(
0
).
append
(
" "
)
.
append
(
time
).
append
(
","
).
append
(
time2
)
...
...
@@ -351,20 +431,22 @@ public class EquipmentController extends AbstractController {
/**
* 获取电动门帘的定时任务数据
*
* @return
*/
@ApiOperation
(
value
=
"获取电动门帘的定时任务数据"
,
notes
=
"获取电动门帘的定时任务数据"
)
@ApiOperation
(
value
=
"获取电动门帘的定时任务数据"
,
notes
=
"获取电动门帘的定时任务数据"
)
@GetMapping
(
"/getAllDdml"
)
public
R
getAllDdml
()
{
List
<
TimedTask
>
timedTasks
=
timedTaskService
.
list
(
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getBusinessType
,
Constants
.
INT_2
));
return
R
.
ok
().
put
(
"list"
,
timedTasks
);
List
<
TimedTask
>
timedTasks
=
timedTaskService
.
list
(
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getBusinessType
,
Constants
.
INT_2
));
return
R
.
ok
().
put
(
"list"
,
timedTasks
);
}
/**
* 候车大厅头上所有显示数据
*
* @return
*/
@ApiOperation
(
value
=
"候车大厅头上所有显示数据"
,
notes
=
"候车大厅头上所有显示数据"
)
@ApiOperation
(
value
=
"候车大厅头上所有显示数据"
,
notes
=
"候车大厅头上所有显示数据"
)
@GetMapping
(
"/getAllHcdt"
)
public
R
getAllHcdt
()
{
SysSystemParams
sysSystemParams
=
sysSystemParamsService
.
getById
(
Constants
.
STRING_1
);
...
...
@@ -374,60 +456,60 @@ public class EquipmentController extends AbstractController {
@ApiOperation
(
value
=
"切换模式"
,
notes
=
"切换模式"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"主键"
,
required
=
true
,
dataType
=
"String"
)
@PostMapping
(
"/checkModel"
)
public
R
checkModel
(
Integer
type
,
Integer
status
)
{
public
R
checkModel
(
Integer
type
,
Integer
status
)
{
// 控制资源点
checkModelOnOrOff
(
type
,
status
);
SysSystemParams
sysSystemParams
=
sysSystemParamsService
.
getById
(
Constants
.
STRING_1
);
if
(
type
==
Constants
.
INT_1
)
{
if
(
type
==
Constants
.
INT_1
)
{
sysSystemParams
.
setSun
(
status
);
sysSystemParams
.
setFan
(
Constants
.
INT_2
);
sysSystemParams
.
setNan
(
Constants
.
INT_2
);
}
else
if
(
type
==
Constants
.
INT_2
)
{
}
else
if
(
type
==
Constants
.
INT_2
)
{
sysSystemParams
.
setSun
(
Constants
.
INT_2
);
sysSystemParams
.
setFan
(
status
);
sysSystemParams
.
setNan
(
Constants
.
INT_2
);
}
else
if
(
type
==
Constants
.
INT_3
)
{
}
else
if
(
type
==
Constants
.
INT_3
)
{
sysSystemParams
.
setSun
(
Constants
.
INT_2
);
sysSystemParams
.
setFan
(
Constants
.
INT_2
);
sysSystemParams
.
setNan
(
status
);
}
sysSystemParamsService
.
update
(
sysSystemParams
,
new
LambdaQueryWrapper
<
SysSystemParams
>()
.
eq
(
SysSystemParams:
:
getId
,
sysSystemParams
.
getId
()));
sysSystemParamsService
.
update
(
sysSystemParams
,
new
LambdaQueryWrapper
<
SysSystemParams
>()
.
eq
(
SysSystemParams:
:
getId
,
sysSystemParams
.
getId
()));
Map
<
String
,
Object
>
list
=
equipmentService
.
getList
();
Map
<
String
,
Object
>
list
=
equipmentService
.
getList
();
webSocket
.
sendAllMessage
(
JSONObject
.
toJSONString
(
list
));
return
R
.
ok
();
}
/**
* 查询定时温控里面的数据
*
* @return
*/
@ApiOperation
(
value
=
"查询定时温控里面的数据"
,
notes
=
"查询定时温控里面的数据"
)
@ApiOperation
(
value
=
"查询定时温控里面的数据"
,
notes
=
"查询定时温控里面的数据"
)
@GetMapping
(
"/getAllDswk"
)
public
R
getAllDswk
()
{
TimedTask
timedTask
=
timedTaskService
.
getOne
(
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getBusinessType
,
Constants
.
INT_1
).
last
(
"limit 1"
));
TimedTask
timedTask
=
timedTaskService
.
getOne
(
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getBusinessType
,
Constants
.
INT_1
).
last
(
"limit 1"
));
return
R
.
ok
().
put
(
"timedTask"
,
timedTask
);
}
@ApiOperation
(
value
=
"温度设定"
,
notes
=
"温度设定"
)
@PostMapping
(
"/changeTemperature"
)
public
R
changeTemperature
(
String
temperature
)
{
TimedTask
timedTask
=
timedTaskService
.
getOne
(
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getBusinessType
,
Constants
.
INT_1
).
last
(
"limit 1"
));
TimedTask
timedTask
=
timedTaskService
.
getOne
(
new
LambdaQueryWrapper
<
TimedTask
>().
eq
(
TimedTask:
:
getBusinessType
,
Constants
.
INT_1
).
last
(
"limit 1"
));
timedTask
.
setTemperature
(
temperature
);
timedTaskService
.
update
(
timedTask
,
new
LambdaQueryWrapper
<
TimedTask
>()
.
eq
(
TimedTask:
:
getId
,
timedTask
.
getId
()));
timedTaskService
.
update
(
timedTask
,
new
LambdaQueryWrapper
<
TimedTask
>()
.
eq
(
TimedTask:
:
getId
,
timedTask
.
getId
()));
return
R
.
ok
();
}
/**
* @Title: 设备开关
* @param model
* @return Map<String,String>
* @return Map<String, String>
* @Title: 设备开关
*/
@PostMapping
(
"/onOrOff"
)
public
Map
<
String
,
Object
>
doorOnOff
(
@RequestBody
LiResourceModel
model
)
{
...
...
@@ -436,7 +518,7 @@ public class EquipmentController extends AbstractController {
}
/**
* 执行节能任务
* 执行节能任务大循环
*/
private
Map
<
String
,
Object
>
energyTask
()
{
// String postUrl = "http://192.168.0.222:8089/command/energyTask";
...
...
@@ -449,9 +531,24 @@ public class EquipmentController extends AbstractController {
}
return
map
;
}
/**
* 执行节能任务小循环
*/
private
Map
<
String
,
Object
>
energyTask2
()
{
// String postUrl = "http://192.168.0.222:8089/command/energyTask";
String
postUrl
=
"http://localhost:8089/command/energyTask2"
;
Map
<
String
,
String
>
postParam
=
new
HashMap
<
String
,
String
>(
10
);
Map
<
String
,
Object
>
resultMap
=
TestClient
.
uploadText
(
postUrl
,
postParam
);
Map
<
String
,
Object
>
map
=
null
;
if
(
Constants
.
STRING_200
.
equals
(
resultMap
.
get
(
Constants
.
STATUS_CODE
).
toString
()))
{
map
=
JSONObject
.
parseObject
(
resultMap
.
get
(
"data"
).
toString
(),
Map
.
class
);
}
return
map
;
}
/**
* 根据选择人工模式,来控制资源点启停
*
* @param type 1=供暖模式,2=机械通风,3=自然通风
* @param status 1=开启,2=关闭
*/
...
...
@@ -459,7 +556,7 @@ public class EquipmentController extends AbstractController {
// String postUrl = "http://192.168.0.222:8089/command/operationType";
String
postUrl
=
"http://localhost:8089/command/operationType"
;
Map
<
String
,
String
>
postParam
=
new
HashMap
<
String
,
String
>(
10
);
postParam
.
put
(
"params"
,
status
==
1
?
"1"
:
"0"
);
postParam
.
put
(
"params"
,
status
==
1
?
"1"
:
"0"
);
postParam
.
put
(
"rgType"
,
type
.
toString
());
postParam
.
put
(
"userId"
,
getUserId
());
postParam
.
put
(
"userName"
,
getUser
().
getName
());
...
...
@@ -477,8 +574,8 @@ public class EquipmentController extends AbstractController {
String
postUrl
=
"http://localhost:8089/command/operation"
;
Map
<
String
,
String
>
postParam
=
new
HashMap
<
String
,
String
>(
10
);
postParam
.
put
(
"liResourceId"
,
model
.
getId
());
postParam
.
put
(
"params"
,
(
model
.
getActionType
()==
Constants
.
INT_5
||
model
.
getActionType
()==
Constants
.
INT_6
||
model
.
getActionType
()==
Constants
.
INT_7
||
model
.
getActionType
()==
Constants
.
INT_8
||
model
.
getActionType
()==
Constants
.
INT_9
)
?
model
.
getParams
()
:
model
.
getStatus
().
toString
());
postParam
.
put
(
"params"
,
(
model
.
getActionType
()
==
Constants
.
INT_5
||
model
.
getActionType
()
==
Constants
.
INT_6
||
model
.
getActionType
()
==
Constants
.
INT_7
||
model
.
getActionType
()
==
Constants
.
INT_8
||
model
.
getActionType
()
==
Constants
.
INT_9
)
?
model
.
getParams
()
:
model
.
getStatus
().
toString
());
postParam
.
put
(
"paramsName"
,
model
.
getActionName
());
postParam
.
put
(
"actionType"
,
model
.
getActionType
().
toString
());
postParam
.
put
(
"userId"
,
getUserId
());
...
...
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/controller/EquipmentController2.java
0 → 100644
View file @
b845d14a
//package com.devplatform.admin.modules.eq.controller;
//
//import com.alibaba.fastjson.JSONObject;
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.devplatform.admin.common.scheduling.SimpleJob;
//import com.devplatform.admin.common.utils.AbstractController;
//import com.devplatform.admin.common.utils.Constants;
//import com.devplatform.admin.common.utils.DateUtil;
//import com.devplatform.admin.common.utils.TestClient;
//import com.devplatform.admin.config.WebSocket;
//import com.devplatform.admin.modules.eq.bean.TimedTask;
//import com.devplatform.admin.modules.eq.service.EquipmentService;
//import com.devplatform.admin.modules.eq.service.TimedTaskService;
//import com.devplatform.admin.modules.liresource.bean.LiStation;
//import com.devplatform.admin.modules.liresource.model.LiResourceModel;
//import com.devplatform.admin.modules.liresource.service.LiResourceService;
//import com.devplatform.admin.modules.liresource.service.LiStationService;
//import com.devplatform.admin.modules.sys.bean.SysSystemParams;
//import com.devplatform.admin.modules.sys.bean.SysSystemRunningTime;
//import com.devplatform.admin.modules.sys.bean.SysUserEntity;
//import com.devplatform.admin.modules.sys.service.SysSystemParamsService;
//import com.devplatform.admin.modules.sys.service.SysSystemRunningTimeService;
//import com.devplatform.common.util.R;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiOperation;
//import lombok.ToString;
//import org.apache.commons.lang.StringUtils;
//import org.quartz.*;
//import org.quartz.impl.StdSchedulerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//import java.text.SimpleDateFormat;
//import java.util.Date;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * 设备控制
// * @author dxw
// */
//@ToString
//@Api(tags={"设备接口"})
//@RestController
//@RequestMapping("/equipment")
//public class EquipmentController2 extends AbstractController {
// private static SchedulerFactory gSchedulerFactory = new StdSchedulerFactory();
// private static String JOB_GROUP_NAME = "quartz_name";
// private static String TRIGGER_GROUP_NAME = "quartz_group";
// @Autowired
// private EquipmentService equipmentService;
// @Autowired
// private SysSystemParamsService sysSystemParamsService;
// @Autowired
// private SysSystemRunningTimeService sysSystemRunningTimeService;
// @Autowired
// private TimedTaskService timedTaskService;
// @Autowired
// private LiStationService liStationService;
// @Autowired
// private WebSocket webSocket;
// @Autowired
// private LiResourceService liResourceService;
//
// /**
// * 获取每个设备最新的参数值
// * @return
// */
// @ApiOperation(value="获取每个设备最新的参数值", notes="获取每个设备最新的参数值")
// @GetMapping("/getListParam")
// public R getListParam() {
// Map<String,Object> list = equipmentService.getList();
// return R.ok().put("bean", list);
// }
//
// /**
// * 发送每个设备最新的参数值
// * @return
// */
// @ApiOperation(value="发送每个设备最新的参数值", notes="发送每个设备最新的参数值")
// @PostMapping("/sendParamsInfo")
// public R sendParamsInfo() {
// Map<String,Object> list = equipmentService.getList();
// webSocket.sendAllMessage(JSONObject.toJSONString(list));
// return R.ok();
// }
//
// /**
// * 切换人工/节能模式
// * @return
// */
// @ApiOperation(value="切换人工/节能模式", notes="切换人工/节能模式")
// @GetMapping("/changeType")
// public R changeType(Integer type) {
// Date time = new Date();
// //关闭全局得供暖、机械通风、自然通风模式
// SysSystemParams sysSystemParams = new SysSystemParams();
// sysSystemParams.setId(Constants.STRING_1);
// sysSystemParams.setType(type);
// sysSystemParams.setUpdateTime(time);
// sysSystemParams.setSun(Constants.INT_2);
// sysSystemParams.setFan(Constants.INT_2);
// sysSystemParams.setNan(Constants.INT_2);
// sysSystemParamsService.update(sysSystemParams,new LambdaQueryWrapper<SysSystemParams>()
// .eq(SysSystemParams::getId,Constants.STRING_1));
//
// //修改全局系统运行得结束时间
// SysSystemRunningTime sysSystemRunningTime = sysSystemRunningTimeService.getOne(new LambdaQueryWrapper<SysSystemRunningTime>()
// .orderByDesc(SysSystemRunningTime::getUpdateTime).last("limit 1"));
// sysSystemRunningTime.setEndTime(time);
// sysSystemRunningTime.setUpdateTime(time);
// sysSystemRunningTimeService.update(sysSystemRunningTime,new LambdaQueryWrapper<SysSystemRunningTime>()
// .eq(SysSystemRunningTime::getId,sysSystemRunningTime.getId()));
//
// //新增全局系统运行时间为当前时间
// SysSystemRunningTime temp = new SysSystemRunningTime();
// temp.setStartTime(time);
// temp.setType(type);
// temp.setEndTime(time);
// temp.setUpdateTime(time);
// sysSystemRunningTimeService.save(temp);
//
// //人工
// if(type == Constants.INT_1){
// //查询定时任务(状态为开启、业务类型为节能),并且关闭节能模式
// TimedTask timedTaskJn = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus,Constants.INT_1).eq(TimedTask::getBusinessType,Constants.INT_3).last("limit 1"));
// if(timedTaskJn != null){
// this.timedTask(timedTaskJn.getId(),timedTaskJn.getStartTime(),timedTaskJn.getEndTime(),Constants.INT_2,Constants.INT_3,null,"");
// }
// }else if(type == Constants.INT_2){
// //如果切换成节能模式,则关闭人工模式的定时任务,打开节能模式定时任务
// TimedTask timedTask = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus,Constants.INT_1)
// .eq(TimedTask::getBusinessType,Constants.INT_1)
// .last("limit 1"));
// //关闭人工模式的定时任务
// if(timedTask != null){
// //候车大厅全局
// this.timedTask(timedTask.getId(),timedTask.getStartTime(),timedTask.getEndTime(),Constants.INT_2,1,null,"");
// }
// //查询关闭得节能模式
// TimedTask timedTaskJn = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus,Constants.INT_2).eq(TimedTask::getBusinessType,Constants.INT_3).last("limit 1"));
// if(timedTaskJn != null){
// //打开节能模式定时任务
// this.timedTask(timedTaskJn.getId(), DateUtil.convertDateToMinute(time),timedTaskJn.getEndTime(),Constants.INT_1,Constants.INT_3,null,"");
// }else{
// this.timedTask("",DateUtil.convertDateToMinute(time),"",Constants.INT_1,Constants.INT_3,null,"");
// }
//
// //执行节能任务
// energyTask();
// }
//
// Map<String,Object> list = equipmentService.getList();
// webSocket.sendAllMessage(JSONObject.toJSONString(list));
// return R.ok();
// }
//
// /**
// * @param jobName @Description 移除任务(使用默认的任务组名 , 触发器名 , 触发器组名)
// */
// public static void removeJob(String jobName) {
// TriggerKey triggerKey1 = TriggerKey.triggerKey(jobName+"-start", TRIGGER_GROUP_NAME);
// TriggerKey triggerKey2 = TriggerKey.triggerKey(jobName+"-end", TRIGGER_GROUP_NAME);
// JobKey jobKey1 = JobKey.jobKey(jobName+"-start", JOB_GROUP_NAME);
// JobKey jobKey2 = JobKey.jobKey(jobName+"-end", JOB_GROUP_NAME);
// try {
// Scheduler sched = gSchedulerFactory.getScheduler();
// Trigger trigger1 = (Trigger) sched.getTrigger(triggerKey1);
// Trigger trigger2 = (Trigger) sched.getTrigger(triggerKey2);
// if (trigger1 == null && trigger2 == null) {
// return;
// }
// if(trigger1 != null){
// // 停止触发器
// sched.pauseTrigger(triggerKey1);
// // 移除触发器
// sched.unscheduleJob(triggerKey1);
// // 删除任务
// sched.deleteJob(jobKey1);
// System.err.println("移除任务:" + jobName+"-start");
// }
// if(trigger2 != null){
// // 停止触发器
// sched.pauseTrigger(triggerKey2);
// // 移除触发器
// sched.unscheduleJob(triggerKey2);
// // 删除任务
// sched.deleteJob(jobKey2);
// System.err.println("移除任务:" + jobName+"-end");
// }
// } catch (Exception ignored) {
// System.err.println("移除定时任务出错");
// }
// }
//
// @ApiOperation(value = "定时任务开启/关闭", notes = "定时任务开启")
// @ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "String")
// @PostMapping("/timedTask")
// public R timedTask(String taskId, String startTime, String endTime, Integer status,Integer businessType,Integer type, String isReboot) {
// TimedTask timedTask = null;
// //如果重启是启动的定时任务,不用更新数据库
// if(StringUtils.isBlank(isReboot)){
// SysUserEntity user = getUser();
// if(StringUtils.isBlank(taskId)){
// timedTask = new TimedTask();
// timedTask.setStartTime(startTime);
// timedTask.setBusinessType(businessType);
// timedTask.setType(type);
// timedTask.setEndTime(endTime);
// timedTask.setCreateTime(new Date());
// timedTask.setCreateUserId(user.getUserId());
// timedTask.setStatus(status);
// timedTaskService.save(timedTask);
// }else {
// timedTask = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getBusinessType,businessType)
// .eq(type != null,TimedTask::getType,type).last("limit 1"));
// timedTask.setStartTime(startTime);
// timedTask.setBusinessType(businessType);
// timedTask.setType(type);
// timedTask.setEndTime(endTime);
// timedTask.setStatus(status);
// timedTask.setUpdateTime(new Date());
// timedTask.setUpdateUserId(user.getUserId());
// timedTaskService.update(timedTask, new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getId,taskId));
// }
//
// taskId = timedTask.getId();
// }
//
// //开启
// if (status == 1) {
// //设置定时任务
// R error = setTimeTask(taskId,businessType,type,startTime, endTime);
// if (error != null) {
// return error;
// }
// }else{
// //关闭定时任务
// removeJob(taskId);
// }
// return R.ok();
// }
//
// /**
// * 设置定时任务
// * @param id
// * @param startTime
// * @param endTime
// * @return
// */
// private R setTimeTask(String id,Integer businessType,Integer type ,String startTime, String endTime){
// try {
// Scheduler sched = gSchedulerFactory.getScheduler();
// JobDetail job1 = null;
// Trigger trigger1 = null;
// JobDetail job2 = null;
// Trigger trigger2 = null;
// if(StringUtils.isNotBlank(startTime)){
// JobDataMap resJobDataMap1 = new JobDataMap();
// //设备开启
// resJobDataMap1.put("status", Constants.INT_1);
// resJobDataMap1.put("businessType", businessType);
// resJobDataMap1.put("type", type);
//
// job1 = JobBuilder.newJob(SimpleJob.class).withIdentity(id+"-start", JOB_GROUP_NAME).usingJobData(resJobDataMap1).build();
//
// String cron1 = "";
// if(businessType == Constants.INT_3){
// int time = Integer.valueOf(startTime) + 30;
// int time2 = time < 60 ? time : (time - 60);
// if(Integer.valueOf(startTime).intValue() > time2){
// cron1 = createCron2(String.valueOf(time2),startTime);
// }else{
// cron1 = createCron2(startTime,String.valueOf(time2));
// }
// }else{
// cron1 = createCron(startTime);
// }
// trigger1 = TriggerBuilder.newTrigger().withIdentity(id+"-start", TRIGGER_GROUP_NAME).startAt(new Date())
// .withSchedule(CronScheduleBuilder.cronSchedule(cron1).withMisfireHandlingInstructionDoNothing()).build();
// }
// if(StringUtils.isNotBlank(endTime)){
// JobDataMap resJobDataMap2 = new JobDataMap();
// //设备关闭
// resJobDataMap2.put("status", Constants.INT_2);
// resJobDataMap2.put("businessType", businessType);
// resJobDataMap2.put("type", type);
//
// job2 = JobBuilder.newJob(SimpleJob.class).withIdentity(id+"-end", JOB_GROUP_NAME).usingJobData(resJobDataMap2).build();
//
// String cron2 = "";
// if(businessType == Constants.INT_3){
// int time = Integer.valueOf(endTime) + 30;
// int time2 = time < 60 ? time : (time - 60);
// if(Integer.valueOf(endTime).intValue() > time2){
// cron2 = createCron2(String.valueOf(time2),endTime);
// }else{
// cron2 = createCron2(endTime,String.valueOf(time2));
// }
// }else{
// cron2 = createCron(endTime);
// }
// trigger2 = TriggerBuilder.newTrigger().withIdentity(id+"-end", TRIGGER_GROUP_NAME).startAt(new Date())
// .withSchedule(CronScheduleBuilder.cronSchedule(cron2).withMisfireHandlingInstructionDoNothing()).build();
// }
//
//
// if(job1 != null && trigger1 != null){
// // 交给scheduler去调度
// sched.scheduleJob(job1, trigger1);
// }
//
// if(job2 != null && trigger2 != null){
// sched.scheduleJob(job2, trigger2);
// }
// // 启动
// if (!sched.isShutdown()) {
// sched.start();
// }
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// System.err.println("设置定时任务1:" + id + "\n\t下次运行时间:" + sdf.format(trigger1.getNextFireTime()));
//// System.err.println("设置定时任务2:" + id + "\n\t下次运行时间:" + sdf.format(trigger2.getNextFireTime()));
// } catch (SchedulerException e) {
// e.printStackTrace();
// return R.error("时间设置有误!");
// }
// return null;
// }
//
// /**
// * 生成cron表达
// * @param time 时间
// * @return cron
// */
// public String createCron(String time){
// String[] strs = time.split(":");
// StringBuilder sb = new StringBuilder()
// .append(0).append(" ")
// .append(strs[1]).append(" ")
// .append(strs[0]).append(" * * ?");
// return sb.toString();
// }
//
// /**
// * 生成cron表达
// * @param time 时间
// * @return cron
// */
// public String createCron2(String time,String time2){
// //0 26,29,33 * * * ?
// StringBuilder sb = new StringBuilder()
// .append(0).append(" ")
// .append(time).append(",").append(time2)
// .append(" * * * ?");
//// System.out.println(sb.toString());
// return sb.toString();
// }
//
// /**
// * 获取电动门帘的定时任务数据
// * @return
// */
// @ApiOperation(value="获取电动门帘的定时任务数据", notes="获取电动门帘的定时任务数据")
// @GetMapping("/getAllDdml")
// public R getAllDdml() {
// List<TimedTask> timedTasks = timedTaskService.list(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getBusinessType,Constants.INT_2));
// return R.ok().put("list",timedTasks);
// }
//
// /**
// * 候车大厅头上所有显示数据
// * @return
// */
// @ApiOperation(value="候车大厅头上所有显示数据", notes="候车大厅头上所有显示数据")
// @GetMapping("/getAllHcdt")
// public R getAllHcdt() {
// SysSystemParams sysSystemParams = sysSystemParamsService.getById(Constants.STRING_1);
// return R.ok().put("sysSystemParams", sysSystemParams);
// }
//
// @ApiOperation(value = "切换模式", notes = "切换模式")
// @ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "String")
// @PostMapping("/checkModel")
// public R checkModel(Integer type,Integer status) {
// // 控制资源点
// checkModelOnOrOff(type, status);
//
// SysSystemParams sysSystemParams = sysSystemParamsService.getById(Constants.STRING_1);
// if(type == Constants.INT_1){
// sysSystemParams.setSun(status);
// sysSystemParams.setFan(Constants.INT_2);
// sysSystemParams.setNan(Constants.INT_2);
// }else if(type == Constants.INT_2){
// sysSystemParams.setSun(Constants.INT_2);
// sysSystemParams.setFan(status);
// sysSystemParams.setNan(Constants.INT_2);
// }else if(type == Constants.INT_3){
// sysSystemParams.setSun(Constants.INT_2);
// sysSystemParams.setFan(Constants.INT_2);
// sysSystemParams.setNan(status);
// }
// sysSystemParamsService.update(sysSystemParams,new LambdaQueryWrapper<SysSystemParams>()
// .eq(SysSystemParams::getId,sysSystemParams.getId()));
//
// Map<String,Object> list = equipmentService.getList();
// webSocket.sendAllMessage(JSONObject.toJSONString(list));
//
// return R.ok();
// }
//
//
//
// /**
// * 查询定时温控里面的数据
// * @return
// */
// @ApiOperation(value="查询定时温控里面的数据", notes="查询定时温控里面的数据")
// @GetMapping("/getAllDswk")
// public R getAllDswk() {
// TimedTask timedTask = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getBusinessType,Constants.INT_1).last("limit 1"));
// return R.ok().put("timedTask", timedTask);
// }
//
// @ApiOperation(value = "温度设定", notes = "温度设定")
// @PostMapping("/changeTemperature")
// public R changeTemperature(String temperature) {
// TimedTask timedTask = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getBusinessType,Constants.INT_1).last("limit 1"));
// timedTask.setTemperature(temperature);
// timedTaskService.update(timedTask,new LambdaQueryWrapper<TimedTask>()
// .eq(TimedTask::getId,timedTask.getId()));
// return R.ok();
// }
//
// /**
// * @Title: 设备开关
// * @param model
// * @return Map<String,String>
// */
// @PostMapping("/onOrOff")
// public Map<String, Object> doorOnOff(@RequestBody LiResourceModel model) {
//// String postUrl = getUrl(model.getStationId());
// return onOrOff(model);
// }
//
// /**
// * 执行节能任务
// */
// private Map<String, Object> energyTask() {
//// String postUrl = "http://192.168.0.222:8089/command/energyTask";
// String postUrl = "http://localhost:8089/command/energyTask";
// Map<String, String> postParam = new HashMap<String, String>(10);
// Map<String, Object> resultMap = TestClient.uploadText(postUrl, postParam);
// Map<String, Object> map = null;
// if (Constants.STRING_200.equals(resultMap.get(Constants.STATUS_CODE).toString())) {
// map = JSONObject.parseObject(resultMap.get("data").toString(), Map.class);
// }
// return map;
// }
//
// /**
// * 根据选择人工模式,来控制资源点启停
// * @param type 1=供暖模式,2=机械通风,3=自然通风
// * @param status 1=开启,2=关闭
// */
// private Map<String, Object> checkModelOnOrOff(Integer type, Integer status) {
//// String postUrl = "http://192.168.0.222:8089/command/operationType";
// String postUrl = "http://localhost:8089/command/operationType";
// Map<String, String> postParam = new HashMap<String, String>(10);
// postParam.put("params",status==1 ? "1": "0");
// postParam.put("rgType", type.toString());
// postParam.put("userId", getUserId());
// postParam.put("userName", getUser().getName());
//
// Map<String, Object> resultMap = TestClient.uploadText(postUrl, postParam);
// Map<String, Object> map = null;
// if (Constants.STRING_200.equals(resultMap.get(Constants.STATUS_CODE).toString())) {
// map = JSONObject.parseObject(resultMap.get("data").toString(), Map.class);
// }
// return map;
// }
//
// private Map<String, Object> onOrOff(LiResourceModel model) {
//// String postUrl = "http://192.168.0.222:8089/command/operation";
// String postUrl = "http://localhost:8089/command/operation";
// Map<String, String> postParam = new HashMap<String, String>(10);
// postParam.put("liResourceId", model.getId());
// postParam.put("params", (model.getActionType()==Constants.INT_5 || model.getActionType()==Constants.INT_6 || model.getActionType()==Constants.INT_7
// || model.getActionType()==Constants.INT_8|| model.getActionType()==Constants.INT_9) ? model.getParams() : model.getStatus().toString());
// postParam.put("paramsName", model.getActionName());
// postParam.put("actionType", model.getActionType().toString());
// postParam.put("userId", getUserId());
// postParam.put("userName", getUser().getName());
//
// Map<String, Object> resultMap = TestClient.uploadText(postUrl, postParam);
// Map<String, Object> map = null;
// if (Constants.STRING_200.equals(resultMap.get(Constants.STATUS_CODE).toString())) {
// map = JSONObject.parseObject(resultMap.get("data").toString(), Map.class);
// }
// return map;
//
// }
//
// private String getUrl(String stationId) {
// LiStation liStation = liStationService.getById(stationId);
// return liStation.getByx1();
// }
//
//
//}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/controller/EquipmentController3.java
0 → 100644
View file @
b845d14a
//package com.devplatform.admin.modules.eq.controller;
//
//import com.alibaba.fastjson.JSONObject;
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.devplatform.admin.common.scheduling.SimpleJob;
//import com.devplatform.admin.common.utils.AbstractController;
//import com.devplatform.admin.common.utils.Constants;
//import com.devplatform.admin.common.utils.DateUtil;
//import com.devplatform.admin.common.utils.TestClient;
//import com.devplatform.admin.config.WebSocket;
//import com.devplatform.admin.modules.eq.bean.TimedTask;
//import com.devplatform.admin.modules.eq.service.EquipmentService;
//import com.devplatform.admin.modules.eq.service.TimedTaskService;
//import com.devplatform.admin.modules.liresource.bean.LiStation;
//import com.devplatform.admin.modules.liresource.model.LiResourceModel;
//import com.devplatform.admin.modules.liresource.service.LiResourceService;
//import com.devplatform.admin.modules.liresource.service.LiStationService;
//import com.devplatform.admin.modules.sys.bean.SysSystemParams;
//import com.devplatform.admin.modules.sys.bean.SysSystemRunningTime;
//import com.devplatform.admin.modules.sys.bean.SysUserEntity;
//import com.devplatform.admin.modules.sys.service.SysSystemParamsService;
//import com.devplatform.admin.modules.sys.service.SysSystemRunningTimeService;
//import com.devplatform.common.util.R;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiOperation;
//import lombok.ToString;
//import org.apache.commons.lang.StringUtils;
//import org.quartz.*;
//import org.quartz.impl.StdSchedulerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.web.bind.annotation.*;
//
//import java.text.SimpleDateFormat;
//import java.util.Calendar;
//import java.util.*;
//
///**
// * 设备控制
// *
// * @author dxw
// */
//@ToString
//@Api(tags = {"设备接口"})
//@RestController
//@RequestMapping("/equipment")
//public class EquipmentController3 extends AbstractController {
// private static SchedulerFactory gSchedulerFactory = new StdSchedulerFactory();
// private static String JOB_GROUP_NAME = "quartz_name";
// private static String TRIGGER_GROUP_NAME = "quartz_group";
// @Autowired
// private EquipmentService equipmentService;
// @Autowired
// private SysSystemParamsService sysSystemParamsService;
// @Autowired
// private SysSystemRunningTimeService sysSystemRunningTimeService;
// @Autowired
// private TimedTaskService timedTaskService;
// @Autowired
// private LiStationService liStationService;
// @Autowired
// private WebSocket webSocket;
// @Autowired
// private LiResourceService liResourceService;
// //节能大循环节能算法间隔分钟
// @Value("${bigTime}")
// private String bigTime;
// //节能小循环节能算法间隔分钟
// @Value("${smallTime}")
// private String smallTime;
// /**
// * 获取每个设备最新的参数值
// *
// * @return
// */
// @ApiOperation(value = "获取每个设备最新的参数值", notes = "获取每个设备最新的参数值")
// @GetMapping("/getListParam")
// public R getListParam() {
// Map<String, Object> list = equipmentService.getList();
// return R.ok().put("bean", list);
// }
//
// /**
// * 发送每个设备最新的参数值
// *
// * @return
// */
// @ApiOperation(value = "发送每个设备最新的参数值", notes = "发送每个设备最新的参数值")
// @PostMapping("/sendParamsInfo")
// public R sendParamsInfo() {
// Map<String, Object> list = equipmentService.getList();
// webSocket.sendAllMessage(JSONObject.toJSONString(list));
// return R.ok();
// }
//
// /**
// * 切换人工/节能模式
// *
// * @return
// */
// @ApiOperation(value = "切换人工/节能模式", notes = "切换人工/节能模式")
// @GetMapping("/changeType")
// public R changeType(Integer type) throws InterruptedException {
// Date time = new Date();
// //关闭全局得供暖、机械通风、自然通风模式
// SysSystemParams sysSystemParams = new SysSystemParams();
// sysSystemParams.setId(Constants.STRING_1);
// sysSystemParams.setType(type);
// sysSystemParams.setUpdateTime(time);
// sysSystemParams.setSun(Constants.INT_2);
// sysSystemParams.setFan(Constants.INT_2);
// sysSystemParams.setNan(Constants.INT_2);
// sysSystemParamsService.update(sysSystemParams, new LambdaQueryWrapper<SysSystemParams>()
// .eq(SysSystemParams::getId, Constants.STRING_1));
//
// //修改全局系统运行得结束时间
// SysSystemRunningTime sysSystemRunningTime = sysSystemRunningTimeService.getOne(new LambdaQueryWrapper<SysSystemRunningTime>()
// .orderByDesc(SysSystemRunningTime::getUpdateTime).last("limit 1"));
// sysSystemRunningTime.setEndTime(time);
// sysSystemRunningTime.setUpdateTime(time);
// sysSystemRunningTimeService.update(sysSystemRunningTime, new LambdaQueryWrapper<SysSystemRunningTime>()
// .eq(SysSystemRunningTime::getId, sysSystemRunningTime.getId()));
//
// //新增全局系统运行时间为当前时间
// SysSystemRunningTime temp = new SysSystemRunningTime();
// temp.setStartTime(time);
// temp.setType(type);
// temp.setEndTime(time);
// temp.setUpdateTime(time);
// sysSystemRunningTimeService.save(temp);
//
// //人工
// if (type == Constants.INT_1) {
// //查询定时任务(状态为开启、业务类型为节能),并且关闭节能模式
// //关闭节能大循环定时任务
// TimedTask timedTaskJnBig = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus, Constants.INT_1).eq(TimedTask::getBusinessType, Constants.INT_3).eq(TimedTask::getBusinessSonType,Constants.INT_1));
// if (timedTaskJnBig != null) {
// this.timedTask(timedTaskJnBig.getId(), timedTaskJnBig.getStartTime(), timedTaskJnBig.getEndTime(), Constants.INT_2, Constants.INT_3, null, "",Constants.INT_1);
// }
// //关闭节能小循环定时任务
// TimedTask timedTaskJnSmall = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus, Constants.INT_1).eq(TimedTask::getBusinessType, Constants.INT_3).eq(TimedTask::getBusinessSonType,Constants.INT_2));
// if (timedTaskJnSmall != null) {
// this.timedTask(timedTaskJnSmall.getId(), timedTaskJnSmall.getStartTime(), timedTaskJnSmall.getEndTime(), Constants.INT_2, Constants.INT_3, null, "",Constants.INT_2);
// }
// //查询人工定时任务
// TimedTask timedTask = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus, Constants.INT_2)
// .eq(TimedTask::getBusinessType, Constants.INT_1)
// .last("limit 1"));
// if(timedTask != null){
// //开启人工定时任务
// this.timedTask(timedTask.getId(),timedTask.getStartTime() , timedTask.getEndTime(), Constants.INT_1, Constants.INT_1, null, "",Constants.INT_3);
// }
// } else if (type == Constants.INT_2) {
// //如果切换成节能模式,则关闭人工模式的定时任务,打开节能模式定时任务
// TimedTask timedTask = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus, Constants.INT_1)
// .eq(TimedTask::getBusinessType, Constants.INT_1)
// .last("limit 1"));
// //关闭人工模式的定时任务
// if (timedTask != null) {
// //候车大厅全局
// this.timedTask(timedTask.getId(), timedTask.getStartTime(), timedTask.getEndTime(), Constants.INT_2, 1, null, "",Constants.INT_3);
// }
// //查询关闭得节能大循环节能模式
// TimedTask timedTaskJnBig = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus, Constants.INT_2).eq(TimedTask::getBusinessType, Constants.INT_3).eq(TimedTask::getBusinessSonType, Constants.INT_1));
// if (timedTaskJnBig != null) {
// //打开节能大循环节能模式定时任务
// this.timedTask(timedTaskJnBig.getId(), DateUtil.convertDateToMinute(time), timedTaskJnBig.getEndTime(), Constants.INT_1, Constants.INT_3, null, "",Constants.INT_1);
// } else {
// this.timedTask("", DateUtil.convertDateToMinute(time), "", Constants.INT_1, Constants.INT_3, null, "",Constants.INT_1);
// }
// //查询关闭得节能小循环节能模式
// TimedTask timedTaskJnsmall = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getStatus, Constants.INT_2).eq(TimedTask::getBusinessType, Constants.INT_3).eq(TimedTask::getBusinessSonType, Constants.INT_2));
// if (timedTaskJnsmall != null) {
// //打开节能小循环节能模式定时任务
// this.timedTask(timedTaskJnsmall.getId(), DateUtil.convertDateToMinute(time), timedTaskJnsmall.getEndTime(), Constants.INT_1, Constants.INT_3, null, "",Constants.INT_2);
// } else {
// this.timedTask("", DateUtil.convertDateToMinute(time), "", Constants.INT_1, Constants.INT_3, null, "",Constants.INT_2);
// }
// //获取当前月、日、小时
// Calendar calendar = Calendar.getInstance();
// Integer month = calendar.get(Calendar.MONTH) + 1; // 月份是从0开始的,所以加1
// if (month != 3 && month != 4) {
// //执行节能任务大循环算法
// energyTask();
// Thread.sleep(10000);
// //执行节能任务小循环算法
// energyTask2();
// }
// }
//
// Map<String, Object> list = equipmentService.getList();
// webSocket.sendAllMessage(JSONObject.toJSONString(list));
// return R.ok();
// }
//
// /**
// * @param jobName @Description 移除任务(使用默认的任务组名 , 触发器名 , 触发器组名)
// */
// public static void removeJob(String jobName) {
// TriggerKey triggerKey1 = TriggerKey.triggerKey(jobName + "-start", TRIGGER_GROUP_NAME);
// TriggerKey triggerKey2 = TriggerKey.triggerKey(jobName + "-end", TRIGGER_GROUP_NAME);
// JobKey jobKey1 = JobKey.jobKey(jobName + "-start", JOB_GROUP_NAME);
// JobKey jobKey2 = JobKey.jobKey(jobName + "-end", JOB_GROUP_NAME);
// try {
// Scheduler sched = gSchedulerFactory.getScheduler();
// Trigger trigger1 = (Trigger) sched.getTrigger(triggerKey1);
// Trigger trigger2 = (Trigger) sched.getTrigger(triggerKey2);
// if (trigger1 == null && trigger2 == null) {
// return;
// }
// if (trigger1 != null) {
// // 停止触发器
// sched.pauseTrigger(triggerKey1);
// // 移除触发器
// sched.unscheduleJob(triggerKey1);
// // 删除任务
// sched.deleteJob(jobKey1);
// System.err.println("移除任务:" + jobName + "-start");
// }
// if (trigger2 != null) {
// // 停止触发器
// sched.pauseTrigger(triggerKey2);
// // 移除触发器
// sched.unscheduleJob(triggerKey2);
// // 删除任务
// sched.deleteJob(jobKey2);
// System.err.println("移除任务:" + jobName + "-end");
// }
// } catch (Exception ignored) {
// System.err.println("移除定时任务出错");
// }
// }
//
// @ApiOperation(value = "定时任务开启/关闭", notes = "定时任务开启")
// @ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "String")
// @PostMapping("/timedTask")
// public R timedTask(String taskId, String startTime, String endTime, Integer status, Integer businessType, Integer type, String isReboot,Integer businessSonType) {
// TimedTask timedTask = null;
// //如果重启是启动的定时任务,不用更新数据库
// if (StringUtils.isBlank(isReboot)) {
// SysUserEntity user = getUser();
// if (StringUtils.isBlank(taskId)) {
// timedTask = new TimedTask();
// timedTask.setStartTime(startTime);
// timedTask.setBusinessType(businessType);
// timedTask.setType(type);
// timedTask.setEndTime(endTime);
// timedTask.setCreateTime(new Date());
// timedTask.setCreateUserId(user.getUserId());
// timedTask.setStatus(status);
// timedTaskService.save(timedTask);
// } else {
//
// timedTask = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getBusinessType, businessType)
// .eq(type != null, TimedTask::getType, type).eq(businessSonType != null, TimedTask::getBusinessSonType, businessSonType).last("limit 1"));
// timedTask.setStartTime(startTime);
// timedTask.setBusinessType(businessType);
// timedTask.setType(type);
// timedTask.setEndTime(endTime);
// timedTask.setStatus(status);
// timedTask.setUpdateTime(new Date());
// timedTask.setUpdateUserId(user.getUserId());
// timedTaskService.update(timedTask, new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getId, taskId));
// }
//
// taskId = timedTask.getId();
// }
//
// //开启
// if (status == 1) {
// //设置定时任务
// R error = setTimeTask(taskId, businessType, type, startTime, endTime,businessSonType);
// if (error != null) {
// return error;
// }
// } else {
// //关闭定时任务
// removeJob(taskId);
// }
// return R.ok();
// }
//
// /**
// * 设置定时任务
// *
// * @param id
// * @param startTime
// * @param endTime
// * @return
// */
// private R setTimeTask(String id, Integer businessType, Integer type, String startTime, String endTime,Integer businessSonType) {
// try {
// Scheduler sched = gSchedulerFactory.getScheduler();
// JobDetail job1 = null;
// Trigger trigger1 = null;
// JobDetail job2 = null;
// Trigger trigger2 = null;
// if (StringUtils.isNotBlank(startTime)) {
// JobDataMap resJobDataMap1 = new JobDataMap();
// //设备开启
// resJobDataMap1.put("status", Constants.INT_1);
// resJobDataMap1.put("businessType", businessType);
// resJobDataMap1.put("type", type);
// resJobDataMap1.put("businessSonType", businessSonType);
// job1 = JobBuilder.newJob(SimpleJob.class).withIdentity(id + "-start", JOB_GROUP_NAME).usingJobData(resJobDataMap1).build();
//
// String cron1 = "0 0/2 * * * ?";
// if (businessType == Constants.INT_3) {
// //控制间隔多长时间执行
// //int time = Integer.valueOf(startTime) + 30;
// int time = 0;
// if(businessSonType == Constants.INT_1){
// time = Integer.valueOf(startTime) + Integer.valueOf(bigTime);
// }else {
// time = Integer.valueOf(startTime) + Integer.valueOf(smallTime);
// }
// int time2 = time < 60 ? time : (time - 60);
// if (Integer.valueOf(startTime).intValue() > time2) {
// cron1 = createCron2(String.valueOf(time2), startTime);
// } else {
// cron1 = createCron2(startTime, String.valueOf(time2));
// }
// } else {
// cron1 = createCron(startTime);
// }
// trigger1 = TriggerBuilder.newTrigger().withIdentity(id + "-start", TRIGGER_GROUP_NAME).startAt(new Date())
// .withSchedule(CronScheduleBuilder.cronSchedule(cron1).withMisfireHandlingInstructionDoNothing()).build();
// }
// if (StringUtils.isNotBlank(endTime)) {
// JobDataMap resJobDataMap2 = new JobDataMap();
// //设备关闭
// resJobDataMap2.put("status", Constants.INT_2);
// resJobDataMap2.put("businessType", businessType);
// resJobDataMap2.put("type", type);
//
// job2 = JobBuilder.newJob(SimpleJob.class).withIdentity(id + "-end", JOB_GROUP_NAME).usingJobData(resJobDataMap2).build();
//
// String cron2 = "";
// if (businessType == Constants.INT_3) {
// int time = Integer.valueOf(endTime) + 30;
// int time2 = time < 60 ? time : (time - 60);
// if (Integer.valueOf(endTime).intValue() > time2) {
// cron2 = createCron2(String.valueOf(time2), endTime);
// } else {
// cron2 = createCron2(endTime, String.valueOf(time2));
// }
// } else {
// cron2 = createCron(endTime);
// }
// trigger2 = TriggerBuilder.newTrigger().withIdentity(id + "-end", TRIGGER_GROUP_NAME).startAt(new Date())
// .withSchedule(CronScheduleBuilder.cronSchedule(cron2).withMisfireHandlingInstructionDoNothing()).build();
// }
//
//
// if (job1 != null && trigger1 != null) {
// // 交给scheduler去调度
// sched.scheduleJob(job1, trigger1);
// }
//
// if (job2 != null && trigger2 != null) {
// sched.scheduleJob(job2, trigger2);
// }
// // 启动
// if (!sched.isShutdown()) {
// sched.start();
// }
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// System.err.println("设置定时任务1:" + id + "\n\t下次运行时间:" + sdf.format(trigger1.getNextFireTime()));
//// System.err.println("设置定时任务2:" + id + "\n\t下次运行时间:" + sdf.format(trigger2.getNextFireTime()));
// } catch (SchedulerException e) {
// e.printStackTrace();
// return R.error("时间设置有误!");
// }
// return null;
// }
//
// /**
// * 生成cron表达
// *
// * @param time 时间
// * @return cron
// */
// public String createCron(String time) {
// String[] strs = time.split(":");
// StringBuilder sb = new StringBuilder()
// .append(0).append(" ")
// .append(strs[1]).append(" ")
// .append(strs[0]).append(" * * ?");
// return sb.toString();
// }
//
// /**
// * 生成cron表达
// *
// * @param time 时间
// * @return cron
// */
// public String createCron2(String time, String time2) {
// //0 26,29,33 * * * ?
// //0 45,45,* * * * ?
// StringBuilder sb = new StringBuilder()
// .append(0).append(" ")
// .append(time).append(",").append(time2)
// .append(" * * * ?");
//// System.out.println(sb.toString());
// return sb.toString();
// }
//
// /**
// * 获取电动门帘的定时任务数据
// *
// * @return
// */
// @ApiOperation(value = "获取电动门帘的定时任务数据", notes = "获取电动门帘的定时任务数据")
// @GetMapping("/getAllDdml")
// public R getAllDdml() {
// List<TimedTask> timedTasks = timedTaskService.list(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getBusinessType, Constants.INT_2));
// return R.ok().put("list", timedTasks);
// }
//
// /**
// * 候车大厅头上所有显示数据
// *
// * @return
// */
// @ApiOperation(value = "候车大厅头上所有显示数据", notes = "候车大厅头上所有显示数据")
// @GetMapping("/getAllHcdt")
// public R getAllHcdt() {
// SysSystemParams sysSystemParams = sysSystemParamsService.getById(Constants.STRING_1);
// return R.ok().put("sysSystemParams", sysSystemParams);
// }
//
// @ApiOperation(value = "切换模式", notes = "切换模式")
// @ApiImplicitParam(name = "id", value = "主键", required = true, dataType = "String")
// @PostMapping("/checkModel")
// public R checkModel(Integer type, Integer status) {
// // 控制资源点
// checkModelOnOrOff(type, status);
//
// SysSystemParams sysSystemParams = sysSystemParamsService.getById(Constants.STRING_1);
// if (type == Constants.INT_1) {
// sysSystemParams.setSun(status);
// sysSystemParams.setFan(Constants.INT_2);
// sysSystemParams.setNan(Constants.INT_2);
// } else if (type == Constants.INT_2) {
// sysSystemParams.setSun(Constants.INT_2);
// sysSystemParams.setFan(status);
// sysSystemParams.setNan(Constants.INT_2);
// } else if (type == Constants.INT_3) {
// sysSystemParams.setSun(Constants.INT_2);
// sysSystemParams.setFan(Constants.INT_2);
// sysSystemParams.setNan(status);
// }
// sysSystemParamsService.update(sysSystemParams, new LambdaQueryWrapper<SysSystemParams>()
// .eq(SysSystemParams::getId, sysSystemParams.getId()));
//
// Map<String, Object> list = equipmentService.getList();
// webSocket.sendAllMessage(JSONObject.toJSONString(list));
//
// return R.ok();
// }
//
//
// /**
// * 查询定时温控里面的数据
// *
// * @return
// */
// @ApiOperation(value = "查询定时温控里面的数据", notes = "查询定时温控里面的数据")
// @GetMapping("/getAllDswk")
// public R getAllDswk() {
// TimedTask timedTask = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getBusinessType, Constants.INT_1).last("limit 1"));
// return R.ok().put("timedTask", timedTask);
// }
//
// @ApiOperation(value = "温度设定", notes = "温度设定")
// @PostMapping("/changeTemperature")
// public R changeTemperature(String temperature) {
// TimedTask timedTask = timedTaskService.getOne(new LambdaQueryWrapper<TimedTask>().eq(TimedTask::getBusinessType, Constants.INT_1).last("limit 1"));
// timedTask.setTemperature(temperature);
// timedTaskService.update(timedTask, new LambdaQueryWrapper<TimedTask>()
// .eq(TimedTask::getId, timedTask.getId()));
// return R.ok();
// }
//
// /**
// * @param model
// * @return Map<String, String>
// * @Title: 设备开关
// */
// @PostMapping("/onOrOff")
// public Map<String, Object> doorOnOff(@RequestBody LiResourceModel model) {
//// String postUrl = getUrl(model.getStationId());
// return onOrOff(model);
// }
//
// /**
// * 执行节能任务大循环
// */
// private Map<String, Object> energyTask() {
//// String postUrl = "http://192.168.0.222:8089/command/energyTask";
// String postUrl = "http://localhost:8089/command/energyTask";
// Map<String, String> postParam = new HashMap<String, String>(10);
// Map<String, Object> resultMap = TestClient.uploadText(postUrl, postParam);
// Map<String, Object> map = null;
// if (Constants.STRING_200.equals(resultMap.get(Constants.STATUS_CODE).toString())) {
// map = JSONObject.parseObject(resultMap.get("data").toString(), Map.class);
// }
// return map;
// }
// /**
// * 执行节能任务小循环
// */
// private Map<String, Object> energyTask2() {
//// String postUrl = "http://192.168.0.222:8089/command/energyTask";
// String postUrl = "http://localhost:8089/command/energyTask2";
// Map<String, String> postParam = new HashMap<String, String>(10);
// Map<String, Object> resultMap = TestClient.uploadText(postUrl, postParam);
// Map<String, Object> map = null;
// if (Constants.STRING_200.equals(resultMap.get(Constants.STATUS_CODE).toString())) {
// map = JSONObject.parseObject(resultMap.get("data").toString(), Map.class);
// }
// return map;
// }
//
// /**
// * 根据选择人工模式,来控制资源点启停
// *
// * @param type 1=供暖模式,2=机械通风,3=自然通风
// * @param status 1=开启,2=关闭
// */
// private Map<String, Object> checkModelOnOrOff(Integer type, Integer status) {
//// String postUrl = "http://192.168.0.222:8089/command/operationType";
// String postUrl = "http://localhost:8089/command/operationType";
// Map<String, String> postParam = new HashMap<String, String>(10);
// postParam.put("params", status == 1 ? "1" : "0");
// postParam.put("rgType", type.toString());
// postParam.put("userId", getUserId());
// postParam.put("userName", getUser().getName());
//
// Map<String, Object> resultMap = TestClient.uploadText(postUrl, postParam);
// Map<String, Object> map = null;
// if (Constants.STRING_200.equals(resultMap.get(Constants.STATUS_CODE).toString())) {
// map = JSONObject.parseObject(resultMap.get("data").toString(), Map.class);
// }
// return map;
// }
//
// private Map<String, Object> onOrOff(LiResourceModel model) {
//// String postUrl = "http://192.168.0.222:8089/command/operation";
// String postUrl = "http://localhost:8089/command/operation";
// Map<String, String> postParam = new HashMap<String, String>(10);
// postParam.put("liResourceId", model.getId());
// postParam.put("params", (model.getActionType() == Constants.INT_5 || model.getActionType() == Constants.INT_6 || model.getActionType() == Constants.INT_7
// || model.getActionType() == Constants.INT_8 || model.getActionType() == Constants.INT_9) ? model.getParams() : model.getStatus().toString());
// postParam.put("paramsName", model.getActionName());
// postParam.put("actionType", model.getActionType().toString());
// postParam.put("userId", getUserId());
// postParam.put("userName", getUser().getName());
//
// Map<String, Object> resultMap = TestClient.uploadText(postUrl, postParam);
// Map<String, Object> map = null;
// if (Constants.STRING_200.equals(resultMap.get(Constants.STATUS_CODE).toString())) {
// map = JSONObject.parseObject(resultMap.get("data").toString(), Map.class);
// }
// return map;
//
// }
//
// private String getUrl(String stationId) {
// LiStation liStation = liStationService.getById(stationId);
// return liStation.getByx1();
// }
//
//
//}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/dao/KqcljInfoDao.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
dao
;
import
com.devplatform.admin.modules.eq.bean.KqcljInfo
;
import
com.devplatform.common.dao.MyBaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
/**
* KqcljInfo Mapper
* 用于空气处理机信息的数据库操作
* @author Administrator
*
*/
@Mapper
public
interface
KqcljInfoDao
extends
MyBaseMapper
<
KqcljInfo
>
{
List
<
Map
<
String
,
Object
>>
getList
();
BigDecimal
getTotalEnergy
(
String
time
);
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/dao/KqcljInfoHourDao.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
dao
;
import
com.devplatform.admin.modules.eq.bean.KqcljInfoHour
;
import
com.devplatform.common.dao.MyBaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* KqcljInfoHour Mapper
* 用于空气处理机信息-时的数据库操作
* @author Administrator
*
*/
@Mapper
public
interface
KqcljInfoHourDao
extends
MyBaseMapper
<
KqcljInfoHour
>
{
List
<
Map
<
String
,
Object
>>
queryListByParam
(
@Param
(
"startTime"
)
String
startTime
,
@Param
(
"endTime"
)
String
endTime
);
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/dao/SnqxzInfoDao.java
View file @
b845d14a
...
...
@@ -32,4 +32,6 @@ public interface SnqxzInfoDao extends MyBaseMapper<SnqxzInfo> {
List
<
SnqxzInfo
>
queryPageList
(
SnqxzInfoModel
model
);
List
<
Map
<
String
,
Object
>>
getList
();
List
<
Map
<
String
,
Object
>>
getList2
(
String
time
);
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/dao/SwqxzInfoDao.java
View file @
b845d14a
...
...
@@ -32,4 +32,6 @@ public interface SwqxzInfoDao extends MyBaseMapper<SwqxzInfo> {
List
<
SwqxzInfo
>
queryPageList
(
SwqxzInfoModel
model
);
List
<
Map
<
String
,
Object
>>
getList
();
List
<
Map
<
String
,
Object
>>
getList2
();
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/dao/WarnInfoDao.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
dao
;
import
com.devplatform.admin.modules.eq.bean.WarnInfo
;
import
com.devplatform.common.dao.MyBaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* WarnInfo Mapper
* 算法模块预警信息的数据库操作
* @author Administrator
*
*/
@Mapper
public
interface
WarnInfoDao
extends
MyBaseMapper
<
WarnInfo
>
{
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/dao/ZyFlrbInfoDao.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
dao
;
import
com.devplatform.admin.modules.eq.bean.ZyFlrbInfo
;
import
com.devplatform.common.dao.MyBaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
/**
* ZyFlrbInfo Mapper
* 用于资阳西站风冷热泵机组信息的数据库操作
* @author Administrator
*
*/
@Mapper
public
interface
ZyFlrbInfoDao
extends
MyBaseMapper
<
ZyFlrbInfo
>
{
List
<
Map
<
String
,
Object
>>
getList
();
ZyFlrbInfo
selectZyFlrbInfo
(
@Param
(
"resourceId"
)
String
resourceId
,
@Param
(
"time"
)
String
time
);
BigDecimal
getTotalEnergy
(
String
time
);
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/dao/ZyJfktpInfoDao.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
dao
;
import
com.devplatform.admin.modules.eq.bean.ZyJfktpInfo
;
import
com.devplatform.common.dao.MyBaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
/**
* JfktpInfo Mapper
* 用于资阳西站空调机组信息的数据库操作
* @author Administrator
*
*/
@Mapper
public
interface
ZyJfktpInfoDao
extends
MyBaseMapper
<
ZyJfktpInfo
>
{
List
<
Map
<
String
,
Object
>>
getList
();
ZyJfktpInfo
selectZyJfktpInfo
(
@Param
(
"resourceId"
)
String
resourceId
,
@Param
(
"time"
)
String
time
);
BigDecimal
getTotalEnergy
(
String
time
);
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/AnalysisService.java
View file @
b845d14a
...
...
@@ -17,4 +17,6 @@ public interface AnalysisService {
List
<
List
<
String
>>
getEnergyListFx
(
String
startTime
,
String
endTime
,
String
resourceType
);
void
toExcel
(
HttpServletResponse
response
,
String
startTime
,
String
endTime
,
String
resourceType
);
List
<
List
<
String
>>
getZyEnergyFx
(
String
startTime
,
String
endTime
,
String
resourceType
);
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/EquipmentService.java
View file @
b845d14a
...
...
@@ -9,4 +9,6 @@ import java.util.Map;
public
interface
EquipmentService
{
Map
<
String
,
Object
>
getList
();
Map
<
String
,
Object
>
getList2
(
String
startTime
,
String
endTime
,
String
resourceType
);
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/KqcljInfoHourService.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
service
;
import
com.devplatform.admin.modules.eq.bean.KqcljInfoHour
;
import
com.devplatform.common.service.MyBaseService
;
import
java.util.List
;
import
java.util.Map
;
/**
* 空气处理机-时的service接口
* <br>
* <b>功能:</b>JfktpInfoHourService<br>
* @author 代码生成器产生
*/
public
interface
KqcljInfoHourService
extends
MyBaseService
<
KqcljInfoHour
>
{
List
<
Map
<
String
,
Object
>>
queryListByParam
(
String
startTime
,
String
endTime
);
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/KqcljInfoService.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
service
;
import
com.devplatform.admin.modules.eq.bean.KqcljInfo
;
import
com.devplatform.common.service.MyBaseService
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
/**
* 空气处理机信息的service接口
* <br>
* <b>功能:</b>KqcljInfoService<br>
* @author 代码生成器产生
*/
public
interface
KqcljInfoService
extends
MyBaseService
<
KqcljInfo
>
{
List
<
Map
<
String
,
Object
>>
getList
();
BigDecimal
getTotalEnergy
(
String
time
);
List
<
Map
<
String
,
Object
>>
queryListByParam
(
String
startTime
,
String
endTime
);
}
\ No newline at end of file
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/SnqxzInfoService.java
View file @
b845d14a
...
...
@@ -23,4 +23,6 @@ public interface SnqxzInfoService extends MyBaseService<SnqxzInfo> {
List
<
SnqxzInfo
>
queryPageList
(
SnqxzInfoModel
model
);
List
<
Map
<
String
,
Object
>>
getList
();
List
<
Map
<
String
,
Object
>>
getList2
(
String
time
);
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/SwqxzInfoService.java
View file @
b845d14a
...
...
@@ -23,4 +23,5 @@ public interface SwqxzInfoService extends MyBaseService<SwqxzInfo> {
List
<
SwqxzInfo
>
queryPageList
(
SwqxzInfoModel
model
);
List
<
Map
<
String
,
Object
>>
getList
();
List
<
Map
<
String
,
Object
>>
getList2
();
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/WarnInfoService.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
service
;
import
com.devplatform.admin.modules.eq.bean.WarnInfo
;
import
com.devplatform.common.service.MyBaseService
;
import
java.util.List
;
/**
* 算法模块预警信息的service接口
* <br>
* <b>功能:</b>TotalMonthService<br>
* @author 代码生成器产生
*/
public
interface
WarnInfoService
extends
MyBaseService
<
WarnInfo
>
{
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/ZyFlrbInfoService.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
service
;
import
com.devplatform.admin.modules.eq.bean.ZyFlrbInfo
;
import
com.devplatform.common.service.MyBaseService
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
/**
* 资阳西站风冷热泵机组信息的service接口
* <br>
* <b>功能:</b>FlrbInfoService<br>
* @author 代码生成器产生
*/
public
interface
ZyFlrbInfoService
extends
MyBaseService
<
ZyFlrbInfo
>
{
List
<
Map
<
String
,
Object
>>
getList
();
ZyFlrbInfo
selectZyFlrbInfo
(
String
resourceId
,
String
time
);
BigDecimal
getTotalEnergy
(
String
time
);
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/ZyJfktpInfoService.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
service
;
import
com.devplatform.admin.modules.eq.bean.ZyJfktpInfo
;
import
com.devplatform.common.service.MyBaseService
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
/**
* 资阳西站空调机组信息的service接口
* <br>
* <b>功能:</b>JfktpInfoService<br>
* @author 代码生成器产生
*/
public
interface
ZyJfktpInfoService
extends
MyBaseService
<
ZyJfktpInfo
>
{
List
<
Map
<
String
,
Object
>>
getList
();
ZyJfktpInfo
selectZyJfktpInfo
(
String
resourceId
,
String
time
);
BigDecimal
getTotalEnergy
(
String
time
);
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/impl/AnalysisServiceImpl.java
View file @
b845d14a
...
...
@@ -17,11 +17,13 @@ import org.springframework.stereotype.Service;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.OutputStream
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
/**
* 设备的service接口实现类
*
* @author dxw
*/
@Service
(
"analysisService"
)
...
...
@@ -51,48 +53,50 @@ public class AnalysisServiceImpl implements AnalysisService {
private
SbInfoService
sbInfoService
;
@Autowired
private
SysResourceRunningTimeTjService
sysResourceRunningTimeTjService
;
@Autowired
private
KqcljInfoService
kqcljInfoService
;
@Override
public
Map
<
String
,
Object
>
getSyParam
()
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
public
Map
<
String
,
Object
>
getSyParam
()
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
try
{
SysSystemParams
sysSystemParams
=
sysSystemParamsService
.
getById
(
Constants
.
STRING_1
);
int
count
=
liResourceService
.
count
(
new
LambdaQueryWrapper
<
LiResource
>()
.
eq
(
LiResource:
:
getStatus
,
Constants
.
INT_4
)
.
eq
(
LiResource:
:
getDeleted
,
Constants
.
INT_0
));
.
eq
(
LiResource:
:
getStatus
,
Constants
.
INT_4
)
.
eq
(
LiResource:
:
getDeleted
,
Constants
.
INT_0
));
Integer
dayTime
=
Integer
.
valueOf
(
sysSystemParams
.
getSystemRunningTime
())
/(
24
*
60
*
60
);
Integer
hourTime
=
Integer
.
valueOf
(
sysSystemParams
.
getSystemRunningTime
())
%(
24
*
60
*
60
)/(
60
*
60
);
Integer
dayTime
=
Integer
.
valueOf
(
sysSystemParams
.
getSystemRunningTime
())
/
(
24
*
60
*
60
);
Integer
hourTime
=
Integer
.
valueOf
(
sysSystemParams
.
getSystemRunningTime
())
%
(
24
*
60
*
60
)
/
(
60
*
60
);
List
<
Integer
>
timeList
=
new
ArrayList
<>();
timeList
.
add
(
dayTime
);
timeList
.
add
(
hourTime
);
//人工/节能模式
map
.
put
(
"type"
,
sysSystemParams
.
getType
());
map
.
put
(
"type"
,
sysSystemParams
.
getType
());
//系统运行时间
map
.
put
(
"systemRunningTime"
,
timeList
);
map
.
put
(
"systemRunningTime"
,
timeList
);
//报警总数
map
.
put
(
"faultAlarm"
,
count
);
map
.
put
(
"faultAlarm"
,
count
);
//供暖模式
map
.
put
(
"sun"
,
sysSystemParams
.
getSun
());
map
.
put
(
"sun"
,
sysSystemParams
.
getSun
());
//机械通风模式
map
.
put
(
"fan"
,
sysSystemParams
.
getFan
());
map
.
put
(
"fan"
,
sysSystemParams
.
getFan
());
//自然通风模式
map
.
put
(
"nan"
,
sysSystemParams
.
getNan
());
map
.
put
(
"nan"
,
sysSystemParams
.
getNan
());
Integer
t
=
0
;
if
(
sysSystemParams
.
getSun
()
==
Constants
.
INT_1
)
{
if
(
sysSystemParams
.
getSun
()
==
Constants
.
INT_1
)
{
t
=
1
;
}
else
if
(
sysSystemParams
.
getFan
()
==
Constants
.
INT_1
)
{
}
else
if
(
sysSystemParams
.
getFan
()
==
Constants
.
INT_1
)
{
t
=
2
;
}
else
if
(
sysSystemParams
.
getNan
()
==
Constants
.
INT_1
)
{
}
else
if
(
sysSystemParams
.
getNan
()
==
Constants
.
INT_1
)
{
t
=
3
;
}
//当前模式
map
.
put
(
"currentModel"
,
t
);
map
.
put
(
"currentModel"
,
t
);
//能耗
Map
<
String
,
Object
>
energy
=
new
HashMap
<>();
Map
<
String
,
Object
>
energy
=
new
HashMap
<>();
SimpleDateFormat
sdfLongTime
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
SimpleDateFormat
sdfLongTime2
=
new
SimpleDateFormat
(
"yyyyMM"
);
...
...
@@ -100,10 +104,10 @@ public class AnalysisServiceImpl implements AnalysisService {
String
time
=
sdfLongTime
.
format
(
now
);
String
time2
=
sdfLongTime2
.
format
(
now
);
Map
<
String
,
Object
>
dayMap
=
totalDayService
.
totalDay
(
time
,
Constants
.
INT_1
);
Map
<
String
,
Object
>
dayMap2
=
totalDayService
.
totalDay
(
time
,
Constants
.
INT_2
);
Map
<
String
,
Object
>
monthMap
=
totalMonthService
.
totalMonth
(
time2
,
Constants
.
INT_1
);
Map
<
String
,
Object
>
monthMap2
=
totalMonthService
.
totalMonth
(
time2
,
Constants
.
INT_2
);
Map
<
String
,
Object
>
dayMap
=
totalDayService
.
totalDay
(
time
,
Constants
.
INT_1
);
Map
<
String
,
Object
>
dayMap2
=
totalDayService
.
totalDay
(
time
,
Constants
.
INT_2
);
Map
<
String
,
Object
>
monthMap
=
totalMonthService
.
totalMonth
(
time2
,
Constants
.
INT_1
);
Map
<
String
,
Object
>
monthMap2
=
totalMonthService
.
totalMonth
(
time2
,
Constants
.
INT_2
);
Map
<
String
,
Object
>
dayTotal
=
sysResourceRunningTimeTjService
.
totalDay
(
time
);
Map
<
String
,
Object
>
monthTotal
=
sysResourceRunningTimeTjService
.
totalMonth
(
time2
);
...
...
@@ -114,122 +118,122 @@ public class AnalysisServiceImpl implements AnalysisService {
String
jnEnergyMonth
=
Constants
.
STRING_0
;
String
totalEnergyDay
=
Constants
.
STRING_0
;
String
totalEnergyMonth
=
Constants
.
STRING_0
;
if
(
dayMap
!=
null
&&
dayMap
.
size
()
>=
0
)
{
if
(
dayMap
.
containsKey
(
"electric_energy"
))
{
if
(
dayMap
!=
null
&&
dayMap
.
size
()
>=
0
)
{
if
(
dayMap
.
containsKey
(
"electric_energy"
))
{
sdEnergyDay
=
dayMap
.
get
(
"electric_energy"
).
toString
();
}
}
if
(
dayMap2
!=
null
&&
dayMap2
.
size
()
>=
0
)
{
if
(
dayMap2
.
containsKey
(
"electric_energy"
))
{
if
(
dayMap2
!=
null
&&
dayMap2
.
size
()
>=
0
)
{
if
(
dayMap2
.
containsKey
(
"electric_energy"
))
{
jnEnergyDay
=
dayMap2
.
get
(
"electric_energy"
).
toString
();
}
}
if
(
monthMap
!=
null
&&
monthMap
.
size
()
>=
0
)
{
if
(
monthMap
.
containsKey
(
"electric_energy"
))
{
if
(
monthMap
!=
null
&&
monthMap
.
size
()
>=
0
)
{
if
(
monthMap
.
containsKey
(
"electric_energy"
))
{
sdEnergyMonth
=
monthMap
.
get
(
"electric_energy"
).
toString
();
}
}
if
(
monthMap2
!=
null
&&
monthMap2
.
size
()
>=
0
)
{
if
(
monthMap2
.
containsKey
(
"electric_energy"
))
{
if
(
monthMap2
!=
null
&&
monthMap2
.
size
()
>=
0
)
{
if
(
monthMap2
.
containsKey
(
"electric_energy"
))
{
jnEnergyMonth
=
monthMap2
.
get
(
"electric_energy"
).
toString
();
}
}
if
(
dayTotal
!=
null
&&
dayTotal
.
size
()
>=
0
)
{
if
(
dayTotal
.
containsKey
(
"electric_energy"
))
{
if
(
dayTotal
!=
null
&&
dayTotal
.
size
()
>=
0
)
{
if
(
dayTotal
.
containsKey
(
"electric_energy"
))
{
totalEnergyDay
=
dayTotal
.
get
(
"electric_energy"
).
toString
();
}
}
if
(
monthTotal
!=
null
&&
monthTotal
.
size
()
>=
0
)
{
if
(
monthTotal
.
containsKey
(
"electric_energy"
))
{
if
(
monthTotal
!=
null
&&
monthTotal
.
size
()
>=
0
)
{
if
(
monthTotal
.
containsKey
(
"electric_energy"
))
{
totalEnergyMonth
=
monthTotal
.
get
(
"electric_energy"
).
toString
();
}
}
//当天
//手动运行时间-天
Integer
sdHour
=
Integer
.
valueOf
(
sysSystemParams
.
getSdSystemRunningTimeDay
())
/(
60
*
60
);
Integer
jnHour
=
Integer
.
valueOf
(
sysSystemParams
.
getJnSystemRunningTimeDay
())
/(
60
*
60
);
energy
.
put
(
"sdSystemRunningTimeDay"
,
sdHour
);
Integer
sdHour
=
Integer
.
valueOf
(
sysSystemParams
.
getSdSystemRunningTimeDay
())
/
(
60
*
60
);
Integer
jnHour
=
Integer
.
valueOf
(
sysSystemParams
.
getJnSystemRunningTimeDay
())
/
(
60
*
60
);
energy
.
put
(
"sdSystemRunningTimeDay"
,
sdHour
);
//节能运行时间-天
energy
.
put
(
"jnSystemRunningTimeDay"
,
jnHour
);
energy
.
put
(
"sdEnergyDay"
,
sdEnergyDay
);
energy
.
put
(
"jnEnergyDay"
,
jnEnergyDay
);
energy
.
put
(
"totalEnergyDay"
,
totalEnergyDay
);
energy
.
put
(
"jnSystemRunningTimeDay"
,
jnHour
);
energy
.
put
(
"sdEnergyDay"
,
sdEnergyDay
);
energy
.
put
(
"jnEnergyDay"
,
jnEnergyDay
);
energy
.
put
(
"totalEnergyDay"
,
totalEnergyDay
);
//当月
//手动运行时间-月
Integer
sdHourM
=
Integer
.
valueOf
(
sysSystemParams
.
getSdSystemRunningTimeMonth
())
/(
60
*
60
);
Integer
jnHourM
=
Integer
.
valueOf
(
sysSystemParams
.
getJnSystemRunningTimeMonth
())
/(
60
*
60
);
energy
.
put
(
"sdSystemRunningTimeMonth"
,
sdHourM
);
Integer
sdHourM
=
Integer
.
valueOf
(
sysSystemParams
.
getSdSystemRunningTimeMonth
())
/
(
60
*
60
);
Integer
jnHourM
=
Integer
.
valueOf
(
sysSystemParams
.
getJnSystemRunningTimeMonth
())
/
(
60
*
60
);
energy
.
put
(
"sdSystemRunningTimeMonth"
,
sdHourM
);
//节能运行时间-月
energy
.
put
(
"jnSystemRunningTimeMonth"
,
jnHourM
);
energy
.
put
(
"sdEnergyMonth"
,
sdEnergyMonth
);
energy
.
put
(
"jnEnergyMonth"
,
jnEnergyMonth
);
energy
.
put
(
"totalEnergyMonth"
,
totalEnergyMonth
);
map
.
put
(
"energy"
,
energy
);
energy
.
put
(
"jnSystemRunningTimeMonth"
,
jnHourM
);
energy
.
put
(
"sdEnergyMonth"
,
sdEnergyMonth
);
energy
.
put
(
"jnEnergyMonth"
,
jnEnergyMonth
);
energy
.
put
(
"totalEnergyMonth"
,
totalEnergyMonth
);
map
.
put
(
"energy"
,
energy
);
//能耗统计
List
<
List
<
String
>>
list
=
new
ArrayList
<
List
<
String
>>();
//当天
List
<
Map
<
String
,
Object
>>
listHour
=
totalHourService
.
queryList
(
DateUtil
.
getStringOfFirstDay
(
DateUtil
.
getNowFormateDate
()),
List
<
Map
<
String
,
Object
>>
listHour
=
totalHourService
.
queryList
(
DateUtil
.
getStringOfFirstDay
(
DateUtil
.
getNowFormateDate
()),
DateUtil
.
getStringOfLastDay
(
DateUtil
.
getNowFormateDate
()));
for
(
int
i
=
0
;
i
<
listHour
.
size
();
i
++)
{
List
<
String
>
listDetail
=
new
ArrayList
<
String
>();
listDetail
.
add
(
DateUtils
.
format
((
Date
)
listHour
.
get
(
i
).
get
(
"create_time"
),
"yyyy-MM-dd HH:mm:ss"
));
listDetail
.
add
(
DateUtils
.
format
((
Date
)
listHour
.
get
(
i
).
get
(
"create_time"
),
"yyyy-MM-dd HH:mm:ss"
));
listDetail
.
add
(
listHour
.
get
(
i
).
get
(
"electric_energy"
).
toString
());
list
.
add
(
listDetail
);
}
List
<
List
<
String
>>
listMonth
=
new
ArrayList
<
List
<
String
>>();
//当月
List
<
Map
<
String
,
Object
>>
listDay
=
totalDayService
.
queryList
(
DateUtil
.
getStringOfFirstDay
(
DateUtil
.
getStringOfFirstDayInMonth
()),
List
<
Map
<
String
,
Object
>>
listDay
=
totalDayService
.
queryList
(
DateUtil
.
getStringOfFirstDay
(
DateUtil
.
getStringOfFirstDayInMonth
()),
DateUtil
.
getStringOfLastDay
(
DateUtil
.
getStringOfLastDayInMonth
()));
for
(
int
i
=
0
;
i
<
listDay
.
size
();
i
++)
{
List
<
String
>
listDetail
=
new
ArrayList
<
String
>();
listDetail
.
add
(
DateUtils
.
format
((
Date
)
listDay
.
get
(
i
).
get
(
"create_time"
),
"yyyy-MM-dd HH:mm:ss"
));
listDetail
.
add
(
DateUtils
.
format
((
Date
)
listDay
.
get
(
i
).
get
(
"create_time"
),
"yyyy-MM-dd HH:mm:ss"
));
listDetail
.
add
(
listDay
.
get
(
i
).
get
(
"electric_energy"
).
toString
());
listMonth
.
add
(
listDetail
);
}
map
.
put
(
"energyList"
,
list
);
map
.
put
(
"energyListMonth"
,
listMonth
);
}
catch
(
Exception
e
)
{
map
.
put
(
"energyList"
,
list
);
map
.
put
(
"energyListMonth"
,
listMonth
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
map
;
}
@Override
public
List
<
List
<
String
>>
getEnergyListTb
(
String
resourceId
,
String
startTime
,
String
endTime
,
String
resourceType
)
{
public
List
<
List
<
String
>>
getEnergyListTb
(
String
resourceId
,
String
startTime
,
String
endTime
,
String
resourceType
)
{
Page
<
Map
<
String
,
Object
>>
page
=
new
Page
<>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>(
16
);
params
.
put
(
"resourceId"
,
resourceId
);
params
.
put
(
"startTime"
,
DateUtil
.
getStringOfFirstDay
(
startTime
));
params
.
put
(
"endTime"
,
DateUtil
.
getStringOfLastDay
(
endTime
));
Page
<
Map
<
String
,
Object
>>
pageTask
=
new
Page
<
Map
<
String
,
Object
>>(
Constants
.
INT_1
,
Constants
.
INT_99
);
if
(
Constants
.
ID_PFJ
.
equals
(
resourceType
))
{
page
=
pfjInfoService
.
queryPageListByParam
(
pageTask
,
params
);
}
else
if
(
Constants
.
ID_JFKTP
.
equals
(
resourceType
))
{
page
=
jfktpInfoService
.
queryPageListByParam
(
pageTask
,
params
);
}
else
if
(
Constants
.
ID_JLM
.
equals
(
resourceType
))
{
}
else
if
(
Constants
.
ID_FLRBJZ
.
equals
(
resourceType
))
{
page
=
flrbInfoService
.
queryPageListByParam
(
pageTask
,
params
);
}
else
if
(
Constants
.
ID_SLJFG
.
equals
(
resourceType
))
{
}
else
if
(
Constants
.
ID_SB
.
equals
(
resourceType
))
{
page
=
sbInfoService
.
queryPageListByParam
(
pageTask
,
params
);
}
else
if
(
Constants
.
ID_SLSWJ
.
equals
(
resourceType
))
{
page
=
dlswjInfoService
.
queryPageListByParam
(
pageTask
,
params
);
}
else
if
(
Constants
.
ID_SLJFG
.
equals
(
resourceType
))
{
page
=
sljfgInfoService
.
queryPageListByParam
(
pageTask
,
params
);
Map
<
String
,
Object
>
params
=
new
HashMap
<>(
16
);
params
.
put
(
"resourceId"
,
resourceId
);
params
.
put
(
"startTime"
,
DateUtil
.
getStringOfFirstDay
(
startTime
));
params
.
put
(
"endTime"
,
DateUtil
.
getStringOfLastDay
(
endTime
));
Page
<
Map
<
String
,
Object
>>
pageTask
=
new
Page
<
Map
<
String
,
Object
>>(
Constants
.
INT_1
,
Constants
.
INT_99
);
if
(
Constants
.
ID_PFJ
.
equals
(
resourceType
))
{
page
=
pfjInfoService
.
queryPageListByParam
(
pageTask
,
params
);
}
else
if
(
Constants
.
ID_JFKTP
.
equals
(
resourceType
))
{
page
=
jfktpInfoService
.
queryPageListByParam
(
pageTask
,
params
);
}
else
if
(
Constants
.
ID_JLM
.
equals
(
resourceType
))
{
}
else
if
(
Constants
.
ID_FLRBJZ
.
equals
(
resourceType
))
{
page
=
flrbInfoService
.
queryPageListByParam
(
pageTask
,
params
);
}
else
if
(
Constants
.
ID_SLJFG
.
equals
(
resourceType
))
{
}
else
if
(
Constants
.
ID_SB
.
equals
(
resourceType
))
{
page
=
sbInfoService
.
queryPageListByParam
(
pageTask
,
params
);
}
else
if
(
Constants
.
ID_SLSWJ
.
equals
(
resourceType
))
{
page
=
dlswjInfoService
.
queryPageListByParam
(
pageTask
,
params
);
}
else
if
(
Constants
.
ID_SLJFG
.
equals
(
resourceType
))
{
page
=
sljfgInfoService
.
queryPageListByParam
(
pageTask
,
params
);
}
List
<
List
<
String
>>
listTj
=
new
ArrayList
<
List
<
String
>>();
for
(
int
i
=
0
;
i
<
page
.
getRecords
().
size
();
i
++)
{
List
<
String
>
listDetail
=
new
ArrayList
<
String
>();
listDetail
.
add
(
DateUtils
.
format
((
Date
)
page
.
getRecords
().
get
(
i
).
get
(
"create_time"
),
"yyyy-MM-dd HH:mm:ss"
));
listDetail
.
add
(
DateUtils
.
format
((
Date
)
page
.
getRecords
().
get
(
i
).
get
(
"create_time"
),
"yyyy-MM-dd HH:mm:ss"
));
listDetail
.
add
(
page
.
getRecords
().
get
(
i
).
get
(
"electric_energy"
).
toString
());
listTj
.
add
(
listDetail
);
}
...
...
@@ -237,37 +241,37 @@ public class AnalysisServiceImpl implements AnalysisService {
}
@Override
public
List
<
List
<
String
>>
getEnergyListFx
(
String
startTime
,
String
endTime
,
String
resourceType
)
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
if
(
Constants
.
STRING_1
.
equals
(
resourceType
))
{
int
type
=
DateUtil
.
checkTimeToType
(
startTime
,
endTime
);
if
(
type
==
Constants
.
INT_1
)
{
list
=
totalHourService
.
queryList
(
startTime
,
endTime
);
}
else
if
(
type
==
Constants
.
INT_2
||
type
==
Constants
.
INT_3
)
{
list
=
totalDayService
.
queryList
(
startTime
,
endTime
);
}
else
if
(
type
==
Constants
.
INT_4
)
{
list
=
totalMonthService
.
queryList
(
startTime
,
endTime
);
}
}
else
if
(
Constants
.
ID_PFJ
.
equals
(
resourceType
))
{
list
=
pfjInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_JFKTP
.
equals
(
resourceType
))
{
list
=
jfktpInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_JLM
.
equals
(
resourceType
))
{
}
else
if
(
Constants
.
ID_SB
.
equals
(
resourceType
))
{
list
=
sbInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_FLRBJZ
.
equals
(
resourceType
))
{
list
=
flrbInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_SLJFG
.
equals
(
resourceType
))
{
list
=
sljfgInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_SLSWJ
.
equals
(
resourceType
))
{
list
=
dlswjInfoService
.
queryListByParam
(
startTime
,
endTime
);
public
List
<
List
<
String
>>
getEnergyListFx
(
String
startTime
,
String
endTime
,
String
resourceType
)
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
if
(
Constants
.
STRING_1
.
equals
(
resourceType
))
{
int
type
=
DateUtil
.
checkTimeToType
(
startTime
,
endTime
);
if
(
type
==
Constants
.
INT_1
)
{
list
=
totalHourService
.
queryList
(
startTime
,
endTime
);
}
else
if
(
type
==
Constants
.
INT_2
||
type
==
Constants
.
INT_3
)
{
list
=
totalDayService
.
queryList
(
startTime
,
endTime
);
}
else
if
(
type
==
Constants
.
INT_4
)
{
list
=
totalMonthService
.
queryList
(
startTime
,
endTime
);
}
}
else
if
(
Constants
.
ID_PFJ
.
equals
(
resourceType
))
{
list
=
pfjInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_JFKTP
.
equals
(
resourceType
))
{
list
=
jfktpInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_JLM
.
equals
(
resourceType
))
{
}
else
if
(
Constants
.
ID_SB
.
equals
(
resourceType
))
{
list
=
sbInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_FLRBJZ
.
equals
(
resourceType
))
{
list
=
flrbInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_SLJFG
.
equals
(
resourceType
))
{
list
=
sljfgInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_SLSWJ
.
equals
(
resourceType
))
{
list
=
dlswjInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
List
<
List
<
String
>>
listTj
=
new
ArrayList
<
List
<
String
>>();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
List
<
String
>
listDetail
=
new
ArrayList
<
String
>();
listDetail
.
add
(
DateUtils
.
format
((
Date
)
list
.
get
(
i
).
get
(
"create_time"
),
"yyyy-MM-dd HH:mm:ss"
));
listDetail
.
add
(
DateUtils
.
format
((
Date
)
list
.
get
(
i
).
get
(
"create_time"
),
"yyyy-MM-dd HH:mm:ss"
));
listDetail
.
add
(
list
.
get
(
i
).
get
(
"electric_energy"
).
toString
());
listTj
.
add
(
listDetail
);
}
...
...
@@ -278,33 +282,33 @@ public class AnalysisServiceImpl implements AnalysisService {
public
void
toExcel
(
HttpServletResponse
response
,
String
startTime
,
String
endTime
,
String
resourceType
)
{
OutputStream
out
=
null
;
try
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
String
title
=
""
;
if
(
Constants
.
STRING_1
.
equals
(
resourceType
))
{
if
(
Constants
.
STRING_1
.
equals
(
resourceType
))
{
title
=
"全部"
;
int
type
=
DateUtil
.
checkTimeToType
(
startTime
,
endTime
);
if
(
type
==
Constants
.
INT_1
)
{
list
=
totalHourService
.
queryList
(
startTime
,
endTime
);
}
else
if
(
type
==
Constants
.
INT_2
||
type
==
Constants
.
INT_3
)
{
list
=
totalDayService
.
queryList
(
startTime
,
endTime
);
}
else
if
(
type
==
Constants
.
INT_4
)
{
list
=
totalMonthService
.
queryList
(
startTime
,
endTime
);
}
}
else
if
(
Constants
.
ID_PFJ
.
equals
(
resourceType
))
{
int
type
=
DateUtil
.
checkTimeToType
(
startTime
,
endTime
);
if
(
type
==
Constants
.
INT_1
)
{
list
=
totalHourService
.
queryList
(
startTime
,
endTime
);
}
else
if
(
type
==
Constants
.
INT_2
||
type
==
Constants
.
INT_3
)
{
list
=
totalDayService
.
queryList
(
startTime
,
endTime
);
}
else
if
(
type
==
Constants
.
INT_4
)
{
list
=
totalMonthService
.
queryList
(
startTime
,
endTime
);
}
}
else
if
(
Constants
.
ID_PFJ
.
equals
(
resourceType
))
{
title
=
"排风机"
;
list
=
pfjInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_JFKTP
.
equals
(
resourceType
))
{
list
=
pfjInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_JFKTP
.
equals
(
resourceType
))
{
title
=
"空调"
;
list
=
jfktpInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_SB
.
equals
(
resourceType
))
{
list
=
jfktpInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_SB
.
equals
(
resourceType
))
{
title
=
"水泵"
;
list
=
sbInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_FLRBJZ
.
equals
(
resourceType
))
{
list
=
sbInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_FLRBJZ
.
equals
(
resourceType
))
{
title
=
"风冷热泵机组"
;
list
=
flrbInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_SLSWJ
.
equals
(
resourceType
))
{
list
=
flrbInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ID_SLSWJ
.
equals
(
resourceType
))
{
title
=
"多联新风室外机"
;
list
=
dlswjInfoService
.
queryListByParam
(
startTime
,
endTime
);
list
=
dlswjInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
String
fileName
=
"energy.xlsx"
;
...
...
@@ -324,10 +328,55 @@ public class AnalysisServiceImpl implements AnalysisService {
map
.
put
(
"list"
,
list
);
ExportExcelFx
ee
=
new
ExportExcelFx
(
map
);
ee
.
export
(
out
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
/**
* 资阳西站获取能耗数据分析
*
* @param startTime
* @param endTime
* @param resourceType
* @return
*/
@Override
public
List
<
List
<
String
>>
getZyEnergyFx
(
String
startTime
,
String
endTime
,
String
resourceType
)
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
if
(
Constants
.
ZY_QB
.
equals
(
resourceType
))
{
list
=
totalHourService
.
queryList
(
startTime
,
endTime
);
}
//资阳西站空调机组能耗/小时
if
(
Constants
.
ZY_KTJZ
.
equals
(
resourceType
))
{
list
=
jfktpInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ZY_FLRB
.
equals
(
resourceType
))
{
//资阳西站风冷热泵机组能耗/小时
list
=
flrbInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
Constants
.
ZY_KQCLJ
.
equals
(
resourceType
))
{
//资阳西站空气处理机机组能耗/小时
list
=
kqcljInfoService
.
queryListByParam
(
startTime
,
endTime
);
}
List
<
List
<
String
>>
listTj
=
new
ArrayList
<
List
<
String
>>();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
for
(
int
j
=
i
+
1
;
j
<
list
.
size
();
j
++)
{
List
<
String
>
listDetail
=
new
ArrayList
<
String
>();
//获取第一个时间的总能耗
String
energyOne
=
list
.
get
(
i
).
get
(
"electric_energy"
).
toString
();
//获取第二个时间的总能耗
String
energyTwo
=
list
.
get
(
j
).
get
(
"electric_energy"
).
toString
();
//获取第一个时间
String
oneTime
=
list
.
get
(
i
).
get
(
"create_time"
).
toString
();
//获取第二个时间
String
twoTime
=
list
.
get
(
j
).
get
(
"create_time"
).
toString
();
listDetail
.
add
(
oneTime
+
"-"
+
twoTime
);
listDetail
.
add
(
new
BigDecimal
(
energyTwo
).
subtract
(
new
BigDecimal
(
energyOne
)).
toString
());
listTj
.
add
(
listDetail
);
break
;
}
}
return
listTj
;
}
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/impl/EquipmentServiceImpl.java
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.devplatform.admin.common.utils.Constants
;
import
com.devplatform.admin.modules.eq.bean.ZyFlrbInfo
;
import
com.devplatform.admin.modules.eq.bean.ZyJfktpInfo
;
import
com.devplatform.admin.modules.eq.service.*
;
import
com.devplatform.admin.modules.liresource.bean.LiResource
;
import
com.devplatform.admin.modules.liresource.service.LiResourceService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.
util.HashMap
;
import
java.
util.Lis
t
;
import
java.util.
Map
;
import
java.
math.BigDecimal
;
import
java.
text.SimpleDateForma
t
;
import
java.util.
*
;
/**
* 设备的service接口实现类
*
* @author dxw
*/
@Service
(
"equipmentService"
)
...
...
@@ -42,64 +49,173 @@ public class EquipmentServiceImpl implements EquipmentService {
private
DlxfsnjInfoService
dlxfsnjInfoService
;
@Autowired
private
LiResourceService
liResourceService
;
@Autowired
private
ZyFlrbInfoService
zyFlrbInfoService
;
@Autowired
private
ZyJfktpInfoService
zyJfktpInfoService
;
@Autowired
private
KqcljInfoService
kqcljInfoService
;
@Override
public
Map
<
String
,
Object
>
getList
()
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>(
32
);
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>(
32
);
//室内气象站
List
<
Map
<
String
,
Object
>>
snqxzList
=
snqxzInfoService
.
getList
();
//室外气象站
List
<
Map
<
String
,
Object
>>
swqxzList
=
swqxzInfoService
.
getList
();
//多联室内机
List
<
Map
<
String
,
Object
>>
dlsnjList
=
dlsnjInfoService
.
getList
();
List
<
Map
<
String
,
Object
>>
dlsnjList
=
dlsnjInfoService
.
getList
();
//多联室外机
List
<
Map
<
String
,
Object
>>
dlswjList
=
dlswjInfoService
.
getList
();
List
<
Map
<
String
,
Object
>>
dlswjList
=
dlswjInfoService
.
getList
();
//风冷热泵机组
List
<
Map
<
String
,
Object
>>
flrbList
=
flrbInfoService
.
getList
();
List
<
Map
<
String
,
Object
>>
flrbList
=
flrbInfoService
.
getList
();
//机房空调
List
<
Map
<
String
,
Object
>>
jfktpList
=
jfktpInfoService
.
getList
();
List
<
Map
<
String
,
Object
>>
jfktpList
=
jfktpInfoService
.
getList
();
//排风机
List
<
Map
<
String
,
Object
>>
pfjList
=
pfjInfoService
.
getList
();
List
<
Map
<
String
,
Object
>>
pfjList
=
pfjInfoService
.
getList
();
//水泵
List
<
Map
<
String
,
Object
>>
sbList
=
sbInfoService
.
getList
();
List
<
Map
<
String
,
Object
>>
sbList
=
sbInfoService
.
getList
();
//室内机风柜
List
<
Map
<
String
,
Object
>>
sljfgList
=
sljfgInfoService
.
getList
();
//室内气象站
List
<
Map
<
String
,
Object
>>
snqxzList
=
snqxzInfoService
.
getList
();
//室外气象站
List
<
Map
<
String
,
Object
>>
swqxzList
=
swqxzInfoService
.
getList
();
List
<
Map
<
String
,
Object
>>
sljfgList
=
sljfgInfoService
.
getList
();
//多联新风处理机室内机
List
<
Map
<
String
,
Object
>>
dlxfsnjList
=
dlxfsnjInfoService
.
getList
();
List
<
Map
<
String
,
Object
>>
dlxfsnjList
=
dlxfsnjInfoService
.
getList
();
List
<
Map
<
String
,
Object
>>
snqxMaps
=
snqxzInfoHourService
.
getParamGroupByRegion
(
null
);
for
(
Map
<
String
,
Object
>
temp
:
snqxMaps
)
{
if
(
Constants
.
STRING_1
.
equals
(
temp
.
get
(
"region"
).
toString
()))
{
List
<
Map
<
String
,
Object
>>
snqxMaps
=
snqxzInfoHourService
.
getParamGroupByRegion
(
null
);
for
(
Map
<
String
,
Object
>
temp
:
snqxMaps
)
{
if
(
Constants
.
STRING_1
.
equals
(
temp
.
get
(
"region"
).
toString
()))
{
//候车大厅室内
map
.
put
(
"hcdtSnqx"
,
temp
);
}
else
if
(
Constants
.
STRING_2
.
equals
(
temp
.
get
(
"region"
).
toString
()))
{
map
.
put
(
"hcdtSnqx"
,
temp
);
}
else
if
(
Constants
.
STRING_2
.
equals
(
temp
.
get
(
"region"
).
toString
()))
{
//办公区域室内
map
.
put
(
"bgqySnqx"
,
temp
);
map
.
put
(
"bgqySnqx"
,
temp
);
}
}
//室内气象站
map
.
put
(
"snqxzList"
,
snqxzList
);
//室外气象站
map
.
put
(
"swqxzList"
,
swqxzList
);
//多联室内机
map
.
put
(
"dlsnjList"
,
dlsnjList
);
map
.
put
(
"dlsnjList"
,
dlsnjList
);
//多联室外机
map
.
put
(
"dlswjList"
,
dlswjList
);
map
.
put
(
"dlswjList"
,
dlswjList
);
//风冷热泵机组
map
.
put
(
"flrbList"
,
flrbList
);
map
.
put
(
"flrbList"
,
flrbList
);
//机房空调(220V)
map
.
put
(
"jfktpList"
,
jfktpList
);
map
.
put
(
"jfktpList"
,
jfktpList
);
//排风机
map
.
put
(
"pfjList"
,
pfjList
);
map
.
put
(
"pfjList"
,
pfjList
);
//水泵
map
.
put
(
"sbList"
,
sbList
);
map
.
put
(
"sbList"
,
sbList
);
//室内机风柜
map
.
put
(
"sljfgList"
,
sljfgList
);
//室内气象站
map
.
put
(
"snqxzList"
,
snqxzList
);
//室外气象站
map
.
put
(
"swqxzList"
,
swqxzList
);
map
.
put
(
"sljfgList"
,
sljfgList
);
//多联新风处理机室内机
map
.
put
(
"dlxfsnjList"
,
dlxfsnjList
);
map
.
put
(
"dlxfsnjList"
,
dlxfsnjList
);
//首页数据
map
.
put
(
"syBean"
,
analysisService
.
getSyParam
());
map
.
put
(
"syBean"
,
analysisService
.
getSyParam
());
return
map
;
}
/**
* 首页接口
*
* @return
*/
@Override
public
Map
<
String
,
Object
>
getList2
(
String
startTime
,
String
endTime
,
String
resourceType
)
{
SimpleDateFormat
sdfLongTime
=
new
SimpleDateFormat
(
"yyyyMMddHH"
);
String
time
=
sdfLongTime
.
format
(
new
Date
());
SimpleDateFormat
sdfLongTime2
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
String
time2
=
sdfLongTime2
.
format
(
new
Date
());
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>(
32
);
//资阳西站室内环境参数
List
<
Map
<
String
,
Object
>>
snqxzList
=
snqxzInfoService
.
getList2
(
time
);
//资阳西站室外气象参数
List
<
Map
<
String
,
Object
>>
swqxzList
=
swqxzInfoService
.
getList2
();
//空调通风系统运行工况&运行参数
//A区
Map
<
String
,
Object
>
ktflrbMapA
=
new
HashMap
<>();
//C区
Map
<
String
,
Object
>
ktflrbMapC
=
new
HashMap
<>();
//获取资源点信息
List
<
LiResource
>
list
=
liResourceService
.
selectResourceList
();
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
for
(
LiResource
liResource
:
list
)
{
if
(
liResource
.
getName
().
equals
(
Constants
.
KTJZ_A
))
{
//根据资源点id查询当前时间的空调机组情况
ZyJfktpInfo
zyJfktpInfo
=
zyJfktpInfoService
.
selectZyJfktpInfo
(
liResource
.
getId
(),
time
);
if
(
zyJfktpInfo
!=
null
)
{
ktflrbMapA
.
put
(
"hfwd"
,
zyJfktpInfo
.
getWindTem
());
}
}
else
if
(
liResource
.
getName
().
equals
(
Constants
.
FLRB_A
))
{
//根据资源点id查询最近的风冷热泵机组情况
ZyFlrbInfo
zyFlrbInfo
=
zyFlrbInfoService
.
selectZyFlrbInfo
(
liResource
.
getId
(),
time
);
if
(
zyFlrbInfo
!=
null
)
{
ktflrbMapA
.
put
(
"gswd"
,
zyFlrbInfo
.
getWaterSupplyTemperature
());
ktflrbMapA
.
put
(
"hswd"
,
zyFlrbInfo
.
getReturnWaterTemperature
());
ktflrbMapA
.
put
(
"sll"
,
zyFlrbInfo
.
getWaterRate
());
ktflrbMapA
.
put
(
"yxgk"
,
zyFlrbInfo
.
getSwitchMode
());
}
}
else
if
(
liResource
.
getName
().
equals
(
Constants
.
KTJZ_C
))
{
//根据资源点id查询当前时间的空调机组情况
ZyJfktpInfo
zyJfktpInfo
=
zyJfktpInfoService
.
selectZyJfktpInfo
(
liResource
.
getId
(),
time
);
if
(
zyJfktpInfo
!=
null
)
{
ktflrbMapC
.
put
(
"hfwd"
,
zyJfktpInfo
.
getWindTem
());
}
}
else
if
(
liResource
.
getName
().
equals
(
Constants
.
FLRB_C
))
{
//根据资源点id查询最近的风冷热泵机组情况
ZyFlrbInfo
zyFlrbInfo
=
zyFlrbInfoService
.
selectZyFlrbInfo
(
liResource
.
getId
(),
time
);
if
(
zyFlrbInfo
!=
null
)
{
ktflrbMapC
.
put
(
"gswd"
,
zyFlrbInfo
.
getWaterSupplyTemperature
());
ktflrbMapC
.
put
(
"hswd"
,
zyFlrbInfo
.
getReturnWaterTemperature
());
ktflrbMapC
.
put
(
"sll"
,
zyFlrbInfo
.
getWaterRate
());
ktflrbMapC
.
put
(
"yxgk"
,
zyFlrbInfo
.
getSwitchMode
());
}
}
}
}
//空调通风系统能耗统计分析-总能耗
Map
<
String
,
Object
>
totalEnergyMap
=
new
HashMap
<>();
//根据时间查询空调机组采集数据表获取总能耗
BigDecimal
zyJfktpInfoEnergy
=
zyJfktpInfoService
.
getTotalEnergy
(
time2
);
totalEnergyMap
.
put
(
"zyJfktpInfoEnergy"
,
zyJfktpInfoEnergy
);
//根据时间查询风冷热泵机组采集数据表获取总能耗
BigDecimal
zyFlrbInfoEnergy
=
zyFlrbInfoService
.
getTotalEnergy
(
time2
);
totalEnergyMap
.
put
(
"zyFlrbInfoEnergy"
,
zyFlrbInfoEnergy
);
//根据时间查询空气处理机采集数据表获取总能耗
BigDecimal
kqcljInfoEnergy
=
kqcljInfoService
.
getTotalEnergy
(
time2
);
totalEnergyMap
.
put
(
"kqcljInfoEnergy"
,
kqcljInfoEnergy
);
if
(
StringUtils
.
isEmpty
(
startTime
)){
startTime
=
time2
;
}
if
(
StringUtils
.
isEmpty
(
endTime
)){
endTime
=
time2
;
}
if
(
StringUtils
.
isEmpty
(
resourceType
)){
resourceType
=
Constants
.
ZY_KTJZ
;
}
//资阳西站室内环境参数
map
.
put
(
"snqxzList"
,
snqxzList
);
//资阳西站室外气象参数
map
.
put
(
"swqxzList"
,
swqxzList
);
//空调通风系统运行工况&运行参数
map
.
put
(
"a"
,
ktflrbMapA
);
map
.
put
(
"c"
,
ktflrbMapC
);
//空调通风系统能耗统计分析-总能耗
map
.
put
(
"totalEnergyMap"
,
totalEnergyMap
);
//空调通风系统能耗统计分析
map
.
put
(
"energyInfoMap"
,
analysisService
.
getZyEnergyFx
(
startTime
,
endTime
,
resourceType
));
return
map
;
}
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/impl/FlrbInfoServiceImpl.java
View file @
b845d14a
...
...
@@ -69,7 +69,8 @@ public class FlrbInfoServiceImpl extends MyBaseServiceImpl<FlrbInfoDao, FlrbInfo
@Override
public
List
<
Map
<
String
,
Object
>>
queryListByParam
(
String
startTime
,
String
endTime
)
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
int
type
=
DateUtil
.
checkTimeToType
(
startTime
,
endTime
);
//int type = DateUtil.checkTimeToType(startTime,endTime);
int
type
=
1
;
if
(
type
==
Constants
.
INT_1
){
list
=
flrbInfoHourService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
type
==
Constants
.
INT_2
||
type
==
Constants
.
INT_3
){
...
...
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/impl/JfktpInfoServiceImpl.java
View file @
b845d14a
...
...
@@ -70,7 +70,8 @@ public class JfktpInfoServiceImpl extends MyBaseServiceImpl<JfktpInfoDao, JfktpI
@Override
public
List
<
Map
<
String
,
Object
>>
queryListByParam
(
String
startTime
,
String
endTime
)
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
int
type
=
DateUtil
.
checkTimeToType
(
startTime
,
endTime
);
//int type = DateUtil.checkTimeToType(startTime,endTime);
int
type
=
1
;
if
(
type
==
Constants
.
INT_1
){
list
=
jfktpInfoHourService
.
queryListByParam
(
startTime
,
endTime
);
}
else
if
(
type
==
Constants
.
INT_2
||
type
==
Constants
.
INT_3
){
...
...
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/impl/KqcljInfoHourServiceImpl.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
service
.
impl
;
import
com.devplatform.admin.modules.eq.bean.KqcljInfoHour
;
import
com.devplatform.admin.modules.eq.dao.KqcljInfoHourDao
;
import
com.devplatform.admin.modules.eq.service.KqcljInfoHourService
;
import
com.devplatform.common.service.impl.MyBaseServiceImpl
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
/**
* 空气处理机机组信息-时的service接口实现类
* <br>
* <b>功能:</b>KqcljInfoHourServiceImpl<br>
* @author 代码生成器产生
*/
@Service
(
"kqcljInfoHourService"
)
public
class
KqcljInfoHourServiceImpl
extends
MyBaseServiceImpl
<
KqcljInfoHourDao
,
KqcljInfoHour
>
implements
KqcljInfoHourService
{
@Override
public
List
<
Map
<
String
,
Object
>>
queryListByParam
(
String
startTime
,
String
endTime
)
{
return
baseMapper
.
queryListByParam
(
startTime
,
endTime
);
}
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/impl/KqcljServiceImpl.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
service
.
impl
;
import
com.devplatform.admin.common.utils.Constants
;
import
com.devplatform.admin.modules.eq.bean.KqcljInfo
;
import
com.devplatform.admin.modules.eq.dao.KqcljInfoDao
;
import
com.devplatform.admin.modules.eq.service.KqcljInfoHourService
;
import
com.devplatform.admin.modules.eq.service.KqcljInfoService
;
import
com.devplatform.common.service.impl.MyBaseServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
/**
* 空气处理机信息的service接口实现类
* <br>
* <b>功能:</b>KqcljServiceImpl<br>
* @author 代码生成器产生
*/
@Service
(
"kqcljInfoService"
)
public
class
KqcljServiceImpl
extends
MyBaseServiceImpl
<
KqcljInfoDao
,
KqcljInfo
>
implements
KqcljInfoService
{
@Autowired
private
KqcljInfoHourService
kqcljInfoHourService
;
@Override
public
List
<
Map
<
String
,
Object
>>
getList
()
{
return
baseMapper
.
getList
();
}
@Override
public
BigDecimal
getTotalEnergy
(
String
time
)
{
return
baseMapper
.
getTotalEnergy
(
time
);
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryListByParam
(
String
startTime
,
String
endTime
)
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
int
type
=
1
;
if
(
type
==
Constants
.
INT_1
){
list
=
kqcljInfoHourService
.
queryListByParam
(
startTime
,
endTime
);
}
return
list
;
}
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/impl/SnqxzInfoServiceImpl.java
View file @
b845d14a
...
...
@@ -30,4 +30,9 @@ public class SnqxzInfoServiceImpl extends MyBaseServiceImpl<SnqxzInfoDao, SnqxzI
public
List
<
Map
<
String
,
Object
>>
getList
()
{
return
baseMapper
.
getList
();
}
@Override
public
List
<
Map
<
String
,
Object
>>
getList2
(
String
time
)
{
return
baseMapper
.
getList2
(
time
);
}
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/impl/SwqxzInfoServiceImpl.java
View file @
b845d14a
...
...
@@ -30,4 +30,8 @@ public class SwqxzInfoServiceImpl extends MyBaseServiceImpl<SwqxzInfoDao, SwqxzI
public
List
<
Map
<
String
,
Object
>>
getList
()
{
return
baseMapper
.
getList
();
}
@Override
public
List
<
Map
<
String
,
Object
>>
getList2
()
{
return
baseMapper
.
getList2
();
}
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/impl/WarnInfoServiceImpl.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.devplatform.admin.modules.eq.bean.WarnInfo
;
import
com.devplatform.admin.modules.eq.dao.WarnInfoDao
;
import
com.devplatform.admin.modules.eq.service.WarnInfoService
;
import
com.devplatform.common.service.impl.MyBaseServiceImpl
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.UUID
;
/**
* 算法模块预警信息service接口实现类
* <br>
* <b>功能:</b>WarnInfoServiceImpl<br>
* @author 代码生成器产生
*/
@Service
(
"warnInfoService"
)
public
class
WarnInfoServiceImpl
extends
MyBaseServiceImpl
<
WarnInfoDao
,
WarnInfo
>
implements
WarnInfoService
{
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/impl/ZyFlrbInfoServiceImpl.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
service
.
impl
;
import
com.devplatform.admin.modules.eq.bean.ZyFlrbInfo
;
import
com.devplatform.admin.modules.eq.dao.ZyFlrbInfoDao
;
import
com.devplatform.admin.modules.eq.service.ZyFlrbInfoService
;
import
com.devplatform.common.service.impl.MyBaseServiceImpl
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
/**
* 资阳西站风冷热泵机组信息的service接口实现类
* <br>
* <b>功能:</b>ZyFlrbInfoServiceImpl<br>
* @author 代码生成器产生
*/
@Service
(
"zyFlrbInfoService"
)
public
class
ZyFlrbInfoServiceImpl
extends
MyBaseServiceImpl
<
ZyFlrbInfoDao
,
ZyFlrbInfo
>
implements
ZyFlrbInfoService
{
@Override
public
List
<
Map
<
String
,
Object
>>
getList
()
{
return
baseMapper
.
getList
();
}
@Override
public
ZyFlrbInfo
selectZyFlrbInfo
(
String
resourceId
,
String
time
)
{
return
baseMapper
.
selectZyFlrbInfo
(
resourceId
,
time
);
}
@Override
public
BigDecimal
getTotalEnergy
(
String
time
)
{
return
baseMapper
.
getTotalEnergy
(
time
);
}
}
microservice-admin/src/main/java/com/devplatform/admin/modules/eq/service/impl/ZyJfktpInfoServiceImpl.java
0 → 100644
View file @
b845d14a
package
com
.
devplatform
.
admin
.
modules
.
eq
.
service
.
impl
;
import
com.devplatform.admin.modules.eq.bean.ZyJfktpInfo
;
import
com.devplatform.admin.modules.eq.dao.ZyJfktpInfoDao
;
import
com.devplatform.admin.modules.eq.service.ZyJfktpInfoService
;
import
com.devplatform.common.service.impl.MyBaseServiceImpl
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
java.util.Map
;
/**
* 资阳西站空调机组信息的service接口实现类
* <br>
* <b>功能:</b>ZyJfktpInfoServiceImpl<br>
* @author 代码生成器产生
*/
@Service
(
"zyJfktpInfoService"
)
public
class
ZyJfktpInfoServiceImpl
extends
MyBaseServiceImpl
<
ZyJfktpInfoDao
,
ZyJfktpInfo
>
implements
ZyJfktpInfoService
{
@Override
public
List
<
Map
<
String
,
Object
>>
getList
()
{
return
baseMapper
.
getList
();
}
@Override
public
ZyJfktpInfo
selectZyJfktpInfo
(
String
resourceId
,
String
time
)
{
return
baseMapper
.
selectZyJfktpInfo
(
resourceId
,
time
);
}
@Override
public
BigDecimal
getTotalEnergy
(
String
time
)
{
return
baseMapper
.
getTotalEnergy
(
time
);
}
}
microservice-admin/src/main/java/com/devplatform/admin/modules/liresource/dao/LiResourceDao.java
View file @
b845d14a
...
...
@@ -67,4 +67,6 @@ public interface LiResourceDao extends MyBaseMapper<LiResource> {
* @return
*/
List
<
LiResource
>
queryListByParam
(
String
modeTypes
);
List
<
LiResource
>
selectResourceList
();
}
microservice-admin/src/main/java/com/devplatform/admin/modules/liresource/service/LiResourceService.java
View file @
b845d14a
...
...
@@ -61,4 +61,6 @@ public interface LiResourceService extends MyBaseService<LiResource> {
* @return
*/
List
<
LiResource
>
queryListByParam
(
String
modeTypes
);
List
<
LiResource
>
selectResourceList
();
}
microservice-admin/src/main/java/com/devplatform/admin/modules/liresource/service/impl/LiResourceServiceImpl.java
View file @
b845d14a
...
...
@@ -51,4 +51,8 @@ public class LiResourceServiceImpl extends MyBaseServiceImpl<LiResourceDao, LiRe
return
baseMapper
.
queryListByParam
(
modeTypes
);
}
@Override
public
List
<
LiResource
>
selectResourceList
()
{
return
baseMapper
.
selectResourceList
();
}
}
microservice-admin/src/main/java/com/devplatform/admin/modules/sys/controller/SysLoginController.java
View file @
b845d14a
...
...
@@ -99,10 +99,10 @@ public class SysLoginController extends AbstractController {
@ApiImplicitParam
(
name
=
"form"
,
value
=
"用户实体类"
,
required
=
true
,
paramType
=
"query"
,
dataType
=
"SysLoginForm"
)
@PostMapping
(
"/sys/login"
)
public
Map
<
String
,
Object
>
login
(
@RequestBody
SysLoginForm
form
)
{
String
str
=
LicenseAuth
.
authLicense
(
environment
);
if
(!
str
.
equals
(
"YES"
))
{
return
R
.
error
(
str
);
}
//
String str = LicenseAuth.authLicense(environment);
//
if(!str.equals("YES")) {
//
return R.error(str);
//
}
boolean
captcha
=
sysCaptchaService
.
validate
(
form
.
getUuid
(),
form
.
getCaptcha
());
if
(!
captcha
){
return
R
.
error
(
"验证码不正确"
);
...
...
microservice-admin/src/main/resources/application.yml
View file @
b845d14a
...
...
@@ -16,5 +16,9 @@ mybatis-plus:
#cache-enabled: false
#call-setters-on-nulls: true
#节能大循环节能算法间隔30分钟
bigTime
:
30
#节能小循环节能算法间隔10分钟
smallTime
:
10
microservice-admin/src/main/resources/mapper/eq/FlrbInfoMapper.xml
View file @
b845d14a
microservice-admin/src/main/resources/mapper/eq/JfktpInfoMapper.xml
View file @
b845d14a
microservice-admin/src/main/resources/mapper/eq/KqcljInfoHourMapper.xml
0 → 100644
View file @
b845d14a
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.devplatform.admin.modules.eq.dao.KqcljInfoHourDao"
>
<!-- Result Map -->
<resultMap
id=
"BaseResultMap"
type=
"com.devplatform.admin.modules.eq.bean.KqcljInfoHour"
>
<result
column=
"id"
property=
"id"
/>
<result
column=
"resource_id"
property=
"resourceId"
/>
<result
column=
"electric_energy"
property=
"electricEnergy"
/>
<result
column=
"type"
property=
"type"
/>
<result
column=
"station_id"
property=
"stationId"
/>
<result
column=
"create_time"
property=
"createTime"
/>
</resultMap>
<!-- flrb_info_hour table all fields -->
<sql
id=
"Base_Column_List"
>
id,resource_id,electric_energy,type,station_id,create_time
</sql>
<!-- 公共查询条件 -->
<sql
id=
"Example_Where_Clause"
>
where t.deleted=0
<if
test=
"id!=null and id!=''"
>
and t.id = #{id}
</if>
<if
test=
"resourceId!=null and resourceId!=''"
>
and t.resource_id = #{resourceId}
</if>
<if
test=
"electricEnergy!=null and electricEnergy!=''"
>
and t.electric_energy = #{electricEnergy}
</if>
<if
test=
"type!=null "
>
and t.type = #{type}
</if>
<if
test=
"stationId!=null and stationId!=''"
>
and t.station_id = #{stationId}
</if>
<if
test=
"createTime!=null "
>
and t.create_time = #{createTime}
</if>
</sql>
<select
id=
"queryListByParam"
resultType=
"java.util.Map"
>
select create_time,cast(sum(cast(electric_energy as decimal(10, 2))) as decimal(10, 2)) as electric_energy
from kqclj_info_hour
where 1=1
<if
test=
"(startTime == null or startTime == '') and (endTime == null or endTime == '')"
>
and TO_DAYS(create_time) = TO_DAYS(NOW())
</if>
<if
test=
"startTime != null and startTime != ''"
>
and create_time
>
= #{startTime}
</if>
<if
test=
"endTime != null and endTime != ''"
>
and create_time
<
= #{endTime}
</if>
group by create_time
order by create_time
</select>
</mapper>
microservice-admin/src/main/resources/mapper/eq/KqcljInfoMapper.xml
0 → 100644
View file @
b845d14a
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.devplatform.admin.modules.eq.dao.KqcljInfoDao"
>
<!-- Result Map -->
<resultMap
id=
"BaseResultMap"
type=
"com.devplatform.admin.modules.eq.bean.KqcljInfo"
>
<result
column=
"id"
property=
"id"
/>
<result
column=
"resource_id"
property=
"resourceId"
/>
<result
column=
"energy"
property=
"energy"
/>
<result
column=
"type"
property=
"type"
/>
<result
column=
"station_id"
property=
"stationId"
/>
<result
column=
"create_time"
property=
"createTime"
/>
</resultMap>
<!-- kqclj_info table all fields -->
<sql
id=
"Base_Column_List"
>
id,resource_id,energy,type,station_id,create_time
</sql>
<!-- 公共查询条件 -->
<sql
id=
"Example_Where_Clause"
>
where t.deleted=0
<if
test=
"id!=null and id!=''"
>
and t.id = #{id}
</if>
<if
test=
"resourceId!=null and resourceId!=''"
>
and t.resource_id = #{resourceId}
</if>
<if
test=
"energy!=null and energy!=''"
>
and t.energy = #{energy}
</if>
<if
test=
"type!=null "
>
and t.type = #{type}
</if>
<if
test=
"stationId!=null and stationId!=''"
>
and t.station_id = #{stationId}
</if>
<if
test=
"createTime!=null "
>
and t.create_time = #{createTime}
</if>
</sql>
<select
id=
"getList"
resultType=
"java.util.Map"
>
SELECT t1.*,li.name as resourceName,li.remark as remark,li.deploy_location as deployLocation,li.status as status,li.region as region
FROM kqclj_info AS t1
INNER JOIN
(SELECT t2.resource_id, MAX(t2.create_time) AS maxdate
FROM kqclj_info AS t2
GROUP BY t2.resource_id) AS t3 ON t1.resource_id = t3.resource_id AND t1.create_time = t3.maxdate
left join li_resource li on li.id = t1.resource_id
</select>
<select
id=
"getTotalEnergy"
resultType=
"java.math.BigDecimal"
>
SELECT
cast(sum(cast(energy as decimal(10, 2))) as decimal(10, 2)) as totalEnergy
FROM
kqclj_info
WHERE 1 = 1
AND date_format( create_time, '%Y%m%d' ) = #{time}
</select>
</mapper>
microservice-admin/src/main/resources/mapper/eq/SnqxzInfoMapper.xml
View file @
b845d14a
...
...
@@ -57,7 +57,15 @@
GROUP BY t2.resource_id) AS t3 ON t1.resource_id = t3.resource_id AND t1.create_time = t3.maxdate
left join li_resource li on li.id = t1.resource_id
</select>
<select
id=
"getList2"
resultType=
"java.util.Map"
>
SELECT
cast(AVG(cast(temperature as decimal(10, 1))) as decimal(10, 1)) as temperature,
cast(AVG(cast(humidity as decimal(10, 1))) as decimal(10, 1)) as humidity
FROM
snqxz_info_hour
where
date_format(create_time,'%Y%m%d%H') = #{time}
</select>
</mapper>
microservice-admin/src/main/resources/mapper/eq/SwqxzInfoHourMapper.xml
View file @
b845d14a
...
...
@@ -13,6 +13,7 @@
<result
column=
"carbon_dioxide"
property=
"carbonDioxide"
/>
<result
column=
"fine_particles"
property=
"fineParticles"
/>
<result
column=
"radiation"
property=
"radiation"
/>
<result
column=
"pressure"
property=
"pressure"
/>
<result
column=
"type"
property=
"type"
/>
<result
column=
"station_id"
property=
"stationId"
/>
<result
column=
"create_time"
property=
"createTime"
/>
...
...
@@ -20,7 +21,7 @@
<!-- swqxz_info_hour table all fields -->
<sql
id=
"Base_Column_List"
>
id,resource_id,temperature,humidity,wind_speed,wind_direction,illuminance,carbon_dioxide,fine_particles,radiation,type,station_id,create_time
id,resource_id,temperature,humidity,wind_speed,wind_direction,illuminance,carbon_dioxide,fine_particles,radiation,
pressure,
type,station_id,create_time
</sql>
<!-- 公共查询条件 -->
...
...
@@ -39,6 +40,7 @@
<if
test=
"type!=null "
>
and t.type = #{type}
</if>
<if
test=
"stationId!=null and stationId!=''"
>
and t.station_id = #{stationId}
</if>
<if
test=
"createTime!=null "
>
and t.create_time = #{createTime}
</if>
<if
test=
"pressure!=null and pressure!=''"
>
and t.pressure = #{pressure}
</if>
</sql>
<select
id=
"queryPageByCount"
parameterType=
"Object"
resultType=
"java.lang.Integer"
>
...
...
microservice-admin/src/main/resources/mapper/eq/SwqxzInfoMapper.xml
View file @
b845d14a
...
...
@@ -9,11 +9,13 @@
<result
column=
"humidity"
property=
"humidity"
/>
<result
column=
"wind_speed"
property=
"windSpeed"
/>
<result
column=
"wind_direction"
property=
"windDirection"
/>
<result
column=
"wind_direction_num"
property=
"windDirectionNum"
/>
<result
column=
"illuminance"
property=
"illuminance"
/>
<result
column=
"carbon_dioxide"
property=
"carbonDioxide"
/>
<result
column=
"fine_particles"
property=
"fineParticles"
/>
<result
column=
"radiation"
property=
"radiation"
/>
<result
column=
"communication_failure"
property=
"communicationFailure"
/>
<result
column=
"pressure"
property=
"pressure"
/>
<result
column=
"type"
property=
"type"
/>
<result
column=
"station_id"
property=
"stationId"
/>
<result
column=
"create_time"
property=
"createTime"
/>
...
...
@@ -21,7 +23,7 @@
<!-- swqxz_info table all fields -->
<sql
id=
"Base_Column_List"
>
id,resource_id,temperature,humidity,wind_speed,wind_direction,
illuminance,carbon_dioxide,fine_particles,radiation,communication_fail
ure,type,station_id,create_time
id,resource_id,temperature,humidity,wind_speed,wind_direction,
wind_direction_num,illuminance,carbon_dioxide,fine_particles,radiation,communication_failure,press
ure,type,station_id,create_time
</sql>
<!-- 公共查询条件 -->
...
...
@@ -33,11 +35,13 @@
<if
test=
"humidity!=null and humidity!=''"
>
and t.humidity = #{humidity}
</if>
<if
test=
"windSpeed!=null and windSpeed!=''"
>
and t.wind_speed = #{windSpeed}
</if>
<if
test=
"windDirection!=null and windDirection!=''"
>
and t.wind_direction = #{windDirection}
</if>
<if
test=
"windDirectionNum!=null and windDirectionNum!=''"
>
and t.wind_direction_num = #{windDirectionNum}
</if>
<if
test=
"illuminance!=null and illuminance!=''"
>
and t.illuminance = #{illuminance}
</if>
<if
test=
"carbonDioxide!=null and carbonDioxide!=''"
>
and t.carbon_dioxide = #{carbonDioxide}
</if>
<if
test=
"fineParticles!=null and fineParticles!=''"
>
and t.fine_particles = #{fineParticles}
</if>
<if
test=
"radiation!=null and radiation!=''"
>
and t.radiation = #{radiation}
</if>
<if
test=
"communicationFailure!=null and communicationFailure!=''"
>
and t.communication_failure = #{communicationFailure}
</if>
<if
test=
"pressure!=null and pressure!=''"
>
and t.pressure = #{pressure}
</if>
<if
test=
"type!=null "
>
and t.type = #{type}
</if>
<if
test=
"stationId!=null and stationId!=''"
>
and t.station_id = #{stationId}
</if>
<if
test=
"createTime!=null "
>
and t.create_time = #{createTime}
</if>
...
...
@@ -67,7 +71,9 @@
GROUP BY t2.resource_id) AS t3 ON t1.resource_id = t3.resource_id AND t1.create_time = t3.maxdate
left join li_resource li on li.id = t1.resource_id
</select>
<select
id=
"getList2"
resultType=
"java.util.Map"
>
SELECT * FROM swqxz_info order by create_time desc limit 1
</select>
</mapper>
microservice-admin/src/main/resources/mapper/eq/WarnInfoMapper.xml
0 → 100644
View file @
b845d14a
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.devplatform.admin.modules.eq.dao.WarnInfoDao"
>
</mapper>
microservice-admin/src/main/resources/mapper/eq/ZyFlrbInfoMapper.xml
0 → 100644
View file @
b845d14a
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.devplatform.admin.modules.eq.dao.ZyFlrbInfoDao"
>
<!-- Result Map -->
<resultMap
id=
"BaseResultMap"
type=
"com.devplatform.admin.modules.eq.bean.ZyFlrbInfo"
>
<result
column=
"id"
property=
"id"
/>
<result
column=
"resource_id"
property=
"resourceId"
/>
<result
column=
"water_supply_temperature"
property=
"waterSupplyTemperature"
/>
<result
column=
"return_water_temperature"
property=
"returnWaterTemperature"
/>
<result
column=
"water_rate"
property=
"waterRate"
/>
<result
column=
"heating_tem"
property=
"heatingTem"
/>
<result
column=
"refrigeration_tem"
property=
"refrigerationTem"
/>
<result
column=
"switch_mode"
property=
"switchMode"
/>
<result
column=
"host_status"
property=
"hostStatus"
/>
<result
column=
"energy"
property=
"energy"
/>
<result
column=
"type"
property=
"type"
/>
<result
column=
"station_id"
property=
"stationId"
/>
<result
column=
"create_time"
property=
"createTime"
/>
</resultMap>
<!-- zy_flrb_info table all fields -->
<sql
id=
"Base_Column_List"
>
id,resource_id,water_supply_temperature,return_water_temperature,water_rate,heating_tem,refrigeration_tem,switch_mode,host_status,energy,type,station_id,create_time
</sql>
<!-- 公共查询条件 -->
<sql
id=
"Example_Where_Clause"
>
where t.deleted=0
<if
test=
"id!=null and id!=''"
>
and t.id = #{id}
</if>
<if
test=
"resourceId!=null and resourceId!=''"
>
and t.resource_id = #{resourceId}
</if>
<if
test=
"waterSupplyTemperature!=null and waterSupplyTemperature!=''"
>
and t.water_supply_temperature = #{waterSupplyTemperature}
</if>
<if
test=
"returnWaterTemperature!=null and returnWaterTemperature!=''"
>
and t.return_water_temperature = #{returnWaterTemperature}
</if>
<if
test=
"waterRate!=null and waterRate!=''"
>
and t.water_rate = #{waterRate}
</if>
<if
test=
"heatingTem!=null and heatingTem!=''"
>
and t.heating_tem = #{heatingTem}
</if>
<if
test=
"refrigerationTem!=null and refrigerationTem!=''"
>
and t.refrigeration_tem = #{refrigerationTem}
</if>
<if
test=
"switchMode!=null and switchMode!=''"
>
and t.switch_mode = #{switchMode}
</if>
<if
test=
"hostStatus!=null and hostStatus!=''"
>
and t.host_status = #{hostStatus}
</if>
<if
test=
"energy!=null and energy!=''"
>
and t.energy = #{energy}
</if>
<if
test=
"type!=null "
>
and t.type = #{type}
</if>
<if
test=
"stationId!=null and stationId!=''"
>
and t.station_id = #{stationId}
</if>
<if
test=
"createTime!=null "
>
and t.create_time = #{createTime}
</if>
</sql>
<select
id=
"getList"
resultType=
"java.util.Map"
>
SELECT t1.*,li.name as resourceName,li.remark as remark,li.deploy_location as deployLocation,li.status as status,li.region as region
FROM zy_flrb_info AS t1
INNER JOIN
(SELECT t2.resource_id, MAX(t2.create_time) AS maxdate
FROM zy_flrb_info AS t2
GROUP BY t2.resource_id) AS t3 ON t1.resource_id = t3.resource_id AND t1.create_time = t3.maxdate
left join li_resource li on li.id = t1.resource_id
</select>
<select
id=
"selectZyFlrbInfo"
resultType=
"com.devplatform.admin.modules.eq.bean.ZyFlrbInfo"
>
SELECT * FROM zy_flrb_info WHERE 1 = 1 AND date_format( create_time, '%Y%m%d%H' ) = #{time}
AND resource_id = #{resourceId} ORDER BY create_time DESC LIMIT 1
</select>
<select
id=
"getTotalEnergy"
resultType=
"java.math.BigDecimal"
>
SELECT
cast(sum(cast(energy as decimal(10, 2))) as decimal(10, 2)) as totalEnergy
FROM
zy_flrb_info
WHERE 1 = 1
AND date_format( create_time, '%Y%m%d' ) = #{time}
</select>
</mapper>
microservice-admin/src/main/resources/mapper/eq/ZyJfktpInfoMapper.xml
0 → 100644
View file @
b845d14a
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.devplatform.admin.modules.eq.dao.ZyJfktpInfoDao"
>
<!-- Result Map -->
<resultMap
id=
"BaseResultMap"
type=
"com.devplatform.admin.modules.eq.bean.ZyJfktpInfo"
>
<result
column=
"id"
property=
"id"
/>
<result
column=
"resource_id"
property=
"resourceId"
/>
<result
column=
"wind_tem"
property=
"windTem"
/>
<result
column=
"water_feedback"
property=
"waterFeedback"
/>
<result
column=
"new_tem"
property=
"newTem"
/>
<result
column=
"season"
property=
"season"
/>
<result
column=
"filter_pressure"
property=
"filterPressure"
/>
<result
column=
"fan_pressure"
property=
"fanPressure"
/>
<result
column=
"status"
property=
"status"
/>
<result
column=
"failure"
property=
"failure"
/>
<result
column=
"automatic"
property=
"automatic"
/>
<result
column=
"energy"
property=
"energy"
/>
<result
column=
"type"
property=
"type"
/>
<result
column=
"station_id"
property=
"stationId"
/>
<result
column=
"create_time"
property=
"createTime"
/>
</resultMap>
<!-- zy_jfktp_info table all fields -->
<sql
id=
"Base_Column_List"
>
id,resource_id,wind_tem,water_feedback,new_tem,season,filter_pressure,fan_pressure,status,failure,automatic,energy,type,station_id,create_time
</sql>
<!-- 公共查询条件 -->
<sql
id=
"Example_Where_Clause"
>
where t.deleted=0
<if
test=
"id!=null and id!=''"
>
and t.id = #{id}
</if>
<if
test=
"resourceId!=null and resourceId!=''"
>
and t.resource_id = #{resourceId}
</if>
<if
test=
"windTem!=null and windTem!=''"
>
and t.wind_tem = #{windTem}
</if>
<if
test=
"waterFeedback!=null and waterFeedback!=''"
>
and t.water_feedback = #{waterFeedback}
</if>
<if
test=
"newTem!=null and newTem!=''"
>
and t.new_tem = #{newTem}
</if>
<if
test=
"season!=null and season!=''"
>
and t.season = #{season}
</if>
<if
test=
"filterPressure!=null and filterPressure!=''"
>
and t.filter_pressure = #{filterPressure}
</if>
<if
test=
"fanPressure!=null and fanPressure!=''"
>
and t.fan_pressure = #{fanPressure}
</if>
<if
test=
"status!=null and status!=''"
>
and t.status = #{status}
</if>
<if
test=
"failure!=null and failure!=''"
>
and t.failure = #{failure}
</if>
<if
test=
"automatic!=null and automatic!=''"
>
and t.automatic = #{automatic}
</if>
<if
test=
"energy!=null and energy!=''"
>
and t.energy = #{energy}
</if>
<if
test=
"type!=null "
>
and t.type = #{type}
</if>
<if
test=
"stationId!=null and stationId!=''"
>
and t.station_id = #{stationId}
</if>
<if
test=
"createTime!=null "
>
and t.create_time = #{createTime}
</if>
</sql>
<select
id=
"getList"
resultType=
"java.util.Map"
>
SELECT t1.*,li.name as resourceName,li.remark as remark,li.deploy_location as deployLocation,li.status as status
FROM zy_jfktp_info AS t1
INNER JOIN
(SELECT t2.resource_id, MAX(t2.create_time) AS maxdate
FROM zy_jfktp_info AS t2
GROUP BY t2.resource_id) AS t3 ON t1.resource_id = t3.resource_id AND t1.create_time = t3.maxdate
left join li_resource li on li.id = t1.resource_id
</select>
<select
id=
"selectZyJfktpInfo"
resultType=
"com.devplatform.admin.modules.eq.bean.ZyJfktpInfo"
>
SELECT * FROM zy_jfktp_info WHERE 1 = 1 AND date_format( create_time, '%Y%m%d%H' ) = #{time}
AND resource_id = #{resourceId} ORDER BY create_time DESC LIMIT 1
</select>
<select
id=
"getTotalEnergy"
resultType=
"java.math.BigDecimal"
>
SELECT
cast(sum(cast(energy as decimal(10, 2))) as decimal(10, 2)) as totalEnergy
FROM
zy_jfktp_info
WHERE 1 = 1
AND date_format( create_time, '%Y%m%d' ) = #{time}
</select>
</mapper>
microservice-admin/src/main/resources/mapper/liResource/LiResourceMapper.xml
View file @
b845d14a
...
...
@@ -251,6 +251,11 @@
from li_resource lr
where lr.deleted = 0 and FIND_IN_SET(#{modeTypes},lr.mode_types)
</select>
<select
id=
"selectResourceList"
resultType=
"com.devplatform.admin.modules.liresource.bean.LiResource"
>
select lr.id,lr.name
from li_resource lr
where lr.deleted = 0
</select>
</mapper>
microservice-admin/src/main/resources/mapper/sys/SysFaulalarmMapper.xml
View file @
b845d14a
...
...
@@ -92,7 +92,8 @@
<if
test=
"endTime != null and endTime != ''"
>
and start_time
<
= #{endTime}
</if>
GROUP BY date_format(start_time,'%Y%m%d%H')
-- GROUP BY date_format(start_time,'%Y%m%d%H')
GROUP BY start_time
order by start_time
</select>
...
...
microservice-config-server/src/main/resources/application-dev.yml
View file @
b845d14a
...
...
@@ -60,13 +60,13 @@ spring:
datasource
:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.jdbc.Driver
#
url: jdbc:mysql://localhost:3306/energy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&allowMultiQueries=true&serverTimezone=GMT%2B8&useSSL=false
url
:
jdbc:mysql://localhost:3306/energy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&allowMultiQueries=true&serverTimezone=GMT%2B8&useSSL=false
# username: root
# password: 123456
# url: jdbc:mysql://47.94.207.62:3306/energy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&allowMultiQueries=true&serverTimezone=GMT%2B8&useSSL=false
# username: root
# password: superAdmin&321
url
:
jdbc:mysql://10.20.2.33:3306/energy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&allowMultiQueries=true&serverTimezone=GMT%2B8&useSSL=false
#
url: jdbc:mysql://10.20.2.33:3306/energy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&allowMultiQueries=true&serverTimezone=GMT%2B8&useSSL=false
username
:
root
password
:
root
initialSize
:
5
...
...
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