2024.7.20(hadoop小学期阶段验收)

一、 测试题目

1、完成科技查新基本信息填报功能,基本信息如下所示:

可参考https://chaxin.las.ac.cn/novelty/embed/kjcx.htm页面样式。

项目名称

平台编号

查新范围

□国内    □国外  

查新目的

О立即查新         О成果查新        О其他查新

(单选框,选中某个选项,显示相应的多选框)

立即查新

□1.项目申报(国家级、省部级、学协会、其他)

□2.中小企业创新基金(研发阶段、小试-中试、市场推广)

□3.新产品

□4.技术引进

□5.技术吸收与创新

□6.其他

成果查新

□7.成果鉴定

□8.高新技术成果转化

□9.申报奖励(国家级、省部级、学协会、其他奖励)

□10.高新技术企业认定

□11.其他

其他查新

□12.博士论文开题

□13.申报专利

□14.其他

查新项目的科学技术要点

充分反映出查新项目的概貌,简述项目的背景、技术问题、解决技术问题所采用的方案、主要技术特征、技术参数或指标、应用范围等相关技术内容。(要求限制500字)

查新点个数

(必填)

查新点1

 

查新点N(根据个数显示)

 

参考检索词

(主题词、关键词、规范词、同义词、缩写、全称、化学名称、分子式、专利分类号等,国内外查新要分中英文列出。)如果有多个检索词要求点击按钮添加多个检索词文本框。

完成时间

说明:国内查新7个工作日(1个查新点),每增加1个查新点,查新费用增加300元,工作时间增加1个工作日;国内外查新10个工作日(1个查新点),每增加1个查新点,查新费用增加600元,工作时间增加3个工作日。(国内查新加急不得少于3个工作日,国内外查新加急不得少于5个工作日)。

加急费情况介绍:

收费:200元/工作日

时间:国内查新第一个查新点不得少于3个工作日,每增加一个点多一个工作日;

国内外查新第一个查新点不得少于5个工作日,每增加一个点多一个工作日;

 

正常:О7个工作日

加急:О  

学科分类

用文本下拉框显示,具体内容参考表后图1.

产业分类

用文本下拉框显示,具体内容参考表后图2.

备注

 

 

1学科分类示意

 

2产业分类示意

2、后台数据库要求使用HBASE数据库,并将新数据存入HBase或者HIVE新建表中。

3、实现从数据库中将新数据读出展示在前台页面。

 

 

测试代码:

复制代码
  1 <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2 <!DOCTYPE html>
  3 <head>
  4     <meta charset="UTF-8">
  5     <title>查新申请表</title>
  6     <style>
  7         body {
  8             font-family: Arial, sans-serif;
  9             color: #333;
 10             margin: 0;
 11             padding: 20px;
 12         }
 13         form {
 14             max-width: 800px;
 15             margin: 0 auto;
 16             padding: 20px;
 17             background-color: #fff;
 18             border-radius: 10px;
 19             box-shadow: 0 0 10px rgb(255, 255, 255);
 20         }
 21         .form-section {
 22             margin-bottom: 20px;
 23         }
 24         .form-section label {
 25             display: block;
 26             margin-top: 10px;
 27         }
 28         .form-section input[type="text"],
 29         .form-section input[type="number"],
 30         .form-section textarea,
 31         .form-section select {
 32             width: 100%;
 33             padding: 10px;
 34             margin-top: 5px;
 35             border: 1px solid #ccc;
 36             border-radius: 5px;
 37         }
 38         .form-section input[type="checkbox"],
 39         .form-section input[type="radio"] {
 40             margin-right: 10px;
 41         }
 42         .form-section input[type="submit"] {
 43             display: block;
 44             width: 100%;
 45             padding: 10px;
 46             background-color: #0056b3;
 47             color: #fff;
 48             border: none;
 49             border-radius: 5px;
 50             cursor: pointer;
 51             font-size: 16px;
 52         }
 53         .form-section input[type="submit"]:hover {
 54             background-color: #004494;
 55         }
 56         .hidden {
 57             display: none;
 58         }
 59     </style>
 60     <script type="text/javascript">
 61         function toggleOptions(radio) {
 62             document.getElementById("immediateCheck").classList.add("hidden");
 63             document.getElementById("achievementCheck").classList.add("hidden");
 64             document.getElementById("otherCheck").classList.add("hidden");
 65 
 66             if (radio.value === "immediate") {
 67                 document.getElementById("immediateCheck").classList.remove("hidden");
 68             } else if (radio.value === "achievement") {
 69                 document.getElementById("achievementCheck").classList.remove("hidden");
 70             } else if (radio.value === "other") {
 71                 document.getElementById("otherCheck").classList.remove("hidden");
 72             }
 73         }
 74 
 75         function addSearchTerm() {
 76             var container = document.getElementById("searchTerms");
 77             var input = document.createElement("input");
 78             input.type = "text";
 79             input.name = "searchTerm";
 80             container.appendChild(document.createElement("br"));
 81             container.appendChild(input);
 82         }
 83 
 84         function add2() {
 85             var container = document.getElementById("checkPoint");
 86             var input = document.createElement("input");
 87             input.type = "text";
 88             input.name = "checkPoint1";
 89             container.appendChild(document.createElement("br"));
 90             container.appendChild(input);
 91         }
 92     </script>
 93 </head>
 94 <body>
 95 <form action="submit.jsp" method="post">
 96     <div class="form-section">
 97         <label for="projectName">项目名称:</label>
 98         <input type="text" id="projectName" name="projectName" required>
 99     </div>
