Merge branch 'dev' into HuiFu

This commit is contained in:
2023-05-16 14:22:34 +08:00
16 changed files with 554 additions and 327 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

@@ -229,66 +229,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);
}

View File

@@ -0,0 +1,41 @@
package com.jsowell.common.enums;
/**
* 联联平台桩状态
*
* @author JS-ZZA
* @date 2023/5/16 9:39
*/
public enum LianLianPileStatusEnum {
UNKNOWN("0", "未知"),
CONSTRUCTION("1", "建设中"),
CLOSE_OFFLINE("5", "关闭下线"),
UNDER_MAINTENANCE("6", "维护中"),
NORMAL("50", "正常"),
;
private String code;
private String value;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
LianLianPileStatusEnum(String code, String value) {
this.code = code;
this.value = value;
}
}

View File

@@ -0,0 +1,52 @@
package com.jsowell.common.enums;
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
/**
* 站点 支付方式
*
* @author JS-ZZA
* @date 2023/5/16 9:17
*/
public enum StationPaymentEnum {
CARD_PAYMENT("0", "刷卡"),
ONLINE_PAYMENT("1", "线上"),
CASH_PAYMENT("2", "现金"),
;
private String code;
private String value;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
StationPaymentEnum(String code, String value) {
this.code = code;
this.value = value;
}
StationPaymentEnum() {
}
public static String getPaymentByCode(String code) {
for (StationPaymentEnum paymentEnum : StationPaymentEnum.values()) {
if (paymentEnum.getValue().equals(code)) {
return paymentEnum.getValue();
}
}
return "";
}
}

View File

@@ -193,6 +193,9 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
long chargingTime = DateUtils.intervalTime("2023-02-24 16:00:00", "2023-02-24 17:03:06");
System.out.println(chargingTime);
String dateToStr = DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, new Date());
System.out.println(dateToStr);
}
/**

View File

@@ -1,5 +1,9 @@
package com.jsowell.common.util.lianlian;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson2.JSON;
import com.google.common.collect.Maps;
import com.jsowell.common.util.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
@@ -10,6 +14,9 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import java.util.Date;
import java.util.Map;
/**
* @author 联联充电
*/
@@ -81,5 +88,55 @@ public class HttpRequestUtil {
return null;
}
/**
* 联联平台发送请求
*
* @param token 联联平台令牌
* @param data 要传输的JsonString格式数据
* @param url 请求地址
* @param dataSecret 消息密钥
* @param dataSecretIV 消息密钥初始化向量
* @param operatorId 运营商id
* @param sigSecret 签名密钥
* @return
*/
public static String sendPost(String token, String data, String url, String dataSecret,
String dataSecretIV, String operatorId, String sigSecret){
//加密
byte[] encryptText = Cryptos.aesEncrypt(data.getBytes(),
dataSecret.getBytes(), dataSecretIV.getBytes());
String encryptData = Encodes.encodeBase64(encryptText);
System.out.println("加密数据:" + encryptData);
Map<String, String> params = Maps.newLinkedHashMap();
params.put("OperatorID", operatorId);
params.put("Data", encryptData);
params.put("TimeStamp", DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, new Date()));
params.put("Seq", "001");
String sign = GBSignUtils.sign(params, sigSecret);
params.put("Sig", sign);
String postData = JSON.toJSONString(params);
System.out.println("最终提交数据:" + postData);
String hutoolRequest = HttpRequest.post(url).header("Authorization", "Bearer " + token).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),
dataSecret.getBytes(), dataSecretIV.getBytes());
String plainData = "";
try {
plainData = new String(plainText, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("解密数据:" + plainData);
return plainData;
}
}

View File

@@ -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;
}

View File

