Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 609485a3
由
zshaohui
编写于
2022-12-16 10:48:42 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
温湿度求平均值展示
1 个父辈
058a8325
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
52 行增加
和
3 行删除
src/main/java/com/neotel/smfcore/core/kanban/rest/BoxKanbanController.java
src/main/java/com/neotel/smfcore/core/kanban/rest/bean/HumiAndtemp.java
src/main/java/com/neotel/smfcore/core/kanban/rest/bean/dto/BoxStatusDto.java
src/main/java/com/neotel/smfcore/core/kanban/rest/BoxKanbanController.java
查看文件 @
609485a
...
@@ -15,6 +15,7 @@ import com.neotel.smfcore.core.device.bean.BoxStatusBean;
...
@@ -15,6 +15,7 @@ import com.neotel.smfcore.core.device.bean.BoxStatusBean;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.bean.StatusBean
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.kanban.rest.bean.HumiAndtemp
;
import
com.neotel.smfcore.core.kanban.rest.bean.dto.*
;
import
com.neotel.smfcore.core.kanban.rest.bean.dto.*
;
import
com.neotel.smfcore.core.kanban.rest.bean.mapstruct.BoxTaskMapper
;
import
com.neotel.smfcore.core.kanban.rest.bean.mapstruct.BoxTaskMapper
;
import
com.neotel.smfcore.core.kanban.rest.bean.query.BoxTaskQueryCriter
;
import
com.neotel.smfcore.core.kanban.rest.bean.query.BoxTaskQueryCriter
;
...
@@ -52,6 +53,7 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -52,6 +53,7 @@ import javax.servlet.http.HttpServletRequest;
import
java.util.*
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
@Slf4j
@Slf4j
...
@@ -462,7 +464,18 @@ public class BoxKanbanController {
...
@@ -462,7 +464,18 @@ public class BoxKanbanController {
if
(
data
!=
null
){
if
(
data
!=
null
){
String
humiAndtempListStr
=
data
.
get
(
"humiAndtempList"
);
String
humiAndtempListStr
=
data
.
get
(
"humiAndtempList"
);
if
(
StringUtils
.
isNotBlank
(
humiAndtempListStr
)){
if
(
StringUtils
.
isNotBlank
(
humiAndtempListStr
)){
boxDto
.
setHumiAndtempList
(
JsonUtil
.
toList
(
humiAndtempListStr
,
Map
.
class
));
List
<
HumiAndtemp
>
humiAndtempList
=
JsonUtil
.
toList
(
humiAndtempListStr
,
HumiAndtemp
.
class
);
boxDto
.
setHumiAndtempList
(
humiAndtempList
);
//得到温度平均值
Double
humidityAgv
=
humiAndtempList
.
stream
().
collect
(
Collectors
.
averagingDouble
(
HumiAndtemp:
:
getHumidity
));
if
(
humidityAgv
!=
null
){
boxDto
.
setHumidity
(
humidityAgv
+
""
);
}
//得到湿度平均值
Double
temperatureAgv
=
humiAndtempList
.
stream
().
collect
(
Collectors
.
averagingDouble
(
HumiAndtemp:
:
getTemperature
));
if
(
temperatureAgv
!=
null
){
boxDto
.
setTemperature
(
temperatureAgv
+
""
);
}
}
}
}
}
...
@@ -497,7 +510,18 @@ public class BoxKanbanController {
...
@@ -497,7 +510,18 @@ public class BoxKanbanController {
if
(
data
!=
null
){
if
(
data
!=
null
){
String
humiAndtempListStr
=
data
.
get
(
"humiAndtempList"
);
String
humiAndtempListStr
=
data
.
get
(
"humiAndtempList"
);
if
(
StringUtils
.
isNotBlank
(
humiAndtempListStr
)){
if
(
StringUtils
.
isNotBlank
(
humiAndtempListStr
)){
boxDto
.
setHumiAndtempList
(
JsonUtil
.
toList
(
humiAndtempListStr
,
Map
.
class
));
List
<
HumiAndtemp
>
humiAndtempList
=
JsonUtil
.
toList
(
humiAndtempListStr
,
HumiAndtemp
.
class
);
boxDto
.
setHumiAndtempList
(
humiAndtempList
);
//得到温度平均值
Double
humidityAgv
=
humiAndtempList
.
stream
().
collect
(
Collectors
.
averagingDouble
(
HumiAndtemp:
:
getHumidity
));
if
(
humidityAgv
!=
null
){
boxDto
.
setHumidity
(
humidityAgv
+
""
);
}
//得到湿度平均值
Double
temperatureAgv
=
humiAndtempList
.
stream
().
collect
(
Collectors
.
averagingDouble
(
HumiAndtemp:
:
getTemperature
));
if
(
temperatureAgv
!=
null
){
boxDto
.
setTemperature
(
temperatureAgv
+
""
);
}
}
}
}
}
...
...
src/main/java/com/neotel/smfcore/core/kanban/rest/bean/HumiAndtemp.java
0 → 100644
查看文件 @
609485a
package
com
.
neotel
.
smfcore
.
core
.
kanban
.
rest
.
bean
;
import
lombok.Getter
;
/**
* 温湿度
*/
@Getter
public
class
HumiAndtemp
{
/**
* 设备id
*/
private
String
id
;
/**
* 温度
*/
private
Double
humidity
;
/**
* 湿度
*/
private
Double
temperature
;
}
src/main/java/com/neotel/smfcore/core/kanban/rest/bean/dto/BoxStatusDto.java
查看文件 @
609485a
package
com
.
neotel
.
smfcore
.
core
.
kanban
.
rest
.
bean
.
dto
;
package
com
.
neotel
.
smfcore
.
core
.
kanban
.
rest
.
bean
.
dto
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.kanban.rest.bean.HumiAndtemp
;
import
com.neotel.smfcore.core.storage.bean.UsageItem
;
import
com.neotel.smfcore.core.storage.bean.UsageItem
;
import
com.neotel.smfcore.core.storage.enums.DeviceType
;
import
com.neotel.smfcore.core.storage.enums.DeviceType
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
@@ -82,5 +83,5 @@ public class BoxStatusDto {
...
@@ -82,5 +83,5 @@ public class BoxStatusDto {
private
String
inListName
=
""
;
private
String
inListName
=
""
;
@ApiModelProperty
(
"温湿度列表"
)
@ApiModelProperty
(
"温湿度列表"
)
private
List
<
Ma
p
>
humiAndtempList
;
private
List
<
HumiAndtem
p
>
humiAndtempList
;
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论