From d42448aa5079914901969395f842f0a7bb4d5e9c Mon Sep 17 00:00:00 2001 From: Agoni <791536664@qq.com> Date: Thu, 24 Aug 2023 08:57:09 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=8D=95=20=E6=8A=A5?= =?UTF-8?q?=E4=BB=B7=E5=8D=95=20=20=E7=89=A9=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QuotationSheetController.java | 2 + .../vo/QuotationSheetCreateReqVO.java | 6 +- .../vo/QuotationSheetRespVO.java | 8 +++ .../vo/QuotationSheetUpdateReqVO.java | 3 + .../vo/QuotationSheetDetailBaseVO.java | 2 +- .../dal/dataobject/materiel/MaterielDO.java | 3 + .../quotationsheet/QuotationSheetDO.java | 19 ++++- .../QuotationSheetDetailDO.java | 4 +- .../quotationsheet/QuotationSheetMapper.java | 4 +- .../QuotationSheetDetailMapper.java | 4 +- .../QuotationSheetServiceImpl.java | 71 +++++++++++++++++-- 11 files changed, 111 insertions(+), 15 deletions(-) diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/QuotationSheetController.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/QuotationSheetController.java index 40b847d1..f1784a3a 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/QuotationSheetController.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/QuotationSheetController.java @@ -1,5 +1,7 @@ package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet; +import cn.iocoder.yudao.module.bs.service.suppliercompany.SupplierCompanyService; +import com.alibaba.fastjson.JSON; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java index b5f3aece..fcb5ec88 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetCreateReqVO.java @@ -13,9 +13,9 @@ import javax.validation.constraints.*; @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class QuotationSheetCreateReqVO extends QuotationSheetBaseVO { - /* @Schema(description = "物料id集合", requiredMode = Schema.RequiredMode.REQUIRED) - @NotEmpty(message = "物料id集合不能为空") - private List suppliesIdList;*/ + @Schema(description = "供应商id集合", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "供应商id集合不能为空") + private List supplierIdList; @NotEmpty(message = "物料不能为空") private List quotationDetails; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetRespVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetRespVO.java index 34038a8e..6d047a6d 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetRespVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetRespVO.java @@ -2,8 +2,12 @@ package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO; +import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO; +import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; +import org.apache.poi.ss.formula.functions.T; + import java.time.LocalDateTime; import java.util.List; @@ -19,6 +23,10 @@ public class QuotationSheetRespVO extends QuotationSheetBaseVO { @Schema(description = "创建时间") private LocalDateTime createTime; + /** + * 供应商信息 + */ + private List supplierList; private List quotationDetails; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetUpdateReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetUpdateReqVO.java index 63e8b6b6..5d7ec158 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetUpdateReqVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetUpdateReqVO.java @@ -16,6 +16,9 @@ public class QuotationSheetUpdateReqVO extends QuotationSheetBaseVO { @NotNull(message = "主键不能为空") private Long id; + @Schema(description = "供应商id集合", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "供应商id集合不能为空") + private List supplierIdList; @NotEmpty(message = "物料不能为空") private List quotationDetails; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheetdetail/vo/QuotationSheetDetailBaseVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheetdetail/vo/QuotationSheetDetailBaseVO.java index bba513b7..96b74746 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheetdetail/vo/QuotationSheetDetailBaseVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheetdetail/vo/QuotationSheetDetailBaseVO.java @@ -31,7 +31,7 @@ public class QuotationSheetDetailBaseVO { private Long companyId; @Schema(description = "规格") - private String desc; + private String getDescStr; @Schema(description = "用量") private Integer dosage; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/materiel/MaterielDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/materiel/MaterielDO.java index 8b7618a9..6c53068e 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/materiel/MaterielDO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/materiel/MaterielDO.java @@ -30,6 +30,9 @@ public class MaterielDO extends TenantBaseDO { */ @TableId private Long id; + + private Long tenantId; + /** * 状态 */ diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheet/QuotationSheetDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheet/QuotationSheetDO.java index ebbe56a1..b8442534 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheet/QuotationSheetDO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheet/QuotationSheetDO.java @@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet; import cn.iocoder.yudao.framework.common.pojo.ImageVo; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; +import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO; +import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; @@ -14,6 +16,9 @@ import java.time.LocalDateTime; import java.time.LocalDateTime; import com.baomidou.mybatisplus.annotation.*; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import org.apache.poi.ss.formula.functions.T; + +import javax.validation.constraints.NotEmpty; /** * 报价单 DO @@ -137,12 +142,22 @@ public class QuotationSheetDO extends TenantBaseDO { */ private Long applicant; /** - * 物料id集合 + * 供应商id集合 */ - private String materialIdList; + private String supplierIdAll; /** * 申请人部门id */ private Long deptId; + /** + * 供应商信息 + */ + @TableField(exist = false) + private List supplierList; + /** + * 物料信息集合 + */ + @TableField(exist = false) + private List quotationDetails; } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheetdetail/QuotationSheetDetailDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheetdetail/QuotationSheetDetailDO.java index 127e5c40..b652454b 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheetdetail/QuotationSheetDetailDO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheetdetail/QuotationSheetDetailDO.java @@ -27,6 +27,8 @@ public class QuotationSheetDetailDO extends BaseDO { */ @TableId private Long id; + + private Long tenantId; /** * 状态 */ @@ -50,7 +52,7 @@ public class QuotationSheetDetailDO extends BaseDO { /** * 规格 */ - private String desc; + private String descStr; /** * 用量 */ diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/quotationsheet/QuotationSheetMapper.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/quotationsheet/QuotationSheetMapper.java index 1fd4d478..d6825456 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/quotationsheet/QuotationSheetMapper.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/quotationsheet/QuotationSheetMapper.java @@ -45,7 +45,7 @@ public interface QuotationSheetMapper extends BaseMapperX { .eqIfPresent(QuotationSheetDO::getPurchaseContent, reqVO.getPurchaseContent()) .betweenIfPresent(QuotationSheetDO::getApplyTime, reqVO.getApplyTime()) .eqIfPresent(QuotationSheetDO::getApplicant, reqVO.getApplicant()) - .eqIfPresent(QuotationSheetDO::getMaterialIdList, reqVO.getMaterialIdList()) + .eqIfPresent(QuotationSheetDO::getSupplierIdAll, reqVO.getMaterialIdList()) .eqIfPresent(QuotationSheetDO::getDeptId, reqVO.getDeptId()) .orderByDesc(QuotationSheetDO::getId)); } @@ -78,7 +78,7 @@ public interface QuotationSheetMapper extends BaseMapperX { .eqIfPresent(QuotationSheetDO::getPurchaseContent, reqVO.getPurchaseContent()) .betweenIfPresent(QuotationSheetDO::getApplyTime, reqVO.getApplyTime()) .eqIfPresent(QuotationSheetDO::getApplicant, reqVO.getApplicant()) - .eqIfPresent(QuotationSheetDO::getMaterialIdList, reqVO.getMaterialIdList()) + .eqIfPresent(QuotationSheetDO::getSupplierIdAll, reqVO.getMaterialIdList()) .eqIfPresent(QuotationSheetDO::getDeptId, reqVO.getDeptId()) .orderByDesc(QuotationSheetDO::getId)); } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/quotationsheetdetail/QuotationSheetDetailMapper.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/quotationsheetdetail/QuotationSheetDetailMapper.java index 3dd2949a..81df029e 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/quotationsheetdetail/QuotationSheetDetailMapper.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/mysql/quotationsheetdetail/QuotationSheetDetailMapper.java @@ -25,7 +25,7 @@ public interface QuotationSheetDetailMapper extends BaseMapperX 0){ //中间表插入数据 @@ -63,6 +73,7 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl 0){ //中间表插入数据 @@ -89,22 +100,74 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl quotationSheetDetailDOList = quotationSheetDetailService.list(new QueryWrapper().eq("company_id", id)); + if (null==quotationSheetDetailDOList){ + quotationSheetDetailDOList = new ArrayList<>(); + } + quotationSheetDO.setSupplierList(supplierCompanyService.listByIds(JSON.parseArray(quotationSheetDO.getSupplierIdAll(),Long.class))); + quotationSheetDO.setQuotationDetails(quotationSheetDetailDOList); + return quotationSheetDO; } @Override public List getQuotationSheetList(Collection ids) { - return quotationSheetMapper.selectBatchIds(ids); + List quotationSheetDOList = quotationSheetMapper.selectBatchIds(ids); + if (null!=quotationSheetDOList){ + quotationSheetDOList.forEach(a->{ + List quotationSheetDetailDOList = quotationSheetDetailService.list(new QueryWrapper().eq("company_id", a.getId())); + if (null==quotationSheetDetailDOList){ + quotationSheetDetailDOList = new ArrayList<>(); + } + a.setSupplierList(supplierCompanyService.listByIds(JSON.parseArray(a.getSupplierIdAll(),Long.class))); + a.setQuotationDetails(quotationSheetDetailDOList); + }); + } + return quotationSheetDOList; } @Override public PageResult getQuotationSheetPage(QuotationSheetPageReqVO pageReqVO) { - return quotationSheetMapper.selectPage(pageReqVO); + PageResult sheetDOPageResult = quotationSheetMapper.selectPage(pageReqVO); + if (sheetDOPageResult.getList()!=null){ + sheetDOPageResult.getList().forEach(a->{ + List quotationSheetDetailDOList = quotationSheetDetailService.list(new QueryWrapper().eq("company_id", a.getId())); + if (null==quotationSheetDetailDOList){ + quotationSheetDetailDOList = new ArrayList<>(); + } + a.setSupplierList(supplierCompanyService.listByIds(JSON.parseArray(a.getSupplierIdAll(),Long.class))); + a.setQuotationDetails(quotationSheetDetailDOList); + }); + } + return sheetDOPageResult; } @Override public List getQuotationSheetList(QuotationSheetExportReqVO exportReqVO) { - return quotationSheetMapper.selectList(exportReqVO); + List quotationSheetDOList = quotationSheetMapper.selectList(exportReqVO); + + if (quotationSheetDOList!=null){ + List quotationSheetDetailDOList = quotationSheetDetailService.list(new QueryWrapper().eq("tenantId", quotationSheetDOList.get(0).getTenantId())); + Map> sheetDetailMap =new HashMap<>(3); + if (null!=quotationSheetDetailDOList){ + sheetDetailMap = quotationSheetDetailDOList.stream().collect(Collectors.groupingBy(QuotationSheetDetailDO::getCompanyId)); + } + Map> finalSheetDetailMap = sheetDetailMap; + quotationSheetDOList.forEach(a->{ + if (finalSheetDetailMap.size()>0){ + List quotationSheetDetailDOS = finalSheetDetailMap.get(a.getId()); + if (null==quotationSheetDetailDOS){ + quotationSheetDetailDOS=new ArrayList<>(); + } + a.setQuotationDetails(quotationSheetDetailDOS); + }else { + a.setQuotationDetails(new ArrayList<>()); + } + a.setSupplierList(supplierCompanyService.listByIds(JSON.parseArray(a.getSupplierIdAll(),Long.class))); + a.setQuotationDetails(quotationSheetDetailDOList); + }); + } + return quotationSheetDOList; } }