|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.collection.ListUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.ReceivableCreateReqVO;
|
|
|
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.ReceivableExportReqVO;
|
|
@@ -11,10 +12,12 @@ import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.ReceivablePage
|
|
|
import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.ReceivableUpdateReqVO;
|
|
|
import cn.iocoder.yudao.module.crm.convert.receivable.ReceivableConvert;
|
|
|
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.ContractDO;
|
|
|
+import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
|
|
|
import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.ReceivableDO;
|
|
|
import cn.iocoder.yudao.module.crm.dal.mysql.receivable.ReceivableMapper;
|
|
|
import cn.iocoder.yudao.module.crm.enums.AuditStatusEnum;
|
|
|
import cn.iocoder.yudao.module.crm.service.contract.ContractService;
|
|
|
+import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
@@ -23,8 +26,7 @@ import java.util.Collection;
|
|
|
import java.util.List;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
-import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CONTRACT_NOT_EXISTS;
|
|
|
-import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.RECEIVABLE_NOT_EXISTS;
|
|
|
+import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
|
|
|
|
|
|
/**
|
|
|
* 回款管理 Service 实现类
|
|
@@ -39,15 +41,21 @@ public class ReceivableServiceImpl implements ReceivableService {
|
|
|
private ReceivableMapper receivableMapper;
|
|
|
@Resource
|
|
|
private ContractService contractService;
|
|
|
+ @Resource
|
|
|
+ private CrmCustomerService crmCustomerService;
|
|
|
|
|
|
@Override
|
|
|
public Long createReceivable(ReceivableCreateReqVO createReqVO) {
|
|
|
// TODO @liuhongfeng:planId 是否存在,是否合法,需要去校验;
|
|
|
- // TODO @liuhongfeng:其它类似 customerId、contractId 也需要去校验;
|
|
|
// 插入
|
|
|
ReceivableDO receivable = ReceivableConvert.INSTANCE.convert(createReqVO);
|
|
|
+ if (ObjectUtil.isNull(receivable.getStatus())){
|
|
|
+ receivable.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNull(receivable.getCheckStatus())){
|
|
|
+ receivable.setCheckStatus(AuditStatusEnum.AUDIT_NEW.getValue());
|
|
|
+ }
|
|
|
|
|
|
- receivable.setCheckStatus(AuditStatusEnum.AUDIT_NEW.getValue());
|
|
|
//校验
|
|
|
checkReceivable(receivable);
|
|
|
|
|
@@ -67,6 +75,11 @@ public class ReceivableServiceImpl implements ReceivableService {
|
|
|
throw exception(CONTRACT_NOT_EXISTS);
|
|
|
}
|
|
|
|
|
|
+ CrmCustomerDO customer = crmCustomerService.getCustomer(receivable.getCustomerId());
|
|
|
+ if(ObjectUtil.isNull(customer)){
|
|
|
+ throw exception(CUSTOMER_NOT_EXISTS);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|