天津投入产出系统后端
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.
 
 
 
 
 
 

426 lines
14 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.Entity.Sys;
using QMFrameWork.Data;
using QMAPP.DAL.Sys;
using System.Data;
namespace QMAPP.BLL.Sys
{
/// <summary>
/// 支持交互问题类型逻辑层对象
/// 创建者:wangyf
/// 创建日期:2015.03.30
/// </summary>
public class SupportInteractionBLL :BaseBLL
{
#region 常量
private const string _beforeTitle = "您在工厂物流管理平台(PLP)系统中有一个类型为\"";
private const string _afterTitle = "\"的问题需要处理。";
private const string _beforeMiddleFinger = "[";
private const string _afterMiddleFinger = "]";
private const string _questionNo = "问题编号";
#endregion
#region 获取信息
/// <summary>
/// 获取信息
/// </summary>
/// <param name="">条件</param>
/// <returns>信息</returns>
public SupportInteraction GetInfo(SupportInteraction model)
{
try
{
return new SupportInteractionDAL().GetInfo(model);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取问题处理方法列表
/// <summary>
/// 获取列表
/// </summary>
/// <param name="condition">条件</param>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public DataPage GetList(SupportInteraction condition, DataPage page)
{
try
{
return new SupportInteractionDAL().GetList(condition, page);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取问题列表
/// <summary>
/// 获取列表
/// </summary>
/// <param name="condition">条件</param>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public DataPage GetProblemList(SupportInteraction condition, DataPage page)
{
try
{
return new SupportInteractionDAL().GetProblemList(condition, page, this.LoginUser.UserID,this.LoginUser.OrganID);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 插入信息
/// <summary>
/// 插入信息(单表)
/// </summary>
/// <param name="">信息</param>
/// <returns>插入行数</returns>
public int Insert(SupportInteraction model)
{
try
{
SupportInteractionDAL dal = new SupportInteractionDAL();
//基本信息
model.CreateUser = this.LoginUser.UserID;
model.CreateDate = DateTime.Now;
model.FlgDel = "0";
model.Ncind = "0";
model.Ecind = "0";
int count = dal.Insert(model);
//获取用户邮箱信息
SupportInteraction userModel = dal.GetUserModel(model);
//提交人不为空时
if (userModel != null && !string.IsNullOrEmpty(userModel.Email))
{
//如果提交到的用户邮箱不为空,给用户发送邮件
SentMail(model, userModel.Email);
}
//插入通知提醒
if (!string.IsNullOrEmpty(model.SUser))
{
NoticeInfo notice = new NoticeInfo();
notice.NOTICETITLE = _beforeTitle + model.PTypeName + _afterTitle + _questionNo + _beforeMiddleFinger
+ model.PSequ + _afterMiddleFinger + _beforeMiddleFinger + DateTime.Now.ToString("yyyy-MM-dd") + _afterMiddleFinger;
notice.NOTICETYPE = "1";
notice.NOTICECONTEXT = _beforeTitle + model.PTypeName + _afterTitle + _questionNo + _beforeMiddleFinger
+ model.PSequ + _afterMiddleFinger +_beforeMiddleFinger + DateTime.Now.ToString("yyyy-MM-dd") + _afterMiddleFinger;
notice.CANREPLY = "0";
notice.USETIME = DateTime.Now;
notice.OUTTIME = notice.USETIME.AddDays(1);
notice.SENDAIM = model.SUser;
notice.CREATEUSER = this.LoginUser.UserID;
notice.UPDATEUSER = notice.CREATEUSER;
new NoticeManageBll().Save(notice);
}
return count;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 提交
/// <summary>
/// 提交
/// </summary>
/// <param name="">信息</param>
/// <returns>插入行数</returns>
public int UpdateSupportInteraction(SupportInteraction model)
{
try
{
SupportInteractionDAL dal = new SupportInteractionDAL();
model.CreateUser = this.LoginUser.UserID;
//获取用户邮箱信息
SupportInteraction userModel = dal.GetUserModel(model);
//提交信息更新到数据库中
int count = dal.UpdateSupportInteraction(model, userModel);
//提交人不为空时
if (userModel != null && !string.IsNullOrEmpty(userModel.Email))
{
//如果提交到的用户邮箱不为空,给用户发送邮件
SentMail(model, userModel.Email);
}
//基本信息
return count;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 发送邮件共通
/// <summary>
/// 发送邮件共通
/// </summary>
public void SentMail(SupportInteraction model, string userMail)
{
if (!string.IsNullOrEmpty(userMail))
{
//给提交用户发送邮件提醒
List<OverTimeRemind> mailList = new List<OverTimeRemind>();
mailList.Add(new OverTimeRemind()
{
ActionTime = DateTime.Now.ToString(),
PDesp = _beforeTitle + model.PTypeName + _afterTitle + _questionNo + _beforeMiddleFinger + model.PSequ + _afterMiddleFinger + _beforeMiddleFinger + DateTime.Now.ToString("yyyy-MM-dd") + _afterMiddleFinger,
SDept = model.SDept
});
new OverTimeRemindBLL().SentMailToUser(mailList);
}
}
#endregion
#region 解决问题
/// <summary>
/// 解决问题
/// </summary>
/// <param name="">信息</param>
/// <returns>插入行数</returns>
public int SloveSupportInteraction(SupportInteraction model)
{
try
{
SupportInteractionDAL dal = new SupportInteractionDAL();
model.CreateUser = this.LoginUser.UserID;
model.CDate = DateTime.Now;
TimeSpan ts = DateTime.Now - model.CreateDate;
decimal hours = Convert.ToDecimal(ts.TotalHours);
model.SDays = hours / 24;
if (!string.IsNullOrEmpty(model.Refer))
{
model.IsRefer = "1";
}
//设置处理人员为当前用户
model.SUser = this.LoginUser.UserID;
//基本信息
return dal.SloveSupportInteraction(model);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取问题类型的下拉列表
/// <summary>
/// 获取列表
/// </summary>
/// <param name="condition">条件</param>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public List<SupportInteraction> GetTypeList()
{
try
{
return new SupportInteractionDAL().GetTypeList();
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取问题解决方法导出的数据
/// <summary>
/// 获取问题解决方法导出的数据
/// </summary>
/// <param name="user">查询条件</param>
/// <returns>数据</returns>
public DataTable GetExportData(SupportInteraction entity)
{
DataTable dt = new DataTable();
try
{
dt = new SupportInteractionDAL().GetExportData(entity);
return dt;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取问题管理导出的数据
/// <summary>
/// 获取问题管理导出的数据
/// </summary>
/// <param name="user">查询条件</param>
/// <returns>数据</returns>
public DataTable GetProblemManageExportData(SupportInteraction entity)
{
DataTable dt = new DataTable();
try
{
dt = new SupportInteractionDAL().GetProblemManageExportData(entity, this.LoginUser.UserID, this.LoginUser.OrganID);
return dt;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 判断选中的问题是否已经关闭
/// <summary>
/// 判断选中的问题是否已经关闭
/// </summary>
/// <param name="user">查询条件</param>
/// <returns>数据</returns>
public bool CheckProblemClosed(SupportInteraction entity)
{
bool retBool = false;
try
{
SupportInteraction model = new SupportInteractionDAL().Get(entity);
if ("1".Equals(model.Ecind))
{
retBool = true;
}
return retBool;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 校验选中问题的处理部门是否为当前用户部门
/// <summary>
/// 校验选中问题的处理部门是否为当前用户部门
/// </summary>
/// <param name="user">查询条件</param>
/// <returns>数据</returns>
public bool CheckProblemDept(SupportInteraction entity)
{
bool retBool = false;
try
{
SupportInteraction model = new SupportInteractionDAL().Get(entity);
if (model.SDept == this.LoginUser.OrganID)
{
retBool = true;
}
return retBool;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 校验选中问题的处理人是否为当前用户
/// <summary>
/// 校验选中问题的处理人是否为当前用户
/// </summary>
/// <param name="user">查询条件</param>
/// <returns>数据</returns>
public bool CheckProblemUser(SupportInteraction entity)
{
bool retBool = false;
try
{
SupportInteraction model = new SupportInteractionDAL().Get(entity);
//处理人为当前用户或者处理人为空时.可以处理当前部门的问题
if (model.SUser == this.LoginUser.UserID || string.IsNullOrEmpty(model.SUser))
{
retBool = true;
}
return retBool;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取处理记录列表
/// <summary>
/// 获取处理记录列表
/// </summary>
/// <param name="condition">条件</param>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public DataPage GetSIDealList(ZPDealInfo condition, DataPage page)
{
try
{
return new SupportInteractionDAL().GetSIDealList(condition, page);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取当前用户的处理机构
/// <summary>
/// 获取当前用户的处理机构
/// </summary>
/// <returns></returns>
public List<ZPFlow> GetCurrentHandleOrga(ZPFlow entity)
{
SupportInteractionDAL dal = new SupportInteractionDAL();
List<ZPFlow> zpList = null;
//判断用户的机构是否在级流程中
if (dal.CheckCurrentUserInFlowLevel("1" , this.LoginUser.OrganID) >0)
{
//查询二级机构的列表
zpList = dal.GetNextFlowLevel("2");
}
else
{
//查询所有列表
zpList = dal.GetAllFlowLevel();
}
return zpList;
}
#endregion
}
}