基于javaweb+mysql的jsp+servlet校园疫情防控管理信息系统疫情播报系统(java+servlet+jsp+bootstrap+mysql+css)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的JSP+Servlet校园疫情防控管理信息系统疫情播报系统(java+servlet+jsp+bootstrap+mysql+css)
管理员:
admin 123456
学生:
student1 123456
student2 123456
教师:
teacher1 123456
teacher2 123456
校园疫情防控管理信息系统
项目简介:
校园疫情防控管理信息系统分为前台部分和后台部分,面向学校的学生和老师,旨在为学校提供一个有效防控校园出现疫情的综合性平台。
本管理系统将通过健康打卡的功能实现后台管理系统对师生身体状况数据的收集。
有了此系统,大大方便了学校疫情的防控工作,加大了学校疫情防控的力度,提高学校疫情防控的效率,尽最大地可能避免学校出现新冠肺炎疫情。
借助此系统学校能更好地做好疫情防控措施。
采用技术 :
前端:HTML + CSS + JavaScript + Bootstrap + Jquery + Ajax
后端:Spring Boot + Jpa + Maven + Schedule定时任务 + Redis + Security + POI
开发环境 :
工具:IDEA、Navicat、Git
环境:JDK 1.8、Tomcat 7.0、Mysql 8.0
项目管理:Maven
代码托管平台:GitHub
开发流程:
1、数据库设计
2、Model:模型定义,与数据库相匹配
3、Dao层:数据操作
4、Service:服务包装
5、Controller:业务入口,数据交互
6、Util:工具类封装
7、Config:配置类封装
8、单元测试
功能模块:
前台部分,主要分为以下几个模块:
个人信息管理
学生和老师登录
学生和老师修改密码
数据显示
学校疫情各情况数据的统计显示
疫情各情况饼状图占比分析
学生和教师各情况统计柱形图显示
各学院学生的各情况统计表格显示
各学院教师的各情况统计表格显示
打卡操作
学生每天打卡
教师每天打卡
疫情新闻显示
最新疫情新闻播报浏览
查看疫情新闻详情
后台部分,主要分为以下几个模块:
学生管理
查询学生
添加学生
修改学生
删除学生
教师管理
查询教师
添加教师
修改教师
删除教师
打卡信息管理
查询打卡信息
添加打卡信息
修改打卡信息
删除打卡信息
分析打卡信息
统计打卡信息
新闻管理
查询新闻
发布新闻
删除新闻
int start = (currentPage1 - 1) * rows1;
sql = "select s.sname,sp.* from student s,stupunchin sp where s.sno = sp.sno and sp.spunchdate like ? and sp.sno = ? limit ?, ?";
Object[] objects1 = {spunchdate1, sno, start, rows1};
ResultSet resultSet = StuDao.QureyInfoByPage(sql, objects1);
ArrayList stuPunchArrayList = new ArrayList();
try {
while (resultSet.next()){
StuPunch stuPunch = new StuPunch();
stuPunch.setSname(resultSet.getString("sname"));
stuPunch.setSispunch(resultSet.getString("sispunch"));
stuPunch.setSpunchdate(resultSet.getDate("spunchdate"));
stuPunch.setSpunchtime(resultSet.getString("spunchtime"));
stuPunch.setSishot(resultSet.getString("sishot"));
stuPunch.setSiscough(resultSet.getString("siscough"));
stuPunch.setSisseem(resultSet.getString("sisseem"));
stuPunch.setSisdiagnose(resultSet.getString("sisdiagnose"));
stuPunch.setSstatus(resultSet.getString("sstatus"));
stuPunchArrayList.add(stuPunch);
}
} catch (Exception e) {
e.printStackTrace();
}finally {
JDBCUtils.close(resultSet);
}
pageBean.setArrayList(stuPunchArrayList);
System.out.println(stuPunchArrayList);
System.out.println(pageBean);
req.setAttribute("pageBean", pageBean);
req.getRequestDispatcher("/view/stu/stupunchinfo.jsp").forward(req, resp);
}else {
req.getRequestDispatcher("/view/alluse/nodata.jsp").forward(req, resp);
}
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
//如果传入的参数为null,则置为空字符串
if (sname == null){
sname = "";
}
if (sclass == null){
sclass = "";
}
if (sdept == null){
sdept = "";
}
//变为like查询所需的字符串参数
String sname1 = "%" + sname + "%";
String sclass1 = "%" + sclass + "%";
String sdept1 = "%" + sdept + "%";
//设置请求的属性参数,后面需要用
req.setAttribute("sname",sname);
req.setAttribute("sclass", sclass);
req.setAttribute("sdept",sdept);
System.out.println(sname1);
System.out.println(sclass1);
System.out.println(sdept1);
//获取登录时的session会话对象
HttpSession session = req.getSession();
// String userName = (String) session.getAttribute("userName");
// String sno = (String) session.getAttribute("sno");
String belong = (String) session.getAttribute("belong");
String sql = null;
// System.out.println(userName);
// System.out.println(sno);
System.out.println(belong);
System.out.println("hdghghjg");
String currentPage = req.getParameter("currentPage");//从请求对象中获取当前页码
String rows = req.getParameter("rows");//从请求获取对象中每页显示的行数
//如果未设请求参数,此处自动设置参数为第一页
if (currentPage == null || "".equals(currentPage)){
currentPage = "1";
}
//如果没有设置rows的请求参数,此处自动设置
if (rows == null || "".equals(rows)){
rows = "7";
}
//变为like查询所需的字符串参数
String sname1 = "%" + sname + "%";
String sclass1 = "%" + sclass + "%";
String sdept1 = "%" + sdept + "%";
String spunchdate1 = "%" + spunchdate + "%";
//设置请求的属性参数,后面需要用
req.setAttribute("sname",sname);
req.setAttribute("sclass", sclass);
req.setAttribute("sdept", sdept);
req.setAttribute("spunchdate",spunchdate);
System.out.println(sname1);
System.out.println(sclass1);
System.out.println(sdept1);
System.out.println(spunchdate1);
//获取登录时的session会话对象
HttpSession session = req.getSession();
// String userName = (String) session.getAttribute("userName");
// String sno = (String) session.getAttribute("sno");
String belong = (String) session.getAttribute("belong");
String sql = null;
// System.out.println(userName);
// System.out.println(sno);
System.out.println(belong);
System.out.println("hdghghjg");
String currentPage = req.getParameter("currentPage");//从请求对象中获取当前页码
String rows = req.getParameter("rows");//从请求获取对象中每页显示的行数
//如果未设请求参数,此处自动设置参数为第一页
if (currentPage == null || "".equals(currentPage)){
currentPage = "1";
}
// String userName = (String) session.getAttribute("userName");
// String sno = (String) session.getAttribute("sno");
String belong = (String) session.getAttribute("belong");
String sql = null;
// System.out.println(userName);
// System.out.println(sno);
System.out.println(belong);
System.out.println("hdghghjg");
String currentPage = req.getParameter("currentPage");//从请求对象中获取当前页码
String rows = req.getParameter("rows");//从请求获取对象中每页显示的行数
//如果未设请求参数,此处自动设置参数为第一页
if (currentPage == null || "".equals(currentPage)){
currentPage = "1";
}
//如果没有设置rows的请求参数,此处自动设置
if (rows == null || "".equals(rows)){
rows = "7";
}
//获取条件查询的参数
int currentPage1 = Integer.parseInt(currentPage);
int rows1 = Integer.parseInt(rows);
//如果当前页数小于1,则设置当前页数为1
if (currentPage1 <= 0){
currentPage1 = 1;
}
//设置StuPunch类的对象类型
PageBean<Teacher> pageBean = new PageBean<Teacher>();
//设置当前页码
pageBean.setCurrentPage(currentPage1);
//设置每页的记录数
pageBean.setRows(rows1);
sql = " select count(*) as num from teacher where tno like ? and tname like ? and tdept like ?";
Object[] objects = {tno1, tname1, tdept1};
//计算总记录数,并设置
int totalCount = DeptAdminDao.findTotalCount(sql, objects);
System.out.println(totalCount);
pageBean.setTotalCount(totalCount);
System.out.println(num);
}else {//已打卡
}
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
}
}
@WebServlet("/DeptQueryTeaPunchByIdServlet")
public class DeptQueryTeaPunchByIdServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
resp.setCharacterEncoding("utf-8");
resp.setContentType("text/html;charset=utf-8");
//获取请求参数
String tno = req.getParameter("tno");
String tpunchdate = req.getParameter("tpunchdate");
sql = " select count(*) as num from student where sname like ? and sclass like ? and sdept like ?";
Object[] objects = {sname1, sclass1, sdept1};
//计算总记录数,并设置
int totalCount = DeptAdminDao.findTotalCount(sql, objects);
System.out.println(totalCount);
pageBean.setTotalCount(totalCount);
if (totalCount > 0){
//计算总页码,并设置
int totalPage = (totalCount % rows1) == 0 ? totalCount/rows1 : (totalCount/rows1 + 1);
pageBean.setTotalPage(totalPage);
//如果当前页数大于总页数
if (currentPage1 > pageBean.getTotalPage()){
currentPage1 = pageBean.getTotalPage();
//重新设置当前页码
pageBean.setCurrentPage(currentPage1);
}
//计算开始的记录和list对象集合,并设置
int start = (currentPage1 - 1) * rows1;
sql = "select * from student where sname like ? and sclass like ? and sdept like ? limit ?, ?";
Object[] objects1 = {sname1, sclass1, sdept1, start, rows1};
ResultSet resultSet = StuDao.QureyInfoByPage(sql, objects1);
ArrayList stuArrayList = new ArrayList();
try {
while (resultSet.next()){
Student student = new Student();
student.setSno(resultSet.getString("sno"));
student.setSname(resultSet.getString("sname"));
student.setSsex(resultSet.getString("ssex"));
student.setSage(resultSet.getInt("sage"));
student.setSclass(resultSet.getString("sclass"));
student.setSpecialty(resultSet.getString("specialty"));
student.setSdept(resultSet.getString("sdept"));
student.setSphone(resultSet.getString("sphone"));
@WebServlet("/StuPunchServlet")
public class StuPunchServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
resp.setCharacterEncoding("utf-8");
resp.setContentType("text/html;charset=utf-8");
//获取sno
HttpSession session = req.getSession();
String sno = (String) session.getAttribute("sno");
System.out.println(sno);
//获取表单请求的参数
/*String sno = req.getParameter("sno");*/
String sishot = req.getParameter("sishot");
String siscough = req.getParameter("siscough");
String sisseem = req.getParameter("sisseem");
String sisdiagnose = req.getParameter("sisdiagnose");
String sstatus = req.getParameter("sstatus");
String sispunch = "是";
Date date = new Date();
//获取当前日期
SimpleDateFormat sf1 = new SimpleDateFormat("yyyy-MM-dd");
String spunchdate = sf1.format(date);
System.out.println(spunchdate);
//获取当前时间
SimpleDateFormat sf2 = new SimpleDateFormat("HH:mm");
String spunchtime = sf2.format(date);
System.out.println(spunchtime);
String sql = null;
//查询是否已经打卡
sql = "select count(*) as num from stupunchin where sno = ? and spunchdate = ?";
Object[] objects1 = {sno, spunchdate};
int count = FrontWebDao.findTotalCount(sql, objects1);
if (count == 0){//无则操作
sql = "insert into stupunchin values(?, ?, ?, ?, ?, ?, ?, ?, ?)";
Object[] objects2 = {sno, sispunch, spunchdate, spunchtime, sishot, siscough, sisseem, sisdiagnose, sstatus};
//设置请求的属性参数,后面需要用
req.setAttribute("tno", tno);
req.setAttribute("tname",tname);
req.setAttribute("tdept", tdept);
req.setAttribute("tpunchdate",tpunchdate);
System.out.println(tno1);
System.out.println(tname1);
System.out.println(tdept1);
System.out.println(tpunchdate1);
//获取登录时的session会话对象
HttpSession session = req.getSession();
// String userName = (String) session.getAttribute("userName");
// String sno = (String) session.getAttribute("sno");
String belong = (String) session.getAttribute("belong");
String sql = null;
// System.out.println(userName);
// System.out.println(sno);
System.out.println(belong);
System.out.println("hdghghjg");
String currentPage = req.getParameter("currentPage");//从请求对象中获取当前页码
String rows = req.getParameter("rows");//从请求获取对象中每页显示的行数
//如果未设请求参数,此处自动设置参数为第一页
if (currentPage == null || "".equals(currentPage)){
currentPage = "1";
}
//如果没有设置rows的请求参数,此处自动设置
if (rows == null || "".equals(rows)){
rows = "7";
}
//获取条件查询的参数
int currentPage1 = Integer.parseInt(currentPage);
int rows1 = Integer.parseInt(rows);
//如果当前页数小于1,则设置当前页数为1
// resp.sendRedirect(req.getContextPath() + "/view/guide/mainview_guide.jsp");
}else {
System.out.println("用户名或密码错误!请重新登录!");
//返回登录成功的信息
req.setAttribute("httpUrl","/view/login/login.jsp");
req.setAttribute("info", "登录失败!用户名或密码错误!即将跳转至登录页面!");
req.setAttribute("title","登录失败");
req.getRequestDispatcher("/view/alluse/info.jsp").forward(req, resp);
}
}else {//如果是管理员
boolean flag = false;
String sql = "select * from admin where adname = ? and adpsw = ? and belong = ?";
Object[] objects = {userName, psw, identity};
ResultSet resultSet = SchoAdminDao.login(sql, objects);
// String belong = null;
try {
if (resultSet.next()){
flag = true;
// belong = resultSet.getString("belong");
}
} catch (Exception e) {
e.printStackTrace();
}finally {
JdbcUtils.close(resultSet);
}
if (flag){
if (identity.equals("学校")){//学校管理员
System.out.println("登录成功!");
HttpSession session = req.getSession();
// 创建会话属性对象,处理请求要用
session.setAttribute("belong", identity);
System.out.println(identity);
// session.setAttribute("belong", belong);
// System.out.println(belong);
req.setAttribute("httpUrl","/view/schoadmin/schomainview.jsp");
req.setAttribute("info", "登录成功!即将跳转至后台首页!");
req.setAttribute("title","登录成功");
req.getRequestDispatcher("/view/alluse/info.jsp").forward(req, resp);
}else {//二级学院管理员
System.out.println("登录成功!");
//创建会话,处理请求要用
HttpSession session = req.getSession();
// 创建请求属性对象,处理请求要用
session.setAttribute("belong", identity);
System.out.println(identity);
req.setAttribute("httpUrl","/view/deptadmin/deptmainview.jsp");
req.setAttribute("info", "登录成功!即将跳转至后台首页!");
req.setAttribute("title","登录成功");
String sql = null;
// System.out.println(userName);
// System.out.println(sno);
System.out.println(belong);
System.out.println("hdghghjg");
String currentPage = req.getParameter("currentPage");//从请求对象中获取当前页码
String rows = req.getParameter("rows");//从请求获取对象中每页显示的行数
//如果未设请求参数,此处自动设置参数为第一页
if (currentPage == null || "".equals(currentPage)){
currentPage = "1";
}
//如果没有设置rows的请求参数,此处自动设置
if (rows == null || "".equals(rows)){
rows = "7";
}
//获取条件查询的参数
int currentPage1 = Integer.parseInt(currentPage);
int rows1 = Integer.parseInt(rows);
//如果当前页数小于1,则设置当前页数为1
if (currentPage1 <= 0){
currentPage1 = 1;
}
//设置StuPunch类的对象类型
PageBean<Student> pageBean = new PageBean<Student>();
//设置当前页码
pageBean.setCurrentPage(currentPage1);
//设置每页的记录数
pageBean.setRows(rows1);
sql = " select count(*) as num from student where sname like ? and sclass like ? and specialty like ? and sdept = ?";
Object[] objects = {sname1, sclass1, specialty1, belong};
/*sql = " select count(*) as num from student where sdept = ?";
Object[] objects = {belong};*/
if (currentPage1 <= 0){
currentPage1 = 1;
}
//设置StuPunch类的对象类型
PageBean<StuPunch> pageBean = new PageBean<StuPunch>();
//设置当前页码
pageBean.setCurrentPage(currentPage1);
//设置每页的记录数
pageBean.setRows(rows1);
sql = " select count(*) as num from student s,stupunchin sp where s.sno = sp.sno and sp.spunchdate like ? and s.sno = ?";
Object[] objects = {spunchdate1, sno};
//计算总记录数,并设置
int totalCount = StuDao.findTotalCount(sql, objects);
System.out.println(totalCount);
pageBean.setTotalCount(totalCount);
if (totalCount > 0){
//计算总页码,并设置
int totalPage = (totalCount % rows1) == 0 ? totalCount/rows1 : (totalCount/rows1 + 1);
pageBean.setTotalPage(totalPage);
//如果当前页数大于总页数
if (currentPage1 > pageBean.getTotalPage()){
currentPage1 = pageBean.getTotalPage();
//重新设置当前页码
pageBean.setCurrentPage(currentPage1);
}
//计算开始的记录和list对象集合,并设置
int start = (currentPage1 - 1) * rows1;
sql = "select s.sname,sp.* from student s,stupunchin sp where s.sno = sp.sno and sp.spunchdate like ? and sp.sno = ? limit ?, ?";
Object[] objects1 = {spunchdate1, sno, start, rows1};
ResultSet resultSet = StuDao.QureyInfoByPage(sql, objects1);
ArrayList stuPunchArrayList = new ArrayList();
System.out.println(belong);
String sql = null;
Object[] objects = {tno, tpunchdate};
//查询是否存在此人
sql = "select count(*) as num from teacher t,teapunchin tp where t.tno = tp.tno and tp.tno = ? and tp.tpunchdate = ?";
int count = DeptAdminDao.findTotalCount(sql, objects);
if (count > 0){ //有则继续操作
sql = "select t.tname,tp.* from teacher t,teapunchin tp where t.tno = tp.tno and tp.tno = ? and tp.tpunchdate = ?";
ResultSet resultSet = DeptAdminDao.qureyInfo(sql, objects);
TeaPunch teaPunch = new TeaPunch();
try {
while (resultSet.next()){
teaPunch.setTno(resultSet.getString("tno"));
teaPunch.setTname(resultSet.getString("tname"));
teaPunch.setTispunch(resultSet.getString("tispunch"));
teaPunch.setTpunchdate(resultSet.getDate("tpunchdate"));
teaPunch.setTpunchtime(resultSet.getString("tpunchtime"));
teaPunch.setTishot(resultSet.getString("tishot"));
teaPunch.setTiscough(resultSet.getString("tiscough"));
teaPunch.setTisseem(resultSet.getString("tisseem"));
teaPunch.setTisdiagnose(resultSet.getString("tisdiagnose"));
teaPunch.setTstatus(resultSet.getString("tstatus"));
}
} catch (Exception e) {
e.printStackTrace();
}finally {
JDBCUtils.close(resultSet);
}
System.out.println(teaPunch.getTno());
System.out.println(teaPunch.getTname());
req.setAttribute("teaPunch", teaPunch);
req.getRequestDispatcher("/view/schoadmin/alterteapunch.jsp").forward(req, resp);
}else {
req.getRequestDispatcher("/view/alluse/noexistdataofalter.jsp").forward(req, resp);
}
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
}
}
@WebServlet("/DeptQueryTeaPunchByPageServlet")
public class DeptQueryTeaPunchByPageServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
resp.setCharacterEncoding("utf-8");
resp.setContentType("text/html;charset=utf-8");
//获取请求参数
String tno = req.getParameter("tno");
String tname = req.getParameter("tname");
String tpunchdate = req.getParameter("tpunchdate");
System.out.println(tno);
System.out.println(tname);
System.out.println(tpunchdate);
//如果传入的参数为null,则置为空字符串
if (tno == null){
tno = "";
}
if (tname == null){
tname = "";
}
if (tpunchdate == null){
tpunchdate = "";
}
//变为like查询所需的字符串参数
String tno1 = "%" + tno + "%";
String tname1 = "%" + tname + "%";
String tpunchdate1 = "%" + tpunchdate + "%";
//设置请求的属性参数,后面需要用
req.setAttribute("tno", tno);
req.setAttribute("tname",tname);
req.setAttribute("tpunchdate",tpunchdate);
System.out.println(tno1);
System.out.println(tname1);
System.out.println(tpunchdate1);
//获取登录时的session会话对象
HttpSession session = req.getSession();
renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
renderer.setBaseItemLabelsVisible(true);
renderer.setBaseItemLabelFont(new Font("宋体", Font.BOLD, 15));
// 图形设置标题文字
TextTitle textTitle = chart1.getTitle();
textTitle.setFont(new Font("宋体", Font.BOLD, 20));
// 设置图形X轴坐标文字
CategoryPlot plot = (CategoryPlot) chart1.getPlot();
CategoryAxis axis = plot.getDomainAxis();
axis.setLabelFont(new Font("宋体", Font.BOLD, 22)); // 设置X轴坐标上标题的文字
axis.setTickLabelFont(new Font("宋体", Font.BOLD, 15)); // 设置X轴坐标上的文字
// 设置图形Y轴坐标文字
ValueAxis valueAxis = plot.getRangeAxis();
valueAxis.setLabelFont(new Font("宋体", Font.BOLD, 12)); // 设置Y轴坐标上标题的文字
valueAxis.setTickLabelFont(new Font("sans-serif", Font.BOLD, 12));// 设置Y轴坐标上的文字
// 设置提示内容的文字
chart1.getLegend().setItemFont(new Font("宋体", Font.BOLD, 15));*/
// 设置抗锯齿,防止字体显示不清楚
ChartUtils.setAntiAlias(chart1);// 抗锯齿
// 对柱子进行渲染
ChartUtils.setBarRenderer(chart1.getCategoryPlot(), false);//
// 对其他部分进行渲染
ChartUtils.setXAixs(chart1.getCategoryPlot());// X坐标轴渲染
ChartUtils.setYAixs(chart1.getCategoryPlot());// Y坐标轴渲染
// 设置标注无边框
chart1.getLegend().setFrame(new BlockBorder(Color.WHITE));
//无背景色
chart1.setBackgroundPaint(null);
String filename1 = ServletUtilities.saveChartAsPNG(chart1, 500, 300, null, session);
String graphUrl1 = req.getContextPath() + "/DisplayChart?filename=" + filename1;
req.setAttribute("graphUrl1", graphUrl1);
String[] depts = {"数科院", "化学化工学院", "生命与科学学院", "商学院", "体育科学学院", "美术与设计学院",
"音乐与舞蹈学院", "创新创业教育学院"};
//学生表格处理
ArrayList<WebStu> webStuArrayList = new ArrayList<WebStu>();
System.out.println(depts.length);
for (int i = 0; i < depts.length; i++) {
WebStu webStu = new WebStu();
String dept = depts[i];
webStu.setSdept(dept);
sql = "select count(*) as num from student s, stupunchin sp where s.sno = sp.sno and s.sdept= ? and sp.sishot = ?";
Object[] obj2 = {dept, "是"};
int tbStuHotNum = FrontWebDao.findTotalCount(sql, obj2);
webStu.setSishotNum(tbStuHotNum);
teaPunch.setTispunch(resultSet.getString("tispunch"));
teaPunch.setTpunchdate(resultSet.getDate("tpunchdate"));
teaPunch.setTpunchtime(resultSet.getString("tpunchtime"));
teaPunch.setTishot(resultSet.getString("tishot"));
teaPunch.setTiscough(resultSet.getString("tiscough"));
teaPunch.setTisseem(resultSet.getString("tisseem"));
teaPunch.setTisdiagnose(resultSet.getString("tisdiagnose"));
teaPunch.setTstatus(resultSet.getString("tstatus"));
}
} catch (Exception e) {
e.printStackTrace();
}finally {
JDBCUtils.close(resultSet);
}
System.out.println(teaPunch.getTno());
System.out.println(teaPunch.getTname());
req.setAttribute("teaPunch", teaPunch);
req.getRequestDispatcher("/view/schoadmin/alterteapunch.jsp").forward(req, resp);
}else {
req.getRequestDispatcher("/view/alluse/noexistdataofalter.jsp").forward(req, resp);
}
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
}
}
@WebServlet("/DeptQueryStuPunchByIdServlet1")
public class DeptQueryStuPunchByIdServlet1 extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
System.out.println(teaPunch.getTno());
System.out.println(teaPunch.getTname());
req.setAttribute("teaPunch", teaPunch);
req.getRequestDispatcher("/view/schoadmin/alterteapunch.jsp").forward(req, resp);
}else {
req.getRequestDispatcher("/view/alluse/noexistdataofalter.jsp").forward(req, resp);
}
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
}
}
@WebServlet("/DeptQueryStuPunchByIdServlet1")
public class DeptQueryStuPunchByIdServlet1 extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
resp.setCharacterEncoding("utf-8");
resp.setContentType("text/html;charset=utf-8");
//获取请求参数
String sno = req.getParameter("sno");
String spunchdate = req.getParameter("spunchdate");
//获取登录时的session会话对象
SimpleDateFormat sf1 = new SimpleDateFormat("yyyy-MM-dd");
String spunchdate = sf1.format(date);
System.out.println(spunchdate);
//获取当前时间
SimpleDateFormat sf2 = new SimpleDateFormat("HH:mm");
String spunchtime = sf2.format(date);
System.out.println(spunchtime);
String sql = null;
//查询是否已经打卡
sql = "select count(*) as num from stupunchin where sno = ? and spunchdate = ?";
Object[] objects1 = {sno, spunchdate};
int count = FrontWebDao.findTotalCount(sql, objects1);
if (count == 0){//无则操作
sql = "insert into stupunchin values(?, ?, ?, ?, ?, ?, ?, ?, ?)";
Object[] objects2 = {sno, sispunch, spunchdate, spunchtime, sishot, siscough, sisseem, sisdiagnose, sstatus};
int num = FrontWebDao.executeUpdate(sql, objects2);
System.out.println(num);
}else {//已打卡
}
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
}
}
}
}
@WebServlet("/StuQueryPunchByPageServlet")
public class StuQueryPunchByPageServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setCharacterEncoding("utf-8");
resp.setCharacterEncoding("utf-8");
resp.setContentType("text/html;charset=utf-8");
//获取查找的参数
String spunchdate = req.getParameter("spunchdate");
if (spunchdate == null){
spunchdate = "";
}
String spunchdate1 = "%" + spunchdate + "%";
System.out.println(spunchdate1);
req.setAttribute("spunchdate", spunchdate);
//获取登录时的session会话对象
HttpSession session = req.getSession();
String userName = (String) session.getAttribute("userName");
String sno = (String) session.getAttribute("sno");