3 天以前 111270df037596a04df97f787ca8b9199dd99866
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package cn.iocoder.yudao.module.crm.service.receivable;
 
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivablePageReqVO;
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.receivable.CrmReceivableSaveReqVO;
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivableDO;
import jakarta.validation.Valid;
 
import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
import java.util.Map;
 
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
 
/**
 * CRM 回款 Service 接口
 *
 * @author 赤焰
 */
public interface CrmReceivableService {
 
    /**
     * 创建回款
     *
     * @param createReqVO 创建信息
     * @return 编号
     */
    Long createReceivable(@Valid CrmReceivableSaveReqVO createReqVO);
 
    /**
     * 更新回款
     *
     * @param updateReqVO 更新信息
     */
    void updateReceivable(@Valid CrmReceivableSaveReqVO updateReqVO);
 
    /**
     * 更新回款流程审批结果
     *
     * @param id        回款编号
     * @param bpmResult BPM 审批结果
     */
    void updateReceivableAuditStatus(Long id, Integer bpmResult);
 
    /**
     * 删除回款
     *
     * @param id 编号
     */
    void deleteReceivable(Long id);
 
    /**
     * 发起回款审批流程
     *
     * @param id     回款编号
     * @param userId 用户编号
     */
    void submitReceivable(Long id, Long userId);
 
    /**
     * 获得回款
     *
     * @param id 编号
     * @return 回款
     */
    CrmReceivableDO getReceivable(Long id);
 
    /**
     * 获得回款列表
     *
     * @param ids 编号
     * @return 回款列表
     */
    List<CrmReceivableDO> getReceivableList(Collection<Long> ids);
 
    /**
     * 获得回款 Map
     *
     * @param ids 编号
     * @return 回款 Map
     */
    default Map<Long, CrmReceivableDO> getReceivableMap(Collection<Long> ids) {
        return convertMap(getReceivableList(ids), CrmReceivableDO::getId);
    }
 
    /**
     * 获得回款分页
     *
     * 数据权限:基于 {@link CrmReceivableDO} 读取
     *
     * @param pageReqVO 分页查询
     * @param userId    用户编号
     * @return 回款分页
     */
    PageResult<CrmReceivableDO> getReceivablePage(CrmReceivablePageReqVO pageReqVO, Long userId);
 
    /**
     * 获得回款分页,基于指定客户
     *
     * 数据权限:基于 {@link CrmCustomerDO} 读取
     *
     * @param pageReqVO 分页查询
     * @return 回款分页
     */
    PageResult<CrmReceivableDO> getReceivablePageByCustomerId(CrmReceivablePageReqVO pageReqVO);
 
    /**
     * 获得待审核回款数量
     *
     * @param userId 用户编号
     * @return 待审批数量
     */
    Long getAuditReceivableCount(Long userId);
 
    /**
     * 获得合同已回款金额 Map
     *
     * @param contractIds 合同编号
     * @return 回款金额 Map
     */
    Map<Long, BigDecimal> getReceivablePriceMapByContractId(Collection<Long> contractIds);
 
    /**
     * 根据合同编号查询回款数量
     *
     * @param contractId 合同编号
     * @return 回款数量
     */
    Long getReceivableCountByContractId(Long contractId);
 
    /**
     * 根据合同编号查询已回款金额
     *
     * @param contractId 合同编号
     * @return 已回款金额
     */
    BigDecimal getReceivablePriceByContractId(Long contractId);
 
    /**
     * 获取总回款金额
     *
     * @return 总回款金额
     */
    BigDecimal getReceivablePriceSum();
 
    /**
     * 根据负责人查询回款金额
     *
     * @param ownerUserId 负责人编号
     * @return 回款金额
     */
    BigDecimal getReceivablePriceByOwnerUserId(Long ownerUserId);
 
}