You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
182 lines
7.2 KiB
182 lines
7.2 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Data;
|
|
using Newtonsoft.Json;
|
|
using System.IO;
|
|
using Spire.Doc;
|
|
using Spire.Doc.Documents;
|
|
using System.Drawing;
|
|
using Spire.Doc.Fields;
|
|
|
|
namespace FangYar.WebUI.ashx
|
|
{
|
|
/// <summary>
|
|
/// CarHandler 的摘要说明
|
|
/// </summary>
|
|
public class AnnualLeaveHandle : IHttpHandler
|
|
{
|
|
|
|
private FangYar.BLL.OA.OA_ANNUAL_LEAVE bll = new FangYar.BLL.OA.OA_ANNUAL_LEAVE();
|
|
public void ProcessRequest(HttpContext context)
|
|
{
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Other, "年假操作请求", "");
|
|
|
|
context.Response.ContentType = "text/plain";
|
|
string action = context.Request.Params["Action"];
|
|
string returnstr = "";
|
|
switch (action)
|
|
{
|
|
case "getAnnualListByTime":
|
|
returnstr = getAnnualListByTime(context);
|
|
break;
|
|
case "getAnnualListByTime2":
|
|
returnstr = getAnnualListByTime2(context);
|
|
break;
|
|
}
|
|
|
|
context.Response.Write(returnstr);
|
|
}
|
|
|
|
//按人员、时间段 分组统计出入次数
|
|
private string getAnnualListByTime(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
string data = "";
|
|
int count = 0;
|
|
string where = null;
|
|
try
|
|
{
|
|
string pplId = context.Request.Params["pplId"];
|
|
string orgId = context.Request.Params["orgId"];
|
|
string startDate = context.Request.Params["startDate"];
|
|
string endDate = context.Request.Params["endDate"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
if (string.IsNullOrEmpty(orgId))
|
|
{
|
|
return "{\"code\":" + code + ",\"msg\":\"所属机构不能为空\",\"data\":" + data + "}";
|
|
}
|
|
if (pplId != null && pplId != "")
|
|
{
|
|
where = " a.PPL_ID = '" + pplId + "' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(where))
|
|
{
|
|
where += "and";
|
|
}
|
|
if (is_content == "1")
|
|
{
|
|
where += " a.org_id in (select o.org_id from fire_org o,(select get_Org_child_list('" + orgId + "') cids ) s where o.type = '0' and find_in_set(org_id,cids) ) ";
|
|
}
|
|
else
|
|
{
|
|
where += " a.org_id = '" + orgId + "' ";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(startDate))
|
|
{
|
|
where += " and date(a.CREATIONTIME) between '" + startDate + "-01' and '" + endDate + "-01' ";
|
|
}
|
|
//if (!string.IsNullOrEmpty(endDate))
|
|
//{
|
|
// where += " and date_format(a.CREATIONTIME, '%Y-%m-%d %H:%i:%s') < date_format('" + endDate + "', '%Y-%m') ";
|
|
//}
|
|
where += " GROUP BY a.org_name, a.dept_name, a.ppl_id, a.ppl_name";
|
|
|
|
DataTable dt = bll.getAnnualListByTime(where);
|
|
code = 0;
|
|
count = dt.Rows.Count;
|
|
data = FangYar.Common.JsonHelper.ToJson(dt);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "获取失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "年假操作请求", "按人员、时间段 分组统计出入次数异常:" + e);
|
|
}
|
|
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\",\"count\":" + count + ",\"data\":" + data + "}";
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "年假操作请求", "按人员、时间段 分组统计出入次数");
|
|
return returnstr;
|
|
}
|
|
|
|
//按人员、时间段 查询列表分页
|
|
private string getAnnualListByTime2(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string pplId = context.Request.Params["pplId"];
|
|
string orgId = context.Request.Params["orgId"];
|
|
string startDate = context.Request.Params["startDate"];
|
|
string endDate = context.Request.Params["endDate"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
int pageIndex = 1;
|
|
int pageSize = 10;
|
|
if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); }
|
|
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
|
|
string where = null;
|
|
if (pplId != null && pplId != "")
|
|
{
|
|
where = " PPL_ID = '" + pplId + "' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(where))
|
|
{
|
|
where += "and";
|
|
}
|
|
if (is_content == "1")
|
|
{
|
|
where += " a.org_id in (select o.org_id from fire_org o,(select get_Org_child_list('" + orgId + "') cids ) s where o.type = '0' and find_in_set(org_id,cids) ) ";
|
|
}
|
|
else
|
|
{
|
|
where += " org_id = '" + orgId + "' ";
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(startDate))
|
|
{
|
|
where += " and date(CREATIONTIME) between '" + startDate + "-01' and '" + endDate + "-01' ";
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
where += " order by CREATIONTIME desc";
|
|
List<FangYar.Model.OA.OA_ANNUAL_LEAVE> list = bll.QueryList(pageIndex, pageSize, where, "");
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "年假操作请求", "按人员、时间段 查询列表分页异常:" + e);
|
|
}
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "年假操作请求", "按人员、时间段 查询列表分页");
|
|
return returnstr;
|
|
}
|
|
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|