package com.v1.config;

import com.hai.entity.ApiMchProduct;
import com.hai.entity.HighGasOilGunNo;
import com.hai.openApi.service.ApiMchProductService;
import com.hai.service.ApiMerchantsService;
import com.hai.service.HighGasOilGunNoService;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Configuration
public class ApiCommonConfig {

    @Resource
    private HighGasOilGunNoService highGasOilGunNoService;

    public BigDecimal computationPriceCost(BigDecimal discount , BigDecimal price) {
        return price.multiply(discount).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP);

    }


    public List<String> assemblyGasOilGunNo(Long oilPriceId) {

        List<String> gasOilGunNos = new ArrayList<>();

        List<HighGasOilGunNo> list = highGasOilGunNoService.getGunNoListByOilPrice(oilPriceId);


        for (HighGasOilGunNo gasOilGunNo : list) {
            gasOilGunNos.add(gasOilGunNo.getGunNo());
        }


        return gasOilGunNos;

    }

}
