Commit 416b3fb98599f7c99039236aabd6e3514e8e7702

Authored by 张志伟
1 parent 7079e483

:fire: feat(*): 期初客户通话数据维护

- 期初客户通话数据维护
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/db/ipt/CustomerInitClue.kt
1 1 package cn.fw.valhalla.domain.db.ipt
2 2  
3 3 import cn.fw.common.annotation.NoArg
4   -import cn.fw.common.data.entity.BaseAuditableTimeEntity
  4 +import com.baomidou.mybatisplus.annotation.*
  5 +import com.baomidou.mybatisplus.extension.activerecord.Model
5 6 import java.time.LocalDate
6 7 import java.time.LocalDateTime
7 8  
... ... @@ -15,6 +16,8 @@ import java.time.LocalDateTime
15 16 */
16 17 @NoArg
17 18 data class CustomerInitClue(
  19 + @TableId(type = IdType.AUTO)
  20 + val id: Long? = null,
18 21 val plateNo: String?,
19 22 val vin: String,
20 23 val brandName: String?,
... ... @@ -33,4 +36,8 @@ data class CustomerInitClue(
33 36 val shopId: Long,
34 37 val groupId: Long,
35 38 val yn: Boolean,
36   -) : BaseAuditableTimeEntity<CustomerInitClue, Long>()
37 39 \ No newline at end of file
  40 + @TableField(insertStrategy = FieldStrategy.NOT_NULL, fill = FieldFill.INSERT)
  41 + val createTime: LocalDateTime? = null,
  42 + @TableField(updateStrategy = FieldStrategy.NOT_NULL, fill = FieldFill.INSERT_UPDATE)
  43 + val updateTime: LocalDateTime? = null
  44 +) : Model<CustomerInitClue>()
38 45 \ No newline at end of file
... ...
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/db/ipt/CustomerInitClueCallLog.kt
1 1 package cn.fw.valhalla.domain.db.ipt
2 2  
3 3 import cn.fw.common.annotation.NoArg
4   -import cn.fw.common.data.entity.BaseEntity
  4 +import com.baomidou.mybatisplus.annotation.IdType
  5 +import com.baomidou.mybatisplus.annotation.TableId
  6 +import com.baomidou.mybatisplus.extension.activerecord.Model
5 7 import java.time.LocalDateTime
6 8  
7 9 /**
... ... @@ -14,9 +16,11 @@ import java.time.LocalDateTime
14 16 */
15 17 @NoArg
16 18 data class CustomerInitClueCallLog(
  19 + @TableId(type = IdType.AUTO)
  20 + val id: Long? = null,
17 21 val clueId: Long,
18 22 val callId: String,
19 23 val talkTime: Int,
20 24 val recording: String?,
21 25 val uploadTime: LocalDateTime,
22   -) : BaseEntity<CustomerInitClueCallLog, Long>()
  26 +) : Model<CustomerInitClueCallLog>()
... ...
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/vo/ipt/CustomerInitClueVO.kt
... ... @@ -3,7 +3,6 @@ package cn.fw.valhalla.domain.vo.ipt
3 3 import cn.fw.common.annotation.NoArg
4 4 import java.time.LocalDate
5 5 import java.time.LocalDateTime
6   -import java.util.*
7 6  
8 7 /**
9 8 * 期初档案数据
... ... @@ -58,5 +57,5 @@ data class CustomerInitClueVO(
58 57 /** 集团id */
59 58 val groupId: Long,
60 59 /** 导入时间 */
61   - val createTime: Date
  60 + val createTime: LocalDateTime?
62 61 )
... ...
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/task/CallHistoryTask.kt
1 1 package cn.fw.valhalla.controller.task
2 2  
3   -import cn.fw.common.util.logInfo
4 3 import cn.fw.valhalla.domain.db.ipt.CustomerInitClueCallLog
5 4 import cn.fw.valhalla.domain.dto.CallReportDTO
6 5 import cn.fw.valhalla.rpc.ehr.EhrRpcService
... ... @@ -44,15 +43,13 @@ class CallHistoryTask(
44 43 /**
45 44 * 持久化通话记录
46 45 */
47   - @Scheduled(initialDelay = 1000 * 10, fixedRate = 1000 * 15)
  46 + @Scheduled(cron = "0/10 * * * * ?")
48 47 fun dealCallHistory() {
49 48 val listOps = stringRedisTemplate.boundListOps(callReportKey)
50 49 val dataList = mutableListOf<String>()
51 50 for (i in 0..2000) {
52   - val dataStr = listOps.leftPop()
53   - dataStr?.let {
54   - dataList.add(dataStr)
55   - }
  51 + val dataStr = listOps.leftPop() ?: break
  52 + dataList.add(dataStr)
56 53 }
57 54 val mapper = jacksonObjectMapper()
58 55 CoroutineScope(Dispatchers.IO).launch {
... ... @@ -73,7 +70,6 @@ class CallHistoryTask(
73 70 } else {
74 71 res = customerInitClueBizService.saveCallLog(callReportDTO)
75 72 }
76   - logInfo("ddddd : $res")
77 73 if (!res) {
78 74 listOps.rightPush(it)
79 75 }
... ... @@ -90,7 +86,7 @@ class CallHistoryTask(
90 86 /**
91 87 * 拉取化通话录音
92 88 */
93   - @Scheduled(initialDelay = 1000 * 10, fixedRate = 1000 * 30)
  89 + @Scheduled(cron = "0/15 * * * * ?")
94 90 fun dealCallRecordings() {
95 91 val list = customerInitClueCallLogService.list(
96 92 KtQueryWrapper(CustomerInitClueCallLog::class.java)
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/ipt/CustomerInitClueBizService.kt
... ... @@ -77,7 +77,7 @@ class CustomerInitClueBizService(
77 77 .orderByAsc(CustomerInitClueCallLog::uploadTime)
78 78 )?.map {
79 79 InitClueCallLogVO(
80   - id = it.id,
  80 + id = it?.id ?: -1,
81 81 clueId = it.clueId,
82 82 callId = it.callId,
83 83 talkTime = it.talkTime,
... ... @@ -110,16 +110,16 @@ class CustomerInitClueBizService(
110 110 .eq(CustomerInitClue::senderMobile, dto.peerNo)
111 111 }
112 112 )
113   - return list?.mapNotNull {
  113 + return list?.map {
  114 + logInfo(it.toString())
114 115 CustomerInitClueCallLog(
115   - clueId = it.id,
  116 + clueId = it.id ?: -1,
116 117 callId = dto.callId,
117 118 talkTime = dto.talkTime,
118 119 recording = null,
119 120 uploadTime = dto.callTime
120 121 )
121 122 }?.let {
122   - logInfo("xxx", it.size)
123 123 customerInitClueCallLogService.saveBatch(it)
124 124 } ?: true
125 125 }
... ... @@ -140,7 +140,7 @@ class CustomerInitClueBizService(
140 140 fun CustomerInitClue.toCustomerInitClueVO(fn: Function<Long, String>): CustomerInitClueVO {
141 141 val shopName = fn.apply(this.shopId)
142 142 return CustomerInitClueVO(
143   - id = this.id,
  143 + id = this.id ?: -1,
144 144 plateNo = this.plateNo,
145 145 vin = this.vin,
146 146 brandName = this.brandName,
... ...