| | |
| | | import com.ruoyi.integration.mongodb.service.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Slf4j |
| | | @Component |
| | |
| | | private PlatformRemoteUpdateService platformRemoteUpdateService; |
| | | @Autowired |
| | | private QrCodeDeliveryService qrCodeDeliveryService; |
| | | @Resource |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | /** |
| | | * 登录认证应答 |
| | |
| | | * @return |
| | | */ |
| | | public JSONObject onlineReply(OnlineReply onlineReply){ |
| | | log.info("登录认证应答:{}", onlineReply); |
| | | onlineReplyService.create(onlineReply); |
| | | return getMessageJsonString(onlineReply, ServiceIdMenu.ONLINE_REPLY.getValue()); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | public JSONObject pong(Pong pong){ |
| | | pongService.create(pong); |
| | | log.info("心跳包应答:{}", pong); |
| | | // pongService.create(pong); |
| | | //存储缓存中,5分钟有效 |
| | | redisTemplate.opsForValue().set("pong:" + pong.getCharging_pile_code() + pong.getCharging_gun_code(), pong, 5, TimeUnit.MINUTES); |
| | | return getMessageJsonString(pong, ServiceIdMenu.PONG.getValue()); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | public JSONObject billingModeVerifyReply(BillingModeVerifyReply billingModeVerifyReply){ |
| | | log.info("计费模型验证请求应答:{}", billingModeVerifyReply); |
| | | billingModeVerifyReplyService.create(billingModeVerifyReply); |
| | | return getMessageJsonString(billingModeVerifyReply, ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getValue()); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | public JSONObject acquisitionBillingModeReply(AcquisitionBillingModeReply acquisitionBillingModeReply){ |
| | | log.info("计费模型验证请求应答:{}", acquisitionBillingModeReply); |
| | | acquisitionBillingModeReplyService.create(acquisitionBillingModeReply); |
| | | return getMessageJsonString(acquisitionBillingModeReply, ServiceIdMenu.ACQUISITION_BILLING_MODE_REPLY.getValue()); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | public JSONObject readRealTimeMonitoringData(ReadRealTimeMonitoringData readRealTimeMonitoringData){ |
| | | log.info("读取实时监测数据:{}", readRealTimeMonitoringData); |
| | | readRealTimeMonitoringDataService.create(readRealTimeMonitoringData); |
| | | return getMessageJsonString(readRealTimeMonitoringData, ServiceIdMenu.READ_REAL_TIME_MONITORING_DATA.getValue()); |
| | | } |
| | |
| | | public JSONObject getMessageJsonString(Object object, String serviceId){ |
| | | JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object)); |
| | | jsonObject.put("service_id", serviceId); |
| | | log.info("发送数据service_id:{},发送内容:{}",serviceId,jsonObject); |
| | | return jsonObject; |
| | | } |
| | | } |