启动充电测试
This commit is contained in:
parent
a1db4383a0
commit
6d48e9c2c4
@ -34,5 +34,9 @@
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>2.12.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-security</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@ -5,6 +5,7 @@ import com.xhpc.common.core.constant.ServiceNameConstants;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.data.down.StartChargingData;
|
||||
import com.xhpc.common.data.redis.CacheRateModel;
|
||||
import com.xhpc.common.security.annotation.PreAuthorize;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -15,6 +16,7 @@ import java.util.Set;
|
||||
@FeignClient(contextId = "powerPileService", value = ServiceNameConstants.PILE_SERVICE, fallbackFactory = PowerPileFallbackFactory.class)
|
||||
public interface PowerPileService {
|
||||
|
||||
@PreAuthorize(hasPermi = "user:privilege:add")
|
||||
@PostMapping("/charging/start")
|
||||
R startCharging(@Validated @RequestBody StartChargingData startChargingData);
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ public class StartChargingData {
|
||||
private Integer balance; //账户余额(精度:小数点后2位)=实际金额(元)×100
|
||||
private String logicCardNo = "0000000000000000"; //逻辑卡号
|
||||
private String physicCardNo = "0000000000000000"; //物理卡号
|
||||
private String version; //协议版本号(0A)
|
||||
private String version = "0A"; //协议版本号(0A)
|
||||
|
||||
public String getOrderNo() {
|
||||
|
||||
|
||||
@ -1,30 +1,36 @@
|
||||
package com.xhpc.pp.controller;
|
||||
|
||||
import com.alibaba.nacos.api.NacosFactory;
|
||||
import com.alibaba.nacos.api.exception.NacosException;
|
||||
import com.alibaba.nacos.api.naming.NamingService;
|
||||
import com.alibaba.nacos.api.naming.pojo.Instance;
|
||||
import com.xhpc.common.core.utils.GetIpAndPort;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.data.down.StartChargingData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
public class TestController {
|
||||
|
||||
@GetMapping("test")
|
||||
public String test() throws NacosException {
|
||||
@Autowired
|
||||
private PowerPileService powerPileService;
|
||||
|
||||
String serverIp = "127.0.0.1";
|
||||
int serverPort = 8848;
|
||||
String serverAddr = serverIp + ":" + serverPort;
|
||||
@GetMapping("test/{ono}/{b}/{gid}")
|
||||
public R test(@PathVariable String ono, @PathVariable int b, @PathVariable String gid) throws NacosException {
|
||||
|
||||
NamingService namingService = NacosFactory.createNamingService(serverAddr);
|
||||
List<Instance> ppInstances = namingService.getAllInstances("xhpc-power-pile");
|
||||
// String serverIp = "127.0.0.1";
|
||||
// int serverPort = 8848;
|
||||
// String serverAddr = serverIp + ":" + serverPort;
|
||||
// NamingService namingService = NacosFactory.createNamingService(serverAddr);
|
||||
// List<Instance> ppInstances = namingService.getAllInstances("xhpc-power-pile");
|
||||
// todo clean dead host pile cache
|
||||
String ipAndPort = GetIpAndPort.getIpAndPort();
|
||||
return ipAndPort;
|
||||
// String ipAndPort = GetIpAndPort.getIpAndPort();
|
||||
|
||||
StartChargingData d = new StartChargingData();
|
||||
d.setBalance(b); //300
|
||||
d.setOrderNo(ono); //00000000000000000000000123456789
|
||||
d.setGunId(gid); //02
|
||||
return powerPileService.startCharging(d);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user