Commit b6ef1d3d by zhouhaibao

[+]代码提交

1 parent fb5d1c53
...@@ -28,6 +28,7 @@ import com.glsx.plat.core.annotation.ResponseResultBody; ...@@ -28,6 +28,7 @@ import com.glsx.plat.core.annotation.ResponseResultBody;
import com.glsx.plat.core.web.R; import com.glsx.plat.core.web.R;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import java.math.BigDecimal;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
...@@ -92,8 +93,10 @@ public class PileControController extends BaseController { ...@@ -92,8 +93,10 @@ public class PileControController extends BaseController {
ModelSetReqData data = new ModelSetReqData(); ModelSetReqData data = new ModelSetReqData();
data.setPileId(Ocpp16Helper.strToBcd(pileId, data.getPileId())); data.setPileId(Ocpp16Helper.strToBcd(pileId, data.getPileId()));
byte[] modelcodeByte = new byte[]{(byte) 0x00, 0x01}; byte[] modelcodeByte = new byte[]{(byte) 0x00, 0x01};
BigDecimal bigDecimal = Ocpp16Helper.bytesBinToBigDecimal(modelcodeByte, 0);
data.setModelCode(modelcodeByte); data.setModelCode(modelcodeByte);
byte[] byteArray = new byte[]{(byte) 0x9C, 0x40, 0x00, 0x00}; byte[] byteArray = new byte[]{(byte) 0x9C, 0x40, 0x01, 0x00};
data.setValleyDreRate(byteArray); data.setValleyDreRate(byteArray);
data.setValleyEleRate(byteArray); data.setValleyEleRate(byteArray);
data.setTopDreRate(byteArray); data.setTopDreRate(byteArray);
...@@ -157,4 +160,14 @@ public class PileControController extends BaseController { ...@@ -157,4 +160,14 @@ public class PileControController extends BaseController {
TcpRsp tcpRsp = tcpRspTcpCallback.get(); TcpRsp tcpRsp = tcpRspTcpCallback.get();
return R.ok().data(tcpRsp); return R.ok().data(tcpRsp);
} }
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};
BigDecimal bigDecimal1 = Ocpp16Helper.bytesBinToBigDecimal(byteArray, 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!