根据Mq消息解析并调用战败分析
This commit is contained in:
@@ -3,4 +3,6 @@ package com.volvo.ai.analytic.center.constant;
|
|||||||
public class Constant {
|
public class Constant {
|
||||||
|
|
||||||
public static final String rabbitMqFormQueue = "Voc-Defeat-Dcc";
|
public static final String rabbitMqFormQueue = "Voc-Defeat-Dcc";
|
||||||
|
|
||||||
|
public static final String CHANNEL_DCC = "Channel_Dcc";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.volvo.ai.analytic.center.dto.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CallItem {
|
||||||
|
private String sessionId;
|
||||||
|
private String sourceId;
|
||||||
|
private String audioTime;
|
||||||
|
private int audioBillsec;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.volvo.ai.analytic.center.dto.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DiFyReq {
|
||||||
|
|
||||||
|
private String user;
|
||||||
|
private String flowId;
|
||||||
|
private Object inputs;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.volvo.ai.analytic.center.dto.req;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DiffDefeatanAlysis {
|
||||||
|
|
||||||
|
private String businessId;
|
||||||
|
private String vdqwUserId;
|
||||||
|
private String vdqwCustomerId;
|
||||||
|
|
||||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date defeatTime;
|
||||||
|
|
||||||
|
private String approveCode;
|
||||||
|
private String approveResult;
|
||||||
|
private String approveOpinion;
|
||||||
|
private List<CallItem> callList;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.volvo.ai.analytic.center.dto.req;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DiffDefeatanApprove {
|
||||||
|
|
||||||
|
private String businessId;
|
||||||
|
private String approveCode;
|
||||||
|
private String approveResult;
|
||||||
|
private String approveOpinion;
|
||||||
|
}
|
||||||
@@ -1,163 +1,14 @@
|
|||||||
package com.volvo.ai.analytic.center.dto.req;
|
package com.volvo.ai.analytic.center.dto.req;
|
||||||
|
|
||||||
import java.util.List;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mq消息体解析对象
|
* mq消息体解析对象
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class RabbitMqFormData {
|
public class RabbitMqFormData {
|
||||||
private String formId;
|
private String formId;
|
||||||
private int sinceType;
|
private int sinceType;
|
||||||
private int subSinceType;
|
private int subSinceType;
|
||||||
private Data data;
|
private Object data;
|
||||||
|
|
||||||
// Getters and Setters
|
|
||||||
public String getFormId() {
|
|
||||||
return formId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFormId(String formId) {
|
|
||||||
this.formId = formId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSinceType() {
|
|
||||||
return sinceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSinceType(int sinceType) {
|
|
||||||
this.sinceType = sinceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSubSinceType() {
|
|
||||||
return subSinceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubSinceType(int subSinceType) {
|
|
||||||
this.subSinceType = subSinceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Data getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setData(Data data) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Data {
|
|
||||||
private String businessId;
|
|
||||||
private String vdqwUserId;
|
|
||||||
private String vdqwCustomerId;
|
|
||||||
private String defeatTime;
|
|
||||||
|
|
||||||
private String approveCode;
|
|
||||||
private String approveResult;
|
|
||||||
private String approveOpinion;
|
|
||||||
private List<CallList> callList;
|
|
||||||
|
|
||||||
// Getters and Setters
|
|
||||||
public String getBusinessId() {
|
|
||||||
return businessId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBusinessId(String businessId) {
|
|
||||||
this.businessId = businessId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVdqwUserId() {
|
|
||||||
return vdqwUserId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVdqwUserId(String vdqwUserId) {
|
|
||||||
this.vdqwUserId = vdqwUserId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVdqwCustomerId() {
|
|
||||||
return vdqwCustomerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVdqwCustomerId(String vdqwCustomerId) {
|
|
||||||
this.vdqwCustomerId = vdqwCustomerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDefeatTime() {
|
|
||||||
return defeatTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDefeatTime(String defeatTime) {
|
|
||||||
this.defeatTime = defeatTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getApproveCode() {
|
|
||||||
return approveCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setApproveCode(String approveCode) {
|
|
||||||
this.approveCode = approveCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getApproveResult() {
|
|
||||||
return approveResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setApproveResult(String approveResult) {
|
|
||||||
this.approveResult = approveResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getApproveOpinion() {
|
|
||||||
return approveOpinion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setApproveOpinion(String approveOpinion) {
|
|
||||||
this.approveOpinion = approveOpinion;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<CallList> getCallList() {
|
|
||||||
return callList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCallList(List<CallList> callList) {
|
|
||||||
this.callList = callList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CallList {
|
|
||||||
private String sessionId;
|
|
||||||
private String sourceId;
|
|
||||||
private String audioTime;
|
|
||||||
private int audioBillsec;
|
|
||||||
|
|
||||||
// Getters and Setters
|
|
||||||
public String getSessionId() {
|
|
||||||
return sessionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSessionId(String sessionId) {
|
|
||||||
this.sessionId = sessionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSourceId() {
|
|
||||||
return sourceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSourceId(String sourceId) {
|
|
||||||
this.sourceId = sourceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAudioTime() {
|
|
||||||
return audioTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAudioTime(String audioTime) {
|
|
||||||
this.audioTime = audioTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getAudioBillsec() {
|
|
||||||
return audioBillsec;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAudioBillsec(int audioBillsec) {
|
|
||||||
this.audioBillsec = audioBillsec;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.volvo.ai.analytic.center.dto.resp;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DiffDefeatAnalyseOutput {
|
||||||
|
|
||||||
|
|
||||||
|
private Integer handleStatus;
|
||||||
|
|
||||||
|
private String resultStr;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.volvo.ai.analytic.center.dto.resp;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DiffDefeatAnalyseOutputResult {
|
||||||
|
|
||||||
|
private DiffDefeatAnalyseOutput diffDefeatAnalyseOutput;
|
||||||
|
|
||||||
|
private String contentStr;
|
||||||
|
|
||||||
|
public DiffDefeatAnalyseOutputResult(DiffDefeatAnalyseOutput diffDefeatAnalyseOutput, String contentStr) {
|
||||||
|
this.diffDefeatAnalyseOutput = diffDefeatAnalyseOutput;
|
||||||
|
this.contentStr = contentStr;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.volvo.ai.analytic.center.dto.resp;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DiffDefeatResult {
|
||||||
|
|
||||||
|
private String userStatus;
|
||||||
|
|
||||||
|
private String appointmentResult;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.volvo.ai.analytic.center.dto.resp;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DiffDefeatanCallbak {
|
||||||
|
|
||||||
|
|
||||||
|
private String businessId;
|
||||||
|
|
||||||
|
private String responseCode;
|
||||||
|
|
||||||
|
private String responseMsg;
|
||||||
|
|
||||||
|
private String label;
|
||||||
|
|
||||||
|
private String describe;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,94 +1,15 @@
|
|||||||
package com.volvo.ai.analytic.center.dto.resp;
|
package com.volvo.ai.analytic.center.dto.resp;
|
||||||
|
|
||||||
import java.util.List;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mq消息体解析对象
|
* mq消息体解析对象
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class RabbitMqToData {
|
public class RabbitMqToData {
|
||||||
private String formId;
|
private String formId;
|
||||||
private int sinceType;
|
private int sinceType;
|
||||||
private int subSinceType;
|
private int subSinceType;
|
||||||
private Data data;
|
private DiffDefeatanCallbak data;
|
||||||
|
|
||||||
// Getters and Setters
|
|
||||||
public String getFormId() {
|
|
||||||
return formId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFormId(String formId) {
|
|
||||||
this.formId = formId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSinceType() {
|
|
||||||
return sinceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSinceType(int sinceType) {
|
|
||||||
this.sinceType = sinceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSubSinceType() {
|
|
||||||
return subSinceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubSinceType(int subSinceType) {
|
|
||||||
this.subSinceType = subSinceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Data getData() {
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setData(Data data) {
|
|
||||||
this.data = data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Data {
|
|
||||||
private String businessId;
|
|
||||||
private String responseCode;
|
|
||||||
private String responseMsg;
|
|
||||||
private String label;
|
|
||||||
private String describe;
|
|
||||||
|
|
||||||
public String getBusinessId() {
|
|
||||||
return businessId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBusinessId(String businessId) {
|
|
||||||
this.businessId = businessId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getResponseCode() {
|
|
||||||
return responseCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResponseCode(String responseCode) {
|
|
||||||
this.responseCode = responseCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getResponseMsg() {
|
|
||||||
return responseMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResponseMsg(String responseMsg) {
|
|
||||||
this.responseMsg = responseMsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLabel(String label) {
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescribe() {
|
|
||||||
return describe;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescribe(String describe) {
|
|
||||||
this.describe = describe;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -29,18 +29,6 @@ public class DataMaskingRule extends BaseEntity {
|
|||||||
@TableField("is_deleted")
|
@TableField("is_deleted")
|
||||||
private Integer isDeleted;
|
private Integer isDeleted;
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建人
|
* 创建人
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,18 +26,6 @@ public class DiffdefeatApprove extends BaseEntity {
|
|||||||
@TableField("is_deleted")
|
@TableField("is_deleted")
|
||||||
private Integer isDeleted;
|
private Integer isDeleted;
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建人
|
* 创建人
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -100,18 +100,6 @@ public class MqMessageRecord extends BaseEntity {
|
|||||||
@TableField("is_deleted")
|
@TableField("is_deleted")
|
||||||
private Integer isDeleted;
|
private Integer isDeleted;
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建人
|
* 创建人
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.volvo.ai.analytic.center.enums;
|
||||||
|
|
||||||
|
public enum MqTaskStatusEnum {
|
||||||
|
Analysis_Wait(0, "待分析"),
|
||||||
|
Analysis_Underway(1, "分析中"),
|
||||||
|
Analysis_Completion(2, "分析完成"),
|
||||||
|
Analysis_Failure(3, "分析失败"),
|
||||||
|
;
|
||||||
|
private int code;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
MqTaskStatusEnum(int code, String name) {
|
||||||
|
this.code = code;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.volvo.ai.analytic.center.enums;
|
||||||
|
|
||||||
|
|
||||||
|
public enum SubSinceTypeEnum {
|
||||||
|
SinceType51(51, "真假战败分析请求"),
|
||||||
|
SinceType52(52, "真假战败审批结果"),
|
||||||
|
SinceType53(53, "真假战败分析结果"),
|
||||||
|
;
|
||||||
|
private int code;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
SubSinceTypeEnum(int code, String name) {
|
||||||
|
this.code = code;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.volvo.ai.analytic.center.feign;
|
package com.volvo.ai.analytic.center.feign;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -12,6 +13,6 @@ public interface DiFyFeign {
|
|||||||
@PostMapping(value = "v1/workflows/run"
|
@PostMapping(value = "v1/workflows/run"
|
||||||
, consumes = MediaType.APPLICATION_JSON_VALUE
|
, consumes = MediaType.APPLICATION_JSON_VALUE
|
||||||
, produces = MediaType.APPLICATION_JSON_VALUE)
|
, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
Object runWorkflows(@RequestHeader(value = "Authorization") String authorization, @RequestBody Map<String, Object> map);
|
JSONObject runWorkflows(@RequestHeader(value = "Authorization") String authorization, @RequestBody Map<String, Object> map);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.volvo.ai.analytic.center.service;
|
||||||
|
|
||||||
|
import com.volvo.ai.analytic.center.dto.req.DiFyReq;
|
||||||
|
|
||||||
|
public interface DiFyService {
|
||||||
|
|
||||||
|
|
||||||
|
public Object getDiFyObject(DiFyReq diFyReq);
|
||||||
|
}
|
||||||
@@ -1,7 +1,19 @@
|
|||||||
package com.volvo.ai.analytic.center.service;
|
package com.volvo.ai.analytic.center.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.volvo.ai.analytic.center.dto.req.DiffDefeatanAlysis;
|
||||||
|
import com.volvo.ai.analytic.center.dto.resp.DiffDefeatAnalyseOutputResult;
|
||||||
import com.volvo.ai.analytic.center.entity.MqMessageRecord;
|
import com.volvo.ai.analytic.center.entity.MqMessageRecord;
|
||||||
|
|
||||||
public interface MqMessageRecordService extends IService<MqMessageRecord> {
|
public interface MqMessageRecordService extends IService<MqMessageRecord> {
|
||||||
|
|
||||||
|
|
||||||
|
//mq消息处理方法
|
||||||
|
boolean processMessageByMQ(String message);
|
||||||
|
|
||||||
|
//处理聊天和语音记录
|
||||||
|
DiffDefeatAnalyseOutputResult processChatRecord(DiffDefeatanAlysis input);
|
||||||
|
|
||||||
|
//定时任务补偿处理消息
|
||||||
|
void processMessageByTask();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,12 +10,15 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class DataMaskingRuleServiceImpl extends ServiceImpl<DataMaskingRuleMapper, DataMaskingRule> implements DataMaskingRuleService {
|
public class DataMaskingRuleServiceImpl extends ServiceImpl<DataMaskingRuleMapper, DataMaskingRule> implements DataMaskingRuleService {
|
||||||
@Override
|
@Override
|
||||||
public List<DataMaskingRule> getDataMaskingRuleListByApplicationChannel(String applicationChannel) {
|
public List<DataMaskingRule> getDataMaskingRuleListByApplicationChannel(String applicationChannel) {
|
||||||
|
log.info("getDataMaskingRuleListByApplicationChannel {}", applicationChannel);
|
||||||
//根据适用渠道applicationChannel获取数据脱敏规则List
|
//根据适用渠道applicationChannel获取数据脱敏规则List
|
||||||
log.info("getDataMaskingRuleListByApplicationChannel applicationChannel:{}", applicationChannel);
|
log.info("getDataMaskingRuleListByApplicationChannel applicationChannel:{}", applicationChannel);
|
||||||
List<DataMaskingRule> dataMaskingRuleList = this.lambdaQuery()
|
List<DataMaskingRule> dataMaskingRuleList = this.lambdaQuery()
|
||||||
@@ -28,6 +31,26 @@ public class DataMaskingRuleServiceImpl extends ServiceImpl<DataMaskingRuleMappe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String runMaskingRule(RunMaskingRuleInput input) {
|
public String runMaskingRule(RunMaskingRuleInput input) {
|
||||||
return "";
|
String output = input.getOldStr();
|
||||||
|
if (input.getDataMaskingRules() != null && !input.getDataMaskingRules().isEmpty()) {
|
||||||
|
for (DataMaskingRule ruleItem : input.getDataMaskingRules()) {
|
||||||
|
try {
|
||||||
|
if ("文本".equals(ruleItem.getCategoryName())) {
|
||||||
|
output = output.replace(ruleItem.getRuleText(), ruleItem.getRuleMappingText());
|
||||||
|
} else if ("正则".equals(ruleItem.getCategoryName())) {
|
||||||
|
Pattern pattern = Pattern.compile(ruleItem.getRuleText(), Pattern.CASE_INSENSITIVE);
|
||||||
|
Matcher matcher = pattern.matcher(output);
|
||||||
|
while (matcher.find()) {
|
||||||
|
String matchedValue = matcher.group();
|
||||||
|
output = output.replace(matchedValue, ruleItem.getRuleMappingText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info("runMaskingRule input:{},output:{}", input, output);
|
||||||
|
return output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.volvo.ai.analytic.center.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.volvo.ai.analytic.center.dto.req.DiFyReq;
|
||||||
|
import com.volvo.ai.analytic.center.feign.DiFyFeign;
|
||||||
|
import com.volvo.ai.analytic.center.service.DiFyService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class DiFyServiceImpl implements DiFyService{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DiFyFeign diFyFeign;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getDiFyObject(DiFyReq diFyReq) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("inputs",diFyReq.getInputs());
|
||||||
|
map.put("response_mode","blocking");
|
||||||
|
map.put("user",diFyReq.getUser());
|
||||||
|
|
||||||
|
JSONObject difyResult = diFyFeign.runWorkflows("Bearer "+diFyReq.getFlowId(),map);
|
||||||
|
JSONObject data = difyResult.getJSONObject("data");
|
||||||
|
if (data != null && "succeeded".equals(data.get("status"))){
|
||||||
|
JSONObject outputs = data.getJSONObject("outputs");
|
||||||
|
return outputs;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,352 @@
|
|||||||
package com.volvo.ai.analytic.center.service.impl;
|
package com.volvo.ai.analytic.center.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.alibaba.cloud.commons.lang.StringUtils;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.volvo.ai.analytic.center.constant.Constant;
|
||||||
|
import com.volvo.ai.analytic.center.dto.req.*;
|
||||||
|
import com.volvo.ai.analytic.center.dto.resp.*;
|
||||||
|
import com.volvo.ai.analytic.center.entity.DataMaskingRule;
|
||||||
|
import com.volvo.ai.analytic.center.entity.DiffdefeatApprove;
|
||||||
import com.volvo.ai.analytic.center.entity.MqMessageRecord;
|
import com.volvo.ai.analytic.center.entity.MqMessageRecord;
|
||||||
|
import com.volvo.ai.analytic.center.enums.MqTaskStatusEnum;
|
||||||
|
import com.volvo.ai.analytic.center.enums.SubSinceTypeEnum;
|
||||||
import com.volvo.ai.analytic.center.mapper.MqMessageRecordMapper;
|
import com.volvo.ai.analytic.center.mapper.MqMessageRecordMapper;
|
||||||
|
import com.volvo.ai.analytic.center.service.DataMaskingRuleService;
|
||||||
|
import com.volvo.ai.analytic.center.service.DiFyService;
|
||||||
|
import com.volvo.ai.analytic.center.service.DiffdefeatApproveService;
|
||||||
import com.volvo.ai.analytic.center.service.MqMessageRecordService;
|
import com.volvo.ai.analytic.center.service.MqMessageRecordService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class MqMessageRecordServiceImpl extends ServiceImpl<MqMessageRecordMapper, MqMessageRecord> implements MqMessageRecordService {
|
public class MqMessageRecordServiceImpl extends ServiceImpl<MqMessageRecordMapper, MqMessageRecord> implements MqMessageRecordService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DataMaskingRuleService dataMaskingRuleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DiffdefeatApproveService diffdefeatApproveService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DiFyService diFyService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理Mq消息
|
||||||
|
* @param message
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean processMessageByMQ(String message) {
|
||||||
|
log.info("message: {}", message);
|
||||||
|
RabbitMqFormData oldItem = JSONObject.parseObject(message, RabbitMqFormData.class);
|
||||||
|
log.info("真假战败数据已获取 {}",oldItem.getFormId());
|
||||||
|
MqMessageRecord curMQMessageRecord = new MqMessageRecord();
|
||||||
|
try {
|
||||||
|
curMQMessageRecord.setSinceType(oldItem.getSinceType());
|
||||||
|
curMQMessageRecord.setSubSinceType(oldItem.getSubSinceType());
|
||||||
|
curMQMessageRecord.setBizNo(oldItem.getFormId());
|
||||||
|
curMQMessageRecord.setSubBizNo(oldItem.getFormId());
|
||||||
|
curMQMessageRecord.setMessageContent(message);
|
||||||
|
curMQMessageRecord.setRetryCount(0);
|
||||||
|
curMQMessageRecord.setLastRetryTime(new Date());
|
||||||
|
curMQMessageRecord.setTaskStatus(0);
|
||||||
|
this.save(curMQMessageRecord);
|
||||||
|
log.info("数据入库成功(MQMessageRecord)");
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("数据入库失败(MQMessageRecord)", ex.getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (oldItem.getSinceType() == 2 && oldItem.getSubSinceType() == SubSinceTypeEnum.SinceType51.getCode() ) {
|
||||||
|
log.info("辨别数据为分析请求");
|
||||||
|
DiffDefeatResult diffDefeatResult = null;
|
||||||
|
DiffDefeatanAlysis diffDefeatanAlysis = JSON.parseObject(JSON.toJSONString(oldItem.getData()), DiffDefeatanAlysis.class);
|
||||||
|
DiffDefeatAnalyseOutputResult response = this.processChatRecord(diffDefeatanAlysis);
|
||||||
|
DiffDefeatAnalyseOutput output = response.getDiffDefeatAnalyseOutput();
|
||||||
|
log.info("数据分析完成");
|
||||||
|
if(output.getHandleStatus() == 200){
|
||||||
|
curMQMessageRecord.setTaskStatus(MqTaskStatusEnum.Analysis_Completion.getCode());
|
||||||
|
diffDefeatResult = JSONObject.parseObject(output.getResultStr(), DiffDefeatResult.class);
|
||||||
|
} else if (output.getHandleStatus() == 400) {
|
||||||
|
curMQMessageRecord.setTaskStatus(MqTaskStatusEnum.Analysis_Completion.getCode());
|
||||||
|
diffDefeatResult = new DiffDefeatResult();
|
||||||
|
diffDefeatResult.setUserStatus("无效通话");
|
||||||
|
diffDefeatResult.setAppointmentResult("因为通话时间太短没有ASR转义文本,因此判断为无效通话");
|
||||||
|
} else {
|
||||||
|
curMQMessageRecord.setTaskStatus(MqTaskStatusEnum.Analysis_Failure.getCode());
|
||||||
|
}
|
||||||
|
curMQMessageRecord.setRespCode(output.getHandleStatus()+"");
|
||||||
|
curMQMessageRecord.setRespContent(output.getResultStr());
|
||||||
|
this.updateById(curMQMessageRecord);
|
||||||
|
log.info("数据更改分析状态完成");
|
||||||
|
|
||||||
|
if (curMQMessageRecord.getTaskStatus() == MqTaskStatusEnum.Analysis_Completion.getCode()){
|
||||||
|
log.info("数据分析结果正常");
|
||||||
|
DiffdefeatApprove curDiffdefeatApprove = new DiffdefeatApprove();
|
||||||
|
String userStatus = getUserStatus(diffDefeatResult.getUserStatus());
|
||||||
|
curDiffdefeatApprove.setFormId(oldItem.getFormId());
|
||||||
|
curDiffdefeatApprove.setBusinessId(diffDefeatanAlysis.getBusinessId());
|
||||||
|
curDiffdefeatApprove.setUserStatus(userStatus);
|
||||||
|
curDiffdefeatApprove.setAppointmentResult(diffDefeatResult.getAppointmentResult());
|
||||||
|
curDiffdefeatApprove.setInputStr(response.getContentStr());
|
||||||
|
curDiffdefeatApprove.setDefeatTime(diffDefeatanAlysis.getDefeatTime());
|
||||||
|
diffdefeatApproveService.save(curDiffdefeatApprove);
|
||||||
|
log.info("插入数据记录完成");
|
||||||
|
|
||||||
|
DiffDefeatanCallbak curDiffDefeatanCallbak = new DiffDefeatanCallbak();
|
||||||
|
curDiffDefeatanCallbak.setBusinessId(diffDefeatanAlysis.getBusinessId());
|
||||||
|
curDiffDefeatanCallbak.setResponseCode("200");
|
||||||
|
curDiffDefeatanCallbak.setLabel(userStatus);
|
||||||
|
curDiffDefeatanCallbak.setDescribe(diffDefeatResult.getAppointmentResult());
|
||||||
|
RabbitMqToData rabbitMqToData = new RabbitMqToData();
|
||||||
|
rabbitMqToData.setFormId(oldItem.getFormId());
|
||||||
|
rabbitMqToData.setSinceType(2);
|
||||||
|
rabbitMqToData.setSubSinceType(SubSinceTypeEnum.SinceType53.getCode());
|
||||||
|
rabbitMqToData.setData(curDiffDefeatanCallbak);
|
||||||
|
String callbakInput = JSONObject.toJSONString(rabbitMqToData);
|
||||||
|
//todo 发Mq给LTO
|
||||||
|
log.info("发送回调MQ完成: {}", callbakInput);
|
||||||
|
} else {
|
||||||
|
log.info("数据分析结果不正常,等待重试");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (oldItem.getSinceType() == 2 && oldItem.getSubSinceType() == SubSinceTypeEnum.SinceType52.getCode()) {
|
||||||
|
log.info("辨别数据为审批结果");
|
||||||
|
com.volvo.ai.analytic.center.dto.req.DiffDefeatanApprove curDiffDefeatanApprove = JSON.parseObject(JSON.toJSONString(oldItem.getData()), com.volvo.ai.analytic.center.dto.req.DiffDefeatanApprove.class);
|
||||||
|
DiffdefeatApprove approveEntity = diffdefeatApproveService.lambdaQuery().eq(DiffdefeatApprove::getFormId, oldItem.getFormId()).last("limit 1").one();
|
||||||
|
if (approveEntity != null) {
|
||||||
|
try {
|
||||||
|
approveEntity.setApproveCode(curDiffDefeatanApprove.getApproveCode());
|
||||||
|
approveEntity.setApproveResult(curDiffDefeatanApprove.getApproveResult());
|
||||||
|
approveEntity.setApproveOpinion(curDiffDefeatanApprove.getApproveOpinion());
|
||||||
|
diffdefeatApproveService.updateById(approveEntity);
|
||||||
|
|
||||||
|
curMQMessageRecord.setTaskStatus(MqTaskStatusEnum.Analysis_Completion.getCode());
|
||||||
|
curMQMessageRecord.setRespCode("200");
|
||||||
|
this.updateById(curMQMessageRecord);
|
||||||
|
log.info("审批结果更新完成");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("审批结果更新失败",e.getMessage());
|
||||||
|
curMQMessageRecord.setTaskStatus(MqTaskStatusEnum.Analysis_Failure.getCode());
|
||||||
|
curMQMessageRecord.setRespContent(e.getMessage());
|
||||||
|
curMQMessageRecord.setRespCode("500");
|
||||||
|
this.updateById(curMQMessageRecord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理聊天和语音数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DiffDefeatAnalyseOutputResult processChatRecord(DiffDefeatanAlysis input) {
|
||||||
|
DiffDefeatAnalyseOutput output = new DiffDefeatAnalyseOutput();
|
||||||
|
String contentStr = "";
|
||||||
|
//获取脱敏配置信息
|
||||||
|
List<DataMaskingRule> maskingRuleItems = dataMaskingRuleService.getDataMaskingRuleListByApplicationChannel(Constant.CHANNEL_DCC);
|
||||||
|
|
||||||
|
// 根据SourceId查询通话信息
|
||||||
|
List<String> sourceIds = input.getCallList().stream().map(CallItem::getSourceId).collect(Collectors.toList());
|
||||||
|
if (!sourceIds.isEmpty()) {
|
||||||
|
int asrCount = 0;
|
||||||
|
//todo 查询未完成解析的通话信息
|
||||||
|
if (asrCount > 0) {
|
||||||
|
output.setHandleStatus(500);
|
||||||
|
output.setResultStr("存在未完成解析的通话信息");
|
||||||
|
return new DiffDefeatAnalyseOutputResult(output, contentStr);
|
||||||
|
}
|
||||||
|
//todo 查询到的通话数据
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询企微的数据
|
||||||
|
if (input.getVdqwUserId() == null || input.getVdqwCustomerId() == null) {
|
||||||
|
log.info("企微用户信息为空,不附加企微数据");
|
||||||
|
}else {
|
||||||
|
//todo 查询到的企微数据
|
||||||
|
}
|
||||||
|
//todo 组装数据
|
||||||
|
|
||||||
|
if (StringUtils.isEmpty(contentStr)) {
|
||||||
|
output.setHandleStatus(400);
|
||||||
|
output.setResultStr("语料信息为空");
|
||||||
|
return new DiffDefeatAnalyseOutputResult(output, contentStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("开始脱敏 {}", contentStr);
|
||||||
|
RunMaskingRuleInput runMaskingRuleInput = new RunMaskingRuleInput();
|
||||||
|
runMaskingRuleInput.setOpinionId(input.getBusinessId());
|
||||||
|
runMaskingRuleInput.setOldStr(contentStr);
|
||||||
|
runMaskingRuleInput.setDataMaskingRules(maskingRuleItems);
|
||||||
|
String summaryText = dataMaskingRuleService.runMaskingRule(runMaskingRuleInput);
|
||||||
|
log.info("脱敏结果 {}", summaryText);
|
||||||
|
|
||||||
|
Map<String, Object> record = new HashMap<>();
|
||||||
|
record.put("record",summaryText);
|
||||||
|
|
||||||
|
DiFyReq diFyReq = new DiFyReq();
|
||||||
|
diFyReq.setUser("voc");
|
||||||
|
diFyReq.setFlowId("app-MVGxogM08CDCg7jMo7GNF6eS");
|
||||||
|
diFyReq.setInputs(record);
|
||||||
|
JSONObject difyResult = (JSONObject) diFyService.getDiFyObject(diFyReq);
|
||||||
|
output.setHandleStatus(200);
|
||||||
|
output.setResultStr(difyResult.getString("result"));
|
||||||
|
log.info("DiFy平台处理结果:{}", output.getResultStr());
|
||||||
|
return new DiffDefeatAnalyseOutputResult(output, contentStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processMessageByTask() {
|
||||||
|
log.info("开始处理任务");
|
||||||
|
Date currTime = new Date();
|
||||||
|
Date startTime = DateUtil.offsetDay(currTime, -3);
|
||||||
|
Date stopTime = DateUtil.offsetMinute(currTime, -5);
|
||||||
|
List<MqMessageRecord> mqMessageRecords = this.lambdaQuery()
|
||||||
|
.eq(MqMessageRecord::getTaskStatus, MqTaskStatusEnum.Analysis_Failure.getCode())
|
||||||
|
.eq(MqMessageRecord::getSinceType, 2)
|
||||||
|
.le(MqMessageRecord::getRetryCount, 3)
|
||||||
|
.ge(MqMessageRecord::getCreateTime, startTime)
|
||||||
|
.lt(MqMessageRecord::getLastRetryTime, stopTime)
|
||||||
|
.list();
|
||||||
|
if (CollectionUtils.isEmpty(mqMessageRecords)){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
for (MqMessageRecord curMQMessageRecord : mqMessageRecords){
|
||||||
|
log.info("辨别数据为分析请求");
|
||||||
|
RabbitMqFormData oldItem = JSONObject.parseObject(curMQMessageRecord.getMessageContent(), RabbitMqFormData.class);
|
||||||
|
if (curMQMessageRecord.getSinceType() == 2 && curMQMessageRecord.getSubSinceType() == SubSinceTypeEnum.SinceType51.getCode() ) {
|
||||||
|
try {
|
||||||
|
DiffDefeatResult diffDefeatResult = null;
|
||||||
|
DiffDefeatanAlysis diffDefeatanAlysis = JSON.parseObject(JSON.toJSONString(oldItem.getData()), DiffDefeatanAlysis.class);
|
||||||
|
DiffDefeatAnalyseOutputResult response = this.processChatRecord(diffDefeatanAlysis);
|
||||||
|
DiffDefeatAnalyseOutput output = response.getDiffDefeatAnalyseOutput();
|
||||||
|
log.info("数据分析完成");
|
||||||
|
if(output.getHandleStatus() == 200){
|
||||||
|
curMQMessageRecord.setTaskStatus(MqTaskStatusEnum.Analysis_Completion.getCode());
|
||||||
|
diffDefeatResult = JSONObject.parseObject(output.getResultStr(), DiffDefeatResult.class);
|
||||||
|
} else if (output.getHandleStatus() == 400) {
|
||||||
|
curMQMessageRecord.setTaskStatus(MqTaskStatusEnum.Analysis_Completion.getCode());
|
||||||
|
diffDefeatResult = new DiffDefeatResult();
|
||||||
|
diffDefeatResult.setUserStatus("无效通话");
|
||||||
|
diffDefeatResult.setAppointmentResult("因为通话时间太短没有ASR转义文本,因此判断为无效通话");
|
||||||
|
} else {
|
||||||
|
curMQMessageRecord.setTaskStatus(MqTaskStatusEnum.Analysis_Failure.getCode());
|
||||||
|
}
|
||||||
|
if (curMQMessageRecord.getTaskStatus() == MqTaskStatusEnum.Analysis_Completion.getCode()){
|
||||||
|
String userStatus = getUserStatus(diffDefeatResult.getUserStatus());
|
||||||
|
DiffdefeatApprove curDiffdefeatApprove = diffdefeatApproveService.lambdaQuery()
|
||||||
|
.eq(DiffdefeatApprove::getFormId, oldItem.getFormId())
|
||||||
|
.eq(DiffdefeatApprove::getBusinessId, curMQMessageRecord.getSubBizNo())
|
||||||
|
.orderByDesc(DiffdefeatApprove::getId)
|
||||||
|
.last("limit 1").one();
|
||||||
|
if(curDiffdefeatApprove!=null){
|
||||||
|
curDiffdefeatApprove.setAppointmentResult(diffDefeatResult.getAppointmentResult());
|
||||||
|
curDiffdefeatApprove.setUserStatus(userStatus);
|
||||||
|
curDiffdefeatApprove.setInputStr(response.getContentStr());
|
||||||
|
} else {
|
||||||
|
log.info("数据分析结果正常");
|
||||||
|
curDiffdefeatApprove = new DiffdefeatApprove();
|
||||||
|
curDiffdefeatApprove.setFormId(oldItem.getFormId());
|
||||||
|
curDiffdefeatApprove.setBusinessId(diffDefeatanAlysis.getBusinessId());
|
||||||
|
curDiffdefeatApprove.setUserStatus(userStatus);
|
||||||
|
curDiffdefeatApprove.setAppointmentResult(diffDefeatResult.getAppointmentResult());
|
||||||
|
curDiffdefeatApprove.setInputStr(response.getContentStr());
|
||||||
|
curDiffdefeatApprove.setDefeatTime(diffDefeatanAlysis.getDefeatTime());
|
||||||
|
diffdefeatApproveService.save(curDiffdefeatApprove);
|
||||||
|
log.info("插入数据记录完成");
|
||||||
|
}
|
||||||
|
|
||||||
|
DiffDefeatanCallbak curDiffDefeatanCallbak = new DiffDefeatanCallbak();
|
||||||
|
curDiffDefeatanCallbak.setBusinessId(diffDefeatanAlysis.getBusinessId());
|
||||||
|
curDiffDefeatanCallbak.setResponseCode("200");
|
||||||
|
curDiffDefeatanCallbak.setLabel(userStatus);
|
||||||
|
curDiffDefeatanCallbak.setDescribe(diffDefeatResult.getAppointmentResult());
|
||||||
|
RabbitMqToData rabbitMqToData = new RabbitMqToData();
|
||||||
|
rabbitMqToData.setFormId(oldItem.getFormId());
|
||||||
|
rabbitMqToData.setSinceType(2);
|
||||||
|
rabbitMqToData.setSubSinceType(SubSinceTypeEnum.SinceType53.getCode());
|
||||||
|
rabbitMqToData.setData(curDiffDefeatanCallbak);
|
||||||
|
String callbakInput = JSONObject.toJSONString(rabbitMqToData);
|
||||||
|
//todo 发Mq给LTO
|
||||||
|
log.info("发送回调MQ完成: {}", callbakInput);
|
||||||
|
}
|
||||||
|
curMQMessageRecord.setRespCode(output.getHandleStatus()+"");
|
||||||
|
curMQMessageRecord.setRespContent(output.getResultStr());
|
||||||
|
curMQMessageRecord.setLastRetryTime(new Date());
|
||||||
|
curMQMessageRecord.setRetryCount(curMQMessageRecord.getRetryCount()+1);
|
||||||
|
this.updateById(curMQMessageRecord);
|
||||||
|
log.info("数据更改分析状态完成");
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("数据解析异常: {}", e.getMessage());
|
||||||
|
curMQMessageRecord.setTaskStatus(MqTaskStatusEnum.Analysis_Failure.getCode());
|
||||||
|
curMQMessageRecord.setRespCode("500");
|
||||||
|
curMQMessageRecord.setRespContent(e.getMessage());
|
||||||
|
curMQMessageRecord.setLastRetryTime(new Date());
|
||||||
|
curMQMessageRecord.setRetryCount(curMQMessageRecord.getRetryCount()+1);
|
||||||
|
this.updateById(curMQMessageRecord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (curMQMessageRecord.getSinceType() == 2 && curMQMessageRecord.getSubSinceType() == SubSinceTypeEnum.SinceType52.getCode()) {
|
||||||
|
try {
|
||||||
|
DiffdefeatApprove approveEntity = diffdefeatApproveService.lambdaQuery()
|
||||||
|
.eq(DiffdefeatApprove::getFormId, oldItem.getFormId())
|
||||||
|
.eq(DiffdefeatApprove::getBusinessId, curMQMessageRecord.getSubBizNo())
|
||||||
|
.orderByDesc(DiffdefeatApprove::getId)
|
||||||
|
.last("limit 1").one();
|
||||||
|
DiffDefeatanApprove curDiffDefeatanApprove = JSON.parseObject(JSON.toJSONString(oldItem.getData()), DiffDefeatanApprove.class);
|
||||||
|
if (approveEntity != null){
|
||||||
|
approveEntity.setApproveCode(curDiffDefeatanApprove.getApproveCode());
|
||||||
|
approveEntity.setApproveResult(curDiffDefeatanApprove.getApproveResult());
|
||||||
|
approveEntity.setApproveOpinion(curDiffDefeatanApprove.getApproveOpinion());
|
||||||
|
diffdefeatApproveService.updateById(approveEntity);
|
||||||
|
|
||||||
|
curMQMessageRecord.setTaskStatus(MqTaskStatusEnum.Analysis_Completion.getCode());
|
||||||
|
curMQMessageRecord.setRespCode("200");
|
||||||
|
curMQMessageRecord.setRespContent("");
|
||||||
|
curMQMessageRecord.setLastRetryTime(new Date());
|
||||||
|
curMQMessageRecord.setRetryCount(curMQMessageRecord.getRetryCount()+1);
|
||||||
|
this.updateById(curMQMessageRecord);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("数据解析异常: {}", e.getMessage());
|
||||||
|
curMQMessageRecord.setTaskStatus(MqTaskStatusEnum.Analysis_Failure.getCode());
|
||||||
|
curMQMessageRecord.setRespCode("500");
|
||||||
|
curMQMessageRecord.setRespContent(e.getMessage());
|
||||||
|
curMQMessageRecord.setLastRetryTime(new Date());
|
||||||
|
curMQMessageRecord.setRetryCount(curMQMessageRecord.getRetryCount()+1);
|
||||||
|
this.updateById(curMQMessageRecord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getUserStatus(String oldStr)
|
||||||
|
{
|
||||||
|
if (oldStr == "确认到店"){
|
||||||
|
return "客户确认将到店";
|
||||||
|
}else if (oldStr == "继续观望"){
|
||||||
|
return "客户继续观望中";
|
||||||
|
}else if (oldStr == "放弃购车"){
|
||||||
|
return "客户放弃购车";
|
||||||
|
}else if (oldStr == "无效通话"){
|
||||||
|
return "近三天无有效通话记录";
|
||||||
|
}
|
||||||
|
return oldStr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user