jinpengyong
2023-09-25 0ce9ec32e0731ef2d7fd61c1da43f9ffd09cca6e
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package com.moral.api.controller;
 
import com.moral.api.pojo.dto.user.UserDTO;
import com.moral.api.pojo.dto.user.UserQueryDTO;
import com.moral.api.pojo.form.user.UserInsertForm;
import com.moral.api.pojo.form.user.UserQueryForm;
import com.moral.api.pojo.form.user.UserUpdateForm;
import com.moral.api.pojo.vo.user.UserQueryVO;
import com.moral.api.service.DeviceAdjustValueService;
import com.moral.api.service.DeviceService;
import com.moral.api.service.UserService;
import com.moral.api.util.CacheUtils;
import com.moral.constant.ResponseCodeEnum;
import com.moral.constant.ResultMessage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.Map;
 
/**
 * @ClassName UserController
 * @Description 用户管理
 * @Author 陈凯裕
 * @Date 2021/3/22 13:52
 * @Version TODO
 **/
@Slf4j
@Api(tags = {"公共功能"})
@RestController
@RequestMapping("/pub")
public class PubController {
    @Autowired
    private CacheUtils cacheUtils;
    @Autowired
    private DeviceService deviceService;
    @Resource
    private DeviceAdjustValueService deviceAdjustValueService;
 
    @GetMapping("deviceAlarmInfo")
    @ApiOperation(value = "设备因子", notes = "设备因子")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String")
    })
    public ResultMessage refreshDeviceAlarmInfo() {
        cacheUtils.refreshDeviceAlarmInfo();
 
        return new ResultMessage();
    }
 
    @GetMapping("sensor")
    @ApiOperation(value = "sensor编码", notes = "sensor编码")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String")
    })
    public ResultMessage sensor() {
        cacheUtils.refreshSensor();
        return new ResultMessage();
    }
 
    @GetMapping(value = "adjust")
    @ApiOperation(value = "adjust编码", notes = "adjust编码")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String")
    })
    public ResultMessage adjust() {
        Map<String,Object> resultMap = deviceAdjustValueService.refreshRedis();
        return new ResultMessage();
    }
 
    @GetMapping(value = "device")
    @ApiOperation(value = "redis重新编译device", notes = "redis重新编译device")
    public ResultMessage device() {
        deviceService.setRedisDevice();
        return new ResultMessage();
    }
 
    @GetMapping(value = "selectDeviceInfoById")
    @ApiOperation(value = "获取信息", notes = "获取信息")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String")
    })
    public ResultMessage selectDeviceInfoById(Integer mac) {
        Map<String,Object> resultMap = deviceService.selectDeviceInfoById(mac);
        return new ResultMessage();
    }
 
}