package com.jwipc.inquiry.logic.impl;

import com.jwipc.inquiry.convert.PriceInfoAuditDetailConvert;
import com.jwipc.inquiry.dto.PriceInfoAuditDTO;
import com.jwipc.inquiry.dto.PriceInfoAuditDetailDTO;
import com.jwipc.inquiry.entity.PriceInfoAuditDetail;
import com.jwipc.inquiry.logic.PriceInfoAuditDetailLogic;
import com.jwipc.inquiry.model.po.PriceInfoAuditDetailPO;
import com.jwipc.inquiry.model.po.PriceInfoAuditPO;
import com.jwipc.inquiry.service.IPriceInfoAuditDetailService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * @author shenyang.ou
 * @date 2024/3/9 16:33
 * @desc
 */
@Service
@RequiredArgsConstructor
public class PriceInfoAuditDetailLogicImpl implements PriceInfoAuditDetailLogic {
    private final IPriceInfoAuditDetailService priceInfoAuditDetailService;
    private final PriceInfoAuditDetailConvert priceInfoAuditDetailConvert;
    @Override
    public List<PriceInfoAuditDetail> getDetailListByAuditId(Long auditId) {
        List<PriceInfoAuditDetailPO> priceInfoAuditDetailPOS = priceInfoAuditDetailService.getDetailListByAuditId(auditId);
        return priceInfoAuditDetailConvert.po2DTOList(priceInfoAuditDetailPOS);
    }

    @Override
    public List<PriceInfoAuditDetail> getDetailListByPriceIds(String priceIds) {
        List<String> priceIdList = Arrays.asList(StringUtils.split(priceIds, ","));
        List<PriceInfoAuditDetailPO> priceInfoAuditDetailPOS = priceInfoAuditDetailService.getDetailListByPriceIdList(priceIdList);
        return priceInfoAuditDetailConvert.po2DTOList(priceInfoAuditDetailPOS);
    }
}
