修改任务链接分享

optimize
jianghaiqing 9 months ago
parent 4e5103d891
commit 7145646f26

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 预甩货调度状态枚举
/// </summary>
public enum RollingNominationDispatchStatusEnum
{
/// <summary>
/// 待确认
/// </summary>
[Description("待确认")]
WAIT,
/// <summary>
/// 已完成
/// </summary>
[Description("已完成")]
COMPLETE,
/// <summary>
/// 已取消
/// </summary>
[Description("已取消")]
CANCEL,
/// <summary>
/// 失效
/// </summary>
[Description("失效")]
EXPIRE
}
}

@ -49,9 +49,9 @@ namespace Myshipping.Application
/// <summary> /// <summary>
/// 查看分享链接 /// 查看分享链接
/// </summary> /// </summary>
/// <param name="nominationDispatchId">预甩货调度批次主键组</param> /// <param name="dispatchBatchId">预甩调度批次号</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetUrl(string nominationDispatchId); Task<TaskManageOrderResultDto> GetUrl(string dispatchBatchId);
/// <summary> /// <summary>
/// 获取Status是load的可配载的列表 /// 获取Status是load的可配载的列表
@ -89,5 +89,13 @@ namespace Myshipping.Application
/// <param name="dispatchBatchId">预甩调度批次ID</param> /// <param name="dispatchBatchId">预甩调度批次ID</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> CancelShareLink(string dispatchBatchId); Task<TaskManageOrderResultDto> CancelShareLink(string dispatchBatchId);
/// <summary>
/// 获取用户反馈信息
/// </summary>
/// <param name="dispatchBatchId">预甩调度批次ID</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetUserFeedBack(string dispatchBatchId);
} }
} }

@ -22,9 +22,9 @@ namespace Myshipping.Application
/// <summary> /// <summary>
/// 取消访问链接 /// 取消访问链接
/// </summary> /// </summary>
/// <param name="pkId">访问链接主键</param> /// <param name="busiId">访问链接业务主键</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> CancelShareLink(string pkId); Task<TaskManageOrderResultDto> CancelShareLink(string busiId);
/// <summary> /// <summary>

@ -553,6 +553,50 @@ namespace Myshipping.Application
/* /*
BOOKING_IDSHIPMENT(), BOOKING_IDSHIPMENT(),
*/ */
var list = _taskRollingNominationInfoRepository.AsQueryable().Filter(null, true)
.InnerJoin<TaskRollingNominationDetailInfo>((nom, detail) => nom.PK_ID == detail.NOM_ID)
.Where((nom, detail) => nom.PK_ID == nominationId
&& detail.IsDeleted == false && !detail.BOOKING_ID.HasValue)
.Select((nom, detail) => detail).ToList();
if (list.Count > 0)
{
var mblNoArg = list.Select(a=>a.SHIPMENT).Distinct().ToList();
var orderList = _bookingOrderRepository.AsQueryable()
.Where(a => mblNoArg.Contains(a.MBLNO) && !a.ParentId.HasValue && a.IsDeleted == false).ToList();
DateTime nowDate = DateTime.Now;
if (orderList.Count > 0)
{
orderList.ForEach(ord =>
{
var dlist = list.Where(b => b.SHIPMENT.Equals(ord.MBLNO)).ToList();
if (dlist.Count > 0)
{
dlist.ForEach(dt =>
{
dt.BOOKING_ID = ord.Id;
dt.UpdatedTime = nowDate;
dt.UpdatedUserId = UserManager.UserId;
dt.UpdatedUserName = UserManager.Name;
_taskRollingNominationDetailInfoRepository.AsUpdateable(dt)
.UpdateColumns(it => new
{
it.BOOKING_ID,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommand();
});
}
});
}
}
} }
catch (Exception ex) catch (Exception ex)
@ -569,18 +613,42 @@ namespace Myshipping.Application
/// <summary> /// <summary>
/// 查看分享链接 /// 查看分享链接
/// </summary> /// </summary>
/// <param name="batchId">预甩任务主键</param> /// <param name="dispatchBatchId">预甩调度批次号</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
[HttpGet("/TaskManageRollingNomination/GetUrl")] [HttpGet("/TaskManageRollingNomination/GetUrl")]
public async Task<TaskManageOrderResultDto> GetUrl(string batchId) public async Task<TaskManageOrderResultDto> GetUrl(string dispatchBatchId)
{ {
TaskManageOrderResultDto result = new TaskManageOrderResultDto(); TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try try
{ {
/* /*
batchIdBUSI_IDKEY dispatchBatchIdBUSI_IDKEY
*/ */
if (!string.IsNullOrWhiteSpace(dispatchBatchId))
throw Oops.Oh($"预甩调度批次号不能为空");
var dispatchInfo = _taskRollingNominationDispatchInfoRepository.AsQueryable()
.First(a => a.BATCH_ID == dispatchBatchId);
if (dispatchInfo == null)
{
throw Oops.Oh($"获取预甩调度信息失败,不存在或已作废");
}
if(string.IsNullOrWhiteSpace(dispatchInfo.SHARE_LINK_KEY))
throw Oops.Oh($"链接访问KEY不存在请生成分享链接");
string[] statusArg = new string[] { RollingNominationDispatchStatusEnum.CANCEL.ToString(),
RollingNominationDispatchStatusEnum.EXPIRE.ToString() };
if (statusArg.Any(a => a.Equals(dispatchInfo.STATUS, StringComparison.OrdinalIgnoreCase)))
throw Oops.Oh($"链接访问KEY状态不可用");
result.succ = true;
result.ext = dispatchInfo.SHARE_LINK_KEY;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -815,5 +883,45 @@ namespace Myshipping.Application
return result; return result;
} }
#endregion #endregion
#region 获取用户反馈信息
/// <summary>
/// 获取用户反馈信息
/// </summary>
/// <param name="dispatchBatchId">预甩调度批次ID</param>
/// <returns>返回回执</returns>
public async Task<TaskManageOrderResultDto> GetUserFeedBack(string dispatchBatchId)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
if (string.IsNullOrWhiteSpace(dispatchBatchId))
{
throw Oops.Oh($"预甩调度批次ID不能为空");
}
var list = _taskRollingNominationDispatchInfoRepository.AsQueryable()
.Where(a => a.BATCH_ID == dispatchBatchId).ToList();
if (list.Count == 0)
throw Oops.Oh($"预甩调度批次ID无法获取业务信息");
result.succ = true;
result.ext = new
{
userOpinion = list.FirstOrDefault().USER_OPINION,
userOpinionTxt = list.FirstOrDefault().USER_OPINION_TXT
};
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"获取用户反馈信息异常,原因:{ex.Message}";
}
return result;
}
#endregion
} }
} }

