软测单独项目
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.
 
 
 
 
 
 

207 lines
8.3 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;
using MySql.Data.MySqlClient;
using System.Text.RegularExpressions;
using FangYar.Common;
namespace FangYar.WebUI.ashx
{
/// <summary>
/// SysEmpMoveHandle 人员信息调整审核表
/// </summary>
public class SysEmpMoveHandle : IHttpHandler
{
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 "list":
returnstr = getEmpMoveList(context);
break;
case "agree":
returnstr = agree(context);
break;
}
context.Response.Write(returnstr);
}
private string getEmpMoveList(HttpContext context)
{
string returnstr = "";
try
{
string userUid = context.Request.Params["userUid"];
string isAdmin = context.Request.Params["isAdmin"];
string orgId = context.Request.Params["orgId"];
string cacheType = context.Request.Params["cacheType"];
string sTime = context.Request.Params["sTime"];
string eTime = context.Request.Params["eTime"];
string sql = @"select c.id as cid,c.USERS_UID,c.EMP_NAME,c.IDNUMBER,
(select o.org_name from fire_org o where o.org_id = c.org_id) org_name,
m.id as mid,m.APPROVAL_RANK,m.SENDERID,m.SENDERNAME,
m.SEND_ORG_ID,m.SEND_ORG_NAME,m.SENDERTIME,
m.RECEIVEID,m.RECEIVENAME,m.RECEIVE_ORG_ID,m.RECEIVE_ORG_NAME,c.Cache_Type
from tbl_sys_emp_move m left join tbl_sys_emp_cache c on m.INSTANCEID = c.ID where ";
if (isAdmin == "1")
{
sql += " m.RECEIVE_ORG_ID = '"+ orgId + "'";
}
else
{
sql += " m.RECEIVEID = '" + userUid + "'";
}
if (!string.IsNullOrEmpty(cacheType))
{
sql += " and c.Cache_Type = '" + cacheType + "'";
}
if (!string.IsNullOrEmpty(sTime) && !string.IsNullOrEmpty(eTime))
{
sql += " and m.SENDERTIME >= '" + sTime + " 00:00:00' and SENDERTIME <= '" + eTime + " 23:59:59'";
}
DataTable dt = FangYar.Common.MySqlHelper.QueryTable(sql);
returnstr = "{\"code\":0,\"msg\":\"操作成功!\",\"data\":";
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
returnstr += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":-1,\"msg\":\"" + e.Message + "\",\"count\":0,\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "人脸点名统计操作请求", "点名状态异常:" + e);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "人脸点名统计操作请求", "点名状态");
return returnstr;
}
private string agree(HttpContext context)
{
string returnstr = "";
try
{
string mid = context.Request.Params["mid"];
string cid = context.Request.Params["cid"];
string nextStepUid = context.Request.Params["sendUid"];
string nextStepName = context.Request.Params["nextStepName"];
string nextStepOrgId = context.Request.Params["nextStepOrgId"];
string nextStepOrgName = context.Request.Params["nextStepOrgName"];
string nextStepUid = context.Request.Params["nextStepUid"];
string nextStepName = context.Request.Params["nextStepName"];
string nextStepOrgId = context.Request.Params["nextStepOrgId"];
string nextStepOrgName = context.Request.Params["nextStepOrgName"];
string commentId = context.Request.Params["commentId"];
string commentName = context.Request.Params["commentName"];
string completedTime = DateTime.Now.ToString();
string opComment = context.Request.Params["opComment"];
string opStatus = context.Request.Params["opStatus"];
string approvalRank = context.Request.Params["approvalRank"];
string cacheType = context.Request.Params["cacheType"];
string sql = "";
Boolean isAgree = false, isSubmit = false;
switch (opStatus)
{
case "1":// 同意
isAgree = true;
break;
case "2":// 不同意
break;
case "3":// 提交上级处理
isSubmit = true;
break;
default:
break;
}
string currentStepSql = @"update tbl_sys_emp_move set
COMPLETEDID = '" + userUid + @"',
COMPLETEDNAME = '" + userName + @"',
COMPLETEDTIME = '" + completedTime + @"',
OP_COMMENT = '" + opComment + @"',
OP_STATUS = '" + opStatus + @"'
where ID = '" + mid + @"' ";// 当前步骤办结
FangYar.Common.MySqlHelper.Execute(currentStepSql);
if (isSubmit)
{
string newMid = Guid.NewGuid().ToString("N");
string nextStepSql = @"insert into tbl_sys_emp_move(
ID,INSTANCEID,APPROVAL_RANK,SENDERID,SENDERNAME,SEND_ORG_ID,
SEND_ORG_NAME,SENDERTIME,RECEIVEID,RECEIVENAME,RECEIVE_ORG_ID,
RECEIVE_ORG_NAME,OP_STATUS,Cache_Type) values (
'"+ newMid + @"','" + cid + @"','1',
'" + newMid + @"','" + newMid + @"','" + newMid + @"',
'" + newMid + @"','" + newMid + @"','" + newMid + @"',
'" + newMid + @"','" + newMid + @"','" + newMid + @"',
'" + newMid + @"','" + newMid + @"','" + newMid + @"')";// 下一步骤生成
FangYar.Common.MySqlHelper.Execute(nextStepSql);
}
if (isAgree)
{
switch (cacheType)
{
case "1":// 新增
break;
case "2":// 跨区调整
break;
case "3":// 删除
break;
}
}
DataTable dt = FangYar.Common.MySqlHelper.QueryTable(sql);
returnstr = "{\"code\":0,\"msg\":\"操作成功!\",\"data\":";
returnstr += FangYar.Common.JsonHelper.ToJson(dt);
returnstr += "}";
}
catch (Exception e)
{
returnstr = "{\"code\":-1,\"msg\":\"" + e.Message + "\",\"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;
}
}
}
}