feat(crm): 集成回款功能
- 新增回款相关的 API 接口和实现类 - 在 AchievementService 和 CrmIndexService 中添加回款统计逻辑 - 修改 CrmCustomerApi,增加获取客户信息的接口- 更新 RpcConfiguration,添加 BpmOAReceiptApi 的配置
This commit is contained in:
parent
be9085e3ac
commit
af22e311ec
@ -4,10 +4,13 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|||||||
import cn.iocoder.yudao.module.hrm.api.crmcustomer.dto.CrmCustomerDTO;
|
import cn.iocoder.yudao.module.hrm.api.crmcustomer.dto.CrmCustomerDTO;
|
||||||
import cn.iocoder.yudao.module.hrm.enums.ApiConstants;
|
import cn.iocoder.yudao.module.hrm.enums.ApiConstants;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
@Tag(name = "RPC 服务 - 流程实例")
|
@Tag(name = "RPC 服务 - 流程实例")
|
||||||
@ -18,4 +21,9 @@ public interface CrmCustomerApi {
|
|||||||
@PostMapping(PREFIX + "/update")
|
@PostMapping(PREFIX + "/update")
|
||||||
@Operation(summary = "更新客户信息")
|
@Operation(summary = "更新客户信息")
|
||||||
CommonResult<Boolean> updateCustomerPurchaseTotal(@RequestBody CrmCustomerDTO updateReqVO);
|
CommonResult<Boolean> updateCustomerPurchaseTotal(@RequestBody CrmCustomerDTO updateReqVO);
|
||||||
|
|
||||||
|
@GetMapping(PREFIX + "/get")
|
||||||
|
@Operation(summary = "获得客户信息")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
CommonResult<CrmCustomerDTO> getCustomer(@RequestParam("id") Long id);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.crm.api.crmcustomer;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.crmcustomer.vo.CrmCustomerSaveReqVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.crmcustomer.vo.CrmCustomerSaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.crm.dal.dataobject.crmcustomer.CrmCustomerDO;
|
||||||
import cn.iocoder.yudao.module.crm.service.crmcustomer.CrmCustomerService;
|
import cn.iocoder.yudao.module.crm.service.crmcustomer.CrmCustomerService;
|
||||||
import cn.iocoder.yudao.module.hrm.api.crmcustomer.CrmCustomerApi;
|
import cn.iocoder.yudao.module.hrm.api.crmcustomer.CrmCustomerApi;
|
||||||
import cn.iocoder.yudao.module.hrm.api.crmcustomer.dto.CrmCustomerDTO;
|
import cn.iocoder.yudao.module.hrm.api.crmcustomer.dto.CrmCustomerDTO;
|
||||||
@ -28,4 +29,10 @@ public class CrmCustomerApiImpl implements CrmCustomerApi {
|
|||||||
customerService.updateCustomerPurchaseTotal(BeanUtils.toBean(updateReqVO, CrmCustomerSaveReqVO.class));
|
customerService.updateCustomerPurchaseTotal(BeanUtils.toBean(updateReqVO, CrmCustomerSaveReqVO.class));
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<CrmCustomerDTO> getCustomer(Long id) {
|
||||||
|
CrmCustomerDO customerDO = customerService.getCustomer(id);
|
||||||
|
return success(BeanUtils.toBean(customerDO, CrmCustomerDTO.class));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import cn.iocoder.yudao.module.crm.dal.dataobject.crmcontractreceivables.CrmCont
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -46,9 +45,5 @@ public interface CrmContractReceivablesMapper extends BaseMapperX<CrmContractRec
|
|||||||
.orderByDesc(CrmContractReceivablesDO::getId));
|
.orderByDesc(CrmContractReceivablesDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Select("select any_value(t.id) as id,COUNT(t.id) AS count,SUM(t.money) AS money,t1.nickname AS nickname from crm_contract_receivables t " +
|
|
||||||
"LEFT JOIN system_users t1 ON (t1.id = t.order_admin_id) " +
|
|
||||||
"where t.deleted=0 GROUP BY t.order_admin_id ORDER BY any_value(money) DESC limit 10")
|
|
||||||
List<ContractVO> selectReceivablesTop();
|
List<ContractVO> selectReceivablesTop();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.crm.framework.rpc.config;
|
package cn.iocoder.yudao.module.crm.framework.rpc.config;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAContractApi;
|
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAContractApi;
|
||||||
|
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAReceiptApi;
|
||||||
import cn.iocoder.yudao.module.product.api.storeproduct.StoreProductApi;
|
import cn.iocoder.yudao.module.product.api.storeproduct.StoreProductApi;
|
||||||
import cn.iocoder.yudao.module.product.api.storeproductattrvalue.StoreProductAttrValueApi;
|
import cn.iocoder.yudao.module.product.api.storeproductattrvalue.StoreProductAttrValueApi;
|
||||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||||
@ -13,7 +14,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@EnableFeignClients(clients = {DeptApi.class, DictDataApi.class, AdminUserApi.class, StoreProductApi.class, StoreProductAttrValueApi.class, SmsSendApi.class, MailSendApi.class, NoticeApi.class,
|
@EnableFeignClients(clients = { DeptApi.class, DictDataApi.class, AdminUserApi.class, StoreProductApi.class, StoreProductAttrValueApi.class, SmsSendApi.class, MailSendApi.class, NoticeApi.class,
|
||||||
BpmOAContractApi.class})
|
BpmOAContractApi.class, BpmOAReceiptApi.class})
|
||||||
public class RpcConfiguration {
|
public class RpcConfiguration {
|
||||||
}
|
}
|
||||||
|
@ -12,13 +12,14 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAContractApi;
|
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAContractApi;
|
||||||
|
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAReceiptApi;
|
||||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.contract.BpmOAContractDTO;
|
import cn.iocoder.yudao.module.bpm.api.oa.vo.contract.BpmOAContractDTO;
|
||||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.contract.BpmOAContractVO;
|
import cn.iocoder.yudao.module.bpm.api.oa.vo.contract.BpmOAContractVO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.api.oa.vo.receipt.BpmOAReceiptDTO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.api.oa.vo.receipt.BpmOAReceiptVO;
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.crmachievement.vo.*;
|
import cn.iocoder.yudao.module.crm.controller.admin.crmachievement.vo.*;
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.crmachievement.CrmAchievementDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.crmachievement.CrmAchievementDO;
|
||||||
import cn.iocoder.yudao.module.crm.dal.mysql.crmachievement.CrmAchievementMapper;
|
import cn.iocoder.yudao.module.crm.dal.mysql.crmachievement.CrmAchievementMapper;
|
||||||
import cn.iocoder.yudao.module.crm.dal.mysql.crmcontract.CrmContractMapper;
|
|
||||||
import cn.iocoder.yudao.module.crm.dal.mysql.crmcontractreceivables.CrmContractReceivablesMapper;
|
|
||||||
import cn.iocoder.yudao.module.hrm.enums.FlowStepEnum;
|
import cn.iocoder.yudao.module.hrm.enums.FlowStepEnum;
|
||||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||||
@ -54,16 +55,16 @@ public class CrmAchievementServiceImpl implements CrmAchievementService {
|
|||||||
private CrmAchievementMapper achievementMapper;
|
private CrmAchievementMapper achievementMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private DeptApi deptApi;
|
private DeptApi deptApi;
|
||||||
@Resource
|
|
||||||
private CrmContractMapper contractMapper;
|
|
||||||
@Resource
|
|
||||||
private CrmContractReceivablesMapper contractReceivablesMapper;
|
|
||||||
@Resource
|
@Resource
|
||||||
private AdminUserApi adminUserApi;
|
private AdminUserApi adminUserApi;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private BpmOAContractApi contractApi;
|
private BpmOAContractApi contractApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BpmOAReceiptApi receiptApi;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createAchievement(DeptAchieveSaveVO createReqVO) {
|
public void createAchievement(DeptAchieveSaveVO createReqVO) {
|
||||||
@ -331,10 +332,6 @@ public class CrmAchievementServiceImpl implements CrmAchievementService {
|
|||||||
.setStarTime(starTime)
|
.setStarTime(starTime)
|
||||||
.setEndTime(endTime)).getCheckedData();
|
.setEndTime(endTime)).getCheckedData();
|
||||||
|
|
||||||
// List<CrmContractDO> crmContractDOS = contractMapper.selectList(new LambdaQueryWrapperX<CrmContractDO>()
|
|
||||||
// .in(CrmContractDO::getOwnerUserId, userIds)
|
|
||||||
// .eq(CrmContractDO::getCheckStatus, ContractStatusEnum.STATUS_2.getValue())
|
|
||||||
// .between(CrmContractDO::getOrderTime, starTime, endTime));
|
|
||||||
BigDecimal contractSuccessMoney = BigDecimal.ZERO;
|
BigDecimal contractSuccessMoney = BigDecimal.ZERO;
|
||||||
if (CollectionUtil.isNotEmpty(contractDTOS)) {
|
if (CollectionUtil.isNotEmpty(contractDTOS)) {
|
||||||
// 累加合同金额
|
// 累加合同金额
|
||||||
@ -343,18 +340,24 @@ public class CrmAchievementServiceImpl implements CrmAchievementService {
|
|||||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取回款信息
|
||||||
|
List<BpmOAReceiptDTO> receiptDTOS = receiptApi.getReceiptList(new BpmOAReceiptVO()
|
||||||
|
.setUserId(userIds)
|
||||||
|
.setStarTime(starTime)
|
||||||
|
.setEndTime(endTime)).getCheckedData();
|
||||||
|
|
||||||
// List<CrmContractReceivablesDO> crmContractReceivablesDOS = contractReceivablesMapper
|
// List<CrmContractReceivablesDO> crmContractReceivablesDOS = contractReceivablesMapper
|
||||||
// .selectList(new LambdaQueryWrapper<CrmContractReceivablesDO>()
|
// .selectList(new LambdaQueryWrapper<CrmContractReceivablesDO>()
|
||||||
// .in(CrmContractReceivablesDO::getOwnerUserId, userIds)
|
// .in(CrmContractReceivablesDO::getOwnerUserId, userIds)
|
||||||
// .eq(CrmContractReceivablesDO::getCheckStatus, ContractStatusEnum.STATUS_2.getValue())
|
// .eq(CrmContractReceivablesDO::getCheckStatus, ContractStatusEnum.STATUS_2.getValue())
|
||||||
// .between(CrmContractReceivablesDO::getReturnTime, starTime, endTime));
|
// .between(CrmContractReceivablesDO::getReturnTime, starTime, endTime));
|
||||||
BigDecimal receivablesSuccessMoney = BigDecimal.ZERO;
|
BigDecimal receivablesSuccessMoney = BigDecimal.ZERO;
|
||||||
// if (!crmContractReceivablesDOS.isEmpty()) {
|
if (CollectionUtil.isNotEmpty(receiptDTOS)) {
|
||||||
// receivablesSuccessMoney = crmContractReceivablesDOS
|
receivablesSuccessMoney = receiptDTOS
|
||||||
// .stream()
|
.stream()
|
||||||
// .map(CrmContractReceivablesDO::getMoney)
|
.map(BpmOAReceiptDTO::getMoney)
|
||||||
// .reduce(BigDecimal.ZERO, BigDecimal::add);
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
// }
|
}
|
||||||
|
|
||||||
BigDecimal contractMoney = BigDecimal.ZERO;
|
BigDecimal contractMoney = BigDecimal.ZERO;
|
||||||
BigDecimal receivablesMoney = BigDecimal.ZERO;
|
BigDecimal receivablesMoney = BigDecimal.ZERO;
|
||||||
|
@ -10,7 +10,9 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAContractApi;
|
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAContractApi;
|
||||||
|
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAReceiptApi;
|
||||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.contract.ContractStatisticsDTO;
|
import cn.iocoder.yudao.module.bpm.api.oa.vo.contract.ContractStatisticsDTO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.api.oa.vo.receipt.ReceiptStatisticsDTO;
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.crmanalysis.vo.*;
|
import cn.iocoder.yudao.module.crm.controller.admin.crmanalysis.vo.*;
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.crmclues.vo.CrmCluesStatisticsRespVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.crmclues.vo.CrmCluesStatisticsRespVO;
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.crmachievement.CrmAchievementDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.crmachievement.CrmAchievementDO;
|
||||||
@ -80,6 +82,9 @@ public class AchievementServiceImpl implements AchievementService {
|
|||||||
@Resource
|
@Resource
|
||||||
private CrmCluesService cluesService;
|
private CrmCluesService cluesService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BpmOAReceiptApi receiptApi;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<UserAchieveVO> getAchievementPage(AchievementPageReqVO pageReqVO) {
|
public PageResult<UserAchieveVO> getAchievementPage(AchievementPageReqVO pageReqVO) {
|
||||||
@ -102,6 +107,10 @@ public class AchievementServiceImpl implements AchievementService {
|
|||||||
List<ContractStatisticsDTO> contractStatisticsDTOS = contractApi.getContractStatistics(userIds, pageReqVO.getCreateTime()).getCheckedData();
|
List<ContractStatisticsDTO> contractStatisticsDTOS = contractApi.getContractStatistics(userIds, pageReqVO.getCreateTime()).getCheckedData();
|
||||||
Map<Long, ContractStatisticsDTO> contractMap = convertMap(contractStatisticsDTOS, ContractStatisticsDTO::getUserId);
|
Map<Long, ContractStatisticsDTO> contractMap = convertMap(contractStatisticsDTOS, ContractStatisticsDTO::getUserId);
|
||||||
|
|
||||||
|
// 获取所有用户的回款统计列表
|
||||||
|
List<ReceiptStatisticsDTO> receiptStatisticsDTOS = receiptApi.getContractStatistics(userIds, pageReqVO.getCreateTime()).getCheckedData();
|
||||||
|
Map<Long, ReceiptStatisticsDTO> receiptMap = convertMap(receiptStatisticsDTOS, ReceiptStatisticsDTO::getUserId);
|
||||||
|
|
||||||
// 获取所有用户的线索统计列表
|
// 获取所有用户的线索统计列表
|
||||||
List<CrmCluesStatisticsRespVO> cluesStatisticsRespVOS = cluesService.getCluesStatisticsByUserIds(userIds, pageReqVO.getCreateTime());
|
List<CrmCluesStatisticsRespVO> cluesStatisticsRespVOS = cluesService.getCluesStatisticsByUserIds(userIds, pageReqVO.getCreateTime());
|
||||||
Map<Long, CrmCluesStatisticsRespVO> clusesMap = convertMap(cluesStatisticsRespVOS, CrmCluesStatisticsRespVO::getOwnerUserId);
|
Map<Long, CrmCluesStatisticsRespVO> clusesMap = convertMap(cluesStatisticsRespVOS, CrmCluesStatisticsRespVO::getOwnerUserId);
|
||||||
@ -109,38 +118,22 @@ public class AchievementServiceImpl implements AchievementService {
|
|||||||
pageResult1.getList().forEach(v -> {
|
pageResult1.getList().forEach(v -> {
|
||||||
|
|
||||||
String per = "0";
|
String per = "0";
|
||||||
if (contractMap.get(v.getId()) == null) {
|
// 设置合同数量
|
||||||
// 设置合同数量
|
v.setContractCount(contractMap.get(v.getId()) != null ? Long.valueOf(contractMap.get(v.getId()).getCount()) : 0L);
|
||||||
v.setContractCount(0L);
|
// 设置合同金额
|
||||||
// 设置合同金额
|
v.setContractMoney(contractMap.get(v.getId()) != null ? contractMap.get(v.getId()).getMoney() : BigDecimal.ZERO);
|
||||||
v.setContractMoney(BigDecimal.ZERO);
|
// 设置回款金额
|
||||||
// 设置回款金额
|
v.setReceivablesMoney(receiptMap.get(v.getId()) != null ? receiptMap.get(v.getId()).getMoney() : BigDecimal.ZERO);
|
||||||
v.setReceivablesMoney(BigDecimal.ZERO);
|
// 设置线索数量
|
||||||
// 设置线索数量
|
v.setCluesCount(clusesMap.get(v.getId()) != null ? Long.valueOf(clusesMap.get(v.getId()).getCount()) : 0L);
|
||||||
v.setCluesCount(0L);
|
// 设置转客数量
|
||||||
// 设置转客数量
|
v.setCluesToCustomerCount(clusesMap.get(v.getId()) != null ? Long.valueOf(clusesMap.get(v.getId()).getSuccessCount()) : 0L);
|
||||||
v.setCluesToCustomerCount(0L);
|
// 设置转客比率
|
||||||
v.setCluesToCustomerPer(per);
|
if (v.getCluesCount() > 0) {
|
||||||
}else {
|
per = NumberUtil.round(NumberUtil.div(v.getCluesToCustomerCount(), v.getCluesCount()), 2)
|
||||||
|
.multiply(new BigDecimal("100")).toString();
|
||||||
// 设置合同数量
|
|
||||||
v.setContractCount(Long.valueOf(contractMap.get(v.getId()).getCount()));
|
|
||||||
// 设置合同金额
|
|
||||||
v.setContractMoney(contractMap.get(v.getId()).getMoney());
|
|
||||||
// 设置回款金额
|
|
||||||
v.setReceivablesMoney(BigDecimal.ZERO);
|
|
||||||
// 设置线索数量
|
|
||||||
v.setCluesCount(Long.valueOf(clusesMap.get(v.getId()).getCount()));
|
|
||||||
// 设置转客数量
|
|
||||||
v.setCluesToCustomerCount(Long.valueOf(clusesMap.get(v.getId()).getSuccessCount()));
|
|
||||||
// 设置转客比率
|
|
||||||
if (v.getCluesCount() > 0) {
|
|
||||||
per = NumberUtil.round(NumberUtil.div(v.getCluesToCustomerCount(), v.getCluesCount()), 2)
|
|
||||||
.multiply(new BigDecimal("100")).toString();
|
|
||||||
}
|
|
||||||
v.setCluesToCustomerPer(per);
|
|
||||||
}
|
}
|
||||||
|
v.setCluesToCustomerPer(per);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,9 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
|||||||
import cn.iocoder.yudao.framework.common.enums.ShopCommonEnum;
|
import cn.iocoder.yudao.framework.common.enums.ShopCommonEnum;
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAContractApi;
|
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAContractApi;
|
||||||
|
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAReceiptApi;
|
||||||
import cn.iocoder.yudao.module.bpm.api.oa.vo.contract.ContractStatisticsDTO;
|
import cn.iocoder.yudao.module.bpm.api.oa.vo.contract.ContractStatisticsDTO;
|
||||||
|
import cn.iocoder.yudao.module.bpm.api.oa.vo.receipt.ReceiptStatisticsDTO;
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.crmindex.vo.BrieCountVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.crmindex.vo.BrieCountVO;
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.crmindex.vo.CrmIndexRespVO;
|
import cn.iocoder.yudao.module.crm.controller.admin.crmindex.vo.CrmIndexRespVO;
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.crmbusiness.CrmBusinessDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.crmbusiness.CrmBusinessDO;
|
||||||
@ -16,8 +18,6 @@ import cn.iocoder.yudao.module.crm.dal.dataobject.crmcustomercontacts.CrmCustome
|
|||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.crmrecord.CrmRecordDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.crmrecord.CrmRecordDO;
|
||||||
import cn.iocoder.yudao.module.crm.dal.mysql.crmbusiness.CrmBusinessMapper;
|
import cn.iocoder.yudao.module.crm.dal.mysql.crmbusiness.CrmBusinessMapper;
|
||||||
import cn.iocoder.yudao.module.crm.dal.mysql.crmclues.CrmCluesMapper;
|
import cn.iocoder.yudao.module.crm.dal.mysql.crmclues.CrmCluesMapper;
|
||||||
import cn.iocoder.yudao.module.crm.dal.mysql.crmcontract.CrmContractMapper;
|
|
||||||
import cn.iocoder.yudao.module.crm.dal.mysql.crmcontractreceivables.CrmContractReceivablesMapper;
|
|
||||||
import cn.iocoder.yudao.module.crm.dal.mysql.crmcustomer.CrmCustomerMapper;
|
import cn.iocoder.yudao.module.crm.dal.mysql.crmcustomer.CrmCustomerMapper;
|
||||||
import cn.iocoder.yudao.module.crm.dal.mysql.crmcustomercontacts.CrmCustomerContactsMapper;
|
import cn.iocoder.yudao.module.crm.dal.mysql.crmcustomercontacts.CrmCustomerContactsMapper;
|
||||||
import cn.iocoder.yudao.module.crm.dal.mysql.crmrecord.CrmRecordMapper;
|
import cn.iocoder.yudao.module.crm.dal.mysql.crmrecord.CrmRecordMapper;
|
||||||
@ -50,10 +50,7 @@ public class CrmIndexServiceImpl implements CrmIndexService {
|
|||||||
private CrmCustomerMapper customerMapper;
|
private CrmCustomerMapper customerMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private CrmCluesMapper crmCluesMapper;
|
private CrmCluesMapper crmCluesMapper;
|
||||||
@Resource
|
|
||||||
private CrmContractMapper contractMapper;
|
|
||||||
@Resource
|
|
||||||
private CrmContractReceivablesMapper contractReceivablesMapper;
|
|
||||||
@Resource
|
@Resource
|
||||||
private CrmRecordMapper crmRecordMapper;
|
private CrmRecordMapper crmRecordMapper;
|
||||||
@Resource
|
@Resource
|
||||||
@ -66,6 +63,9 @@ public class CrmIndexServiceImpl implements CrmIndexService {
|
|||||||
@Resource
|
@Resource
|
||||||
private BpmOAContractApi bpmOAContractApi;
|
private BpmOAContractApi bpmOAContractApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BpmOAReceiptApi receiptApi;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CrmIndexRespVO getIndexCount(String relation) {
|
public CrmIndexRespVO getIndexCount(String relation) {
|
||||||
@ -112,7 +112,6 @@ public class CrmIndexServiceImpl implements CrmIndexService {
|
|||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计当天
|
* 统计当天
|
||||||
*
|
*
|
||||||
@ -197,66 +196,14 @@ public class CrmIndexServiceImpl implements CrmIndexService {
|
|||||||
// 设置较昨日比率
|
// 设置较昨日比率
|
||||||
String per006 = contractStatisticsDTO.getMoneyPercentage().toString();
|
String per006 = contractStatisticsDTO.getMoneyPercentage().toString();
|
||||||
|
|
||||||
// Long count05 = contractMapper.selectCount(new LambdaQueryWrapper<CrmContractDO>()
|
// 获取今日回款新增金额
|
||||||
// .in(!ids.isEmpty(), CrmContractDO::getOwnerUserId, ids)
|
ReceiptStatisticsDTO receiptStatisticsDTO = receiptApi.getReceiptCount(relation).getCheckedData();
|
||||||
// .between(CrmContractDO::getCreateTime, todayStart, todayEnd));
|
// 设置今日新增金额
|
||||||
// Long count005 = contractMapper.selectCount(new LambdaQueryWrapper<CrmContractDO>()
|
BigDecimal count07 = receiptStatisticsDTO.getTodayAddMoney();
|
||||||
// .in(!ids.isEmpty(), CrmContractDO::getOwnerUserId, ids)
|
// 设置昨日新增金额
|
||||||
// .between(CrmContractDO::getCreateTime, yesterdayStart, yesterdayEnd));
|
BigDecimal count007 = receiptStatisticsDTO.getYesterdayAddMoney();
|
||||||
// String per005 = "0";
|
// 设置较昨日比率
|
||||||
// if (count005 > 0) {
|
String per007 = receiptStatisticsDTO.getMoneyPercentage().toString();
|
||||||
// per005 = NumberUtil.div(NumberUtil.sub(count05, count005), count005, 2)
|
|
||||||
// .multiply(new BigDecimal("100")).toString();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// QueryWrapper<CrmContractDO> queryWrapper06 = new QueryWrapper<>();
|
|
||||||
// queryWrapper06.select("sum(money) as count06");
|
|
||||||
// queryWrapper06.eq("to_days(create_time)", "to_days(now())");
|
|
||||||
// queryWrapper06.in(!ids.isEmpty(), "owner_user_id", ids);
|
|
||||||
// CrmContractDO crmContractDO = contractMapper.selectOne(queryWrapper06);
|
|
||||||
// BigDecimal count06 = BigDecimal.ZERO;
|
|
||||||
// if (crmContractDO != null) {
|
|
||||||
// count06 = crmContractDO.getCount06();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// QueryWrapper<CrmContractDO> queryWrapper006 = new QueryWrapper<>();
|
|
||||||
// queryWrapper006.select("sum(money) as count006");
|
|
||||||
// queryWrapper006.eq("to_days(now())-to_days(create_time)", 1);
|
|
||||||
// queryWrapper006.in(!ids.isEmpty(), "owner_user_id", ids);
|
|
||||||
// CrmContractDO crmContractDO006 = contractMapper.selectOne(queryWrapper006);
|
|
||||||
// BigDecimal count006 = BigDecimal.ZERO;
|
|
||||||
// if (crmContractDO006 != null) {
|
|
||||||
// count006 = crmContractDO006.getCount006();
|
|
||||||
// }
|
|
||||||
// String per006 = "0";
|
|
||||||
// if (count006.compareTo(BigDecimal.ZERO) > 0) {
|
|
||||||
// per006 = NumberUtil.div(NumberUtil.sub(count06, count006), count006, 2)
|
|
||||||
// .multiply(new BigDecimal("100")).toString();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// QueryWrapper<CrmContractReceivablesDO> queryWrapper07 = new QueryWrapper<>();
|
|
||||||
// queryWrapper07.select("sum(money) as count07");
|
|
||||||
// queryWrapper07.eq("to_days(create_time)", "to_days(now())");
|
|
||||||
// CrmContractReceivablesDO crmContractReceivablesDO = contractReceivablesMapper.selectOne(queryWrapper07);
|
|
||||||
BigDecimal count07 = BigDecimal.ZERO;
|
|
||||||
// if (crmContractDO != null) {
|
|
||||||
// count07 = crmContractReceivablesDO.getCount07();
|
|
||||||
// }
|
|
||||||
// QueryWrapper<CrmContractReceivablesDO> queryWrapper007 = new QueryWrapper<>();
|
|
||||||
// queryWrapper007.select("sum(money) as count007");
|
|
||||||
// queryWrapper007.eq("to_days(now())-to_days(create_time)", 1);
|
|
||||||
// CrmContractReceivablesDO crmContractReceivablesDO007 = contractReceivablesMapper.selectOne(queryWrapper007);
|
|
||||||
BigDecimal count007 = BigDecimal.ZERO;
|
|
||||||
// if (crmContractReceivablesDO007 != null) {
|
|
||||||
// count007 = crmContractReceivablesDO007.getCount007();
|
|
||||||
// }
|
|
||||||
String per007 = "0";
|
|
||||||
// if (count007.compareTo(BigDecimal.ZERO) > 0) {
|
|
||||||
// per007 = NumberUtil.div(NumberUtil.sub(count07, count007), count007, 2)
|
|
||||||
// .multiply(new BigDecimal("100")).toString();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
Long count08 = customerContactsMapper.selectCount(new LambdaQueryWrapper<CrmCustomerContactsDO>()
|
Long count08 = customerContactsMapper.selectCount(new LambdaQueryWrapper<CrmCustomerContactsDO>()
|
||||||
.in(!ids.isEmpty(), CrmCustomerContactsDO::getOwnerUserId, ids)
|
.in(!ids.isEmpty(), CrmCustomerContactsDO::getOwnerUserId, ids)
|
||||||
|
@ -50,9 +50,29 @@
|
|||||||
<if test="dto.creatorName != null and dto.creatorName != ''">
|
<if test="dto.creatorName != null and dto.creatorName != ''">
|
||||||
and d.nickname like concat('%', #{dto.creatorName}, '%')
|
and d.nickname like concat('%', #{dto.creatorName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="dto.getIsCheck() != null">
|
<if test="dto.getIsCheck()">
|
||||||
AND FIND_IN_SET ('${dto.loginAdminId}',a.flow_admin_id)
|
AND FIND_IN_SET ('${dto.loginAdminId}',a.flow_admin_id)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectReceivablesTop" resultType="cn.iocoder.yudao.module.crm.controller.admin.crmanalysis.vo.ContractVO">
|
||||||
|
SELECT
|
||||||
|
t.user_id AS id,
|
||||||
|
COUNT( t.id ) AS count,
|
||||||
|
SUM( t.money ) AS money,
|
||||||
|
u.nickname AS nickname
|
||||||
|
FROM
|
||||||
|
bpm_oa_receipt t
|
||||||
|
LEFT JOIN system_users u ON ( u.id = t.user_id )
|
||||||
|
AND u.deleted = 0
|
||||||
|
WHERE
|
||||||
|
t.deleted = 0
|
||||||
|
AND t.result = 2
|
||||||
|
GROUP BY
|
||||||
|
t.user_id
|
||||||
|
ORDER BY
|
||||||
|
money DESC
|
||||||
|
LIMIT 10
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
Reference in New Issue
Block a user