jiangping
2024-07-18 64a6a81753abfc712b1ab384de0f7afb87f4fb23
server/service/src/main/java/com/doumee/service/business/impl/CustomerLogServiceImpl.java
@@ -1,5 +1,8 @@
package com.doumee.service.business.impl;
import com.doumee.biz.zbom.ZbomCRMService;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
@@ -29,6 +32,8 @@
    @Autowired
    private CustomerLogMapper customerLogMapper;
    @Autowired
    private ZbomCRMService zbomCRMService;
    @Override
    public Long create(CustomerLog customerLog) {
@@ -61,6 +66,37 @@
    }
    @Override
    public void reSubmit(CustomerLog customerLog){
        CustomerLog log = customerLogMapper.selectById(customerLog.getId());
        if(log ==null || Constants.equalsInteger(log.getIsdeleted(),Constants.ONE)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        if(Constants.equalsInteger(log.getCrmStatus(),Constants.ONE)){
            //如果已经提交成功过
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该留资数据已提交,无需重新提交!");
        }
        zbomCRMService.dealCustomerLogData(log);
    }
    @Override
    public void reSubmitAll(CustomerLog log){
        List<CustomerLog> logList = customerLogMapper.selectList(new QueryWrapper<CustomerLog>()
                .lambda()
                .eq(CustomerLog::getIsdeleted,Constants.ZERO)
                .eq(log.getCrmStatus()!=null,CustomerLog::getCrmStatus,log.getCrmStatus())
                .ne(CustomerLog::getCrmStatus,Constants.ONE));
        if(logList ==null || logList.size() ==0){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,不存在待处理数据");
        }
        if(Constants.equalsInteger(log.getCrmStatus(),Constants.ONE)){
            //如果已经提交成功过
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该留资数据已提交,无需重新提交!");
        }
        for(CustomerLog model :logList){
            zbomCRMService.dealCustomerLogData(model);
        }
    }
    @Override
    public void updateByIdInBatch(List<CustomerLog> customerLogs) {
        if (CollectionUtils.isEmpty(customerLogs)) {
            return;