diff --git a/jsowell-admin/src/main/java/com/jsowell/lianlian/LianLianController.java b/jsowell-admin/src/main/java/com/jsowell/lianlian/LianLianController.java index 673ac4fa0..a895dbccd 100644 --- a/jsowell-admin/src/main/java/com/jsowell/lianlian/LianLianController.java +++ b/jsowell-admin/src/main/java/com/jsowell/lianlian/LianLianController.java @@ -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); diff --git a/jsowell-admin/src/test/java/SpringBootTestController.java b/jsowell-admin/src/test/java/SpringBootTestController.java index 9b59df99f..8a4d8e07f 100644 --- a/jsowell-admin/src/test/java/SpringBootTestController.java +++ b/jsowell-admin/src/test/java/SpringBootTestController.java @@ -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 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); + + } diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/LianLianPileStatusEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/LianLianPileStatusEnum.java new file mode 100644 index 000000000..eb12ad42f --- /dev/null +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/LianLianPileStatusEnum.java @@ -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; + } + +} diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/StationPaymentEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/StationPaymentEnum.java new file mode 100644 index 000000000..21fd2d30c --- /dev/null +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/StationPaymentEnum.java @@ -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 ""; + } +} diff --git a/jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java b/jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java index 82bd3702a..028e4bef8 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java +++ b/jsowell-common/src/main/java/com/jsowell/common/util/DateUtils.java @@ -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); } /** diff --git a/jsowell-common/src/main/java/com/jsowell/common/util/lianlian/HttpRequestUtil.java b/jsowell-common/src/main/java/com/jsowell/common/util/lianlian/HttpRequestUtil.java index 847e26aa2..8a05d8cab 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/util/lianlian/HttpRequestUtil.java +++ b/jsowell-common/src/main/java/com/jsowell/common/util/lianlian/HttpRequestUtil.java @@ -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 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 map = (Map) 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; + } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/dto/LianLianPushStationInfoDTO.java b/jsowell-pile/src/main/java/com/jsowell/pile/dto/LianLianPushStationInfoDTO.java new file mode 100644 index 000000000..c969c6963 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/dto/LianLianPushStationInfoDTO.java @@ -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; +} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/ConnectorInfo.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/ConnectorInfo.java index e55f3258e..132947aee 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/ConnectorInfo.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/ConnectorInfo.java @@ -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; } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/EquipmentInfo.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/EquipmentInfo.java index 72f5f5e35..45b394f2d 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/EquipmentInfo.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/EquipmentInfo.java @@ -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 ConnectorInfos; + @JSONField(name = "ConnectorInfos") + private List 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; } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/StationInfo.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/StationInfo.java index 23b3a8562..31ad97155 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/StationInfo.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/StationInfo.java @@ -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 Pictures; + // private List 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 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; } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/LianLianService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/LianLianService.java index 94a7860c7..8af4b5414 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/LianLianService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/LianLianService.java @@ -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); } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/impl/LianLianServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/impl/LianLianServiceImpl.java index a526b1f89..809994022 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/impl/LianLianServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/impl/LianLianServiceImpl.java @@ -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 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 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 pileStatus = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileBasicInfo.getSn())); - equipmentInfo.setEquipmentStatus(50); - equipmentInfo.setEquipmentPower(new BigDecimal(modelInfo.getRatedPower())); + Map 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); } diff --git a/jsowell-ui/src/views/homeIndex/homeIndex.vue b/jsowell-ui/src/views/homeIndex/homeIndex.vue index 2d383d470..1ad913110 100644 --- a/jsowell-ui/src/views/homeIndex/homeIndex.vue +++ b/jsowell-ui/src/views/homeIndex/homeIndex.vue @@ -1,144 +1,132 @@ diff --git a/jsowell-ui/src/views/order/invoice/detail.vue b/jsowell-ui/src/views/order/invoice/detail.vue index 183d23243..25ed4a3b5 100644 --- a/jsowell-ui/src/views/order/invoice/detail.vue +++ b/jsowell-ui/src/views/order/invoice/detail.vue @@ -12,14 +12,15 @@

开票明细

- {{ invoiceTitle.titleName }} + {{ invoiceTitle.titleType }} + {{ invoiceTitle.titleName }} {{ invoiceTitle.taxId }} {{ invoiceTitle.unitAddress }}
-

申请订单明细

+

关联申请订单明细

diff --git a/jsowell-ui/src/views/pile/station/detail.vue b/jsowell-ui/src/views/pile/station/detail.vue index 2817ed931..1df31cd23 100644 --- a/jsowell-ui/src/views/pile/station/detail.vue +++ b/jsowell-ui/src/views/pile/station/detail.vue @@ -31,9 +31,9 @@ - - 角色管理 - + + +