Lius
2025-03-27 b0f56573ea27a8798764314c72cf39e9eb0651dc
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java
@@ -11,6 +11,7 @@
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.FillRuleConstant;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.util.FillRuleUtil;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.system.entity.*;
@@ -21,8 +22,10 @@
import org.jeecg.modules.system.model.MdcProductionTreeModel;
import org.jeecg.modules.system.model.ProductionIdModel;
import org.jeecg.modules.system.service.IMdcProductionService;
import org.jeecg.modules.system.service.ISysDictService;
import org.jeecg.modules.system.service.ISysParamsService;
import org.jeecg.modules.system.util.FindsProductionsChildrenUtil;
import org.jeecg.modules.system.vo.MdcProOptionsVo;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -51,6 +54,9 @@
    @Resource
    private ISysParamsService sysParamsService;
    @Resource
    private ISysDictService sysDictService;
    /**
     * queryTreeList 对应 queryTreeList 查询所有的产线数据,以树结构形式响应给前端
     */
@@ -521,6 +527,54 @@
        return FindsProductionsChildrenUtil.wrapTreeDataToTreeList(list);
    }
    @Override
    public List<String> findChildren(List<String> mdcProductionIds) {
        return this.baseMapper.findChildren(mdcProductionIds);
    }
    /**
     * 根据用户id获取产线(中心)或班组下拉选项
     * @param userId
     * @param productionId
     * @return
     */
    @Override
    public List<MdcProOptionsVo> loadProductionOptions(String userId, String productionId) {
        List<MdcProOptionsVo> result = new ArrayList<>();
        List<MdcProduction> mdcProductionList = this.baseMapper.loadProductionOptions(userId, productionId);
        if (mdcProductionList != null && !mdcProductionList.isEmpty()) {
            for (MdcProduction mdcProduction : mdcProductionList) {
                MdcProOptionsVo vo = new MdcProOptionsVo().convert(mdcProduction);
                result.add(vo);
            }
        }
        return result;
    }
    @Override
    public List<MdcProOptionsVo> loadTeamOptions(String userId, String productionId) {
        List<MdcProOptionsVo> result = new ArrayList<>();
        List<String> productionList = this.findChildren(Arrays.asList(productionId.split(",")));
        if (productionList != null && !productionList.isEmpty()) {
            List<String> dictValues = this.baseMapper.findTeamValue(userId, productionList);
            if (dictValues != null && !dictValues.isEmpty()) {
                List<DictModel> dictModels = sysDictService.queryEnableDictItemsByCode(CommonConstant.DICT_MDC_STAFF_TEAM);
                if (dictModels != null && !dictModels.isEmpty()) {
                    for (DictModel dictModel : dictModels) {
                        if (dictValues.contains(dictModel.getValue())) {
                            MdcProOptionsVo vo = new MdcProOptionsVo();
                            vo.setKey(dictModel.getValue());
                            vo.setValue(dictModel.getValue());
                            vo.setTitle(dictModel.getText());
                            result.add(vo);
                        }
                    }
                }
            }
        }
        return result;
    }
    /**
     * 打开 父节点 及 以上的mdc标记
     * @param parentId