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 57099e20
authored
Nov 14, 2023
by
叶立庆
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
http://192.168.3.233:8090/platform/platform-charging-server
2 parents
973314e7
910fe0b5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
33 deletions
platform-charging/src/main/java/cn/com/glsx/charging/modules/controller/GetDataController.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/controller/PileControController.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/handler/UploadRealTimeRspHandler.java
platform-charging/src/main/java/cn/com/glsx/charging/util/ByteUtils.java
platform-charging/src/main/java/cn/com/glsx/charging/modules/controller/GetDataController.java
View file @
57099e2
...
...
@@ -12,9 +12,9 @@ import com.glsx.plat.core.web.R;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -25,22 +25,28 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j
@Tag
(
name
=
"读取实时数据"
)
@RestController
@RequestMapping
(
value
=
"/
getdata
"
)
@RequestMapping
(
value
=
"/
api/charging/realtime
"
)
@ResponseResultBody
public
class
GetDataController
extends
BaseController
{
@Operation
(
summary
=
"读取实时监测数据"
,
description
=
"读取实时监测数据"
)
@GetMapping
(
"/realtime"
)
public
R
<
Boolean
>
getRealTimeData
(
@Param
(
"pileId"
)
String
pileId
,
@Param
(
"gunNumber"
)
String
gunNumber
)
{
log
.
info
(
"读取实时监测数据,充电桩编号:{}"
,
pileId
);
log
.
info
(
"读取实时监测数据,枪号:{}"
,
gunNumber
);
RealTimeReq
req
=
new
RealTimeReq
();
RealTimeDataReqData
data
=
new
RealTimeDataReqData
();
data
.
setPileId
(
Ocpp16Helper
.
strToBcd
(
pileId
,
data
.
getPileId
()));
data
.
setGunNumber
(
Ocpp16Helper
.
strToBcd
(
gunNumber
,
new
byte
[]
{})[
0
]);
TcpCallback
<
TcpRsp
>
tcpRspTcpCallback
=
ServerMain
.
getServer
().
sendSync
(
req
);
TcpRsp
tcpRsp
=
tcpRspTcpCallback
.
get
();
return
R
.
ok
().
data
(
tcpRsp
);
@GetMapping
(
"/get"
)
public
R
<
Boolean
>
getRealTimeData
(
@RequestParam
String
pileId
,
@RequestParam
String
gunNumber
)
{
try
{
log
.
info
(
"读取实时监测数据,充电桩编号:{}"
,
pileId
);
log
.
info
(
"读取实时监测数据,枪号:{}"
,
gunNumber
);
RealTimeReq
req
=
new
RealTimeReq
();
RealTimeDataReqData
data
=
new
RealTimeDataReqData
();
data
.
setPileId
(
Ocpp16Helper
.
strToBcd
(
pileId
,
data
.
getPileId
()));
data
.
setGunNumber
((
byte
)
1
);
req
.
setData
(
data
);
TcpCallback
<
TcpRsp
>
tcpRspTcpCallback
=
ServerMain
.
getServer
().
sendSync
(
req
);
TcpRsp
tcpRsp
=
tcpRspTcpCallback
.
get
();
return
R
.
ok
().
data
(
tcpRsp
);
}
catch
(
Exception
e
)
{
log
.
error
(
"读取实时监测数据error:{}"
,
e
.
getMessage
(),
e
);
return
R
.
error
();
}
}
}
platform-charging/src/main/java/cn/com/glsx/charging/modules/controller/PileControController.java
View file @
57099e2
...
...
@@ -101,10 +101,10 @@ public class PileControController extends BaseController {
ModelSetReqData
data
=
new
ModelSetReqData
();
data
.
setPileId
(
Ocpp16Helper
.
strToBcd
(
pileId
,
data
.
getPileId
()));
data
.
setModelCode
(
Ocpp16Helper
.
strToBcd
(
modelcode
,
data
.
getModelCode
()));
byte
[]
byteArray1
=
new
byte
[]{(
byte
)
0x8D
,
0x40
,
0x10
,
0x00
};
byte
[]
byteArray
=
new
byte
[]{(
byte
)
0x9C
,
0x40
,
0x01
,
0x00
};
data
.
setValleyDreRate
(
byteArray
);
data
.
setValleyEleRate
(
byteArray
);
data
.
setValleyDreRate
(
byteArray
1
);
data
.
setValleyEleRate
(
byteArray
1
);
data
.
setTopDreRate
(
byteArray
);
data
.
setTopEleRate
(
byteArray
);
data
.
setFlatDreRate
(
byteArray
);
...
...
@@ -112,17 +112,17 @@ public class PileControController extends BaseController {
data
.
setPeakDreRate
(
byteArray
);
data
.
setPeakEleRate
(
byteArray
);
data
.
setLossCalRatio
((
byte
)
0
);
data
.
setPeriodRate1
((
byte
)
1
);
data
.
setPeriodRate2
((
byte
)
1
);
data
.
setPeriodRate3
((
byte
)
1
);
data
.
setPeriodRate4
((
byte
)
1
);
data
.
setPeriodRate5
((
byte
)
1
);
data
.
setPeriodRate6
((
byte
)
1
);
data
.
setPeriodRate7
((
byte
)
1
);
data
.
setPeriodRate8
((
byte
)
1
);
data
.
setPeriodRate9
((
byte
)
1
);
data
.
setPeriodRate10
((
byte
)
1
);
data
.
setPeriodRate11
((
byte
)
1
);
data
.
setPeriodRate1
((
byte
)
0
);
data
.
setPeriodRate2
((
byte
)
0
);
data
.
setPeriodRate3
((
byte
)
0
);
data
.
setPeriodRate4
((
byte
)
0
);
data
.
setPeriodRate5
((
byte
)
0
);
data
.
setPeriodRate6
((
byte
)
0
);
data
.
setPeriodRate7
((
byte
)
0
);
data
.
setPeriodRate8
((
byte
)
0
);
data
.
setPeriodRate9
((
byte
)
0
);
data
.
setPeriodRate10
((
byte
)
0
);
data
.
setPeriodRate11
((
byte
)
0
);
data
.
setPeriodRate12
((
byte
)
1
);
data
.
setPeriodRate13
((
byte
)
1
);
data
.
setPeriodRate14
((
byte
)
1
);
...
...
@@ -168,10 +168,7 @@ public class PileControController extends BaseController {
}
public
static
void
main
(
String
[]
args
)
{
byte
[]
modelcodeByte
=
new
byte
[]{(
byte
)
0x00
,
0x01
};
BigDecimal
bigDecimal
=
Ocpp16Helper
.
bytesBinToBigDecimal
(
modelcodeByte
,
0
);
System
.
out
.
println
(
bigDecimal
);
byte
[]
byteArray
=
new
byte
[]{(
byte
)
0x9C
,
0x40
,
0x01
,
0x00
};
byte
[]
byteArray
=
new
byte
[]{(
byte
)
0x8D
,
0x40
,
0x10
,
0x00
};
BigDecimal
bigDecimal1
=
Ocpp16Helper
.
bytesBinToBigDecimal
(
byteArray
,
5
);
System
.
out
.
println
(
bigDecimal1
);
...
...
platform-charging/src/main/java/cn/com/glsx/charging/modules/gbt/ocpp16/tcp/handler/UploadRealTimeRspHandler.java
View file @
57099e2
...
...
@@ -29,8 +29,8 @@ public class UploadRealTimeRspHandler implements TcpHandler<UploadRealtimeDataRs
log
.
info
(
"实时监测数据为空"
);
return
null
;
}
uploadRealTimeData
(
notify
.
getData
());
log
.
info
(
"实时监测数据:{}"
,
data
);
uploadRealTimeData
(
notify
.
getData
());
return
null
;
}
...
...
platform-charging/src/main/java/cn/com/glsx/charging/util/ByteUtils.java
View file @
57099e2
...
...
@@ -212,7 +212,8 @@ public class ByteUtils {
* @date 2018年1月17日 上午9:36:49
* @since 1.0.0
*/
public
static
byte
getByte
(
byte
[]
buff
,
int
offset
)
{
public
static
byte
getByte
(
byte
[]
buff
,
int
offset
)
{
return
buff
[
offset
];
}
...
...
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