liusheng
2024-07-04 713dfaf7fb56cb57ea5c60822b52e65c6e1a8202
smartor/src/main/java/com/smartor/service/impl/IvrTaskcalldetailServiceImpl.java
@@ -1,22 +1,15 @@
package com.smartor.service.impl;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.RSAPublicKeyExample;
import com.smartor.domain.IvrTaskSingle;
import com.smartor.domain.IvrTaskcalldetailReq;
import com.smartor.mapper.IvrTaskSingleMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.smartor.mapper.IvrTaskcalldetailMapper;
import com.smartor.domain.IvrTaskcalldetail;
import com.smartor.mapper.IvrTaskcalldetailMapper;
import com.smartor.mapper.ServiceSubtaskMapper;
import com.smartor.service.IIvrTaskcalldetailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * 语音任务呼叫明细Service业务层处理
@@ -31,10 +24,8 @@
    private IvrTaskcalldetailMapper ivrTaskcalldetailMapper;
    @Autowired
    private IvrTaskSingleMapper ivrTaskSingleMapper;
    private ServiceSubtaskMapper ivrTaskSingleMapper;
    @Value("${pri_key}")
    private String pri_key;
    /**
@@ -105,26 +96,4 @@
        return ivrTaskcalldetailMapper.deleteIvrTaskcalldetailByCalldetailid(calldetailid);
    }
    @Override
    public Integer saveQuestionAnswer(IvrTaskcalldetailReq ivrTaskcalldetailReq) {
        RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
        Long tid = Long.valueOf(rsaPublicKeyExample.decryptedData(ivrTaskcalldetailReq.getParam1(), pri_key));
        Long pid = Long.valueOf(rsaPublicKeyExample.decryptedData(ivrTaskcalldetailReq.getParam2(), pri_key));
        IvrTaskSingle ivrTaskSingle = new IvrTaskSingle();
        ivrTaskSingle.setTaskid(tid);
        ivrTaskSingle.setPatid(pid);
        List<IvrTaskSingle> ivrTaskSingles = ivrTaskSingleMapper.selectIvrTaskcallList(ivrTaskSingle);
        if (CollectionUtils.isEmpty(ivrTaskSingles) || ivrTaskSingles.size() == 0) {
            log.error("报错了,ivrTaskSingles数据为空了:{}", ivrTaskSingle);
            return 0;
        }
        for (IvrTaskcalldetail ivrTaskcalldetail : ivrTaskcalldetailReq.getIvrTaskcalldetailList()) {
            ivrTaskcalldetail.setCallid(ivrTaskSingles.get(0).getId().toString());
            ivrTaskcalldetail.setCalldetailid(UUID.randomUUID().toString());
            ivrTaskcalldetail.setCreateTime(new Date());
            ivrTaskcalldetailMapper.insertIvrTaskcalldetail(ivrTaskcalldetail);
        }
        return 1;
    }
}