refactor(crm): 重构首页统计接口

- 在 CrmIndexController 中添加 userId 参数
- 更新 CrmIndexService 接口,增加 userId 参数
- 修改 CrmIndexServiceImpl 中的 getIndexCount 方法,支持 userId 参数
- 调整 getBrieCount 方法,添加 userId 参数
This commit is contained in:
aikai 2025-02-24 15:07:06 +08:00
parent fb5607f1ea
commit d0fb900104
3 changed files with 7 additions and 45 deletions

View File

@ -25,10 +25,10 @@ public class CrmIndexController {
@GetMapping("/getCount") @GetMapping("/getCount")
@Operation(summary = "首页统计") @Operation(summary = "首页统计")
public CommonResult<CrmIndexRespVO> getCount(@RequestParam(name = "relation",defaultValue = "my",required=false) String relation) { public CommonResult<CrmIndexRespVO> getCount(@RequestParam(name = "relation", defaultValue = "my", required = false) String relation,
return success(crmIndexService.getIndexCount(relation)); @RequestParam(name = "userId", required = false) Long userId) {
return success(crmIndexService.getIndexCount(relation, userId));
} }
} }

View File

@ -9,6 +9,6 @@ import cn.iocoder.yudao.module.crm.controller.admin.crmindex.vo.CrmIndexRespVO;
*/ */
public interface CrmIndexService { public interface CrmIndexService {
CrmIndexRespVO getIndexCount(String relation); CrmIndexRespVO getIndexCount(String relation,Long userId);
} }

View File

@ -71,47 +71,9 @@ public class CrmIndexServiceImpl implements CrmIndexService {
@Override @Override
public CrmIndexRespVO getIndexCount(String relation) { public CrmIndexRespVO getIndexCount(String relation, Long userId) {
// Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
// Date todayStart = DateUtil.beginOfDay(new Date());
// Date todayEnd = DateUtil.endOfDay(new Date());
// Date day30 = DateUtil.offsetDay(new Date(),30);
//
// Long followCustomerCount = customerMapper.selectCount(new LambdaQueryWrapper<CrmCustomerDO>()
// .between(CrmCustomerDO::getNextTime,todayStart,todayEnd).eq(CrmCustomerDO::getOwnerUserId,loginUserId));
// Long followBusinessCount = businessMapper.selectCount(new LambdaQueryWrapper<CrmBusinessDO>()
// .between(CrmBusinessDO::getNextTime,todayStart,todayEnd).eq(CrmBusinessDO::getOwnerUserId,loginUserId));
// Long followCluesCount = crmCluesMapper.selectCount(new LambdaQueryWrapper<CrmCluesDO>()
// .between(CrmCluesDO::getNextTime,todayStart,todayEnd).eq(CrmCluesDO::getOwnerUserId,loginUserId));
// Long contractDueCount = contractMapper.selectCount(new LambdaQueryWrapper<CrmContractDO>()
// .between(CrmContractDO::getEndTime,todayStart,day30).eq(CrmContractDO::getOwnerUserId,loginUserId));
// Long customerDueCount = 0L;
// Long contractReturnCount = contractMapper.selectCount(new LambdaQueryWrapper<CrmContractDO>()
// .eq(CrmContractDO::getOwnerUserId,loginUserId).apply("money > return_money"));
// Long myInvoiceCount = crmInvoiceMapper.selectCount(new LambdaQueryWrapper<CrmInvoiceDO>()
// .eq(CrmInvoiceDO::getCreator,loginUserId));
// Long productCount = storeProductMapper.selectCount();
//
// Long contractCheckCount = contractMapper.selectCount(new LambdaQueryWrapper<CrmContractDO>()
// .apply( "FIND_IN_SET ('" + loginUserId + "',flow_admin_id)"));
// Long receivablesCheckCount = contractReceivablesMapper.selectCount(new LambdaQueryWrapper<CrmContractReceivablesDO>()
// .apply( "FIND_IN_SET ('" + loginUserId + "',flow_admin_id)"));
// Long invoiceCheckCount = crmInvoiceMapper.selectCount(new LambdaQueryWrapper<CrmInvoiceDO>()
// .apply( "FIND_IN_SET ('" + loginUserId + "',flow_admin_id)"));
return CrmIndexRespVO.builder() return CrmIndexRespVO.builder()
// .followCustomerCount(followCustomerCount) .brieCountVO(getBrieCount(relation, userId))
// .followBusinessCount(followBusinessCount)
// .followCluesCount(followCluesCount)
// .contractDueCount(contractDueCount)
// .customerDueCount(customerDueCount)
// .contractReturnCount(contractReturnCount)
// .myInvoiceCount(myInvoiceCount)
// .productCount(productCount)
// .contractCheckCount(contractCheckCount)
// .receivablesCheckCount(receivablesCheckCount)
// .invoiceCheckCount(invoiceCheckCount)
.brieCountVO(getBrieCount(relation))
.build(); .build();
} }
@ -120,7 +82,7 @@ public class CrmIndexServiceImpl implements CrmIndexService {
* *
* @return * @return
*/ */
private BrieCountVO getBrieCount(String relation) { private BrieCountVO getBrieCount(String relation, Long userId) {
Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
Date todayStart = DateUtil.beginOfDay(new Date()); Date todayStart = DateUtil.beginOfDay(new Date());
Date todayEnd = DateUtil.endOfDay(new Date()); Date todayEnd = DateUtil.endOfDay(new Date());