package com.fjhx.controller.amqp;

import com.fjhx.constants.IotProductionRedisPrefixConstant;
import com.fjhx.entity.amqp.AmqpData;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/amqpData")
public class AmqpController {

    @Resource
    private BladeRedis redisCache;

    @PostMapping("/getEquipmentInfo")
    public R getEquipmentInfo(@RequestBody Map<String, String> condition) {
        AmqpData equipmentNo = redisCache.get(IotProductionRedisPrefixConstant.INSTANTANEOUS_STATE + condition.get("equipmentNo"));
        return R.success(equipmentNo);
    }

}
