修改服务发布

optimize
jianghaiqing 1 year ago
parent 2f0d61d385
commit 956fba5fc3

@ -44,5 +44,10 @@ namespace Myshipping.Application
/// 值类型 STRING-字符 DATETIME-日期
/// </summary>
public string VAL_TYPE { get; set; }
/// <summary>
/// 流程版本号
/// </summary>
public string WF_VERSION { get; set; }
}
}

@ -44,5 +44,10 @@ namespace Myshipping.Application
/// 值类型 STRING-字符 DATETIME-日期
/// </summary>
public string VAL_TYPE { get; set; }
/// <summary>
/// 流程版本号
/// </summary>
public string WF_VERSION { get; set; }
}
}

@ -32,5 +32,10 @@ namespace Myshipping.Application.Entity
/// 服务项目主键
/// </summary>
public string SERVICE_PROJECT_ID { get; set; }
/// <summary>
/// 流程版本号
/// </summary>
public string WF_VERSION { get; set; }
}
}

@ -38,7 +38,7 @@ namespace Myshipping.Application.Entity
/// <summary>
/// 发布人
/// </summary>
public string PUBLISH_ER { get; set; }
public long PUBLISH_ER { get; set; }
/// <summary>
/// 发布人名称

@ -41,7 +41,8 @@ namespace Myshipping.Application
SqlSugarRepository<ServiceWorkFlowActivitiesInfo> serviceWorkFlowActivitiesInfoRepository,
SqlSugarRepository<ServiceWorkFlowProjectRelation> serviceWorkFlowProjectRelationRepository,
SqlSugarRepository<ServiceWorkFlowActivitiesRelation> serviceWorkFlowActivitiesRelationRepository,
SqlSugarRepository<ServiceWorkFlowActivitiesSubRelation> serviceWorkFlowActivitiesSubRelationRepository)
SqlSugarRepository<ServiceWorkFlowActivitiesSubRelation> serviceWorkFlowActivitiesSubRelationRepository,
SqlSugarRepository<ServiceWorkFlowReleaseInfo> serviceWorkFlowReleaseInfoRepository)
{
_serviceWorkFlowBaseRepository = serviceWorkFlowBaseRepository;
_serviceWorkFlowActivitiesInfoRepository = serviceWorkFlowActivitiesInfoRepository;
@ -50,6 +51,7 @@ namespace Myshipping.Application
_logger = logger;
_serviceWorkFlowActivitiesSubRelationRepository = serviceWorkFlowActivitiesSubRelationRepository;
_serviceWorkFlowReleaseInfoRepository = serviceWorkFlowReleaseInfoRepository;
}
/// <summary>
@ -238,15 +240,15 @@ namespace Myshipping.Application
//批量删除服务流程与服务项目关系(物理删除)
_serviceWorkFlowProjectRelationRepository.EntityContext.Deleteable<ServiceWorkFlowProjectRelation>()
.EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID).ExecuteCommand();
.EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == "DEVELOP").ExecuteCommand();
//批量删除服务流程与服务活动关系(物理删除)
_serviceWorkFlowActivitiesRelationRepository.EntityContext.Deleteable<ServiceWorkFlowActivitiesRelation>()
.EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID).ExecuteCommand();
.EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == "DEVELOP").ExecuteCommand();
//批量删除服务流程活动与子活动的关系(物理删除)
_serviceWorkFlowActivitiesSubRelationRepository.EntityContext.Deleteable<ServiceWorkFlowActivitiesSubRelation>()
.EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID).ExecuteCommand();
.EnableQueryFilter().Where(a => a.SERVICE_WORKFLOW_ID == entity.PK_ID && a.WF_VERSION == "DEVELOP").ExecuteCommand();
}
//服务流程与服务项目关系
@ -256,6 +258,7 @@ namespace Myshipping.Application
PK_ID = IDGen.NextID().ToString(),
SERVICE_WORKFLOW_ID = entity.PK_ID,
SERVICE_PROJECT_ID = info.ServiceProject.PKId,
WF_VERSION = "DEVELOP"
};
//插入关系
@ -273,7 +276,8 @@ namespace Myshipping.Application
SERVICE_ACTIVITIES_ID = sku.PKId,
SORT_NO = sku.SortNo,
IS_CONTAINS_SUB = sku.IsContainsSub,
VAL_TYPE = !string.IsNullOrWhiteSpace(sku.ValType)? sku.ValType: StatusSKUValTypeEnum.DATETIME.ToString()
VAL_TYPE = !string.IsNullOrWhiteSpace(sku.ValType)? sku.ValType: StatusSKUValTypeEnum.DATETIME.ToString(),
WF_VERSION = "DEVELOP"
};
await _serviceWorkFlowActivitiesRelationRepository.InsertAsync(wfRelationActivities);
@ -288,7 +292,8 @@ namespace Myshipping.Application
SERVICE_WORKFLOW_ID = entity.PK_ID,
SERVICE_ACTIVITIES_ID = sku.PKId,
SUB_SERVICE_ACTIVITIES_ID = sub.PKId,
SORT_NO = sub.SortNo
SORT_NO = sub.SortNo,
WF_VERSION = "DEVELOP"
};
await _serviceWorkFlowActivitiesSubRelationRepository.InsertAsync(wfRelationActivitiesSub);
@ -998,15 +1003,41 @@ namespace Myshipping.Application
if (model == null)
throw Oops.Oh($"服务流程获取失败,服务流程信息不存在或已作废", typeof(InvalidOperationException));
var lastReleaseInfo = _serviceWorkFlowReleaseInfoRepository.AsQueryable()
.First(a => a.SERVICE_WORKFLOW_ID == model.PK_ID && a.IS_DEL == 0);
int currNum = lastReleaseInfo == null ? 1 : lastReleaseInfo.TOTAL_NUM;
ServiceWorkFlowReleaseInfo releaseInfo = new ServiceWorkFlowReleaseInfo
{
PK_ID = IDGen.NextID().ToString(),
SERVICE_WORKFLOW_ID = model.PK_ID,
LAST_PK_ID = lastReleaseInfo.PK_ID,
PUBLISH_DATE = DateTime.Now,
IS_DEL = 0,
PUBLISH_ER = UserManager.UserId,
PUBLISH_NAME = UserManager.Name,
TOTAL_NUM = currNum + 1,
};
//写入发布表
_serviceWorkFlowReleaseInfoRepository.Insert(releaseInfo);
model.RELEASE_VERSION = releaseInfo.RELEASE_VERSION;
model.UpdatedTime = DateTime.Now;
model.UpdatedUserId = UserManager.UserId;
model.UpdatedUserName = UserManager.Name;
await _serviceWorkFlowBaseRepository.AsUpdateable(model).UpdateColumns(it => new
{
it.RELEASE_VERSION,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName,
}).ExecuteCommandAsync();
result.succ = true;
result.msg = "执行成功";
result.msg = "发布成功";
}
catch (Exception ex)

Loading…
Cancel
Save