package com.iamberry.wechat.core.entity;

import com.iamberry.wechat.core.entity.statictics.StatisticsSalesOrder;

import java.util.Comparator;

public class StatisticsSalesOrderUtil implements Comparator{

	@Override
	public int compare(Object arg0, Object arg1) {
		// TODO Auto-generated method stub
		StatisticsSalesOrder salesOrder = (StatisticsSalesOrder)arg0;
		StatisticsSalesOrder order = (StatisticsSalesOrder)arg1;
		int flag = 0;
		if (salesOrder.getSalesDate() != null && order.getSalesDate() != null) {
			flag = salesOrder.getSalesDate().compareTo(order.getSalesDate());
		}
		if (salesOrder.getSalesMonth() != null && order.getSalesMonth() != null) {
			flag = salesOrder.getSalesMonth().compareTo(order.getSalesMonth());
		}

		return flag;
	}

}
