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 f1784a3a..af417f82 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,6 @@ package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet; +import cn.iocoder.yudao.module.bs.service.materiel.MaterielService; import cn.iocoder.yudao.module.bs.service.suppliercompany.SupplierCompanyService; import com.alibaba.fastjson.JSON; import org.springframework.web.bind.annotation.*; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetBaseVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetBaseVO.java index ba637daa..364ef3e9 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetBaseVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetBaseVO.java @@ -98,9 +98,6 @@ public class QuotationSheetBaseVO { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime applyTime; - @Schema(description = "物料id集合") - private String materialIdList; - @Schema(description = "申请人") private Long applicant; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetExcelVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetExcelVO.java index 5f07a18e..8938b617 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetExcelVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetExcelVO.java @@ -102,9 +102,6 @@ public class QuotationSheetExcelVO { @ExcelProperty("申请人") private Long applicant; - @ExcelProperty("物料id集合") - private String materialIdList; - @ExcelProperty("申请人部门id") private Long deptId; diff --git a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetExportReqVO.java b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetExportReqVO.java index 2deac845..949f9b87 100644 --- a/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetExportReqVO.java +++ b/yudao-module-bs/yudao-module-bs-biz/src/main/java/cn/iocoder/yudao/module/bs/controller/admin/quotationsheet/vo/QuotationSheetExportReqVO.java @@ -97,9 +97,6 @@ public class QuotationSheetExportReqVO { @Schema(description = "申请人") private Long applicant; - @Schema(description = "物料id集合") - private String materialIdList; - @Schema(description = "申请人部门id", example = "10907") private Long deptId; 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 543e5ac0..c1c9cffb 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 @@ -99,8 +99,8 @@ public class QuotationSheetPageReqVO extends PageParam { @Schema(description = "申请人") private Long applicant; - @Schema(description = "物料id集合") - private String materialIdList; + @Schema(description = "供应商id") + private String supplierCompanyId; @Schema(description = "申请人部门id", example = "10907") private Long deptId; 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 6d047a6d..276438ba 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 @@ -28,6 +28,8 @@ public class QuotationSheetRespVO extends QuotationSheetBaseVO { */ private List supplierList; + private String supplierNameList; + private List quotationDetails; } 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 b8442534..ff3c9397 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 @@ -155,6 +155,9 @@ public class QuotationSheetDO extends TenantBaseDO { */ @TableField(exist = false) private List supplierList; + + @TableField(exist = false) + private String supplierNameList; /** * 物料信息集合 */ 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 b652454b..8cb57b72 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 @@ -1,5 +1,7 @@ package cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail; +import cn.iocoder.yudao.framework.common.pojo.ImageVo; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import lombok.*; import java.util.*; import java.time.LocalDateTime; @@ -66,4 +68,23 @@ public class QuotationSheetDetailDO extends BaseDO { */ private String quality; + private String extend; + + /** + * 物料编码 + */ + @TableField(exist = false) + private String materielCode; + /** + * 物料名称 + */ + @TableField(exist = false) + private String materielName; + + /** + * 附件 + */ + @TableField(typeHandler = JacksonTypeHandler.class) + private List files; + } 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 d6825456..1c543b10 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::getSupplierIdAll, reqVO.getMaterialIdList()) + .likeIfPresent(QuotationSheetDO::getSupplierIdAll,reqVO.getSupplierCompanyId()) .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::getSupplierIdAll, reqVO.getMaterialIdList()) +// .likeIfPresent(QuotationSheetDO::getSupplierIdAll, reqVO.getSupplierCompanyId()) .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/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 7982da43..55273f87 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 @@ -1,9 +1,13 @@ 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.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO; +import cn.iocoder.yudao.module.bs.dal.dataobject.materiel.MaterielDO; 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.quotationsheetdetail.QuotationSheetDetailService; import cn.iocoder.yudao.module.bs.service.quotationsheetdetail.QuotationSheetDetailServiceImpl; import cn.iocoder.yudao.module.bs.service.suppliercompany.SupplierCompanyService; @@ -17,6 +21,8 @@ import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo.*; @@ -47,11 +53,15 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl 0){ //中间表插入数据 @@ -105,6 +115,22 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl(); } + if (quotationSheetDetailDOList.size()>0){ + List materielDOList = materielService.listByIds(quotationSheetDetailDOList.stream().map(QuotationSheetDetailDO::getMaterialId).collect(Collectors.toList())); + if (null!=materielDOList){ + Map map= materielDOList.stream().collect(Collectors.toMap(MaterielDO::getId, x ->x)); + quotationSheetDetailDOList.forEach(a->{ + MaterielDO materielDO = map.get(a.getMaterialId()); + if (null!=materielDO){ + a.setMaterielCode(materielDO.getMaterielCode()); + a.setMaterielName(materielDO.getMaterielName()); + } + }); + } + + } + + quotationSheetDO.setSupplierList(supplierCompanyService.listByIds(JSON.parseArray(quotationSheetDO.getSupplierIdAll(),Long.class))); quotationSheetDO.setQuotationDetails(quotationSheetDetailDOList); return quotationSheetDO; @@ -119,6 +145,17 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl(); } + if (quotationSheetDetailDOList.size()>0){ + List materielDOList = materielService.listByIds(quotationSheetDetailDOList.stream().map(QuotationSheetDetailDO::getMaterialId).collect(Collectors.toList())); + Map map= materielDOList.stream().collect(Collectors.toMap(MaterielDO::getId, x ->x)); + quotationSheetDetailDOList.forEach(q->{ + MaterielDO materielDO = map.get(q.getMaterialId()); + if (null!=materielDO){ + q.setMaterielCode(materielDO.getMaterielCode()); + q.setMaterielName(materielDO.getMaterielName()); + } + }); + } a.setSupplierList(supplierCompanyService.listByIds(JSON.parseArray(a.getSupplierIdAll(),Long.class))); a.setQuotationDetails(quotationSheetDetailDOList); }); @@ -129,13 +166,35 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl getQuotationSheetPage(QuotationSheetPageReqVO pageReqVO) { PageResult sheetDOPageResult = quotationSheetMapper.selectPage(pageReqVO); - if (sheetDOPageResult.getList()!=null){ + if (sheetDOPageResult.getList()!=null&&sheetDOPageResult.getList().size()>0){ + List materielDOList = materielService.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 finalMap = map; 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))); + 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); + } + a.setSupplierList(supplierCompanyDOList); a.setQuotationDetails(quotationSheetDetailDOList); }); } @@ -146,12 +205,18 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl getQuotationSheetList(QuotationSheetExportReqVO exportReqVO) { List quotationSheetDOList = quotationSheetMapper.selectList(exportReqVO); - if (quotationSheetDOList!=null){ + if (quotationSheetDOList!=null&"ationSheetDOList.size()>0){ 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)); } + List materielDOList = materielService.list(new QueryWrapper().eq("tenant_id",quotationSheetDOList.get(0).getTenantId())); + Map map=new HashMap<>(2); + if (null!=materielDOList){ + map= materielDOList.stream().collect(Collectors.toMap(MaterielDO::getId, x ->x)); + } + Map finalMap = map; Map> finalSheetDetailMap = sheetDetailMap; quotationSheetDOList.forEach(a->{ if (finalSheetDetailMap.size()>0){ @@ -159,6 +224,17 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl(); } + if (quotationSheetDetailDOS.size()>0){ + quotationSheetDetailDOS.forEach(q->{ + if (finalMap.size()>0){ + MaterielDO materielDO = finalMap.get(q.getMaterialId()); + if (null!=materielDO){ + q.setMaterielCode(materielDO.getMaterielCode()); + q.setMaterielName(materielDO.getMaterielName()); + } + } + }); + } a.setQuotationDetails(quotationSheetDetailDOS); }else { a.setQuotationDetails(new ArrayList<>()); @@ -170,4 +246,30 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl().like("number", companyNumber).orderByDesc("create_time").last("limit 1")); + if (null!=supplierCompanyDO){ + Long aLong = numKun(supplierCompanyDO.getNumber()); + companyNumber ="bjd"+(aLong+1); + }else { + companyNumber=companyNumber+"0000"; + long l = numKun(companyNumber) + 1; + companyNumber ="bjd"+(numKun(companyNumber) + 1); + } + return companyNumber; + } + public Long numKun(String a){ + String regEx = "[^0-9]"; + Pattern p = Pattern.compile(regEx); + Matcher m = p.matcher(a); + String result = m.replaceAll("").trim(); + return Long.valueOf(result); + } }