| | |
| | | import com.ruoyi.system.service.TCrmBranchService; |
| | | import com.ruoyi.system.service.TCrmChangePointsService; |
| | | import com.ruoyi.system.service.TCrmSalespersonService; |
| | | import com.ruoyi.system.vo.TCrmSalespersonAndBranchVO; |
| | | import com.ruoyi.system.vo.TCrmSalespersonVO; |
| | | import com.ruoyi.system.vo.TErpGoodsVO; |
| | | import io.swagger.annotations.Api; |
| | |
| | | } |
| | | if(crmBranch.getPersonType() == 3){ |
| | | branchIds.add(crmBranch.getId()); |
| | | query.setBranchIds(branchIds); |
| | | } |
| | | if(CollectionUtils.isEmpty(branchIds)){ |
| | | return R.ok(new PageInfo<>()); |
| | | } |
| | | } |
| | | return R.ok(crmSalespersonService.pageList(query)); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取crm业务员信息和分公司信息 |
| | | */ |
| | | @ApiOperation(value = "获取crm业务员信息和分公司信息") |
| | | @GetMapping(value = "/getSalespersonAndBranch") |
| | | public R<List<TCrmSalespersonAndBranchVO>> getSalespersonAndBranch() { |
| | | |
| | | Long userId = tokenService.getLoginUser().getUser().getUserId(); |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | |
| | | if(roleType != 3){ |
| | | return R.fail("当前用户非业务员角色!"); |
| | | } |
| | | |
| | | LambdaQueryWrapper<TCrmSalesperson> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(TCrmSalesperson::getUserId,userId); |
| | | wrapper.eq(TCrmSalesperson::getStatus,1) |
| | | .orderByDesc(TCrmSalesperson::getCreateTime) |
| | | .last("LIMIT 1"); |
| | | TCrmSalesperson crmSalesperson = crmSalespersonService.getOne(wrapper); |
| | | |
| | | if(Objects.isNull(crmSalesperson)){ |
| | | return R.fail("当前用户未绑定业务员信息!"); |
| | | } |
| | | |
| | | List<TCrmSalespersonAndBranchVO> result = new ArrayList<>(); |
| | | |
| | | TCrmSalespersonAndBranchVO vo = new TCrmSalespersonAndBranchVO(); |
| | | vo.setId(crmSalesperson.getId()); |
| | | vo.setName(crmSalesperson.getSalespersonName()); |
| | | vo.setType(2); |
| | | result.add(vo); |
| | | // 查询分公司 |
| | | TCrmBranch crmBranch = crmBranchService.getById(crmSalesperson.getBranchId()); |
| | | if(Objects.isNull(crmBranch)){ |
| | | return R.fail("当前业务员未绑定分公司信息!"); |
| | | } |
| | | vo = new TCrmSalespersonAndBranchVO(); |
| | | vo.setId(crmBranch.getId()); |
| | | vo.setName(crmBranch.getBranchName()); |
| | | vo.setType(1); |
| | | result.add(vo); |
| | | |
| | | return R.ok(result); |
| | | } |
| | | |
| | | /** |
| | | * 添加crm业务员管理管理 |
| | | */ |
| | | @Log(title = "crm业务员管理信息-新增crm业务员管理", businessType = BusinessType.INSERT) |