|
@@ -28,7 +28,7 @@ namespace Util
|
|
|
string priListIds = priObjData[0];
|
|
|
int projectId = int.Parse(priObjData[1]);
|
|
|
int prizeInId = int.Parse(priObjData[2]);
|
|
|
- prizeSend(projectId, prizeInId, priListIds, content);
|
|
|
+ prizeSend(projectId, prizeInId, priListIds, content, queueName);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -67,7 +67,7 @@ namespace Util
|
|
|
}
|
|
|
|
|
|
//查询条件匹配数据
|
|
|
- public static List<QueryCondition> condition(int projectId, List<int> ids, string content)
|
|
|
+ public static List<QueryCondition> condition(int listId, int projectId, List<int> ids, string content)
|
|
|
{
|
|
|
List<QueryCondition> dic = new();
|
|
|
var queryTableService = App.GetService<IPriQueryTableService>();
|
|
@@ -340,8 +340,9 @@ namespace Util
|
|
|
}
|
|
|
|
|
|
//奖励发放对象
|
|
|
- public static string prizeObject(int prizeObjectTag, string content)
|
|
|
+ public static string prizeObject(int listId, int prizeObjectTag, string content)
|
|
|
{
|
|
|
+ Dictionary<string, object> logStepDic = new();
|
|
|
Dictionary<string, object> dic = new();
|
|
|
var prizeObjectTableService = App.GetService<IPriPrizeObjectTableService>();
|
|
|
var prizeObjectFieldService = App.GetService<IPriPrizeObjectFieldService>();
|
|
@@ -351,16 +352,27 @@ namespace Util
|
|
|
string field = prizeObjectTable.selectField;
|
|
|
int projectId = prizeObjectTable.projectId;
|
|
|
|
|
|
+ logStepDic.Add("奖励发放对象说明", prizeObjectTable.note);
|
|
|
+
|
|
|
//查询匹配条件
|
|
|
string condi = "";
|
|
|
+ List<Dictionary<string, object>> condiDics = new();
|
|
|
var queryFields = prizeObjectFieldService.GetList(m => m.objectTableId == prizeObjectTable.id);
|
|
|
foreach(var queryField in queryFields)
|
|
|
{
|
|
|
+ string fieldName = queryField.fieldName;
|
|
|
string fieldEnName = queryField.fieldEnName;
|
|
|
string fieldQueryKind = queryField.fieldQueryKind;
|
|
|
string fieldQueryModel = queryField.fieldQueryModel;
|
|
|
string fieldQueryValue = queryField.fieldQueryValue;
|
|
|
string fieldQueryValueType = queryField.fieldQueryValueType;
|
|
|
+
|
|
|
+ Dictionary<string, object> condiDic = new();
|
|
|
+
|
|
|
+ condiDic.Add("字段名称", fieldName);
|
|
|
+ condiDic.Add("匹配条件", fieldQueryKind);
|
|
|
+ condiDic.Add("匹配方式", fieldQueryModel);
|
|
|
+
|
|
|
if(fieldQueryKind == "1") //模糊匹配
|
|
|
{
|
|
|
condi += " and " + fieldEnName + " like ";
|
|
@@ -369,14 +381,19 @@ namespace Util
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
string val = req.ContainsKey(fieldQueryValue) ? req[fieldQueryValue] : "0";
|
|
|
condi += "'%" + val + "%'";
|
|
|
+ condiDic.Add("匹配值", val);
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
|
- condi += "'%" + GetExpressionVal(fieldQueryValue) + "%'";
|
|
|
+ string val = GetExpressionVal(fieldQueryValue);
|
|
|
+ condi += "'%" + val + "%'";
|
|
|
+ condiDic.Add("匹配值", val);
|
|
|
}
|
|
|
else if(fieldQueryModel == "db_field")
|
|
|
{
|
|
|
+ string val = GetDbExpressionVal(fieldQueryValue);
|
|
|
condi += "'%" + GetDbExpressionVal(fieldQueryValue) + "%'";
|
|
|
+ condiDic.Add("匹配值", val);
|
|
|
}
|
|
|
}
|
|
|
else if(fieldQueryKind == "2") //精确匹配
|
|
@@ -401,6 +418,7 @@ namespace Util
|
|
|
val = "'" + val + "'";
|
|
|
}
|
|
|
condi += val;
|
|
|
+ condiDic.Add("匹配值", val);
|
|
|
}
|
|
|
else if(fieldQueryKind == "5" || fieldQueryKind == "6") //数组匹配/排除
|
|
|
{
|
|
@@ -453,6 +471,7 @@ namespace Util
|
|
|
}
|
|
|
val = val.TrimEnd(',');
|
|
|
condi += val + ")";
|
|
|
+ condiDic.Add("匹配值", val);
|
|
|
}
|
|
|
else if(fieldQueryKind == "3") //范围匹配
|
|
|
{
|
|
@@ -497,6 +516,7 @@ namespace Util
|
|
|
if(!string.IsNullOrEmpty(val[1])) condi += " and " + fieldEnName + "<='" + GetDbExpressionVal(val[1]) + "'";
|
|
|
}
|
|
|
}
|
|
|
+ condiDic.Add("匹配值", val);
|
|
|
}
|
|
|
else if(fieldQueryKind == "4") //取反匹配
|
|
|
{
|
|
@@ -520,16 +540,22 @@ namespace Util
|
|
|
val = "'" + val + "'";
|
|
|
}
|
|
|
condi += val;
|
|
|
+ condiDic.Add("匹配值", val);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ logStepDic.Add("奖励发放对象查询条件", condiDics);
|
|
|
+
|
|
|
+ string result = "0";
|
|
|
var db = initDb(prizeObjectTable.databaseId);
|
|
|
var item = db.Ado.GetScalar("select " + field + " from " + prizeObjectTable.tableEnName + " where 1=1" + condi);
|
|
|
if(item != null)
|
|
|
{
|
|
|
- return item.ToString();
|
|
|
+ result = item.ToString();
|
|
|
}
|
|
|
- return "0";
|
|
|
+ logStepDic.Add("奖励发放对象", result);
|
|
|
+ setLogStep(listId, logStepDic);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
//奖励发放入口
|
|
@@ -556,7 +582,7 @@ namespace Util
|
|
|
}
|
|
|
|
|
|
//奖励发放
|
|
|
- public static void prizeSend(int projectId, int prizeInId, string prizeIds, string content)
|
|
|
+ public static void prizeSend(int projectId, int prizeInId, string prizeIds, string content, string queueName)
|
|
|
{
|
|
|
var loopSetService = App.GetService<IPriLoopSetService>();
|
|
|
var recursionStartTableService = App.GetService<IPriRecursionStartTableService>();
|
|
@@ -564,387 +590,402 @@ namespace Util
|
|
|
var priList = prizeList(projectId, prizeIds);
|
|
|
foreach(var sub in priList)
|
|
|
{
|
|
|
- addLog(projectId, sub.id, prizeInId, content); //初始化日志
|
|
|
- string prizeObjectId = prizeObject(sub.prizeObj, content);
|
|
|
- var recursionFlag = sub.recursionFlag; //是否递归
|
|
|
- if(recursionFlag)
|
|
|
+ try
|
|
|
{
|
|
|
- List<QueryCondition> queryCondiDic = condition(projectId, Tools.SpitIntArrary(sub.queryTableIdList, ',').ToList(), content);
|
|
|
- var loopSet = loopSetService.GetFirst(m => m.listId == sub.id) ?? new PriLoopSet();
|
|
|
- var recursionStartTable = recursionStartTableService.GetFirst(m => m.listId == sub.id) ?? new PriRecursionStartTable();
|
|
|
- var tableEnName = loopSet.tableEnName; //递归查询表
|
|
|
- var parentField = loopSet.parentField; //父字段
|
|
|
- var sonField = loopSet.sonField; //子字段
|
|
|
- var afterPrizeFlag = loopSet.afterPrizeFlag; //发奖后是否继续
|
|
|
- var db = initDb(recursionStartTable.databaseId);
|
|
|
- string objId = prizeObjectId;
|
|
|
- bool op = true;
|
|
|
- int index = 0;
|
|
|
- loopAmount = 0;
|
|
|
- while(!string.IsNullOrEmpty(objId) && objId != "0" && op)
|
|
|
- {
|
|
|
- List<QueryCondition> condiDic = loopCondition(projectId, sub, objId, content);
|
|
|
- if(condiDic.Count > 0)
|
|
|
- {
|
|
|
- bool prizeFlag = true;
|
|
|
- var conditions = recursionStartConditionService.GetList(m => m.loopSetId == loopSet.id);
|
|
|
- if(conditions.Count > 0)
|
|
|
- {
|
|
|
- int allCount = conditions.Count; //所有奖励条件数
|
|
|
- int passCount = 0; //通过条件数
|
|
|
- foreach(var condition in conditions)
|
|
|
+ addLog(projectId, sub.id, prizeInId, content, queueName); //初始化日志
|
|
|
+ string prizeObjectId = prizeObject(sub.id, sub.prizeObj, content);
|
|
|
+ var recursionFlag = sub.recursionFlag; //是否递归
|
|
|
+ setLogStep(sub.id, "是否递归", recursionFlag ? "是" : "否");
|
|
|
+ if(recursionFlag)
|
|
|
+ {
|
|
|
+ List<QueryCondition> queryCondiDic = condition(sub.id, projectId, Tools.SpitIntArrary(sub.queryTableIdList, ',').ToList(), content);
|
|
|
+ setLogStep(sub.id, "查询原始数据", queryCondiDic);
|
|
|
+ var loopSet = loopSetService.GetFirst(m => m.listId == sub.id) ?? new PriLoopSet();
|
|
|
+ var recursionStartTable = recursionStartTableService.GetFirst(m => m.listId == sub.id) ?? new PriRecursionStartTable();
|
|
|
+ var tableEnName = loopSet.tableEnName; //递归查询表
|
|
|
+ var parentField = loopSet.parentField; //父字段
|
|
|
+ var sonField = loopSet.sonField; //子字段
|
|
|
+ var afterPrizeFlag = loopSet.afterPrizeFlag; //发奖后是否继续
|
|
|
+ var db = initDb(recursionStartTable.databaseId);
|
|
|
+ string objId = prizeObjectId;
|
|
|
+ bool op = true;
|
|
|
+ int index = 0;
|
|
|
+ loopAmount = 0;
|
|
|
+ List<Dictionary<string, object>> loopLogDic = new();
|
|
|
+ while(!string.IsNullOrEmpty(objId) && objId != "0" && op)
|
|
|
+ {
|
|
|
+ Dictionary<string, object> loopLog = new();
|
|
|
+ List<QueryCondition> condiDic = loopCondition(projectId, sub, objId, content);
|
|
|
+ loopLog.Add("查询" + objId + "匹配数据", condiDic);
|
|
|
+ if(condiDic.Count > 0)
|
|
|
+ {
|
|
|
+ bool prizeFlag = true;
|
|
|
+ var conditions = recursionStartConditionService.GetList(m => m.loopSetId == loopSet.id);
|
|
|
+ if(conditions.Count > 0)
|
|
|
{
|
|
|
- if(condition.startIndex <= index)
|
|
|
+ int allCount = conditions.Count; //所有奖励条件数
|
|
|
+ int passCount = 0; //通过条件数
|
|
|
+ foreach(var condition in conditions)
|
|
|
{
|
|
|
- Dictionary<string, string> logStepDic = new();
|
|
|
-
|
|
|
- var returnFieldId = condition.returnFieldId; //条件返回字段
|
|
|
- var fieldQueryKind = condition.fieldQueryKind; //匹配条件
|
|
|
- var fieldQueryModel = condition.fieldQueryModel; //匹配方式
|
|
|
- var fieldQueryValue = condition.fieldQueryValue; //匹配值
|
|
|
- var fieldQueryValueType = condition.fieldQueryValueType; //匹配值类型
|
|
|
-
|
|
|
- string checkObj = "";
|
|
|
- string checkTitle = "";
|
|
|
- if(returnFieldId.Contains(","))
|
|
|
- {
|
|
|
- string[] returnFieldIdList = returnFieldId.Split(',');
|
|
|
- foreach(string subField in returnFieldIdList)
|
|
|
- {
|
|
|
- string val = GetQueryTableData(condiDic, subField);
|
|
|
- checkObj += val + ",";
|
|
|
- string title = GetQueryTableTitle(condiDic, subField);
|
|
|
- checkTitle += title + ",";
|
|
|
- }
|
|
|
- checkObj = checkObj.TrimEnd(',');
|
|
|
- checkTitle = checkTitle.TrimEnd(',');
|
|
|
- }
|
|
|
- else if (returnFieldId.Contains("+") || returnFieldId.Contains("-") || returnFieldId.Contains("*") || returnFieldId.Contains("/") || returnFieldId.Contains("(") || returnFieldId.Contains(")"))
|
|
|
- {
|
|
|
- string expresssion = returnFieldId;
|
|
|
- checkTitle = returnFieldId;
|
|
|
- string[] returnFields = returnFieldId.Split(new char[] { '+', '-', '*', '/', '(', ')' });
|
|
|
- foreach(string returnField in returnFields)
|
|
|
- {
|
|
|
- string val = GetQueryTableData(condiDic, returnField);
|
|
|
- expresssion = expresssion.Replace(returnField, val);
|
|
|
-
|
|
|
- string title = GetQueryTableTitle(condiDic, returnField);
|
|
|
- checkTitle = checkTitle.Replace(returnField, title);
|
|
|
- }
|
|
|
- DataTable dt = new();
|
|
|
- checkObj = dt.Compute(expresssion, "false").ToString();
|
|
|
- }
|
|
|
- else
|
|
|
+ if(condition.startIndex <= index)
|
|
|
{
|
|
|
- checkObj = GetQueryTableData(condiDic, returnFieldId);
|
|
|
- checkTitle = GetQueryTableTitle(condiDic, returnFieldId);
|
|
|
- }
|
|
|
-
|
|
|
- logStepDic.Add("标题", checkTitle);
|
|
|
- logStepDic.Add("匹配值", fieldQueryValue);
|
|
|
- logStepDic.Add("实际值", checkObj);
|
|
|
+ Dictionary<string, object> logStepDic = new();
|
|
|
+
|
|
|
+ var returnFieldId = condition.returnFieldId; //条件返回字段
|
|
|
+ var fieldQueryKind = condition.fieldQueryKind; //匹配条件
|
|
|
+ var fieldQueryModel = condition.fieldQueryModel; //匹配方式
|
|
|
+ var fieldQueryValue = condition.fieldQueryValue; //匹配值
|
|
|
+ var fieldQueryValueType = condition.fieldQueryValueType; //匹配值类型
|
|
|
|
|
|
- var checkVal = fieldQueryValue;
|
|
|
- bool passFlag = false;
|
|
|
-
|
|
|
- if(fieldQueryKind == "1") //模糊匹配
|
|
|
- {
|
|
|
- if(fieldQueryValueType == "text")
|
|
|
- {
|
|
|
- if(checkObj.ToString().Contains(GetExpressionVal(checkVal)))
|
|
|
- {
|
|
|
- passCount += 1; passFlag = true;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else if(fieldQueryKind == "2") //精确匹配
|
|
|
- {
|
|
|
- if(fieldQueryValueType == "int")
|
|
|
+ string checkObj = "";
|
|
|
+ string checkTitle = "";
|
|
|
+ if(returnFieldId.Contains(","))
|
|
|
{
|
|
|
- if(int.Parse(Function.CheckInt(checkObj.ToString())) == int.Parse(Function.CheckNum(checkVal)))
|
|
|
+ string[] returnFieldIdList = returnFieldId.Split(',');
|
|
|
+ foreach(string subField in returnFieldIdList)
|
|
|
{
|
|
|
- passCount += 1; passFlag = true;
|
|
|
+ string val = GetQueryTableData(condiDic, subField);
|
|
|
+ checkObj += val + ",";
|
|
|
+ string title = GetQueryTableTitle(condiDic, subField);
|
|
|
+ checkTitle += title + ",";
|
|
|
}
|
|
|
+ checkObj = checkObj.TrimEnd(',');
|
|
|
+ checkTitle = checkTitle.TrimEnd(',');
|
|
|
}
|
|
|
- else if(fieldQueryValueType == "number")
|
|
|
+ else if (returnFieldId.Contains("+") || returnFieldId.Contains("-") || returnFieldId.Contains("*") || returnFieldId.Contains("/") || returnFieldId.Contains("(") || returnFieldId.Contains(")"))
|
|
|
{
|
|
|
- if(decimal.Parse(Function.CheckNum(checkObj.ToString())) == decimal.Parse(Function.CheckNum(checkVal)))
|
|
|
+ string expresssion = returnFieldId;
|
|
|
+ checkTitle = returnFieldId;
|
|
|
+ string[] returnFields = returnFieldId.Split(new char[] { '+', '-', '*', '/', '(', ')' });
|
|
|
+ foreach(string returnField in returnFields)
|
|
|
{
|
|
|
- passCount += 1; passFlag = true;
|
|
|
+ string val = GetQueryTableData(condiDic, returnField);
|
|
|
+ expresssion = expresssion.Replace(returnField, val);
|
|
|
+
|
|
|
+ string title = GetQueryTableTitle(condiDic, returnField);
|
|
|
+ checkTitle = checkTitle.Replace(returnField, title);
|
|
|
}
|
|
|
+ DataTable dt = new();
|
|
|
+ checkObj = dt.Compute(expresssion, "false").ToString();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if(checkObj.ToString() == GetExpressionVal(checkVal))
|
|
|
- {
|
|
|
- passCount += 1; passFlag = true;
|
|
|
- }
|
|
|
+ checkObj = GetQueryTableData(condiDic, returnFieldId);
|
|
|
+ checkTitle = GetQueryTableTitle(condiDic, returnFieldId);
|
|
|
}
|
|
|
- }
|
|
|
- else if(fieldQueryKind == "3") //范围匹配
|
|
|
- {
|
|
|
- string[] val = checkVal.Split(':');
|
|
|
- string valLeft = val[0];
|
|
|
- string valRight = val[1];
|
|
|
- if(fieldQueryModel == "request_param")
|
|
|
+
|
|
|
+ logStepDic.Add("标题", checkTitle);
|
|
|
+ logStepDic.Add("匹配值", fieldQueryValue);
|
|
|
+ logStepDic.Add("实际值", checkObj);
|
|
|
+
|
|
|
+ var checkVal = fieldQueryValue;
|
|
|
+ bool passFlag = false;
|
|
|
+
|
|
|
+ if(fieldQueryKind == "1") //模糊匹配
|
|
|
{
|
|
|
- Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
- if(fieldQueryValueType == "number")
|
|
|
+ if(fieldQueryValueType == "text")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(req[valLeft]) && !string.IsNullOrEmpty(req[valRight]) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(req[valLeft])) && decimal.Parse(checkObj) <= decimal.Parse(Function.CheckNum(req[valRight])))
|
|
|
- {
|
|
|
- passCount += 1; passFlag = true;
|
|
|
- }
|
|
|
- else if(!string.IsNullOrEmpty(req[valLeft]) && string.IsNullOrEmpty(req[valRight]) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(req[valLeft])))
|
|
|
- {
|
|
|
- passCount += 1; passFlag = true;
|
|
|
- }
|
|
|
- else if(string.IsNullOrEmpty(req[valLeft]) && !string.IsNullOrEmpty(req[valRight]) && decimal.Parse(checkObj) <= decimal.Parse(Function.CheckNum(req[valRight])))
|
|
|
+ if(checkObj.ToString().Contains(GetExpressionVal(checkVal)))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
}
|
|
|
- else if(fieldQueryValueType == "int")
|
|
|
+ }
|
|
|
+ else if(fieldQueryKind == "2") //精确匹配
|
|
|
+ {
|
|
|
+ if(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(req[valLeft]) && !string.IsNullOrEmpty(req[valRight]) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(req[valLeft])) && int.Parse(checkObj) <= int.Parse(Function.CheckInt(req[valRight])))
|
|
|
- {
|
|
|
- passCount += 1; passFlag = true;
|
|
|
- }
|
|
|
- else if(!string.IsNullOrEmpty(req[valLeft]) && string.IsNullOrEmpty(req[valRight]) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(req[valLeft])))
|
|
|
- {
|
|
|
- passCount += 1; passFlag = true;
|
|
|
- }
|
|
|
- else if(string.IsNullOrEmpty(req[valLeft]) && !string.IsNullOrEmpty(req[valRight]) && int.Parse(checkObj) <= int.Parse(Function.CheckInt(req[valRight])))
|
|
|
+ if(int.Parse(Function.CheckInt(checkObj.ToString())) == int.Parse(Function.CheckNum(checkVal)))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
}
|
|
|
- else if(fieldQueryValueType.StartsWith("date"))
|
|
|
+ else if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(req[valLeft]) && !string.IsNullOrEmpty(req[valRight]) && DateTime.Parse(checkObj) >= DateTime.Parse(req[valLeft]) && DateTime.Parse(checkObj) <= DateTime.Parse(req[valRight]))
|
|
|
- {
|
|
|
- passCount += 1; passFlag = true;
|
|
|
- }
|
|
|
- else if(!string.IsNullOrEmpty(req[valLeft]) && string.IsNullOrEmpty(req[valRight]) && DateTime.Parse(checkObj) >= DateTime.Parse(req[valLeft]))
|
|
|
+ if(decimal.Parse(Function.CheckNum(checkObj.ToString())) == decimal.Parse(Function.CheckNum(checkVal)))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
- else if(string.IsNullOrEmpty(req[valLeft]) && !string.IsNullOrEmpty(req[valRight]) && DateTime.Parse(checkObj) <= DateTime.Parse(req[valRight]))
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(checkObj.ToString() == GetExpressionVal(checkVal))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else if(fieldQueryModel == "fixed_value")
|
|
|
+ else if(fieldQueryKind == "3") //范围匹配
|
|
|
{
|
|
|
- string checkValLeft = valLeft.Replace("#{", "").Replace("}#", "");
|
|
|
- string checkValRight = valRight.Replace("#{", "").Replace("}#", "");
|
|
|
- if(checkValLeft.Contains(",")) checkValLeft = checkValLeft.Split(',')[0];
|
|
|
- if(checkValRight.Contains(",")) checkValRight = checkValRight.Split(',')[0];
|
|
|
- valLeft = GetExpressionVal(valLeft);
|
|
|
- valRight = GetExpressionVal(valRight);
|
|
|
- if(fieldQueryValueType == "number")
|
|
|
+ string[] val = checkVal.Split(':');
|
|
|
+ string valLeft = val[0];
|
|
|
+ string valRight = val[1];
|
|
|
+ if(fieldQueryModel == "request_param")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(valLeft)) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(valRight)))
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
+ if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- passCount += 1; passFlag = true;
|
|
|
+ if(!string.IsNullOrEmpty(req[valLeft]) && !string.IsNullOrEmpty(req[valRight]) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(req[valLeft])) && decimal.Parse(checkObj) <= decimal.Parse(Function.CheckNum(req[valRight])))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(!string.IsNullOrEmpty(req[valLeft]) && string.IsNullOrEmpty(req[valRight]) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(req[valLeft])))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(string.IsNullOrEmpty(req[valLeft]) && !string.IsNullOrEmpty(req[valRight]) && decimal.Parse(checkObj) <= decimal.Parse(Function.CheckNum(req[valRight])))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
- else if(!string.IsNullOrEmpty(valLeft) && string.IsNullOrEmpty(valRight) && decimal.Parse(Function.CheckNum(checkObj.ToString())) >= decimal.Parse(Function.CheckNum(valLeft)))
|
|
|
+ else if(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- passCount += 1; passFlag = true;
|
|
|
+ if(!string.IsNullOrEmpty(req[valLeft]) && !string.IsNullOrEmpty(req[valRight]) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(req[valLeft])) && int.Parse(checkObj) <= int.Parse(Function.CheckInt(req[valRight])))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(!string.IsNullOrEmpty(req[valLeft]) && string.IsNullOrEmpty(req[valRight]) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(req[valLeft])))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(string.IsNullOrEmpty(req[valLeft]) && !string.IsNullOrEmpty(req[valRight]) && int.Parse(checkObj) <= int.Parse(Function.CheckInt(req[valRight])))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
- else if(string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(valRight)))
|
|
|
+ else if(fieldQueryValueType.StartsWith("date"))
|
|
|
{
|
|
|
- passCount += 1; passFlag = true;
|
|
|
+ if(!string.IsNullOrEmpty(req[valLeft]) && !string.IsNullOrEmpty(req[valRight]) && DateTime.Parse(checkObj) >= DateTime.Parse(req[valLeft]) && DateTime.Parse(checkObj) <= DateTime.Parse(req[valRight]))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(!string.IsNullOrEmpty(req[valLeft]) && string.IsNullOrEmpty(req[valRight]) && DateTime.Parse(checkObj) >= DateTime.Parse(req[valLeft]))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(string.IsNullOrEmpty(req[valLeft]) && !string.IsNullOrEmpty(req[valRight]) && DateTime.Parse(checkObj) <= DateTime.Parse(req[valRight]))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- else if(fieldQueryValueType == "int")
|
|
|
+ else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(valLeft)) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(valRight)))
|
|
|
+ string checkValLeft = valLeft.Replace("#{", "").Replace("}#", "");
|
|
|
+ string checkValRight = valRight.Replace("#{", "").Replace("}#", "");
|
|
|
+ if(checkValLeft.Contains(",")) checkValLeft = checkValLeft.Split(',')[0];
|
|
|
+ if(checkValRight.Contains(",")) checkValRight = checkValRight.Split(',')[0];
|
|
|
+ valLeft = GetExpressionVal(valLeft);
|
|
|
+ valRight = GetExpressionVal(valRight);
|
|
|
+ if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- passCount += 1; passFlag = true;
|
|
|
+ if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(valLeft)) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(valRight)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(!string.IsNullOrEmpty(valLeft) && string.IsNullOrEmpty(valRight) && decimal.Parse(Function.CheckNum(checkObj.ToString())) >= decimal.Parse(Function.CheckNum(valLeft)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(valRight)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
- else if(!string.IsNullOrEmpty(valLeft) && string.IsNullOrEmpty(valRight) && int.Parse(Function.CheckInt(checkObj.ToString())) >= int.Parse(Function.CheckInt(valLeft)))
|
|
|
+ else if(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- passCount += 1; passFlag = true;
|
|
|
+ if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(valLeft)) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(valRight)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(!string.IsNullOrEmpty(valLeft) && string.IsNullOrEmpty(valRight) && int.Parse(Function.CheckInt(checkObj.ToString())) >= int.Parse(Function.CheckInt(valLeft)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(valRight)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
- else if(string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(valRight)))
|
|
|
+ else if(fieldQueryValueType.StartsWith("date"))
|
|
|
{
|
|
|
- passCount += 1; passFlag = true;
|
|
|
+ if(valLeft == "0") valLeft = "";
|
|
|
+ if(valRight == "0") valRight = "";
|
|
|
+ if(checkObj != "0" && checkObj != "")
|
|
|
+ {
|
|
|
+ if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj) >= DateTime.Parse(GetExpressionVal(valLeft)) && DateTime.Parse(checkObj) <= DateTime.Parse(GetExpressionVal(valRight)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(!string.IsNullOrEmpty(valLeft) && string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj) >= DateTime.Parse(GetExpressionVal(valLeft)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj) <= DateTime.Parse(GetExpressionVal(valRight)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- else if(fieldQueryValueType.StartsWith("date"))
|
|
|
- {
|
|
|
- if(valLeft == "0") valLeft = "";
|
|
|
- if(valRight == "0") valRight = "";
|
|
|
- if(checkObj != "0" && checkObj != "")
|
|
|
+ else if(fieldQueryModel == "query_field")
|
|
|
+ {
|
|
|
+ valLeft = GetComputeVal(queryCondiDic, valLeft);
|
|
|
+ valRight = GetComputeVal(queryCondiDic, valRight);
|
|
|
+ if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj) >= DateTime.Parse(GetExpressionVal(valLeft)) && DateTime.Parse(checkObj) <= DateTime.Parse(GetExpressionVal(valRight)))
|
|
|
+ if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(valLeft)) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(valRight)))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
- else if(!string.IsNullOrEmpty(valLeft) && string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj) >= DateTime.Parse(GetExpressionVal(valLeft)))
|
|
|
+ else if(!string.IsNullOrEmpty(valLeft) && string.IsNullOrEmpty(valRight) && decimal.Parse(Function.CheckNum(checkObj.ToString())) >= decimal.Parse(Function.CheckNum(valLeft)))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
- else if(string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj) <= DateTime.Parse(GetExpressionVal(valRight)))
|
|
|
+ else if(string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(valRight)))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- else if(fieldQueryModel == "query_field")
|
|
|
- {
|
|
|
- valLeft = GetComputeVal(queryCondiDic, valLeft);
|
|
|
- valRight = GetComputeVal(queryCondiDic, valRight);
|
|
|
- if(fieldQueryValueType == "number")
|
|
|
- {
|
|
|
- if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(valLeft)) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(valRight)))
|
|
|
+ else if(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- passCount += 1; passFlag = true;
|
|
|
+ if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(valLeft)) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(valRight)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(!string.IsNullOrEmpty(valLeft) && string.IsNullOrEmpty(valRight) && int.Parse(Function.CheckInt(checkObj.ToString())) >= int.Parse(Function.CheckInt(valLeft)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(valRight)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
- else if(!string.IsNullOrEmpty(valLeft) && string.IsNullOrEmpty(valRight) && decimal.Parse(Function.CheckNum(checkObj.ToString())) >= decimal.Parse(Function.CheckNum(valLeft)))
|
|
|
+ else if(fieldQueryValueType.StartsWith("date"))
|
|
|
{
|
|
|
- passCount += 1; passFlag = true;
|
|
|
+ if(valLeft == "0") valLeft = "";
|
|
|
+ if(valRight == "0") valRight = "";
|
|
|
+ if(checkObj != "0" && checkObj != "")
|
|
|
+ {
|
|
|
+ if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj) >= DateTime.Parse(GetExpressionVal(valLeft)) && DateTime.Parse(checkObj) <= DateTime.Parse(GetExpressionVal(valRight)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(!string.IsNullOrEmpty(valLeft) && string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj) >= DateTime.Parse(GetExpressionVal(valLeft)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj) <= DateTime.Parse(GetExpressionVal(valRight)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- else if(string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(valRight)))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(fieldQueryKind == "4") //取反匹配
|
|
|
+ {
|
|
|
+ if(fieldQueryValueType == "int")
|
|
|
+ {
|
|
|
+ if(int.Parse(checkObj) != int.Parse(Function.CheckInt(checkVal)))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
}
|
|
|
- else if(fieldQueryValueType == "int")
|
|
|
+ else if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(valLeft)) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(valRight)))
|
|
|
+ if(decimal.Parse(checkObj) != decimal.Parse(Function.CheckNum(checkVal)))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
- else if(!string.IsNullOrEmpty(valLeft) && string.IsNullOrEmpty(valRight) && int.Parse(Function.CheckInt(checkObj.ToString())) >= int.Parse(Function.CheckInt(valLeft)))
|
|
|
+ }
|
|
|
+ else if(fieldQueryValueType == "text")
|
|
|
+ {
|
|
|
+ if(checkObj.ToString() != GetExpressionVal(checkVal))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
- else if(string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(valRight)))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(fieldQueryKind == "5" || fieldQueryKind == "6") //数组匹配/排除
|
|
|
+ {
|
|
|
+ string val = ",";
|
|
|
+ string[] valList = checkVal.Split(',');
|
|
|
+ if(fieldQueryModel == "request_param")
|
|
|
+ {
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
+ foreach(string subVal in valList)
|
|
|
{
|
|
|
- passCount += 1; passFlag = true;
|
|
|
+ val += req[subVal] + ",";
|
|
|
}
|
|
|
}
|
|
|
- else if(fieldQueryValueType.StartsWith("date"))
|
|
|
+ else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
|
- if(valLeft == "0") valLeft = "";
|
|
|
- if(valRight == "0") valRight = "";
|
|
|
- if(checkObj != "0" && checkObj != "")
|
|
|
+ foreach(string subVal in valList)
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj) >= DateTime.Parse(GetExpressionVal(valLeft)) && DateTime.Parse(checkObj) <= DateTime.Parse(GetExpressionVal(valRight)))
|
|
|
- {
|
|
|
- passCount += 1; passFlag = true;
|
|
|
- }
|
|
|
- else if(!string.IsNullOrEmpty(valLeft) && string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj) >= DateTime.Parse(GetExpressionVal(valLeft)))
|
|
|
- {
|
|
|
- passCount += 1; passFlag = true;
|
|
|
- }
|
|
|
- else if(string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj) <= DateTime.Parse(GetExpressionVal(valRight)))
|
|
|
- {
|
|
|
- passCount += 1; passFlag = true;
|
|
|
- }
|
|
|
+ val += GetExpressionVal(subVal) + ",";
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- else if(fieldQueryKind == "4") //取反匹配
|
|
|
- {
|
|
|
- if(fieldQueryValueType == "int")
|
|
|
- {
|
|
|
- if(int.Parse(checkObj) != int.Parse(Function.CheckInt(checkVal)))
|
|
|
+ else if(fieldQueryModel == "db_field")
|
|
|
{
|
|
|
- passCount += 1; passFlag = true;
|
|
|
+ foreach(string subVal in valList)
|
|
|
+ {
|
|
|
+ val += GetDbExpressionVal(subVal) + ",";
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- else if(fieldQueryValueType == "number")
|
|
|
- {
|
|
|
- if(decimal.Parse(checkObj) != decimal.Parse(Function.CheckNum(checkVal)))
|
|
|
+ if(fieldQueryKind == "5" && val.Contains("," + checkObj.ToString() + ","))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
- }
|
|
|
- else if(fieldQueryValueType == "text")
|
|
|
- {
|
|
|
- if(checkObj.ToString() != GetExpressionVal(checkVal))
|
|
|
+ if(fieldQueryKind == "6" && !val.Contains("," + checkObj.ToString() + ","))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
}
|
|
|
+ logStepDic.Add("状态", passFlag ? "通过" : "未通过");
|
|
|
+ loopLog.Add("匹配情况", logStepDic);
|
|
|
}
|
|
|
- else if(fieldQueryKind == "5" || fieldQueryKind == "6") //数组匹配/排除
|
|
|
- {
|
|
|
- string val = ",";
|
|
|
- string[] valList = checkVal.Split(',');
|
|
|
- if(fieldQueryModel == "request_param")
|
|
|
- {
|
|
|
- Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
- foreach(string subVal in valList)
|
|
|
- {
|
|
|
- val += req[subVal] + ",";
|
|
|
- }
|
|
|
- }
|
|
|
- else if(fieldQueryModel == "fixed_value")
|
|
|
- {
|
|
|
- foreach(string subVal in valList)
|
|
|
- {
|
|
|
- val += GetExpressionVal(subVal) + ",";
|
|
|
- }
|
|
|
- }
|
|
|
- else if(fieldQueryModel == "db_field")
|
|
|
- {
|
|
|
- foreach(string subVal in valList)
|
|
|
- {
|
|
|
- val += GetDbExpressionVal(subVal) + ",";
|
|
|
- }
|
|
|
- }
|
|
|
- if(fieldQueryKind == "5" && val.Contains("," + checkObj.ToString() + ","))
|
|
|
- {
|
|
|
- passCount += 1; passFlag = true;
|
|
|
- }
|
|
|
- if(fieldQueryKind == "6" && !val.Contains("," + checkObj.ToString() + ","))
|
|
|
- {
|
|
|
- passCount += 1; passFlag = true;
|
|
|
- }
|
|
|
- }
|
|
|
- logStepDic.Add("状态", passFlag ? "通过" : "未通过");
|
|
|
- setLogStep(sub.id, logStepDic);
|
|
|
}
|
|
|
+ if(loopSet.conditionMode == "all" && passCount == allCount) prizeFlag = true;
|
|
|
+ else if(loopSet.conditionMode == "one" && passCount >= 1) prizeFlag = true;
|
|
|
+ else if(loopSet.conditionMode == "two" && passCount >= 2) prizeFlag = true;
|
|
|
+ else if(loopSet.conditionMode == "three" && passCount >= 3) prizeFlag = true;
|
|
|
+ else prizeFlag = false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ prizeFlag = false;
|
|
|
+ }
|
|
|
+ loopLog.Add("匹配结果", prizeFlag);
|
|
|
+ if(prizeFlag)
|
|
|
+ {
|
|
|
+ decimal prizeAmt = prizeSendDo(projectId, sub, objId, content, loopSet);
|
|
|
+ op = afterPrizeFlag;
|
|
|
}
|
|
|
- if(loopSet.conditionMode == "all" && passCount == allCount) prizeFlag = true;
|
|
|
- else if(loopSet.conditionMode == "one" && passCount >= 1) prizeFlag = true;
|
|
|
- else if(loopSet.conditionMode == "two" && passCount >= 2) prizeFlag = true;
|
|
|
- else if(loopSet.conditionMode == "three" && passCount >= 3) prizeFlag = true;
|
|
|
- else prizeFlag = false;
|
|
|
}
|
|
|
- else
|
|
|
+ loopLogDic.Add(loopLog);
|
|
|
+ var parent = db.Ado.GetScalar("select " + parentField + " from " + tableEnName + " where " + sonField + "=" + objId);
|
|
|
+ if(parent != null)
|
|
|
{
|
|
|
- prizeFlag = false;
|
|
|
+ objId = parent.ToString();
|
|
|
}
|
|
|
- if(prizeFlag)
|
|
|
+ else
|
|
|
{
|
|
|
- decimal prizeAmt = prizeSendDo(projectId, sub, objId, content, loopSet);
|
|
|
- op = afterPrizeFlag;
|
|
|
+ objId = "0";
|
|
|
}
|
|
|
+ index += 1;
|
|
|
}
|
|
|
- var parent = db.Ado.GetScalar("select " + parentField + " from " + tableEnName + " where " + sonField + "=" + objId);
|
|
|
- if(parent != null)
|
|
|
- {
|
|
|
- objId = parent.ToString();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- objId = "0";
|
|
|
- }
|
|
|
- index += 1;
|
|
|
+ setLogStep(sub.id, "向上递归流程", loopLogDic);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ prizeSendDo(projectId, sub, prizeObjectId, content, new PriLoopSet());
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
+ catch(Exception ex)
|
|
|
{
|
|
|
- prizeSendDo(projectId, sub, prizeObjectId, content, new PriLoopSet());
|
|
|
+ setLogFieldValue(sub.id, "errLog", ex.ToString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -952,14 +993,18 @@ namespace Util
|
|
|
static decimal loopAmount = 0;
|
|
|
public static decimal prizeSendDo(int projectId, PriList sub, string prizeObjectId, string content, PriLoopSet set)
|
|
|
{
|
|
|
+ var projectService = App.GetService<IPriProjectService>();
|
|
|
var recordService = App.GetService<IPriRecordService>();
|
|
|
var conditionService = App.GetService<IPriConditionService>();
|
|
|
var returnFieldService = App.GetService<IPriReturnFieldService>();
|
|
|
var queryTableService = App.GetService<IPriQueryTableService>();
|
|
|
var amountSetService = App.GetService<IPriListAmountSetService>();
|
|
|
+
|
|
|
+ var project = projectService.GetFirst(m => m.id == projectId) ?? new PriProject();
|
|
|
//查询匹配条件
|
|
|
- List<QueryCondition> condiDic = condiDic = condition(projectId, Tools.SpitIntArrary(sub.queryTableIdList, ',').ToList(), content);
|
|
|
+ List<QueryCondition> condiDic = condition(sub.id, projectId, Tools.SpitIntArrary(sub.queryTableIdList, ',').ToList(), content);
|
|
|
if(sub.prizeSourceFieldType == "loop") MergeCondiDic(condiDic, loopCondition(projectId, sub, prizeObjectId, content));
|
|
|
+ setLogStep(sub.id, "发放奖励查询来源数据", condiDic);
|
|
|
|
|
|
var prizeSourceField = sub.prizeSourceField; //奖励金额来源字段(对应条件匹配返回字段)
|
|
|
var prizePercent = sub.prizePercent; //奖励比例
|
|
@@ -969,11 +1014,13 @@ namespace Util
|
|
|
var recursionFlag = sub.recursionFlag; //是否递归
|
|
|
|
|
|
var conditions = conditionService.GetList(m => m.listId == sub.id);
|
|
|
+ setLogStep(sub.id, "发放奖励匹配条件", condiDic);
|
|
|
int allCount = conditions.Count; //所有奖励条件数
|
|
|
int passCount = 0; //通过条件数
|
|
|
+ List<Dictionary<string, object>> logStepDics = new();
|
|
|
foreach(var condition in conditions)
|
|
|
{
|
|
|
- Dictionary<string, string> logStepDic = new();
|
|
|
+ Dictionary<string, object> logStepDic = new();
|
|
|
var returnFieldId = condition.returnFieldId; //条件返回字段
|
|
|
var fieldQueryKind = condition.fieldQueryKind; //匹配条件
|
|
|
var fieldQueryModel = condition.fieldQueryModel; //匹配方式
|
|
@@ -1294,15 +1341,17 @@ namespace Util
|
|
|
if(!sub.recursionFlag)
|
|
|
{
|
|
|
logStepDic.Add("状态", passFlag ? "通过" : "未通过");
|
|
|
- setLogStep(sub.id, logStepDic);
|
|
|
+ logStepDics.Add(logStepDic);
|
|
|
}
|
|
|
}
|
|
|
+ setLogStep(sub.id, "匹配结果", logStepDics);
|
|
|
bool op = false;
|
|
|
decimal prizeAmt = 0;
|
|
|
if(conditionMode == "all" && passCount == allCount && passCount > 0) op = true;
|
|
|
else if(conditionMode == "one" && passCount >= 1) op = true;
|
|
|
else if(conditionMode == "two" && passCount >= 2) op = true;
|
|
|
else if(conditionMode == "three" && passCount >= 3) op = true;
|
|
|
+ setLogStep(sub.id, "是否通过", op ? "是" : "否");
|
|
|
if(op) //满足条件
|
|
|
{
|
|
|
decimal number = 0;
|
|
@@ -1353,6 +1402,7 @@ namespace Util
|
|
|
if(prizeAmount > 0) prizeAmt += prizeAmount;
|
|
|
decimal getPrizeAmount = prizeAmt;
|
|
|
if(set.levelDiffFlag) prizeAmt -= loopAmount;
|
|
|
+ setLogStep(sub.id, "发放金额", prizeAmt);
|
|
|
if(prizeAmt > 0)
|
|
|
{
|
|
|
setLogPrizeAmount(sub.id, prizeAmt);
|
|
@@ -1361,7 +1411,7 @@ namespace Util
|
|
|
var sendFlag = recordService.Any(m => m.prizeObjId == prizeObjectId && m.listId == sub.id && m.requestParamField == requestParamField);
|
|
|
if(!sendFlag)
|
|
|
{
|
|
|
- recordService.Add(new PriRecord()
|
|
|
+ PriRecord item = new PriRecord()
|
|
|
{
|
|
|
createDate = DateTime.Now,
|
|
|
projectId = projectId,
|
|
@@ -1370,7 +1420,10 @@ namespace Util
|
|
|
prizeObjId = prizeObjectId,
|
|
|
requestParamField = requestParamField,
|
|
|
batchNo = batchNo,
|
|
|
- });
|
|
|
+ };
|
|
|
+ recordService.Add(item);
|
|
|
+ setLogFieldValue(sub.id, "prizeOutContent", Newtonsoft.Json.JsonConvert.SerializeObject(item));
|
|
|
+ setLogFieldValue(sub.id, "prizeOutUrl", project.noticeUrl);
|
|
|
loopAmount = getPrizeAmount;
|
|
|
prizeToDatabase(projectId, sub.id, content, condiDic, prizeAmt); //入库
|
|
|
}
|
|
@@ -1911,7 +1964,7 @@ namespace Util
|
|
|
}
|
|
|
|
|
|
//记录日志
|
|
|
- public static void addLog(int projectId, int listId, int prizeIn, string requestParam)
|
|
|
+ public static void addLog(int projectId, int listId, int prizeIn, string requestParam, string prizeInUrl)
|
|
|
{
|
|
|
var logService = App.GetService<IPriLogService>();
|
|
|
logService.Add(new PriLog()
|
|
@@ -1922,6 +1975,7 @@ namespace Util
|
|
|
batchNo = batchNo,
|
|
|
prizeIn = prizeIn,
|
|
|
requestParam = requestParam,
|
|
|
+ prizeInUrl = prizeInUrl,
|
|
|
});
|
|
|
}
|
|
|
public static void setLogPrizeAmount(int listId, decimal prizeAmount)
|
|
@@ -1934,13 +1988,25 @@ namespace Util
|
|
|
logService.Update(log);
|
|
|
}
|
|
|
}
|
|
|
- public static void setLogStep(int listId, Dictionary<string, string> step)
|
|
|
+ public static void setLogStep(int listId, Dictionary<string, object> step)
|
|
|
+ {
|
|
|
+ var logService = App.GetService<IPriLogService>();
|
|
|
+ var log = logService.GetFirst(m => m.batchNo == batchNo && m.listId == listId);
|
|
|
+ if(log != null)
|
|
|
+ {
|
|
|
+ log.stepList += Newtonsoft.Json.JsonConvert.SerializeObject(step) + ",";
|
|
|
+ logService.Update(log);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public static void setLogStep(int listId, string key, object val)
|
|
|
{
|
|
|
var logService = App.GetService<IPriLogService>();
|
|
|
var log = logService.GetFirst(m => m.batchNo == batchNo && m.listId == listId);
|
|
|
if(log != null)
|
|
|
{
|
|
|
- log.stepList += Newtonsoft.Json.JsonConvert.SerializeObject(step);
|
|
|
+ Dictionary<string, object> step = new();
|
|
|
+ step.Add(key, val);
|
|
|
+ log.stepList += Newtonsoft.Json.JsonConvert.SerializeObject(step) + ",";
|
|
|
logService.Update(log);
|
|
|
}
|
|
|
}
|
|
@@ -1954,5 +2020,18 @@ namespace Util
|
|
|
logService.Update(log);
|
|
|
}
|
|
|
}
|
|
|
+ public static void setLogFieldValue(int listId, string field, string content)
|
|
|
+ {
|
|
|
+ var logService = App.GetService<IPriLogService>();
|
|
|
+ var log = logService.GetFirst(m => m.batchNo == batchNo && m.listId == listId);
|
|
|
+ if(log != null)
|
|
|
+ {
|
|
|
+ if(field == "errLog") log.errLog = content;
|
|
|
+ if(field == "prizeOutContent") log.prizeOutContent = content;
|
|
|
+ if(field == "prizeOutUrl") log.prizeOutUrl = content;
|
|
|
+ if(field == "stepListIndex") log.stepListIndex = content;
|
|
|
+ logService.Update(log);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|