From 65bf12d8c871308e36fff97d985f49ad6bce6adc Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期二, 07 四月 2026 16:01:09 +0800
Subject: [PATCH] feat: 支持个人对私录入销售订单;支持个人采购;供应商、客户档案、销售采购导入导出修改
---
src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java | 38 +++++++++++++++++++++++++-------------
1 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
index b7cb426..4599ddc 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
@@ -1,6 +1,8 @@
package com.ruoyi.basic.service.impl;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.date.LocalDateTimeUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -33,10 +35,9 @@
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.util.*;
import java.util.stream.Collectors;
@@ -133,12 +134,12 @@
// 2. 鏋勫缓鏌ヨ鏉′欢锛堝寮虹┖鍊煎畨鍏級
LambdaQueryWrapper<Customer> queryWrapper = new LambdaQueryWrapper<>();
String customerName = customer.getCustomerName();
- String customerType = customer.getCustomerType();
+ Integer customerType = customer.getCustomerType();
if (StringUtils.isNotBlank(customerName)) {
queryWrapper.like(Customer::getCustomerName, customerName);
}
- if (StringUtils.isNotBlank(customerType)) {
- queryWrapper.like(Customer::getCustomerType, customerType);
+ if (customerType != null) {
+ queryWrapper.eq(Customer::getCustomerType, customerType);
}
// 3. 鎵ц鍒嗛〉鏌ヨ锛堜繚鐣欏垎椤靛厓鏁版嵁锛�
@@ -149,10 +150,17 @@
.filter(Objects::nonNull) // 杩囨护绌哄璞★紙閬垮厤鍚庣画鎿嶄綔NPE锛�
.peek(c -> {
// 瀹夊叏鑾峰彇瀛楁锛岄伩鍏峮ull鍊兼嫾鎺�
- String address = StringUtils.defaultString(c.getCompanyAddress(), "");
- String phone = StringUtils.defaultString(c.getCompanyPhone(), "");
- c.setAddressPhone(address + "(" + phone + ")");
-
+ String address = StringUtils.defaultString(c.getCompanyAddress(), "").trim();
+ String phone = StringUtils.defaultString(c.getCompanyPhone(), "").trim();
+ if (StringUtils.isNotEmpty(address) && StringUtils.isNotEmpty(phone)) {
+ c.setAddressPhone(address + "(" + phone + ")");
+ } else if (StringUtils.isNotEmpty(address)) {
+ c.setAddressPhone(address);
+ } else if (StringUtils.isNotEmpty(phone)) {
+ c.setAddressPhone(phone);
+ } else {
+ c.setAddressPhone("");
+ }
// 鏌ヨ鏈�鏂扮殑璺熻繘璁板綍
CustomerFollowUp followUp = customerFollowUpService.getOne(
new LambdaQueryWrapper<CustomerFollowUp>()
@@ -163,7 +171,11 @@
if (followUp != null) {
c.setFollowUpLevel(followUp.getFollowUpLevel());
- c.setFollowUpTime(followUp.getFollowUpTime());
+ c.setFollowUpTime(
+ Date.from(
+ followUp.getFollowUpTime().atZone(ZoneId.systemDefault()).toInstant()
+ )
+ );
}
})
.collect(Collectors.toList());
@@ -258,7 +270,7 @@
@Override
public List<Map<String, Object>> customerList(Customer customer) {
LambdaQueryWrapper<Customer> queryWrapper = Wrappers.lambdaQuery();
- queryWrapper.select(Customer::getId, Customer::getCustomerName, Customer::getTaxpayerIdentificationNumber);
+ queryWrapper.select(Customer::getId, Customer::getCustomerName, Customer::getTaxpayerIdentificationNumber, Customer::getCustomerType);
// 鑾峰彇鍘熷鏌ヨ缁撴灉
List<Map<String, Object>> result = customerMapper.selectMaps(queryWrapper);
--
Gitblit v1.9.3