Browse Source

读取数据获取起始列表数据

lcl 4 months ago
parent
commit
960fbb5e47
1 changed files with 89 additions and 2 deletions
  1. 89 2
      Util/PrizeDo.cs

+ 89 - 2
Util/PrizeDo.cs

@@ -16,6 +16,7 @@ namespace Util
     {
         public static string batchNo = "";
         public static string publicStep = "";
+        public static bool logFlag = true;
         //发奖入口
         public static void sendPrize(string queueName, string content)
         {
@@ -28,6 +29,11 @@ namespace Util
                 string priListIds = priObjData[0];
                 int projectId = int.Parse(priObjData[1]);
                 int prizeInId = int.Parse(priObjData[2]);
+
+                var projectService = App.GetService<IPriProjectService>();
+                var project = projectService.GetFirst(m => m.id == projectId) ?? new PriProject();
+                logFlag = project.logFlag;
+
                 prizeSend(projectId, prizeInId, priListIds, content, queueName);
             }
         }
@@ -135,6 +141,11 @@ namespace Util
                             string val = GetQueryTableData(dic, fieldQueryValue);
                             condi += "'%" + val + "%'";                            
                         }
+                        else if(fieldQueryModel == "start_list_field")
+                        {
+                            string val = GetStartData(startData, fieldQueryValue);
+                            condi += "'%" + val + "%'";                            
+                        }
                     }
                     else if(fieldQueryKind == "2") //精确匹配
                     {
@@ -160,6 +171,10 @@ namespace Util
                             {
                                 val = GetQueryTableData(dic, fieldQueryValue);
                             }
+                            else if(fieldQueryModel == "start_list_field")
+                            {
+                                val = GetStartData(startData, fieldQueryValue);
+                            }
                             if(fieldQueryValueType == "text")
                             {
                                 val = "'" + val + "'";
@@ -231,6 +246,21 @@ namespace Util
                                 }
                             }                       
                         }
+                        else if(fieldQueryModel == "start_list_field")
+                        {
+                            foreach(string sub in valList)
+                            {
+                                string dicVal = GetStartData(startData, sub);
+                                if(fieldQueryValueType == "text")
+                                {
+                                    val += "'" + dicVal + "',";
+                                }
+                                else
+                                {
+                                    val += dicVal + ",";
+                                }
+                            }                       
+                        }
                         val = val.TrimEnd(',');
                         condi += val + ")";
                     }
@@ -286,6 +316,23 @@ namespace Util
                                 if(!string.IsNullOrEmpty(dicValRight)) condi += " and " + fieldEnName + "<='" + GetExpressionVal(dicValRight) + "'";
                             }
                         }
+                        else if(fieldQueryModel == "start_list_field")
+                        {
+                            string valLeft = val[0];
+                            string valRight = val[1];
+                            string dicValLeft = GetStartData(startData, valLeft);
+                            string dicValRight = GetStartData(startData, valRight);
+                            if(fieldQueryValueType == "number")
+                            {
+                                if(!string.IsNullOrEmpty(dicValLeft)) condi += " and " + fieldEnName + ">=" + dicValLeft;
+                                if(!string.IsNullOrEmpty(dicValRight)) condi += " and " + fieldEnName + "<=" + dicValRight;
+                            }
+                            else
+                            {
+                                if(!string.IsNullOrEmpty(dicValLeft)) condi += " and " + fieldEnName + ">='" + GetExpressionVal(dicValLeft) + "'";
+                                if(!string.IsNullOrEmpty(dicValRight)) condi += " and " + fieldEnName + "<='" + GetExpressionVal(dicValRight) + "'";
+                            }
+                        }
                     }
                     else if(fieldQueryKind == "4") //取反匹配
                     {
@@ -311,6 +358,10 @@ namespace Util
                             {
                                 val = GetQueryTableData(dic, fieldQueryValue);
                             }
+                            else if(fieldQueryModel == "start_list_field")
+                            {
+                                val = GetStartData(startData, fieldQueryValue);
+                            }
                             if(fieldQueryValueType == "text")
                             {
                                 val = "'" + val + "'";
@@ -1750,7 +1801,7 @@ namespace Util
                         {}
                         else
                         {
-                            prizeToDatabase(projectId, sub.id, content, condiDic, prizeAmt); //入库
+                            prizeToDatabase(projectId, sub.id, content, condiDic, prizeAmt, startData); //入库
                         }
                     }
                 }
@@ -1999,7 +2050,7 @@ namespace Util
         }
 
         //奖励入库
