Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 14fc5f41
由
LN
编写于
2023-04-21 13:36:30 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
报表服务器功能修改,增加配置: onlyReport: true
1 个父辈
35663066
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
54 行增加
和
3 行删除
src/main/java/com/neotel/smfcore/core/message/util/DeviceMessageUtil.java
src/main/java/com/neotel/smfcore/core/storage/rest/StorageController.java
src/main/java/com/neotel/smfcore/security/rest/MenuController.java
src/main/java/com/neotel/smfcore/core/message/util/DeviceMessageUtil.java
查看文件 @
14fc5f4
...
@@ -18,6 +18,7 @@ import lombok.AllArgsConstructor;
...
@@ -18,6 +18,7 @@ import lombok.AllArgsConstructor;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
...
@@ -36,6 +37,8 @@ public class DeviceMessageUtil {
...
@@ -36,6 +37,8 @@ public class DeviceMessageUtil {
private
static
IMessageManager
messageManager
;
private
static
IMessageManager
messageManager
;
private
static
Boolean
onlyReport
=
false
;
@Autowired
@Autowired
public
void
setDataCache
(
DataCache
dataCache
)
{
public
void
setDataCache
(
DataCache
dataCache
)
{
DeviceMessageUtil
.
dataCache
=
dataCache
;
DeviceMessageUtil
.
dataCache
=
dataCache
;
...
@@ -48,6 +51,9 @@ public class DeviceMessageUtil {
...
@@ -48,6 +51,9 @@ public class DeviceMessageUtil {
public
void
setMessageManager
(
IMessageManager
messageManager
)
{
public
void
setMessageManager
(
IMessageManager
messageManager
)
{
DeviceMessageUtil
.
messageManager
=
messageManager
;
DeviceMessageUtil
.
messageManager
=
messageManager
;
}
}
@Value
(
"${menu.onlyReport:}"
)
public
void
setOnlyReport
(
Boolean
onlyReport
){
DeviceMessageUtil
.
onlyReport
=
onlyReport
;}
/**
/**
* 流水线提示消息,只保存最后一条
* 流水线提示消息,只保存最后一条
...
@@ -165,6 +171,11 @@ public class DeviceMessageUtil {
...
@@ -165,6 +171,11 @@ public class DeviceMessageUtil {
public
static
void
processDeviceStatus
()
{
public
static
void
processDeviceStatus
()
{
try
{
try
{
if
(
onlyReport
){
log
.
info
(
"processDeviceStatus : onlyReport=true,直接返回"
);
return
;
}
//获取所有料仓状态
//获取所有料仓状态
Map
<
String
,
Storage
>
allStorages
=
dataCache
.
getAllStorage
();
Map
<
String
,
Storage
>
allStorages
=
dataCache
.
getAllStorage
();
String
[]
msgCodes
=
new
String
[]{
"smfcore.messages.online"
,
"smfcore.messages.offline"
};
String
[]
msgCodes
=
new
String
[]{
"smfcore.messages.online"
,
"smfcore.messages.offline"
};
...
...
src/main/java/com/neotel/smfcore/core/storage/rest/StorageController.java
查看文件 @
14fc5f4
...
@@ -158,6 +158,9 @@ public class StorageController {
...
@@ -158,6 +158,9 @@ public class StorageController {
User
user
=
userManager
.
get
(
userId
);
User
user
=
userManager
.
get
(
userId
);
mygroups
=
user
.
getGroups
();
mygroups
=
user
.
getGroups
();
}
}
if
(
mygroups
==
null
){
mygroups
=
new
HashSet
<>();
}
mygroups
.
add
(
""
);
mygroups
.
add
(
""
);
List
<
Storage
>
allStorages
=
storageManager
.
findAll
();
List
<
Storage
>
allStorages
=
storageManager
.
findAll
();
...
...
src/main/java/com/neotel/smfcore/security/rest/MenuController.java
查看文件 @
14fc5f4
...
@@ -31,7 +31,9 @@ import com.neotel.smfcore.security.rest.bean.mapstruct.MenuMapper;
...
@@ -31,7 +31,9 @@ import com.neotel.smfcore.security.rest.bean.mapstruct.MenuMapper;
import
com.neotel.smfcore.security.rest.bean.query.MenuQueryCondition
;
import
com.neotel.smfcore.security.rest.bean.query.MenuQueryCondition
;
import
com.neotel.smfcore.security.rest.bean.vo.MenuVo
;
import
com.neotel.smfcore.security.rest.bean.vo.MenuVo
;
import
com.neotel.smfcore.security.service.manager.IMenuManager
;
import
com.neotel.smfcore.security.service.manager.IMenuManager
;
import
com.neotel.smfcore.security.service.manager.IUserManager
;
import
com.neotel.smfcore.security.service.po.Menu
;
import
com.neotel.smfcore.security.service.po.Menu
;
import
com.neotel.smfcore.security.service.po.User
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
...
@@ -39,6 +41,7 @@ import lombok.extern.log4j.Log4j;
...
@@ -39,6 +41,7 @@ import lombok.extern.log4j.Log4j;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.logging.log4j.util.Strings
;
import
org.apache.logging.log4j.util.Strings
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
...
@@ -68,10 +71,13 @@ public class MenuController {
...
@@ -68,10 +71,13 @@ public class MenuController {
private
final
IMenuManager
menuManager
;
private
final
IMenuManager
menuManager
;
@Autowired
@Autowired
private
final
MenuMapper
menuMapper
;
private
final
MenuMapper
menuMapper
;
@Autowired
private
final
IUserManager
userManager
;
@Autowired
@Autowired
MenuInit
menuInit
;
MenuInit
menuInit
;
@Value
(
"${menu.onlyReport:}"
)
protected
Boolean
onlyReport
=
false
;
@RequestMapping
(
value
=
"/show"
)
@RequestMapping
(
value
=
"/show"
)
@AnonymousAccess
@AnonymousAccess
public
ResponseEntity
<
Object
>
show
(
@RequestParam
String
menuPath
)
{
public
ResponseEntity
<
Object
>
show
(
@RequestParam
String
menuPath
)
{
...
@@ -94,6 +100,36 @@ public class MenuController {
...
@@ -94,6 +100,36 @@ public class MenuController {
@ApiOperation
(
"获取前端所需菜单"
)
@ApiOperation
(
"获取前端所需菜单"
)
@AnonymousAccess
@AnonymousAccess
public
ResponseEntity
<
Object
>
buildMenus
(
HttpServletRequest
servletRequest
)
{
public
ResponseEntity
<
Object
>
buildMenus
(
HttpServletRequest
servletRequest
)
{
if
(
onlyReport
)
{
String
userId
=
"1"
;
try
{
User
user
=
userManager
.
findByUserName
(
Constants
.
SUPER_USERNAME
);
userId
=
user
.
getId
();
}
catch
(
Exception
ex
)
{
log
.
error
(
"获取用户出错:"
+
ex
);
}
List
<
Menu
>
menuList
=
menuManager
.
findByUserId
(
userId
);
List
<
Menu
>
reportMenuList
=
new
ArrayList
<>();
Menu
report
=
null
;
for
(
Menu
menu
:
menuList
)
{
if
(
menu
.
getPath
().
equals
(
"report"
))
{
report
=
menu
;
break
;
}
}
reportMenuList
.
add
(
report
);
for
(
Menu
menu
:
menuList
)
{
if
(
menu
.
getPid
()
!=
null
&&
menu
.
getPid
().
equals
(
report
.
getId
()))
{
reportMenuList
.
add
(
menu
);
}
}
List
<
Menu
>
buildMenuList
=
menuManager
.
buildTree
(
reportMenuList
);
// List<MenuDto> menuDtoList = menuMapper.toDto(menuManager.buildTree(menuList));
List
<
MenuVo
>
vos
=
menuManager
.
buildMenus
(
buildMenuList
,
servletRequest
.
getLocale
());
return
new
ResponseEntity
<>(
vos
,
HttpStatus
.
OK
);
}
else
{
String
userId
=
"1"
;
String
userId
=
"1"
;
try
{
try
{
userId
=
SecurityUtils
.
getCurrentUserId
();
userId
=
SecurityUtils
.
getCurrentUserId
();
...
@@ -101,11 +137,12 @@ public class MenuController {
...
@@ -101,11 +137,12 @@ public class MenuController {
log
.
error
(
"获取当前用户出错:"
+
ex
);
log
.
error
(
"获取当前用户出错:"
+
ex
);
}
}
List
<
Menu
>
menuList
=
menuManager
.
findByUserId
(
userId
);
List
<
Menu
>
menuList
=
menuManager
.
findByUserId
(
userId
);
List
<
Menu
>
buildMenuList
=
menuManager
.
buildTree
(
menuList
);
List
<
Menu
>
buildMenuList
=
menuManager
.
buildTree
(
menuList
);
// List<MenuDto> menuDtoList = menuMapper.toDto(menuManager.buildTree(menuList));
// List<MenuDto> menuDtoList = menuMapper.toDto(menuManager.buildTree(menuList));
List
<
MenuVo
>
vos
=
menuManager
.
buildMenus
(
buildMenuList
,
servletRequest
.
getLocale
());
List
<
MenuVo
>
vos
=
menuManager
.
buildMenus
(
buildMenuList
,
servletRequest
.
getLocale
());
return
new
ResponseEntity
<>(
vos
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
vos
,
HttpStatus
.
OK
);
}
}
}
@ApiOperation
(
"导出菜单数据"
)
@ApiOperation
(
"导出菜单数据"
)
@GetMapping
(
value
=
"/download"
)
@GetMapping
(
value
=
"/download"
)
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论