package com.ruoyi.project.business.service.impl;

import static java.util.stream.Collectors.groupingBy;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Pair;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.ruoyi.common.enums.FileBuzType;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.importExcel.excel.helper.BasicTableInfoHelper;
import com.ruoyi.common.importExcel.excel.tempInfo.PriceFormBasicInfoHelper;
import com.ruoyi.common.importExcel.utils.ExcelUtils;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.business.domain.TbFile;
import com.ruoyi.project.business.domain.TjElevatorParaDetail;
import com.ruoyi.project.business.domain.TpAreaBasicPrice;
import com.ruoyi.project.business.domain.TpElevatorModel;
import com.ruoyi.project.business.domain.TpParaLibrary;
import com.ruoyi.project.business.domain.TpParaSelectItem;
import com.ruoyi.project.business.domain.TpParabar;
import com.ruoyi.project.business.domain.TpParabarDetail;
import com.ruoyi.project.business.domain.TqSpecificationDetail;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.framework.web.domain.server.Sys;
import com.ruoyi.project.business.domain.*;
import com.ruoyi.project.business.domain.vo.parabar.ElParabarDetailVO;
import com.ruoyi.project.business.domain.vo.parabar.ElParabarDetailValueVO;
import com.ruoyi.project.business.domain.vo.parabar.ElParabarVO;
import com.ruoyi.project.business.domain.vo.paramSelectItem.AreaElevatorModelParaVO;
import com.ruoyi.project.business.domain.vo.paramSelectItem.AreaParaSelectItemVo;
import com.ruoyi.project.business.domain.vo.paramSelectItem.ElevatorModeParamlVo;
import com.ruoyi.project.business.domain.vo.paramSelectItem.TabsVo;
import com.ruoyi.project.business.domain.vo.paramSelectItem.TpAreaBasicPriceVo;
import com.ruoyi.project.business.domain.vo.paramSelectItem.TpElevatorModelVo;
import com.ruoyi.project.business.domain.vo.paramSelectItem.TransferParam;
import com.ruoyi.project.business.domain.vo.quotation.EleCategoryVO;
import com.ruoyi.project.business.domain.vo.quotation.EleDecorateConfigVO;
import com.ruoyi.project.business.domain.vo.quotation.EleParamOptionVO;
import com.ruoyi.project.business.domain.vo.quotation.EleParamVO;
import com.ruoyi.project.business.domain.vo.quotation.EleconfigVO;
import com.ruoyi.project.business.dto.TpElevatorModelDto;
import com.ruoyi.project.business.enums.DelFlagEnum;
import com.ruoyi.project.business.enums.InputTypeEnum;
import com.ruoyi.project.business.enums.ParamTypeEnum;
import com.ruoyi.project.business.enums.StatusEnum;
import com.ruoyi.project.business.mapper.TbFileMapper;
import com.ruoyi.project.business.mapper.TjElevatorParaDetailMapper;
import com.ruoyi.project.business.mapper.TpAreaBasicPriceMapper;
import com.ruoyi.project.business.mapper.TpAreaElevatorModelParaMapper;
import com.ruoyi.project.business.mapper.TpAreaParaSelectItemMapper;
import com.ruoyi.project.business.mapper.TpAreaParaStandardMapper;
import com.ruoyi.project.business.mapper.TpCaseElevatorMapper;
import com.ruoyi.project.business.mapper.TpElevatorModelMapper;
import com.ruoyi.project.business.mapper.TpParaLibraryMapper;
import com.ruoyi.project.business.mapper.TpParaSelectItemMapper;
import com.ruoyi.project.business.mapper.TpParaValidationElevatorMapper;
import com.ruoyi.project.business.mapper.TpParabarDetailMapper;
import com.ruoyi.project.business.mapper.TpParabarMapper;
import com.ruoyi.project.business.mapper.quotation.TqSpecificationDetailMapper;
import com.ruoyi.project.business.mapper.quotation.TqSpecificationMapper;
import com.ruoyi.project.business.service.ITbAreaService;
import com.ruoyi.project.business.service.ITbCountryService;
import com.ruoyi.project.business.service.ITpElevatorModelService;
import com.ruoyi.project.business.service.ITpParabarService;
import com.ruoyi.project.system.domain.SysDictData;

import java.util.*;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.service.ISysUserService;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author ruoyi
 * @date 2024-04-25
 */
@Service
@Slf4j
public class TpElevatorModelServiceImpl implements ITpElevatorModelService {

    @Resource
    private TpElevatorModelMapper tpElevatorModelMapper;

    @Resource
    private TpParaSelectItemMapper tpParaSelectItemMapper;

    @Resource
    private TpParaLibraryMapper tpParaLibraryMapper;

    @Resource
    private TpAreaElevatorModelParaMapper tpAreaElevatorModelParaMapper;

    @Resource
    private TpAreaParaSelectItemMapper tpAreaParaSelectItemMapper;

    @Resource
    private TpAreaParaStandardMapper tpAreaParaStandardMapper;

    @Resource
    private TpAreaBasicPriceMapper tpAreaBasicPriceMapper;

    @Resource
    private TpCaseElevatorMapper tpCaseElevatorMapper;

    @Resource
    private TpParaValidationElevatorMapper tpParaValidationElevatorMapper;

    @Resource
    private ITbAreaService tbAreaService;

    @Resource
    private TqSpecificationMapper tqSpecificationMapper;
    @Resource
    private ISysUserService sysUserService;

    @Resource
    private TqSpecificationDetailMapper tqSpecificationDetailMapper;

    @Resource
    private TjElevatorParaDetailMapper tjElevatorParaDetailMapper;

    @Resource
    private TbFileMapper tbFileMapper;

    @Resource
    private TpParabarMapper tpParabarMapper;

    @Resource
    private TpParabarDetailMapper tpParabarDetailMapper;

    @Resource
    private ITbCountryService tbCountryService;