-        public static void prizeToDatabase(int projectId, int listId, string content, List<QueryCondition> condiDic, decimal prize_amt)
+        public static void prizeToDatabase(int projectId, int listId, string content, List<QueryCondition> condiDic, decimal prize_amt, Dictionary<string, string> startData)
         {
             var prizeInTableService = App.GetService<IPriPrizeInTableService>();
             var prizeInFieldService = App.GetService<IPriPrizeInFieldService>();
@@ -2028,6 +2079,10 @@ namespace Util
                     {
                         fieldQueryValue = GetQueryTableData(condiDic, fieldQueryValue);
                     }
+                    else if(fieldQueryModel == "querystart_list_field_field")
+                    {
+                        fieldQueryValue = GetStartData(startData, fieldQueryValue);
+                    }
                     else if(fieldQueryModel == "fixed_value")
                     {
                         fieldQueryValue = GetExpressionVal(fieldQueryValue);
@@ -2074,6 +2129,10 @@ namespace Util
                         {
                             condi += "'%" + GetQueryTableData(condiDic, fieldQueryValue) + "%'";
                         }
+                        else if(fieldQueryModel == "start_list_field")
+                        {
+                            condi += "'%" + GetStartData(startData, fieldQueryValue) + "%'";
+                        }
                     }
                     else if(fieldQueryKind == "2") //精确匹配
                     {
@@ -2092,6 +2151,10 @@ namespace Util
                         {
                             val = GetQueryTableData(condiDic, fieldQueryValue);
                         }
+                        else if(fieldQueryModel == "start_list_field")
+                        {
+                            val = GetStartData(startData, fieldQueryValue);
+                        }
                         if(fieldQueryValueType == "text")
                         {
                             val = "'" + val + "'";
@@ -2147,6 +2210,20 @@ namespace Util
                                 }
                             }
                         }
+                        else if(fieldQueryModel == "start_list_field")
+                        {
+                            foreach(string sub in valList)
+                            {
+                                if(fieldQueryValueType == "text")
+                                {
+                                    val += "'" + GetStartData(startData, sub) + "',";
+                                }
+                                else
+                                {
+                                    val += GetStartData(startData, sub) + ",";
+                                }
+                            }
+                        }
                         else if(fieldQueryModel == "db_field")
                         {
                             foreach(string sub in valList)
@@ -2279,6 +2356,10 @@ namespace Util
         {
             return condiDic.Any(m => m.FieldEnName == key) ? condiDic.FirstOrDefault(m => m.FieldEnName == key).FieldName : "";
         }
+        public static string GetStartData(Dictionary<string, string> startData, string key)
+        {
+            return startData.ContainsKey(key) ? startData[key] : "";
+        }
 
         //合并字典
         public static void MergeCondiDic(List<QueryCondition> condiDic, List<QueryCondition> condiDic1)
@@ -2292,6 +2373,7 @@ namespace Util
         //记录日志
         public static void addLog(int projectId, int listId, int prizeIn, string requestParam, string prizeInUrl)
         {
+            if(!logFlag) return;
             var logService = App.GetService<IPriLogService>();
             logService.Add(new PriLog()
             {
@@ -2306,6 +2388,7 @@ namespace Util
         }
         public static void setLogPrizeAmount(int listId, decimal prizeAmount)
         {
+            if(!logFlag) return;
             var logService = App.GetService<IPriLogService>();
             var log = logService.GetFirst(m => m.batchNo == batchNo && m.listId == listId);
             if(log != null)
@@ -2316,6 +2399,7 @@ namespace Util
         }
         public static void setLogStep(int listId, Dictionary<string, object> step)
         {
+            if(!logFlag) return;
             var logService = App.GetService<IPriLogService>();
             var log = logService.GetFirst(m => m.batchNo == batchNo && m.listId == listId);
             if(log != null)
@@ -2326,6 +2410,7 @@ namespace Util
         }
         public static void setLogStep(int listId, string key, object val)
         {
+            if(!logFlag) return;
             var logService = App.GetService<IPriLogService>();
             var log = logService.GetFirst(m => m.batchNo == batchNo && m.listId == listId);
             if(log != null)
@@ -2336,6 +2421,7 @@ namespace Util
         }
         public static void setLogStatus(int listId, int status)
         {
+            if(!logFlag) return;
             var logService = App.GetService<IPriLogService>();
             var log = logService.GetFirst(m => m.batchNo == batchNo && m.listId == listId);
             if(log != null)
@@ -2346,6 +2432,7 @@ namespace Util
         }
         public static void setLogFieldValue(int listId, string field, string content)
         {
+            if(!logFlag) return;
             var logService = App.GetService<IPriLogService>();
             var log = logService.GetFirst(m => m.batchNo == batchNo && m.listId == listId);
             if(log != null)