|
@@ -34,7 +34,7 @@ import java.util.List;
|
|
|
/**
|
|
/**
|
|
|
* 客户公海与有效客户统一控制器
|
|
* 客户公海与有效客户统一控制器
|
|
|
*
|
|
*
|
|
|
- * @author Antigravity
|
|
|
|
|
|
|
+ * @author tys
|
|
|
*/
|
|
*/
|
|
|
@Validated
|
|
@Validated
|
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
@@ -64,41 +64,67 @@ public class CustomerPoolController extends BaseController {
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo<CustomerListVo> list(CustomerListBo bo, PageQuery pageQuery) {
|
|
public TableDataInfo<CustomerListVo> list(CustomerListBo bo, PageQuery pageQuery) {
|
|
|
|
|
+ return allList(bo, pageQuery);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 我负责的客户列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/mineList")
|
|
|
|
|
+ public TableDataInfo<CustomerListVo> mineList(CustomerListBo bo, PageQuery pageQuery) {
|
|
|
Long userId = LoginHelper.getLoginUser().getUserId();
|
|
Long userId = LoginHelper.getLoginUser().getUserId();
|
|
|
RemoteComStaffVo remoteComStaffVo = remoteComStaffService.selectStaffByUserId(userId);
|
|
RemoteComStaffVo remoteComStaffVo = remoteComStaffService.selectStaffByUserId(userId);
|
|
|
Long staffId = (remoteComStaffVo != null) ? remoteComStaffVo.getStaffId() : null;
|
|
Long staffId = (remoteComStaffVo != null) ? remoteComStaffVo.getStaffId() : null;
|
|
|
|
|
|
|
|
- boolean isAdmin = LoginHelper.isSuperAdmin() || LoginHelper.isTenantAdmin();
|
|
|
|
|
- bo.getParams().put("isAdmin", isAdmin ? "true" : "false");
|
|
|
|
|
- bo.getParams().put("createBy", userId);
|
|
|
|
|
|
|
+ bo.setSalesPersonId(staffId != null ? staffId : -1L);
|
|
|
|
|
+ bo.setServiceStaffId(null);
|
|
|
|
|
+ bo.setCreateBy(null);
|
|
|
|
|
+ bo.setActiveTab("mine");
|
|
|
|
|
+ bo.setIsHighSeas("false");
|
|
|
|
|
+ return customerPoolService.queryCustomerListPage(bo, pageQuery);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if ("mine".equals(bo.getActiveTab())) {
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 我参与的客户列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/involvedList")
|
|
|
|
|
+ public TableDataInfo<CustomerListVo> involvedList(CustomerListBo bo, PageQuery pageQuery) {
|
|
|
|
|
+ Long userId = LoginHelper.getLoginUser().getUserId();
|
|
|
|
|
+ RemoteComStaffVo remoteComStaffVo = remoteComStaffService.selectStaffByUserId(userId);
|
|
|
|
|
+ Long staffId = (remoteComStaffVo != null) ? remoteComStaffVo.getStaffId() : null;
|
|
|
|
|
+
|
|
|
|
|
+ bo.setServiceStaffId(staffId != null ? staffId : -1L);
|
|
|
|
|
+ bo.setSalesPersonId(null);
|
|
|
|
|
+ bo.setCreateBy(null);
|
|
|
|
|
+ bo.setActiveTab("involved");
|
|
|
|
|
+ bo.setIsHighSeas("false");
|
|
|
|
|
+ return customerPoolService.queryCustomerListPage(bo, pageQuery);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/allList")
|
|
|
|
|
+ public TableDataInfo<CustomerListVo> allList(CustomerListBo bo, PageQuery pageQuery) {
|
|
|
|
|
+ // 仅系统超级管理员(userId=1)可看全部客户;
|
|
|
|
|
+ // 租户管理员(roleKey=admin)属于普通 CRM 用户,仍需按"我负责+我参与"过滤
|
|
|
|
|
+ boolean isAdmin = LoginHelper.isSuperAdmin();
|
|
|
|
|
+ if (isAdmin) {
|
|
|
|
|
+ bo.setIsAdmin("true");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ bo.setIsAdmin("false");
|
|
|
|
|
+ Long userId = LoginHelper.getLoginUser().getUserId();
|
|
|
|
|
+ RemoteComStaffVo remoteComStaffVo = remoteComStaffService.selectStaffByUserId(userId);
|
|
|
|
|
+ Long staffId = (remoteComStaffVo != null) ? remoteComStaffVo.getStaffId() : null;
|
|
|
|
|
+ // salesPersonId 用 staffId 匹配 ci.sales_person_id(我负责的)和 team_member.user_no(我参与的)
|
|
|
bo.setSalesPersonId(staffId != null ? staffId : -1L);
|
|
bo.setSalesPersonId(staffId != null ? staffId : -1L);
|
|
|
bo.setServiceStaffId(null);
|
|
bo.setServiceStaffId(null);
|
|
|
- bo.setCreateBy(null);
|
|
|
|
|
- } else if ("involved".equals(bo.getActiveTab())) {
|
|
|
|
|
- bo.setServiceStaffId(staffId != null ? staffId : -1L);
|
|
|
|
|
- bo.setSalesPersonId(null);
|
|
|
|
|
- bo.setCreateBy(null);
|
|
|
|
|
- } else {
|
|
|
|
|
- // "all" tab
|
|
|
|
|
- if (isAdmin) {
|
|
|
|
|
- // 管理员在"全部客户"时查看所有数据,不加自己ID的限制
|
|
|
|
|
- bo.setSalesPersonId(null);
|
|
|
|
|
- bo.setServiceStaffId(null);
|
|
|
|
|
- bo.setCreateBy(null);
|
|
|
|
|
- } else {
|
|
|
|
|
- // 普通用户在"全部客户"时仍需要限制查看自己创建的/负责的/参与的
|
|
|
|
|
- bo.setCreateBy(userId);
|
|
|
|
|
- bo.setSalesPersonId(staffId != null ? staffId : -1L);
|
|
|
|
|
- bo.setServiceStaffId(staffId != null ? staffId : -1L);
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
- bo.setIsHighSeas("false"); // 强制为有效客户
|
|
|
|
|
-
|
|
|
|
|
|
|
+ bo.setActiveTab("all");
|
|
|
|
|
+ bo.setIsHighSeas("false");
|
|
|
|
|
+ bo.setCreateBy(null);
|
|
|
|
|
+ bo.getParams().remove("createBy");
|
|
|
return customerPoolService.queryCustomerListPage(bo, pageQuery);
|
|
return customerPoolService.queryCustomerListPage(bo, pageQuery);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 获取客户详细信息
|
|
* 获取客户详细信息
|
|
|
*/
|
|
*/
|