@@ -1,5 +1,6 @@
package com.jsowell.thirdparty.domain;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -19,12 +20,13 @@ public class ConnectorInfo {
* 充电设备接口编码 Y
* 充电设备接口编码,同一对接平台内唯一
*/
private String ConnectorID;
@JSONField(name = "ConnectorID")
private String connectorID;
/**
* 充电设备接口名称 N
*/
private String ConnectorName;
// private String ConnectorName;
/**
* 充电设备接口类型 Y
@@ -33,32 +35,37 @@ public class ConnectorInfo {
* 3交流接口插头带枪线模式3连接方式C
* 4直流接口枪头带枪线模式4
*/
private Integer ConnectorType;
@JSONField(name = "ConnectorType")
private Integer connectorType;
/**
* 额定电压上限(单位V) Y
*/
private Integer VoltageUpperLimits;
@JSONField(name = "VoltageUpperLimits")
private Integer voltageUpperLimits;
/**
* 额定电压下限(单位V) Y
*/
private Integer VoltageLowerLimits;
@JSONField(name = "VoltageLowerLimits")
private Integer voltageLowerLimits;
/**
* 额定电流(单位A) Y
*/
private Integer Current;
@JSONField(name = "Current")
private Integer current;
/**
* 额定功率(单位kW) Y
*/
private BigDecimal Power;
@JSONField(name = "Power")
private BigDecimal power;
/**
* 车位号 N
* 停车场车位编号
*/
private String ParkNo;
// private String ParkNo;
}

View File

@@ -1,5 +1,6 @@
package com.jsowell.thirdparty.domain;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@@ -20,40 +21,44 @@ public class EquipmentInfo {
* 设备编码 Y
* 设备唯一编码,对同一对接平台,保证唯一
*/
private String EquipmentID;
@JSONField(name = "EquipmentID")
private String equipmentID;
/**
* 设备生产商组织机构代码 Y
*/
private String ManufacturerID;
@JSONField(name = "ManufacturerID")
private String manufacturerID;
/**
* 设备型号 N
* 由设备生厂商定义的设备型号
*/
private String EquipmentModel;
// private String EquipmentModel;
/**
* 设备名称 N
*/
private String EquipmentName;
// private String EquipmentName;
/**
* 设备生产日期 N
* YYYY-MM-DD
*/
private String ProductionDate;
// private String ProductionDate;
/**
* 建设时间 Y
* YYYY-MM-DD
*/
private String ConstructionTime;
@JSONField(name = "ConstructionTime")
private String constructionTime;
/**
* 设备类型(1-直流设备2-交流设备3-交直流一体设备) Y
*/
private Integer EquipmentType;
@JSONField(name = "EquipmentType")
private Integer equipmentType;
/**
* 设备状态 Y
@@ -63,40 +68,45 @@ public class EquipmentInfo {
* 6维护中
* 50正常使用
*/
private Integer EquipmentStatus;
@JSONField(name = "EquipmentStatus")
private Integer equipmentStatus;
/**
* 额定功率(单位kW) Y
*/
private BigDecimal EquipmentPower;
@JSONField(name = "EquipmentPower")
private BigDecimal equipmentPower;
/**
* 新国标(0-否1-是) Y
* 是否新国标
*/
private Integer NewNationalStandard;
@JSONField(name = "NewNationalStandard")
private Integer newNationalStandard;
/**
* 充电设备接口列表 Y
* 该充电设备所有的充电设备接口的信息对象集合
*/
private List<ConnectorInfo> ConnectorInfos;
@JSONField(name = "ConnectorInfos")
private List<ConnectorInfo> connectorInfos;
/**
* 充电设备经度 N
* GCJ-02坐标系
*/
private BigDecimal EquipmentLng;
// private BigDecimal EquipmentLng;
/**
* 充电设备纬度 N
* GCJ-02坐标系
*/
private BigDecimal EquipmentLat;
// private BigDecimal EquipmentLat;
/**
* 是否支持VIN码识别(0-否1-是) Y
*/
private Integer VinFlag;
@JSONField(name = "VinFlag")
private Integer vinFlag;
}

View File

