|  | @@ -1,6 +1,7 @@
 | 
	
		
			
				|  |  |  package com.ruixuan.salesLeads.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.alibaba.excel.EasyExcel;
 | 
	
		
			
				|  |  | +import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  |  import com.github.pagehelper.PageInfo;
 | 
	
	
		
			
				|  | @@ -27,6 +28,7 @@ import com.ruixuan.system.domain.SysIndustryInfo;
 | 
	
		
			
				|  |  |  import com.ruixuan.system.mapper.SysAreaInfoMapper;
 | 
	
		
			
				|  |  |  import com.ruixuan.system.mapper.SysIndustryInfoMapper;
 | 
	
		
			
				|  |  |  import lombok.extern.slf4j.Slf4j;
 | 
	
		
			
				|  |  | +import org.apache.ibatis.annotations.Param;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
	
		
			
				|  | @@ -61,6 +63,9 @@ public class TelephoneRobotServiceImpl implements ITelephoneRobotService {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private SaleClueCallRecordMapper saleClueCallRecordMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SaleClueCallResultMapper saleClueCallResultMapper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       *
 | 
	
	
		
			
				|  | @@ -111,15 +116,17 @@ public class TelephoneRobotServiceImpl implements ITelephoneRobotService {
 | 
	
		
			
				|  |  |          //日期8位数 自增
 | 
	
		
			
				|  |  |          String flowCode = redisCache.getFlowCode();
 | 
	
		
			
				|  |  |          log.info("task------>>>>{}",flowCode);
 | 
	
		
			
				|  |  | -        result.put("taskId",flowCode);
 | 
	
		
			
				|  |  | -        result.put("batchId",flowCode);
 | 
	
		
			
				|  |  | +        result.put("taskId",Integer.valueOf(flowCode));
 | 
	
		
			
				|  |  | +        result.put("batchId",Integer.valueOf(flowCode));
 | 
	
		
			
				|  |  |          result.put("callBackUrl",RobotConstant.CALL_BACK_URL);
 | 
	
		
			
				|  |  |          result.put("canCover",true);
 | 
	
		
			
				|  |  |          List customerList = new ArrayList();
 | 
	
		
			
				|  |  |          for (Long sellerId : sellerIds) {
 | 
	
		
			
				|  |  | -            SaleRecordVo saleInfo = saleClueInfoMapper.selectSaleClueInfoBySellerId(sellerId);
 | 
	
		
			
				|  |  | +            //SaleRecordVo saleInfo = saleClueInfoMapper.selectSaleClueInfoBySellerId(sellerId);
 | 
	
		
			
				|  |  | +            //销售线索id查询
 | 
	
		
			
				|  |  | +            SaleRecordVo saleInfo = saleClueInfoMapper.selectSaleClueInfoById(sellerId.intValue());
 | 
	
		
			
				|  |  |              Map<String,Object> param = new HashMap<>();
 | 
	
		
			
				|  |  | -            param.put("id",saleInfo.getSellerId().intValue());
 | 
	
		
			
				|  |  | +            param.put("id",saleInfo.getId());
 | 
	
		
			
				|  |  |              param.put("name",saleInfo.getSellerId());
 | 
	
		
			
				|  |  |              param.put("companyName",saleInfo.getSellerName());
 | 
	
		
			
				|  |  |              param.put("phone","17778037644");
 | 
	
	
		
			
				|  | @@ -138,6 +145,7 @@ public class TelephoneRobotServiceImpl implements ITelephoneRobotService {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          headers.put("Auth-Token",JSONObject.parseObject(tokenObj.getString("data")).getString("token"));
 | 
	
		
			
				|  |  |          String content = HttpUtil.httpPostRequest(RobotConstant.CUSTOMER_IMPORT,result,headers);
 | 
	
		
			
				|  |  | +        log.info("调用第三方接口------入参---{}-----返回信息---》》》》{}",result,content);
 | 
	
		
			
				|  |  |          JSONObject jsonObject = JSONObject.parseObject(content);
 | 
	
		
			
				|  |  |          if (!"0".equals(jsonObject.getString("code"))){
 | 
	
		
			
				|  |  |              log.info("导入数据接口异常======>>>>>{}"+jsonObject);
 | 
	
	
		
			
				|  | @@ -148,10 +156,18 @@ public class TelephoneRobotServiceImpl implements ITelephoneRobotService {
 | 
	
		
			
				|  |  |          //更新最新的记录 用户信息
 | 
	
		
			
				|  |  |          //1分钟只能调取导入接口一次 所以可以保证最新的记录就是刚通过回调接口回来的数据信息
 | 
	
		
			
				|  |  |          saleClueCallRecordMapper.updateCallRecordUser(userId,flowCode);
 | 
	
		
			
				|  |  | -        log.info("------>>>>>>修改用户信息");
 | 
	
		
			
				|  |  | -        //JSONArray success = jsonObject.getJSONArray("success");
 | 
	
		
			
				|  |  | -        //JSONArray error = jsonObject.getJSONArray("error");
 | 
	
		
			
				|  |  | -        return ResultResponse.successMsg("导入记录成功"+customerList.size()+"条",null);
 | 
	
		
			
				|  |  | +        log.info("------更新操作用户-------");
 | 
	
		
			
				|  |  | +        //查询 最新的记录
 | 
	
		
			
				|  |  | +        SaleClueCallRecordPojo recordPojo = saleClueCallRecordMapper.selectCallRecordInfo();
 | 
	
		
			
				|  |  | +        JSONObject jsonContent = JSONObject.parseObject(recordPojo.getContent());
 | 
	
		
			
				|  |  | +        JSONArray success = jsonContent.getJSONArray("success");
 | 
	
		
			
				|  |  | +        recordPojo.setSuccessList(success);
 | 
	
		
			
				|  |  | +        JSONArray error = jsonContent.getJSONArray("error");
 | 
	
		
			
				|  |  | +        recordPojo.setErrorList(error);
 | 
	
		
			
				|  |  | +        return ResultResponse.successMsg("本次导入记录,成功"+ (StringUtils.isEmpty(success) ? 0 : success.size()) + "条;失败"+
 | 
	
		
			
				|  |  | +        (StringUtils.isEmpty(error) ? 0 : error.size())+"条。",recordPojo);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -179,6 +195,24 @@ public class TelephoneRobotServiceImpl implements ITelephoneRobotService {
 | 
	
		
			
				|  |  |          return ResultResponse.successMsg("查询导入记录成功。",callRecordList);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /**
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +     * @description: 通话记录
 | 
	
		
			
				|  |  | +     *
 | 
	
		
			
				|  |  | +     * @param createTime 创建时间
 | 
	
		
			
				|  |  | +     * @param state 销售线索状态 1-未开始 2-进行中 3-已结束
 | 
	
		
			
				|  |  | +     * @return: com.ruixuan.common.core.domain.ResultResponse
 | 
	
		
			
				|  |  | +     * @author: zianY
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public ResultResponse getRobotTelephoneResultList(String createTime,Integer state){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        PageUtils.startPage();
 | 
	
		
			
				|  |  | +        //查询导入记录
 | 
	
		
			
				|  |  | +        List<SaleClueCallResultPojo> callResultList = saleClueCallResultMapper.getSaleClueCallResultList(createTime,state);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return ResultResponse.successMsg("查询通话记录成功。",callResultList);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 |