/**
   * 导出报表-日使用时长信息
   *
   * @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;
  }
  @SuppressWarnings("unchecked")
  public String export() {
    Object obj =
        ServletActionContext.getRequest()
            .getSession()
            .getAttribute(Constants.NEARME_SESSION_REPROT_DATA);

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

    List<COSVersionActiveEntity> list = (List<COSVersionActiveEntity>) obj;

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

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

      // 设置标题
      eu.setFont(ExcelUtil.getTitleFont());
      eu.writeLine(new String[] {"版本", "日期", "活跃用户"});

      // 设置信息体
      eu.setFont(ExcelUtil.getBodyFont());
      for (COSVersionActiveEntity entity : list) {
        eu.writeLine(
            new String[] {
              String.valueOf(entity.getVersion()),
              DateUtil.formatDate2Short(entity.getStatDate()),
              String.valueOf(entity.getActiveTotal())
            });
      }
      eu.endWrite();
      eu.export(response);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return Action.SUCCESS;
  }
  public String init() {
    String startDate = DateUtil.getDateOfXdaysAgo(30);
    String endDate = DateUtil.getToday();
    form = new ZjbForm();
    form.setStartTime(startDate);
    form.setEndTime(endDate);
    form.setLidu(Constants.DAILY);

    ZjbDTO dto = new ZjbDTO();
    dto.setStartDate(DateUtil.parseDate(startDate, "yyyy-MM-dd"));
    dto.setEndDate(DateUtil.parseDate(endDate, "yyyy-MM-dd"));
    dto.setLidu(form.getLidu());
    channelserviceList = service.getChannelserviceList(dto);
    ServletActionContext.getRequest()
        .getSession()
        .setAttribute(Constants.NEARME_SESSION_REPROT_DATA, channelserviceList);

    LogUtil.log(dto, TAG);

    return Action.SUCCESS;
  }
  /**
   * 导出报表
   *
   * @return
   */
  @SuppressWarnings("unchecked")
  public String export() {
    Object obj =
        ServletActionContext.getRequest()
            .getSession()
            .getAttribute(Constants.NEARME_SESSION_REPROT_DATA);

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

    List<ChannelserviceEntity> list = (List<ChannelserviceEntity>) obj;

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

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

      // 设置标题
      eu.setFont(ExcelUtil.getTitleFont());
      eu.writeLine(
          new String[] {
            "日期",
            "登陆用户",
            "登陆用户服务的非OPPO手机数",
            "分成手机数",
            "登陆用户服务的非OPPO手机台均安装量",
            "登陆用户服务的OPPO手机数",
            "分成手机数",
            "登陆用户服务的OPPO手机台均安装量",
            "未登陆用户数",
            "未登陆用户服务的非OPPO手机数",
            "分成手机数",
            "未登陆用户服务的非OPPO手机台均安装量",
            "未登陆用户服务的OPPO手机数",
            "分成手机数",
            "未登陆用户服务的OPPO手机台均安装量",
          });

      // 设置信息体
      eu.setFont(ExcelUtil.getBodyFont());
      for (int i = list.size() - 1; i >= 0; i--) {
        ChannelserviceEntity entity = list.get(i);
        eu.writeLine(
            new String[] {
              DateUtil.formatDate2Short(entity.getStatDate()),
              String.valueOf(entity.getIn_users()),
              String.valueOf(entity.getIn_not_oppo()),
              String.valueOf(entity.getIn_not_oppo_bonus()),
              String.valueOf(entity.getIn_not_oppo_avg()),
              String.valueOf(entity.getIn_oppo()),
              String.valueOf(entity.getIn_oppo_bonus()),
              String.valueOf(entity.getIn_oppo_avg()),
              String.valueOf(entity.getOut_users()),
              String.valueOf(entity.getOut_not_oppo()),
              String.valueOf(entity.getOut_not_oppo_bonus()),
              String.valueOf(entity.getIn_not_oppo_avg()),
              String.valueOf(entity.getOut_oppo()),
              String.valueOf(entity.getOut_oppo_bonus()),
              String.valueOf(entity.getOut_oppo_avg())
            });
      }
      eu.endWrite();
      eu.export(response);
    } catch (Exception e) {
      e.printStackTrace();
    }

    return Action.SUCCESS;
  }