wang-hao-jie
2021-12-07 8a82baca367e2fb25d8fa55d21f9b25f5ece74df
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package cn.exrick.xboot.your.controller.pc;
 
import cn.exrick.xboot.core.common.redis.RedisTemplateHelper;
import cn.exrick.xboot.core.common.utils.ResultUtil;
import cn.exrick.xboot.core.common.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
 
import java.util.*;
 
/**
 * @author whj
 */
@Slf4j
@RestController
@Api(tags = "大屏统计接口")
@RequestMapping("/xboot/pcStatistic")
@Transactional
public class StatisticController {
 
    @Autowired
    private RedisTemplateHelper redisTemplateHelper;
 
    @RequestMapping(value = "/getIndex1", method = RequestMethod.GET)
    @ApiOperation(value = "获取首页数据")
    public Result<Object> getIndex1() {
        Map<String,Object> map = new HashMap<>();
        Set<String> scan = redisTemplateHelper.scan("*statistic1::*");
        for (String str : scan) {
            map.put(str.substring(12),redisTemplateHelper.get(str));
        }
        return new ResultUtil<Object>().setData(map);
    }
}