From fec1341c1cb8e11cfbe3fa7dfabe447edb72b630 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期二, 27 十月 2026 15:12:43 +0800
Subject: [PATCH] refactor(auth): 移除多个模块中的权限校验注解
---
yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java | 40 ++++++++++++++++++++++++++++++++++------
1 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java
index 5438515..8169887 100644
--- a/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java
+++ b/yudao-module-crm/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/customer/CrmCustomerController.java
@@ -15,6 +15,7 @@
import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.customer.*;
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO;
+import cn.iocoder.yudao.module.crm.service.contract.CrmContractService;
import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerPoolConfigService;
import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
@@ -33,10 +34,12 @@
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
+import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.stream.Stream;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
@@ -56,6 +59,8 @@
private CrmCustomerService customerService;
@Resource
private CrmCustomerPoolConfigService customerPoolConfigService;
+ @Resource
+ private CrmContractService contractService;
@Resource
private DeptApi deptApi;
@@ -101,11 +106,19 @@
@GetMapping("/get")
@Operation(summary = "鑾峰緱瀹㈡埛")
@Parameter(name = "id", description = "缂栧彿", required = true, example = "1024")
- @PreAuthorize("@ss.hasPermission('crm:customer:query')")
public CommonResult<CrmCustomerRespVO> getCustomer(@RequestParam("id") Long id) {
// 1. 鑾峰彇瀹㈡埛
CrmCustomerDO customer = customerService.getCustomer(id);
// 2. 鎷兼帴鏁版嵁
+ return success(buildCustomerDetail(customer));
+ }
+
+ @GetMapping("/business-get")
+ @Operation(summary = "鑾峰緱涓氬姟妯″潡鍏宠仈瀹㈡埛璇︽儏")
+ @PreAuthorize("isAuthenticated()")
+ public CommonResult<CrmCustomerRespVO> getBusinessCustomer(@RequestParam("id") Long id) {
+ CrmCustomerDO customer = customerService.getCustomerList(java.util.Collections.singleton(id))
+ .stream().findFirst().orElse(null);
return success(buildCustomerDetail(customer));
}
@@ -118,7 +131,6 @@
@GetMapping("/page")
@Operation(summary = "鑾峰緱瀹㈡埛鍒嗛〉")
- @PreAuthorize("@ss.hasPermission('crm:customer:query')")
public CommonResult<PageResult<CrmCustomerRespVO>> getCustomerPage(@Valid CrmCustomerPageReqVO pageVO) {
// 1. 鏌ヨ瀹㈡埛鍒嗛〉
PageResult<CrmCustomerDO> pageResult = customerService.getCustomerPage(pageVO, getLoginUserId());
@@ -126,6 +138,18 @@
return success(PageResult.empty(pageResult.getTotal()));
}
// 2. 鎷兼帴鏁版嵁
+ return success(new PageResult<>(buildCustomerDetailList(pageResult.getList()), pageResult.getTotal()));
+ }
+
+ @GetMapping("/business-page")
+ @Operation(summary = "鑾峰緱涓氬姟妯″潡瀹㈡埛鍒嗛〉")
+ @PreAuthorize("isAuthenticated()")
+ public CommonResult<PageResult<CrmCustomerRespVO>> getBusinessCustomerPage(
+ @Valid CrmCustomerPageReqVO pageVO) {
+ PageResult<CrmCustomerDO> pageResult = customerService.getBusinessCustomerPage(pageVO);
+ if (CollUtil.isEmpty(pageResult.getList())) {
+ return success(PageResult.empty(pageResult.getTotal()));
+ }
return success(new PageResult<>(buildCustomerDetailList(pageResult.getList()), pageResult.getTotal()));
}
@@ -139,6 +163,10 @@
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId));
// 1.2 鑾峰彇璺濈杩涘叆鍏捣鐨勬椂闂�
Map<Long, Long> poolDayMap = getPoolDayMap(list);
+ // 1.3 鑾峰彇銆屽凡绛捐鍚堝悓銆嶇殑鏁伴噺涓庨噾棰濆悎璁★紙鎸夋湰椤靛鎴锋壒閲忕粺璁★紝瀹℃牳閫氳繃鐨勫悎鍚屾墠绠楋級
+ Set<Long> customerIds = convertSet(list, CrmCustomerDO::getId);
+ Map<Long, Long> contractCountMap = contractService.getContractCountMapByCustomerIds(customerIds);
+ Map<Long, BigDecimal> contractPriceMap = contractService.getContractPriceMapByCustomerIds(customerIds);
// 2. 杞崲鎴� VO
return BeanUtils.toBean(list, CrmCustomerRespVO.class, customerVO -> {
customerVO.setAreaName(AreaUtils.format(customerVO.getAreaId()));
@@ -153,12 +181,15 @@
if (customerVO.getOwnerUserId() != null) {
customerVO.setPoolDay(poolDayMap.get(customerVO.getId()));
}
+ // 2.3 璁剧疆宸茬璁㈠悎鍚岀殑鏁伴噺涓庨噾棰濆悎璁★紙娌℃湁鍚堝悓鐨勫鎴凤細鏁伴噺 0銆侀噾棰� null锛屽墠绔樉绀恒�屸�斻�嶏級
+ customerVO.setContractCount(
+ contractCountMap.getOrDefault(customerVO.getId(), 0L).intValue());
+ customerVO.setContractTotalPrice(contractPriceMap.get(customerVO.getId()));
});
}
@GetMapping("/put-pool-remind-page")
@Operation(summary = "鑾峰緱寰呰繘鍏ュ叕娴峰鎴峰垎椤�")
- @PreAuthorize("@ss.hasPermission('crm:customer:query')")
public CommonResult<PageResult<CrmCustomerRespVO>> getPutPoolRemindCustomerPage(@Valid CrmCustomerPageReqVO pageVO) {
// 1. 鏌ヨ瀹㈡埛鍒嗛〉
PageResult<CrmCustomerDO> pageResult = customerService.getPutPoolRemindCustomerPage(pageVO, getLoginUserId());
@@ -168,21 +199,18 @@
@GetMapping("/put-pool-remind-count")
@Operation(summary = "鑾峰緱寰呰繘鍏ュ叕娴峰鎴锋暟閲�")
- @PreAuthorize("@ss.hasPermission('crm:customer:query')")
public CommonResult<Long> getPutPoolRemindCustomerCount() {
return success(customerService.getPutPoolRemindCustomerCount(getLoginUserId()));
}
@GetMapping("/today-contact-count")
@Operation(summary = "鑾峰緱浠婃棩闇�鑱旂郴瀹㈡埛鏁伴噺")
- @PreAuthorize("@ss.hasPermission('crm:customer:query')")
public CommonResult<Long> getTodayContactCustomerCount() {
return success(customerService.getTodayContactCustomerCount(getLoginUserId()));
}
@GetMapping("/follow-count")
@Operation(summary = "鑾峰緱鍒嗛厤缁欐垜銆佸緟璺熻繘鐨勭嚎绱㈡暟閲忕殑瀹㈡埛鏁伴噺")
- @PreAuthorize("@ss.hasPermission('crm:customer:query')")
public CommonResult<Long> getFollowCustomerCount() {
return success(customerService.getFollowCustomerCount(getLoginUserId()));
}
--
Gitblit v1.9.3