@@ -1,10 +1,12 @@
package com.jsowell.thirdparty.domain;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.math.BigDecimal;
import java.util.List;
@@ -21,84 +23,94 @@ public class StationInfo {
* 充电站ID Y
* 对接平台自定义的唯一编码
*/
private String StationID;
@JSONField(name = "StationID")
private String stationID;
/**
* 对接平台ID Y
* 组织机构代码
*/
private String OperatorID;
@JSONField(name = "OperatorID")
private String operatorID;
/**
* 设备所属运营商ID Y
* 设备所属运营商组织机构代码
*/
private String EquipmentOwnerID;
@JSONField(name = "EquipmentOwnerID")
private String equipmentOwnerID;
/**
* 充电站名称 Y
* 充电站名称的描述
*/
private String StationName;
@JSONField(name = "StationName")
private String stationName;
/**
* 是否独立报桩 (0-否;1-是) Y
* 如果是独立报桩需要填写户号以及容量
*/
private Integer IsAloneApply;
@JSONField(name = "IsAloneApply")
private Integer isAloneApply;
/**
* 户号 N
* 国网电费账单户号
*/
private String AccountNumber;
// private String AccountNumber;
/**
* 容量(单位KW) N
* 独立电表申请的功率
*/
private BigDecimal Capacity;
// private BigDecimal Capacity;
/**
* 是否是公共停车场库 (0-否;1-是) Y
* 如果是公共停车场库需要填写场库编号
*/
private Integer IsPublicParkingLot;
@JSONField(name = "IsPublicParkingLot")
private Integer isPublicParkingLot;
/**
* 停车场库编号 N
* 公共停车场库编号
*/
private String ParkingLotNumber;
// private String ParkingLotNumber;
/**
* 充电站国家代码 Y
* 比如CN
*/
private String CountryCode;
@JSONField(name = "CountryCode")
private String countryCode;
/**
* 充电站省市辖区编码 Y
* 填写内容为参照 GB/T2260-2015
*/
private String AreaCode;
@JSONField(name = "AreaCode")
private String areaCode;
/**
* 详细地址 Y
*/
private String Address;
@JSONField(name = "Address")
private String address;
/**
* 站点电话 N
* 能够联系场站工作人员进行协助的联系电话
*/
private String StationTel;
// private String StationTel;
/**
* 服务电话 Y
* 平台服务电话例如400 的电话
*/
private String ServiceTel;
@JSONField(name = "ServiceTel")
private String serviceTel;
/**
* 站点类型 Y
@@ -113,7 +125,8 @@ public class StationInfo {
* 106-单位(专用)
* 255-其他
*/
private Integer StationType;
@JSONField(name = "StationType")
private Integer stationType;
/**
* 站点状态 Y
@@ -123,31 +136,35 @@ public class StationInfo {
* 6维护中
* 50正常使用
*/
private Integer StationStatus;
@JSONField(name = "StationStatus")
private Integer stationStatus;
/**
* 车位数量 Y
* 可停放进行充电的车位总数(默认0-未知)
*/
private Integer ParkNums;
@JSONField(name = "ParkNums")
private Integer parkNums;
/**
* 经度 Y
* GCJ-02坐标系
*/
private BigDecimal StationLng;
@JSONField(name = "StationLng")
private BigDecimal stationLng;
/**
* 纬度 Y
* GCJ-02坐标系
*/
private BigDecimal StationLat;
@JSONField(name = "StationLat")
private BigDecimal stationLat;
/**
* 站点引导 N
* 描述性文字,用于引导车主找到充电车位
*/
private String SiteGuide;
// private String SiteGuide;
/**
* 建设场所 Y
@@ -168,102 +185,111 @@ public class StationInfo {
* 15出租车
* 255其他
*/
private Integer Construction;
@JSONField(name = "Construction")
private Integer construction;
/**
* 站点照片 N
* 充电设备照片、充电车位照片、停车场入口照片
*/
private List<String> Pictures;
// private List<String> Pictures;
/**
* 使用车型描述 N
* 描述该站点接受的车大小以及类型,如大巴、物流车、私家乘用车、出租车等
*/
private String MatchCars;
// private String MatchCars;
/**
* 车位楼层及数量描述 N
* 车位楼层以及数量信息
*/
private String ParkInfo;
// private String ParkInfo;
/**
* 停车场产权方 N
* 停车场产权人
*/
private String ParkOwner;
// private String ParkOwner;
/**
* 停车场管理方 N
* 停车场管理人XX 物业)
*/
private String ParkManager;
// private String ParkManager;
/**
* 全天开放 Y
* 是否全天开放(0-否1-是),如果为0则营业时间必填
*/
private Integer OpenAllDay;
@JSONField(name = "OpenAllDay")
private Integer openAllDay;
/**
* 营业时间 N
* 营业时间描述,推荐格式周一至周日00:00-24:00
*/
private String BusinessHours;
// private String BusinessHours;
/**
* 最低单价 Y
* 最低充电电费率
*/
private BigDecimal MinElectricityPrice;
@JSONField(name = "MinElectricityPrice")
private BigDecimal minElectricityPrice;
/**
* 充电电费率 Y
* 充电费描述,推荐格式XX 元/度
*/
private String ElectricityFee;
@JSONField(name = "ElectricityFee")
private String electricityFee;
/**
* 服务费率 Y
* 服务费率描述,推荐格式XX 元/度
*/
private String ServiceFee;
@JSONField(name = "ServiceFee")
private String serviceFee;
/**
* 免费停车 Y
* 是否停车免费(0-否1-是)
*/
private Integer ParkFree;
@JSONField(name = "ParkFree")
private Integer parkFree;
/**
* 停车费 N
* 停车费率描述
*/
private String ParkFee;
// private String ParkFee;
/**
* 支付方式 Y
* 支付方式:刷卡、线上、现金 其中电子钱包类卡为刷卡,身份鉴权卡、微信/ 支付宝、APP为线上
*/
private String Payment;
@JSONField(name = "Payment")
private String payment;
/**
* 是否支持预约 Y
* 充电设备是否需要提前预约后才能使用。(0-不支持预约;1-支持预约) 不填默认为0
*/
private Integer SupportOrder;
@JSONField(name = "SupportOrder")
private Integer supportOrder;
/**
* 备注 N
* 其他备注信息
*/
private String Remark;
// private String Remark;
/**
* 充电设备信息列表 Y
* 该充电站所有充电设备信息对象集合
*/
@JSONField(name = "EquipmentInfos")
private List<EquipmentInfo> equipmentInfos;
/**
@@ -273,46 +299,55 @@ public class StationInfo {
* 2:限时免费;
* 3:充电限免
*/
private Integer ParkFeeType;
@JSONField(name = "ParkFeeType")
private Integer parkFeeType;
/**
* 是否靠近卫生间(0-否1-是) Y
*/
private Integer ToiletFlag;
@JSONField(name = "ToiletFlag")
private Integer toiletFlag;
/**
* 是否靠近便利店(0-否1-是) Y
*/
private Integer StoreFlag;
@JSONField(name = "StoreFlag")
private Integer storeFlag;
/**
* 是否靠近餐厅(0-否1-是) Y
*/
private Integer RestaurantFlag;
@JSONField(name = "RestaurantFlag")
private Integer restaurantFlag;
/**
* 是否靠近休息室(0-否1-是) Y
*/
private Integer LoungeFlag;
@JSONField(name = "LoungeFlag")
private Integer loungeFlag;
/**
* 是否有雨棚(0-否1-是) Y
*/
private Integer CanopyFlag;
@JSONField(name = "CanopyFlag")
private Integer canopyFlag;
/**
* 是否有小票机(0-否1-是) Y
*/
private Integer PrinterFlag;
@JSONField(name = "PrinterFlag")
private Integer printerFlag;
/**
* 是否有道闸(0-否1-是) Y
*/
private Integer BarrierFlag;
@JSONField(name = "BarrierFlag")
private Integer barrierFlag;
/**
* 是否有地锁(0-否1-是) Y
*/
private Integer ParkingLockFlag;
@JSONField(name = "ParkingLockFlag")
private Integer parkingLockFlag;
}

