客户工作流模板调整

master
ZR20090193-陈敬勇 9 months ago
parent 285e0e30c1
commit 458ebe47c9

@ -23,6 +23,14 @@ public static class MultiLanguageConst
/// </summary>
[Description("更新成功")]
public const string DataUpdateSuccess = "Data_Update_Success";
/// <summary>
/// 删除成功
/// </summary>
[Description("删除成功")]
public const string DataDelSuccess = "Data_Del_Success";
/// <summary>
/// 更新失败
/// </summary>
@ -70,6 +78,10 @@ public static class MultiLanguageConst
#region 工作流相关
[Description("工作流实例存在引用的流程模板不能删除")]
public const string FlowTemplateDelExistImport = "FlowTemplate_Del_Exist_Import";
[Description("引入的流程模板不存在")]
public const string FlowTemplateImportNotExist = "FlowTemplate_Import_NotExist";
/// <summary>
/// 只能修改【草稿】和【驳回】状态的流程
/// </summary>
@ -78,7 +90,7 @@ public static class MultiLanguageConst
/// <summary>
/// 该流程模板已不存在,请重新设计流程
/// </summary>
[Description("该流程模板不存在,请重新设计流程")]
[Description("该流程模板不存在")]
public const string FlowTemplateNotExist = "FlowTemplate_NotExist";
/// <summary>

@ -11,6 +11,7 @@ public class FlowTemplateRes
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 模板名称
/// </summary>
@ -27,6 +28,7 @@ public class FlowTemplateRes
/// 模块名称
/// </summary>
public string PermissionName { get; set; }
/// <summary>
///中文视图名;设计打印方案时,提供中文快捷按钮的视图来源
/// </summary>
@ -47,6 +49,10 @@ public class FlowTemplateRes
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 备注

@ -34,6 +34,13 @@ public interface IClientFlowTemplateService
/// <returns></returns>
DataResult ImportFlowTemplate(string id);
/// <summary>
/// 删除模板
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult DelFlowTemplate(string id);
/// <summary>
/// 获取模板列表
/// </summary>

@ -49,17 +49,7 @@ public class ClientFlowTemplateService : IClientFlowTemplateService
{
if (req.Id == 0)
{
var isExist = db.Queryable<FlowTemplateTenant>().Where(x => x.Name == req.Name).First();
if (isExist != null)
{
return DataResult.Failed("流程模板名称已存在!");
}
var data = req.Adapt<FlowTemplateTenant>();
var entity = db.Insertable(data).ExecuteReturnEntity();
return DataResult.Successed("添加成功!", entity.Id);
return DataResult.Failed("非法请求!",MultiLanguageConst.IllegalRequest);
}
else
{
@ -68,7 +58,7 @@ public class ClientFlowTemplateService : IClientFlowTemplateService
info = req.Adapt(info);
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("更新成功!");
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
}
}
@ -78,7 +68,7 @@ public class ClientFlowTemplateService : IClientFlowTemplateService
.Where(a => a.Id == long.Parse(id))
.Select<FlowTemplateRes>()
.First();
return DataResult<FlowTemplateRes>.Success(data);
return DataResult<FlowTemplateRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
}
public DataResult ImportFlowTemplate(string id)
@ -86,20 +76,37 @@ public class ClientFlowTemplateService : IClientFlowTemplateService
var info = db.Queryable<FlowTemplate>().Where(x => x.Id == long.Parse(id)).First();
if (info == null)
{
return DataResult.Failed("流程模板不存在!");
return DataResult.Failed("流程模板不存在!",MultiLanguageConst.FlowTemplateImportNotExist);
}
var data = info.Adapt<FlowTemplateTenant>();
db.Insertable(info).ExecuteCommand();
return DataResult.Successed("引入成功!");
return DataResult.Successed("引入成功!",MultiLanguageConst.DataImportSuccess);
}
public DataResult DelFlowTemplate(string id)
{
var info = db.Queryable<FlowTemplateTenant>().Where(x => x.Id == long.Parse(id)).First();
if (info == null)
{
return DataResult.Failed("流程模板不存在!",MultiLanguageConst.FlowTemplateNotExist);
}
if (db.Queryable<FlowInstance>().Where(x=>x.TemplateId == long.Parse(id)).Any())
{
return DataResult.Failed("工作流实例存在引用的流程模板不能删除!",MultiLanguageConst.FlowTemplateDelExistImport);
}
db.Deleteable(info).ExecuteCommand();
return DataResult.Successed("删除成功!",MultiLanguageConst.DataDelSuccess);
}
public DataResult<List<FlowTemplateRes>> GetFlowTemplateList(PageRequest request)
{
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = db.Queryable<FlowTemplate>()
// .LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
var data = db.Queryable<FlowTemplate>().Where(a=>a.Status == StatusEnum.Enable)
.LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
.Select<FlowTemplateRes>()
.Where(whereList).ToQueryPage(request.PageCondition);
return data;

@ -20,7 +20,7 @@ public class SysOrgRes
/// </summary>
public string OrgName { get; set; }
/// <summary>
/// <summary/>
/// Desc:负责人
/// Default:
/// Nullable:True
@ -36,7 +36,10 @@ public class SysOrgRes
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 是否部门标识
/// </summary>

@ -58,7 +58,30 @@ public class ClientFlowTemplateController : ApiController
var res = _invokeService.GetClientFlowTemplateInfo(id);
return res;
}
/// <summary>
/// 导入模板
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("ImportFlowTemplate")]
public DataResult ImportFlowTemplate([FromQuery] string id)
{
var res = _invokeService.ImportFlowTemplate(id);
return res;
}
/// <summary>
/// 删除模板
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("DelFlowTemplate")]
public DataResult DelFlowTemplate([FromQuery] string id)
{
var res = _invokeService.DelFlowTemplate(id);
return res;
}
/// <summary>
/// 获取模板列表

Loading…
Cancel
Save