feat 完善表格数据管理
This commit is contained in:
parent
ebf503fef4
commit
1151844c07
@ -75,7 +75,6 @@ namespace ARW.Model.Models.Business.TableDataManage.TableDatas
|
||||
/// 描述 :供应商的对应报价
|
||||
/// 空值 : true
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "供应商的对应报价")]
|
||||
[SugarColumn(ColumnName = "table_data_supplier_offer")]
|
||||
public decimal TableDataSupplierOffer { get; set; }
|
||||
|
||||
@ -104,7 +103,7 @@ namespace ARW.Model.Models.Business.TableDataManage.TableDatas
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "日期", NumberFormat = "yyyy-MM-dd HH:mm:ss")]
|
||||
[SugarColumn(ColumnName = "table_data_date")]
|
||||
public DateTime? TableDataDate { get; set; }
|
||||
public DateTime TableDataDate { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -113,7 +112,7 @@ namespace ARW.Model.Models.Business.TableDataManage.TableDatas
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "截止日期", NumberFormat = "yyyy-MM-dd HH:mm:ss")]
|
||||
[SugarColumn(ColumnName = "table_data_deadline")]
|
||||
public DateTime? TableDataDeadline { get; set; }
|
||||
public DateTime TableDataDeadline { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
@ -59,105 +59,126 @@ namespace ARW.Model.Vo.Business.TableDataManage.TableDatas
|
||||
/// <summary>
|
||||
/// 描述 :采购方式
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
[EpplusTableColumn(Header = "采购方式")]
|
||||
public string TableDataProcurementMethod { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :供应商名称
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
[EpplusTableColumn(Header = "供应商名称")]
|
||||
public string TableDataSupplierName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :供应商的对应报价
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
[EpplusIgnore]
|
||||
public decimal TableDataSupplierOffer { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :项目计价形式
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
[EpplusTableColumn(Header = "项目计价形式")]
|
||||
public string TableDataProjectPricingForm { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :链接
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
[EpplusTableColumn(Header = "链接")]
|
||||
public string TableDataLink { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :日期
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "日期", NumberFormat = "yyyy-MM-dd HH:mm:ss")]
|
||||
public DateTime? TableDataDate { get; set; }
|
||||
[EpplusTableColumn(Header = "日期", NumberFormat = "yyyy/m/d")]
|
||||
public DateTime TableDataDate { get; set; }
|
||||
|
||||
|
||||
[EpplusIgnore]
|
||||
public string TableDataDateName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :截止日期
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
public DateTime? TableDataDeadline { get; set; }
|
||||
[EpplusTableColumn(Header = "截止日期", NumberFormat = "yyyy/m/d")]
|
||||
public DateTime TableDataDeadline { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :中标人或候选人
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
[EpplusTableColumn(Header = "中标人或候选人")]
|
||||
public string TableDataWinningBidde { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :中标金额
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
[EpplusTableColumn(Header = "中标金额")]
|
||||
public decimal TableDataBidWinningPrice { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :是否为中标公告
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "是否为中标公告")]
|
||||
[EpplusIgnore]
|
||||
public int TableDataIsBidAnnouncement { get; set; }
|
||||
|
||||
|
||||
[EpplusTableColumn(Header = "是否为中标公告")]
|
||||
public string TableDataIsBidAnnouncementName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :是否是人力资源池或框架协议
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "是否是人力资源池或框架协议")]
|
||||
[EpplusIgnore]
|
||||
public int TableDataIsHumanResourcePoolOrFrameworkAgreement { get; set; }
|
||||
|
||||
|
||||
[EpplusTableColumn(Header = "是否是人力资源池或框架协议")]
|
||||
public string TableDataIsHumanResourcePoolOrFrameworkAgreementName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :公告中是否包含多个包/标段/采购内容
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "公告中是否包含多个包/标段/采购内容")]
|
||||
[EpplusIgnore]
|
||||
public int TableDataIsMultiple { get; set; }
|
||||
|
||||
|
||||
[EpplusTableColumn(Header = "公告中是否包含多个包/标段/采购内容")]
|
||||
public string TableDataIsMultipleName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :是否仅有一个中标人
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "是否仅有一个中标人")]
|
||||
[EpplusIgnore]
|
||||
public int TableDataIsOnlyBidder { get; set; }
|
||||
|
||||
|
||||
[EpplusTableColumn(Header = "是否仅有一个中标人")]
|
||||
public string TableDataIsOnlyBidderName { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :单一来源理由(如有)
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
[EpplusTableColumn(Header = "单一来源理由(如有)")]
|
||||
public string TableDataSingleSource { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :详情
|
||||
/// </summary>
|
||||
[EpplusIgnore]
|
||||
[EpplusTableColumn(Header = "详情")]
|
||||
public string TableDataDetails { get; set; }
|
||||
|
||||
|
||||
|
@ -18,6 +18,7 @@ using ARW.Model.Models.Business.ProductsInvolveds;
|
||||
using ARW.Model.Models.Business.TableDataManage.TableDataProductsInvolves;
|
||||
using ARW.Repository.Business.TableDataManage.TableDataProductsInvolves;
|
||||
using ARW.Repository.Business.ProductsInvolveds;
|
||||
using Senparc.CO2NET.Extensions;
|
||||
|
||||
namespace ARW.Service.Business.BusinessService.TableDataManage.TableDatas
|
||||
{
|
||||
@ -72,6 +73,7 @@ namespace ARW.Service.Business.BusinessService.TableDataManage.TableDatas
|
||||
TableDataProjectPricingForm = s.TableDataProjectPricingForm,
|
||||
TableDataLink = s.TableDataLink,
|
||||
TableDataDate = s.TableDataDate,
|
||||
TableDataDateName = s.TableDataDate.ToString("yyyy/m/d"),
|
||||
TableDataDeadline = s.TableDataDeadline,
|
||||
TableDataWinningBidde = s.TableDataWinningBidde,
|
||||
TableDataBidWinningPrice = s.TableDataBidWinningPrice,
|
||||
@ -173,19 +175,108 @@ namespace ARW.Service.Business.BusinessService.TableDataManage.TableDatas
|
||||
/// </summary>
|
||||
public async Task<TableDataVo> HandleImportData(TableDataVo TableData)
|
||||
{
|
||||
// 空值判断
|
||||
if (string.IsNullOrEmpty(TableData.TableDataProcurementContent)) throw new CustomException("采购内容不能为空");
|
||||
|
||||
if (string.IsNullOrEmpty(TableData.TableDataIsHumanResourcePoolOrFrameworkAgreementName))
|
||||
throw new CustomException("是否是人力资源池或框架协议不能为空");
|
||||
else
|
||||
TableData.TableDataIsHumanResourcePoolOrFrameworkAgreement = GetYesOrNoNum(TableData.TableDataIsHumanResourcePoolOrFrameworkAgreementName);
|
||||
|
||||
if (string.IsNullOrEmpty(TableData.TableDataIsBidAnnouncementName))
|
||||
throw new CustomException("是否为中标公告不能为空");
|
||||
else
|
||||
TableData.TableDataIsBidAnnouncement = GetYesOrNoNum(TableData.TableDataIsBidAnnouncementName);
|
||||
|
||||
if (string.IsNullOrEmpty(TableData.TableDataIsMultipleName))
|
||||
throw new CustomException("公告中是否包含多个包/标段/采购内容 不能为空");
|
||||
else
|
||||
TableData.TableDataIsMultiple = GetYesOrNoNum(TableData.TableDataIsMultipleName);
|
||||
|
||||
if (string.IsNullOrEmpty(TableData.TableDataIsOnlyBidderName))
|
||||
throw new CustomException("是否仅有一个中标人 不能为空");
|
||||
else
|
||||
TableData.TableDataIsOnlyBidder = GetYesOrNoNum(TableData.TableDataIsOnlyBidderName);
|
||||
|
||||
if (TableData.TableDataSort == 0) TableData.TableDataSort = 100;
|
||||
|
||||
|
||||
return TableData;
|
||||
}
|
||||
|
||||
|
||||
private int GetYesOrNoNum(string str)
|
||||
{
|
||||
if (str == "是")
|
||||
return 1;
|
||||
if (str == "否")
|
||||
return 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private string GetYesOrNoStr(int num)
|
||||
{
|
||||
if (num ==1)
|
||||
return "是";
|
||||
if (num == 2)
|
||||
return "否";
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Excel导入
|
||||
/// </summary>
|
||||
public async Task<string> ImportExcel(TableData TableData, int index, bool isUpdateSupport, string user)
|
||||
public async Task<string> ImportExcel(TableDataVo TableDataVo, int index, bool isUpdateSupport, string user)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 空值判断
|
||||
// if (TableData.TableDataId == null) throw new CustomException("表格数据不能为空");
|
||||
TableDataVo = await HandleImportData(TableDataVo);
|
||||
|
||||
// 表格数据所属涉及产品
|
||||
var dto = new TableDataDto();
|
||||
var productsInvolvedIdList = new List<string>();
|
||||
if (!string.IsNullOrEmpty(TableDataVo.ProductsInvolvedName))
|
||||
{
|
||||
var nameList = TableDataVo.ProductsInvolvedName.Split(',').ToList();
|
||||
foreach (var item in nameList)
|
||||
{
|
||||
var productsInvolved = await _ProductsInvolveRepository.GetFirstAsync(s => s.ProductsInvolvedName == item);
|
||||
if (productsInvolved == null)
|
||||
throw new CustomException($"{item} 涉及产品不存在!");
|
||||
else
|
||||
{
|
||||
productsInvolvedIdList.Add(productsInvolved.ProductsInvolvedId.ToString());
|
||||
}
|
||||
}
|
||||
if (productsInvolvedIdList.Count > 0)
|
||||
{
|
||||
dto.ProductsInvolvedGuid = string.Join(",", productsInvolvedIdList);
|
||||
}
|
||||
}
|
||||
|
||||
var TableData = new TableData
|
||||
{
|
||||
TableDataProcurementContent = TableDataVo.TableDataProcurementContent,
|
||||
TableDataProcurementUnit = TableDataVo.TableDataProcurementUnit,
|
||||
TableDataProcurementMethod = TableDataVo.TableDataProcurementMethod,
|
||||
TableDataSupplierName = TableDataVo.TableDataSupplierName,
|
||||
TableDataProjectPricingForm = TableDataVo.TableDataProjectPricingForm,
|
||||
TableDataLink = TableDataVo.TableDataLink,
|
||||
TableDataDate = TableDataVo.TableDataDate,
|
||||
TableDataDeadline = TableDataVo.TableDataDeadline,
|
||||
TableDataWinningBidde = TableDataVo.TableDataWinningBidde,
|
||||
TableDataBidWinningPrice = TableDataVo.TableDataBidWinningPrice,
|
||||
TableDataIsBidAnnouncement = TableDataVo.TableDataIsBidAnnouncement,
|
||||
TableDataIsHumanResourcePoolOrFrameworkAgreement = TableDataVo.TableDataIsHumanResourcePoolOrFrameworkAgreement,
|
||||
TableDataIsMultiple = TableDataVo.TableDataIsMultiple,
|
||||
TableDataIsOnlyBidder = TableDataVo.TableDataIsOnlyBidder,
|
||||
TableDataSingleSource = TableDataVo.TableDataSingleSource,
|
||||
TableDataDetails = TableDataVo.TableDataDetails,
|
||||
TableDataSort = TableDataVo.TableDataSort,
|
||||
};
|
||||
|
||||
if (isUpdateSupport)
|
||||
{
|
||||
@ -198,9 +289,9 @@ namespace ARW.Service.Business.BusinessService.TableDataManage.TableDatas
|
||||
// 开启事务
|
||||
var res = await UseTranAsync(async () =>
|
||||
{
|
||||
var addRes = await AddOrUpdateTableData(TableData, new TableDataDto());
|
||||
var addRes = await AddOrUpdateTableData(TableData, dto);
|
||||
});
|
||||
var addStr = $"第 {index} 行 => 表格数据:【{TableData.TableDataId}】<span style='color:#27af49'>新增成功!</span><br>";
|
||||
var addStr = $"第 {index} 行 => 表格数据:【{TableData.TableDataProcurementContent}】<span style='color:#27af49'>新增成功!</span><br>";
|
||||
return addStr;
|
||||
}
|
||||
else
|
||||
@ -213,9 +304,9 @@ namespace ARW.Service.Business.BusinessService.TableDataManage.TableDatas
|
||||
TableData.TableDataGuid = model.TableDataGuid;
|
||||
TableData.Update_by = user;
|
||||
TableData.Update_time = DateTime.Now;
|
||||
var editRes = await AddOrUpdateTableData(TableData, new TableDataDto());
|
||||
var editRes = await AddOrUpdateTableData(TableData,dto);
|
||||
});
|
||||
var editStr = $"第 {index} 行 => 表格数据:【{TableData.TableDataId}】<span style='color:#e6a23c'>更新成功!</span><br>";
|
||||
var editStr = $"第 {index} 行 => 表格数据:【{TableData.TableDataProcurementContent}】<span style='color:#e6a23c'>更新成功!</span><br>";
|
||||
return editStr;
|
||||
}
|
||||
}
|
||||
@ -224,16 +315,16 @@ namespace ARW.Service.Business.BusinessService.TableDataManage.TableDatas
|
||||
// 开启事务
|
||||
var res = await UseTranAsync(async () =>
|
||||
{
|
||||
var addRes = await AddOrUpdateTableData(TableData, new TableDataDto());
|
||||
var addRes = await AddOrUpdateTableData(TableData,dto);
|
||||
});
|
||||
//Console.WriteLine(res.IsSuccess);
|
||||
var addStr = $"第 {index} 行 => 表格数据:【{TableData.TableDataId}】<span style='color:#27af49'>新增成功!</span><br>";
|
||||
var addStr = $"第 {index} 行 => 表格数据:【{TableData.TableDataProcurementContent}】<span style='color:#27af49'>新增成功!</span><br>";
|
||||
return addStr;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var errorRes = $"第 {index} 行 => 表格数据:【{TableData.TableDataId}】<span style='color:red'>导入失败!{ex.Message}</span><br>";
|
||||
var errorRes = $"第 {index} 行 => 表格数据:【{TableDataVo.TableDataProcurementContent}】<span style='color:red'>导入失败!{ex.Message}</span><br>";
|
||||
return errorRes;
|
||||
throw;
|
||||
}
|
||||
@ -246,6 +337,14 @@ namespace ARW.Service.Business.BusinessService.TableDataManage.TableDatas
|
||||
/// </summary>
|
||||
public async Task<List<TableDataVo>> HandleExportData(List<TableDataVo> data)
|
||||
{
|
||||
foreach (var item in data)
|
||||
{
|
||||
item.TableDataIsBidAnnouncementName = GetYesOrNoStr(item.TableDataIsBidAnnouncement);
|
||||
item.TableDataIsHumanResourcePoolOrFrameworkAgreementName = GetYesOrNoStr(item.TableDataIsHumanResourcePoolOrFrameworkAgreement);
|
||||
item.TableDataIsMultipleName = GetYesOrNoStr(item.TableDataIsMultiple);
|
||||
item.TableDataIsOnlyBidderName = GetYesOrNoStr(item.TableDataIsOnlyBidder);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ namespace ARW.Service.Business.IBusinessService.TableDataManage.TableDatas
|
||||
/// </summary>
|
||||
/// <param name="TableData"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> ImportExcel(TableData TableData,int index,bool isUpdateSupport,string user);
|
||||
Task<string> ImportExcel(TableDataVo TableData,int index,bool isUpdateSupport,string user);
|
||||
|
||||
/// <summary>
|
||||
/// Excel导出
|
||||
|
@ -108,10 +108,10 @@ namespace ARW.WebApi.Controllers.Business.TableDataManage.TableDatas
|
||||
foreach (TableDataVo item in parm)
|
||||
{
|
||||
i++;
|
||||
var TableData = await _TableDataService.HandleImportData(item);
|
||||
var modal = TableData.Adapt<TableData>().ToCreate(HttpContext);
|
||||
//var TableData = await _TableDataService.HandleImportData(item);
|
||||
//var modal = TableData.Adapt<TableData>().ToCreate(HttpContext);
|
||||
var user = JwtUtil.GetLoginUser(App.HttpContext).UserName;
|
||||
var msg = await _TableDataService.ImportExcel(modal, i, isUpdateSupport, user);
|
||||
var msg = await _TableDataService.ImportExcel(item, i, isUpdateSupport, user);
|
||||
msgList.Add(msg);
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ namespace ARW.WebApi.Controllers.Business.TableDataManage.TableDatas
|
||||
MemoryStream stream = new MemoryStream();
|
||||
|
||||
// 示例数据
|
||||
var values = new List<string>() { "111", "222", "333" };
|
||||
var values = new List<string>() { "房产,人工智能", "渤银理财理财分销对接代销系统采购项目", "渤银理财有限责任公司", "竞争性采购", "北京开科唯识技术股份有限公司", "总价", "https://www.jianyu360.cn/nologin/content/ABCY1xGZCkFAjg6RHt3cFxbCzMCEjJ3XGB1Kw4ZKDogcFFzcz9UCaI=.html", "22/11/2023", "23/11/2023", "北京开科唯识技术股份有限公司","31926", "是", "否", "是", "是", "", "渤银理财理财分销对接代销系统采购项目成交公示 受渤海银行股份有限公司委托,金采联合(北京)招标有限公司于2022年8月4日以竞争性采购方式,对渤银理财理财分销对接代销系统采购项目(项目编号:FUTC-2022-H031B)组织了采购。现将成交供应商公布如下:北京开科唯识技术股份有限公司为成交供应商。公示期限:自2022年8月22日至2022年8月24日采购代理机构:金采联合(北京)招标有限公司联系地址:北京市西城区佟麟阁路95号尚信大厦联系人:刘世平、刘松樵、谭永江代理机构联系方式:13682015217、16622986307、010-51813597特此公告金采联合(北京)招标有限公司2022年8月19日", "100" };
|
||||
string sFileName = DownloadImportTemplate(TableData, stream, "表格数据导入模板", values);
|
||||
|
||||
return File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", $"{sFileName}");
|
||||
|
Loading…
Reference in New Issue
Block a user