|
@@ -11,7 +11,6 @@ import com.fjhx.area.utils.CustomizeAreaUtil;
|
|
|
import com.fjhx.common.enums.FlowStatusEnum1;
|
|
|
import com.fjhx.common.utils.Assert;
|
|
|
import com.fjhx.common.utils.Utils;
|
|
|
-import com.fjhx.customer.entity.customer.po.Customer;
|
|
|
import com.fjhx.customer.service.customer.CustomerService;
|
|
|
import com.fjhx.item.service.product.ProductInfoService;
|
|
|
import com.fjhx.sale.entity.ext.dto.ExtQuotationDto;
|
|
@@ -151,58 +150,61 @@ public class ExtQuotationServiceImpl extends ServiceImpl<ExtQuotationMapper, Ext
|
|
|
if (ObjectUtil.isEmpty(result)) {
|
|
|
throw new ServiceException("查询不到明细信息请检查");
|
|
|
}
|
|
|
-
|
|
|
- Customer customer = customerService.getById(result.getBuyCorporationId());
|
|
|
- if (ObjectUtil.isNotEmpty(customer)) {
|
|
|
- result.setBuyCorporationName(customer.getName());
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- setArea(result);
|
|
|
-
|
|
|
- List<ExtQuotationProduct> quotationProductList = extQuotationProductService.list(Wrappers.<ExtQuotationProduct>lambdaQuery()
|
|
|
- .eq(ExtQuotationProduct::getSaleQuotationId, result.getId()));
|
|
|
|
|
|
- List<ExtQuotationProductVo> quotationProductVos = BeanUtil.copyToList(quotationProductList, ExtQuotationProductVo.class);
|
|
|
-
|
|
|
- productInfoService.attributeAssign(quotationProductVos, ExtQuotationProductVo::getProductId, (item, productInfo) -> {
|
|
|
- item.setProductCode(productInfo.getCustomCode());
|
|
|
- item.setProductName(productInfo.getName());
|
|
|
- item.setProductLength(productInfo.getLength());
|
|
|
- item.setProductWidth(productInfo.getWidth());
|
|
|
- item.setProductHeight(productInfo.getHeight());
|
|
|
- item.setProductProdImgPath(productInfo.getProdImgPath());
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- List<Long> ids = quotationProductVos.stream().map(ExtQuotationProduct::getId).collect(Collectors.toList());
|
|
|
- List<ExtQuotationProductBom> list = extQuotationProductBomService.list(q -> q.in(ExtQuotationProductBom::getQuotationProductId, ids));
|
|
|
- List<ExtQuotationProductBomVo> quotationProductBomVos = BeanUtil.copyToList(list, ExtQuotationProductBomVo.class);
|
|
|
-
|
|
|
- productInfoService.attributeAssign(quotationProductBomVos, ExtQuotationProductBom::getProductId, (item, productInfo) -> {
|
|
|
- item.setProductCode(productInfo.getCustomCode());
|
|
|
- item.setProductName(productInfo.getName());
|
|
|
- item.setProductLength(productInfo.getLength());
|
|
|
- item.setProductWidth(productInfo.getWidth());
|
|
|
- item.setProductHeight(productInfo.getHeight());
|
|
|
- });
|
|
|
-
|
|
|
- Map<Long, List<ExtQuotationProductBomVo>> qpbMap = quotationProductBomVos.stream().collect(Collectors.groupingBy(ExtQuotationProductBom::getQuotationProductId));
|
|
|
-
|
|
|
- for (ExtQuotationProductVo quotationProductVo : quotationProductVos) {
|
|
|
- quotationProductVo.setQuotationProductBomList(qpbMap.get(quotationProductVo.getId()));
|
|
|
- }
|
|
|
- result.setQuotationProductList(quotationProductVos);
|
|
|
-
|
|
|
-
|
|
|
- List<ExtQuotation> quotationTrendList = this.list(q -> q
|
|
|
- .eq(ExtQuotation::getGroupId, result.getGroupId())
|
|
|
- .ne(ExtQuotation::getStatus, FlowStatusEnum1.CANCELLATION.getKey())
|
|
|
- .orderByAsc(ExtQuotation::getCreateTime)
|
|
|
- );
|
|
|
- result.setQuotationTrendList(quotationTrendList);
|
|
|
-
|
|
|
- return result;
|
|
|
+ return setDetailInfo(Arrays.asList(result)).get(0);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -333,4 +335,100 @@ public class ExtQuotationServiceImpl extends ServiceImpl<ExtQuotationMapper, Ext
|
|
|
extQuotationProductService.editLinked(quotationProducts, ExtQuotationProduct::getSaleQuotationId, saleQuotationDto.getId());
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * 获取报价单历史版本
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<ExtQuotationVo> getVersionList(Long extQuotationId) {
|
|
|
+ ExtQuotation extQuotation = this.getById(extQuotationId);
|
|
|
+ Assert.notEmpty(extQuotation, "查询不到报价单信息!");
|
|
|
+ Long groupId = extQuotation.getGroupId();
|
|
|
+ List<ExtQuotation> extQuotationList = this.list(q -> q.eq(ExtQuotation::getGroupId, groupId).orderByDesc(ExtQuotation::getCreateTime));
|
|
|
+ List<ExtQuotationVo> extQuotationVos = BeanUtil.copyToList(extQuotationList, ExtQuotationVo.class);
|
|
|
+ return setDetailInfo(extQuotationVos);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 赋值明细信息
|
|
|
+ */
|
|
|
+ private List<ExtQuotationVo> setDetailInfo(List<ExtQuotationVo> extQuotationVos) {
|
|
|
+ Long groupId = extQuotationVos.get(0).getGroupId();
|
|
|
+
|
|
|
+
|
|
|
+ List<Long> ids = extQuotationVos.stream().map(ExtQuotation::getId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ List<ExtQuotationProduct> productList = extQuotationProductService.list(q -> q.in(ExtQuotationProduct::getSaleQuotationId, ids));
|
|
|
+ List<ExtQuotationProductVo> quotationProductVos = BeanUtil.copyToList(productList, ExtQuotationProductVo.class);
|
|
|
+ Map<Long, List<ExtQuotationProductVo>> productMap = quotationProductVos.stream().collect(Collectors.groupingBy(ExtQuotationProductVo::getSaleQuotationId));
|
|
|
+
|
|
|
+ productInfoService.attributeAssign(quotationProductVos, ExtQuotationProductVo::getProductId, (item, productInfo) -> {
|
|
|
+ item.setProductCode(productInfo.getCustomCode());
|
|
|
+ item.setProductName(productInfo.getName());
|
|
|
+ item.setProductLength(productInfo.getLength());
|
|
|
+ item.setProductWidth(productInfo.getWidth());
|
|
|
+ item.setProductHeight(productInfo.getHeight());
|
|
|
+ });
|
|
|
+
|
|
|
+ List<Long> qpIds = productList.stream().map(ExtQuotationProduct::getId).collect(Collectors.toList());
|
|
|
+ Map<Long, List<ExtQuotationProductBomVo>> qpbMap = new HashMap<>();
|
|
|
+ if (ObjectUtil.isNotEmpty(qpIds)) {
|
|
|
+ List<ExtQuotationProductBom> bomList = extQuotationProductBomService.list(q -> q.in(ExtQuotationProductBom::getQuotationProductId, qpIds));
|
|
|
+ List<ExtQuotationProductBomVo> quotationProductBomVos = BeanUtil.copyToList(bomList, ExtQuotationProductBomVo.class);
|
|
|
+
|
|
|
+ productInfoService.attributeAssign(quotationProductBomVos, ExtQuotationProductBom::getMaterialId, (item, productInfo) -> {
|
|
|
+ item.setProductCode(productInfo.getCustomCode());
|
|
|
+ item.setProductName(productInfo.getName());
|
|
|
+ item.setProductLength(productInfo.getLength());
|
|
|
+ item.setProductWidth(productInfo.getWidth());
|
|
|
+ item.setProductHeight(productInfo.getHeight());
|
|
|
+ });
|
|
|
+ qpbMap = quotationProductBomVos.stream().collect(Collectors.groupingBy(ExtQuotationProductBom::getQuotationProductId));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ customerService.attributeAssign(extQuotationVos, ExtQuotation::getBuyCorporationId, (item, customer) -> {
|
|
|
+ item.setBuyCorporationName(customer.getName());
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ List<Long> areaIdList = new ArrayList<>();
|
|
|
+ for (ExtQuotation quotation : extQuotationVos) {
|
|
|
+ areaIdList.add(quotation.getBuyCountryId());
|
|
|
+ areaIdList.add(quotation.getBuyProvinceId());
|
|
|
+ areaIdList.add(quotation.getBuyCityId());
|
|
|
+ }
|
|
|
+ areaIdList = areaIdList.stream().distinct().collect(Collectors.toList());
|
|
|
+ Map<Long, String> areaMap = CustomizeAreaUtil.getAreaMapByIds(areaIdList);
|
|
|
+
|
|
|
+
|
|
|
+ List<ExtQuotation> quotationTrendList = this.list(q -> q
|
|
|
+ .eq(ExtQuotation::getGroupId, groupId)
|
|
|
+ .ne(ExtQuotation::getStatus, FlowStatusEnum1.CANCELLATION.getKey())
|
|
|
+ .orderByAsc(ExtQuotation::getCreateTime)
|
|
|
+ );
|
|
|
+
|
|
|
+
|
|
|
+ for (ExtQuotationVo quotation : extQuotationVos) {
|
|
|
+
|
|
|
+ quotation.setBuyCountryName(areaMap.get(quotation.getBuyCountryId()));
|
|
|
+ quotation.setBuyProvinceName(areaMap.get(quotation.getBuyProvinceId()));
|
|
|
+ quotation.setBuyCityName(areaMap.get(quotation.getBuyCityId()));
|
|
|
+ quotation.setBuyDetailedAddress(quotation.getBuyAddress());
|
|
|
+
|
|
|
+
|
|
|
+ List<ExtQuotationProductVo> quotationProductVos1 = productMap.getOrDefault(quotation.getId(), new ArrayList<>());
|
|
|
+ for (ExtQuotationProductVo quotationProductVo : quotationProductVos1) {
|
|
|
+
|
|
|
+ quotationProductVo.setQuotationProductBomList(qpbMap.get(quotationProductVo.getId()));
|
|
|
+ }
|
|
|
+ quotation.setQuotationProductList(quotationProductVos1);
|
|
|
+
|
|
|
+
|
|
|
+ quotation.setQuotationTrendList(quotationTrendList);
|
|
|
+ }
|
|
|
+
|
|
|
+ return extQuotationVos;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|