heheng
2025-11-28 6d5fc7859473d30a2e4c1f20f748abae652342b8
multi-system/src/main/java/com/gkhy/exam/system/service/impl/CatalogueServiceImpl.java
@@ -13,14 +13,17 @@
import com.gkhy.exam.system.domain.vo.CatalogueVo;
import com.gkhy.exam.system.mapper.CatalogueMapper;
import com.gkhy.exam.system.mapper.CompanyIndustryTemplateMapper;
import com.gkhy.exam.system.mapper.ProductItemMapper;
import com.gkhy.exam.system.mapper.SysCompanyMapper;
import com.gkhy.exam.system.service.CatalogueService;
import com.gkhy.exam.system.service.ProjectDocumentService;
import com.gkhy.exam.system.service.SysCompanyService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -34,6 +37,10 @@
    private SysCompanyMapper sysCompanyMapper;
    @Autowired
    private CompanyIndustryTemplateMapper companyIndustryTemplateMapper;
    @Autowired
    private ProductItemMapper productItemMapper;
    @Autowired
    private ProjectDocumentService projectDocumentService;
    /**
     * 目录管理
@@ -73,7 +80,7 @@
            }
        }
        catalogue.setCreateBy(SecurityUtils.getUsername());
        catalogue.setCreateTime(LocalDate.now());
        catalogue.setCreateTime(LocalDateTime.now());
        int insert = catalogueMapper.insert(catalogue);
        if (insert>0){
            return CommonResult.success();
@@ -84,7 +91,7 @@
    @Override
    public CommonResult updateCatalogue(Catalogue catalogue) {
        catalogue.setUpdateBy(SecurityUtils.getUsername());
        catalogue.setUpdateTime(LocalDate.now());
        catalogue.setUpdateTime(LocalDateTime.now());
        int i = catalogueMapper.updateById(catalogue);
        if (i>0){
            return CommonResult.success();
@@ -104,7 +111,7 @@
        Catalogue catalogue = new Catalogue();
        catalogue.setId(catalogueId);
        catalogue.setDelFlag(2);
        catalogue.setUpdateTime(LocalDate.now());
        catalogue.setUpdateTime(LocalDateTime.now());
        catalogue.setUpdateBy(SecurityUtils.getUsername());
        int i = catalogueMapper.updateById(catalogue);
        if (i>0){
@@ -243,7 +250,8 @@
    @Override
    public CommonResult copyCatalogue(List<CatalogueVo> catalogue) {
        Integer companyId = catalogue.get(0).getCompanyId();
        catalogueMapper.delete(Wrappers.<Catalogue>lambdaQuery().eq(Catalogue::getCompanyId,companyId));
        Integer type = catalogue.get(0).getType();
        catalogueMapper.delete(Wrappers.<Catalogue>lambdaQuery().eq(Catalogue::getCompanyId,companyId).eq(Catalogue::getType,catalogue.get(0).getType()));
        for (CatalogueVo catalogueVo : catalogue) {
            Catalogue catalogue1 = new Catalogue();
            BeanUtils.copyProperties(catalogueVo,catalogue1);
@@ -253,9 +261,26 @@
                saveCatalogue(children,catalogue1);
            }
        }
        productItemMapper.deletedByCompanyId(companyId,type.equals(2)?1:2);
        return CommonResult.success();
    }
    @Override
    public CommonResult selectCatalogueDocumentList(CatalogueReq catalogueReq) {
        List<CatalogueVo> catalogueVos = catalogueMapper.selectCatalogueList(catalogueReq);
        for (CatalogueVo catalogueVo : catalogueVos) {
            List<ProjectDocument> projectDocuments = projectDocumentService.selectList(catalogueVo.getCompanyId(), catalogueReq.getItemId(), catalogueVo.getId(),catalogueReq.getType());
            catalogueVo.setProjectDocuments(projectDocuments);
        }
        List<CatalogueVo> collect = catalogueVos.stream().filter(catalogueVo -> catalogueVo.getParentId() == 0).collect(Collectors.toList());
        for (CatalogueVo catalogueVo : collect) {
            List<CatalogueVo> getchildren = getchildren(catalogueVo, catalogueVos);
            catalogueVo.setChildren(getchildren);
        }
        return CommonResult.success(collect);
    }
    private void saveCatalogue(List<CatalogueVo> children,Catalogue catalogue) {
        for (CatalogueVo child : children) {
            Catalogue catalogue1 = new Catalogue();