From 6732f66d7724b1ee5e5ffd53ca4b7146e046331d Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期四, 22 八月 2024 21:03:29 +0800 Subject: [PATCH] 消息发送 --- ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/OnlineReplyServiceImpl.java | 22 ++ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/PlatformStartChargingServiceImpl.java | 31 +++ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/BillingModeVerifyReplyService.java | 8 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/PongService.java | 13 + ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/PlatformConfirmationChargingServiceImpl.java | 31 +++ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/constant/IotConstant.java | 2 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/ReadRealTimeMonitoringDataService.java | 7 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/constant/ServiceIdConstant.java | 28 +++ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/ReadRealTimeMonitoringDataServiceImpl.java | 31 +++ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/tools/MessageUtil.java | 124 +++++++++++-- ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/EndChargeServiceImpl.java | 34 +++ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/UpdateBalance.java | 7 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/OnlineReplyService.java | 6 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/OnlineService.java | 6 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/PlatformStartChargingService.java | 7 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/AcquisitionBillingModeReplyService.java | 7 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/AcquisitionBillingModeReplyServiceImpl.java | 32 +++ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/base/BaseService.java | 28 +++ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/EndChargeService.java | 8 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/BillingModeVerifyReplyServiceImpl.java | 31 +++ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/PlatformConfirmationChargingService.java | 7 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/UpdateBalanceReply.java | 8 ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/PongServiceImpl.java | 38 ++++ ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/OnlineServiceImpl.java | 22 ++ 24 files changed, 507 insertions(+), 31 deletions(-) diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/constant/IotConstant.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/constant/IotConstant.java index b84b38b..a9b79fa 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/constant/IotConstant.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/constant/IotConstant.java @@ -1,6 +1,8 @@ package com.ruoyi.integration.iotda.constant; public class IotConstant { + public static final int SUCCESS = 1; + public static final int FAIL = 0; /** * 华为云iot token */ diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/constant/ServiceIdConstant.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/constant/ServiceIdConstant.java index d4515f1..8043449 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/constant/ServiceIdConstant.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/constant/ServiceIdConstant.java @@ -5,5 +5,33 @@ * 登录认证应答 */ public static final String ONLINE_REPLY = "online_reply"; + /** + * 登录认证应答 + */ + public static final String PONG = "pong"; + /** + * 计费模型验证请求应答 + */ + public static final String BILLING_MODE_VERIFY_REPLY = "billing_mode_verify_reply"; + /** + * 计费模型请求应答 + */ + public static final String ACQUISITION_BILLING_MODE_REPLY = "acquisition_billing_mode_reply"; + /** + * 读取实时监测数据 + */ + public static final String READ_REAL_TIME_MONITORING_DATA = "read_real_time_monitoring_data"; + /** + * 充电结束 + */ + public static final String END_CHARGE = "end_charge"; + /** + * 运营平台确认启动充电 + */ + public static final String PLATFORM_CONFIRMATION_CHARGING = "platform_confirmation_charging"; + /** + * 运营平台远程控制启机 + */ + public static final String PLATFORM_START_CHARGING = "platform_start_charging"; } diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/tools/MessageUtil.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/tools/MessageUtil.java index bd5dc8f..7691758 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/tools/MessageUtil.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/tools/MessageUtil.java @@ -3,40 +3,122 @@ import com.alibaba.fastjson2.JSONObject; import com.ruoyi.integration.iotda.constant.ServiceIdConstant; - -import java.util.HashMap; -import java.util.Map; +import com.ruoyi.integration.mongodb.model.*; +import com.ruoyi.integration.mongodb.service.*; +import org.apache.poi.ss.formula.functions.T; +import org.springframework.beans.factory.annotation.Autowired; public class MessageUtil { + @Autowired + private OnlineReplyService onlineReplyService; + @Autowired + private PongService pongService; + @Autowired + private BillingModeVerifyReplyService billingModeVerifyReplyService; + @Autowired + private AcquisitionBillingModeReplyService acquisitionBillingModeReplyService; + @Autowired + private ReadRealTimeMonitoringDataService readRealTimeMonitoringDataService; + @Autowired + private EndChargeService endChargeService; + @Autowired + private PlatformConfirmationChargingService platformConfirmationChargingService; + @Autowired + private PlatformStartChargingService platformStartChargingService; + /** * 登录认证应答 - * @param charging_pile_code 桩编码 - * @param online_result 登录结果(0:成功,1:失败) + * @param onlineReply 实体对象 * @return */ - public static String onlineReply(String charging_pile_code,Integer online_result){ - Map<String,Object> map = new HashMap<>(3); - map.put("service_id", ServiceIdConstant.ONLINE_REPLY); - map.put("charging_pile_code",charging_pile_code); - map.put("online_result",online_result); - return JSONObject.toJSONString(map); + public String onlineReply(OnlineReply onlineReply){ + onlineReplyService.create(onlineReply); + return getMessageJsonString(onlineReply, ServiceIdConstant.ONLINE_REPLY); } /** * 心跳包应答 - * @param charging_pile_code 桩编码 - * @param charging_gun_code 枪号 - * @param charging_gun_status 心跳应答(0) + * @param pong 实体对象 * @return */ - public static String pong(String charging_pile_code,String charging_gun_code,Integer charging_gun_status){ - Map<String,Object> map = new HashMap<>(3); - map.put("service_id", ServiceIdConstant.ONLINE_REPLY); - map.put("charging_pile_code",charging_pile_code); - map.put("charging_gun_code",charging_gun_code); - map.put("charging_gun_status",charging_gun_status); - return JSONObject.toJSONString(map); + public String pong(Pong pong){ + pongService.create(pong); + return getMessageJsonString(pong, ServiceIdConstant.PONG); + } + + /** + * 计费模型验证请求应答 + * @param billingModeVerifyReply 实体对象 + * @return + */ + public String billingModeVerifyReply(BillingModeVerifyReply billingModeVerifyReply){ + billingModeVerifyReplyService.create(billingModeVerifyReply); + return getMessageJsonString(billingModeVerifyReply, ServiceIdConstant.BILLING_MODE_VERIFY_REPLY); + } + + /** + * 计费模型验证请求应答 + * @param acquisitionBillingModeReply 实体对象 + * @return + */ + public String acquisitionBillingModeReply(AcquisitionBillingModeReply acquisitionBillingModeReply){ + acquisitionBillingModeReplyService.create(acquisitionBillingModeReply); + return getMessageJsonString(acquisitionBillingModeReply, ServiceIdConstant.ACQUISITION_BILLING_MODE_REPLY); + } + + /** + * 读取实时监测数据 + * @param readRealTimeMonitoringData 实体对象 + * @return + */ + public String readRealTimeMonitoringData(ReadRealTimeMonitoringData readRealTimeMonitoringData){ + readRealTimeMonitoringDataService.create(readRealTimeMonitoringData); + return getMessageJsonString(readRealTimeMonitoringData, ServiceIdConstant.READ_REAL_TIME_MONITORING_DATA); + } + + /** + * 充电结束 + * @param endCharge 实体对象 + * @return + */ + public String endCharge(EndCharge endCharge){ + endChargeService.create(endCharge); + return getMessageJsonString(endCharge, ServiceIdConstant.END_CHARGE); + } + + /** + * 运营平台确认启动充电 + * @param platformConfirmationCharging 实体对象 + * @return + */ + public String platformConfirmationCharging(PlatformConfirmationCharging platformConfirmationCharging){ + platformConfirmationChargingService.create(platformConfirmationCharging); + return getMessageJsonString(platformConfirmationCharging, ServiceIdConstant.PLATFORM_CONFIRMATION_CHARGING); + } + + /** + * 运营平台远程控制启机 + * @param platformStartCharging 实体对象 + * @return + */ + public String platformConfirmationCharging(PlatformStartCharging platformStartCharging){ + platformStartChargingService.create(platformStartCharging); + return getMessageJsonString(platformStartCharging, ServiceIdConstant.PLATFORM_START_CHARGING); + } + + + + /** + * 统一封装消息 + * @param object 实体对象 + * @param serviceId 服务ID + * @return + */ + private String getMessageJsonString(Object object, String serviceId){ + JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object)); + jsonObject.put("service_id", serviceId); + return jsonObject.toJSONString(); } } diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/base/BaseService.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/base/BaseService.java new file mode 100644 index 0000000..8d4e064 --- /dev/null +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/base/BaseService.java @@ -0,0 +1,28 @@ +package com.ruoyi.integration.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-integration/src/main/java/com/ruoyi/integration/mongodb/model/UpdateBalance.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/UpdateBalance.java index 711d8d2..847e495 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/UpdateBalance.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/UpdateBalance.java @@ -15,9 +15,10 @@ @Accessors(chain = true) public class UpdateBalance { - private String charging_pile_code; //桩编码 - private String physical_card_number; //物理卡号 - private BigDecimal account_balance; //修改结果(:0:修改成功,1:设备编号错误,2:卡号错误) + private String charging_pile_code;// 桩编码 + private String charging_gun_code;// 抢号 + private String physical_card_number;// 物理卡号 + private BigDecimal account_balance;// 修改后账户金额 } diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/UpdateBalanceReply.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/UpdateBalanceReply.java index c053589..1c82407 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/UpdateBalanceReply.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/model/UpdateBalanceReply.java @@ -15,11 +15,9 @@ @Accessors(chain = true) public class UpdateBalanceReply { - private String charging_pile_code;// 桩编码 - private String charging_gun_code;// 抢号 - private String physical_card_number;// 物理卡号 - private BigDecimal account_balance;// 修改后账户金额 - + private String charging_pile_code; //桩编码 + private String physical_card_number; //物理卡号 + private BigDecimal account_balance; //修改结果(:0:修改成功,1:设备编号错误,2:卡号错误) } diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/AcquisitionBillingModeReplyService.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/AcquisitionBillingModeReplyService.java new file mode 100644 index 0000000..d16587c --- /dev/null +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/AcquisitionBillingModeReplyService.java @@ -0,0 +1,7 @@ +package com.ruoyi.integration.mongodb.service; + +import com.ruoyi.integration.mongodb.base.BaseService; +import com.ruoyi.integration.mongodb.model.AcquisitionBillingModeReply; + +public interface AcquisitionBillingModeReplyService extends BaseService<AcquisitionBillingModeReply> { +} diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/BillingModeVerifyReplyService.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/BillingModeVerifyReplyService.java new file mode 100644 index 0000000..aefa979 --- /dev/null +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/BillingModeVerifyReplyService.java @@ -0,0 +1,8 @@ +package com.ruoyi.integration.mongodb.service; + +import com.ruoyi.integration.mongodb.base.BaseService; +import com.ruoyi.integration.mongodb.model.BillingModeVerifyReply; +import org.springframework.stereotype.Service; + +public interface BillingModeVerifyReplyService extends BaseService<BillingModeVerifyReply> { +} diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/EndChargeService.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/EndChargeService.java new file mode 100644 index 0000000..8626bf9 --- /dev/null +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/EndChargeService.java @@ -0,0 +1,8 @@ +package com.ruoyi.integration.mongodb.service; + +import com.ruoyi.integration.mongodb.base.BaseService; +import com.ruoyi.integration.mongodb.model.EndCharge; + +public interface EndChargeService extends BaseService<EndCharge> { + +} diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/OnlineReplyService.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/OnlineReplyService.java index 2985efc..ecf59cb 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/OnlineReplyService.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/OnlineReplyService.java @@ -1,8 +1,12 @@ package com.ruoyi.integration.mongodb.service; +import com.ruoyi.integration.mongodb.base.BaseService; +import com.ruoyi.integration.mongodb.model.OnlineReply; +import org.springframework.stereotype.Service; + /** * 登录认证应答接口 */ -public interface OnlineReplyService { +public interface OnlineReplyService extends BaseService<OnlineReply> { } diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/OnlineService.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/OnlineService.java index a6744bc..bd152a3 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/OnlineService.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/OnlineService.java @@ -1,8 +1,12 @@ package com.ruoyi.integration.mongodb.service; +import com.ruoyi.integration.mongodb.base.BaseService; +import com.ruoyi.integration.mongodb.model.Online; +import org.springframework.stereotype.Service; + /** * 充电桩登录认证接口 */ -public interface OnlineService { +public interface OnlineService extends BaseService<Online> { } diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/PlatformConfirmationChargingService.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/PlatformConfirmationChargingService.java new file mode 100644 index 0000000..cf60b5a --- /dev/null +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/PlatformConfirmationChargingService.java @@ -0,0 +1,7 @@ +package com.ruoyi.integration.mongodb.service; + +import com.ruoyi.integration.mongodb.base.BaseService; +import com.ruoyi.integration.mongodb.model.PlatformConfirmationCharging; + +public interface PlatformConfirmationChargingService extends BaseService<PlatformConfirmationCharging> { +} diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/PlatformStartChargingService.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/PlatformStartChargingService.java new file mode 100644 index 0000000..4c45229 --- /dev/null +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/PlatformStartChargingService.java @@ -0,0 +1,7 @@ +package com.ruoyi.integration.mongodb.service; + +import com.ruoyi.integration.mongodb.base.BaseService; +import com.ruoyi.integration.mongodb.model.PlatformStartCharging; + +public interface PlatformStartChargingService extends BaseService<PlatformStartCharging> { +} diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/PongService.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/PongService.java new file mode 100644 index 0000000..459d53b --- /dev/null +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/PongService.java @@ -0,0 +1,13 @@ +package com.ruoyi.integration.mongodb.service; + +import com.ruoyi.integration.mongodb.base.BaseService; +import com.ruoyi.integration.mongodb.model.Online; +import com.ruoyi.integration.mongodb.model.Pong; +import org.springframework.stereotype.Service; + +/** + * 心跳包应答接口 + */ +public interface PongService extends BaseService<Pong> { + +} diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/ReadRealTimeMonitoringDataService.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/ReadRealTimeMonitoringDataService.java new file mode 100644 index 0000000..f77a87c --- /dev/null +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/ReadRealTimeMonitoringDataService.java @@ -0,0 +1,7 @@ +package com.ruoyi.integration.mongodb.service; + +import com.ruoyi.integration.mongodb.base.BaseService; +import com.ruoyi.integration.mongodb.model.ReadRealTimeMonitoringData; + +public interface ReadRealTimeMonitoringDataService extends BaseService<ReadRealTimeMonitoringData> { +} diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/AcquisitionBillingModeReplyServiceImpl.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/AcquisitionBillingModeReplyServiceImpl.java new file mode 100644 index 0000000..bb0bbb5 --- /dev/null +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/AcquisitionBillingModeReplyServiceImpl.java @@ -0,0 +1,32 @@ +package com.ruoyi.integration.mongodb.service.impl; + +import com.ruoyi.integration.iotda.constant.IotConstant; +import com.ruoyi.integration.mongodb.model.AcquisitionBillingModeReply; +import com.ruoyi.integration.mongodb.service.AcquisitionBillingModeReplyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.stereotype.Service; + +import java.util.List; +@Service +public class AcquisitionBillingModeReplyServiceImpl implements AcquisitionBillingModeReplyService { + + @Autowired + private MongoTemplate mongoTemplate; + + @Override + public int create(AcquisitionBillingModeReply acquisitionBillingModeReply) { + mongoTemplate.save(acquisitionBillingModeReply); + return IotConstant.SUCCESS; + } + + @Override + public AcquisitionBillingModeReply findById(String id) { + return mongoTemplate.findById(id, AcquisitionBillingModeReply.class); + } + + @Override + public List<AcquisitionBillingModeReply> findAll() { + return mongoTemplate.findAll(AcquisitionBillingModeReply.class); + } +} diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/BillingModeVerifyReplyServiceImpl.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/BillingModeVerifyReplyServiceImpl.java new file mode 100644 index 0000000..324a208 --- /dev/null +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/BillingModeVerifyReplyServiceImpl.java @@ -0,0 +1,31 @@ +package com.ruoyi.integration.mongodb.service.impl; + +import com.ruoyi.integration.iotda.constant.IotConstant; +import com.ruoyi.integration.mongodb.model.BillingModeVerifyReply; +import com.ruoyi.integration.mongodb.service.BillingModeVerifyReplyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.stereotype.Service; + +import java.util.List; +@Service +public class BillingModeVerifyReplyServiceImpl implements BillingModeVerifyReplyService { + @Autowired + private MongoTemplate mongoTemplate; + + @Override + public int create(BillingModeVerifyReply billingModeVerifyReply) { + mongoTemplate.save(billingModeVerifyReply); + return IotConstant.SUCCESS; + } + + @Override + public BillingModeVerifyReply findById(String id) { + return mongoTemplate.findById(id, BillingModeVerifyReply.class); + } + + @Override + public List<BillingModeVerifyReply> findAll() { + return mongoTemplate.findAll(BillingModeVerifyReply.class); + } +} diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/EndChargeServiceImpl.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/EndChargeServiceImpl.java new file mode 100644 index 0000000..d9476dd --- /dev/null +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/EndChargeServiceImpl.java @@ -0,0 +1,34 @@ +package com.ruoyi.integration.mongodb.service.impl; + +import com.ruoyi.integration.iotda.constant.IotConstant; +import com.ruoyi.integration.mongodb.model.EndCharge; +import com.ruoyi.integration.mongodb.model.Pong; +import com.ruoyi.integration.mongodb.service.EndChargeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.stereotype.Service; + +import java.util.List; + + +@Service +public class EndChargeServiceImpl implements EndChargeService { + @Autowired + private MongoTemplate mongoTemplate; + + @Override + public int create(EndCharge endCharge) { + mongoTemplate.save(endCharge); + return IotConstant.SUCCESS; + } + + @Override + public EndCharge findById(String id) { + return mongoTemplate.findById(id, EndCharge.class); + } + + @Override + public List<EndCharge> findAll() { + return mongoTemplate.findAll(EndCharge.class); + } +} diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/OnlineReplyServiceImpl.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/OnlineReplyServiceImpl.java index e4991cc..5652d9d 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/OnlineReplyServiceImpl.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/OnlineReplyServiceImpl.java @@ -1,7 +1,13 @@ package com.ruoyi.integration.mongodb.service.impl; +import com.ruoyi.integration.iotda.constant.IotConstant; +import com.ruoyi.integration.mongodb.model.OnlineReply; import com.ruoyi.integration.mongodb.service.OnlineReplyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.stereotype.Service; + +import java.util.List; /** @@ -10,5 +16,21 @@ @Service public class OnlineReplyServiceImpl implements OnlineReplyService { + @Autowired + private MongoTemplate mongoTemplate; + @Override + public int create(OnlineReply onlineReply) { + mongoTemplate.save(onlineReply); + return IotConstant.SUCCESS; + } + @Override + public OnlineReply findById(String id) { + return null; + } + + @Override + public List<OnlineReply> findAll() { + return null; + } } diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/OnlineServiceImpl.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/OnlineServiceImpl.java index c117a9a..78e3759 100644 --- a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/OnlineServiceImpl.java +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/OnlineServiceImpl.java @@ -1,7 +1,13 @@ package com.ruoyi.integration.mongodb.service.impl; +import com.ruoyi.integration.iotda.constant.IotConstant; +import com.ruoyi.integration.mongodb.model.Online; import com.ruoyi.integration.mongodb.service.OnlineService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.stereotype.Service; + +import java.util.List; /** @@ -9,6 +15,22 @@ **/ @Service public class OnlineServiceImpl implements OnlineService { + @Autowired + private MongoTemplate mongoTemplate; + @Override + public int create(Online online) { + mongoTemplate.save(online); + return IotConstant.SUCCESS; + } + @Override + public Online findById(String id) { + return mongoTemplate.findById(id, Online.class); + } + + @Override + public List<Online> findAll() { + return mongoTemplate.findAll(Online.class); + } } diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/PlatformConfirmationChargingServiceImpl.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/PlatformConfirmationChargingServiceImpl.java new file mode 100644 index 0000000..55bf672 --- /dev/null +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/PlatformConfirmationChargingServiceImpl.java @@ -0,0 +1,31 @@ +package com.ruoyi.integration.mongodb.service.impl; + +import com.ruoyi.integration.iotda.constant.IotConstant; +import com.ruoyi.integration.mongodb.model.PlatformConfirmationCharging; +import com.ruoyi.integration.mongodb.service.PlatformConfirmationChargingService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class PlatformConfirmationChargingServiceImpl implements PlatformConfirmationChargingService { + @Autowired + private MongoTemplate mongoTemplate; + @Override + public int create(PlatformConfirmationCharging platformConfirmationCharging) { + mongoTemplate.save(platformConfirmationCharging); + return IotConstant.SUCCESS; + } + + @Override + public PlatformConfirmationCharging findById(String id) { + return mongoTemplate.findById(id, PlatformConfirmationCharging.class); + } + + @Override + public List<PlatformConfirmationCharging> findAll() { + return mongoTemplate.findAll(PlatformConfirmationCharging.class); + } +} diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/PlatformStartChargingServiceImpl.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/PlatformStartChargingServiceImpl.java new file mode 100644 index 0000000..c8f4cd9 --- /dev/null +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/PlatformStartChargingServiceImpl.java @@ -0,0 +1,31 @@ +package com.ruoyi.integration.mongodb.service.impl; + +import com.ruoyi.integration.iotda.constant.IotConstant; +import com.ruoyi.integration.mongodb.model.PlatformStartCharging; +import com.ruoyi.integration.mongodb.service.PlatformStartChargingService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class PlatformStartChargingServiceImpl implements PlatformStartChargingService { + @Autowired + private MongoTemplate mongoTemplate; + @Override + public int create(PlatformStartCharging platformStartCharging) { + mongoTemplate.save(platformStartCharging); + return IotConstant.SUCCESS; + } + + @Override + public PlatformStartCharging findById(String id) { + return mongoTemplate.findById(id, PlatformStartCharging.class); + } + + @Override + public List<PlatformStartCharging> findAll() { + return mongoTemplate.findAll(PlatformStartCharging.class); + } +} diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/PongServiceImpl.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/PongServiceImpl.java new file mode 100644 index 0000000..eaa822a --- /dev/null +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/PongServiceImpl.java @@ -0,0 +1,38 @@ +package com.ruoyi.integration.mongodb.service.impl; + +import com.ruoyi.integration.iotda.constant.IotConstant; +import com.ruoyi.integration.mongodb.model.Online; +import com.ruoyi.integration.mongodb.model.Pong; +import com.ruoyi.integration.mongodb.service.OnlineService; +import com.ruoyi.integration.mongodb.service.PongService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.stereotype.Service; + +import java.util.List; + + +/** + * 心跳包应答实现类 + **/ +@Service +public class PongServiceImpl implements PongService { + @Autowired + private MongoTemplate mongoTemplate; + + @Override + public int create(Pong pong) { + mongoTemplate.save(pong); + return IotConstant.SUCCESS; + } + + @Override + public Pong findById(String id) { + return mongoTemplate.findById(id, Pong.class); + } + + @Override + public List<Pong> findAll() { + return mongoTemplate.findAll(Pong.class); + } +} diff --git a/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/ReadRealTimeMonitoringDataServiceImpl.java b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/ReadRealTimeMonitoringDataServiceImpl.java new file mode 100644 index 0000000..22e170f --- /dev/null +++ b/ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/mongodb/service/impl/ReadRealTimeMonitoringDataServiceImpl.java @@ -0,0 +1,31 @@ +package com.ruoyi.integration.mongodb.service.impl; + +import com.ruoyi.integration.iotda.constant.IotConstant; +import com.ruoyi.integration.mongodb.model.ReadRealTimeMonitoringData; +import com.ruoyi.integration.mongodb.service.ReadRealTimeMonitoringDataService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.mongodb.core.MongoTemplate; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class ReadRealTimeMonitoringDataServiceImpl implements ReadRealTimeMonitoringDataService { + @Autowired + private MongoTemplate mongoTemplate; + @Override + public int create(ReadRealTimeMonitoringData readRealTimeMonitoringData) { + mongoTemplate.save(readRealTimeMonitoringData); + return IotConstant.SUCCESS; + } + + @Override + public ReadRealTimeMonitoringData findById(String id) { + return mongoTemplate.findById(id, ReadRealTimeMonitoringData.class); + } + + @Override + public List<ReadRealTimeMonitoringData> findAll() { + return mongoTemplate.findAll(ReadRealTimeMonitoringData.class); + } +} -- Gitblit v1.7.1