Pu Zhibing
2025-02-18 628450ded3b738f62f68bc2f7cb90804331eb201
ruoyi-service/ruoyi-integration/src/main/java/com/ruoyi/integration/iotda/utils/tools/MessageUtil.java
@@ -7,7 +7,11 @@
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
@@ -57,6 +61,8 @@
    private PlatformRemoteUpdateService platformRemoteUpdateService;
    @Autowired
    private QrCodeDeliveryService qrCodeDeliveryService;
    @Resource
    private RedisTemplate redisTemplate;
    /**
     * 登录认证应答
@@ -76,7 +82,9 @@
     */
    public JSONObject pong(Pong pong){
        log.info("心跳包应答:{}", pong);
        pongService.create(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());
    }