| | |
| | | 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; |
| | |
| | | |
| | | @Resource |
| | | private SrmSupplierService supplierService; |
| | | |
| | | @Resource |
| | | private StorageAttachmentApi storageAttachmentApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "创建资质证书") |
| | |
| | | var pageResult = certificateService.getCertificatePage(pageReqVO); |
| | | var respList = BeanUtils.toBean(pageResult.getList(), SrmSupplierCertificateRespVO.class); |
| | | enrichSupplierNames(respList); |
| | | enrichAttachments(respList); |
| | | return success(new PageResult<>(respList, pageResult.getTotal())); |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | 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()))); |
| | | } |
| | | |
| | | } |