100 <%--    <div class="form-section">--%>
101 <%--        <label for="platformId">平台编号:</label>--%>
102 <%--        <input type="text" id="platformId" name="platformId" required>--%>
103 <%--    </div>--%>
104     <div class="form-section">
105         <label>查新范围:</label>
106         <label><input type="checkbox" name="range" value="domestic"> 国内</label>
107         <label><input type="checkbox" name="range" value="international"> 国外</label>
108     </div>
109     <div class="form-section">
110         <label>查新目的:</label>
111         <label><input type="radio" name="purpose" value="immediate" onclick="toggleOptions(this)" required> 立即查新</label>
112         <label><input type="radio" name="purpose" value="achievement" onclick="toggleOptions(this)"> 成果查新</label>
113         <label><input type="radio" name="purpose" value="other" onclick="toggleOptions(this)"> 其他查新</label>
114     </div>
115     <div id="immediateCheck" class="form-section hidden">
116         <label>立即查新:</label>
117         <label><input type="checkbox" name="immediatePurpose" value="projectApplication"> 项目申报(国家级、省部级、学协会、其他)</label>
118         <label><input type="checkbox" name="immediatePurpose" value="innovationFund"> 中小企业创新基金(研发阶段、小试-中试、市场推广)</label>
119         <label><input type="checkbox" name="immediatePurpose" value="newProduct"> 新产品</label>
120         <label><input type="checkbox" name="immediatePurpose" value="technologyIntroduction"> 技术引进</label>
121         <label><input type="checkbox" name="immediatePurpose" value="technologyAbsorption"> 技术吸收与创新</label>
122         <label><input type="checkbox" name="immediatePurpose" value="other"> 其他</label>
123     </div>
124     <div id="achievementCheck" class="form-section hidden">
125         <label>成果查新:</label>
126         <label><input type="checkbox" name="achievementPurpose" value="achievementAppraisal"> 成果鉴定</label>
127         <label><input type="checkbox" name="achievementPurpose" value="technologyConversion"> 高新技术成果转化</label>
128         <label><input type="checkbox" name="achievementPurpose" value="rewardApplication"> 申报奖励(国家级、省部级、学协会、其他奖励)</label>
129         <label><input type="checkbox" name="achievementPurpose" value="highTechEnterprise"> 高新技术企业认定</label>
130         <label><input type="checkbox" name="achievementPurpose" value="other"> 其他</label>
131     </div>
132     <div id="otherCheck" class="form-section hidden">
133         <label>其他查新:</label>
134         <label><input type="checkbox" name="otherPurpose" value="phdThesis"> 博士论文开题</label>
135         <label><input type="checkbox" name="otherPurpose" value="patentApplication"> 申报专利</label>
136         <label><input type="checkbox" name="otherPurpose" value="other"> 其他</label>
137     </div>
138     <div class="form-section">
139         <label for="techDetails">查新项目的科学技术要点:</label>
140         <textarea id="techDetails" name="techDetails" rows="5" maxlength="500" required></textarea>
141     </div>
142     <div class="form-section">
143         <label for="numCheckPoints">查新点个数:</label>
144         <input type="number" id="numCheckPoints" name="numCheckPoints" required>
145     </div>
146     <div id="checkPoint" class="form-section">
147         <label for="checkPoint1">查新点:</label>
148         <input type="text" id="checkPoint1" name="checkPoint1">
149     </div>
150     <button type="button" onclick="add2()">添加</button>
151     <div id="searchTerms" class="form-section">
152         <label for="searchTerm">参考检索词:(主题词、关键词、规范词、同义词、缩写、全称、化学名称、分子式、专利分类号等,国内外查新要分中英文列出。)</label>
153         <input type="text" id="searchTerm" name="searchTerm">
154     </div>
155     <button type="button" onclick="addSearchTerm()">+</button>
156     <div class="form-section">
157         <label>完成时间:说明:国内查新7个工作日(1个查新点),每增加1个查新点,查新费用增加300元,工作时间增加1个工作日;国内外查新10个工作日(1个查新点),每增加1个查新点,查新费用增加600元,工作时间增加3个工作日。(国内查新加急不得少于3个工作日,国内外查新加急不得少于5个工作日)。
158             加急费情况介绍:
159             收费:200元/工作日
160             时间:国内查新第一个查新点不得少于3个工作日,每增加一个点多一个工作日;
161             国内外查新第一个查新点不得少于5个工作日,每增加一个点多一个工作日;</label>
162         <label><input type="radio" name="completionTime" value="normal" required> 7个工作日</label>
163         <label><input type="radio" name="completionTime" value="urgent"> 加急</label>
164     </div>
165     <div class="form-section">
166         <label for="discipline">学科分类:</label>
167         <select id="discipline" name="discipline" required>
168             <option value="discipline1">信息科学与系统科学</option>
169             <option value="discipline2">生物学</option>
170             <option value="discipline3">力学</option>
171             <option value="discipline4">物理学</option>
172             <option value="discipline5">化学</option>
173             <option value="discipline6">数学</option>
174             <option value="discipline7">天文学</option>
175             <option value="discipline7">地球科学</option>
176             <option value="discipline8">环境科学</option>
177             <option value="discipline9">动力与电气工程</option>
178             <option value="discipline10">能源科学</option>
179             <option value="discipline11">电子与通信技术</option>
180             <option value="discipline8">食品科学技术</option>
181             <option value="discipline9">航空航天科学技术</option>
182             <option value="discipline10">农业科学</option>
183             <option value="discipline11">林学</option>
184         </select>
185     </div>
186     <div class="form-section">
187         <label for="industry">产业分类:</label>
188         <select id="industry" name="industry" required>
189             <option value="industry1">节能环保产业(节水、节能、环保)</option>
190             <option value="industry2">生物产业</option>
191             <option value="industry3">新一代信息技术产业</option>
192             <option value="industry4">高端装备制造产业</option>
193             <option value="industry5">新能源产业(太阳能、风能、生物智能)</option>
194             <option value="industry6">新材料产业</option>
195             <option value="industry7">新能源汽车</option>
196             <option value="industry8">国民经济其他产业</option>
197         </select>
198     </div>
199     <div class="form-section">
200         <label for="remarks">备注:</label>
201         <textarea id="remarks" name="remarks" rows="3"></textarea>
202     </div>
203     <div class="form-section">
204         <input type="submit" value="提交">
205     </div>
206 </form>
207 </body>
208 </html>
复制代码
复制代码
<%--
  Created by IntelliJ IDEA.
  User: 贾贾鱼
  Date: 2024/7/20
  Time: 15:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>展示</title>
