From a02789977e52ea046fbdeb042c63c34c39d6d529 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 20 四月 2026 10:49:03 +0800
Subject: [PATCH] feat(technology): 添加技术路由DTO和VO类
---
src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java
index 3edeaa0..95f6193 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java
@@ -56,6 +56,11 @@
@Autowired
private SalesLedgerMapper salesLedgerMapper;
+ @Autowired
+ private CustomerPrivateMapper customerPrivateMapper;
+ @Autowired
+ private CustomerPrivateService customerPrivateService;
+
@Override
public Boolean add(CustomerPrivateDto customerPrivateDto) {
@@ -64,6 +69,7 @@
//鏂板绉佹捣璁板綍
CustomerPrivatePool customerPrivatePool = new CustomerPrivatePool();
customerPrivatePool.setCustomerId(customerPrivateDto.getId());
+ customerPrivatePool.setType(0L);
customerPrivatePool.setBoundId(SecurityUtils.getLoginUser().getUserId());
customerPrivatePoolMapper.insert(customerPrivatePool);
return true;
@@ -93,20 +99,34 @@
@Override
public R importData(MultipartFile file) {
try {
+ List<CustomerPrivate> existingList = customerPrivateService.list();
+ java.util.Set<String> existingCustomerNames = existingList.stream()
+ .map(CustomerPrivate::getCustomerName)
+ .collect(Collectors.toSet());
+
ExcelUtil<CustomerPrivate> util = new ExcelUtil<CustomerPrivate>(CustomerPrivate.class);
List<CustomerPrivate> userList = util.importExcel(file.getInputStream());
if (CollectionUtils.isEmpty(userList)) {
return R.fail("妯℃澘閿欒鎴栧鍏ユ暟鎹负绌�");
}
+
+ int successCount = 0;
+ int skipCount = 0;
for (CustomerPrivate user : userList) {
+ if (existingCustomerNames.contains(user.getCustomerName())) {
+ skipCount++;
+ continue;
+ }
CustomerPrivateDto customerPrivateDto = new CustomerPrivateDto();
BeanUtils.copyProperties(user, customerPrivateDto);
this.add(customerPrivateDto);
+ existingCustomerNames.add(user.getCustomerName());
+ successCount++;
}
- return R.ok(true);
+ return R.ok("瀵煎叆瀹屾垚锛屾垚鍔�" + successCount + "鏉★紝璺宠繃閲嶅" + skipCount + "鏉�");
} catch (Exception e) {
e.printStackTrace();
- return R.fail("瀵煎叆澶辫触");
+ return R.fail("瀵煎叆澶辫触锛�" + e.getMessage());
}
}
}
--
Gitblit v1.9.3