Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
device-new-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
device-new-platform
Commits
8587a650
Commit
8587a650
authored
Jul 12, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加前端页面
parent
7e3317ff
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
50 additions
and
60 deletions
+50
-60
device-manager-ui/admin/src/views/device/drawerview.vue
device-manager-ui/admin/src/views/device/drawerview.vue
+16
-5
device-manager-ui/admin/src/views/device/list.vue
device-manager-ui/admin/src/views/device/list.vue
+1
-1
device-manager/src/main/java/com/mortals/xhx/base/system/message/impl/MessageServiceImpl.java
...tals/xhx/base/system/message/impl/MessageServiceImpl.java
+1
-1
device-manager/src/main/java/com/mortals/xhx/busiz/req/DeviceReq.java
...er/src/main/java/com/mortals/xhx/busiz/req/DeviceReq.java
+6
-1
device-manager/src/main/java/com/mortals/xhx/module/device/service/DeviceService.java
.../com/mortals/xhx/module/device/service/DeviceService.java
+2
-2
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
...als/xhx/module/device/service/impl/DeviceServiceImpl.java
+13
-10
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceController.java
...a/com/mortals/xhx/module/device/web/DeviceController.java
+3
-33
device-manager/src/main/java/com/mortals/xhx/module/platform/service/impl/PlatformServiceImpl.java
...xhx/module/platform/service/impl/PlatformServiceImpl.java
+3
-4
doc/api.md
doc/api.md
+5
-3
No files found.
device-manager-ui/admin/src/views/device/drawerview.vue
View file @
8587a650
...
@@ -22,7 +22,6 @@
...
@@ -22,7 +22,6 @@
style=
"text-align: center; margin-left: -100px; margin-top: 10px"
style=
"text-align: center; margin-left: -100px; margin-top: 10px"
>
>
<el-button
@
click=
"deleteDevice()"
>
删除设备
</el-button>
<el-button
@
click=
"deleteDevice()"
>
删除设备
</el-button>
<el-button
type=
"primary"
@
click=
"updateDevice()"
>
修改信息
</el-button>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</el-drawer>
</el-drawer>
...
@@ -114,10 +113,22 @@ export default {
...
@@ -114,10 +113,22 @@ export default {
this
.
open
=
false
;
this
.
open
=
false
;
},
},
updateDevice
()
{
deleteDevice
()
{
console
.
log
(
"
更新设备信息
"
)
console
.
log
(
"
删除设备信息
"
);
this
.
$get
(
"
/device/delete
"
,
{
id
:
this
.
form
.
id
,
})
.
then
((
res
)
=>
{
if
(
res
.
code
==
1
)
{
this
.
$message
.
success
(
"
删除成功!
"
);
this
.
open
=
false
;
//this.getData();
}
})
.
catch
((
error
)
=>
{
this
.
$message
.
error
(
error
.
message
);
});
},
},
/**获取数据后弹框 */
/**获取数据后弹框 */
...
...
device-manager-ui/admin/src/views/device/list.vue
View file @
8587a650
...
@@ -260,7 +260,7 @@ export default {
...
@@ -260,7 +260,7 @@ export default {
return
(
return
(
<
device
-
switch
<
device
-
switch
confirm
confirm
url
=
"
/device/
sav
e
"
url
=
"
/device/
enabl
e
"
row
=
{
row
}
row
=
{
row
}
onChange
=
{
this
.
statusChange
}
onChange
=
{
this
.
statusChange
}
value
=
{
this
.
tableData
.
data
}
value
=
{
this
.
tableData
.
data
}
...
...
device-manager/src/main/java/com/mortals/xhx/base/system/message/impl/MessageServiceImpl.java
View file @
8587a650
...
@@ -162,7 +162,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -162,7 +162,7 @@ public class MessageServiceImpl implements MessageService {
try
{
try
{
Map
<
String
,
String
>
header
=
new
HashMap
<>();
Map
<
String
,
String
>
header
=
new
HashMap
<>();
header
.
put
(
HEADER_CONTENT_TYPE
,
"application/json"
);
header
.
put
(
HEADER_CONTENT_TYPE
,
"application/json"
);
log
.
info
(
"thirdParty
http
Url:{} req:{}"
,
sendUrl
,
JSON
.
toJSONString
(
deviceReqApiReq
));
log
.
info
(
"thirdPartyUrl:{} req:{}"
,
sendUrl
,
JSON
.
toJSONString
(
deviceReqApiReq
));
resp
=
HttpUtil
.
doPost
(
sendUrl
,
header
,
JSON
.
toJSONString
(
deviceReqApiReq
));
resp
=
HttpUtil
.
doPost
(
sendUrl
,
header
,
JSON
.
toJSONString
(
deviceReqApiReq
));
return
JSON
.
parseObject
(
resp
,
ApiResp
.
class
);
return
JSON
.
parseObject
(
resp
,
ApiResp
.
class
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
device-manager/src/main/java/com/mortals/xhx/busiz/req/DeviceReq.java
View file @
8587a650
...
@@ -122,7 +122,12 @@ public class DeviceReq implements Serializable {
...
@@ -122,7 +122,12 @@ public class DeviceReq implements Serializable {
private
Date
defectsLiabilityPeriod
;
private
Date
defectsLiabilityPeriod
;
/**
/**
* 设备来源(默认为新设备)
* 设备状态 (0.未激活,1.离线,2.在线)
*/
private
Integer
deviceStatus
;
/**
* 设备来源(0.旧设备,1.新设备)
*/
*/
private
Integer
source
;
private
Integer
source
;
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/service/DeviceService.java
View file @
8587a650
...
@@ -37,10 +37,10 @@ public interface DeviceService extends ICRUDCacheService<DeviceEntity,Long>{
...
@@ -37,10 +37,10 @@ public interface DeviceService extends ICRUDCacheService<DeviceEntity,Long>{
/**
/**
* 设备启用停用
* 设备启用停用
* @param
deviceCode
* @param
id
* @param context
* @param context
*/
*/
void
deviceEnabled
(
String
deviceCode
,
Integer
status
,
Context
context
);
void
deviceEnabled
(
Long
id
,
Integer
status
,
Context
context
);
void
sendThirdParty
(
DeviceEntity
entity
,
ProductEntity
productEntity
,
PlatformEntity
platformEntity
,
DeviceMethodEnum
update
);
void
sendThirdParty
(
DeviceEntity
entity
,
ProductEntity
productEntity
,
PlatformEntity
platformEntity
,
DeviceMethodEnum
update
);
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/service/impl/DeviceServiceImpl.java
View file @
8587a650
...
@@ -75,8 +75,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -75,8 +75,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
throw
new
AppException
(
"所属产品不能为空!"
);
throw
new
AppException
(
"所属产品不能为空!"
);
}
}
}
}
super
.
validData
(
entity
,
context
);
super
.
validData
(
entity
,
context
);
}
}
...
@@ -138,13 +136,21 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -138,13 +136,21 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
}
}
@Override
@Override
public
void
deviceEnabled
(
String
deviceCode
,
Integer
enabled
,
Context
context
)
{
public
void
deviceEnabled
(
Long
id
,
Integer
enabled
,
Context
context
)
{
DeviceEntity
deviceEntity
=
this
.
selectOne
(
new
DeviceQuery
().
deviceCode
(
deviceCode
)
);
DeviceEntity
deviceEntity
=
this
.
get
(
id
,
context
);
if
(
!
ObjectUtils
.
isEmpty
(
deviceEntity
))
throw
new
AppException
(
"当前设备不存在!"
);
if
(
ObjectUtils
.
isEmpty
(
deviceEntity
))
throw
new
AppException
(
"当前设备不存在!"
);
deviceEntity
.
setEnabled
(
enabled
);
deviceEntity
.
setEnabled
(
enabled
);
deviceEntity
.
setUpdateTime
(
new
Date
());
deviceEntity
.
setUpdateTime
(
new
Date
());
deviceEntity
.
setUpdateUserId
(
getContextUserId
(
context
));
deviceEntity
.
setUpdateUserId
(
getContextUserId
(
context
));
this
.
update
(
deviceEntity
,
context
);
this
.
update
(
deviceEntity
,
context
);
ProductEntity
productEntity
=
productService
.
get
(
deviceEntity
.
getProductId
());
PlatformEntity
platformEntity
=
platformService
.
get
(
deviceEntity
.
getPlatformId
());
if
(
enabled
==
YesNoEnum
.
YES
.
getValue
())
{
this
.
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
ENABLED
);
}
else
{
this
.
sendThirdParty
(
deviceEntity
,
productEntity
,
platformEntity
,
DeviceMethodEnum
.
STOP
);
}
}
}
...
@@ -208,9 +214,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -208,9 +214,8 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
public
void
sendThirdParty
(
DeviceEntity
entity
,
ProductEntity
productEntity
,
PlatformEntity
platformEntity
,
DeviceMethodEnum
update
)
{
public
void
sendThirdParty
(
DeviceEntity
entity
,
ProductEntity
productEntity
,
PlatformEntity
platformEntity
,
DeviceMethodEnum
update
)
{
DeviceReq
deviceReq
=
new
DeviceReq
();
DeviceReq
deviceReq
=
new
DeviceReq
();
BeanUtils
.
copyProperties
(
entity
,
deviceReq
,
BeanUtil
.
getNullPropertyNames
(
entity
));
BeanUtils
.
copyProperties
(
entity
,
deviceReq
,
BeanUtil
.
getNullPropertyNames
(
entity
));
deviceReq
.
set
ReceiveMethod
(
update
.
getValue
());
deviceReq
.
set
DeviceStatus
(
update
.
getValue
());
deviceReq
.
setProductCode
(
productEntity
.
getProductCode
());
deviceReq
.
setProductCode
(
productEntity
.
getProductCode
());
//deviceReq.setPlatformCode(platformEntity.getPlatformSn());
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
.
getSendUrl
())
if
(!
ObjectUtils
.
isEmpty
(
platformEntity
.
getSendUrl
())
//&& platformEntity.getSendSwitch() == SendSwitchEnum.启用.getValue()
//&& platformEntity.getSendSwitch() == SendSwitchEnum.启用.getValue()
&&
entity
.
getSwitchSend
())
{
&&
entity
.
getSwitchSend
())
{
...
@@ -293,7 +298,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -293,7 +298,7 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
entity
.
setDeviceCode
(
StrUtil
.
replace
(
entity
.
getDeviceCode
(),
":"
,
"-"
));
entity
.
setDeviceCode
(
StrUtil
.
replace
(
entity
.
getDeviceCode
(),
":"
,
"-"
));
if
(
ObjectUtils
.
isEmpty
(
entity
.
getDeviceMac
()))
{
if
(
ObjectUtils
.
isEmpty
(
entity
.
getDeviceMac
()))
{
entity
.
setDeviceMac
(
entity
.
getDeviceCode
());
entity
.
setDeviceMac
(
entity
.
getDeviceCode
());
}
else
{
}
else
{
entity
.
setDeviceMac
(
StrUtil
.
replace
(
entity
.
getDeviceMac
(),
":"
,
"-"
));
entity
.
setDeviceMac
(
StrUtil
.
replace
(
entity
.
getDeviceMac
(),
":"
,
"-"
));
}
}
...
@@ -319,8 +324,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
...
@@ -319,8 +324,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
entity
.
setProductName
(
productEntity
.
getProductName
());
entity
.
setProductName
(
productEntity
.
getProductName
());
}
}
}
}
super
.
saveBefore
(
entity
,
context
);
super
.
saveBefore
(
entity
,
context
);
}
}
...
...
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceController.java
View file @
8587a650
...
@@ -168,18 +168,18 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
...
@@ -168,18 +168,18 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
* 设备启用停用
* 设备启用停用
*/
*/
@PostMapping
(
value
=
"enable"
)
@PostMapping
(
value
=
"enable"
)
public
String
deviceEnable
(
@Request
Param
(
value
=
"deviceCode"
)
String
deviceCode
,
@RequestParam
(
value
=
"status"
)
Integer
status
)
{
public
String
deviceEnable
(
@Request
Body
DeviceEntity
deviceEntity
)
{
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
Map
<
String
,
Object
>
model
=
new
HashMap
<>();
Map
<
String
,
Object
>
model
=
new
HashMap
<>();
String
busiDesc
=
this
.
getModuleDesc
()
+
"设备启用停用"
;
String
busiDesc
=
this
.
getModuleDesc
()
+
"设备启用停用"
;
try
{
try
{
this
.
service
.
active
(
deviceCode
,
getContext
());
this
.
service
.
deviceEnabled
(
deviceEntity
.
getId
(),
deviceEntity
.
getEnabled
()
,
getContext
());
//this.init(request, response, null, model, getContext());
//this.init(request, response, null, model, getContext());
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
jsonObject
.
put
(
KEY_RESULT_DATA
,
model
);
jsonObject
.
put
(
KEY_RESULT_DATA
,
model
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"设备
激活
消息"
,
e
);
log
.
error
(
"设备
启用停用
消息"
,
e
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
super
.
convertException
(
e
));
jsonObject
.
put
(
KEY_RESULT_MSG
,
super
.
convertException
(
e
));
}
}
...
@@ -214,36 +214,6 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
...
@@ -214,36 +214,6 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
""
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
""
);
try
{
try
{
//设备基础统计
/*UserEntity userEntity = userService.get(getContext().getUser().getId());
if(userEntity == null){
throw new AppException("暂未登录!");
}
//登录名
model.put("loginName", userEntity.getRealName());
//最后登陆时间
model.put("LastLoginTime", userEntity.getLastLoginTime());
//供应商数量
model.put("supplierCount", supplierService.count(new SupplierQuery(),getContext()));
//工作人员数量
model.put("workmanCount", workmanService.count(new WorkmanQuery(), getContext()));
//房间数量
model.put("roomCount", roomService.count(new RoomQuery(), getContext()));
//设备数量
model.put("deviceCount", deviceService.count(new DeviceQuery(), getContext()));
//专家数量
model.put("specialistCount", specialistService.count(new SpecialistQuery(), getContext()));
//待办
List<ProjectEntity> list = this.service.pendTask(getContext());
model.put("pendList", list);
//统计信息
ProjectStat projectStat = this.service.projectStat(getContext());
model.put("projectStat", projectStat);
//查询当天项目情况
List<ProjectEntity> dayProjectList = this.service.getProjectByDay(null, getContext());
model.put("dayProjectList", dayProjectList);
this.init(request, response, null, model, getContext());*/
jsonObject
.
put
(
KEY_RESULT_DATA
,
model
);
jsonObject
.
put
(
KEY_RESULT_DATA
,
model
);
recordSysLog
(
request
,
"首页统计 【成功】"
);
recordSysLog
(
request
,
"首页统计 【成功】"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
device-manager/src/main/java/com/mortals/xhx/module/platform/service/impl/PlatformServiceImpl.java
View file @
8587a650
...
@@ -23,11 +23,10 @@ public class PlatformServiceImpl extends AbstractCRUDServiceImpl<PlatformDao, Pl
...
@@ -23,11 +23,10 @@ public class PlatformServiceImpl extends AbstractCRUDServiceImpl<PlatformDao, Pl
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getSendUrl
())){
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getSendUrl
())){
//UrlValidator urlValidator = new UrlValidator();
if
(!
PatternPool
.
URL_HTTP
.
matcher
(
entity
.
getSendUrl
()).
find
())
{
throw
new
AppException
(
"URL不合法"
);
}
}
}
super
.
validData
(
entity
,
context
);
super
.
validData
(
entity
,
context
);
}
}
}
}
\ No newline at end of file
doc/api.md
View file @
8587a650
...
@@ -454,6 +454,8 @@ siteCode|String|站点编号,来源基础服务平台|是|-
...
@@ -454,6 +454,8 @@ siteCode|String|站点编号,来源基础服务平台|是|-
siteName|String|站点名称|是|-
siteName|String|站点名称|是|-
homeUrl|String|首页地址|否|-
homeUrl|String|首页地址|否|-
deviceRemark|String|备注|是|-
deviceRemark|String|备注|是|-
deviceStatus|Integer|设备状态 (0.未激活,1.离线,2.在线)|是|默认0为激活
source|Integer|(0.旧设备,1.新设备)|是|默认1新设备
**请求样例:**
**请求样例:**
```
```
...
@@ -489,7 +491,7 @@ data|object|数据对象|-
...
@@ -489,7 +491,7 @@ data|object|数据对象|-
参数名称|类型|备注|必填|其它
参数名称|类型|备注|必填|其它
:------|:---|:---|:---|:---
:------|:---|:---|:---|:---
deviceCode|String|设备编码,如MAC地址|是|-
deviceCode|String|设备编码,如MAC地址|是|-
messageType|String|消息类型|是|如
heart_beat
messageType|String|消息类型|是|如
HEART_BEAT
timestamp|Long|时间戳|是|-
timestamp|Long|时间戳|是|-
data|String|数据体,内容自行定义|否|-
data|String|数据体,内容自行定义|否|-
...
@@ -500,13 +502,13 @@ data|String|数据体,内容自行定义|否|-
...
@@ -500,13 +502,13 @@ data|String|数据体,内容自行定义|否|-
{
{
"data":"{xxxx}",
"data":"{xxxx}",
"deviceCode":"a1",
"deviceCode":"a1",
"messageType":"
heart_beat
",
"messageType":"
HEART_BEAT
",
"timestamp":1654656951795
"timestamp":1654656951795
},
},
{
{
"data":"{bbbbbb}",
"data":"{bbbbbb}",
"deviceCode":"a2",
"deviceCode":"a2",
"messageType":"
heart_beat
",
"messageType":"
HEART_BEAT
",
"timestamp":1654656951795
"timestamp":1654656951795
}
}
]
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment