commit
355fd97f10
@ -0,0 +1,95 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Insert title here</title>
|
||||
<link rel="stylesheet" href="../public/layui/css/layui.css" media="all">
|
||||
<script src="../public/layui/layui.js"></script>
|
||||
<style>
|
||||
.layui-form-label{
|
||||
margin-left:20%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div align="center" style=" margin-top: 2%;"><h1>查询图书是否逾期</h1></div>
|
||||
<div align="center"
|
||||
style="margin-left:30%; margin-top: 5%; width: 40%;">
|
||||
|
||||
<form class="layui-form layui-form-pane" action="04judgeSus.jsp">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">图书编号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="bookid" lay-verify="required"
|
||||
placeholder="请输入图书编号" autocomplete="off" class="layui-input"><br>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item" align="center">
|
||||
<button class="layui-btn layui-btn-warm" lay-submit="" lay-filter="demo2">查询</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<script>
|
||||
layui
|
||||
.use(
|
||||
[ 'form', 'layedit', 'laydate' ],
|
||||
function() {
|
||||
var form = layui.form, layer = layui.layer, layedit = layui.layedit, laydate = layui.laydate;
|
||||
//日期
|
||||
laydate.render({
|
||||
elem : '#date1',
|
||||
type : 'datetime',
|
||||
format : 'yyyy-M-d H:m:s',
|
||||
min:0,
|
||||
max:0,
|
||||
value: new Date()
|
||||
});
|
||||
|
||||
//创建一个编辑器
|
||||
var editIndex = layedit
|
||||
.build('LAY_demo_editor');
|
||||
|
||||
|
||||
//监听提交
|
||||
form.on('submit(demo1)', function(data) {
|
||||
layer.alert(JSON.stringify(data.field), {
|
||||
title : '最终的提交信息'
|
||||
})
|
||||
return false;
|
||||
});
|
||||
|
||||
//表单赋值
|
||||
layui.$('#LAY-component-form-setval').on(
|
||||
'click', function() {
|
||||
form.val('example', {
|
||||
"username" : "贤心" // "name": "value"
|
||||
,
|
||||
"password" : "123456",
|
||||
"interest" : 1,
|
||||
"like[write]" : true //复选框选中状态
|
||||
,
|
||||
"close" : true //开关状态
|
||||
,
|
||||
"sex" : "女",
|
||||
"desc" : "我爱 layui"
|
||||
});
|
||||
});
|
||||
|
||||
//表单取值
|
||||
layui.$('#LAY-component-form-getval').on(
|
||||
'click', function() {
|
||||
var data = form.val('example');
|
||||
alert(JSON.stringify(data));
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,80 @@
|
||||
<%@ page import="javabean.DateTime" %>
|
||||
<%@ page import="javabean.CompareDate" %>
|
||||
<%@ page import="java.sql.*" %>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Insert title here</title>
|
||||
</head>
|
||||
<body>
|
||||
<jsp:useBean id="judge" scope="session" class="javabean.JDBCBean"></jsp:useBean>
|
||||
<%
|
||||
|
||||
String book = request.getParameter("bookid");
|
||||
session.setAttribute("book", book);
|
||||
if(session.getAttribute("manager")!=null){
|
||||
DateTime date = new DateTime();
|
||||
String now = date.show();
|
||||
String bookid = request.getParameter("bookid");
|
||||
|
||||
String sql="select*from borrow_books where book_id = "+bookid;
|
||||
ResultSet rs = judge.executeQuery(sql);
|
||||
String end = "";
|
||||
String ret = "";
|
||||
String card = "";
|
||||
while (rs.next()) {
|
||||
end = rs.getString("end_date");
|
||||
ret = rs.getString("return_date");
|
||||
card = rs.getString("card_id");
|
||||
}
|
||||
if(ret==null){
|
||||
//CompareDate cd = new CompareDate();
|
||||
long n = CompareDate.show(now,end);
|
||||
//out.println(sql);
|
||||
//out.println(n);
|
||||
//out.println(end);
|
||||
//out.println(now);
|
||||
session.setAttribute("days", n);
|
||||
|
||||
String sql1="select*from borrow_card where id = "+card;
|
||||
ResultSet rs1 = judge.executeQuery(sql1);
|
||||
String rule = "";
|
||||
while (rs1.next()) {
|
||||
rule = rs1.getString("rule_id");
|
||||
}
|
||||
|
||||
String sql2="select*from rules where id = "+rule;
|
||||
ResultSet rs2 = judge.executeQuery(sql2);
|
||||
String fee = "";
|
||||
while (rs2.next()) {
|
||||
fee = rs2.getString("overtime_fee");
|
||||
}
|
||||
session.setAttribute("fee", fee);
|
||||
%>
|
||||
<script>
|
||||
window.location.href = "04return.jsp";
|
||||
</script>
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
<script>
|
||||
alert("该书未借出或不存在!");
|
||||
window.location.href = "04judge.jsp";
|
||||
</script>
|
||||
<%
|
||||
}
|
||||
}else{
|
||||
%>
|
||||
<script>
|
||||
alert('请先登录!');
|
||||
window.parent.location.href = "../loginManager.html";
|
||||
</script>
|
||||
<%
|
||||
}
|
||||
|
||||
%>
|
||||
</body>
|
||||
</html>
|
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,25 @@
|
||||
package javabean;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class CompareDate {
|
||||
public static long show(String Str1, String Str2) {
|
||||
long between = 0;
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
try {
|
||||
Date date1 = format.parse(Str1);
|
||||
Date date2 = format.parse(Str2);
|
||||
between = (date2.getTime() - date1.getTime());
|
||||
System.out.println(date1);
|
||||
System.out.println(date2);
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
long days = between / (24 * 60 * 60 * 1000);
|
||||
return days;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue