package com.thinkgem.jeesite.modules.pay.service;

import com.thinkgem.jeesite.common.utils.DateUtils;
import com.thinkgem.jeesite.modules.pay.bean.OrderRequest;
import com.thinkgem.jeesite.modules.pay.dao.OrderApiDao;
import com.thinkgem.jeesite.modules.pay.entity.OrderEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author niehh
 * @Description: 订单
 * @date 2018年03月18日 10:51
 */
@Service
@Transactional(readOnly = true)
public class OrderService {

    @Autowired
    private OrderApiDao orderApiDao;

    public List<OrderEntity> getOrderList(OrderRequest request){
        if(request.getStartDate()!= null){
            request.setStartTime(DateUtils.formatDate(request.getStartDate(),"yyyy-MM-dd") + " 00:00:00");
        }
        if(request.getEndDate() != null){
            request.setEndTime(DateUtils.formatDate(request.getEndDate(),"yyyy-MM-dd") + " 23:59:59");
        }

        return orderApiDao.getOrderList(request);

    }

}
