| | |
| | | package com.moral.controller; |
| | | |
| | | import com.auth0.jwt.exceptions.JWTDecodeException; |
| | | import com.moral.common.bean.ResultBean; |
| | | import com.moral.common.exception.WebAuthException; |
| | | import com.moral.common.util.BeanUtils; |
| | | import com.moral.common.util.ParameterUtils; |
| | | import com.moral.common.util.RedisHashUtil; |
| | | import com.moral.common.util.WebTokenUtils; |
| | | import com.moral.common.webAnno.UserLoginToken; |
| | | import com.moral.entity.AreaNames; |
| | | import com.moral.entity.Organization; |
| | | import com.moral.service.AccountService; |
| | | import com.moral.service.DictionaryDataService; |
| | | import com.moral.service.OrganizationService; |
| | | import com.moral.service.WebTokenService; |
| | | import com.moral.service.*; |
| | | import com.moral.util.LatLngTransformation; |
| | | import jdk.nashorn.internal.runtime.logging.Logger; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | WebTokenService webTokenService; |
| | | @Resource |
| | | RedisHashUtil redisHashUtil; |
| | | @Resource |
| | | HistoryMinutelyService historyMinutelyService; |
| | | |
| | | @UserLoginToken |
| | | @GetMapping("test") |
| | | public String add() { |
| | | return "test success!"; |
| | | } |
| | | |
| | | @PostMapping("login") |
| | | public Map<String, Object> login(@RequestBody Map<String, Object> parameters) { |
| | |
| | | return resultMap; |
| | | } |
| | | |
| | | |
| | | @UserLoginToken |
| | | @GetMapping("test") |
| | | public String add() { |
| | | return "test success!"; |
| | | @PostMapping("report_avg_datas") |
| | | public ResultBean<List<Map<String, Object>>> getMonitorPointOrDeviceAvgData(HttpServletRequest request,@RequestBody Map<String, Object> parameters) |
| | | throws Exception { |
| | | //该方法用于判断时间是具体到年月日 |
| | | ParameterUtils.getTimeType4Time(parameters); |
| | | Object sensorKey = parameters.remove("sensorKey"); |
| | | parameters.put("sensors", Arrays.asList(sensorKey)); |
| | | List<Map<String, Object>> list = historyMinutelyService.getMonitorPointOrDeviceAvgData(parameters); |
| | | for (Map<String, Object> map : list) { |
| | | String time = map.get("time").toString(); |
| | | time = time.substring(time.length() - 2); |
| | | map.put("time", Integer.valueOf(time)); |
| | | if(parameters.get("type").equals("day")){ |
| | | map.put("time", Integer.valueOf(time)+1); |
| | | } |
| | | map.put("value", map.remove(sensorKey)); |
| | | } |
| | | return new ResultBean<List<Map<String, Object>>>(list); |
| | | } |
| | | } |