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

593 lines
24 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace FangYar.WebUI.ashx
{
/// <summary>
/// WorkFlowHandler 的摘要说明
/// </summary>
public class WorkFlowHandler : IHttpHandler
{
private FangYar.BLL.TBL.SysEmpBLL bll = new FangYar.BLL.TBL.SysEmpBLL();
private FangYar.BLL.FIRE.FIRE_ORG bll_org = new FangYar.BLL.FIRE.FIRE_ORG();
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 "getLeaveFirst":
returnstr = getLeaveFirst(context);
break;
case "getCarApplyFirst":
returnstr = getCarApplyFirst(context);
break;
case "getGCApplyFirst":
returnstr = getGCApplyFirst(context);
break;
case "getXZZDJGFirst":
returnstr = getXZZDJGFirst(context);
break;
case "GetOutsideVehicleApprovalFirstNode":
returnstr = GetOutsideVehicleApprovalFirstNode(context);
break;
}
context.Response.Write(returnstr);
}
/// <summary>
/// 流程发起查询对应步骤和处理人
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private string getLeaveFirst(HttpContext context)
{
string returnstr = "";
try
{
string userId = context.Request.Params["qjr"];
var user = bll.GetModelByUID(userId);
var nextUid = "";
var nextStep = "";
var org = bll_org.GetModel(user.ORG_ID);//所在单位部门
var unit_org = org;//所在单位
//if (unit_org.TYPE=='1') {
// unit_org = bll_org.getHigherOrgByOrgId(unit_org.ORG_ID);
//}
//var height_unit_org = bll_org.getHigherOrgByOrgId(unit_org.ORG_ID);//上级单位
if (user.TAGS != null && user.TAGS.Contains("消防站"))
{
nextStep = "1_";
nextUid = "";
//获取消防站主官
var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);
if (listuser != null && listuser.Count > 0)
{
foreach (var model in listuser)
{
if (model.TAGS != null && model.TAGS.Contains("消防站主官"))
{
nextUid += model.USERS_UID + ",";
}
}
}
nextUid = nextUid.Trim(',');
}
else if (user.TAGS.Contains("常委"))
{
nextStep = "4_";
nextUid = "";
//获取支队长、政委
var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);
if (listuser != null && listuser.Count > 0)
{
foreach (var model in listuser)
{
if (model.TAGS != null && !model.TAGS.Contains("副支队长") && (model.TAGS.Contains("支队长") || model.TAGS.Contains("政治委员")))
{
nextUid += model.USERS_UID + ",";
}
}
}
nextUid = nextUid.Trim(',');
}
else if (user.TAGS.Contains("大队"))
{
nextStep = "2_";
nextUid = "";
//获取支队长、政委
var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);
if (listuser != null && listuser.Count > 0)
{
foreach (var model in listuser)
{
if (model.TAGS != null && (model.TAGS.Contains("大队长") || model.TAGS.Contains("教导员")))
{
nextUid += model.USERS_UID + ",";
}
}
}
nextUid = nextUid.Trim(',');
}
else if (user.TAGS.Contains("科长"))
{
nextStep = "3_1";
RoadFlow.Platform.FLOW_EVENT flowEvent = new RoadFlow.Platform.FLOW_EVENT();
nextUid = flowEvent.GetOALEAVE_STEPUID_FGLD(user);
}
else
{
nextStep = "3_";
nextUid = "";
var dept_org = bll_org.GetModel(user.DEPT_ID);//部门信息
if (dept_org != null && dept_org.LEADER != null)
{
var kz = bll.GetModelByID(dept_org.LEADER);
if (kz != null && kz.USERS_UID != null)
{
nextUid = kz.USERS_UID;//部门领导
}
}
}
returnstr += "{\"code\":1,\"msg\":\"\",\"data\":{\"nextUid\":\"" + nextUid + "\",\"nextStep\":\"" + nextStep + "\"}}";
}
catch (Exception ex)
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "流程处理操作请求", "流程发起查询对应步骤和处理人异常:" + ex);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "流程处理操作请求", "流程发起查询对应步骤和处理人");
return returnstr;
}
/// <summary>
/// 流程发起查询对应步骤和处理人
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private string getCarApplyFirst(HttpContext context)
{
string returnstr = "";
try
{
string userId = context.Request.Params["qjr"];
var user = bll.GetModelByUID(userId);
var nextUid = "";
var nextStep = "";
var org = bll_org.GetModel(user.ORG_ID);//所在单位部门
var unit_org = org;//所在单位
//if (unit_org.TYPE=='1') {
// unit_org = bll_org.getHigherOrgByOrgId(unit_org.ORG_ID);
//}
//var height_unit_org = bll_org.getHigherOrgByOrgId(unit_org.ORG_ID);//上级单位
if (user.TAGS != null && user.TAGS.Contains("消防站"))
{
nextStep = "1_";
nextUid = "";
//获取消防站主官
var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);
if (listuser != null && listuser.Count > 0)
{
foreach (var model in listuser)
{
if (model.TAGS != null && model.TAGS.Contains("消防站主官"))
{
nextUid += model.USERS_UID + ",";
}
}
}
nextUid = nextUid.Trim(',');
}
else if (user.TAGS.Contains("大队"))
{
nextStep = "2_";
nextUid = "";
//获取支队长、政委
var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);
if (listuser != null && listuser.Count > 0)
{
foreach (var model in listuser)
{
if (model.TAGS != null && (model.TAGS.Contains("大队长") || model.TAGS.Contains("教导员")))
{
nextUid += model.USERS_UID + ",";
}
}
}
nextUid = nextUid.Trim(',');
}
else if (user.TAGS.Contains("科长"))
{
nextStep = "3_1_1_1";
nextUid = "";
}
else
{
nextStep = "3_";
nextUid = "";
var dept_org = bll_org.GetModel(user.DEPT_ID);//部门信息
if (dept_org != null && dept_org.LEADER != null)
{
var kz = bll.GetModelByID(dept_org.LEADER);
if (kz != null && kz.USERS_UID != null)
{
nextUid = kz.USERS_UID;//部门领导
}
}
}
returnstr += "{\"code\":1,\"msg\":\"\",\"data\":{\"nextUid\":\"" + nextUid + "\",\"nextStep\":\"" + nextStep + "\"}}";
}
catch (Exception ex)
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "流程处理操作请求", "流程发起查询对应步骤和处理人异常:" + ex);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "流程处理操作请求", "流程发起查询对应步骤和处理人");
return returnstr;
}
/// <summary>
/// 流程发起查询对应步骤和处理人-公差
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private string getGCApplyFirst(HttpContext context)
{
string returnstr = "";
try
{
string userId = context.Request.Params["qjr"];
var user = bll.GetModelByUID(userId);
var nextUid = "";
var nextStep = "";
var org = bll_org.GetModel(user.ORG_ID);//所在单位部门
var unit_org = org;//所在单位
//if (unit_org.TYPE=='1') {
// unit_org = bll_org.getHigherOrgByOrgId(unit_org.ORG_ID);
//}
//var height_unit_org = bll_org.getHigherOrgByOrgId(unit_org.ORG_ID);//上级单位
if (user.TAGS != null && user.TAGS.Contains("消防站"))
{
nextStep = "1_";
nextUid = "";
//获取消防站主官
var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);
if (listuser != null && listuser.Count > 0)
{
foreach (var model in listuser)
{
if (model.TAGS != null && model.TAGS.Contains("消防站主官"))
{
nextUid += model.USERS_UID + ",";
}
}
}
nextUid = nextUid.Trim(',');
}
else if (user.TAGS.Contains("常委"))
{
nextStep = "4_";
nextUid = "";
//获取支队长、政委
var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);
if (listuser != null && listuser.Count > 0)
{
foreach (var model in listuser)
{
if (model.TAGS != null && !model.TAGS.Contains("副支队长") && (model.TAGS.Contains("支队长") || model.TAGS.Contains("政治委员")))
{
nextUid += model.USERS_UID + ",";
}
}
}
nextUid = nextUid.Trim(',');
}
else if (user.TAGS.Contains("大队"))
{
nextStep = "2_";
nextUid = "";
//获取支队长、政委
var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);
if (listuser != null && listuser.Count > 0)
{
foreach (var model in listuser)
{
if (model.TAGS != null && (model.TAGS.Contains("大队长") || model.TAGS.Contains("教导员")))
{
nextUid += model.USERS_UID + ",";
}
}
}
nextUid = nextUid.Trim(',');
}
else
{
nextStep = "3_";
nextUid = "";
var dept_org = bll_org.GetModel(user.DEPT_ID);//部门信息
if (dept_org != null && dept_org.LEADER != null)
{
var kz = bll.GetModelByID(dept_org.LEADER);
if (kz != null && kz.USERS_UID != null)
{
nextUid = kz.USERS_UID;//部门领导
}
}
}
returnstr += "{\"code\":1,\"msg\":\"\",\"data\":{\"nextUid\":\"" + nextUid + "\",\"nextStep\":\"" + nextStep + "\"}}";
}
catch (Exception ex)
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "流程处理操作请求", "流程发起查询对应步骤和处理人-公差异常:" + ex);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "流程处理操作请求", "流程发起查询对应步骤和处理人-公差");
return returnstr;
}
/// <summary>
/// 流程发起查询对应步骤和处理人(西藏总队机关)
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private string getXZZDJGFirst(HttpContext context)
{
string returnstr = "";
try
{
string userId = context.Request.Params["qjr"];
var user = bll.GetModelByUID(userId);
var nextUid = "";
var nextStep = "";
var unit_org = bll_org.GetModel(user.ORG_ID);//所在单位部门
if (unit_org.EXTENDCODE1 == "1") //消防站
{
if (user.TAGS != null && (user.TAGS.Contains("消防员") || user.TAGS.Contains("消防士")))
{
nextStep = "1_";
nextUid = "";
}
else if (user.TAGS.Contains("主官"))
{
nextStep = "3_";
nextUid = "";
}
else
{
nextStep = "1_";
nextUid = "";
}
}
else if (unit_org.EXTENDCODE1 == "2") //大队
{
if (user.TAGS != null && user.TAGS.Contains("文员"))
{
nextStep = "2_";
nextUid = "";
}
else if (user.TAGS.Contains("主官"))
{
nextStep = "4_";
nextUid = "";
}
else if (user.TAGS.Contains("干部"))
{
nextStep = "3_";
nextUid = "";
}
else
{
nextStep = "3_";
nextUid = "";
}
}
else if (unit_org.EXTENDCODE1 == "0") //支队
{
if (user.TAGS != null && user.TAGS.Contains("文员"))
{
nextStep = "5_";
nextUid = "";
}
else if (user.TAGS.Contains("主官"))
{
nextStep = "9_";
nextUid = "";
}
else if (user.TAGS.Contains("支队副职") || user.TAGS.Contains("副支队长") || user.TAGS.Contains("副政委"))
{
nextStep = "8_";
nextUid = "";
}
else if (user.TAGS.Contains("科室负责人"))
{
nextStep = "7_";
nextUid = "";
}
else if (user.TAGS.Contains("干部"))
{
nextStep = "6_";
nextUid = "";
}
else
{
nextStep = "6_";
nextUid = "";
}
}
else if (unit_org.EXTENDCODE1 == "3") //总队
{
if (user.TAGS != null && user.TAGS.Contains("干部"))
{
nextStep = "10_";
nextUid = "";
}
else if (user.TAGS.Contains("处室负责人"))
{
nextStep = "11_";
nextUid = "";
}
else if (user.TAGS.Contains("消防员") || user.TAGS.Contains("消防士"))
{
nextStep = "12_";
nextUid = "";
}
else if (user.TAGS.Contains("文员"))
{
nextStep = "13_";
nextUid = "";
}
else
{
nextStep = "12_";
nextUid = "";
}
}
returnstr += "{\"code\":1,\"msg\":\"\",\"data\":{\"nextUid\":\"" + nextUid + "\",\"nextStep\":\"" + nextStep + "\"}}";
}
catch (Exception ex)
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"data\":{}}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "流程处理操作请求", "流程发起查询对应步骤和处理人(西藏总队机关)异常:" + ex);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "流程处理操作请求", "流程发起查询对应步骤和处理人(西藏总队机关)");
return returnstr;
}
/// <summary>
/// 流程发起查询对应步骤和处理人(辖区外用车审批)
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
private string GetOutsideVehicleApprovalFirstNode(HttpContext context)
{
string returnstr = "";
try
{
string userId = context.Request.Params["qjr"];
var user = bll.GetModelByUID(userId);
var nextUid = "";
var nextStep = "";
var unit_org = bll_org.GetModel(user.ORG_ID);//所在单位部门
//var listuser = bll.QueryListByOrgIdOrDeptId(unit_org.ORG_ID);//获取下一级审批人员
if (unit_org.EXTENDCODE1 == "1") //消防站
{
nextStep = "1_";
nextUid = "";
if (user.TAGS != null && user.TAGS.Contains("消防员"))
{
nextStep = "1_";
nextUid = "";
}
//if (listuser != null && listuser.Count > 0)
//{
// foreach (var model in listuser)
// {
// if (model.TAGS != null && model.TAGS.Contains("消防站主官"))
// {
// nextUid += model.USERS_UID + ",";
// }
// }
//}
}
else if (unit_org.EXTENDCODE1 == "2") //大队
{
nextStep = "2_";
nextUid = "";
if (user.TAGS != null && (user.TAGS.Contains("文员") || user.TAGS.Contains("消防员")))
{
nextStep = "2_";
nextUid = "";
}
}
else if (unit_org.EXTENDCODE1 == "0") //支队
{
nextStep = "3_";
nextUid = "";
if (user.TAGS != null && (user.TAGS.Contains("文员") || user.TAGS.Contains("消防员")))
{
nextStep = "3_";
nextUid = "";
}
}
else if (unit_org.EXTENDCODE1 == "3") //总队
{
if (user.TAGS != null && (user.TAGS.Contains("文员") || user.TAGS.Contains("消防员")))
{
nextStep = "4_";
nextUid = "";
}
else if (user.TAGS.Contains("总队干部"))
{
nextStep = "5_";
nextUid = "";
}
else if (user.TAGS.Contains("处室负责人"))
{
nextStep = "6_";
nextUid = "";
}
else
{
nextStep = "4_";
nextUid = "";
}
}
returnstr += "{\"code\":1,\"msg\":\"\",\"data\":{\"nextUid\":\"" + nextUid + "\",\"nextStep\":\"" + nextStep + "\"}}";
}
catch (Exception ex)
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"data\":{}}";
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "流程处理操作请求", "流程发起查询对应步骤和处理人(西藏总队机关)异常:" + ex);
}
// 记录操作日志
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "流程处理操作请求", "流程发起查询对应步骤和处理人(西藏总队机关)");
return returnstr;
}
public bool IsReusable
{
get
{
return false;
}
}
}
}