package com.nmgs.controller;

import com.nmgs.config.ResultData;
import com.nmgs.entity.Consistant;
import com.nmgs.util.PubTools;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("test")
@Api(tags="测试数据")
public class TestController {
    @RequestMapping("testConnection")
    @ApiOperation(value = "测试连接",httpMethod = "GET")
    public ResultData<String> testConnection(){
        return ResultData.success(1,"连接成功");
    }
    @RequestMapping(value = "testMapHex",method = {RequestMethod.POST})
    @ApiOperation(value = "查看缓存里面的数据",httpMethod = "POST")
    public ResultData<String> testMapHex(){
        Map map = Consistant.map;
        return ResultData.success("查询成功",map.toString(),map.size());
    }

    @RequestMapping(value = "hexToString",method = {RequestMethod.POST})
    @ApiOperation(value = "二维码内容解析",httpMethod = "POST")
    public ResultData<String> hexToString(@RequestParam("content") String content){
        String contentRet="";
        contentRet = PubTools.hexToString(content);
        return ResultData.success("查询成功",contentRet,1);
    }

}
