Commit 9362e654 by zhouhaibao

[+]接入对外提供接口

1 parent 89bbd979
...@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
/** /**
* @author payu * @author payu
*/ */
@FeignClient(name = "platform-charging", contextId = "pilecontrol", path = "/api/user/", decode404 = true) @FeignClient(name = "platform-charging-server", contextId = "pilecontrol", path = "/api/user/", decode404 = true)
public interface PileControlFeignClient { public interface PileControlFeignClient {
/** /**
......
...@@ -18,6 +18,7 @@ import cn.com.glsx.charging.modules.model.UserDTO; ...@@ -18,6 +18,7 @@ import cn.com.glsx.charging.modules.model.UserDTO;
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 cn.com.glsx.charging.modules.service.UserDemoService;
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.Operation; import io.swagger.v3.oas.annotations.Operation;
...@@ -48,12 +49,13 @@ public class PileControlApiController implements PileControlFeignClient { ...@@ -48,12 +49,13 @@ public class PileControlApiController implements PileControlFeignClient {
@Override @Override
public Result<Boolean> start(StartBo startBo) { public Result<Boolean> start(StartBo startBo) {
log.info("启动充电桩请求入参{}", JSONObject.toJSONString(startBo));
StartMachineReq req = new StartMachineReq(); StartMachineReq req = new StartMachineReq();
StartMachineReqData data = new StartMachineReqData(); StartMachineReqData data = new StartMachineReqData();
data.setTransactionSerialNumber(Ocpp16Helper.strToBcd(startBo.getTransactionSerialNumber(), data.setTransactionSerialNumber(Ocpp16Helper.strToBcd(startBo.getTransactionSerialNumber(),
data.getTransactionSerialNumber())); data.getTransactionSerialNumber()));
data.setPileId(Ocpp16Helper.strToBcd(startBo.getPileId(), data.getPileId())); data.setPileId(Ocpp16Helper.strToBcd(startBo.getPileId(), data.getPileId()));
data.setGunNumber((byte) 1); data.setGunNumber(startBo.getGunNumber().byteValue());
data.setLogicalCardNumber( data.setLogicalCardNumber(
Ocpp16Helper.strToBcd(startBo.getTransactionSerialNumber(), data.getLogicalCardNumber())); Ocpp16Helper.strToBcd(startBo.getTransactionSerialNumber(), data.getLogicalCardNumber()));
byte[] bytes = Ocpp16Helper.binToBytes( byte[] bytes = Ocpp16Helper.binToBytes(
...@@ -70,6 +72,7 @@ public class PileControlApiController implements PileControlFeignClient { ...@@ -70,6 +72,7 @@ public class PileControlApiController implements PileControlFeignClient {
@Override @Override
public Result<Boolean> end(EndBo endBo) { public Result<Boolean> end(EndBo endBo) {
log.info("停止充电桩请求入参{}", JSONObject.toJSONString(endBo));
ShutdownMachineReq req = new ShutdownMachineReq(); ShutdownMachineReq req = new ShutdownMachineReq();
ShutdownMachineReqData data = new ShutdownMachineReqData(); ShutdownMachineReqData data = new ShutdownMachineReqData();
data.setGunNumber(endBo.getGunNumber().byteValue()); data.setGunNumber(endBo.getGunNumber().byteValue());
...@@ -87,7 +90,8 @@ public class PileControlApiController implements PileControlFeignClient { ...@@ -87,7 +90,8 @@ public class PileControlApiController implements PileControlFeignClient {
data.setPileId(Ocpp16Helper.strToBcd(startBo.getPileId(), data.getPileId())); data.setPileId(Ocpp16Helper.strToBcd(startBo.getPileId(), data.getPileId()));
data.setGunNumber(startBo.getGunNumber().byteValue()); data.setGunNumber(startBo.getGunNumber().byteValue());
data.setSucceedStatus(startBo.getSucceedStatus()); data.setSucceedStatus(startBo.getSucceedStatus());
data.setAccountBalance(Ocpp16Helper.bigDecimalToByteArray(BigDecimal.valueOf(startBo.getAccountBalance()), 4)); data.setAccountBalance(
Ocpp16Helper.bigDecimalToByteArray(BigDecimal.valueOf(startBo.getAccountBalance()), 4));
data.setTransactionSerialNumber(Ocpp16Helper.strToBcd(startBo.getTransactionSerialNumber(), data.setTransactionSerialNumber(Ocpp16Helper.strToBcd(startBo.getTransactionSerialNumber(),
data.getTransactionSerialNumber())); data.getTransactionSerialNumber()));
data.setLogicalCardNumber(Ocpp16Helper.strToBcd(startBo.getLogicalCardNumber(), data.setLogicalCardNumber(Ocpp16Helper.strToBcd(startBo.getLogicalCardNumber(),
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!