Ejemplo n.º 1
0
 @RequestMapping("/getUserChartData")
 @ResponseBody
 public ResultEntity getUserChartData() {
   ResultEntity resultEntity = new ResultEntity();
   List<Object[]> list = userService.getLastWeekUserDate(MyDataUtils.getLastWeakDate());
   resultEntity.setData(list);
   resultEntity.setSuccessMsg("success");
   return resultEntity;
 }
Ejemplo n.º 2
0
  public List<Object[]> getProductionChartData(Date[] dates) {
    List<Object[]> list = new ArrayList<Object[]>();

    Long[] counts = new Long[dates.length];
    String[] dateStrs = new String[dates.length];

    for (int i = 0; i < dates.length; i++) {

      Long l =
          (Long)
              getSession()
                  .createQuery(
                      "select  count(*) from Production where createDate < ? and createDate>?")
                  .setParameter(0, MyDataUtils.getNextMonth(dates[i]))
                  .setParameter(1, dates[i])
                  .uniqueResult();
      counts[i] = l;
      dateStrs[i] = MyDataUtils.DateToString(dates[i], "yyyy-MM");
    }
    list.add(dateStrs);
    list.add(counts);
    return list;
  }