From 00957f0c836b80d9052a6ccf673d3b454b646081 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期一, 29 九月 2025 18:17:54 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmBranchController.java | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmBranchController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmBranchController.java index 36d9f54..80277fc 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmBranchController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCrmBranchController.java @@ -18,6 +18,7 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -44,15 +45,17 @@ private final ISysUserService sysUserService; private final TCrmChangePointsService crmChangePointsService; private final TCrmPositionService crmPositionService; + private final TCrmSalespersonService crmSalespersonService; private final TokenService tokenService; @Autowired - public TCrmBranchController(TCrmBranchService crmBranchService, TCrmBranchAreaService crmBranchAreaService, TCrmBranchSalaryService crmBranchSalaryService, ISysUserService sysUserService, TCrmChangePointsService crmChangePointsService, TCrmPositionService crmPositionService, TokenService tokenService) { + public TCrmBranchController(TCrmBranchService crmBranchService, TCrmBranchAreaService crmBranchAreaService, TCrmBranchSalaryService crmBranchSalaryService, ISysUserService sysUserService, TCrmChangePointsService crmChangePointsService, TCrmPositionService crmPositionService, TCrmSalespersonService crmSalespersonService, TokenService tokenService) { this.crmBranchService = crmBranchService; this.crmBranchAreaService = crmBranchAreaService; this.crmBranchSalaryService = crmBranchSalaryService; this.sysUserService = sysUserService; this.crmChangePointsService = crmChangePointsService; this.crmPositionService = crmPositionService; + this.crmSalespersonService = crmSalespersonService; this.tokenService = tokenService; } @@ -74,8 +77,17 @@ Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); Long userId = tokenService.getLoginUser().getUserId(); LambdaQueryWrapper<TCrmBranch> wrapper = new LambdaQueryWrapper<>(); - if (roleType == 1) { + if (roleType == 2) { wrapper.eq(TCrmBranch::getUserId, userId); + } + if(roleType == 3){ + // 查询业务员信息 + TCrmSalesperson crmSalesperson = crmSalespersonService.getOne(Wrappers.lambdaQuery(TCrmSalesperson.class) + .eq(TCrmSalesperson::getUserId, userId) + .last("LIMIT 1")); + if(Objects.nonNull(crmSalesperson)){ + wrapper.eq(TCrmBranch::getId, crmSalesperson.getBranchId()); + } } wrapper.eq(TCrmBranch::getStatus,1).orderByDesc(TCrmBranch::getCreateTime); return R.ok(crmBranchService.list(wrapper)); @@ -181,6 +193,13 @@ // 冻结 sysUser.setStatus("1"); sysUserService.updateUser(sysUser); + // 查询业务员 + List<TCrmSalesperson> crmSalespersons = crmSalespersonService.list(Wrappers.lambdaQuery(TCrmSalesperson.class) + .eq(TCrmSalesperson::getBranchId, id)); + if(!CollectionUtils.isEmpty(crmSalespersons)){ + List<Long> userIds = crmSalespersons.stream().map(TCrmSalesperson::getUserId).collect(Collectors.toList()); + sysUserService.updateUserStatusByUserIds(userIds, "1"); + } break; } return R.ok(); -- Gitblit v1.7.1