webcount.java

来自「一个完整的网络订餐系统」· Java 代码 · 共 124 行

JAVA
124
字号
package com.util;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import java.text.SimpleDateFormat;

public class WebCount
    implements Serializable
{

    int todaycount;
    int yesterdaycount;
    int sumcount;
    int tiptopcount;
    Date tiptopdate;
    int day_of_year;
    Date beginTime;
    int step;

    WebCount()
    {
        todaycount = 0;
        yesterdaycount = 0;
        sumcount = 0;
        tiptopcount = 0;
        day_of_year = 0;
        step = 1;
        beginTime = new Date();
    }

    void addCount()
    {
        int day_year = Calendar.getInstance().get(6);
        if(day_year == day_of_year)
        {
            todaycount = todaycount + step;
        } else
        {
            yesterdaycount = todaycount;
            day_of_year = day_year;
            todaycount = 1;
        }
        sumcount = sumcount + step;
        if(tiptopcount < todaycount)
        {
            tiptopcount = todaycount;
            tiptopdate = new Date();
        }
    }

    public String getBeginTime()
    {
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
      return sdf.format(beginTime);
    }

    public int getSumcount()
    {
        return sumcount;
    }

    public int getTiptopcount()
    {
        return tiptopcount;
    }

    public String getTiptopdate()
    {
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
      return sdf.format(tiptopdate);
    }

    public int getTodaycount()
    {
        return todaycount;
    }

    public int getYesterdaycount()
    {
        return yesterdaycount;
    }

    public void setBeginTime(Date beginTime)
    {
        this.beginTime = beginTime;
    }

    public void setSumcount(int sumcount)
    {
        this.sumcount = sumcount;
    }

    public void setTiptopcount(int tiptopcount)
    {
        this.tiptopcount = tiptopcount;
    }

    public void setTiptopdate(Date tiptopdate)
    {
        this.tiptopdate = tiptopdate;
    }

    public void setTodaycount(int todaycount)
    {
        this.todaycount = todaycount;
    }

    public void setYesterdaycount(int yesterdaycount)
    {
        this.yesterdaycount = yesterdaycount;
    }

    public void setStep(int step)
    {
        this.step = step;
    }

    public int getStep()
    {
        return step;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?