Ecology-Dev-chaofa/上海港湾/interface/geoh/dealSerialHistory.jsp

74 lines
2.6 KiB
Plaintext

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.hrm.*" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.general.TimeUtil" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.util.Calendar" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rst" class="weaver.conn.RecordSet" scope="page" />
<%
JSONObject jsonObject = new JSONObject();
boolean flagg = false;
User user = HrmUserVarify.getUser(request,response);
int userid = user.getUID();
//系统管理员
if(userid == 1){
flagg = false;
}else {
String currentdate = TimeUtil.getCurrentDateString();
String currenttime = TimeUtil.getOnlyCurrentTimeString();
rs.executeQuery("select * from uf_pbymfwjlb where ry = ? and fwrq = ? ", userid, currentdate);
while (rs.next()) {
int mxid = Util.getIntValue(rs.getString("id"));
int ry = Util.getIntValue(rs.getString("ry"));
String fwsj = Util.null2String(rs.getString("fwsj"));
String sxsj = Util.null2String(rs.getString("sxsj"));
// 当前时间 在 已有访问时间 和 超时的时间 范围内
if (belongCalendar(currenttime, fwsj, sxsj)) {
flagg = rst.executeUpdate(" delete from uf_pbymfwjlb where ry=? and id=? ",ry,mxid);
}
}
}
jsonObject.put("flag",flagg);
out.print(JSONObject.toJSONString(jsonObject));
%>
<%!
/**
* 判断一个时间是否在一个时间段内
*
* @param nowtime 当前时间
* @param begintime 开始时间
* @param endtime 结束时间
*/
public static boolean belongCalendar(String nowtime, String begintime, String endtime) {
boolean b = false;
SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
try {
Date nowTime = format.parse(nowtime);
Calendar date = Calendar.getInstance();
date.setTime(nowTime);
Date beginTime = format.parse(begintime);
Calendar begin = Calendar.getInstance();
begin.setTime(beginTime);
Date endTime = format.parse(endtime);
Calendar end = Calendar.getInstance();
end.setTime(endTime);
if (date.after(begin) && date.before(end)) {//在时间段内
b = true;
}
}catch (Exception e){
e.printStackTrace();
}
return b;
}
%>