Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 0cc69d94
由
zshaohui
编写于
2023-10-31 13:27:13 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.增加温湿度报表
1 个父辈
782479ec
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
283 行增加
和
1 行删除
src/main/java/com/neotel/smfcore/common/init/DataInitManager.java
src/main/java/com/neotel/smfcore/common/utils/SecurityUtils.java
src/main/java/com/neotel/smfcore/core/humiture/rest/HumitureController.java
src/main/java/com/neotel/smfcore/core/humiture/rest/bean/dto/HumitureDto.java
src/main/java/com/neotel/smfcore/core/humiture/rest/bean/query/HumitureQueryCriteria.java
src/main/java/com/neotel/smfcore/core/system/service/manager/impl/HumitureManagerImpl.java
src/main/java/com/neotel/smfcore/custom/neotelApi/rest/NeotelController.java
src/main/java/com/neotel/smfcore/common/init/DataInitManager.java
查看文件 @
0cc69d9
...
...
@@ -214,6 +214,7 @@ public class DataInitManager {
addNewFunctionMenu
(
71
,
pMenuReport
,
"inOutData"
,
"出入库"
,
"inOutData"
,
"neolight/inOutData/index"
,
"outPut"
,
functionMenuMap
);
addNewFunctionMenu
(
72
,
pMenuReport
,
"inventory"
,
"库存"
,
"inventory"
,
"neolight/inventory/index"
,
"inventory"
,
functionMenuMap
);
addNewFunctionMenu
(
73
,
pMenuReport
,
"inOutDataCount"
,
"出入库"
,
"inOutDataCount"
,
"neolight/inOutDataCount/index"
,
"outPut"
,
functionMenuMap
);
addNewFunctionMenu
(
74
,
pMenuReport
,
"humiture"
,
"温湿度"
,
"humiture"
,
"humiture/humitureReport/index"
,
"humiture"
,
functionMenuMap
);
//可观测性:物料追踪
Menu
guanceMenu
=
Menu
.
CreatePMenu
(
"可观测性"
,
8
,
"observability"
,
2
,
"scanKey"
,
null
);
...
...
src/main/java/com/neotel/smfcore/common/utils/SecurityUtils.java
查看文件 @
0cc69d9
...
...
@@ -19,6 +19,8 @@ import cn.hutool.json.JSONArray;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.core.storage.service.manager.IStorageManager
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.security.service.manager.IUserManager
;
import
com.neotel.smfcore.security.service.po.User
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -30,9 +32,11 @@ import org.springframework.security.core.userdetails.UserDetails;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.stream.Collectors
;
@Slf4j
@Component
...
...
@@ -46,6 +50,37 @@ public class SecurityUtils {
SecurityUtils
.
userManager
=
userManager
;
}
private
static
IStorageManager
storageManager
;
@Autowired
public
void
setStorageManager
(
IStorageManager
storageManager
){
SecurityUtils
.
storageManager
=
storageManager
;
}
/**
* 获取当前用户分组对应料仓cid
*
* @return
*/
public
static
List
<
String
>
getUserGroupCid
()
{
List
<
String
>
resultList
=
new
ArrayList
<>();
String
username
=
getLoginUsername
();
User
user
=
userManager
.
findByUserName
(
username
);
List
<
Storage
>
storageList
=
storageManager
.
findAll
();
if
(
user
!=
null
&&
user
.
getGroups
()
!=
null
&&
!
user
.
getGroups
().
isEmpty
())
{
for
(
Storage
storage
:
storageList
)
{
if
(
user
.
getGroups
().
contains
(
storage
.
getGroupId
()))
{
resultList
.
add
(
storage
.
getCid
());
}
}
}
else
{
resultList
=
storageList
.
stream
().
map
(
item
->
item
.
getCid
()).
collect
(
Collectors
.
toList
());
}
return
resultList
;
}
/**
* 获取当前登录的用户
* @return UserDetails
...
...
src/main/java/com/neotel/smfcore/core/humiture/rest/HumitureController.java
0 → 100644
查看文件 @
0cc69d9
package
com
.
neotel
.
smfcore
.
core
.
humiture
.
rest
;
import
com.google.common.collect.Lists
;
import
com.neotel.smfcore.common.base.IExcelDownLoad
;
import
com.neotel.smfcore.common.bean.PageData
;
import
com.neotel.smfcore.common.utils.*
;
import
com.neotel.smfcore.core.device.util.DataCache
;
import
com.neotel.smfcore.core.humiture.rest.bean.dto.HumitureDto
;
import
com.neotel.smfcore.core.humiture.rest.bean.query.HumitureQueryCriteria
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.msd.bean.MSDSettiings
;
import
com.neotel.smfcore.core.storage.service.po.Storage
;
import
com.neotel.smfcore.core.system.service.manager.IHumitureManager
;
import
com.neotel.smfcore.core.system.service.po.Humiture
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
@Slf4j
@RestController
@Api
(
tags
=
"温湿度"
)
public
class
HumitureController
{
@Autowired
IHumitureManager
humitureManager
;
@Autowired
DataCache
dataCache
;
@ApiOperation
(
"获取温湿度"
)
@GetMapping
(
"api/humiture/list"
)
@AnonymousAccess
public
HumitureDto
info
(
HumitureQueryCriteria
criteria
,
Pageable
pageable
)
{
MSDSettiings
msdSettiings
=
dataCache
.
getCache
(
Constants
.
CACHE_msdSetting
);
if
(
msdSettiings
==
null
)
{
msdSettiings
=
new
MSDSettiings
();
}
Float
maxTemperature
=
msdSettiings
.
getMaxTemperature
();
Float
maxHumidity
=
msdSettiings
.
getMaxHumidity
();
Float
minTemperature
=
msdSettiings
.
getMinTemperature
();
Float
minHumidity
=
msdSettiings
.
getMinHumidity
();
List
<
String
>
cids
=
criteria
.
getCids
();
String
storageId
=
criteria
.
getStorageId
();
if
(
StringUtils
.
isNotBlank
(
storageId
))
{
Storage
storage
=
dataCache
.
getStorageById
(
storageId
);
if
(
cids
==
null
||
cids
.
isEmpty
())
{
cids
=
new
ArrayList
<>();
}
cids
.
add
(
storage
.
getCid
());
criteria
.
setCids
(
cids
);
}
if
(
cids
==
null
||
cids
.
isEmpty
())
{
criteria
.
setCids
(
SecurityUtils
.
getUserGroupCid
());
}
Query
query
=
QueryHelp
.
getQuery
(
criteria
);
query
.
with
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"createDate"
));
query
.
addCriteria
(
Criteria
.
where
(
"humiAndtempListStr"
).
exists
(
true
));
PageData
<
Humiture
>
resultList
=
new
PageData
<>();
int
resultTotalElements
=
0
;
List
<
Humiture
>
resultHumitureList
=
new
ArrayList
<>();
PageData
<
Humiture
>
humitureList
=
humitureManager
.
findByPage
(
query
,
pageable
);
int
totalElements
=
humitureList
.
getTotalElements
();
if
(
totalElements
!=
0
)
{
resultTotalElements
=
totalElements
;
List
<
Humiture
>
content
=
humitureList
.
getContent
();
for
(
Humiture
humiture
:
content
)
{
String
humiAndtempListStr
=
humiture
.
getHumiAndtempListStr
();
if
(
StringUtils
.
isNotBlank
(
humiAndtempListStr
)){
List
<
Humiture
>
subHumiAndtempList
=
JsonUtil
.
toList
(
humiAndtempListStr
,
Humiture
.
class
);
for
(
Humiture
subHumiture
:
subHumiAndtempList
)
{
subHumiture
.
setCid
(
humiture
.
getCid
()+
"-"
+
subHumiture
.
getId
());
subHumiture
.
setCreateDate
(
humiture
.
getCreateDate
());
subHumiture
.
setUpdateDate
(
humiture
.
getUpdateDate
());
resultHumitureList
.
add
(
subHumiture
);
}
}
}
}
resultList
.
setTotalElements
(
resultTotalElements
);
resultList
.
setContent
(
resultHumitureList
);
HumitureDto
restultDto
=
new
HumitureDto
();
restultDto
.
setMaxHumidity
(
maxHumidity
);
restultDto
.
setMinHumidity
(
minHumidity
);
restultDto
.
setMinTemperature
(
minTemperature
);
restultDto
.
setMaxTemperature
(
maxTemperature
);
restultDto
.
setHumitureList
(
resultList
);
return
restultDto
;
}
@ApiOperation
(
"导出温湿度列表"
)
@GetMapping
(
value
=
"api/humiture/list/download"
)
public
void
download
(
HttpServletResponse
response
,
HumitureQueryCriteria
criteria
,
Pageable
pageable
,
HttpServletRequest
request
)
throws
IOException
{
List
<
String
>
cids
=
criteria
.
getCids
();
if
(
cids
==
null
||
cids
.
isEmpty
())
{
criteria
.
setCids
(
SecurityUtils
.
getUserGroupCid
());
}
Query
query
=
QueryHelp
.
getQuery
(
criteria
);
query
.
with
(
Sort
.
by
(
Sort
.
Direction
.
ASC
,
"createDate"
));
query
.
addCriteria
(
Criteria
.
where
(
"humiAndtempListStr"
).
exists
(
true
));
FileUtil
.
downloadExcel
(
query
,
pageable
,
response
,
new
IExcelDownLoad
()
{
@Override
public
List
<
List
<
String
>>
getHeader
()
{
List
<
List
<
String
>>
headerList
=
new
ArrayList
<>();
headerList
.
add
(
Arrays
.
asList
(
"cid"
));
headerList
.
add
(
Arrays
.
asList
(
"设备名称"
));
headerList
.
add
(
Arrays
.
asList
(
"温度"
));
headerList
.
add
(
Arrays
.
asList
(
"湿度"
));
headerList
.
add
(
Arrays
.
asList
(
"创建时间"
));
headerList
.
add
(
Arrays
.
asList
(
"更新时间"
));
return
headerList
;
}
@Override
public
List
<
List
<
Object
>>
getPageData
(
Query
query
,
Pageable
pageable
)
{
List
<
List
<
Object
>>
resultList
=
new
ArrayList
<>();
PageData
<
Humiture
>
pageData
=
humitureManager
.
findByPage
(
query
,
pageable
);
int
totalElements
=
pageData
.
getTotalElements
();
if
(
totalElements
!=
0
)
{
List
<
Humiture
>
humitureList
=
pageData
.
getContent
();
for
(
Humiture
humiture
:
humitureList
)
{
String
humiAndtempListStr
=
humiture
.
getHumiAndtempListStr
();
if
(
StringUtils
.
isNotBlank
(
humiAndtempListStr
))
{
List
<
Humiture
>
subHumiAndtempList
=
JsonUtil
.
toList
(
humiAndtempListStr
,
Humiture
.
class
);
for
(
Humiture
subHumiture
:
subHumiAndtempList
)
{
List
<
Object
>
data
=
new
ArrayList
<>();
data
.
add
(
humiture
.
getCid
()
+
"-"
+
subHumiture
.
getId
());
Storage
storage
=
dataCache
.
getStorage
(
humiture
.
getCid
());
data
.
add
(
storage
.
getName
());
data
.
add
(
subHumiture
.
getTemperature
());
data
.
add
(
subHumiture
.
getHumidity
());
data
.
add
(
humiture
.
getCreateDate
());
data
.
add
(
humiture
.
getUpdateDate
());
resultList
.
add
(
data
);
}
}
}
}
return
resultList
;
}
});
}
}
src/main/java/com/neotel/smfcore/core/humiture/rest/bean/dto/HumitureDto.java
0 → 100644
查看文件 @
0cc69d9
package
com
.
neotel
.
smfcore
.
core
.
humiture
.
rest
.
bean
.
dto
;
import
com.neotel.smfcore.common.bean.PageData
;
import
com.neotel.smfcore.core.kanban.rest.bean.dto.BoxStatusDto
;
import
com.neotel.smfcore.core.system.service.po.Humiture
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.util.List
;
/**
* @date 2022-12-05
* @author sunke
*/
@Getter
@Setter
public
class
HumitureDto
{
/**
* 最高温度
*/
@ApiModelProperty
(
"最高温度"
)
private
float
maxTemperature
=
38.0
F
;
@ApiModelProperty
(
"最低温度"
)
private
float
minTemperature
=
0.0
F
;
/**
* 最大湿度值
*/
@ApiModelProperty
(
"最大湿度"
)
private
float
maxHumidity
=
100.0
F
;
@ApiModelProperty
(
"温湿度数据"
)
PageData
<
Humiture
>
humitureList
;
@ApiModelProperty
(
"最小湿度"
)
private
float
minHumidity
=
0.0
F
;
@ApiModelProperty
(
"冷藏区最低温度"
)
private
float
minColdAreaTemp
=
-
5.0
F
;
@ApiModelProperty
(
"冷藏区最高温度"
)
private
float
maxColdAreaTemp
=
10.0
F
;
}
src/main/java/com/neotel/smfcore/core/humiture/rest/bean/query/HumitureQueryCriteria.java
0 → 100644
查看文件 @
0cc69d9
package
com
.
neotel
.
smfcore
.
core
.
humiture
.
rest
.
bean
.
query
;
import
com.neotel.smfcore.common.annotation.QueryCondition
;
import
com.neotel.smfcore.common.bean.BetweenData
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
import
java.util.List
;
@Data
public
class
HumitureQueryCriteria
{
@ApiModelProperty
(
"料仓CID列表"
)
@QueryCondition
(
type
=
QueryCondition
.
Type
.
IN
,
propName
=
"cid"
)
private
List
<
String
>
cids
;
/**
* 仅搜索大于此ID的温湿度值
*/
@QueryCondition
(
type
=
QueryCondition
.
Type
.
GT
,
propName
=
"id"
)
private
String
humitureId
;
@QueryCondition
(
type
=
QueryCondition
.
Type
.
BETWEEN
,
propName
=
"createDate"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
BetweenData
<
Date
>
createDate
;
private
String
storageId
;
}
src/main/java/com/neotel/smfcore/core/system/service/manager/impl/HumitureManagerImpl.java
查看文件 @
0cc69d9
...
...
@@ -36,7 +36,9 @@ public class HumitureManagerImpl implements IHumitureManager {
@Override
public
PageData
<
Humiture
>
findByPage
(
Query
query
,
Pageable
pageable
)
{
return
null
;
int
totalCount
=
humitureDao
.
countByQuery
(
query
);
List
<
Humiture
>
list
=
humitureDao
.
findByQuery
(
query
,
pageable
);
return
new
PageData
<
Humiture
>(
list
,
totalCount
);
}
@Override
...
...
src/main/java/com/neotel/smfcore/custom/neotelApi/rest/NeotelController.java
查看文件 @
0cc69d9
...
...
@@ -95,6 +95,7 @@ public class NeotelController {
String
reelId
=
outItem
.
get
(
"reelId"
).
toString
();
orderItem
.
setRi
(
reelId
);
//料盘唯一码
orderItem
.
setNeedNum
(
1
);
orderItem
.
setNeedReelCount
(
1
);
}
orderItemList
.
add
(
orderItem
);
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论