| | |
| | | import com.ruoyi.common.utils.WebUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.TCrmBranchDTO; |
| | | import com.ruoyi.system.dto.UnbindDTO; |
| | | import com.ruoyi.system.export.TCrmBranchExport; |
| | | import com.ruoyi.system.export.TSysAppUserClinicExport; |
| | | import com.ruoyi.system.export.TSysAppUserExport; |
| | |
| | | private final TCrmChangePointsService crmChangePointsService; |
| | | private final TCrmPositionService crmPositionService; |
| | | private final TCrmSalespersonService crmSalespersonService; |
| | | private final TCrmBranchLiftService crmBranchLiftService; |
| | | private final TokenService tokenService; |
| | | @Autowired |
| | | public TCrmBranchController(TCrmBranchService crmBranchService, TCrmBranchAreaService crmBranchAreaService, TCrmBranchSalaryService crmBranchSalaryService, ISysUserService sysUserService, TCrmChangePointsService crmChangePointsService, TCrmPositionService crmPositionService, TCrmSalespersonService crmSalespersonService, TokenService tokenService) { |
| | | public TCrmBranchController(TCrmBranchService crmBranchService, TCrmBranchAreaService crmBranchAreaService, TCrmBranchSalaryService crmBranchSalaryService, ISysUserService sysUserService, TCrmChangePointsService crmChangePointsService, TCrmPositionService crmPositionService, TCrmSalespersonService crmSalespersonService, TCrmBranchLiftService crmBranchLiftService, TokenService tokenService) { |
| | | this.crmBranchService = crmBranchService; |
| | | this.crmBranchAreaService = crmBranchAreaService; |
| | | this.crmBranchSalaryService = crmBranchSalaryService; |
| | |
| | | this.crmChangePointsService = crmChangePointsService; |
| | | this.crmPositionService = crmPositionService; |
| | | this.crmSalespersonService = crmSalespersonService; |
| | | this.crmBranchLiftService = crmBranchLiftService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "获取crm分公司管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TCrmBranchVO>> pageList(@RequestBody TCrmBranchQuery query) { |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | query.setRoleType(roleType); |
| | | return R.ok(crmBranchService.pageList(query)); |
| | | } |
| | | |
| | |
| | | wrapper.eq(TCrmBranch::getId, crmSalesperson.getBranchId()); |
| | | } |
| | | } |
| | | wrapper.eq(TCrmBranch::getStatus,1).orderByDesc(TCrmBranch::getCreateTime); |
| | | wrapper.eq(TCrmBranch::getStatus,1) |
| | | .eq(TCrmBranch::getAuditStatus,2) |
| | | .orderByDesc(TCrmBranch::getCreateTime); |
| | | return R.ok(crmBranchService.list(wrapper)); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "添加crm分公司管理") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TCrmBranchDTO dto) { |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | if (roleType == 2) { |
| | | dto.setAuditStatus(1); |
| | | } |
| | | if (roleType == 1) { |
| | | dto.setAuditStatus(2); |
| | | } |
| | | return crmBranchService.addBranch(dto); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "分公司管理信息导出") |
| | | @PostMapping("/exportList") |
| | | public void exportList(@RequestBody TCrmBranchQuery query){ |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | query.setRoleType(roleType); |
| | | List<TCrmBranchExport> crmBranchExports = crmBranchService.exportList(query); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TCrmBranchExport.class, crmBranchExports); |
| | | HttpServletResponse response = WebUtils.response(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 解除绑定 |
| | | */ |
| | | @ApiOperation(value = "crm分公司管理信息-解除绑定", notes = "clinicId:诊所id") |
| | | @GetMapping(value = "/unbind") |
| | | public R<String> unbind(@RequestBody UnbindDTO dto) { |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | TCrmBranch crmBranch = crmBranchService.getOne(Wrappers.lambdaQuery(TCrmBranch.class) |
| | | .eq(TCrmBranch::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | if(crmBranch.getPersonType() != 1){ |
| | | return R.fail("仅负责人可操作解除绑定"); |
| | | } |
| | | |
| | | TCrmBranchLift crmBranchLift = new TCrmBranchLift(); |
| | | crmBranchLift.setBranchId(crmBranch.getId()); |
| | | crmBranchLift.setChargePhone(dto.getChargePhone()); |
| | | crmBranchLift.setLiftReason(dto.getLiftReason()); |
| | | crmBranchLiftService.save(crmBranchLift); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | | |