委托结算

master
zhangxiaofeng 8 months ago
parent e1ab5077d3
commit 892833c397

1
.gitignore vendored

@ -350,3 +350,4 @@ healthchecksdb
.docs/contents/.vuepress/dist/*
EntrustSettle.Api/Logs
*.db
/EntrustSettle.Api/wwwroot/files

@ -6,6 +6,7 @@ using EntrustSettle.Model.Models;
using EntrustSettle.Model.Validator;
using FluentValidation;
using Microsoft.AspNetCore.Mvc;
using System.Web;
namespace EntrustSettle.Api.Controllers
{
@ -23,8 +24,6 @@ namespace EntrustSettle.Api.Controllers
this.orderAnnexService = orderAnnexService;
}
///// <param name="orderId">可选;文件类型为反馈附件时的订单主键</param>
///// <param name="appendRemark">可选;文件类型为反馈附件时追加的备注信息</param>
/// <summary>
/// 附件上传接口
/// </summary>
@ -32,13 +31,13 @@ namespace EntrustSettle.Api.Controllers
/// <param name="fileType">文件类型</param>
[HttpPost]
public async Task<MessageModel<long>> Upload([FromForm] IFormFile file,
[FromForm] FileTypeEnum fileType)
[FromForm] FileTypeEnum fileType)
{
if (file == null)
{
return Failed<long>("附件不能为空");
}
new FileTypeEnumValidator().ValidateAndThrow(fileType);
//new FileTypeEnumValidator().ValidateAndThrow(fileType);
// 文件目录
var dir = Path.Combine(App.WebHostEnvironment.WebRootPath, "files");
@ -62,8 +61,8 @@ namespace EntrustSettle.Api.Controllers
var model = new Annex()
{
Name = file.FileName,
Path = Path.Combine(dir, newFileName),
Type = (byte)fileType
Path = Path.Combine(@"files", newFileName),
Type = (int)fileType
};
var annexId = await annexService.Add(model);
@ -95,13 +94,14 @@ namespace EntrustSettle.Api.Controllers
{
return NotFound();
}
var filePath = Path.Combine(App.WebHostEnvironment.WebRootPath, "files", file.Path);
var filePath = Path.Combine(App.WebHostEnvironment.WebRootPath, file.Path);
if (!System.IO.File.Exists(filePath))
{
return NotFound();
}
var stream = new FileStream(file.Path, FileMode.Open);
return File(stream, "application/octet-stream", file.Name);
// 读取filePath文件的内容并返回给客户端
var p = HttpUtility.UrlEncode(file.Name, System.Text.Encoding.UTF8);
return PhysicalFile(filePath, "application/octet-stream", p);
}
}
}

@ -1,4 +1,5 @@
using EntrustSettle.Model;
using EntrustSettle.Common.Const;
using EntrustSettle.Model;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@ -7,6 +8,7 @@ namespace EntrustSettle.Controllers
[Route("api/[controller]/[action]")]
[ApiController]
[Authorize]
[ApiExplorerSettings(GroupName = ApiGroupNameConst.Business)]
public class BaseApiController : Controller
{
#region 常用的 Http Route templete 后缀,影响所有接口,谨慎修改

@ -1,4 +1,6 @@
using EntrustSettle.Common;
using Amazon.Runtime;
using EntrustSettle.Common;
using EntrustSettle.Common.Const;
using EntrustSettle.Common.Extensions;
using EntrustSettle.Controllers;
using EntrustSettle.IServices;
@ -9,7 +11,9 @@ using EntrustSettle.Model.Validator;
using EntrustSettle.Repository.UnitOfWorks;
using FluentValidation;
using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
namespace EntrustSettle.Api.Controllers
{
@ -23,18 +27,21 @@ namespace EntrustSettle.Api.Controllers
private readonly ILogger<OrderController> logger;
private readonly IUnitOfWorkManage unitOfWorkManage;
private readonly IOrderHistoryService orderHistoryService;
private readonly IHttpClientFactory httpClientFactory;
public OrderController(IOrderService orderService,
IOrderAnnexService orderFileService,
ILogger<OrderController> logger,
IUnitOfWorkManage unitOfWorkManage,
IOrderHistoryService orderHistoryService)
IOrderHistoryService orderHistoryService,
IHttpClientFactory httpClientFactory)
{
this.orderService = orderService;
this.orderAnnexService = orderFileService;
this.logger = logger;
this.unitOfWorkManage = unitOfWorkManage;
this.orderHistoryService = orderHistoryService;
this.httpClientFactory = httpClientFactory;
}
/// <summary>
/// 获取订单列表
@ -63,17 +70,25 @@ namespace EntrustSettle.Api.Controllers
return SuccessPage(result);
}
[HttpGet]
[AllowAnonymous]
public async Task<MessageModel> Test()
{
await Task.CompletedTask;
return SuccessMsg();
}
/// <summary>
/// 下单
/// </summary>
[HttpPost]
// test:[UseTran]
//[UseTran]
public async Task<MessageModel> Submit(OrderSubmitDto inputDto)
{
var validator = new OrderSubmitDtoValidator();
validator.ValidateAndThrow(inputDto);
// 订单信息保存
var orderList = new List<Order>();
foreach (var item in inputDto.MblnoList)
{
@ -94,7 +109,8 @@ namespace EntrustSettle.Api.Controllers
unitOfWorkManage.BeginTran();
var orderIdList = await orderService.Add(orderList);
if (inputDto.AnnexIdList.Length > 0)
// 附件关联信息保存
if (inputDto.AnnexIdList?.Count > 0)
{
var orderFileModelList = new List<OrderAnnex>();
@ -111,9 +127,23 @@ namespace EntrustSettle.Api.Controllers
};
await orderAnnexService.Add(orderFileModelList);
}
// 状态历史保存
var historyModelList = new List<OrderHistory>();
foreach (var item in orderIdList)
{
historyModelList.Add(new OrderHistory
{
Pid = item,
Status = (int)OrderStatusEnum.,
StatusTime = DateTime.Now
});
}
await orderHistoryService.Add(historyModelList);
unitOfWorkManage.CommitTran();
// todo:测试是否不需要rollback
return SuccessMsg();
}
/// <summary>
@ -125,8 +155,13 @@ namespace EntrustSettle.Api.Controllers
public async Task<MessageModel<List<AnnexDto>>> GetAnnexInfoList(long id, FileTypeEnum fileType)
{
var result = await orderAnnexService.Db.Queryable<OrderAnnex, Annex>((o, a) => o.AnnexId == a.Id)
.Where((o, a) => o.OrderId == id && a.Type == (byte)fileType)
.Select<AnnexDto>()
.Where((o, a) => o.OrderId == id && a.Type == (int)fileType)
.Select((o, a) => new AnnexDto()
{
Name = a.Name,
Type = a.Type,
Id = a.Id
})
.ToListAsync();
return Success(result);
@ -178,7 +213,7 @@ namespace EntrustSettle.Api.Controllers
{
throw new Exception("未找到该订单");
}
unitOfWorkManage.BeginTran();
// 添加要新增绑定的附件信息
var orderAnnexModelList = bindDto.NewAnnexIdList.Select(x => new OrderAnnex()
{
@ -195,14 +230,15 @@ namespace EntrustSettle.Api.Controllers
await orderAnnexService.Delete(x => bindDto.DelAnnexIdList.Contains(x.AnnexId));
}
var updateable = orderService.AsUpdateable(order);
orderService.Db.Tracking(order);
if (bindDto.OperType == FileTypeEnum.)
{
if (!string.IsNullOrWhiteSpace(bindDto.Remark))
{
order.Remark += (Environment.NewLine + bindDto.Remark);
updateable.UpdateColumns(x => x.Remark);
string remark = string.IsNullOrEmpty(order.Remark) ?
bindDto.Remark :
order.Remark += (Environment.NewLine + bindDto.Remark);
order.Remark = remark;
}
}
else if (bindDto.OperType == FileTypeEnum.)
@ -210,15 +246,12 @@ namespace EntrustSettle.Api.Controllers
if (bindDto.MailFlag != null)
{
order.MailFlag = bindDto.MailFlag;
updateable.UpdateColumns(x => x.MailFlag);
}
if (!string.IsNullOrWhiteSpace(bindDto.MailBillNo))
{
order.MailBillNo = bindDto.MailBillNo;
updateable.UpdateColumns(x => x.MailBillNo);
}
order.MailBillNo = bindDto.MailBillNo;
}
await updateable.Where(x => x.Id == bindDto.OrderId).ExecuteCommandHasChangeAsync();
await orderService.Db.Updateable(order).ExecuteCommandAsync();
unitOfWorkManage.CommitTran();
return SuccessMsg();
}
@ -233,13 +266,13 @@ namespace EntrustSettle.Api.Controllers
.Select<OrderDetailDto>()
.FirstAsync();
if (result != null)
if (result == null)
{
throw new Exception("为找到该订单,请刷新后重试");
}
var annexList = await orderAnnexService.Db.Queryable<OrderAnnex, Annex>((o, a) => o.AnnexId == a.Id)
.Where((o, a) => o.OrderId == id)
.Where((o, a) => a.Type == (byte)FileTypeEnum. || a.Type == (byte)FileTypeEnum.)
.Where((o, a) => a.Type == (int)FileTypeEnum. || a.Type == (int)FileTypeEnum.)
.Select<AnnexDto>()
.ToListAsync();
result.AnnexList = annexList;

@ -10,6 +10,9 @@ namespace EntrustSettle.Api.Controllers
/// </summary>
public class UserController : BaseApiController
{
/// <summary>
/// 获取当前登录人的信息
/// </summary>
[HttpGet]
public MessageModel<dynamic> GetCurrentUser()
{

@ -19,23 +19,27 @@
<Compile Remove="Logs\**" />
<Compile Remove="Log\**" />
<Compile Remove="Middlewares\**" />
<Compile Remove="wwwroot\files\**" />
<Content Remove="Extensions\**" />
<Content Remove="Hubs\**" />
<Content Remove="Logs\**" />
<Content Remove="Log\**" />
<Content Remove="Middlewares\**" />
<Content Remove="wwwroot\files\**" />
<Content Remove="wwwroot\ui\**" />
<EmbeddedResource Remove="Extensions\**" />
<EmbeddedResource Remove="Hubs\**" />
<EmbeddedResource Remove="Logs\**" />
<EmbeddedResource Remove="Log\**" />
<EmbeddedResource Remove="Middlewares\**" />
<EmbeddedResource Remove="wwwroot\files\**" />
<EmbeddedResource Remove="wwwroot\ui\**" />
<None Remove="Extensions\**" />
<None Remove="Hubs\**" />
<None Remove="Logs\**" />
<None Remove="Log\**" />
<None Remove="Middlewares\**" />
<None Remove="wwwroot\files\**" />
<None Remove="wwwroot\ui\**" />
</ItemGroup>

@ -41,7 +41,7 @@ internal class Program
{
hostingContext.Configuration.ConfigureApplication();
config.Sources.Clear();
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false);
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
});
builder.ConfigureApplication();
@ -117,9 +117,9 @@ internal class Program
//设置本地时间而非UTC时间
options.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Local;
//添加Enum转string
options.SerializerSettings.Converters.Add(new StringEnumConverter());
//options.SerializerSettings.Converters.Add(new StringEnumConverter());
//将long类型转为string
options.SerializerSettings.Converters.Add(new NumberConverter(NumberConverterShip.Int64));
//options.SerializerSettings.Converters.Add(new NumberConverter(NumberConverterShip.Int64));
});
builder.Services.AddRabbitMQSetup();

@ -21,9 +21,18 @@
"RedisMq": {
"Enabled": false //redis
},
"UserInfoCacheTime": 60 //
},
"Apis": {
"Hyd": {
"BaseUrl": "www.baidu.com",
"下单": "1",
"查询": "2",
"下单2": "3",
"下单3": "4"
}
},
// JwtIdentityServer4
"Audience": {
"Secret": "sdfsdfsrty45634kkhllghtdgdfss345t678fs", //16+
@ -236,7 +245,7 @@
"Enabled": false
},
"Redis": {
"Enabled": true,
"Enabled": false,
"ConnectionString": "127.0.0.1:6379,defaultDatabase=3",
"InstanceName": "" //Key
},

@ -1,5 +1,8 @@
namespace EntrustSettle.Common.Const
{
/// <summary>
/// Api接口分组名称
/// </summary>
public class ApiGroupNameConst
{
public const string System = "System";

@ -0,0 +1,7 @@
namespace EntrustSettle.Common.Const
{
public class HttpClientConst
{
public const string HYD = "海运达平台";
}
}

@ -1,6 +1,6 @@
using System;
using System.IO;
using EntrustSettle.Common.Https;
using EntrustSettle.Common.Http;
using Microsoft.AspNetCore.Http;
namespace EntrustSettle.Common.Extensions;

@ -4,7 +4,7 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Features;
namespace EntrustSettle.Common.Https;
namespace EntrustSettle.Common.Http;
/// <summary>
/// 扩展 HttpResponseStream <br/>

@ -6,7 +6,7 @@ using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace EntrustSettle.Common.Https.HttpPolly
namespace EntrustSettle.Common.Http.HttpPolly
{
public class HttpPollyHelper : IHttpPollyHelper
{
@ -165,10 +165,19 @@ namespace EntrustSettle.Common.Https.HttpPolly
}
public async Task<T> GetAsync<T>(HttpEnum httpEnum, string url, Dictionary<string, string> headers = null)
public async Task<T> GetAsync<T>(HttpEnum httpEnum, string url, Dictionary<string, string> queryParams = null, Dictionary<string, string> headers = null)
{
try
{
if (queryParams != null)
{
url += "?";
foreach (KeyValuePair<string, string> param in queryParams)
{
url += (param.Key + "=" + System.Web.HttpUtility.UrlEncode(param.Value, Encoding.UTF8) + "&");
}
url = url.TrimEnd('&');
}
var client = _clientFactory.CreateClient(httpEnum.ToString());
if (headers != null)
{
@ -202,10 +211,19 @@ namespace EntrustSettle.Common.Https.HttpPolly
}
public async Task<string> GetAsync(HttpEnum httpEnum, string url, Dictionary<string, string> headers = null)
public async Task<string> GetAsync(HttpEnum httpEnum, string url, Dictionary<string, string> queryParams = null, Dictionary<string, string> headers = null)
{
try
{
if (queryParams != null)
{
url += "?";
foreach (KeyValuePair<string, string> param in queryParams)
{
url += (param.Key + "=" + System.Web.HttpUtility.UrlEncode(param.Value, Encoding.UTF8) + "&");
}
url = url.TrimEnd('&');
}
var client = _clientFactory.CreateClient(httpEnum.ToString());
if (headers != null)
{

@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace EntrustSettle.Common.Https.HttpPolly
namespace EntrustSettle.Common.Http.HttpPolly
{
public interface IHttpPollyHelper
{
@ -10,8 +10,8 @@ namespace EntrustSettle.Common.Https.HttpPolly
Task<T> PostAsync<T>(HttpEnum httpEnum, string url, string request, Dictionary<string, string> headers = null);
Task<string> PostAsync(HttpEnum httpEnum, string url, string request, Dictionary<string, string> headers = null);
Task<string> PostAsync<R>(HttpEnum httpEnum, string url, R request, Dictionary<string, string> headers = null);
Task<T> GetAsync<T>(HttpEnum httpEnum, string url, Dictionary<string, string> headers = null);
Task<string> GetAsync(HttpEnum httpEnum, string url, Dictionary<string, string> headers = null);
Task<T> GetAsync<T>(HttpEnum httpEnum, string url, Dictionary<string, string> queryParams = null, Dictionary<string, string> headers = null);
Task<string> GetAsync(HttpEnum httpEnum, string url, Dictionary<string, string> queryParams = null, Dictionary<string, string> headers = null);
Task<T> PutAsync<T, R>(HttpEnum httpEnum, string url, R request, Dictionary<string, string> headers = null);
Task<T> PutAsync<T>(HttpEnum httpEnum, string url, string request, Dictionary<string, string> headers = null);
Task<T> DeleteAsync<T>(HttpEnum httpEnum, string url, Dictionary<string, string> headers = null);

@ -4,7 +4,7 @@ using System.Linq;
using System.Net;
using Microsoft.AspNetCore.Http;
namespace EntrustSettle.Common.Https;
namespace EntrustSettle.Common.Http;
public static class RequestIpUtility
{

@ -1,5 +1,5 @@
using System.IO;
using EntrustSettle.Common.Https;
using EntrustSettle.Common.Http;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http.Features;

@ -1,16 +1,13 @@
using EntrustSettle.Common.Https.HttpPolly;
using EntrustSettle.Common;
using EntrustSettle.Common.Http.HttpPolly;
using EntrustSettle.Model;
using Microsoft.Extensions.DependencyInjection;
using Polly;
using Polly.Extensions.Http;
using Polly.Timeout;
using System;
using System.Net.Http;
namespace EntrustSettle.Extensions
{
/// <summary>
/// Cors 启动服务
///
/// </summary>
public static class HttpPollySetup
{
@ -18,39 +15,44 @@ namespace EntrustSettle.Extensions
{
if (services == null) throw new ArgumentNullException(nameof(services));
#region Polly策略
var retryPolicy = HttpPolicyExtensions
.HandleTransientHttpError()
.Or<TimeoutRejectedException>() // 若超时则抛出此异常
.WaitAndRetryAsync(new[]
services.AddHttpClient(HttpEnum.Hyd.ToString(), c =>
{
TimeSpan.FromSeconds(1),
TimeSpan.FromSeconds(5),
TimeSpan.FromSeconds(10)
c.BaseAddress = new Uri(AppSettings.app("Apis", "Hyd", "Url"));
});
// 为每个重试定义超时策略
var timeoutPolicy = Policy.TimeoutAsync<HttpResponseMessage>(10);
#endregion
//#region Polly策略
//var retryPolicy = HttpPolicyExtensions
//.HandleTransientHttpError()
//.Or<TimeoutRejectedException>() // 若超时则抛出此异常
//.WaitAndRetryAsync(new[]
//{
// TimeSpan.FromSeconds(1),
// TimeSpan.FromSeconds(5),
// TimeSpan.FromSeconds(10)
//});
services.AddHttpClient(HttpEnum.Common.ToString(), c =>
{
c.DefaultRequestHeaders.Add("Accept", "application/json");
})
.AddPolicyHandler(retryPolicy)
// 将超时策略放在重试策略之内,每次重试会应用此超时策略
.AddPolicyHandler(timeoutPolicy);
//// 为每个重试定义超时策略
//var timeoutPolicy = Policy.TimeoutAsync<HttpResponseMessage>(10);
services.AddHttpClient(HttpEnum.LocalHost.ToString(), c =>
{
c.BaseAddress = new Uri("http://www.localhost.com");
c.DefaultRequestHeaders.Add("Accept", "application/json");
})
.AddPolicyHandler(retryPolicy)
// 将超时策略放在重试策略之内,每次重试会应用此超时策略
.AddPolicyHandler(timeoutPolicy);
//services.AddHttpClient(HttpEnum.Common.ToString(), c =>
//{
// c.DefaultRequestHeaders.Add("Accept", "application/json");
//})
//.AddPolicyHandler(retryPolicy)
//// 将超时策略放在重试策略之内,每次重试会应用此超时策略
//.AddPolicyHandler(timeoutPolicy);
//services.AddHttpClient(HttpEnum.LocalHost.ToString(), c =>
//{
// c.BaseAddress = new Uri("http://www.localhost.com");
// c.DefaultRequestHeaders.Add("Accept", "application/json");
//})
//.AddPolicyHandler(retryPolicy)
//// 将超时策略放在重试策略之内,每次重试会应用此超时策略
//.AddPolicyHandler(timeoutPolicy);
services.AddSingleton<IHttpPollyHelper, HttpPollyHelper>();
//#endregion
}
}
}

@ -1,14 +1,15 @@
using EntrustSettle.Common;
using EntrustSettle.Common.Const;
using EntrustSettle.Common.Const;
using EntrustSettle.Common.Extensions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Models;
using Serilog;
using Swashbuckle.AspNetCore.Filters;
using Swashbuckle.AspNetCore.SwaggerGen;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
namespace EntrustSettle.Extensions
{
@ -69,7 +70,6 @@ namespace EntrustSettle.Extensions
{
c.SwaggerDoc(x.UrlPrefix, x.OpenApiInfo);
});
c.OrderActionsBy(o => o.RelativePath);
c.UseInlineDefinitionsForEnums();
@ -86,7 +86,7 @@ namespace EntrustSettle.Extensions
}
catch (Exception ex)
{
Log.Error("EntrustSettle.xml和Blog.Core.Model.xml 丢失,请检查并拷贝。\n" + ex.Message);
Log.Error("EntrustSettle.Api.xml和EntrustSettle.Model.xml 丢失,请检查并拷贝。\n" + ex.Message);
}
// 开启加权小锁
@ -96,6 +96,7 @@ namespace EntrustSettle.Extensions
// 在header中添加token传递到后台
c.OperationFilter<SecurityRequirementsOperationFilter>();
c.SchemaFilter<EnumSchemaFilter>();
// ids4和jwt切换
//if (Permissions.IsUseIds4)
@ -134,7 +135,33 @@ namespace EntrustSettle.Extensions
services.AddSwaggerGenNewtonsoftSupport();
}
}
/// <summary>
/// Swagger文档枚举字段显示枚举属性和枚举值,以及枚举描述
/// </summary>
public class EnumSchemaFilter : ISchemaFilter
{
/// <summary>
/// 实现接口
/// </summary>
/// <param name="model"></param>
/// <param name="context"></param>
public void Apply(OpenApiSchema model, SchemaFilterContext context)
{
if (context.Type.IsEnum)
{
model.Enum.Clear();
Enum.GetNames(context.Type)
.ToList()
.ForEach(name =>
{
Enum e = (Enum)Enum.Parse(context.Type, name);
model.Enum.Add(new OpenApiString($"{name}({e.EnumDescription()})={Convert.ToInt64(Enum.Parse(context.Type, name))}"));
});
}
}
}
}

@ -99,6 +99,7 @@ namespace EntrustSettle.IServices.Base
#region 更新
IUpdateable<TEntity> AsUpdateable();
IUpdateable<TEntity> AsUpdateable(TEntity model);
IUpdateable<TEntity> AsUpdateable(params TEntity[] entities);
Task<bool> Update(TEntity model);

@ -1,13 +1,15 @@
namespace EntrustSettle.Model
using System.ComponentModel;
namespace EntrustSettle.Model
{
/// <summary>
/// 订单业务类型
/// </summary>
public enum OrderBusinessTypeEnum
{
= 1,
= 2
}
///// <summary>
///// 订单业务类型
///// </summary>
//public enum OrderBusinessTypeEnum
//{
// 港杂费 = 1,
// 堆存费 = 2
//}
/// <summary>
/// 订单状态
/// </summary>

@ -4,7 +4,8 @@ namespace EntrustSettle.Model
{
public enum HttpEnum
{
Common,
LocalHost
//Common,
//LocalHost,
Hyd
}
}

@ -5,6 +5,10 @@
/// </summary>
public class AnnexDto
{
/// <summary>
/// 附件Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 附件原始名称
/// </summary>
@ -12,6 +16,6 @@
/// <summary>
/// 附件类型 1:原始附件 2:反馈附件 3:账单 4:发票
/// </summary>
public byte? Type { get; set; }
public int Type { get; set; }
}
}

@ -20,6 +20,6 @@ namespace EntrustSettle.Model.Dtos
/// <summary>
/// 当前业务状态名称
/// </summary>
public OrderStatusEnum StatusName => (OrderStatusEnum)Status;
public string StatusName => Status.ToString();
}
}

@ -12,7 +12,7 @@ namespace EntrustSettle.Model.Dtos
/// 查询类型 1客户订单管理台账 2运营端台账
/// </summary>
[Required]
public byte QueryType { get; set; }
public int QueryType { get; set; }
/// <summary>
/// 提单号
@ -25,7 +25,7 @@ namespace EntrustSettle.Model.Dtos
/// <summary>
/// 业务类型 1:港杂费 2:堆存费
/// </summary>
public byte? BusinessType { get; set; }
public int? BusinessType { get; set; }
/// <summary>
/// 当前业务状态
/// </summary>

@ -1,4 +1,6 @@
namespace EntrustSettle.Model.Dtos
using System.Collections.Generic;
namespace EntrustSettle.Model.Dtos
{
/// <summary>
/// 提单提交Dto
@ -32,7 +34,7 @@
/// <summary>
/// 业务类型 1:港杂费 2:堆存费
/// </summary>
public byte? BusinessType { get; set; }
public int BusinessType { get; set; }
/// <summary>
/// 客户备注
/// </summary>
@ -40,6 +42,6 @@
/// <summary>
/// 文件Id列表
/// </summary>
public long[] AnnexIdList { get; set; }
public List<long> AnnexIdList { get; set; }
}
}

@ -12,7 +12,11 @@ namespace EntrustSettle.Model.Dtos
/// <summary>
/// 业务状态
/// </summary>
public OrderStatusEnum? Status { get; set; }
public OrderStatusEnum Status { get; set; }
/// <summary>
/// 业务状态名称
/// </summary>
public string StatusName => Status.ToString();
/// <summary>
/// 金额
/// </summary>
@ -29,5 +33,5 @@ namespace EntrustSettle.Model.Dtos
/// 操作人
/// </summary>
public string CreateBy { get; set; }
}
}
}
}

@ -19,6 +19,6 @@ namespace EntrustSettle.Model.Models
/// <summary>
/// 附件类型 1:原始附件 2:反馈附件 3:账单 4:发票
/// </summary>
public byte? Type { get; set; }
public int Type { get; set; }
}
}

@ -36,7 +36,7 @@ namespace EntrustSettle.Model.Models
/// <summary>
/// 业务类型 1:港杂费 2:堆存费
/// </summary>
public byte? BusinessType { get; set; }
public int BusinessType { get; set; }
/// <summary>
/// 缴费金额
/// </summary>
@ -44,7 +44,7 @@ namespace EntrustSettle.Model.Models
/// <summary>
/// 当前业务状态 -1:已下单 0:已接收未接单 1:已接单 2:待缴费 3:已缴费 4:已完成
/// </summary>
public int? Status { get; set; }
public int Status { get; set; }
/// <summary>
/// 客户备注
/// </summary>

@ -17,7 +17,7 @@ namespace EntrustSettle.Model.Models
/// <summary>
/// 设置业务状态 -1:已下单 0:已接收未接单 1:已接单 2:待缴费 3:已缴费 4:已完成
/// </summary>
public int? Status { get; set; }
public int Status { get; set; }
/// <summary>
/// 设置金额
/// </summary>

@ -11,11 +11,11 @@ namespace EntrustSettle.Model.Validator
RuleFor(x => x.MblnoList).NotEmpty();
RuleFor(x => x.CompanyId).NotNull().NotEmpty();
RuleFor(x => x.CompanyName).NotNull().NotEmpty();
RuleFor(x => x.ContactId).NotNull().NotEmpty();
RuleFor(x => x.ContactName).NotNull().NotEmpty();
RuleFor(x => x.BusinessType).ExclusiveBetween<OrderSubmitDto, byte>(1, 5);
//RuleFor(x => x.ContactId).NotNull().NotEmpty();
//RuleFor(x => x.ContactName).NotNull().NotEmpty();
RuleFor(x => x.BusinessType).InclusiveBetween(1, 5).WithMessage("业务类型错误");
//RuleFor(x => x.Remark).MaximumLength(2000).WithMessage("备注过长");
RuleFor(x => x.AnnexIdList.Length).LessThanOrEqualTo(5).WithMessage("附件数量不能超过5个");
RuleFor(x => x.AnnexIdList).Must(x => x == null || x.Count <= 5).WithMessage("附件数量不能超过5个");
}
}
public class FileTypeEnumValidator : AbstractValidator<FileTypeEnum>

@ -1,5 +1,5 @@
using EntrustSettle.Common.Extensions;
using EntrustSettle.Common.Https;
using EntrustSettle.Common.Http;
using Microsoft.AspNetCore.Http;
using Serilog;
using Serilog.Events;

@ -184,6 +184,10 @@ namespace EntrustSettle.Services.Base
{
return Db.Updateable(model);
}
public IUpdateable<TEntity> AsUpdateable()
{
return Db.Updateable<TEntity>();
}
public IUpdateable<TEntity> AsUpdateable(params TEntity[] entities)
{
return Db.Updateable(entities);

@ -1,10 +1,30 @@
using EntrustSettle.IServices;
using EntrustSettle.Common;
using EntrustSettle.Common.Const;
using EntrustSettle.IServices;
using EntrustSettle.Model.Models;
using EntrustSettle.Services.Base;
using System.Net.Http;
using System.Threading.Tasks;
namespace EntrustSettle.Services
{
public class OrderService : BaseServices<Order>, IOrderService
{
private readonly IHttpClientFactory httpClientFactory;
public OrderService(IHttpClientFactory httpClientFactory)
{
this.httpClientFactory = httpClientFactory;
}
public async Task SubmitToHYD(Order order)
{
var client = httpClientFactory.CreateClient(HttpClientConst.HYD);
var url = AppSettings.app("Apis", "Hyd", "下单");
var json = order.ToJson();
//new HttpContent()
//client.PostAsync(url,);
//client.GetAsync()
}
}
}

@ -38,8 +38,8 @@ namespace EntrustSettle.Tasks
string pars = data.GetString("JobParam");
if (!string.IsNullOrWhiteSpace(pars))
{
var log = await HttpHelper.GetAsync(pars);
_logger.LogInformation(log);
//var log = await HttpHelper.GetAsync(pars);
//_logger.LogInformation(log);
}
}
}

Loading…
Cancel
Save