View File

@@ -1,10 +1,7 @@
package com.jsowell.thirdparty.service;
import com.jsowell.pile.dto.LianLianGetTokenDTO;
import com.jsowell.pile.dto.QueryEquipmentDTO;
import com.jsowell.pile.dto.QueryStartChargeDTO;
import com.jsowell.pile.dto.*;
import com.jsowell.thirdparty.domain.StationStatsInfo;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.thirdparty.vo.*;
import java.util.List;
@@ -21,7 +18,7 @@ public interface LianLianService {
* 根据充电站id推送充电站信息
* @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);
/**
* 联联平台获取令牌
* @param dto
* @return
*/
String getToken(LianLianGetTokenDTO dto);
}

View File

@@ -9,23 +9,19 @@ import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
import com.jsowell.common.enums.LianLianPileStatusEnum;
import com.jsowell.common.enums.StationPaymentEnum;
import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum;
import com.jsowell.common.enums.ykc.PileStatusEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.*;
import com.jsowell.common.util.http.HttpUtils;
import com.jsowell.common.util.lianlian.Cryptos;
import com.jsowell.common.util.lianlian.Encodes;
import com.jsowell.common.util.lianlian.GBSignUtils;
import com.jsowell.common.util.lianlian.LianLianUtils;
import com.jsowell.common.util.lianlian.*;
import com.jsowell.netty.command.ykc.StartChargingCommand;
import com.jsowell.netty.command.ykc.StopChargingCommand;
import com.jsowell.netty.service.yunkuaichong.YKCPushCommandService;
import com.jsowell.pile.domain.*;
import com.jsowell.pile.dto.LianLianGetTokenDTO;
import com.jsowell.pile.dto.QueryEquipmentDTO;
import com.jsowell.pile.dto.QueryStartChargeDTO;
import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.pile.dto.*;
import com.jsowell.pile.service.IOrderBasicInfoService;
import com.jsowell.pile.service.IPileBasicInfoService;
import com.jsowell.pile.service.IPileConnectorInfoService;
@@ -98,70 +94,83 @@ public class LianLianServiceImpl implements LianLianService {
/**
* 根据站点id推送站点信息
* @param stationId
* @param dto
*/
@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查询站点相关信息
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(stationId);
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(dto.getStationId());
// 组装联联平台所需要的数据格式
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()))
.stationID(String.valueOf(dto.getStationId()))
.operatorID(dto.getOperatorID())
.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.getStationTel())
.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(new BigDecimal(Constants.ZERO))
.electricityFee(Constants.ZERO)
.serviceFee(Constants.ZERO)
.parkFree(Integer.valueOf(pileStationInfo.getParkFree()))
// .ParkFee("2")
// .payment("线上")
.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()))
.parkFeeType(0)
.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();
String payment = StationPaymentEnum.getPaymentByCode(pileStationInfo.getPayment());
info.setPayment(payment);
List<EquipmentInfo> pileList = getPileList(pileStationInfo);
if (CollectionUtils.isNotEmpty(pileList)) {
info.setEquipmentInfos(pileList); // 充电设备信息列表
}
// 调用联联平台接口
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();
// Map<String, Object> map = new HashMap<>();
jsonObject.put("StationInfo", info);
String s = HttpUtils.sendPost(url, jsonObject.toJSONString());
String jsonStr = JSONObject.toJSONString(info);
JSONObject data = new JSONObject();
data.put("StationInfo", jsonStr);
System.out.println(s);
String jsonString = JSONObject.toJSONString(data);
System.out.println("jsonString : " + jsonString);
String result = HttpRequestUtil.sendPost(dto.getToken(), jsonString, url, dto.getDataSecret()
, dto.getDataSecretIV(), dto.getOperatorID(), dto.getSigSecret());
System.out.println(result);
}
public static void main(String[] args) throws Exception {
public static void main(String[] args){
BigDecimal bigDecimal = new BigDecimal("7").setScale(1, BigDecimal.ROUND_HALF_UP);
System.out.println(bigDecimal);
}
/**
@@ -194,7 +203,7 @@ public class LianLianServiceImpl implements LianLianService {
stationInfo.setCountryCode(pileStationInfo.getCountryCode());
stationInfo.setAreaCode(pileStationInfo.getAreaCode());
stationInfo.setAddress(pileStationInfo.getAddress());
stationInfo.setServiceTel(pileStationInfo.getServiceTel());
stationInfo.setServiceTel(pileStationInfo.getStationTel());
stationInfo.setStationType(Integer.valueOf(pileStationInfo.getStationType()));
stationInfo.setParkNums(Integer.valueOf(pileStationInfo.getParkNums()));
stationInfo.setStationLng(new BigDecimal(pileStationInfo.getStationLng()));
@@ -644,15 +653,27 @@ public class LianLianServiceImpl implements LianLianService {
String pileSn = pileBasicInfo.getSn();
equipmentInfo.setEquipmentID(pileSn);
equipmentInfo.setManufacturerID(merchantInfo.getOrganizationCode());
equipmentInfo.setConstructionTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, pileBasicInfo.getCreateTime()));
equipmentInfo.setManufacturerID(Constants.OPERATORID_LIANLIAN);
equipmentInfo.setConstructionTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, pileBasicInfo.getCreateTime()));
PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn);
equipmentInfo.setEquipmentType(Integer.valueOf(modelInfo.getSpeedType()));
// Map<String, String> pileStatus = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileBasicInfo.getSn()));
equipmentInfo.setEquipmentStatus(50);
equipmentInfo.setEquipmentPower(new BigDecimal(modelInfo.getRatedPower()));
Map<String, String> pileStatusMap = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileSn));
String pileStatus = pileStatusMap.get(pileSn);
if (StringUtils.equals(PileStatusEnum.ON_LINE.getValue(), pileStatus)) {
// 1-在线
pileStatus = LianLianPileStatusEnum.NORMAL.getCode();
} else if (StringUtils.equals(PileStatusEnum.OFF_LINE.getValue(), pileStatus)) {
// 2-离线
pileStatus = LianLianPileStatusEnum.CLOSE_OFFLINE.getCode();
} else if (StringUtils.equals(PileStatusEnum.FAULT.getValue(), pileStatus)) {
// 3-故障
pileStatus = LianLianPileStatusEnum.UNDER_MAINTENANCE.getCode();
}
equipmentInfo.setEquipmentStatus(Integer.valueOf(pileStatus));
equipmentInfo.setEquipmentPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP));
equipmentInfo.setNewNationalStandard(1);
equipmentInfo.setVinFlag(1);
@@ -686,7 +707,7 @@ public class LianLianServiceImpl implements LianLianService {
connectorInfo.setVoltageUpperLimits(Integer.valueOf(modelInfo.getRatedVoltage()));
connectorInfo.setVoltageLowerLimits(Integer.valueOf(modelInfo.getRatedVoltage()));
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);
}

View File

@@ -1,59 +1,58 @@
<template>
<div>
<h1>电桩</h1>
<hr />
<el-table
stripe
border
:data="tableData"
style="width: 100%">
<el-table-column
label="序号"
type="index"
>
</el-table-column>
<el-table-column
prop="pileSn"
label="编号">
</el-table-column>
<el-table-column
prop="stationName"
label="名称"
>
</el-table-column>
<el-table-column
prop="stationAddress"
label="电站">
</el-table-column>
<el-table-column
prop="type"
label="接口">
</el-table-column>
<el-table-column
prop="power"
label="功率">
</el-table-column>
<el-table-column
prop="degree"
label="度数">
</el-table-column>
<el-table-column
prop="electricityPrice"
label="电费">
</el-table-column>
<el-table-column
prop="servicePrice"
label="服务费">
</el-table-column>
<el-table-column
prop="chargingNumber"
label="充电次数">
</el-table-column>
</el-table>
<!-- <h1>电桩</h1>-->
<!-- <hr />-->
<!-- <el-table-->
<!-- stripe-->
<!-- border-->
<!-- :data="tableData"-->
<!-- style="width: 100%">-->
<!-- <el-table-column-->
<!-- label="序号"-->
<!-- type="index"-->
<!-- >-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- prop="pileSn"-->
<!-- label="编号">-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- prop="stationName"-->
<!-- label="名称"-->
<!-- >-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- prop="stationAddress"-->
<!-- label="电站">-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- prop="type"-->
<!-- label="接口">-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- prop="power"-->
<!-- label="功率">-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- prop="degree"-->
<!-- label="度数">-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- prop="electricityPrice"-->
<!-- label="电费">-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- prop="servicePrice"-->
<!-- label="服务费">-->
<!-- </el-table-column>-->
<!-- <el-table-column-->
<!-- prop="chargingNumber"-->
<!-- label="充电次数">-->
<!-- </el-table-column>-->
<!-- </el-table>-->
<h1>概况</h1>
<hr />
<el-row :gutter="24">
<el-col :span="4" :xs="24">
<div style="display: flex;justify-content: space-between">
<div class="box">
<div>总充电电量</div>
<div class="box-text">
@@ -66,8 +65,6 @@
</div>
<div class="progress"></div>
</div>
</el-col>
<el-col :span="4" :xs="24">
<div class="box">
<div>总充电费用</div>
<div class="box-text">
@@ -81,8 +78,6 @@
</div>
<div class="progress"></div>
</div>
</el-col>
<el-col :span="4" :xs="24">
<div class="box">
<div>总充电订单数</div>
<div class="box-text">
@@ -95,8 +90,6 @@
</div>
<div class="progress"></div>
</div>
</el-col>
<el-col :span="4" :xs="24">
<div class="box">
<div>总充电设备数量</div>
<div class="box-text">
@@ -109,9 +102,7 @@
</div>
<div class="progress"></div>
</div>
</el-col>
<el-col :span="4" :xs="24" v-hasRole="['admin', 'common']">
<div class="box" >
<div class="box" v-hasRole="['admin', 'common']">
<div>总客户余额</div>
<div class="box-text">
<b class="box-h1">{{ generalSituation.totalMemberAmount }}</b>
@@ -123,8 +114,6 @@
</div>
<div class="progress"></div></div
>
</el-col>
<el-col :span="4" :xs="24">
<div class="box">
<div>总服务费金额</div>
<div class="box-text">
@@ -137,8 +126,7 @@
</div>
<div class="progress"></div>
</div>
</el-col>
</el-row>
</div>
<h1>订单</h1>
<hr />
<el-button style="background-color: #1ab394; color: #ffffff"

View File

@@ -4,8 +4,8 @@
<el-tab-pane label="全部">
<home-index></home-index>
</el-tab-pane>
<el-tab-pane label="今日">今日</el-tab-pane>
<el-tab-pane label="运营数据大屏">运营数据大屏</el-tab-pane>
<!-- <el-tab-pane label="今日">今日</el-tab-pane>-->
<!-- <el-tab-pane label="运营数据大屏">运营数据大屏</el-tab-pane>-->
</el-tabs>
</div>
</template>

View File

@@ -12,14 +12,15 @@
<el-card class="cardStyle">
<h3>开票明细</h3>
<el-descriptions :column="1" border>
<el-descriptions-item label="单位" labelStyle="width: 80px" contentStyle="width: 150px">{{ invoiceTitle.titleName }}</el-descriptions-item>
<el-descriptions-item label="抬头类型">{{ invoiceTitle.titleType }}</el-descriptions-item>
<el-descriptions-item label="名称" labelStyle="width: 80px" contentStyle="width: 150px">{{ invoiceTitle.titleName }}</el-descriptions-item>
<el-descriptions-item label="税号">{{ invoiceTitle.taxId }}</el-descriptions-item>
<el-descriptions-item label="地址">{{ invoiceTitle.unitAddress }}</el-descriptions-item>
</el-descriptions>
<div class="marginTop"></div>
</el-card>
<el-card class="cardStyle">
<h3>申请订单明细</h3>
<h3>关联申请订单明细</h3>
<el-table :data="orderList" border show-summary style="width: 100%">
<el-table-column prop="orderCode" label="订单号" align="center" width="180"></el-table-column>
<el-table-column prop="totalElectricityAmount" align="center" label="电费总金额"></el-table-column>

View File

@@ -31,9 +31,9 @@
<billing ref="billing" :stationId="stationId"/>
</el-tab-pane>
<el-tab-pane label="客户管理" name="member">
角色管理
</el-tab-pane>
<!-- <el-tab-pane label="客户管理" name="member">-->
<!-- 角色管理-->
<!-- </el-tab-pane>-->
<el-tab-pane label="运营管理" name="operation">
<el-form>