mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-03 17:40:13 +08:00
update 联联平台接口
This commit is contained in:
@@ -5,6 +5,7 @@ import com.jsowell.common.annotation.Anonymous;
|
|||||||
import com.jsowell.common.core.controller.BaseController;
|
import com.jsowell.common.core.controller.BaseController;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.response.RestApiResponse;
|
import com.jsowell.common.response.RestApiResponse;
|
||||||
|
import com.jsowell.pile.dto.LianLianPushStationInfoDTO;
|
||||||
import com.jsowell.pile.dto.QueryEquipmentDTO;
|
import com.jsowell.pile.dto.QueryEquipmentDTO;
|
||||||
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
||||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||||
@@ -33,11 +34,11 @@ public class LianLianController extends BaseController {
|
|||||||
|
|
||||||
|
|
||||||
@PostMapping("/pushStationInfo")
|
@PostMapping("/pushStationInfo")
|
||||||
public RestApiResponse<?> pushStationInfo(@RequestBody QueryStationInfoDTO dto) {
|
public RestApiResponse<?> pushStationInfo(@RequestBody LianLianPushStationInfoDTO dto) {
|
||||||
logger.info("推送联联平台充电站信息 params:{}", JSONObject.toJSONString(dto));
|
logger.info("推送联联平台充电站信息 params:{}", JSONObject.toJSONString(dto));
|
||||||
RestApiResponse<?> response = null;
|
RestApiResponse<?> response = null;
|
||||||
try {
|
try {
|
||||||
lianLianService.pushStationInfo(Long.parseLong(dto.getStationID()));
|
lianLianService.pushStationInfo(dto);
|
||||||
response = new RestApiResponse<>();
|
response = new RestApiResponse<>();
|
||||||
}catch (BusinessException e) {
|
}catch (BusinessException e) {
|
||||||
logger.error("推送联联平台充电站信息 error",e);
|
logger.error("推送联联平台充电站信息 error",e);
|
||||||
|
|||||||
@@ -159,66 +159,27 @@ public class SpringBootTestController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLianLian() throws Exception {
|
public void testLianLian(){
|
||||||
// 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);
|
|
||||||
|
|
||||||
LianLianGetTokenDTO dto = new LianLianGetTokenDTO();
|
LianLianGetTokenDTO dto = new LianLianGetTokenDTO();
|
||||||
dto.setOperatorId("987654321");
|
dto.setOperatorId("987654321");
|
||||||
dto.setOperatorSecret("1234567890abcdef");
|
dto.setOperatorSecret("1234567890abcdef");
|
||||||
String token = lianLianService.getToken(dto);
|
String token = lianLianService.getToken(dto);
|
||||||
System.out.println("token:" + token);
|
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);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -169,7 +169,6 @@ public class LoginRequestHandler extends AbstractHandler{
|
|||||||
ProofreadTimeCommand command = ProofreadTimeCommand.builder().pileSn(pileSn).build();
|
ProofreadTimeCommand command = ProofreadTimeCommand.builder().pileSn(pileSn).build();
|
||||||
ykcPushCommandService.pushProofreadTimeCommand(command);
|
ykcPushCommandService.pushProofreadTimeCommand(command);
|
||||||
});
|
});
|
||||||
|
|
||||||
// log.info("下面进行下发二维码 pileSn:{}, thread:{}", pileSn, Thread.currentThread().getName());
|
// log.info("下面进行下发二维码 pileSn:{}, thread:{}", pileSn, Thread.currentThread().getName());
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.jsowell.pile.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联联平台推送站点信息
|
||||||
|
*
|
||||||
|
* @author JS-ZZA
|
||||||
|
* @date 2023/5/10 14:56
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class LianLianPushStationInfoDTO {
|
||||||
|
/**
|
||||||
|
* 运营商id
|
||||||
|
*/
|
||||||
|
private String OperatorID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 签名秘钥
|
||||||
|
*/
|
||||||
|
private String SigSecret;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息密钥
|
||||||
|
*/
|
||||||
|
private String DataSecret;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息密钥初始化向量
|
||||||
|
*/
|
||||||
|
private String DataSecretIV;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 令牌
|
||||||
|
*/
|
||||||
|
private String token;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点id
|
||||||
|
*/
|
||||||
|
private Long stationId;
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.jsowell.thirdparty.domain;
|
package com.jsowell.thirdparty.domain;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -24,7 +25,7 @@ public class ConnectorInfo {
|
|||||||
/**
|
/**
|
||||||
* 充电设备接口名称 N
|
* 充电设备接口名称 N
|
||||||
*/
|
*/
|
||||||
private String ConnectorName;
|
// private String ConnectorName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 充电设备接口类型 Y
|
* 充电设备接口类型 Y
|
||||||
@@ -59,6 +60,6 @@ public class ConnectorInfo {
|
|||||||
* 车位号 N
|
* 车位号 N
|
||||||
* 停车场车位编号
|
* 停车场车位编号
|
||||||
*/
|
*/
|
||||||
private String ParkNo;
|
// private String ParkNo;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.jsowell.thirdparty.domain;
|
package com.jsowell.thirdparty.domain;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -31,18 +32,18 @@ public class EquipmentInfo {
|
|||||||
* 设备型号 N
|
* 设备型号 N
|
||||||
* 由设备生厂商定义的设备型号
|
* 由设备生厂商定义的设备型号
|
||||||
*/
|
*/
|
||||||
private String EquipmentModel;
|
// private String EquipmentModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备名称 N
|
* 设备名称 N
|
||||||
*/
|
*/
|
||||||
private String EquipmentName;
|
// private String EquipmentName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备生产日期 N
|
* 设备生产日期 N
|
||||||
* YYYY-MM-DD
|
* YYYY-MM-DD
|
||||||
*/
|
*/
|
||||||
private String ProductionDate;
|
// private String ProductionDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 建设时间 Y
|
* 建设时间 Y
|
||||||
@@ -86,13 +87,13 @@ public class EquipmentInfo {
|
|||||||
* 充电设备经度 N
|
* 充电设备经度 N
|
||||||
* GCJ-02坐标系
|
* GCJ-02坐标系
|
||||||
*/
|
*/
|
||||||
private BigDecimal EquipmentLng;
|
// private BigDecimal EquipmentLng;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 充电设备纬度 N
|
* 充电设备纬度 N
|
||||||
* GCJ-02坐标系
|
* GCJ-02坐标系
|
||||||
*/
|
*/
|
||||||
private BigDecimal EquipmentLat;
|
// private BigDecimal EquipmentLat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否支持VIN码识别(0-否;1-是) Y
|
* 是否支持VIN码识别(0-否;1-是) Y
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.jsowell.thirdparty.domain;
|
package com.jsowell.thirdparty.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -51,13 +53,13 @@ public class StationInfo {
|
|||||||
* 户号 N
|
* 户号 N
|
||||||
* 国网电费账单户号
|
* 国网电费账单户号
|
||||||
*/
|
*/
|
||||||
private String AccountNumber;
|
// private String AccountNumber;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 容量(单位KW) N
|
* 容量(单位KW) N
|
||||||
* 独立电表申请的功率
|
* 独立电表申请的功率
|
||||||
*/
|
*/
|
||||||
private BigDecimal Capacity;
|
// private BigDecimal Capacity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否是公共停车场库 (0-否;1-是) Y
|
* 是否是公共停车场库 (0-否;1-是) Y
|
||||||
@@ -69,7 +71,7 @@ public class StationInfo {
|
|||||||
* 停车场库编号 N
|
* 停车场库编号 N
|
||||||
* 公共停车场库编号
|
* 公共停车场库编号
|
||||||
*/
|
*/
|
||||||
private String ParkingLotNumber;
|
// private String ParkingLotNumber;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 充电站国家代码 Y
|
* 充电站国家代码 Y
|
||||||
@@ -92,7 +94,7 @@ public class StationInfo {
|
|||||||
* 站点电话 N
|
* 站点电话 N
|
||||||
* 能够联系场站工作人员进行协助的联系电话
|
* 能够联系场站工作人员进行协助的联系电话
|
||||||
*/
|
*/
|
||||||
private String StationTel;
|
// private String StationTel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务电话 Y
|
* 服务电话 Y
|
||||||
@@ -147,7 +149,7 @@ public class StationInfo {
|
|||||||
* 站点引导 N
|
* 站点引导 N
|
||||||
* 描述性文字,用于引导车主找到充电车位
|
* 描述性文字,用于引导车主找到充电车位
|
||||||
*/
|
*/
|
||||||
private String SiteGuide;
|
// private String SiteGuide;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 建设场所 Y
|
* 建设场所 Y
|
||||||
@@ -174,31 +176,31 @@ public class StationInfo {
|
|||||||
* 站点照片 N
|
* 站点照片 N
|
||||||
* 充电设备照片、充电车位照片、停车场入口照片
|
* 充电设备照片、充电车位照片、停车场入口照片
|
||||||
*/
|
*/
|
||||||
private List<String> Pictures;
|
// private List<String> Pictures;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用车型描述 N
|
* 使用车型描述 N
|
||||||
* 描述该站点接受的车大小以及类型,如大巴、物流车、私家乘用车、出租车等
|
* 描述该站点接受的车大小以及类型,如大巴、物流车、私家乘用车、出租车等
|
||||||
*/
|
*/
|
||||||
private String MatchCars;
|
// private String MatchCars;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车位楼层及数量描述 N
|
* 车位楼层及数量描述 N
|
||||||
* 车位楼层以及数量信息
|
* 车位楼层以及数量信息
|
||||||
*/
|
*/
|
||||||
private String ParkInfo;
|
// private String ParkInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 停车场产权方 N
|
* 停车场产权方 N
|
||||||
* 停车场产权人
|
* 停车场产权人
|
||||||
*/
|
*/
|
||||||
private String ParkOwner;
|
// private String ParkOwner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 停车场管理方 N
|
* 停车场管理方 N
|
||||||
* 停车场管理人(如:XX 物业)
|
* 停车场管理人(如:XX 物业)
|
||||||
*/
|
*/
|
||||||
private String ParkManager;
|
// private String ParkManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全天开放 Y
|
* 全天开放 Y
|
||||||
@@ -210,7 +212,7 @@ public class StationInfo {
|
|||||||
* 营业时间 N
|
* 营业时间 N
|
||||||
* 营业时间描述,推荐格式:周一至周日00:00-24:00
|
* 营业时间描述,推荐格式:周一至周日00:00-24:00
|
||||||
*/
|
*/
|
||||||
private String BusinessHours;
|
// private String BusinessHours;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最低单价 Y
|
* 最低单价 Y
|
||||||
@@ -240,7 +242,7 @@ public class StationInfo {
|
|||||||
* 停车费 N
|
* 停车费 N
|
||||||
* 停车费率描述
|
* 停车费率描述
|
||||||
*/
|
*/
|
||||||
private String ParkFee;
|
// private String ParkFee;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付方式 Y
|
* 支付方式 Y
|
||||||
@@ -258,13 +260,13 @@ public class StationInfo {
|
|||||||
* 备注 N
|
* 备注 N
|
||||||
* 其他备注信息
|
* 其他备注信息
|
||||||
*/
|
*/
|
||||||
private String Remark;
|
// private String Remark;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 充电设备信息列表 Y
|
* 充电设备信息列表 Y
|
||||||
* 该充电站所有充电设备信息对象集合
|
* 该充电站所有充电设备信息对象集合
|
||||||
*/
|
*/
|
||||||
private List<EquipmentInfo> equipmentInfos;
|
private List<EquipmentInfo> EquipmentInfos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 停车收费类型 Y
|
* 停车收费类型 Y
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
package com.jsowell.thirdparty.service;
|
package com.jsowell.thirdparty.service;
|
||||||
|
|
||||||
import com.jsowell.pile.dto.LianLianGetTokenDTO;
|
import com.jsowell.pile.dto.*;
|
||||||
import com.jsowell.pile.dto.QueryEquipmentDTO;
|
|
||||||
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
|
||||||
import com.jsowell.thirdparty.domain.StationStatsInfo;
|
import com.jsowell.thirdparty.domain.StationStatsInfo;
|
||||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
|
||||||
import com.jsowell.thirdparty.vo.*;
|
import com.jsowell.thirdparty.vo.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -21,7 +18,7 @@ public interface LianLianService {
|
|||||||
* 根据充电站id,推送充电站信息
|
* 根据充电站id,推送充电站信息
|
||||||
* @param stationId
|
* @param stationId
|
||||||
*/
|
*/
|
||||||
void pushStationInfo(Long stationId) throws Exception;
|
void pushStationInfo(LianLianPushStationInfoDTO dto);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 联联平台获取充电站信息
|
* 联联平台获取充电站信息
|
||||||
@@ -75,5 +72,10 @@ public interface LianLianService {
|
|||||||
*/
|
*/
|
||||||
QueryStopChargeVO query_stop_charge(QueryStartChargeDTO dto);
|
QueryStopChargeVO query_stop_charge(QueryStartChargeDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联联平台获取令牌
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
String getToken(LianLianGetTokenDTO dto);
|
String getToken(LianLianGetTokenDTO dto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
package com.jsowell.thirdparty.service.impl;
|
package com.jsowell.thirdparty.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.PageUtil;
|
import cn.hutool.core.util.PageUtil;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.jsowell.common.constant.Constants;
|
import com.jsowell.common.constant.Constants;
|
||||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||||
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
import com.jsowell.common.enums.ykc.OrderStatusEnum;
|
||||||
@@ -22,10 +25,7 @@ import com.jsowell.netty.command.ykc.StartChargingCommand;
|
|||||||
import com.jsowell.netty.command.ykc.StopChargingCommand;
|
import com.jsowell.netty.command.ykc.StopChargingCommand;
|
||||||
import com.jsowell.netty.service.yunkuaichong.YKCPushCommandService;
|
import com.jsowell.netty.service.yunkuaichong.YKCPushCommandService;
|
||||||
import com.jsowell.pile.domain.*;
|
import com.jsowell.pile.domain.*;
|
||||||
import com.jsowell.pile.dto.LianLianGetTokenDTO;
|
import com.jsowell.pile.dto.*;
|
||||||
import com.jsowell.pile.dto.QueryEquipmentDTO;
|
|
||||||
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
|
||||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
|
||||||
import com.jsowell.pile.service.IOrderBasicInfoService;
|
import com.jsowell.pile.service.IOrderBasicInfoService;
|
||||||
import com.jsowell.pile.service.IPileBasicInfoService;
|
import com.jsowell.pile.service.IPileBasicInfoService;
|
||||||
import com.jsowell.pile.service.IPileConnectorInfoService;
|
import com.jsowell.pile.service.IPileConnectorInfoService;
|
||||||
@@ -98,24 +98,30 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据站点id推送站点信息
|
* 根据站点id推送站点信息
|
||||||
* @param stationId
|
* @param dto
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void pushStationInfo(Long stationId) throws Exception {
|
public void pushStationInfo(LianLianPushStationInfoDTO dto){
|
||||||
|
// String OperatorID = "987654321";
|
||||||
|
// String SigSecret = "1234567890abcdef"; // 签名秘钥
|
||||||
|
// String DataSecret = "1234567890abcdef"; // 消息密钥
|
||||||
|
// String DataSecretIV = "1234567890abcdef"; // 消息密钥初始化向量
|
||||||
|
// String token = "c548f9276c1c4ea8b88b1f7b1eb7cf07"; //QueryToken类查询接口获取到的token
|
||||||
|
|
||||||
// 通过id查询站点相关信息
|
// 通过id查询站点相关信息
|
||||||
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(stationId);
|
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(dto.getStationId());
|
||||||
// 组装联联平台所需要的数据格式
|
// 组装联联平台所需要的数据格式
|
||||||
StationInfo info = StationInfo.builder()
|
StationInfo info = StationInfo.builder()
|
||||||
.StationID(String.valueOf(stationId))
|
.StationID(String.valueOf(dto.getStationId()))
|
||||||
.OperatorID(Constants.OPERATORID_LIANLIAN)
|
.OperatorID(dto.getOperatorID())
|
||||||
.EquipmentOwnerID(Constants.OPERATORID_LIANLIAN)
|
.EquipmentOwnerID(dto.getOperatorID())
|
||||||
.StationName(pileStationInfo.getStationName())
|
.StationName(pileStationInfo.getStationName())
|
||||||
.IsAloneApply(Integer.valueOf(pileStationInfo.getAloneApply()))
|
.IsAloneApply(Integer.valueOf(pileStationInfo.getAloneApply()))
|
||||||
.IsPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking()))
|
.IsPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking()))
|
||||||
.CountryCode(pileStationInfo.getCountryCode())
|
.CountryCode(pileStationInfo.getCountryCode())
|
||||||
.AreaCode(pileStationInfo.getAreaCode())
|
.AreaCode("310118")
|
||||||
.Address(pileStationInfo.getAddress())
|
.Address(pileStationInfo.getAddress())
|
||||||
.ServiceTel(pileStationInfo.getServiceTel())
|
.ServiceTel(pileStationInfo.getStationTel())
|
||||||
.StationType(Integer.valueOf(pileStationInfo.getStationType()))
|
.StationType(Integer.valueOf(pileStationInfo.getStationType()))
|
||||||
.StationStatus(Integer.valueOf(pileStationInfo.getStationStatus()))
|
.StationStatus(Integer.valueOf(pileStationInfo.getStationStatus()))
|
||||||
.ParkNums(Integer.valueOf(pileStationInfo.getParkNums()))
|
.ParkNums(Integer.valueOf(pileStationInfo.getParkNums()))
|
||||||
@@ -123,15 +129,15 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
.StationLat(new BigDecimal(pileStationInfo.getStationLat()))
|
.StationLat(new BigDecimal(pileStationInfo.getStationLat()))
|
||||||
.Construction(Integer.valueOf(pileStationInfo.getConstruction()))
|
.Construction(Integer.valueOf(pileStationInfo.getConstruction()))
|
||||||
.OpenAllDay(Integer.valueOf(pileStationInfo.getOpenAllDay()))
|
.OpenAllDay(Integer.valueOf(pileStationInfo.getOpenAllDay()))
|
||||||
// .MinElectricityPrice()
|
.MinElectricityPrice(new BigDecimal("2"))
|
||||||
// .ElectricityFee()
|
.ElectricityFee("2")
|
||||||
// .ServiceFee()
|
.ServiceFee("2")
|
||||||
.ParkFree(Integer.valueOf(pileStationInfo.getParkFree()))
|
.ParkFree(Integer.valueOf(pileStationInfo.getParkFree()))
|
||||||
// .ParkFee()
|
// .ParkFee("2")
|
||||||
.Payment(pileStationInfo.getPayment())
|
.Payment("线上")
|
||||||
.SupportOrder(Integer.valueOf(pileStationInfo.getSupportOrder()))
|
.SupportOrder(Integer.valueOf(pileStationInfo.getSupportOrder()))
|
||||||
// .equipmentInfos()
|
// .equipmentInfos()
|
||||||
// .ParkFeeType()
|
.ParkFeeType(0)
|
||||||
.ToiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag()))
|
.ToiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag()))
|
||||||
.StoreFlag(Integer.valueOf(pileStationInfo.getStoreFlag()))
|
.StoreFlag(Integer.valueOf(pileStationInfo.getStoreFlag()))
|
||||||
.RestaurantFlag(Integer.valueOf(pileStationInfo.getRestaurantFlag()))
|
.RestaurantFlag(Integer.valueOf(pileStationInfo.getRestaurantFlag()))
|
||||||
@@ -149,14 +155,60 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 调用联联平台接口
|
// 调用联联平台接口
|
||||||
String url = "http://dataexchange.evchargeonline.com:81/shevcs/v1/" + "notification_stationInfo";
|
String url = "http://testdataexchange.evchargeonline.com:82/shevcs/v1/" + "notification_stationInfo";
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
// String jsonString = JSON.toJSONString(info);
|
||||||
// Map<String, Object> map = new HashMap<>();
|
|
||||||
jsonObject.put("StationInfo", info);
|
|
||||||
String s = HttpUtils.sendPost(url, jsonObject.toJSONString());
|
|
||||||
|
|
||||||
System.out.println(s);
|
// Gson gson = new Gson();
|
||||||
|
// String gsonString = gson.toJson(info);
|
||||||
|
|
||||||
|
String jsonStr = JSONUtil.toJsonStr(info);
|
||||||
|
|
||||||
|
// System.out.println("jsonString : " + jsonString);
|
||||||
|
// System.out.println("gsonString : " + gsonString);
|
||||||
|
System.out.println("jsonStr : " + jsonStr);
|
||||||
|
|
||||||
|
JSONObject data = new JSONObject();
|
||||||
|
data.put("StationInfo", jsonStr);
|
||||||
|
|
||||||
|
String jsonString = JSONObject.toJSONString(data);
|
||||||
|
System.out.println("jsonString : " + jsonString);
|
||||||
|
|
||||||
|
//加密
|
||||||
|
byte[] encryptText = Cryptos.aesEncrypt(jsonString.getBytes(),
|
||||||
|
dto.getDataSecret().getBytes(), dto.getDataSecretIV().getBytes());
|
||||||
|
String encryptData = Encodes.encodeBase64(encryptText);
|
||||||
|
System.out.println("加密数据:" + encryptData);
|
||||||
|
|
||||||
|
Map<String, String> params = Maps.newLinkedHashMap();
|
||||||
|
params.put("OperatorID", dto.getOperatorID());
|
||||||
|
params.put("Data", encryptData);
|
||||||
|
params.put("TimeStamp", "20230510145200");
|
||||||
|
params.put("Seq", "001");
|
||||||
|
String sign = GBSignUtils.sign(params, dto.getSigSecret());
|
||||||
|
params.put("Sig", sign);
|
||||||
|
|
||||||
|
String postData = JSON.toJSONString(params);
|
||||||
|
System.out.println("最终提交数据:" + postData);
|
||||||
|
|
||||||
|
String hutoolRequest = HttpRequest.post(url).header("Authorization", "Bearer " + dto.getToken()).body(postData).execute().body();
|
||||||
|
|
||||||
|
System.out.println("接收到返回数据:" + hutoolRequest);
|
||||||
|
|
||||||
|
Map<String, String> map = (Map<String, String>) JSON.parse(hutoolRequest);
|
||||||
|
|
||||||
|
String rData = map.get("Data");
|
||||||
|
|
||||||
|
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(rData),
|
||||||
|
dto.getDataSecret().getBytes(), dto.getDataSecretIV().getBytes());
|
||||||
|
String plainData = "";
|
||||||
|
try {
|
||||||
|
plainData = new String(plainText, "UTF-8");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("解密数据:" + plainData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +246,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
stationInfo.setCountryCode(pileStationInfo.getCountryCode());
|
stationInfo.setCountryCode(pileStationInfo.getCountryCode());
|
||||||
stationInfo.setAreaCode(pileStationInfo.getAreaCode());
|
stationInfo.setAreaCode(pileStationInfo.getAreaCode());
|
||||||
stationInfo.setAddress(pileStationInfo.getAddress());
|
stationInfo.setAddress(pileStationInfo.getAddress());
|
||||||
stationInfo.setServiceTel(pileStationInfo.getServiceTel());
|
stationInfo.setServiceTel(pileStationInfo.getStationTel());
|
||||||
stationInfo.setStationType(Integer.valueOf(pileStationInfo.getStationType()));
|
stationInfo.setStationType(Integer.valueOf(pileStationInfo.getStationType()));
|
||||||
stationInfo.setParkNums(Integer.valueOf(pileStationInfo.getParkNums()));
|
stationInfo.setParkNums(Integer.valueOf(pileStationInfo.getParkNums()));
|
||||||
stationInfo.setStationLng(new BigDecimal(pileStationInfo.getStationLng()));
|
stationInfo.setStationLng(new BigDecimal(pileStationInfo.getStationLng()));
|
||||||
@@ -645,14 +697,14 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
|
|
||||||
equipmentInfo.setEquipmentID(pileSn);
|
equipmentInfo.setEquipmentID(pileSn);
|
||||||
equipmentInfo.setManufacturerID(merchantInfo.getOrganizationCode());
|
equipmentInfo.setManufacturerID(merchantInfo.getOrganizationCode());
|
||||||
equipmentInfo.setConstructionTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, pileBasicInfo.getCreateTime()));
|
equipmentInfo.setConstructionTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, pileBasicInfo.getCreateTime()));
|
||||||
|
|
||||||
PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn);
|
PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn);
|
||||||
equipmentInfo.setEquipmentType(Integer.valueOf(modelInfo.getSpeedType()));
|
equipmentInfo.setEquipmentType(Integer.valueOf(modelInfo.getSpeedType()));
|
||||||
|
|
||||||
// Map<String, String> pileStatus = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileBasicInfo.getSn()));
|
// Map<String, String> pileStatus = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileBasicInfo.getSn()));
|
||||||
equipmentInfo.setEquipmentStatus(50);
|
equipmentInfo.setEquipmentStatus(50);
|
||||||
equipmentInfo.setEquipmentPower(new BigDecimal(modelInfo.getRatedPower()));
|
equipmentInfo.setEquipmentPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP));
|
||||||
equipmentInfo.setNewNationalStandard(1);
|
equipmentInfo.setNewNationalStandard(1);
|
||||||
equipmentInfo.setVinFlag(1);
|
equipmentInfo.setVinFlag(1);
|
||||||
|
|
||||||
@@ -686,7 +738,7 @@ public class LianLianServiceImpl implements LianLianService {
|
|||||||
connectorInfo.setVoltageUpperLimits(Integer.valueOf(modelInfo.getRatedVoltage()));
|
connectorInfo.setVoltageUpperLimits(Integer.valueOf(modelInfo.getRatedVoltage()));
|
||||||
connectorInfo.setVoltageLowerLimits(Integer.valueOf(modelInfo.getRatedVoltage()));
|
connectorInfo.setVoltageLowerLimits(Integer.valueOf(modelInfo.getRatedVoltage()));
|
||||||
connectorInfo.setCurrent(Integer.valueOf(modelInfo.getRatedCurrent()));
|
connectorInfo.setCurrent(Integer.valueOf(modelInfo.getRatedCurrent()));
|
||||||
connectorInfo.setPower(new BigDecimal(modelInfo.getRatedPower()));
|
connectorInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP));
|
||||||
|
|
||||||
resultList.add(connectorInfo);
|
resultList.add(connectorInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user