</head>
<body>
<%@ page import="java.sql.*" %>
<%@ page import="org.apache.hive.jdbc.HiveDriver" %>

<%
    // 获取表单数据
    String projectName = request.getParameter("projectName");
    String[] ranges = request.getParameterValues("range");
    String purpose = request.getParameter("purpose");
    String[] immediatePurposes = request.getParameterValues("immediatePurpose");
    String[] achievementPurposes = request.getParameterValues("achievementPurpose");
    String[] otherPurposes = request.getParameterValues("otherPurpose");
    String techDetails = request.getParameter("techDetails");
    int numCheckPoints = Integer.parseInt(request.getParameter("numCheckPoints"));
    String[] checkPoint = request.getParameterValues("checkPoint");
    String[] searchTerms = request.getParameterValues("searchTerm");
    String completionTime = request.getParameter("completionTime");
    String discipline = request.getParameter("discipline");
    String industry = request.getParameter("industry");
    String remarks = request.getParameter("remarks");
    System.out.println(projectName);
    System.out.println(ranges);
    System.out.println(purpose);
    System.out.println(techDetails);
    System.out.println(remarks);

    // 构建插入SQL语句
    String sql = "INSERT INTO chaxun (projectName, ranges, purpose, immediatePurposes, achievementPurposes, otherPurposes, techDetails, numCheckPoints, checkPoint1, searchTerms, completionTime, discipline, industry, remarks) VALUES (?,  ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";

    Connection conn = null;
    PreparedStatement pstmt = null;

    try {
        // 加载Hive JDBC驱动
        Class.forName("org.apache.hive.jdbc.HiveDriver");

        // 创建数据库连接
        String url = "jdbc:hive2://node1:10000/default";
        String user = "hadoop";
        String password = "";
        conn = DriverManager.getConnection(url, user, password);

        // 创建PreparedStatement
        pstmt = conn.prepareStatement(sql);
        pstmt.setString(1, projectName);
        pstmt.setString(2, String.join(",", ranges));
        pstmt.setString(3, purpose);
        pstmt.setString(4, immediatePurposes != null ? String.join(",", immediatePurposes) : "");
        pstmt.setString(5, achievementPurposes != null ? String.join(",", achievementPurposes) : "");
        pstmt.setString(6, otherPurposes != null ? String.join(",", otherPurposes) : "");
        pstmt.setString(7, techDetails);
        pstmt.setInt(8, numCheckPoints);
        pstmt.setString(9, checkPoint != null ? String.join(",", checkPoint) :"");
        pstmt.setString(10, String.join(",", searchTerms));
        pstmt.setString(11, completionTime);
        pstmt.setString(12, discipline);
        pstmt.setString(13, industry);
        pstmt.setString(14, remarks);

        // 执行插入操作
        pstmt.executeUpdate();

        System.out.println("成功");
    } catch (Exception e) {
        e.printStackTrace();
        System.out.println("失败");
    } finally {
        // 关闭资源
        if (pstmt != null) pstmt.close();
        if (conn != null) conn.close();
    }
%>

</body>
</html>
复制代码

 

posted @   贾贾鱼  阅读(7)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
点击右上角即可分享
微信分享提示