Prechádzať zdrojové kódy

refactor(product): 重构产品模块中的价格字段和分类查询功能

- 将estimatedPurchasePrice字段重命名为maxPurchasePrice
- 在ProductCategoryService中添加platform参数支持
- 修复ProductBaseServiceImpl中的促销标题设置逻辑
- 更新价格库存映射以使用新的最大采购价格字段
- 扩展产品基础服务中的价格相关条件判断逻辑
- 添加客户信息服务引用以支持协议信息查询
- 优化协议信息服务实现以获取客户名称和编号
- 在外部项目中添加注释说明项目编号规则
- 更新API DTO以包含客户编号字段
肖路 1 mesiac pred
rodič
commit
3fcd96ff78

+ 2 - 0
ruoyi-api/ruoyi-api-customer/src/main/java/org/dromara/customer/api/domain/dto/CustomerInfoDTO.java

@@ -14,6 +14,8 @@ public class CustomerInfoDTO implements Serializable {
 
     private String customerName;
 
+    private String customerNo;
+
     /**
      * 状态(0已审核 待审核)
      */

+ 1 - 1
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/vo/ContractSupplyProductVo.java

@@ -389,7 +389,7 @@ public class ContractSupplyProductVo {
      * 暂估采购价
      */
     @ExcelProperty(value = "暂估采购价")
-    private BigDecimal estimatedPurchasePrice;
+    private BigDecimal maxPurchasePrice;
 
     /**
      * 产品经理

+ 3 - 0
ruoyi-modules/ruoyi-external/src/main/java/org/dromara/external/domain/ExternalItem.java

@@ -27,6 +27,9 @@ public class ExternalItem extends TenantEntity {
     @TableId(value = "id")
     private Long id;
 
+    /*
+    * 1+DDDDD
+    * */
     private String itemNo;
 
     /**

+ 1 - 1
ruoyi-modules/ruoyi-external/src/main/java/org/dromara/external/domain/vo/ExternalProductVo.java

@@ -342,7 +342,7 @@ public class ExternalProductVo implements Serializable {
     /**
      * 暂估采购价
      */
-    private java.math.BigDecimal estimatedPurchasePrice;
+    private java.math.BigDecimal maxPurchasePrice;
 
     /**
      * 产品经理

+ 2 - 2
ruoyi-modules/ruoyi-product/src/main/java/org/dromara/product/controller/ProductCategoryController.java

@@ -136,7 +136,7 @@ public class ProductCategoryController extends BaseController {
     * 查询产品分类树(排除节点)
     * */
     @GetMapping("/tree/exclude/{excludeIds}")
-    public R<List<Tree<Long>>> listExclude(@PathVariable("excludeIds") String excludeIds) {
-        return R.ok(productCategoryService.queryPageListExclude(excludeIds));
+    public R<List<Tree<Long>>> listExclude(@PathVariable("excludeIds") String excludeIds,@RequestParam Long platform) {
+        return R.ok(productCategoryService.queryPageListExclude(excludeIds, platform));
     }
 }

+ 1 - 1
ruoyi-modules/ruoyi-product/src/main/java/org/dromara/product/domain/bo/ProductBaseBo.java

@@ -299,7 +299,7 @@ public class ProductBaseBo extends BaseEntity {
     /**
      * 暂估采购价
      */
-    private java.math.BigDecimal estimatedPurchasePrice;
+    private java.math.BigDecimal maxPurchasePrice;
 
     /**
      * 供应价

+ 1 - 1
ruoyi-modules/ruoyi-product/src/main/java/org/dromara/product/service/IProductCategoryService.java

@@ -101,7 +101,7 @@ public interface IProductCategoryService extends IService<ProductCategory>{
      * @param excludeIds 排除节点
      * @return 产品分类列表
      */
-    List<Tree<Long>> queryPageListExclude(String excludeIds);
+    List<Tree<Long>> queryPageListExclude(String excludeIds,Long platform);
 
     /**
      * 获取分类下一级的分类列表

+ 3 - 0
ruoyi-modules/ruoyi-product/src/main/java/org/dromara/product/service/impl/ProductBaseAuditServiceImpl.java

@@ -172,6 +172,9 @@ public class ProductBaseAuditServiceImpl extends ServiceImpl<ProductBaseAuditMap
             lqw.eq(bo.getQueryType()==1,ProductBaseAudit::getCreateById,LoginHelper.getLoginUser().getSupplierId());
             lqw.eq(bo.getQueryType()==2,ProductBaseAudit::getCreateByType,2);
             lqw.eq(bo.getQueryType()==2,ProductBaseAudit::getCreateById,LoginHelper.getLoginUser().getPartnerId());
+        }else{
+            lqw.eq(ProductBaseAudit::getCreateByType,0);
+            lqw.eq(ProductBaseAudit::getCreateById,LoginHelper.getUserId());
         }
 //        if(ObjectUtil.isNotEmpty(bo.getQueryType())){
 //            lqw.apply(bo.getQueryType()==1,"JSON_EXTRACT(product_data, '$.createByType') = {0}", 1);

+ 9 - 5
ruoyi-modules/ruoyi-product/src/main/java/org/dromara/product/service/impl/ProductBaseServiceImpl.java

@@ -769,7 +769,7 @@ public class ProductBaseServiceImpl extends ServiceImpl<ProductBaseMapper, Produ
 
         // 映射扩展字段
         extend.setSupplierNo(bo.getSupplierNo());
-        extend.setPromotionTitle(extend.getPromotionTitle());
+        extend.setPromotionTitle(bo.getPromotionTitle());
         extend.setInvoiceName(bo.getInvoiceName());
         extend.setSpecificationsCode(bo.getSpecificationsCode());
         extend.setInvoiceSpecs(bo.getInvoiceSpecs());
@@ -804,7 +804,7 @@ public class ProductBaseServiceImpl extends ServiceImpl<ProductBaseMapper, Produ
         priceInventory.setMemberPrice(bo.getMemberPrice());
         priceInventory.setMinSellingPrice(bo.getMinSellingPrice());
         priceInventory.setPurchasingPrice(bo.getPurchasingPrice());
-        priceInventory.setMaxPurchasePrice(bo.getEstimatedPurchasePrice());
+        priceInventory.setMaxPurchasePrice(bo.getMaxPurchasePrice());
         priceInventory.setCurrency(bo.getCurrency());
         priceInventory.setTaxRate(bo.getTaxRate());
         priceInventory.setMinOrderQuantity(bo.getMinOrderQuantity());
@@ -889,8 +889,12 @@ public class ProductBaseServiceImpl extends ServiceImpl<ProductBaseMapper, Produ
         // 如果没有传价格相关信息,不做任何操作
         if (bo.getMarketPrice() == null && bo.getMemberPrice() == null &&
             bo.getMinSellingPrice() == null && bo.getPurchasingPrice() == null &&
-            bo.getEstimatedPurchasePrice() == null && bo.getTotalInventory() == null &&
-            bo.getNowInventory() == null && bo.getVirtualInventory() == null) {
+            bo.getMaxPurchasePrice() == null && bo.getTotalInventory() == null &&
+            bo.getNowInventory() == null && bo.getVirtualInventory() == null &&
+            bo.getTaxRate() == null && bo.getTaxationId() == null &&
+            bo.getSupplyPrice() == null && bo.getSupplyValidityPeriod() == null &&
+            bo.getSupplyPostStatus() == null
+            ) {
             return;
         }
 
@@ -903,7 +907,7 @@ public class ProductBaseServiceImpl extends ServiceImpl<ProductBaseMapper, Produ
             if (bo.getPurchasingPrice() != null) existing.setPurchasingPrice(bo.getPurchasingPrice());
             if (bo.getTaxRate() != null) existing.setTaxRate(bo.getTaxRate());
             if (bo.getTaxationId() != null) existing.setTaxationId(bo.getTaxationId());
-            if (bo.getEstimatedPurchasePrice() != null) existing.setMaxPurchasePrice(bo.getEstimatedPurchasePrice());
+            if (bo.getMaxPurchasePrice() != null) existing.setMaxPurchasePrice(bo.getMaxPurchasePrice());
             if(bo.getTotalInventory() != null) existing.setTotalInventory(bo.getVirtualInventory()+existing.getNowInventory());
             if(bo.getNowInventory() != null) existing.setNowInventory(bo.getNowInventory());
             if(bo.getVirtualInventory() != null) existing.setVirtualInventory(bo.getVirtualInventory());

+ 2 - 1
ruoyi-modules/ruoyi-product/src/main/java/org/dromara/product/service/impl/ProductCategoryServiceImpl.java

@@ -273,9 +273,10 @@ public class ProductCategoryServiceImpl  extends ServiceImpl<ProductCategoryMapp
      * @return 产品分类列表
      */
     @Override
-    public List<Tree<Long>> queryPageListExclude(String excludeIds) {
+    public List<Tree<Long>> queryPageListExclude(String excludeIds,Long platform) {
         LambdaQueryWrapper<ProductCategory> lqw = new LambdaQueryWrapper<>();
         lqw.ne(StringUtils.isNotBlank(excludeIds), ProductCategory::getId, excludeIds);
+        lqw.eq(ProductCategory::getPlatform, platform);
         return buildTreeSelect(baseMapper.selectVoList(lqw));
     }
 

+ 17 - 3
ruoyi-modules/ruoyi-product/src/main/java/org/dromara/product/service/impl/ProtocolInfoServiceImpl.java

@@ -1,5 +1,6 @@
 package org.dromara.product.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.dromara.common.core.utils.MapstructUtils;
@@ -11,6 +12,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.dromara.customer.api.RemoteCustomerService;
+import org.dromara.customer.api.domain.dto.CustomerInfoDTO;
 import org.dromara.product.domain.ProtocolProducts;
 import org.dromara.product.mapper.ProtocolProductsMapper;
 import org.dromara.system.api.RemoteComStaffService;
@@ -41,6 +44,9 @@ public class ProtocolInfoServiceImpl  extends ServiceImpl<ProtocolInfoMapper, Pr
     @DubboReference
     private RemoteComStaffService remoteComStaffService;
 
+    @DubboReference
+    private RemoteCustomerService remoteCustomerService;
+
     /**
      * 查询协议信息
      *
@@ -50,9 +56,17 @@ public class ProtocolInfoServiceImpl  extends ServiceImpl<ProtocolInfoMapper, Pr
     @Override
     public ProtocolInfoVo queryById(Long id){
         ProtocolInfoVo item = baseMapper.selectVoById(id);
-        Map<Long, String> staffMap = remoteComStaffService.selectStaffNameByIds(Set.of(item.getSalesmanId(), item.getServiceId()));
-        item.setSalesmanName(staffMap.get(item.getSalesmanId()));
-        item.setServiceName(staffMap.get(item.getServiceId()));
+        if(ObjectUtil.isNotEmpty(item.getSalesmanId()) && ObjectUtil.isNotEmpty(item.getServiceId())){
+            Map<Long, String> staffMap = remoteComStaffService.selectStaffNameByIds(Set.of(item.getSalesmanId(), item.getServiceId()));
+            item.setSalesmanName(staffMap.get(item.getSalesmanId()));
+            item.setServiceName(staffMap.get(item.getServiceId()));
+        }
+        //获取客户信息
+        if (ObjectUtil.isNotEmpty(item.getCustomerId())){
+            CustomerInfoDTO customerInfoDTO = remoteCustomerService.selectCustomerInfoById(item.getCustomerId());
+            item.setCustomerName(customerInfoDTO.getCustomerName());
+            item.setCustomerNo(customerInfoDTO.getCustomerNo());
+        }
         return item;
     }
 

+ 1 - 1
ruoyi-modules/ruoyi-product/src/main/resources/mapper/product/ProductBaseMapper.xml

@@ -301,7 +301,7 @@
             p.member_price AS standardPrice,
             p.min_selling_price AS certificatePrice,
             p.purchasing_price AS purchasePrice,
-            p.max_purchase_price AS estimatedPurchasePrice,
+            p.max_purchase_price AS maxPurchasePrice,
             p.tax_rate AS taxRate,
             p.currency,
             p.min_order_quantity AS minOrderQuantity,