<%@ page import="weaver.general.*" %> <%@ page import="weaver.hrm.User" %> <%@ page import="weaver.hrm.HrmUserVarify" %> <%@ page import="com.alibaba.fastjson.JSONObject" %> <%@ page import="java.util.*" %> <%@ page import="weaver.systeminfo.SystemEnv" %> <%@ page import="weaver.common.DateUtil" %> <%@ page import="com.engine.kq.util.PageUidFactory" %> <%@ page import="com.cloudstore.dev.api.util.Util_TableMap" %> <%@ page import="com.engine.common.util.ParamUtil" %> <%@ page import="weaver.hrm.resource.ResourceComInfo" %> <%@ page import="com.engine.kq.service.KQMyAttendanceService" %> <%@ page import="com.engine.common.util.ServiceUtil" %> <%@ page import="com.engine.kq.service.impl.KQMyAttendanceServiceImpl" %> <%@ page language="java" contentType="text/html; charset=UTF-8" %> <% Map data = new HashMap(); User user = HrmUserVarify.getUser(request , response); Map params = ParamUtil.request2Map(request); String kqtype = Util.null2String(params.get("kqtype")); if("BELATE".equalsIgnoreCase(kqtype) || "graveBeLate".equalsIgnoreCase(kqtype)){ data = getBeLateList(params,user); data.put("api_status", true); }else{ data = getService(user).getHrmKQReportInfo(ParamUtil.request2Map(request), user); data.put("api_status", true); } JSONObject jsonObject = new JSONObject(data); %> <%=jsonObject.toJSONString() %> <%! private KQMyAttendanceService getService(User user){ return (KQMyAttendanceService) ServiceUtil.getService(KQMyAttendanceServiceImpl.class, user); } /** * 获取迟到明细列表 * * @return */ public Map getBeLateList(Map params,User user) { Map resultMap = new HashMap(); try { String nowdate = weaver.common.DateUtil.getCurrentDate(); String type = Util.null2String(params.get("type"));//是查看一年的数据还是一月的数据:1-年、2-月 String typevalue = Util.null2String(params.get("typevalue"));//指定的年份或者指定的月份 String fromDate = Util.null2String(params.get("fromDate"));//指定日期起点 String toDate = Util.null2String(params.get("toDate"));//指定日期终点 int subCompanyId = Util.getIntValue((String) params.get("subCompanyId"), 0);//指定查看的人员的所属分部 int departmentId = Util.getIntValue((String) params.get("departmentId"), 0);//指定查看的人员的所属部门 String resourceId = Util.null2String(params.get("resourceId"));//指定查看的人员ID String status = Util.null2String(params.get("status"));//? String tabKey = Util.null2String(params.get("tabKey"));//是迟到还是严重迟到:2-严重迟到、其他-迟到 /** * 若未指定查看人员,则默认为当前登录人员 */ if (resourceId.length() == 0) { resourceId = "" + user.getUID(); } /** * 获取指定日期的起点和终点 */ if (type.equals("1")) {//年 if (typevalue.length() == 0 || typevalue.length() != 4) { typevalue = weaver.common.DateUtil.getYear(); } fromDate = typevalue + "-01-01"; toDate = weaver.common.DateUtil.getLastDayOfYear(weaver.common.DateUtil.parseToDate(fromDate)); } else if (type.equals("2")) {//月 if (typevalue.length() == 0) { typevalue = weaver.common.DateUtil.getYear() + "-" + weaver.common.DateUtil.getMonth(); } fromDate = typevalue + "-01"; toDate = weaver.common.DateUtil.getLastDayOfMonthToString(DateUtil.parseToDate(fromDate)); } /**获取今天的日期*/ Calendar today = Calendar.getInstance(); String currentdate = Util.add0(today.get(Calendar.YEAR), 4) + "-" + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2); /** * 获取明细列表 */ String backFields = " a.id, b.resourceid,a.departmentid, a.lastname, a.workcode, a.status, a.dsporder, kqdate, serialid, serialid as serialid1," + " workbegintime,workendtime, signintime,signouttime, (beLateMins+graveBeLateMins) as beLateMins"; String sqlFrom = "from hrmresource a, kq_format_detail b "; String sqlWhere = " where a.id = b.resourceid"; String orderBy = " kqdate asc, workbegintime asc "; if (fromDate.length() > 0) { sqlWhere += " and kqdate >= '" + fromDate + "'"; } if (toDate.length() > 0) { sqlWhere += " and kqdate <= '" + toDate + "'"; } if (resourceId.length() > 0) { sqlWhere += " and resourceid = " + resourceId; } sqlWhere += " and (graveBeLateMins>0 or beLateMins>0 )"; String pageUid = PageUidFactory.getHrmPageUid("KQReportDetialList"); String tableString ="" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " "; tableString += " "; tableString += "" + "
"; //主要用于 显示定制列以及 表格 每页展示记录数选择 String sessionkey = pageUid + "_" + Util.getEncrypt(Util.getRandom()); Util_TableMap.setVal(sessionkey, tableString); resultMap.put("sessionkey", sessionkey); resultMap.put("status", "1"); } catch (Exception e) { resultMap.put("status", "-1"); resultMap.put("message", SystemEnv.getHtmlLabelName(382661, user.getLanguage())); e.printStackTrace(); } return resultMap; } %>