@ -16,6 +16,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -245,13 +246,59 @@ namespace Myshipping.Application.Service.TaskManagePlat
/// <summary> /// <summary>
/// 取消访问链接 /// 取消访问链接
/// </summary> /// </summary>
/// <param name="pkId">访问链接主键</param> /// <param name="busiId">访问链接业务主键</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
[HttpGet("/TaskManageShareLink/CancelShareLink")] [HttpGet("/TaskManageShareLink/CancelShareLink")]
public async Task<TaskManageOrderResultDto> CancelShareLink(string pkId) public async Task<TaskManageOrderResultDto> CancelShareLink(string busiId)
{ {
TaskManageOrderResultDto result = new TaskManageOrderResultDto(); TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
var shareInfo = _taskShareLinkInfoRepository.AsQueryable()
.First(a => a.BUSI_ID == busiId && a.IsDeleted == false);
if(shareInfo == null)
throw Oops.Oh($"分享链接不存在或已删除");
var statusArg = new string[] {
RollingNominationDispatchStatusEnum.COMPLETE.ToString(),
RollingNominationDispatchStatusEnum.EXPIRE.ToString(),
RollingNominationDispatchStatusEnum.CANCEL.ToString()
};
if(statusArg.Any(a=>a.Equals(shareInfo.STATUS,StringComparison.OrdinalIgnoreCase)))
throw Oops.Oh($"分享链接状态{shareInfo.STATUS} 不需要取消");
shareInfo.STATUS = RollingNominationDispatchStatusEnum.CANCEL.ToString();
shareInfo.UpdatedTime = DateTime.Now;
shareInfo.UpdatedUserId = UserManager.UserId;
shareInfo.UpdatedUserName = UserManager.Name;
await _taskShareLinkInfoRepository.AsUpdateable(shareInfo)
.UpdateColumns(it => new
{
it.STATUS,
it.UpdatedTime,
it.UpdatedUserId,
it.UpdatedUserName
}).ExecuteCommandAsync();
if (_cache.Exists(shareInfo.SHARE_LINK_KEY))
_cache.DelAsync(shareInfo.SHARE_LINK_KEY);
result.succ = true;
result.msg = "成功";
}
catch (Exception ex)
{
_logger.LogError($"取消访问链接异常,原因:{ex.Message}");
result.succ = false;
result.msg = $"取消访问链接异常,原因:{ex.Message}";
}
return result; return result;
} }
#endregion #endregion
@ -497,7 +544,17 @@ namespace Myshipping.Application.Service.TaskManagePlat
if (shareEntity == null) if (shareEntity == null)
throw Oops.Oh($"链接分享不存在"); throw Oops.Oh($"链接分享不存在");
shareEntity.USER_OPINION = model.userOpinion;
shareEntity.USER_OPINION_TXT = model.userOpinionTxt;
shareEntity.CONFIRM_DATE = DateTime.Now;
await _taskShareLinkInfoRepository.AsUpdateable(shareEntity)
.UpdateColumns(it => new
{
it.USER_OPINION,
it.USER_OPINION_TXT,
it.CONFIRM_DATE,
}).ExecuteCommandAsync();
result.succ = true; result.succ = true;
result.msg = "成功"; result.msg = "成功";

Loading…
Cancel
Save