修改往来单位地址

optimize
jianghaiqing 1 year ago
parent 89a167db6d
commit ac9a5abe7e

@ -3,6 +3,7 @@ using Furion.DistributedIDGenerator;
using Furion.DynamicApiController;
using Furion.FriendlyException;
using Furion.JsonSerialization;
using Google.Protobuf.Collections;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
@ -131,13 +132,19 @@ namespace Myshipping.Application
UserTendDto userTendInfo = GetUserTendInfo(info.Main.RecvUserId);
//根据状态编号检索对应的状态和活动信息,如果已经提取到的状态数量与推送的不一致不能直接返回错误
//检索状态对应所有的服务流程如果已经提取到的状态数量与推送的不一致提示错误不能入库s
var skuList = _statusSkuBaseInfoRepository.AsQueryable().Filter(null, true)
.LeftJoin<ServiceWorkFlowActivitiesInfo>((sts, act) => sts.PK_ID == act.STATUS_SKU_ID)
.LeftJoin<ServiceWorkFlowActivitiesSubRelation>((sts,act,rela)=>
act.PK_ID == rela.SERVICE_ACTIVITIES_ID)
.LeftJoin<ServiceWorkFlowBaseInfo>((sts, act, rela,wf)=>
rela.SERVICE_WORKFLOW_ID == wf.PK_ID && rela.WF_VERSION == wf.RELEASE_VERSION)
.Where((sts, act) => statusArg.Contains(sts.STATUS_SKU_CODE) && !sts.IsDeleted && sts.IS_ENABLE == 1
&& !act.IsDeleted)
.Select((sts, act) => new { Sku = sts, Act = act }).ToList();
.Select((sts, act,rela,wf) =>
new { Sku = sts, Act = act, Rela = rela,WF = wf }).ToList();
//推送状态与已有状态进行匹配
var reqStatusList =
info.Main.StatusList.GroupJoin(skuList, l => l.StatusCode, r => r.Sku.STATUS_SKU_CODE,
(l, r) =>
@ -149,11 +156,12 @@ namespace Myshipping.Application
return new { Exists = false, Sku = new StatusSkuBaseInfo(), Act = new ServiceWorkFlowActivitiesInfo(),Req = l };
}).ToList();
if (reqStatusList.Any(a=>!a.Exists))
//如果有不存在的状态则提示无法入库
if (reqStatusList.Any(a => !a.Exists))
{
var errList =
reqStatusList.Where(a => !a.Exists)
.Select(a=>a.Req.StatusCode).ToArray();
.Select(a => a.Req.StatusCode).ToArray();
string errMsg = $"以下状态不存在 {(string.Join(",", errList))} 不能入库";
@ -170,8 +178,46 @@ namespace Myshipping.Application
&& m.BUSI_SYSTEM_CODE.Equals(info.Main.BusiSystemCode) && !m.IsDeleted && !s.IsDeleted)
.Select((m, s) => new { main = m, sub = s }).ToList();
var wfList = skuList.Select(a => a.WF)
.Distinct().ToList();
//var ddd = wfList.GroupJoin(runList, l => l.PK_ID,
// r => r.main.SERVICE_WF_ID,
// (l, r) => {
// var currList = r.ToList();
// if (currList.Count > 0)
// {
// return new { Exists = true, WF = l };
// }
// return { Exists = true, WF = l };
// }).ToList();
//状态关联的服务流程与运行表中的服务流程对应,对已经有的进行更新,对未进入运行表的进行写入
var actArg = reqStatusList.Select(a => a.Act.PK_ID).ToArray();
//根据服务流程活动获取所有相关的服务流程
var wfRlt = _serviceWorkFlowBaseService.GetServiceWorkFlowListByActivities(actArg).GetAwaiter().GetResult();
if (!wfRlt.succ)
{
string errMsg = $"获取服务流程失败,原因:{wfRlt.msg}";
_logger.LogInformation("批次={no} {msg}", batchNo, errMsg);
throw Oops.Oh(errMsg, typeof(InvalidOperationException));
}
var list = JSON.Deserialize<List<ServiceWorkFlowBaseShowDto>>(JSON.Serialize(wfRlt.ext));
//list.GroupJoin(runList,l=>l.)
//如果有已经运行的业务主键则只补充对应的活动表
if(runList.Count > 0)
if (runList.Count > 0)
{
reqStatusList.ForEach(async reqMd =>
{
@ -192,22 +238,13 @@ namespace Myshipping.Application
}
else
{
var actArg = reqStatusList.Select(a => a.Act.PK_ID).ToArray();
//获取最后发布的服务流程写入运行表
var wfRlt = _serviceWorkFlowBaseService.GetServiceWorkFlowListByActivities(actArg).GetAwaiter().GetResult();
if(!wfRlt.succ)
{
string errMsg = $"获取服务流程失败,原因:{wfRlt.msg}";
_logger.LogInformation("批次={no} {msg}", batchNo, errMsg);
throw Oops.Oh(errMsg, typeof(InvalidOperationException));
}
DateTime nowDate = DateTime.Now;
var list = JSON.Deserialize<List<ServiceWorkFlowBaseShowDto>>(JSON.Serialize(wfRlt.ext));
list.ForEach(async wf =>
{

@ -301,7 +301,20 @@ namespace Myshipping.Core.Service
var curList = r.ToList();
if (curList.Count > 0)
{
l.Addrs = curList.Adapt<List<DjyCustomerAddrInput>>();
}
if(!string.IsNullOrWhiteSpace(l.Addr))
{
if(l.Addrs == null)
l.Addrs = new List<DjyCustomerAddrInput>();
l.Addrs.Add(new DjyCustomerAddrInput {
CustomerId = l.Id,
Addr = l.Addr,
});
}
return l;

Loading…
Cancel
Save