suntianwu 3 年之前
父节点
当前提交
e5f692b485

+ 64 - 0
src/main/java/com/care/outcall/controller/KoalaOutCallController.java

@@ -0,0 +1,64 @@
+package com.care.outcall.controller;
+
+
+import com.care.outcall.entity.KoalaLoggerEntity;
+import com.care.outcall.service.KoalaOutCallService;
+import com.care.util.JsonUtil;
+import com.care.util.Result;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+/**
+ * @author stw
+ * @version 2.7.0 创建于 2019/7/15
+ **/
+@Api(value = "外呼操作-->考拉外呼日志记录", description = "外呼操作-->考拉外呼日志记录")
+@RestController
+@RequestMapping("/mcdcc/outcall/")
+public class KoalaOutCallController {
+    private static final Logger logger = LogManager.getLogger(KoalaOutCallController.class);
+
+    @Autowired
+    private KoalaOutCallService koalaOutCallService;
+
+    @ApiOperation(value = "记录呼叫中心日志API", notes = "记录呼叫中心日志")
+    @PostMapping(value = "/koala/addOptLog", produces = "application/json;charset=UTF-8", consumes = "application/json;charset=UTF-8")
+    public Result addOptLog(@RequestBody KoalaLoggerEntity koalaLoggerEntity) {
+        try {
+            if (logger.isDebugEnabled()) {
+                logger.debug(JsonUtil.toJson(koalaLoggerEntity));
+            }
+            koalaOutCallService.addOptLog(koalaLoggerEntity);
+        } catch (Exception e) {
+            logger.error("记录日志接口异常,异常信息:" + e.getMessage());
+        }
+        return Result.success();
+    }
+
+    @ApiOperation(value = "考拉外呼--手动外呼--坐席基础信息接口", notes = "考拉外呼--手动外呼--坐席基础信息接口")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "token", value = "放在请求头中的令牌", dataType = "String", paramType = "header", required = true)
+    })
+    @GetMapping(value = "/koala/getAgentInfo")
+    public Result getAgentInfo(@RequestHeader(name = "token") String token) {
+
+        try {
+//            Token tokenObj = TokenUtil.parseTokenStr(token);
+//            String userId = token.getPayload().getId();
+            String userId = "";
+            Map<String, String> map = this.koalaOutCallService.getAgentInfo(userId);
+            return Result.success();
+        } catch (Exception e) {
+            logger.error("获取坐席基础信息异常,信息为:" + e.getMessage());
+            return Result.error(e.getMessage());
+        }
+    }
+}

+ 0 - 44
src/main/java/com/care/outcall/controller/KoalaOutCallLogRecordController.java

@@ -1,44 +0,0 @@
-package com.care.outcall.controller;
-
-
-import com.care.outcall.entity.KoalaLoggerEntity;
-import com.care.outcall.service.KoalaOutCallLogRecordService;
-import com.care.util.JsonUtil;
-import com.care.util.Result;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author stw
- * @version 2.7.0 创建于 2019/7/15
- **/
-@Api(value = "外呼操作-->考拉外呼日志记录", description = "外呼操作-->考拉外呼日志记录")
-@RestController
-@RequestMapping("/mcdcc/outcall/")
-public class KoalaOutCallLogRecordController {
-    private static final Logger logger = LogManager.getLogger(KoalaOutCallLogRecordController.class);
-
-    @Autowired
-    private KoalaOutCallLogRecordService koalaOutCallLogRecordService;
-
-    @ApiOperation(value = "记录呼叫中心日志API", notes = "记录呼叫中心日志")
-    @PostMapping(value = "/koala/addOptLog", produces = "application/json;charset=UTF-8", consumes = "application/json;charset=UTF-8")
-    public Result addOptLog(@RequestBody KoalaLoggerEntity koalaLoggerEntity) {
-        try {
-            if (logger.isDebugEnabled()) {
-                logger.debug(JsonUtil.toJson(koalaLoggerEntity));
-            }
-            koalaOutCallLogRecordService.addOptLog(koalaLoggerEntity);
-        } catch (Exception e) {
-            logger.error("记录日志接口异常,异常信息:" + e.getMessage());
-        }
-        return Result.success();
-    }
-}

+ 7 - 5
src/main/java/com/care/outcall/entity/KoalaLogDomain.java

