招标解析接口

This commit is contained in:
cwchen 2025-11-24 13:40:44 +08:00
parent 4ee54de8ac
commit 328f8b9b39
17 changed files with 561 additions and 40 deletions

View File

@ -0,0 +1,49 @@
package com.bonus.web.controller.analysis;
import com.bonus.common.annotation.RequiresPermissions;
import com.bonus.common.annotation.SysLog;
import com.bonus.common.core.controller.BaseController;
//import com.bonus.web.service.analysis.AnalysisService;
import com.bonus.common.core.page.TableDataInfo;
import com.bonus.common.domain.analysis.dto.AnalysisDto;
import com.bonus.common.domain.analysis.vo.AnalysisVo;
import com.bonus.common.enums.OperaType;
import com.bonus.web.service.analysis.AnalysisService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @className:AnalysisController
* @author:cwchen
* @date:2025-11-13-11:17
* @version:1.0
* @description:招标解析模块
*/
@RestController
@RequestMapping("/analysis")
public class AnalysisController extends BaseController {
@Resource(name = "AnalysisService")
private AnalysisService analysisService;
/*@ApiOperation(value = "测试mq异步消息", notes = "测试mq异步消息")
@GetMapping("/testAsyncMq")
public AjaxResult testAsyncMq() {
return analysisService.testAsyncMq();
}*/
@ApiOperation(value = "招标解析", notes = "查询列表")
@GetMapping("getList")
@SysLog(title = "招标解析", module = "招标解析->查询列表", businessType = OperaType.QUERY, details = "查询列表", logType = 1)
@RequiresPermissions("analysis:analysis:list")
public TableDataInfo getList(AnalysisDto dto) {
startPage();
List<AnalysisVo> list = analysisService.getList(dto);
return getDataTable(list);
}
}

View File

@ -0,0 +1,30 @@
package com.bonus.web.controller.common;
import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.domain.admin.SelectDto;
import com.bonus.web.service.common.CommonSelectService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
/**
* @className:CommonSelect
* @author:cwchen
* @date:2025-11-24-13:15
* @version:1.0
* @description:通用下拉选/
*/
@RequestMapping("/commonSelect/")
public class CommonSelectController {
@Resource(name = "CommonSelectService")
private CommonSelectService commonSelectService;
@ApiOperation(value = "招标解析模板下拉选", notes = "获取招标解析模板下拉选")
@GetMapping("getAnalysisSelects")
public AjaxResult getAnalysisSelects(SelectDto selectDto) {
return commonSelectService.getAnalysisSelects(selectDto);
}
}

View File

@ -0,0 +1,82 @@
package com.bonus.web.service.analysis;
import com.bonus.analysis.service.IASAnalysisService;
import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.domain.analysis.dto.AnalysisDto;
import com.bonus.common.domain.analysis.vo.AnalysisVo;
import com.bonus.common.domain.rabbitmq.dto.RabbitMqMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
/**
* @className:AnalysisService
* @author:cwchen
* @date:2025-11-13-13:33
* @version:1.0
* @description:招标解析业务逻辑层
*/
@Service(value = "AnalysisService")
@Slf4j
public class AnalysisService {
// @Resource(name = "RabbitMQProducer")
// private RabbitMQProducer rabbitMQProducer;
@Resource(name = "taskExecutor")
private Executor taskExecutor;
@Resource(name = "IASAnalysisService")
private IASAnalysisService analysisService;
public AjaxResult testAsyncMq() {
/*taskExecutor.submit(() -> {
for (int i = 0; i < 1; i++) {
RabbitMqMessage mqMessage = new RabbitMqMessage();
mqMessage.setTaskName("基础OCR识别");
if(i == 0){
mqMessage.setUploadPath("personnelDatabase/2025/10/24/89a266f4-f928-4ee4-95eb-1a73906da0a7.png");
}else {
mqMessage.setUploadPath("toolsDatabase/2025/11/13/3d6dc46140c24af282981df2017982e9.png");
}
try {
// Boolean sendStatus = rabbitMQProducer.send("myExchange", "myRoutingKey", mqMessage).get();
*//*CompletableFuture<Boolean> future = rabbitMQProducer.send("myExchange", "myRoutingKey", mqMessage);
future.thenAccept(success -> {
if (success) {
log.info("消息投递成功");
} else {
log.error("消息投递失败");
}
});*//*
} catch (Exception e) {
throw new RuntimeException(e);
}
}
});*/
CompletableFuture.runAsync(() -> {
}, taskExecutor);
return AjaxResult.success();
}
/**
* 招标解析->查询列表
* @param dto
* @return List<AnalysisVo>
* @author cwchen
* @date 2025/11/24 10:47
*/
public List<AnalysisVo> getList(AnalysisDto dto) {
return analysisService.getList(dto);
}
}

View File

