Commit 3b21ee30 by zhouhaibao

[+]代码提交

1 parent 0a7649f7
......@@ -96,13 +96,13 @@ public class PileControController extends BaseController {
@Operation(summary = "设置费率", description = "设置费率")
@GetMapping("/setModel")
public R<Boolean> setModel(String pileId, String modelcode) {
public R<Boolean> setModel(String pileId, String modelcode,String v1,String v2) {
ModelSetReq req = new ModelSetReq();
ModelSetReqData data = new ModelSetReqData();
data.setPileId(Ocpp16Helper.strToBcd(pileId, data.getPileId()));
data.setModelCode(Ocpp16Helper.strToBcd(modelcode, data.getModelCode()));
byte[] byteArray1 = new byte[]{(byte) 0x9C, 0x40, 0x00, 0x00};
byte[] byteArray = new byte[]{(byte) 0x9C, 0x40, 0x01, 0x00};
byte[] byteArray1 =Ocpp16Helper.bigDecimalToByteArray(new BigDecimal(v1), 4);
byte[] byteArray = Ocpp16Helper.bigDecimalToByteArray(new BigDecimal(v2), 4);
data.setValleyDreRate(byteArray1);
data.setValleyEleRate(byteArray1);
data.setTopDreRate(byteArray);
......@@ -169,7 +169,12 @@ public class PileControController extends BaseController {
public static void main(String[] args) {
byte[] byteArray1 = new byte[]{(byte) 0x9C, 0x40, 0x00, 0x00};
BigDecimal bigDecimal1 = Ocpp16Helper.bytesBinToBigDecimal(byteArray1, 5);
BigDecimal bigDecimal2 = Ocpp16Helper.bytesBinToBigDecimal(byteArray1, 5);
System.out.println(bigDecimal2);
System.out.println(new BigDecimal("0.16540"));
byte[] bytes = Ocpp16Helper.bigDecimalToByteArray(new BigDecimal("0.16540"), 4);
BigDecimal bigDecimal1 = Ocpp16Helper.bytesBinToBigDecimal(bytes, 5);
System.out.println(bigDecimal1);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!