|
@@ -25,8 +25,7 @@ namespace Util
|
|
|
string[] priObjData = priObjString.Split('|');
|
|
|
string priListIds = priObjData[0];
|
|
|
int projectId = int.Parse(priObjData[1]);
|
|
|
- addLog(projectId, prizeInId, content); //初始化日志
|
|
|
- prizeSend(projectId, priListIds, content);
|
|
|
+ prizeSend(projectId, prizeInId, priListIds, content);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -555,7 +554,7 @@ namespace Util
|
|
|
}
|
|
|
|
|
|
//奖励发放
|
|
|
- public static void prizeSend(int projectId, string prizeIds, string content)
|
|
|
+ public static void prizeSend(int projectId, int prizeInId, string prizeIds, string content)
|
|
|
{
|
|
|
var loopSetService = App.GetService<IPriLoopSetService>();
|
|
|
var recursionStartTableService = App.GetService<IPriRecursionStartTableService>();
|
|
@@ -563,10 +562,12 @@ 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)
|
|
|
{
|
|
|
+ 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; //递归查询表
|
|
@@ -589,6 +590,7 @@ namespace Util
|
|
|
var conditions = recursionStartConditionService.GetList(m => m.loopSetId == loopSet.id);
|
|
|
if(conditions.Count > 0)
|
|
|
{
|
|
|
+ MergeCondiDic(condiDic, queryCondiDic);
|
|
|
int allCount = conditions.Count; //所有奖励条件数
|
|
|
int passCount = 0; //通过条件数
|
|
|
foreach(var condition in conditions)
|
|
@@ -651,71 +653,85 @@ namespace Util
|
|
|
{
|
|
|
if(fieldQueryValueType == "text")
|
|
|
{
|
|
|
- if(checkObj.ToString().Contains(GetExpressionVal(checkVal))) passCount += 1; passFlag = true;
|
|
|
+ if(checkObj.ToString().Contains(GetExpressionVal(checkVal)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else if(fieldQueryKind == "2") //精确匹配
|
|
|
{
|
|
|
if(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- if(int.Parse(Function.CheckInt(checkObj.ToString())) == int.Parse(Function.CheckNum(checkVal))) passCount += 1; passFlag = true;
|
|
|
+ if(int.Parse(Function.CheckInt(checkObj.ToString())) == int.Parse(Function.CheckNum(checkVal)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
else if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- if(decimal.Parse(Function.CheckNum(checkObj.ToString())) == decimal.Parse(Function.CheckNum(checkVal))) passCount += 1; passFlag = true;
|
|
|
+ if(decimal.Parse(Function.CheckNum(checkObj.ToString())) == decimal.Parse(Function.CheckNum(checkVal)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if(checkObj.ToString() == GetExpressionVal(checkVal)) passCount += 1; passFlag = true;
|
|
|
+ if(checkObj.ToString() == GetExpressionVal(checkVal))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else if(fieldQueryKind == "3") //范围匹配
|
|
|
{
|
|
|
string[] val = checkVal.Split(':');
|
|
|
+ string valLeft = val[0];
|
|
|
+ string valRight = val[1];
|
|
|
if(fieldQueryModel == "request_param")
|
|
|
{
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(req[val[0]])) && decimal.Parse(checkObj) <= decimal.Parse(Function.CheckNum(req[val[1]])))
|
|
|
+ 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[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(req[val[0]])))
|
|
|
+ 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[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && decimal.Parse(checkObj) <= decimal.Parse(Function.CheckNum(req[val[1]])))
|
|
|
+ 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(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(req[val[0]])) && int.Parse(checkObj) <= int.Parse(Function.CheckInt(req[val[1]])))
|
|
|
+ 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[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(req[val[0]])))
|
|
|
+ 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[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && int.Parse(checkObj) <= int.Parse(Function.CheckInt(req[val[1]])))
|
|
|
+ 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(fieldQueryValueType.StartsWith("date"))
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) >= DateTime.Parse(req[val[0]]) && DateTime.Parse(checkObj) <= DateTime.Parse(req[val[1]]))
|
|
|
+ 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[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) >= DateTime.Parse(req[val[0]]))
|
|
|
+ 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[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) <= DateTime.Parse(req[val[1]]))
|
|
|
+ else if(string.IsNullOrEmpty(req[valLeft]) && !string.IsNullOrEmpty(req[valRight]) && DateTime.Parse(checkObj) <= DateTime.Parse(req[valRight]))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
@@ -723,66 +739,141 @@ namespace Util
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
|
+ 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")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(val[0])) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(val[1])))
|
|
|
+ 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(val[0]) && string.IsNullOrEmpty(val[1]) && decimal.Parse(Function.CheckNum(checkObj.ToString())) >= decimal.Parse(Function.CheckNum(val[0])))
|
|
|
+ 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(val[0]) && !string.IsNullOrEmpty(val[1]) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(val[1])))
|
|
|
+ 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(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(val[0])) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(val[1])))
|
|
|
+ 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(val[0]) && string.IsNullOrEmpty(val[1]) && int.Parse(Function.CheckInt(checkObj.ToString())) >= int.Parse(Function.CheckInt(val[0])))
|
|
|
+ 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(val[0]) && !string.IsNullOrEmpty(val[1]) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(val[1])))
|
|
|
+ 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(fieldQueryValueType.StartsWith("date"))
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj) >= DateTime.Parse(GetExpressionVal(val[0])) && DateTime.Parse(checkObj) <= DateTime.Parse(GetExpressionVal(val[1])))
|
|
|
+ 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(fieldQueryModel == "query_field")
|
|
|
+ {
|
|
|
+ valLeft = GetComputeVal(condiDic, valLeft);
|
|
|
+ valRight = GetComputeVal(condiDic, 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)))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
- else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj) >= DateTime.Parse(GetExpressionVal(val[0])))
|
|
|
+ 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(val[0]) && !string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj) <= DateTime.Parse(GetExpressionVal(val[1])))
|
|
|
+ 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(fieldQueryValueType == "int")
|
|
|
+ {
|
|
|
+ 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(fieldQueryValueType.StartsWith("date"))
|
|
|
+ {
|
|
|
+ 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(fieldQueryKind == "4") //取反匹配
|
|
|
{
|
|
|
if(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- if(int.Parse(checkObj) != int.Parse(Function.CheckInt(checkVal))) passCount += 1; passFlag = true;
|
|
|
+ if(int.Parse(checkObj) != int.Parse(Function.CheckInt(checkVal)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
else if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- if(decimal.Parse(checkObj) != decimal.Parse(Function.CheckNum(checkVal))) passCount += 1; passFlag = true;
|
|
|
+ if(decimal.Parse(checkObj) != decimal.Parse(Function.CheckNum(checkVal)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
else if(fieldQueryValueType == "text")
|
|
|
{
|
|
|
- if(checkObj.ToString() != GetExpressionVal(checkVal)) passCount += 1; passFlag = true;
|
|
|
+ if(checkObj.ToString() != GetExpressionVal(checkVal))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else if(fieldQueryKind == "5" || fieldQueryKind == "6") //数组匹配/排除
|
|
@@ -811,8 +902,14 @@ namespace Util
|
|
|
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;
|
|
|
+ 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 ? "通过" : "未通过");
|
|
|
logStepDics.Add(logStepDic);
|
|
@@ -820,6 +917,8 @@ namespace Util
|
|
|
}
|
|
|
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
|
|
@@ -840,7 +939,7 @@ namespace Util
|
|
|
}
|
|
|
index += 1;
|
|
|
}
|
|
|
- setLogStep(Newtonsoft.Json.JsonConvert.SerializeObject(topStepDic));
|
|
|
+ setLogStep(sub.id, Newtonsoft.Json.JsonConvert.SerializeObject(topStepDic));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -858,9 +957,8 @@ namespace Util
|
|
|
var queryTableService = App.GetService<IPriQueryTableService>();
|
|
|
var amountSetService = App.GetService<IPriListAmountSetService>();
|
|
|
//查询匹配条件
|
|
|
- List<QueryCondition> condiDic = new List<QueryCondition>();
|
|
|
- if(sub.prizeSourceFieldType == "condi") condiDic = condition(projectId, Tools.SpitIntArrary(sub.queryTableIdList, ',').ToList(), content);
|
|
|
- if(sub.prizeSourceFieldType == "loop") condiDic = loopCondition(projectId, sub, prizeObjectId, content);
|
|
|
+ List<QueryCondition> condiDic = condiDic = condition(projectId, Tools.SpitIntArrary(sub.queryTableIdList, ',').ToList(), content);
|
|
|
+ if(sub.prizeSourceFieldType == "loop") MergeCondiDic(condiDic, loopCondition(projectId, sub, prizeObjectId, content));
|
|
|
|
|
|
var prizeSourceField = sub.prizeSourceField; //奖励金额来源字段(对应条件匹配返回字段)
|
|
|
var prizePercent = sub.prizePercent; //奖励比例
|
|
@@ -932,71 +1030,85 @@ namespace Util
|
|
|
{
|
|
|
if(fieldQueryValueType == "text")
|
|
|
{
|
|
|
- if(checkObj.ToString().Contains(GetExpressionVal(checkVal))) passCount += 1; passFlag = true;
|
|
|
+ if(checkObj.ToString().Contains(GetExpressionVal(checkVal)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else if(fieldQueryKind == "2") //精确匹配
|
|
|
{
|
|
|
if(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- if(int.Parse(Function.CheckInt(checkObj.ToString())) == int.Parse(Function.CheckNum(checkVal))) passCount += 1; passFlag = true;
|
|
|
+ if(int.Parse(Function.CheckInt(checkObj.ToString())) == int.Parse(Function.CheckNum(checkVal)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
else if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- if(decimal.Parse(Function.CheckNum(checkObj.ToString())) == decimal.Parse(Function.CheckNum(checkVal))) passCount += 1; passFlag = true;
|
|
|
+ if(decimal.Parse(Function.CheckNum(checkObj.ToString())) == decimal.Parse(Function.CheckNum(checkVal)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if(checkObj.ToString() == GetExpressionVal(checkVal)) passCount += 1; passFlag = true;
|
|
|
+ if(checkObj.ToString() == GetExpressionVal(checkVal))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else if(fieldQueryKind == "3") //范围匹配
|
|
|
{
|
|
|
string[] val = checkVal.Split(':');
|
|
|
+ string valLeft = val[0];
|
|
|
+ string valRight = val[1];
|
|
|
if(fieldQueryModel == "request_param")
|
|
|
{
|
|
|
Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(req[val[0]])) && decimal.Parse(checkObj) <= decimal.Parse(Function.CheckNum(req[val[1]])))
|
|
|
+ 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[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(req[val[0]])))
|
|
|
+ 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[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && decimal.Parse(checkObj) <= decimal.Parse(Function.CheckNum(req[val[1]])))
|
|
|
+ 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(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(req[val[0]])) && int.Parse(checkObj) <= int.Parse(Function.CheckInt(req[val[1]])))
|
|
|
+ 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[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(req[val[0]])))
|
|
|
+ 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[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && int.Parse(checkObj) <= int.Parse(Function.CheckInt(req[val[1]])))
|
|
|
+ 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(fieldQueryValueType.StartsWith("date"))
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) >= DateTime.Parse(req[val[0]]) && DateTime.Parse(checkObj) <= DateTime.Parse(req[val[1]]))
|
|
|
+ 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[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) >= DateTime.Parse(req[val[0]]))
|
|
|
+ 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[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) <= DateTime.Parse(req[val[1]]))
|
|
|
+ else if(string.IsNullOrEmpty(req[valLeft]) && !string.IsNullOrEmpty(req[valRight]) && DateTime.Parse(checkObj) <= DateTime.Parse(req[valRight]))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
@@ -1004,50 +1116,118 @@ namespace Util
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
|
+ valLeft = GetExpressionVal(valLeft);
|
|
|
+ valRight = GetExpressionVal(valRight);
|
|
|
if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && decimal.Parse(Function.CheckNum(checkObj.ToString())) >= decimal.Parse(Function.CheckNum(val[0])) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(val[1])))
|
|
|
+ if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && decimal.Parse(Function.CheckNum(checkObj.ToString())) >= decimal.Parse(Function.CheckNum(valLeft)) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(valRight)))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
- else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && decimal.Parse(Function.CheckNum(checkObj.ToString())) >= decimal.Parse(Function.CheckNum(val[0])))
|
|
|
+ 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(val[0]) && !string.IsNullOrEmpty(val[1]) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(val[1])))
|
|
|
+ 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(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && int.Parse(Function.CheckNum(checkObj.ToString())) >= int.Parse(Function.CheckInt(val[0])) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(val[1])))
|
|
|
+ if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && int.Parse(Function.CheckNum(checkObj.ToString())) >= int.Parse(Function.CheckInt(valLeft)) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(valRight)))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
- else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && int.Parse(Function.CheckInt(checkObj.ToString())) >= int.Parse(Function.CheckInt(val[0])))
|
|
|
+ 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(val[0]) && !string.IsNullOrEmpty(val[1]) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(val[1])))
|
|
|
+ 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(fieldQueryValueType.StartsWith("date"))
|
|
|
{
|
|
|
- if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj.ToString()) >= DateTime.Parse(GetExpressionVal(val[0])) && DateTime.Parse(checkObj.ToString()) <= DateTime.Parse(GetExpressionVal(val[1])))
|
|
|
+ if(valLeft == "0") valLeft = "";
|
|
|
+ if(valRight == "0") valRight = "";
|
|
|
+ if(checkObj != "0" && checkObj != "")
|
|
|
+ {
|
|
|
+ if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj.ToString()) >= DateTime.Parse(GetExpressionVal(valLeft)) && DateTime.Parse(checkObj.ToString()) <= DateTime.Parse(GetExpressionVal(valRight)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(!string.IsNullOrEmpty(valLeft) && string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj.ToString()) >= DateTime.Parse(GetExpressionVal(valLeft)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj.ToString()) <= DateTime.Parse(GetExpressionVal(valRight)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(fieldQueryModel == "query_field")
|
|
|
+ {
|
|
|
+ string checkValLeft = valLeft.Replace("#{", "").Replace("}#", "");
|
|
|
+ string checkValRight = valRight.Replace("#{", "").Replace("}#", "");
|
|
|
+ if(checkValLeft.Contains(",")) checkValLeft = checkValLeft.Split(',')[0];
|
|
|
+ if(checkValRight.Contains(",")) checkValRight = checkValRight.Split(',')[0];
|
|
|
+ if(!string.IsNullOrEmpty(valLeft)) valLeft = valLeft.Replace(checkValLeft, GetQueryTableData(condiDic, checkValLeft));
|
|
|
+ if(!string.IsNullOrEmpty(valRight)) valRight = valRight.Replace(checkValRight, GetQueryTableData(condiDic, checkValRight));
|
|
|
+ valLeft = GetExpressionVal(valLeft);
|
|
|
+ valRight = GetExpressionVal(valRight);
|
|
|
+ if(fieldQueryValueType == "number")
|
|
|
+ {
|
|
|
+ if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && decimal.Parse(Function.CheckNum(checkObj.ToString())) >= decimal.Parse(Function.CheckNum(valLeft)) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(valRight)))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
- else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj.ToString()) >= DateTime.Parse(GetExpressionVal(val[0])))
|
|
|
+ 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(fieldQueryValueType == "int")
|
|
|
+ {
|
|
|
+ if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && int.Parse(Function.CheckNum(checkObj.ToString())) >= int.Parse(Function.CheckInt(valLeft)) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(valRight)))
|
|
|
{
|
|
|
passCount += 1; passFlag = true;
|
|
|
}
|
|
|
- else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj.ToString()) <= DateTime.Parse(GetExpressionVal(val[1])))
|
|
|
+ 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(fieldQueryValueType.StartsWith("date"))
|
|
|
+ {
|
|
|
+ if(valLeft == "0") valLeft = "";
|
|
|
+ if(valRight == "0") valRight = "";
|
|
|
+ if(checkObj != "0" && checkObj != "")
|
|
|
+ {
|
|
|
+ if(!string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj.ToString()) >= DateTime.Parse(GetExpressionVal(valLeft)) && DateTime.Parse(checkObj.ToString()) <= DateTime.Parse(GetExpressionVal(valRight)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(!string.IsNullOrEmpty(valLeft) && string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj.ToString()) >= DateTime.Parse(GetExpressionVal(valLeft)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(string.IsNullOrEmpty(valLeft) && !string.IsNullOrEmpty(valRight) && DateTime.Parse(checkObj.ToString()) <= DateTime.Parse(GetExpressionVal(valRight)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1055,15 +1235,24 @@ namespace Util
|
|
|
{
|
|
|
if(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- if(int.Parse(Function.CheckNum(checkObj.ToString())) != int.Parse(Function.CheckInt(checkVal))) passCount += 1; passFlag = true;
|
|
|
+ if(int.Parse(Function.CheckNum(checkObj.ToString())) != int.Parse(Function.CheckInt(checkVal)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
else if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
- if(decimal.Parse(Function.CheckNum(checkObj.ToString())) != decimal.Parse(Function.CheckNum(checkVal))) passCount += 1; passFlag = true;
|
|
|
+ if(decimal.Parse(Function.CheckNum(checkObj.ToString())) != decimal.Parse(Function.CheckNum(checkVal)))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
else if(fieldQueryValueType == "text")
|
|
|
{
|
|
|
- if(checkObj.ToString() != GetExpressionVal(checkVal)) passCount += 1; passFlag = true;
|
|
|
+ if(checkObj.ToString() != GetExpressionVal(checkVal))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else if(fieldQueryKind == "5" || fieldQueryKind == "6") //数组匹配/排除
|
|
@@ -1092,8 +1281,14 @@ namespace Util
|
|
|
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;
|
|
|
+ if (fieldQueryKind == "5" && val.Contains("," + checkObj.ToString() + ","))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ if(fieldQueryKind == "6" && !val.Contains("," + checkObj.ToString() + ","))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if(!sub.recursionFlag)
|
|
@@ -1106,6 +1301,8 @@ namespace Util
|
|
|
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;
|
|
|
if(op) //满足条件
|
|
|
{
|
|
|
decimal number = 0;
|
|
@@ -1158,7 +1355,7 @@ namespace Util
|
|
|
if(set.levelDiffFlag) prizeAmt -= loopAmount;
|
|
|
if(prizeAmt > 0)
|
|
|
{
|
|
|
- setLogPrizeAmount(prizeAmt);
|
|
|
+ setLogPrizeAmount(sub.id, prizeAmt);
|
|
|
var req = getRequestParams(projectId, content);
|
|
|
var requestParamField = req[sub.requestParamField];
|
|
|
var sendFlag = recordService.Any(m => m.prizeObjId == prizeObjectId && m.listId == sub.id && m.requestParamField == requestParamField);
|
|
@@ -1175,15 +1372,15 @@ namespace Util
|
|
|
batchNo = batchNo,
|
|
|
});
|
|
|
loopAmount = getPrizeAmount;
|
|
|
- // prizeToDatabase(projectId, sub.id, content); //入库
|
|
|
+ prizeToDatabase(projectId, sub.id, content, condiDic, prizeAmt); //入库
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(!sub.recursionFlag)
|
|
|
{
|
|
|
- setLogStatus(op ? 1 : 0);
|
|
|
- setLogStep(Newtonsoft.Json.JsonConvert.SerializeObject(logStepDics));
|
|
|
+ setLogStatus(sub.id, op ? 1 : 0);
|
|
|
+ setLogStep(sub.id, Newtonsoft.Json.JsonConvert.SerializeObject(logStepDics));
|
|
|
}
|
|
|
return prizeAmt;
|
|
|
}
|
|
@@ -1424,7 +1621,7 @@ namespace Util
|
|
|
}
|
|
|
|
|
|
//奖励入库
|
|
|
- public static void prizeToDatabase(int projectId, int listId, string content)
|
|
|
+ public static void prizeToDatabase(int projectId, int listId, string content, List<QueryCondition> condiDic, decimal prize_amt)
|
|
|
{
|
|
|
var prizeInTableService = App.GetService<IPriPrizeInTableService>();
|
|
|
var prizeInFieldService = App.GetService<IPriPrizeInFieldService>();
|
|
@@ -1451,7 +1648,7 @@ namespace Util
|
|
|
}
|
|
|
else if(fieldQueryModel == "query_field")
|
|
|
{
|
|
|
-
|
|
|
+ fieldQueryValue = GetQueryTableData(condiDic, fieldQueryValue);
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
@@ -1461,6 +1658,10 @@ namespace Util
|
|
|
{
|
|
|
fieldQueryValue = GetDbExpressionVal(fieldQueryValue);
|
|
|
}
|
|
|
+ else if(fieldQueryModel == "prize_amt")
|
|
|
+ {
|
|
|
+ fieldQueryValue = prize_amt.ToString();
|
|
|
+ }
|
|
|
if(fieldQueryValueType == "text") doFields.Add(fieldEnName, fieldQueryValue);
|
|
|
if(fieldQueryValueType == "int") doFields.Add(fieldEnName, int.Parse(fieldQueryValue));
|
|
|
if(fieldQueryValueType == "number") doFields.Add(fieldEnName, decimal.Parse(fieldQueryValue));
|
|
@@ -1618,7 +1819,7 @@ namespace Util
|
|
|
// if(prizeInTable.excuteKind == "add") db.Insertable(doFields).AS(prizeInTable.tableEnName).ExecuteCommand();
|
|
|
// if(prizeInTable.excuteKind == "update") db.Updateable(doFields).AS(prizeInTable.tableEnName).Where("1=1" + condi).ExecuteCommand();
|
|
|
|
|
|
- Function.WriteLog(DateTime.Now.ToString() + "\n" + prizeInTable.excuteKind + "\n" + prizeInTable.tableEnName + "\n" + Newtonsoft.Json.JsonConvert.SerializeObject(doFields) + "\n\n", "奖励入库数据");
|
|
|
+ Function.WriteLog(DateTime.Now.ToString() + "\n" + prizeInTable.excuteKind + "\n" + prizeInTable.tableEnName + "\n" + Newtonsoft.Json.JsonConvert.SerializeObject(doFields) + "\n" + condi + "\n\n", "奖励入库数据");
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1626,15 +1827,17 @@ namespace Util
|
|
|
//固定值表达式
|
|
|
public static string GetExpressionVal(string str)
|
|
|
{
|
|
|
- if(str == "#{now}#") str = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
- if(str == "#{today}#") str = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
- if(str == "#{this_month}#") str = DateTime.Now.ToString("yyyy-MM");
|
|
|
- if(str.StartsWith("#{now") && str.EndsWith("DAY}#")) str = DateTime.Now.AddDays(int.Parse(str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[1])).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
- if(str.StartsWith("#{now") && str.EndsWith("MONTH}#")) str = DateTime.Now.AddMonths(int.Parse(str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[1])).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
- if(str.StartsWith("#{today") && str.EndsWith("DAY}#")) str = DateTime.Now.AddDays(int.Parse(str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[1])).ToString("yyyy-MM-dd");
|
|
|
- if(str.StartsWith("#{today") && str.EndsWith("MONTH}#")) str = DateTime.Now.AddMonths(int.Parse(str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[1])).ToString("yyyy-MM-dd");
|
|
|
- if(str.StartsWith("#{this_month") && str.EndsWith("DAY}#")) str = DateTime.Now.AddDays(int.Parse(str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[1])).ToString("yyyy-MM");
|
|
|
- if(str.StartsWith("#{this_month") && str.EndsWith("MONTH}#")) str = DateTime.Now.AddMonths(int.Parse(str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[1])).ToString("yyyy-MM");
|
|
|
+ if(str == "#{now}#") return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ if(str == "#{today}#") return DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
+ if(str == "#{this_month}#") return DateTime.Now.ToString("yyyy-MM");
|
|
|
+ if(str.StartsWith("#{now") && str.EndsWith("DAY}#")) return DateTime.Now.AddDays(int.Parse(str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[1])).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ if(str.StartsWith("#{now") && str.EndsWith("MONTH}#")) return DateTime.Now.AddMonths(int.Parse(str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[1])).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ if(str.StartsWith("#{today") && str.EndsWith("DAY}#")) return DateTime.Now.AddDays(int.Parse(str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[1])).ToString("yyyy-MM-dd");
|
|
|
+ if(str.StartsWith("#{today") && str.EndsWith("MONTH}#")) return DateTime.Now.AddMonths(int.Parse(str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[1])).ToString("yyyy-MM-dd");
|
|
|
+ if(str.StartsWith("#{this_month") && str.EndsWith("DAY}#")) return DateTime.Now.AddDays(int.Parse(str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[1])).ToString("yyyy-MM");
|
|
|
+ if(str.StartsWith("#{this_month") && str.EndsWith("MONTH}#")) return DateTime.Now.AddMonths(int.Parse(str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[1])).ToString("yyyy-MM");
|
|
|
+ if(str.StartsWith("#{") && str.EndsWith("DAY}#")) return DateTime.Parse(str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[0]).AddDays(int.Parse(str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[1])).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ if(str.StartsWith("#{") && str.EndsWith("MONTH}#")) return DateTime.Parse(str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[0]).AddMonths(int.Parse(str.Replace("#", "").Replace("{", "").Replace("}", "").Split(',')[1])).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
return str;
|
|
|
}
|
|
|
|
|
@@ -1647,6 +1850,26 @@ namespace Util
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
+ //四则混合运算
|
|
|
+ public static string GetComputeVal(List<QueryCondition> condiDic, string expresssion)
|
|
|
+ {
|
|
|
+ if (expresssion.Contains("+") || expresssion.Contains("-") || expresssion.Contains("*") || expresssion.Contains("/") || expresssion.Contains("(") || expresssion.Contains(")"))
|
|
|
+ {
|
|
|
+ string[] returnFields = expresssion.Split(new char[] { '+', '-', '*', '/', '(', ')' });
|
|
|
+ foreach (string returnField in returnFields)
|
|
|
+ {
|
|
|
+ if(condiDic.Any(m => m.FieldEnName == returnField))
|
|
|
+ {
|
|
|
+ string val = GetQueryTableData(condiDic, returnField);
|
|
|
+ expresssion = expresssion.Replace(returnField, val);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ DataTable dt = new DataTable();
|
|
|
+ return dt.Compute(expresssion, "false").ToString();
|
|
|
+ }
|
|
|
+ return expresssion;
|
|
|
+ }
|
|
|
+
|
|
|
//获取查询条件数据
|
|
|
public static string GetQueryTableData(List<QueryCondition> condiDic, string key)
|
|
|
{
|
|
@@ -1657,43 +1880,53 @@ namespace Util
|
|
|
return condiDic.Any(m => m.FieldEnName == key) ? condiDic.FirstOrDefault(m => m.FieldEnName == key).FieldName : "";
|
|
|
}
|
|
|
|
|
|
+ //合并字典
|
|
|
+ public static void MergeCondiDic(List<QueryCondition> condiDic, List<QueryCondition> condiDic1)
|
|
|
+ {
|
|
|
+ foreach(QueryCondition sub in condiDic1)
|
|
|
+ {
|
|
|
+ condiDic.Add(sub);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//记录日志
|
|
|
- public static void addLog(int projectId, int prizeIn, string requestParam)
|
|
|
+ public static void addLog(int projectId, int listId, int prizeIn, string requestParam)
|
|
|
{
|
|
|
var logService = App.GetService<IPriLogService>();
|
|
|
logService.Add(new PriLog()
|
|
|
{
|
|
|
createDate = DateTime.Now,
|
|
|
projectId = projectId,
|
|
|
+ listId = listId,
|
|
|
batchNo = batchNo,
|
|
|
prizeIn = prizeIn,
|
|
|
requestParam = requestParam,
|
|
|
});
|
|
|
}
|
|
|
- public static void setLogPrizeAmount(decimal prizeAmount)
|
|
|
+ public static void setLogPrizeAmount(int listId, decimal prizeAmount)
|
|
|
{
|
|
|
var logService = App.GetService<IPriLogService>();
|
|
|
- var log = logService.GetFirst(m => m.batchNo == batchNo);
|
|
|
+ var log = logService.GetFirst(m => m.batchNo == batchNo && m.listId == listId);
|
|
|
if(log != null)
|
|
|
{
|
|
|
log.prizeAmount = prizeAmount;
|
|
|
logService.Update(log);
|
|
|
}
|
|
|
}
|
|
|
- public static void setLogStep(string step)
|
|
|
+ public static void setLogStep(int listId, string step)
|
|
|
{
|
|
|
var logService = App.GetService<IPriLogService>();
|
|
|
- var log = logService.GetFirst(m => m.batchNo == batchNo);
|
|
|
+ var log = logService.GetFirst(m => m.batchNo == batchNo && m.listId == listId);
|
|
|
if(log != null)
|
|
|
{
|
|
|
log.stepList = step;
|
|
|
logService.Update(log);
|
|
|
}
|
|
|
}
|
|
|
- public static void setLogStatus(int status)
|
|
|
+ public static void setLogStatus(int listId, int status)
|
|
|
{
|
|
|
var logService = App.GetService<IPriLogService>();
|
|
|
- var log = logService.GetFirst(m => m.batchNo == batchNo);
|
|
|
+ var log = logService.GetFirst(m => m.batchNo == batchNo && m.listId == listId);
|
|
|
if(log != null)
|
|
|
{
|
|
|
log.status = status;
|