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
e7687d8f
Commit
e7687d8f
authored
Jul 15, 2022
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加启动日志
parent
9145a8e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
device-manager/src/main/java/com/mortals/xhx/base/system/message/impl/MessageServiceImpl.java
...tals/xhx/base/system/message/impl/MessageServiceImpl.java
+2
-1
device-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceController.java
...a/com/mortals/xhx/module/device/web/DeviceController.java
+8
-6
No files found.
device-manager/src/main/java/com/mortals/xhx/base/system/message/impl/MessageServiceImpl.java
View file @
e7687d8f
...
@@ -16,6 +16,7 @@ import com.mortals.xhx.busiz.req.ApiThirdPartyReq;
...
@@ -16,6 +16,7 @@ import com.mortals.xhx.busiz.req.ApiThirdPartyReq;
import
com.mortals.xhx.busiz.req.DeviceReq
;
import
com.mortals.xhx.busiz.req.DeviceReq
;
import
com.mortals.xhx.busiz.rsp.ApiResp
;
import
com.mortals.xhx.busiz.rsp.ApiResp
;
import
com.mortals.xhx.common.code.ApiRespCodeEnum
;
import
com.mortals.xhx.common.code.ApiRespCodeEnum
;
import
com.mortals.xhx.common.code.DeviceMethodEnum
;
import
com.mortals.xhx.common.code.MessageTypeEnum
;
import
com.mortals.xhx.common.code.MessageTypeEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
com.mortals.xhx.common.key.Constant
;
import
com.mortals.xhx.common.key.Constant
;
...
@@ -162,7 +163,7 @@ public class MessageServiceImpl implements MessageService {
...
@@ -162,7 +163,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
(
"thirdPartyUrl
:{} req:{}"
,
sendUrl
,
JSON
.
toJSONString
(
deviceReqApiReq
));
log
.
info
(
"thirdPartyUrl
=>{}\n reqbody=>{} \n type=>{}"
,
sendUrl
,
JSON
.
toJSONString
(
deviceReqApiReq
),
DeviceMethodEnum
.
getByValue
(
deviceReq
.
getDeviceStatus
()).
getDesc
(
));
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/module/device/web/DeviceController.java
View file @
e7687d8f
...
@@ -35,6 +35,7 @@ import com.mortals.xhx.module.product.model.ProductEntity;
...
@@ -35,6 +35,7 @@ import com.mortals.xhx.module.product.model.ProductEntity;
import
com.mortals.xhx.module.product.service.ProductService
;
import
com.mortals.xhx.module.product.service.ProductService
;
import
com.mortals.xhx.queue.TbQueueMsgHeaders
;
import
com.mortals.xhx.queue.TbQueueMsgHeaders
;
import
com.mortals.xhx.queue.TopicPartitionInfo
;
import
com.mortals.xhx.queue.TopicPartitionInfo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -54,6 +55,7 @@ import java.util.stream.Stream;
...
@@ -54,6 +55,7 @@ import java.util.stream.Stream;
*/
*/
@RestController
@RestController
@RequestMapping
(
"device"
)
@RequestMapping
(
"device"
)
@Slf4j
public
class
DeviceController
extends
BaseCRUDJsonBodyMappingController
<
DeviceService
,
DeviceEntity
,
Long
>
{
public
class
DeviceController
extends
BaseCRUDJsonBodyMappingController
<
DeviceService
,
DeviceEntity
,
Long
>
{
@Autowired
@Autowired
...
@@ -92,7 +94,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
...
@@ -92,7 +94,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
@Override
@Override
protected
void
doListBefore
(
DeviceEntity
query
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
protected
void
doListBefore
(
DeviceEntity
query
,
Map
<
String
,
Object
>
model
,
Context
context
)
throws
AppException
{
List
<
OrderCol
>
orderColList
=
new
ArrayList
<>();
List
<
OrderCol
>
orderColList
=
new
ArrayList
<>();
orderColList
.
add
(
new
OrderCol
(
"createTime"
,
OrderCol
.
DESCENDING
));
orderColList
.
add
(
new
OrderCol
(
"createTime"
,
OrderCol
.
DESCENDING
));
query
.
setOrderColList
(
orderColList
);
query
.
setOrderColList
(
orderColList
);
super
.
doListBefore
(
query
,
model
,
context
);
super
.
doListBefore
(
query
,
model
,
context
);
}
}
...
@@ -156,11 +158,11 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
...
@@ -156,11 +158,11 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
*/
*/
@PostMapping
(
value
=
"active"
)
@PostMapping
(
value
=
"active"
)
public
Rest
<
Void
>
deviceActive
(
@RequestBody
DeviceEntity
deviceEntity
)
{
public
Rest
<
Void
>
deviceActive
(
@RequestBody
DeviceEntity
deviceEntity
)
{
log
.
info
(
"设备激活:{}"
,
deviceEntity
.
getDeviceCode
());
String
busiDesc
=
this
.
getModuleDesc
()
+
"设备激活"
;
String
busiDesc
=
this
.
getModuleDesc
()
+
"设备激活"
;
Rest
<
Void
>
rest
=
Rest
.
ok
(
busiDesc
+
" 【成功】"
);
Rest
<
Void
>
rest
=
Rest
.
ok
(
busiDesc
+
" 【成功】"
);
try
{
try
{
this
.
service
.
active
(
deviceEntity
.
getDeviceCode
(),
getContext
());
this
.
service
.
active
(
deviceEntity
.
getDeviceCode
(),
getContext
());
;
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"设备激活消息"
,
e
);
log
.
error
(
"设备激活消息"
,
e
);
...
@@ -178,7 +180,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
...
@@ -178,7 +180,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
Map
<
String
,
Object
>
model
=
new
HashMap
<>();
Map
<
String
,
Object
>
model
=
new
HashMap
<>();
String
busiDesc
=
this
.
getModuleDesc
()
+
"设备启用停用"
;
String
busiDesc
=
this
.
getModuleDesc
()
+
"设备启用停用"
;
try
{
try
{
this
.
service
.
deviceEnabled
(
deviceEntity
.
getId
(),
deviceEntity
.
getEnabled
(),
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
);
...
@@ -220,7 +222,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
...
@@ -220,7 +222,7 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
jsonObject
.
put
(
KEY_RESULT_MSG
,
""
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
""
);
try
{
try
{
jsonObject
.
put
(
KEY_RESULT_DATA
,
model
);
jsonObject
.
put
(
KEY_RESULT_DATA
,
model
);
recordSysLog
(
request
,
"首页统计 【成功】"
);
recordSysLog
(
request
,
"首页统计 【成功】"
);
}
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
);
...
@@ -233,8 +235,8 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
...
@@ -233,8 +235,8 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
@Override
@Override
public
void
doImportDataBefore
(
List
<
DeviceEntity
>
list
,
boolean
updateSupport
,
Context
context
)
throws
AppException
{
public
void
doImportDataBefore
(
List
<
DeviceEntity
>
list
,
boolean
updateSupport
,
Context
context
)
throws
AppException
{
String
siteId
=
request
.
getParameter
(
"siteId"
);
String
siteId
=
request
.
getParameter
(
"siteId"
);
if
(!
ObjectUtils
.
isEmpty
(
siteId
))
{
if
(!
ObjectUtils
.
isEmpty
(
siteId
))
{
list
.
stream
().
forEach
(
item
->
item
.
setSiteId
(
Convert
.
toLong
(
siteId
,
0L
)));
list
.
stream
().
forEach
(
item
->
item
.
setSiteId
(
Convert
.
toLong
(
siteId
,
0L
)));
}
}
list
.
stream
().
peek
(
item
->
{
list
.
stream
().
peek
(
item
->
{
if
(!
ObjectUtils
.
isEmpty
(
item
.
getPicObj
()))
{
if
(!
ObjectUtils
.
isEmpty
(
item
.
getPicObj
()))
{
...
...
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