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
94
95
96
97
98
99
100
101
102
103
104
105
106
package org.rcisoft.business.system.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.business.system.service.SystemService;
import org.rcisoft.business.system.vo.ParamStatus;
import org.rcisoft.business.system.vo.ParamStatusList;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* Created by JiChao on 2018/5/2.
* 系统模块
*/
@Api(tags = "系统检测")
@RestController
@RequestMapping("system")
public class SystemController {
@Autowired
private SystemService systemServiceImpl;
@ApiOperation(value="气候自适应统计", notes="气候自适应统计")
@ApiImplicitParams({@ApiImplicitParam(name = "proId", value = "项目主键", required = true, dataType = "字符串")
})
@RequestMapping("/statClimate")
public Result statClimate(@RequestParam String proId) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, systemServiceImpl.statClimate(proId));
}
@ApiOperation(value="能源消耗", notes="能源消耗")
@ApiImplicitParams({@ApiImplicitParam(name = "proId", value = "项目主键", required = true, dataType = "字符串")
})
@RequestMapping("/energyConsume")
public Result energyConsume(@RequestParam String proId) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, systemServiceImpl.energyConsume(proId));
}
@ApiOperation(value="逐时负荷", notes="逐时负荷")
@ApiImplicitParams({@ApiImplicitParam(name = "proId", value = "项目主键", required = true, dataType = "字符串")
})
@RequestMapping("/burdenHour")
public Result burdenHour(@RequestParam String proId) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, systemServiceImpl.burdenHour(proId));
}
@ApiOperation(value="故障报修 and 运行时长", notes="根据项目id查询所有设备的错误数量和运行时长,10分钟查询一次")
@ApiImplicitParams({
@ApiImplicitParam(name = "proId", value = "项目主键", required = true, dataType = "字符串")
})
@RequestMapping("/selectErrorandRuntime")
public Result selectErrorandRuntime(@RequestParam String proId) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, systemServiceImpl.selectErrorandRuntime(proId));
}
@ApiOperation(value="查询参数列表", notes="根据设备num查询所有参数")
@ApiImplicitParams({
@ApiImplicitParam(name = "devNum", value = "设备num", required = true, dataType = "字符串")
})
@RequestMapping("/selectDeviceParamList")
public Result selectDeviceParamList(@RequestParam String devNum) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, systemServiceImpl.selectDeviceParamList(devNum));
}
@ApiOperation(value="查询参数数据", notes="查询缓存中的数据,10秒钟查询1次")
@ApiImplicitParams({
@ApiImplicitParam(name = "proId", value = "项目主键", required = true, dataType = "字符串")
})
@RequestMapping("/selectDataByCache")
public String selectDataByCache(@RequestParam String proId) {
return systemServiceImpl.selectDataByCache(proId);
// return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, systemServiceImpl.selectDataByCache(proId));
}
@ApiOperation(value="查询传感器code", notes="查询传感器code")
@ApiImplicitParams({
@ApiImplicitParam(name = "proId", value = "项目主键", required = true, dataType = "字符串")
})
@RequestMapping("/selectSensorCode")
public Result selectSensorCode(@RequestParam String proId, @RequestParam String devNum) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, systemServiceImpl.selectSensorCode(proId, devNum));
}
@ApiOperation(value="查询项目下所有设备的信息", notes="通过电流参数判断设备是否开启")
@RequestMapping("/selectDeviceAll")
public Result selectDeviceAll(@RequestParam String proId) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, systemServiceImpl.selectDeviceAll(proId));
}
@ApiOperation(value="查询每个设备的状态", notes="0:关闭,1:开启")
@RequestMapping("/selectDeviceStatus")
public Result selectDeviceStatus(@RequestBody ParamStatusList list) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, systemServiceImpl.selectDeviceStatus(list));
}
}