修改服务流程推送状态

optimize
jianghaiqing 1 year ago
parent 274adfcfb2
commit 4091b9309d

@ -138,31 +138,6 @@ namespace Myshipping.Application
/// </summary>
public string RecvUserName { get; set; }
/// <summary>
/// 任务对应接收操作人ID(大简云账户体系)
/// </summary>
public string DJYRecvUserId { get; set; }
/// <summary>
/// 任务对应接收操作人名称(大简云账户体系)
/// </summary>
public string DJYRecvUserName { get; set; }
/// <summary>
/// 任务对应接收操作人邮箱(大简云账户体系)
/// </summary>
public string DJYRecvUserEmail { get; set; }
/// <summary>
/// 任务对应部门代码(大简云账户体系)
/// </summary>
public string DJYTaskOrgCode { get; set; }
/// <summary>
/// 任务对应部门名称(大简云账户体系)
/// </summary>
public string DJYTaskOrgName { get; set; }
/// <summary>
/// 状态列表
/// </summary>

@ -262,8 +262,27 @@ namespace Myshipping.Application
entity.UpdatedUserId = UserManager.UserId;
entity.UpdatedUserName = UserManager.Name;
if(string.IsNullOrWhiteSpace(model.DEVELOP_VERSION) && !string.IsNullOrWhiteSpace(model.RELEASE_VERSION))
if (!isSetEnable)
{
entity.IS_ENABLE = model.IS_ENABLE;
}
entity.IS_LOCK = model.IS_LOCK;
if (string.IsNullOrWhiteSpace(model.DEVELOP_VERSION))
{
if(!string.IsNullOrWhiteSpace(model.RELEASE_VERSION))
{
entity.DEVELOP_VERSION = "DEVELOP";
}
}
else
{
entity.DEVELOP_VERSION = model.DEVELOP_VERSION;
}
currVersion = entity.DEVELOP_VERSION;
if (info.StatusSkuList != null && info.StatusSkuList.Count > 0)
{
@ -290,7 +309,7 @@ namespace Myshipping.Application
it.IS_LOCK
}).ExecuteCommandAsync();
currVersion = model.DEVELOP_VERSION;
currVersion = entity.DEVELOP_VERSION;
//批量删除服务流程与服务项目关系(物理删除)
_serviceWorkFlowProjectRelationRepository.EntityContext.Deleteable<ServiceWorkFlowProjectRelation>()
@ -529,16 +548,18 @@ namespace Myshipping.Application
1ID
2
*/
var activitiesList = _serviceWorkFlowActivitiesRelationRepository.AsQueryable()
.LeftJoin<ServiceWorkFlowBaseInfo>((rela, wf) => rela.SERVICE_WORKFLOW_ID == wf.PK_ID)
var activitiesList = _serviceWorkFlowActivitiesRelationRepository.AsQueryable().Filter(null, true)
.LeftJoin<ServiceWorkFlowBaseInfo>((rela, wf) => rela.SERVICE_WORKFLOW_ID == wf.PK_ID
&& rela.WF_VERSION == wf.RELEASE_VERSION)
.Where((rela,wf) => activitiesArgs.Contains(rela.SERVICE_ACTIVITIES_ID)
&& !wf.IsDeleted && wf.IS_ENABLE == 1 && !string.IsNullOrWhiteSpace(wf.RELEASE_VERSION))
&& !wf.IsDeleted && wf.IS_ENABLE == 1)
.Select((rela, wf) => wf).Distinct().ToList();
var subActList = _serviceWorkFlowActivitiesSubRelationRepository.AsQueryable()
.LeftJoin<ServiceWorkFlowBaseInfo>((rela, wf) => rela.SERVICE_WORKFLOW_ID == wf.PK_ID)
var subActList = _serviceWorkFlowActivitiesSubRelationRepository.AsQueryable().Filter(null, true)
.LeftJoin<ServiceWorkFlowBaseInfo>((rela, wf) => rela.SERVICE_WORKFLOW_ID == wf.PK_ID
&& rela.WF_VERSION == wf.RELEASE_VERSION)
.Where((rela, wf) => activitiesArgs.Contains(rela.SUB_SERVICE_ACTIVITIES_ID)
&& !wf.IsDeleted && wf.IS_ENABLE == 1 && !string.IsNullOrWhiteSpace(wf.RELEASE_VERSION))
&& !wf.IsDeleted && wf.IS_ENABLE == 1)
.Select((rela, wf) => wf).Distinct().ToList();
if(subActList.Count > 0)
@ -558,41 +579,41 @@ namespace Myshipping.Application
var wfArg = activitiesList.Select(a => a.PK_ID).ToArray();
var mergeList =
_serviceWorkFlowBaseRepository.AsQueryable()
_serviceWorkFlowBaseRepository.AsQueryable().Filter(null, true)
.LeftJoin<ServiceWorkFlowActivitiesRelation>((wf, rela) => wf.PK_ID == rela.SERVICE_WORKFLOW_ID
&& wf.RELEASE_VERSION == rela.WF_VERSION)
.Where(wf => wfArg.Contains(wf.PK_ID))
.Select((wf, rela) => new { WF = wf, Rela = rela })
.LeftJoin<ServiceWorkFlowActivitiesInfo>((rela, act) =>
rela.Rela.SERVICE_ACTIVITIES_ID == act.PK_ID)
.LeftJoin<StatusSkuBaseInfo>((rela, act, sku) =>
.LeftJoin<ServiceWorkFlowActivitiesInfo>((wf,rela, act) =>
rela.SERVICE_ACTIVITIES_ID == act.PK_ID && wf.RELEASE_VERSION == rela.WF_VERSION)
.LeftJoin<StatusSkuBaseInfo>((wf,rela, act, sku) =>
act.STATUS_SKU_ID == sku.PK_ID)
.Select((rela, act, sku) =>
new { WF = rela.WF, Act = act, Sku = sku, SortNo = rela.Rela.SORT_NO, IsSub = rela.Rela.IS_CONTAINS_SUB, ValType = rela.Rela.VAL_TYPE })
.Where((wf) => wfArg.Contains(wf.PK_ID))
.Select((wf,rela, act, sku) =>
new { WF = wf, Act = act, Sku = sku, SortNo = rela.SORT_NO, IsSub = rela.IS_CONTAINS_SUB, ValType = rela.VAL_TYPE })
.ToList();
var mergeSubList =
_serviceWorkFlowBaseRepository.AsQueryable()
_serviceWorkFlowBaseRepository.AsQueryable().Filter(null, true)
.LeftJoin<ServiceWorkFlowActivitiesSubRelation>((wf, rela) => wf.PK_ID == rela.SERVICE_WORKFLOW_ID
&& wf.RELEASE_VERSION == rela.WF_VERSION)
.Where(wf => wfArg.Contains(wf.PK_ID))
.Select((wf, rela) => new { WF = wf, Rela = rela })
.LeftJoin<ServiceWorkFlowActivitiesInfo>((rela, act) =>
rela.Rela.SUB_SERVICE_ACTIVITIES_ID == act.PK_ID)
.LeftJoin<StatusSkuBaseInfo>((rela, act, sku) =>
.LeftJoin<ServiceWorkFlowActivitiesInfo>((wf, rela, act) =>
rela.SUB_SERVICE_ACTIVITIES_ID == act.PK_ID && wf.RELEASE_VERSION == rela.WF_VERSION)
.LeftJoin<StatusSkuBaseInfo>((wf, rela, act, sku) =>
act.STATUS_SKU_ID == sku.PK_ID)
.Select((rela, act, sku) =>
new { WF = rela.WF, Act = act, Sku = sku, SortNo = rela.Rela.SORT_NO, ParentId = rela.Rela.SERVICE_ACTIVITIES_ID, ValType = rela.Rela.VAL_TYPE })
.Where((wf) => wfArg.Contains(wf.PK_ID))
.Select((wf,rela, act, sku) =>
new { WF = wf, Act = act, Sku = sku, SortNo = rela.SORT_NO, ParentId = rela.SERVICE_ACTIVITIES_ID, ValType = rela.VAL_TYPE })
.ToList();
var prjectList = _serviceWorkFlowBaseRepository.AsQueryable()
var prjectList =
_serviceWorkFlowBaseRepository.AsQueryable().Filter(null, true)
.LeftJoin<ServiceWorkFlowProjectRelation>((wf, rela) => wf.PK_ID == rela.SERVICE_WORKFLOW_ID
&& wf.RELEASE_VERSION == rela.WF_VERSION)
.Select((wf,rela)=> new { WF = wf, Rela = rela })
.LeftJoin<ServiceProjectBaseInfo>((rela, prj) =>
rela.Rela.SERVICE_PROJECT_ID == prj.PK_ID)
.Select((rela, prj) => new{ WF = rela.WF, Rela = rela.Rela,Prj = prj }).ToList();
.LeftJoin<ServiceProjectBaseInfo>((wf,rela, prj) =>
rela.SERVICE_PROJECT_ID == prj.PK_ID)
.Where((wf) => wfArg.Contains(wf.PK_ID))
.Select((wf,rela, prj) => new{ WF = wf, Rela = rela,Prj = prj }).ToList();
var list = mergeList.GroupBy(a => a.WF.PK_ID)
@ -615,7 +636,8 @@ namespace Myshipping.Application
{
actModel.SubList = mergeSubList.Where(
b =>
b.WF.PK_ID == a.WF.PK_ID && b.Act.PK_ID == a.Act.PK_ID).OrderBy(b => b.SortNo)
b.WF.PK_ID == a.WF.PK_ID && b.ParentId == a.Act.PK_ID)
.OrderBy(b => b.SortNo)
.Select(b =>
{
@ -1233,14 +1255,15 @@ namespace Myshipping.Application
};
if (lastReleaseInfo != null)
{
releaseInfo.LAST_PK_ID = lastReleaseInfo.PK_ID;
lastReleaseInfo.IS_DEL = 1;
_serviceWorkFlowReleaseInfoRepository.AsUpdateable(lastReleaseInfo).UpdateColumns(it => new
{
it.IS_DEL
}).ExecuteCommand();
}
//写入发布表
_serviceWorkFlowReleaseInfoRepository.Insert(releaseInfo);

@ -3,11 +3,13 @@ using Furion.DistributedIDGenerator;
using Furion.DynamicApiController;
using Furion.FriendlyException;
using Furion.JsonSerialization;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Myshipping.Application.Entity;
using Myshipping.Core;
using Myshipping.Core.Entity;
using NPOI.OpenXmlFormats.Vml;
using NPOI.SS.Formula.Functions;
using Org.BouncyCastle.Asn1.Tsp;
using Org.BouncyCastle.Ocsp;
@ -23,7 +25,7 @@ namespace Myshipping.Application
/// <summary>
/// 服务流程管理
/// </summary>
[ApiDescriptionSettings("Application", Name = "ServiceWorkFlowManage", Order = 30)]
[AllowAnonymous, ApiDescriptionSettings("Application", Name = "ServiceWorkFlowManage", Order = 30)]
public class ServiceWorkFlowManageService : IServiceWorkFlowManageService, IDynamicApiController, ITransient
{
private readonly ILogger<ServiceWorkFlowManageService> _logger;
@ -124,20 +126,10 @@ namespace Myshipping.Application
throw Oops.Oh($"报文Main的状态列表至少需要提供一个以上的状态信息", typeof(InvalidOperationException));
}
UserTendDto userTendInfo = null;
//如果大简云用户ID不为空接收人为空时通过大简云用户ID关联订舱人ID
if (!string.IsNullOrWhiteSpace(info.Main.DJYRecvUserId))
{
userTendInfo = GetUserTendInfoByDJYUserId(info.Main.DJYRecvUserId, info.Main.DJYRecvUserEmail);
}
else
{
userTendInfo = GetUserTendInfo(info.Main.RecvUserId);
}
UserTendDto userTendInfo = GetUserTendInfo(info.Main.RecvUserId);
//根据状态编号检索对应的状态和活动信息,如果已经提取到的状态数量与推送的不一致不能直接返回错误
var skuList = _statusSkuBaseInfoRepository.AsQueryable()
var skuList = _statusSkuBaseInfoRepository.AsQueryable().Filter(null, true)
.LeftJoin<ServiceWorkFlowActivitiesInfo>((sts, act) => sts.PK_ID == act.STATUS_SKU_ID)
.Where((sts, act) => statusArg.Contains(sts.STATUS_SKU_CODE) && !sts.IsDeleted && sts.IS_ENABLE == 1
&& !act.IsDeleted)
@ -168,7 +160,7 @@ namespace Myshipping.Application
}
//先从运行表按主键获取运行主表和活动表
var runList = _serviceWorkFlowRunInfoRepository.AsQueryable()
var runList = _serviceWorkFlowRunInfoRepository.AsQueryable().Filter(null, true)
.LeftJoin<ServiceWorkFlowRunActivitiesInfo>(
(m, s) => m.PK_ID == s.RUN_ID)
.Where((m, s) => m.BUSI_ID == info.Main.BusiId
@ -254,8 +246,6 @@ namespace Myshipping.Application
IS_START = sku.SortNo == 1 ? 1 : 0,
IS_END = sku.SortNo == endNum ? 1 : 0,
ACT_ID = sku.PKId,
ACT_DATE = currReq.Req.StatusDate,
ACT_VAL = currReq.Req.StatusVal,
STATUS_SKU_CODE = sku.statusSkuBase.StatusSKUCode,
STATUS_SKU_ID = sku.StatusSKUId,
SHOW_NAME = sku.ShowName,
@ -272,7 +262,14 @@ namespace Myshipping.Application
SOURCE_TYPE = "AUTO"
};
if(!string.IsNullOrWhiteSpace(lastActId))
if(currReq != null)
{
activitiesRunInfo.ACT_DATE = currReq.Req.StatusDate;
activitiesRunInfo.ACT_VAL = currReq.Req.StatusVal;
}
if (!string.IsNullOrWhiteSpace(lastActId))
activitiesRunInfo.NEXT_ACT_ID = lastActId;
await _serviceWorkFlowRunActivitiesInfoRepository.InsertAsync(activitiesRunInfo);
@ -296,8 +293,6 @@ namespace Myshipping.Application
IS_START = sub.SortNo == 1 ? 1 : 0,
IS_END = sub.SortNo == endNum ? 1 : 0,
ACT_ID = sub.PKId,
ACT_DATE = currSubReq.Req.StatusDate,
ACT_VAL = currSubReq.Req.StatusVal,
STATUS_SKU_CODE = sub.statusSkuBase.StatusSKUCode,
STATUS_SKU_ID = sub.StatusSKUId,
SHOW_NAME = sub.ShowName,
@ -314,6 +309,12 @@ namespace Myshipping.Application
SOURCE_TYPE = "AUTO"
};
if(currSubReq != null)
{
activitiesSubRunInfo.ACT_DATE = currSubReq.Req.StatusDate;
activitiesSubRunInfo.ACT_VAL = currSubReq.Req.StatusVal;
}
if (!string.IsNullOrWhiteSpace(lastSubActId))
activitiesSubRunInfo.NEXT_ACT_ID = lastSubActId;

Loading…
Cancel
Save