Commit e653508b by 叶立庆

Merge branch 'v5.7.4' into 'master'

上线合并

See merge request !15
2 parents ac0b4d17 c9e163b4
Showing 34 changed files with 625 additions and 88 deletions
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</parent> </parent>
<groupId>cn.com.glsx</groupId> <groupId>cn.com.glsx</groupId>
<artifactId>rpc-dj-mindworkplate-api</artifactId> <artifactId>rpc-dj-mindworkplate-api</artifactId>
<version>5.7.1-SNAPSHOT</version> <version>5.7.4-SNAPSHOT</version>
<name>rpc-dj-mindworkplate-api</name> <name>rpc-dj-mindworkplate-api</name>
<properties> <properties>
<deploy.scanPackage>cn.com.glsx.remote</deploy.scanPackage> <deploy.scanPackage>cn.com.glsx.remote</deploy.scanPackage>
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<dependency> <dependency>
<groupId>cn.com.glsx</groupId> <groupId>cn.com.glsx</groupId>
<artifactId>rpc-dj-mindworkplate-api</artifactId> <artifactId>rpc-dj-mindworkplate-api</artifactId>
<version>5.7.1-SNAPSHOT</version> <version>${project.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
</plugin> </plugin>
......
...@@ -73,4 +73,10 @@ public class ReceptionViolationInfoDTO implements Serializable { ...@@ -73,4 +73,10 @@ public class ReceptionViolationInfoDTO implements Serializable {
private RecordingBatchModelCallWghs recordingBatchModelCallWghs; private RecordingBatchModelCallWghs recordingBatchModelCallWghs;
private String resultJson; private String resultJson;
@ApiModelProperty(notes = "二级品牌ID")
private Integer carBrandId;
@ApiModelProperty(notes = "二级品牌名称")
private String carBrandName;
} }
\ No newline at end of file \ No newline at end of file
...@@ -38,4 +38,7 @@ public class ReceptionViolationReqDTO implements Serializable { ...@@ -38,4 +38,7 @@ public class ReceptionViolationReqDTO implements Serializable {
@ApiModelProperty(notes = "1.延保 2.轻改") @ApiModelProperty(notes = "1.延保 2.轻改")
private Integer bussinessType; private Integer bussinessType;
@ApiModelProperty(notes = "二级品牌ID")
private Integer carBrandId;
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.dj.mindworkplate.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Data;
@Table(name = "recording_tag_config_model_type")
@Data
public class RecordingTagConfigModelType {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 配置编码
*/
@Column(name = "config_code")
private String configCode;
/**
* 模型类型
*/
@Column(name = "model_type")
private String modelType;
/**
* 创建人
*/
@Column(name = "created_by")
private String createdBy;
/**
* 创建时间
*/
@Column(name = "created_date")
private Date createdDate;
/**
* 修改人
*/
@Column(name = "updated_by")
private String updatedBy;
/**
* 修改时间
*/
@Column(name = "updated_date")
private Date updatedDate;
/**
* 删除标识(D:已删除;N:未删除)
*/
@Column(name = "deleted_flag")
private String deletedFlag;
}
...@@ -62,4 +62,10 @@ public class RecordingTagGroup { ...@@ -62,4 +62,10 @@ public class RecordingTagGroup {
*/ */
private String description; private String description;
/**
* 配置编码
*/
@Column(name = "config_code")
private String configCode;
} }
\ No newline at end of file \ No newline at end of file
...@@ -123,4 +123,10 @@ public class RecordingTagRuleMapping { ...@@ -123,4 +123,10 @@ public class RecordingTagRuleMapping {
*/ */
@Transient @Transient
private BigDecimal sumScore; private BigDecimal sumScore;
/**
* 配置编码
*/
@Transient
private String configCode;
} }
\ No newline at end of file \ No newline at end of file
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<dependency> <dependency>
<groupId>cn.com.glsx</groupId> <groupId>cn.com.glsx</groupId>
<artifactId>rpc-dj-mindworkplate-api</artifactId> <artifactId>rpc-dj-mindworkplate-api</artifactId>
<version>5.7.1-SNAPSHOT</version> <version>5.7.4-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.com.glsx.dj</groupId> <groupId>cn.com.glsx.dj</groupId>
......
package cn.com.glsx.dj.mindworkplate.config;
import java.util.List;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* 模型类型配置
*/
@Data
@Configuration
@ConfigurationProperties("model.type")
public class ModelTypeConfig {
/**
* 走新逻辑的模型类型集合
*/
private List<String> newLogicModelTypes;
}
package cn.com.glsx.dj.mindworkplate.job; package cn.com.glsx.dj.mindworkplate.job;
import cn.com.glsx.dj.mindworkplate.config.ModelTypeConfig;
import cn.com.glsx.dj.mindworkplate.constant.RedisKeyConstants; import cn.com.glsx.dj.mindworkplate.constant.RedisKeyConstants;
import cn.com.glsx.dj.mindworkplate.enums.BadgeManufacturerEnum; import cn.com.glsx.dj.mindworkplate.enums.BadgeManufacturerEnum;
import cn.com.glsx.dj.mindworkplate.mapper.BadgeRecordingsMapper;
import cn.com.glsx.dj.mindworkplate.model.BadgeRecordings; import cn.com.glsx.dj.mindworkplate.model.BadgeRecordings;
import cn.com.glsx.dj.mindworkplate.model.ConversationBatch; import cn.com.glsx.dj.mindworkplate.model.ConversationBatch;
import cn.com.glsx.dj.mindworkplate.model.EmployeeBadge; import cn.com.glsx.dj.mindworkplate.model.EmployeeBadge;
...@@ -30,6 +32,12 @@ public class CheckResultJob implements SimpleJob { ...@@ -30,6 +32,12 @@ public class CheckResultJob implements SimpleJob {
@Autowired @Autowired
private ConversationDateService conversationDateService; private ConversationDateService conversationDateService;
@Autowired
private BadgeRecordingsMapper badgeRecordingsMapper;
@Autowired
private ModelTypeConfig modelTypeConfig;
@Override @Override
public void execute(ShardingContext shardingContext) { public void execute(ShardingContext shardingContext) {
log.info("----------------获取质检结果任务开始-----------------"); log.info("----------------获取质检结果任务开始-----------------");
...@@ -37,7 +45,13 @@ public class CheckResultJob implements SimpleJob { ...@@ -37,7 +45,13 @@ public class CheckResultJob implements SimpleJob {
if(CollectionUtils.isNotEmpty(conversationBatchList)){ if(CollectionUtils.isNotEmpty(conversationBatchList)){
for (ConversationBatch conversationBatch : conversationBatchList) { for (ConversationBatch conversationBatch : conversationBatchList) {
try { try {
if(conversationBatch.getCheckHistoryFlag()==null) { // 获取对应的录音记录,以获取modelType
BadgeRecordings badgeRecordings = badgeRecordingsMapper.selectByPrimaryKey(conversationBatch.getRecordId());
// 配置的模型类型走新规则
if (badgeRecordings != null && modelTypeConfig.getNewLogicModelTypes() != null && modelTypeConfig.getNewLogicModelTypes().contains(badgeRecordings.getModelType())) {
conversationDateService.getCheckResult(conversationBatch);
} else if(conversationBatch.getCheckHistoryFlag()==null) {
// 其他品牌的质检走旧的模版匹配规则
conversationDateService.getCheckResultOld(conversationBatch); conversationDateService.getCheckResultOld(conversationBatch);
}else{ }else{
conversationDateService.getCheckResult(conversationBatch); conversationDateService.getCheckResult(conversationBatch);
......
package cn.com.glsx.dj.mindworkplate.mapper;
import cn.com.glsx.dj.mindworkplate.model.RecordingTagConfigModelType;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.oreframework.datasource.mybatis.mapper.OreMapper;
@Mapper
public interface RecordingTagConfigModelTypeMapper extends OreMapper<RecordingTagConfigModelType> {
/**
* 根据模型类型查询配置编码
*/
List<String> findConfigCodesByModelType(@Param("modelType") String modelType);
/**
* 根据配置编码查询模型类型
*/
List<String> findModelTypesByConfigCode(@Param("configCode") String configCode);
/**
* 检查配置编码和模型类型是否存在
*/
int countByConfigCodeAndModelType(@Param("configCode") String configCode, @Param("modelType") String modelType);
}
...@@ -10,4 +10,6 @@ import org.oreframework.datasource.mybatis.mapper.OreMapper; ...@@ -10,4 +10,6 @@ import org.oreframework.datasource.mybatis.mapper.OreMapper;
public interface RecordingTagGroupMapper extends OreMapper<RecordingTagGroup> { public interface RecordingTagGroupMapper extends OreMapper<RecordingTagGroup> {
List<RecordingTagGroup> findAll(@Param("checkType") Integer checkType); List<RecordingTagGroup> findAll(@Param("checkType") Integer checkType);
List<RecordingTagGroup> findAllByConfigCode(@Param("configCode") String configCode);
} }
\ No newline at end of file \ No newline at end of file
...@@ -10,4 +10,6 @@ import org.oreframework.datasource.mybatis.mapper.OreMapper; ...@@ -10,4 +10,6 @@ import org.oreframework.datasource.mybatis.mapper.OreMapper;
public interface RecordingTagRuleMappingMapper extends OreMapper<RecordingTagRuleMapping> { public interface RecordingTagRuleMappingMapper extends OreMapper<RecordingTagRuleMapping> {
List<RecordingTagRuleMapping> findAll(@Param("checkType") Integer checkType); List<RecordingTagRuleMapping> findAll(@Param("checkType") Integer checkType);
List<RecordingTagRuleMapping> findAllByConfigCode(@Param("configCode") String configCode);
} }
\ No newline at end of file \ No newline at end of file
...@@ -20,6 +20,9 @@ public class ViolationExportModel implements Serializable { ...@@ -20,6 +20,9 @@ public class ViolationExportModel implements Serializable {
@ExcelProperty({"序号"}) @ExcelProperty({"序号"})
private Integer index; private Integer index;
@ExcelProperty({"品牌"})
private String carBrandName;
@ExcelProperty({"员工"}) @ExcelProperty({"员工"})
private String employeeName; private String employeeName;
......
...@@ -615,7 +615,7 @@ public class ConversationDateService { ...@@ -615,7 +615,7 @@ public class ConversationDateService {
ModelResponse modelResponse = JSONObject.parseObject(jsonResult.toJSONString(), ModelResponse modelResponse = JSONObject.parseObject(jsonResult.toJSONString(),
ModelResponse.class); ModelResponse.class);
List<RecordingTagRuleMapping> process = tagService.process(modelResponse, List<RecordingTagRuleMapping> process = tagService.process(modelResponse,
conversationBatch.getId(), conversationBatch.getCheckType()); conversationBatch.getId(), conversationBatch.getCheckType(), latest.getModelType());
conversationBatch.setEstimatedResult("未知"); conversationBatch.setEstimatedResult("未知");
recordingCheckResultService.buildInsertCheckList(process, modelResponse, conversationBatch); recordingCheckResultService.buildInsertCheckList(process, modelResponse, conversationBatch);
conversationBatch.setUpdatedBy("system"); conversationBatch.setUpdatedBy("system");
......
...@@ -194,12 +194,8 @@ public class EmployeeBadgeRecordingService { ...@@ -194,12 +194,8 @@ public class EmployeeBadgeRecordingService {
conversationBatchMapper.insertUseGeneratedKeys(conversationBatch); conversationBatchMapper.insertUseGeneratedKeys(conversationBatch);
if (badgeRecordings.getCheResultFlag() == 0 && badgeRecordings.getCheckType() == 1) { if (badgeRecordings.getCheResultFlag() == 0 && badgeRecordings.getCheckType() == 1) {
// 需要质检 // 需要质检
String carModel = badgeRecordings.getCarModel(); String carBrandId = Objects.isNull(badgeRecordings.getCarBrandId()) ? null : badgeRecordings.getCarBrandId().toString();
if(carModel!=null&& carModel.contains("问界")) { recordingBatchModelCallService.insertWaitGet(conversationBatch.getId(), carBrandId);
recordingBatchModelCallService.insertWaitGet(conversationBatch.getId());
}else {
recordingBatchModelCallService.insertWaitGetWJ(conversationBatch.getId());
}
} }
} }
} }
......
...@@ -205,6 +205,8 @@ public class ReceptionCustomerService { ...@@ -205,6 +205,8 @@ public class ReceptionCustomerService {
boolean checkFlag = true; boolean checkFlag = true;
MerchantDTO merchantBrand = findMerchantBrand(merchantDTO); MerchantDTO merchantBrand = findMerchantBrand(merchantDTO);
badgeRecordings.setCarModel(receptionCustomerInfoDTO.getCarModel()); badgeRecordings.setCarModel(receptionCustomerInfoDTO.getCarModel());
badgeRecordings.setCarBrandId(receptionCustomerInfoDTO.getCarBrandId());
badgeRecordings.setOneCarBrandId(receptionCustomerInfoDTO.getOneCarBrandId());
Integer recordId = employeeBadgeRecordingService.addRecordingForMatePad( Integer recordId = employeeBadgeRecordingService.addRecordingForMatePad(
badgeRecordings, badgeRecordings,
recordUrlList, receptionCustomerInfoDTO.getChannelType(), checkFlag,Arrays.asList(receptionCustomerInfo.getOneCarBrandId())); recordUrlList, receptionCustomerInfoDTO.getChannelType(), checkFlag,Arrays.asList(receptionCustomerInfo.getOneCarBrandId()));
...@@ -1388,6 +1390,7 @@ public class ReceptionCustomerService { ...@@ -1388,6 +1390,7 @@ public class ReceptionCustomerService {
violationExportModel.setIndex( violationExportModel.setIndex(
violationReceptionByConditionPage.getResult().indexOf( violationReceptionByConditionPage.getResult().indexOf(
receptionViolationInfoDTO) + 1); receptionViolationInfoDTO) + 1);
violationExportModel.setCarBrandName(receptionViolationInfoDTO.getCarBrandName());
violationExportModel.setEmployeeName(receptionViolationInfoDTO.getEmployeeName() violationExportModel.setEmployeeName(receptionViolationInfoDTO.getEmployeeName()
+ receptionViolationInfoDTO.getEmployeePhone()); + receptionViolationInfoDTO.getEmployeePhone());
violationExportModel.setCustomerName(receptionViolationInfoDTO.getCustomerName() violationExportModel.setCustomerName(receptionViolationInfoDTO.getCustomerName()
...@@ -1414,10 +1417,13 @@ public class ReceptionCustomerService { ...@@ -1414,10 +1417,13 @@ public class ReceptionCustomerService {
: receptionViolationInfoDTO.getViolationStatus().intValue() == 2 : receptionViolationInfoDTO.getViolationStatus().intValue() == 2
? "确认违规" : "未违规"); ? "确认违规" : "未违规");
} }
// 20260422 未违规不展示
if (receptionViolationInfoDTO.getViolationStatus().intValue() != 0) {
String resultJson = receptionViolationInfoDTO.getResultJson(); String resultJson = receptionViolationInfoDTO.getResultJson();
if (StringUtils.isNotEmpty(resultJson)) { if (StringUtils.isNotEmpty(resultJson)) {
violationExportModel.setJsonObject(processRules(resultJson)); violationExportModel.setJsonObject(processRules(resultJson));
} }
}
violationExportModels.add(violationExportModel); violationExportModels.add(violationExportModel);
} }
} }
......
package cn.com.glsx.dj.mindworkplate.service; package cn.com.glsx.dj.mindworkplate.service;
import cn.com.glsx.dj.mindworkplate.config.ModelTypeConfig;
import cn.com.glsx.dj.mindworkplate.dto.ConversationDetailDTO; import cn.com.glsx.dj.mindworkplate.dto.ConversationDetailDTO;
import cn.com.glsx.dj.mindworkplate.dto.ConversationDetailRequestDTO; import cn.com.glsx.dj.mindworkplate.dto.ConversationDetailRequestDTO;
import cn.com.glsx.dj.mindworkplate.mapper.BadgeRecordingsMapper;
import cn.com.glsx.dj.mindworkplate.mapper.RecordingCheckResultMapper; import cn.com.glsx.dj.mindworkplate.mapper.RecordingCheckResultMapper;
import cn.com.glsx.dj.mindworkplate.model.BadgeRecordings;
import cn.com.glsx.dj.mindworkplate.model.ConversationBatch; import cn.com.glsx.dj.mindworkplate.model.ConversationBatch;
import cn.com.glsx.dj.mindworkplate.model.RecordingCheckResult; import cn.com.glsx.dj.mindworkplate.model.RecordingCheckResult;
import cn.com.glsx.dj.mindworkplate.model.RecordingTagRuleMapping; import cn.com.glsx.dj.mindworkplate.model.RecordingTagRuleMapping;
...@@ -49,6 +52,12 @@ public class RecordingCheckResultService { ...@@ -49,6 +52,12 @@ public class RecordingCheckResultService {
@Autowired @Autowired
private SopTaskDetailInfoService sopTaskDetailInfoService; private SopTaskDetailInfoService sopTaskDetailInfoService;
@Autowired
private BadgeRecordingsMapper badgeRecordingsMapper;
@Autowired
private ModelTypeConfig modelTypeConfig;
/** /**
* 写入质检结果 * 写入质检结果
* *
...@@ -58,28 +67,22 @@ public class RecordingCheckResultService { ...@@ -58,28 +67,22 @@ public class RecordingCheckResultService {
*/ */
public void buildInsertCheckList(List<RecordingTagRuleMapping> process, ModelResponse modelResponse, ConversationBatch conversationBatch) { public void buildInsertCheckList(List<RecordingTagRuleMapping> process, ModelResponse modelResponse, ConversationBatch conversationBatch) {
if(CollectionUtils.isNotEmpty(process)){ if(CollectionUtils.isNotEmpty(process)){
List<Label> labels = modelResponse.getLabels(); List<RecordingCheckResult> recordingCheckResults = new ArrayList<>();
BigDecimal reduce = process.stream()
.map(RecordingTagRuleMapping::getScore) // 获取录音记录,以获取modelType
.filter(score -> score != null) // 过滤 null 值 BadgeRecordings badgeRecordings = badgeRecordingsMapper.selectByPrimaryKey(conversationBatch.getRecordId());
.reduce(BigDecimal.ZERO, BigDecimal::add); String modelType = badgeRecordings != null ? badgeRecordings.getModelType() : null;
conversationBatch.setScore(reduce);
List<RecordingCheckResult> recordingCheckResults = process.stream().map(index -> { // 对于配置的模型类型,使用大模型直接返回的分数
List<Label> collect = labels.stream() if (modelTypeConfig.getNewLogicModelTypes() != null && modelTypeConfig.getNewLogicModelTypes().contains(modelType)) {
.filter(label -> label.getLabel().equals(index.getTagGroupName())).collect( // 处理大模型返回的分数
Collectors.toList()); processModelScores(modelResponse.getAllLabels(), process, recordingCheckResults, conversationBatch);
RecordingCheckResult build = RecordingCheckResult.builder() } else {
.tagId(index.getTagId()).score(index.getScore()) // 其他品牌,使用业务侧判断的规则拿到的分数
.sumScore(index.getSumScore()).createdDate(new Date()).tagGroupName(index.getTagGroupName()) processBusinessScores(process, modelResponse.getLabels(), recordingCheckResults, conversationBatch);
.batchId(conversationBatch.getId()).deletedFlag("N").build();
if (CollectionUtils.isNotEmpty(collect)) {
Label label = collect.get(0);
String jsonString = JSONObject.toJSONString(label.getSentence());
String jsonString2 = JSONObject.toJSONString(label.getRetouching());
build.setHitText(jsonString);
} }
return build;
}).collect(Collectors.toList()); // 后续处理逻辑
LabelRequest labelRequest = new LabelRequest(); LabelRequest labelRequest = new LabelRequest();
labelRequest.setTagList(process.stream().map(RecordingTagRuleMapping::getTagGroupName).collect(Collectors.toList())); labelRequest.setTagList(process.stream().map(RecordingTagRuleMapping::getTagGroupName).collect(Collectors.toList()));
labelRequest.setTagResponseCount(1); labelRequest.setTagResponseCount(1);
...@@ -100,9 +103,69 @@ public class RecordingCheckResultService { ...@@ -100,9 +103,69 @@ public class RecordingCheckResultService {
recordingCheckResult.setScriptRec("[]"); recordingCheckResult.setScriptRec("[]");
} }
} }
if (CollectionUtils.isNotEmpty(recordingCheckResults)) {
recordingCheckResultMapper.insertList(recordingCheckResults); recordingCheckResultMapper.insertList(recordingCheckResults);
} }
} }
}
/**
* 处理大模型返回的分数
*/
private void processModelScores(List<Label> labels, List<RecordingTagRuleMapping> process, List<RecordingCheckResult> recordingCheckResults, ConversationBatch conversationBatch) {
BigDecimal totalScore = BigDecimal.ZERO;
for (Label label : labels) {
// 查找对应的规则
List<RecordingTagRuleMapping> matchedRules = process.stream()
.filter(rule -> rule.getTagGroupName() != null && rule.getTagGroupName().equals(label.getLabel()))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(matchedRules)) {
for (RecordingTagRuleMapping rule : matchedRules) {
// 使用大模型返回的分数
BigDecimal score = new BigDecimal(label.getAssessment().getScores());
BigDecimal sumScore = new BigDecimal(label.getAssessment().getSumScores());
totalScore = totalScore.add(score);
RecordingCheckResult build = RecordingCheckResult.builder()
.tagId(rule.getTagId()).score(score)
.sumScore(sumScore).createdDate(new Date()).tagGroupName(label.getLabel())
.batchId(conversationBatch.getId()).deletedFlag("N").build();
build.setHitText(JSONObject.toJSONString(label.getSentence()));
recordingCheckResults.add(build);
}
}
}
conversationBatch.setScore(totalScore);
}
/**
* 处理业务侧判断的规则拿到的分数
*/
private void processBusinessScores(List<RecordingTagRuleMapping> process, List<Label> labels, List<RecordingCheckResult> recordingCheckResults, ConversationBatch conversationBatch) {
BigDecimal totalScore = process.stream()
.map(RecordingTagRuleMapping::getScore)
.filter(score -> score != null) // 过滤 null 值
.reduce(BigDecimal.ZERO, BigDecimal::add);
for (RecordingTagRuleMapping index : process) {
List<Label> collect = labels.stream()
.filter(label -> label.getLabel().equals(index.getTagGroupName())).collect(
Collectors.toList());
RecordingCheckResult build = RecordingCheckResult.builder()
.tagId(index.getTagId()).score(index.getScore())
.sumScore(index.getSumScore()).createdDate(new Date()).tagGroupName(index.getTagGroupName())
.batchId(conversationBatch.getId()).deletedFlag("N").build();
if (CollectionUtils.isNotEmpty(collect)) {
Label label = collect.get(0);
String jsonString = JSONObject.toJSONString(label.getSentence());
build.setHitText(jsonString);
}
recordingCheckResults.add(build);
}
conversationBatch.setScore(totalScore);
}
/** /**
* 通过批次号查询质检结果 * 通过批次号查询质检结果
......
package cn.com.glsx.dj.mindworkplate.service.recordingtag;
import cn.com.glsx.dj.mindworkplate.mapper.RecordingTagConfigModelTypeMapper;
import cn.com.glsx.dj.mindworkplate.model.RecordingTagConfigModelType;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 录音标签配置模型类型关联服务
*/
@Service
public class RecordingTagConfigModelTypeService {
@Autowired
private RecordingTagConfigModelTypeMapper recordingTagConfigModelTypeMapper;
/**
* 根据模型类型查询配置编码
*/
public List<String> findConfigCodesByModelType(String modelType) {
return recordingTagConfigModelTypeMapper.findConfigCodesByModelType(modelType);
}
/**
* 检查配置编码和模型类型是否存在
*/
public boolean existsByConfigCodeAndModelType(String configCode, String modelType) {
return recordingTagConfigModelTypeMapper.countByConfigCodeAndModelType(configCode, modelType) > 0;
}
/**
* 保存配置编码和模型类型的关联关系
*/
public void save(String configCode, String modelType) {
if (!existsByConfigCodeAndModelType(configCode, modelType)) {
RecordingTagConfigModelType recordingTagConfigModelType = new RecordingTagConfigModelType();
recordingTagConfigModelType.setConfigCode(configCode);
recordingTagConfigModelType.setModelType(modelType);
recordingTagConfigModelType.setCreatedBy("system");
recordingTagConfigModelType.setCreatedDate(new Date());
recordingTagConfigModelType.setUpdatedBy("system");
recordingTagConfigModelType.setUpdatedDate(new Date());
recordingTagConfigModelType.setDeletedFlag("N");
recordingTagConfigModelTypeMapper.insert(recordingTagConfigModelType);
}
}
/**
* 批量保存配置编码和模型类型的关联关系
*/
public void saveBatch(String configCode, List<String> modelTypes) {
for (String modelType : modelTypes) {
save(configCode, modelType);
}
}
/**
* 删除配置编码和模型类型的关联关系
*/
public void delete(String configCode, String modelType) {
RecordingTagConfigModelType recordingTagConfigModelType = new RecordingTagConfigModelType();
recordingTagConfigModelType.setConfigCode(configCode);
recordingTagConfigModelType.setModelType(modelType);
recordingTagConfigModelType.setDeletedFlag("Y");
recordingTagConfigModelType.setUpdatedBy("system");
recordingTagConfigModelType.setUpdatedDate(new Date());
recordingTagConfigModelTypeMapper.updateByExampleSelective(recordingTagConfigModelType, null);
}
}
...@@ -3,6 +3,8 @@ package cn.com.glsx.dj.mindworkplate.service.recordingtag; ...@@ -3,6 +3,8 @@ package cn.com.glsx.dj.mindworkplate.service.recordingtag;
import cn.com.glsx.dj.mindworkplate.mapper.RecordingTagGroupMapper; import cn.com.glsx.dj.mindworkplate.mapper.RecordingTagGroupMapper;
import cn.com.glsx.dj.mindworkplate.model.RecordingTagGroup; import cn.com.glsx.dj.mindworkplate.model.RecordingTagGroup;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -19,7 +21,19 @@ public class RecordingTagGroupService { ...@@ -19,7 +21,19 @@ public class RecordingTagGroupService {
@Autowired @Autowired
private RecordingTagGroupMapper recordingTagGroupMapper; private RecordingTagGroupMapper recordingTagGroupMapper;
@Autowired
private RecordingTagConfigModelTypeService recordingTagConfigModelTypeService;
public List<RecordingTagGroup> findAll(Integer checkType) { public List<RecordingTagGroup> findAll(Integer checkType) {
return recordingTagGroupMapper.findAll(checkType); return recordingTagGroupMapper.findAll(checkType);
} }
public List<RecordingTagGroup> findAllByModelType(Integer checkType, String modelType) {
List<String> configCodes = recordingTagConfigModelTypeService.findConfigCodesByModelType(modelType);
if (CollectionUtils.isNotEmpty(configCodes)) {
String configCode = configCodes.get(0);
return recordingTagGroupMapper.findAllByConfigCode(configCode);
}
return recordingTagGroupMapper.findAll(checkType);
}
} }
...@@ -3,6 +3,8 @@ package cn.com.glsx.dj.mindworkplate.service.recordingtag; ...@@ -3,6 +3,8 @@ package cn.com.glsx.dj.mindworkplate.service.recordingtag;
import cn.com.glsx.dj.mindworkplate.mapper.RecordingTagRuleMappingMapper; import cn.com.glsx.dj.mindworkplate.mapper.RecordingTagRuleMappingMapper;
import cn.com.glsx.dj.mindworkplate.model.RecordingTagRuleMapping; import cn.com.glsx.dj.mindworkplate.model.RecordingTagRuleMapping;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -20,7 +22,20 @@ public class RecordingTagRuleMappingService { ...@@ -20,7 +22,20 @@ public class RecordingTagRuleMappingService {
@Autowired @Autowired
private RecordingTagRuleMappingMapper recordingTagRuleMappingMapper; private RecordingTagRuleMappingMapper recordingTagRuleMappingMapper;
@Autowired
private RecordingTagConfigModelTypeService recordingTagConfigModelTypeService;
public List<RecordingTagRuleMapping> findAll(Integer checkType) { public List<RecordingTagRuleMapping> findAll(Integer checkType) {
return recordingTagRuleMappingMapper.findAll(checkType); return recordingTagRuleMappingMapper.findAll(checkType);
} }
public List<RecordingTagRuleMapping> findAllByModelType(Integer checkType, String modelType) {
List<String> configCodes = recordingTagConfigModelTypeService.findConfigCodesByModelType(modelType);
if (CollectionUtils.isNotEmpty(configCodes)) {
String configCode = configCodes.get(0);
List<RecordingTagRuleMapping> allByCheckType = recordingTagRuleMappingMapper.findAllByConfigCode(configCode);
return allByCheckType;
}
return recordingTagRuleMappingMapper.findAll(checkType);
}
} }
package cn.com.glsx.dj.mindworkplate.service.recordingtag; package cn.com.glsx.dj.mindworkplate.service.recordingtag;
import cn.com.glsx.dj.mindworkplate.config.ModelTypeConfig;
import cn.com.glsx.dj.mindworkplate.model.ConversationBatch; import cn.com.glsx.dj.mindworkplate.model.ConversationBatch;
import cn.com.glsx.dj.mindworkplate.model.RecordingTagGroup; import cn.com.glsx.dj.mindworkplate.model.RecordingTagGroup;
import cn.com.glsx.dj.mindworkplate.model.RecordingTagRelation; import cn.com.glsx.dj.mindworkplate.model.RecordingTagRelation;
import cn.com.glsx.dj.mindworkplate.model.RecordingTagRuleMapping; import cn.com.glsx.dj.mindworkplate.model.RecordingTagRuleMapping;
import cn.com.glsx.dj.mindworkplate.service.ConversationBatchService; import cn.com.glsx.dj.mindworkplate.service.ConversationBatchService;
import cn.com.glsx.dj.mindworkplate.service.recordingtag.model.Label;
import cn.com.glsx.dj.mindworkplate.service.recordingtag.model.Label.Assessment;
import cn.com.glsx.dj.mindworkplate.service.recordingtag.model.ModelResponse; import cn.com.glsx.dj.mindworkplate.service.recordingtag.model.ModelResponse;
import cn.com.glsx.dj.mindworkplate.service.recordingtag.strategy.TagProcessingPipeline; import cn.com.glsx.dj.mindworkplate.service.recordingtag.strategy.TagProcessingPipeline;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.function.Function; import java.util.function.Function;
...@@ -35,12 +39,15 @@ public class TagService { ...@@ -35,12 +39,15 @@ public class TagService {
@Autowired @Autowired
private ConversationBatchService conversationBatchService; private ConversationBatchService conversationBatchService;
@Autowired
private ModelTypeConfig modelTypeConfig;
/** /**
* 计算录音标签,并且入库 * 计算录音标签,并且入库
* *
*/ */
public List<RecordingTagRuleMapping> process(ModelResponse response,Integer batchId, public List<RecordingTagRuleMapping> process(ModelResponse response, Integer batchId,
Integer checkType) { Integer checkType, String modelType) {
ConversationBatch recordindIdByBatchId = conversationBatchService.findRecordindIdByBatchId( ConversationBatch recordindIdByBatchId = conversationBatchService.findRecordindIdByBatchId(
batchId); batchId);
if (recordindIdByBatchId == null) { if (recordindIdByBatchId == null) {
...@@ -48,11 +55,65 @@ public class TagService { ...@@ -48,11 +55,65 @@ public class TagService {
return null; return null;
} }
Integer recordingId = recordindIdByBatchId.getRecordId(); Integer recordingId = recordindIdByBatchId.getRecordId();
List<RecordingTagRuleMapping> recordingTagRuleMappings = recordingTagRuleMappingService.findAll(checkType); List<RecordingTagRuleMapping> recordingTagRuleMappings = recordingTagRuleMappingService.findAllByModelType(checkType, modelType);
List<RecordingTagGroup> groupList = recordingTagGroupService.findAll(checkType); List<RecordingTagGroup> groupList = recordingTagGroupService.findAllByModelType(checkType, modelType);
List<Integer> tagIds = tagProcessingPipeline.process(recordindIdByBatchId, response, List<Integer> tagIds;
// 对于配置的模型类型,直接使用大模型返回的标签
if (modelTypeConfig.getNewLogicModelTypes() != null && modelTypeConfig.getNewLogicModelTypes().contains(modelType)) {
tagIds = getTagIdsFromModel(response, recordingTagRuleMappings);
} else {
// 其他品牌,使用业务侧判断的规则拿到的标签
tagIds = tagProcessingPipeline.process(recordindIdByBatchId, response,
recordingTagRuleMappings, groupList); recordingTagRuleMappings, groupList);
}
if (CollectionUtils.isNotEmpty(tagIds)) { if (CollectionUtils.isNotEmpty(tagIds)) {
// 保存标签关系
saveTagRelations(recordingId, tagIds);
// 处理命中的标签规则
List<RecordingTagRuleMapping> result = processHitRules(recordingTagRuleMappings, tagIds);
// 对于配置的模型类型,使用大模型直接返回的分数
if (modelTypeConfig.getNewLogicModelTypes() != null && modelTypeConfig.getNewLogicModelTypes().contains(modelType)) {
applyModelScores(response, result);
}
return result;
}
return null;
}
/**
* 从大模型返回的结果中获取标签ID
*/
private List<Integer> getTagIdsFromModel(ModelResponse response, List<RecordingTagRuleMapping> recordingTagRuleMappings) {
List<Integer> tagIds = new ArrayList<>();
List<Label> labels = response.getAllLabels();
for (Label label : labels) {
Assessment assessment = label.getAssessment();
if (assessment == null) {
continue;
}
if (assessment.getLevel() == null) {
continue;
}
// 查找对应的规则
List<RecordingTagRuleMapping> matchedRules = recordingTagRuleMappings.stream()
.filter(rule -> rule.getTagGroupName() != null && rule.getTagGroupName().equals(label.getLabel()) && rule.getTagName().equals(assessment.getLevel()))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(matchedRules)) {
for (RecordingTagRuleMapping rule : matchedRules) {
tagIds.add(rule.getTagId());
}
}
}
return tagIds;
}
/**
* 保存标签关系
*/
private void saveTagRelations(Integer recordingId, List<Integer> tagIds) {
List<RecordingTagRelation> collect = tagIds.stream().map(index -> { List<RecordingTagRelation> collect = tagIds.stream().map(index -> {
RecordingTagRelation recordingTagRelation = new RecordingTagRelation(); RecordingTagRelation recordingTagRelation = new RecordingTagRelation();
recordingTagRelation.setRecordingId(recordingId); recordingTagRelation.setRecordingId(recordingId);
...@@ -63,6 +124,12 @@ public class TagService { ...@@ -63,6 +124,12 @@ public class TagService {
return recordingTagRelation; return recordingTagRelation;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
recordingTagRelationService.saveList(collect); recordingTagRelationService.saveList(collect);
}
/**
* 处理命中的标签规则
*/
private List<RecordingTagRuleMapping> processHitRules(List<RecordingTagRuleMapping> recordingTagRuleMappings, List<Integer> tagIds) {
return recordingTagRuleMappings.stream() return recordingTagRuleMappings.stream()
.filter(index -> tagIds.contains(index.getTagId())) .filter(index -> tagIds.contains(index.getTagId()))
.collect(Collectors.toMap( .collect(Collectors.toMap(
...@@ -74,7 +141,23 @@ public class TagService { ...@@ -74,7 +141,23 @@ public class TagService {
.stream() .stream()
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
return null;
/**
* 应用大模型返回的分数
*/
private void applyModelScores(ModelResponse response, List<RecordingTagRuleMapping> result) {
List<Label> labels = response.getAllLabels();
for (Label label : labels) {
for (RecordingTagRuleMapping rule : result) {
if (rule.getTagGroupName() != null && rule.getTagGroupName().equals(label.getLabel())) {
// 使用大模型返回的分数
if (label.getAssessment() != null) {
rule.setScore(new java.math.BigDecimal(label.getAssessment().getScores()));
rule.setSumScore(new java.math.BigDecimal(label.getAssessment().getSumScores()));
}
}
}
}
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -5,13 +5,26 @@ import lombok.Data; ...@@ -5,13 +5,26 @@ import lombok.Data;
@Data @Data
public class Label { public class Label {
private String ruler;
private String label; private String label;
private List<String> shots; private Assessment assessment;
private List<String> sentence; private List<String> sentence;
private List<String> retouching; private List<String> retouching;
private String reason; private String reason;
private List<String> shots;
@Data
public static class Assessment {
private String level;
private String scores;
private String sumScores;
}
public int getShotCount() { public int getShotCount() {
return shots != null ? shots.size() : 0; // 优先使用shots字段(旧格式),如果没有则使用sentence字段(新格式)
if (shots != null) {
return shots.size();
}
return sentence != null ? sentence.size() : 0;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
public class ModelResponse { public class ModelResponse {
private List<Label> labels; private List<Label> labels;
private Result result;
public List<Label> getLabels() { public List<Label> getLabels() {
return labels; return labels;
...@@ -12,4 +13,31 @@ public class ModelResponse { ...@@ -12,4 +13,31 @@ public class ModelResponse {
public void setLabels(List<Label> labels) { public void setLabels(List<Label> labels) {
this.labels = labels; this.labels = labels;
} }
public Result getResult() {
return result;
}
public void setResult(Result result) {
this.result = result;
}
public List<Label> getAllLabels() {
if (result != null && result.getLabels() != null) {
return result.getLabels();
}
return labels;
}
public static class Result {
private List<Label> labels;
public List<Label> getLabels() {
return labels;
}
public void setLabels(List<Label> labels) {
this.labels = labels;
}
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -10,11 +10,11 @@ import cn.com.glsx.dj.mindworkplate.service.bigmodelapi.BigModelExecutorFactory; ...@@ -10,11 +10,11 @@ import cn.com.glsx.dj.mindworkplate.service.bigmodelapi.BigModelExecutorFactory;
import cn.com.glsx.dj.mindworkplate.service.recordmodelcall.enums.ModelCallTaskEnum; import cn.com.glsx.dj.mindworkplate.service.recordmodelcall.enums.ModelCallTaskEnum;
import cn.com.glsx.dj.mindworkplate.service.recordmodelcall.enums.ModelCallTypeEnum; import cn.com.glsx.dj.mindworkplate.service.recordmodelcall.enums.ModelCallTypeEnum;
import cn.com.glsx.dj.mindworkplate.service.recordmodelcall.strtype.RecordModelCallExecutionStrategy; import cn.com.glsx.dj.mindworkplate.service.recordmodelcall.strtype.RecordModelCallExecutionStrategy;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.util.ArrayList;
import java.util.Arrays; import java.util.*;
import java.util.Date;
import java.util.List;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -43,7 +43,9 @@ public class RecordingBatchModelCallService { ...@@ -43,7 +43,9 @@ public class RecordingBatchModelCallService {
* 新增录音任务 * 新增录音任务
* *
* @param recordingBatchId 录音批次id * @param recordingBatchId 录音批次id
* @deprecated use #insertWaitGet(Integer recordingBatchId, String carModel)
*/ */
@Deprecated
public void insertWaitGet(Integer recordingBatchId){ public void insertWaitGet(Integer recordingBatchId){
try { try {
List<RecordingBatchModelCall> recordingBatchModelCallList = new ArrayList<>(); List<RecordingBatchModelCall> recordingBatchModelCallList = new ArrayList<>();
...@@ -68,25 +70,55 @@ public class RecordingBatchModelCallService { ...@@ -68,25 +70,55 @@ public class RecordingBatchModelCallService {
/** /**
* 新增录音任务 * 新增录音任务
* 指定品牌取不同的模型类型参数
* *
* @param recordingBatchId 录音批次id * @param recordingBatchId 录音批次id
*/ */
public void insertWaitGetWJ(Integer recordingBatchId){ public void insertWaitGet(Integer recordingBatchId, String carBrandId){
try {
List<RecordingBatchModelCall> recordingBatchModelCallList = new ArrayList<>(); List<RecordingBatchModelCall> recordingBatchModelCallList = new ArrayList<>();
// 通用配置
String property = environment.getProperty("recording.model.call.type.nwj"); String property = environment.getProperty("recording.model.call.type.nwj");
if (StringUtils.isNotEmpty(property)) {
String[] split = property.split(","); // 车型关联配置
for (String s : split) { String carBrandPropertyStr = environment.getProperty("recording.model.call.type.map");
if (StringUtils.isBlank(carBrandPropertyStr)) {
log.error("录音大模型任务创建异常,未配置车型对应关系");
return;
}
try {
JSONObject carBrandPropertyObj = JSON.parseObject(carBrandPropertyStr);
if (Objects.isNull(carBrandPropertyObj)) {
log.error("录音大模型任务创建异常,配置解析异常");
return;
}
if (StringUtils.isNotBlank(carBrandId)) {
property = carBrandPropertyObj.keySet().stream()
.filter(p -> StringUtils.equals(p, carBrandId))
.findFirst()
.map(carBrandPropertyObj::getString)
.orElse(property); // 匹配不到匹配的则使用通用配置
}
log.info("录音大模型任务配置准备,carBrandId:{}, property:{}", carBrandId, property);
if (StringUtils.isEmpty(property)) {
log.error("录音大模型任务创建异常,配置为空, carBrandId:{}, property:{}", carBrandId, property);
return;
}
for (String s : property.split(",")) {
int i = Integer.parseInt(s); int i = Integer.parseInt(s);
RecordingBatchModelCall build = RecordingBatchModelCall.builder() RecordingBatchModelCall build = RecordingBatchModelCall.builder()
.recordingBatchId(recordingBatchId).createTime(new Date()).businessType(i).requestType( .recordingBatchId(recordingBatchId)
(byte) 2).resultStatus( .createTime(new Date())
ModelCallTaskEnum.READY.getValue()).build(); .businessType(i)
.requestType((byte) 2)
.resultStatus(ModelCallTaskEnum.READY.getValue())
.build();
recordingBatchModelCallList.add(build); recordingBatchModelCallList.add(build);
} }
recordingBatchModelCallMapper.insertList(recordingBatchModelCallList); int insertCnt = recordingBatchModelCallMapper.insertList(recordingBatchModelCallList);
} log.info("录音大模型任务创建成功,数量:{}, 成功:{}", recordingBatchModelCallList.size(), insertCnt);
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
log.info("录音大模型任务创建异常{}",e.getMessage()); log.info("录音大模型任务创建异常{}",e.getMessage());
...@@ -206,6 +238,7 @@ public class RecordingBatchModelCallService { ...@@ -206,6 +238,7 @@ public class RecordingBatchModelCallService {
/** /**
* 业务不存在使用默认实例处理 * 业务不存在使用默认实例处理
*/ */
log.warn("业务不存在使用默认实例处理, {}", businessType);
instance= BigModelExecutorFactory.getInstance( instance= BigModelExecutorFactory.getInstance(
ModelCallTypeEnum.fromBusType(0).getHanderImp(), ModelCallTypeEnum.fromBusType(0).getHanderImp(),
RecordModelCallExecutionStrategy.class); RecordModelCallExecutionStrategy.class);
......
...@@ -28,6 +28,11 @@ ModelCallTypeEnum { ...@@ -28,6 +28,11 @@ ModelCallTypeEnum {
ModelCall_WGHS(11, "violationScriptsAbstractStrategy", RecordModelCallExecutionStrategy.class), ModelCall_WGHS(11, "violationScriptsAbstractStrategy", RecordModelCallExecutionStrategy.class),
/** /**
* 违规话术-岚图
*/
ModelCall_WGHS_LT(1107, "violationScriptsAbstractStrategy", RecordModelCallExecutionStrategy.class),
/**
* 默认业务处理 * 默认业务处理
*/ */
ModelCall_default(0, "defaultAbstractStrategy", RecordModelCallExecutionStrategy.class); ModelCall_default(0, "defaultAbstractStrategy", RecordModelCallExecutionStrategy.class);
......
...@@ -10,10 +10,9 @@ import cn.com.glsx.dj.mindworkplate.service.recordmodelcall.RecordingBatchModelC ...@@ -10,10 +10,9 @@ import cn.com.glsx.dj.mindworkplate.service.recordmodelcall.RecordingBatchModelC
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException; import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.util.ArrayList;
import java.util.Date; import java.util.*;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
...@@ -82,46 +81,49 @@ public class ViolationScriptsAbstractStrategy implements RecordModelCallExecutio ...@@ -82,46 +81,49 @@ public class ViolationScriptsAbstractStrategy implements RecordModelCallExecutio
} }
List<Map> maps = JSONObject.parseArray(o1+"", Map.class); List<Map> maps = JSONObject.parseArray(o1+"", Map.class);
List<RecordingBatchModelCallWghsDetail> recordingBatchModelCallWghsDetails = new ArrayList<>(); List<RecordingBatchModelCallWghsDetail> recordingBatchModelCallWghsDetails = new ArrayList<>();
byte isMntioned = 0; int isMntioned = 0;
byte isMntioned1 = 0;
byte isMntioned2 = 0;
byte isMntioned3 = 0;
for (Map map : maps) { for (Map map : maps) {
Object o = map.get("rule"); Object o = map.get("rule");
Object match = map.get("match"); Object match = map.get("match");
Object g1_match = map.get("g1_match"); Object g1_match = map.get("g1_match");
Object g2_match = map.get("g2_match"); Object g2_match = map.get("g2_match");
if (o != null) { if (o != null) {
boolean isMatch = false;
switch (o.toString()) { switch (o.toString()) {
case "R101": case "R101":
if ("YES".equals(match) && "NO".equals(g1_match) && "NO".equals(g2_match)) { if (!Objects.equals("NO", g2_match)) {
isMntioned1 = 1; log.info("规则:{},g2_match:{}", o, match);
recordingBatchModelCallWghsDetails.addAll(extractTimeAndText(map.get("sentence") + "",o.toString()));
}
break; break;
case "R102":
if ("YES".equals(match) && ("NO".equals(g1_match))) {
isMntioned2 = 1;
recordingBatchModelCallWghsDetails.addAll(extractTimeAndText(map.get("sentence") + "",o.toString()));
} }
case "R102":
if (!Objects.equals("NO", g1_match)) {
log.info("规则:{},g1_match:{}", o, match);
break; break;
}
case "R103": case "R103":
case "H001":
case "H002":
case "H003":
case "H004":
if ("YES".equals(match)) { if ("YES".equals(match)) {
isMntioned3 = 1; isMatch = true;
recordingBatchModelCallWghsDetails.addAll(extractTimeAndText(map.get("sentence") + "",o.toString())); isMntioned |= 1;
} }
break; break;
default: default:
break; log.warn("未定义的规则{}", o);
} }
if (isMatch) {
recordingBatchModelCallWghsDetails.addAll(extractTimeAndText(map.get("sentence") + "", Objects.toString(o, null)));
} }
} }
if (isMntioned1 == 1 || isMntioned2 == 1 || isMntioned3 == 1) {
isMntioned = 1;
} }
RecordingBatchModelCallWghs build = RecordingBatchModelCallWghs.builder(). RecordingBatchModelCallWghs build = RecordingBatchModelCallWghs.builder()
batchId(recordingBatchModelCall.getRecordingBatchId()). .batchId(recordingBatchModelCall.getRecordingBatchId())
isMentioned(isMntioned).wghsStatus((int) isMntioned).createdTime(new Date()).build(); .isMentioned((byte) isMntioned)
.wghsStatus(isMntioned)
.createdTime(new Date())
.build();
recordingBatchModelCallWGHSService.insert(build, recordingBatchModelCallWghsDetails); recordingBatchModelCallWGHSService.insert(build, recordingBatchModelCallWghsDetails);
} }
......
...@@ -624,13 +624,14 @@ ...@@ -624,13 +624,14 @@
resultType="cn.com.glsx.dj.mindworkplate.model.ReceptionViolationInfoDTO"> resultType="cn.com.glsx.dj.mindworkplate.model.ReceptionViolationInfoDTO">
select t3.id as batchId,t5.employee_name as employeeName,t5.phone_number as employeePhone,t1.merchant_id as merchantNo,t1.phone_number as phoneNumber,t1.customer_name as customerName, select t3.id as batchId,t5.employee_name as employeeName,t5.phone_number as employeePhone,t1.merchant_id as merchantNo,t1.phone_number as phoneNumber,t1.customer_name as customerName,
t1.car_model as carModel,t1.reception_start_time as startTime,t2.recording_url as fileUrl, t1.reception_end_time as endTime,t1.reception_status as receptionStatus, t1.car_model as carModel,t1.reception_start_time as startTime,t2.recording_url as fileUrl, t1.reception_end_time as endTime,t1.reception_status as receptionStatus,
t1.car_brand as carBrandName, t1.car_brandid as carBrandId,
t2.recording_duration as totalDuration,t4.wghs_Status as violationStatus,t4.Violation_Reason_confim_time as violationReasonConfimTime,t1.bussiness_type as bussinessTypeName,t6.result_json as resultJson t2.recording_duration as totalDuration,t4.wghs_Status as violationStatus,t4.Violation_Reason_confim_time as violationReasonConfimTime,t1.bussiness_type as bussinessTypeName,t6.result_json as resultJson
from reception_customer_info t1 from reception_customer_info t1
left join inspection_badge_recordings t2 on t1.id=t2.reception_id left join inspection_badge_recordings t2 on t1.id=t2.reception_id
left join inspection_employee_badge t5 on t2.badge_id =t5.badge_id left join inspection_employee_badge t5 on t2.badge_id =t5.badge_id
left join inspection_conversation_batch t3 on t2.id =t3.record_id left join inspection_conversation_batch t3 on t2.id =t3.record_id
left join recording_batch_model_call_wghs t4 on t3.id =t4.batch_id left join recording_batch_model_call_wghs t4 on t3.id =t4.batch_id
left join recording_batch_model_call t6 on (t6.recording_batch_id =t4.batch_id and t6.business_type=11) left join recording_batch_model_call t6 on (t6.recording_batch_id =t4.batch_id and t6.business_type in (11,1107))
where t4.id is not null where t4.id is not null
<if test="merchantNo!=null"> <if test="merchantNo!=null">
and t1.merchant_id = #{merchantNo} and t1.merchant_id = #{merchantNo}
...@@ -659,6 +660,9 @@ ...@@ -659,6 +660,9 @@
<if test="violationStatus!=null"> <if test="violationStatus!=null">
and t4.wghs_Status = #{violationStatus} and t4.wghs_Status = #{violationStatus}
</if> </if>
<if test="carBrandId != null">
and t1.car_brandid = #{carBrandId}
</if>
<choose> <choose>
<!-- 当 violationStatus 不为 null 时 --> <!-- 当 violationStatus 不为 null 时 -->
<when test="violationStatus == null || violationStatus == 1"> <when test="violationStatus == null || violationStatus == 1">
...@@ -675,6 +679,7 @@ ...@@ -675,6 +679,7 @@
select t3.id as batchId,t5.employee_name as employeeName,t5.phone_number as employeePhone,t1.merchant_id as merchantNo,t1.phone_number as phoneNumber,t1.customer_name as customerName, select t3.id as batchId,t5.employee_name as employeeName,t5.phone_number as employeePhone,t1.merchant_id as merchantNo,t1.phone_number as phoneNumber,t1.customer_name as customerName,
t1.car_model as carModel,t1.reception_start_time as startTime,t2.recording_url as fileUrl, t1.reception_end_time as endTime,t1.reception_status as receptionStatus, t1.car_model as carModel,t1.reception_start_time as startTime,t2.recording_url as fileUrl, t1.reception_end_time as endTime,t1.reception_status as receptionStatus,
t1.car_brand as carBrandName, t1.car_brandid as carBrandId,
t2.recording_duration as totalDuration,t4.wghs_Status as violationStatus,t4.Violation_Reason_confim_time as violationReasonConfimTime,t1.bussiness_type as bussinessTypeName t2.recording_duration as totalDuration,t4.wghs_Status as violationStatus,t4.Violation_Reason_confim_time as violationReasonConfimTime,t1.bussiness_type as bussinessTypeName
from reception_customer_info t1 from reception_customer_info t1
left join inspection_badge_recordings t2 on t1.id=t2.reception_id left join inspection_badge_recordings t2 on t1.id=t2.reception_id
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
select select
t2.*,t1.result_json t2.*,t1.result_json
from recording_batch_model_call_wghs t2 from recording_batch_model_call_wghs t2
left join recording_batch_model_call t1 on (t1.recording_batch_id = t2.batch_id and t1.business_type=11) left join recording_batch_model_call t1 on (t1.recording_batch_id = t2.batch_id and t1.business_type in (11,1107))
where t2.batch_id = #{batchId} where t2.batch_id = #{batchId}
</select> </select>
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.com.glsx.dj.mindworkplate.mapper.RecordingTagConfigModelTypeMapper" >
<resultMap id="BaseResultMap" type="cn.com.glsx.dj.mindworkplate.model.RecordingTagConfigModelType" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="config_code" property="configCode" jdbcType="VARCHAR" />
<result column="model_type" property="modelType" jdbcType="VARCHAR" />
<result column="created_by" property="createdBy" jdbcType="VARCHAR" />
<result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
<result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, config_code, model_type, created_by, created_date, updated_by, updated_date, deleted_flag
</sql>
<select id="findConfigCodesByModelType" resultType="java.lang.String">
select config_code from recording_tag_config_model_type
where model_type = #{modelType} and deleted_flag = 'N'
</select>
<select id="findModelTypesByConfigCode" resultType="java.lang.String">
select model_type from recording_tag_config_model_type
where config_code = #{configCode} and deleted_flag = 'N'
</select>
<select id="countByConfigCodeAndModelType" resultType="java.lang.Integer">
select count(*) from recording_tag_config_model_type
where config_code = #{configCode} and model_type = #{modelType} and deleted_flag = 'N'
</select>
</mapper>
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" /> <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" /> <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
<result column="description" property="description" jdbcType="VARCHAR" /> <result column="description" property="description" jdbcType="VARCHAR" />
<result column="configCode" property="configCode" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
...@@ -25,10 +26,20 @@ ...@@ -25,10 +26,20 @@
</sql> </sql>
<select id="findAll" resultMap="BaseResultMap"> <select id="findAll" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />,
config_code as configCode
from recording_tag_group from recording_tag_group
where deleted_flag = 'N' where deleted_flag = 'N'
AND config_code in (select code from recording_tag_config where scene_type=#{checkType}) AND config_code in (select code from recording_tag_config where scene_type=#{checkType})
</select> </select>
<select id="findAllByConfigCode" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />,
config_code as configCode
from recording_tag_group
where deleted_flag = 'N'
AND config_code=#{configCode}
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -17,11 +17,12 @@ ...@@ -17,11 +17,12 @@
<result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" /> <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
<result column="rule_sql" property="ruleSql" jdbcType="VARCHAR" /> <result column="rule_sql" property="ruleSql" jdbcType="VARCHAR" />
<result column="description" property="description" jdbcType="VARCHAR" /> <result column="description" property="description" jdbcType="VARCHAR" />
<result column="tagName" property="tagName" jdbcType="VARCHAR" />
<result column="matchConditionType" property="matchConditionType" jdbcType="VARCHAR" /> <result column="matchConditionType" property="matchConditionType" jdbcType="VARCHAR" />
<result column="tagName" property="tagName" jdbcType="VARCHAR" />
<result column="tagId" property="tagId" jdbcType="INTEGER" /> <result column="tagId" property="tagId" jdbcType="INTEGER" />
<result column="score" property="score" jdbcType="DOUBLE" /> <result column="score" property="score" jdbcType="DOUBLE" />
<result column="sumScore" property="sumScore" jdbcType="DOUBLE" /> <result column="sumScore" property="sumScore" jdbcType="DOUBLE" />
<result column="configCode" property="configCode" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
...@@ -35,10 +36,20 @@ ...@@ -35,10 +36,20 @@
<select id="findAll" <select id="findAll"
resultMap="BaseResultMap"> resultMap="BaseResultMap">
select t1.id as tagId,t1.value_name as tagName,t1.tag_groupid AS tagGroupid,t1.match_condition_type as matchConditionType, select t1.id as tagId,t1.value_name as tagName,t1.tag_groupid AS tagGroupid,t1.match_condition_type as matchConditionType,
t2.*,t1.tag_value_score as score,t3.tag_score as sumScore,t3.group_name as tagGroupName from recording_tag_value t1 t2.*,t1.tag_value_score as score,t3.tag_score as sumScore,t3.group_name as tagGroupName,t3.config_code as configCode from recording_tag_value t1
left join recording_tag_group t3 on t1.tag_groupid=t3.id left join recording_tag_group t3 on t1.tag_groupid=t3.id
left join recording_tag_rule_mapping t2 on (t1.id =t2.tag_value_id and t2.deleted_flag='N') left join recording_tag_rule_mapping t2 on (t1.id =t2.tag_value_id and t2.deleted_flag='N')
where t1.deleted_flag='N' and t3.deleted_flag='N' where t1.deleted_flag='N' and t3.deleted_flag='N'
AND t3.config_code in (select code from recording_tag_config where scene_type=#{checkType}) AND t3.config_code in (select code from recording_tag_config where scene_type=#{checkType})
</select> </select>
<select id="findAllByConfigCode"
resultMap="BaseResultMap">
select t1.id as tagId,t1.value_name as tagName,t1.tag_groupid AS tagGroupid,t1.match_condition_type as matchConditionType,
t2.*,t1.tag_value_score as score,t3.tag_score as sumScore,t3.group_name as tagGroupName,t3.config_code as configCode from recording_tag_value t1
left join recording_tag_group t3 on t1.tag_groupid=t3.id
left join recording_tag_rule_mapping t2 on (t1.id =t2.tag_value_id and t2.deleted_flag='N')
where t1.deleted_flag='N' and t3.deleted_flag='N'
AND t3.config_code=#{configCode}
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -45,15 +45,15 @@ public class ConversationDateServiceTest extends BaseServiceTest{ ...@@ -45,15 +45,15 @@ public class ConversationDateServiceTest extends BaseServiceTest{
ConversationBatch conversationBatch = conversationBatchMapper.selectByPrimaryKey(122); ConversationBatch conversationBatch = conversationBatchMapper.selectByPrimaryKey(122);
conversationBatch.setCheckType(1); conversationBatch.setCheckType(1);
conversationBatch.setCarBrandId(1); conversationBatch.setCarBrandId(1);
conversationBatch.setOneCarBrandId(1); conversationBatch.setOneCarBrandId(2336);
conversationDateService.singleBatchInspection(conversationBatch); conversationDateService.singleBatchInspection(conversationBatch);
} }
@Test @Test
public void getCheckResult() throws Exception{ public void getCheckResult() throws Exception{
ConversationBatch conversationBatch = conversationBatchMapper.selectByPrimaryKey(124); ConversationBatch conversationBatch = conversationBatchMapper.selectByPrimaryKey(122);
conversationBatch.setCheTaskId("Task-1932639431466942464"); conversationBatch.setCheTaskId("Task-2043591565565231104");
conversationBatch.setCheckType(3); conversationBatch.setCheckType(1);
conversationDateService.getCheckResult(conversationBatch); conversationDateService.getCheckResult(conversationBatch);
} }
......
...@@ -38,7 +38,8 @@ public class RecordingModelCallTest extends BaseServiceTest{ ...@@ -38,7 +38,8 @@ public class RecordingModelCallTest extends BaseServiceTest{
@Test @Test
public void insertWaitGet() { public void insertWaitGet() {
recordingBatchModelCallService.insertWaitGet(121); recordingBatchModelCallService.insertWaitGet(121, "问界");
recordingBatchModelCallService.insertWaitGet(121, "岚图");
} }
@Test @Test
public void execute1() { public void execute1() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!