招标解析算法服务
This commit is contained in:
parent
c64e2f168e
commit
b2d7393387
|
|
@ -173,7 +173,8 @@ public class AnalysisService {
|
|||
RabbitMqMessage msg = new RabbitMqMessage();
|
||||
String taskId = UUID.randomUUID().toString();
|
||||
msg.setMessageId(taskId);
|
||||
msg.setUploadPath(dto.getFiles().get(i).getFilePath());
|
||||
// msg.setUploadPath(dto.getFiles().get(i).getFilePath());
|
||||
msg.setUploadPath("analysisDatabase/2025/11/29/2055f27b7a8c4fb883b1f9d12d95872a.pdf");
|
||||
msg.setProId(dto.getProId());
|
||||
msg.setTemplateId(dto.getTemplateId());
|
||||
msg.setAnalysisLabelId(dto.getAnalysisLabelId());
|
||||
|
|
@ -233,6 +234,9 @@ public class AnalysisService {
|
|||
*/
|
||||
public AjaxResult getProDetail(AnalysisDto.TemplateDto dto) {
|
||||
AnalysisVo analysisVo = analysisService.getProDetail(dto);
|
||||
// 查询标段文件的文件组成
|
||||
List<String> bidCompositions = analysisService.getBidCompositionByBid(analysisVo);
|
||||
analysisVo.setBidCompositions(bidCompositions);
|
||||
// 查询类型为2时查询文件
|
||||
if(dto.getQueryType() == 2){
|
||||
// 查询项目组成文件
|
||||
|
|
|
|||
|
|
@ -137,4 +137,13 @@ public interface IASAnalysisMapper {
|
|||
* @date 2025/11/29 15:51
|
||||
*/
|
||||
void delProBidAnalysisResult(AnalysisDto.TemplateDto dto);
|
||||
|
||||
/**
|
||||
* 查询标段文件的文件组成
|
||||
* @param analysisVo
|
||||
* @return List<ProComposition>
|
||||
* @author cwchen
|
||||
* @date 2025/11/30 13:29
|
||||
*/
|
||||
List<String> getBidCompositionByBid(AnalysisVo analysisVo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,4 +135,13 @@ public interface IASAnalysisService {
|
|||
* @date 2025/11/29 15:48
|
||||
*/
|
||||
void delProBidAnalysisResult(AnalysisDto.TemplateDto dto);
|
||||
|
||||
/**
|
||||
* 查询标段文件的文件组成
|
||||
* @param analysisVo
|
||||
* @return List<ProComposition>
|
||||
* @author cwchen
|
||||
* @date 2025/11/30 13:28
|
||||
*/
|
||||
List<String> getBidCompositionByBid(AnalysisVo analysisVo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
|
@ -107,4 +108,15 @@ public class ASAnalysisServiceImpl implements IASAnalysisService {
|
|||
public void delProBidAnalysisResult(AnalysisDto.TemplateDto dto) {
|
||||
analysisMapper.delProBidAnalysisResult(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getBidCompositionByBid(AnalysisVo analysisVo) {
|
||||
try {
|
||||
List<String> list = Optional.ofNullable(analysisMapper.getBidCompositionByBid(analysisVo)).orElse(new ArrayList<>());
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@
|
|||
<!--保存项目数据-->
|
||||
<insert id="addProData" keyProperty="proId" useGeneratedKeys="true" keyColumn="pro_id">
|
||||
INSERT INTO tb_pro(template_id,create_user_id,create_user_name,update_user_id,
|
||||
update_user_name,analysis_status)
|
||||
update_user_name)
|
||||
VALUES (
|
||||
#{templateId},#{createUserId},#{createUserName},#{updateUserId},#{updateUserName},'0'
|
||||
#{templateId},#{createUserId},#{createUserName},#{updateUserId},#{updateUserName}
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
|
@ -82,7 +82,8 @@
|
|||
tp.bid_opening_method AS bidOpeningMethod,
|
||||
tp.create_time AS createTime,
|
||||
tp.analysis_status AS analysisStatus,
|
||||
tp.pro_introduction AS proIntroduction
|
||||
tp.pro_introduction AS proIntroduction,
|
||||
tp.template_id AS templateId
|
||||
FROM tb_pro tp WHERE pro_id = #{proId} AND del_flag = '0'
|
||||
</select>
|
||||
|
||||
|
|
@ -122,8 +123,8 @@
|
|||
<!--获取解析标签项-->
|
||||
<select id="getAnalysisLabels" resultType="com.bonus.common.domain.analysis.vo.AnalysisLabelItemOcrVo">
|
||||
SELECT tali.analysis_label_item_id AS id,
|
||||
tali.analysis_name AS search_keyword,
|
||||
tali.analysis_code AS target_field,
|
||||
tali.analysis_name AS searchKeyword,
|
||||
tali.analysis_code AS targetField,
|
||||
tali.parent_id AS parentId,
|
||||
tali.analysis_level AS analysisLevel,
|
||||
tali.analysis_sort AS analysisSort,
|
||||
|
|
@ -132,6 +133,12 @@
|
|||
LEFT JOIN tb_analysis_rule_set tars ON tali.analysis_label_item_id = tars.analysis_label_item_id AND tars.template_id = #{templateId}
|
||||
WHERE tali.analysis_label_id = #{analysisLabelId} AND tali.del_flag = '0'
|
||||
</select>
|
||||
<!--查询标段文件的文件组成-->
|
||||
<select id="getBidCompositionByBid" resultType="java.lang.String">
|
||||
SELECT file_name AS fileName
|
||||
FROM tb_template_composition
|
||||
WHERE template_id = #{templateId} AND composition_type = '2'
|
||||
</select>
|
||||
|
||||
<!--删除项目数据-->
|
||||
<update id="delProData">
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ public class AnalysisLabelItemOcrVo {
|
|||
/**
|
||||
* 解析名称
|
||||
*/
|
||||
private String search_keyword;
|
||||
private String searchKeyword;
|
||||
|
||||
/**
|
||||
* 解析编码
|
||||
*/
|
||||
private String target_field;
|
||||
private String targetField;
|
||||
|
||||
/**
|
||||
* 父节点
|
||||
|
|
|
|||
|
|
@ -89,6 +89,9 @@ public class AnalysisVo {
|
|||
* */
|
||||
private List<AnalysisBidVo> bidList;
|
||||
|
||||
/**文件组成*/
|
||||
/**项目文件组成*/
|
||||
List<ProComposition> compositions;
|
||||
|
||||
/**标段文件组成*/
|
||||
private List<String> bidCompositions;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
import lombok.Data;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -32,12 +33,12 @@ public class AnalysisOcrRequest {
|
|||
private String gpus = "2";
|
||||
|
||||
private String doc_folder_path;
|
||||
private String cover_keys;
|
||||
// private List<String> cover_keys = new ArrayList<>();
|
||||
private List<AnalysisLabelItemOcrVo> extraction_items;
|
||||
|
||||
public AnalysisOcrRequest(String doc_folder_path, String cover_keys, List<AnalysisLabelItemOcrVo> extraction_items) {
|
||||
public AnalysisOcrRequest(String doc_folder_path, /*List<String> cover_keys,*/ List<AnalysisLabelItemOcrVo> extraction_items) {
|
||||
this.doc_folder_path = doc_folder_path;
|
||||
this.cover_keys = cover_keys;
|
||||
// this.cover_keys = cover_keys;
|
||||
this.extraction_items = extraction_items;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class AnalysisResponse {
|
|||
private String message; // 消息
|
||||
|
||||
@JsonProperty("data")
|
||||
private Map<String, String> data; // 识别数据
|
||||
private Map<String, Object> data; // 识别数据
|
||||
|
||||
public boolean isSuccess() {
|
||||
return Objects.equals(status, "success");
|
||||
|
|
|
|||
|
|
@ -169,6 +169,14 @@ public class RabbitMQConsumerService {
|
|||
|
||||
public void performAnalysisRecognition2(RabbitMqMessage message,String folderPath){
|
||||
try {
|
||||
|
||||
if(message.getBidId() == null){
|
||||
// 1.项目解析
|
||||
|
||||
}else {
|
||||
// 2.标段解析
|
||||
}
|
||||
|
||||
List<AnalysisLabelItemOcrVo> labelItemVoList = analysisService.getAnalysisLabels(message.getAnalysisLabelId(),message.getTemplateId());
|
||||
AnalysisOcrRequest analysisOcrRequest = buildOcrRequest2(folderPath, labelItemVoList);
|
||||
AnalysisResponse ocrResponse2 = analysisOcrService.callOcrService(analysisOcrRequest);
|
||||
|
|
@ -206,7 +214,6 @@ public class RabbitMQConsumerService {
|
|||
*/
|
||||
private AnalysisOcrRequest buildOcrRequest2(String filePath,List<AnalysisLabelItemOcrVo> list) {
|
||||
AnalysisOcrRequest ocrRequest = new AnalysisOcrRequest();
|
||||
ocrRequest.setCover_keys("");
|
||||
ocrRequest.setExtraction_items(list);
|
||||
ocrRequest.setDoc_folder_path(filePath);
|
||||
ocrRequest.setAnalysisType("2");
|
||||
|
|
|
|||
Loading…
Reference in New Issue