package com.uas.finance.service.Impl;

import com.uas.finance.dao.FinanceConditionDao;
import com.uas.finance.model.FinanceCondition;
import com.uas.finance.service.FinanceConditionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 财务情况说明接口实现类
 * created by shicr on 2017/12/21
 **/
@Service
public class FinanceConditionServiceImpl implements FinanceConditionService {

    @Autowired
    private FinanceConditionDao dao;

    /**
     * 保存财务情况说明
     *
     * @param financeCondition
     * @return
     */
    public FinanceCondition save(FinanceCondition financeCondition) {
        return dao.save(financeCondition);
    }

    /**
     * 更新ERP传来的财务情况说明
     *
     * @param financeCondition
     * @return
     */
    @Override
    public List<Map<String, Long>> update(FinanceCondition financeCondition) {
        List<Map<String, Long>> list = new ArrayList<Map<String, Long>>();
        Map<String, Long> map = new HashMap<String, Long>();
        FinanceCondition financeCondition1 = dao.save(financeCondition);
        map.put("id",financeCondition1.getId());
        map.put("fc_caid",financeCondition1.getErpId());
        list.add(map);
        return list;
    }
}
