From 711099b0894427badfbedcc8a7e2a1f882055341 Mon Sep 17 00:00:00 2001 From: wjt Date: Fri, 12 May 2023 17:48:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=89=E6=95=88=E6=A1=88=E4=BE=8B=E5=88=86?= =?UTF-8?q?=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/platform/domain/ExcellentCases.java | 7 ++++++- .../platform/rest/ExcellentCasesController.java | 4 ++-- .../platform/rest/QualityScoreController.java | 3 +++ .../service/impl/ExcellentCasesServiceImpl.java | 17 ++++++----------- .../report/entity/dto/CallRecordDetailsDTO.java | 2 ++ .../main/java/com/baiye/module/dao/ClueJpa.java | 7 ++++--- .../baiye/module/dao/ClueTalkRepository.java | 14 ++++++++++++++ .../baiye/module/entity/ReportTokerCall.java | 4 ++++ .../baiye/module/service/dto/ClueTalkDTO.java | 2 ++ .../service/impl/ReportTokerServiceImpl.java | 16 ++++++++++------ .../main/java/com/baiye/task/ReportSync.java | 3 +++ 11 files changed, 56 insertions(+), 23 deletions(-) diff --git a/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/platform/domain/ExcellentCases.java b/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/platform/domain/ExcellentCases.java index 7a33972a..7137d854 100644 --- a/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/platform/domain/ExcellentCases.java +++ b/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/platform/domain/ExcellentCases.java @@ -30,9 +30,14 @@ public class ExcellentCases implements Serializable { @Column(name = "url") @NotNull(groups = AddGroup.class) - @ApiModelProperty(value = "id") + @ApiModelProperty(value = "url") private String url; + @ApiModelProperty(value = "录音的id") + @Column(name = "session_id") + @NotNull(groups = AddGroup.class) + private String sessionId; + @Column(name = "create_by") private Long createBy; diff --git a/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/platform/rest/ExcellentCasesController.java b/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/platform/rest/ExcellentCasesController.java index aac019be..feb9b131 100644 --- a/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/platform/rest/ExcellentCasesController.java +++ b/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/platform/rest/ExcellentCasesController.java @@ -4,12 +4,12 @@ import com.baiye.http.CommonResponse; import com.baiye.modules.platform.domain.ExcellentCases; import com.baiye.modules.platform.service.ExcellentCasesService; import com.baiye.modules.platform.service.dto.ExcellentCasesQueryCriteria; -import com.baiye.modules.platform.service.dto.ScriptOrganizeQueryCriteria; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; /** @@ -25,7 +25,7 @@ public class ExcellentCasesController { @PostMapping("/addCases") @ApiOperation("新增案例") - public CommonResponse addExcellentCases(@RequestBody ExcellentCases excellentCases) { + public CommonResponse addExcellentCases(@RequestBody @Validated ExcellentCases excellentCases) { excellentCasesService.addExcellentCases(excellentCases); return CommonResponse.createBySuccess(); } diff --git a/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/platform/rest/QualityScoreController.java b/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/platform/rest/QualityScoreController.java index 3bffac17..121c08b3 100644 --- a/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/platform/rest/QualityScoreController.java +++ b/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/platform/rest/QualityScoreController.java @@ -1,9 +1,11 @@ package com.baiye.modules.platform.rest; +import com.baiye.annotation.Inner; import com.baiye.http.CommonResponse; import com.baiye.modules.platform.service.QualityScoreService; import lombok.RequiredArgsConstructor; +import lombok.Value; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -27,6 +29,7 @@ public class QualityScoreController { @GetMapping("/insert") + @Inner(value = false) public CommonResponse insert(@RequestParam("id") Long id) { qualityScoreService.insert(id); return CommonResponse.createBySuccess(); diff --git a/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/platform/service/impl/ExcellentCasesServiceImpl.java b/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/platform/service/impl/ExcellentCasesServiceImpl.java index 38e651e0..eec436c7 100644 --- a/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/platform/service/impl/ExcellentCasesServiceImpl.java +++ b/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/platform/service/impl/ExcellentCasesServiceImpl.java @@ -1,6 +1,7 @@ package com.baiye.modules.platform.service.impl; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.URLUtil; import com.baiye.config.properties.FileProperties; @@ -14,7 +15,6 @@ import com.baiye.util.QueryHelp; import com.baiye.util.SecurityUtils; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; @@ -37,24 +37,19 @@ public class ExcellentCasesServiceImpl implements ExcellentCasesService { private final FileProperties fileProperties; - @Value("${ocean.engine.welcomeUrl}") - private String sysPath; - @Override public void addExcellentCases(ExcellentCases excellentCases) { excellentCases.setCreateBy(SecurityUtils.getCurrentUserId()); excellentCases.setCreateTime(DateUtil.date()); URL url1 = URLUtil.url(excellentCases.getUrl()); - BufferedInputStream inputStream = null; - String url = null; + BufferedInputStream inputStream; + String url; try { inputStream = new BufferedInputStream(url1.openStream()); - String s = url1.getPath(); - String substring = s.substring(s.lastIndexOf("/") + 1); + String substring = DateUtil.format(DateUtil.date(), "MMdd") + RandomUtil.randomString(6) + ".wav"; File file = inputStreamToFile(inputStream, substring); - log.info("地址=={}", file.getPath()); - url = sysPath + file.getPath(); + url = "cases" + File.separator + substring; } catch (Exception e) { e.printStackTrace(); throw new BadRequestException("保存错误,获取录音错误"); @@ -68,7 +63,7 @@ public class ExcellentCasesServiceImpl implements ExcellentCasesService { public File inputStreamToFile(InputStream ins, String name) throws Exception { String path = fileProperties.getPath().getPath(); - File file = new File(path + File.separator + "record" + name); + File file = new File(path + File.separator + "cases" + File.separator + name); if (file.exists()) { return file; } diff --git a/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/report/entity/dto/CallRecordDetailsDTO.java b/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/report/entity/dto/CallRecordDetailsDTO.java index 8fdf3044..95ee8b67 100644 --- a/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/report/entity/dto/CallRecordDetailsDTO.java +++ b/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/report/entity/dto/CallRecordDetailsDTO.java @@ -32,6 +32,8 @@ public class CallRecordDetailsDTO { */ @ExcelProperty(value = "跟进人", index = 1) private String memberName; + + private String sessionId; /** * 呼叫时长 */ diff --git a/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/dao/ClueJpa.java b/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/dao/ClueJpa.java index 73ac5d60..4a171ab3 100644 --- a/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/dao/ClueJpa.java +++ b/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/dao/ClueJpa.java @@ -132,7 +132,7 @@ public class ClueJpa { if (id != null) { sql.append("and c.id = :id "); } - if (nid != null){ + if (nid != null) { sql.append("and c.nid = :nid "); } if (StringUtils.isNotBlank(name)) { @@ -202,7 +202,7 @@ public class ClueJpa { if (id != null) { query.setParameter("id", id); } - if (nid != null){ + if (nid != null) { query.setParameter("nid", AESUtils.encrypt(nid, secret)); } if (StringUtils.isNotBlank(name)) { @@ -520,7 +520,7 @@ public class ClueJpa { */ @Transactional(rollbackOn = Exception.class) public List getReportCallInfo(String beginTime, String endTime, Long managerId) { - StringBuilder sql = new StringBuilder("select tcm.newest_call_time as newestCallTime,tcm.clue_call_status as clueCallStatus ,tc.create_by as managerId " + + StringBuilder sql = new StringBuilder("select tcm.newest_call_time as newestCallTime,tcm.clue_call_status as clueCallStatus ,tcm.member_status as memberStatus,tc.create_by as managerId " + "from tb_clue_talk as tcm left join tb_clue as tc on tcm.clue_id =tc.id " + " where tcm.newest_call_time between :beginTime and :endTime "); if (managerId != null) { @@ -543,6 +543,7 @@ public class ClueJpa { clueDto.setManagerId(id.longValue()); clueDto.setClueCallStatus((Integer) row.get("clueCallStatus")); clueDto.setNewestCallTime((Date) row.get("newestCallTime")); + clueDto.setMemberStatus((Integer) row.get("memberStatus")); clueDtoList.add(clueDto); } return clueDtoList; diff --git a/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/dao/ClueTalkRepository.java b/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/dao/ClueTalkRepository.java index bb5213cd..594694a3 100644 --- a/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/dao/ClueTalkRepository.java +++ b/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/dao/ClueTalkRepository.java @@ -54,12 +54,14 @@ public interface ClueTalkRepository extends JpaRepository, JpaSp /** * 查询公司下线索数量 + * * @param userId * @return */ @Query(value = " select count(*) from tb_clue_talk as tcm left join tb_clue as tc on tcm.clue_id =tc.id" + " where tc.create_by = ?1", nativeQuery = true) Integer countAllByCreateBy(Long userId); + /** * 查询任务总数 * @@ -92,4 +94,16 @@ public interface ClueTalkRepository extends JpaRepository, JpaSp * 根据分配人用户ID删除 */ void deleteByMemberId(Long userId); + + /** + * 统计时间内 新增线索条数 + * + * @param userId + * @param startTime + * @param endTime + * @return + */ + @Query(value = " select count(*) from tb_clue_talk as tcm left join tb_clue as tc on tcm.clue_id =tc.id" + + " where tc.create_by = ?1 and tcm.create_time between ?2 and ?3", nativeQuery = true) + Integer countByCreateTime(Long userId, String startTime, String endTime); } diff --git a/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/entity/ReportTokerCall.java b/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/entity/ReportTokerCall.java index 5f945d48..29fb0548 100644 --- a/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/entity/ReportTokerCall.java +++ b/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/entity/ReportTokerCall.java @@ -47,6 +47,10 @@ public class ReportTokerCall { @Column(name = "turn_on_rate") private Double turnOnRate; + @ApiModelProperty(value = "有效数") + @Column(name = "effective_num") + private Integer effectiveNum; + @ApiModelProperty(value = "业务管理员") @Column(name = "manager_id") @JsonSerialize(using = ToStringSerializer.class) diff --git a/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/service/dto/ClueTalkDTO.java b/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/service/dto/ClueTalkDTO.java index d6b9ba89..389a7148 100644 --- a/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/service/dto/ClueTalkDTO.java +++ b/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/service/dto/ClueTalkDTO.java @@ -14,4 +14,6 @@ public class ClueTalkDTO { private Date newestCallTime; private Integer clueCallStatus; + + private Integer memberStatus; } diff --git a/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/service/impl/ReportTokerServiceImpl.java b/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/service/impl/ReportTokerServiceImpl.java index b0eb8a81..1d6f8482 100644 --- a/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/service/impl/ReportTokerServiceImpl.java +++ b/ad-platform-services/ad-platform-source/src/main/java/com/baiye/module/service/impl/ReportTokerServiceImpl.java @@ -411,18 +411,17 @@ public class ReportTokerServiceImpl implements ReportTokerService { reportTokerCalls.addAll(reportTokerCalls1); } Map map = new HashMap<>(4); - List clueTalks = clueTalkRepository.findClueTalkByCreateBy(SecurityUtils.getCurrentUserId()); + int addTotal = clueTalkRepository.countByCreateTime(SecurityUtils.getCurrentUserId(), beginTime, endTime); int usrNum = 0; int turnOnNum = 0; double turnOnRate = 0; - int totalNum = 0; - if (CollUtil.isNotEmpty(clueTalks)) { - totalNum = clueTalks.size(); - } + int effectiveNum = 0; + double effectiveRate = 0; if (CollUtil.isNotEmpty(reportTokerCalls)) { for (ReportTokerCall reportTokerCall : reportTokerCalls) { usrNum += reportTokerCall.getUsrNum(); turnOnNum += reportTokerCall.getTurnOnNum(); + effectiveNum += reportTokerCall.getEffectiveNum(); } } map.put("usrNum", usrNum); @@ -430,8 +429,13 @@ public class ReportTokerServiceImpl implements ReportTokerService { if (usrNum > 0) { turnOnRate = NumberUtil.div(turnOnNum, usrNum, 2); } + if (turnOnNum > 0) { + effectiveRate = NumberUtil.div(effectiveNum, turnOnNum, 2); + } map.put("turnOnRate", turnOnRate); - map.put("totalNum", totalNum); + map.put("totalNum", addTotal); + map.put("effectiveNum", effectiveNum); + map.put("effectiveRate", effectiveRate); return CommonResponse.createBySuccess(map); } diff --git a/ad-platform-services/ad-platform-source/src/main/java/com/baiye/task/ReportSync.java b/ad-platform-services/ad-platform-source/src/main/java/com/baiye/task/ReportSync.java index ab6a8240..e7fe1870 100644 --- a/ad-platform-services/ad-platform-source/src/main/java/com/baiye/task/ReportSync.java +++ b/ad-platform-services/ad-platform-source/src/main/java/com/baiye/task/ReportSync.java @@ -129,6 +129,9 @@ public class ReportSync { talkReport.setTurnOnNum(talkReport.getTurnOnNum() + 1); talkReport.setUsrNum(talkReport.getUsrNum() + 1); } + if (clueTalk.getMemberStatus() == DefaultNumberConstants.FOUR_NUMBER) { + talkReport.setEffectiveNum(talkReport.getEffectiveNum() + 1); + } } rate(talkReport, totalNum); talkReport.setManagerId(key);