@@ -19,7 +19,7 @@ public class KoalaLogDomain extends KoalaLoggerEntity {
     private String eventStatus;
     private String computeTraffic;
 
-    private String taskId;
+    private String olderId;
     private String disNumber;
     private String md5FlowNo;
 
@@ -130,12 +130,14 @@ public class KoalaLogDomain extends KoalaLoggerEntity {
         this.computeTraffic = computeTraffic;
     }
 
-    public String getTaskId() {
-        return taskId;
+    @Override
+    public String getOlderId() {
+        return olderId;
     }
 
-    public void setTaskId(String taskId) {
-        this.taskId = taskId;
+    @Override
+    public void setOlderId(String olderId) {
+        this.olderId = olderId;
     }
 
     public String getDisNumber() {

+ 6 - 6
src/main/java/com/care/outcall/entity/KoalaLoggerEntity.java

@@ -17,8 +17,8 @@ public class KoalaLoggerEntity implements Serializable {
     private String apiEventStatus;
     @ApiModelProperty(dataType = "String", name = "agentId", value = "坐席id")
     private String agentId;
-    @ApiModelProperty(dataType = "String", name = "taskId", value = "任务id")
-    private String taskId;
+    @ApiModelProperty(dataType = "String", name = "olderId", value = "任务id")
+    private String olderId;
     @ApiModelProperty(dataType = "String", name = "outCallNumber", value = "外呼流水号")
     private String outCallNumber;
     @ApiModelProperty(dataType = "String", name = "disNumber", value = "外显号码")
@@ -60,12 +60,12 @@ public class KoalaLoggerEntity implements Serializable {
         this.agentId = agentId;
     }
 
-    public String getTaskId() {
-        return taskId;
+    public String getOlderId() {
+        return olderId;
     }
 
-    public void setTaskId(String taskId) {
-        this.taskId = taskId;
+    public void setOlderId(String olderId) {
+        this.olderId = olderId;
     }
 
     public String getOutCallNumber() {

+ 41 - 0
src/main/java/com/care/outcall/entity/KoalaOlderDto.java

@@ -0,0 +1,41 @@
+package com.care.outcall.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author stw
+ * @version 2.7.0 创建于 2019/7/17
+ **/
+@Data
+public class KoalaOlderDto implements Serializable {
+
+    /**
+     * 大有流水号
+     */
+    private String dyFlowNo;
+
+    /**
+     * 老人id
+     */
+    private String olderId;
+
+    /**
+     * 流水号信息
+     */
+    private String sessionId;
+
+    /**
+     * 大有企业号
+     */
+    private String enterpriseNo;
+
+    /**
+     * 创建时间
+     */
+    private String createTime;
+
+
+
+}

+ 11 - 132
src/main/java/com/care/outcall/entity/Bill.java

@@ -10,7 +10,7 @@ import java.util.Date;
  * @Date: Created In 2018/1/10 16:03
  * @Modified By:
  */
-public class Bill implements Serializable{
+public class KoalaOutCallBill implements Serializable{
     // '主键值为uuid',
     private String id;
     //'呼叫号码或md5身份证号',
@@ -21,53 +21,29 @@ public class Bill implements Serializable{
     private String origOutCallStatus;
     //通话结果状态:1.成功通话2.废号(空号/欠费/停机)3.无法接通(占线/转秘书台)4.无法接通(占线/转秘书台)5.无人接(未接听)6.无人接(主动挂)7.传真机/总机8.关机
     private String callResultStatus;
-    private String teleCallsId;//COMMENT '客户编号(电信)',
+
     private String batchId;//'电信:任务编号,联通:批次号',
-    private String teleTaskName;//'任务名称',
+
     private String sessionId;// '会话id,通话唯一标识,联通为uuid',
     private String teleEntId;//'企业id',
     private String teleAgentId;// '坐席id',
     private String outCallRadioStatus;//'录件获取状态,(电信:1.未获取,2.已获取),(联通:PRS001.未获取,PRS002.已获取,PRS003.已获取 ,无录音)',
     private String clientAlertStartTime;//'客户振铃开始时间,(电信:yyyyMMddHHmmss),(联通:有值,但是格式未知)',
     private String callDuration;//'通话时长,时间单位秒',
-    private String callResultType;//'0.呼入,1.呼出,统一是外呼,即呼出。',
     private String hangupType;//'0.客户挂断,1.坐席挂断',
     private String callStartTime;// '通话开始时间',
     // '通话结束时间',
     private String callEndTime;
     // '音频地址',
     private String audioUrl;
-    // '平台类型,1.电信,2.联通,3.移动'
-    private Integer channelFlag;
-    //电信分配给企业的分配id
-    private String teleCustomerId;
+
 
     //业务字段
-    private String logsId;
     private Date createTime;
     private Date updateTime;
     private String enterpriseNo;
     private String enterpriseId;
-    private String dySid;
-    private String audioMp3Url;
-
-    private String realFlowNo;
 
-    private String telecomTaskId;
-    private String listenType;
-    //话单标识为呼损率,0.自动未呼损(默认)、1.自动外呼呼损
-    private String loss;
-    //自动外呼生成外呼,0.手动外呼(默认),1.自动外呼
-    private String auto;
-
-
-    public String getListenType() {
-        return listenType;
-    }
-
-    public void setListenType(String listenType) {
-        this.listenType = listenType;
-    }
 
     public Date getCreateTime() {
         return createTime;
@@ -93,22 +69,6 @@ public class Bill implements Serializable{
         this.enterpriseNo = enterpriseNo;
     }
 
-    public String getLogsId() {
-        return logsId;
-    }
-
-    public void setLogsId(String logsId) {
-        this.logsId = logsId;
-    }
-
-    public String getTeleCustomerId() {
-        return teleCustomerId;
-    }
-
-    public void setTeleCustomerId(String teleCustomerId) {
-        this.teleCustomerId = teleCustomerId;
-    }
-
     public String getId() {
         return id;
     }
@@ -133,13 +93,6 @@ public class Bill implements Serializable{
         this.outCallStatus = outCallStatus;
     }
 
-    public String getTeleCallsId() {
-        return teleCallsId;
-    }
-
-    public void setTeleCallsId(String teleCallsId) {
-        this.teleCallsId = teleCallsId;
-    }
 
     public String getBatchId() {
         return batchId;
@@ -149,14 +102,6 @@ public class Bill implements Serializable{
         this.batchId = batchId;
     }
 
-    public String getTeleTaskName() {
-        return teleTaskName;
-    }
-
-    public void setTeleTaskName(String teleTaskName) {
-        this.teleTaskName = teleTaskName;
-    }
-
     public String getSessionId() {
         return sessionId;
     }
@@ -205,13 +150,6 @@ public class Bill implements Serializable{
         this.callDuration = callDuration;
     }
 
-    public String getCallResultType() {
-        return callResultType;
-    }
-
-    public void setCallResultType(String callResultType) {
-        this.callResultType = callResultType;
-    }
 
     public String getHangupType() {
         return hangupType;
@@ -245,13 +183,6 @@ public class Bill implements Serializable{
         this.audioUrl = audioUrl;
     }
 
-    public Integer getChannelFlag() {
-        return channelFlag;
-    }
-
-    public void setChannelFlag(Integer channelFlag) {
-        this.channelFlag = channelFlag;
-    }
 
     public String getOrigOutCallStatus() {
         return origOutCallStatus;
@@ -269,53 +200,6 @@ public class Bill implements Serializable{
         this.callResultStatus = callResultStatus;
     }
 
-    public String getDySid() {
-        return dySid;
-    }
-
-    public void setDySid(String dySid) {
-        this.dySid = dySid;
-    }
-
-    public String getAudioMp3Url() {
-        return audioMp3Url;
-    }
-
-    public void setAudioMp3Url(String audioMp3Url) {
-        this.audioMp3Url = audioMp3Url;
-    }
-
-    public String getRealFlowNo() {
-        return realFlowNo;
-    }
-
-    public void setRealFlowNo(String realFlowNo) {
-        this.realFlowNo = realFlowNo;
-    }
-
-    public String getTelecomTaskId() {
-        return telecomTaskId;
-    }
-
-    public void setTelecomTaskId(String telecomTaskId) {
-        this.telecomTaskId = telecomTaskId;
-    }
-
-    public String getLoss() {
-        return loss;
-    }
-
-    public void setLoss(String loss) {
-        this.loss = loss;
-    }
-
-    public String getAuto() {
-        return auto;
-    }
-
-    public void setAuto(String auto) {
-        this.auto = auto;
-    }
 
     public String getEnterpriseId() {
         return enterpriseId;
@@ -327,37 +211,32 @@ public class Bill implements Serializable{
 
     @Override
     public String toString() {
-        return "Bill{" +
+        return "KoalaOutCallBill{" +
                 "id='" + id + '\'' +
                 ", clientFlowNo='" + clientFlowNo + '\'' +
                 ", outCallStatus='" + outCallStatus + '\'' +
                 ", origOutCallStatus='" + origOutCallStatus + '\'' +
                 ", callResultStatus='" + callResultStatus + '\'' +
-                ", teleCallsId='" + teleCallsId + '\'' +
+
                 ", batchId='" + batchId + '\'' +
-                ", teleTaskName='" + teleTaskName + '\'' +
+
                 ", sessionId='" + sessionId + '\'' +
                 ", teleEntId='" + teleEntId + '\'' +
                 ", teleAgentId='" + teleAgentId + '\'' +
                 ", outCallRadioStatus='" + outCallRadioStatus + '\'' +
                 ", clientAlertStartTime='" + clientAlertStartTime + '\'' +
                 ", callDuration='" + callDuration + '\'' +
-                ", callResultType='" + callResultType + '\'' +
+
                 ", hangupType='" + hangupType + '\'' +
                 ", callStartTime='" + callStartTime + '\'' +
                 ", callEndTime='" + callEndTime + '\'' +
                 ", audioUrl='" + audioUrl + '\'' +
-                ", channelFlag=" + channelFlag +
-                ", teleCustomerId='" + teleCustomerId + '\'' +
-                ", logsId='" + logsId + '\'' +
+
                 ", createTime=" + createTime +
                 ", updateTime=" + updateTime +
                 ", enterpriseNo='" + enterpriseNo + '\'' +
-                ", dySid='" + dySid + '\'' +
-                ", audioMp3Url='" + audioMp3Url + '\'' +
-                ", realFlowNo='" + realFlowNo + '\'' +
-                ", auto='" + auto + '\'' +
-                ", loss='" + loss + '\'' +
+
+
                 '}';
     }
 

+ 0 - 127
src/main/java/com/care/outcall/entity/KoalaTaskDto.java

@@ -1,127 +0,0 @@
-package com.care.outcall.entity;
-
-import java.io.Serializable;
-
-/**
- * @author 许明
- * @version 2.7.0 创建于 2019/7/17
- **/
-public class KoalaTaskDto implements Serializable {
-
-    /**
-     * 大有流水号,MD5+
-     */
-    private String dyFlowNo;
-
-    /**
-     * 考拉流水号,AES加密
-     */
-    private String koalaFlowNo;
-
-    /**
-     * 大有任务号
-     */
-    private String dyTaskNo;
-
-    /**
-     * 大有任务id
-     */
-    private String dyTaskId;
-
-    /**
-     * 大有任务名称
-     */
-    private String dyTaskName;
-
-    /**
-     * 流水号信息
-     */
-    private String sessionId;
-
-    /**
-     * 大有企业号
-     */
-    private String enterpriseNo;
-
-    /**
-     * 大有企业Id
-     */
-    private String enterpriseId;
-
-    /**
-     * 创建时间
-     */
-    private String createTime;
-
-    public String getDyFlowNo() {
-        return dyFlowNo;
-    }
-
-    public void setDyFlowNo(String dyFlowNo) {
-        this.dyFlowNo = dyFlowNo;
-    }
-
-    public String getDyTaskNo() {
-        return dyTaskNo;
-    }
-
-    public void setDyTaskNo(String dyTaskNo) {
-        this.dyTaskNo = dyTaskNo;
-    }
-
-    public String getDyTaskId() {
-        return dyTaskId;
-    }
-
-    public void setDyTaskId(String dyTaskId) {
-        this.dyTaskId = dyTaskId;
-    }
-
-    public String getDyTaskName() {
-        return dyTaskName;
-    }
-
-    public void setDyTaskName(String dyTaskName) {
-        this.dyTaskName = dyTaskName;
-    }
-
-    public String getSessionId() {
-        return sessionId;
-    }
-
-    public void setSessionId(String sessionId) {
-        this.sessionId = sessionId;
-    }
-
-    public String getEnterpriseNo() {
-        return enterpriseNo;
-    }
-
-    public void setEnterpriseNo(String enterpriseNo) {
-        this.enterpriseNo = enterpriseNo;
-    }
-
-    public String getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(String createTime) {
-        this.createTime = createTime;
-    }
-
-    public String getKoalaFlowNo() {
-        return koalaFlowNo;
-    }
-
-    public void setKoalaFlowNo(String koalaFlowNo) {
-        this.koalaFlowNo = koalaFlowNo;
-    }
-
-    public String getEnterpriseId() {
-        return enterpriseId;
-    }
-
-    public void setEnterpriseId(String enterpriseId) {
-        this.enterpriseId = enterpriseId;
-    }
-}

+ 0 - 41
src/main/java/com/care/outcall/mapper/KoalaLoggerDao.java

@@ -1,41 +0,0 @@
-package com.care.outcall.mapper;
-
-
-import com.care.outcall.entity.Bill;
-import com.care.outcall.entity.KoalaLogDomain;
-import com.care.outcall.entity.KoalaTaskDto;
-import org.apache.ibatis.annotations.Param;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author 许明
- * @version 2.7.0.0 创建于 2018/7/16
- **/
-@Repository
-public interface KoalaLoggerDao {
-
-    List<KoalaLogDomain> getAllBillInfo();
-
-    int checkSession(@Param("sessionId") String sessionId);
-
-    int addBill(Bill bill);
-
-
-    int updatePhoneBillBySessionIdNew(Bill params);
-
-    void updateComputeTraffic(List<Map<String, String>> logList);
-
-    void updateMakeCallStatus(List<String> ids);
-
-    void updateIsCallStatusByTaskId(@Param("taskId") String taskId, @Param("flowNo") String flowNo);
-
-    void updateComputeTrafficToFinish();
-
-    List<KoalaTaskDto> getTaskInfoBySessionId(@Param("sessionId") String sessionId);
-
-
-
-}

+ 53 - 0
src/main/java/com/care/outcall/mapper/KoalaOutCallDao.java

@@ -0,0 +1,53 @@
+package com.care.outcall.mapper;
+
+
+import com.care.outcall.entity.KoalaOutCallBill;
+import com.care.outcall.entity.KoalaLogDomain;
+import com.care.outcall.entity.KoalaOlderDto;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author 许明
+ * @version 2.7.0.0 创建于 2018/7/16
+ **/
+@Repository
+public interface KoalaOutCallDao {
+    /**
+     * 根据大有坐席id获取,考拉坐席号、账户编号和坐席密码
+     *
+     * @param userId 大有坐席id
+     * @return 返回:考拉坐席号、账户编号和坐席密码
+     */
+    Map<String, String> getKoalaAccountNoAndApiSecretByUserId(@Param(value = "userId") String userId);
+
+    /**
+     * 记录考拉外呼日志
+     * @param kaoLaLogDomain
+     */
+    void addOptLog(KoalaLogDomain kaoLaLogDomain);
+
+    List<KoalaLogDomain> getAllBillInfo();
+
+    int checkSession(@Param("sessionId") String sessionId);
+
+    int addBill(KoalaOutCallBill koalaOutCallBill);
+
+
+    int updatePhoneBillBySessionIdNew(KoalaOutCallBill params);
+
+    void updateComputeTraffic(List<Map<String, String>> logList);
+
+    void updateMakeCallStatus(List<String> ids);
+
+
+    void updateComputeTrafficToFinish();
+
+    List<KoalaOlderDto> getOlderInfoBySessionId(@Param("sessionId") String sessionId);
+
+
+
+}

+ 0 - 20
src/main/java/com/care/outcall/mapper/KoalaOutCallLogRecordDao.java

@@ -1,20 +0,0 @@
-package com.care.outcall.mapper;
-
-
-import com.care.outcall.entity.KoalaLogDomain;
-import org.springframework.stereotype.Repository;
-
-/**
- * @author stw
- * @version 2.7.0 创建于 2019/7/15
- **/
-@Repository
-public interface KoalaOutCallLogRecordDao {
-
-    /**
-     * 记录考拉外呼日志
-     * @param kaoLaLogDomain
-     */
-    void addOptLog(KoalaLogDomain kaoLaLogDomain);
-
-}

+ 56 - 73
src/main/java/com/care/outcall/schedule/CcKoalaPhoneBillSchuding.java

@@ -1,10 +1,10 @@
 package com.care.outcall.schedule;
 
 
-import com.care.outcall.entity.Bill;
+import com.care.outcall.entity.KoalaOlderDto;
+import com.care.outcall.entity.KoalaOutCallBill;
 import com.care.outcall.entity.KoalaLogDomain;
-import com.care.outcall.entity.KoalaTaskDto;
-import com.care.outcall.mapper.KoalaLoggerDao;
+import com.care.outcall.mapper.KoalaOutCallDao;
 import com.care.util.CommonConfUtil;
 import com.care.util.DateUtils;
 import org.apache.logging.log4j.LogManager;
@@ -23,11 +23,11 @@ import java.util.*;
  **/
 @Configuration
 @EnableScheduling
-public class CcKoalaPhoneBillSchuding {
-    private static final Logger logger = LogManager.getLogger(CcKoalaPhoneBillSchuding.class);
+public class KoalaOutCallBillSchuding {
+    private static final Logger logger = LogManager.getLogger(KoalaOutCallBillSchuding.class);
 
     @Autowired
-    private KoalaLoggerDao koalaLoggerDao;
+    private KoalaOutCallDao koalaOutCallDao;
 
 
     /**
@@ -48,7 +48,7 @@ public class CcKoalaPhoneBillSchuding {
     public void updateComputeTrafficToFinish() {
         try {
             //大于两天的话单日志默认已计算
-            koalaLoggerDao.updateComputeTrafficToFinish();
+            koalaOutCallDao.updateComputeTrafficToFinish();
         } catch (Exception e) {
             e.getMessage();
         }
@@ -65,7 +65,7 @@ public class CcKoalaPhoneBillSchuding {
         List<Map<String, String>> idList = new ArrayList<>();
         List<String> makeCallIds = new ArrayList<>();
         //获取所有未计算的话单
-        List<KoalaLogDomain> logList = koalaLoggerDao.getAllBillInfo();
+        List<KoalaLogDomain> logList = koalaOutCallDao.getAllBillInfo();
         //重新构建话单日志结构
         reBuildBill(map, logList);
 
@@ -76,46 +76,44 @@ public class CcKoalaPhoneBillSchuding {
             //描述事件的生存周期:1.坐席振铃,2.坐席接通,3.客户振铃,4.客户接通,5.坐席挂断,6.客户挂断,7.未接通
             if (logDomains.size() > 2) {
                 //构建大有话单 关于成功话单部分
-                Bill bill = buildDataUBill(sid, logDomains, makeCallIds);
-                if (bill == null) {
+                KoalaOutCallBill koalaOutCallBill = buildDataUBill(sid, logDomains, makeCallIds);
+                if (koalaOutCallBill == null) {
                     continue;
                 }
-                if (StringUtils.isEmpty(bill.getOutCallRadioStatus())) {
-                    bill.setOutCallRadioStatus("1");
+                if (StringUtils.isEmpty(koalaOutCallBill.getOutCallRadioStatus())) {
+                    koalaOutCallBill.setOutCallRadioStatus("1");
                 }
-                bill.setCallResultStatus("1");
-                bill.setListenType("2");//默认设置为sip接听,后期会变
+                koalaOutCallBill.setCallResultStatus("1");
                 //判断话单表是否已存在该数据,不存在则新增,存在则更新状态
-                int count = koalaLoggerDao.checkSession(bill.getSessionId());
+                int count = koalaOutCallDao.checkSession(koalaOutCallBill.getSessionId());
                 if (count == 0) {
                     //不存在则新增
                     try {
-                        koalaLoggerDao.addBill(bill);
+                        koalaOutCallDao.addBill(koalaOutCallBill);
                     } catch (Exception e) {
                         logger.error("生成考拉话单异常,信息为:" + e.getMessage());
                     }
                 } else {
-                    koalaLoggerDao.updatePhoneBillBySessionIdNew(bill);
+                    koalaOutCallDao.updatePhoneBillBySessionIdNew(koalaOutCallBill);
                 }
                 Map<String, String> idMap = new HashMap<>();
                 idMap.put("id", sid);
                 idList.add(idMap);
             } else if (logDomains.size() >= 1 && logDomains.size() <= 2) {
                 //构建大有话单 关于未接通的话单部分
-                Bill bill = buildDataUBill(sid, logDomains, makeCallIds);
-                if (bill == null) {
+                KoalaOutCallBill koalaOutCallBill = buildDataUBill(sid, logDomains, makeCallIds);
+                if (koalaOutCallBill == null) {
                     continue;
                 }
-                bill.setOrigOutCallStatus("2");
-                bill.setOutCallRadioStatus("2");
-                bill.setOutCallStatus("2");
-                bill.setListenType("2");//默认设置为sip接听,后期会变
+                koalaOutCallBill.setOrigOutCallStatus("2");
+                koalaOutCallBill.setOutCallRadioStatus("2");
+                koalaOutCallBill.setOutCallStatus("2");
 
-                int count = koalaLoggerDao.checkSession(bill.getSessionId());
+                int count = koalaOutCallDao.checkSession(koalaOutCallBill.getSessionId());
                 if (count == 0) {
-                    koalaLoggerDao.addBill(bill);
+                    koalaOutCallDao.addBill(koalaOutCallBill);
                 } else {
-                    koalaLoggerDao.updatePhoneBillBySessionIdNew(bill);
+                    koalaOutCallDao.updatePhoneBillBySessionIdNew(koalaOutCallBill);
                 }
                 Map<String, String> idMap = new HashMap<>();
                 idMap.put("id", sid);
@@ -123,17 +121,17 @@ public class CcKoalaPhoneBillSchuding {
             }
         }
         if (!idList.isEmpty()) {
-            koalaLoggerDao.updateComputeTraffic(idList);
+            koalaOutCallDao.updateComputeTraffic(idList);
         }
         if (!makeCallIds.isEmpty()) {
-            koalaLoggerDao.updateMakeCallStatus(makeCallIds);
+            koalaOutCallDao.updateMakeCallStatus(makeCallIds);
         }
     }
 
     //构建大有话单
-    private synchronized Bill buildDataUBill(String sessionId, List<KoalaLogDomain> logDomains, List<String> idList) {
+    private synchronized KoalaOutCallBill buildDataUBill(String sessionId, List<KoalaLogDomain> logDomains, List<String> idList) {
         try {
-            Bill bill = new Bill();
+            KoalaOutCallBill koalaOutCallBill = new KoalaOutCallBill();
             //离外呼最近的事件时间
             String receiveTime = "";
             //通话计费开始时间
@@ -152,8 +150,8 @@ public class CcKoalaPhoneBillSchuding {
             String tenantId = "";
             //被叫号码
             String calledNumber = "";
-            //任务id
-            String taskId = "";
+            //老人id
+            String olderId = "";
             //开始外呼时间,用于记录无人接听的时候的开始时间
             String unReceivedCallStartTime = "";
             boolean callFlag = false;
@@ -166,7 +164,7 @@ public class CcKoalaPhoneBillSchuding {
             for (KoalaLogDomain logDomain : logDomains) {
                 tenantId = logDomain.getTenantId();
                 calledNumber = logDomain.getCalledNumber();
-                taskId = logDomain.getTaskId();
+                olderId = logDomain.getOlderId();
                 break;
             }
             for (KoalaLogDomain logDomain : logDomains) {
@@ -212,10 +210,6 @@ public class CcKoalaPhoneBillSchuding {
             if (!unCalledFlag) {
                 callStartTime = unReceivedCallStartTime;
             }
-            if (isCalledFlag) {
-                //更新流水号表已拨打状态
-                koalaLoggerDao.updateIsCallStatusByTaskId(taskId, calledNumber);
-            }
 
             //表示是正常的话单数据,有录音文件(考拉接通即产生录音)
             String creationTime = dialingTime.replaceAll("-", "").replaceAll(":", "").replaceAll(" ", "");
@@ -225,51 +219,47 @@ public class CcKoalaPhoneBillSchuding {
             //构建考拉外呼录音文件路径
             String audioUrl = audioUri + "/" + tenantId + "/" + audioCreateTime + "/" + sessionId + "_" + calledNumber + ".mp3";
             //根据 sessionId 获取 sessionId 对应的流水号,和电信任务的具体信息
-            List<KoalaTaskDto> koalaTaskDtoList = koalaLoggerDao.getTaskInfoBySessionId(sessionId);
-            if (koalaTaskDtoList == null || koalaTaskDtoList.isEmpty()) {
+            List<KoalaOlderDto> koalaOlderDtoList = koalaOutCallDao.getOlderInfoBySessionId(sessionId);
+            if (koalaOlderDtoList == null || koalaOlderDtoList.isEmpty()) {
                 logger.info("没有找到 sessionId={} 对应信息的流水号信息", sessionId);
                 return null;
             }
-            KoalaTaskDto koalaTaskDto = getNewOne(koalaTaskDtoList);
+            KoalaOlderDto koalaOlderDto = getNewOne(koalaOlderDtoList);
 
-            bill.setTelecomTaskId(koalaTaskDto.getDyTaskId());
             //新增,内容----
             //屏蔽内容 ----
             KoalaLogDomain logDomain = logDomains.get(0);
             //该会话的坐席号
             String agentId = logDomain.getAgentId();
             //该会话的企业id
-            bill.setClientFlowNo(koalaTaskDto.getDyFlowNo());
-            bill.setCallStartTime(callStartTime);
-            bill.setOutCallStatus("1");
-            bill.setOrigOutCallStatus("1");
-            bill.setCallResultStatus(callResultStatus);
-            bill.setCallEndTime(callEndTime);
-            bill.setAudioUrl(audioUrl);
-            bill.setOutCallRadioStatus("2");//录件获取状态。1未获取,2已获取
-            bill.setBatchId(koalaTaskDto.getDyTaskNo());
-            bill.setTeleTaskName(koalaTaskDto.getDyTaskName());
-            bill.setSessionId(sessionId);
-            bill.setTeleAgentId(agentId);
+            koalaOutCallBill.setClientFlowNo(koalaOlderDto.getDyFlowNo());
+            koalaOutCallBill.setCallStartTime(callStartTime);
+            koalaOutCallBill.setOutCallStatus("1");
+            koalaOutCallBill.setOrigOutCallStatus("1");
+            koalaOutCallBill.setCallResultStatus(callResultStatus);
+            koalaOutCallBill.setCallEndTime(callEndTime);
+            koalaOutCallBill.setAudioUrl(audioUrl);
+            koalaOutCallBill.setOutCallRadioStatus("2");//录件获取状态。1未获取,2已获取
+            koalaOutCallBill.setBatchId(koalaOlderDto.getOlderId());
+            koalaOutCallBill.setSessionId(sessionId);
+            koalaOutCallBill.setTeleAgentId(agentId);
             //大有
-            bill.setClientAlertStartTime(clientAlterTime);
+            koalaOutCallBill.setClientAlertStartTime(clientAlterTime);
             if (callFlag && !unCalledFlag) {
-                bill.setCallDuration("0");
+                koalaOutCallBill.setCallDuration("0");
             } else {
                 try {
                     long callDuration = DateUtils.compute_yyyy_MM_ddHHmmssTime(callStartTime, callEndTime);
-                    bill.setCallDuration(String.valueOf(callDuration));
+                    koalaOutCallBill.setCallDuration(String.valueOf(callDuration));
                 } catch (Exception e) {
                     logger.error("时间处理异常,异常信息为==>" + e.getMessage());
-                    bill.setCallDuration("0");
+                    koalaOutCallBill.setCallDuration("0");
                 }
             }
 
-            bill.setCallResultType("1");//呼出
-            bill.setHangupType(hangupType);
-            bill.setChannelFlag(6);
-            bill.setEnterpriseNo(koalaTaskDto.getEnterpriseNo());
-            return bill;
+            koalaOutCallBill.setHangupType(hangupType);
+            koalaOutCallBill.setEnterpriseNo(koalaOlderDto.getEnterpriseNo());
+            return koalaOutCallBill;
         } catch (Exception e) {
             logger.error("计算话单失败,失败原因={}", e.getMessage());
             //e.printStackTrace();
@@ -329,21 +319,14 @@ public class CcKoalaPhoneBillSchuding {
         noRepeatSetMap.clear();
     }
 
-    private KoalaTaskDto getNewOne(List<KoalaTaskDto> koalaTaskDtoList) {
-        koalaTaskDtoList.sort(new Comparator<KoalaTaskDto>() {
+    private KoalaOlderDto getNewOne(List<KoalaOlderDto> koalaOlderDtoList) {
+        koalaOlderDtoList.sort(new Comparator<KoalaOlderDto>() {
             @Override
-            public int compare(KoalaTaskDto o1, KoalaTaskDto o2) {
+            public int compare(KoalaOlderDto o1, KoalaOlderDto o2) {
                 return Integer.valueOf(String.valueOf(Long.parseLong(o2.getCreateTime()) - Long.parseLong(o1.getCreateTime())));
             }
         });
-        return koalaTaskDtoList.get(0);
+        return koalaOlderDtoList.get(0);
     }
 
-    public static void main(String[] args) {
-        double a = 1000000000.22;
-        float b = 10.22f;
-        String s = "1";
-        s = s + 1;
-        s += 1;
-    }
 }

+ 0 - 13
src/main/java/com/care/outcall/service/KoalaOutCallLogRecordService.java

@@ -1,13 +0,0 @@
-package com.care.outcall.service;
-
-
-import com.care.outcall.entity.KoalaLoggerEntity;
-
-/**
- * @author stw
- * @version 2.7.0 创建于 2019/7/15
- **/
-public interface KoalaOutCallLogRecordService {
-
-    void addOptLog(KoalaLoggerEntity koalaLoggerEntity) throws Exception;
-}

+ 21 - 0
src/main/java/com/care/outcall/service/KoalaOutCallService.java

@@ -0,0 +1,21 @@
+package com.care.outcall.service;
+
+
+import com.care.outcall.entity.KoalaLoggerEntity;
+
+import java.util.Map;
+
+/**
+ * @author stw
+ * @version 2.7.0 创建于 2019/7/15
+ **/
+public interface KoalaOutCallService {
+    /**
+     * 考拉坐席基本信息接口
+     *
+     * @return 返回 坐席信息
+     */
+    Map<String, String> getAgentInfo(String userId) throws Exception;
+
+    void addOptLog(KoalaLoggerEntity koalaLoggerEntity) throws Exception;
+}

+ 25 - 6
src/main/java/com/care/outcall/service/impl/KoalaOutCallLogRecordServiceImpl.java

@@ -3,13 +3,14 @@ package com.care.outcall.service.impl;
 
 import com.care.outcall.entity.KoalaLogDomain;
 import com.care.outcall.entity.KoalaLoggerEntity;
-import com.care.outcall.mapper.KoalaOutCallLogRecordDao;
-import com.care.outcall.service.KoalaOutCallLogRecordService;
+import com.care.outcall.mapper.KoalaOutCallDao;
+import com.care.outcall.service.KoalaOutCallService;
 import com.care.util.DateUtils;
 import com.care.util.JsonUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -17,14 +18,14 @@ import java.util.Map;
  * @version 2.7.0 创建于 2019/7/15
  **/
 @Service
-public class KoalaOutCallLogRecordServiceImpl implements KoalaOutCallLogRecordService {
+public class KoalaOutCallServiceImpl implements KoalaOutCallService {
 
     @Autowired
-    private KoalaOutCallLogRecordDao koalaOutCallLogRecordDao;
+    private KoalaOutCallDao koalaOutCallDao;
 
     @Override
     public void addOptLog(KoalaLoggerEntity koalaLoggerEntity) throws Exception {
-        koalaOutCallLogRecordDao.addOptLog(makeLog(koalaLoggerEntity));
+        koalaOutCallDao.addOptLog(makeLog(koalaLoggerEntity));
     }
 
     private static Map<String, Object> parseJson(String json) throws Exception {
@@ -40,7 +41,7 @@ public class KoalaOutCallLogRecordServiceImpl implements KoalaOutCallLogRecordSe
 
         domain.setAgentId(koalaLoggerEntity.getAgentId());
         domain.setEntNo(koalaLoggerEntity.getEntNo());
-        domain.setTaskId(koalaLoggerEntity.getTaskId());
+        domain.setOlderId(koalaLoggerEntity.getOlderId());
         domain.setDisNumber(koalaLoggerEntity.getDisNumber());
 
         //解析请求结果,获取sessionId和坐席分机号等
@@ -103,4 +104,22 @@ public class KoalaOutCallLogRecordServiceImpl implements KoalaOutCallLogRecordSe
         }
         return eventStatus;
     }
+
+    @Override
+    public Map<String, String> getAgentInfo(String userId) throws Exception {
+
+        Map<String, String> koalaAccountNoAndApiSecret = this.koalaOutCallDao.getKoalaAccountNoAndApiSecretByUserId(userId);
+
+        String accountNo = koalaAccountNoAndApiSecret.get("accountNo");
+        String entId = koalaAccountNoAndApiSecret.get("entId");
+        String agentId = koalaAccountNoAndApiSecret.get("agentId");
+        String agentPassword = koalaAccountNoAndApiSecret.get("agentPassword");
+
+        Map<String, String> map = new HashMap<>();
+        map.put("entId", entId);
+        map.put("accountNo", accountNo);
+        map.put("agentId", agentId);
+        map.put("agentPassword", agentPassword);
+        return map;
+    }
 }

+ 349 - 0
src/main/resources/mybatis/KoalaOutCallMapper.xml

@@ -0,0 +1,349 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.care.outcall.mapper.KoalaOutCallDao">
+
+    <select id="getKoalaAccountNoAndApiSecretByUserId" resultType="Map">
+        select
+        substring(cua.agent_id, 1, INSTR(cua.agent_id, '@') - 1) as agentId,
+        cue.account_no as accountNo,
+        cua.agent_password as agentPassword,
+        cue.ent_id as entId
+        from cc_upstream_agent cua
+        left join cc_upstream_ent cue on cue.id = cua.cue_id and cue.channel_type = cua.channel_type
+        left join cc_user_relations cur on cur.other_id = cua.id and cur.channel_type = cua.channel_type
+        where cur.user_id = #{userId} limit 1
+    </select>
+    <insert id="addOptLog" parameterType="com.care.outcall.entity.KoalaLogDomain">
+        INSERT INTO cc_koala_log
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            create_time,
+            update_time,
+            id,
+            <if test="entNo!=null and entNo!='' ">
+                ent_id,
+            </if>
+            <if test="tenantId!=null and tenantId!='' ">
+                tenant_id,
+            </if>
+            <if test="agentId!=null and agentId!='' ">
+                agent_id,
+            </if>
+            <if test="agentNumber!=null and agentNumber!='' ">
+                agent_number,
+            </if>
+            <if test="sessionId!=null and sessionId!='' ">
+                session_id,
+            </if>
+            <if test="result!=null and result!='' ">
+                result,
+            </if>
+            <if test="apiMethod!=null and apiMethod!='' ">
+                api_method,
+            </if>
+            <if test="calledNumber!=null and calledNumber!='' ">
+                called_number,
+            </if>
+            <if test="receiveTime!=null and receiveTime!='' ">
+                receive_time,
+            </if>
+            <if test="eventStatus!=null">
+                event_status,
+            </if>
+            <if test="computeTraffic!=null ">
+                compute_traffic,
+            </if>
+            <if test="disNumber!=null ">
+                out_display_no,
+            </if>
+            <if test="olderId!=null ">
+                older_id,
+            </if>
+        </trim>
+        VALUES
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            now(),
+            now(),
+            uuid(),
+            <if test="entNo!=null and entNo!='' ">
+                (select id from cc_enterprise where enterprise_no=#{entNo}),
+            </if>
+            <if test="tenantId!=null and tenantId!='' ">
+                #{tenantId},
+            </if>
+            <if test="agentId!=null and agentId!='' ">
+                #{agentId},
+            </if>
+            <if test="agentNumber!=null and agentNumber!='' ">
+                #{agentNumber},
+            </if>
+            <if test="sessionId!=null and sessionId!='' ">
+                #{sessionId},
+            </if>
+            <if test="result!=null and result!='' ">
+                #{result},
+            </if>
+            <if test="apiMethod!=null and apiMethod!='' ">
+                #{apiMethod},
+            </if>
+            <if test="calledNumber!=null and calledNumber!='' ">
+                #{calledNumber},
+            </if>
+            <if test="receiveTime!=null and receiveTime!='' ">
+                #{receiveTime},
+            </if>
+            <if test="eventStatus!=null">
+                #{eventStatus},
+            </if>
+            <if test="computeTraffic!=null ">
+                #{computeTraffic},
+            </if>
+            <if test="disNumber!=null ">
+                #{disNumber},
+            </if>
+            <if test="olderId!=null ">
+                #{olderId},
+            </if>
+        </trim>
+    </insert>
+
+
+    <select id="getAllBillInfo" resultType="com.care.outcall.entity.KoalaLogDomain">
+        SELECT
+         create_time as createTime,
+        id,
+        ent_id as entId,
+        tenant_id as tenantId,
+        agent_id as agentId,
+        agent_number as agentNumber,
+        session_id as sessionId,
+        result,
+        api_method as apiMethod,
+        called_number as calledNumber,
+        receive_time as receiveTime,
+        event_status as eventStatus,
+        compute_traffic as computeTraffic,
+        out_display_no as disNumber,
+        older_id as olderId
+        FROM cc_koala_log WHERE compute_traffic=0 and older_id &lt;> '-1'
+    </select>
+
+    <select id="checkSession" parameterType="java.lang.String" resultType="java.lang.Integer">
+        SELECT COUNT(1)
+        FROM cc_traffic_billed
+        WHERE session_id = #{sessionId}
+    </select>
+
+    <insert id="addBill" parameterType="com.care.outcall.entity.KoalaOutCallBill">
+        INSERT INTO cc_traffic_billed
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            id,
+            <if test="clientFlowNo!=null and clientFlowNo!='' ">
+                client_flow_no,
+            </if>
+            <if test="outCallStatus!=null and outCallStatus!='' ">
+                out_call_status,
+            </if>
+            <if test="origOutCallStatus!=null and origOutCallStatus!='' ">
+                orig_out_call_status,
+            </if>
+            <if test="callResultStatus!=null and callResultStatus!='' ">
+                call_result_status,
+            </if>
+
+            <if test="batchId!=null and batchId!='' ">
+                batch_id,
+            </if>
+
+            <if test="sessionId!=null and sessionId!='' ">
+                session_id,
+            </if>
+
+            <if test="teleEntId!=null and teleEntId!='' ">
+                tele_ent_id,
+            </if>
+            <if test="teleAgentId!=null and teleAgentId!='' ">
+                tele_agent_id,
+            </if>
+            <if test="outCallRadioStatus!=null and outCallRadioStatus!='' ">
+                out_call_radio_status,
+            </if>
+            <if test="clientAlertStartTime!=null and clientAlertStartTime!='' ">
+                client_alert_start_time,
+            </if>
+            <if test="callDuration!=null and callDuration!='' ">
+                call_duration,
+            </if>
+
+            <if test="hangupType!=null and hangupType!=''">
+                hangup_type,
+            </if>
+            <if test="callStartTime!=null and callStartTime!=''">
+                call_start_time,
+            </if>
+            <if test="callEndTime!=null and callEndTime!=''">
+                call_end_time,
+            </if>
+
+            <if test="audioUrl!=null and audioUrl!=''">
+                audio_url,
+            </if>
+            <if test="enterpriseNo!=null and enterpriseNo!=''">
+                enterprise_id,
+            </if>
+
+            create_time,
+            update_time
+        </trim>
+        VALUES
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            uuid(),
+            <if test="clientFlowNo!=null and clientFlowNo!='' ">
+                #{clientFlowNo},
+            </if>
+            <if test="outCallStatus!=null and outCallStatus!='' ">
+                #{outCallStatus},
+            </if>
+            <if test="origOutCallStatus!=null and origOutCallStatus!='' ">
+                #{origOutCallStatus},
+            </if>
+            <if test="callResultStatus!=null and callResultStatus!='' ">
+                #{callResultStatus},
+            </if>
+
+            <if test="batchId!=null and batchId!='' ">
+                #{batchId},
+            </if>
+
+            <if test="sessionId!=null and sessionId!='' ">
+                #{sessionId},
+            </if>
+
+            <if test="teleEntId!=null and teleEntId!='' ">
+                #{teleEntId},
+            </if>
+            <if test="teleAgentId!=null and teleAgentId!='' ">
+                #{teleAgentId},
+            </if>
+            <if test="outCallRadioStatus!=null and outCallRadioStatus!='' ">
+                #{outCallRadioStatus},
+            </if>
+            <if test="clientAlertStartTime!=null and clientAlertStartTime!='' ">
+                #{clientAlertStartTime},
+            </if>
+            <if test="callDuration!=null and callDuration!='' ">
+                #{callDuration},
+            </if>
+
+            <if test="hangupType!=null and hangupType!=''">
+                #{hangupType},
+            </if>
+            <if test="callStartTime!=null and callStartTime!=''">
+                #{callStartTime},
+            </if>
+            <if test="callEndTime!=null and callEndTime!=''">
+                #{callEndTime},
+            </if>
+
+            <if test="audioUrl!=null and audioUrl!=''">
+                #{audioUrl},
+            </if>
+            <if test="enterpriseNo!=null">
+                (select ttt1.id from cc_enterprise ttt1 where ttt1.enterprise_no=#{enterpriseNo}),
+            </if>
+
+            now(),
+            now()
+        </trim>
+    </insert>
+
+    <update id="updatePhoneBillBySessionIdNew" parameterType="com.care.outcall.entity.KoalaOutCallBill">
+        UPDATE cc_traffic_billed
+        <set>
+            update_time=now(),
+            <if test="clientFlowNo!=null and clientFlowNo!='' ">
+                client_flow_no=#{clientFlowNo},
+            </if>
+            <if test="outCallStatus!=null and outCallStatus!='' ">
+                out_call_status=#{outCallStatus},
+            </if>
+            <if test="origOutCallStatus!=null and origOutCallStatus!='' ">
+                orig_out_call_status=#{origOutCallStatus},
+            </if>
+            <if test="callResultStatus!=null and callResultStatus!='' ">
+                call_result_status=#{callResultStatus},
+            </if>
+            <if test="outCallRadioStatus!=null and outCallRadioStatus!='' ">
+                out_call_radio_status=#{outCallRadioStatus},
+            </if>
+            <if test="clientAlertStartTime!=null and clientAlertStartTime!='' ">
+                client_alert_start_time=#{clientAlertStartTime},
+            </if>
+            <if test="callDuration!=null and callDuration!='' ">
+                call_duration=#{callDuration},
+            </if>
+
+            <if test="hangupType!=null and hangupType!=''">
+                hangup_type=#{hangupType},
+            </if>
+            <if test="callStartTime!=null and callStartTime!=''">
+                call_start_time= #{callStartTime},
+            </if>
+            <if test="callEndTime!=null and callEndTime!=''">
+                call_end_time= #{callEndTime},
+            </if>
+
+            <if test="audioUrl!=null and audioUrl!=''">
+                audio_url=#{audioUrl},
+            </if>
+
+            <if test="teleEntId!=null and teleEntId!='' ">
+                tele_ent_id=#{teleEntId},
+            </if>
+            <if test="teleAgentId!=null and teleAgentId!='' ">
+                tele_agent_id=#{teleAgentId},
+            </if>
+            <if test="batchId!=null and batchId!='' ">
+                batch_id=#{batchId},
+            </if>
+
+        </set>
+        WHERE session_id=#{sessionId}
+    </update>
+
+    <update id="updateComputeTraffic" parameterType="java.util.List">
+        update cc_koala_log
+        set compute_traffic=1,update_time=now()
+        where session_id in
+        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+            #{item.id}
+        </foreach>
+    </update>
+
+    <update id="updateMakeCallStatus" parameterType="java.util.List">
+        UPDATE cc_koala_log
+        SET compute_traffic = 1
+        WHERE id IN
+        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+            #{item}
+        </foreach>
+    </update>
+
+    <update id="updateComputeTrafficToFinish">
+        update cc_koala_log set compute_traffic = '1'
+        where compute_traffic = '0' and DATEDIFF(now(), create_time) >= 2 and older_id &lt;> '-1'
+    </update>
+
+    <select id="getOlderInfoBySessionId" resultType="com.care.outcall.entity.KoalaOlderDto">
+        select
+        distinct ckl.session_id as sessionId,
+        ce.org_code as enterpriseNo,
+        ckl.older_id as olderId,
+        ckl.called_number as dyFlowNo,
+        date_format(cocfn.create_time, '%Y%m%d%H%i%s') createTime
+        from cc_koala_log ckl
+        left join care_organization ce on ce.id=ckl.ent_id
+        left join care_older coct on coct.id=ckl.older_id
+        left join care_older_contact cocfn on ckl.called_number=cocfn.phone and coct.id = cocfn.older_id
+        where ckl.session_id=#{sessionId}
+    </select>
+</mapper>