Compare commits
No commits in common. "c1a401fcc95593634c810a486a9498b2e82280fd" and "41c6b179fa4bc68600ad66659729a1be973c9881" have entirely different histories.
c1a401fcc9
...
41c6b179fa
|
|
@ -1,43 +0,0 @@
|
||||||
package com.hshh.evaluation.controller;
|
|
||||||
|
|
||||||
import com.hshh.evaluation.entity.EvaluationTemplate;
|
|
||||||
import com.hshh.evaluation.service.EvaluationTemplateService;
|
|
||||||
import com.hshh.system.common.bean.BaseController;
|
|
||||||
import com.hshh.system.common.bean.PaginationBean;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评估工程模板表 前端控制器.
|
|
||||||
*
|
|
||||||
* @author liDongYu
|
|
||||||
* @since 2025-08-13
|
|
||||||
*/
|
|
||||||
@Controller
|
|
||||||
@RequestMapping("/evaluation/evaluationTemplate")
|
|
||||||
public class EvaluationTemplateController extends BaseController {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private EvaluationTemplateService evaluationTemplateService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认页.
|
|
||||||
*
|
|
||||||
* @return evaluation/list.html
|
|
||||||
*/
|
|
||||||
@GetMapping("/")
|
|
||||||
@Operation(summary = "评估工程模板首页", description = "导航到评估工程模板首页")
|
|
||||||
public String list(PaginationBean request, Model model) {
|
|
||||||
setNavigateTitle(model, "/evaluation/evaluationTemplate/");
|
|
||||||
List<EvaluationTemplate> list = evaluationTemplateService.list(request);
|
|
||||||
Long total = evaluationTemplateService.count(request);
|
|
||||||
//设置分页信息
|
|
||||||
setPaginationInfo(request, list, total, model);
|
|
||||||
return "evaluation_template/list";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
package com.hshh.evaluation.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 com.hshh.system.common.bean.BaseBean;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评估工程模板表.
|
|
||||||
*
|
|
||||||
* @author liDongYu
|
|
||||||
* @since 2025-08-13
|
|
||||||
*/
|
|
||||||
@TableName("m_data_evaluation_template")
|
|
||||||
@Data
|
|
||||||
public class EvaluationTemplate extends BaseBean {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
|
|
||||||
private String templateName;
|
|
||||||
|
|
||||||
|
|
||||||
private Integer indicatorTopId;
|
|
||||||
|
|
||||||
|
|
||||||
private Integer indicatorWeightId;
|
|
||||||
|
|
||||||
|
|
||||||
private Integer templateStatus;
|
|
||||||
|
|
||||||
|
|
||||||
private String templateMemo;
|
|
||||||
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String indicatorTopName;
|
|
||||||
@TableField(exist = false)
|
|
||||||
private String templateStatusName;
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
package com.hshh.evaluation.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.hshh.evaluation.entity.EvaluationTemplate;
|
|
||||||
import com.hshh.system.common.bean.PaginationBean;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评估工程模板表 Mapper 接口.
|
|
||||||
*
|
|
||||||
* @author liDongYu
|
|
||||||
* @since 2025-08-13
|
|
||||||
*/
|
|
||||||
public interface EvaluationTemplateMapper extends BaseMapper<EvaluationTemplate> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询模板列表.
|
|
||||||
*
|
|
||||||
* @param search 查询条件
|
|
||||||
* @return 模板列表
|
|
||||||
*/
|
|
||||||
List<EvaluationTemplate> list(PaginationBean search);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 记录总数.
|
|
||||||
*
|
|
||||||
* @param search 查询条件
|
|
||||||
* @return 总数
|
|
||||||
*/
|
|
||||||
Long count(PaginationBean search);
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
package com.hshh.evaluation.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.hshh.evaluation.entity.EvaluationTemplate;
|
|
||||||
import com.hshh.system.common.bean.PaginationBean;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评估工程模板表 服务类.
|
|
||||||
*
|
|
||||||
* @author liDongYu
|
|
||||||
* @since 2025-08-13
|
|
||||||
*/
|
|
||||||
public interface EvaluationTemplateService extends IService<EvaluationTemplate> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询模板列表.
|
|
||||||
*
|
|
||||||
* @param search 查询条件
|
|
||||||
* @return 模板列表
|
|
||||||
*/
|
|
||||||
List<EvaluationTemplate> list(PaginationBean search);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 记录总数.
|
|
||||||
*
|
|
||||||
* @param search 查询条件
|
|
||||||
* @return 总数
|
|
||||||
*/
|
|
||||||
Long count(PaginationBean search);
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
package com.hshh.evaluation.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.hshh.evaluation.entity.EvaluationTemplate;
|
|
||||||
import com.hshh.evaluation.mapper.EvaluationTemplateMapper;
|
|
||||||
import com.hshh.evaluation.service.EvaluationTemplateService;
|
|
||||||
import com.hshh.system.common.bean.PaginationBean;
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评估工程模板表 服务实现类.
|
|
||||||
*
|
|
||||||
* @author liDongYu
|
|
||||||
* @since 2025-08-13
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class EvaluationTemplateServiceImpl extends
|
|
||||||
ServiceImpl<EvaluationTemplateMapper, EvaluationTemplate> implements
|
|
||||||
EvaluationTemplateService {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<EvaluationTemplate> list(PaginationBean search) {
|
|
||||||
return this.baseMapper.list(search);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long count(PaginationBean search) {
|
|
||||||
return this.baseMapper.count(search);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
<?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.hshh.evaluation.mapper.EvaluationTemplateMapper">
|
|
||||||
<select id="list" resultType="com.hshh.evaluation.entity.EvaluationTemplate"
|
|
||||||
parameterType="com.hshh.system.common.bean.PaginationBean" databaseId="mysql">
|
|
||||||
SELECT
|
|
||||||
@rownum := @rownum + 1 AS seq,
|
|
||||||
t.*
|
|
||||||
FROM (
|
|
||||||
SELECT T1.*,T2.name as indicatorTopName FROM m_data_evaluation_template T1 left join m_data_indicator T2 on T1.indicator_top_id=T2.id
|
|
||||||
<where>
|
|
||||||
<if test="search != null and search !='' ">
|
|
||||||
T1.template_name LIKE CONCAT('%',#{search},'%')
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
order by T1.id asc ) t, ( SELECT @rownum := #{start} ) r limit
|
|
||||||
#{start},#{pageSize}
|
|
||||||
</select>
|
|
||||||
<select id="list" resultType="com.hshh.evaluation.entity.EvaluationTemplate"
|
|
||||||
parameterType="com.hshh.system.common.bean.PaginationBean" databaseId="dm">SELECT
|
|
||||||
t.seq,
|
|
||||||
t.*
|
|
||||||
FROM (
|
|
||||||
SELECT
|
|
||||||
ROW_NUMBER() OVER (ORDER BY id ASC) AS seq,
|
|
||||||
a.*,
|
|
||||||
a1.name as indicatorTopName
|
|
||||||
FROM m_data_evaluation_template a left join m_data_indicator a1 on a.indicator_top_id=a1.name
|
|
||||||
<where>
|
|
||||||
<if test="search != null and search !='' ">
|
|
||||||
a.template_name LIKE '%'||#{search}||'%'
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
) t
|
|
||||||
WHERE t.seq > #{start} AND t.seq <= (#{start} + #{pageSize})
|
|
||||||
</select>
|
|
||||||
<select id="count" resultType="java.lang.Long" databaseId="dm">
|
|
||||||
select count(id) from m_data_evaluation_template
|
|
||||||
<where>
|
|
||||||
<if test="search != null and search !=''">
|
|
||||||
(template_name LIKE '%'||#{search}||'%') )
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="count" resultType="java.lang.Long" databaseId="mysql">
|
|
||||||
select count(id) from m_data_evaluation_template
|
|
||||||
<where>
|
|
||||||
<if test="search != null and search !=''">
|
|
||||||
template_name LIKE CONCAT('%',#{search},'%')
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
<!-- Page body -->
|
|
||||||
<div class="page-body">
|
|
||||||
<div class="container-xl">
|
|
||||||
<!-- 面包屑导航 -->
|
|
||||||
<div th:replace="fragments/dialog::navigateDialog(${chainMenuList})"></div>
|
|
||||||
<div class="row g-4 mb-4">
|
|
||||||
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">评估模板列表</h3>
|
|
||||||
<div class="card-actions">
|
|
||||||
<a href="javascript:void(0)" class="btn btn-primary" onclick="_toAdd()">
|
|
||||||
<!-- Download SVG icon from http://tabler-icons.io/i/plus -->
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24"
|
|
||||||
viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
|
|
||||||
stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
||||||
<path d="M12 5l0 14"></path>
|
|
||||||
<path d="M5 12l14 0"></path>
|
|
||||||
</svg>
|
|
||||||
新增
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div th:replace="fragments/dialog::searchConditionDialog(${condition})"></div>
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table card-table table-vcenter text-nowrap datatable">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
|
|
||||||
<th class="w-1">No.
|
|
||||||
<!-- Download SVG icon from http://tabler-icons.io/i/chevron-up -->
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-sm icon-thick" width="24"
|
|
||||||
height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"
|
|
||||||
fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
||||||
<path d="M6 15l6 -6l6 6"></path>
|
|
||||||
</svg>
|
|
||||||
</th>
|
|
||||||
<th>模板名称</th>
|
|
||||||
<th>对应指标</th>
|
|
||||||
<th>模板状态</th>
|
|
||||||
<th>模板描述</th>
|
|
||||||
<th>创建时间</th>
|
|
||||||
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr th:if="${result.list!=null}" th:each="project : ${result.list}">
|
|
||||||
<td th:text="${project.seq}"></td>
|
|
||||||
<td th:text="${project.templateName}"></td>
|
|
||||||
<td th:text="${project.indicatorTopName}"></td>
|
|
||||||
<td th:text="${project.templateStatusName}"></td>
|
|
||||||
<td th:text="${project.templateMemo}"></td>
|
|
||||||
<td th:text="${#temporals.format(project.createDate, 'yyyy-MM-dd HH:mm:ss')}"></td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
<div class="btn-list flex-nowrap">
|
|
||||||
<a href="javascript:void(0)" class="btn btn-primary"
|
|
||||||
th:onclick="|_startEvaluation('${project.id}')|">
|
|
||||||
编辑
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<a href="javascript:void(0)" class=" btn btn-danger"
|
|
||||||
th:onclick="|_projectDelete('${project.id}')|">
|
|
||||||
删除
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div th:replace="fragments/dialog::paginationDialog(${result})"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div th:replace="fragments/dialog::confirmationDialog"></div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
@ -1,132 +0,0 @@
|
||||||
package com.hshh.system.common.algorithm;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/** 树节点:每个非叶子节点可附带“对子节点的判断矩阵” */
|
|
||||||
class AhpNode {
|
|
||||||
final String name;
|
|
||||||
final List<AhpNode> children = new ArrayList<>();
|
|
||||||
|
|
||||||
// 对子节点的两两比较矩阵(仅在 children.size()>1 时需要)
|
|
||||||
double[][] localMatrix;
|
|
||||||
|
|
||||||
// 计算得到
|
|
||||||
double[] localWeights; // 对“本节点”的子节点局部权重(和=1)
|
|
||||||
double lambdaMax = Double.NaN, ci = Double.NaN, cr = Double.NaN;
|
|
||||||
|
|
||||||
double globalWeight = Double.NaN; // 本节点的全局权重(根设为1,叶子递推得到)
|
|
||||||
|
|
||||||
AhpNode(String name) { this.name = name; }
|
|
||||||
|
|
||||||
AhpNode setLocalMatrix(double[][] m) { this.localMatrix = m; return this; }
|
|
||||||
AhpNode add(AhpNode... nodes) { this.children.addAll(Arrays.asList(nodes)); return this; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class AhpTreeDemo {
|
|
||||||
|
|
||||||
/** 递归计算:从 root 开始,将局部权重通过父节点全局权重向下传播 */
|
|
||||||
static void computeTree(AhpNode root) {
|
|
||||||
if (Double.isNaN(root.globalWeight)) root.globalWeight = 1.0; // 根默认 1
|
|
||||||
|
|
||||||
int k = root.children.size();
|
|
||||||
if (k == 0) return; // 叶子
|
|
||||||
|
|
||||||
if (k == 1) {
|
|
||||||
// 单子节点不需要矩阵,权重=1,直接传播
|
|
||||||
root.localWeights = new double[]{1.0};
|
|
||||||
AhpNode c = root.children.get(0);
|
|
||||||
c.globalWeight = root.globalWeight; // 乘1
|
|
||||||
computeTree(c);
|
|
||||||
root.lambdaMax = 1; root.ci = 0; root.cr = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (root.localMatrix == null || root.localMatrix.length != k || root.localMatrix[0].length != k) {
|
|
||||||
throw new IllegalStateException("Node '"+root.name+"' needs a "+k+"x"+k+" localMatrix.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// AHP:对子节点判断矩阵 -> 局部权重 + 一致性
|
|
||||||
Ahp.EigenResult er = Ahp.principalEigen(root.localMatrix, 1e-12, 10000);
|
|
||||||
root.localWeights = er.w;
|
|
||||||
root.lambdaMax = er.lambdaMax;
|
|
||||||
root.ci = Ahp.consistencyIndex(er.lambdaMax, k);
|
|
||||||
root.cr = Ahp.consistencyRatio(er.lambdaMax, k);
|
|
||||||
|
|
||||||
// 传播:子全局 = 父全局 × 局部权重
|
|
||||||
for (int i = 0; i < k; i++) {
|
|
||||||
AhpNode child = root.children.get(i);
|
|
||||||
child.globalWeight = root.globalWeight * root.localWeights[i];
|
|
||||||
computeTree(child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 打印树(缩进展示),显示局部/全局权重与一致性 */
|
|
||||||
static void printTree(AhpNode node, int depth) {
|
|
||||||
String indent = " ".repeat(depth);
|
|
||||||
String info = String.format("%s- %s (global=%.4f)", indent, node.name,
|
|
||||||
Double.isNaN(node.globalWeight) ? 0.0 : node.globalWeight);
|
|
||||||
System.out.println(info);
|
|
||||||
|
|
||||||
if (node.children.size() > 1) {
|
|
||||||
System.out.printf("%s local weights = %s | λmax=%.6f CI=%.6f CR=%.6f%n",
|
|
||||||
indent, Ahp.fmt(node.localWeights), node.lambdaMax, node.ci, node.cr);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (AhpNode c : node.children) printTree(c, depth+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------------- 完整示例 ----------------
|
|
||||||
// public static void main(String[] args) {
|
|
||||||
// // 层次:H -> A,B ; A -> A1,A2,A3 ; B -> B1,B2
|
|
||||||
// AhpNode H = new AhpNode("H"); // 目标
|
|
||||||
// AhpNode A = new AhpNode("A"); // 准则组 A
|
|
||||||
// AhpNode B = new AhpNode("B"); // 准则组 B
|
|
||||||
// AhpNode A1 = new AhpNode("A1");
|
|
||||||
// AhpNode A2 = new AhpNode("A2");
|
|
||||||
// AhpNode A3 = new AhpNode("A3");
|
|
||||||
// AhpNode B1 = new AhpNode("B1");
|
|
||||||
// AhpNode B2 = new AhpNode("B2");
|
|
||||||
//
|
|
||||||
// // 组装树
|
|
||||||
// H.add(A, B);
|
|
||||||
// A.add(A1, A2, A3);
|
|
||||||
// B.add(B1, B2);
|
|
||||||
//
|
|
||||||
// // 顶层 H 的判断矩阵(A vs B)
|
|
||||||
// H.setLocalMatrix(new double[][]{
|
|
||||||
// {1, 3},
|
|
||||||
// {1.0/3, 1}
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// // A 组内(A1,A2,A3)
|
|
||||||
// A.setLocalMatrix(new double[][]{
|
|
||||||
// {1, 2, 4},
|
|
||||||
// {0.5, 1, 3},
|
|
||||||
// {0.25, 1.0/3, 1}
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// // B 组内(B1,B2)
|
|
||||||
// B.setLocalMatrix(new double[][]{
|
|
||||||
// {1, 0.5},
|
|
||||||
// {2, 1}
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// // 计算
|
|
||||||
// H.globalWeight = 1.0; // 根节点全局权重=1
|
|
||||||
// computeTree(H);
|
|
||||||
//
|
|
||||||
// // 打印结果
|
|
||||||
// printTree(H, 0);
|
|
||||||
//
|
|
||||||
// // 校验:所有叶子全局之和应为 1
|
|
||||||
// double sumLeaves = sumLeaves(H);
|
|
||||||
// System.out.printf("%nSum of leaf global weights = %.6f%n", sumLeaves);
|
|
||||||
// }
|
|
||||||
|
|
||||||
static double sumLeaves(AhpNode n) {
|
|
||||||
if (n.children.isEmpty()) return n.globalWeight;
|
|
||||||
double s = 0.0;
|
|
||||||
for (AhpNode c : n.children) s += sumLeaves(c);
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user