新增下载录音需求

master
wujingtao 3 years ago
parent 5a2bb30da2
commit 7d024e2ae9

@ -29,7 +29,7 @@ public class BaseDoubleCallInfo {
private String requestId;
@Column(name = "clue_id")
@ApiModelProperty(value = "线索id")
private String clueId;
private Long clueId;
@Column(name = "member_id")
@ApiModelProperty(value = "所属人id")
private Long memberId;
@ -94,6 +94,18 @@ public class BaseDoubleCallInfo {
@ApiModelProperty(value = "通话时长")
private Integer duration;
@Column(name = "fee_duration")
@ApiModelProperty(value = "计费时长(这个不要驼峰)")
private Integer fee_duration;
@Column(name = "price")
@ApiModelProperty(value = "计费单价")
private String price;
@Column(name = "fee")
@ApiModelProperty(value = "费用")
private String fee;
@Column(name = "record_flag")
@ApiModelProperty(value = "该字段用于录音标识 0未有 1有")
private Integer recordFlag;

@ -1,7 +1,5 @@
package com.baiye.modules.report.api;
import cn.hutool.json.JSONUtil;
import com.baiye.http.CommonResponse;
import com.baiye.modules.report.entity.dto.StatisticalReportDTO;
import com.baiye.modules.report.service.ReportService;
@ -9,14 +7,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Objects;
/**
* @author wjt

@ -1,34 +0,0 @@
package com.baiye.modules.report.dao;
import com.baiye.modules.report.entity.ReportTask;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author wjt
* @date 2021/12/13
*/
@Repository
public interface ReportDayRepository extends JpaRepository<ReportTask, Long>, JpaSpecificationExecutor<ReportTask> {
/**
* id
*
* @param taskId
* @return
*/
List<ReportTask> findAllByTaskId(Long taskId);
/**
*
* @param beginTime
* @param endTime
* @param ids
* @return
*/
@Query(value = "select * from tb_report_task d where (d.create_time between ?1 and ?2) and (coalesce (?3,null) is null or d.task_id in (?3))", nativeQuery = true)
List<ReportTask> selectAllByCondition(String beginTime, String endTime, List<Long> ids);
}

@ -1,27 +0,0 @@
package com.baiye.modules.report.dao;
import com.baiye.modules.report.entity.ReportOrganize;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author wujingtao
* @date 2022/01/11
*/
@Repository
public interface ReportOrganizeRepository extends JpaRepository<ReportOrganize, Long>, JpaSpecificationExecutor<ReportOrganize> {
/**
*
*
* @param beginTime
* @param endTime
* @param ids
* @return
*/
@Query(value = "select * from tb_report_organize d where (d.create_time between ?1 and ?2) and (coalesce (?3,null) is null or d.organize_id in (?3))", nativeQuery = true)
List<ReportOrganize> selectAllByCondition(String beginTime, String endTime, List<Long> ids);
}

@ -1,39 +0,0 @@
package com.baiye.modules.report.entity;
import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* @author wujingtao
* @date 2022/01/11
*/
@Data
@Entity
@Table(name = "tb_report_organize")
@EntityListeners(AuditingEntityListener.class)
public class ReportOrganize implements Serializable {
private static final long serialVersionUID = 9034474268733855182L;
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String organizeName;
private Long organizeId;
private Integer turnOnNum;
private Double turnOnRate;
private Double usrRate;
private Integer totalNum;
private Integer usrNum;
@CreatedDate
@Column(name = "create_time")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DatePattern.NORM_DATE_PATTERN, timezone = "GMT+8")
private Date createTime;
}

@ -1,39 +0,0 @@
package com.baiye.modules.report.entity;
import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* @author wjt
* @date 2021/12/09
*/
@Data
@Entity
@Table(name = "tb_report_task")
@EntityListeners(AuditingEntityListener.class)
public class ReportTask implements Serializable {
private static final long serialVersionUID = 4019826389911404260L;
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String taskName;
private Long taskId;
private Integer turnOnNum;
private Double turnOnRate;
private Double usrRate;
private Integer usrNum;
private Integer totalNum;
@CreatedDate
@Column(name = "create_time")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DatePattern.NORM_DATE_PATTERN, timezone = "GMT+8")
private Date createTime;
}