    /**
     * 查询【请填写功能名称】
     *
     * @param id 【请填写功能名称】主键
     * @return 【请填写功能名称】
     */
    @Override
    public TpElevatorModel selectTpElevatorModelById(Long id) {
        TpElevatorModel data = tpElevatorModelMapper.selectTpElevatorModelById(id);
        if (StringUtils.isNotBlank(data.getTargetUserIds())){
            SysUser params = new SysUser();
            params.setUserIdList(Arrays.stream(data.getTargetUserIds().split(",")).filter(StringUtils::isNotBlank).map(Long::valueOf).collect(Collectors.toList()));
            List<SysUser> users = sysUserService.selectUserListWithoutAdmin(params);
            data.setTargetUsers(users);
        }

        return data;
    }

    /**
     * 查询【请填写功能名称】列表
     *
     * @param tpElevatorModel 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<TpElevatorModel> selectTpElevatorModelList(TpElevatorModel tpElevatorModel) {
        return tpElevatorModelMapper.selectTpElevatorModelList(tpElevatorModel);
    }

    @Override
    public List<TpElevatorModelDto> listForComponents(TpElevatorModelDto param) {
        return tpElevatorModelMapper.listForComponents(param);
    }

    /**
     * 新增【请填写功能名称】
     *
     * @param tpElevatorModel 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertTpElevatorModel(TpElevatorModel tpElevatorModel) {
        //根据三个条件检查是否存在重复TpElevatorModel
        TpElevatorModel param = new TpElevatorModel();
        param.setAreaId(tpElevatorModel.getAreaId());
        param.setElevatorType(tpElevatorModel.getElevatorType());
        param.setElevatorModelSame(tpElevatorModel.getElevatorModel());
        List<TpElevatorModel> exist = tpElevatorModelMapper.selectTpElevatorModelList(param);

        if (ObjectUtils.isNotEmpty(exist)) {
            throw new ServiceException(MessageUtils.message("elevator.add.exist"));
            //throw new ServiceException("该梯形已存在！");
        }
        tpElevatorModel.setCreateTime(DateUtils.getNowDate());
        tpElevatorModel.setCreateBy(SecurityUtils.getUserId().toString());
        tpElevatorModel.setUpdateTime(DateUtils.getNowDate());
        tpElevatorModel.setUpdateBy(SecurityUtils.getUserId().toString());
        return tpElevatorModelMapper.insertTpElevatorModel(tpElevatorModel);
    }

    /**
     * 修改【请填写功能名称】
     *
     * @param tpElevatorModel 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateTpElevatorModel(TpElevatorModel tpElevatorModel) {
        //根据三个条件检查是否存在重复TpElevatorModel
        TpElevatorModel param = new TpElevatorModel();
        param.setAreaId(tpElevatorModel.getAreaId());
        param.setElevatorType(tpElevatorModel.getElevatorType());
        param.setElevatorModelSame(tpElevatorModel.getElevatorModel());
        List<TpElevatorModel> All = tpElevatorModelMapper.selectTpElevatorModelList(param);
        //排除掉自己
        List<TpElevatorModel> exist = All.stream().filter(it -> !it.getId().equals(tpElevatorModel.getId()))
            .collect(Collectors.toList());
        if (ObjectUtils.isNotEmpty(exist)) {
            throw new ServiceException(MessageUtils.message("elevator.add.exist"));
            //throw new ServiceException("该梯形已存在！");
        }
        tpElevatorModel.setUpdateTime(DateUtils.getNowDate());
        //修改电梯类型的时候（因为电梯类型影响参数，所以修改类型需要删除所有参数数据）
        TpElevatorModel myself = tpElevatorModelMapper.selectTpElevatorModelById(tpElevatorModel.getId());
        if (!tpElevatorModel.getElevatorType().equals(myself.getElevatorType())) {
            //如果不相等，代表修改了。需要删除
            Long[] ids = {tpElevatorModel.getId()};
            deleteTpElevatorModelChildByIds(ids);
        }
        return tpElevatorModelMapper.updateTpElevatorModel(tpElevatorModel);
    }

    /**
     * 批量删除【请填写功能名称】
     *
     * @param ids 需要删除的【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteTpElevatorModelByIds(Long[] ids) {
        //删除共需删除4张表
        //梯形表 参数表 参数选项表 以及默认参数值表
        //只能删除一个
        Long elevatorModelId = ids[0];
        // todo 删除是否存在校验 待添加
        //验证是否被规则校验使用
        int validationNum = tpParaValidationElevatorMapper.getValidationCount(elevatorModelId);
        if (validationNum > 0) {
            //返回无法删除
            throw new ServiceException(MessageUtils.message("elevator.delete.hasValidation"));
            //throw new ServiceException("该梯型存在规则校验数据，无法删除！");
        }
        //验证是否被参数联动使用
        int caseNum = tpCaseElevatorMapper.getCount(elevatorModelId);
        if (caseNum > 0) {
            //返回无法删除
            throw new ServiceException(MessageUtils.message("elevator.delete.hasCase"));
            //throw new ServiceException("该梯型存在参数联动数据，无法删除！");
        }
        //校验是否参与报价
        int bjNum = tqSpecificationMapper.getCount(elevatorModelId);
        if (bjNum > 0) {
            //返回无法删除
            throw new ServiceException(MessageUtils.message("elevator.delete.hasBJ"));
            //throw new ServiceException("该梯型存在报价数据，无法删除！");
        }
        //删除参数表
        int i = tpAreaElevatorModelParaMapper.deleteTpAreaElevatorByElevatorModelId(elevatorModelId);
        i += tpAreaParaSelectItemMapper.deleteTpAreaParaSelectItemByElevatorModelId(elevatorModelId);
        i += tpAreaParaStandardMapper.deleteTpAreaParaStandardByElevatorModelId(elevatorModelId);
        return tpElevatorModelMapper.deleteTpElevatorModelByIds(ids);
    }

    @Override
    public int deleteTpElevatorModelChildByIds(Long[] ids) {
        //删除共需删除4张表
        //梯形表 参数表 参数选项表 以及默认参数值表
        //只能删除一个
        Long elevatorModelId = ids[0];
        // todo 删除是否存在校验 待添加
        //验证是否被规则校验使用
        int validationNum = tpParaValidationElevatorMapper.getValidationCount(elevatorModelId);
        if (validationNum > 0) {
            //返回无法删除
            throw new ServiceException(MessageUtils.message("elevator.delete.hasValidation"));
            //throw new ServiceException("该梯型存在规则校验数据，无法删除！");
        }
        //验证是否被参数联动使用
        int caseNum = tpCaseElevatorMapper.getCount(elevatorModelId);
        if (caseNum > 0) {
            //返回无法删除
            throw new ServiceException(MessageUtils.message("elevator.delete.hasCase"));
            //throw new ServiceException("该梯型存在参数联动数据，无法删除！");
        }
        //校验是否参与报价
        int bjNum = tqSpecificationMapper.getCount(elevatorModelId);
        if (bjNum > 0) {
            //返回无法删除
            throw new ServiceException(MessageUtils.message("elevator.delete.hasBJ"));
            //throw new ServiceException("该梯型存在报价数据，无法删除！");
        }
        //删除参数表
        int i = tpAreaElevatorModelParaMapper.deleteTpAreaElevatorByElevatorModelId(elevatorModelId);
        i += tpAreaParaSelectItemMapper.deleteTpAreaParaSelectItemByElevatorModelId(elevatorModelId);
        i += tpAreaParaStandardMapper.deleteTpAreaParaStandardByElevatorModelId(elevatorModelId);
        return i;
    }

    /**
     * 删除【请填写功能名称】信息
     *
     * @param id 【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteTpElevatorModelById(Long id) {
        return tpElevatorModelMapper.deleteTpElevatorModelById(id);
    }

    @Override
    public int updateParaStatus(TpElevatorModel tpElevatorModel) {
        if ("1".equals(tpElevatorModel.getStatus())) {
            int usedCount = 0;
            // todo 查询此数据是否可以停用或删除
            // usedCount = tpElevatorModelMapper.checkParaChangeAllowed(tpParaLibrary.getId());
            if (usedCount > 0) {
                throw new ServiceException(MessageUtils.message("paraLibrary.usingMessage"));
                //                throw new ServiceException("该参数正在使用中，请确认！");
            }
        }
        tpElevatorModel.setUpdateTime(DateUtils.getNowDate());
        tpElevatorModel.setUpdateBy(SecurityUtils.getUserId() + "");
        return tpElevatorModelMapper.updateTpElevatorModel(tpElevatorModel);
    }

    @Override
    public List<TpElevatorModel> selectTpElevatorModelListNew(TpElevatorModelVo tpElevatorModel) {
        tpElevatorModel.setDelFlag(DelFlagEnum.NORMAL.getValue());
        List<TpElevatorModel> result = tpElevatorModelMapper.selectTpElevatorModelListNew(tpElevatorModel);
        if (CollectionUtils.isEmpty(result)) {
            return result;
        }

        List<Long> userIdsAll = Lists.newArrayList();
        result.forEach(row -> {
            if (StringUtils.isNotBlank(row.getTargetUserIds())){
                userIdsAll.addAll(Arrays.stream(row.getTargetUserIds().split(",")).filter(StringUtils::isNotBlank).map(Long::valueOf).collect(Collectors.toList()));
            }
        });

        // 获取适用国家，适用用户信息
        Map<Long, TbCountry> allCountryMap = tbCountryService.allCountryMap();
        Map<Long, String> userNameMap = CollectionUtils.isNotEmpty(userIdsAll) ?
                sysUserService.listByIds(userIdsAll).stream().collect(Collectors.toMap(SysUser::getUserId, SysUser::getNickName)): Maps.newHashMap();
        result.forEach(row -> {
            if (StringUtils.isNotBlank(row.getTargetCountryIds())){
                row.setTargetCountry(Arrays.stream(row.getTargetCountryIds().split(",")).filter(StringUtils::isNotBlank)
                        .map(id -> Objects.nonNull(allCountryMap.get(Long.valueOf(id))) ? LocalUtils.localCountryNameFun().apply(allCountryMap.get(Long.valueOf(id))): null)
                        .filter(StringUtils::isNotBlank)
                        .collect(Collectors.joining(",")));
            }

            if (StringUtils.isNotBlank(row.getTargetUserIds())){
                row.setTargetUser(Arrays.stream(row.getTargetUserIds().split(",")).filter(StringUtils::isNotBlank)
                        .map(id -> Objects.nonNull(userNameMap.get(Long.valueOf(id))) ? userNameMap.get(Long.valueOf(id)): null)
                        .filter(StringUtils::isNotBlank)
                        .collect(Collectors.joining(",")));
            }
        });



        return result;
    }

    @Override
    public List<TpElevatorModel> listNewAll(TpElevatorModelVo tpElevatorModel) {
        if (Objects.nonNull(tpElevatorModel.getCountryId())) {
            tpElevatorModel.setStatus(StatusEnum.ENABLE.getCode());
            tpElevatorModel.setDelFlag(DelFlagEnum.NORMAL.getValue());
            tpElevatorModel.setUserId(SecurityUtils.getUserId());
            tpElevatorModel.setCountryId(tpElevatorModel.getCountryId());
            return tpElevatorModelMapper.selectTpElevatorModelListNewByCountryUser(tpElevatorModel);
        }
        if (tpElevatorModel.isNeedAll()) {
            return tpElevatorModelMapper.selectTpElevatorModelListNew(tpElevatorModel);
        }
        log.info("电梯型号获取失败,区域为空");
        return Collections.emptyList();
    }

    @Override
    public ElevatorModeParamlVo selectTpElevatorModelParamById(Long id) {
        return tpElevatorModelMapper.selectTpElevatorModelParamById(id);
    }

    @Override
    public ElevatorModeParamlVo selectTpElevatorModelParamSelectItemById(Long id) {
        ElevatorModeParamlVo item = new ElevatorModeParamlVo();
        TpElevatorModel model = tpElevatorModelMapper.selectTpElevatorModelById(id);
        BeanUtils.copyProperties(model, item);
        List<AreaElevatorModelParaVO> list = tpElevatorModelMapper.selectTpElevatorModelParamSelectItemById(id);
        //查询全部的选项\
        TpParaSelectItem param = new TpParaSelectItem();
        List<TpParaSelectItem> allselect = tpParaSelectItemMapper.selectTpParaSelectItemList(param);
        Locale locale = LocaleContextHolder.getLocale();
        String language = locale.getLanguage();

        //设置每个参数的选项opt
        for (AreaElevatorModelParaVO modelPara : list) {
            List<TransferParam> optList = new ArrayList<>();
            Long ids = modelPara.getParaId();
            List<TpParaSelectItem> paraselect = allselect.stream()
                .filter(it -> it.getParaId().equals(ids))
                .collect(Collectors.toList());
            for (TpParaSelectItem opt : paraselect) {
                TransferParam transferParam = new TransferParam();
                transferParam.setDisabled(false);
                transferParam.setKey(opt.getId());
                String label = "";
                switch (language) {
                    case "zh":
                        label = opt.getLabel();
                        break;
                    case "en":
                        label = opt.getLabelUS();
                        break;
                    case "es":
                        label = opt.getLabelES();
                        break;
                    case "ru":
                        label = opt.getLabelRU();
                        break;
                }
                transferParam.setLabel(label);
                optList.add(transferParam);
            }
            modelPara.setParaSelectListOpt(optList);
            if (!ObjectUtils.isEmpty(modelPara.getSelectItemList())) {
                List<Long> selectItems = modelPara.getSelectItemList().stream()
                    .map(AreaParaSelectItemVo::getParaSelectItemId).collect(Collectors.toList());
                modelPara.setParaAreaSelectList(selectItems);
            } else {
                List<Long> res = new ArrayList<>();
                modelPara.setParaAreaSelectList(res);
            }
        }

        //根据paraCategory分组
        Map<String, List<AreaElevatorModelParaVO>> tabs = list.stream()
            .collect(groupingBy(AreaElevatorModelParaVO::getParaCategory));
        List<TabsVo> vos = new ArrayList<>();
        for (String paraCategory : tabs.keySet()) {
            List<AreaElevatorModelParaVO> tempPara = tabs.get(paraCategory);
            TabsVo vo = new TabsVo();
            vo.setParaCategory(paraCategory);
            vo.setParaSelect(tempPara);
            vos.add(vo);
        }
        item.setTabsList(vos);

        return item;
    }

    @Override
    public ElevatorModeParamlVo selectTpElevatorModelParamStantById(Long id) {
        ElevatorModeParamlVo item = new ElevatorModeParamlVo();
        TpElevatorModel model = tpElevatorModelMapper.selectTpElevatorModelById(id);
        BeanUtils.copyProperties(model, item);
        //查询所有参数可选项以及默认数据
        List<AreaElevatorModelParaVO> list = tpElevatorModelMapper.selectTpElevatorModelParamSelectItemAllById(id);
        //根据paraCategory分组
        Map<String, List<AreaElevatorModelParaVO>> tabs = list.stream()
            .sorted(Comparator.comparing(AreaElevatorModelParaVO::getSort))
            .collect(groupingBy(AreaElevatorModelParaVO::getParaCategory));
        List<TabsVo> vos = new ArrayList<>();
        for (String paraCategory : tabs.keySet()) {
            List<AreaElevatorModelParaVO> tempPara = tabs.get(paraCategory);
            TabsVo vo = new TabsVo();
            vo.setParaCategory(paraCategory);
            vo.setParaSelect(tempPara);
            vos.add(vo);
        }
        item.setTabsList(vos);
        return item;
    }

    @Resource
    private ITpParabarService iTpParabarService;

    @Override
    public EleconfigVO selectTpElevatorModelParamOption(Long id, boolean quotationFlag) {
        EleconfigVO eleconfigVO = new EleconfigVO();
        List<EleCategoryVO> categoryVOList = new ArrayList<>();
        // 普通参数
        ElevatorModeParamlVo elevatorModeParamlVo = tpElevatorModelMapper
            .selectTpElevatorModelParamOptionById(id, quotationFlag);
        List<ElParabarVO> parabarList = new ArrayList<>();
        if (quotationFlag) {
            // 参数包
            parabarList = iTpParabarService.getParabarConfigByElevatorModelId(id);
        }
        // 过滤非装潢参数包
        List<ElParabarVO> undecorateParabarList = parabarList.stream()
            .filter(parabar -> "0".equals(parabar.getDecorateFlag()))
            .collect(Collectors.toList());
        // 给参数包设置 参数类别
        fillParaCategory(undecorateParabarList);
        // 参数包转map  Key：paramCategory  value：ElParabarVO
        Map<String, List<ElParabarVO>> parabarMap = undecorateParabarList.stream()
            .collect(groupingBy(ElParabarVO::getParaCategory));
        // 参数包配置值转map  Key：paraCode  value：paraValue
        Map<String, Pair<Long, Long>> codeValueMap = convert2CodeValueMap(undecorateParabarList);

        if (ObjectUtils.isNotEmpty(elevatorModeParamlVo) && CollUtil.isNotEmpty(elevatorModeParamlVo.getParaSelect())) {
            // 根据类别分组
            Map<String, List<AreaElevatorModelParaVO>> categoryMap = elevatorModeParamlVo.getParaSelect().stream()
                .collect(groupingBy(AreaElevatorModelParaVO::getParaCategory));
            // 遍历类别
            for (Map.Entry<String, List<AreaElevatorModelParaVO>> entry : categoryMap.entrySet()) {
                String paraCategory = entry.getKey();
                List<AreaElevatorModelParaVO> value = entry.getValue();
                List<ElParabarVO> elParabarVOS = parabarMap.get(paraCategory);
                List<EleParamVO> eleParamVOList = new ArrayList<>();
                // ++++++++++++++参数包 start
                if (CollUtil.isNotEmpty(elParabarVOS)) {
                    // 遍历参数
                    for (ElParabarVO paraVO : elParabarVOS) {
                        // 如果是下拉矿，遍历参数选项
                        List<EleParamOptionVO> paramOptionVOList = new ArrayList<>();
                        List<ElParabarDetailVO> paramList = paraVO.getParamList();
                        if (CollUtil.isNotEmpty(paramList)) {
                            for (ElParabarDetailVO parabarDetailVO : paramList) {
                                EleParamOptionVO paramOptionVO = EleParamOptionVO.builder()
                                    .label(parabarDetailVO.getParabarDetailName())
                                    .labelUS(parabarDetailVO.getParabarDetailNameUS())
                                    .labelES(parabarDetailVO.getParabarDetailNameES())
                                    .labelRU(parabarDetailVO.getParabarDetailNameRU())
                                    .isShow(true)
                                    .value(parabarDetailVO.getId().toString())
                                    .parabarDetailValueList(parabarDetailVO.getParamOptionList())
                                    .build();
                                paramOptionVOList.add(paramOptionVO);
                            }
                        }
                        EleParamVO paramVO = EleParamVO.builder()
                            .paramType(ParamTypeEnum.BAR.getCode())
                            .label(paraVO.getParabarName())
                            .labelUS(paraVO.getParabarNameUS())
                            .labelES(paraVO.getParabarNameES())
                            .labelRU(paraVO.getParabarNameRU())
                            .paraCode(paraVO.getId().toString())
                            .inputType(InputTypeEnum.SELECT.getCode())
                            .isShow(true)
                            .enabled(true)
                            // .defaultValue(null)
                            // .defaultId(null)
                            // .finalValue(null)
                            .paramOptionList(paramOptionVOList)
                            .build();
                        eleParamVOList.add(paramVO);
                    }
                }
                // ++++++++++++++参数包 end

                // 参数排序
                value = value.stream().sorted(Comparator.comparingLong(AreaElevatorModelParaVO::getSort))
                    .collect(Collectors.toList());

                // 遍历参数
                for (AreaElevatorModelParaVO paraVO : value) {
                    // 如果是下拉矿，遍历参数选项
                    List<EleParamOptionVO> paramOptionVOList = new ArrayList<>();
                    List<AreaParaSelectItemVo> selectItemList = paraVO.getSelectItemList();
                    if (CollUtil.isNotEmpty(selectItemList)) {
                        for (AreaParaSelectItemVo paramItem : selectItemList) {
                            EleParamOptionVO paramOptionVO = EleParamOptionVO.builder()
                                .label(paramItem.getLabel())
                                .labelUS(paramItem.getLabelUS())
                                .labelES(paramItem.getLabelES())
                                .labelRU(paramItem.getLabelRU())
                                .paraSource(paramItem.getParaSource())
                                .isShow(true)
                                .value(paramItem.getParaSelectItemValue())
                                .build();
                            paramOptionVOList.add(paramOptionVO);
                        }
                    }

                    // 参数包的值覆盖默认参数，参数类型变更,状态改为不可见
                    String defaultValue = paraVO.getParaDefaultValue();
                    // checkbox如果没有默认值则设置默认值No
                    if (InputTypeEnum.CHECK_BOX.getCode().equals(paraVO.getInputType())
                        && StringUtils.isBlank(defaultValue)) {
                        defaultValue = "No";
                        log.info("电梯参数 [{}] checkbox设置默认值No", paraVO.getParaName());
                    }
                    String paramType = ParamTypeEnum.NORMAL.getCode();
                    Pair<Long, Long> pair = codeValueMap.get(paraVO.getParaCode());
                    Long parabarId = null;
                    Long parabarDetailId = null;
                    Boolean isShow = true;
                    if (Objects.nonNull(pair)) {
                        defaultValue = null;
                        paramType = ParamTypeEnum.BAR_PARAM.getCode();
                        isShow = false;
                        parabarId = pair.getKey();
                        parabarDetailId = pair.getValue();
                    }
                    // 计算参数前端隐藏（20240829修改）
                    if (StatusEnum.ENABLE.getCode().equals(paraVO.getIsCalc())) {
                        isShow = false;
                    }
                    EleParamVO paramVO = EleParamVO.builder()
                        .paramType(paramType)
                        .parabarId(parabarId)
                        .parabarDetailId(parabarDetailId)
                        .label(paraVO.getParaName())
                        .labelUS(paraVO.getParaNameUS())
                        .labelES(paraVO.getParaNameES())
                        .labelRU(paraVO.getParaNameRU())
                        .paraCode(paraVO.getParaCode())
                        .inputType(paraVO.getInputType())
                        .defaultValue(defaultValue)
                        .defaultId(String.valueOf(paraVO.getParaDefaultId()))
                        .finalValue(defaultValue)
                        .isShow(isShow)
                        .enabled(true)
                        .paramOptionList(paramOptionVOList)
                        .build();
                    eleParamVOList.add(paramVO);
                }
                // 参数包逻辑
                Boolean categoryIsShow = eleParamVOList.stream().anyMatch(EleParamVO::getIsShow);
                // 参数大类的类别都相同
                AreaElevatorModelParaVO areaElevatorModelParaVO = value.get(0);

                EleCategoryVO eleCategoryVO = EleCategoryVO.builder()
                    .dictSort(areaElevatorModelParaVO.getDictSort())
                    .paraCategory(areaElevatorModelParaVO.getParaCategory())
                    .label(areaElevatorModelParaVO.getParaCategoryLabel())
                    .labelUS(areaElevatorModelParaVO.getParaCategoryLabelUS())
                    .labelRU(areaElevatorModelParaVO.getParaCategoryLabelRU())
                    .labelES(areaElevatorModelParaVO.getParaCategoryLabelES())
                    .isShow(categoryIsShow)
                    .enabled(true)
                    .paramList(eleParamVOList).build();
                //新增判断如果eleParamVOList为空则isShow为false
                if(ObjectUtils.isEmpty(eleParamVOList)){
                    eleCategoryVO.setIsShow(false);
                }
                categoryVOList.add(eleCategoryVO);
            }
            categoryVOList.sort(Comparator.comparingLong(EleCategoryVO::getDictSort));
            eleconfigVO.setCategoryList(categoryVOList);
        }
        // 装潢包参数组装
        List<ElParabarVO> decorateParabarList = parabarList.stream()
            .filter(parabar -> "1".equals(parabar.getDecorateFlag()))
            .collect(Collectors.toList());

        if (CollUtil.isNotEmpty(decorateParabarList)) {
            List<EleDecorateConfigVO> decorateConfigVOList = new ArrayList<>();
            for (ElParabarVO elParabarVO : decorateParabarList) {
                for (ElParabarDetailVO elParabarDetailVO : elParabarVO.getParamList()) {
                    List<EleParamVO> paramList = new ArrayList<>();
                    for (ElParabarDetailValueVO elParabarDetailValueVO : elParabarDetailVO.getParamOptionList()) {
                        List<EleParamOptionVO> paramOptionVOList = new ArrayList<>();
                        EleParamOptionVO paramOptionVO = EleParamOptionVO.builder()
                            .label(elParabarDetailValueVO.getParamOptionLabel())
                            .labelUS(elParabarDetailValueVO.getParamOptionLabelUS())
                            .labelES(elParabarDetailValueVO.getParamOptionLabelES())
                            .labelRU(elParabarDetailValueVO.getParamOptionLabelRU())
                            // .isShow(true)
                            .value(elParabarDetailValueVO.getParaValue())
                            .build();
                        paramOptionVOList.add(paramOptionVO);

                        EleParamVO paramVO = EleParamVO.builder()
                            // .paramType(elParabarDetailValueVO.get)
                            .sortNumber(elParabarDetailValueVO.getSortNumber())
                            .parabarId(elParabarVO.getId())
                            .parabarDetailId(elParabarDetailVO.getId())
                            .label(elParabarDetailValueVO.getParaName())
                            .labelUS(elParabarDetailValueVO.getParaNameUS())
                            .labelES(elParabarDetailValueVO.getParaNameES())
                            .labelRU(elParabarDetailValueVO.getParaNameRU())
                            .paraCode(elParabarDetailValueVO.getParaCode())
                            .inputType(elParabarDetailValueVO.getInputType())
                            // .defaultValue(defaultValue)
                            // .defaultId(String.valueOf(paraVO.getParaDefaultId()))
                            .finalValue(elParabarDetailValueVO.getParaValue())
                            .paramOptionList(paramOptionVOList)
                            .build();
                        paramList.add(paramVO);
                    }
                    paramList.sort(Comparator.comparing(EleParamVO::getSortNumber));
                    EleDecorateConfigVO build = EleDecorateConfigVO.builder()
                        .url(elParabarDetailVO.getUrl())
                            .parabarDetailName(elParabarDetailVO.getParabarDetailName())
                            .parabarDetailNameUS(elParabarDetailVO.getParabarDetailNameUS())
                            .parabarDetailNameES(elParabarDetailVO.getParabarDetailNameES())
                            .parabarDetailNameRU(elParabarDetailVO.getParabarDetailNameRU())
                            .parabarId(elParabarVO.getId())
                        .parabarDetailId(elParabarDetailVO.getId())
                        .paramList(paramList)
                        .build();
                    decorateConfigVOList.add(build);
                }
            }
            eleconfigVO.setEleDecorateConfigList(decorateConfigVOList);
        }
        return eleconfigVO;
    }

    @Override
    public ExcelUtils.UploadResult<PriceFormBasicInfoHelper> checkPriceFormImport(
        BasicTableInfoHelper basicTableInfoHelper,
        List<PriceFormBasicInfoHelper> list) {
        return ExcelUtils.checkData(list, it -> {
            List<String> businessErrors = Lists.newArrayList();

            //todo 执行验证及其他操作
            return businessErrors;
        });
    }

    @Override
    public ElevatorModeParamlVo selectTpElevatorModelJGBById(Long id) {
        ElevatorModeParamlVo item = new ElevatorModeParamlVo();
        TpElevatorModel model = tpElevatorModelMapper.selectTpElevatorModelById(id);
        BeanUtils.copyProperties(model, item);

        //设置基础价格
        TpAreaBasicPriceVo areaBase = new TpAreaBasicPriceVo();
        TpAreaBasicPrice tpAreaBasicPrice = new TpAreaBasicPrice();
        tpAreaBasicPrice.setElevatorModelId(id);
        List<TpAreaBasicPriceVo> baseList = tpAreaBasicPriceMapper.getTpAreaBasicPriceList(tpAreaBasicPrice);
        item.setBaseData(baseList);

        // todo 设置选配项目

        return item;
    }

    private List<ElParabarVO> falseData() {
        List<String> urls = Arrays.asList("https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg",
            "https://fuss10.elemecdn.com/1/34/19aa98b1fcb2781c4fba33d850549jpeg.jpeg",
            "https://fuss10.elemecdn.com/0/6f/e35ff375812e6b0020b6b4e8f9583jpeg.jpeg",
            "https://fuss10.elemecdn.com/9/bb/e27858e973f5d7d3904835f46abbdjpeg.jpeg",
            "https://fuss10.elemecdn.com/d/e6/c4d93a3805b3ce3f323f7974e6f78jpeg.jpeg",
            "https://fuss10.elemecdn.com/3/28/bbf893f792f03a54408b3b7a7ebf0jpeg.jpeg",
            "https://fuss10.elemecdn.com/2/11/6535bcfb26e4c79b48ddde44f4b6fjpeg.jpeg");

        List<ElParabarVO> elParabarVOS = new ArrayList<>();
        ElParabarVO elParabarVO = new ElParabarVO();
        List<ElParabarDetailVO> paramList = new ArrayList<>();
        for (int i = 0; i < urls.size(); i++) {
            ElParabarDetailVO elParabarDetailVO = new ElParabarDetailVO();
            elParabarDetailVO.setUrl(urls.get(i));
            elParabarDetailVO.setId(Long.valueOf(i + ""));
            ElParabarDetailValueVO elParabarDetailValueVO = new ElParabarDetailValueVO();
            elParabarDetailValueVO.setParabarId(72L);
            elParabarDetailValueVO.setParaName("扶手样式（左）" + i);
            elParabarDetailValueVO.setParaNameES("扶手样式（左）" + i);
            elParabarDetailValueVO.setParaNameUS("扶手样式（左）" + i);
            elParabarDetailValueVO.setParaNameRU("扶手样式（左）" + i);
            elParabarDetailValueVO.setParaCode("FSYSZ");
            elParabarDetailValueVO.setParaValue("100");
            elParabarDetailValueVO.setParamOptionLabel("KASKDK_ASJKDJ");
            elParabarDetailValueVO.setParamOptionLabelES("KASKDK_ASJKDJ");
            elParabarDetailValueVO.setParamOptionLabelUS("KASKDK_ASJKDJ");
            elParabarDetailValueVO.setParamOptionLabelRU("KASKDK_ASJKDJ");
            elParabarDetailVO.setParamOptionList(Arrays.asList(elParabarDetailValueVO));
            paramList.add(elParabarDetailVO);
        }
        elParabarVO.setId(72L);
        elParabarVO.setParamList(paramList);
        elParabarVOS.add(elParabarVO);
        return elParabarVOS;
    }

    private Map<String, Pair<Long, Long>> convert2CodeValueMap(List<ElParabarVO> parabarList) {
        Map<String, Pair<Long, Long>> codeValueMap = new HashMap<>();
        for (ElParabarVO parabarVO : parabarList) {
            for (ElParabarDetailVO elParabarDetailVO : parabarVO.getParamList()) {
                elParabarDetailVO.getParamOptionList().forEach(item -> {
                    codeValueMap.put(item.getParaCode(), Pair.of(parabarVO.getId(), elParabarDetailVO.getId()));
                });
            }
        }
        return codeValueMap;
    }

    private void fillParaCategory(List<ElParabarVO> parabarList) {
        if (CollUtil.isNotEmpty(parabarList)) {
            for (ElParabarVO parabarVO : parabarList) {
                parabarVO.setParaCategory(
                    parabarVO.getParamList().get(0).getParamOptionList().get(0).getParaCategory());
            }
        }
    }

    @Override
    public EleconfigVO listElevatorParam(Long id, boolean quotationFlag) {
        EleconfigVO eleconfigVO = new EleconfigVO();
        // 字典：参数大类
        List<SysDictData> paraCategory = DictUtils.getDictCache("para_category");
        Map<String, SysDictData> paraCategoryMap = new HashMap<>();
        if (CollUtil.isNotEmpty(paraCategory)) {
            paraCategoryMap = paraCategory.stream()
                .collect(Collectors.toMap(SysDictData::getDictValue, a -> a, (a, b) -> a));
        }
        List<TqSpecificationDetail> tqSpecificationDetailList = new ArrayList<>();
        if (quotationFlag) {
            //     报价
            LambdaQueryWrapper<TqSpecificationDetail> sdWrapper = Wrappers.<TqSpecificationDetail>lambdaQuery()
                .eq(TqSpecificationDetail::getSpecificationId, id)
                .eq(TqSpecificationDetail::getDelFlag, DelFlagEnum.NORMAL.getValue());
            tqSpecificationDetailList = tqSpecificationDetailMapper.selectList(sdWrapper);
        } else {
            //     土建
            LambdaQueryWrapper<TjElevatorParaDetail> sdWrapper = Wrappers.<TjElevatorParaDetail>lambdaQuery()
                .eq(TjElevatorParaDetail::getElevatorId, id)
                .eq(TjElevatorParaDetail::getDelFlag, DelFlagEnum.NORMAL.getValue());
            List<TjElevatorParaDetail> tjElevatorParaDetails = tjElevatorParaDetailMapper.selectList(sdWrapper);
            tqSpecificationDetailList = tjElevatorParaDetails.stream().map(item -> {
                TqSpecificationDetail tqSpecificationDetail = new TqSpecificationDetail();
                tqSpecificationDetail.setParaCode(item.getParaCode());
                tqSpecificationDetail.setParaValue(item.getParaValue());
                tqSpecificationDetail.setParaCategory(item.getParaCategory());
                return tqSpecificationDetail;
            }).collect(Collectors.toList());
        }

        List<String> paraCodeList = tqSpecificationDetailList.stream().map(TqSpecificationDetail::getParaCode)
            .collect(Collectors.toList());
//        List<TpParaLibrary> tpParaLibraries = tpParaLibraryMapper.selectList(
//            Wrappers.<TpParaLibrary>lambdaQuery().in(TpParaLibrary::getParaCode, paraCodeList));
        List<TpParaLibrary> tpParaLibraries = tpParaLibraryMapper.selectList(
                CollectionUtils.isNotEmpty(paraCodeList) ? Wrappers.<TpParaLibrary>lambdaQuery().in(TpParaLibrary::getParaCode, paraCodeList) : null
        );
        // 参数库
        Map<String, TpParaLibrary> paraLibraryMap = tpParaLibraries.stream()
            .collect(Collectors.toMap(TpParaLibrary::getParaCode, a -> a, (a, b) -> a));
        // 参数选项
        List<Long> paraLibraryIdList = tpParaLibraries.stream().map(TpParaLibrary::getId).collect(Collectors.toList());
        Map<Long, String> idCodeMap = tpParaLibraries.stream()
            .collect(Collectors.toMap(TpParaLibrary::getId, TpParaLibrary::getParaCode));
        List<TpParaSelectItem> tpParaSelectItems = tpParaSelectItemMapper.selectList(
            Wrappers.<TpParaSelectItem>lambdaQuery().in(TpParaSelectItem::getParaId, paraLibraryIdList));
        // 参数选项Map  key: paraCode_value
        Map<String, TpParaSelectItem> paraSelectItemMap = tpParaSelectItems.stream().collect(Collectors.toMap(a -> {
            String paraCode = idCodeMap.getOrDefault(a.getParaId(), "");
            return paraCode + "_" + a.getValue();
        }, a -> a, (a, b) -> a));

        // 参数大类list
        // 普通参数 参数包
        List<EleCategoryVO> eleCategoryList = new ArrayList<>();
        // 装潢包
        List<EleDecorateConfigVO> eleDecorateConfigList = new ArrayList<>();
        Map<String, List<TqSpecificationDetail>> collect = tqSpecificationDetailList.stream()
            .collect(groupingBy(TqSpecificationDetail::getParaCategory));
        // 参数包SET
        Set<Long> parabarIdSet = new HashSet<>();

        for (Map.Entry<String, List<TqSpecificationDetail>> entry : collect.entrySet()) {
            List<EleParamVO> paramList = new ArrayList<>();
            if ("99".equals(entry.getKey())) {
                List<TqSpecificationDetail> decorateList = entry.getValue();
                TqSpecificationDetail tqSpecificationDetail = decorateList.get(0);
                // 装潢包
                List<TbFile> tbFiles = tbFileMapper.selectList(Wrappers.<TbFile>lambdaQuery()
                    .eq(TbFile::getBusinessId, tqSpecificationDetail.getParabarDetailId())
                    .eq(TbFile::getBusinessType, FileBuzType.PARABAR_DETAIL.getType())
                    .orderByDesc(TbFile::getId));
                String url = null;
                if (CollUtil.isNotEmpty(tbFiles)) {
                    url = tbFiles.get(0).getFilePath();
                }
                List<EleParamVO> decorateParamList = new ArrayList<>();
                extracted(paraLibraryMap, paraSelectItemMap, entry, decorateParamList);

                EleDecorateConfigVO eleDecorateConfigVO = EleDecorateConfigVO.builder()
                    .paramList(decorateParamList)
                    .parabarDetailId(tqSpecificationDetail.getParabarDetailId())
                    .parabarId(tqSpecificationDetail.getParabarId())
                    .url(url)
                    .build();
                eleDecorateConfigList.add(eleDecorateConfigVO);
            } else {
                // 参数包
                extractedParbar(parabarIdSet, entry, paramList);
                // 普通参数
                SysDictData dict = paraCategoryMap.getOrDefault(entry.getKey(), new SysDictData());
                extracted(paraLibraryMap, paraSelectItemMap, entry, paramList);
                EleCategoryVO build = EleCategoryVO.builder()
                    .dictSort(dict.getDictSort())
                    .enabled(true)
                    .isShow(true)
                    .label(dict.getDictLabel())
                    .labelES(dict.getDictLabelES())
                    .labelRU(dict.getDictLabelRU())
                    .labelUS(dict.getDictLabelUS())
                    .paraCategory(entry.getKey())
                    .paramList(paramList)
                    .build();
                eleCategoryList.add(build);
            }
        }
        eleCategoryList.sort((o1, o2) -> (o1.getDictSort().intValue()) - (o2.getDictSort().intValue()));
        eleconfigVO.setCategoryList(eleCategoryList);
        eleconfigVO.setEleDecorateConfigList(eleDecorateConfigList);
        return eleconfigVO;
    }

    private void extractedParbar(Set<Long> parabarIdSet, Entry<String, List<TqSpecificationDetail>> entry,
        List<EleParamVO> paramList) {
        for (TqSpecificationDetail item : entry.getValue()) {
            Long parabarId = item.getParabarId();
            if (Objects.nonNull(item.getParabarId()) && !parabarIdSet.contains(parabarId)) {
                parabarIdSet.add(parabarId);
                List<TpParabar> tpParabars = tpParabarMapper.selectList(
                    Wrappers.<TpParabar>lambdaQuery().eq(TpParabar::getId, parabarId));
                TpParabar parabar = new TpParabar();
                if (CollUtil.isNotEmpty(tpParabars)) {
                    parabar = tpParabars.get(0);
                }
                EleParamVO eleParamVO = EleParamVO.builder()
                    .enabled(true)
                    .finalValue(item.getParabarDetailId() + "")
                    .inputType("02")
                    .isShow(true)
                    .label(parabar.getParabarName())
                    .labelES(parabar.getParabarNameES())
                    .labelRU(parabar.getParabarNameRU())
                    .labelUS(parabar.getParabarNameUS())
                    .paraCode(parabar.getId() + "")
                    .paramType(ParamTypeEnum.BAR.getCode())
                    .build();
                List<TpParabarDetail> tpParabarDetails = tpParabarDetailMapper.selectList(
                    Wrappers.<TpParabarDetail>lambdaQuery()
                        .eq(TpParabarDetail::getId, item.getParabarDetailId()));
                TpParabarDetail parabarDetail = new TpParabarDetail();
                if (CollUtil.isNotEmpty(tpParabarDetails)) {
                    parabarDetail = tpParabarDetails.get(0);
                }
                EleParamOptionVO option = EleParamOptionVO.builder()
                    .label(parabarDetail.getParabarDetailName())
                    .labelES(parabarDetail.getParabarDetailNameES())
                    .labelRU(parabarDetail.getParabarDetailNameRU())
                    .labelUS(parabarDetail.getParabarDetailNameUS())
                    .value(parabarDetail.getId() + "")
                    .isShow(true)
                    .build();
                eleParamVO.setParamOptionList(Collections.singletonList(option));

                paramList.add(eleParamVO);
            }
        }
    }

    private static void extracted(Map<String, TpParaLibrary> paraLibraryMap,
        Map<String, TpParaSelectItem> paraSelectItemMap, Entry<String, List<TqSpecificationDetail>> entry,
        List<EleParamVO> decorateParamList) {
        for (TqSpecificationDetail item : entry.getValue()) {
            TpParaLibrary tpParaLibrary = paraLibraryMap.getOrDefault(item.getParaCode(), new TpParaLibrary());
            EleParamVO eleParamVO = EleParamVO.builder()
                .enabled(true)
                .finalValue(item.getParaValue())
                .inputType(tpParaLibrary.getInputType())
                .isShow("1".equals(tpParaLibrary.getIsCalc()))
                .label(tpParaLibrary.getParaName())
                .labelES(tpParaLibrary.getParaNameES())
                .labelRU(tpParaLibrary.getParaNameRU())
                .labelUS(tpParaLibrary.getParaNameUS())
                .paraCode(item.getParaCode())
                .paramType(ParamTypeEnum.NORMAL.getCode())
                .build();
            // 参数包的参数也不可见
            if (Objects.nonNull(item.getParabarDetailId()) && !"99".equals(item.getParaCategory())) {
                eleParamVO.setIsShow(false);
                eleParamVO.setParamType(ParamTypeEnum.BAR_PARAM.getCode());
            }

            // 下拉框填充选项
            if (InputTypeEnum.SELECT.getCode().equals(tpParaLibrary.getInputType()) ||
                InputTypeEnum.INPUT_SELECT.getCode().equals(tpParaLibrary.getInputType())) {
                TpParaSelectItem selectItem = paraSelectItemMap.getOrDefault(
                    item.getParaCode() + "_" + item.getParaValue(), null);
                if (Objects.nonNull(selectItem)) {
                    EleParamOptionVO option = EleParamOptionVO.builder()
                        .label(selectItem.getLabel())
                        .labelES(selectItem.getLabelES())
                        .labelRU(selectItem.getLabelRU())
                        .labelUS(selectItem.getLabelUS())
                        .value(item.getParaValue())
                        .isShow(true)
                        .build();
                    eleParamVO.setParamOptionList(Collections.singletonList(option));
                }
            }
            decorateParamList.add(eleParamVO);
        }
    }
}
