package com.sunxung.factoring.service.businessmanagement.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sunxung.factoring.dict.impl.FileModuleDict;
import com.sunxung.factoring.entity.businessmanagement.BusinessBasicInfoHistory;
import com.sunxung.factoring.entity.businessmanagement.BusinessSupplierInfoHistory;
import com.sunxung.factoring.entity.sys.FileStorage;
import com.sunxung.factoring.mapper.businessManagement.BusinessBasicInfoHistoryMapper;
import com.sunxung.factoring.service.businessmanagement.BusinessBasicInfoHistoryService;
import com.sunxung.factoring.service.businessmanagement.BusinessSupplierInfoHistoryService;
import com.sunxung.factoring.service.sys.ISysAttachmentRefService;
import com.sunxung.factoring.service.sys.UserService;
import com.sunxung.factoring.service.sys.dto.AttachmentDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description : 业务基础信息service实现类
 * @Author : L.Jia
 * @Date: 2021-09-10 16:23
 */
@Service
public class BusinessBasicInfoHistoryServiceImpl extends ServiceImpl<BusinessBasicInfoHistoryMapper, BusinessBasicInfoHistory>  implements BusinessBasicInfoHistoryService {

    @Autowired
    private BusinessSupplierInfoHistoryService businessSupplierInfoHistoryService;

    @Autowired
    private ISysAttachmentRefService sysAttachmentRefService;

    @Autowired
    private UserService userService;

//    @Override
//    public BusinessBasicInfoHistory getView(Long formBusinessId) {
//        //业务基础信息
//        BusinessBasicInfoHistory businessBasicInfoHistory = getById(formBusinessId);
//        //供应商
//        List<BusinessSupplierInfoHistory> businessSupplierInfoHistoryList = businessSupplierInfoHistoryService.list(new LambdaQueryWrapper<BusinessSupplierInfoHistory>().eq(BusinessSupplierInfoHistory::getBusinessBasicInfoId, businessBasicInfoHistory.getId()));
//        businessBasicInfoHistory.setBusinessSupplierInfos(businessSupplierInfoHistoryList);
//        //投标文件
//        AttachmentDto attachmentDtoHis = AttachmentDto.builder()
//                .setEntityId(formBusinessId)
//                .setChildEnum(FileModuleDict.ChildEnum.BIDDING_HIS_FILE)
//                .build();
//        List<FileStorage> files = sysAttachmentRefService.getFiles(attachmentDtoHis);
//        businessBasicInfoHistory.setFileStorage(files);
//        businessBasicInfoHistory.setUserName(userService.get(businessBasicInfoHistory.getManagerId()).getName());
//        return businessBasicInfoHistory;
//    }
}
