7 天以前 e2729587d4a8b9c2e3e2c4dd50a25adedb337e98
Merge remote-tracking branch 'origin/dev_business' into dev_business
已修改9个文件
121 ■■■■ 文件已修改
docs/contract_generate_order_frontend.md 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/projectSql/ruoyi-vue-pro.sql 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessRespVO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/vo/CrmFollowUpRecordSaveReqVO.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/quotation/CrmSaleQuotationController.java 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/quotation/vo/CrmSaleQuotationRespVO.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordServiceImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/sale/ErpSaleOrderServiceImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/contract_generate_order_frontend.md
@@ -228,6 +228,9 @@
ALTER TABLE `erp_sale_order`
ADD COLUMN `contract_id` bigint DEFAULT NULL COMMENT '关联 CRM 合同编号' AFTER `customer_id`,
ADD COLUMN `contract_no` varchar(32) DEFAULT NULL COMMENT 'CRM 合同单号' AFTER `contract_id`;
ALTER TABLE `erp_sale_order`
MODIFY COLUMN `deposit_price` decimal(24,6) NOT NULL DEFAULT 0 COMMENT '定金金额,单位:元';
```
---
docs/projectSql/ruoyi-vue-pro.sql
@@ -3449,7 +3449,7 @@
  `total_tax_price` decimal(24, 6) NOT NULL COMMENT '合计税额,单位:元',
  `discount_percent` decimal(24, 6) NOT NULL COMMENT '优惠率,百分比',
  `discount_price` decimal(24, 6) NOT NULL COMMENT '优惠金额,单位:元',
  `deposit_price` decimal(24, 6) NOT NULL COMMENT '定金金额,单位:元',
  `deposit_price` decimal(24, 6) NOT NULL DEFAULT 0 COMMENT '定金金额,单位:元',
  `file_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '附件地址',
  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
  `process_instance_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'BPM 流程实例编号',
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessController.java
@@ -36,9 +36,7 @@
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Stream;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
@@ -123,18 +121,39 @@
        List<CrmBusinessProductDO> businessProducts = businessService.getBusinessProductListByBusinessId(businessVO.getId());
        Map<Long, MdmItemRespDTO> itemMap = mdmItemApi.getItemMap(
                convertSet(businessProducts, CrmBusinessProductDO::getItemId));
        Map<Long, MdmUnitMeasureRespDTO> unitMap = mdmUnitMeasureApi.getUnitMeasureMap(
                convertSet(businessProducts, CrmBusinessProductDO::getItemUnitId));
        // 收集所有需要查询的单位ID(主单位 + 辅单位1 + 辅单位2)
        Set<Long> unitIds = new HashSet<>();
        unitIds.addAll(convertSet(businessProducts, CrmBusinessProductDO::getItemUnitId));
        itemMap.values().forEach(item -> {
            if (item.getUnitMeasureId2() != null) {
                unitIds.add(item.getUnitMeasureId2());
            }
            if (item.getUnitMeasureId3() != null) {
                unitIds.add(item.getUnitMeasureId3());
            }
        });
        Map<Long, MdmUnitMeasureRespDTO> unitMap = mdmUnitMeasureApi.getUnitMeasureMap(unitIds);
        businessVO.setProducts(BeanUtils.toBean(businessProducts, CrmBusinessRespVO.Product.class, businessProductVO ->
                MapUtils.findAndThen(itemMap, businessProductVO.getItemId(),
                        item -> businessProductVO.setItemName(item.getName())
                                .setItemCode(item.getCode())
                                .setBarCode(item.getBarCode())
                                .setItemSpecification(item.getSpecification()))));
        // 填充单位名称
        // 填充单位名称(主单位 + 辅单位1 + 辅单位2)
        businessVO.getProducts().forEach(product -> {
            MapUtils.findAndThen(unitMap, product.getItemUnitId(),
                    unit -> product.setItemUnitName(unit.getName()));
            // 填充辅单位名称
            MapUtils.findAndThen(itemMap, product.getItemId(), item -> {
                if (item.getUnitMeasureId2() != null) {
                    MapUtils.findAndThen(unitMap, item.getUnitMeasureId2(),
                            unit -> product.setItemUnitName2(unit.getName()));
                }
                if (item.getUnitMeasureId3() != null) {
                    MapUtils.findAndThen(unitMap, item.getUnitMeasureId3(),
                            unit -> product.setItemUnitName3(unit.getName()));
                }
            });
        });
        return businessVO;
    }
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessRespVO.java
@@ -134,6 +134,10 @@
        private Long itemUnitId;
        @Schema(description = "计量单位名称", example = "个")
        private String itemUnitName;
        @Schema(description = "辅单位1名称")
        private String itemUnitName2;
        @Schema(description = "辅单位2名称")
        private String itemUnitName3;
        @Schema(description = "物料条码", example = "12345678")
        private String barCode;
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/vo/CrmFollowUpRecordSaveReqVO.java
@@ -44,5 +44,25 @@
    private List<Long> contactIds;
    @Schema(description = "图片 URL 列表")
    private List<String> picUrls;
    private Object picUrls; // 接受字符串或数组
    /**
     * 获取图片 URL 列表
     */
    public List<String> getPicUrlList() {
        if (picUrls == null) {
            return null;
        }
        if (picUrls instanceof List) {
            return (List<String>) picUrls;
        }
        if (picUrls instanceof String) {
            String str = (String) picUrls;
            if (str.isEmpty()) {
                return null;
            }
            return java.util.Arrays.asList(str.split(","));
        }
        return null;
    }
}
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/quotation/CrmSaleQuotationController.java
@@ -161,9 +161,14 @@
        // 1. 构建物料明细
        if (CollUtil.isNotEmpty(productList)) {
            Map<Long, MdmItemRespDTO> itemMap = mdmItemApi.getItemMap(convertSet(productList, CrmSaleQuotationProductDO::getItemId));
            java.util.Set<Long> unitIds = new java.util.HashSet<>(convertSet(productList, CrmSaleQuotationProductDO::getItemUnitId));
            itemMap.values().forEach(item -> {
                if (item.getUnitMeasureId2() != null) {
                    unitIds.add(item.getUnitMeasureId2());
                }
            });
            Map<Long, MdmUnitMeasureRespDTO> unitMap = convertMap(
                    mdmUnitMeasureApi.getUnitMeasureList(
                            convertSet(productList, CrmSaleQuotationProductDO::getItemUnitId)).getCheckedData(),
                    mdmUnitMeasureApi.getUnitMeasureList(unitIds).getCheckedData(),
                    MdmUnitMeasureRespDTO::getId);
            respVO.setItems(BeanUtils.toBean(productList, CrmSaleQuotationRespVO.Item.class, item -> {
                MdmItemRespDTO mdmItem = itemMap.get(item.getItemId());
@@ -171,8 +176,13 @@
                    item.setItemCode(mdmItem.getCode());
                    item.setItemName(mdmItem.getName());
                    item.setItemBarCode(mdmItem.getBarCode());
                    item.setItemSpecification(mdmItem.getSpecification());
                    item.setItemUnitId2(mdmItem.getUnitMeasureId2());
                    item.setItemUnitId3(mdmItem.getUnitMeasureId3());
                }
                MapUtils.findAndThen(unitMap, item.getItemUnitId(), unit -> item.setItemUnitName(unit.getName()));
                MapUtils.findAndThen(unitMap, item.getItemUnitId2(), unit -> item.setItemUnitName2(unit.getName()));
                MapUtils.findAndThen(unitMap, item.getItemUnitId3(), unit -> item.setItemUnitName3(unit.getName()));
            }));
        }
        // 2. 填充客户名称
@@ -206,6 +216,15 @@
        Map<Long, List<CrmSaleQuotationProductDO>> productMap = convertMultiMap(productList, CrmSaleQuotationProductDO::getQuotationId);
        // 1.2 物料信息
        Map<Long, MdmItemRespDTO> itemMap = mdmItemApi.getItemMap(convertSet(productList, CrmSaleQuotationProductDO::getItemId));
        java.util.Set<Long> unitIds = new java.util.HashSet<>(convertSet(productList, CrmSaleQuotationProductDO::getItemUnitId));
        itemMap.values().forEach(item -> {
            if (item.getUnitMeasureId2() != null) {
                unitIds.add(item.getUnitMeasureId2());
            }
        });
        Map<Long, MdmUnitMeasureRespDTO> unitMap = convertMap(
                mdmUnitMeasureApi.getUnitMeasureList(unitIds).getCheckedData(),
                MdmUnitMeasureRespDTO::getId);
        // 1.3 客户信息
        Map<Long, CrmCustomerDO> customerMap = customerService.getCustomerMap(
                convertSet(pageResult.getList(), CrmSaleQuotationDO::getCustomerId));
@@ -222,8 +241,18 @@
        // 2. 开始拼接
        return BeanUtils.toBean(pageResult, CrmSaleQuotationRespVO.class, vo -> {
            vo.setItems(BeanUtils.toBean(productMap.get(vo.getId()), CrmSaleQuotationRespVO.Item.class,
                    item -> MapUtils.findAndThen(itemMap, item.getItemId(), mdmItem -> item.setItemCode(mdmItem.getCode())
                            .setItemName(mdmItem.getName()).setItemBarCode(mdmItem.getBarCode()))));
                    item -> {
                        MapUtils.findAndThen(itemMap, item.getItemId(), mdmItem -> item
                                .setItemCode(mdmItem.getCode())
                                .setItemName(mdmItem.getName())
                                .setItemBarCode(mdmItem.getBarCode())
                                .setItemSpecification(mdmItem.getSpecification())
                                .setItemUnitId2(mdmItem.getUnitMeasureId2())
                                .setItemUnitId3(mdmItem.getUnitMeasureId3()));
                        MapUtils.findAndThen(unitMap, item.getItemUnitId(), unit -> item.setItemUnitName(unit.getName()));
                        MapUtils.findAndThen(unitMap, item.getItemUnitId2(), unit -> item.setItemUnitName2(unit.getName()));
                        MapUtils.findAndThen(unitMap, item.getItemUnitId3(), unit -> item.setItemUnitName3(unit.getName()));
                    }));
            MapUtils.findAndThen(customerMap, vo.getCustomerId(), customer -> vo.setCustomerName(customer.getName()));
            MapUtils.findAndThen(userMap, vo.getOwnerUserId(), user -> vo.setOwnerUserName(user.getNickname()));
            MapUtils.findAndThen(deptMap, vo.getOwnerUserId(), dept -> vo.setOwnerUserDeptName(dept.getName()));
@@ -258,4 +287,4 @@
        }
    }
}
}
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/quotation/vo/CrmSaleQuotationRespVO.java
@@ -141,10 +141,20 @@
        private String itemName;
        @Schema(description = "物料条码", example = "BAR001")
        private String itemBarCode;
        @Schema(description = "规格型号", example = "M8*20")
        private String itemSpecification;
        @Schema(description = "计量单位编号", example = "1")
        private Long itemUnitId;
        @Schema(description = "计量单位名称", example = "个")
        private String itemUnitName;
        @Schema(description = "辅单位1编号", example = "2")
        private Long itemUnitId2;
        @Schema(description = "辅单位1名称", example = "箱")
        private String itemUnitName2;
        @Schema(description = "辅单位2编号", example = "3")
        private Long itemUnitId3;
        @Schema(description = "辅单位2名称", example = "托")
        private String itemUnitName3;
        @Schema(description = "物料原价", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
        private BigDecimal itemPrice;
@@ -169,4 +179,4 @@
    }
}
}
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordServiceImpl.java
@@ -67,8 +67,10 @@
    @Override
    @CrmPermission(bizTypeValue = "#createReqVO.bizType", bizId = "#createReqVO.bizId", level = CrmPermissionLevelEnum.WRITE)
    public Long createFollowUpRecord(CrmFollowUpRecordSaveReqVO createReqVO) {
        // 1. 创建更进记录
        // 1. 创建跟进记录
        CrmFollowUpRecordDO record = BeanUtils.toBean(createReqVO, CrmFollowUpRecordDO.class);
        // 手动处理 picUrls 字段
        record.setPicUrls(createReqVO.getPicUrlList());
        crmFollowUpRecordMapper.insert(record);
        storageAttachmentApi.bindAttachments("file", "crm_follow_up_record",
                record.getId(), createReqVO.getBlobIds());
yudao-module-erp/src/main/java/cn/iocoder/yudao/module/erp/service/sale/ErpSaleOrderServiceImpl.java
@@ -101,6 +101,7 @@
        // 2.1 插入订单
        ErpSaleOrderDO saleOrder = BeanUtils.toBean(createReqVO, ErpSaleOrderDO.class, in -> in
                .setNo(no).setStatus(ErpAuditStatus.PROCESS.getStatus())
                .setDepositPrice(ObjectUtil.defaultIfNull(createReqVO.getDepositPrice(), BigDecimal.ZERO))
                .setOutCount(BigDecimal.ZERO).setOutStatus(ErpSaleOrderOutStatusEnum.NOT_OUT.getStatus()));
        calculateTotalPrice(saleOrder, saleOrderItems);
        saleOrderMapper.insert(saleOrder);
@@ -136,6 +137,7 @@
        // 2.1 更新订单
        ErpSaleOrderDO updateObj = BeanUtils.toBean(updateReqVO, ErpSaleOrderDO.class);
        updateObj.setDepositPrice(ObjectUtil.defaultIfNull(updateReqVO.getDepositPrice(), BigDecimal.ZERO));
        calculateTotalPrice(updateObj, saleOrderItems);
        saleOrderMapper.updateById(updateObj);
        // 2.2 更新订单项
@@ -478,4 +480,4 @@
        }
    }
}
}