From 52123c927f77f41f71461ef0d422525656bd7b6f Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 07 五月 2026 11:53:26 +0800
Subject: [PATCH] 优化营销客户相关
---
src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java | 35 ++-
src/main/resources/mapper/basic/CustomerMapper.xml | 54 +++++
src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java | 2
src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java | 2
src/main/java/com/ruoyi/basic/service/ICustomerService.java | 4
src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java | 60 ++++--
src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java | 2
/dev/null | 101 -----------
src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java | 2
src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java | 2
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java | 208 +++++++++++++++++-----
src/main/java/com/ruoyi/basic/controller/CustomerController.java | 17 -
src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java | 2
13 files changed, 278 insertions(+), 213 deletions(-)
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerController.java b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
index 051976c..866153b 100644
--- a/src/main/java/com/ruoyi/basic/controller/CustomerController.java
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
@@ -45,16 +45,9 @@
*/
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.EXPORT)
@PostMapping("/export")
- public void export(HttpServletResponse response, Customer customer) {
- Long[] ids = customer.getIds();
- List<Customer> list;
- if (ids != null && ids.length > 0) {
- list = customerService.selectCustomerListByIds(ids);
- } else {
- list = customerService.selectCustomerLists(customer);
- }
- ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
- util.exportExcel(response, list, "瀹㈡埛妗f鏁版嵁");
+ public void export(HttpServletResponse response, CustomerDto customer) {
+ ExcelUtil<CustomerVo> util = new ExcelUtil<CustomerVo>(CustomerVo.class);
+ util.exportExcel(response, customerService.selectCustomerLists(customer), "瀹㈡埛妗f鏁版嵁");
}
@PostMapping("/downloadTemplate")
@@ -70,9 +63,9 @@
*/
@Log(title = "瀹㈡埛妗f", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
- public AjaxResult importData(MultipartFile file) throws Exception {
+ public AjaxResult importData(MultipartFile file, Integer type) throws Exception {
- return customerService.importData(file);
+ return customerService.importData(file, type);
}
/**
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java b/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java
index 70b109e..a5dcc83 100644
--- a/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java
@@ -44,7 +44,7 @@
@Operation(summary = "鏌ヨ瀹㈡埛璺熻繘鍒楄〃")
public IPage<CustomerFollowUp> list(Page<CustomerFollowUp> page, CustomerFollowUp customerFollowUp) {
LambdaQueryWrapper<CustomerFollowUp> queryWrapper = new LambdaQueryWrapper<>();
- queryWrapper.eq(customerFollowUp.getCustomerPrivatePoolId() != null, CustomerFollowUp::getCustomerPrivatePoolId, customerFollowUp.getCustomerPrivatePoolId())
+ queryWrapper.eq(customerFollowUp.getCustomerId() != null, CustomerFollowUp::getCustomerId, customerFollowUp.getCustomerId())
.like(customerFollowUp.getFollowerUserName() != null, CustomerFollowUp::getFollowerUserName, customerFollowUp.getFollowerUserName())
.orderByDesc(CustomerFollowUp::getFollowUpTime);
return customerFollowUpService.page(page, queryWrapper);
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerPrivateController.java b/src/main/java/com/ruoyi/basic/controller/CustomerPrivateController.java
deleted file mode 100644
index 67b1755..0000000
--- a/src/main/java/com/ruoyi/basic/controller/CustomerPrivateController.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.ruoyi.basic.controller;
-
-import com.ruoyi.basic.dto.CustomerPrivateDto;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.service.CustomerPrivatePoolService;
-import com.ruoyi.basic.service.CustomerPrivateService;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.aspectj.lang.annotation.Log;
-import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.framework.web.domain.R;
-import jakarta.servlet.http.HttpServletResponse;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.List;
-
-/**
- * <p>
- * 瀹㈡埛妗f 鍓嶇鎺у埗鍣�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-@RestController
-@RequestMapping("/customerPrivate")
-@AllArgsConstructor
-public class CustomerPrivateController {
- private final CustomerPrivateService customerPrivateService;
-
- private final CustomerPrivatePoolService customerPrivatePoolService;
-
-
- @PostMapping("/add")
- public R add(@RequestBody CustomerPrivateDto customerPrivateDto) {
- return R.ok(customerPrivateService.add(customerPrivateDto));
- }
-
-
- @DeleteMapping("/delete")
- public R delete(@RequestBody List<Long> ids) {
- return R.ok(customerPrivateService.delete(ids));
- }
-
-
- /**
- * 瀵煎叆瀹㈡埛妗f
- */
- @Log(title = "瀹㈡埛妗f", businessType = BusinessType.IMPORT)
- @PostMapping("/importData")
- public R importData(MultipartFile file) throws Exception {
-
- return customerPrivateService.importData(file);
- }
-
- /**
- * 瀵煎嚭瀹㈡埛妗f鍒楄〃
- */
- @Log(title = "瀹㈡埛妗f", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- public void export(HttpServletResponse response, CustomerPrivatePoolDto customerPrivatePoolDto) {
- List<Long> ids = customerPrivatePoolDto.getIds();
- List<CustomerPrivatePoolDto> list;
- if (ids != null && ids.size() > 0) {
- list = customerPrivatePoolService.selectCustomerPrivatePoolDtoListByIds(ids);
- } else {
- list = customerPrivatePoolService.selectCustomerPrivatePoolDtoLists(customerPrivatePoolDto);
- }
- ExcelUtil<CustomerPrivatePoolDto> util = new ExcelUtil<CustomerPrivatePoolDto>(CustomerPrivatePoolDto.class);
- util.exportExcel(response, list, "瀹㈡埛妗f鏁版嵁");
- }
-
- @PostMapping("/downloadTemplate")
- @Log(title = "瀹㈡埛妗f-涓嬭浇妯℃澘", businessType = BusinessType.EXPORT)
- public void downloadTemplate(HttpServletResponse response) {
- ExcelUtil<CustomerPrivatePoolDto> util = new ExcelUtil<CustomerPrivatePoolDto>(CustomerPrivatePoolDto.class);
- util.importTemplateExcel(response, "瀹㈡埛妗f妯℃澘");
- }
-}
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerPrivatePoolController.java b/src/main/java/com/ruoyi/basic/controller/CustomerPrivatePoolController.java
deleted file mode 100644
index 83597cf..0000000
--- a/src/main/java/com/ruoyi/basic/controller/CustomerPrivatePoolController.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.ruoyi.basic.controller;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.service.CustomerPrivatePoolService;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.framework.web.domain.R;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * <p>
- * 鍓嶇鎺у埗鍣� 瀹㈡埛锛堢娴凤級
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-@RestController
-@Tag(name = "瀹㈡埛锛堢娴凤級")
-@RequestMapping("/customerPrivatePool")
-@AllArgsConstructor
-public class CustomerPrivatePoolController {
-
- private final CustomerPrivatePoolService customerPrivatePoolService;
-
-
- @GetMapping("/listPage")
- @Operation(summary = "瀹㈡埛锛堢娴凤級鍒楄〃")
- public R listPage(CustomerPrivatePoolDto customerPrivatePoolDto, Page<CustomerPrivatePoolDto> page){
- //鏌ヨ褰撳墠鐢ㄦ埛鐨勫鎴蜂俊鎭�
- customerPrivatePoolDto.setBoundId(SecurityUtils.getUserId());
- IPage<CustomerPrivatePoolDto> listPage = customerPrivatePoolService.listPage(page, customerPrivatePoolDto);
- return R.ok(listPage);
- }
-
- @PostMapping("/add")
- @Operation(summary = "鍒嗛厤瀹㈡埛锛堢娴凤級")
- public R add(@RequestBody CustomerPrivatePoolDto customerPrivatePool){
- boolean result = customerPrivatePoolService.add(customerPrivatePool);
- return R.ok(result);
- }
-
- @PutMapping("/update")
- public R update(@RequestBody CustomerPrivatePoolDto customerPrivatePoolDto) {
- return R.ok(customerPrivatePoolService.updateCustomerPrivatePoolDto(customerPrivatePoolDto));
- }
-
-
- @DeleteMapping("/delete/{id}")
- @Operation(summary = "鍒犻櫎瀹㈡埛锛堢娴凤級")
- public R delete(@PathVariable Long id){
- boolean result = customerPrivatePoolService.deleteCustomerPrivatePool(id);
- return R.ok(result);
- }
-
- @PostMapping("/together")
- @Operation(summary = "鍏变韩")
- public R together( @RequestBody CustomerPrivatePoolDto customerPrivatePool){
- boolean result = customerPrivatePoolService.together(customerPrivatePool);
- return R.ok(result);
- }
-
- @GetMapping("/info/{id}")
- @Operation(summary = "璇︽儏")
- public R getInfo(@PathVariable Long id){
- CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolService.getInfo(id);
- return R.ok(customerPrivatePool);
- }
-
- @GetMapping("/getbyId/{id}")
- @Operation(summary = "璇︽儏")
- public R getbyId(@PathVariable Long id){
- CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolService.getbyId(id);
- return R.ok(customerPrivatePool);
- }
-
-
-
-
-
-}
diff --git a/src/main/java/com/ruoyi/basic/dto/CustomerPrivateDto.java b/src/main/java/com/ruoyi/basic/dto/CustomerPrivateDto.java
deleted file mode 100644
index c06ad62..0000000
--- a/src/main/java/com/ruoyi/basic/dto/CustomerPrivateDto.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.ruoyi.basic.dto;
-
-import com.ruoyi.basic.pojo.CustomerPrivate;
-import lombok.Data;
-
-import java.util.List;
-
-@Data
-public class CustomerPrivateDto extends CustomerPrivate {
-
- private List<CustomerFollowUpDto> followUpList;
-}
diff --git a/src/main/java/com/ruoyi/basic/dto/CustomerPrivatePoolDto.java b/src/main/java/com/ruoyi/basic/dto/CustomerPrivatePoolDto.java
deleted file mode 100644
index e452a24..0000000
--- a/src/main/java/com/ruoyi/basic/dto/CustomerPrivatePoolDto.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.ruoyi.basic.dto;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.basic.pojo.CustomerFollowUp;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
-import java.util.List;
-
-@Data
-public class CustomerPrivatePoolDto extends CustomerPrivatePool {
-
- /**
- * 瀹㈡埛鍚嶇О
- */
- @Excel(name = "瀹㈡埛鍚嶇О")
- private String customerName;
- /** 瀹㈡埛鍒嗙被锛氶浂鍞鎴凤紝杩涢攢鍟嗗鎴� */
-
- @Schema(description = "瀹㈡埛瑕乮d")
- private Long customerId;
-
- /**
- * 璺熻繘绋嬪害
- */
-// @Excel(name = "璺熻繘绋嬪害")
- @TableField(exist = false)
- private String followUpLevel;
-
- /**
- * 璺熻繘鏃堕棿
- */
-// @Excel(name = "璺熻繘鏃堕棿" , width = 30, dateFormat = "yyyy-MM-dd")
- @TableField(exist = false)
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- private Date followUpTime;
-
- @Excel(name = "瀹㈡埛鍒嗙被")
- private String customerType;
-
-
- private String addressPhone;
- /**
- * 绾崇◣浜鸿瘑鍒彿
- */
- @Excel(name = "绾崇◣浜鸿瘑鍒彿")
- private String taxpayerIdentificationNumber;
-
- /**
- * 鍏徃鍦板潃
- */
- @Excel(name = "鍏徃鍦板潃")
- private String companyAddress;
-
- /**
- * 鍏徃鐢佃瘽
- */
- @Excel(name = "鍏徃鐢佃瘽")
- private String companyPhone;
-
- /**
- * 鑱旂郴浜�
- */
- @Excel(name = "鑱旂郴浜�")
- private String contactPerson;
-
- /**
- * 鑱旂郴鐢佃瘽
- */
- @Excel(name = "鑱旂郴鐢佃瘽",cellType = Excel.ColumnType.STRING)
- private String contactPhone;
-
- /**
- * 缁存姢浜�
- */
- @Excel(name = "缁存姢浜�")
- private String maintainer;
-
- /**
- * 缁存姢鏃堕棿
- */
- @JsonFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "缁存姢鏃堕棿" , width = 30, dateFormat = "yyyy-MM-dd")
- private Date maintenanceTime;
-
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
- @Schema(description = "閾惰鍩烘湰鎴�")
- @Excel(name = "閾惰鍩烘湰鎴�")
- private String basicBankAccount;
-
- @Schema(description = "閾惰璐﹀彿")
- @Excel(name = "閾惰璐﹀彿")
- private String bankAccount;
-
- @Schema(description = "寮�鎴疯鍙�")
- @Excel(name = "寮�鎴疯鍙�")
- private String bankCode;
- @Schema(description = "鍒涘缓鐢ㄦ埛")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
-
- @Schema(description = "璺熻繘璁板綍")
- private List<CustomerFollowUpDto> followUpList;
-
- @Schema(description = "缁戝畾浜篿ds")
- private List< Long> boundIds;
-
- @Excel(isExport = false)
- private List<Long> ids;
-
-
-}
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java
index b9e5725..2605737 100644
--- a/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java
+++ b/src/main/java/com/ruoyi/basic/mapper/CustomerMapper.java
@@ -69,4 +69,6 @@
int deleteCustomerByIds(Long[] ids);
IPage<CustomerVo> listPage(Page<CustomerDto> page, @Param("c") CustomerDto customer, @Param("loginUserId") Long loginUserId);
+
+ List<CustomerVo> list(@Param("c") CustomerDto customer, @Param("loginUserId") Long loginUserId);
}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerPrivateMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerPrivateMapper.java
deleted file mode 100644
index 4f1bf6d..0000000
--- a/src/main/java/com/ruoyi/basic/mapper/CustomerPrivateMapper.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.ruoyi.basic.mapper;
-
-import com.ruoyi.basic.pojo.CustomerPrivate;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * <p>
- * 瀹㈡埛妗f Mapper 鎺ュ彛
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-@Mapper
-public interface CustomerPrivateMapper extends BaseMapper<CustomerPrivate> {
-
-}
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerPrivatePoolMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerPrivatePoolMapper.java
deleted file mode 100644
index 4c6f325..0000000
--- a/src/main/java/com/ruoyi/basic/mapper/CustomerPrivatePoolMapper.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.ruoyi.basic.mapper;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * <p>
- * Mapper 鎺ュ彛
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-@Mapper
-public interface CustomerPrivatePoolMapper extends BaseMapper<CustomerPrivatePool> {
-
- IPage<CustomerPrivatePoolDto> listPage(IPage<CustomerPrivatePoolDto> page, @Param("c") CustomerPrivatePoolDto customerPrivatePoolDto);
-
- CustomerPrivatePoolDto selectInfo(Long id);
-
- List<CustomerPrivatePoolDto> selectInfos();
-
-}
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java b/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java
index 6b5fed1..51921da 100644
--- a/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java
+++ b/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java
@@ -37,7 +37,7 @@
/**
* 鍏宠仈鐨勭娴穒d
*/
- private Long customerPrivatePoolId;
+// private Long customerPrivatePoolId;
private Long customerId;
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerPrivate.java b/src/main/java/com/ruoyi/basic/pojo/CustomerPrivate.java
deleted file mode 100644
index 87f2cc6..0000000
--- a/src/main/java/com/ruoyi/basic/pojo/CustomerPrivate.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package com.ruoyi.basic.pojo;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import java.io.Serializable;
-import java.time.LocalDate;
-import java.util.Date;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * <p>
- * 瀹㈡埛妗f
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-@Getter
-@Setter
-@TableName("customer_private")
-@Schema(name = "CustomerPrivate瀵硅薄", description = "瀹㈡埛妗f")
-public class CustomerPrivate implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- @Schema(description = "瀹㈡埛鍚嶇О")
- @Excel(name = "瀹㈡埛鍚嶇О")
- private String customerName;
-
- @Schema(description = "绾崇◣浜鸿瘑鍒彿")
- @Excel(name = "绾崇◣浜鸿瘑鍒彿")
- private String taxpayerIdentificationNumber;
-
- @Schema(description = "鍏徃鍦板潃")
- @Excel(name = "鍏徃鍦板潃")
- private String companyAddress;
-
- @Schema(description = "鍏徃鐢佃瘽")
- @Excel(name = "鍏徃鐢佃瘽")
- private String companyPhone;
-
- @Schema(description = "鑱旂郴浜�")
- @Excel(name = "鑱旂郴浜�")
- private String contactPerson;
-
- @Schema(description = "鑱旂郴鐢佃瘽")
- @Excel(name = "鑱旂郴鐢佃瘽", cellType = Excel.ColumnType.STRING)
- private String contactPhone;
-
- @Schema(description = "缁存姢浜�")
- @Excel(name = "缁存姢浜�")
- private String maintainer;
-
- @Schema(description = "缁存姢鏃堕棿")
- @JsonFormat(pattern = "yyyy-MM-dd")
- @Excel(name = "缁存姢鏃堕棿", width = 30, dateFormat = "yyyy-MM-dd")
- private Date maintenanceTime;
-
- @Schema(description = "绉熸埛ID")
- @TableField(fill = FieldFill.INSERT)
- private Long tenantId;
-
- @Schema(description = "閾惰鍩烘湰鎴�")
- @Excel(name = "閾惰鍩烘湰鎴�")
- private String basicBankAccount;
-
- @Schema(description = "閾惰璐﹀彿")
- @Excel(name = "閾惰璐﹀彿")
- private String bankAccount;
-
- @Schema(description = "寮�鎴疯鍙�")
- @Excel(name = "寮�鎴疯鍙�")
- private String bankCode;
-
- @Schema(description = "瀹㈡埛鍒嗙被锛氶浂鍞鎴凤紝杩涢攢鍟嗗鎴�")
- @Excel(name = "瀹㈡埛鍒嗙被")
- private String customerType;
-
- @Schema(description = "鍒涘缓浜篒D")
- @TableField(fill = FieldFill.INSERT)
- private Long createUser;
-
- @Schema(description = "閮ㄩ棬ID")
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-
-
- @Schema(description = "璺熻繘绋嬪害")
- @TableField(exist = false)
- private String followUpLevel;
-
- @Schema(description = "璺熻繘鏃堕棿")
- @TableField(exist = false)
- private Date followUpTime;
-
-
- @TableField(exist = false)
- private Long[] ids;
-
- @TableField(exist = false)
- private String addressPhone;
-
-}
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerPrivatePool.java b/src/main/java/com/ruoyi/basic/pojo/CustomerPrivatePool.java
deleted file mode 100644
index 86dfc5a..0000000
--- a/src/main/java/com/ruoyi/basic/pojo/CustomerPrivatePool.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.ruoyi.basic.pojo;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import java.io.Serializable;
-import java.time.LocalDateTime;
-
-import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.Data;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * <p>
- *
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-@Data
-@TableName("customer_private_pool")
-@Schema(name = "CustomerPrivatePool瀵硅薄", description = "")
-public class CustomerPrivatePool implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @Schema(description = "涓婚敭id")
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- @Schema(description = "瀹㈡埛id")
- private Long customerId;
-
- @Schema(description = "缁戝畾浜篿d")
- private Long boundId;
-
- @Schema(description = "鍒涘缓浜�")
- @TableField(fill = FieldFill.INSERT)
- private Integer createUser;
-
- @Schema(description = "鏇存柊浜�")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private Integer updateUser;
-
- @Schema(description = "鍒涘缓鏃堕棿")
- @TableField(fill = FieldFill.INSERT)
- private LocalDateTime createTime;
-
- @Schema(description = "鏇存柊鏃堕棿")
- @TableField(fill = FieldFill.INSERT_UPDATE)
- private LocalDateTime updateTime;
-
- @Schema(description = "绫诲瀷鍖哄垎鍏捣瀹㈡埛鍜岀娴峰鎴� 榛樿鏄娴峰鎴�0 鍏捣1")
- private Long type;
-
- @Schema(description = "閮ㄩ棬id")
- @TableField(fill = FieldFill.INSERT)
- private Long deptId;
-
- @Schema(description = "鍒犻櫎鏍囪瘑 榛樿0 1宸茬粡鍒犻櫎")
- private Integer DeleteFlag;
-}
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java b/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java
index 88768e4..8b2b5a1 100644
--- a/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java
+++ b/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java
@@ -36,7 +36,7 @@
/**
* 鍏宠仈瀹㈡埛ID
*/
- private Integer customerPrivatePoolId;
+// private Integer customerPrivatePoolId;
private Long customerId;
diff --git a/src/main/java/com/ruoyi/basic/service/CustomerPrivatePoolService.java b/src/main/java/com/ruoyi/basic/service/CustomerPrivatePoolService.java
deleted file mode 100644
index 18ca371..0000000
--- a/src/main/java/com/ruoyi/basic/service/CustomerPrivatePoolService.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.ruoyi.basic.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.pojo.Customer;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-import java.util.List;
-
-/**
- * <p>
- * 鏈嶅姟绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-public interface CustomerPrivatePoolService extends IService<CustomerPrivatePool> {
-
- IPage<CustomerPrivatePoolDto> listPage(Page<CustomerPrivatePoolDto> page, CustomerPrivatePoolDto customerPrivatePoolDto);
-
- boolean deleteCustomerPrivatePool(Long id);
-
- boolean together(CustomerPrivatePoolDto customerPrivatePool);
-
- boolean add(CustomerPrivatePoolDto customerPrivatePool);
-
- CustomerPrivatePoolDto getInfo(Long id);
-
- Boolean updateCustomerPrivatePoolDto(CustomerPrivatePoolDto customerPrivatePoolDto);
-
- CustomerPrivatePoolDto getbyId(Long id);
-
- List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoListByIds(List<Long> ids);
-
- List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoLists(CustomerPrivatePoolDto customerPrivatePoolDto);
-}
diff --git a/src/main/java/com/ruoyi/basic/service/CustomerPrivateService.java b/src/main/java/com/ruoyi/basic/service/CustomerPrivateService.java
deleted file mode 100644
index e758157..0000000
--- a/src/main/java/com/ruoyi/basic/service/CustomerPrivateService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.ruoyi.basic.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.basic.dto.CustomerPrivateDto;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.pojo.Customer;
-import com.ruoyi.basic.pojo.CustomerPrivate;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.framework.web.domain.R;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.List;
-
-/**
- * <p>
- * 瀹㈡埛妗f 鏈嶅姟绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-public interface CustomerPrivateService extends IService<CustomerPrivate> {
-
-
- Boolean add(CustomerPrivateDto customerPrivateDto);
-
-
- Integer delete(List<Long> id);
-
- R importData(MultipartFile file);
-}
diff --git a/src/main/java/com/ruoyi/basic/service/ICustomerService.java b/src/main/java/com/ruoyi/basic/service/ICustomerService.java
index 2b4c887..c120e72 100644
--- a/src/main/java/com/ruoyi/basic/service/ICustomerService.java
+++ b/src/main/java/com/ruoyi/basic/service/ICustomerService.java
@@ -75,9 +75,9 @@
*/
List<Map<String, Object>> customerList(Customer customer);
- List<Customer> selectCustomerLists(Customer customer);
+ List<CustomerVo> selectCustomerLists(CustomerDto customer);
- AjaxResult importData(MultipartFile file);
+ AjaxResult importData(MultipartFile file, Integer type);
IPage<CustomerVo> selectCustomerList(Page<CustomerDto> page, CustomerDto customer);
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
index 29013d3..7946753 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
@@ -130,7 +130,7 @@
}
List<CustomerFollowUp> followUps = list(new LambdaQueryWrapper<CustomerFollowUp>()
- .eq(CustomerFollowUp::getCustomerPrivatePoolId, customerId));
+ .eq(CustomerFollowUp::getCustomerId, customerId));
if (followUps != null && !followUps.isEmpty()) {
for (CustomerFollowUp followUp : followUps) {
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivatePoolServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivatePoolServiceImpl.java
deleted file mode 100644
index 0b14ee9..0000000
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivatePoolServiceImpl.java
+++ /dev/null
@@ -1,225 +0,0 @@
-package com.ruoyi.basic.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.basic.dto.CustomerFollowUpDto;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.mapper.CustomerPrivateMapper;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
-import com.ruoyi.basic.pojo.*;
-import com.ruoyi.basic.service.*;
-import com.ruoyi.common.utils.StringUtils;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.time.ZoneId;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * <p>
- * 鏈嶅姟瀹炵幇绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-16 04:43:00
- */
-@Service
-@Transactional(rollbackFor = Exception.class)
-@RequiredArgsConstructor
-public class CustomerPrivatePoolServiceImpl extends ServiceImpl<CustomerPrivatePoolMapper, CustomerPrivatePool> implements CustomerPrivatePoolService {
-
- private final CustomerPrivatePoolMapper customerPrivatePoolMapper;
-
- private final CustomerFollowUpService customerFollowUpService;
-
- private final CustomerReturnVisitService customerReturnVisitService;
-
- private final ICustomerService customerService;
-
- private final CustomerFollowUpFileService customerFollowUpFileService;
- private final CustomerPrivateMapper customerPrivateMapper;
-
-
- @Override
- public IPage<CustomerPrivatePoolDto> listPage(Page<CustomerPrivatePoolDto> page, CustomerPrivatePoolDto customerPrivatePoolDto) {
- IPage<CustomerPrivatePoolDto> customerPrivatePoolDtoIPage = customerPrivatePoolMapper.listPage(page, customerPrivatePoolDto);
- List<Long> customerIds = customerPrivatePoolDtoIPage.getRecords().stream()
- .map(CustomerPrivatePoolDto::getId )
- .filter(Objects::nonNull)
- .collect(Collectors.toList());
-
- if (!org.springframework.util.CollectionUtils.isEmpty(customerIds)) {
- Map<Long, CustomerFollowUp> latestFollowUpMap = getLatestFollowUpMap(customerIds);
-
- customerPrivatePoolDtoIPage.getRecords().forEach(c -> {
- String address = StringUtils.defaultString(c.getCompanyAddress(), "");
- String phone = StringUtils.defaultString(c.getCompanyPhone(), "");
- c.setAddressPhone(address + "(" + phone + ")");
-
- CustomerFollowUp followUp = latestFollowUpMap.get(c.getId());
- if (followUp != null) {
- c.setFollowUpLevel(followUp.getFollowUpLevel());
- c.setFollowUpTime(Date.from(
- followUp.getFollowUpTime().atZone(ZoneId.systemDefault()).toInstant()
- ));
- }
- });
-
- }
- return customerPrivatePoolDtoIPage;
- }
-
-
- private Map<Long, CustomerFollowUp> getLatestFollowUpMap(List<Long> customerIds) {
- List<CustomerFollowUp> followUps = customerFollowUpService.list(
- new LambdaQueryWrapper<CustomerFollowUp>()
- .in(CustomerFollowUp::getCustomerPrivatePoolId, customerIds)
- .orderByDesc(CustomerFollowUp::getFollowUpTime)
- );
-
- return followUps.stream()
- .collect(Collectors.toMap(
- CustomerFollowUp::getCustomerPrivatePoolId,
- followUp -> followUp,
- (existing, replacement) -> existing
- ));
- }
-
- @Override
- public boolean deleteCustomerPrivatePool(Long id) {
- List<CustomerPrivatePool> list = this.list(new QueryWrapper<CustomerPrivatePool>().lambda().eq(CustomerPrivatePool::getCustomerId, id));
-
- for (CustomerPrivatePool customerPrivatePool : list) {
- customerFollowUpService.remove(new QueryWrapper<CustomerFollowUp>().lambda().eq(CustomerFollowUp::getCustomerPrivatePoolId, customerPrivatePool.getId()));
- customerReturnVisitService.remove(new QueryWrapper<CustomerReturnVisit>().lambda().eq(CustomerReturnVisit::getCustomerPrivatePoolId, customerPrivatePool.getId()));
- }
- Customer byId = customerService.getById(id);
- byId.setUsageStatus(0L);
- byId.setUsageUser(0L);
- customerService.updateById(byId);
- list.stream().forEach(customerPrivatePool -> {
- customerPrivatePool.setDeleteFlag(1);
- customerPrivatePoolMapper.updateById(customerPrivatePool);
- });
- return true;
- }
-
- @Override
- public boolean together(CustomerPrivatePoolDto customerPrivatePoolDto) {
- List<CustomerPrivatePool> existingPools = this.list(new QueryWrapper<CustomerPrivatePool>().lambda().eq(CustomerPrivatePool::getCustomerId, customerPrivatePoolDto.getCustomerId()));
-
- List<Long> existingBoundIds = existingPools.stream()
- .map(CustomerPrivatePool::getBoundId)
- .collect(Collectors.toList());
-
- List<Long> newBoundIds = customerPrivatePoolDto.getBoundIds().stream()
- .filter(boundId -> !existingBoundIds.contains(boundId))
- .collect(Collectors.toList());
-
- if (CollectionUtils.isEmpty(newBoundIds)) {
- return true;
- }
- for (Long id : customerPrivatePoolDto.getBoundIds()) {
- CustomerPrivatePool customerPrivatePool = new CustomerPrivatePool();
- customerPrivatePool.setCustomerId(customerPrivatePoolDto.getCustomerId());
- customerPrivatePool.setBoundId(id);
- customerPrivatePool.setType(1L);
- this.save(customerPrivatePool);
- }
- return true;
- }
-
- @Override
- public boolean add(CustomerPrivatePoolDto customerPrivatePool) {
- customerPrivatePool.setType(1L);
- this.save(customerPrivatePool);
- Customer byId = customerService.getById(customerPrivatePool.getCustomerId());
- if (byId != null) {
- byId.setUsageStatus(1L);
- byId.setUsageUser(customerPrivatePool.getBoundId());
- return customerService.updateById(byId);
- }
- throw new RuntimeException("瀹㈡埛涓嶅瓨鍦�");
-
- }
-
- @Override
- public CustomerPrivatePoolDto getInfo(Long id) {
- CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolMapper.selectInfo(id);
- if (customerPrivatePool == null) {
- return null;
- }
-
- // 鏌ヨ璺熻繘璁板綍
- List<CustomerFollowUp> followUpList = customerFollowUpService.list(
- new LambdaQueryWrapper<CustomerFollowUp>()
- .eq(CustomerFollowUp::getCustomerPrivatePoolId, id)
- .orderByDesc(CustomerFollowUp::getFollowUpTime)
- );
- if (!CollectionUtils.isEmpty(followUpList)) {
- List<CustomerFollowUpDto> followUpDtoList = followUpList.stream().map(followUp -> {
- CustomerFollowUpDto followUpDto = new CustomerFollowUpDto();
- BeanUtils.copyProperties(followUp, followUpDto);
-
- // 鏌ヨ闄勪欢
- List<CustomerFollowUpFile> fileList = customerFollowUpFileService.list(
- new LambdaQueryWrapper<CustomerFollowUpFile>()
- .eq(CustomerFollowUpFile::getFollowUpId, followUp.getId())
- );
- followUpDto.setFileList(fileList);
-
- return followUpDto;
- }).collect(Collectors.toList());
-
- customerPrivatePool.setFollowUpList(followUpDtoList);
- }
-
- return customerPrivatePool;
- }
-
- @Override
- public Boolean updateCustomerPrivatePoolDto(CustomerPrivatePoolDto customerPrivatePoolDto) {
- if (customerPrivatePoolDto.getType() == 0L) {
- CustomerPrivate byId = customerPrivateMapper.selectById(customerPrivatePoolDto.getCustomerId());
- BeanUtils.copyProperties(customerPrivatePoolDto, byId);
- byId.setId(customerPrivatePoolDto.getCustomerId());
- customerPrivateMapper.updateById(byId);
- } else if (customerPrivatePoolDto.getType() == 1L) {
- Customer customer = customerService.getById(customerPrivatePoolDto.getCustomerId());
- BeanUtils.copyProperties(customerPrivatePoolDto, customer);
- customer.setId(customerPrivatePoolDto.getCustomerId());
- customerService.updateById(customer);
- }
- return true;
- }
-
- @Override
- public CustomerPrivatePoolDto getbyId(Long id) {
- CustomerPrivatePoolDto customerPrivatePool = customerPrivatePoolMapper.selectInfo(id);
- return customerPrivatePool;
- }
-
- @Override
- public List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoListByIds(List<Long> ids) {
- ArrayList<CustomerPrivatePoolDto> customerPrivatePoolDtos = new ArrayList<>();
- for (Long id : ids) {
- CustomerPrivatePoolDto customerPrivatePoolDto = customerPrivatePoolMapper.selectInfo(id);
- customerPrivatePoolDtos.add(customerPrivatePoolDto);
- }
- return customerPrivatePoolDtos;
- }
-
- @Override
- public List<CustomerPrivatePoolDto> selectCustomerPrivatePoolDtoLists(CustomerPrivatePoolDto customerPrivatePoolDto) {
-
- return customerPrivatePoolMapper.selectInfos();
- }
-}
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java
deleted file mode 100644
index 4521155..0000000
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerPrivateServiceImpl.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package com.ruoyi.basic.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.basic.dto.CustomerPrivateDto;
-import com.ruoyi.basic.mapper.CustomerPrivateMapper;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
-import com.ruoyi.basic.pojo.CustomerFollowUp;
-import com.ruoyi.basic.pojo.CustomerPrivate;
-import com.ruoyi.basic.pojo.CustomerPrivatePool;
-import com.ruoyi.basic.pojo.CustomerReturnVisit;
-import com.ruoyi.basic.service.CustomerFollowUpService;
-import com.ruoyi.basic.service.CustomerPrivateService;
-import com.ruoyi.basic.service.CustomerReturnVisitService;
-import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.framework.web.domain.R;
-import com.ruoyi.sales.mapper.SalesLedgerMapper;
-import com.ruoyi.sales.pojo.SalesLedger;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.BeanUtils;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * <p>
- * 瀹㈡埛妗f 鏈嶅姟瀹炵幇绫�
- * </p>
- *
- * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
- * @since 2026-04-17 10:39:09
- */
-@Service
-@Transactional(rollbackFor = Exception.class)
-@RequiredArgsConstructor
-public class CustomerPrivateServiceImpl extends ServiceImpl<CustomerPrivateMapper, CustomerPrivate> implements CustomerPrivateService {
-
-
- private final CustomerPrivatePoolMapper customerPrivatePoolMapper;
-
- private final CustomerFollowUpService customerFollowUpService;
-
- private final CustomerReturnVisitService customerReturnVisitService;
- private final SalesLedgerMapper salesLedgerMapper;
-
- private final CustomerPrivateMapper customerPrivateMapper;
-
-
- @Override
- public Boolean add(CustomerPrivateDto customerPrivateDto) {
- //鏂板绉佹捣 瀹㈡埛
- this.save(customerPrivateDto);
- //鏂板绉佹捣璁板綍
- CustomerPrivatePool customerPrivatePool = new CustomerPrivatePool();
- customerPrivatePool.setCustomerId(customerPrivateDto.getId());
- customerPrivatePool.setType(0L);
- customerPrivatePool.setBoundId(SecurityUtils.getLoginUser().getUserId());
- customerPrivatePoolMapper.insert(customerPrivatePool);
- return true;
- }
-
-
- @Override
- public Integer delete(List<Long> ids) {
- List<CustomerPrivatePool> customerPrivatePools = customerPrivatePoolMapper.selectList(new QueryWrapper<CustomerPrivatePool>().lambda().in(CustomerPrivatePool::getId, ids));
- List<SalesLedger> salesLedgers = salesLedgerMapper.selectList(new QueryWrapper<SalesLedger>().lambda().in(SalesLedger::getCustomerId, customerPrivatePools.stream().map(CustomerPrivatePool::getCustomerId).collect(Collectors.toList())));
- if (!CollectionUtils.isEmpty(salesLedgers)) {
- throw new RuntimeException("瀹㈡埛鏈夐攢鍞悎鍚岋紝璇峰厛鍒犻櫎閿�鍞悎鍚�");
- }
- if (CollectionUtils.isEmpty(customerPrivatePools)) {
- throw new RuntimeException("瀹㈡埛涓嶅瓨鍦�");
- }
- customerFollowUpService.remove(new QueryWrapper<CustomerFollowUp>().lambda().in(CustomerFollowUp::getCustomerPrivatePoolId, customerPrivatePools.stream().map(CustomerPrivatePool::getCustomerId).collect(Collectors.toList())));
- customerReturnVisitService.remove(new QueryWrapper<CustomerReturnVisit>().lambda().in(CustomerReturnVisit::getCustomerPrivatePoolId, customerPrivatePools.stream().map(CustomerPrivatePool::getCustomerId).collect(Collectors.toList())));
- customerPrivatePools.stream().forEach(customerPrivatePool -> {
- customerPrivatePool.setDeleteFlag(1);
- customerPrivatePoolMapper.updateById(customerPrivatePool);
- });
- return 1;
-
- }
-
- @Override
- public R importData(MultipartFile file) {
- try {
- List<CustomerPrivate> existingList = customerPrivateMapper.selectList(null);
- 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("瀵煎叆瀹屾垚锛屾垚鍔�" + successCount + "鏉★紝璺宠繃閲嶅" + skipCount + "鏉�");
- } catch (Exception e) {
- e.printStackTrace();
- return R.fail("瀵煎叆澶辫触锛�" + e.getMessage());
- }
- }
-}
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 c30f4f8..d826a94 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
@@ -10,7 +10,6 @@
import com.ruoyi.basic.dto.CustomerDto;
import com.ruoyi.basic.dto.CustomerFollowUpDto;
import com.ruoyi.basic.mapper.CustomerMapper;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
import com.ruoyi.basic.pojo.*;
import com.ruoyi.basic.service.CustomerFollowUpFileService;
import com.ruoyi.basic.service.CustomerFollowUpService;
@@ -20,22 +19,20 @@
import com.ruoyi.basic.vo.CustomerVo;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.sales.mapper.SalesLedgerMapper;
import com.ruoyi.sales.pojo.SalesLedger;
-import lombok.RequiredArgsConstructor;
+import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
-
-import java.time.LocalDate;
-import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors;
@@ -48,16 +45,21 @@
* @date 2025-05-07
*/
@Service
-@RequiredArgsConstructor
+@AllArgsConstructor
@Slf4j
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements ICustomerService {
- private final SalesLedgerMapper salesLedgerMapper;
- private final CustomerPrivatePoolMapper customerPrivatePoolMapper;
- private final CustomerMapper customerMapper;
+ @Autowired
+ private SalesLedgerMapper salesLedgerMapper;
+ @Autowired
+ private CustomerMapper customerMapper;
- private final CustomerFollowUpService customerFollowUpService;
- private final CustomerReturnVisitService customerReturnVisitService;
-
+ @Autowired
+ private CustomerFollowUpService customerFollowUpService;
+ @Autowired
+ private CustomerFollowUpFileService customerFollowUpFileService;
+ @Autowired
+ private CustomerReturnVisitService customerReturnVisitService;
+ @Autowired
private CustomerUserService customerUserService;
/**
@@ -165,13 +167,13 @@
private Map<Long, CustomerFollowUp> getLatestFollowUpMap(List<Long> customerIds) {
List<CustomerFollowUp> followUps = customerFollowUpService.list(
new LambdaQueryWrapper<CustomerFollowUp>()
- .in(CustomerFollowUp::getCustomerPrivatePoolId, customerIds)
+ .in(CustomerFollowUp::getCustomerId, customerIds)
.orderByDesc(CustomerFollowUp::getFollowUpTime)
);
return followUps.stream()
.collect(Collectors.toMap(
- CustomerFollowUp::getCustomerPrivatePoolId,
+ CustomerFollowUp::getCustomerId,
followUp -> followUp,
(existing, replacement) -> existing
));
@@ -229,13 +231,18 @@
if (!assignedPools.isEmpty()) {
throw new RuntimeException("瀹㈡埛妗f涓嬫湁宸插垎閰嶇殑鍏捣瀹㈡埛锛岃鍏堟敹鍥�");
}
- // 鍒犻櫎瀹㈡埛鐨勫悓鏃朵篃闇�瑕佸垹闄ゅ搴旂殑瀹㈡埛璺熼殢銆侀檮浠跺拰鍥炶鎻愰啋
+ // 鍒犻櫎瀹㈡埛鐨勫悓鏃朵篃闇�瑕佸垹闄ゅ搴旂殑瀹㈡埛璺熼殢銆侀檮浠跺拰鍥炶鎻愰啋
for (Long id : ids) {
customerFollowUpService.deleteByCustomerId(id);
customerReturnVisitService.deleteByCustomerId(id);
+ // 鍒犻櫎瀹㈡埛鐨勫叡浜叧绯�
+ customerUserService.remove(
+ new QueryWrapper<CustomerUser>().lambda()
+ .eq(CustomerUser::getCustomerId, id)
+ );
}
- customerMapper.delete(new QueryWrapper<Customer>().lambda().in(Customer::getId, idList));
+ // 鍒犻櫎瀹㈡埛涓昏〃鏁版嵁
return customerMapper.deleteBatchIds(idList);
}
@@ -247,17 +254,26 @@
}
@Override
- public List<Customer> selectCustomerLists(Customer customer) {
- return customerMapper.selectList(null);
+ public List<CustomerVo> selectCustomerLists(CustomerDto customer) {
+ LoginUser loginUser = SecurityUtils.getLoginUser();
+ Long loginUserId = loginUser.getUserId();
+ return customerMapper.list(customer, loginUserId);
}
@Override
- public AjaxResult importData(MultipartFile file) {
+ public AjaxResult importData(MultipartFile file, Integer type) {
try {
ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
List<Customer> userList = util.importExcel(file.getInputStream());
if (CollectionUtils.isEmpty(userList)) {
return AjaxResult.warn("妯℃澘閿欒鎴栧鍏ユ暟鎹负绌�");
+ }
+
+ // 鏍规嵁 type 鍙傛暟璁剧疆瀹㈡埛绫诲瀷锛堢娴�/鍏捣锛�
+ if (type != null) {
+ userList.forEach(customer -> {
+ customer.setType(type);
+ });
}
this.saveOrUpdateBatch(userList);
return AjaxResult.success(true);
@@ -306,7 +322,7 @@
customer.setUsageStatus(0L);
customer.setUsageUser(0L);
customerMapper.updateById(customer);
-
+
// 鍒犻櫎璇ュ鎴风殑鎵�鏈夊叡浜叧绯�
customerUserService.remove(
new QueryWrapper<CustomerUser>().lambda()
@@ -376,4 +392,4 @@
}
return sb.toString();
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java b/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java
index 9a795c4..b72b3af 100644
--- a/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java
+++ b/src/main/java/com/ruoyi/sales/pojo/SalesQuotation.java
@@ -3,7 +3,7 @@
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
-import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@@ -16,55 +16,58 @@
public class SalesQuotation {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
- @Schema(description = "鎶ヤ环鍗曠紪鍙�")
+ @ApiModelProperty(value = "鎶ヤ环鍗曠紪鍙�")
@Excel(name = "鎶ヤ环鍗曠紪鍙�")
private String quotationNo;
- @Schema(description = "瀹㈡埛鍚嶇О")
+ @ApiModelProperty(value = "瀹㈡埛鍚嶇О")
@Excel(name = "瀹㈡埛鍚嶇О")
private String customer;
- @Schema(description = "涓氬姟鍛�")
+ @ApiModelProperty(value = "瀹㈡埛id")
+ private Long customerId;
+
+ @ApiModelProperty(value = "涓氬姟鍛�")
@Excel(name = "涓氬姟鍛�")
private String salesperson;
- @Schema(description = "鎶ヤ环鏃ユ湡")
+ @ApiModelProperty(value = "鎶ヤ环鏃ユ湡")
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Excel(name = "鎶ヤ环鏃ユ湡", width = 30, dateFormat = "yyyy-MM-dd")
private LocalDate quotationDate;
- @Schema(description = "鏈夋晥鏈熻嚦")
+ @ApiModelProperty(value = "鏈夋晥鏈熻嚦")
@JsonFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Excel(name = "鏈夋晥鏈熻嚦", width = 30, dateFormat = "yyyy-MM-dd")
private LocalDate validDate;
- @Schema(description = "浠樻鏂瑰紡")
+ @ApiModelProperty(value = "浠樻鏂瑰紡")
private String paymentMethod;
- @Schema(description = "浜よ揣鍛ㄦ湡澶╂暟")
+ @ApiModelProperty(value = "浜よ揣鍛ㄦ湡澶╂暟")
private String deliveryPeriod;
- @Schema(description = "鐘舵��")
+ @ApiModelProperty(value = "鐘舵��")
private String status;
- @Schema(description = "鎶ヤ环鎬婚噾棰�")
+ @ApiModelProperty(value = "鎶ヤ环鎬婚噾棰�")
@Excel(name = "鎶ヤ环閲戦")
private BigDecimal totalAmount;
- @Schema(description = "澶囨敞")
+ @ApiModelProperty(value = "澶囨敞")
private String remark;
- @Schema(description = "鍒涘缓鏃堕棿")
+ @ApiModelProperty(value = "鍒涘缓鏃堕棿")
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
- @Schema(description = "淇敼鏃堕棿")
+ @ApiModelProperty(value = "淇敼鏃堕棿")
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
- @Schema(description = "鍒涘缓鐢ㄦ埛")
+ @ApiModelProperty(value = "鍒涘缓鐢ㄦ埛")
@TableField(fill = FieldFill.INSERT)
private Integer createUser;
- @Schema(description = "淇敼鐢ㄦ埛")
+ @ApiModelProperty(value = "淇敼鐢ㄦ埛")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Integer updateUser;
- @Schema(description = "绉熸埛ID")
+ @ApiModelProperty(value = "绉熸埛ID")
@TableField(fill = FieldFill.INSERT)
private Long tenantId;
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index ccbe035..3b0cc55 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -9,15 +9,10 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.service.AccountIncomeService;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.dto.StorageBlobVO;
-import com.ruoyi.basic.enums.ApplicationTypeEnum;
-import com.ruoyi.basic.enums.RecordTypeEnum;
import com.ruoyi.basic.mapper.CustomerMapper;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
+import com.ruoyi.basic.mapper.ProductMapper;
import com.ruoyi.basic.mapper.ProductModelMapper;
import com.ruoyi.basic.pojo.Customer;
-import com.ruoyi.basic.utils.FileUtil;
import com.ruoyi.common.enums.FileNameType;
import com.ruoyi.common.enums.SaleEnum;
import com.ruoyi.common.exception.base.BaseException;
@@ -29,9 +24,8 @@
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.other.mapper.TempFileMapper;
-import com.ruoyi.production.mapper.ProductionProductInputMapper;
-import com.ruoyi.production.mapper.ProductionProductMainMapper;
-import com.ruoyi.production.mapper.ProductionProductOutputMapper;
+import com.ruoyi.other.pojo.TempFile;
+import com.ruoyi.production.mapper.*;
import com.ruoyi.production.service.ProductionProductMainService;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.domain.SysUser;
@@ -44,11 +38,12 @@
import com.ruoyi.sales.mapper.*;
import com.ruoyi.sales.pojo.*;
import com.ruoyi.sales.service.ISalesLedgerService;
-import com.ruoyi.sales.vo.SalesLedgerVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.FilenameUtils;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.DefaultRedisScript;
@@ -56,10 +51,15 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
+import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.RoundingMode;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
@@ -82,26 +82,52 @@
private static final String LOCK_PREFIX = "contract_no_lock:";
private static final long LOCK_WAIT_TIMEOUT = 10; // 閿佺瓑寰呰秴鏃舵椂闂达紙绉掞級
private static final long LOCK_EXPIRE_TIME = 30; // 閿佽嚜鍔ㄨ繃鏈熸椂闂达紙绉掞級
+ private final AccountIncomeService accountIncomeService;
private final SalesLedgerMapper salesLedgerMapper;
private final CustomerMapper customerMapper;
private final SalesLedgerProductMapper salesLedgerProductMapper;
private final SalesLedgerProductServiceImpl salesLedgerProductServiceImpl;
private final CommonFileMapper commonFileMapper;
+ private final TempFileMapper tempFileMapper;
private final ReceiptPaymentMapper receiptPaymentMapper;
private final ShippingInfoServiceImpl shippingInfoServiceImpl;
private final CommonFileServiceImpl commonFileService;
private final ShippingInfoMapper shippingInfoMapper;
private final InvoiceLedgerMapper invoiceLedgerMapper;
+ private final SalesLedgerSchedulingMapper salesLedgerSchedulingMapper;
+ private final SalesLedgerWorkMapper salesLedgerWorkMapper;
+ private final SalesLedgerProductionAccountingMapper salesLedgerProductionAccountingMapper;
private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
private final InvoiceRegistrationMapper invoiceRegistrationMapper;
- private final ProductModelMapper productModelMapper;
+ private final ProductOrderMapper productOrderMapper;
+ private final ProcessRouteMapper processRouteMapper;
+ private final ProductProcessRouteMapper productProcessRouteMapper;
+ private final ProcessRouteItemMapper processRouteItemMapper;
+ private final ProductProcessRouteItemMapper productProcessRouteItemMapper;
+ private final ProductWorkOrderMapper productWorkOrderMapper;
+ private final ProductionProductMainMapper productionProductMainMapper;
+ private final ProductionProductOutputMapper productionProductOutputMapper;
+ private final ProductionProductInputMapper productionProductInputMapper;
+ private final QualityInspectMapper qualityInspectMapper;
private final RedisTemplate<String, String> redisTemplate;
- private final SysDeptMapper sysDeptMapper;
- private final ProductionProductMainService productionProductMainService;
- private final PurchaseReturnOrderProductsMapper purchaseReturnOrderProductsMapper;
- private final SysUserMapper sysUserMapper;
- private final CustomerPrivatePoolMapper customerPrivatePoolMapper;
- private final FileUtil fileUtil;
+ @Autowired
+ private SysDeptMapper sysDeptMapper;
+ @Value("${file.upload-dir}")
+ private String uploadDir;
+ @Autowired
+ private ProductModelMapper productModelMapper;
+
+ @Autowired
+ private ProductMapper productMapper;
+ @Autowired
+ private ProductStructureMapper productStructureMapper;
+ @Autowired
+ private ProductionProductMainService productionProductMainService;
+ @Autowired
+ private PurchaseReturnOrderProductsMapper purchaseReturnOrderProductsMapper;
+ ;
+ @Autowired
+ private SysUserMapper sysUserMapper;
@Override
public List<SalesLedger> selectSalesLedgerList(SalesLedgerDto salesLedgerDto) {
@@ -185,9 +211,6 @@
resultDto.setProductData(products);
resultDto.setSalesLedgerFiles(salesLedgerFiles);
}
- // 5. 鏌ヨ闄勪欢
- List<StorageBlobVO> StorageBlobVOs = fileUtil.getStorageBlobVOsByRecordTypeAndRecordId(RecordTypeEnum.SALES_LEDGER, salesLedger.getId());
- resultDto.setStorageBlobVOs(StorageBlobVOs);
return resultDto;
}
@@ -311,7 +334,7 @@
}
@Override
- public IPage<SalesLedgerVo> selectSalesLedgerListPage(Page page, SalesLedgerDto salesLedgerDto) {
+ public IPage<SalesLedger> selectSalesLedgerListPage(Page page, SalesLedgerDto salesLedgerDto) {
return salesLedgerMapper.selectSalesLedgerListPage(page, salesLedgerDto);
}
@@ -514,7 +537,7 @@
List<Long> productIds = products.stream()
.map(SalesLedgerProduct::getId)
.collect(Collectors.toList());
- //鍒犻櫎鐢熶骇璁″垝
+ //鍒犻櫎鐢熶骇鏁版嵁
salesLedgerProductServiceImpl.deleteProductionData(productIds);
// 鎵归噺鍒犻櫎浜у搧瀛愯〃
@@ -569,43 +592,122 @@
@Override
@Transactional(rollbackFor = Exception.class)
public int addOrUpdateSalesLedger(SalesLedgerDto salesLedgerDto) {
- // 1. 鏍¢獙瀹㈡埛淇℃伅
- CustomerPrivatePoolDto customer = customerPrivatePoolMapper.selectInfo(salesLedgerDto.getCustomerId());
- if (customer == null) {
- throw new BaseException("瀹㈡埛涓嶅瓨鍦�");
+ try {
+ // 1. 鏍¢獙瀹㈡埛淇℃伅
+ Customer customer = customerMapper.selectById(salesLedgerDto.getCustomerId());
+ if (customer == null) {
+ throw new BaseException("瀹㈡埛涓嶅瓨鍦�");
+ }
+
+ // 2. DTO杞珽ntity
+ SalesLedger salesLedger = convertToEntity(salesLedgerDto);
+ salesLedger.setCustomerName(customer.getCustomerName());
+ salesLedger.setTenantId(customer.getTenantId());
+ // 3. 鏂板鎴栨洿鏂颁富琛�
+ if (salesLedger.getId() == null) {
+ String contractNo = generateSalesContractNo();
+ salesLedger.setSalesContractNo(contractNo);
+ salesLedgerMapper.insert(salesLedger);
+ } else {
+ salesLedgerMapper.updateById(salesLedger);
+ }
+
+ // 4. 澶勭悊瀛愯〃鏁版嵁
+ List<SalesLedgerProduct> productList = salesLedgerDto.getProductData();
+ if (productList != null && !productList.isEmpty()) {
+ handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class, salesLedgerDto.getType()));
+ updateMainContractAmount(
+ salesLedger.getId(),
+ productList,
+ SalesLedgerProduct::getTaxInclusiveTotalPrice,
+ salesLedgerMapper,
+ SalesLedger.class
+ );
+ }
+
+ // 5. 杩佺Щ涓存椂鏂囦欢鍒版寮忕洰褰�
+ if (salesLedgerDto.getTempFileIds() != null && !salesLedgerDto.getTempFileIds().isEmpty()) {
+ migrateTempFilesToFormal(salesLedger.getId(), salesLedgerDto.getTempFileIds());
+ }
+ return 1;
+ } catch (IOException e) {
+ throw new BaseException("鏂囦欢杩佺Щ澶辫触: " + e.getMessage());
+ }
+ }
+
+ /**
+ * 灏嗕复鏃舵枃浠惰縼绉诲埌姝e紡鐩綍
+ *
+ * @param businessId 涓氬姟ID锛堥攢鍞彴璐D锛�
+ * @param tempFileIds 涓存椂鏂囦欢ID鍒楄〃
+ * @throws IOException 鏂囦欢鎿嶄綔寮傚父
+ */
+ private void migrateTempFilesToFormal(Long businessId, List<String> tempFileIds) throws IOException {
+ if (CollectionUtils.isEmpty(tempFileIds)) {
+ return;
}
- // 2. DTO杞珽ntity
- SalesLedger salesLedger = convertToEntity(salesLedgerDto);
- salesLedger.setCustomerName(customer.getCustomerName());
- salesLedger.setTenantId(customer.getTenantId());
- // 3. 鏂板鎴栨洿鏂颁富琛�
- if (salesLedger.getId() == null) {
- String contractNo = generateSalesContractNo();
- salesLedger.setSalesContractNo(contractNo);
- salesLedgerMapper.insert(salesLedger);
- } else {
- salesLedgerMapper.updateById(salesLedger);
+ // 鏋勫缓姝e紡鐩綍璺緞锛堟寜涓氬姟绫诲瀷鍜屾棩鏈熷垎缁勶級
+ String formalDir = uploadDir + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
+
+ Path formalDirPath = Paths.get(formalDir);
+
+ // 纭繚姝e紡鐩綍瀛樺湪锛堥�掑綊鍒涘缓锛�
+ if (!Files.exists(formalDirPath)) {
+ Files.createDirectories(formalDirPath);
}
- // 4. 澶勭悊瀛愯〃鏁版嵁
- List<SalesLedgerProduct> productList = salesLedgerDto.getProductData();
- if (productList != null && !productList.isEmpty()) {
- handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class, salesLedgerDto.getType()));
- updateMainContractAmount(
- salesLedger.getId(),
- productList,
- SalesLedgerProduct::getTaxInclusiveTotalPrice,
- salesLedgerMapper,
- SalesLedger.class
- );
- }
+ for (String tempFileId : tempFileIds) {
+ // 鏌ヨ涓存椂鏂囦欢璁板綍
+ TempFile tempFile = tempFileMapper.selectById(tempFileId);
+ if (tempFile == null) {
+ log.warn("涓存椂鏂囦欢涓嶅瓨鍦紝璺宠繃澶勭悊: {}", tempFileId);
+ continue;
+ }
- // 5. 淇濆瓨鏂囦欢
- if (salesLedgerDto.getStorageBlobDTOs() != null && !salesLedgerDto.getStorageBlobDTOs().isEmpty()) {
- fileUtil.saveStorageAttachment(ApplicationTypeEnum.FILE, RecordTypeEnum.SALES_LEDGER, salesLedger.getId(), salesLedgerDto.getStorageBlobDTOs());
+ // 鏋勫缓姝e紡鏂囦欢鍚嶏紙鍖呭惈涓氬姟ID鍜屾椂闂存埑锛岄伩鍏嶅啿绐侊級
+ String originalFilename = tempFile.getOriginalName();
+ String fileExtension = FilenameUtils.getExtension(originalFilename);
+ String formalFilename = businessId + "_" +
+ System.currentTimeMillis() + "_" +
+ UUID.randomUUID().toString().substring(0, 8) +
+ (StringUtils.hasText(fileExtension) ? "." + fileExtension : "");
+
+ Path formalFilePath = formalDirPath.resolve(formalFilename);
+
+ try {
+ // 鎵ц鏂囦欢杩佺Щ锛堜娇鐢ㄥ師瀛愭搷浣滅‘淇濆畨鍏ㄦ�э級
+// Files.move(
+// Paths.get(tempFile.getTempPath()),
+// formalFilePath,
+// StandardCopyOption.REPLACE_EXISTING,
+// StandardCopyOption.ATOMIC_MOVE
+// );
+ // 鍘熷瓙绉诲姩澶辫触锛屼娇鐢ㄥ鍒�+鍒犻櫎
+ Files.copy(Paths.get(tempFile.getTempPath()), formalFilePath, StandardCopyOption.REPLACE_EXISTING);
+ Files.deleteIfExists(Paths.get(tempFile.getTempPath()));
+ log.info("鏂囦欢杩佺Щ鎴愬姛: {} -> {}", tempFile.getTempPath(), formalFilePath);
+
+ // 鏇存柊鏂囦欢璁板綍锛堝叧鑱斿埌涓氬姟ID锛�
+ CommonFile fileRecord = new CommonFile();
+ fileRecord.setCommonId(businessId);
+ fileRecord.setName(originalFilename);
+ fileRecord.setUrl(formalFilePath.toString());
+ fileRecord.setCreateTime(LocalDateTime.now());
+ //閿�鍞�
+ fileRecord.setType(FileNameType.SALE.getValue());
+ commonFileMapper.insert(fileRecord);
+
+ // 鍒犻櫎涓存椂鏂囦欢璁板綍
+ tempFileMapper.deleteById(tempFile);
+
+ log.info("鏂囦欢杩佺Щ鎴愬姛: {} -> {}", tempFile.getTempPath(), formalFilePath);
+ } catch (IOException e) {
+ log.error("鏂囦欢杩佺Щ澶辫触: {}", tempFile.getTempPath(), e);
+ // 鍙�夋嫨鍥炴粴浜嬪姟鎴栬褰曞け璐ユ枃浠�
+ throw new IOException("鏂囦欢杩佺Щ寮傚父", e);
+ }
}
- return 1;
}
// 鏂囦欢杩佺Щ鏂规硶
diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
index 2bcb92b..d3fefb6 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesQuotationServiceImpl.java
@@ -11,8 +11,6 @@
import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl;
import com.ruoyi.approve.bean.vo.ApproveGetAndUpdateVo;
import com.ruoyi.approve.bean.vo.ApproveProcessVO;
-import com.ruoyi.basic.dto.CustomerPrivatePoolDto;
-import com.ruoyi.basic.mapper.CustomerPrivatePoolMapper;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
diff --git a/src/main/resources/mapper/basic/CustomerMapper.xml b/src/main/resources/mapper/basic/CustomerMapper.xml
index 982f70f..57dea6c 100644
--- a/src/main/resources/mapper/basic/CustomerMapper.xml
+++ b/src/main/resources/mapper/basic/CustomerMapper.xml
@@ -54,5 +54,57 @@
</where>
</select>
-
+ <select id="list" resultType="com.ruoyi.basic.vo.CustomerVo">
+ select
+ c.*,
+ u.user_name usage_user_name,
+ (
+ select group_concat(u2.user_name separator ', ')
+ from customer_user cu
+ left join sys_user u2 on cu.user_id = u2.user_id
+ where cu.customer_id = c.id
+ and cu.user_id != c.usage_user
+ ) as together_user_names,
+ (
+ select group_concat(cu.user_id separator ',')
+ from customer_user cu
+ where cu.customer_id = c.id
+ and cu.user_id != c.usage_user
+ ) as user_ids_str
+ from customer c
+ left join sys_user u on c.usage_user = u.user_id
+ <where>
+ <if test="c.ids != null and c.ids.length > 0">
+ and c.id in
+ <foreach collection="c.ids" item="id" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </if>
+ <if test="c.customerName != null and c.customerName != ''">
+ and customer_name like concat('%', #{c.customerName}, '%')
+ </if>
+ <if test="c.customerType != null and c.customerType != ''">
+ and customer_type = #{c.customerType}
+ </if>
+ <!-- 鍏捣鏌ヨ锛歵ype = 1锛堝叕娴峰鎴凤級-->
+ <if test="c.type != null and c.type == 1">
+ and type = #{c.type}
+ </if>
+ <!-- 绉佹捣鏌ヨ锛歵ype = 0锛堢娴峰鎴凤級鎴栬�� type = 1锛堝叕娴峰鎴凤級涓斿凡琚垎閰嶏紝骞朵笖鏄嚜宸遍鐢ㄣ�佽嚜宸卞垱寤烘垨鑰呭叡浜粰鑷繁鐨勫鎴� -->
+ <if test="c.type != null and c.type == 0">
+ and (
+ (type = #{c.type} or (type = 1 and is_assigned = 1))
+ and (
+ c.usage_user = #{loginUserId}
+ or c.create_user = #{loginUserId}
+ or exists (
+ select 1 from customer_user cu
+ where cu.customer_id = c.id
+ and cu.user_id = #{loginUserId}
+ )
+ )
+ )
+ </if>
+ </where>
+ </select>
</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/basic/CustomerPrivateMapper.xml b/src/main/resources/mapper/basic/CustomerPrivateMapper.xml
deleted file mode 100644
index 9a8d68c..0000000
--- a/src/main/resources/mapper/basic/CustomerPrivateMapper.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.basic.mapper.CustomerPrivateMapper">
-
- <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
- <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.CustomerPrivate">
- <id column="id" property="id" />
- <result column="customer_name" property="customerName" />
- <result column="taxpayer_identification_number" property="taxpayerIdentificationNumber" />
- <result column="company_address" property="companyAddress" />
- <result column="company_phone" property="companyPhone" />
- <result column="contact_person" property="contactPerson" />
- <result column="contact_phone" property="contactPhone" />
- <result column="maintainer" property="maintainer" />
- <result column="maintenance_time" property="maintenanceTime" />
- <result column="tenant_id" property="tenantId" />
- <result column="basic_bank_account" property="basicBankAccount" />
- <result column="bank_account" property="bankAccount" />
- <result column="bank_code" property="bankCode" />
- <result column="customer_type" property="customerType" />
- <result column="create_user" property="createUser" />
- <result column="dept_id" property="deptId" />
- </resultMap>
-
-</mapper>
diff --git a/src/main/resources/mapper/basic/CustomerPrivatePoolMapper.xml b/src/main/resources/mapper/basic/CustomerPrivatePoolMapper.xml
deleted file mode 100644
index c7f33c8..0000000
--- a/src/main/resources/mapper/basic/CustomerPrivatePoolMapper.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.basic.mapper.CustomerPrivatePoolMapper">
-
- <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
- <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.CustomerPrivatePool">
- <id column="id" property="id" />
- <result column="customer_id" property="customerId" />
- <result column="bound_id" property="boundId" />
- <result column="create_user" property="createUser" />
- <result column="update_user" property="updateUser" />
- <result column="create_time" property="createTime" />
- <result column="update_time" property="updateTime" />
- </resultMap>
- <select id="listPage" resultType="com.ruoyi.basic.dto.CustomerPrivatePoolDto">
- select cpp.id,
- cpp.bound_id,
- cpp.type,
- coalesce(c.id, cp.id) as customer_id,
- coalesce(c.customer_name, cp.customer_name) as customer_name,
- coalesce(c.customer_type, cp.customer_type) as customer_type,
- coalesce(c.taxpayer_identification_number, cp.taxpayer_identification_number) as taxpayer_identification_number,
- coalesce(c.company_address, cp.company_address) as company_address,
- coalesce(c.company_phone, cp.company_phone) as company_phone,
- coalesce(c.contact_person, cp.contact_person) as contact_person,
- coalesce(c.contact_phone, cp.contact_phone) as contact_phone,
- coalesce(c.maintainer, cp.maintainer) as maintainer,
- coalesce(c.maintenance_time, cp.maintenance_time) as maintenance_time,
- coalesce(c.tenant_id, cp.tenant_id) as tenant_id,
- coalesce(c.basic_bank_account, cp.basic_bank_account) as basic_bank_account,
- coalesce(c.bank_account, cp.bank_account) as bank_account,
- coalesce(c.bank_code, cp.bank_code) as bank_code
- from customer_private_pool cpp
- left join customer c on c.id = cpp.customer_id and cpp.type = 1
- left join customer_private cp on cp.id = cpp.customer_id and cpp.type = 0
- <where>
- cpp.delete_flag = 0
- <if test="c.customerName != null and c.customerName != ''">
- and (c.customer_name like concat('%', #{c.customerName}, '%') or cp.customer_name like concat('%', #{c.customerName}, '%'))
- </if>
- <if test="c.customerType != null">
- and c.customer_type = #{c.customerType}
- </if>
- <if test="c.boundId != null">
- and cpp.bound_id = #{c.boundId}
- </if>
-
- </where>
- order by cpp.id desc
- </select>
- <select id="selectInfo" resultType="com.ruoyi.basic.dto.CustomerPrivatePoolDto">
- select cpp.id,
- cpp.bound_id,
- cpp.type,
- coalesce(c.id, cp.id) as customer_id,
- coalesce(c.customer_name, cp.customer_name) as customer_name,
- coalesce(c.customer_type, cp.customer_type) as customer_type,
- coalesce(c.taxpayer_identification_number, cp.taxpayer_identification_number) as taxpayer_identification_number,
- coalesce(c.company_address, cp.company_address) as company_address,
- coalesce(c.company_phone, cp.company_phone) as company_phone,
- coalesce(c.contact_person, cp.contact_person) as contact_person,
- coalesce(c.contact_phone, cp.contact_phone) as contact_phone,
- coalesce(c.maintainer, cp.maintainer) as maintainer,
- coalesce(c.maintenance_time, cp.maintenance_time) as maintenance_time,
- coalesce(c.tenant_id, cp.tenant_id) as tenant_id,
- coalesce(c.basic_bank_account, cp.basic_bank_account) as basic_bank_account,
- coalesce(c.bank_account, cp.bank_account) as bank_account,
- coalesce(c.bank_code, cp.bank_code) as bank_code
- from customer_private_pool cpp
- left join customer c on c.id = cpp.customer_id and cpp.type = 1
- left join customer_private cp on cp.id = cpp.customer_id and cpp.type = 0
- <where>
- <if test="id != null">
- and cpp.id = #{id}
- </if>
- </where>
- </select>
- <select id="selectInfos" resultType="com.ruoyi.basic.dto.CustomerPrivatePoolDto">
- select cpp.id,
- cpp.bound_id,
- cpp.type,
- coalesce(c.id, cp.id) as customer_id,
- coalesce(c.customer_name, cp.customer_name) as customer_name,
- coalesce(c.customer_type, cp.customer_type) as customer_type,
- coalesce(c.taxpayer_identification_number, cp.taxpayer_identification_number) as taxpayer_identification_number,
- coalesce(c.company_address, cp.company_address) as company_address,
- coalesce(c.company_phone, cp.company_phone) as company_phone,
- coalesce(c.contact_person, cp.contact_person) as contact_person,
- coalesce(c.contact_phone, cp.contact_phone) as contact_phone,
- coalesce(c.maintainer, cp.maintainer) as maintainer,
- coalesce(c.maintenance_time, cp.maintenance_time) as maintenance_time,
- coalesce(c.tenant_id, cp.tenant_id) as tenant_id,
- coalesce(c.basic_bank_account, cp.basic_bank_account) as basic_bank_account,
- coalesce(c.bank_account, cp.bank_account) as bank_account,
- coalesce(c.bank_code, cp.bank_code) as bank_code
- from customer_private_pool cpp
- left join customer c on c.id = cpp.customer_id and cpp.type = 1
- left join customer_private cp on cp.id = cpp.customer_id and cpp.type = 0
- </select>
-
-</mapper>
--
Gitblit v1.9.3