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 47d8bf76
authored
Nov 16, 2023
by
zhouhaibao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]接口调整
1 parent
3c99e78a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
33 deletions
platform-charging-api/src/main/java/cn/com/glsx/charging/api/PileControlFeignClient.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/api/PileControlApiController.java
platform-charging-api/src/main/java/cn/com/glsx/charging/api/PileControlFeignClient.java
View file @
47d8bf7
...
@@ -3,9 +3,12 @@ package cn.com.glsx.charging.api;
...
@@ -3,9 +3,12 @@ package cn.com.glsx.charging.api;
import
cn.com.glsx.charging.modules.model.pilecontrol.EndBo
;
import
cn.com.glsx.charging.modules.model.pilecontrol.EndBo
;
import
cn.com.glsx.charging.modules.model.pilecontrol.StartBo
;
import
cn.com.glsx.charging.modules.model.pilecontrol.StartBo
;
import
com.glsx.plat.core.web.Result
;
import
com.glsx.plat.core.web.Result
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
/**
* @author payu
* @author payu
...
@@ -33,14 +36,14 @@ public interface PileControlFeignClient {
...
@@ -33,14 +36,14 @@ public interface PileControlFeignClient {
* 三、性能问题 1.Feign是一个http请求调用的轻量级框架,基于http协议,性能不如rpc 2.可以为Feign配置连接池,配合使用okhttp等
* 三、性能问题 1.Feign是一个http请求调用的轻量级框架,基于http协议,性能不如rpc 2.可以为Feign配置连接池,配合使用okhttp等
*/
*/
@
Pos
tMapping
(
"/start"
)
@
Ge
tMapping
(
"/start"
)
Result
<
Boolean
>
start
(
@Request
Body
StartBo
startBo
);
Result
<
Boolean
>
start
(
@Request
Param
(
"requestParam"
)
String
json
);
@
Pos
tMapping
(
"/end"
)
@
Ge
tMapping
(
"/end"
)
Result
<
Boolean
>
end
(
@Request
Body
EndBo
endBo
);
Result
<
Boolean
>
end
(
@Request
Param
(
"requestParam"
)
String
endBo
);
@
Pos
tMapping
(
"/pileStart"
)
@
Ge
tMapping
(
"/pileStart"
)
Result
<
Boolean
>
pileStart
(
@Request
Body
StartBo
startBo
);
Result
<
Boolean
>
pileStart
(
@Request
Param
(
"requestParam"
)
String
startBo
);
@PostMapping
(
value
=
"/test"
)
@PostMapping
(
value
=
"/test"
)
Result
<
Boolean
>
test
();
Result
<
Boolean
>
test
();
...
...
platform-charging/src/main/java/cn/com/glsx/charging/modules/api/PileControlApiController.java
View file @
47d8bf7
...
@@ -13,14 +13,13 @@ import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.protocol.ShutdownMachineReq;
...
@@ -13,14 +13,13 @@ import cn.com.glsx.charging.modules.gbt.ocpp16.tcp.protocol.ShutdownMachineReq;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.protocol.StartMachineReq
;
import
cn.com.glsx.charging.modules.gbt.ocpp16.tcp.protocol.StartMachineReq
;
import
cn.com.glsx.charging.modules.model.pilecontrol.EndBo
;
import
cn.com.glsx.charging.modules.model.pilecontrol.EndBo
;
import
cn.com.glsx.charging.modules.model.pilecontrol.StartBo
;
import
cn.com.glsx.charging.modules.model.pilecontrol.StartBo
;
import
cn.com.glsx.charging.modules.service.UserDemoService
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.glsx.plat.core.annotation.ResponseResultBody
;
import
com.glsx.plat.core.annotation.ResponseResultBody
;
import
com.glsx.plat.core.web.Result
;
import
com.glsx.plat.core.web.Result
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
javax.annotation.Resource
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
@@ -42,32 +41,39 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -42,32 +41,39 @@ import org.springframework.web.bind.annotation.RestController;
public
class
PileControlApiController
implements
PileControlFeignClient
{
public
class
PileControlApiController
implements
PileControlFeignClient
{
@Override
@Override
@PostMapping
(
"/start"
)
@GetMapping
(
"/start"
)
public
Result
<
Boolean
>
start
(
@RequestBody
StartBo
startBo
)
{
public
Result
<
Boolean
>
start
(
@RequestParam
(
"requestParam"
)
String
json
)
{
log
.
info
(
"启动充电桩请求入参{}"
,
JSONObject
.
toJSONString
(
startBo
));
try
{
StartMachineReq
req
=
new
StartMachineReq
();
StartBo
startBo
=
JSONObject
.
parseObject
(
json
,
StartBo
.
class
);
StartMachineReqData
data
=
new
StartMachineReqData
();
log
.
info
(
"启动充电桩请求入参{}"
,
JSONObject
.
toJSONString
(
startBo
));
data
.
setTransactionSerialNumber
(
Ocpp16Helper
.
strToBcd
(
startBo
.
getTransactionSerialNumber
(),
StartMachineReq
req
=
new
StartMachineReq
();
data
.
getTransactionSerialNumber
()));
StartMachineReqData
data
=
new
StartMachineReqData
();
data
.
setPileId
(
Ocpp16Helper
.
strToBcd
(
startBo
.
getPileId
(),
data
.
getPileId
()));
data
.
setTransactionSerialNumber
(
Ocpp16Helper
.
strToBcd
(
startBo
.
getTransactionSerialNumber
(),
data
.
setGunNumber
(
startBo
.
getGunNumber
().
byteValue
());
data
.
getTransactionSerialNumber
()));
data
.
setLogicalCardNumber
(
data
.
setPileId
(
Ocpp16Helper
.
strToBcd
(
startBo
.
getPileId
(),
data
.
getPileId
()));
Ocpp16Helper
.
strToBcd
(
startBo
.
getTransactionSerialNumber
(),
data
.
getLogicalCardNumber
()));
data
.
setGunNumber
(
startBo
.
getGunNumber
().
byteValue
());
byte
[]
bytes
=
Ocpp16Helper
.
binToBytes
(
data
.
setLogicalCardNumber
(
Ocpp16Helper
.
hexToBinStr
(
startBo
.
getPhysicalCardNumber
()));
Ocpp16Helper
.
strToBcd
(
startBo
.
getTransactionSerialNumber
(),
data
.
getLogicalCardNumber
()));
data
.
setPhysicalCardNumber
(
bytes
);
byte
[]
bytes
=
Ocpp16Helper
.
binToBytes
(
byte
[]
accountBytes
=
Ocpp16Helper
.
bigDecimalToByteArray
(
Ocpp16Helper
.
hexToBinStr
(
startBo
.
getPhysicalCardNumber
()));
BigDecimal
.
valueOf
(
startBo
.
getAccountBalance
()),
2
);
data
.
setPhysicalCardNumber
(
bytes
);
data
.
setAccountBalance
(
accountBytes
);
byte
[]
accountBytes
=
Ocpp16Helper
.
bigDecimalToByteArray
(
req
.
setData
(
data
);
BigDecimal
.
valueOf
(
startBo
.
getAccountBalance
()),
2
);
TcpCallback
<
TcpRsp
>
tcpRspTcpCallback
=
ServerMain
.
getServer
().
sendSync
(
req
);
data
.
setAccountBalance
(
accountBytes
);
TcpRsp
tcpRsp
=
tcpRspTcpCallback
.
get
();
req
.
setData
(
data
);
return
Result
.
success
(
true
);
TcpCallback
<
TcpRsp
>
tcpRspTcpCallback
=
ServerMain
.
getServer
().
sendSync
(
req
);
TcpRsp
tcpRsp
=
tcpRspTcpCallback
.
get
();
return
Result
.
success
(
true
);
}
catch
(
Exception
e
)
{
return
Result
.
failure
();
}
}
}
@Override
@Override
@PostMapping
(
"/end"
)
@GetMapping
(
"/end"
)
public
Result
<
Boolean
>
end
(
@RequestBody
EndBo
endBo
)
{
public
Result
<
Boolean
>
end
(
@RequestParam
(
"requestParam"
)
String
json
)
{
EndBo
endBo
=
JSONObject
.
parseObject
(
json
,
EndBo
.
class
);
log
.
info
(
"停止充电桩请求入参{}"
,
JSONObject
.
toJSONString
(
endBo
));
log
.
info
(
"停止充电桩请求入参{}"
,
JSONObject
.
toJSONString
(
endBo
));
ShutdownMachineReq
req
=
new
ShutdownMachineReq
();
ShutdownMachineReq
req
=
new
ShutdownMachineReq
();
ShutdownMachineReqData
data
=
new
ShutdownMachineReqData
();
ShutdownMachineReqData
data
=
new
ShutdownMachineReqData
();
...
@@ -80,8 +86,9 @@ public class PileControlApiController implements PileControlFeignClient {
...
@@ -80,8 +86,9 @@ public class PileControlApiController implements PileControlFeignClient {
}
}
@Override
@Override
@PostMapping
(
"/pileStart"
)
@GetMapping
(
"/pileStart"
)
public
Result
<
Boolean
>
pileStart
(
@RequestBody
StartBo
startBo
)
{
public
Result
<
Boolean
>
pileStart
(
@RequestParam
(
"requestParam"
)
String
json
)
{
StartBo
startBo
=
JSONObject
.
parseObject
(
json
,
StartBo
.
class
);
AdminSwipeConfirmRsp
rsp
=
new
AdminSwipeConfirmRsp
();
AdminSwipeConfirmRsp
rsp
=
new
AdminSwipeConfirmRsp
();
AdminSwipeConfirmRspData
data
=
new
AdminSwipeConfirmRspData
();
AdminSwipeConfirmRspData
data
=
new
AdminSwipeConfirmRspData
();
data
.
setPileId
(
Ocpp16Helper
.
strToBcd
(
startBo
.
getPileId
(),
data
.
getPileId
()));
data
.
setPileId
(
Ocpp16Helper
.
strToBcd
(
startBo
.
getPileId
(),
data
.
getPileId
()));
...
...
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