小程序接口修改
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -43,114 +44,127 @@ namespace BLL
|
||||
// BLL.FileCabinetAItemService.DeleteFileCabinetAItemByID(dataId);
|
||||
Funs.DB.Sys_CodeRecords.DeleteOnSubmit(codeRecords);
|
||||
}
|
||||
}
|
||||
|
||||
#region 根据菜单id、项目id返回编码 (用于页面新增显示)
|
||||
/// <summary>
|
||||
/// 根据菜单id、项目id返回编码 (用于页面新增显示)
|
||||
/// </summary>
|
||||
/// <param name="menuId"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
public static string ReturnCodeByMenuIdProjectId(string menuId, string projectId, string unitId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string code = string.Empty;
|
||||
string ruleCodes = string.Empty;
|
||||
int digit = 4;
|
||||
string symbol = "-"; ///间隔符
|
||||
var codeRecords = (from x in db.Sys_CodeRecords where x.MenuId == menuId && x.ProjectId == projectId orderby x.CompileDate descending select x).FirstOrDefault();
|
||||
if (codeRecords != null && !string.IsNullOrEmpty(codeRecords.RuleCodes))
|
||||
{
|
||||
ruleCodes = codeRecords.RuleCodes;
|
||||
if (codeRecords.Digit.HasValue)
|
||||
{
|
||||
digit = codeRecords.Digit.Value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
////项目
|
||||
string ruleCode = string.Empty;
|
||||
var project = ProjectService.GetProjectByProjectId(projectId);
|
||||
if (project != null)
|
||||
{
|
||||
string projectCode = project.ProjectCode; ///项目编号
|
||||
////编码规则表
|
||||
var sysCodeTemplateRule = db.ProjectData_CodeTemplateRule.FirstOrDefault(x => x.MenuId == menuId && x.ProjectId == projectId);
|
||||
if (sysCodeTemplateRule != null)
|
||||
{
|
||||
symbol = sysCodeTemplateRule.Symbol;
|
||||
if (sysCodeTemplateRule.Digit.HasValue)
|
||||
{
|
||||
digit = sysCodeTemplateRule.Digit.Value;
|
||||
}
|
||||
if (sysCodeTemplateRule.IsProjectCode == true)
|
||||
{
|
||||
ruleCode = projectCode + symbol;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(sysCodeTemplateRule.Prefix))
|
||||
{
|
||||
ruleCode += sysCodeTemplateRule.Prefix + symbol;
|
||||
}
|
||||
if (sysCodeTemplateRule.IsUnitCode == true)
|
||||
{
|
||||
var unit = UnitService.GetUnitByUnitId(unitId);
|
||||
if (unit != null)
|
||||
{
|
||||
ruleCode += unit.UnitCode + symbol;
|
||||
}
|
||||
}
|
||||
ruleCodes = ruleCode;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var codeTempRule = db.Sys_CodeTemplateRule.FirstOrDefault(x => x.MenuId == menuId);
|
||||
if (codeTempRule != null && !string.IsNullOrEmpty(codeTempRule.Prefix))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(codeTempRule.Symbol))
|
||||
{
|
||||
symbol = codeTempRule.Symbol;
|
||||
}
|
||||
ruleCodes = codeTempRule.Prefix + symbol;
|
||||
if (codeTempRule.Digit.HasValue)
|
||||
{
|
||||
digit = codeTempRule.Digit.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////获取编码记录表最大排列序号
|
||||
int maxNewSortIndex = 0;
|
||||
var maxSortIndex = db.Sys_CodeRecords.Where(x => (x.ProjectId == projectId || projectId == null) && x.MenuId == menuId).Select(x => x.SortIndex).Max();
|
||||
|
||||
if (maxSortIndex.HasValue)
|
||||
{
|
||||
maxNewSortIndex = maxSortIndex.Value;
|
||||
}
|
||||
maxNewSortIndex = maxNewSortIndex + 1;
|
||||
code = (maxNewSortIndex.ToString().PadLeft(digit, '0')); ///字符自动补零
|
||||
if (!string.IsNullOrEmpty(ruleCodes))
|
||||
{
|
||||
code = ruleCodes + code;
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public static void DeleteCodeRecordsByDataIdForApi(string dataId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var codeRecords = db.Sys_CodeRecords.FirstOrDefault(x => x.DataId == dataId);
|
||||
if (codeRecords != null)
|
||||
{
|
||||
///删除文件柜A中数据
|
||||
// BLL.FileCabinetAItemService.DeleteFileCabinetAItemByID(dataId);
|
||||
db.Sys_CodeRecords.DeleteOnSubmit(codeRecords);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region 根据菜单id、项目id插入一条编码记录(数据新增到数据库 生成编码)
|
||||
/// <summary>
|
||||
/// 根据菜单id、项目id插入一条编码记录(数据新增到数据库 生成编码)
|
||||
/// </summary>
|
||||
/// <param name="menuId"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="unitId"></param>
|
||||
public static string InsertCodeRecordsByMenuIdProjectIdUnitId(string menuId, string projectId, string unitId, string dataId, DateTime? compileDate)
|
||||
#region 根据菜单id、项目id返回编码 (用于页面新增显示)
|
||||
/// <summary>
|
||||
/// 根据菜单id、项目id返回编码 (用于页面新增显示)
|
||||
/// </summary>
|
||||
/// <param name="menuId"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
public static string ReturnCodeByMenuIdProjectId(string menuId, string projectId, string unitId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string code = string.Empty;
|
||||
string ruleCodes = string.Empty;
|
||||
int digit = 4;
|
||||
string symbol = "-"; ///间隔符
|
||||
var codeRecords = (from x in db.Sys_CodeRecords where x.MenuId == menuId && x.ProjectId == projectId orderby x.CompileDate descending select x).FirstOrDefault();
|
||||
if (codeRecords != null && !string.IsNullOrEmpty(codeRecords.RuleCodes))
|
||||
{
|
||||
ruleCodes = codeRecords.RuleCodes;
|
||||
if (codeRecords.Digit.HasValue)
|
||||
{
|
||||
digit = codeRecords.Digit.Value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
////项目
|
||||
string ruleCode = string.Empty;
|
||||
var project = db.Base_Project.FirstOrDefault(e => e.ProjectId == projectId) ;
|
||||
if (project != null)
|
||||
{
|
||||
string projectCode = project.ProjectCode; ///项目编号
|
||||
////编码规则表
|
||||
var sysCodeTemplateRule = db.ProjectData_CodeTemplateRule.FirstOrDefault(x => x.MenuId == menuId && x.ProjectId == projectId);
|
||||
if (sysCodeTemplateRule != null)
|
||||
{
|
||||
symbol = sysCodeTemplateRule.Symbol;
|
||||
if (sysCodeTemplateRule.Digit.HasValue)
|
||||
{
|
||||
digit = sysCodeTemplateRule.Digit.Value;
|
||||
}
|
||||
if (sysCodeTemplateRule.IsProjectCode == true)
|
||||
{
|
||||
ruleCode = projectCode + symbol;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(sysCodeTemplateRule.Prefix))
|
||||
{
|
||||
ruleCode += sysCodeTemplateRule.Prefix + symbol;
|
||||
}
|
||||
if (sysCodeTemplateRule.IsUnitCode == true)
|
||||
{
|
||||
var unit = db.Base_Unit.FirstOrDefault(x => x.UnitId == unitId);
|
||||
if (unit != null)
|
||||
{
|
||||
ruleCode += unit.UnitCode + symbol;
|
||||
}
|
||||
}
|
||||
ruleCodes = ruleCode;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var codeTempRule = db.Sys_CodeTemplateRule.FirstOrDefault(x => x.MenuId == menuId);
|
||||
if (codeTempRule != null && !string.IsNullOrEmpty(codeTempRule.Prefix))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(codeTempRule.Symbol))
|
||||
{
|
||||
symbol = codeTempRule.Symbol;
|
||||
}
|
||||
ruleCodes = codeTempRule.Prefix + symbol;
|
||||
if (codeTempRule.Digit.HasValue)
|
||||
{
|
||||
digit = codeTempRule.Digit.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////获取编码记录表最大排列序号
|
||||
int maxNewSortIndex = 0;
|
||||
var maxSortIndex = db.Sys_CodeRecords.Where(x => (x.ProjectId == projectId || projectId == null) && x.MenuId == menuId).Select(x => x.SortIndex).Max();
|
||||
|
||||
if (maxSortIndex.HasValue)
|
||||
{
|
||||
maxNewSortIndex = maxSortIndex.Value;
|
||||
}
|
||||
maxNewSortIndex = maxNewSortIndex + 1;
|
||||
code = (maxNewSortIndex.ToString().PadLeft(digit, '0')); ///字符自动补零
|
||||
if (!string.IsNullOrEmpty(ruleCodes))
|
||||
{
|
||||
code = ruleCodes + code;
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据菜单id、项目id插入一条编码记录(数据新增到数据库 生成编码)
|
||||
/// <summary>
|
||||
/// 根据菜单id、项目id插入一条编码记录(数据新增到数据库 生成编码)
|
||||
/// </summary>
|
||||
/// <param name="menuId"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="unitId"></param>
|
||||
public static string InsertCodeRecordsByMenuIdProjectIdUnitId(string menuId, string projectId, string unitId, string dataId, DateTime? compileDate)
|
||||
{
|
||||
string ruleCode = string.Empty;
|
||||
var IsHaveCodeRecords = Funs.DB.Sys_CodeRecords.FirstOrDefault(x => x.DataId == dataId);
|
||||
@@ -276,16 +290,148 @@ namespace BLL
|
||||
|
||||
return ruleCode;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据菜单id,项目id 更新编码记录(当编码规则改变的时候 更新编码)
|
||||
/// <summary>
|
||||
/// 根据菜单id 更新编码记录(当编码规则改变的时候 更新编码)
|
||||
/// </summary>
|
||||
/// <param name="menuId"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="unitId"></param>
|
||||
public static void UpdateCodeRecordsByMenuIdProjectId(string menuId, string projectId)
|
||||
|
||||
public static string InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(string menuId, string projectId, string unitId, string dataId, DateTime? compileDate)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string ruleCode = string.Empty;
|
||||
var IsHaveCodeRecords = db.Sys_CodeRecords.FirstOrDefault(x => x.DataId == dataId);
|
||||
if (IsHaveCodeRecords == null) ///是否已存在编码
|
||||
{
|
||||
string ruleCodeower = string.Empty;
|
||||
int digit = 4; ///流水位数
|
||||
string symbolower = "-"; ///业主间隔符
|
||||
int digitower = 4; ///业主流水位数
|
||||
string symbol = "-"; ///间隔符
|
||||
var project = db.Base_Project.FirstOrDefault(e => e.ProjectId == projectId); ////项目
|
||||
if (project != null && !string.IsNullOrEmpty(dataId))
|
||||
{
|
||||
string projectCode = project.ProjectCode; ///项目编号
|
||||
////编码规则表
|
||||
var sysCodeTemplateRule = db.ProjectData_CodeTemplateRule.FirstOrDefault(x => x.MenuId == menuId && x.ProjectId == projectId);
|
||||
if (sysCodeTemplateRule != null)
|
||||
{
|
||||
symbol = sysCodeTemplateRule.Symbol;
|
||||
symbolower = sysCodeTemplateRule.OwerSymbol;
|
||||
|
||||
if (sysCodeTemplateRule.Digit.HasValue)
|
||||
{
|
||||
digit = sysCodeTemplateRule.Digit.Value;
|
||||
}
|
||||
if (sysCodeTemplateRule.OwerDigit.HasValue)
|
||||
{
|
||||
digitower = sysCodeTemplateRule.OwerDigit.Value;
|
||||
}
|
||||
if (sysCodeTemplateRule.IsProjectCode == true)
|
||||
{
|
||||
ruleCode = projectCode + symbol;
|
||||
}
|
||||
if (sysCodeTemplateRule.OwerIsProjectCode == true)
|
||||
{
|
||||
ruleCodeower = projectCode + symbolower;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(sysCodeTemplateRule.Prefix))
|
||||
{
|
||||
ruleCode += sysCodeTemplateRule.Prefix + symbol;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(sysCodeTemplateRule.OwerPrefix))
|
||||
{
|
||||
ruleCodeower += sysCodeTemplateRule.OwerPrefix + symbolower;
|
||||
}
|
||||
if (sysCodeTemplateRule.IsUnitCode == true || sysCodeTemplateRule.OwerIsUnitCode == true)
|
||||
{
|
||||
var unit = db.Base_Unit.FirstOrDefault(x => x.UnitId == unitId);
|
||||
if (unit != null)
|
||||
{
|
||||
if (sysCodeTemplateRule.IsUnitCode == true)
|
||||
{ ruleCode = unit.UnitCode + symbol; }
|
||||
|
||||
if (sysCodeTemplateRule.OwerIsUnitCode == true)
|
||||
{
|
||||
ruleCodeower = unit.UnitCode + symbolower;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////获取编码记录表最大排列序号
|
||||
int maxNewSortIndex = 0;
|
||||
if (!String.IsNullOrEmpty(projectId))
|
||||
{
|
||||
var maxSortIndex = db.Sys_CodeRecords.Where(x => x.ProjectId == projectId && x.MenuId == menuId).Select(x => x.SortIndex).Max();
|
||||
if (maxSortIndex.HasValue)
|
||||
{
|
||||
maxNewSortIndex = maxSortIndex.Value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var maxSortIndexNull = db.Sys_CodeRecords.Where(x => x.MenuId == menuId).Select(x => x.SortIndex).Max();
|
||||
if (maxSortIndexNull.HasValue)
|
||||
{
|
||||
maxNewSortIndex = maxSortIndexNull.Value;
|
||||
}
|
||||
}
|
||||
maxNewSortIndex = maxNewSortIndex + 1;
|
||||
////插入数据库
|
||||
Model.Sys_CodeRecords newCodeRecords = new Model.Sys_CodeRecords
|
||||
{
|
||||
CodeRecordId = SQLHelper.GetNewID(typeof(Model.Sys_CodeRecords))
|
||||
};
|
||||
if (project != null)
|
||||
{
|
||||
newCodeRecords.ProjectId = project.ProjectId;
|
||||
}
|
||||
newCodeRecords.MenuId = menuId;
|
||||
newCodeRecords.DataId = dataId;
|
||||
newCodeRecords.UnitId = unitId;
|
||||
newCodeRecords.SortIndex = maxNewSortIndex;
|
||||
newCodeRecords.CompileDate = compileDate;
|
||||
newCodeRecords.RuleCodes = ruleCode;
|
||||
newCodeRecords.Digit = digit;
|
||||
newCodeRecords.OwnerRuleCodes = ruleCodeower;
|
||||
newCodeRecords.OwerDigit = digitower;
|
||||
if (!string.IsNullOrEmpty(ruleCode))
|
||||
{
|
||||
newCodeRecords.Code = ruleCode + (maxNewSortIndex.ToString().PadLeft(digit, '0')); ///字符自动补零 编码
|
||||
}
|
||||
else
|
||||
{
|
||||
newCodeRecords.Code = (maxNewSortIndex.ToString().PadLeft(digit, '0'));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(ruleCodeower))
|
||||
{
|
||||
newCodeRecords.OwnerCode = ruleCodeower + (maxNewSortIndex.ToString().PadLeft(digitower, '0')); ///字符自动补零 业主编码
|
||||
}
|
||||
else
|
||||
{
|
||||
newCodeRecords.OwnerCode = (maxNewSortIndex.ToString().PadLeft(digitower, '0'));
|
||||
}
|
||||
db.Sys_CodeRecords.InsertOnSubmit(newCodeRecords);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
ruleCode = IsHaveCodeRecords.Code;
|
||||
}
|
||||
|
||||
return ruleCode;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 根据菜单id,项目id 更新编码记录(当编码规则改变的时候 更新编码)
|
||||
/// <summary>
|
||||
/// 根据菜单id 更新编码记录(当编码规则改变的时候 更新编码)
|
||||
/// </summary>
|
||||
/// <param name="menuId"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="unitId"></param>
|
||||
public static void UpdateCodeRecordsByMenuIdProjectId(string menuId, string projectId)
|
||||
{
|
||||
var codeRecords = from x in Funs.DB.Sys_CodeRecords where x.MenuId == menuId && x.ProjectId == projectId select x;
|
||||
if (codeRecords.Count() > 0)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using BLL.CNCECHSSEService;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
@@ -501,12 +502,28 @@ namespace BLL
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
public static void DeleteAttachFileByIdForApi(string id)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Model.AttachFile attachFile = db.AttachFile.FirstOrDefault(e => e.ToKeyId == id);
|
||||
if (attachFile != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(attachFile.AttachUrl))
|
||||
{
|
||||
UploadFileService.DeleteFile(Funs.RootPath, attachFile.AttachUrl);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///根据主键删除附件
|
||||
/// </summary>
|
||||
/// <param name="lawRegulationId"></param>
|
||||
public static void DeleteAttachFileById(string menuId, string id)
|
||||
db.AttachFile.DeleteOnSubmit(attachFile);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
///根据主键删除附件
|
||||
/// </summary>
|
||||
/// <param name="lawRegulationId"></param>
|
||||
public static void DeleteAttachFileById(string menuId, string id)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.AttachFile attachFile = db.AttachFile.FirstOrDefault(e => e.MenuId == menuId && e.ToKeyId == id);
|
||||
@@ -520,15 +537,32 @@ namespace BLL
|
||||
db.AttachFile.DeleteOnSubmit(attachFile);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
public static void DeleteAttachFileByIdForApi(string menuId, string id)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Model.AttachFile attachFile = db.AttachFile.FirstOrDefault(e => e.MenuId == menuId && e.ToKeyId == id);
|
||||
if (attachFile != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(attachFile.AttachUrl))
|
||||
{
|
||||
BLL.UploadFileService.DeleteFile(Funs.RootPath, attachFile.AttachUrl);
|
||||
}
|
||||
|
||||
#region 根据主键删除流程
|
||||
/// <summary>
|
||||
///根据主键删除流程
|
||||
/// </summary>
|
||||
/// <param name="lawRegulationId"></param>
|
||||
public static void DeleteFlowOperateByID(string id)
|
||||
db.AttachFile.DeleteOnSubmit(attachFile);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据主键删除流程
|
||||
/// <summary>
|
||||
///根据主键删除流程
|
||||
/// </summary>
|
||||
/// <param name="lawRegulationId"></param>
|
||||
public static void DeleteFlowOperateByID(string id)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
@@ -628,15 +662,95 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public static void btnSaveDataForApi(string projectId, string menuId, string dataId, string userId, bool isClosed, string content, string url)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Model.Sys_FlowOperate newFlowOperate = new Model.Sys_FlowOperate
|
||||
{
|
||||
MenuId = menuId,
|
||||
DataId = dataId,
|
||||
OperaterId = userId,
|
||||
State = Const.State_2,
|
||||
IsClosed = isClosed,
|
||||
Opinion = "系统自动关闭流程",
|
||||
ProjectId = projectId,
|
||||
Url = url
|
||||
};
|
||||
var user = db.Sys_User.FirstOrDefault(e => e.UserId == newFlowOperate.OperaterId);
|
||||
if (user != null)
|
||||
{
|
||||
var roles = RoleService.GetRoleByRoleId(user.RoleId);
|
||||
if (roles != null && !string.IsNullOrEmpty(roles.RoleName))
|
||||
{
|
||||
newFlowOperate.AuditFlowName = "[" + roles.RoleName + "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
newFlowOperate.AuditFlowName = "[" + user.UserName + "]";
|
||||
}
|
||||
|
||||
#region 接收http post请求
|
||||
/// 接收http post请求
|
||||
/// </summary>
|
||||
/// <param name="url">地址</param>
|
||||
/// <param name="parameters">查询参数集合</param>
|
||||
/// <returns></returns>
|
||||
public static string CreateGetHttpResponse(string url)
|
||||
newFlowOperate.AuditFlowName += "系统审核完成";
|
||||
}
|
||||
|
||||
var updateFlowOperate = from x in db.Sys_FlowOperate
|
||||
where x.DataId == newFlowOperate.DataId && (x.IsClosed == false || !x.IsClosed.HasValue)
|
||||
select x;
|
||||
if (updateFlowOperate.Count() > 0)
|
||||
{
|
||||
foreach (var item in updateFlowOperate)
|
||||
{
|
||||
item.OperaterId = newFlowOperate.OperaterId;
|
||||
item.OperaterTime = System.DateTime.Now;
|
||||
item.State = newFlowOperate.State;
|
||||
item.Opinion = newFlowOperate.Opinion;
|
||||
item.AuditFlowName = "系统审核完成";
|
||||
item.IsClosed = newFlowOperate.IsClosed;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int maxSortIndex = 1;
|
||||
var flowSet = db.Sys_FlowOperate.Where(x => x.DataId == newFlowOperate.DataId);
|
||||
var sortIndex = flowSet.Select(x => x.SortIndex).Max();
|
||||
if (sortIndex.HasValue)
|
||||
{
|
||||
maxSortIndex = sortIndex.Value + 1;
|
||||
}
|
||||
newFlowOperate.FlowOperateId = SQLHelper.GetNewID(typeof(Model.Sys_FlowOperate));
|
||||
newFlowOperate.SortIndex = maxSortIndex;
|
||||
newFlowOperate.OperaterTime = System.DateTime.Now;
|
||||
newFlowOperate.AuditFlowName = "系统审核完成";
|
||||
db.Sys_FlowOperate.InsertOnSubmit(newFlowOperate);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
if (newFlowOperate.IsClosed == true)
|
||||
{
|
||||
var updateNoClosedFlowOperate = from x in Funs.DB.Sys_FlowOperate
|
||||
where x.DataId == newFlowOperate.DataId && (x.IsClosed == false || !x.IsClosed.HasValue)
|
||||
select x;
|
||||
if (updateNoClosedFlowOperate.Count() > 0)
|
||||
{
|
||||
foreach (var itemClosed in updateNoClosedFlowOperate)
|
||||
{
|
||||
itemClosed.IsClosed = true;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 接收http post请求
|
||||
/// 接收http post请求
|
||||
/// </summary>
|
||||
/// <param name="url">地址</param>
|
||||
/// <param name="parameters">查询参数集合</param>
|
||||
/// <returns></returns>
|
||||
public static string CreateGetHttpResponse(string url)
|
||||
{
|
||||
ServicePointManager.Expect100Continue = true;
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
|
||||
|
||||
@@ -350,13 +350,62 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void SaveAttachUrlForApi(string source, string attachUrl, string menuId, string toKeyId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string rootUrl = ConfigurationManager.AppSettings["localRoot"];
|
||||
if (string.IsNullOrEmpty(rootUrl))
|
||||
{
|
||||
rootUrl = Funs.RootPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过附件路径得到Source
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetSourceByAttachUrl(string attachUrl, int size, string oldSrouce)
|
||||
List<Model.AttachFile> sour = (from x in db.AttachFile
|
||||
where x.MenuId == menuId && x.ToKeyId == toKeyId
|
||||
select x).ToList();
|
||||
if (sour.Count() == 0)
|
||||
{
|
||||
Model.AttachFile att = new Model.AttachFile
|
||||
{
|
||||
AttachFileId = SQLHelper.GetNewID(),
|
||||
ToKeyId = toKeyId,
|
||||
AttachSource = source.ToString(),
|
||||
AttachUrl = attachUrl,
|
||||
MenuId = menuId,
|
||||
// ImageByte= imageByte,
|
||||
//AttachPath= attachPath,
|
||||
};
|
||||
if (menuId == BLL.Const.PersonListMenuId)
|
||||
{
|
||||
att.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]);
|
||||
}
|
||||
db.AttachFile.InsertOnSubmit(att);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.AttachFile att = db.AttachFile.FirstOrDefault(x => x.MenuId == menuId && x.AttachFileId == sour.First().AttachFileId);
|
||||
if (att != null)
|
||||
{
|
||||
att.ToKeyId = toKeyId;
|
||||
att.AttachSource = source.ToString();
|
||||
att.AttachUrl = attachUrl;
|
||||
att.MenuId = menuId;
|
||||
if (menuId == BLL.Const.PersonListMenuId)
|
||||
{
|
||||
att.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]);
|
||||
}
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 通过附件路径得到Source
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetSourceByAttachUrl(string attachUrl, int size, string oldSrouce)
|
||||
{
|
||||
string attachSource = string.Empty;
|
||||
if (!string.IsNullOrEmpty(attachUrl))
|
||||
|
||||
Reference in New Issue
Block a user