From c5f1d8e03f85b998481d57e328c3563d2d05388d Mon Sep 17 00:00:00 2001 From: Agoni <791536664@qq.com> Date: Sun, 27 Aug 2023 13:52:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E4=BB=B7=E5=8D=95=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QuotationSheetController.java | 17 ++++ .../vo/QuotationSheetPageReqVO.java | 6 ++ .../vo/QuotationSheetRespVO.java | 17 ++++ .../vo/QuotationSheetBiddingBaseVO.java | 8 ++ .../vo/QuotationSheetBiddingExcelVO.java | 5 + .../vo/QuotationSheetBiddingPageReqVO.java | 6 ++ .../quotationsheet/QuotationSheetDO.java | 20 ++++ .../QuotationSheetBiddingDO.java | 4 + .../quotationsheet/QuotationSheetMapper.java | 1 + .../quotationsheet/QuotationSheetService.java | 13 +++ .../QuotationSheetServiceImpl.java | 91 ++++++++++++++++++- 11 files changed, 187 insertions(+), 1 deletion(-) 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 af417f82..854da082 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 @@ -102,4 +102,21 @@ public class QuotationSheetController { ExcelUtils.write(response, "报价单.xls", "数据", QuotationSheetExcelVO.class, datas); } + + @GetMapping("/pageBidding") + @Operation(summary = "报价单中标管理列表接口") + @PreAuthorize("@ss.hasPermission('bs:quotation-sheet:query')") + public CommonResult> pageBidding(@Valid QuotationSheetPageReqVO pageVO) { + PageResult pageResult = quotationSheetService.getQuotationSheetPageBidding(pageVO); + return success(QuotationSheetConvert.INSTANCE.convertPage(pageResult)); + } + + + @PostMapping("/approvalBidding") + @Operation(summary = "中标审批发起接口") + @PreAuthorize("@ss.hasPermission('bs:quotation-sheet:approvalBidding')") + public CommonResult approvalBidding(@Valid QuotationSheetPageReqVO pageVO) { + return success(quotationSheetService.approvalBidding(pageVO)); + } + } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetPageReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetPageReqVO.java index c1c9cffb..3e6aaf77 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetPageReqVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetPageReqVO.java @@ -102,7 +102,13 @@ public class QuotationSheetPageReqVO extends PageParam { @Schema(description = "供应商id") private String supplierCompanyId; + @Schema(description = "供应商中标id") + private String supplierBiddingId; + @Schema(description = "申请人部门id", example = "10907") private Long deptId; + @Schema(description = "供应商中标id集合发起审批的时候添加此参数") + private List approvalBiddingIdList; + } 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 276438ba..8b38abcd 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 @@ -1,6 +1,7 @@ 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.quotationsheetbidding.QuotationSheetBiddingDO; 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; @@ -31,5 +32,21 @@ public class QuotationSheetRespVO extends QuotationSheetBaseVO { private String supplierNameList; private List quotationDetails; + /** + * 供应商竞标集合 + */ + @Schema(description = "供应商竞标集合") + private List quotationSheetBiddingDOList; + + @Schema(description = "是否中标") + private Integer isWin; + + /** + * 供应商中标id + */ + @Schema(description = "供应商中标id") + private String supplierBiddingId; + @Schema(description = "中标供应商名称") + private String biddingSupplierName; } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheetbidding/vo/QuotationSheetBiddingBaseVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheetbidding/vo/QuotationSheetBiddingBaseVO.java index 09bec0e8..f70c9baf 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheetbidding/vo/QuotationSheetBiddingBaseVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheetbidding/vo/QuotationSheetBiddingBaseVO.java @@ -29,18 +29,22 @@ public class QuotationSheetBiddingBaseVO { private String remark; @Schema(description = "物料明细", example = "27461") + @NotNull(message = "物料明细不能为空") private Long quotationDetailId; @Schema(description = "物料编码") + @NotBlank(message = "物料编码不能为空") private String materialCode; @Schema(description = "物料id", example = "18066") private Long materialId; @Schema(description = "物料名称", example = "芋艿") + @NotBlank(message = "物料名称不能为空") private String materialName; @Schema(description = "供应商id", example = "2920") + @NotNull(message = "供应商不能为空") private Long companyId; @Schema(description = "供应商名称", example = "李四") @@ -65,4 +69,8 @@ public class QuotationSheetBiddingBaseVO { @Schema(description = "流程实例的编号", example = "1130") private Long processInstanceId; + @Schema(description = "报价单id", example = "2") + @NotNull(message = "报价单不能为空") + private Long quotationId; + } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheetbidding/vo/QuotationSheetBiddingExcelVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheetbidding/vo/QuotationSheetBiddingExcelVO.java index e7f48f2f..984e7b59 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheetbidding/vo/QuotationSheetBiddingExcelVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheetbidding/vo/QuotationSheetBiddingExcelVO.java @@ -65,6 +65,11 @@ public class QuotationSheetBiddingExcelVO { @Schema(description = "附件", requiredMode = Schema.RequiredMode.REQUIRED) private List files; + /** + * 报价单id + */ + private Long quotationId; + @ExcelProperty("流程实例的编号") private Long processInstanceId; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheetbidding/vo/QuotationSheetBiddingPageReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheetbidding/vo/QuotationSheetBiddingPageReqVO.java index 6dc280ac..450fda15 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheetbidding/vo/QuotationSheetBiddingPageReqVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheetbidding/vo/QuotationSheetBiddingPageReqVO.java @@ -65,4 +65,10 @@ public class QuotationSheetBiddingPageReqVO extends PageParam { @Schema(description = "流程实例的编号", example = "1130") private Long processInstanceId; + /** + * 报价单id + */ + @Schema(description = "报价单id") + private Long quotationId; + } 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 ff3c9397..9cfa2644 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,7 @@ 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.quotationsheetbidding.QuotationSheetBiddingDO; 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; @@ -163,4 +164,23 @@ public class QuotationSheetDO extends TenantBaseDO { */ @TableField(exist = false) private List quotationDetails; + + @TableField(exist = false) + private Integer isWin; + /** + * 供应商中标id + */ + private String supplierBiddingId; + + /** + * 中标供应商名称 + */ + @TableField(exist = false) + private String biddingSupplierName; + + /** + * 物料信息集合 + */ + @TableField(exist = false) + private List quotationSheetBiddingDOList; } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheetbidding/QuotationSheetBiddingDO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheetbidding/QuotationSheetBiddingDO.java index edc5144e..69379f1d 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheetbidding/QuotationSheetBiddingDO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/dal/dataobject/quotationsheetbidding/QuotationSheetBiddingDO.java @@ -90,5 +90,9 @@ public class QuotationSheetBiddingDO extends BaseDO { * 流程实例的编号 */ private Long processInstanceId; + /** + * 报价单id + */ + private Long quotationId; } 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 1c543b10..2fdcfd4d 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 @@ -47,6 +47,7 @@ public interface QuotationSheetMapper extends BaseMapperX { .eqIfPresent(QuotationSheetDO::getApplicant, reqVO.getApplicant()) .likeIfPresent(QuotationSheetDO::getSupplierIdAll,reqVO.getSupplierCompanyId()) .eqIfPresent(QuotationSheetDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(QuotationSheetDO::getSupplierBiddingId, reqVO.getSupplierBiddingId()) .orderByDesc(QuotationSheetDO::getId)); } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetService.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetService.java index 61278779..0d52d5aa 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetService.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetService.java @@ -73,4 +73,17 @@ public interface QuotationSheetService extends MPJBaseService */ List getQuotationSheetList(QuotationSheetExportReqVO exportReqVO); + /** + * 报价单中标列表 + * @param pageVO + * @return + */ + PageResult getQuotationSheetPageBidding(QuotationSheetPageReqVO pageVO); + + /** + * 报价单中标发起审批 + * @param pageVO + * @return + */ + String approvalBidding(QuotationSheetPageReqVO pageVO); } diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetServiceImpl.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetServiceImpl.java index 55273f87..51139320 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetServiceImpl.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/service/quotationsheet/QuotationSheetServiceImpl.java @@ -3,14 +3,20 @@ package cn.iocoder.yudao.module.bs.service.quotationsheet; import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; +import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO; import cn.iocoder.yudao.module.bs.dal.dataobject.materiel.MaterielDO; +import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetbidding.QuotationSheetBiddingDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO; import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO; import cn.iocoder.yudao.module.bs.service.materiel.MaterielService; +import cn.iocoder.yudao.module.bs.service.quotationsheetbidding.QuotationSheetBiddingService; import cn.iocoder.yudao.module.bs.service.quotationsheetdetail.QuotationSheetDetailService; import cn.iocoder.yudao.module.bs.service.quotationsheetdetail.QuotationSheetDetailServiceImpl; import cn.iocoder.yudao.module.bs.service.suppliercompany.SupplierCompanyService; +import cn.iocoder.yudao.module.system.api.dept.DeptApi; +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -33,6 +39,7 @@ import cn.iocoder.yudao.module.bs.convert.quotationsheet.QuotationSheetConvert; import cn.iocoder.yudao.module.bs.dal.mysql.quotationsheet.QuotationSheetMapper; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser; import static cn.iocoder.yudao.module.bs.enums.ErrorCodeConstants.*; /** @@ -56,12 +63,25 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl 0){ //中间表插入数据 @@ -79,7 +99,7 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl lambdaQuery() + quotationSheetDetailService.remove(Wrappers. lambdaQuery() .eq(QuotationSheetDetailDO::getCompanyId,updateReqVO.getId()).eq(BaseDO::getDeleted,0)); // 更新 QuotationSheetDO updateObj = QuotationSheetConvert.INSTANCE.convert(updateReqVO); @@ -88,6 +108,7 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl 0){ //中间表插入数据 updateReqVO.getQuotationDetails().forEach(quotationSheetDetail -> { + quotationSheetDetail.setId(null); quotationSheetDetail.setCompanyId(updateObj.getId()); }); quotationSheetDetailService.saveBatch(updateReqVO.getQuotationDetails()); @@ -246,6 +267,74 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl getQuotationSheetPageBidding(QuotationSheetPageReqVO pageVO) { + PageResult sheetDOPageResult = quotationSheetMapper.selectPage(pageVO); + if (sheetDOPageResult.getList()!=null&&sheetDOPageResult.getList().size()>0){ + List materielDOList = materielService.list(new QueryWrapper().eq("tenant_id",sheetDOPageResult.getList().get(0).getTenantId())); + List quotationSheetBiddingDOList = quotationSheetBiddingService.list(new QueryWrapper().eq("tenant_id", sheetDOPageResult.getList().get(0).getTenantId())); + Map map=new HashMap<>(2); + if (null!=materielDOList){ + map= materielDOList.stream().collect(Collectors.toMap(MaterielDO::getId, x ->x)); + } + Map> biddingMap=new HashMap<>(2); + if (null!=quotationSheetBiddingDOList&"ationSheetBiddingDOList.size()>0){ + biddingMap= quotationSheetBiddingDOList.stream().collect(Collectors.groupingBy(QuotationSheetBiddingDO::getQuotationId)); + } + Map finalMap = map; + Map> finalBiddingMap = biddingMap; + sheetDOPageResult.getList().forEach(a->{ + List quotationSheetDetailDOList = quotationSheetDetailService.list(new QueryWrapper().eq("company_id", a.getId())); + if (null==quotationSheetDetailDOList){ + quotationSheetDetailDOList = new ArrayList<>(); + } + if (finalBiddingMap.size()>0){ + List sheetBiddingDOList = finalBiddingMap.get(a.getId()); + if (null!=sheetBiddingDOList){ + a.setQuotationSheetBiddingDOList(sheetBiddingDOList); + }else { + a.setQuotationSheetBiddingDOList(new ArrayList<>()); + } + }else { + a.setQuotationSheetBiddingDOList(new ArrayList<>()); + } + if (quotationSheetDetailDOList.size()>0){ + quotationSheetDetailDOList.forEach(q->{ + if (finalMap.size()>0){ + MaterielDO materielDO = finalMap.get(q.getMaterialId()); + if (null!=materielDO){ + q.setMaterielCode(materielDO.getMaterielCode()); + q.setMaterielName(materielDO.getMaterielName()); + } + } + }); + } + List supplierCompanyDOList = supplierCompanyService.listByIds(JSON.parseArray(a.getSupplierIdAll(), Long.class)); + if (null!=supplierCompanyDOList){ + String collect = supplierCompanyDOList.stream().map(SupplierCompanyDO::getCompanyAme).collect(Collectors.toList()).stream().collect(Collectors.joining(",")); + a.setSupplierNameList(collect); + } + if (null!=a.getSupplierBiddingId()&&!"".equals(a.getSupplierBiddingId())){ + List supplierCompanyDO = supplierCompanyService.listByIds(JSON.parseArray(a.getSupplierBiddingId(), Long.class)); + if (null!=supplierCompanyDO){ + a.setBiddingSupplierName(supplierCompanyDO.stream().map(SupplierCompanyDO::getCompanyAme).collect(Collectors.toList()).stream().collect(Collectors.joining(","))); + } + a.setIsWin(1); + }else { + a.setIsWin(2); + } + a.setSupplierList(supplierCompanyDOList); + a.setQuotationDetails(quotationSheetDetailDOList); + }); + } + return sheetDOPageResult; + } + + @Override + public String approvalBidding(QuotationSheetPageReqVO pageVO) { + return null; + } + /** * 编号生成方法 * @return