Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-charging-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ebcca57e
authored
Nov 10, 2023
by
zhouhaibao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]判空校验
1 parent
2087c3cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
platform-charging/src/main/java/cn/com/glsx/charging/modules/controller/PileControController.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/controller/PileControController.java
View file @
ebcca57
...
...
@@ -37,6 +37,7 @@ import io.swagger.v3.oas.annotations.Operation;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
java.math.BigDecimal
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -195,7 +196,7 @@ public class PileControController extends BaseController {
@Operation
(
summary
=
"远程重启"
,
description
=
"停止充电桩"
)
@GetMapping
(
"/remoteRestart"
)
public
R
<
Boolean
>
remoteRestart
(
String
pileId
,
byte
res
)
{
public
R
<
Boolean
>
remoteRestart
(
String
pileId
,
byte
res
)
{
RemoteRestartReq
req
=
new
RemoteRestartReq
();
RemoteRestartReqData
data
=
new
RemoteRestartReqData
();
data
.
setPileId
(
Ocpp16Helper
.
strToBcd
(
pileId
,
data
.
getPileId
()));
...
...
@@ -208,19 +209,30 @@ public class PileControController extends BaseController {
@Operation
(
summary
=
"远程更新"
,
description
=
"远程更新"
)
@GetMapping
(
"/remoteupdate"
)
public
R
<
Boolean
>
remoteupdate
(
String
pileId
,
byte
pileModel
,
BigDecimal
pilePower
,
String
upServerAddress
,
BigDecimal
upServerPort
,
String
userName
,
String
password
,
String
filePath
,
byte
exeControl
,
byte
uploadTimeOut
public
R
<
Boolean
>
remoteupdate
(
String
pileId
,
byte
pileModel
,
BigDecimal
pilePower
,
String
upServerAddress
,
BigDecimal
upServerPort
,
String
userName
,
String
password
,
String
filePath
,
byte
exeControl
,
byte
uploadTimeOut
)
{
RemoteUpdateReq
req
=
new
RemoteUpdateReq
();
RemoteUpdateReqData
data
=
new
RemoteUpdateReqData
();
data
.
setPileId
(
Ocpp16Helper
.
strToBcd
(
pileId
,
data
.
getPileId
()));
data
.
setPileModel
(
pileModel
);
data
.
setPilePower
(
Ocpp16Helper
.
bigDecimalToByteArray
(
pilePower
,
2
));
data
.
setUpServerAddress
(
Ocpp16Helper
.
strToAscii
(
upServerAddress
,
data
.
getUpServerAddress
()));
data
.
setUpServerPort
(
Ocpp16Helper
.
bigDecimalToByteArray
(
upServerPort
,
2
));
data
.
setUserName
(
Ocpp16Helper
.
strToAscii
(
userName
,
data
.
getUserName
()));
data
.
setPassword
(
Ocpp16Helper
.
strToAscii
(
password
,
data
.
getPassword
()));
data
.
setFilePath
(
Ocpp16Helper
.
strToAscii
(
filePath
,
data
.
getFilePath
()));
if
(
StringUtils
.
isNotEmpty
(
upServerAddress
))
{
data
.
setUpServerAddress
(
Ocpp16Helper
.
strToAscii
(
upServerAddress
,
data
.
getUpServerAddress
()));
}
if
(
upServerPort
!=
null
)
{
data
.
setUpServerPort
(
Ocpp16Helper
.
bigDecimalToByteArray
(
upServerPort
,
2
));
}
if
(
StringUtils
.
isNotEmpty
(
userName
))
{
data
.
setUserName
(
Ocpp16Helper
.
strToAscii
(
userName
,
data
.
getUserName
()));
}
if
(
StringUtils
.
isNotEmpty
(
password
))
{
data
.
setPassword
(
Ocpp16Helper
.
strToAscii
(
password
,
data
.
getPassword
()));
}
if
(
StringUtils
.
isNotEmpty
(
filePath
))
{
data
.
setFilePath
(
Ocpp16Helper
.
strToAscii
(
filePath
,
data
.
getFilePath
()));
}
data
.
setExeControl
(
exeControl
);
data
.
setUploadTimeOut
(
uploadTimeOut
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment