Commit 0c866930ab0f561e277265d5f334d0aa66cc12c9

Authored by “wangming”
1 parent 3b7c4f3b

fix: 修复门店过滤字段错误

- 修复lq_kd_kdjlb表的门店字段从F_StoreId改为djmd
- 修复lq_xh_hyhk表的门店字段从F_StoreId改为md
- 修复lq_hytk_hytk表的门店字段从F_StoreId改为md
- 移除lq_khxx表的门店过滤(该表没有门店字段)
- lq_tkjlb表的F_StoreId字段保持不变(已验证存在)
- 解决所有门店过滤相关的SQL语法错误
netcore/src/Modularity/Extend/NCC.Extend/LqReportService.cs
@@ -754,7 +754,7 @@ namespace NCC.Extend @@ -754,7 +754,7 @@ namespace NCC.Extend
754 object billingParameters; 754 object billingParameters;
755 if (input.StoreIds != null && input.StoreIds.Any()) 755 if (input.StoreIds != null && input.StoreIds.Any())
756 { 756 {
757 - billingSql += " AND kd.F_StoreId IN @storeIds"; 757 + billingSql += " AND kd.djmd IN @storeIds";
758 billingParameters = new { startTime, endTime, storeIds = input.StoreIds }; 758 billingParameters = new { startTime, endTime, storeIds = input.StoreIds };
759 } 759 }
760 else 760 else
@@ -779,7 +779,7 @@ namespace NCC.Extend @@ -779,7 +779,7 @@ namespace NCC.Extend
779 object consumeParameters; 779 object consumeParameters;
780 if (input.StoreIds != null && input.StoreIds.Any()) 780 if (input.StoreIds != null && input.StoreIds.Any())
781 { 781 {
782 - consumeSql += " AND xh.F_StoreId IN @storeIds"; 782 + consumeSql += " AND xh.md IN @storeIds";
783 consumeParameters = new { startTime, endTime, storeIds = input.StoreIds }; 783 consumeParameters = new { startTime, endTime, storeIds = input.StoreIds };
784 } 784 }
785 else 785 else
@@ -804,7 +804,7 @@ namespace NCC.Extend @@ -804,7 +804,7 @@ namespace NCC.Extend
804 object refundParameters; 804 object refundParameters;
805 if (input.StoreIds != null && input.StoreIds.Any()) 805 if (input.StoreIds != null && input.StoreIds.Any())
806 { 806 {
807 - refundSql += " AND hytk.F_StoreId IN @storeIds"; 807 + refundSql += " AND hytk.md IN @storeIds";
808 refundParameters = new { startTime, endTime, storeIds = input.StoreIds }; 808 refundParameters = new { startTime, endTime, storeIds = input.StoreIds };
809 } 809 }
810 else 810 else
@@ -932,6 +932,7 @@ namespace NCC.Extend @@ -932,6 +932,7 @@ namespace NCC.Extend
932 var endTime = input.EndTime ?? DateTime.Now; 932 var endTime = input.EndTime ?? DateTime.Now;
933 933
934 // 第一步:获取客户类型统计 934 // 第一步:获取客户类型统计
  935 + // 注意:lq_khxx表没有门店字段,无法按门店过滤
935 var customerTypeSql = $@" 936 var customerTypeSql = $@"
936 SELECT 937 SELECT
937 SUM(CASE WHEN kh.khlx = '{MemberTypeEnum.线索.GetHashCode()}' THEN 1 ELSE 0 END) as lead_count, 938 SUM(CASE WHEN kh.khlx = '{MemberTypeEnum.线索.GetHashCode()}' THEN 1 ELSE 0 END) as lead_count,
@@ -942,16 +943,7 @@ namespace NCC.Extend @@ -942,16 +943,7 @@ namespace NCC.Extend
942 WHERE kh.F_CreateTime >= @startTime 943 WHERE kh.F_CreateTime >= @startTime
943 AND kh.F_CreateTime <= @endTime"; 944 AND kh.F_CreateTime <= @endTime";
944 945
945 - object customerTypeParameters;  
946 - if (input.StoreIds != null && input.StoreIds.Any())  
947 - {  
948 - customerTypeSql += " AND kh.F_StoreId IN @storeIds";  
949 - customerTypeParameters = new { startTime, endTime, storeIds = input.StoreIds };  
950 - }  
951 - else  
952 - {  
953 - customerTypeParameters = new { startTime, endTime };  
954 - } 946 + object customerTypeParameters = new { startTime, endTime };
955 947
956 var customerTypeResult = await _db.Ado.SqlQueryAsync<dynamic>(customerTypeSql, customerTypeParameters); 948 var customerTypeResult = await _db.Ado.SqlQueryAsync<dynamic>(customerTypeSql, customerTypeParameters);
957 var leadCount = Convert.ToInt32(customerTypeResult?.FirstOrDefault()?.lead_count ?? 0); 949 var leadCount = Convert.ToInt32(customerTypeResult?.FirstOrDefault()?.lead_count ?? 0);
@@ -992,7 +984,7 @@ namespace NCC.Extend @@ -992,7 +984,7 @@ namespace NCC.Extend
992 object consumeParameters; 984 object consumeParameters;
993 if (input.StoreIds != null && input.StoreIds.Any()) 985 if (input.StoreIds != null && input.StoreIds.Any())
994 { 986 {
995 - consumeSql += " AND xh.F_StoreId IN @storeIds"; 987 + consumeSql += " AND xh.md IN @storeIds";
996 consumeParameters = new { startTime, endTime, storeIds = input.StoreIds }; 988 consumeParameters = new { startTime, endTime, storeIds = input.StoreIds };
997 } 989 }
998 else 990 else