lizijie
2019-09-11 9b2bea0002ad5f7293fc00b70778511bf1e636c6
src/main/java/com/moral/controller/ReportController.java
@@ -20,8 +20,12 @@
import org.springframework.web.bind.annotation.RestController;
import com.moral.common.bean.ResultBean;
import com.moral.common.util.WebUtils;
import com.moral.entity.charts.LineChartCriteria;
import com.moral.security.auth.JwtAuthenticationToken;
import com.moral.security.model.UserContext;
import com.moral.service.AlarmDailyService;
import com.moral.service.HistoryDailyService;
import com.moral.service.HistoryMinutelyService;
@SuppressWarnings({ "unchecked", "rawtypes" })
@@ -82,9 +86,41 @@
   @GetMapping("alarm-year")
   public ResultBean<List<Integer>> getAlarmDataByYear(HttpServletRequest request) throws Exception {
      Map<String, Object> parameters = getParametersStartingWith(request, null);
      List<Integer> alarmDataByYear = alarmDailyService.getAlarmDataByYear(parameters);
      List<Integer> result = alarmDailyService.getAlarmDataByYear(parameters);
      
      return new ResultBean<List<Integer>>(alarmDataByYear);
      return new ResultBean<List<Integer>>(result);
   }
   @GetMapping("alarm-month")
   public ResultBean<List<Map<String, Object>>> getAlarmDataByMonth(HttpServletRequest request) throws Exception {
      Map<String, Object> parameters = getParametersStartingWith(request, null);
      List<Map<String, Object>> result = alarmDailyService.getAlarmDataByMonth(parameters);
      return new ResultBean<List<Map<String, Object>>>(result);
   }
   @Resource
   private HistoryDailyService historyDailyService;
   @GetMapping("emissions")
   public ResultBean<List<Map<String, Object>>> getemissionsData(HttpServletRequest request, JwtAuthenticationToken token) throws Exception {
      Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
      UserContext userContext = token.getPrincipal();
      Integer orgId = userContext.getOrganizationId();
      parameters.put("orgId", orgId);
      List<Map<String, Object>> result = historyDailyService.getEmissionsData(parameters);
      return new ResultBean<List<Map<String, Object>>>(result);
   }
   @GetMapping("overproof")
   public ResultBean<Map> getOverproofData(HttpServletRequest request, JwtAuthenticationToken token) throws Exception {
      Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
      UserContext userContext = token.getPrincipal();
      Integer orgId = userContext.getOrganizationId();
      parameters.put("orgId", orgId);
      //List<Map<String, Object>> result = null;
      Map result = historyDailyService.getOverproofData(parameters);
      return new ResultBean<Map>(result);
   }
}