|
|
@ -4,6 +4,7 @@ using Furion.DynamicApiController;
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
using Furion.JsonSerialization;
|
|
|
|
using Furion.JsonSerialization;
|
|
|
|
using Furion.RemoteRequest;
|
|
|
|
using Furion.RemoteRequest;
|
|
|
|
|
|
|
|
using Furion.RemoteRequest.Extensions;
|
|
|
|
using Mapster;
|
|
|
|
using Mapster;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
@ -16,6 +17,7 @@ using Myshipping.Core;
|
|
|
|
using Myshipping.Core.Entity;
|
|
|
|
using Myshipping.Core.Entity;
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
using Myshipping.Core.Service;
|
|
|
|
using MySqlX.XDevAPI.Common;
|
|
|
|
using MySqlX.XDevAPI.Common;
|
|
|
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
using SqlSugar;
|
|
|
|
using SqlSugar;
|
|
|
|
using StackExchange.Profiling.Internal;
|
|
|
|
using StackExchange.Profiling.Internal;
|
|
|
@ -23,6 +25,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;
|
|
|
@ -636,13 +639,21 @@ namespace Myshipping.Application
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string batchNo = IDGen.NextID().ToString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} ids={ids} 下载正本提单开始", batchNo, string.Join(",", PKIds));
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var taskList = _taskBaseInfoRepository.AsQueryable().Where(t => PKIds.Contains(t.PK_ID)).ToList();
|
|
|
|
var taskList = _taskBaseInfoRepository.AsQueryable().Where(t => PKIds.Contains(t.PK_ID)).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 获取任务完成,Num={Num}", batchNo, taskList.Count);
|
|
|
|
|
|
|
|
|
|
|
|
//获取个人对应的账户,这里GetAccountConfig逻辑优先取个人,个人没有配置取公司对应配置
|
|
|
|
//获取个人对应的账户,这里GetAccountConfig逻辑优先取个人,个人没有配置取公司对应配置
|
|
|
|
var userWebAccountConfig = _webAccountConfig.GetAccountConfig(CONST_WEB_ACCOUNT_TYPE, UserManager.UserId).GetAwaiter().GetResult();
|
|
|
|
var userWebAccountConfig = _webAccountConfig.GetAccountConfig(CONST_WEB_ACCOUNT_TYPE, UserManager.UserId).GetAwaiter().GetResult();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("批次={no} 获取获取网站的账户完成,result={Num}", batchNo, JSON.Serialize(userWebAccountConfig));
|
|
|
|
|
|
|
|
|
|
|
|
if (userWebAccountConfig == null)
|
|
|
|
if (userWebAccountConfig == null)
|
|
|
|
throw Oops.Bah($"个人/公司网站【{CONST_WEB_ACCOUNT_TYPE}】获取失败,请维护个人/公司网站账户信息");
|
|
|
|
throw Oops.Bah($"个人/公司网站【{CONST_WEB_ACCOUNT_TYPE}】获取失败,请维护个人/公司网站账户信息");
|
|
|
|
|
|
|
|
|
|
|
@ -721,6 +732,21 @@ namespace Myshipping.Application
|
|
|
|
_taskOriginalDownloadHisInfoRepository.Insert(taskOriginalDownloadHisInfo);
|
|
|
|
_taskOriginalDownloadHisInfoRepository.Insert(taskOriginalDownloadHisInfo);
|
|
|
|
|
|
|
|
|
|
|
|
//请求远程链接
|
|
|
|
//请求远程链接
|
|
|
|
|
|
|
|
Dictionary<string, string> formDict = new Dictionary<string, string> {
|
|
|
|
|
|
|
|
{"bno", taskBaseInfo.MBL_NO },
|
|
|
|
|
|
|
|
{"page_url", downloadUrl },
|
|
|
|
|
|
|
|
{"web_user", webAccountConfig.Account },
|
|
|
|
|
|
|
|
{"web_pwd", webAccountConfig.Password },
|
|
|
|
|
|
|
|
{"web_pwd", "myshipping_task" },
|
|
|
|
|
|
|
|
{"web_pwd", "" }
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//请求下载正本
|
|
|
|
|
|
|
|
var postResult = await InnerRemoteDownOriginal(downloadUrl, formDict);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var rtnObj = JObject.Parse(rtnStr);
|
|
|
|
|
|
|
|
//var sta = rtnObj.GetValue("status").ToString();
|
|
|
|
|
|
|
|
//var msg = rtnObj.GetValue("message").ToString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -731,7 +757,17 @@ namespace Myshipping.Application
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//private async Task<TaskManageOrderResultDto> Inner
|
|
|
|
private async Task<TaskManageOrderResultDto> InnerRemoteDownOriginal(string url, Dictionary<string, string> dic)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var result = new TaskManageOrderResultDto();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var t = url.SetBody(dic, "application/x-www-form-urlencoded");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|