Browse Source

体检单位明细数据

bjmzak
wxd 2 years ago
parent
commit
6438fed0bc
  1. 52
      src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs

52
src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs

@ -315,6 +315,7 @@ namespace Shentun.Peis.DataMigrations
await TransferThreeCustomerOrgData();
await TransferCustomerOrgRegisterData();
await TransferCustomerOrgGroupData();
await TransferCustomerOrgGroupDetailData();
}
#region 基础数据
@ -2200,6 +2201,57 @@ namespace Shentun.Peis.DataMigrations
}
}
/// <summary>
/// 迁移单位分组明细数据
/// </summary>
/// <returns></returns>
[RemoteService(false)]
public async Task TransferCustomerOrgGroupDetailData()
{
var count = await _customerOrgGroupDetailRepository.GetCountAsync();
if (count == 0)
{
var oldCustomerOrgGroupList = await Db.Ado.GetDataTableAsync("select * from org_group_detail ");
if (oldCustomerOrgGroupList.Rows.Count > 0)
{
foreach (DataRow row in oldCustomerOrgGroupList.Rows)
{
using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true))
{
//新系统单位分组ID
Guid customerOrgGroupId = Guid.Parse((await _fieldComparisonRepository.GetQueryableAsync())
.Where(m => m.TableName == "customer_org_group" && m.OldKeyValue == row["org_group_id"].ToString()).FirstOrDefault().NewKeyValue);
Guid asbitemId = Guid.Parse((await _fieldComparisonRepository.GetQueryableAsync())
.Where(m => m.TableName == "asbitem" && m.OldKeyValue == row["asbitem_id"].ToString()).FirstOrDefault().NewKeyValue);
var data = new CustomerOrgGroupDetail
{
AsbitemId = asbitemId,
CustomerOrgGroupId = customerOrgGroupId,
Price = Convert.ToDecimal(row["price"].ToString()),
Amount = 1
};
await _customerOrgGroupDetailRepository.InsertAsync(data);
await uow.CompleteAsync();
}
}
}
_logger.LogInformation($"单位分组明细数据处理完毕,处理数量{oldCustomerOrgGroupList.Rows.Count}");
}
else
{
_logger.LogInformation("单位分组明细数据已存在,未处理");
}
}
#endregion

Loading…
Cancel
Save