@ -0,0 +1,38 @@
package com.bonus.web.service.common;
import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.domain.admin.SelectDto;
import com.bonus.common.domain.system.vo.SelectVo;
import com.bonus.system.service.ISelectService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @className:CommonSelectService
* @author:cwchen
* @date:2025-11-24-13:17
* @version:1.0
* @description:通用下拉选/-业务层
*/
@Service(value = "CommonSelectService")
@Slf4j
public class CommonSelectService {
@Resource(name = "ISelectService")
private ISelectService selectService;
/**
* 招标解析模板下拉选
* @param selectDto
* @return AjaxResult
* @author cwchen
* @date 2025/11/24 13:31
*/
public AjaxResult getAnalysisSelects(SelectDto selectDto) {
List<SelectVo> list = selectService.getAnalysisSelects(selectDto);
return AjaxResult.success(list);
}
}

View File

@ -0,0 +1,26 @@
package com.bonus.analysis.mapper;
import com.bonus.common.domain.analysis.dto.AnalysisDto;
import com.bonus.common.domain.analysis.vo.AnalysisVo;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @className:IASAnalysisMapper
* @author:cwchen
* @date:2025-11-24-10:51
* @version:1.0
* @description:招标解析数据层
*/
@Repository(value = "IASAnalysisMapper")
public interface IASAnalysisMapper {
/**
* 招标解析->查询列表
* @param dto
* @return List<AnalysisVo>
* @author cwchen
* @date 2025/11/24 11:17
*/
List<AnalysisVo> getList(AnalysisDto dto);
}

View File

@ -0,0 +1,25 @@
package com.bonus.analysis.service;
import com.bonus.common.domain.analysis.dto.AnalysisDto;
import com.bonus.common.domain.analysis.vo.AnalysisVo;
import java.util.List;
/**
* @className:IASAnalysisService
* @author:cwchen
* @date:2025-11-24-10:49
* @version:1.0
* @description:招标解析业务层
*/
public interface IASAnalysisService {
/**
* 招标解析->查询列表
* @param dto
* @return List<AnalysisVo>
* @author cwchen
* @date 2025/11/24 11:06
*/
List<AnalysisVo> getList(AnalysisDto dto);
}

View File

@ -0,0 +1,32 @@
package com.bonus.analysis.service.impl;
import com.bonus.analysis.mapper.IASAnalysisMapper;
import com.bonus.analysis.service.IASAnalysisService;
import com.bonus.common.domain.analysis.dto.AnalysisDto;
import com.bonus.common.domain.analysis.vo.AnalysisVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
/**
* @className:ASAnalysisServiceImpl
* @author:cwchen
* @date:2025-11-24-10:50
* @version:1.0
* @description:招标解析业务实现层
*/
@Slf4j
@Service(value = "IASAnalysisService")
public class ASAnalysisServiceImpl implements IASAnalysisService {
@Resource(name = "IASAnalysisMapper")
private IASAnalysisMapper analysisMapper;
@Override
public List<AnalysisVo> getList(AnalysisDto dto) {
return analysisMapper.getList(dto);
}
}

View File

