diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/packages/PackagesServiceImpl.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/packages/PackagesServiceImpl.java index a6188934..e04f0488 100644 --- a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/packages/PackagesServiceImpl.java +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/packages/PackagesServiceImpl.java @@ -4,6 +4,12 @@ import cn.hutool.core.io.IoUtil; import cn.iocoder.yudao.framework.common.util.FileUtils; import cn.iocoder.yudao.framework.common.util.barcode.BarcodeUtil; import cn.iocoder.yudao.module.infra.service.file.FileService; +import cn.iocoder.yudao.module.setting.dal.dataobject.depot.DepotDO; +import cn.iocoder.yudao.module.setting.dal.dataobject.depotcabinet.DepotCabinetDO; +import cn.iocoder.yudao.module.setting.dal.dataobject.organization.OrganizationDO; +import cn.iocoder.yudao.module.setting.dal.mysql.depot.DepotMapper; +import cn.iocoder.yudao.module.setting.dal.mysql.depotcabinet.DepotCabinetMapper; +import cn.iocoder.yudao.module.setting.dal.mysql.organization.OrganizationMapper; import me.zhyd.oauth.log.Log; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -39,6 +45,12 @@ public class PackagesServiceImpl implements PackagesService { private FileService fileService; @Value("${yudao.web.admin-ui.url}") private String webUrl; + @Resource + private OrganizationMapper organizationMapper; + @Resource + private DepotMapper depotMapper; + @Resource + private DepotCabinetMapper depotCabinetMapper; @Override @@ -48,6 +60,27 @@ public class PackagesServiceImpl implements PackagesService { String url = getUrl(packages); packages.setCodeUrl(url); packages.setCodeValue(packages.getCaseNum()+"-"+packages.getCatalogNum()+"-"+packages.getFilesNum()); + //位置 + Long organizationId = packages.getCompanyId(); + Long depotId = packages.getDepotId(); + Long cabinetId = packages.getCabinetId(); + OrganizationDO organizationDO = organizationMapper.selectById(organizationId); + DepotDO depotDO = depotMapper.selectById(depotId); + DepotCabinetDO depotCabinetDO = depotCabinetMapper.selectById(cabinetId); + String position = ""; + if (organizationDO != null) { + packages.setCompany(organizationDO.getOrganizationName()); + if (depotDO != null) { + packages.setDepotName(depotDO.getName()); + if (depotCabinetDO != null) { + packages.setCabinetName(depotCabinetDO.getName()); + } else { + packages.setCabinetName("默认档案柜"); + } + } else { + packages.setDepotName("默认库房"); + } + } packagesMapper.insert(packages); // 返回 return packages.getId();