From c05a14bba4b86d83918d7cdc01635785bf5694c2 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期二, 03 六月 2025 00:26:08 +0800 Subject: [PATCH] 拆分mongodb查询服务 --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 40 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/ChargingHandshakeServiceImpl.java | 39 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java | 1 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/UploadRealTimeMonitoringDataServiceImpl.java | 174 ruoyi-service/ruoyi-integration/pom.xml | 28 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/PlatformStartChargingReplyService.java | 17 ruoyi-service/ruoyi-chargingPile/pom.xml | 5 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/ChargingHandshakeService.java | 13 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/PlatformStopChargingReplyServiceImpl.java | 48 ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/SendMessageFallbackFactory.java | 3 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/TransactionRecordServiceImpl.java | 51 ruoyi-api/ruoyi-api-integration/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/UploadRealTimeMonitoringDataService.java | 31 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/BmsDemandAndChargerExportationServiceImpl.java | 49 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java | 1 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/SecurityDetectionService.java | 17 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/TransactionRecordService.java | 14 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/controller/UploadRealTimeMonitoringDataController.java | 10 ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/IntegrationFallbackFactory.java | 100 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyDetailController.java | 2 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/PlatformStopChargingReplyServiceImpl.java | 48 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/PlatformStartChargingReplyServiceImpl.java | 47 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java | 5 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/SecurityDetectionService.java | 17 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/PlatformStartChargingReplyServiceImpl.java | 47 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/PlatformStartChargingReplyService.java | 17 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/TransactionRecordServiceImpl.java | 51 ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/IntegrationClient.java | 14859 ------------------------------------------------------ ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/BmsDemandAndChargerExportationService.java | 20 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/PlatformStopChargingReplyService.java | 15 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/SecurityDetectionServiceImpl.java | 49 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/PlatformStopChargingReplyService.java | 15 ruoyi-service/ruoyi-order/pom.xml | 7 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/ChargingHandshakeService.java | 13 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java | 7 /dev/null | 26 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/base/BaseService.java | 28 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/BmsDemandAndChargerExportationService.java | 20 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/SecurityDetectionServiceImpl.java | 49 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java | 7 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java | 1 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/UploadRealTimeMonitoringDataServiceImpl.java | 174 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/base/BaseService.java | 28 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/TransactionRecordService.java | 14 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/ChargingHandshakeServiceImpl.java | 39 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/BmsDemandAndChargerExportationServiceImpl.java | 48 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java | 2 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/UploadRealTimeMonitoringDataService.java | 31 48 files changed, 1,270 insertions(+), 15,059 deletions(-) diff --git a/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/BmsDemandAndChargerExportationFallbackFactory.java b/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/BmsDemandAndChargerExportationFallbackFactory.java deleted file mode 100644 index e723828..0000000 --- a/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/BmsDemandAndChargerExportationFallbackFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ruoyi.integration.api.factory; - -import com.ruoyi.common.core.domain.R; -import com.ruoyi.common.core.dto.MongoChargingOrderQuery; -import com.ruoyi.integration.api.feignClient.BmsDemandAndChargerExportationClient; -import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; -import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; -import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; -import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * 充电桩服务降级处理 - * - * @author ruoyi - */ -@Component -public class BmsDemandAndChargerExportationFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<BmsDemandAndChargerExportationClient> -{ - private static final Logger log = LoggerFactory.getLogger(BmsDemandAndChargerExportationFallbackFactory.class); - - @Override - public BmsDemandAndChargerExportationClient create(Throwable throwable) { - log.error("调用充电桩实时监测数据失败:{}", throwable.getMessage()); - return new BmsDemandAndChargerExportationClient() { - - @Override - public R<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(String orderCode) { - return R.fail("获取充电中bms数据失败:" + throwable.getMessage()); - } - }; - } -} diff --git a/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/ChargingHandshakeFallbackFactory.java b/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/ChargingHandshakeFallbackFactory.java deleted file mode 100644 index a1b0f16..0000000 --- a/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/ChargingHandshakeFallbackFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.ruoyi.integration.api.factory; - -import com.ruoyi.common.core.domain.R; -import com.ruoyi.integration.api.feignClient.ChargingHandshakeClient; -import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; -import com.ruoyi.integration.api.model.ChargingHandshake; -import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.cloud.openfeign.FallbackFactory; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * 充电桩服务降级处理 - * - * @author ruoyi - */ -@Component -public class ChargingHandshakeFallbackFactory implements FallbackFactory<ChargingHandshakeClient> -{ - private static final Logger log = LoggerFactory.getLogger(ChargingHandshakeFallbackFactory.class); - - @Override - public ChargingHandshakeClient create(Throwable throwable) { - log.error("调用充电握手数据失败:{}", throwable.getMessage()); - return new ChargingHandshakeClient() { - - - @Override - public R<ChargingHandshake> getDataByOrderCode(String code) { - return R.fail("根据订单号查询充电握手数据失败:" + throwable.getMessage()); - } - }; - } -} diff --git a/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/IntegrationFallbackFactory.java b/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/IntegrationFallbackFactory.java index 3424e16..ebd6acc 100644 --- a/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/IntegrationFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/IntegrationFallbackFactory.java @@ -24,106 +24,6 @@ return new IntegrationClient() { @Override - public R<String> onlineReply(OnlineReply onlineReply) { - return R.fail("登录认证应答调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> pong(Pong pong) { - return R.fail("心跳包应答调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> billingModeVerifyReply(BillingModeVerifyReply billingModeVerifyReply) { - return R.fail("计费模型验证请求应答调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> acquisitionBillingModeReply(AcquisitionBillingModeReply acquisitionBillingModeReply) { - return R.fail("计费模型验证请求应答调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> readRealTimeMonitoringData(ReadRealTimeMonitoringData readRealTimeMonitoringData) { - return R.fail("读取实时监测数据调用失败:" + throwable.getMessage()); - } - -// @Override -// public R<String> endCharge(EndCharge endCharge) { -// return R.fail("充电结束调用失败:" + throwable.getMessage()); -// } - - @Override - public R<String> platformConfirmationCharging(PlatformConfirmationCharging platformConfirmationCharging) { - return R.fail("运营平台确认启动充电调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> platformStartCharging(PlatformStartCharging platformStartCharging) { - return R.fail("运营平台远程控制启机调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> platformStopCharging(PlatformStopCharging platformStopCharging) { - return R.fail("运营平台远程停机调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> confirmTransactionRecord(ConfirmTransactionRecord confirmTransactionRecord) { - return R.fail("交易记录确认调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> updateBalance(UpdateBalance updateBalance) { - return R.fail("远程账户余额更新调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> synchronizeOfflineCard(SynchronizeOfflineCard synchronizeOfflineCard) { - return R.fail("离线卡数据同步调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> clearOfflineCard(ClearOfflineCard clearOfflineCard) { - return R.fail("离线卡数据清除调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> queryOfflineCard(QueryOfflineCard queryOfflineCard) { - return R.fail("离线卡数据查询调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> workingParameterSetting(WorkingParameterSetting workingParameterSetting) { - return R.fail("充电桩工作参数设置调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> timingSetting(TimingSetting timingSetting) { - return R.fail("对时设置调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> setupBillingModel(SetupBillingModel setupBillingModel) { - return R.fail("计费模型设置调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> openOrCloseGroundLock(OpenOrCloseGroundLock openOrCloseGroundLock) { - return R.fail("遥控地锁升锁与降锁命令 (下行)调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> platformRestart(PlatformRestart platformRestart) { - return R.fail("远程重启调用失败:" + throwable.getMessage()); - } - - @Override - public R<String> platformRemoteUpdate(PlatformRemoteUpdate platformRemoteUpdate) { - return R.fail("远程更新调用失败:" + throwable.getMessage()); - } - - @Override public R<String> setupBillingModel1(String deviceId, String json) { return R.fail("远程更新硬件:" + throwable.getMessage()); } diff --git a/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/SendMessageFallbackFactory.java b/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/SendMessageFallbackFactory.java index e063231..e8137f8 100644 --- a/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/SendMessageFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/factory/SendMessageFallbackFactory.java @@ -1,9 +1,6 @@ package com.ruoyi.integration.api.factory; -import com.ruoyi.common.core.domain.R; -import com.ruoyi.integration.api.feignClient.ChargingHandshakeClient; import com.ruoyi.integration.api.feignClient.SendMessageClient; -import com.ruoyi.integration.api.model.ChargingHandshake; import com.ruoyi.integration.api.model.PlatformStartCharging; import com.ruoyi.integration.api.model.PlatformStopCharging; import com.ruoyi.integration.api.model.QrCodeDelivery; diff --git a/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/BmsDemandAndChargerExportationClient.java b/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/BmsDemandAndChargerExportationClient.java deleted file mode 100644 index f980896..0000000 --- a/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/BmsDemandAndChargerExportationClient.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.ruoyi.integration.api.feignClient; - -import com.ruoyi.common.core.constant.ServiceNameConstants; -import com.ruoyi.common.core.domain.R; -import com.ruoyi.integration.api.factory.BmsDemandAndChargerExportationFallbackFactory; -import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestParam; - -/** - * @author zhibing.pu - * @Date 2024/11/1 16:06 - */ -@FeignClient(contextId = "BmsDemandAndChargerExportationClient", value = ServiceNameConstants.INTEGRATION_SERVICE, fallbackFactory = BmsDemandAndChargerExportationFallbackFactory.class) -public interface BmsDemandAndChargerExportationClient { - - - /** - * 获取充电中bms数据 - * @param orderCode - * @return - */ - @PostMapping("/bmsDemandAndChargerExportation/getBmsDemandAndChargerExportation") - R<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(@RequestParam(value = "orderCode") String orderCode); - -} diff --git a/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/ChargingHandshakeClient.java b/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/ChargingHandshakeClient.java deleted file mode 100644 index b81372d..0000000 --- a/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/ChargingHandshakeClient.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ruoyi.integration.api.feignClient; - -import com.ruoyi.common.core.constant.ServiceNameConstants; -import com.ruoyi.common.core.domain.R; -import com.ruoyi.integration.api.factory.ChargingHandshakeFallbackFactory; -import com.ruoyi.integration.api.model.ChargingHandshake; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestParam; - -/** - * @author zhibing.pu - * @Date 2024/8/28 10:46 - */ -@FeignClient(contextId = "ChargingHandshakeClient", value = ServiceNameConstants.INTEGRATION_SERVICE, fallbackFactory = ChargingHandshakeFallbackFactory.class) -public interface ChargingHandshakeClient { - - - /** - * 根据订单号查询充电握手数据 - * @param code - * @return - */ - @PostMapping("/chargingHandshake/getDataByOrderCode") - R<ChargingHandshake> getDataByOrderCode(@RequestParam("code") String code); -} diff --git a/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/IntegrationClient.java b/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/IntegrationClient.java index c08fcd0..42dc6fe 100644 --- a/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/IntegrationClient.java +++ b/ruoyi-api/ruoyi-api-integration/src/main/java/com/ruoyi/integration/api/feignClient/IntegrationClient.java @@ -19,14864 +19,7 @@ public interface IntegrationClient { - /** - * 登录认证应答 - * @param onlineReply 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessageonlineReply") - public R<String> onlineReply(@RequestBody OnlineReply onlineReply); - - /** - * 心跳包应答 - * @param pong 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessagepong") - public R<String> pong(@RequestBody Pong pong); - - /** - * 计费模型验证请求应答 - * @param billingModeVerifyReply 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessagebillingModeVerifyReply") - public R<String> billingModeVerifyReply(@RequestBody BillingModeVerifyReply billingModeVerifyReply); - - /** - * 计费模型验证请求应答 - * @param acquisitionBillingModeReply 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessageacquisitionBillingModeReply") - public R<String> acquisitionBillingModeReply(@RequestBody AcquisitionBillingModeReply acquisitionBillingModeReply); - - /** - * 读取实时监测数据 - * @param readRealTimeMonitoringData 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessagereadRealTimeMonitoringData") - public R<String> readRealTimeMonitoringData(@RequestBody ReadRealTimeMonitoringData readRealTimeMonitoringData); - - /** - * 充电结束 - * @param endCharge 实体对象 - * @return - */ -// @PostMapping("/sendMessage/sendMessageendCharge") -// public R<String> endCharge(@RequestBody EndCharge endCharge); - - /** - * 运营平台确认启动充电 - * @param platformConfirmationCharging 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessageplatformConfirmationCharging") - public R<String> platformConfirmationCharging(@RequestBody PlatformConfirmationCharging platformConfirmationCharging); - - /** - * 运营平台远程控制启机 - * @param platformStartCharging 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessageplatformStartCharging") - public R<String> platformStartCharging(@RequestBody PlatformStartCharging platformStartCharging); - - /** - * 运营平台远程停机 - * @param platformStopCharging 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessageplatformStopCharging") - public R<String> platformStopCharging(@RequestBody PlatformStopCharging platformStopCharging); - - /** - * 交易记录确认 - * @param confirmTransactionRecord 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessageconfirmTransactionRecord") - public R<String> confirmTransactionRecord(@RequestBody ConfirmTransactionRecord confirmTransactionRecord); - - /** - * 远程账户余额更新 - * @param updateBalance 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessageupdateBalance") - public R<String> updateBalance(@RequestBody UpdateBalance updateBalance); - - /** - * 离线卡数据同步 - * @param synchronizeOfflineCard 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessagesynchronizeOfflineCard") - public R<String> synchronizeOfflineCard(@RequestBody SynchronizeOfflineCard synchronizeOfflineCard); - - /** - * 离线卡数据清除 - * @param clearOfflineCard 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessageclearOfflineCard") - public R<String> clearOfflineCard(@RequestBody ClearOfflineCard clearOfflineCard); - - /** - * 离线卡数据查询 - * @param queryOfflineCard 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessagequeryOfflineCard") - public R<String> queryOfflineCard(@RequestBody QueryOfflineCard queryOfflineCard); - - /** - * 充电桩工作参数设置 - * @param workingParameterSetting 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessageworkingParameterSetting") - public R<String> workingParameterSetting(@RequestBody WorkingParameterSetting workingParameterSetting); - - /** - * 对时设置 - * @param timingSetting 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessagetimingSetting") - public R<String> timingSetting(@RequestBody TimingSetting timingSetting); - - /** - * 计费模型设置 - * @param setupBillingModel 实体对象 - * @return - */ - @PostMapping("/sendMessage/setupBillingModel") - public R<String> setupBillingModel(@RequestBody SetupBillingModel setupBillingModel); - - /** - * 遥控地锁升锁与降锁命令 (下行) - * @param openOrCloseGroundLock 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessageopenOrCloseGroundLock") - public R<String> openOrCloseGroundLock(@RequestBody OpenOrCloseGroundLock openOrCloseGroundLock); - /** - * 远程重启 - * @param platformRestart 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessageplatformRestart") - public R<String> platformRestart(@RequestBody PlatformRestart platformRestart); - /** - * 远程更新 - * @param platformRemoteUpdate 实体对象 - * @return - */ - @PostMapping("/sendMessage/sendMessageplatformRemoteUpdate") - public R<String> platformRemoteUpdate(@RequestBody PlatformRemoteUpdate platformRemoteUpdate); - @PostMapping("/iot/setupBillingModel") - public R<String> setupBillingModel1(@RequestParam("deviceId") String deviceId, @RequestParam("json") String json); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + R<String> setupBillingModel1(@RequestParam("deviceId") String deviceId, @RequestParam("json") String json); } diff --git a/ruoyi-api/ruoyi-api-integration/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/ruoyi-api/ruoyi-api-integration/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index b52ff44..a85ce88 100644 --- a/ruoyi-api/ruoyi-api-integration/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/ruoyi-api/ruoyi-api-integration/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,12 +1,10 @@ com.ruoyi.integration.api.factory.IntegrationFallbackFactory com.ruoyi.integration.api.factory.UploadRealTimeMonitoringDataFallbackFactory -com.ruoyi.integration.api.factory.ChargingHandshakeFallbackFactory com.ruoyi.integration.api.factory.SendMessageFallbackFactory com.ruoyi.integration.api.factory.PlatformStartChargingReplyFallbackFactory com.ruoyi.integration.api.factory.PlatformStopChargingReplyFallbackFactory com.ruoyi.integration.api.factory.SwitchwayGateFallbackFactory com.ruoyi.integration.api.factory.IotInterfaceFallbackFactory com.ruoyi.integration.api.factory.SecurityDetectionFallbackFactory -com.ruoyi.integration.api.factory.BmsDemandAndChargerExportationFallbackFactory com.ruoyi.integration.api.factory.TCECClientFallbackFactory com.ruoyi.integration.api.factory.TransactionRecordClientFallbackFactory \ No newline at end of file diff --git a/ruoyi-service/ruoyi-chargingPile/pom.xml b/ruoyi-service/ruoyi-chargingPile/pom.xml index 40a8298..07f0e31 100644 --- a/ruoyi-service/ruoyi-chargingPile/pom.xml +++ b/ruoyi-service/ruoyi-chargingPile/pom.xml @@ -153,6 +153,11 @@ <artifactId>javase</artifactId> <version>3.3.0</version> </dependency> + <!--mongodb--> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-mongodb</artifactId> + </dependency> </dependencies> <build> diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyDetailController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyDetailController.java index c58af1d..46e3915 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyDetailController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TAccountingStrategyDetailController.java @@ -178,7 +178,7 @@ TAccountingStrategy accountingStrategy = accountingStrategyService.getById(site.getAccountingStrategyId()); TAccountingStrategyDetail one = accountingStrategyDetailService.getOne(Wrappers.<TAccountingStrategyDetail>lambdaQuery() .eq(TAccountingStrategyDetail::getAccountingStrategyId, accountingStrategy.getId()) - .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and end_time")); + .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and (if(end_time = '00:00', '23:59', end_time))")); return R.ok(dto.getStrategyDetailId().equals(one.getId())); } diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java index 31cee8d..918eaeb 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TApplyChargingPileController.java @@ -11,6 +11,7 @@ import com.ruoyi.chargingPile.api.model.Partner; import com.ruoyi.chargingPile.api.model.Site; import com.ruoyi.chargingPile.api.model.TChargingGun; +import com.ruoyi.chargingPile.util.mongodb.service.UploadRealTimeMonitoringDataService; import com.ruoyi.common.core.utils.WebUtils; import com.ruoyi.common.core.web.domain.BasePojo; import com.ruoyi.common.core.web.page.PageInfo; @@ -425,7 +426,7 @@ @Resource private OtherClient otherClient; @Resource - private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; + private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; @ApiOperation(value = "下载", tags = {"管理后台-结算表记录"}) @PutMapping("/downloadSettlement") @Log(title = "【结算表记录】下载结算表", businessType = BusinessType.EXPORT) @@ -559,7 +560,7 @@ settlementExportVO.setAverageServiceChargeReal(""); settlementExportVO.setAverageServiceCharge(""); // 获取充电时间 - UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); + UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataService.getLastDataById(chargingOrder.getCode()); if (data5!=null){ if (data5.getCumulative_charging_time()!=null){ settlementExportVO.setChargingSecond(data5.getCumulative_charging_time()+""); @@ -568,7 +569,7 @@ } // 获取开始SOC 结束soc if (chargingOrder.getCode()!=null){ - List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrder.getCode()).getData(); + List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataService.getDataByOrderCode(chargingOrder.getCode()); if (data6!=null && !data6.isEmpty()){ int min = 100; int max = 0; diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java index 6120ef0..2bfa42a 100644 --- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java @@ -19,6 +19,7 @@ import com.ruoyi.chargingPile.dto.GetChargingGunMonitoring; import com.ruoyi.chargingPile.mapper.TChargingPileMapper; import com.ruoyi.chargingPile.service.*; +import com.ruoyi.chargingPile.util.mongodb.service.UploadRealTimeMonitoringDataService; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.web.domain.AjaxResult; @@ -96,7 +97,7 @@ private AppUserCarClient appUserCarClient; @Resource - private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; + private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; @Resource private SysUserRoleClient sysUserRoleClient; @@ -406,7 +407,7 @@ // 查询正在充电的单子的实时记录 TChargingOrder chargingOrder = chargingOrderClient.getOrderDetailByGunId(chargingGun.getId()).getData(); if(Objects.nonNull(chargingOrder)){ - UploadRealTimeMonitoringData uploadRealTimeMonitoringData = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); + UploadRealTimeMonitoringData uploadRealTimeMonitoringData = uploadRealTimeMonitoringDataService.getLastDataById(chargingOrder.getCode()); if(null != uploadRealTimeMonitoringData){ chargingGun.setSoc(uploadRealTimeMonitoringData.getSoc()); }else{ @@ -636,7 +637,7 @@ gunMonitoring.setLicensePlate(chargingOrder.getPlateNum()); } - UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); + UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataService.getLastDataById(chargingOrder.getCode()); gunMonitoring.setChargingRatio(BigDecimal.valueOf(data.getSoc())); gunMonitoring.setElectricQuantity(data.getCharging_degree().toString()); gunMonitoring.setSoc(data.getSoc().toString()); diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/base/BaseService.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/base/BaseService.java new file mode 100644 index 0000000..bc66509 --- /dev/null +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/base/BaseService.java @@ -0,0 +1,28 @@ +package com.ruoyi.chargingPile.util.mongodb.base; + + +import java.util.List; + +public interface BaseService<T> { + + /** + * 添加 + * @param t 实体类 + * @return 添加结果 1=成功 0=失败 + */ + int create(T t); + + /** + * 根据id查询 + * @param id 实体id + * @return 实体对象 + */ + T findById(String id); + + /** + * 查询列表 + * @return 实体列表 + */ + List<T> findAll(); + +} diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/BmsDemandAndChargerExportationService.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/BmsDemandAndChargerExportationService.java new file mode 100644 index 0000000..3a52d8f --- /dev/null +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/BmsDemandAndChargerExportationService.java @@ -0,0 +1,20 @@ +package com.ruoyi.chargingPile.util.mongodb.service; + +import com.ruoyi.chargingPile.util.mongodb.base.BaseService; +import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; + +import java.util.List; + +public interface BmsDemandAndChargerExportationService extends BaseService<BmsDemandAndChargerExportation> { + + + /** + * 获取bms数据 + * @param orderCode + * @return + */ + List<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(String orderCode); + + + +} diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/ChargingHandshakeService.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/ChargingHandshakeService.java new file mode 100644 index 0000000..15f3b46 --- /dev/null +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/ChargingHandshakeService.java @@ -0,0 +1,13 @@ +package com.ruoyi.chargingPile.util.mongodb.service; + +import com.ruoyi.chargingPile.util.mongodb.base.BaseService; +import com.ruoyi.integration.api.model.ChargingHandshake; + +public interface ChargingHandshakeService extends BaseService<ChargingHandshake> { + + + ChargingHandshake getDataByOrderCode(String code); + + + +} diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/PlatformStartChargingReplyService.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/PlatformStartChargingReplyService.java new file mode 100644 index 0000000..c07be82 --- /dev/null +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/PlatformStartChargingReplyService.java @@ -0,0 +1,17 @@ +package com.ruoyi.chargingPile.util.mongodb.service; + +import com.ruoyi.chargingPile.util.mongodb.base.BaseService; +import com.ruoyi.integration.api.model.PlatformStartChargingReply; + +import java.util.List; + +public interface PlatformStartChargingReplyService extends BaseService<PlatformStartChargingReply> { + + /** + * 根据订单编号查询远程启机应答数据 + * @param code + * @return + */ + List<PlatformStartChargingReply> getPlatformStartChargingReply(String code); + +} diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/PlatformStopChargingReplyService.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/PlatformStopChargingReplyService.java new file mode 100644 index 0000000..491dfbd --- /dev/null +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/PlatformStopChargingReplyService.java @@ -0,0 +1,15 @@ +package com.ruoyi.chargingPile.util.mongodb.service; + +import com.ruoyi.chargingPile.util.mongodb.base.BaseService; +import com.ruoyi.integration.api.model.PlatformStopChargingReply; +import com.ruoyi.integration.api.vo.GetPlatformStopChargingReply; + +public interface PlatformStopChargingReplyService extends BaseService<PlatformStopChargingReply> { + + /** + * 根据枪编号获取停机应答 + * @return + */ + PlatformStopChargingReply getPlatformStopChargingReply(GetPlatformStopChargingReply query); + +} diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/SecurityDetectionService.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/SecurityDetectionService.java new file mode 100644 index 0000000..7c35873 --- /dev/null +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/SecurityDetectionService.java @@ -0,0 +1,17 @@ +package com.ruoyi.chargingPile.util.mongodb.service; + +import com.ruoyi.chargingPile.util.mongodb.base.BaseService; +import com.ruoyi.integration.api.model.SecurityDetection; + +/** + */ +public interface SecurityDetectionService extends BaseService<SecurityDetection> { + + + /** + * 根据业务流水号查询数据 + * @param transactionSerialNumber + * @return + */ + SecurityDetection getSecurityDetection(String transactionSerialNumber); +} diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/TransactionRecordService.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/TransactionRecordService.java new file mode 100644 index 0000000..e59fea6 --- /dev/null +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/TransactionRecordService.java @@ -0,0 +1,14 @@ +package com.ruoyi.chargingPile.util.mongodb.service; + +import com.ruoyi.chargingPile.util.mongodb.base.BaseService; +import com.ruoyi.integration.api.model.TransactionRecord; + +public interface TransactionRecordService extends BaseService<TransactionRecord> { + + /** + * 根据订单流水号查询数据 + * @param code + * @return + */ + TransactionRecord findOne(String code); +} diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/UploadRealTimeMonitoringDataService.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/UploadRealTimeMonitoringDataService.java new file mode 100644 index 0000000..ad7fb4d --- /dev/null +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/UploadRealTimeMonitoringDataService.java @@ -0,0 +1,31 @@ +package com.ruoyi.chargingPile.util.mongodb.service; + +import com.ruoyi.chargingPile.util.mongodb.base.BaseService; +import com.ruoyi.common.core.dto.MongoChargingOrderQuery; +import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; +import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; + +import java.text.ParseException; +import java.util.List; + +public interface UploadRealTimeMonitoringDataService extends BaseService<UploadRealTimeMonitoringData> { + + /** + * 根据订单号查询监控数据 + * @param code + * @return + */ + List<UploadRealTimeMonitoringData> getDataByOrderCode(String code); + UploadRealTimeMonitoringPageData getDataAll(MongoChargingOrderQuery mongoChargingOrderQuery) throws ParseException; + + /** + * 查询订单最新一条数据 + * @param transaction_serial_number + * @return + */ + UploadRealTimeMonitoringData getLastDataById(String transaction_serial_number); + + void delete(String id); + + void updateById(String id); +} diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/BmsDemandAndChargerExportationServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/BmsDemandAndChargerExportationServiceImpl.java new file mode 100644 index 0000000..37d320f --- /dev/null +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/BmsDemandAndChargerExportationServiceImpl.java @@ -0,0 +1,48 @@ +package com.ruoyi.chargingPile.util.mongodb.service.impl; + +import com.ruoyi.chargingPile.util.mongodb.service.BmsDemandAndChargerExportationService; +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Sort; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class BmsDemandAndChargerExportationServiceImpl implements BmsDemandAndChargerExportationService { + @Autowired + private MongoTemplate mongoTemplate; + @Override + public int create(BmsDemandAndChargerExportation bmsDemandAndChargerExportation) { + mongoTemplate.save(bmsDemandAndChargerExportation); + return 1; + } + + @Override + public BmsDemandAndChargerExportation findById(String id) { + return mongoTemplate.findById(id, BmsDemandAndChargerExportation.class); + } + + @Override + public List<BmsDemandAndChargerExportation> findAll() { + return mongoTemplate.findAll(BmsDemandAndChargerExportation.class); + } + + + @Override + public List<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(String orderCode) { + Query query = new Query(); + if(StringUtils.isNotEmpty(orderCode)){ + query.addCriteria(Criteria.where("transaction_serial_number").is(orderCode)); + } + List<BmsDemandAndChargerExportation> uploadRealTimeMonitoringData = mongoTemplate.find( + query.with(Sort.by(Sort.Order.desc("create_time"))) + , BmsDemandAndChargerExportation.class); + return uploadRealTimeMonitoringData; + } + +} diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/ChargingHandshakeServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/ChargingHandshakeServiceImpl.java new file mode 100644 index 0000000..e47accd --- /dev/null +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/ChargingHandshakeServiceImpl.java @@ -0,0 +1,39 @@ +package com.ruoyi.chargingPile.util.mongodb.service.impl; + +import com.ruoyi.chargingPile.util.mongodb.service.ChargingHandshakeService; +import com.ruoyi.integration.api.model.ChargingHandshake; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class ChargingHandshakeServiceImpl implements ChargingHandshakeService { + @Autowired + private MongoTemplate mongoTemplate; + @Override + public int create(ChargingHandshake chargingHandshake) { + mongoTemplate.save(chargingHandshake); + return 1; + } + + @Override + public ChargingHandshake findById(String id) { + return mongoTemplate.findById(id, ChargingHandshake.class); + } + + @Override + public List<ChargingHandshake> findAll() { + return mongoTemplate.findAll(ChargingHandshake.class); + } + + @Override + public ChargingHandshake getDataByOrderCode(String code) { + List<ChargingHandshake> charging_gun_code = mongoTemplate.find(new Query().addCriteria(Criteria.where("transaction_serial_number").is(code)), ChargingHandshake.class); + return charging_gun_code.size() > 0 ? charging_gun_code.get(0) : null; + } + +} diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/PlatformStartChargingReplyServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/PlatformStartChargingReplyServiceImpl.java new file mode 100644 index 0000000..3c0c176 --- /dev/null +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/PlatformStartChargingReplyServiceImpl.java @@ -0,0 +1,47 @@ +package com.ruoyi.chargingPile.util.mongodb.service.impl; + +import com.ruoyi.chargingPile.util.mongodb.service.PlatformStartChargingReplyService; +import com.ruoyi.integration.api.model.PlatformStartChargingReply; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class PlatformStartChargingReplyServiceImpl implements PlatformStartChargingReplyService { + @Autowired + private MongoTemplate mongoTemplate; + + @Override + public int create(PlatformStartChargingReply platformStartChargingReply) { + mongoTemplate.save(platformStartChargingReply); + return 1; + } + + @Override + public PlatformStartChargingReply findById(String id) { + return mongoTemplate.findById(id, PlatformStartChargingReply.class); + } + + @Override + public List<PlatformStartChargingReply> findAll() { + return mongoTemplate.findAll(PlatformStartChargingReply.class); + } + + + /** + * 根据订单编号查询远程启机应答数据 + * @param code + * @return + */ + @Override + public List<PlatformStartChargingReply> getPlatformStartChargingReply(String code) { + Query query = new Query(); + query.addCriteria(Criteria.where("transaction_serial_number").is(code)); + List<PlatformStartChargingReply> platformStartChargingReplies = mongoTemplate.find(query, PlatformStartChargingReply.class); + return platformStartChargingReplies; + } +} diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/PlatformStopChargingReplyServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/PlatformStopChargingReplyServiceImpl.java new file mode 100644 index 0000000..17d7e79 --- /dev/null +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/PlatformStopChargingReplyServiceImpl.java @@ -0,0 +1,48 @@ +package com.ruoyi.chargingPile.util.mongodb.service.impl; + +import com.ruoyi.chargingPile.util.mongodb.service.PlatformStopChargingReplyService; +import com.ruoyi.integration.api.model.PlatformStopChargingReply; +import com.ruoyi.integration.api.vo.GetPlatformStopChargingReply; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +@Service +public class PlatformStopChargingReplyServiceImpl implements PlatformStopChargingReplyService { + @Autowired + private MongoTemplate mongoTemplate; + @Override + public int create(PlatformStopChargingReply platformStopChargingReply) { + mongoTemplate.save(platformStopChargingReply); + return 1; + } + + @Override + public PlatformStopChargingReply findById(String id) { + return mongoTemplate.findById(id, PlatformStopChargingReply.class); + } + + @Override + public List<PlatformStopChargingReply> findAll() { + return mongoTemplate.findAll(PlatformStopChargingReply.class); + } + + + /** + * 根据枪编号获取 + * @return + */ + @Override + public PlatformStopChargingReply getPlatformStopChargingReply(GetPlatformStopChargingReply query) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + List<PlatformStopChargingReply> platformStopChargingReplies = mongoTemplate.find(new Query().addCriteria(Criteria.where("charging_pile_code").is(query.getCharging_pile_code()) + .and("charging_gun_code").is(query.getCharging_gun_code()).and("create_time").lte(sdf.format(new Date())).gte(query.getEnd_time())), PlatformStopChargingReply.class); + return platformStopChargingReplies.size() > 0 ? platformStopChargingReplies.get(0) : null; + } +} diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/SecurityDetectionServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/SecurityDetectionServiceImpl.java new file mode 100644 index 0000000..06a9877 --- /dev/null +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/SecurityDetectionServiceImpl.java @@ -0,0 +1,49 @@ +package com.ruoyi.chargingPile.util.mongodb.service.impl; + +import com.ruoyi.chargingPile.util.mongodb.service.SecurityDetectionService; +import com.ruoyi.integration.api.model.SecurityDetection; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; + +import java.util.List; + + +/** + * 心跳包应答实现类 + **/ +@Service +public class SecurityDetectionServiceImpl implements SecurityDetectionService { + @Autowired + private MongoTemplate mongoTemplate; + + @Override + public int create(SecurityDetection securityDetection) { + mongoTemplate.save(securityDetection); + return 1; + } + + @Override + public SecurityDetection findById(String id) { + return mongoTemplate.findById(id, SecurityDetection.class); + } + + @Override + public List<SecurityDetection> findAll() { + return mongoTemplate.findAll(SecurityDetection.class); + } + + /** + * 根据业务流水号查询数据 + * @param transactionSerialNumber + * @return + */ + @Override + public SecurityDetection getSecurityDetection(String transactionSerialNumber) { + List<SecurityDetection> securityDetectionList = mongoTemplate.find(new Query().addCriteria(Criteria.where("transaction_serial_number") + .is(transactionSerialNumber)), SecurityDetection.class); + return securityDetectionList.size() > 0 ? securityDetectionList.get(0) : null; + } +} diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/TransactionRecordServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/TransactionRecordServiceImpl.java new file mode 100644 index 0000000..1475f99 --- /dev/null +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/TransactionRecordServiceImpl.java @@ -0,0 +1,51 @@ +package com.ruoyi.chargingPile.util.mongodb.service.impl; + +import com.ruoyi.chargingPile.util.mongodb.service.TransactionRecordService; +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.integration.api.model.TransactionRecord; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Sort; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class TransactionRecordServiceImpl implements TransactionRecordService { + @Autowired + private MongoTemplate mongoTemplate; + @Override + public int create(TransactionRecord transactionRecord) { + mongoTemplate.save(transactionRecord); + return 1; + } + + @Override + public TransactionRecord findById(String id) { + return mongoTemplate.findById(id, TransactionRecord.class); + } + + @Override + public List<TransactionRecord> findAll() { + return mongoTemplate.findAll(TransactionRecord.class); + } + + /** + * 根据订单流水号查询数据 + * @param code + * @return + */ + @Override + public TransactionRecord findOne(String code) { + Query query = new Query(); + if(StringUtils.isNotEmpty(code)){ + query.addCriteria(Criteria.where("transaction_serial_number").is(code)); + } + List<TransactionRecord> transactionRecords = mongoTemplate.find( + query.with(Sort.by(Sort.Order.desc("create_time"))) + , TransactionRecord.class); + return transactionRecords.size() > 0 ? transactionRecords.get(0) : null; + } +} diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/UploadRealTimeMonitoringDataServiceImpl.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/UploadRealTimeMonitoringDataServiceImpl.java new file mode 100644 index 0000000..67d3608 --- /dev/null +++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/util/mongodb/service/impl/UploadRealTimeMonitoringDataServiceImpl.java @@ -0,0 +1,174 @@ +package com.ruoyi.chargingPile.util.mongodb.service.impl; + +import com.ruoyi.chargingPile.util.mongodb.service.UploadRealTimeMonitoringDataService; +import com.ruoyi.common.core.dto.MongoChargingOrderQuery; +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; +import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.data.mongodb.core.query.Update; +import org.springframework.stereotype.Service; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +@Service +public class UploadRealTimeMonitoringDataServiceImpl implements UploadRealTimeMonitoringDataService { + @Autowired + private MongoTemplate mongoTemplate; + + @Override + public int create(UploadRealTimeMonitoringData uploadRealTimeMonitoringData) { + mongoTemplate.save(uploadRealTimeMonitoringData); + return 1; + } + + @Override + public UploadRealTimeMonitoringData findById(String id) { + return mongoTemplate.findById(id, UploadRealTimeMonitoringData.class); + } + + + @Override + public List<UploadRealTimeMonitoringData> findAll() { + return mongoTemplate.findAll(UploadRealTimeMonitoringData.class); + } + + + /** + * 根据订单号查询监控数据 + * @param code + * @return + */ + @Override + public List<UploadRealTimeMonitoringData> getDataByOrderCode(String code) { + Query query = new Query(); + if(StringUtils.isNotEmpty(code)){ + query.addCriteria(Criteria.where("transaction_serial_number").is(code)); + } + List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringData = mongoTemplate.find( + query.with(Sort.by(Sort.Order.desc("create_time"))) + , UploadRealTimeMonitoringData.class); + return uploadRealTimeMonitoringData; + } + + @Override + public UploadRealTimeMonitoringPageData getDataAll(MongoChargingOrderQuery mongoChargingOrderQuery) throws ParseException { + Query query = new Query(); +// if (!values.isEmpty()){ +// query.addCriteria(Criteria.where("transaction_serial_number").in(values)); +// } + if (mongoChargingOrderQuery.getCode() != null && !mongoChargingOrderQuery.getCode().isEmpty()) { + query.addCriteria(Criteria.where("transaction_serial_number").regex(mongoChargingOrderQuery.getCode(),"i")); // "i" 表示不区分大小写 + } + if (mongoChargingOrderQuery.getOrderType() !=null){ + query.addCriteria(Criteria.where("orderType").is(mongoChargingOrderQuery.getOrderType())); + } + if (mongoChargingOrderQuery.getSiteId() != null){ + query.addCriteria(Criteria.where("siteId").is(mongoChargingOrderQuery.getSiteId())); + } + if (!mongoChargingOrderQuery.getSiteIds().isEmpty()){ + query.addCriteria(Criteria.where("siteId").in(mongoChargingOrderQuery.getSiteIds())); + } + if (mongoChargingOrderQuery.getChargingPileCode() != null && !mongoChargingOrderQuery.getChargingPileCode().isEmpty()) { + query.addCriteria(Criteria.where("charging_pile_code").is(mongoChargingOrderQuery.getChargingPileCode())); + } + if (mongoChargingOrderQuery.getChargingGunCode() != null && !mongoChargingOrderQuery.getChargingGunCode().isEmpty()){ + query.addCriteria(Criteria.where("charging_gun_code").is(mongoChargingOrderQuery.getChargingGunCode())); + } + if (mongoChargingOrderQuery.getStatus() != null){ + query.addCriteria(Criteria.where("status").is(mongoChargingOrderQuery.getStatus())); + } + + if (mongoChargingOrderQuery.getCreateTime() != null) { + String[] split = mongoChargingOrderQuery.getCreateTime().split(" - "); + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date start = dateFormat.parse(split[0]); + Date end = dateFormat.parse(split[1]); + query.addCriteria(Criteria.where("create_time").gte(start).lt(end)); + } + + if (mongoChargingOrderQuery.getLastTime() != null && mongoChargingOrderQuery.getLastTime() != null) { + String[] split = mongoChargingOrderQuery.getLastTime().split(" - "); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date start = dateFormat.parse(split[0]); + Date end = dateFormat.parse(split[1]); + query.addCriteria(Criteria.where("last_time").gte(start).lt(end)); + } + + + + + + + + + + long totalElements = mongoTemplate.count(query, UploadRealTimeMonitoringData.class); + + // 创建带有排序的 Pageable 对象 + Pageable pageable = PageRequest.of( + mongoChargingOrderQuery.getPageCurr()-1, + mongoChargingOrderQuery.getPageSize(), + Sort.by(Sort.Direction.DESC, "create_time") + ); + + // 设置分页和排序 + query.with(pageable); + + // 执行查询并获取 Page 对象 + List<UploadRealTimeMonitoringData> page = mongoTemplate.find(query, UploadRealTimeMonitoringData.class,"upload_real_time_monitoring_data"); + + // 设置分页 +// Pageable pageable = PageRequest.of(mongoChargingOrderQuery.getPageSize()*(mongoChargingOrderQuery.getPageCurr()-1), mongoChargingOrderQuery.getPageSize()); +// query.with(pageable); +// query.with(Sort.by(Sort.Direction.DESC,"create_time")); + List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringData = mongoTemplate.find( + query + , UploadRealTimeMonitoringData.class); + + UploadRealTimeMonitoringPageData uploadRealTimeMonitoringPageData = new UploadRealTimeMonitoringPageData(); + uploadRealTimeMonitoringPageData.setCount(totalElements); + uploadRealTimeMonitoringPageData.setRecords(page); + return uploadRealTimeMonitoringPageData; + } + + @Override + public UploadRealTimeMonitoringData getLastDataById(String transaction_serial_number) { + Query query = new Query(); + if (StringUtils.isNotEmpty(transaction_serial_number)){ + query.addCriteria(Criteria.where("transaction_serial_number").is(transaction_serial_number)); + } + // 按照 createdAt 字段降序排序 + query.with(Sort.by(Sort.Direction.DESC, "create_time")); + // 限制结果只返回一条记录 + query.limit(1); + return mongoTemplate.findOne(query, UploadRealTimeMonitoringData.class); + } + + @Override + public void delete(String id) { + UploadRealTimeMonitoringData byId = findById(id.toString()); + mongoTemplate.remove(byId); + } + + @Override + public void updateById(String id) { + // 创建查询条件 + Query query = new Query(Criteria.where("_id").is(id)); + // 创建更新对象 + Update update = new Update().set("last_time", new Date()); + // 执行更新操作 + mongoTemplate.updateFirst(query, update, UploadRealTimeMonitoringData.class); + } + +} diff --git a/ruoyi-service/ruoyi-integration/pom.xml b/ruoyi-service/ruoyi-integration/pom.xml index 9874e38..f7b1321 100644 --- a/ruoyi-service/ruoyi-integration/pom.xml +++ b/ruoyi-service/ruoyi-integration/pom.xml @@ -115,33 +115,7 @@ <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> - <!--rocketmq--> -<!-- <dependency>--> -<!-- <groupId>com.alibaba.cloud</groupId>--> -<!-- <artifactId>spring-cloud-starter-stream-rocketmq</artifactId>--> -<!-- <version>2.2.2.RELEASE</version>--> -<!-- <exclusions>--> -<!-- <exclusion>--> -<!-- <groupId>org.apache.rocketmq</groupId>--> -<!-- <artifactId>rocketmq-client</artifactId>--> -<!-- </exclusion>--> -<!-- <exclusion>--> -<!-- <groupId>org.apache.rocketmq</groupId>--> -<!-- <artifactId>rocketmq-acl</artifactId>--> -<!-- </exclusion>--> -<!-- </exclusions>--> -<!-- </dependency>--> -<!-- <dependency>--> -<!-- <groupId>org.apache.rocketmq</groupId>--> -<!-- <artifactId>rocketmq-client</artifactId>--> -<!-- <version>4.7.1</version>--> -<!-- </dependency>--> -<!-- <dependency>--> -<!-- <groupId>org.apache.rocketmq</groupId>--> -<!-- <artifactId>rocketmq-acl</artifactId>--> -<!-- <version>4.7.1</version>--> -<!-- </dependency>--> - + <dependency> <groupId>org.apache.rocketmq</groupId> <artifactId>rocketmq-spring-boot-starter</artifactId> diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/controller/UploadRealTimeMonitoringDataController.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/controller/UploadRealTimeMonitoringDataController.java index 1fa5baf..35b4c16 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/controller/UploadRealTimeMonitoringDataController.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/controller/UploadRealTimeMonitoringDataController.java @@ -32,13 +32,9 @@ * @return */ @PostMapping(value = "/getOrderInfoByCode") - public R<UploadRealTimeMonitoringData> chargingOrderInfo(@RequestParam("orderId") String orderId){ - List<UploadRealTimeMonitoringData> dataByOrderCode = uploadRealTimeMonitoringDataService.getDataByOrderCode(orderId); - if(dataByOrderCode.size() > 0){ - UploadRealTimeMonitoringData uploadRealTimeMonitoringData = dataByOrderCode.get(0); - return R.ok(uploadRealTimeMonitoringData); - } - return R.ok(); + public R<UploadRealTimeMonitoringData> getOrderInfoByCode(@RequestParam("orderId") String orderId){ + UploadRealTimeMonitoringData dataByOrderCode = uploadRealTimeMonitoringDataService.getLastDataById(orderId); + return R.ok(dataByOrderCode); } /** diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java index 6c047ac..048678b 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/listener/IotMessageListener.java @@ -84,7 +84,7 @@ if(!"}".equals(substring)){ content1 = content1.substring(0, content1.length() - 1) + "}"; } - System.out.println("content1:"+content1); + log.info("content1:"+content1); content = JSON.parseObject(content1); } JSONObject header = jsonObject.getJSONObject("notify_data").getJSONObject("header"); diff --git a/ruoyi-service/ruoyi-order/pom.xml b/ruoyi-service/ruoyi-order/pom.xml index c0c8fee..6df4555 100644 --- a/ruoyi-service/ruoyi-order/pom.xml +++ b/ruoyi-service/ruoyi-order/pom.xml @@ -150,7 +150,11 @@ <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> - + <!--mongodb--> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-mongodb</artifactId> + </dependency> <dependency> <groupId>cn.afterturn</groupId> <artifactId>easypoi-spring-boot-starter</artifactId> @@ -162,7 +166,6 @@ </exclusion> </exclusions> </dependency> - </dependencies> <build> diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java index 2838c76..c67c52a 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java @@ -57,6 +57,7 @@ import com.ruoyi.order.dto.*; import com.ruoyi.order.service.*; import com.ruoyi.order.util.PreviousSixMonths; +import com.ruoyi.order.util.mongodb.service.UploadRealTimeMonitoringDataService; import com.ruoyi.order.vo.EndOfChargePageInfo; import com.ruoyi.order.vo.WatchChargingOrderVo; import com.ruoyi.other.api.feignClient.RoleSiteClient; @@ -148,7 +149,7 @@ @Resource private TOrderInvoiceService invoiceService; @Resource - private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; + private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; @Resource private PartnerClient partnerClient; @Resource @@ -1243,7 +1244,7 @@ @GetMapping(value = "/watch/deletes") @ApiOperation(value = "监控订单-删除", tags = {"管理后台-订单管理"}) public R watchChargingOrder(@RequestParam String id) { - uploadRealTimeMonitoringDataClient.delete(id); + uploadRealTimeMonitoringDataService.delete(id); return R.ok(); } 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 3c3e937..46af198 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 @@ -21,7 +21,6 @@ import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.common.security.utils.SecurityUtils; -import com.ruoyi.integration.api.feignClient.ChargingHandshakeClient; import com.ruoyi.integration.api.feignClient.PlatformStartChargingReplyClient; import com.ruoyi.integration.api.feignClient.SendMessageClient; import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; @@ -50,6 +49,9 @@ import com.ruoyi.order.service.TChargingOrderService; import com.ruoyi.order.service.TOrderEvaluateService; import com.ruoyi.order.service.*; +import com.ruoyi.order.util.mongodb.service.PlatformStartChargingReplyService; +import com.ruoyi.order.util.mongodb.service.TransactionRecordService; +import com.ruoyi.order.util.mongodb.service.UploadRealTimeMonitoringDataService; import com.ruoyi.order.vo.EndOfChargePageInfo; import com.ruoyi.other.api.domain.*; import com.ruoyi.order.vo.ChargingOrderListInfoVO; @@ -140,7 +142,7 @@ private RedisService redisService; @Resource - private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; + private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; @Resource private TCECClient tcecClient; @@ -161,7 +163,7 @@ private AccountingStrategyClient accountingStrategyClient; @Resource - private PlatformStartChargingReplyClient platformStartChargingReplyClient; + private PlatformStartChargingReplyService platformStartChargingReplyService; @Resource private TChargingOrderRefundService chargingOrderRefundService; @@ -196,9 +198,6 @@ @Resource private SecurityDetectionClient securityDetectionClient; - @Resource - private BmsDemandAndChargerExportationClient bmsDemandAndChargerExportationClient; - //计数器 private Map<String, Integer> counter_map = new HashMap<>(); @@ -209,7 +208,7 @@ private OperatorClient operatorClient; @Resource - private TransactionRecordClient transactionRecordClient; + private TransactionRecordService transactionRecordService; @Resource private ITChargingOrderSummaryDataService chargingOrderSummaryDataService; @@ -286,8 +285,12 @@ }else{ myChargingOrderInfo.setLicensePlate(chargingOrder.getPlateNum()); } - myChargingOrderInfo.setStartTime(chargingOrder.getStartTime().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond() * 1000); - myChargingOrderInfo.setEndTime(chargingOrder.getEndTime().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond() * 1000); + if(null != chargingOrder.getStartTime()){ + myChargingOrderInfo.setStartTime(chargingOrder.getStartTime().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond() * 1000); + } + if(null != chargingOrder.getEndTime()){ + myChargingOrderInfo.setEndTime(chargingOrder.getEndTime().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond() * 1000); + } myChargingOrderInfo.setOrderAmount(chargingOrder.getOrderAmount()); myChargingOrderInfo.setPaymentAmount(chargingOrder.getPaymentAmount()); myChargingOrderInfo.setRechargeAmount(chargingOrder.getRechargeAmount()); @@ -299,7 +302,7 @@ .orderByAsc(TChargingOrderAccountingStrategy::getStartTime) ); myChargingOrderInfo.setStageCost(stageCost); - List<UploadRealTimeMonitoringData> dataList = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrder.getCode()).getData(); + List<UploadRealTimeMonitoringData> dataList = uploadRealTimeMonitoringDataService.getDataByOrderCode(chargingOrder.getCode()); if(null != dataList){ //在MongoDB中获取数据 SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); @@ -385,7 +388,6 @@ * @return */ @Override - @GlobalTransactional(rollbackFor = Exception.class) public AjaxResult paymentChargingOrder(AddChargingOrder addChargingOrder) { Long userId = tokenService.getLoginUserApplet().getUserId(); TAppUser appUser = appUserClient.getUserById(userId).getData(); @@ -572,7 +574,6 @@ * @return */ @Override - @GlobalTransactional(rollbackFor = Exception.class) public AjaxResult chargingOrderCallback(Integer paymentType, String out_trade_no, String transaction_id, String attach) { TChargingOrder chargingOrder = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, out_trade_no)); if(chargingOrder.getRechargePaymentStatus() == 2){ @@ -725,7 +726,7 @@ } String code = chargingOrder.getCode(); String key = "AQJC_" + chargingOrder.getChargingGunId(); - List<PlatformStartChargingReply> data = platformStartChargingReplyClient.getPlatformStartChargingReply(code).getData(); + List<PlatformStartChargingReply> data = platformStartChargingReplyService.getPlatformStartChargingReply(code); log.info(code + ":-------------------开始检查调起充电结果-------------------" + data.toString()); if(data.size() != 0){ PlatformStartChargingReply platformStartChargingReply = data.get(1); @@ -1095,7 +1096,7 @@ chargingDetails.setCode(one.getCode()); chargingDetails.setStatus(one.getStatus()); chargingDetails.setChargingCost(one.getResidualAmount()); - UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataClient.chargingOrderInfo(one.getCode()).getData(); + UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataService.getLastDataById(one.getCode()); if(null != data){ chargingDetails.setChargeCurrent(data.getOutput_current()); chargingDetails.setChargeVoltage(data.getOutput_voltage()); @@ -1124,7 +1125,6 @@ * @return */ @Override - @GlobalTransactional(rollbackFor = Exception.class) public AjaxResult stopCharging(String id) { TChargingOrder order = this.getById(id); Integer status = order.getStatus(); @@ -1736,7 +1736,7 @@ } // 获取开始SOC 结束soc if (chargingOrderListVO.getCode()!=null){ - List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrderListVO.getCode()).getData(); + List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataService.getDataByOrderCode(chargingOrderListVO.getCode()); if (data6!=null && !data6.isEmpty()){ int min = 100; @@ -2045,7 +2045,7 @@ // 获取开始SOC 结束soc if (chargingOrder.getCode()!=null){ - List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrder.getCode()).getData(); + List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataService.getDataByOrderCode(chargingOrder.getCode()); if (data6!=null){ for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : data6) { if (uploadRealTimeMonitoringData.getOutput_current()!=null&& @@ -2154,7 +2154,6 @@ * @param orderCode */ @Override - @GlobalTransactional(rollbackFor = Exception.class) public void endCharge(String orderCode, Integer endMode) { TChargingOrder order = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, orderCode)); TChargingOrder chargingOrder = new TChargingOrder(); @@ -2179,7 +2178,6 @@ * @param vo */ @Override - @GlobalTransactional(rollbackFor = Exception.class) public R endChargeBillingCharge(TransactionRecordMessageVO vo) { TChargingOrder chargingOrder = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, vo.getTransaction_serial_number())); if(null == chargingOrder){ @@ -2396,7 +2394,7 @@ TChargingOrder order = new TChargingOrder(); order.setId(chargingOrder.getId()); order.setAppUserId(chargingOrder.getAppUserId()); - UploadRealTimeMonitoringData uploadRealTimeMonitoringData = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); + UploadRealTimeMonitoringData uploadRealTimeMonitoringData = uploadRealTimeMonitoringDataService.getLastDataById(chargingOrder.getCode()); if(null != uploadRealTimeMonitoringData && null == chargingOrder.getEndMode()){ Integer soc = uploadRealTimeMonitoringData.getSoc(); if(soc >= 98){ @@ -3990,7 +3988,7 @@ .ne(TChargingOrder::getElectricity, 0).in(TChargingOrder::getStatus, Arrays.asList(4, 5))); List<Map<String, Object>> mapList = new ArrayList<>(); for (TChargingOrder order : list) { - TransactionRecord transactionRecord = transactionRecordClient.findTransactionRecord(order.getCode()).getData(); + TransactionRecord transactionRecord = transactionRecordService.findOne(order.getCode()); Map<String, Object> map = new HashMap<>(); map.put("order", order); map.put("transactionRecord", transactionRecord); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java index 84b6550..c31e936 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderEvaluateServiceImpl.java @@ -325,7 +325,6 @@ * @return */ @Override - @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 public AjaxResult addOrderEvaluate(OrderEvaluateVo query) { TOrderEvaluate orderEvaluate = this.getOne(new LambdaQueryWrapper<TOrderEvaluate>().eq(TOrderEvaluate::getOrderId, query.getOrderId()) .eq(TOrderEvaluate::getOrderType, query.getOrderType()).eq(TOrderEvaluate::getDelFlag, 0)); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java index 16a0f3b..09b19fc 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TOrderInvoiceServiceImpl.java @@ -95,7 +95,6 @@ * @return */ @Override - @GlobalTransactional(rollbackFor = Exception.class) public AjaxResult addOrderInvoice(AddOrderInvoice addOrderInvoice) { Long userId = tokenService.getLoginUserApplet().getUserId(); String orders = addOrderInvoice.getOrders(); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java index 7602a31..66eb669 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java @@ -485,7 +485,6 @@ * @return */ @Override - @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 public AjaxResult cancelShoppingOrderWxRefund(String out_refund_no, String refund_id, String refund_status, String success_time) { TShoppingOrderRefund one = shoppingOrderRefundService.getOne(new LambdaQueryWrapper<TShoppingOrderRefund>().eq(TShoppingOrderRefund::getRefundCode, out_refund_no)); one.setRefundStatus(2); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/base/BaseService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/base/BaseService.java new file mode 100644 index 0000000..178015c --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/base/BaseService.java @@ -0,0 +1,28 @@ +package com.ruoyi.order.util.mongodb.base; + + +import java.util.List; + +public interface BaseService<T> { + + /** + * 添加 + * @param t 实体类 + * @return 添加结果 1=成功 0=失败 + */ + int create(T t); + + /** + * 根据id查询 + * @param id 实体id + * @return 实体对象 + */ + T findById(String id); + + /** + * 查询列表 + * @return 实体列表 + */ + List<T> findAll(); + +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/BmsDemandAndChargerExportationService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/BmsDemandAndChargerExportationService.java new file mode 100644 index 0000000..524ef13 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/BmsDemandAndChargerExportationService.java @@ -0,0 +1,20 @@ +package com.ruoyi.order.util.mongodb.service; + +import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; +import com.ruoyi.order.util.mongodb.base.BaseService; + +import java.util.List; + +public interface BmsDemandAndChargerExportationService extends BaseService<BmsDemandAndChargerExportation> { + + + /** + * 获取bms数据 + * @param orderCode + * @return + */ + List<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(String orderCode); + + + +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/ChargingHandshakeService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/ChargingHandshakeService.java new file mode 100644 index 0000000..2ee0c10 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/ChargingHandshakeService.java @@ -0,0 +1,13 @@ +package com.ruoyi.order.util.mongodb.service; + +import com.ruoyi.integration.api.model.ChargingHandshake; +import com.ruoyi.order.util.mongodb.base.BaseService; + +public interface ChargingHandshakeService extends BaseService<ChargingHandshake> { + + + ChargingHandshake getDataByOrderCode(String code); + + + +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/PlatformStartChargingReplyService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/PlatformStartChargingReplyService.java new file mode 100644 index 0000000..7c0ed8c --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/PlatformStartChargingReplyService.java @@ -0,0 +1,17 @@ +package com.ruoyi.order.util.mongodb.service; + +import com.ruoyi.integration.api.model.PlatformStartChargingReply; +import com.ruoyi.order.util.mongodb.base.BaseService; + +import java.util.List; + +public interface PlatformStartChargingReplyService extends BaseService<PlatformStartChargingReply> { + + /** + * 根据订单编号查询远程启机应答数据 + * @param code + * @return + */ + List<PlatformStartChargingReply> getPlatformStartChargingReply(String code); + +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/PlatformStopChargingReplyService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/PlatformStopChargingReplyService.java new file mode 100644 index 0000000..7d22bc6 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/PlatformStopChargingReplyService.java @@ -0,0 +1,15 @@ +package com.ruoyi.order.util.mongodb.service; + +import com.ruoyi.integration.api.model.PlatformStopChargingReply; +import com.ruoyi.integration.api.vo.GetPlatformStopChargingReply; +import com.ruoyi.order.util.mongodb.base.BaseService; + +public interface PlatformStopChargingReplyService extends BaseService<PlatformStopChargingReply> { + + /** + * 根据枪编号获取停机应答 + * @return + */ + PlatformStopChargingReply getPlatformStopChargingReply(GetPlatformStopChargingReply query); + +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/SecurityDetectionService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/SecurityDetectionService.java new file mode 100644 index 0000000..8ac54db --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/SecurityDetectionService.java @@ -0,0 +1,17 @@ +package com.ruoyi.order.util.mongodb.service; + +import com.ruoyi.integration.api.model.SecurityDetection; +import com.ruoyi.order.util.mongodb.base.BaseService; + +/** + */ +public interface SecurityDetectionService extends BaseService<SecurityDetection> { + + + /** + * 根据业务流水号查询数据 + * @param transactionSerialNumber + * @return + */ + SecurityDetection getSecurityDetection(String transactionSerialNumber); +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/TransactionRecordService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/TransactionRecordService.java new file mode 100644 index 0000000..0496189 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/TransactionRecordService.java @@ -0,0 +1,14 @@ +package com.ruoyi.order.util.mongodb.service; + +import com.ruoyi.integration.api.model.TransactionRecord; +import com.ruoyi.order.util.mongodb.base.BaseService; + +public interface TransactionRecordService extends BaseService<TransactionRecord> { + + /** + * 根据订单流水号查询数据 + * @param code + * @return + */ + TransactionRecord findOne(String code); +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/UploadRealTimeMonitoringDataService.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/UploadRealTimeMonitoringDataService.java new file mode 100644 index 0000000..ae90d10 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/UploadRealTimeMonitoringDataService.java @@ -0,0 +1,31 @@ +package com.ruoyi.order.util.mongodb.service; + +import com.ruoyi.common.core.dto.MongoChargingOrderQuery; +import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; +import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; +import com.ruoyi.order.util.mongodb.base.BaseService; + +import java.text.ParseException; +import java.util.List; + +public interface UploadRealTimeMonitoringDataService extends BaseService<UploadRealTimeMonitoringData> { + + /** + * 根据订单号查询监控数据 + * @param code + * @return + */ + List<UploadRealTimeMonitoringData> getDataByOrderCode(String code); + UploadRealTimeMonitoringPageData getDataAll(MongoChargingOrderQuery mongoChargingOrderQuery) throws ParseException; + + /** + * 查询订单最新一条数据 + * @param transaction_serial_number + * @return + */ + UploadRealTimeMonitoringData getLastDataById(String transaction_serial_number); + + void delete(String id); + + void updateById(String id); +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/BmsDemandAndChargerExportationServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/BmsDemandAndChargerExportationServiceImpl.java new file mode 100644 index 0000000..e00ad2b --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/BmsDemandAndChargerExportationServiceImpl.java @@ -0,0 +1,49 @@ +package com.ruoyi.order.util.mongodb.service.impl; + +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.integration.api.model.BmsDemandAndChargerExportation; +import com.ruoyi.order.util.mongodb.service.BmsDemandAndChargerExportationService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Sort; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.List; + +@Service +public class BmsDemandAndChargerExportationServiceImpl implements BmsDemandAndChargerExportationService { + @Autowired + private MongoTemplate mongoTemplate; + @Override + public int create(BmsDemandAndChargerExportation bmsDemandAndChargerExportation) { + mongoTemplate.save(bmsDemandAndChargerExportation); + return 1; + } + + @Override + public BmsDemandAndChargerExportation findById(String id) { + return mongoTemplate.findById(id, BmsDemandAndChargerExportation.class); + } + + @Override + public List<BmsDemandAndChargerExportation> findAll() { + return mongoTemplate.findAll(BmsDemandAndChargerExportation.class); + } + + + @Override + public List<BmsDemandAndChargerExportation> getBmsDemandAndChargerExportation(String orderCode) { + Query query = new Query(); + if(StringUtils.isNotEmpty(orderCode)){ + query.addCriteria(Criteria.where("transaction_serial_number").is(orderCode)); + } + List<BmsDemandAndChargerExportation> uploadRealTimeMonitoringData = mongoTemplate.find( + query.with(Sort.by(Sort.Order.desc("create_time"))) + , BmsDemandAndChargerExportation.class); + return uploadRealTimeMonitoringData; + } + +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/ChargingHandshakeServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/ChargingHandshakeServiceImpl.java new file mode 100644 index 0000000..eeef842 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/ChargingHandshakeServiceImpl.java @@ -0,0 +1,39 @@ +package com.ruoyi.order.util.mongodb.service.impl; + +import com.ruoyi.integration.api.model.ChargingHandshake; +import com.ruoyi.order.util.mongodb.service.ChargingHandshakeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class ChargingHandshakeServiceImpl implements ChargingHandshakeService { + @Autowired + private MongoTemplate mongoTemplate; + @Override + public int create(ChargingHandshake chargingHandshake) { + mongoTemplate.save(chargingHandshake); + return 1; + } + + @Override + public ChargingHandshake findById(String id) { + return mongoTemplate.findById(id, ChargingHandshake.class); + } + + @Override + public List<ChargingHandshake> findAll() { + return mongoTemplate.findAll(ChargingHandshake.class); + } + + @Override + public ChargingHandshake getDataByOrderCode(String code) { + List<ChargingHandshake> charging_gun_code = mongoTemplate.find(new Query().addCriteria(Criteria.where("transaction_serial_number").is(code)), ChargingHandshake.class); + return charging_gun_code.size() > 0 ? charging_gun_code.get(0) : null; + } + +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/PlatformStartChargingReplyServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/PlatformStartChargingReplyServiceImpl.java new file mode 100644 index 0000000..7b1e3ca --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/PlatformStartChargingReplyServiceImpl.java @@ -0,0 +1,47 @@ +package com.ruoyi.order.util.mongodb.service.impl; + +import com.ruoyi.integration.api.model.PlatformStartChargingReply; +import com.ruoyi.order.util.mongodb.service.PlatformStartChargingReplyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class PlatformStartChargingReplyServiceImpl implements PlatformStartChargingReplyService { + @Autowired + private MongoTemplate mongoTemplate; + + @Override + public int create(PlatformStartChargingReply platformStartChargingReply) { + mongoTemplate.save(platformStartChargingReply); + return 1; + } + + @Override + public PlatformStartChargingReply findById(String id) { + return mongoTemplate.findById(id, PlatformStartChargingReply.class); + } + + @Override + public List<PlatformStartChargingReply> findAll() { + return mongoTemplate.findAll(PlatformStartChargingReply.class); + } + + + /** + * 根据订单编号查询远程启机应答数据 + * @param code + * @return + */ + @Override + public List<PlatformStartChargingReply> getPlatformStartChargingReply(String code) { + Query query = new Query(); + query.addCriteria(Criteria.where("transaction_serial_number").is(code)); + List<PlatformStartChargingReply> platformStartChargingReplies = mongoTemplate.find(query, PlatformStartChargingReply.class); + return platformStartChargingReplies; + } +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/PlatformStopChargingReplyServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/PlatformStopChargingReplyServiceImpl.java new file mode 100644 index 0000000..269c21c --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/PlatformStopChargingReplyServiceImpl.java @@ -0,0 +1,48 @@ +package com.ruoyi.order.util.mongodb.service.impl; + +import com.ruoyi.integration.api.model.PlatformStopChargingReply; +import com.ruoyi.integration.api.vo.GetPlatformStopChargingReply; +import com.ruoyi.order.util.mongodb.service.PlatformStopChargingReplyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +@Service +public class PlatformStopChargingReplyServiceImpl implements PlatformStopChargingReplyService { + @Autowired + private MongoTemplate mongoTemplate; + @Override + public int create(PlatformStopChargingReply platformStopChargingReply) { + mongoTemplate.save(platformStopChargingReply); + return 1; + } + + @Override + public PlatformStopChargingReply findById(String id) { + return mongoTemplate.findById(id, PlatformStopChargingReply.class); + } + + @Override + public List<PlatformStopChargingReply> findAll() { + return mongoTemplate.findAll(PlatformStopChargingReply.class); + } + + + /** + * 根据枪编号获取 + * @return + */ + @Override + public PlatformStopChargingReply getPlatformStopChargingReply(GetPlatformStopChargingReply query) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + List<PlatformStopChargingReply> platformStopChargingReplies = mongoTemplate.find(new Query().addCriteria(Criteria.where("charging_pile_code").is(query.getCharging_pile_code()) + .and("charging_gun_code").is(query.getCharging_gun_code()).and("create_time").lte(sdf.format(new Date())).gte(query.getEnd_time())), PlatformStopChargingReply.class); + return platformStopChargingReplies.size() > 0 ? platformStopChargingReplies.get(0) : null; + } +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/SecurityDetectionServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/SecurityDetectionServiceImpl.java new file mode 100644 index 0000000..ec59a61 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/SecurityDetectionServiceImpl.java @@ -0,0 +1,49 @@ +package com.ruoyi.order.util.mongodb.service.impl; + +import com.ruoyi.integration.api.model.SecurityDetection; +import com.ruoyi.order.util.mongodb.service.SecurityDetectionService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; + +import java.util.List; + + +/** + * 心跳包应答实现类 + **/ +@Service +public class SecurityDetectionServiceImpl implements SecurityDetectionService { + @Autowired + private MongoTemplate mongoTemplate; + + @Override + public int create(SecurityDetection securityDetection) { + mongoTemplate.save(securityDetection); + return 1; + } + + @Override + public SecurityDetection findById(String id) { + return mongoTemplate.findById(id, SecurityDetection.class); + } + + @Override + public List<SecurityDetection> findAll() { + return mongoTemplate.findAll(SecurityDetection.class); + } + + /** + * 根据业务流水号查询数据 + * @param transactionSerialNumber + * @return + */ + @Override + public SecurityDetection getSecurityDetection(String transactionSerialNumber) { + List<SecurityDetection> securityDetectionList = mongoTemplate.find(new Query().addCriteria(Criteria.where("transaction_serial_number") + .is(transactionSerialNumber)), SecurityDetection.class); + return securityDetectionList.size() > 0 ? securityDetectionList.get(0) : null; + } +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/TransactionRecordServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/TransactionRecordServiceImpl.java new file mode 100644 index 0000000..6fe533e --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/TransactionRecordServiceImpl.java @@ -0,0 +1,51 @@ +package com.ruoyi.order.util.mongodb.service.impl; + +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.integration.api.model.TransactionRecord; +import com.ruoyi.order.util.mongodb.service.TransactionRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Sort; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class TransactionRecordServiceImpl implements TransactionRecordService { + @Autowired + private MongoTemplate mongoTemplate; + @Override + public int create(TransactionRecord transactionRecord) { + mongoTemplate.save(transactionRecord); + return 1; + } + + @Override + public TransactionRecord findById(String id) { + return mongoTemplate.findById(id, TransactionRecord.class); + } + + @Override + public List<TransactionRecord> findAll() { + return mongoTemplate.findAll(TransactionRecord.class); + } + + /** + * 根据订单流水号查询数据 + * @param code + * @return + */ + @Override + public TransactionRecord findOne(String code) { + Query query = new Query(); + if(StringUtils.isNotEmpty(code)){ + query.addCriteria(Criteria.where("transaction_serial_number").is(code)); + } + List<TransactionRecord> transactionRecords = mongoTemplate.find( + query.with(Sort.by(Sort.Order.desc("create_time"))) + , TransactionRecord.class); + return transactionRecords.size() > 0 ? transactionRecords.get(0) : null; + } +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/UploadRealTimeMonitoringDataServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/UploadRealTimeMonitoringDataServiceImpl.java new file mode 100644 index 0000000..1e0b313 --- /dev/null +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/mongodb/service/impl/UploadRealTimeMonitoringDataServiceImpl.java @@ -0,0 +1,174 @@ +package com.ruoyi.order.util.mongodb.service.impl; + +import com.ruoyi.common.core.dto.MongoChargingOrderQuery; +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; +import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; +import com.ruoyi.order.util.mongodb.service.UploadRealTimeMonitoringDataService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.data.mongodb.core.query.Update; +import org.springframework.stereotype.Service; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +@Service +public class UploadRealTimeMonitoringDataServiceImpl implements UploadRealTimeMonitoringDataService { + @Autowired + private MongoTemplate mongoTemplate; + + @Override + public int create(UploadRealTimeMonitoringData uploadRealTimeMonitoringData) { + mongoTemplate.save(uploadRealTimeMonitoringData); + return 1; + } + + @Override + public UploadRealTimeMonitoringData findById(String id) { + return mongoTemplate.findById(id, UploadRealTimeMonitoringData.class); + } + + + @Override + public List<UploadRealTimeMonitoringData> findAll() { + return mongoTemplate.findAll(UploadRealTimeMonitoringData.class); + } + + + /** + * 根据订单号查询监控数据 + * @param code + * @return + */ + @Override + public List<UploadRealTimeMonitoringData> getDataByOrderCode(String code) { + Query query = new Query(); + if(StringUtils.isNotEmpty(code)){ + query.addCriteria(Criteria.where("transaction_serial_number").is(code)); + } + List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringData = mongoTemplate.find( + query.with(Sort.by(Sort.Order.desc("create_time"))) + , UploadRealTimeMonitoringData.class); + return uploadRealTimeMonitoringData; + } + + @Override + public UploadRealTimeMonitoringPageData getDataAll(MongoChargingOrderQuery mongoChargingOrderQuery) throws ParseException { + Query query = new Query(); +// if (!values.isEmpty()){ +// query.addCriteria(Criteria.where("transaction_serial_number").in(values)); +// } + if (mongoChargingOrderQuery.getCode() != null && !mongoChargingOrderQuery.getCode().isEmpty()) { + query.addCriteria(Criteria.where("transaction_serial_number").regex(mongoChargingOrderQuery.getCode(),"i")); // "i" 表示不区分大小写 + } + if (mongoChargingOrderQuery.getOrderType() !=null){ + query.addCriteria(Criteria.where("orderType").is(mongoChargingOrderQuery.getOrderType())); + } + if (mongoChargingOrderQuery.getSiteId() != null){ + query.addCriteria(Criteria.where("siteId").is(mongoChargingOrderQuery.getSiteId())); + } + if (!mongoChargingOrderQuery.getSiteIds().isEmpty()){ + query.addCriteria(Criteria.where("siteId").in(mongoChargingOrderQuery.getSiteIds())); + } + if (mongoChargingOrderQuery.getChargingPileCode() != null && !mongoChargingOrderQuery.getChargingPileCode().isEmpty()) { + query.addCriteria(Criteria.where("charging_pile_code").is(mongoChargingOrderQuery.getChargingPileCode())); + } + if (mongoChargingOrderQuery.getChargingGunCode() != null && !mongoChargingOrderQuery.getChargingGunCode().isEmpty()){ + query.addCriteria(Criteria.where("charging_gun_code").is(mongoChargingOrderQuery.getChargingGunCode())); + } + if (mongoChargingOrderQuery.getStatus() != null){ + query.addCriteria(Criteria.where("status").is(mongoChargingOrderQuery.getStatus())); + } + + if (mongoChargingOrderQuery.getCreateTime() != null) { + String[] split = mongoChargingOrderQuery.getCreateTime().split(" - "); + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date start = dateFormat.parse(split[0]); + Date end = dateFormat.parse(split[1]); + query.addCriteria(Criteria.where("create_time").gte(start).lt(end)); + } + + if (mongoChargingOrderQuery.getLastTime() != null && mongoChargingOrderQuery.getLastTime() != null) { + String[] split = mongoChargingOrderQuery.getLastTime().split(" - "); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date start = dateFormat.parse(split[0]); + Date end = dateFormat.parse(split[1]); + query.addCriteria(Criteria.where("last_time").gte(start).lt(end)); + } + + + + + + + + + + long totalElements = mongoTemplate.count(query, UploadRealTimeMonitoringData.class); + + // 创建带有排序的 Pageable 对象 + Pageable pageable = PageRequest.of( + mongoChargingOrderQuery.getPageCurr()-1, + mongoChargingOrderQuery.getPageSize(), + Sort.by(Sort.Direction.DESC, "create_time") + ); + + // 设置分页和排序 + query.with(pageable); + + // 执行查询并获取 Page 对象 + List<UploadRealTimeMonitoringData> page = mongoTemplate.find(query, UploadRealTimeMonitoringData.class,"upload_real_time_monitoring_data"); + + // 设置分页 +// Pageable pageable = PageRequest.of(mongoChargingOrderQuery.getPageSize()*(mongoChargingOrderQuery.getPageCurr()-1), mongoChargingOrderQuery.getPageSize()); +// query.with(pageable); +// query.with(Sort.by(Sort.Direction.DESC,"create_time")); + List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringData = mongoTemplate.find( + query + , UploadRealTimeMonitoringData.class); + + UploadRealTimeMonitoringPageData uploadRealTimeMonitoringPageData = new UploadRealTimeMonitoringPageData(); + uploadRealTimeMonitoringPageData.setCount(totalElements); + uploadRealTimeMonitoringPageData.setRecords(page); + return uploadRealTimeMonitoringPageData; + } + + @Override + public UploadRealTimeMonitoringData getLastDataById(String transaction_serial_number) { + Query query = new Query(); + if (StringUtils.isNotEmpty(transaction_serial_number)){ + query.addCriteria(Criteria.where("transaction_serial_number").is(transaction_serial_number)); + } + // 按照 createdAt 字段降序排序 + query.with(Sort.by(Sort.Direction.DESC, "create_time")); + // 限制结果只返回一条记录 + query.limit(1); + return mongoTemplate.findOne(query, UploadRealTimeMonitoringData.class); + } + + @Override + public void delete(String id) { + UploadRealTimeMonitoringData byId = findById(id.toString()); + mongoTemplate.remove(byId); + } + + @Override + public void updateById(String id) { + // 创建查询条件 + Query query = new Query(Criteria.where("_id").is(id)); + // 创建更新对象 + Update update = new Update().set("last_time", new Date()); + // 执行更新操作 + mongoTemplate.updateFirst(query, update, UploadRealTimeMonitoringData.class); + } + +} -- Gitblit v1.7.1