コード例 #1
0
  /**
   * 查询
   *
   * @return
   */
  public String query() {
    int systemID = form.getSystemIDValue();
    Date startDate = form.getStartDate();
    Date endDate = startDate; // 周数据用到
    String lidu = form.getLidu();
    String model = form.getModel();

    if (Constants.MONTHLY.equals(lidu)) {
      startDate = DateUtil.getFirstDayOfXmonthAgo(startDate, 0);
    } else if (Constants.WEEKLY.equals(lidu)) {
      startDate = DateUtil.AddDays(startDate, -6);
    }

    ColorosDTO dto = new ColorosDTO();
    dto.setStartDate(startDate);
    dto.setEndDate(endDate);
    dto.setLidu(lidu);
    dto.setSystemID(systemID);
    dto.setModel(model);
    versionactiveList = service.getVersionactiveList(dto);
    ServletActionContext.getRequest()
        .getSession()
        .setAttribute(Constants.NEARME_SESSION_REPROT_DATA, versionactiveList);

    LogUtil.log(dto, TAG);

    return Action.SUCCESS;
  }
コード例 #2
0
  /**
   * 初始化
   *
   * @return
   */
  public String init() {
    // 检查action传递过来的systemID合法性
    if (form == null || StringUtil.isNullOrEmpty(form.getSystemID())) {
      return Action.ERROR;
    }

    String startDate = DateUtil.getDateOfXdaysAgo(1);
    String lidu = Constants.DAILY;
    int systemID = form.getSystemIDValue();

    form.setStartTime(startDate);
    form.setLidu(lidu);

    ColorosDTO dto = new ColorosDTO();
    dto.setStartDate(DateUtil.parseDate(startDate, "yyyy-MM-dd"));
    dto.setLidu(lidu);
    dto.setSystemID(systemID);
    versionactiveList = service.getVersionactiveList(dto);
    ServletActionContext.getRequest()
        .getSession()
        .setAttribute(Constants.NEARME_SESSION_REPROT_DATA, versionactiveList);

    LogUtil.log(dto, TAG);

    return Action.SUCCESS;
  }
コード例 #3
0
 /** 缓存KEY */
 public String toString() {
   return String.format(
       "%s_%s_%s_%s",
       this.systemID,
       DateUtil.formatDate(this.startDate, "yyyyMMdd"),
       DateUtil.formatDate(this.endDate, "yyyyMMdd"),
       this.model);
 }
コード例 #4
0
  public boolean fillFromForm(BaseForm form) {
    if (form == null) {
      return false;
    }
    // 提取起始、结束日期
    Date t1 = DateUtil.AddDays(DateUtil.trunc(new Date()), -1); // 昨天
    if (form.getDays() != null) {
      endDate = t1;
      form.setEndTime(DateUtil.formatDate(t1, "yyyy-MM-dd"));
      startDate = DateUtil.AddDays(t1, 0 - NumericUtil.tryParse(form.getDays(), 30));
      form.setStartTime(DateUtil.formatDate(startDate, "yyyy-MM-dd"));
    } else {
      startDate = form.getStartDate();
      endDate = form.getEndDate();
    }

    // 判断日期有效性
    if (getEndDate() == null) {
      endDate = t1;
      // 设置回FORM,避免查询数据使用的日期和页面显示日期不一致
      form.setEndTime(DateUtil.formatDate(t1, "yyyy-MM-dd"));
    }
    if (getStartDate() == null || getEndDate().before(getStartDate())) {
      startDate = DateUtil.AddDays(t1, -30);
      // 设置回FORM,避免查询数据使用的日期和页面显示日期不一致
      form.setStartTime(DateUtil.formatDate(startDate, "yyyy-MM-dd"));
    }

    systemID = form.getSystemIDValue();
    model = form.getModel();
    appVersion = form.getAppVersion();

    return true;
  }
コード例 #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记录查询
  }
コード例 #6
0
  @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;
  }
コード例 #7
0
  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;
  }
コード例 #8
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;
  }
コード例 #9
0
  /**
   * 导出报表
   *
   * @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;
  }
コード例 #10
0
 public String getBakTableAffix() {
   if (this.bakTableAffix == null && this.startDate != null) {
     this.bakTableAffix = DateUtil.formatDate(this.startDate, "yyyyMM");
   }
   return bakTableAffix;
 }