master
zhangxiaofeng 4 months ago
parent 82e919c00d
commit 0302dda23d

@ -12,6 +12,7 @@ using EntrustSettle.Model.Models.DJY;
using EntrustSettle.Model.Validator;
using EntrustSettle.Repository.UnitOfWorks;
using FluentValidation;
using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
@ -916,7 +917,8 @@ namespace EntrustSettle.Api.Controllers
var noStatusOrderList = orderList.Where(x => x.Status != 3 && x.Status != 4);
if (noStatusOrderList.Any())
{
throw new Exception("需要在订单具有【已缴费】或【已完结】状态时才能进行发票申请,下列订单状态不符合条件,请重新选择:" + string.Join("、", noStatusOrderList.Select(x => x.Mblno)));
//throw new Exception("需要在订单具有【已缴费】或【已完结】状态时才能进行发票申请,下列订单状态不符合条件,请重新选择:" + string.Join("、", noStatusOrderList.Select(x => x.Mblno)));
throw new Exception("业务尚未缴费,请先缴费");
}
// 判断是否存在申请中的发票
@ -926,11 +928,11 @@ namespace EntrustSettle.Api.Controllers
throw new Exception("下列订单正在申请开票中,无法重复申请,请重新选择:" + string.Join("、", applyingOrderList.Select(x => x.Mblno)));
}
// 判断是否存在已开票的发票
var existsInvoiceOrderIdList = orderAnnexService.AsQueryable()
var existsInvoiceOrderIdList = await orderAnnexService.AsQueryable()
.LeftJoin<Annex>((o, a) => o.AnnexId == a.Id)
.Where((o, a) => input.OrderIdList.Contains(o.OrderId) && a.Type == (int)FileTypeEnum.)
.Select((o, a) => o.OrderId)
.ToList();
.ToListAsync();
if (existsInvoiceOrderIdList.Count > 0)
{
throw new Exception("下列订单已存在发票,无法重复申请,请重新选择:" +
@ -974,11 +976,14 @@ namespace EntrustSettle.Api.Controllers
long bsno = await hydService.Submit(submitDto);
// 记录发票申请(用于接收到发票回推后,可以查询到关联的订单)
var invoiceApplyModelList = orderList.Select(x => new InvoiceApply()
var invoiceApplyModelList = orderList.Select(x =>
{
OrderId = x.Id,
Bsno = bsno,
Remark = remark,
var applyInfo = input.Adapt<InvoiceApply>();
applyInfo.OrderId = x.Id;
applyInfo.Bsno = bsno;
applyInfo.Remark = input.Remark;
return applyInfo;
}).ToList();
await invoiceApplyService.Add(invoiceApplyModelList);
@ -1017,15 +1022,30 @@ namespace EntrustSettle.Api.Controllers
x.Id,
x.Mblno,
x.Bsno,
x.Status
x.Status,
x.IsApplyBill
}).FirstAsync();
if (order == null)
{
throw new Exception("待申请账单的数据可能已删除,请重新查询后重新申请");
}
if (order.Status != 4)
if (order.Status != 4 && order.Status != 2 && order.Status != 3)
{
throw new Exception("业务尚未完结,无法出具账单");
}
if (order.IsApplyBill)
{
throw new Exception("该订单正在申请账单中,请耐心等待");
}
// 判断是否存账单
var existsBill = await orderAnnexService.AsQueryable()
.LeftJoin<Annex>((o, a) => o.AnnexId == a.Id)
.Where((o, a) => order.Id == o.OrderId && a.Type == (int)FileTypeEnum.)
.AnyAsync();
if (existsBill)
{
throw new Exception("需要在订单具有【已完结】状态时才能进行账单申请");
throw new Exception("该订单已存在账单,无法重复申请");
}
HydFeedbackDto feedbackDto = new()

@ -69,12 +69,12 @@ namespace EntrustSettle.Services
{
await caching.RemoveAsync(CacheConst.HydAccessToken);
}
throw new Exception($"code:{code}");
throw new Exception($"code:{code},msg:{msg}");
}
}
catch (Exception ex)
{
throw new Exception($"下单失败,原因:{DealExMessage(ex?.Message)}");
throw new Exception($"下单或开发票失败,原因:{DealExMessage(ex?.Message)}");
}
}
@ -193,7 +193,7 @@ namespace EntrustSettle.Services
if (code.ObjToInt() == 200)
{
token = jobj.GetValue("token").ToString();
await caching.SetAsync(CacheConst.HydAccessToken, token, TimeSpan.FromHours(3));
await caching.SetAsync(CacheConst.HydAccessToken, token, TimeSpan.FromMinutes(8));
return token;
}
else

Loading…
Cancel
Save