package com.dgtly.order.service.impl;

import com.dgtly.common.utils.DateUtils;
import com.dgtly.order.domain.MetaHanaSalesOrder;
import com.dgtly.order.mapper.MetaHanaSalesOrderMapper;
import com.dgtly.order.service.IMetaHanaSalesOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.logging.SimpleFormatter;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author qxp
 * @since 2020-07-30
 */
@Service
public class MetaHanaSalesOrderServiceImpl implements IMetaHanaSalesOrderService {

    @Resource
    private MetaHanaSalesOrderMapper metaHanaSalesOrderMapper;


    @Override
    public List<MetaHanaSalesOrder> selectDistinctMetaHanaSalesOrder(MetaHanaSalesOrder metaHanaSalesOrder) {

        /*List<String> orderNumbers = new ArrayList<>();
        List<MetaHanaSalesOrder> list =  metaHanaSalesOrderMapper.selectDistinctMetaHanaSalesOrder(metaHanaSalesOrder);
        for(MetaHanaSalesOrder m:list){
            orderNumbers.add(m.getDocNumber());
        }
        Map<String,Map<String,Object>> timeList = metaHanaSalesOrderMapper.selectOrderExcepTimeByList(orderNumbers);
        for(MetaHanaSalesOrder m:list){
            if(timeList.containsKey(m.getDocNumber())){

                m.setExpectedTime((Date)timeList.get(m.getDocNumber()).get("expected_time"));
            }

        }*/
        if(metaHanaSalesOrder.getExpectedTime() != null){
            metaHanaSalesOrder.setExpectedTimeStr(DateUtils.dateTime(metaHanaSalesOrder.getExpectedTime()));
        }
        List<MetaHanaSalesOrder> list =  metaHanaSalesOrderMapper.selectDistinctMetaHanaSalesOrder1(metaHanaSalesOrder);
        return list;
    }



}
