Ecology-Dev-chaofa/昆山鸿仕达/interface/hsd/kqyc.jsp

137 lines
5.2 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@page import="weaver.general.Util"%>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.*" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rs1" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="rst" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="bb" class="weaver.general.BaseBean" />
<%
int sum = 0;
String resourceId = Util.null2String(request.getParameter("userid"));
String date = Util.null2String(request.getParameter("date"));
String lastdate = addDateDay(date,-1);
Set<String> userIdList = new HashSet<>();
rs.executeQuery("select * from hrmresource where status < 4 and id=? ", resourceId);
while(rs.next()){
String userid = Util.null2String(rs.getString("id"));
String result = getKqInfo(userid,lastdate);
//有异常
if(!"".equals(result)){
userIdList.add(userid);
}
}
String a = "";
for(String userid : userIdList){
a += userid + ",";
}
%>
<%!
public static String getKqInfo(String userid,String date){
String text = "";
RecordSet rs = new RecordSet();
try {
String sql = " select resourceid, kqdate, workMins, belatemins, graveBeLateMins, leaveearlymins, graveLeaveEarlyMins, absenteeismmins, forgotcheckMins, forgotBeginWorkCheckMins, "+
" leaveMins,leaveInfo,evectionMins,outMins " +
" from kq_format_detail " +
" where resourceid = ? and kqdate>=? and kqdate<=? "+
" order by resourceid, kqdate, serialnumber ";
rs.executeQuery(sql,userid, date, date);
while (rs.next()) {
int workMins = Util.getIntValue(rs.getString("workMins"),0);
int beLateMins = Util.getIntValue(rs.getString("beLateMins"),0);
int leaveEarlyMins = Util.getIntValue(rs.getString("leaveEarlyMins"),0);
int graveBeLateMins = Util.getIntValue(rs.getString("graveBeLateMins"),0);
int absenteeismMins = Util.getIntValue(rs.getString("absenteeismMins"),0);
int graveLeaveEarlyMins = Util.getIntValue(rs.getString("graveLeaveEarlyMins"),0);
int forgotCheckMins = Util.getIntValue(rs.getString("forgotCheckMins"),0);
int forgotBeginWorkCheckMins = Util.getIntValue(rs.getString("forgotBeginWorkCheckMins"),0);
if (workMins <= 0) {
if (text.length() > 0) text += " ";
text += "";
} else {
if (absenteeismMins > 0) {//旷工
if (text.length() > 0) text += " ";
text += "absentee";
} else {
if (beLateMins > 0) {//迟到
if (text.length() > 0) text += " ";
text += "beLate";
}
if (graveBeLateMins > 0) {//严重迟到
if (text.length() > 0) text += " ";
text += "graveBeLate";
}
if (leaveEarlyMins > 0) {//早退
if (text.length() > 0) text += " ";
text += "leaveEarly";
}
if (graveLeaveEarlyMins > 0) {//严重早退
if (text.length() > 0) text += " ";
text += "graveLeaveEarly";
}
if (forgotCheckMins > 0) {//漏签
if (text.length() > 0) text += " ";
text += "forgotCheck";
}
if (forgotBeginWorkCheckMins > 0) {//漏签
if (text.length() > 0) text += " ";
text += "forgotBeginWorkCheck";
}
}
}
}
}catch(Exception e){
e.printStackTrace();
rs.writeLog("========== remind kq info error ========== "+ e);
}
return text;
}
/**
* 对时间的天数进行加减
* @param daytime 时间的格式yyyy-MM-dd
* @param day 天数 -1则代表减一天
* @return
*/
public static String addDateDay(String daytime, int day){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date date = null;
try {
date = format.parse(daytime);
if (date == null){
return "";
}
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DAY_OF_MONTH, day);// 加一天
date = cal.getTime();
cal = null;
return format.format(date);
} catch (Exception ex) {
ex.printStackTrace();
}
return "";
}
%>
<HEAD>
</HEAD>
<BODY>
<h1>Congratulation Mode 666666 !</h1>
<h2> 有么 <%=a%></h2>
</BODY>