From 36e7b299289c393c3460140dc966e83f9ea2e749 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期二, 11 二月 2025 09:51:22 +0800 Subject: [PATCH] 修改bug --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 2 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/kuaidian/model/QueryChargeOrderInfoResult.java | 4 + ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/model/ConnectorStatusInfo.java | 3 + ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java | 9 +++ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECController.java | 11 +++ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECUtil.java | 9 ++ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/kuaidian/model/QueryTerminalCodeResult.java | 2 ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java | 5 + ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java | 11 +++ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/kuaidian/model/OrderInfo.java | 35 ++++++++--- ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/model/ConnectorStatusInfo1.java | 54 ++++++++++++++++++ 11 files changed, 128 insertions(+), 17 deletions(-) diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java index 384df0f..81b2753 100644 --- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java @@ -69,6 +69,11 @@ public R pushChargingGunStatus(Integer id, Integer status) { return R.fail("接口状态变化后推送给第三方失败:" + throwable.getMessage()); } + + @Override + public R<TChargingGun> getChargingGunByFullNumber(String fullNumber) { + return R.fail("根据枪唯一码查询信息失败:" + throwable.getMessage()); + } }; } } diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java index bb7bc35..5224e07 100644 --- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java +++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/feignClient/ChargingGunClient.java @@ -86,4 +86,13 @@ */ @PostMapping("/t-charging-gun/pushChargingGunStatus") R pushChargingGunStatus(@RequestParam("id") Integer id, @RequestParam("status") Integer status); + + + + /** + * 根据枪唯一码查询信息 + * @return + */ + @PostMapping("/t-charging-gun/getChargingGunByFullNumber") + R<TChargingGun> getChargingGunByFullNumber(@RequestParam("fullNumber") String fullNumber); } diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java index 961ab8a..bdc8e6e 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TChargingGunController.java @@ -321,5 +321,16 @@ .eq(TChargingGun::getDelFlag, 0)); return R.ok(list); } + + + /** + * 根据枪唯一码查询信息 + * @return + */ + @PostMapping("/getChargingGunByFullNumber") + public R<TChargingGun> getChargingGunByFullNumber(@RequestParam("fullNumber") String fullNumber){ + TChargingGun chargingGun = chargingGunService.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getDelFlag, 0).eq(TChargingGun::getFullNumber, fullNumber)); + return R.ok(chargingGun); + } } diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECController.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECController.java index 1973b3b..f931203 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECController.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECController.java @@ -271,7 +271,7 @@ stationInfo.setOperatorID("906171535"); stationInfo.setEquipmentOwnerID("906171535"); stationInfo.setStationName(datum.getName()); - stationInfo.setCountryCode(datum.getCountryCode()); + stationInfo.setCountryCode(StringUtils.isNotEmpty(datum.getCountryCode()) ? datum.getCountryCode() : "CN"); stationInfo.setAreaCode(datum.getDistrictsCode()); stationInfo.setAddress(datum.getAddress()); stationInfo.setStationTel(datum.getPhone()); @@ -393,6 +393,7 @@ //构建设备接口信息 equipmentInfo.setConnectorInfos(buildConnectorInfos(tChargingPile.getId(), tChargingPile.getCode(), chargingGunList)); + equipmentInfo.setPower(tChargingPile.getRatedPower()); equipmentInfos.add(equipmentInfo); } return equipmentInfos; @@ -475,6 +476,9 @@ connectorStatusInfo.setStatus(255); break; } + ConnectorStatusInfo connectorStatusInfo1 = new ConnectorStatusInfo(); + BeanUtils.copyProperties(connectorStatusInfo, connectorStatusInfo1); + connectorStatusInfo.setConnectorStatusInfo(connectorStatusInfo1); List<Operator> operators = operatorClient.getAllOperator().getData(); for (Operator operator : operators) { TCECUtil.notificationStationStatus(operator, connectorStatusInfo); @@ -1422,8 +1426,11 @@ QueryTerminalCode queryTerminalCode = JSON.parseObject(decrypt, QueryTerminalCode.class); String qrCode = queryTerminalCode.getQRCode(); String substring = qrCode.substring(qrCode.indexOf("=") + 1); + TChargingGun chargingGun = chargingGunClient.getChargingGunByFullNumber(substring).getData(); QueryTerminalCodeResult queryTerminalCodeResult = new QueryTerminalCodeResult(); - queryTerminalCodeResult.setTerminalCode(substring); + if(null != chargingGun){ + queryTerminalCodeResult.setTerminalCode(chargingGun.getId().toString()); + } //参数加密 String jsonString = JacksonUtils.toJson(queryTerminalCodeResult); diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECUtil.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECUtil.java index 54980d9..8d147f0 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECUtil.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/TCECUtil.java @@ -297,7 +297,10 @@ sign = SignUtil.bytesToHexString(hmacMd5); break; case "KuaiDian": - sign = SignUtil.hmacSign(model.getData(), key); + //进行字符串拼接、计算 + String m1 = new StringBuilder(model.getOperatorID()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString(); + // 打印计算得到的签名Sig + sign = SignUtil.hmacSign(m1, key); break; } return sign; @@ -327,7 +330,9 @@ sign = SignUtil.bytesToHexString(hmacMd5); break; case "KuaiDian": - sign = SignUtil.hmacSign(model.getData(), key); + //进行字符串拼接、计算 + String m1 = new StringBuilder(model.getOperatorID()).append(model.getData()).append(model.getTimeStamp()).append(model.getSeq()).toString(); + sign = SignUtil.hmacSign(m1, key); break; } return sign; diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/kuaidian/model/OrderInfo.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/kuaidian/model/OrderInfo.java index fa1630a..1a8763a 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/kuaidian/model/OrderInfo.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/kuaidian/model/OrderInfo.java @@ -1,5 +1,6 @@ package com.ruoyi.integration.drainage.kuaidian.model; +import com.fasterxml.jackson.annotation.JsonProperty; import com.ruoyi.integration.drainage.model.ChargeDetail; import lombok.Data; @@ -19,48 +20,57 @@ * 充电订单号 */ @NotNull - private String StartChargeSeq; + @JsonProperty("StartChargeSeq") + private String startChargeSeq; /** * 充电设备接口编码 */ @NotNull - private String ConnectorID; + @JsonProperty("ConnectorID") + private String connectorID; /** * 开始充电时间 * yyyy-MM-dd HH:mm:ss */ @NotNull - private String StartTime; + @JsonProperty("StartTime") + private String startTime; /** * 结束充电时间 * yyyy-MM-dd HH:mm:ss */ @NotNull - private String EndTime; + @JsonProperty("EndTime") + private String endTime; /** * 累计充电电量 */ @NotNull - private BigDecimal TotalPower; + @JsonProperty("TotalPower") + private BigDecimal totalPower; /** * 总电费 */ @NotNull - private BigDecimal TotalElecMoney; + @JsonProperty("TotalElecMoney") + private BigDecimal totalElecMoney; /** * 总服务费 */ @NotNull - private BigDecimal TotalSeviceMoney; + @JsonProperty("TotalSeviceMoney") + private BigDecimal totalSeviceMoney; /** * 累计总金额 */ @NotNull - private BigDecimal TotalMoney; + @JsonProperty("TotalMoney") + private BigDecimal totalMoney; /** * 车辆识别码 */ @Null + @JsonProperty("VIN") private String VIN; /** * 充电结束原因 @@ -72,15 +82,18 @@ * 5`99:自定义 */ @NotNull - private Integer StopReason; + @JsonProperty("StopReason") + private Integer stopReason; /** * 时段数N * 范围0`23 */ @Null - private Integer SumPeriod; + @JsonProperty("SumPeriod") + private Integer sumPeriod; /** * 充电明细信息 */ - private List<ChargeDetail> ChargeDetails; + @JsonProperty("ChargeDetails") + private List<ChargeDetail> chargeDetails; } diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/kuaidian/model/QueryChargeOrderInfoResult.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/kuaidian/model/QueryChargeOrderInfoResult.java index 544ae8e..3b1d520 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/kuaidian/model/QueryChargeOrderInfoResult.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/kuaidian/model/QueryChargeOrderInfoResult.java @@ -1,5 +1,6 @@ package com.ruoyi.integration.drainage.kuaidian.model; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import java.util.List; @@ -14,5 +15,6 @@ /** * 充电订单账单集合 */ - private List<OrderInfo> OrderInfos; + @JsonProperty("Orderlnfos") + private List<OrderInfo> orderInfos; } diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/kuaidian/model/QueryTerminalCodeResult.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/kuaidian/model/QueryTerminalCodeResult.java index 2d022ee..695c3a0 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/kuaidian/model/QueryTerminalCodeResult.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/kuaidian/model/QueryTerminalCodeResult.java @@ -1,5 +1,6 @@ package com.ruoyi.integration.drainage.kuaidian.model; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import javax.validation.constraints.NotNull; @@ -15,5 +16,6 @@ * 枪号 */ @NotNull + @JsonProperty("TerminalCode") private String TerminalCode; } diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/model/ConnectorStatusInfo.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/model/ConnectorStatusInfo.java index 7a13ce1..215b381 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/model/ConnectorStatusInfo.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/model/ConnectorStatusInfo.java @@ -49,4 +49,7 @@ @Null @JsonProperty("LookStatus") private Integer lookStatus; + + @JsonProperty("ConnectorStatusInfo") + private ConnectorStatusInfo connectorStatusInfo; } diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/model/ConnectorStatusInfo1.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/model/ConnectorStatusInfo1.java new file mode 100644 index 0000000..95ebd57 --- /dev/null +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/drainage/model/ConnectorStatusInfo1.java @@ -0,0 +1,54 @@ +package com.ruoyi.integration.drainage.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Null; + +/** + * 充电设备接口状态 + * @author zhibing.pu + * @Date 2025/1/21 14:53 + */ +@Data +public class ConnectorStatusInfo1 { + /** + * 充电设备接口编码 + */ + @NotNull + @JsonProperty("ConnectorID") + private String connectorID; + /** + * 充电设备接口状态 + * 0:离网 + * 1:空闲 + * 2:占用(未充电) + * 3:占用(充电中) + * 4:占用(预约锁定) + * 255:故障 + */ + @NotNull + @JsonProperty("Status") + private Integer status; + /** + * 车位状态 + * 0:未知 + * 10:空闲 + * 50:占用 + */ + @Null + @JsonProperty("ParkStatus") + private Integer parkStatus; + /** + * 地锁状态 + * 0:未知 + * 10:已解锁 + * 50:已上锁 + */ + @Null + @JsonProperty("LookStatus") + private Integer lookStatus; + + private ConnectorStatusInfo1 ConnectorStatusInfo; +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java index 9e68b8c..974db7f 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java @@ -1942,7 +1942,7 @@ chargingOrder.setChargingCapacity(query.getCharging_degree()); chargingOrder.setElectricity(query.getCharging_degree()); chargingOrder.setTotalElectricity(new BigDecimal(100 - query.getSoc())); - BmsDemandAndChargerExportation data = bmsDemandAndChargerExportationClient.getBmsDemandAndChargerExportation(chargingOrder.getCode()).getData(); + BmsDemandAndChargerExportation data = bmsDemandAndChargerExportationClient.getBmsDemandAndChargerExportation(chargingOrder1.getCode()).getData(); if(null != data){ chargingOrder.setNeedElec(data.getBms_current_requirements()); } -- Gitblit v1.7.1