Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 6581cb82
由
LN
编写于
2025-03-25 16:58:03 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
对接设备激活后才能打开配置
1 个父辈
da18b7a3
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
61 行增加
和
11 行删除
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipViewController.java
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipmentController.java
src/main/java/com/neotel/smfcore/core/equipment/rest/dto/EquipmentDto.java
src/main/java/com/neotel/smfcore/core/equipment/service/po/Equipment.java
src/main/java/com/neotel/smfcore/core/equipment/util/EquipConfigUtil.java
src/main/java/com/neotel/smfcore/core/equipment/util/bean/EquipConfigInfo.java
src/main/java/com/neotel/smfcore/core/message/util/DeviceMessageUtil.java
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipViewController.java
查看文件 @
6581cb8
...
@@ -60,6 +60,9 @@ public class EquipViewController {
...
@@ -60,6 +60,9 @@ public class EquipViewController {
for
(
Equipment
equip
:
for
(
Equipment
equip
:
allEquipList
.
values
())
{
allEquipList
.
values
())
{
EquipStatusDto
dto
=
new
EquipStatusDto
(
equip
.
getId
(),
equip
.
getName
(),
equip
.
getCid
(),
false
,
0
,
""
,
equip
.
getType
(),
false
);
EquipStatusDto
dto
=
new
EquipStatusDto
(
equip
.
getId
(),
equip
.
getName
(),
equip
.
getCid
(),
false
,
0
,
""
,
equip
.
getType
(),
false
);
if
((!
equip
.
isAPIEquip
())||
(
equip
.
isActivate
())){
dto
.
setActivate
(
true
);
}
EquipStatusBean
bean
=
EquipStatusUtil
.
getStatusBean
(
equip
.
getCid
());
EquipStatusBean
bean
=
EquipStatusUtil
.
getStatusBean
(
equip
.
getCid
());
if
(
bean
!=
null
){
if
(
bean
!=
null
){
if
(
bean
.
timeOut
()){
if
(
bean
.
timeOut
()){
...
...
src/main/java/com/neotel/smfcore/core/equipment/rest/EquipmentController.java
查看文件 @
6581cb8
package
com
.
neotel
.
smfcore
.
core
.
equipment
.
rest
;
package
com
.
neotel
.
smfcore
.
core
.
equipment
.
rest
;
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.exception.ValidateException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.QueryHelp
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
...
@@ -22,6 +23,7 @@ import lombok.RequiredArgsConstructor;
...
@@ -22,6 +23,7 @@ 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.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
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -83,9 +85,9 @@ public class EquipmentController {
...
@@ -83,9 +85,9 @@ public class EquipmentController {
}
}
}
}
if
(
equipment
.
isAPIEquip
()){
if
(
equipment
.
isAPIEquip
()){
equipment
.
setActivate
d
(
false
);
equipment
.
setActivate
(
false
);
}
else
{
}
else
{
equipment
.
setActivate
d
(
true
);
equipment
.
setActivate
(
true
);
}
}
equipment
=
equipmentManager
.
save
(
equipment
);
equipment
=
equipmentManager
.
save
(
equipment
);
equipmentCache
.
reloadEquipment
(
equipment
,
equipment
.
getCid
());
equipmentCache
.
reloadEquipment
(
equipment
,
equipment
.
getCid
());
...
@@ -158,4 +160,48 @@ public class EquipmentController {
...
@@ -158,4 +160,48 @@ public class EquipmentController {
return
allList
;
return
allList
;
}
}
@RequestMapping
(
value
=
"/activation"
)
@AnonymousAccess
public
ResultBean
activation
(
@RequestParam
String
cid
)
{
Criteria
c
=
Criteria
.
where
(
"cid"
).
is
(
cid
);
List
<
Equipment
>
equipmentList
=
equipmentManager
.
findByQuery
(
new
Query
(
c
));
if
(
equipmentList
==
null
||
equipmentList
.
size
()
<
0
)
{
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.msg.noCid"
,
"操作失败,未找到CID"
);
}
Equipment
equipment
=
equipmentList
.
get
(
0
);
if
(
equipment
.
isActivate
())
{
return
ResultBean
.
newOkResult
(
"OK"
);
}
equipment
.
setActivate
(
true
);
equipmentManager
.
save
(
equipment
);
equipmentCache
.
reloadEquipment
(
equipment
,
equipment
.
getCid
());
log
.
info
(
"设备cid="
+
cid
+
", equipType="
+
equipment
.
getType
()
+
" setActivate(true)成功"
);
return
ResultBean
.
newOkResult
(
"OK"
);
}
@RequestMapping
(
value
=
"/deactivation"
)
@AnonymousAccess
public
ResultBean
deactivation
(
@RequestParam
String
cid
)
{
Criteria
c
=
Criteria
.
where
(
"cid"
).
is
(
cid
);
List
<
Equipment
>
equipmentList
=
equipmentManager
.
findByQuery
(
new
Query
(
c
));
if
(
equipmentList
==
null
||
equipmentList
.
size
()
<
0
)
{
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.msg.noCid"
,
"操作失败,未找到CID"
);
}
Equipment
equipment
=
equipmentList
.
get
(
0
);
if
(!
equipment
.
isAPIEquip
()){
return
ResultBean
.
newErrorResult
(
1
,
"smfcore.operationFailure"
,
"操作失败"
);
}
if
(!
equipment
.
isActivate
())
{
return
ResultBean
.
newOkResult
(
"OK"
);
}
equipment
.
setActivate
(
false
);
equipmentManager
.
save
(
equipment
);
equipmentCache
.
reloadEquipment
(
equipment
,
equipment
.
getCid
());
log
.
info
(
"设备cid="
+
cid
+
", equipType="
+
equipment
.
getType
()
+
" setActivate(false)成功"
);
return
ResultBean
.
newOkResult
(
"OK"
);
}
}
}
src/main/java/com/neotel/smfcore/core/equipment/rest/dto/EquipmentDto.java
查看文件 @
6581cb8
...
@@ -21,7 +21,7 @@ public class EquipmentDto {
...
@@ -21,7 +21,7 @@ public class EquipmentDto {
@ApiModelProperty
(
"是否可用"
)
@ApiModelProperty
(
"是否可用"
)
private
boolean
available
=
true
;
private
boolean
available
=
true
;
@ApiModelProperty
(
"是否激活"
)
@ApiModelProperty
(
"是否激活"
)
private
boolean
activate
d
=
true
;
private
boolean
activate
=
true
;
private
String
id
;
private
String
id
;
}
}
src/main/java/com/neotel/smfcore/core/equipment/service/po/Equipment.java
查看文件 @
6581cb8
...
@@ -30,7 +30,7 @@ public class Equipment extends BasePo implements Serializable {
...
@@ -30,7 +30,7 @@ public class Equipment extends BasePo implements Serializable {
/**
/**
* 是否激活
* 是否激活
*/
*/
private
boolean
activate
d
=
true
;
private
boolean
activate
=
true
;
public
boolean
isNEOSCAN
()
{
public
boolean
isNEOSCAN
()
{
return
EquipmentType
.
NEOSCAN
.
name
().
equals
(
type
)||
EquipmentType
.
NS200
.
name
().
equals
(
type
);
return
EquipmentType
.
NEOSCAN
.
name
().
equals
(
type
)||
EquipmentType
.
NS200
.
name
().
equals
(
type
);
...
@@ -42,6 +42,7 @@ public class Equipment extends BasePo implements Serializable {
...
@@ -42,6 +42,7 @@ public class Equipment extends BasePo implements Serializable {
* @return
* @return
*/
*/
public
boolean
isAPIEquip
()
{
public
boolean
isAPIEquip
()
{
return
EquipmentType
.
HANWHA
.
name
().
equals
(
type
)||
EquipmentType
.
PANACIMNEOLINK
.
name
().
equals
(
type
);
return
EquipmentType
.
HANWHA
.
name
().
equals
(
type
)||
EquipmentType
.
PANACIMNEOLINK
.
name
().
equals
(
type
)||
EquipmentType
.
FUJINEOLINK
.
name
().
equals
(
type
)||
EquipmentType
.
NEXIM
.
name
().
equals
(
type
);
}
}
}
}
src/main/java/com/neotel/smfcore/core/equipment/util/EquipConfigUtil.java
查看文件 @
6581cb8
...
@@ -8,8 +8,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -8,8 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
@Slf4j
@Slf4j
@Service
@Service
...
@@ -44,7 +43,7 @@ public class EquipConfigUtil {
...
@@ -44,7 +43,7 @@ public class EquipConfigUtil {
configInfo
.
setEquipType
(
equipType
);
configInfo
.
setEquipType
(
equipType
);
configInfo
.
setEnableApi
(
false
);
configInfo
.
setEnableApi
(
false
);
if
(
equipType
.
equals
(
EquipmentType
.
HANWHA
.
name
())){
if
(
equipType
.
equals
(
EquipmentType
.
HANWHA
.
name
())){
Map
<
String
,
Object
>
defMap
=
new
HashMap
<>();
LinkedHashMap
<
String
,
Object
>
defMap
=
new
Linked
HashMap
<>();
defMap
.
put
(
"host"
,
""
);
defMap
.
put
(
"host"
,
""
);
defMap
.
put
(
"webPort"
,
1337
);
defMap
.
put
(
"webPort"
,
1337
);
defMap
.
put
(
"apiPort"
,
8082
);
defMap
.
put
(
"apiPort"
,
8082
);
...
...
src/main/java/com/neotel/smfcore/core/equipment/util/bean/EquipConfigInfo.java
查看文件 @
6581cb8
...
@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.equipment.util.bean;
...
@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.equipment.util.bean;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.Map
;
@Data
@Data
...
@@ -19,7 +20,7 @@ public class EquipConfigInfo {
...
@@ -19,7 +20,7 @@ public class EquipConfigInfo {
/**
/**
* 配置列表
* 配置列表
*/
*/
public
Map
<
String
,
Object
>
apiConfigMap
;
public
LinkedHash
Map
<
String
,
Object
>
apiConfigMap
;
//韩华配置key: host ,webPort, apiPort,singleOrder
//韩华配置key: host ,webPort, apiPort,singleOrder
...
...
src/main/java/com/neotel/smfcore/core/message/util/DeviceMessageUtil.java
查看文件 @
6581cb8
...
@@ -97,7 +97,7 @@ public class DeviceMessageUtil {
...
@@ -97,7 +97,7 @@ public class DeviceMessageUtil {
if
(
result
){
if
(
result
){
messageManager
.
save
(
message
);
messageManager
.
save
(
message
);
}
}
messageManager
.
save
(
message
);
//
messageManager.save(message);
}
}
}
}
public
static
void
addDeviceMessage
(
String
cid
,
String
msgType
,
String
moudle
,
String
msgCode
,
String
msg
,
String
[]
msgParam
,
String
almType
,
String
almCode
)
{
public
static
void
addDeviceMessage
(
String
cid
,
String
msgType
,
String
moudle
,
String
msgCode
,
String
msg
,
String
[]
msgParam
,
String
almType
,
String
almCode
)
{
...
@@ -114,7 +114,7 @@ public class DeviceMessageUtil {
...
@@ -114,7 +114,7 @@ public class DeviceMessageUtil {
if
(
result
){
if
(
result
){
messageManager
.
save
(
message
);
messageManager
.
save
(
message
);
}
}
messageManager
.
save
(
message
);
//
messageManager.save(message);
}
}
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论