Commit 023505ba6a5d2507aaa89f697f85dd61cde16d51

Authored by “wangming”
1 parent 44e46b3e

Enhance LqEventService to include TargetCount in success data; add debug logging…

… for Excel import process; modify LqEventUser DTO to support TargetCount; update projectNumber type in LqKdPxmx DTO and entity to decimal for consistency.
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqEventUser/LqEventUserCrInput.cs
... ... @@ -38,5 +38,10 @@ namespace NCC.Extend.Entitys.Dto.LqEventUser
38 38 /// 门店id
39 39 /// </summary>
40 40 public string StoreId { get; set; }
  41 +
  42 + /// <summary>
  43 + /// 目标张数
  44 + /// </summary>
  45 + public int? TargetCount { get; set; }
41 46 }
42 47 }
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdPxmx/LqKdPxmxCrInput.cs
... ... @@ -51,7 +51,7 @@ namespace NCC.Extend.Entitys.Dto.LqKdKdjlb
51 51 /// <summary>
52 52 /// 项目次数
53 53 /// </summary>
54   - public int? projectNumber { get; set; }
  54 + public decimal projectNumber { get; set; }
55 55  
56 56 /// <summary>
57 57 /// 是否有效
... ...
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Entity/lq_kd_pxmx/LqKdPxmxEntity.cs
... ... @@ -57,7 +57,7 @@ namespace NCC.Extend.Entitys.lq_kd_pxmx
57 57 /// 项目次数
58 58 /// </summary>
59 59 [SugarColumn(ColumnName = "F_ProjectNumber")]
60   - public int? ProjectNumber { get; set; }
  60 + public decimal ProjectNumber { get; set; }
61 61  
62 62 /// <summary>
63 63 /// 是否有效
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqEventService.cs
... ... @@ -604,6 +604,7 @@ namespace NCC.Extend.LqEvent
604 604 DepId = user.OrganizeId,
605 605 TeamName = row.TeamName,
606 606 StoreId = storeId,
  607 + TargetCount = row.TargetCount,
607 608 };
608 609  
609 610 result.SuccessData.Add(successData);
... ... @@ -656,8 +657,23 @@ namespace NCC.Extend.LqEvent
656 657 // 使用ExcelImportHelper读取Excel文件
657 658 var dataTable = ExcelImportHelper.ToDataTable(tempFilePath, 0, 0);
658 659  
659   - // 从第2行开始读取数据(第1行是标题)
660   - for (int i = 1; i < dataTable.Rows.Count; i++)
  660 + // 调试信息:输出总行数和列数
  661 + Console.WriteLine($"Excel总行数: {dataTable.Rows.Count}, 总列数: {dataTable.Columns.Count}");
  662 +
  663 + // 调试信息:输出所有行的数据
  664 + for (int debugRow = 0; debugRow < dataTable.Rows.Count; debugRow++)
  665 + {
  666 + var debugRowData = dataTable.Rows[debugRow];
  667 + var debugValues = new List<string>();
  668 + for (int debugCol = 0; debugCol < debugRowData.ItemArray.Length; debugCol++)
  669 + {
  670 + debugValues.Add(debugRowData[debugCol]?.ToString() ?? "null");
  671 + }
  672 + Console.WriteLine($"调试第{debugRow + 1}行: {string.Join(", ", debugValues)}");
  673 + }
  674 +
  675 + // 从第1行开始读取数据(没有标题行)
  676 + for (int i = 0; i < dataTable.Rows.Count; i++)
661 677 {
662 678 var row = dataTable.Rows[i];
663 679 var mobilePhone = row[0]?.ToString()?.Trim();
... ... @@ -666,6 +682,9 @@ namespace NCC.Extend.LqEvent
666 682 var storeName = row[3]?.ToString()?.Trim();
667 683 var targetCountStr = row[4]?.ToString()?.Trim();
668 684  
  685 + // 调试信息:输出每一行读取的数据
  686 + Console.WriteLine($"第{i + 1}行数据: 手机号={mobilePhone}, 姓名={name}, 战队={teamName}, 门店={storeName}, 目标={targetCountStr}");
  687 +
669 688 int? targetCount = null;
670 689 if (!string.IsNullOrEmpty(targetCountStr) && int.TryParse(targetCountStr, out int target))
671 690 {
... ... @@ -675,6 +694,7 @@ namespace NCC.Extend.LqEvent
675 694 // 跳过空行
676 695 if (string.IsNullOrEmpty(mobilePhone) && string.IsNullOrEmpty(name))
677 696 {
  697 + Console.WriteLine($"第{i + 1}行被跳过:空行");
678 698 continue;
679 699 }
680 700  
... ...
netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs
... ... @@ -276,8 +276,8 @@ namespace NCC.Extend.LqKdKdjlb
276 276 CreateTIme = DateTime.Now,
277 277 MemberId = entity.Kdhy,
278 278 IsEnabled = 0,
279   - ProjectNumber = item.projectNumber ?? 1,
280   - TotalPrice = (decimal)(item.pxjg * (item.projectNumber ?? 1)),
  279 + ProjectNumber = item.projectNumber,
  280 + TotalPrice = (decimal)(item.pxjg * item.projectNumber),
281 281 Px = item.px,
282 282 Pxmc = item.pxmc,
283 283 Pxjg = item.pxjg,
... ...