@ -1,5 +1,6 @@
package com.baiye.modules.report.entity.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@ -19,7 +20,7 @@ public class UploadTaskDTO implements Serializable {
@ExcelProperty(value = "日期", index = 0)
private String createTime;
// @ExcelIgnore
@ExcelIgnore
private Long taskId;
@ExcelProperty(value = "任务名称", index = 1)

@ -1,19 +0,0 @@
package com.baiye.modules.report.entity.vo;
import com.baiye.modules.report.entity.ReportOrganize;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author wujingtao
* @date 2022/01/11
*/
@Data
public class OrganizeInfosVO implements Serializable {
private static final long serialVersionUID = 133887339450743290L;
private Long organizationId;
private String organizationName;
private List<ReportOrganize> data;
}

@ -1,19 +0,0 @@
package com.baiye.modules.report.entity.vo;
import com.baiye.modules.report.entity.ReportTask;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author wujingtao
* @date 2021/12/28
*/
@Data
public class TaskInfosVO implements Serializable {
private static final long serialVersionUID = 1546722887341864964L;
private Long taskId;
private String taskName;
private List<ReportTask> data;
}

@ -4,7 +4,6 @@ import com.baiye.http.CommonResponse;
import com.baiye.modules.report.entity.dto.StatisticalReportDTO;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author wjt
@ -71,5 +70,6 @@ public interface ReportService {
* @param memberId
* @return
*/
void downloadMemberReport(HttpServletResponse response, String beginTime, String endTime, Long memberId) ;
void downloadMemberReport(HttpServletResponse response, String beginTime, String endTime, Long memberId);
}

@ -235,9 +235,6 @@ public class ReportServiceImpl implements ReportService {
/**
*
*
* @param s
* @return
*/
private StatisticalReportDTO getStatisticalReportDTO(StatisticalReportDTO s) {
List<Long> ids = s.getIds();
@ -248,7 +245,7 @@ public class ReportServiceImpl implements ReportService {
}
String beginTime = s.getBeginTime();
String endTime = s.getEndTime();
Integer type = s.getType();
Integer type;
if (StrUtil.isBlank(beginTime) && StrUtil.isBlank(endTime)) {
endTime = DateUtil.today();
beginTime = DateUtil.format(DateUtil.offsetDay(DateUtil.date(), -7), "yyyy-MM-dd");
@ -262,12 +259,6 @@ public class ReportServiceImpl implements ReportService {
/**
*
*
* @param beginTime
* @param endTime
* @param type
* @param ids
* @return
*/
private List<CallClueInfo> getCallClueInfos(String beginTime, String endTime, Integer type, List<Long> ids) {
List<CallClueInfo> callClueInfos = new ArrayList<>();
@ -308,10 +299,6 @@ public class ReportServiceImpl implements ReportService {
/**
* idkey
*
* @param ids
* @param callClueInfos
* @return
*/
private HashMap<Long, List<CallClueInfo>> getGroupTask(List<Long> ids, List<CallClueInfo> callClueInfos) {
HashMap<Long, List<CallClueInfo>> map = new HashMap<>();
@ -328,12 +315,6 @@ public class ReportServiceImpl implements ReportService {
/**
* key
*
* @param beginTime
* @param endTime
* @param callClueInfos
* @param type
* @return
*/
private HashMap<String, List<CallClueInfo>> getGroupByTime(String beginTime, String endTime, List<CallClueInfo> callClueInfos, Integer type) {
Date begin = DateUtil.parse(beginTime);
@ -371,9 +352,7 @@ public class ReportServiceImpl implements ReportService {
}
/**
* 5taskid
*
* @param ids
* 5
*/
private void getTaskId(List<Long> ids) {
List<Task> allByIsAndIsDistribution = taskRepository.findAllByIsAndIsDistributionAndId(DefaultNumberConstants.ONE_NUMBER, ids);
@ -390,11 +369,7 @@ public class ReportServiceImpl implements ReportService {
}
/**
* task 使
*
* @param s
* @param mapByTask
* @return
* 使
*/
private List<HashMap<String, Object>> getMapByTask(StatisticalReportDTO s, Map<Long, List<CallClueInfo>> mapByTask) {
List<HashMap<String, Object>> listMap = new ArrayList<>();
@ -404,9 +379,8 @@ public class ReportServiceImpl implements ReportService {
for (Task info : tasks) {
taskInfos.put(info.getId(), info);
}
for (Long key : mapByTask.keySet()) {
HashMap<String, Object> mapVo = new HashMap<String, Object>();
HashMap<String, Object> mapVo = new HashMap<String, Object>(16);
//按时间分
HashMap<String, List<CallClueInfo>> mapByTime = getGroupByTime(s.getBeginTime(), s.getEndTime(), mapByTask.get(key), s.getType());
int total = taskInfos.get(key).getTotalNumber();
@ -442,11 +416,7 @@ public class ReportServiceImpl implements ReportService {
}
/**
* task
*
* @param s
* @param mapByTask
* @return
*
*/
private List<UploadTaskDTO> getMapByTaskUpload(StatisticalReportDTO s, Map<Long, List<CallClueInfo>> mapByTask) {
List<UploadTaskDTO> list = new ArrayList<>();
@ -487,10 +457,7 @@ public class ReportServiceImpl implements ReportService {
}
/**
*
*
* @param callClueInfos
* @return
* 线
*/
private MemberInfoVO getMessageInfo(String begin, String end, List<CallClueInfo> callClueInfos) {
int usrNum = 0;
@ -530,14 +497,15 @@ public class ReportServiceImpl implements ReportService {
/**
*
*
* @return
*/
@Cacheable(cacheNames = {"organize", "organize"}, key = "'id:' + #id")
public Organize getOrganize(Long id) {
return organizeRepository.findOrganizeById(id);
}
/**
*
*/
@Cacheable(cacheNames = {"user", "user"}, key = "'id:' + #id")
public User getMember(Long id) {
return userRepository.findUserById(id);

@ -79,4 +79,10 @@ public class DoubleCallController {
public CommonResponse<Object> doubleCallStop(@RequestBody DoubleCallStopDTO doubleCallStopDTO) {
return doubleCallService.doubleCallStop(doubleCallStopDTO);
}
@GetMapping("/call/record")
@ApiOperation("获取通话记录和录音地址")
public CommonResponse<Object> getCallRecord(@RequestParam(value = "clueId") Long clueId, @RequestParam(value = "memberId") Long memberId) {
return doubleCallService.getCallRecord(clueId, memberId);
}
}

@ -15,23 +15,6 @@ import java.util.List;
*/
@Repository
public interface CallClueRepository extends JpaRepository<CallClueInfo, Long>, JpaSpecificationExecutor<CallClueInfo> {
/**
*
*
* @param id
* @return
*/
CallClueInfo findByClueId(Long id);
/**
*
*
* @param memberId
* @return
*/
@Query("select d from CallClueInfo d where d.memberId=?1 ")
List<CallClueInfo> selectByMember(Long memberId);
/**
* 线
*
@ -67,15 +50,13 @@ public interface CallClueRepository extends JpaRepository<CallClueInfo, Long>, J
/**
* id
*
* @param beginTime
* @param endTime
* @param id
* @return
*/
@Query(value = "select * from tb_call_clue d where (d.create_time between ?1 and ?2) and (coalesce (?3,null) is null or d.task_id in (?3))", nativeQuery = true)
List<CallClueInfo> selectAllByTimeAndTaskId(String beginTime, String endTime, List<Long> id);
/**
* id
*/
@Modifying
@Query(value = "update CallClueInfo c set c.status =?1 where c.clueId = ?2")
void updateByStatus(Integer status, Long clueId);

@ -15,13 +15,6 @@ import java.util.List;
*/
@Repository
public interface DoubleCallRepository extends JpaRepository<DoubleCallInfo, Long>, JpaSpecificationExecutor<DoubleCallInfo> {
/**
* id
*
* @param id
* @return
*/
DoubleCallInfo findById(String id);
/**
* id
@ -30,14 +23,6 @@ public interface DoubleCallRepository extends JpaRepository<DoubleCallInfo, Long
* @return
*/
DoubleCallInfo findBySessionId(String sessionId);
/**
*
*
* @param memberId
* @return
*/
@Query("select d from DoubleCallInfo d where d.memberId=?1 ")
List<DoubleCallInfo> selectByMemberAndStatus(Long memberId);
/**
*
@ -53,4 +38,16 @@ public interface DoubleCallRepository extends JpaRepository<DoubleCallInfo, Long
@Modifying
@Query(value = "update DoubleCallInfo d set d.status =?1 where d.sessionId = ?2")
void updateByStatus(Integer status, String sessionId);
/**
*
*
* @param clueId
* @param memberId
* @param status
* @return
*/
@Query(value = "select d from DoubleCallInfo d where d.clueId=?1 and d.memberId=?2 and d.status=?3")
List<DoubleCallInfo> findByClueIdAndMemberId(Long clueId, Long memberId, Integer status);
}

@ -5,6 +5,8 @@ import com.baiye.model.entity.BaseCallClueInfo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@ -17,8 +19,9 @@ import java.util.Date;
* @date 2021/12/13
* 线
*/
@Data
@Entity
@Getter
@Setter
@Table(name = "tb_call_clue")
@EntityListeners(AuditingEntityListener.class)
public class CallClueInfo extends BaseCallClueInfo implements Serializable {

@ -2,19 +2,19 @@ package com.baiye.modules.telemarkting.entity;
import com.baiye.model.entity.BaseDoubleCallInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.LastModifiedDate;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* @author wjt
* @date 2021/12/06
*/
@Data
@Getter
@Setter
@Entity
@Table(name = "tb_double_call")
@EntityListeners(AuditingEntityListener.class)

@ -31,6 +31,9 @@ public class DoubleCallBackDTO {
private String callOutAnswerTime;
private Integer callOutUnaswRsn;
private Integer duration;
/**
*
*/
private Integer fee_duration;
private String price;
private String fee;

@ -3,8 +3,6 @@ package com.baiye.modules.telemarkting.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NonNull;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

@ -0,0 +1,37 @@
package com.baiye.modules.telemarkting.entity.vo;
import lombok.Data;
import java.util.Date;
/**
* @author wujingtao
* @date 2022/01/19
*/
@Data
public class CallRecordsVO {
/**
* id
*/
private Long id;
/**
* 线id
*/
private Long clueId;
/**
* id
*/
private Long memberId;
/**
*
*/
private Date createTime;
/**
*
*/
private Integer duration;
/**
*
*/
private String recordFileDownloadUrl;
}

@ -2,7 +2,6 @@ package com.baiye.modules.telemarkting.httpRequest;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONObject;

@ -40,4 +40,14 @@ public interface DoubleCallService {
* @return
*/
CommonResponse<Object> doubleCallStop(DoubleCallStopDTO doubleCallStopDTO);
/**
* h
*
* @param clueId
* @param memberId
* @return
*/
CommonResponse<Object> getCallRecord(Long clueId, Long memberId);
}

@ -1,6 +1,7 @@
package com.baiye.modules.telemarkting.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
@ -15,6 +16,7 @@ import com.baiye.modules.telemarkting.entity.dto.DoubleCallBackDTO;
import com.baiye.modules.telemarkting.entity.dto.DoubleCallBackStatusDTO;
import com.baiye.modules.telemarkting.entity.dto.DoubleCallReqDTO;
import com.baiye.modules.telemarkting.entity.dto.DoubleCallStopDTO;
import com.baiye.modules.telemarkting.entity.vo.CallRecordsVO;
import com.baiye.modules.telemarkting.httpRequest.CallReq;
import com.baiye.modules.telemarkting.service.DoubleCallService;
import lombok.extern.slf4j.Slf4j;
@ -22,6 +24,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
/**
@ -48,7 +53,7 @@ public class DoubleCallServiceImpl implements DoubleCallService {
DoubleCallInfo doubleCallInfo = new DoubleCallInfo();
doubleCallInfo.setSessionId(sessionId);
doubleCallInfo.setRequestId(requestId);
doubleCallInfo.setClueId(doubleCallReq.getUserData());
doubleCallInfo.setClueId(Long.parseLong(doubleCallReq.getUserData()));
doubleCallInfo.setMemberId(doubleCallReq.getMemberId());
doubleCallInfo.setStatus(DefaultNumberConstants.ONE_NUMBER);
@ -98,4 +103,23 @@ public class DoubleCallServiceImpl implements DoubleCallService {
}
return CommonResponse.createByError();
}
@Override
public CommonResponse<Object> getCallRecord(Long clueId, Long memberId) {
if (clueId == null || memberId == null) {
log.error("参数不能为空clueId:{} ,memberId:{}", clueId, memberId);
return CommonResponse.createByErrorMessage("参数不能为空");
}
List<DoubleCallInfo> calls = doubleCallRepository.findByClueIdAndMemberId(clueId, memberId, DefaultNumberConstants.TWO_NUMBER);
List<CallRecordsVO> list = new ArrayList<>();
if (CollUtil.isNotEmpty(calls)) {
for (DoubleCallInfo info : calls) {
CallRecordsVO v = new CallRecordsVO();
BeanUtil.copyProperties(info, v);
list.add(v);
}
}
list.sort(Comparator.comparing(CallRecordsVO::getCreateTime));
return CommonResponse.createBySuccess(list);
}
}

@ -27,7 +27,7 @@ public class ClueRecordDto implements Serializable {
private Boolean status;
@ApiModelProperty(value = "上传类型 0:自定义模板 1:UC 2:快手 3:抖音 4:百度")
@ExcelProperty(value = "渠道", index = 2 ,converter = ExportOriginConverter.class)
@ExcelProperty(value = "渠道", index = 2, converter = ExportOriginConverter.class)
private Integer uploadType;
@ApiModelProperty(value = "任务id")
@ -36,7 +36,7 @@ public class ClueRecordDto implements Serializable {
private Long taskId;
@ApiModelProperty(value = "上传文件名")
@ExcelProperty(value = "任务名", index = 1)
@ExcelProperty(value = "文件名", index = 1)
private String oldFile;
@ApiModelProperty(value = "存入路径")

Loading…
Cancel
Save