huminmin
7 天以前 0fdd0bf60b7d98d21c9b5ff95bb55f0fa6495007
yudao-module-srm/src/main/java/cn/iocoder/yudao/module/srm/controller/admin/certificate/SrmSupplierCertificateController.java
@@ -6,7 +6,9 @@
import cn.iocoder.yudao.module.srm.controller.admin.certificate.vo.*;
import cn.iocoder.yudao.module.srm.dal.dataobject.SrmSupplierDO;
import cn.iocoder.yudao.module.srm.service.certificate.SrmSupplierCertificateService;
import cn.iocoder.yudao.module.srm.service.certificate.SrmSupplierCertificateServiceImpl;
import cn.iocoder.yudao.module.srm.service.supplier.SrmSupplierService;
import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -34,6 +36,9 @@
    @Resource
    private SrmSupplierService supplierService;
    @Resource
    private StorageAttachmentApi storageAttachmentApi;
    @PostMapping("/create")
    @Operation(summary = "创建资质证书")
@@ -66,6 +71,7 @@
        var pageResult = certificateService.getCertificatePage(pageReqVO);
        var respList = BeanUtils.toBean(pageResult.getList(), SrmSupplierCertificateRespVO.class);
        enrichSupplierNames(respList);
        enrichAttachments(respList);
        return success(new PageResult<>(respList, pageResult.getTotal()));
    }
@@ -75,6 +81,7 @@
    public CommonResult<List<SrmSupplierCertificateRespVO>> getListBySupplier(@RequestParam("supplierId") Long supplierId) {
        var list = BeanUtils.toBean(certificateService.getCertificateListBySupplierId(supplierId), SrmSupplierCertificateRespVO.class);
        enrichSupplierNames(list);
        enrichAttachments(list);
        return success(list);
    }
@@ -93,6 +100,7 @@
    public CommonResult<SrmSupplierCertificateRespVO> getCertificate(@RequestParam("id") Long id) {
        var resp = BeanUtils.toBean(certificateService.getCertificate(id), SrmSupplierCertificateRespVO.class);
        enrichSupplierName(resp);
        enrichAttachments(List.of(resp));
        return success(resp);
    }
@@ -118,4 +126,10 @@
        }
    }
    private void enrichAttachments(List<SrmSupplierCertificateRespVO> list) {
        if (list == null || list.isEmpty()) return;
        list.forEach(vo -> vo.setAttachmentList(storageAttachmentApi.listAttachments(
                SrmSupplierCertificateServiceImpl.CERTIFICATE_RECORD_TYPE, vo.getId())));
    }
}