索赔检核代码
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
package com.volvo.ai.analytic.center.dto.req;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ClaimVerificationFileDTO {
|
||||||
|
|
||||||
|
@NotBlank(message = "售后ID不能为空")
|
||||||
|
private String newBieAfterSalesId;
|
||||||
|
|
||||||
|
@NotBlank(message = "业务类型不能为空, 99001:文件分析,99002:审计报告")
|
||||||
|
private String businessType;
|
||||||
|
|
||||||
|
//文件类型 dtc,诊断报告
|
||||||
|
private String fileType;
|
||||||
|
|
||||||
|
//obs文件路径集合
|
||||||
|
private List<String> fileObsPath;
|
||||||
|
|
||||||
|
//DTC报告
|
||||||
|
private JSONObject dtcReport;
|
||||||
|
|
||||||
|
//环检报告
|
||||||
|
private JSONObject preCheckReport;
|
||||||
|
|
||||||
|
//诊断报告
|
||||||
|
private JSONObject diagnosticReport;
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
package com.volvo.ai.analytic.center.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("tt_ai_analytic_business_config")
|
||||||
|
public class AiAnalyticBusinessConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务线标识(如:A业务/B业务/C业务)
|
||||||
|
*/
|
||||||
|
@TableField(value = "business_line")
|
||||||
|
private String businessLine;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检核方式 AI检核 : 9911 人工复核: 9912)
|
||||||
|
*/
|
||||||
|
@TableField(value = "verification_method")
|
||||||
|
private String verificationMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置类型:FileDescription,AnalysisRequirement,ReportRequirements,ReportTemplate,AnalysisRules
|
||||||
|
*/
|
||||||
|
@TableField(value = "config_type")
|
||||||
|
private String configType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置内容
|
||||||
|
*/
|
||||||
|
@TableField(value = "config_data")
|
||||||
|
private String configData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置版本
|
||||||
|
*/
|
||||||
|
@TableField(value = "config_version")
|
||||||
|
private Integer configVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除标识(0-未删除,1-已删除)
|
||||||
|
*/
|
||||||
|
@TableField(value = "is_deleted")
|
||||||
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "create_time")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "update_time")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@TableField(value = "create_by")
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
@TableField(value = "update_by")
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 乐观锁
|
||||||
|
*/
|
||||||
|
@TableField(value = "versions")
|
||||||
|
private Integer versions;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,7 +6,14 @@ import lombok.Getter;
|
|||||||
public enum BusinessTypeEnum {
|
public enum BusinessTypeEnum {
|
||||||
|
|
||||||
COMMUNITYTARGET("CommunityTarget", "社区舆情分析"),
|
COMMUNITYTARGET("CommunityTarget", "社区舆情分析"),
|
||||||
SMART_ASSISTANT("SMART_ASSISTANT", "智能助手")
|
SMART_ASSISTANT("SMART_ASSISTANT", "智能助手"),
|
||||||
|
|
||||||
|
//索赔检核
|
||||||
|
CLAIM_VERIFICATION("CLAIM_VERIFICATION", "索赔检核流程"),
|
||||||
|
CLAIM_VERIFICATION_FILE_ANALYSIS("99001", "索赔检核文件分析"),
|
||||||
|
CLAIM_VERIFICATION_AUDIT("99002", "索赔检核审计报告"),
|
||||||
|
CLAIM_VERIFICATION_DTC("DTC", "DTC报告"),
|
||||||
|
CLAIM_VERIFICATION_DIAGNOSTIC("DIAGNOSTIC", "诊断报告")
|
||||||
;
|
;
|
||||||
|
|
||||||
private String code;
|
private String code;
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.volvo.ai.analytic.center.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.volvo.ai.analytic.center.entity.AiAnalyticBusinessConfig;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AiAnalyticBusinessConfigMapper extends BaseMapper<AiAnalyticBusinessConfig> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.volvo.ai.analytic.center.mq;
|
||||||
|
|
||||||
|
import com.volvo.ai.analytic.center.service.ClaimVerificationService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.rocketmq.common.message.MessageExt;
|
||||||
|
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||||
|
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RocketMQMessageListener(consumerGroup = "${rocketmq.consumer..group}",
|
||||||
|
topic = "${rocketmq.consumer.topic}",
|
||||||
|
enableMsgTrace = true)
|
||||||
|
public class ClaimVerificationConsumer implements RocketMQListener<MessageExt>{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ClaimVerificationService claimVerificationService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessage(MessageExt messageExt) {
|
||||||
|
log.info("Received 索赔检核 message: " + messageExt);
|
||||||
|
claimVerificationService.consumerMessageByMQ(new String(messageExt.getBody()));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.volvo.ai.analytic.center.service;
|
||||||
|
|
||||||
|
public interface ClaimVerificationService {
|
||||||
|
|
||||||
|
|
||||||
|
void consumerMessageByMQ(String message);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.volvo.ai.analytic.center.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.volvo.ai.analytic.center.dto.req.ClaimVerificationFileDTO;
|
||||||
|
import com.volvo.ai.analytic.center.entity.AiAnalysisRequestLogs;
|
||||||
|
import com.volvo.ai.analytic.center.enums.BusinessTypeEnum;
|
||||||
|
import com.volvo.ai.analytic.center.mapper.AiAnalysisRequestLogsMapper;
|
||||||
|
import com.volvo.ai.analytic.center.mapper.AiAnalyticBusinessConfigMapper;
|
||||||
|
import com.volvo.ai.analytic.center.service.ClaimVerificationService;
|
||||||
|
import com.volvo.ai.analytic.center.utils.AiAnalysisUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class ClaimVerificationServiceImpl implements ClaimVerificationService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AiAnalysisRequestLogsMapper aiAnalysisRequestLogsMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AiAnalyticBusinessConfigMapper aiAnalyticBusinessConfigMapper;
|
||||||
|
|
||||||
|
@Value("${dify.claimVerification.user}")
|
||||||
|
private String claimVerificationUser;
|
||||||
|
|
||||||
|
@Value("${dify.claimVerification.fileToken}")
|
||||||
|
private String fileToken;
|
||||||
|
|
||||||
|
@Value("${dify.claimVerification.verificationToken}")
|
||||||
|
private String verificationToken;
|
||||||
|
|
||||||
|
@Value("${rocketmq.producer.topic}")
|
||||||
|
private String topic;
|
||||||
|
@Override
|
||||||
|
public void consumerMessageByMQ(String message) {
|
||||||
|
log.info("售后索赔检核MQ message: {}", message);
|
||||||
|
ClaimVerificationFileDTO claimVerificationFileAnalysisDTO = JSON.parseObject(message, ClaimVerificationFileDTO.class);
|
||||||
|
if (claimVerificationFileAnalysisDTO == null) {
|
||||||
|
log.error(" 售后索赔检核文件入参 is null");
|
||||||
|
throw new RuntimeException(" 售后索赔检核文件分析入参为空");
|
||||||
|
}
|
||||||
|
// 生成ai分析请求id
|
||||||
|
String aiAnalysisRequestId = AiAnalysisUtils.getAiAnalysisRequestId(BusinessTypeEnum.COMMUNITYTARGET.getCode());
|
||||||
|
// 异步保存请求日志
|
||||||
|
syncSaveRequestLogs(message, aiAnalysisRequestId);
|
||||||
|
|
||||||
|
if(claimVerificationFileAnalysisDTO.getBusinessType().equals(BusinessTypeEnum.CLAIM_VERIFICATION_FILE_ANALYSIS.getCode())){
|
||||||
|
//文件分析
|
||||||
|
List<String> fileObsPath = claimVerificationFileAnalysisDTO.getFileObsPath();
|
||||||
|
if(fileObsPath != null && fileObsPath.size() > 0){
|
||||||
|
|
||||||
|
}
|
||||||
|
} else if(claimVerificationFileAnalysisDTO.getBusinessType().equals(BusinessTypeEnum.CLAIM_VERIFICATION_AUDIT.getCode())){
|
||||||
|
//审计报告
|
||||||
|
}else {
|
||||||
|
throw new RuntimeException(" 售后索赔检核业务类型错误");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Async
|
||||||
|
protected void syncSaveRequestLogs(String message, String aiAnalysisRequestId) {
|
||||||
|
aiAnalysisRequestLogsMapper.insert(AiAnalysisRequestLogs.builder()
|
||||||
|
.aiAnalysisRequestId(aiAnalysisRequestId)
|
||||||
|
.businessRequest(message)
|
||||||
|
.difyAgentKey("")
|
||||||
|
.aiAnalysisRequestType(BusinessTypeEnum.COMMUNITYTARGET.getCode())
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user