2026-05-22 09:36:01 +08:00
|
|
|
|
<?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.ruoyi.system.mapper.bid.BizComparisonMapper">
|
feat: multi-dim comparison + clustering + per-supplier PDF export
Backend:
- BizComparisonVO: add composite score fields (priceScore, deliveryScore,
qualityScore, serviceScore, compositeScore, rankBadge) + SupplierPlan cluster VO
- Mapper: join biz_supplier_evaluation for quality/service history scores
- Service: weighted scoring (price 40%/delivery 25%/quality 20%/service 15%),
greedy clustering assigns each item to best-score supplier, groups into plans
- Controller: returns CompareResult with items + recommendedPlans
Frontend:
- Tab 1 (多维度比价): supplier rank cards with 4-dim progress bars
- Tab 2 (智能推荐方案): per-supplier cluster cards with explanation + PDF export
- PDF: logo header, score legend, items table, cluster reason per supplier
2026-05-22 11:19:29 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 核心比价数据:物料行 + 各供应商报价 + 历史评价均分 -->
|
2026-05-22 09:36:01 +08:00
|
|
|
|
<select id="selectComparisonData" resultType="java.util.HashMap">
|
|
|
|
|
|
SELECT
|
feat: multi-dim comparison + clustering + per-supplier PDF export
Backend:
- BizComparisonVO: add composite score fields (priceScore, deliveryScore,
qualityScore, serviceScore, compositeScore, rankBadge) + SupplierPlan cluster VO
- Mapper: join biz_supplier_evaluation for quality/service history scores
- Service: weighted scoring (price 40%/delivery 25%/quality 20%/service 15%),
greedy clustering assigns each item to best-score supplier, groups into plans
- Controller: returns CompareResult with items + recommendedPlans
Frontend:
- Tab 1 (多维度比价): supplier rank cards with 4-dim progress bars
- Tab 2 (智能推荐方案): per-supplier cluster cards with explanation + PDF export
- PDF: logo header, score legend, items table, cluster reason per supplier
2026-05-22 11:19:29 +08:00
|
|
|
|
ri.item_id AS rfqItemId,
|
|
|
|
|
|
ri.material_name AS materialName,
|
|
|
|
|
|
ri.spec AS spec,
|
|
|
|
|
|
ri.unit AS unit,
|
|
|
|
|
|
ri.quantity AS quantity,
|
|
|
|
|
|
qi.unit_price AS unitPrice,
|
|
|
|
|
|
qi.total_price AS totalPrice,
|
|
|
|
|
|
qi.delivery_days AS deliveryDays,
|
|
|
|
|
|
q.quotation_id AS quotationId,
|
|
|
|
|
|
q.quote_no AS quoteNo,
|
|
|
|
|
|
q.supplier_id AS supplierId,
|
|
|
|
|
|
s.supplier_name AS supplierName,
|
|
|
|
|
|
s.contact AS contact,
|
|
|
|
|
|
s.phone AS phone,
|
|
|
|
|
|
COALESCE(ev.avg_quality, 3.0) AS avgQuality,
|
|
|
|
|
|
COALESCE(ev.avg_service, 3.0) AS avgService,
|
|
|
|
|
|
COALESCE(ev.eval_count, 0) AS historyCount
|
2026-05-22 09:36:01 +08:00
|
|
|
|
FROM biz_rfq_item ri
|
feat: multi-dim comparison + clustering + per-supplier PDF export
Backend:
- BizComparisonVO: add composite score fields (priceScore, deliveryScore,
qualityScore, serviceScore, compositeScore, rankBadge) + SupplierPlan cluster VO
- Mapper: join biz_supplier_evaluation for quality/service history scores
- Service: weighted scoring (price 40%/delivery 25%/quality 20%/service 15%),
greedy clustering assigns each item to best-score supplier, groups into plans
- Controller: returns CompareResult with items + recommendedPlans
Frontend:
- Tab 1 (多维度比价): supplier rank cards with 4-dim progress bars
- Tab 2 (智能推荐方案): per-supplier cluster cards with explanation + PDF export
- PDF: logo header, score legend, items table, cluster reason per supplier
2026-05-22 11:19:29 +08:00
|
|
|
|
LEFT JOIN biz_quotation_item qi ON qi.rfq_item_id = ri.item_id
|
|
|
|
|
|
LEFT JOIN biz_quotation q ON q.quotation_id = qi.quotation_id
|
2026-06-17 02:54:35 +08:00
|
|
|
|
AND q.status IN ('draft','submitted','accepted')
|
feat: multi-dim comparison + clustering + per-supplier PDF export
Backend:
- BizComparisonVO: add composite score fields (priceScore, deliveryScore,
qualityScore, serviceScore, compositeScore, rankBadge) + SupplierPlan cluster VO
- Mapper: join biz_supplier_evaluation for quality/service history scores
- Service: weighted scoring (price 40%/delivery 25%/quality 20%/service 15%),
greedy clustering assigns each item to best-score supplier, groups into plans
- Controller: returns CompareResult with items + recommendedPlans
Frontend:
- Tab 1 (多维度比价): supplier rank cards with 4-dim progress bars
- Tab 2 (智能推荐方案): per-supplier cluster cards with explanation + PDF export
- PDF: logo header, score legend, items table, cluster reason per supplier
2026-05-22 11:19:29 +08:00
|
|
|
|
LEFT JOIN biz_supplier s ON s.supplier_id = q.supplier_id
|
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
|
SELECT supplier_id,
|
|
|
|
|
|
AVG(quality_score) AS avg_quality,
|
|
|
|
|
|
AVG(service_score) AS avg_service,
|
|
|
|
|
|
COUNT(*) AS eval_count
|
|
|
|
|
|
FROM biz_supplier_evaluation
|
|
|
|
|
|
GROUP BY supplier_id
|
|
|
|
|
|
) ev ON ev.supplier_id = q.supplier_id
|
2026-05-22 09:36:01 +08:00
|
|
|
|
WHERE ri.rfq_id = #{rfqId}
|
feat: multi-dim comparison + clustering + per-supplier PDF export
Backend:
- BizComparisonVO: add composite score fields (priceScore, deliveryScore,
qualityScore, serviceScore, compositeScore, rankBadge) + SupplierPlan cluster VO
- Mapper: join biz_supplier_evaluation for quality/service history scores
- Service: weighted scoring (price 40%/delivery 25%/quality 20%/service 15%),
greedy clustering assigns each item to best-score supplier, groups into plans
- Controller: returns CompareResult with items + recommendedPlans
Frontend:
- Tab 1 (多维度比价): supplier rank cards with 4-dim progress bars
- Tab 2 (智能推荐方案): per-supplier cluster cards with explanation + PDF export
- PDF: logo header, score legend, items table, cluster reason per supplier
2026-05-22 11:19:29 +08:00
|
|
|
|
ORDER BY ri.item_id, qi.unit_price ASC
|
2026-05-22 09:36:01 +08:00
|
|
|
|
</select>
|
feat: multi-dim comparison + clustering + per-supplier PDF export
Backend:
- BizComparisonVO: add composite score fields (priceScore, deliveryScore,
qualityScore, serviceScore, compositeScore, rankBadge) + SupplierPlan cluster VO
- Mapper: join biz_supplier_evaluation for quality/service history scores
- Service: weighted scoring (price 40%/delivery 25%/quality 20%/service 15%),
greedy clustering assigns each item to best-score supplier, groups into plans
- Controller: returns CompareResult with items + recommendedPlans
Frontend:
- Tab 1 (多维度比价): supplier rank cards with 4-dim progress bars
- Tab 2 (智能推荐方案): per-supplier cluster cards with explanation + PDF export
- PDF: logo header, score legend, items table, cluster reason per supplier
2026-05-22 11:19:29 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- RFQ基本信息 -->
|
|
|
|
|
|
<select id="selectRfqInfo" resultType="java.util.HashMap">
|
|
|
|
|
|
SELECT rfq_no AS rfqNo, rfq_title AS rfqTitle
|
|
|
|
|
|
FROM biz_rfq WHERE rfq_id = #{rfqId}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2026-06-17 02:54:35 +08:00
|
|
|
|
<!-- 历史报价参考:当前RFQ无报价时,查询同物料在其他RFQ中的最近报价 -->
|
|
|
|
|
|
<select id="selectHistoricalPrices" resultType="java.util.HashMap">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
qi.unit_price AS unitPrice,
|
|
|
|
|
|
qi.total_price AS totalPrice,
|
|
|
|
|
|
qi.delivery_days AS deliveryDays,
|
|
|
|
|
|
q.quotation_id AS quotationId,
|
|
|
|
|
|
q.quote_no AS quoteNo,
|
|
|
|
|
|
q.supplier_id AS supplierId,
|
|
|
|
|
|
s.supplier_name AS supplierName,
|
|
|
|
|
|
r.rfq_no AS rfqNo,
|
|
|
|
|
|
COALESCE(ev.avg_quality, 3.0) AS avgQuality,
|
|
|
|
|
|
COALESCE(ev.avg_service, 3.0) AS avgService,
|
|
|
|
|
|
COALESCE(ev.eval_count, 0) AS historyCount
|
|
|
|
|
|
FROM biz_quotation_item qi
|
|
|
|
|
|
JOIN biz_quotation q ON qi.quotation_id = q.quotation_id
|
|
|
|
|
|
AND q.status IN ('submitted','accepted')
|
|
|
|
|
|
JOIN biz_supplier s ON s.supplier_id = q.supplier_id
|
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
|
SELECT supplier_id,
|
|
|
|
|
|
AVG(quality_score) AS avg_quality,
|
|
|
|
|
|
AVG(service_score) AS avg_service,
|
|
|
|
|
|
COUNT(*) AS eval_count
|
|
|
|
|
|
FROM biz_supplier_evaluation
|
|
|
|
|
|
GROUP BY supplier_id
|
|
|
|
|
|
) ev ON ev.supplier_id = q.supplier_id
|
|
|
|
|
|
LEFT JOIN biz_rfq r ON q.rfq_id = r.rfq_id
|
|
|
|
|
|
WHERE qi.material_name = #{materialName}
|
|
|
|
|
|
AND q.rfq_id != #{excludeRfqId}
|
|
|
|
|
|
ORDER BY q.create_time DESC
|
|
|
|
|
|
LIMIT #{limit}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2026-05-22 09:36:01 +08:00
|
|
|
|
</mapper>
|