| | |
| | | import static com.moral.common.util.RedisUtil.hasKey;
|
| | | import static com.moral.common.util.ResourceUtil.getValue;
|
| | | import static com.moral.common.util.WebUtils.getParametersStartingWith;
|
| | | import static org.springframework.util.ObjectUtils.isEmpty;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.InputStreamReader;
|
| | |
| | | import com.alibaba.fastjson.JSON;
|
| | | import com.alibaba.fastjson.JSONReader;
|
| | | import com.alibaba.fastjson.TypeReference;
|
| | | import com.moral.common.exception.BusinessException;
|
| | | import com.moral.common.util.ValidateUtil;
|
| | | import com.moral.service.AccountService;
|
| | | import com.moral.service.DeviceService;
|
| | |
| | | */
|
| | | @GetMapping("equipment-state")
|
| | | public Map<String, Object> getDeviceStatesByAccount(HttpServletRequest request) {
|
| | | Map<String, Object> result = new LinkedHashMap<String, Object>();
|
| | | Map<String, Object> parameters = getParametersStartingWith(request, null);
|
| | | if (!parameters.containsKey("accountId")) {
|
| | | result.put("msg", "参数不能为空!");
|
| | | } else {
|
| | | result = deviceService.getDeviceStatesByAccount(parameters);
|
| | | }
|
| | | return result;
|
| | | return deviceService.getDeviceStatesByAccount(parameters);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @GetMapping("sensor-standard")
|
| | | public Map<String, Object> getStandardBySensor(@RequestParam("macKey") String macKey) {
|
| | | ValidateUtil.notEmpty(macKey, "param.is.null");
|
| | | Map<String, Object> result = new HashMap<String, Object>();
|
| | | ValidateUtil.notEmpty(macKey, "参数不能为空!");
|
| | | result.put("standard", getValue(macKey + "-standard"));
|
| | | return result;
|
| | | }
|
| | |
| | | */
|
| | | @GetMapping("day-aqi")
|
| | | public Map<String, Object> getDayAQIByDevice(HttpServletRequest request) {
|
| | | Map<String, Object> result = new HashMap<String, Object>();
|
| | | Map<String, Object> parameters = getParametersStartingWith(request, null);
|
| | | if (!parameters.containsKey("mac")) {
|
| | | result.put("msg", "参数不能为空!");
|
| | | } else {
|
| | | result = historyService.getDayAQIByDevice(parameters);
|
| | | }
|
| | | return result;
|
| | | return historyService.getDayAQIByDevice(parameters);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @GetMapping("all-average")
|
| | | public Map<String, Object> getAllSensorAverageByDevice(HttpServletRequest request) {
|
| | | Map<String, Object> result = new LinkedHashMap<String, Object>();
|
| | | Map<String, Object> parameters = getParametersStartingWith(request, null);
|
| | | if (!(parameters.containsKey("areaCode") && parameters.containsKey("accountId"))) {
|
| | | result.put("msg", "参数不能为空!");
|
| | | } else {
|
| | | result = historyService.getAllSensorAverageByDevice(parameters);
|
| | | }
|
| | | return result;
|
| | | return historyService.getAllSensorAverageByDevice(parameters);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @GetMapping("sensor-average")
|
| | | public Map<String, Object> getDeviceRankingBySensorAverage(HttpServletRequest request) {
|
| | | Map<String, Object> result = new HashMap<String, Object>();
|
| | | Map<String, Object> parameters = getParametersStartingWith(request, null);
|
| | | if (!(parameters.containsKey("areaCode") && parameters.containsKey("accountId")
|
| | | && parameters.containsKey("macKey"))) {
|
| | | result.put("msg", "参数不能为空!");
|
| | | } else {
|
| | | result = historyService.getDeviceRankingBySensorAverage(parameters);
|
| | | }
|
| | | return result;
|
| | | return historyService.getDeviceRankingBySensorAverage(parameters);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @GetMapping("month-sensor-average")
|
| | | public Map<String, Object> getMonthAverageBySensor(HttpServletRequest request) {
|
| | | Map<String, Object> result = new HashMap<String, Object>();
|
| | | Map<String, Object> parameters = getParametersStartingWith(request, null);
|
| | | if (!(parameters.containsKey("mac") && parameters.containsKey("macKey"))) {
|
| | | result.put("msg", "参数不能为空!");
|
| | | } else {
|
| | | result = historyService.getMonthAverageBySensor(parameters);
|
| | | }
|
| | | return result;
|
| | | return historyService.getMonthAverageBySensor(parameters);
|
| | | }
|
| | |
|
| | | }
|