大作业开发进度4

新增

  • 形式审核
  • 部门审核

代码

形式审核

  • 形式审核servlet
package web;

import dao.DCWJXXDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

@WebServlet("/xsshShenhe")
public class xsshShenhe extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        String result = request.getParameter("result");
        String id = request.getParameter("id");
        DCWJXXDao dao = new DCWJXXDao();
        try {
            if (result.equals("同意")){
                dao.agreeWj(id,1);
            }else if (request.equals("不同意")){
                String reason = request.getParameter("reason");
                dao.disAgreeWj(id,2,reason);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        response.sendRedirect(request.getContextPath() + "/XsshGetAllWshWj");
    }
}

  • 形式审核展示前servlet
package web;

import dao.DCWJXXDao;
import domain.DCWJXX;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

@WebServlet("/xsshTableUI")
public class xsshTableUI extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        String id = request.getParameter("id");
        DCWJXXDao dao = new DCWJXXDao();
        DCWJXX dcwjxx = null;
        try {
            dcwjxx = dao.queryWjByid(id);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        request.setAttribute("wj",dcwjxx);
        request.getRequestDispatcher("/templete/xsshTable.jsp").forward(request,response);
    }
}

  • 形式审核页面
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 79413
  Date: 2020/10/22
  Time: 20:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Title</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery,所以必须放在前边) -->
    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
    <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container-fluid">

    <table class="table table-bordered table-hover" style="font-size: medium">

        <tr align="center">
            <td colspan="4"><h2>河北重大科技需求征集表</h2></td>
        </tr>

        <tr align="center">
            <td width="100px">机构全称</td>
            <td width="200px">${wj.JGMC}</td>
            <td width="100px">归口管理部门</td>
            <td width="200px">${wj.GKGLBM}</td>
        </tr>

        <tr align="center">
            <td width="100px">通讯地址</td>
            <td width="200px">${wj.TXDZ}</td>
            <td width="100px">所在地域</td>
            <td width="200px">${wj.SZDY}</td>
        </tr>

        <tr align="center">
            <td width="100px">网址</td>
            <td width="200px">${wj.DWWZ}</td>
            <td width="100px">电子信箱</td>
            <td width="200px">${wj.DZYX}</td>
        </tr>

        <tr align="center">
            <td width="100px">法人代表</td>
            <td width="200px">${wj.FRDB}</td>
            <td width="100px">邮政编码</td>
            <td width="200px">${wj.YZBM}</td>
        </tr>

        <tr align="center">
            <td width="100px">联系人</td>
            <td width="200px">${wj.LXR}</td>
            <td width="100px">固定电话</td>
            <td width="200px">${wj.GDDH}</td>
        </tr>


        <tr align="center">
            <td width="100px">手 机</td>
            <td width="200px">${wj.YDDH}</td>
            <td width="100px">传 真</td>
            <td width="200px">${wj.CZ}</td>
        </tr>

        <tr align="center">
            <td width="100px">机构属性</td>
            <td width="200px" COLSPAN="3">${wj.JGSX}</td>
        </tr>

        <tr align="center" >
            <td width="100px">机构简介</td>
            <td width="200px" COLSPAN="3">${wj.JGJJ}</td>
        </tr>


        <tr align="center">
            <td width="100px">技术需求名称</td>
            <td width="200px">${wj.JSXQMC}</td>
            <td width="100px">需求时限</td>
            <td width="200px">${wj.QSXQNF}年 至 ${wj.JZXQNF}年</td>
        </tr>


        <tr align="center">
            <td rowspan="4"><h4>技术需求概述</h4></td>

            <tr align="center" >
                <td width="100px">主要问题</td>
                <td width="200px" COLSPAN="2">${wj.ZYWT}</td>
            </tr>

            <tr align="center" >
                <td width="100px">技术关键</td>
                <td width="200px" COLSPAN="2">${wj.JSGJ}</td>
            </tr>

            <tr align="center" >
                <td width="100px">预期目标</td>
                <td width="200px" COLSPAN="2">${wj.YQMB}</td>
            </tr>

        </tr>


        <tr align="center" >
            <td width="100px">关键字</td>
            <td width="200px" COLSPAN="3">
                ${wj.GJZ1} ${wj.GJZ2} ${wj.GJZ3} ${wj.GJZ4} ${wj.GJZ5}
            </td>
        </tr>

        <tr align="center" >
            <td width="100px">拟投入资金总额</td>
            <td width="200px" COLSPAN="3">${wj.TRZJZE}</td>
        </tr>


        <tr align="center" >
            <td width="100px">技术需求解决方式</td>
            <td width="200px" COLSPAN="3">
                ${wj.JSXQHZMS}
                <c:if test="${not empty wj.HZYXDW}">
                (合作意向单位:${wj.HZYXDW})
                </c:if>
            </td>
        </tr>

        <tr align="center" >
            <td width="100px">科技活动类型</td>
            <td width="200px" COLSPAN="3">${wj.YJLX}</td>
        </tr>

        <c:if test="${wj.YJLX == '基础研究'}">
            <tr align="center" >
                <td width="100px">学科分类</td>
                <td width="200px" COLSPAN="3">${wj.XKFL}</td>
            </tr>
        </c:if>

        <c:if test="${wj.YJLX != '基础研究'}">
            <tr align="center" >
                <td width="100px">需求技术所属领域</td>
                <td width="200px" COLSPAN="3">${wj.XQJSSSLY}</td>
            </tr>

            <tr align="center" >
                <td width="100px">需求技术应用行业</td>
                <td width="200px" COLSPAN="3">${wj.XQJSYYHY}</td>
            </tr>

        </c:if>

        <tr align="center">

            <td colspan="2">
                <button class="btn btn-success" onclick="shenhe('同意')">同意</button>
            </td>
            <td colspan="2">
                <button class="btn btn-danger" onclick="shenhe('不同意')">不同意</button>
            </td>

        </tr>


    </table>


</div>


<script>
    function shenhe(option) {

        if (option == "同意"){
            window.location.href="${pageContext.request.contextPath}/xsshShenhe?id=${wj.WJID}&result=同意"
        }else if (option == "不同意"){
            var qd = prompt("请输入审核理由:");
            if (qd){
                window.location.href="${pageContext.request.contextPath}/xsshShenhe?id=${wj.WJID}&result=同意&reason=" + qd;
            }
        }


    }
</script>

</body>
</html>

部门审核大致与形式审核相同,只是修改的状态不同
//0 未审核 1 通过形式审核 2 未通过形式审核 3 通过部门审核 4 未通过部门审核

明日计划

  • 完成分类查询
  • 完成综合查询
原文地址:https://www.cnblogs.com/wuren-best/p/13861058.html