@ -0,0 +1,33 @@
<?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="com.bonus.analysis.mapper.IASAnalysisMapper">
<!--招标解析->查询列表-->
<select id="getList" resultType="com.bonus.common.domain.analysis.vo.AnalysisVo">
SELECT tp.pro_id AS proId,
tp.pro_name AS proName,
tt.template_name AS templateName,
tp.pro_code AS proCode,
tp.tenderer AS tenderer,
tp.agency AS agency,
tp.bid_opening_time AS bidOpeningTime,
tp.bid_opening_method AS bidOpeningMethod,
tp.create_time AS createTime,
tp.analysis_status AS analysisStatus
FROM tb_pro tp
LEFT JOIN tb_template tt ON tp.template_id = tt.template_id
WHERE tp.del_flag = '0'
<if test="proName!=null and proName!=''">
AND INSTR(tp.pro_name,#{proName}) > 0
</if>
<if test="tenderer!=null and tenderer!=''">
AND INSTR(tp.tenderer,#{tenderer}) > 0
</if>
<if test="startDate!=null and startDate!='' and endDate!=null and endDate!=''">
AND DATE(bid_opening_time) BETWEEN DATE(#{startDate}) AND DATE(#{endDate})
</if>
ORDER BY tp.create_time DESC
</select>
</mapper>

View File

@ -0,0 +1,14 @@
package com.bonus.common.domain.admin;
import lombok.Data;
/**
* @className:SelectDto
* @author:cwchen
* @date:2025-11-24-13:30
* @version:1.0
* @description:下拉选-dto
*/
@Data
public class SelectDto {
}

View File

@ -0,0 +1,23 @@
package com.bonus.common.domain.analysis.dto;
import lombok.Data;
/**
* @className:AnalysisDto
* @author:cwchen
* @date:2025-11-24-9:40
* @version:1.0
* @description:招标解析dto
*/
@Data
public class AnalysisDto {
/**项目名称*/
private String proName;
/**招标人*/
private String tenderer;
/**开标开始日期*/
private String startDate;
/**开标结束日期*/
private String endDate;
}

View File

@ -0,0 +1,78 @@
package com.bonus.common.domain.analysis.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @className:AnalysisVo
* @author:cwchen
* @date:2025-11-24-9:42
* @version:1.0
* @description:招标解析vo
*/
@Data
public class AnalysisVo {
/**
* 项目id
*/
private Long proId;
/**
* 模板信息id
*/
private Long templateId;
/**
* 模板名称
* */
private String templateName;
/**
* 项目名称
*/
private String proName;
/**
* 项目编号
*/
private String proCode;
/**
* 招标人
*/
private String tenderer;
/**
* 代理机构
*/
private String agency;
/**
* 开标时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date bidOpeningTime;
/**
* 开标方式
*/
private String bidOpeningMethod;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 解析状态 0.解析中 1.解析成功 2.解析失败
*/
private String analysisStatus;
}

View File

@ -1,40 +0,0 @@
package com.bonus.common.domain.ocr.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @className:OcrData
* @author:cwchen
* @date:2025-10-16-10:43
* @version:1.0
* @description: OCR数据DTO
*/
@Data
public class OcrData {
@JsonProperty("chat_res")
private Map<String, String> chatRes;
/**
* 获取识别文本
*/
public String getText() {
if (chatRes == null) return null;
// 将所有字段值拼接成文本
return chatRes.values().stream()
.filter(Objects::nonNull)
.collect(Collectors.joining(" "));
}
/**
* 获取特定字段值
*/
public String getFieldValue(String fieldName) {
return chatRes != null ? chatRes.get(fieldName) : null;
}
}

View File

@ -0,0 +1,29 @@
package com.bonus.common.domain.system.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
/**
* @className:SelectVo
* @author:cwchen
* @date:2025-11-24-13:24
* @version:1.0
* @description:下拉选-vo
*/
@Data
public class SelectVo {
/**
* id
*/
private String id;
/**
* 名称
*/
private String name;
/**
* 上传类型-模板解析
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String uploadType;
}

View File

@ -0,0 +1,24 @@
package com.bonus.system.mapper;
import com.bonus.common.domain.system.vo.SelectVo;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @className:ISelectMapper
* @author:cwchen
* @date:2025-11-24-13:22
* @version:1.0
* @description:下拉选/树数据层
*/
@Repository(value = "ISelectMapper")
public interface ISelectMapper {
/**
* 招标解析模板下拉选
* @return List<SelectVo>
* @author cwchen
* @date 2025/11/24 13:34
*/
List<SelectVo> getAnalysisSelects();
}

View File

@ -0,0 +1,24 @@
package com.bonus.system.service;
import com.bonus.common.domain.admin.SelectDto;
import com.bonus.common.domain.system.vo.SelectVo;
import java.util.List;
/**
* @className:ISelectService
* @author:cwchen
* @date:2025-11-24-13:20
* @version:1.0
* @description:下拉选/树业务层
*/
public interface ISelectService {
/**
* 招标解析模板下拉选
* @param selectDto
* @return List<SelectVo>
* @author cwchen
* @date 2025/11/24 13:32
*/
List<SelectVo> getAnalysisSelects(SelectDto selectDto);
}

View File

@ -0,0 +1,38 @@
package com.bonus.system.service.impl;
import com.bonus.common.domain.admin.SelectDto;
import com.bonus.common.domain.system.vo.SelectVo;
import com.bonus.system.mapper.ISelectMapper;
import com.bonus.system.service.ISelectService;
import lombok.extern.slf4j.Slf4j;
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;
/**
* @className:SelectServiceImpl
* @author:cwchen
* @date:2025-11-24-13:21
* @version:1.0
* @description:下拉选/树业务逻辑层
*/
@Service(value = "ISelectService")
@Slf4j
public class SelectServiceImpl implements ISelectService {
@Resource(name = "ISelectMapper")
private ISelectMapper selectMapper;
@Override
public List<SelectVo> getAnalysisSelects(SelectDto selectDto) {
try {
return Optional.ofNullable(selectMapper.getAnalysisSelects()).orElse(new ArrayList<>());
} catch (Exception e) {
return Collections.emptyList();
}
}
}

View File

@ -0,0 +1,16 @@
<?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="com.bonus.system.mapper.ISelectMapper">
<!--招标解析模板下拉选-->
<select id="getAnalysisSelects" resultType="com.bonus.common.domain.system.vo.SelectVo">
SELECT tt.template_id AS id,
tt.template_name AS name,
ttc.file_name AS uploadType
FROM tb_template tt
LEFT JOIN tb_template_composition ttc ON tt.template_id = ttc.template_id AND ttc.composition_type = '1'
WHERE tt.use_state = '0' AND tt.del_flag = '0'
</select>
</mapper>