コード例 #1
0
 /** 设置 日启动次数 列名称及报表名称 */
 private void setStartcntColumn() {
   ColumnEntity columns = new ColumnEntity();
   columns.setColumn1("启动次数");
   columns.setColumn2("启动IMEI数");
   columns.setColumn3("占比(%)");
   startcntEntity.setColumns(columns);
   startcntEntity.setTblName("使用频率时长分析_日启动次数");
 }
コード例 #2
0
 /** 设置 日使用时长 列名称及报表名称 */
 private void setUsetimeColumn() {
   ColumnEntity columns = new ColumnEntity();
   columns.setColumn1("平均时长");
   columns.setColumn2("启动IMEI数");
   columns.setColumn3("占比(%)");
   usetimeEntity.setColumns(columns);
   usetimeEntity.setTblName("使用频率时长分析_日使用时长");
 }
コード例 #3
0
  /**
   * 查询日启动次数
   *
   * @return
   */
  public String querystartcnt() {
    Date startDate = form.getStartDate();
    int systemID = form.getSystemIDValue();
    String appVersion = form.getAppVersion();
    String model = form.getModel();

    if (systemID == 0) {
      return Action.SUCCESS;
    }
    if (startDate == null) {
      return Action.SUCCESS;
    }

    BaseDTO dto = new BaseDTO();
    dto.setStartDate(startDate);
    dto.setSystemID(systemID);
    dto.setAppVersion(appVersion);
    dto.setModel(model);

    startcntEntity = new BaseEntity();
    List<ColumnValueEntity> list = service.getUseoftenStartcntList(dto);
    setStartcntColumn();
    startcntEntity.setValueList(list);
    ServletActionContext.getRequest()
        .getSession()
        .setAttribute(Constants.NEARME_SESSION_REPROT_DATA, startcntEntity);

    LogUtil.log(dto, "使用频率时长分析"); // log记录查询

    return "querystartcnt";
  }
コード例 #4
0
  /**
   * 导出报表-日使用时长信息
   *
   * @return
   */
  public String exportusetime() {
    Object obj =
        ServletActionContext.getRequest()
            .getSession()
            .getAttribute(Constants.NEARME_SESSION_REPROT_DATA_2);

    if (obj == null) {
      return Action.SUCCESS;
    }

    BaseEntity baseEntity = (BaseEntity) obj;
    String tblname = baseEntity.getTblName();
    ColumnEntity columns = baseEntity.getColumns();
    List<ColumnValueEntity> valuelist = baseEntity.getValueList();

    if (valuelist == null) {
      return Action.SUCCESS;
    }

    HttpServletResponse response = ServletActionContext.getResponse();
    ExcelUtil eu = new ExcelUtil(tblname + "_" + DateUtil.getToday());

    try {
      eu.createSheets(1, new String[] {tblname});

      // 设置标题
      eu.setFont(ExcelUtil.getTitleFont());
      eu.writeLine(new String[] {columns.getColumn1(), columns.getColumn2(), columns.getColumn3()});

      // 设置信息体
      eu.setFont(ExcelUtil.getBodyFont());
      for (ColumnValueEntity entity : valuelist) {
        eu.writeLine(new String[] {entity.getValue1(), entity.getValue2(), entity.getValue3()});
      }
      eu.endWrite();
      eu.export(response);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return Action.SUCCESS;
  }
コード例 #5
0
  /** 初始化日使用时长 */
  private void initUsetime() {
    String startDate = DateUtil.getDateOfXdaysAgo(1);

    formusetime.setStartTime(startDate);
    formusetime.setSystemID(form.getSystemID());

    BaseDTO dto = new BaseDTO();
    dto.setStartDate(DateUtil.parseDate(startDate, "yyyy-MM-dd"));
    dto.setSystemID(formusetime.getSystemIDValue());

    List<ColumnValueEntity> list = service.getUseoftenUsetimeList(dto);
    setUsetimeColumn();
    usetimeEntity.setValueList(list);

    ServletActionContext.getRequest()
        .getSession()
        .setAttribute(Constants.NEARME_SESSION_REPROT_DATA_2, usetimeEntity);

    LogUtil.log(dto, "使用频率时长分析"); // log记录查询
  }