update 联联平台接口

This commit is contained in:
Lemon
2023-05-15 10:30:16 +08:00
parent 738c9fde3d
commit fb260eb68d
9 changed files with 178 additions and 111 deletions

View File

@@ -5,6 +5,7 @@ import com.jsowell.common.annotation.Anonymous;
import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse;
import com.jsowell.pile.dto.LianLianPushStationInfoDTO;
import com.jsowell.pile.dto.QueryEquipmentDTO;
import com.jsowell.pile.dto.QueryStartChargeDTO;
import com.jsowell.pile.dto.QueryStationInfoDTO;
@@ -33,11 +34,11 @@ public class LianLianController extends BaseController {
@PostMapping("/pushStationInfo")
public RestApiResponse<?> pushStationInfo(@RequestBody QueryStationInfoDTO dto) {
public RestApiResponse<?> pushStationInfo(@RequestBody LianLianPushStationInfoDTO dto) {
logger.info("推送联联平台充电站信息 params:{}", JSONObject.toJSONString(dto));
RestApiResponse<?> response = null;
try {
lianLianService.pushStationInfo(Long.parseLong(dto.getStationID()));
lianLianService.pushStationInfo(dto);
response = new RestApiResponse<>();
}catch (BusinessException e) {
logger.error("推送联联平台充电站信息 error",e);

View File

@@ -159,66 +159,27 @@ public class SpringBootTestController {
}
@Test
public void testLianLian() throws Exception {
// Long stationId = 2L;
// // 通过id查询站点相关信息
// PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(stationId);
// // 组装联联平台所需要的数据格式
// StationInfo info = StationInfo.builder()
// .StationID(String.valueOf(stationId))
// .OperatorID(Constants.OPERATORID_LIANLIAN)
// .EquipmentOwnerID(Constants.OPERATORID_LIANLIAN)
// .StationName(pileStationInfo.getStationName())
// .IsAloneApply(Integer.valueOf(pileStationInfo.getAloneApply()))
// .IsPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking()))
// .CountryCode(pileStationInfo.getCountryCode())
// .AreaCode(pileStationInfo.getAreaCode())
// .Address(pileStationInfo.getAddress())
// .ServiceTel(pileStationInfo.getServiceTel())
// .StationType(Integer.valueOf(pileStationInfo.getStationType()))
// .StationStatus(Integer.valueOf(pileStationInfo.getStationStatus()))
// .ParkNums(Integer.valueOf(pileStationInfo.getParkNums()))
// .StationLng(new BigDecimal(pileStationInfo.getStationLng()))
// .StationLat(new BigDecimal(pileStationInfo.getStationLat()))
// .Construction(Integer.valueOf(pileStationInfo.getConstruction()))
// .OpenAllDay(Integer.valueOf(pileStationInfo.getOpenAllDay()))
// // .MinElectricityPrice()
// // .ElectricityFee()
// // .ServiceFee()
// .ParkFree(Integer.valueOf(pileStationInfo.getParkFree()))
// // .ParkFee()
// .Payment(pileStationInfo.getPayment())
// .SupportOrder(Integer.valueOf(pileStationInfo.getSupportOrder()))
// // .equipmentInfos()
// // .ParkFeeType()
// .ToiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag()))
// .StoreFlag(Integer.valueOf(pileStationInfo.getStoreFlag()))
// .RestaurantFlag(Integer.valueOf(pileStationInfo.getRestaurantFlag()))
// .LoungeFlag(Integer.valueOf(pileStationInfo.getLoungeFlag()))
// .CanopyFlag(Integer.valueOf(pileStationInfo.getCanopyFlag()))
// .PrinterFlag(Integer.valueOf(pileStationInfo.getPrinterFlag()))
// .BarrierFlag(Integer.valueOf(pileStationInfo.getBarrierFlag()))
// .ParkingLockFlag(Integer.valueOf(pileStationInfo.getParkingLockFlag()))
//
// .build();
// List<EquipmentInfo> pileList = lianLianService.getPileList(pileStationInfo);
// if (CollectionUtils.isNotEmpty(pileList)) {
// info.setEquipmentInfos(pileList); // 充电设备信息列表
// }
String url = "http://testdataexchange.evchargeonline.com:82/shevcs/v1/" + "notification_stationInfo";
JSONObject json = new JSONObject();
json.put("OperatorID", "MA1JLFUU8");
json.put("OperatorSecret", "Nh62XxllR5OjAzFj");
// json.put("StationInfo", info);
public void testLianLian(){
// 获取令牌
LianLianGetTokenDTO dto = new LianLianGetTokenDTO();
dto.setOperatorId("987654321");
dto.setOperatorSecret("1234567890abcdef");
String token = lianLianService.getToken(dto);
System.out.println("token:" + token);
LianLianPushStationInfoDTO dto1 = LianLianPushStationInfoDTO.builder()
.OperatorID("987654321")
.DataSecret("1234567890abcdef")
.DataSecretIV("1234567890abcdef")
.SigSecret("1234567890abcdef")
.token(token)
.stationId(2L)
.build();
lianLianService.pushStationInfo(dto1);
}