From 9f99167aba3720cb731298511f8423b18c08e5a2 Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期四, 05 三月 2026 15:51:53 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New' into dev_New
---
src/main/java/com/ruoyi/aftersalesservice/pojo/AfterSalesService.java | 21
src/main/java/com/ruoyi/aftersalesservice/dto/AfterSalesServiceNewDto.java | 21
src/main/java/com/ruoyi/basic/service/CustomerFollowUpService.java | 55 +
src/main/resources/mapper/sales/SalesLedgerMapper.xml | 10
src/main/java/com/ruoyi/basic/pojo/Customer.java | 16
src/main/resources/mapper/projectManagement/RolesMapper.xml | 17
src/main/java/com/ruoyi/aftersalesservice/service/AfterSalesServiceService.java | 13
src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java | 227 +++++++
src/main/java/com/ruoyi/common/utils/OrderUtils.java | 34 +
src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java | 90 ++
src/main/java/com/ruoyi/basic/service/impl/ReturnVisitReminderService.java | 53 +
src/main/java/com/ruoyi/aftersalesservice/dto/AfterSalesServiceExeclDto.java | 5
src/main/java/com/ruoyi/basic/dto/CustomerFollowUpDto.java | 25
src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpFileServiceImpl.java | 20
src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java | 3
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java | 35 +
src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java | 139 ++++
src/main/resources/application-dev.yml | 2
src/main/java/com/ruoyi/basic/pojo/CustomerFollowUpFile.java | 81 ++
src/main/java/com/ruoyi/aftersalesservice/dto/CountDto.java | 11
src/main/java/com/ruoyi/aftersalesservice/controller/AfterSalesServiceController.java | 71 +
src/main/java/com/ruoyi/sales/controller/SalesQuotationController.java | 11
src/main/java/com/ruoyi/projectManagement/service/impl/RolesServiceImpl.java | 24
src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java | 92 ++
src/main/java/com/ruoyi/projectManagement/service/RolesService.java | 10
src/main/java/com/ruoyi/projectManagement/mapper/RolesMapper.java | 9
src/main/resources/mapper/aftersalesservice/AfterSalesServiceMapper.xml | 21
src/main/java/com/ruoyi/basic/service/ICustomerService.java | 14
src/main/java/com/ruoyi/sales/dto/ShippingInfoDto.java | 4
src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java | 2
src/main/resources/mapper/sales/ShippingInfoMapper.xml | 5
src/main/java/com/ruoyi/basic/service/CustomerFollowUpFileService.java | 16
src/main/java/com/ruoyi/projectManagement/pojo/Roles.java | 60 +
src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java | 144 ++++
src/main/java/com/ruoyi/projectManagement/controller/RolesController.java | 52 +
src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java | 78 ++
src/main/java/com/ruoyi/basic/dto/CustomerDto.java | 24
src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java | 85 ++
src/main/java/com/ruoyi/basic/mapper/CustomerReturnVisitMapper.java | 16
src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java | 92 ++
src/main/java/com/ruoyi/basic/controller/CustomerController.java | 4
src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java | 28
src/main/java/com/ruoyi/basic/dto/CustomerReturnVisitDto.java | 54 +
src/main/java/com/ruoyi/basic/mapper/CustomerFollowUpFileMapper.java | 16
src/main/java/com/ruoyi/basic/mapper/CustomerFollowUpMapper.java | 16
src/main/java/com/ruoyi/aftersalesservice/mapper/AfterSalesServiceMapper.java | 9
src/main/java/com/ruoyi/basic/service/CustomerReturnVisitService.java | 25
47 files changed, 1,799 insertions(+), 61 deletions(-)
diff --git a/src/main/java/com/ruoyi/aftersalesservice/controller/AfterSalesServiceController.java b/src/main/java/com/ruoyi/aftersalesservice/controller/AfterSalesServiceController.java
index fee8947..95e9999 100644
--- a/src/main/java/com/ruoyi/aftersalesservice/controller/AfterSalesServiceController.java
+++ b/src/main/java/com/ruoyi/aftersalesservice/controller/AfterSalesServiceController.java
@@ -2,19 +2,19 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ruoyi.aftersalesservice.dto.AfterSalesServiceDto;
+import com.ruoyi.aftersalesservice.dto.AfterSalesServiceExeclDto;
+import com.ruoyi.aftersalesservice.dto.AfterSalesServiceNewDto;
import com.ruoyi.aftersalesservice.pojo.AfterSalesService;
import com.ruoyi.aftersalesservice.service.AfterSalesServiceService;
-import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.equipmentenergyconsumption.pojo.EquipmentEnergyConsumption;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.mapper.SysUserMapper;
-import com.ruoyi.purchase.dto.VatDto;
+import com.ruoyi.sales.dto.SalesLedgerDto;
+import com.ruoyi.sales.service.ISalesLedgerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
@@ -25,6 +25,7 @@
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Collectors;
/**
* @author :yys
@@ -42,11 +43,14 @@
@Autowired
private SysUserMapper sysUserMapper;
+ @Autowired
+ private ISalesLedgerService salesLedgerService;
+
@GetMapping("/listPage")
@ApiOperation("鍞悗鏈嶅姟-鍒嗛〉鏌ヨ")
@Log(title = "鍞悗鏈嶅姟-鍒嗛〉鏌ヨ", businessType = BusinessType.OTHER)
- public AjaxResult listPage(Page page, AfterSalesService afterSalesService) {
- IPage<AfterSalesService> listPage = afterSalesServiceService.listPage(page, afterSalesService);
+ public AjaxResult listPage(Page page, AfterSalesServiceNewDto afterSalesService) {
+ IPage<AfterSalesServiceNewDto> listPage = afterSalesServiceService.listPage(page, afterSalesService);
return AjaxResult.success(listPage);
}
@@ -55,16 +59,16 @@
@ApiOperation("鍞悗鏈嶅姟-鍙嶉鐧昏")
public void export(HttpServletResponse response) {
Page page = new Page(-1,-1);
- AfterSalesService afterSalesService = new AfterSalesService();
- IPage<AfterSalesService> listPage = afterSalesServiceService.listPage(page, afterSalesService);
- List<AfterSalesServiceDto> list = new ArrayList<>();
+ AfterSalesServiceNewDto afterSalesService = new AfterSalesServiceNewDto();
+ IPage<AfterSalesServiceNewDto> listPage = afterSalesServiceService.listPage(page, afterSalesService);
+ List<AfterSalesServiceExeclDto> list = new ArrayList<>();
listPage.getRecords().forEach(item -> {
- AfterSalesServiceDto dto = new AfterSalesServiceDto();
+ AfterSalesServiceExeclDto dto = new AfterSalesServiceExeclDto();
BeanUtils.copyProperties(item, dto);
dto.setStatusName(item.getStatus().toString());
list.add(dto);
});
- ExcelUtil<AfterSalesServiceDto> util = new ExcelUtil<AfterSalesServiceDto>(AfterSalesServiceDto.class);
+ ExcelUtil<AfterSalesServiceExeclDto> util = new ExcelUtil<AfterSalesServiceExeclDto>(AfterSalesServiceExeclDto.class);
util.exportExcel(response, list , "鍙嶉鐧昏");
}
@@ -73,32 +77,33 @@
@ApiOperation("鍞悗鏈嶅姟-鍞悗澶勭悊")
public void exportTwo(HttpServletResponse response) {
Page page = new Page(-1,-1);
- AfterSalesService afterSalesService = new AfterSalesService();
- IPage<AfterSalesService> listPage = afterSalesServiceService.listPage(page, afterSalesService);
+ AfterSalesServiceNewDto afterSalesService = new AfterSalesServiceNewDto();
+ IPage<AfterSalesServiceNewDto> listPage = afterSalesServiceService.listPage(page, afterSalesService);
listPage.getRecords().forEach(item -> {
item.setStatusName(item.getStatus().toString());
});
- ExcelUtil<AfterSalesService> util = new ExcelUtil<AfterSalesService>(AfterSalesService.class);
+ ExcelUtil<AfterSalesServiceNewDto> util = new ExcelUtil<AfterSalesServiceNewDto>(AfterSalesServiceNewDto.class);
util.exportExcel(response, listPage.getRecords() , "鍞悗澶勭悊");
}
@PostMapping("/add")
@ApiOperation("鍞悗鏈嶅姟-鏂板")
@Log(title = "鍞悗鏈嶅姟-鏂板", businessType = BusinessType.INSERT)
- public AjaxResult add(@RequestBody AfterSalesService afterSalesService) {
- afterSalesService.setStatus(1);
- SysUser sysUser = sysUserMapper.selectUserById(afterSalesService.getCheckUserId());
- if(sysUser == null) throw new RuntimeException("瀹℃牳浜轰笉瀛樺湪");
- afterSalesService.setCheckNickName(sysUser.getNickName());
- boolean save = afterSalesServiceService.save(afterSalesService);
- return save ? AjaxResult.success() : AjaxResult.error();
+ public AjaxResult add(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) {
+ return afterSalesServiceService.addAfterSalesServiceDto(afterSalesServiceNewDto) ? AjaxResult.success() : AjaxResult.error();
}
@PostMapping("/update")
@ApiOperation("鍞悗鏈嶅姟-淇敼")
@Log(title = "鍞悗鏈嶅姟-淇敼", businessType = BusinessType.UPDATE)
- public AjaxResult update(@RequestBody AfterSalesService afterSalesService) {
- boolean update = afterSalesServiceService.updateById(afterSalesService);
+ public AjaxResult update(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) {
+ if (afterSalesServiceNewDto.getProductModelIdList() != null && afterSalesServiceNewDto.getProductModelIdList().isEmpty() ) {
+ String productModelIds = afterSalesServiceNewDto.getProductModelIdList().stream()
+ .map(String::valueOf)
+ .collect(Collectors.joining(","));
+ afterSalesServiceNewDto.setProductModelIds(productModelIds);
+ }
+ boolean update = afterSalesServiceService.updateById(afterSalesServiceNewDto);
return update ? AjaxResult.success() : AjaxResult.error();
}
@@ -129,4 +134,24 @@
}
+ @GetMapping("listSalesLedger")
+ @ApiOperation("鍞悗鏈嶅姟-鑾峰彇閿�鍞彴璐�")
+ public AjaxResult listSalesLedger(SalesLedgerDto salesLedgerDto, Page page) {
+ IPage<SalesLedgerDto> list = salesLedgerService.listSalesLedger(salesLedgerDto,page);
+ return AjaxResult.success(list);
+ }
+
+
+ @GetMapping("getById")
+ @ApiOperation("鍞悗鏈嶅姟-鏍规嵁id鑾峰彇璇︽儏")
+ public AjaxResult getById(Long id) {
+ return AjaxResult.success(afterSalesServiceService.getAfterSalesServiceNewDtoById(id));
+ }
+
+ @ApiOperation("鍞悗鏈嶅姟-缁熻宸ュ崟鎯呭喌")
+ @GetMapping("count")
+ public AjaxResult count() {
+ return AjaxResult.success(afterSalesServiceService.countAfterSalesService());
+ }
+
}
diff --git a/src/main/java/com/ruoyi/aftersalesservice/dto/AfterSalesServiceDto.java b/src/main/java/com/ruoyi/aftersalesservice/dto/AfterSalesServiceExeclDto.java
similarity index 88%
rename from src/main/java/com/ruoyi/aftersalesservice/dto/AfterSalesServiceDto.java
rename to src/main/java/com/ruoyi/aftersalesservice/dto/AfterSalesServiceExeclDto.java
index 8a7c70b..c8526c7 100644
--- a/src/main/java/com/ruoyi/aftersalesservice/dto/AfterSalesServiceDto.java
+++ b/src/main/java/com/ruoyi/aftersalesservice/dto/AfterSalesServiceExeclDto.java
@@ -1,14 +1,11 @@
package com.ruoyi.aftersalesservice.dto;
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
-import java.time.LocalDateTime;
import java.util.Date;
/**
@@ -16,7 +13,7 @@
* @date : 2025/11/3 11:14
*/
@Data
-public class AfterSalesServiceDto {
+public class AfterSalesServiceExeclDto {
/**
* 鐘舵�� 1-寰呭鐞� 2-宸插鐞�
diff --git a/src/main/java/com/ruoyi/aftersalesservice/dto/AfterSalesServiceNewDto.java b/src/main/java/com/ruoyi/aftersalesservice/dto/AfterSalesServiceNewDto.java
new file mode 100644
index 0000000..9e35764
--- /dev/null
+++ b/src/main/java/com/ruoyi/aftersalesservice/dto/AfterSalesServiceNewDto.java
@@ -0,0 +1,21 @@
+package com.ruoyi.aftersalesservice.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.ruoyi.aftersalesservice.pojo.AfterSalesService;
+import com.ruoyi.sales.dto.SalesLedgerDto;
+import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class AfterSalesServiceNewDto extends AfterSalesService {
+
+ @ApiModelProperty("浜у搧鍨嬪彿ID鏁扮粍")
+ private List<Long> productModelIdList;
+
+ private SalesLedgerDto salesLedgerDto;
+
+ private String salesContractNo;
+}
diff --git a/src/main/java/com/ruoyi/aftersalesservice/dto/CountDto.java b/src/main/java/com/ruoyi/aftersalesservice/dto/CountDto.java
new file mode 100644
index 0000000..6ada2bc
--- /dev/null
+++ b/src/main/java/com/ruoyi/aftersalesservice/dto/CountDto.java
@@ -0,0 +1,11 @@
+package com.ruoyi.aftersalesservice.dto;
+
+import lombok.Data;
+
+@Data
+public class CountDto {
+
+ private Integer status ;
+
+ private Integer count ;
+}
diff --git a/src/main/java/com/ruoyi/aftersalesservice/mapper/AfterSalesServiceMapper.java b/src/main/java/com/ruoyi/aftersalesservice/mapper/AfterSalesServiceMapper.java
index 1c09a0e..1f439fc 100644
--- a/src/main/java/com/ruoyi/aftersalesservice/mapper/AfterSalesServiceMapper.java
+++ b/src/main/java/com/ruoyi/aftersalesservice/mapper/AfterSalesServiceMapper.java
@@ -3,8 +3,13 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.aftersalesservice.dto.AfterSalesServiceNewDto;
+import com.ruoyi.aftersalesservice.dto.CountDto;
import com.ruoyi.aftersalesservice.pojo.AfterSalesService;
import org.apache.ibatis.annotations.Param;
+
+import java.util.HashMap;
+import java.util.List;
/**
* @author :yys
@@ -18,5 +23,7 @@
* @param afterSalesService
* @return
*/
- IPage<AfterSalesService> listPage(Page page,@Param("req") AfterSalesService afterSalesService);
+ IPage<AfterSalesServiceNewDto> listPage(Page page, @Param("req") AfterSalesServiceNewDto afterSalesService);
+
+ List<CountDto> countAfterSalesService();
}
diff --git a/src/main/java/com/ruoyi/aftersalesservice/pojo/AfterSalesService.java b/src/main/java/com/ruoyi/aftersalesservice/pojo/AfterSalesService.java
index 67ccd01..e11722e 100644
--- a/src/main/java/com/ruoyi/aftersalesservice/pojo/AfterSalesService.java
+++ b/src/main/java/com/ruoyi/aftersalesservice/pojo/AfterSalesService.java
@@ -33,8 +33,12 @@
@ApiModelProperty("鐘舵�� 1-寰呭鐞� 2-宸插鐞�")
private Integer status;
+ @ApiModelProperty("鍞悗鍗曞彿")
+ private String afterSalesServiceNo;
+
@Excel(name = "鐘舵��", readConverterExp = "1=寰呭鐞�,2=宸插鐞�")
+ @TableField(exist = false)
private String statusName;
/**
@@ -138,5 +142,22 @@
private String deptName;
+ @ApiModelProperty("鍞悗绫诲瀷")
+ private String serviceType;
+
+ @ApiModelProperty("绱ф�ョ▼搴�")
+ private String urgency;
+
+ @ApiModelProperty("閿�鍞彴璐D")
+ private Long salesLedgerId;
+
+ @ApiModelProperty("鍒嗛厤浜篒D")
+ private Long distributionUserId;
+
+
+ @ApiModelProperty("浜у搧鍨嬪彿IDs")
+ private String productModelIds;
+
+
}
diff --git a/src/main/java/com/ruoyi/aftersalesservice/service/AfterSalesServiceService.java b/src/main/java/com/ruoyi/aftersalesservice/service/AfterSalesServiceService.java
index f5ba2d7..f67b757 100644
--- a/src/main/java/com/ruoyi/aftersalesservice/service/AfterSalesServiceService.java
+++ b/src/main/java/com/ruoyi/aftersalesservice/service/AfterSalesServiceService.java
@@ -3,7 +3,11 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.aftersalesservice.dto.AfterSalesServiceNewDto;
+import com.ruoyi.aftersalesservice.dto.CountDto;
import com.ruoyi.aftersalesservice.pojo.AfterSalesService;
+
+import java.util.List;
/**
* @author :yys
@@ -18,5 +22,12 @@
* @param afterSalesService
* @return
*/
- IPage<AfterSalesService> listPage(Page page, AfterSalesService afterSalesService);
+ IPage<AfterSalesServiceNewDto> listPage(Page page, AfterSalesServiceNewDto afterSalesService);
+
+ boolean addAfterSalesServiceDto(AfterSalesServiceNewDto afterSalesServiceNewDto);
+
+ AfterSalesServiceNewDto getAfterSalesServiceNewDtoById(Long id);
+
+ List<CountDto> countAfterSalesService();
+
}
diff --git a/src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java b/src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java
index 4f8237f..68dfa7f 100644
--- a/src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java
+++ b/src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java
@@ -1,17 +1,34 @@
package com.ruoyi.aftersalesservice.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.aftersalesservice.dto.AfterSalesServiceNewDto;
+import com.ruoyi.aftersalesservice.dto.CountDto;
import com.ruoyi.aftersalesservice.mapper.AfterSalesServiceMapper;
import com.ruoyi.aftersalesservice.pojo.AfterSalesService;
import com.ruoyi.aftersalesservice.service.AfterSalesServiceService;
+import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.system.domain.SysDept;
+import com.ruoyi.project.system.domain.SysUser;
import com.ruoyi.project.system.mapper.SysDeptMapper;
+import com.ruoyi.project.system.mapper.SysUserMapper;
+import com.ruoyi.sales.dto.SalesLedgerDto;
+import com.ruoyi.sales.pojo.SalesLedger;
+import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import com.ruoyi.sales.service.ISalesLedgerProductService;
+import com.ruoyi.sales.service.ISalesLedgerService;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
/**
* @author :yys
@@ -27,14 +44,71 @@
@Autowired
private SysDeptMapper sysDeptMapper;
+ @Autowired
+ private SysUserMapper sysUserMapper;
+ @Autowired
+ private ISalesLedgerProductService salesLedgerProductService;
+ @Autowired
+ private ISalesLedgerService salesLedgerService;
+
@Override
- public IPage<AfterSalesService> listPage(Page page, AfterSalesService afterSalesService) {
+ public IPage<AfterSalesServiceNewDto> listPage(Page page, AfterSalesServiceNewDto afterSalesService) {
Long tenantId = SecurityUtils.getLoginUser().getTenantId();
SysDept sysDept = sysDeptMapper.selectDeptById(tenantId);
- IPage<AfterSalesService> afterSalesServiceIPage = afterSalesServiceMapper.listPage(page, afterSalesService);
+ IPage<AfterSalesServiceNewDto> afterSalesServiceIPage = afterSalesServiceMapper.listPage(page, afterSalesService);
afterSalesServiceIPage.getRecords().forEach(item -> {
item.setDeptName(sysDept.getDeptName());
});
return afterSalesServiceIPage;
}
+
+ @Override
+ public boolean addAfterSalesServiceDto(AfterSalesServiceNewDto afterSalesServiceNewDto) {
+ afterSalesServiceNewDto.setStatus(1);
+ if (afterSalesServiceNewDto.getProductModelIdList() != null && afterSalesServiceNewDto.getProductModelIdList().isEmpty() ) {
+ String productModelIds = afterSalesServiceNewDto.getProductModelIdList().stream()
+ .map(String::valueOf)
+ .collect(Collectors.joining(","));
+ afterSalesServiceNewDto.setProductModelIds(productModelIds);
+ }
+ SysUser sysUser = sysUserMapper.selectUserById(afterSalesServiceNewDto.getCheckUserId());
+ if(sysUser == null) throw new RuntimeException("瀹℃牳浜轰笉瀛樺湪");
+ afterSalesServiceNewDto.setCheckNickName(sysUser.getNickName());
+ if (StringUtils.isEmpty(afterSalesServiceNewDto.getAfterSalesServiceNo())) {
+ String string = OrderUtils.countAfterServiceTodayByCreateTime(afterSalesServiceMapper, "SH_");
+ afterSalesServiceNewDto.setAfterSalesServiceNo(string);
+ }
+ return this.save(afterSalesServiceNewDto);
+ }
+
+ @Override
+ public AfterSalesServiceNewDto getAfterSalesServiceNewDtoById(Long id) {
+ AfterSalesService afterSalesService = afterSalesServiceMapper.selectById(id);
+ SalesLedger byId = salesLedgerService.getById(afterSalesService.getSalesLedgerId());
+ List<Long> collect = Arrays.stream(afterSalesService.getProductModelIds().split(",")).map(Long::valueOf).collect(Collectors.toList());
+ List<SalesLedgerProduct> list = salesLedgerProductService.list(new QueryWrapper<SalesLedgerProduct>().lambda().in(SalesLedgerProduct::getId, collect));
+ AfterSalesServiceNewDto afterSalesServiceNewDto = new AfterSalesServiceNewDto();
+ BeanUtils.copyProperties(afterSalesService, afterSalesServiceNewDto);
+ SalesLedgerDto salesLedgerDto = new SalesLedgerDto();
+ BeanUtils.copyProperties(byId, salesLedgerDto);
+ salesLedgerDto.setProductData( list);
+ afterSalesServiceNewDto.setSalesLedgerDto(salesLedgerDto);
+ return afterSalesServiceNewDto;
+ }
+
+ @Override
+ public List<CountDto> countAfterSalesService() {
+ List<CountDto> stringIntegerHashMap = afterSalesServiceMapper.countAfterSalesService();
+ Integer total = 0;
+ for (CountDto countDto : stringIntegerHashMap) {
+ total += countDto.getCount();
+ }
+ CountDto countDto = new CountDto();
+ countDto.setStatus(3);
+ countDto.setCount(total);
+ stringIntegerHashMap.add(countDto);
+
+ return stringIntegerHashMap;
+
+ }
}
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerController.java b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
index e89e203..94c4007 100644
--- a/src/main/java/com/ruoyi/basic/controller/CustomerController.java
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerController.java
@@ -32,7 +32,7 @@
* 鏌ヨ瀹㈡埛妗f鍒楄〃
*/
@GetMapping("/list")
- public IPage<Customer> list(Page page, Customer customer) {
+ public IPage<Customer> list(Page<Customer> page, Customer customer) {
return customerService.selectCustomerList(page, customer);
}
@@ -76,7 +76,7 @@
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
- return success(customerService.selectCustomerById(id));
+ return success(customerService.selectCustomerDetailById(id));
}
/**
diff --git a/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java b/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java
new file mode 100644
index 0000000..d863c8a
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/controller/CustomerFollowUpController.java
@@ -0,0 +1,144 @@
+package com.ruoyi.basic.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.pojo.CustomerFollowUp;
+import com.ruoyi.basic.pojo.CustomerReturnVisit;
+import com.ruoyi.basic.service.CustomerFollowUpService;
+import com.ruoyi.basic.service.CustomerReturnVisitService;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * <br>
+ * 瀹㈡埛璺熻繘鎺у埗灞�
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/04 14:45
+ */
+@RestController
+@RequestMapping("/basic/customer-follow")
+public class CustomerFollowUpController extends BaseController {
+
+ @Autowired
+ private CustomerFollowUpService customerFollowUpService;
+
+ @Autowired
+ private CustomerReturnVisitService customerReturnVisitService;
+
+ /**
+ * 鏌ヨ瀹㈡埛璺熻繘鍒楄〃
+ */
+ @GetMapping("/list")
+ @ApiOperation("鏌ヨ瀹㈡埛璺熻繘鍒楄〃")
+ public IPage<CustomerFollowUp> list(Page<CustomerFollowUp> page, CustomerFollowUp customerFollowUp) {
+ LambdaQueryWrapper<CustomerFollowUp> queryWrapper = new LambdaQueryWrapper<>();
+ 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);
+ }
+
+ /**
+ * 鑾峰彇瀹㈡埛璺熻繘璇︾粏淇℃伅
+ */
+ @ApiOperation("鑾峰彇瀹㈡埛璺熻繘璇︾粏淇℃伅")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Integer id) {
+ return AjaxResult.success(customerFollowUpService.getFollowUpWithFiles(id));
+ }
+
+ /**
+ * 鏂板瀹㈡埛璺熻繘
+ */
+ @PostMapping("/add")
+ @ApiOperation("鏂板瀹㈡埛璺熻繘")
+ @Log(title = "瀹㈡埛璺熻繘-鏂板", businessType = BusinessType.INSERT)
+ public AjaxResult add(@RequestBody CustomerFollowUp customerFollowUp) {
+ return toAjax(customerFollowUpService.insertCustomerFollowUp(customerFollowUp));
+ }
+
+ /**
+ * 淇敼瀹㈡埛璺熻繘
+ */
+ @PutMapping("/edit")
+ @ApiOperation("淇敼瀹㈡埛璺熻繘")
+ @Log(title = "瀹㈡埛璺熻繘-淇敼", businessType = BusinessType.UPDATE)
+ public AjaxResult edit(@RequestBody CustomerFollowUp customerFollowUp) {
+ return toAjax(customerFollowUpService.updateCustomerFollowUp(customerFollowUp));
+ }
+
+ /**
+ * 涓婁紶璺熻繘闄勪欢
+ */
+ @ApiOperation("涓婁紶璺熻繘闄勪欢")
+ @PostMapping("/upload/{followUpId}")
+ @Log(title = "瀹㈡埛璺熻繘-涓婁紶闄勪欢", businessType = BusinessType.INSERT)
+ public AjaxResult uploadFiles(@RequestParam("files") List<MultipartFile> files, @PathVariable Integer followUpId) {
+ customerFollowUpService.addFollowUpFiles(files, followUpId);
+ return AjaxResult.success();
+ }
+
+ /**
+ * 鍒犻櫎璺熻繘闄勪欢
+ */
+ @ApiOperation("鍒犻櫎璺熻繘闄勪欢")
+ @DeleteMapping("/file/{fileId}")
+ @Log(title = "瀹㈡埛璺熻繘-鍒犻櫎闄勪欢", businessType = BusinessType.DELETE)
+ public AjaxResult deleteFile(@PathVariable Integer fileId) {
+ customerFollowUpService.deleteFollowUpFile(fileId);
+ return AjaxResult.success();
+ }
+
+ /**
+ * 鍒犻櫎瀹㈡埛璺熻繘
+ */
+ @ApiOperation("鍒犻櫎瀹㈡埛璺熻繘")
+ @DeleteMapping("/{id}")
+ @Log(title = "瀹㈡埛璺熻繘-鍒犻櫎", businessType = BusinessType.DELETE)
+ public AjaxResult remove(@PathVariable Integer id) {
+ return toAjax(customerFollowUpService.deleteCustomerFollowUpById(id));
+ }
+
+ /**
+ * 鏂板/鏇存柊鍥炶鎻愰啋
+ */
+ @ApiOperation("鏂板/鏇存柊鍥炶鎻愰啋")
+ @PostMapping("/return-visit")
+ @Log(title = "鍥炶鎻愰啋-鏂板/鏇存柊", businessType = BusinessType.UPDATE)
+ public AjaxResult saveReturnVisit(@RequestBody CustomerReturnVisit customerReturnVisit) {
+ return toAjax(customerReturnVisitService.saveOrUpdateReturnVisit(customerReturnVisit));
+ }
+
+ /**
+ * 鑾峰彇鍥炶鎻愰啋璇︽儏
+ */
+ @ApiOperation("鑾峰彇鍥炶鎻愰啋璇︽儏")
+ @GetMapping("/return-visit/{customerId}")
+ public AjaxResult getReturnVisit(@PathVariable Integer customerId) {
+ return AjaxResult.success(customerReturnVisitService.getByCustomerId(customerId));
+ }
+
+ /**
+ * 鏍囪鍥炶鎻愰啋宸茶
+ */
+ @ApiOperation("鏍囪鍥炶鎻愰啋宸茶")
+ @PutMapping("/return-visit/read/{id}")
+ @Log(title = "鍥炶鎻愰啋-鏍囪宸茶", businessType = BusinessType.UPDATE)
+ public AjaxResult markAsRead(@PathVariable Long id) {
+ customerReturnVisitService.markAsRead(id);
+ return AjaxResult.success();
+ }
+
+}
diff --git a/src/main/java/com/ruoyi/basic/dto/CustomerDto.java b/src/main/java/com/ruoyi/basic/dto/CustomerDto.java
new file mode 100644
index 0000000..a8161da
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/dto/CustomerDto.java
@@ -0,0 +1,24 @@
+package com.ruoyi.basic.dto;
+
+import com.ruoyi.basic.pojo.Customer;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * <br>
+ * 瀹㈡埛妗fDTO锛屽寘鍚窡杩涜褰�
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/05 09:40
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CustomerDto extends Customer {
+
+ private List<CustomerFollowUpDto> followUpList;
+
+}
diff --git a/src/main/java/com/ruoyi/basic/dto/CustomerFollowUpDto.java b/src/main/java/com/ruoyi/basic/dto/CustomerFollowUpDto.java
new file mode 100644
index 0000000..cdfc967
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/dto/CustomerFollowUpDto.java
@@ -0,0 +1,25 @@
+package com.ruoyi.basic.dto;
+
+import com.ruoyi.basic.pojo.CustomerFollowUp;
+import com.ruoyi.basic.pojo.CustomerFollowUpFile;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * <br>
+ * 瀹㈡埛璺熻繘DTO锛屽寘鍚檮浠跺垪琛�
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/05 09:41
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class CustomerFollowUpDto extends CustomerFollowUp {
+
+ private List<CustomerFollowUpFile> fileList;
+
+}
diff --git a/src/main/java/com/ruoyi/basic/dto/CustomerReturnVisitDto.java b/src/main/java/com/ruoyi/basic/dto/CustomerReturnVisitDto.java
new file mode 100644
index 0000000..f3a7fc4
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/dto/CustomerReturnVisitDto.java
@@ -0,0 +1,54 @@
+package com.ruoyi.basic.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * <br>
+ * 瀹㈡埛鍥炶鎻愰啋Dto
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/05 10:26
+ */
+@Data
+public class CustomerReturnVisitDto {
+ /**
+ * 鍥炶鎻愰啋涓婚敭ID
+ */
+ private Long id;
+
+ /**
+ * 鍏宠仈瀹㈡埛ID (瀵瑰簲 customer 琛ㄧ殑 id)
+ */
+ private Integer customerId;
+
+ /**
+ * 鎻愰啋寮�鍏崇姸鎬� (0:鍏抽棴, 1:寮�鍚�)
+ */
+ private Integer isEnabled;
+
+ /**
+ * 鎻愰啋鐨勫叿浣撳唴瀹�
+ */
+ private String content;
+
+ /**
+ * 璁惧畾鐨勬彁閱掕Е鍙戞椂闂�
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime reminderTime;
+
+ /**
+ * 澶勭悊鐘舵�� (0:寰呮彁閱�, 1:宸叉彁閱�)
+ */
+ private Integer isCompleted;
+
+ /**
+ * 鎺ユ敹鎻愰啋鐨勭敤鎴稩D
+ */
+ private Long remindUserId;
+}
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerFollowUpFileMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerFollowUpFileMapper.java
new file mode 100644
index 0000000..f45feaa
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/mapper/CustomerFollowUpFileMapper.java
@@ -0,0 +1,16 @@
+package com.ruoyi.basic.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.basic.pojo.CustomerFollowUpFile;
+
+/**
+ * <br>
+ * 瀹㈡埛璺熻繘闄勪欢mapper
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/04 14:52
+ */
+public interface CustomerFollowUpFileMapper extends BaseMapper<CustomerFollowUpFile> {
+}
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerFollowUpMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerFollowUpMapper.java
new file mode 100644
index 0000000..11f8f9e
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/mapper/CustomerFollowUpMapper.java
@@ -0,0 +1,16 @@
+package com.ruoyi.basic.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.basic.pojo.CustomerFollowUp;
+
+/**
+ * <br>
+ * 瀹㈡埛璺熻繘mapper
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/04 14:46
+ */
+public interface CustomerFollowUpMapper extends BaseMapper<CustomerFollowUp> {
+}
diff --git a/src/main/java/com/ruoyi/basic/mapper/CustomerReturnVisitMapper.java b/src/main/java/com/ruoyi/basic/mapper/CustomerReturnVisitMapper.java
new file mode 100644
index 0000000..f65e452
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/mapper/CustomerReturnVisitMapper.java
@@ -0,0 +1,16 @@
+package com.ruoyi.basic.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.basic.pojo.CustomerReturnVisit;
+
+/**
+ * <br>
+ * 瀹㈡埛鍥炶鎻愰啋mapper
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/04 17:57
+ */
+public interface CustomerReturnVisitMapper extends BaseMapper<CustomerReturnVisit> {
+}
diff --git a/src/main/java/com/ruoyi/basic/pojo/Customer.java b/src/main/java/com/ruoyi/basic/pojo/Customer.java
index 511e691..8a35b2b 100644
--- a/src/main/java/com/ruoyi/basic/pojo/Customer.java
+++ b/src/main/java/com/ruoyi/basic/pojo/Customer.java
@@ -1,6 +1,7 @@
package com.ruoyi.basic.pojo;
import java.io.Serializable;
+import java.time.LocalDateTime;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.*;
@@ -33,6 +34,21 @@
private String customerName;
/** 瀹㈡埛鍒嗙被锛氶浂鍞鎴凤紝杩涢攢鍟嗗鎴� */
+
+ /**
+ * 璺熻繘绋嬪害
+ */
+ @Excel(name = "璺熻繘绋嬪害")
+ @TableField(exist = false)
+ private String followUpLevel;
+
+ /**
+ * 璺熻繘鏃堕棿
+ */
+ @Excel(name = "璺熻繘鏃堕棿")
+ @TableField(exist = false)
+ private LocalDateTime followUpTime;
+
@Excel(name = "瀹㈡埛鍒嗙被")
private String customerType;
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java b/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java
new file mode 100644
index 0000000..a64bf66
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUp.java
@@ -0,0 +1,85 @@
+package com.ruoyi.basic.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <br>
+ * 瀹㈡埛璺熻繘杩涘害琛�
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/04 14:37
+ */
+@Data
+@TableName(value = "customer_follow_up")
+public class CustomerFollowUp implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 涓婚敭ID
+ */
+ @TableId(type = IdType.AUTO)
+ private Integer id;
+
+ /**
+ * 鍏宠仈鐨勫鎴稩D
+ */
+ private Integer customerId;
+
+ /**
+ * 璺熻繘鏂瑰紡
+ */
+ private String followUpMethod;
+
+ /**
+ * 璺熻繘绋嬪害
+ */
+ private String followUpLevel;
+
+ /**
+ * 璺熻繘鏃堕棿
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime followUpTime;
+
+ /**
+ * 璺熻繘浜哄鍚�
+ */
+ private String followerUserName;
+
+ /**
+ * 璺熻繘鍐呭
+ */
+ private String content;
+
+ /**
+ * 璺熻繘浜篒D
+ */
+ private Long followerUserId;
+
+ /**
+ * 绉熸埛ID
+ */
+ private Long tenantId;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ /**
+ * 鏇存柊鏃堕棿
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUpFile.java b/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUpFile.java
new file mode 100644
index 0000000..2e33d08
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/pojo/CustomerFollowUpFile.java
@@ -0,0 +1,81 @@
+package com.ruoyi.basic.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <br>
+ * 瀹㈡埛璺熻繘闄勪欢琛�
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/04 14:41
+ */
+@Data
+@TableName(value = "customer_follow_up_file")
+public class CustomerFollowUpFile implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 涓婚敭
+ */
+ @TableId(type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 璺熻繘璁板綍ID
+ */
+ private Integer followUpId;
+
+ /**
+ * 鏂囦欢鍚嶇О
+ */
+ private String fileName;
+
+ /**
+ * 鏂囦欢璁块棶鍦板潃
+ */
+ private String fileUrl;
+
+ /**
+ * 鏂囦欢澶у皬锛堝崟浣嶏細瀛楄妭锛�
+ */
+ private Long fileSize;
+
+ /**
+ * 鏂囦欢鍚庣紑
+ */
+ private String fileSuffix;
+
+ /**
+ * 涓婁紶鑰�
+ */
+ private Long createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ private LocalDateTime createTime;
+
+ /**
+ * 淇敼鑰�
+ */
+ private Long updateUser;
+
+ /**
+ * 淇敼鏃堕棿
+ */
+ private LocalDateTime updateTime;
+
+ /**
+ * 绉熸埛ID
+ */
+ private Long tenantId;
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java b/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java
new file mode 100644
index 0000000..9ddfc42
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/pojo/CustomerReturnVisit.java
@@ -0,0 +1,92 @@
+package com.ruoyi.basic.pojo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * <br>
+ * 瀹㈡埛鍥炶鎻愰啋
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/04 17:50
+ */
+@Data
+@TableName(value = "customer_return_visit")
+public class CustomerReturnVisit implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 涓婚敭ID
+ */
+ @TableId(type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 鍏宠仈瀹㈡埛ID
+ */
+ private Integer customerId;
+
+ /**
+ * 鎻愰啋寮�鍏� (0:鍏抽棴, 1:寮�鍚�)
+ */
+ private Integer isEnabled;
+
+ /**
+ * 鎻愰啋鍐呭
+ */
+ private String content;
+
+ /**
+ * 鎻愰啋鏃堕棿
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime reminderTime;
+
+ /**
+ * 澶勭悊鐘舵�� (0:寰呮彁閱�, 1:宸叉彁閱�)
+ */
+ private Integer isCompleted;
+
+ /**
+ * 鎺ユ敹鎻愰啋鐨勭敤鎴稩D
+ */
+ private Long remindUserId;
+
+ /**
+ * 绉熸埛ID
+ */
+ private Long tenantId;
+
+
+ /**
+ * 鍒涘缓鑰�
+ */
+ private Long createUser;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime createTime;
+
+ /**
+ * 淇敼鑰�
+ */
+ private Long updateUser;
+
+ /**
+ * 淇敼鏃堕棿
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private LocalDateTime updateTime;
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/service/CustomerFollowUpFileService.java b/src/main/java/com/ruoyi/basic/service/CustomerFollowUpFileService.java
new file mode 100644
index 0000000..e35054e
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/service/CustomerFollowUpFileService.java
@@ -0,0 +1,16 @@
+package com.ruoyi.basic.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.basic.pojo.CustomerFollowUpFile;
+
+/**
+ * <br>
+ * 瀹㈡埛璺熻繘闄勪欢鎺ュ彛
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/04 14:52
+ */
+public interface CustomerFollowUpFileService extends IService<CustomerFollowUpFile> {
+}
diff --git a/src/main/java/com/ruoyi/basic/service/CustomerFollowUpService.java b/src/main/java/com/ruoyi/basic/service/CustomerFollowUpService.java
new file mode 100644
index 0000000..25b5809
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/service/CustomerFollowUpService.java
@@ -0,0 +1,55 @@
+package com.ruoyi.basic.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.basic.dto.CustomerFollowUpDto;
+import com.ruoyi.basic.pojo.CustomerFollowUp;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * <br>
+ * 瀹㈡埛璺熻繘鎺ュ彛
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/04 14:48
+ */
+public interface CustomerFollowUpService extends IService<CustomerFollowUp> {
+ /**
+ * 鏂板瀹㈡埛璺熻繘
+ */
+ boolean insertCustomerFollowUp(CustomerFollowUp customerFollowUp);
+
+ /**
+ * 淇敼瀹㈡埛璺熻繘
+ */
+ int updateCustomerFollowUp(CustomerFollowUp customerFollowUp);
+
+ /**
+ * 鎵归噺鍒犻櫎瀹㈡埛璺熻繘
+ */
+ int deleteCustomerFollowUpById(Integer id);
+
+ /**
+ * 鏍规嵁瀹㈡埛ID鍒犻櫎鎵�鏈夎窡杩涜褰�
+ */
+ void deleteByCustomerId(Long customerId);
+
+ /**
+ * 娣诲姞璺熻繘闄勪欢
+ */
+ void addFollowUpFiles(List<MultipartFile> files, Integer followUpId);
+
+ /**
+ * 鍒犻櫎璺熻繘闄勪欢
+ */
+ void deleteFollowUpFile(Integer fileId);
+
+ /**
+ * 鑾峰彇璺熻繘璇︽儏
+ */
+ CustomerFollowUpDto getFollowUpWithFiles(Integer id);
+}
diff --git a/src/main/java/com/ruoyi/basic/service/CustomerReturnVisitService.java b/src/main/java/com/ruoyi/basic/service/CustomerReturnVisitService.java
new file mode 100644
index 0000000..de095a0
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/service/CustomerReturnVisitService.java
@@ -0,0 +1,25 @@
+package com.ruoyi.basic.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.basic.dto.CustomerReturnVisitDto;
+import com.ruoyi.basic.pojo.CustomerReturnVisit;
+
+/**
+ * <br>
+ * 瀹㈡埛鍥炶鎻愰啋鎺ュ彛
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/04 17:58
+ */
+public interface CustomerReturnVisitService extends IService<CustomerReturnVisit> {
+
+ int saveOrUpdateReturnVisit(CustomerReturnVisit customerReturnVisit);
+
+ CustomerReturnVisitDto getByCustomerId(Integer customerId);
+
+ void deleteByCustomerId(Long customerId);
+
+ void markAsRead(Long id);
+}
diff --git a/src/main/java/com/ruoyi/basic/service/ICustomerService.java b/src/main/java/com/ruoyi/basic/service/ICustomerService.java
index 35a9a63..989e474 100644
--- a/src/main/java/com/ruoyi/basic/service/ICustomerService.java
+++ b/src/main/java/com/ruoyi/basic/service/ICustomerService.java
@@ -3,11 +3,13 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.basic.dto.CustomerDto;
import com.ruoyi.basic.pojo.Customer;
import com.ruoyi.framework.web.domain.AjaxResult;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
+import java.util.Map;
/**
* 瀹㈡埛妗fService鎺ュ彛
@@ -25,12 +27,20 @@
Customer selectCustomerById(Long id);
/**
+ * 鏌ヨ瀹㈡埛璇︽儏锛堝惈璺熻繘璁板綍鍜岄檮浠讹級
+ *
+ * @param id 瀹㈡埛妗f涓婚敭
+ * @return 瀹㈡埛璇︽儏DTO
+ */
+ CustomerDto selectCustomerDetailById(Long id);
+
+ /**
* 鏌ヨ瀹㈡埛妗f鍒楄〃
*
* @param customer 瀹㈡埛妗f
* @return 瀹㈡埛妗f闆嗗悎
*/
- IPage<Customer> selectCustomerList(Page page, Customer customer);
+ IPage<Customer> selectCustomerList(Page<Customer> page, Customer customer);
/**
* 鏂板瀹㈡埛妗f
@@ -63,7 +73,7 @@
*
* @return 缁撴灉
*/
- List customerList(Customer customer);
+ List<Map<String, Object>> customerList(Customer customer);
List<Customer> selectCustomerLists(Customer customer);
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpFileServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpFileServiceImpl.java
new file mode 100644
index 0000000..48cbddb
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpFileServiceImpl.java
@@ -0,0 +1,20 @@
+package com.ruoyi.basic.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.mapper.CustomerFollowUpFileMapper;
+import com.ruoyi.basic.pojo.CustomerFollowUpFile;
+import com.ruoyi.basic.service.CustomerFollowUpFileService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <br>
+ * 瀹㈡埛鏍规嵁闄勪欢鎺ュ彛瀹炵幇绫�
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/04 14:53
+ */
+@Service
+public class CustomerFollowUpFileServiceImpl extends ServiceImpl<CustomerFollowUpFileMapper, CustomerFollowUpFile> implements CustomerFollowUpFileService {
+}
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
new file mode 100644
index 0000000..9f452ac
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerFollowUpServiceImpl.java
@@ -0,0 +1,227 @@
+package com.ruoyi.basic.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.dto.CustomerFollowUpDto;
+import com.ruoyi.basic.mapper.CustomerFollowUpMapper;
+import com.ruoyi.basic.pojo.CustomerFollowUp;
+import com.ruoyi.basic.pojo.CustomerFollowUpFile;
+import com.ruoyi.basic.service.CustomerFollowUpFileService;
+import com.ruoyi.basic.service.CustomerFollowUpService;
+import com.ruoyi.basic.service.ICustomerService;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
+
+import org.apache.commons.io.FilenameUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * <br>
+ * 瀹㈡埛鏍规嵁鎺ュ彛瀹炵幇绫�
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/04 14:48
+ */
+@Service
+public class CustomerFollowUpServiceImpl extends ServiceImpl<CustomerFollowUpMapper, CustomerFollowUp> implements CustomerFollowUpService {
+
+ @Autowired
+ private CustomerFollowUpFileService customerFollowUpFileService;
+
+ @Value("${file.upload-dir}")
+ private String uploadDir;
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public boolean insertCustomerFollowUp(CustomerFollowUp customerFollowUp) {
+ validateFollowUp(customerFollowUp);
+ Long currentUserId = SecurityUtils.getUserId();
+ Long currentTenantId = SecurityUtils.getLoginUser().getTenantId();
+
+ customerFollowUp.setFollowerUserId(currentUserId);
+ customerFollowUp.setCreateTime(LocalDateTime.now());
+ customerFollowUp.setTenantId(currentTenantId);
+
+ int result = baseMapper.insert(customerFollowUp);
+ if (result < 1) {
+ throw new ServiceException("瀹㈡埛璺熻繘鏁版嵁娣诲姞澶辫触");
+ }
+
+ return true;
+ }
+
+ @Override
+ public int updateCustomerFollowUp(CustomerFollowUp customerFollowUp) {
+ validateFollowUp(customerFollowUp);
+ customerFollowUp.setUpdateTime(LocalDateTime.now());
+ return baseMapper.updateById(customerFollowUp);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void addFollowUpFiles(List<MultipartFile> files, Integer followUpId) {
+ handleFollowUpFiles(files, followUpId);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void deleteFollowUpFile(Integer fileId) {
+ CustomerFollowUpFile file = customerFollowUpFileService.getById(fileId);
+ if (file != null) {
+ try {
+ Files.deleteIfExists(Paths.get(file.getFileUrl()));
+ } catch (Exception e) {
+ throw new ServiceException("鍒犻櫎鏂囦欢澶辫触锛�" + e.getMessage());
+ }
+ customerFollowUpFileService.removeById(fileId);
+ }
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int deleteCustomerFollowUpById(Integer id) {
+ if (id == null) {
+ throw new ServiceException("璺熻繘ID涓嶈兘涓虹┖");
+ }
+
+ List<CustomerFollowUpFile> files = customerFollowUpFileService.list(new LambdaQueryWrapper<CustomerFollowUpFile>()
+ .eq(CustomerFollowUpFile::getFollowUpId, id));
+
+ if (files != null && !files.isEmpty()) {
+ for (CustomerFollowUpFile file : files) {
+ deleteFollowUpFile(file.getId().intValue());
+ }
+ }
+
+ int result = baseMapper.deleteById(id);
+ if (result < 1) {
+ throw new ServiceException("瀹㈡埛璺熻繘璁板綍鍒犻櫎澶辫触");
+ }
+ return result;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void deleteByCustomerId(Long customerId) {
+ if (customerId == null) {
+ throw new ServiceException("瀹㈡埛ID涓嶈兘涓虹┖");
+ }
+
+ List<CustomerFollowUp> followUps = list(new LambdaQueryWrapper<CustomerFollowUp>()
+ .eq(CustomerFollowUp::getCustomerId, customerId));
+
+ if (followUps != null && !followUps.isEmpty()) {
+ for (CustomerFollowUp followUp : followUps) {
+ deleteCustomerFollowUpById(followUp.getId());
+ }
+ }
+ }
+
+ private void handleFollowUpFiles(List<MultipartFile> multipartFiles, Integer followUpId) {
+ if (multipartFiles == null || multipartFiles.isEmpty()) {
+ return;
+ }
+
+ Long currentUserId = SecurityUtils.getUserId();
+ Long currentTenantId = SecurityUtils.getLoginUser().getTenantId();
+ List<CustomerFollowUpFile> fileList = new ArrayList<>();
+
+ for (MultipartFile file : multipartFiles) {
+ if (file == null || file.isEmpty()) {
+ continue;
+ }
+ try {
+ String formalDir = uploadDir + "/" + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
+ Path formalDirPath = Paths.get(formalDir);
+
+ if (!Files.exists(formalDirPath)) {
+ Files.createDirectories(formalDirPath);
+ }
+
+ String originalFilename = file.getOriginalFilename();
+ String fileExtension = FilenameUtils.getExtension(originalFilename);
+ String formalFilename = followUpId + "_" +
+ System.currentTimeMillis() + "_" +
+ UUID.randomUUID().toString().substring(0, 8) +
+ (StringUtils.hasText(fileExtension) ? "." + fileExtension : "");
+
+ Path formalFilePath = formalDirPath.resolve(formalFilename);
+ file.transferTo(formalFilePath.toFile());
+
+ CustomerFollowUpFile followUpFile = new CustomerFollowUpFile();
+ followUpFile.setFollowUpId(followUpId);
+ followUpFile.setFileName(originalFilename);
+ followUpFile.setFileUrl(formalFilePath.toString());
+ followUpFile.setFileSize(file.getSize());
+ followUpFile.setFileSuffix(fileExtension);
+ followUpFile.setCreateUser(currentUserId);
+ followUpFile.setCreateTime(LocalDateTime.now());
+ followUpFile.setTenantId(currentTenantId);
+
+ fileList.add(followUpFile);
+ } catch (Exception e) {
+ throw new ServiceException("鏂囦欢 [" + file.getOriginalFilename() + "] 涓婁紶澶辫触锛�" + e.getMessage());
+ }
+ }
+ if (!fileList.isEmpty()) {
+ customerFollowUpFileService.saveBatch(fileList);
+ }
+ }
+
+ private void validateFollowUp(CustomerFollowUp followUp) {
+ if (followUp == null) {
+ throw new ServiceException("璺熻繘鏁版嵁涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isEmpty(followUp.getFollowUpMethod())) {
+ throw new ServiceException("璺熻繘鏂瑰紡涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isEmpty(followUp.getFollowUpLevel())) {
+ throw new ServiceException("璺熻繘绋嬪害涓嶈兘涓虹┖");
+ }
+ if (followUp.getFollowUpTime() == null) {
+ throw new ServiceException("璺熻繘鏃堕棿涓嶈兘涓虹┖");
+ }
+ if (StringUtils.isEmpty(followUp.getFollowerUserName())) {
+ throw new ServiceException("璺熻繘浜轰笉鑳戒负绌�");
+ }
+ if (StringUtils.isEmpty(followUp.getContent())) {
+ throw new ServiceException("璺熻繘鍐呭涓嶈兘涓虹┖");
+ }
+ }
+
+ @Override
+ public CustomerFollowUpDto getFollowUpWithFiles(Integer id) {
+ CustomerFollowUp followUp = baseMapper.selectById(id);
+ if (followUp == null) {
+ return null;
+ }
+
+ CustomerFollowUpDto dto = new CustomerFollowUpDto();
+ BeanUtils.copyProperties(followUp, dto);
+
+ List<CustomerFollowUpFile> fileList = customerFollowUpFileService.list(new LambdaQueryWrapper<CustomerFollowUpFile>()
+ .eq(CustomerFollowUpFile::getFollowUpId, id));
+ dto.setFileList(fileList);
+
+ return dto;
+ }
+}
diff --git a/src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java
new file mode 100644
index 0000000..0186349
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerReturnVisitServiceImpl.java
@@ -0,0 +1,139 @@
+package com.ruoyi.basic.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.dto.CustomerReturnVisitDto;
+import com.ruoyi.basic.mapper.CustomerReturnVisitMapper;
+import com.ruoyi.basic.pojo.CustomerReturnVisit;
+import com.ruoyi.basic.service.CustomerReturnVisitService;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.SecurityUtils;
+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.LocalDateTime;
+import java.util.List;
+
+/**
+ * <br>
+ * 瀹㈡埛鍥炶鎻愰啋鎺ュ彛瀹炵幇绫�
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/04 17:58
+ */
+@Service
+public class CustomerReturnVisitServiceImpl extends ServiceImpl<CustomerReturnVisitMapper, CustomerReturnVisit> implements CustomerReturnVisitService {
+
+ @Autowired
+ private ReturnVisitReminderService returnVisitReminderService;
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int saveOrUpdateReturnVisit(CustomerReturnVisit customerReturnVisit) {
+ validateReturnVisit(customerReturnVisit);
+ Long currentUserId = SecurityUtils.getUserId();
+ Long currentTenantId = SecurityUtils.getLoginUser().getTenantId();
+ if (customerReturnVisit.getId() != null) {
+ CustomerReturnVisit existing = baseMapper.selectById(customerReturnVisit.getId());
+ if (existing == null) {
+ throw new ServiceException("鍥炶鎻愰啋涓嶅瓨鍦�");
+ }
+ if (!existing.getTenantId().equals(currentTenantId)) {
+ throw new ServiceException("鏃犳潈闄愪慨鏀规鍥炶鎻愰啋");
+ }
+ customerReturnVisit.setUpdateUser(currentUserId);
+ customerReturnVisit.setUpdateTime(LocalDateTime.now());
+ int result = baseMapper.updateById(customerReturnVisit);
+
+ // 鏍规嵁鎻愰啋寮�鍏虫潵鍒ゆ柇闃熷垪淇℃伅鏂板鎴栧彇娑�
+ if (customerReturnVisit.getIsEnabled() == 1) {
+ returnVisitReminderService.scheduleReminder(customerReturnVisit.getId());
+ } else {
+ returnVisitReminderService.cancelReminder(customerReturnVisit.getId());
+ }
+ return result;
+ } else {
+ customerReturnVisit.setCreateUser(currentUserId);
+ customerReturnVisit.setCreateTime(LocalDateTime.now());
+ customerReturnVisit.setTenantId(currentTenantId);
+ int result = baseMapper.insert(customerReturnVisit);
+
+ if (customerReturnVisit.getIsEnabled() == 1) {
+ returnVisitReminderService.scheduleReminder(customerReturnVisit.getId());
+ }
+ return result;
+ }
+ }
+
+ @Override
+ public CustomerReturnVisitDto getByCustomerId(Integer customerId) {
+ if (customerId == null) {
+ throw new ServiceException("瀹㈡埛ID涓嶈兘涓虹┖");
+ }
+ LambdaQueryWrapper<CustomerReturnVisit> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(CustomerReturnVisit::getCustomerId, customerId);
+ CustomerReturnVisit returnVisit = baseMapper.selectOne(queryWrapper);
+
+ if (returnVisit == null) {
+ return null;
+ }
+
+ CustomerReturnVisitDto dto = new CustomerReturnVisitDto();
+ BeanUtils.copyProperties(returnVisit, dto);
+ return dto;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void deleteByCustomerId(Long customerId) {
+ if (customerId == null) {
+ throw new ServiceException("瀹㈡埛ID涓嶈兘涓虹┖");
+ }
+ LambdaQueryWrapper<CustomerReturnVisit> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(CustomerReturnVisit::getCustomerId, customerId);
+ List<CustomerReturnVisit> returnVisits = baseMapper.selectList(queryWrapper);
+
+ for (CustomerReturnVisit returnVisit : returnVisits) {
+ returnVisitReminderService.cancelReminder(returnVisit.getId());
+ }
+ baseMapper.delete(queryWrapper);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void markAsRead(Long id) {
+ if (id == null) {
+ throw new ServiceException("鍥炶鎻愰啋ID涓嶈兘涓虹┖");
+ }
+ CustomerReturnVisit returnVisit = baseMapper.selectById(id);
+ if (returnVisit == null) {
+ throw new ServiceException("鍥炶鎻愰啋涓嶅瓨鍦�");
+ }
+
+ CustomerReturnVisit updateObj = new CustomerReturnVisit();
+ updateObj.setId(id);
+ updateObj.setIsCompleted(1);
+ baseMapper.updateById(updateObj);
+ }
+
+ private void validateReturnVisit(CustomerReturnVisit returnVisit) {
+ if (returnVisit == null) {
+ throw new ServiceException("鍥炶鎻愰啋鏁版嵁涓嶈兘涓虹┖");
+ }
+ if (returnVisit.getCustomerId() == null) {
+ throw new ServiceException("瀹㈡埛ID涓嶈兘涓虹┖");
+ }
+ if (returnVisit.getReminderTime() == null) {
+ throw new ServiceException("鎻愰啋鏃堕棿涓嶈兘涓虹┖");
+ }
+ if (returnVisit.getIsEnabled() != null && returnVisit.getIsEnabled() == 1) {
+ if (returnVisit.getReminderTime().isBefore(LocalDateTime.now())) {
+ throw new ServiceException("鎻愰啋鏃堕棿涓嶈兘鏃╀簬褰撳墠鏃堕棿");
+ }
+ }
+ }
+}
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 f24a2d2..b7cb426 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/CustomerServiceImpl.java
@@ -7,8 +7,15 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.dto.CustomerDto;
+import com.ruoyi.basic.dto.CustomerFollowUpDto;
import com.ruoyi.basic.mapper.CustomerMapper;
import com.ruoyi.basic.pojo.Customer;
+import com.ruoyi.basic.pojo.CustomerFollowUp;
+import com.ruoyi.basic.pojo.CustomerFollowUpFile;
+import com.ruoyi.basic.service.CustomerFollowUpFileService;
+import com.ruoyi.basic.service.CustomerFollowUpService;
+import com.ruoyi.basic.service.CustomerReturnVisitService;
import com.ruoyi.basic.service.ICustomerService;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
@@ -20,7 +27,9 @@
import com.ruoyi.sales.pojo.SalesLedger;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+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;
@@ -44,6 +53,12 @@
private final SalesLedgerMapper salesLedgerMapper;
private CustomerMapper customerMapper;
+ private CustomerFollowUpService customerFollowUpService;
+
+ private CustomerFollowUpFileService customerFollowUpFileService;
+
+ private CustomerReturnVisitService customerReturnVisitService;
+
/**
* 鏌ヨ瀹㈡埛妗f
*
@@ -56,13 +71,57 @@
}
/**
+ * 鏌ヨ瀹㈡埛璇︽儏锛堝惈璺熻繘璁板綍鍜岄檮浠讹級
+ *
+ * @param id 瀹㈡埛妗f涓婚敭
+ * @return 瀹㈡埛璇︽儏DTO
+ */
+ @Override
+ public CustomerDto selectCustomerDetailById(Long id) {
+ Customer customer = customerMapper.selectById(id);
+ if (customer == null) {
+ return null;
+ }
+
+ CustomerDto dto = new CustomerDto();
+ BeanUtils.copyProperties(customer, dto);
+
+ // 鏌ヨ璺熻繘璁板綍
+ List<CustomerFollowUp> followUpList = customerFollowUpService.list(
+ new LambdaQueryWrapper<CustomerFollowUp>()
+ .eq(CustomerFollowUp::getCustomerId, 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());
+
+ dto.setFollowUpList(followUpDtoList);
+ }
+
+ return dto;
+ }
+
+ /**
* 鏌ヨ瀹㈡埛妗f鍒楄〃
*
* @param customer 瀹㈡埛妗f
* @return 瀹㈡埛妗f
*/
@Override
- public IPage<Customer> selectCustomerList(Page page, Customer customer) {
+ public IPage<Customer> selectCustomerList(Page<Customer> page, Customer customer) {
// 1. 澶勭悊绌哄�煎満鏅紙鍙傛暟鏍¢獙锛�
if (page == null) {
page = Page.of(1, 10); // 榛樿绗�1椤碉紝姣忛〉10鏉℃暟鎹�
@@ -92,12 +151,26 @@
// 瀹夊叏鑾峰彇瀛楁锛岄伩鍏峮ull鍊兼嫾鎺�
String address = StringUtils.defaultString(c.getCompanyAddress(), "");
String phone = StringUtils.defaultString(c.getCompanyPhone(), "");
- c.setAddressPhone(address + "(" + phone + ")"); // 浼樺寲瀛楃涓叉嫾鎺�
+ c.setAddressPhone(address + "(" + phone + ")");
+
+ // 鏌ヨ鏈�鏂扮殑璺熻繘璁板綍
+ CustomerFollowUp followUp = customerFollowUpService.getOne(
+ new LambdaQueryWrapper<CustomerFollowUp>()
+ .eq(CustomerFollowUp::getCustomerId, c.getId())
+ .orderByDesc(CustomerFollowUp::getFollowUpTime)
+ .last("LIMIT 1")
+ );
+
+ if (followUp != null) {
+ c.setFollowUpLevel(followUp.getFollowUpLevel());
+ c.setFollowUpTime(followUp.getFollowUpTime());
+ }
})
.collect(Collectors.toList());
// 5. 鏇存柊鍒嗛〉缁撴灉涓殑鏁版嵁锛堜繚鎸佸垎椤典俊鎭畬鏁达級
- customerPage.setRecords(processedList);
+ IPage<Customer> resultPage = new Page<>(customerPage.getCurrent(), customerPage.getSize(), customerPage.getTotal());
+ resultPage.setRecords(processedList);
return customerPage; // 杩斿洖鍖呭惈鍒嗛〉淇℃伅鐨処Page瀵硅薄
}
@@ -137,12 +210,19 @@
* @return 缁撴灉
*/
@Override
+ @Transactional(rollbackFor = Exception.class)
public int deleteCustomerByIds(Long[] ids) {
List<Long> idList = Arrays.asList(ids);
List<SalesLedger> salesLedgers = salesLedgerMapper.selectList(new QueryWrapper<SalesLedger>().lambda().in(SalesLedger::getCustomerId, idList));
if (!salesLedgers.isEmpty()) {
throw new RuntimeException("瀹㈡埛妗f涓嬫湁閿�鍞悎鍚岋紝璇峰厛鍒犻櫎閿�鍞悎鍚�");
}
+ // 鍒犻櫎瀹㈡埛鐨勫悓鏃朵篃闇�瑕佸垹闄ゅ搴旂殑瀹㈡埛璺熼殢銆侀檮浠跺拰鍥炶鎻愰啋
+ for (Long id : ids) {
+ customerFollowUpService.deleteByCustomerId(id);
+ customerReturnVisitService.deleteByCustomerId(id);
+ }
+
return customerMapper.deleteBatchIds(idList);
}
@@ -163,12 +243,12 @@
try {
ExcelUtil<Customer> util = new ExcelUtil<Customer>(Customer.class);
List<Customer> userList = util.importExcel(file.getInputStream());
- if(CollectionUtils.isEmpty(userList)){
+ if (CollectionUtils.isEmpty(userList)) {
return AjaxResult.warn("妯℃澘閿欒鎴栧鍏ユ暟鎹负绌�");
}
this.saveOrUpdateBatch(userList);
return AjaxResult.success(true);
- }catch (Exception e){
+ } catch (Exception e) {
e.printStackTrace();
return AjaxResult.error("瀵煎叆澶辫触");
}
diff --git a/src/main/java/com/ruoyi/basic/service/impl/ReturnVisitReminderService.java b/src/main/java/com/ruoyi/basic/service/impl/ReturnVisitReminderService.java
new file mode 100644
index 0000000..819a47d
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/service/impl/ReturnVisitReminderService.java
@@ -0,0 +1,53 @@
+package com.ruoyi.basic.service.impl;
+
+import com.ruoyi.basic.pojo.CustomerReturnVisit;
+import com.ruoyi.basic.service.CustomerReturnVisitService;
+import com.ruoyi.framework.redis.RedisCache;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.time.ZoneId;
+
+/**
+ * <br>
+ * 瀹㈡埛鍥炶鎻愰啋鏈嶅姟
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/05 10:45
+ */
+@Slf4j
+@Service
+public class ReturnVisitReminderService {
+
+ private static final String REMINDER_QUEUE_KEY = "return_visit:reminder:queue";
+
+ @Autowired
+ private RedisCache redisCache;
+
+ @Autowired
+ private CustomerReturnVisitService customerReturnVisitService;
+
+ @SuppressWarnings("unchecked")
+ public void scheduleReminder(Long returnVisitId) {
+ CustomerReturnVisit returnVisit = customerReturnVisitService.getById(returnVisitId);
+ if (returnVisit == null || returnVisit.getIsEnabled() == 0) {
+ return;
+ }
+ long timestamp = returnVisit.getReminderTime()
+ .atZone(ZoneId.systemDefault())
+ .toInstant()
+ .toEpochMilli();
+
+ redisCache.redisTemplate.opsForZSet().add(REMINDER_QUEUE_KEY, returnVisitId, timestamp);
+ log.info("宸叉坊鍔犲洖璁挎彁閱掑埌闃熷垪: ID={}, 鎻愰啋鏃堕棿={}", returnVisitId, returnVisit.getReminderTime());
+ }
+
+ @SuppressWarnings("unchecked")
+ public void cancelReminder(Long returnVisitId) {
+ redisCache.redisTemplate.opsForZSet().remove(REMINDER_QUEUE_KEY, returnVisitId);
+ log.info("宸插彇娑堝洖璁挎彁閱�: ID={}", returnVisitId);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java b/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java
new file mode 100644
index 0000000..245acda
--- /dev/null
+++ b/src/main/java/com/ruoyi/basic/task/ReturnVisitReminderTask.java
@@ -0,0 +1,92 @@
+package com.ruoyi.basic.task;
+
+import com.ruoyi.basic.pojo.CustomerReturnVisit;
+import com.ruoyi.basic.service.CustomerReturnVisitService;
+import com.ruoyi.framework.redis.RedisCache;
+import com.ruoyi.project.system.domain.SysUserClient;
+import com.ruoyi.project.system.service.SysUserClientService;
+import com.ruoyi.project.system.service.impl.UnipushService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDateTime;
+import java.util.Set;
+
+/**
+ * <br>
+ * 瀹㈡埛鍥炶鎻愰啋瀹氭椂浠诲姟
+ * </br>
+ *
+ * @author deslrey
+ * @version 1.0
+ * @since 2026/03/05 9:04
+ */
+@Slf4j
+@Component
+public class ReturnVisitReminderTask {
+
+ private static final String REMINDER_QUEUE_KEY = "return_visit:reminder:queue";
+
+ @Autowired
+ private RedisCache redisCache;
+
+ @Autowired
+ private CustomerReturnVisitService customerReturnVisitService;
+
+ @Autowired
+ private UnipushService unipushService;
+
+ @Autowired
+ private SysUserClientService userClientService;
+
+ @SuppressWarnings("unchecked")
+ @Scheduled(fixedDelay = 60000)
+ public void processReminders() {
+ long now = System.currentTimeMillis();
+ Set<Object> dueReminders = redisCache.redisTemplate.opsForZSet().rangeByScore(REMINDER_QUEUE_KEY, 0, now);
+ if (dueReminders == null || dueReminders.isEmpty()) {
+ return;
+ }
+
+ for (Object obj : dueReminders) {
+ Long returnVisitId = Long.valueOf(obj.toString());
+ try {
+ Long removeCount = redisCache.redisTemplate.opsForZSet().remove(REMINDER_QUEUE_KEY, obj);
+ if (removeCount != null && removeCount > 0) {
+ processReminder(returnVisitId);
+ }
+ } catch (Exception e) {
+ log.error("澶勭悊鍥炶鎻愰啋澶辫触: ID={}", returnVisitId, e);
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void processReminder(Long returnVisitId) {
+ CustomerReturnVisit returnVisit = customerReturnVisitService.getById(returnVisitId);
+ if (returnVisit == null || returnVisit.getIsEnabled() == 0 || returnVisit.getIsCompleted() == 1) {
+ return;
+ }
+ SysUserClient client = userClientService.getById(returnVisit.getRemindUserId());
+ if (client == null || client.getCid() == null) {
+ log.warn("鐢ㄦ埛鏈粦瀹欳ID, 鏃犳硶鍙戦�乁nipush鎺ㄩ��: userId={}", returnVisit.getRemindUserId());
+ return;
+ }
+
+ try {
+ unipushService.sendReturnVisitReminder(returnVisitId, client.getCid(), returnVisit.getContent(), returnVisit.getCustomerId());
+ CustomerReturnVisit updateObj = new CustomerReturnVisit();
+ updateObj.setId(returnVisitId);
+ updateObj.setIsCompleted(1);
+ customerReturnVisitService.updateById(updateObj);
+
+ log.info("鍥炶鎻愰啋宸查�氳繃 Unipush 鍙戦��: ID={}", returnVisitId);
+ } catch (Exception e) {
+ log.error("鍙戦�佸洖璁挎彁閱掑け璐ワ紝閲嶆柊鍔犲叆闃熷垪: ID={}", returnVisitId, e);
+ long retryTime = System.currentTimeMillis() + 60000;
+ redisCache.redisTemplate.opsForZSet().add(REMINDER_QUEUE_KEY, returnVisitId, retryTime);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/ruoyi/common/utils/OrderUtils.java b/src/main/java/com/ruoyi/common/utils/OrderUtils.java
index 32e55a0..7bb9aba 100644
--- a/src/main/java/com/ruoyi/common/utils/OrderUtils.java
+++ b/src/main/java/com/ruoyi/common/utils/OrderUtils.java
@@ -99,4 +99,38 @@
// 鎷兼帴璁㈠崟缂栧彿 preFix + 鏃堕棿锛坹yyyMMdd锛� + 璁㈠崟鏁伴噺(001)
return preFix + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE).replaceAll("-", "") + String.format("%03d", (aLong + 1)) + "-" + new Date().getTime();
}
+
+
+ /**
+ * 鏌ヨ褰撳ぉ锛堝熀浜巆reateTime瀛楁锛夌殑璁板綍鏁伴噺
+ * @param mapper 瀹炰綋绫诲搴旂殑BaseMapper
+ * @param <T> 瀹炰綋绫绘硾鍨�
+ * @return 褰撳ぉ璁板綍鏁伴噺
+ */
+ public static <T> String countAfterServiceTodayByCreateTime(BaseMapper<T> mapper,String preFix) {
+ // 鑾峰彇褰撳ぉ寮�濮嬫椂闂达紙00:00:00锛�
+ LocalDateTime todayStart = LocalDateTime.of(
+ LocalDateTime.now().toLocalDate(),
+ LocalTime.MIN
+ );
+ // 鑾峰彇褰撳ぉ缁撴潫鏃堕棿锛�23:59:59.999锛�
+ LocalDateTime todayEnd = LocalDateTime.of(
+ LocalDateTime.now().toLocalDate(),
+ LocalTime.MAX
+ );
+
+ // 杞崲涓篋ate绫诲瀷锛堝鏋滃疄浣撶被涓璫reateTime鏄疞ocalDateTime鍙洿鎺ヤ娇鐢級
+ Date startDate = Date.from(todayStart.atZone(ZoneId.systemDefault()).toInstant());
+ Date endDate = Date.from(todayEnd.atZone(ZoneId.systemDefault()).toInstant());
+
+ // 鏋勫缓鏌ヨ鏉′欢
+ QueryWrapper<T> queryWrapper = new QueryWrapper<>();
+ queryWrapper.ge("create_time", startDate) // 澶т簬绛変簬褰撳ぉ寮�濮�
+ .lt("create_time", endDate); // 灏忎簬褰撳ぉ缁撴潫锛堥伩鍏嶆绉掔簿搴﹂棶棰橈級
+
+ // 鎵ц鏌ヨ
+ Long aLong = mapper.selectCount(queryWrapper);
+ // 鎷兼帴璁㈠崟缂栧彿 preFix + 鏃堕棿锛坹yyyMMdd锛� + 璁㈠崟鏁伴噺(001)
+ return preFix + LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE).replaceAll("-", "") + String.format("%03d", (aLong + 1));
+ }
}
diff --git a/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java b/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
index 3de2b9e..a6e97f4 100644
--- a/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
+++ b/src/main/java/com/ruoyi/project/system/service/impl/UnipushService.java
@@ -80,16 +80,19 @@
log.warn("鐢ㄦ埛 {} 鏈粦瀹氱Щ鍔ㄧ CID,璺宠繃鎺ㄩ��", sysNotice.getConsigneeId());
continue;
}
-
// 杞崲璺緞
String appPath = convertWebPathToAppPath(sysNotice.getJumpPath());
+ String content = sysNotice.getNoticeContent();
+ if (StringUtils.isNotEmpty(sysNotice.getRemark())) {
+ content = content + " " + sysNotice.getRemark();
+ }
// 鎺ㄩ��
sendRoutingPush(
sysNotice.getNoticeId(),
client.getCid(),
sysNotice.getNoticeTitle(),
- sysNotice.getRemark() != null ? sysNotice.getRemark() : sysNotice.getNoticeContent(),
+ content,
appPath
);
}
@@ -118,31 +121,41 @@
} else {
lastSegment = pathOnly;
}
-
if (StringUtils.isEmpty(lastSegment)) {
return DEFAULT_APP_PAGE;
}
SysMenu menu = sysMenuMapper.selectMenuByPath(lastSegment);
-
if (menu != null && StringUtils.isNotEmpty(menu.getAppComponent())) {
String appPath = menu.getAppComponent();
-
if (appPath.startsWith("/")) {
appPath = appPath.substring(1);
}
-
// 鎷兼帴 Web 绔師濮嬪弬鏁板苟杩斿洖
return appPath + queryString;
}
-
return DEFAULT_APP_PAGE;
+ }
+
+ /**
+ * 鍙戦�佸洖璁挎彁閱�
+ */
+ public void sendReturnVisitReminder(Long returnVisitId, String cid, String content, Integer customerId) {
+ String targetPath = "pages/cooperativeOffice/customerManage/detail?customerId=" + customerId;
+ sendRoutingPush(returnVisitId, cid, "瀹㈡埛鍥炶鎻愰啋", content, targetPath, false);
}
/**
* 鍙戦�佸崟浜鸿矾鐢辨帹閫�
*/
private void sendRoutingPush(Long noticeId, String cid, String title, String content, String targetPath) {
+ sendRoutingPush(noticeId, cid, title, content, targetPath, true);
+ }
+
+ /**
+ * 鍙戦�佸崟浜鸿矾鐢辨帹閫�
+ */
+ private void sendRoutingPush(Long noticeId, String cid, String title, String content, String targetPath, boolean needMarkRead) {
log.info("鍑嗗鎺ㄩ�佹秷鎭�:NoticeId={}, CID={}, Title={}, TargetPath={}", noticeId, cid, title, targetPath);
PushDTO<Audience> pushDTO = new PushDTO<>();
@@ -156,6 +169,7 @@
pushMessageMap.put("content", content);
payloadMap.put("url", targetPath);
payloadMap.put("noticeId", noticeId);
+ payloadMap.put("needMarkRead", needMarkRead);
pushMessageMap.put("payload", JSON.toJSONString(payloadMap));
String transmissionContent = JSON.toJSONString(pushMessageMap);
diff --git a/src/main/java/com/ruoyi/projectManagement/controller/RolesController.java b/src/main/java/com/ruoyi/projectManagement/controller/RolesController.java
new file mode 100644
index 0000000..dc4284a
--- /dev/null
+++ b/src/main/java/com/ruoyi/projectManagement/controller/RolesController.java
@@ -0,0 +1,52 @@
+package com.ruoyi.projectManagement.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.utils.OrderUtils;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.projectManagement.mapper.RolesMapper;
+import com.ruoyi.projectManagement.pojo.Roles;
+import com.ruoyi.projectManagement.service.RolesService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/roles")
+@Api(value = "Roles", tags = "")
+public class RolesController {
+
+ private RolesService rolesservice;
+ private RolesMapper rolesMapper;
+
+ @GetMapping("/listPage")
+ @ApiOperation("鍒嗛〉鏌ヨ鎵�鏈�")
+ public AjaxResult listPage(Page<Roles> page, Roles roles) {
+ return AjaxResult.success(rolesservice.listPage(page, roles));
+ }
+
+ @PostMapping("/add")
+ @ApiOperation("鏂板")
+ public AjaxResult add(@RequestBody Roles role) {
+ role.setNo(OrderUtils.countTodayByCreateTime(rolesMapper, "XMJS"));
+ return AjaxResult.success(rolesservice.save(role));
+ }
+
+ @PostMapping("/update")
+ @ApiOperation("淇敼")
+ public AjaxResult update(@RequestBody Roles roles) {
+ return AjaxResult.success(rolesservice.updateById(roles));
+ }
+
+ @DeleteMapping("/delete")
+ @ApiOperation("鍒犻櫎")
+ public AjaxResult delete(@RequestBody List<Long> ids) {
+ if (CollectionUtils.isEmpty(ids)) return AjaxResult.error("璇蜂紶鍏ヨ鍒犻櫎鐨処D");
+ return AjaxResult.success(rolesservice.removeBatchByIds(ids));
+ }
+}
diff --git a/src/main/java/com/ruoyi/projectManagement/mapper/RolesMapper.java b/src/main/java/com/ruoyi/projectManagement/mapper/RolesMapper.java
new file mode 100644
index 0000000..10bc1fb
--- /dev/null
+++ b/src/main/java/com/ruoyi/projectManagement/mapper/RolesMapper.java
@@ -0,0 +1,9 @@
+package com.ruoyi.projectManagement.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.projectManagement.pojo.Roles;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface RolesMapper extends BaseMapper<Roles> {
+}
diff --git a/src/main/java/com/ruoyi/projectManagement/pojo/Roles.java b/src/main/java/com/ruoyi/projectManagement/pojo/Roles.java
new file mode 100644
index 0000000..9cd9dfa
--- /dev/null
+++ b/src/main/java/com/ruoyi/projectManagement/pojo/Roles.java
@@ -0,0 +1,60 @@
+package com.ruoyi.projectManagement.pojo;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+@Data
+@TableName("project_management_roles")
+@ApiModel(description="")
+public class Roles implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 涓婚敭ID
+ */
+ @ApiModelProperty(value="涓婚敭ID")
+ private Long id;
+ /**
+ * 缂栧彿
+ */
+ @ApiModelProperty(value="缂栧彿")
+ private String no;
+ /**
+ * 鍚嶇О
+ */
+ @ApiModelProperty(value="鍚嶇О")
+ private String name;
+ /**
+ * 鐘舵��(1:鍚敤, 0:绂佺敤)
+ */
+ @ApiModelProperty(value="鐘舵��(1:鍚敤, 0:绂佺敤)")
+ private Integer status;
+
+ @ApiModelProperty(value = "绉熸埛ID")
+ @TableField(fill = FieldFill.INSERT)
+ private Long tenantId;
+
+ @ApiModelProperty(value = "鍒涘缓鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ private LocalDateTime createTime;
+
+ @ApiModelProperty(value = "鍒涘缓鐢ㄦ埛")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @ApiModelProperty(value = "淇敼鏃堕棿")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private LocalDateTime updateTime;
+
+ @ApiModelProperty(value = "淇敼鐢ㄦ埛")
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+}
diff --git a/src/main/java/com/ruoyi/projectManagement/service/RolesService.java b/src/main/java/com/ruoyi/projectManagement/service/RolesService.java
new file mode 100644
index 0000000..cc30753
--- /dev/null
+++ b/src/main/java/com/ruoyi/projectManagement/service/RolesService.java
@@ -0,0 +1,10 @@
+package com.ruoyi.projectManagement.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.projectManagement.pojo.Roles;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+
+public interface RolesService extends IService<Roles> {
+ IPage<Roles> listPage(Page<Roles> page, Roles roles);
+}
diff --git a/src/main/java/com/ruoyi/projectManagement/service/impl/RolesServiceImpl.java b/src/main/java/com/ruoyi/projectManagement/service/impl/RolesServiceImpl.java
new file mode 100644
index 0000000..f58c4ed
--- /dev/null
+++ b/src/main/java/com/ruoyi/projectManagement/service/impl/RolesServiceImpl.java
@@ -0,0 +1,24 @@
+package com.ruoyi.projectManagement.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.projectManagement.mapper.RolesMapper;
+import com.ruoyi.projectManagement.pojo.Roles;
+import com.ruoyi.projectManagement.service.RolesService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@RequiredArgsConstructor
+@Transactional(rollbackFor = Exception.class)
+public class RolesServiceImpl extends ServiceImpl<RolesMapper, Roles> implements RolesService {
+
+ private final RolesMapper rolesmapper;
+
+ @Override
+ public IPage<Roles> listPage(Page<Roles> page, Roles roles) {
+ return rolesmapper.selectPage(page, null);
+ }
+}
diff --git a/src/main/java/com/ruoyi/sales/controller/SalesQuotationController.java b/src/main/java/com/ruoyi/sales/controller/SalesQuotationController.java
index 71556a2..f2e7928 100644
--- a/src/main/java/com/ruoyi/sales/controller/SalesQuotationController.java
+++ b/src/main/java/com/ruoyi/sales/controller/SalesQuotationController.java
@@ -1,26 +1,15 @@
package com.ruoyi.sales.controller;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.ruoyi.aftersalesservice.dto.AfterSalesServiceDto;
-import com.ruoyi.aftersalesservice.pojo.AfterSalesService;
-import com.ruoyi.common.utils.StringUtils;
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.AjaxResult;
import com.ruoyi.sales.dto.SalesQuotationDto;
-import com.ruoyi.sales.pojo.SalesQuotation;
import com.ruoyi.sales.service.SalesQuotationService;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.List;
@RestController
@RequestMapping("/sales/quotation")
diff --git a/src/main/java/com/ruoyi/sales/dto/ShippingInfoDto.java b/src/main/java/com/ruoyi/sales/dto/ShippingInfoDto.java
index 3561c18..260d217 100644
--- a/src/main/java/com/ruoyi/sales/dto/ShippingInfoDto.java
+++ b/src/main/java/com/ruoyi/sales/dto/ShippingInfoDto.java
@@ -29,4 +29,8 @@
@TableField(exist = false)
private List<CommonFile> commonFileList;
+ private String specificationModel;
+
+ private String productName;
+
}
diff --git a/src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java b/src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java
index 77faa01..8dfb5f9 100644
--- a/src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java
+++ b/src/main/java/com/ruoyi/sales/mapper/SalesLedgerMapper.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.aftersalesservice.pojo.AfterSalesService;
import com.ruoyi.home.dto.IncomeExpenseAnalysisDto;
import com.ruoyi.sales.dto.SalesLedgerDto;
import com.ruoyi.sales.dto.SalesTrendDto;
@@ -83,4 +84,6 @@
"ORDER BY month" +
"</script>")
List<SalesTrendDto> statisticsTable(@Param("statisticsTableDto")StatisticsTableDto statisticsTableDto);
+
+ IPage<SalesLedgerDto> listSalesLedger(Page page,@Param("ew") SalesLedgerDto salesLedgerDto);
}
diff --git a/src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java b/src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java
index 8c973b3..c359fd3 100644
--- a/src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java
+++ b/src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.aftersalesservice.pojo.AfterSalesService;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.sales.dto.LossProductModelDto;
import com.ruoyi.sales.dto.MonthlyAmountDto;
@@ -43,4 +44,5 @@
List<LossProductModelDto> getSalesLedgerWithProductsLoss(Long salesLedgerId);
+ IPage<SalesLedgerDto> listSalesLedger(SalesLedgerDto salesLedgerDto, Page page);
}
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 3a42fc7..03635b4 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -9,6 +9,7 @@
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.aftersalesservice.pojo.AfterSalesService;
import com.ruoyi.basic.mapper.CustomerMapper;
import com.ruoyi.basic.mapper.ProductMapper;
import com.ruoyi.basic.mapper.ProductModelMapper;
@@ -452,6 +453,40 @@
return lossProductModelDtos;
}
+ @Override
+ public IPage<SalesLedgerDto> listSalesLedger(SalesLedgerDto salesLedgerDto, Page page) {
+ IPage<SalesLedgerDto> salesLedgerDtoIPage = salesLedgerMapper.listSalesLedger(page, salesLedgerDto);
+ for (SalesLedgerDto salesLedger : salesLedgerDtoIPage.getRecords()) {
+ LambdaQueryWrapper<SalesLedgerProduct> productWrapper = new LambdaQueryWrapper<>();
+ productWrapper.eq(SalesLedgerProduct::getSalesLedgerId, salesLedger.getId());
+ productWrapper.eq(SalesLedgerProduct::getType, 1);
+ List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(productWrapper);
+ for (SalesLedgerProduct product : products) {
+ product.setOriginalNoInvoiceNum(product.getNoInvoiceNum());
+ // 鎻愪緵涓存椂鏈紑绁ㄦ暟锛屾湭寮�绁ㄩ噾棰濅緵鍓嶆璁$畻
+ product.setTempnoInvoiceAmount(product.getNoInvoiceAmount());
+ product.setTempNoInvoiceNum(product.getNoInvoiceNum());
+ product.setRegister(SecurityUtils.getLoginUser().getUser().getNickName());
+ product.setRegisterDate(LocalDateTime.now());
+ // 鍙戣揣淇℃伅
+ ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>()
+ .eq(ShippingInfo::getSalesLedgerProductId, product.getId())
+ .orderByDesc(ShippingInfo::getCreateTime)
+ .last("limit 1"));
+ if (shippingInfo != null) {
+ product.setShippingStatus(shippingInfo.getStatus());
+
+ }
+ }
+ if (!products.isEmpty()) {
+ salesLedger.setHasChildren(true);
+ salesLedger.setProductData(products);
+ }
+ }
+
+ return salesLedgerDtoIPage;
+ }
+
// 鍐呴儴绫荤敤浜庡瓨鍌ㄨ仛鍚堢粨鏋�
private static class GroupedCustomer {
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index 3196942..9eff9ac 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -253,4 +253,4 @@
file:
temp-dir: D:/ruoyi/temp/uploads # 涓存椂鐩綍
- upload-dir: D:/ruoyi/prod/uploads # 姝e紡鐩綍
\ No newline at end of file
+ upload-dir: D:/ruoyi/prod/uploads # 姝e紡鐩綍
diff --git a/src/main/resources/mapper/aftersalesservice/AfterSalesServiceMapper.xml b/src/main/resources/mapper/aftersalesservice/AfterSalesServiceMapper.xml
index 41cd6ca..68e5909 100644
--- a/src/main/resources/mapper/aftersalesservice/AfterSalesServiceMapper.xml
+++ b/src/main/resources/mapper/aftersalesservice/AfterSalesServiceMapper.xml
@@ -2,8 +2,11 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.aftersalesservice.mapper.AfterSalesServiceMapper">
- <select id="listPage" resultType="com.ruoyi.aftersalesservice.pojo.AfterSalesService">
- select * from after_sales_service
+ <select id="listPage" resultType="com.ruoyi.aftersalesservice.dto.AfterSalesServiceNewDto">
+ select ass.*,
+ sl.sales_contract_no
+ from after_sales_service ass
+ left join sales_ledger sl on ass.sales_ledger_id = sl.id
where 1 = 1
<if test="req.feedbackDate != null">
AND feedback_date BETWEEN #{req.feedbackDate} AND #{req.feedbackDate}
@@ -17,6 +20,20 @@
<if test="req.status != null and req.status != ''">
and status = #{req.status}
</if>
+ <if test="req.urgency != null">
+ and urgency = #{req.urgency}
+ </if>
+ <if test="req.serviceType != null">
+ and service_type = #{req.serviceType}
+ </if>
order by update_time desc
</select>
+ <select id="countAfterSalesService" resultType="com.ruoyi.aftersalesservice.dto.CountDto">
+ select
+ status,
+ count(1) as count
+ from after_sales_service
+ group by status
+ </select>
+
</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/projectManagement/RolesMapper.xml b/src/main/resources/mapper/projectManagement/RolesMapper.xml
new file mode 100644
index 0000000..4347379
--- /dev/null
+++ b/src/main/resources/mapper/projectManagement/RolesMapper.xml
@@ -0,0 +1,17 @@
+<?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.projectManagement.mapper.RolesMapper">
+ <resultMap id="BaseResultMap" type="com.ruoyi.projectManagement.pojo.Roles">
+ <id column="id" property="id"/>
+ <result column="id" property="id"/>
+ <result column="no" property="no"/>
+ <result column="name" property="name"/>
+ <result column="status" property="status"/>
+ <result column="create_time" property="createTime"/>
+ <result column="create_user" property="createUser"/>
+ <result column="update_time" property="updateTime"/>
+ <result column="update_user" property="updateUser"/>
+ </resultMap>
+</mapper>
diff --git a/src/main/resources/mapper/sales/SalesLedgerMapper.xml b/src/main/resources/mapper/sales/SalesLedgerMapper.xml
index c5d7aed..85f62c0 100644
--- a/src/main/resources/mapper/sales/SalesLedgerMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerMapper.xml
@@ -111,4 +111,14 @@
FROM sales_ledger
GROUP BY customer_name
</select>
+ <select id="listSalesLedger" resultType="com.ruoyi.sales.dto.SalesLedgerDto">
+ select * from
+ sales_ledger sl
+ <where>
+ <if test="ew.customerName != null and ew.customerName != '' ">
+ and sl.customer_name like concat('%',#{ew.customerName},'%')
+ </if>
+ </where>
+ </select>
+
</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/sales/ShippingInfoMapper.xml b/src/main/resources/mapper/sales/ShippingInfoMapper.xml
index 6026980..89134d5 100644
--- a/src/main/resources/mapper/sales/ShippingInfoMapper.xml
+++ b/src/main/resources/mapper/sales/ShippingInfoMapper.xml
@@ -19,9 +19,14 @@
s.update_user,
s.tenant_id,
sl.sales_contract_no,
+ slp.specification_model,
+ p.product_name,
sl.customer_name
FROM shipping_info s
LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id
+ LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id
+ left join product_model pm on slp.product_model_id = pm.id
+ left join product p on pm.product_id = p.id
WHERE 1=1
<if test="req.salesContractNo != null and req.salesContractNo != ''">
AND sl.sales_contract_no LIKE CONCAT('%',#{req.salesContractNo},'%')
--
Gitblit v1.9.3