Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit a90f22ac
由
zshaohui
编写于
2025-04-27 10:05:54 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.日志监控 功能提交
1 个父辈
229df88d
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
84 行增加
和
7 行删除
src/main/java/com/neotel/smfcore/common/exception/handler/GlobalExceptionHandler.java
src/main/java/com/neotel/smfcore/common/init/DataInitManager.java
src/main/java/com/neotel/smfcore/core/message/enums/MessageType.java
src/main/java/com/neotel/smfcore/core/message/rest/MessageController.java
src/main/java/com/neotel/smfcore/core/message/rest/bean/query/MessageCriteria.java
src/main/java/com/neotel/smfcore/core/system/util/DevicesStatusUtil.java
src/main/resources/messages.properties
src/main/resources/messages_en_US.properties
src/main/resources/messages_ja_JP.properties
src/main/resources/messages_zh_CN.properties
src/main/resources/messages_zh_TW.properties
src/main/java/com/neotel/smfcore/common/exception/handler/GlobalExceptionHandler.java
查看文件 @
a90f22a
...
@@ -95,7 +95,7 @@ public class GlobalExceptionHandler {
...
@@ -95,7 +95,7 @@ public class GlobalExceptionHandler {
String
targetMsg
=
messageUtils
.
getText
(
e
.
getMsgKey
(),
e
.
getMsgParam
(),
servlet
.
getLocale
()
,
e
.
getDefaultMsg
());
String
targetMsg
=
messageUtils
.
getText
(
e
.
getMsgKey
(),
e
.
getMsgParam
(),
servlet
.
getLocale
()
,
e
.
getDefaultMsg
());
e
.
getMessage
();
e
.
getMessage
();
Message
message
=
new
Message
();
Message
message
=
new
Message
();
message
.
setType
(
MessageType
.
ERROR
.
name
());
message
.
setType
(
MessageType
.
WARNING
.
name
());
message
.
setDeviceName
(
"server"
);
message
.
setDeviceName
(
"server"
);
message
.
setMsgCode
(
e
.
getMsgKey
());
message
.
setMsgCode
(
e
.
getMsgKey
());
message
.
setMsgParams
(
e
.
getMsgParam
());
message
.
setMsgParams
(
e
.
getMsgParam
());
...
...
src/main/java/com/neotel/smfcore/common/init/DataInitManager.java
查看文件 @
a90f22a
...
@@ -207,7 +207,8 @@ public class DataInitManager {
...
@@ -207,7 +207,8 @@ public class DataInitManager {
Menu
pMenuLog
=
Menu
.
CreatePMenu
(
"日志管理"
,
6
,
"log"
,
2
,
"log"
,
null
);
Menu
pMenuLog
=
Menu
.
CreatePMenu
(
"日志管理"
,
6
,
"log"
,
2
,
"log"
,
null
);
addNewFunctionMenu
(
61
,
pMenuLog
,
"taskLog"
,
"物料日志"
,
"taskLog"
,
"neolight/taskLog/index"
,
"education"
,
functionMenuMap
);
addNewFunctionMenu
(
61
,
pMenuLog
,
"taskLog"
,
"物料日志"
,
"taskLog"
,
"neolight/taskLog/index"
,
"education"
,
functionMenuMap
);
addNewFunctionMenu
(
62
,
pMenuLog
,
"message"
,
"消息查询"
,
"message"
,
"neolight/message/index"
,
"messagefind"
,
functionMenuMap
);
addNewFunctionMenu
(
62
,
pMenuLog
,
"message"
,
"消息查询"
,
"message"
,
"neolight/message/index"
,
"messagefind"
,
functionMenuMap
);
addNewFunctionMenu
(
63
,
pMenuLog
,
"interfaceException"
,
"接口异常"
,
"interfaceException"
,
"neolight/interfaceException/index"
,
"messagefind"
,
functionMenuMap
);
addNewFunctionMenu
(
63
,
pMenuLog
,
"interfaceException"
,
"接口异常"
,
"interfaceException"
,
"neolight/interfaceException/index"
,
"messagefind"
,
functionMenuMap
);
addNewFunctionMenu
(
64
,
pMenuLog
,
"logMonitor"
,
"日志监控"
,
"logMonitor"
,
"neolight/logMonitor/index"
,
"messagefind"
,
functionMenuMap
);
//报表:出入库、库存
//报表:出入库、库存
Menu
pMenuReport
=
Menu
.
CreatePMenu
(
"报表"
,
7
,
"report"
,
2
,
"inOutData"
,
null
);
Menu
pMenuReport
=
Menu
.
CreatePMenu
(
"报表"
,
7
,
"report"
,
2
,
"inOutData"
,
null
);
...
...
src/main/java/com/neotel/smfcore/core/message/enums/MessageType.java
查看文件 @
a90f22a
...
@@ -21,4 +21,9 @@ public enum MessageType {
...
@@ -21,4 +21,9 @@ public enum MessageType {
* 3 设备操作数据
* 3 设备操作数据
*/
*/
DATA
,
DATA
,
/**
* 4 需要人员立即操作的
*/
CRITICAL
}
}
src/main/java/com/neotel/smfcore/core/message/rest/MessageController.java
查看文件 @
a90f22a
package
com
.
neotel
.
smfcore
.
core
.
message
.
rest
;
package
com
.
neotel
.
smfcore
.
core
.
message
.
rest
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.google.common.collect.Maps
;
import
com.neotel.smfcore.common.bean.BetweenData
;
import
com.neotel.smfcore.common.bean.PageData
;
import
com.neotel.smfcore.common.bean.PageData
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.language.util.MessageUtils
;
import
com.neotel.smfcore.core.message.rest.bean.dto.MessageDto
;
import
com.neotel.smfcore.core.message.rest.bean.dto.MessageDto
;
...
@@ -9,12 +13,14 @@ import com.neotel.smfcore.core.message.rest.bean.mapstruct.MessageMapper;
...
@@ -9,12 +13,14 @@ import com.neotel.smfcore.core.message.rest.bean.mapstruct.MessageMapper;
import
com.neotel.smfcore.core.message.rest.bean.query.MessageCriteria
;
import
com.neotel.smfcore.core.message.rest.bean.query.MessageCriteria
;
import
com.neotel.smfcore.core.message.service.manager.IMessageManager
;
import
com.neotel.smfcore.core.message.service.manager.IMessageManager
;
import
com.neotel.smfcore.core.message.service.po.Message
;
import
com.neotel.smfcore.core.message.service.po.Message
;
import
com.neotel.smfcore.security.annotation.AnonymousAccess
;
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
;
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.data.domain.Pageable
;
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.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
...
@@ -24,7 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -24,7 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.
List
;
import
java.util.
*
;
@Slf4j
@Slf4j
@RestController
@RestController
...
@@ -71,4 +77,56 @@ public class MessageController {
...
@@ -71,4 +77,56 @@ public class MessageController {
List
<
String
>
typeList
=
messageManager
.
findDeviceNameList
();
List
<
String
>
typeList
=
messageManager
.
findDeviceNameList
();
return
typeList
;
return
typeList
;
}
}
@ApiOperation
(
"根据type汇总总数量"
)
@GetMapping
(
"/typeTotalByDate"
)
@AnonymousAccess
public
ResultBean
typeTotalByDate
(
MessageCriteria
criteria
,
HttpServletRequest
request
)
{
//默认取7天的,如果客户端传的有,就用客户端的
Date
endDate
=
new
Date
();
Date
startDate
=
DateUtil
.
offsetDay
(
endDate
,
-
7
);
BetweenData
<
Date
>
updateDate
=
criteria
.
getUpdateDate
();
if
(
updateDate
!=
null
&&
!
updateDate
.
isEmpty
())
{
Date
from
=
updateDate
.
getFrom
();
Date
to
=
updateDate
.
getTo
();
if
(
from
!=
null
)
{
startDate
=
from
;
}
if
(
to
!=
null
)
{
endDate
=
to
;
}
}
Query
q
=
new
Query
();
Criteria
c
=
Criteria
.
where
(
"msg"
).
exists
(
true
).
ne
(
""
).
and
(
"updateDate"
).
gte
(
startDate
).
lt
(
endDate
);
q
.
addCriteria
(
c
);
q
.
with
(
Sort
.
by
(
Sort
.
Direction
.
DESC
,
"createDate"
));
//q.fields().include("type,");
List
<
Message
>
messageList
=
messageManager
.
findByQuery
(
q
);
Map
<
String
,
List
<
Message
>>
resultMap
=
Maps
.
newConcurrentMap
();
resultMap
.
put
(
"INFO"
,
new
ArrayList
<>());
resultMap
.
put
(
"WARNING"
,
new
ArrayList
<>());
resultMap
.
put
(
"ERROR"
,
new
ArrayList
<>());
resultMap
.
put
(
"CRITICAL"
,
new
ArrayList
<>());
if
(
messageList
!=
null
&&
!
messageList
.
isEmpty
())
{
for
(
Message
message
:
messageList
)
{
String
type
=
message
.
getType
();
if
(
ObjectUtil
.
isNotEmpty
(
message
.
getMsgCode
()))
{
message
.
setMsg
(
MessageUtils
.
getText
(
message
.
getMsgCode
(),
message
.
getMsgParams
(),
request
.
getLocale
(),
message
.
getMsg
()));
}
List
<
Message
>
list
=
resultMap
.
get
(
type
);
if
(
list
==
null
)
{
list
=
new
ArrayList
<>();
}
list
.
add
(
message
);
resultMap
.
put
(
type
,
list
);
}
}
return
ResultBean
.
newOkResult
(
resultMap
);
}
}
}
src/main/java/com/neotel/smfcore/core/message/rest/bean/query/MessageCriteria.java
查看文件 @
a90f22a
...
@@ -2,11 +2,13 @@ package com.neotel.smfcore.core.message.rest.bean.query;
...
@@ -2,11 +2,13 @@ package com.neotel.smfcore.core.message.rest.bean.query;
import
com.neotel.smfcore.common.annotation.QueryCondition
;
import
com.neotel.smfcore.common.annotation.QueryCondition
;
import
com.neotel.smfcore.common.bean.BetweenData
;
import
com.neotel.smfcore.common.bean.BetweenData
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
@Data
@Data
public
class
MessageCriteria
{
public
class
MessageCriteria
{
...
@@ -14,7 +16,7 @@ public class MessageCriteria {
...
@@ -14,7 +16,7 @@ public class MessageCriteria {
private
String
blurry
;
private
String
blurry
;
@QueryCondition
(
type
=
QueryCondition
.
Type
.
BETWEEN
,
propName
=
"updateDate"
)
@QueryCondition
(
type
=
QueryCondition
.
Type
.
BETWEEN
,
propName
=
"updateDate"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd
HH:mm:ss
"
)
private
BetweenData
<
Date
>
updateDate
;
private
BetweenData
<
Date
>
updateDate
;
...
@@ -33,4 +35,8 @@ public class MessageCriteria {
...
@@ -33,4 +35,8 @@ public class MessageCriteria {
@QueryCondition
@QueryCondition
@ApiModelProperty
(
"类型"
)
@ApiModelProperty
(
"类型"
)
private
String
type
;
private
String
type
;
@QueryCondition
(
type
=
QueryCondition
.
Type
.
IN
,
propName
=
"type"
)
@ApiModelProperty
(
"多个类型"
)
private
List
<
String
>
typeList
;
}
}
src/main/java/com/neotel/smfcore/core/system/util/DevicesStatusUtil.java
查看文件 @
a90f22a
...
@@ -89,6 +89,7 @@ public class DevicesStatusUtil {
...
@@ -89,6 +89,7 @@ public class DevicesStatusUtil {
if
(
msgArray
!=
null
&&
msgArray
.
length
>
0
)
{
if
(
msgArray
!=
null
&&
msgArray
.
length
>
0
)
{
for
(
String
msg
:
for
(
String
msg
:
msgArray
)
{
msgArray
)
{
msg
=
msg
.
trim
();
String
msgType
=
MessageType
.
ERROR
.
name
();
String
msgType
=
MessageType
.
ERROR
.
name
();
if
(
msg
.
startsWith
(
"A="
))
{
if
(
msg
.
startsWith
(
"A="
))
{
msgType
=
MessageType
.
ERROR
.
name
();
msgType
=
MessageType
.
ERROR
.
name
();
...
@@ -99,6 +100,9 @@ public class DevicesStatusUtil {
...
@@ -99,6 +100,9 @@ public class DevicesStatusUtil {
}
else
if
(
msg
.
startsWith
(
"W="
))
{
}
else
if
(
msg
.
startsWith
(
"W="
))
{
msgType
=
MessageType
.
WARNING
.
name
();
msgType
=
MessageType
.
WARNING
.
name
();
msg
=
msg
.
substring
(
2
);
msg
=
msg
.
substring
(
2
);
}
else
if
(
msg
.
startsWith
(
"C="
)){
msgType
=
MessageType
.
CRITICAL
.
name
();
msg
=
msg
.
substring
(
2
);
}
}
DeviceMessageUtil
.
addDeviceMessage
(
cid
,
msgType
,
""
,
msgCode
,
msg
,
msgParam
);
DeviceMessageUtil
.
addDeviceMessage
(
cid
,
msgType
,
""
,
msgCode
,
msg
,
msgParam
);
}
}
...
...
src/main/resources/messages.properties
查看文件 @
a90f22a
...
@@ -271,4 +271,5 @@ smfcore.error.storage.outNotEnd=\u6599\u4ED3{0}\u6709\u51FA\u5E93\u4EFB\u52A1\u6
...
@@ -271,4 +271,5 @@ smfcore.error.storage.outNotEnd=\u6599\u4ED3{0}\u6709\u51FA\u5E93\u4EFB\u52A1\u6
#smfclient.loadMaterialFinished=loading material is finished: {0}
#smfclient.loadMaterialFinished=loading material is finished: {0}
#smfclient.loadMaterialFailed=loading material failed:{0}
#smfclient.loadMaterialFailed=loading material failed:{0}
#smfclient.checkingMaterialOk=checking material is ok:{0}
#smfclient.checkingMaterialOk=checking material is ok:{0}
#
smfclient.checkNg
=
checking material is ng:{0}
\ No newline at end of file
\ No newline at end of file
#smfclient.checkNg=checking material is ng:{0}
smfcore.logMonitor
=
\u
65E5
\u
5FD7
\u
76D1
\u
63A7
\ No newline at end of file
\ No newline at end of file
src/main/resources/messages_en_US.properties
查看文件 @
a90f22a
...
@@ -256,4 +256,4 @@ smfcore.equipmentView=Equipment connected
...
@@ -256,4 +256,4 @@ smfcore.equipmentView=Equipment connected
smfcore.greaterThanZero
=
Amount Must be greater than 0
smfcore.greaterThanZero
=
Amount Must be greater than 0
smfcore.error.virtualOut.num
=
The number cannot exceed {0}
smfcore.error.virtualOut.num
=
The number cannot exceed {0}
smfcore.error.virtualOut.noItem
=
The corresponding material is not found in work order {0}
smfcore.error.virtualOut.noItem
=
The corresponding material is not found in work order {0}
smfcore.logMonitor
=
Log Monitoring
src/main/resources/messages_ja_JP.properties
查看文件 @
a90f22a
...
@@ -255,4 +255,4 @@ smfcore.equipmentView=\u8BBE\u5907\u4E92\u8054
...
@@ -255,4 +255,4 @@ smfcore.equipmentView=\u8BBE\u5907\u4E92\u8054
smfcore.greaterThanZero
=
\u6570\u
91CF
\u
5FC5
\u
987B
\u5927\u
4E8E0
smfcore.greaterThanZero
=
\u6570\u
91CF
\u
5FC5
\u
987B
\u5927\u
4E8E0
smfcore.error.virtualOut.num
=
\u6570\u
91CF
\u
4E0D
\u
80FD
\u
8D85
\u
8FC7{0}
smfcore.error.virtualOut.num
=
\u6570\u
91CF
\u
4E0D
\u
80FD
\u
8D85
\u
8FC7{0}
smfcore.error.virtualOut.noItem
=
\u
5DE5
\u5355
{0}
\u
4E2D
\u
672A
\u
627E
\u5230\u
5BF9
\u
5E94
\u7684
PN
\u6216\u7269\u6599\u
7F16
\u
53F7
smfcore.error.virtualOut.noItem
=
\u
5DE5
\u5355
{0}
\u
4E2D
\u
672A
\u
627E
\u5230\u
5BF9
\u
5E94
\u7684
PN
\u6216\u7269\u6599\u
7F16
\u
53F7
smfcore.logMonitor
=
\u
30ED
\u
30B0
\u
76E3
\u8996
src/main/resources/messages_zh_CN.properties
查看文件 @
a90f22a
...
@@ -255,3 +255,4 @@ smfcore.equipmentView=\u8BBE\u5907\u4E92\u8054
...
@@ -255,3 +255,4 @@ smfcore.equipmentView=\u8BBE\u5907\u4E92\u8054
smfcore.greaterThanZero
=
\u6570\u
91CF
\u
5FC5
\u
987B
\u5927\u
4E8E0
smfcore.greaterThanZero
=
\u6570\u
91CF
\u
5FC5
\u
987B
\u5927\u
4E8E0
smfcore.error.virtualOut.num
=
\u6570\u
91CF
\u
4E0D
\u
80FD
\u
8D85
\u
8FC7{0}
smfcore.error.virtualOut.num
=
\u6570\u
91CF
\u
4E0D
\u
80FD
\u
8D85
\u
8FC7{0}
smfcore.error.virtualOut.noItem
=
\u
5DE5
\u5355
{0}
\u
4E2D
\u
672A
\u
627E
\u5230\u
5BF9
\u
5E94
\u7684
PN
\u6216\u7269\u6599\u
7F16
\u
53F7
smfcore.error.virtualOut.noItem
=
\u
5DE5
\u5355
{0}
\u
4E2D
\u
672A
\u
627E
\u5230\u
5BF9
\u
5E94
\u7684
PN
\u6216\u7269\u6599\u
7F16
\u
53F7
smfcore.logMonitor
=
\u
65E5
\u
5FD7
\u
76D1
\u
63A7
\ No newline at end of file
\ No newline at end of file
src/main/resources/messages_zh_TW.properties
查看文件 @
a90f22a
...
@@ -255,3 +255,4 @@ smfcore.equipmentView=\u8A2D\u5099\u4E92\u806F
...
@@ -255,3 +255,4 @@ smfcore.equipmentView=\u8A2D\u5099\u4E92\u806F
smfcore.greaterThanZero
=
\u6578\u
91CF
\u
5FC5
\u9808\u5927\u
65BC0
smfcore.greaterThanZero
=
\u6578\u
91CF
\u
5FC5
\u9808\u5927\u
65BC0
smfcore.error.virtualOut.num
=
\u6578\u
91CF
\u
4E0D
\u
80FD
\u
8D85
\u
904E{0}
smfcore.error.virtualOut.num
=
\u6578\u
91CF
\u
4E0D
\u
80FD
\u
8D85
\u
904E{0}
smfcore.error.virtualOut.noItem
=
\u
5DE5
\u
55AE{0}
\u
4E2D
\u
672A
\u
627E
\u5230\u
5C0D
\u
61C9
\u7684
PN
\u7269\u6599\u
7DE8
\u
865F
smfcore.error.virtualOut.noItem
=
\u
5DE5
\u
55AE{0}
\u
4E2D
\u
672A
\u
627E
\u5230\u
5C0D
\u
61C9
\u7684
PN
\u7269\u6599\u
7DE8
\u
865F
smfcore.logMonitor
=
\u
65E5
\u
8A8C
\u
76E3
\u
63A7
\ No newline at end of file
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论