From fb260eb68dc715113e77686c8a44caa21b7ce596 Mon Sep 17 00:00:00 2001 From: Lemon Date: Mon, 15 May 2023 10:30:16 +0800 Subject: [PATCH 1/7] =?UTF-8?q?update=20=E8=81=94=E8=81=94=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsowell/lianlian/LianLianController.java | 5 +- .../test/java/SpringBootTestController.java | 69 +++-------- .../netty/handler/LoginRequestHandler.java | 1 - .../pile/dto/LianLianPushStationInfoDTO.java | 48 ++++++++ .../thirdparty/domain/ConnectorInfo.java | 5 +- .../thirdparty/domain/EquipmentInfo.java | 11 +- .../thirdparty/domain/StationInfo.java | 30 ++--- .../thirdparty/service/LianLianService.java | 12 +- .../service/impl/LianLianServiceImpl.java | 108 +++++++++++++----- 9 files changed, 178 insertions(+), 111 deletions(-) create mode 100644 jsowell-pile/src/main/java/com/jsowell/pile/dto/LianLianPushStationInfoDTO.java 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 a67e6a328..4ced984c4 100644 --- a/jsowell-admin/src/test/java/SpringBootTestController.java +++ b/jsowell-admin/src/test/java/SpringBootTestController.java @@ -159,66 +159,27 @@ public class SpringBootTestController { } @Test - public void testLianLian() throws Exception { - // Long stationId = 2L; - // // 通过id查询站点相关信息 - // PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(stationId); - // // 组装联联平台所需要的数据格式 - // StationInfo info = StationInfo.builder() - // .StationID(String.valueOf(stationId)) - // .OperatorID(Constants.OPERATORID_LIANLIAN) - // .EquipmentOwnerID(Constants.OPERATORID_LIANLIAN) - // .StationName(pileStationInfo.getStationName()) - // .IsAloneApply(Integer.valueOf(pileStationInfo.getAloneApply())) - // .IsPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking())) - // .CountryCode(pileStationInfo.getCountryCode()) - // .AreaCode(pileStationInfo.getAreaCode()) - // .Address(pileStationInfo.getAddress()) - // .ServiceTel(pileStationInfo.getServiceTel()) - // .StationType(Integer.valueOf(pileStationInfo.getStationType())) - // .StationStatus(Integer.valueOf(pileStationInfo.getStationStatus())) - // .ParkNums(Integer.valueOf(pileStationInfo.getParkNums())) - // .StationLng(new BigDecimal(pileStationInfo.getStationLng())) - // .StationLat(new BigDecimal(pileStationInfo.getStationLat())) - // .Construction(Integer.valueOf(pileStationInfo.getConstruction())) - // .OpenAllDay(Integer.valueOf(pileStationInfo.getOpenAllDay())) - // // .MinElectricityPrice() - // // .ElectricityFee() - // // .ServiceFee() - // .ParkFree(Integer.valueOf(pileStationInfo.getParkFree())) - // // .ParkFee() - // .Payment(pileStationInfo.getPayment()) - // .SupportOrder(Integer.valueOf(pileStationInfo.getSupportOrder())) - // // .equipmentInfos() - // // .ParkFeeType() - // .ToiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag())) - // .StoreFlag(Integer.valueOf(pileStationInfo.getStoreFlag())) - // .RestaurantFlag(Integer.valueOf(pileStationInfo.getRestaurantFlag())) - // .LoungeFlag(Integer.valueOf(pileStationInfo.getLoungeFlag())) - // .CanopyFlag(Integer.valueOf(pileStationInfo.getCanopyFlag())) - // .PrinterFlag(Integer.valueOf(pileStationInfo.getPrinterFlag())) - // .BarrierFlag(Integer.valueOf(pileStationInfo.getBarrierFlag())) - // .ParkingLockFlag(Integer.valueOf(pileStationInfo.getParkingLockFlag())) - // - // .build(); - - // List 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-netty/src/main/java/com/jsowell/netty/handler/LoginRequestHandler.java b/jsowell-netty/src/main/java/com/jsowell/netty/handler/LoginRequestHandler.java index 33817202b..674ea1a49 100644 --- a/jsowell-netty/src/main/java/com/jsowell/netty/handler/LoginRequestHandler.java +++ b/jsowell-netty/src/main/java/com/jsowell/netty/handler/LoginRequestHandler.java @@ -169,7 +169,6 @@ public class LoginRequestHandler extends AbstractHandler{ ProofreadTimeCommand command = ProofreadTimeCommand.builder().pileSn(pileSn).build(); ykcPushCommandService.pushProofreadTimeCommand(command); }); - // log.info("下面进行下发二维码 pileSn:{}, thread:{}", pileSn, Thread.currentThread().getName()); CompletableFuture.runAsync(() -> { try { 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..bec786cc9 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; @@ -24,7 +25,7 @@ public class ConnectorInfo { /** * 充电设备接口名称 N */ - private String ConnectorName; + // private String ConnectorName; /** * 充电设备接口类型 Y @@ -59,6 +60,6 @@ public class ConnectorInfo { * 车位号 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..d9145b600 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; @@ -31,18 +32,18 @@ public class EquipmentInfo { * 设备型号 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 @@ -86,13 +87,13 @@ public class EquipmentInfo { * 充电设备经度 N * GCJ-02坐标系 */ - private BigDecimal EquipmentLng; + // private BigDecimal EquipmentLng; /** * 充电设备纬度 N * GCJ-02坐标系 */ - private BigDecimal EquipmentLat; + // private BigDecimal EquipmentLat; /** * 是否支持VIN码识别(0-否;1-是) Y 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..0b311d067 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; @@ -51,13 +53,13 @@ public class StationInfo { * 户号 N * 国网电费账单户号 */ - private String AccountNumber; + // private String AccountNumber; /** * 容量(单位KW) N * 独立电表申请的功率 */ - private BigDecimal Capacity; + // private BigDecimal Capacity; /** * 是否是公共停车场库 (0-否;1-是) Y @@ -69,7 +71,7 @@ public class StationInfo { * 停车场库编号 N * 公共停车场库编号 */ - private String ParkingLotNumber; + // private String ParkingLotNumber; /** * 充电站国家代码 Y @@ -92,7 +94,7 @@ public class StationInfo { * 站点电话 N * 能够联系场站工作人员进行协助的联系电话 */ - private String StationTel; + // private String StationTel; /** * 服务电话 Y @@ -147,7 +149,7 @@ public class StationInfo { * 站点引导 N * 描述性文字,用于引导车主找到充电车位 */ - private String SiteGuide; + // private String SiteGuide; /** * 建设场所 Y @@ -174,31 +176,31 @@ public class StationInfo { * 站点照片 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 @@ -210,7 +212,7 @@ public class StationInfo { * 营业时间 N * 营业时间描述,推荐格式:周一至周日00:00-24:00 */ - private String BusinessHours; + // private String BusinessHours; /** * 最低单价 Y @@ -240,7 +242,7 @@ public class StationInfo { * 停车费 N * 停车费率描述 */ - private String ParkFee; + // private String ParkFee; /** * 支付方式 Y @@ -258,13 +260,13 @@ public class StationInfo { * 备注 N * 其他备注信息 */ - private String Remark; + // private String Remark; /** * 充电设备信息列表 Y * 该充电站所有充电设备信息对象集合 */ - private List equipmentInfos; + private List EquipmentInfos; /** * 停车收费类型 Y 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..ea6b4c007 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 @@ -1,12 +1,15 @@ package com.jsowell.thirdparty.service.impl; import cn.hutool.core.util.PageUtil; +import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONUtil; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.github.pagehelper.PageInfo; 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.core.domain.ykc.RealTimeMonitorData; 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.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,24 +98,30 @@ 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) + .StationID(String.valueOf(dto.getStationId())) + .OperatorID(dto.getOperatorID()) + .EquipmentOwnerID(dto.getOperatorID()) .StationName(pileStationInfo.getStationName()) .IsAloneApply(Integer.valueOf(pileStationInfo.getAloneApply())) .IsPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking())) .CountryCode(pileStationInfo.getCountryCode()) - .AreaCode(pileStationInfo.getAreaCode()) + .AreaCode("310118") .Address(pileStationInfo.getAddress()) - .ServiceTel(pileStationInfo.getServiceTel()) + .ServiceTel(pileStationInfo.getStationTel()) .StationType(Integer.valueOf(pileStationInfo.getStationType())) .StationStatus(Integer.valueOf(pileStationInfo.getStationStatus())) .ParkNums(Integer.valueOf(pileStationInfo.getParkNums())) @@ -123,15 +129,15 @@ public class LianLianServiceImpl implements LianLianService { .StationLat(new BigDecimal(pileStationInfo.getStationLat())) .Construction(Integer.valueOf(pileStationInfo.getConstruction())) .OpenAllDay(Integer.valueOf(pileStationInfo.getOpenAllDay())) - // .MinElectricityPrice() - // .ElectricityFee() - // .ServiceFee() + .MinElectricityPrice(new BigDecimal("2")) + .ElectricityFee("2") + .ServiceFee("2") .ParkFree(Integer.valueOf(pileStationInfo.getParkFree())) - // .ParkFee() - .Payment(pileStationInfo.getPayment()) + // .ParkFee("2") + .Payment("线上") .SupportOrder(Integer.valueOf(pileStationInfo.getSupportOrder())) // .equipmentInfos() - // .ParkFeeType() + .ParkFeeType(0) .ToiletFlag(Integer.valueOf(pileStationInfo.getToiletFlag())) .StoreFlag(Integer.valueOf(pileStationInfo.getStoreFlag())) .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(); - // Map map = new HashMap<>(); - jsonObject.put("StationInfo", info); - String s = HttpUtils.sendPost(url, jsonObject.toJSONString()); + // String jsonString = JSON.toJSONString(info); - 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 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 map = (Map) 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.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())); @@ -645,14 +697,14 @@ public class LianLianServiceImpl implements LianLianService { equipmentInfo.setEquipmentID(pileSn); 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); equipmentInfo.setEquipmentType(Integer.valueOf(modelInfo.getSpeedType())); // Map pileStatus = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileBasicInfo.getSn())); 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.setVinFlag(1); @@ -686,7 +738,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); } From 77a6abf2247ce1899def3ba34b793f52748458fa Mon Sep 17 00:00:00 2001 From: Lemon Date: Mon, 15 May 2023 14:53:54 +0800 Subject: [PATCH 2/7] update --- .../com/jsowell/common/util/DateUtils.java | 3 + .../common/util/lianlian/HttpRequestUtil.java | 57 ++++++++++++ .../service/impl/LianLianServiceImpl.java | 93 +++++++++---------- 3 files changed, 103 insertions(+), 50 deletions(-) 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-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 ea6b4c007..67bf5443c 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 @@ -17,10 +17,7 @@ import com.jsowell.common.enums.ykc.PileConnectorDataBaseStatusEnum; 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; @@ -157,63 +154,59 @@ public class LianLianServiceImpl implements LianLianService { // 调用联联平台接口 String url = "http://testdataexchange.evchargeonline.com:82/shevcs/v1/" + "notification_stationInfo"; - // String jsonString = JSON.toJSONString(info); - - // 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); + String result = HttpRequestUtil.sendPost(dto.getToken(), jsonString, url, dto.getDataSecret() + , dto.getDataSecretIV(), dto.getOperatorID(), dto.getSigSecret()); - Map 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); + System.out.println(result); - 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 map = (Map) 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); + // //加密 + // byte[] encryptText = Cryptos.aesEncrypt(jsonString.getBytes(), + // dto.getDataSecret().getBytes(), dto.getDataSecretIV().getBytes()); + // String encryptData = Encodes.encodeBase64(encryptText); + // System.out.println("加密数据:" + encryptData); + // + // Map params = Maps.newLinkedHashMap(); + // params.put("OperatorID", dto.getOperatorID()); + // params.put("Data", encryptData); + // params.put("TimeStamp", DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, new Date())); + // 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 map = (Map) 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); } - 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); } /** @@ -696,7 +689,7 @@ public class LianLianServiceImpl implements LianLianService { String pileSn = pileBasicInfo.getSn(); equipmentInfo.setEquipmentID(pileSn); - equipmentInfo.setManufacturerID(merchantInfo.getOrganizationCode()); + equipmentInfo.setManufacturerID("987654321"); equipmentInfo.setConstructionTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, pileBasicInfo.getCreateTime())); PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); From 27003fb2088034462e6af3bfc4cf361c2d121858 Mon Sep 17 00:00:00 2001 From: Lemon Date: Mon, 15 May 2023 14:54:43 +0800 Subject: [PATCH 3/7] =?UTF-8?q?update=20=E8=B0=83=E7=94=A8=E8=81=94?= =?UTF-8?q?=E8=81=94=E5=B9=B3=E5=8F=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/LianLianServiceImpl.java | 36 ------------------- 1 file changed, 36 deletions(-) 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 67bf5443c..3e407d2aa 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 @@ -166,42 +166,6 @@ public class LianLianServiceImpl implements LianLianService { System.out.println(result); - // //加密 - // byte[] encryptText = Cryptos.aesEncrypt(jsonString.getBytes(), - // dto.getDataSecret().getBytes(), dto.getDataSecretIV().getBytes()); - // String encryptData = Encodes.encodeBase64(encryptText); - // System.out.println("加密数据:" + encryptData); - // - // Map params = Maps.newLinkedHashMap(); - // params.put("OperatorID", dto.getOperatorID()); - // params.put("Data", encryptData); - // params.put("TimeStamp", DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, new Date())); - // 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 map = (Map) 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); - } public static void main(String[] args){ From 7cf38df2a3f4d507ad78421ede7e441741672d77 Mon Sep 17 00:00:00 2001 From: JS-LM <2497833386@QQ.com> Date: Tue, 16 May 2023 09:21:39 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=9C=AA=E4=BD=BF=E7=94=A8=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E6=81=A2=E5=A4=8D=E9=A6=96=E9=A1=B5=E5=8E=9F=E6=9C=89?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jsowell-ui/src/views/homeIndex/homeIndex.vue | 252 +++++++++---------- jsowell-ui/src/views/index.vue | 4 +- jsowell-ui/src/views/pile/station/detail.vue | 6 +- 3 files changed, 125 insertions(+), 137 deletions(-) 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/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 @@ - - 角色管理 - + + + From c2cc46d6683d6cf2a9d190febfae2d8766708db9 Mon Sep 17 00:00:00 2001 From: Lemon Date: Tue, 16 May 2023 10:10:34 +0800 Subject: [PATCH 5/7] =?UTF-8?q?update=20=20=E8=81=94=E8=81=94=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/enums/LianLianPileStatusEnum.java | 41 ++++++++ .../common/enums/StationPaymentEnum.java | 52 ++++++++++ .../thirdparty/domain/ConnectorInfo.java | 18 ++-- .../thirdparty/domain/EquipmentInfo.java | 27 +++-- .../thirdparty/domain/StationInfo.java | 99 ++++++++++++------- .../service/impl/LianLianServiceImpl.java | 92 +++++++++-------- 6 files changed, 241 insertions(+), 88 deletions(-) create mode 100644 jsowell-common/src/main/java/com/jsowell/common/enums/LianLianPileStatusEnum.java create mode 100644 jsowell-common/src/main/java/com/jsowell/common/enums/StationPaymentEnum.java 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-thirdparty/src/main/java/com/jsowell/thirdparty/domain/ConnectorInfo.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/domain/ConnectorInfo.java index bec786cc9..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 @@ -20,7 +20,8 @@ public class ConnectorInfo { * 充电设备接口编码 Y * 充电设备接口编码,同一对接平台内唯一 */ - private String ConnectorID; + @JSONField(name = "ConnectorID") + private String connectorID; /** * 充电设备接口名称 N @@ -34,27 +35,32 @@ 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 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 d9145b600..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 @@ -21,12 +21,14 @@ public class EquipmentInfo { * 设备编码 Y * 设备唯一编码,对同一对接平台,保证唯一 */ - private String EquipmentID; + @JSONField(name = "EquipmentID") + private String equipmentID; /** * 设备生产商组织机构代码 Y */ - private String ManufacturerID; + @JSONField(name = "ManufacturerID") + private String manufacturerID; /** * 设备型号 N @@ -49,12 +51,14 @@ public class EquipmentInfo { * 建设时间 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 @@ -64,24 +68,28 @@ 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 @@ -98,6 +106,7 @@ public class EquipmentInfo { /** * 是否支持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 0b311d067..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 @@ -23,31 +23,36 @@ 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 @@ -65,7 +70,8 @@ public class StationInfo { * 是否是公共停车场库 (0-否;1-是) Y * 如果是公共停车场库需要填写场库编号 */ - private Integer IsPublicParkingLot; + @JSONField(name = "IsPublicParkingLot") + private Integer isPublicParkingLot; /** * 停车场库编号 N @@ -77,18 +83,21 @@ public class StationInfo { * 充电站国家代码 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 @@ -100,7 +109,8 @@ public class StationInfo { * 服务电话 Y * 平台服务电话,例如400 的电话 */ - private String ServiceTel; + @JSONField(name = "ServiceTel") + private String serviceTel; /** * 站点类型 Y @@ -115,7 +125,8 @@ public class StationInfo { * 106-单位(专用) * 255-其他 */ - private Integer StationType; + @JSONField(name = "StationType") + private Integer stationType; /** * 站点状态 Y @@ -125,25 +136,29 @@ 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 @@ -170,7 +185,8 @@ public class StationInfo { * 15:出租车 * 255:其他 */ - private Integer Construction; + @JSONField(name = "Construction") + private Integer construction; /** * 站点照片 N @@ -206,7 +222,8 @@ public class StationInfo { * 全天开放 Y * 是否全天开放(0-否;1-是),如果为0,则营业时间必填 */ - private Integer OpenAllDay; + @JSONField(name = "OpenAllDay") + private Integer openAllDay; /** * 营业时间 N @@ -218,25 +235,29 @@ public class StationInfo { * 最低单价 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 @@ -248,13 +269,15 @@ public class StationInfo { * 支付方式 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 @@ -266,7 +289,8 @@ public class StationInfo { * 充电设备信息列表 Y * 该充电站所有充电设备信息对象集合 */ - private List EquipmentInfos; + @JSONField(name = "EquipmentInfos") + private List equipmentInfos; /** * 停车收费类型 Y @@ -275,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/impl/LianLianServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/service/impl/LianLianServiceImpl.java index 3e407d2aa..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 @@ -1,22 +1,21 @@ package com.jsowell.thirdparty.service.impl; import cn.hutool.core.util.PageUtil; -import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONUtil; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.github.pagehelper.PageInfo; 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.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.*; import com.jsowell.netty.command.ykc.StartChargingCommand; import com.jsowell.netty.command.ykc.StopChargingCommand; @@ -109,43 +108,44 @@ public class LianLianServiceImpl implements LianLianService { PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(dto.getStationId()); // 组装联联平台所需要的数据格式 StationInfo info = StationInfo.builder() - .StationID(String.valueOf(dto.getStationId())) - .OperatorID(dto.getOperatorID()) - .EquipmentOwnerID(dto.getOperatorID()) - .StationName(pileStationInfo.getStationName()) - .IsAloneApply(Integer.valueOf(pileStationInfo.getAloneApply())) - .IsPublicParkingLot(Integer.valueOf(pileStationInfo.getPublicParking())) - .CountryCode(pileStationInfo.getCountryCode()) - .AreaCode("310118") - .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("2")) - .ElectricityFee("2") - .ServiceFee("2") - .ParkFree(Integer.valueOf(pileStationInfo.getParkFree())) + .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())) + // .payment("线上") + .supportOrder(Integer.valueOf(pileStationInfo.getSupportOrder())) // .equipmentInfos() - .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())) + .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); // 充电设备信息列表 @@ -154,7 +154,7 @@ public class LianLianServiceImpl implements LianLianService { // 调用联联平台接口 String url = "http://testdataexchange.evchargeonline.com:82/shevcs/v1/" + "notification_stationInfo"; - String jsonStr = JSONUtil.toJsonStr(info); + String jsonStr = JSONObject.toJSONString(info); JSONObject data = new JSONObject(); data.put("StationInfo", jsonStr); @@ -653,14 +653,26 @@ public class LianLianServiceImpl implements LianLianService { String pileSn = pileBasicInfo.getSn(); equipmentInfo.setEquipmentID(pileSn); - equipmentInfo.setManufacturerID("987654321"); + 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); + 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); From d17b4ffa5d0d7221db43c2748ad2fc6992405592 Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Tue, 16 May 2023 14:09:58 +0800 Subject: [PATCH 6/7] =?UTF-8?q?update=20=E7=94=B3=E8=AF=B7=E5=BC=80?= =?UTF-8?q?=E7=A5=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jsowell-ui/src/views/order/invoice/detail.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jsowell-ui/src/views/order/invoice/detail.vue b/jsowell-ui/src/views/order/invoice/detail.vue index 183d23243..eefc9c0b8 100644 --- a/jsowell-ui/src/views/order/invoice/detail.vue +++ b/jsowell-ui/src/views/order/invoice/detail.vue @@ -12,7 +12,8 @@

开票明细

- {{ invoiceTitle.titleName }} + {{ invoiceTitle.titleType }} + {{ invoiceTitle.titleName }} {{ invoiceTitle.taxId }} {{ invoiceTitle.unitAddress }} From d465afbc1e92ce0f4efe07715a83e1276c4fa805 Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Tue, 16 May 2023 14:11:12 +0800 Subject: [PATCH 7/7] =?UTF-8?q?update=20=E7=94=B3=E8=AF=B7=E5=BC=80?= =?UTF-8?q?=E7=A5=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jsowell-ui/src/views/order/invoice/detail.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsowell-ui/src/views/order/invoice/detail.vue b/jsowell-ui/src/views/order/invoice/detail.vue index eefc9c0b8..25ed4a3b5 100644 --- a/jsowell-ui/src/views/order/invoice/detail.vue +++ b/jsowell-ui/src/views/order/invoice/detail.vue @@ -20,7 +20,7 @@
-

申请订单明细

+

关联申请订单明细