From d325f641b00c2b441c1d195e33a51b96b7576817 Mon Sep 17 00:00:00 2001 From: Lemon Date: Sat, 20 May 2023 15:26:28 +0800 Subject: [PATCH] =?UTF-8?q?add=20=20=E8=81=94=E8=81=94=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E5=85=85=E7=94=B5=E8=AE=A2=E5=8D=95=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/SpringBootTestController.java | 5 ++- .../thirdparty/service/LianLianService.java | 7 ++++ .../service/impl/LianLianServiceImpl.java | 34 +++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/jsowell-admin/src/test/java/SpringBootTestController.java b/jsowell-admin/src/test/java/SpringBootTestController.java index 01f86d3c0..7662fc13e 100644 --- a/jsowell-admin/src/test/java/SpringBootTestController.java +++ b/jsowell-admin/src/test/java/SpringBootTestController.java @@ -191,8 +191,11 @@ public class SpringBootTestController { // 推送充电状态 // lianLianService.pushChargeStatus("C27680791529"); - lianLianService.pushStopChargeResult("C27680791529"); + // 推送停止充电结果 + // lianLianService.pushStopChargeResult("C27680791529"); + // 推送充电订单信息 + lianLianService.pushChargeOrderInfo("C27680791529"); } 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 6a6de0834..a8c6ae18a 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 @@ -114,4 +114,11 @@ public interface LianLianService { * @return */ String pushStopChargeResult(String orderCode); + + /** + * 推送充电订单信息 + * @param orderCode + * @return + */ + String pushChargeOrderInfo(String orderCode); } 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 ffeb1b8b6..b7136d377 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 @@ -877,6 +877,39 @@ public class LianLianServiceImpl implements LianLianService { return result; } + /** + * 推送充电订单信息 + * @param orderCode + * @return + */ + @Override + public String pushChargeOrderInfo(String orderCode) { + String url = TEST_URL + "notification_charge_order_info"; + OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); + OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode); + + JSONObject json = new JSONObject(); + json.put("StartChargeSeq", orderCode); + json.put("ConnectorID", orderBasicInfo.getPileConnectorCode()); + json.put("StartTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeStartTime())); + json.put("EndTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderBasicInfo.getChargeEndTime())); + json.put("TotalPower", orderDetail.getTotalUsedElectricity().setScale(2, BigDecimal.ROUND_HALF_UP)); + json.put("TotalElecMoney", orderDetail.getTotalElectricityAmount().setScale(2, BigDecimal.ROUND_HALF_UP)); + json.put("TotalSeviceMoney", orderDetail.getTotalServiceAmount().setScale(2, BigDecimal.ROUND_HALF_UP)); + json.put("TotalMoney", orderDetail.getTotalOrderAmount().setScale(2, BigDecimal.ROUND_HALF_UP)); + json.put("StopReason", 2); // 2:BMS 停止充电 + + String jsonString = JSONObject.toJSONString(json); + String token = getToken(OPERATOR_ID, OPERATOR_SECRET); + if (token == null) { + return null; + } + // 发送请求 + String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET); + + return result; + } + // private ChargeDetail setChargeDetail(OrderBasicInfo orderBasicInfo, OrderDetail orderDetail) { // ChargeDetail detail = new ChargeDetail(); // @@ -891,6 +924,7 @@ public class LianLianServiceImpl implements LianLianService { // TODO 推送充电订单信息 notification_charge_order_info + // TODO 推送订单对账结果信息 check_charge_orders /**