|
@@ -4,8 +4,11 @@ using Infrastructure;
|
|
|
using LitJson;
|
|
|
using Microsoft.Extensions.Localization;
|
|
|
using Model;
|
|
|
+using Model.Customer;
|
|
|
using NuGet.Packaging;
|
|
|
using Services;
|
|
|
+using System.Linq;
|
|
|
+using System.Net.Mime;
|
|
|
|
|
|
namespace Util
|
|
|
{
|
|
@@ -13,17 +16,16 @@ namespace Util
|
|
|
{
|
|
|
public static string batchNo = "";
|
|
|
|
|
|
- public static void sendPrize(string content)
|
|
|
+ public static void sendPrize(int prizeInId, string content)
|
|
|
{
|
|
|
batchNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + Function.get_Random(3);
|
|
|
- JsonData jsonObj = JsonMapper.ToObject(content);
|
|
|
- string priObjString = prizeInSet(int.Parse(Function.CheckInt(jsonObj["prize_tag"].ToString())));
|
|
|
- content = jsonObj["content"].ToString();
|
|
|
+ string priObjString = prizeInSet(prizeInId);
|
|
|
if(!string.IsNullOrEmpty(priObjString))
|
|
|
{
|
|
|
string[] priObjData = priObjString.Split('|');
|
|
|
string priListIds = priObjData[0];
|
|
|
int projectId = int.Parse(priObjData[1]);
|
|
|
+ addLog(projectId, prizeInId, content);
|
|
|
prizeSend(projectId, priListIds, content);
|
|
|
}
|
|
|
}
|
|
@@ -63,18 +65,19 @@ namespace Util
|
|
|
}
|
|
|
|
|
|
|
|
|
- public static Dictionary<string, object> condition(int projectId, string content)
|
|
|
+ public static List<QueryCondition> condition(int projectId, List<int> ids, string content)
|
|
|
{
|
|
|
- Dictionary<string, object> dic = new Dictionary<string, object>();
|
|
|
+ List<QueryCondition> dic = new List<QueryCondition>();
|
|
|
var queryTableService = App.GetService<IPriQueryTableService>();
|
|
|
var queryFieldService = App.GetService<IPriQueryFieldService>();
|
|
|
var returnFieldService = App.GetService<IPriReturnFieldService>();
|
|
|
|
|
|
- var queryTables = queryTableService.GetList(m => m.projectId == projectId);
|
|
|
+ var queryTables = queryTableService.GetList(m => ids.Contains(m.id));
|
|
|
foreach(var queryTable in queryTables)
|
|
|
{
|
|
|
|
|
|
string fields = "";
|
|
|
+ Dictionary<string, string> fieldDic = new Dictionary<string, string>();
|
|
|
var returnFields = returnFieldService.GetList(m => m.queryTableId == queryTable.id);
|
|
|
foreach(var returnField in returnFields)
|
|
|
{
|
|
@@ -94,6 +97,7 @@ namespace Util
|
|
|
{
|
|
|
fields += returnField.fieldEnName + " " + queryTable.tableEnName + "_" + returnField.fieldEnName + ",";
|
|
|
}
|
|
|
+ fieldDic.Add(queryTable.tableEnName + "_" + returnField.fieldEnName, returnField.fieldName);
|
|
|
}
|
|
|
fields = fields.TrimEnd(',');
|
|
|
|
|
@@ -126,7 +130,7 @@ namespace Util
|
|
|
}
|
|
|
else if(fieldQueryModel == "query_field")
|
|
|
{
|
|
|
- string val = dic.ContainsKey(fieldQueryValue) ? dic[fieldQueryValue].ToString() : "0";
|
|
|
+ string val = GetQueryTableData(dic, fieldQueryValue);
|
|
|
condi += "'%" + val + "%'";
|
|
|
}
|
|
|
}
|
|
@@ -152,7 +156,7 @@ namespace Util
|
|
|
}
|
|
|
else if(fieldQueryModel == "query_field")
|
|
|
{
|
|
|
- val = dic.ContainsKey(fieldQueryValue) ? dic[fieldQueryValue].ToString() : "0";
|
|
|
+ val = GetQueryTableData(dic, fieldQueryValue);
|
|
|
}
|
|
|
if(fieldQueryValueType == "text")
|
|
|
{
|
|
@@ -214,7 +218,7 @@ namespace Util
|
|
|
{
|
|
|
foreach(string sub in valList)
|
|
|
{
|
|
|
- string dicVal = dic.ContainsKey(sub) ? dic[sub].ToString() : "0";
|
|
|
+ string dicVal = GetQueryTableData(dic, sub);
|
|
|
if(fieldQueryValueType == "text")
|
|
|
{
|
|
|
val += "'" + dicVal + "',";
|
|
@@ -265,8 +269,10 @@ namespace Util
|
|
|
}
|
|
|
else if(fieldQueryModel == "query_field")
|
|
|
{
|
|
|
- string dicValLeft = dic.ContainsKey(val[0]) ? dic[val[0]].ToString() : "0";
|
|
|
- string dicValRight = dic.ContainsKey(val[1]) ? dic[val[1]].ToString() : "0";
|
|
|
+ string valLeft = val[0];
|
|
|
+ string valRight = val[1];
|
|
|
+ string dicValLeft = GetQueryTableData(dic, valLeft);
|
|
|
+ string dicValRight = GetQueryTableData(dic, valRight);
|
|
|
if(fieldQueryValueType == "number")
|
|
|
{
|
|
|
if(!string.IsNullOrEmpty(dicValLeft)) condi += " and " + fieldEnName + ">=" + dicValLeft;
|
|
@@ -301,7 +307,7 @@ namespace Util
|
|
|
}
|
|
|
else if(fieldQueryModel == "query_field")
|
|
|
{
|
|
|
- val = dic.ContainsKey(fieldQueryValue) ? dic[fieldQueryValue].ToString() : "0";
|
|
|
+ val = GetQueryTableData(dic, fieldQueryValue);
|
|
|
}
|
|
|
if(fieldQueryValueType == "text")
|
|
|
{
|
|
@@ -317,9 +323,14 @@ namespace Util
|
|
|
var items = db.Ado.GetDataTable(sql);
|
|
|
if(items.Rows.Count > 0)
|
|
|
{
|
|
|
- foreach(System.Data.DataColumn item in items.Columns)
|
|
|
+ foreach(string field in fieldDic.Keys)
|
|
|
{
|
|
|
- if(!dic.ContainsKey(item.ColumnName)) dic.Add(item.ColumnName, items.Rows[0][item.ColumnName].ToString());
|
|
|
+ if(!dic.Any(m => m.FieldEnName == field)) dic.Add(new QueryCondition()
|
|
|
+ {
|
|
|
+ FieldName = fieldDic[field],
|
|
|
+ FieldEnName = field,
|
|
|
+ Value = items.Rows[0][field].ToString()
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -567,9 +578,11 @@ namespace Util
|
|
|
bool op = true;
|
|
|
int index = 0;
|
|
|
loopAmount = 0;
|
|
|
+ Dictionary<string, object> topStepDic = new Dictionary<string, object>();
|
|
|
while(!string.IsNullOrEmpty(objId) && objId != "0" && op)
|
|
|
{
|
|
|
- Dictionary<string, object> condiDic = loopCondition(projectId, sub, objId, content);
|
|
|
+ List<Dictionary<string, string>> logStepDics = new List<Dictionary<string, string>>();
|
|
|
+ List<QueryCondition> condiDic = loopCondition(projectId, sub, objId, content);
|
|
|
if(condiDic.Count > 0)
|
|
|
{
|
|
|
bool prizeFlag = true;
|
|
@@ -582,6 +595,8 @@ namespace Util
|
|
|
{
|
|
|
if(condition.startIndex <= index)
|
|
|
{
|
|
|
+ Dictionary<string, string> logStepDic = new Dictionary<string, string>();
|
|
|
+
|
|
|
var returnFieldId = condition.returnFieldId;
|
|
|
var fieldQueryKind = condition.fieldQueryKind;
|
|
|
var fieldQueryModel = condition.fieldQueryModel;
|
|
@@ -589,54 +604,69 @@ namespace Util
|
|
|
var fieldQueryValueType = condition.fieldQueryValueType;
|
|
|
|
|
|
string checkObj = "";
|
|
|
+ string checkTitle = "";
|
|
|
if(returnFieldId.Contains(","))
|
|
|
{
|
|
|
string[] returnFieldIdList = returnFieldId.Split(',');
|
|
|
foreach(string subField in returnFieldIdList)
|
|
|
{
|
|
|
- string val = condiDic.ContainsKey(subField) ? condiDic[subField].ToString() : "0";
|
|
|
+ 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 = condiDic.ContainsKey(returnField) ? condiDic[returnField].ToString() : "0";
|
|
|
+ string val = GetQueryTableData(condiDic, returnField);
|
|
|
expresssion = expresssion.Replace(returnField, val);
|
|
|
+
|
|
|
+ string title = GetQueryTableTitle(condiDic, returnField);
|
|
|
+ checkTitle = checkTitle.Replace(returnField, title);
|
|
|
}
|
|
|
DataTable dt = new DataTable();
|
|
|
checkObj = dt.Compute(expresssion, "false").ToString();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- checkObj = condiDic.ContainsKey(returnFieldId) ? condiDic[returnFieldId].ToString() : "0";
|
|
|
+ checkObj = GetQueryTableData(condiDic, returnFieldId);
|
|
|
+ checkTitle = GetQueryTableTitle(condiDic, returnFieldId);
|
|
|
}
|
|
|
+
|
|
|
+ logStepDic.Add("标题", checkTitle);
|
|
|
+ logStepDic.Add("匹配值", fieldQueryValue);
|
|
|
+ logStepDic.Add("实际值", checkObj);
|
|
|
+
|
|
|
var checkVal = fieldQueryValue;
|
|
|
+ bool passFlag = false;
|
|
|
|
|
|
if(fieldQueryKind == "1")
|
|
|
{
|
|
|
if(fieldQueryValueType == "text")
|
|
|
{
|
|
|
- if(checkObj.ToString().Contains(GetExpressionVal(checkVal))) passCount += 1;
|
|
|
+ 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;
|
|
|
+ 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;
|
|
|
+ if(decimal.Parse(Function.CheckNum(checkObj.ToString())) == decimal.Parse(Function.CheckNum(checkVal))) passCount += 1; passFlag = true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if(checkObj.ToString() == GetExpressionVal(checkVal)) passCount += 1;
|
|
|
+ if(checkObj.ToString() == GetExpressionVal(checkVal)) passCount += 1; passFlag = true;
|
|
|
}
|
|
|
}
|
|
|
else if(fieldQueryKind == "3")
|
|
@@ -647,42 +677,96 @@ namespace Util
|
|
|
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]]))) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(req[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(req[val[0]]))) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && decimal.Parse(checkObj) <= decimal.Parse(Function.CheckNum(req[val[1]]))) passCount += 1;
|
|
|
+ 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]])))
|
|
|
+ {
|
|
|
+ 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]])))
|
|
|
+ {
|
|
|
+ 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]])))
|
|
|
+ {
|
|
|
+ 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]]))) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(req[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(req[val[0]]))) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && int.Parse(checkObj) <= int.Parse(Function.CheckInt(req[val[1]]))) passCount += 1;
|
|
|
+ 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]])))
|
|
|
+ {
|
|
|
+ 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]])))
|
|
|
+ {
|
|
|
+ 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]])))
|
|
|
+ {
|
|
|
+ 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]])) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(req[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) >= DateTime.Parse(req[val[0]])) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) <= DateTime.Parse(req[val[1]])) passCount += 1;
|
|
|
+ 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]]))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(!string.IsNullOrEmpty(req[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) >= DateTime.Parse(req[val[0]]))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) <= DateTime.Parse(req[val[1]]))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
|
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]))) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && decimal.Parse(Function.CheckNum(checkObj.ToString())) >= decimal.Parse(Function.CheckNum(val[0]))) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(val[1]))) passCount += 1;
|
|
|
+ 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])))
|
|
|
+ {
|
|
|
+ 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])))
|
|
|
+ {
|
|
|
+ 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])))
|
|
|
+ {
|
|
|
+ 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]))) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && int.Parse(Function.CheckInt(checkObj.ToString())) >= int.Parse(Function.CheckInt(val[0]))) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(val[1]))) passCount += 1;
|
|
|
+ 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])))
|
|
|
+ {
|
|
|
+ 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])))
|
|
|
+ {
|
|
|
+ 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])))
|
|
|
+ {
|
|
|
+ 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]))) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj) >= DateTime.Parse(GetExpressionVal(val[0]))) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj) <= DateTime.Parse(GetExpressionVal(val[1]))) passCount += 1;
|
|
|
+ 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])))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj) >= DateTime.Parse(GetExpressionVal(val[0])))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj) <= DateTime.Parse(GetExpressionVal(val[1])))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -690,15 +774,15 @@ namespace Util
|
|
|
{
|
|
|
if(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- if(int.Parse(checkObj) != int.Parse(Function.CheckInt(checkVal))) passCount += 1;
|
|
|
+ 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;
|
|
|
+ if(decimal.Parse(checkObj) != decimal.Parse(Function.CheckNum(checkVal))) passCount += 1; passFlag = true;
|
|
|
}
|
|
|
else if(fieldQueryValueType == "text")
|
|
|
{
|
|
|
- if(checkObj.ToString() != GetExpressionVal(checkVal)) passCount += 1;
|
|
|
+ if(checkObj.ToString() != GetExpressionVal(checkVal)) passCount += 1; passFlag = true;
|
|
|
}
|
|
|
}
|
|
|
else if(fieldQueryKind == "5" || fieldQueryKind == "6")
|
|
@@ -727,9 +811,11 @@ namespace Util
|
|
|
val += GetDbExpressionVal(subVal) + ",";
|
|
|
}
|
|
|
}
|
|
|
- if(fieldQueryKind == "5" && val.Contains("," + checkObj.ToString() + ",")) passCount += 1;
|
|
|
- if(fieldQueryKind == "6" && val.Contains("," + checkObj.ToString() + ",")) passCount += 1;
|
|
|
+ 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);
|
|
|
}
|
|
|
}
|
|
|
if(loopSet.conditionMode == "all" && passCount == allCount) prizeFlag = true;
|
|
@@ -742,10 +828,11 @@ namespace Util
|
|
|
}
|
|
|
if(prizeFlag)
|
|
|
{
|
|
|
- prizeSendDo(projectId, sub, objId, content, loopSet);
|
|
|
+ decimal prizeAmt = prizeSendDo(projectId, sub, objId, content, loopSet);
|
|
|
op = afterPrizeFlag;
|
|
|
}
|
|
|
}
|
|
|
+ topStepDic.Add(objId, logStepDics);
|
|
|
var parent = db.Ado.GetScalar("select " + parentField + " from " + tableEnName + " where " + sonField + "=" + objId);
|
|
|
if(parent != null)
|
|
|
{
|
|
@@ -753,6 +840,7 @@ namespace Util
|
|
|
}
|
|
|
index += 1;
|
|
|
}
|
|
|
+ setLogStep(Newtonsoft.Json.JsonConvert.SerializeObject(topStepDic));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -762,7 +850,7 @@ namespace Util
|
|
|
}
|
|
|
|
|
|
static decimal loopAmount = 0;
|
|
|
- public static void prizeSendDo(int projectId, PriList sub, string prizeObjectId, string content, PriLoopSet set)
|
|
|
+ public static decimal prizeSendDo(int projectId, PriList sub, string prizeObjectId, string content, PriLoopSet set)
|
|
|
{
|
|
|
var recordService = App.GetService<IPriRecordService>();
|
|
|
var conditionService = App.GetService<IPriConditionService>();
|
|
@@ -770,8 +858,8 @@ namespace Util
|
|
|
var queryTableService = App.GetService<IPriQueryTableService>();
|
|
|
var amountSetService = App.GetService<IPriListAmountSetService>();
|
|
|
|
|
|
- Dictionary<string, object> condiDic = new Dictionary<string, object>();
|
|
|
- if(sub.prizeSourceFieldType == "condi") condiDic = condition(projectId, content);
|
|
|
+ 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);
|
|
|
|
|
|
var prizeSourceField = sub.prizeSourceField;
|
|
@@ -784,8 +872,10 @@ namespace Util
|
|
|
var conditions = conditionService.GetList(m => m.listId == sub.id);
|
|
|
int allCount = conditions.Count;
|
|
|
int passCount = 0;
|
|
|
+ List<Dictionary<string, string>> logStepDics = new List<Dictionary<string, string>>();
|
|
|
foreach(var condition in conditions)
|
|
|
{
|
|
|
+ Dictionary<string, string> logStepDic = new Dictionary<string, string>();
|
|
|
var returnFieldId = condition.returnFieldId;
|
|
|
var fieldQueryKind = condition.fieldQueryKind;
|
|
|
var fieldQueryModel = condition.fieldQueryModel;
|
|
@@ -793,54 +883,71 @@ namespace Util
|
|
|
var fieldQueryValueType = condition.fieldQueryValueType;
|
|
|
|
|
|
string checkObj = "";
|
|
|
+ string checkTitle = "";
|
|
|
if(returnFieldId.Contains(","))
|
|
|
{
|
|
|
string[] returnFieldIdList = returnFieldId.Split(',');
|
|
|
foreach(string subField in returnFieldIdList)
|
|
|
{
|
|
|
- string val = condiDic.ContainsKey(subField) ? condiDic[subField].ToString() : "0";
|
|
|
+ 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 = condiDic.ContainsKey(returnField) ? condiDic[returnField].ToString() : "0";
|
|
|
+ string val = GetQueryTableData(condiDic, returnField);
|
|
|
expresssion = expresssion.Replace(returnField, val);
|
|
|
+
|
|
|
+ string title = GetQueryTableTitle(condiDic, returnField);
|
|
|
+ checkTitle = checkTitle.Replace(returnField, title);
|
|
|
}
|
|
|
DataTable dt = new DataTable();
|
|
|
checkObj = dt.Compute(expresssion, "false").ToString();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- checkObj = condiDic.ContainsKey(returnFieldId) ? condiDic[returnFieldId].ToString() : "0";
|
|
|
- }
|
|
|
+ checkObj = GetQueryTableData(condiDic, returnFieldId);
|
|
|
+ checkTitle = GetQueryTableTitle(condiDic, returnFieldId);
|
|
|
+ }
|
|
|
+ if(!sub.recursionFlag)
|
|
|
+ {
|
|
|
+ logStepDic.Add("标题", checkTitle);
|
|
|
+ logStepDic.Add("匹配值", fieldQueryValue);
|
|
|
+ logStepDic.Add("实际值", checkObj);
|
|
|
+ }
|
|
|
+
|
|
|
string checkVal = fieldQueryValue;
|
|
|
+ bool passFlag = false;
|
|
|
|
|
|
if(fieldQueryKind == "1")
|
|
|
{
|
|
|
if(fieldQueryValueType == "text")
|
|
|
{
|
|
|
- if(checkObj.ToString().Contains(GetExpressionVal(checkVal))) passCount += 1;
|
|
|
+ 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;
|
|
|
+ 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;
|
|
|
+ if(decimal.Parse(Function.CheckNum(checkObj.ToString())) == decimal.Parse(Function.CheckNum(checkVal))) passCount += 1; passFlag = true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if(checkObj.ToString() == GetExpressionVal(checkVal)) passCount += 1;
|
|
|
+ if(checkObj.ToString() == GetExpressionVal(checkVal)) passCount += 1; passFlag = true;
|
|
|
}
|
|
|
}
|
|
|
else if(fieldQueryKind == "3")
|
|
@@ -851,42 +958,96 @@ namespace Util
|
|
|
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]]))) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(req[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && decimal.Parse(checkObj) >= decimal.Parse(Function.CheckNum(req[val[0]]))) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && decimal.Parse(checkObj) <= decimal.Parse(Function.CheckNum(req[val[1]]))) passCount += 1;
|
|
|
+ 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]])))
|
|
|
+ {
|
|
|
+ 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]])))
|
|
|
+ {
|
|
|
+ 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]])))
|
|
|
+ {
|
|
|
+ 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]]))) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(req[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && int.Parse(checkObj) >= int.Parse(Function.CheckInt(req[val[0]]))) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && int.Parse(checkObj) <= int.Parse(Function.CheckInt(req[val[1]]))) passCount += 1;
|
|
|
+ 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]])))
|
|
|
+ {
|
|
|
+ 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]])))
|
|
|
+ {
|
|
|
+ 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]])))
|
|
|
+ {
|
|
|
+ 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]])) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(req[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) >= DateTime.Parse(req[val[0]])) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) <= DateTime.Parse(req[val[1]])) passCount += 1;
|
|
|
+ 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]]))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(!string.IsNullOrEmpty(req[val[0]]) && string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) >= DateTime.Parse(req[val[0]]))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && DateTime.Parse(checkObj) <= DateTime.Parse(req[val[1]]))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else if(fieldQueryModel == "fixed_value")
|
|
|
{
|
|
|
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]))) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && decimal.Parse(Function.CheckNum(checkObj.ToString())) >= decimal.Parse(Function.CheckNum(val[0]))) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(val[1]))) passCount += 1;
|
|
|
+ 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])))
|
|
|
+ {
|
|
|
+ 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])))
|
|
|
+ {
|
|
|
+ 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])))
|
|
|
+ {
|
|
|
+ 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]))) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && int.Parse(Function.CheckInt(checkObj.ToString())) >= int.Parse(Function.CheckInt(val[0]))) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(val[1]))) passCount += 1;
|
|
|
+ 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])))
|
|
|
+ {
|
|
|
+ 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])))
|
|
|
+ {
|
|
|
+ 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])))
|
|
|
+ {
|
|
|
+ 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]))) passCount += 1;
|
|
|
- else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj.ToString()) >= DateTime.Parse(GetExpressionVal(val[0]))) passCount += 1;
|
|
|
- else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj.ToString()) <= DateTime.Parse(GetExpressionVal(val[1]))) passCount += 1;
|
|
|
+ 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])))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj.ToString()) >= DateTime.Parse(GetExpressionVal(val[0])))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
+ else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && DateTime.Parse(checkObj.ToString()) <= DateTime.Parse(GetExpressionVal(val[1])))
|
|
|
+ {
|
|
|
+ passCount += 1; passFlag = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -894,15 +1055,15 @@ namespace Util
|
|
|
{
|
|
|
if(fieldQueryValueType == "int")
|
|
|
{
|
|
|
- if(int.Parse(Function.CheckNum(checkObj.ToString())) != int.Parse(Function.CheckInt(checkVal))) passCount += 1;
|
|
|
+ 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;
|
|
|
+ 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;
|
|
|
+ if(checkObj.ToString() != GetExpressionVal(checkVal)) passCount += 1; passFlag = true;
|
|
|
}
|
|
|
}
|
|
|
else if(fieldQueryKind == "5" || fieldQueryKind == "6")
|
|
@@ -931,11 +1092,18 @@ namespace Util
|
|
|
val += GetDbExpressionVal(subVal) + ",";
|
|
|
}
|
|
|
}
|
|
|
- if(fieldQueryKind == "5" && val.Contains("," + checkObj.ToString() + ",")) passCount += 1;
|
|
|
- if(fieldQueryKind == "6" && val.Contains("," + checkObj.ToString() + ",")) passCount += 1;
|
|
|
+ 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)
|
|
|
+ {
|
|
|
+ logStepDic.Add("状态", passFlag ? "通过" : "未通过");
|
|
|
+ logStepDics.Add(logStepDic);
|
|
|
}
|
|
|
}
|
|
|
bool op = false;
|
|
|
+ decimal prizeAmt = 0;
|
|
|
if(conditionMode == "all" && passCount == allCount && passCount > 0) op = true;
|
|
|
else if(conditionMode == "one" && passCount >= 1) op = true;
|
|
|
if(op)
|
|
@@ -952,14 +1120,14 @@ namespace Util
|
|
|
string[] prizeSourceFieldList = prizeSourceField.Split(',');
|
|
|
foreach(string subField in prizeSourceFieldList)
|
|
|
{
|
|
|
- string val = condiDic.ContainsKey(subField) ? condiDic[subField].ToString() : "0";
|
|
|
+ string val = GetQueryTableData(condiDic, subField);
|
|
|
prizeSourceData += val + ",";
|
|
|
}
|
|
|
prizeSourceData = prizeSourceData.TrimEnd(',');
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- prizeSourceData = condiDic.ContainsKey(prizeSourceField) ? condiDic[prizeSourceField].ToString() : "0";
|
|
|
+ prizeSourceData = GetQueryTableData(condiDic, prizeSourceField);
|
|
|
}
|
|
|
if(string.IsNullOrEmpty(prizeSourceData)) prizeSourceData = "0";
|
|
|
if(prizeSourceField.Contains("/") && number > 0)
|
|
@@ -967,7 +1135,6 @@ namespace Util
|
|
|
decimal prizeSourceDataNum = decimal.Parse(prizeSourceData) / number;
|
|
|
prizeSourceData = prizeSourceDataNum.ToString("f2");
|
|
|
}
|
|
|
- decimal prizeAmt = 0;
|
|
|
var amountSet = amountSetService.GetFirst(m => m.listId == sub.id && m.prizeSourceField == prizeSourceData);
|
|
|
if(amountSet != null)
|
|
|
{
|
|
@@ -991,6 +1158,7 @@ namespace Util
|
|
|
if(set.levelDiffFlag) prizeAmt -= loopAmount;
|
|
|
if(prizeAmt > 0)
|
|
|
{
|
|
|
+ setLogPrizeAmount(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);
|
|
@@ -1011,12 +1179,19 @@ namespace Util
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if(!sub.recursionFlag)
|
|
|
+ {
|
|
|
+ setLogStatus(op ? 1 : 0);
|
|
|
+ setLogStep(Newtonsoft.Json.JsonConvert.SerializeObject(logStepDics));
|
|
|
+ }
|
|
|
+ return prizeAmt;
|
|
|
}
|
|
|
|
|
|
|
|
|
- public static Dictionary<string, object> loopCondition(int projectId, PriList sub, string objId, string content)
|
|
|
+ public static List<QueryCondition> loopCondition(int projectId, PriList sub, string objId, string content)
|
|
|
{
|
|
|
- Dictionary<string, object> dic = new Dictionary<string, object>();
|
|
|
+ List<QueryCondition> dic = new List<QueryCondition>();
|
|
|
var queryTableService = App.GetService<IPriRecursionStartTableService>();
|
|
|
var queryFieldService = App.GetService<IPriRecursionStartFieldService>();
|
|
|
var queryReturnFieldService = App.GetService<IPriRecursionStartReturnFieldService>();
|
|
@@ -1028,6 +1203,7 @@ namespace Util
|
|
|
{
|
|
|
|
|
|
string fields = "1";
|
|
|
+ Dictionary<string, string> fieldDic = new Dictionary<string, string>();
|
|
|
var returnFields = queryReturnFieldService.GetList(m => m.objectTableId == queryTable.id);
|
|
|
if(returnFields.Count > 0)
|
|
|
{
|
|
@@ -1050,6 +1226,7 @@ namespace Util
|
|
|
{
|
|
|
fields += returnField.fieldEnName + " " + queryTable.tableEnName + "_" + returnField.fieldEnName + ",";
|
|
|
}
|
|
|
+ fieldDic.Add(queryTable.tableEnName + "_" + returnField.fieldEnName, returnField.fieldName);
|
|
|
}
|
|
|
fields = fields.TrimEnd(',');
|
|
|
}
|
|
@@ -1232,9 +1409,14 @@ namespace Util
|
|
|
var items = db.Ado.GetDataTable(sql);
|
|
|
if(items.Rows.Count > 0)
|
|
|
{
|
|
|
- foreach(System.Data.DataColumn item in items.Columns)
|
|
|
+ foreach(string field in fieldDic.Keys)
|
|
|
{
|
|
|
- if(!dic.ContainsKey(item.ColumnName)) dic.Add(item.ColumnName, items.Rows[0][item.ColumnName].ToString());
|
|
|
+ if(!dic.Any(m => m.FieldEnName == field)) dic.Add(new QueryCondition()
|
|
|
+ {
|
|
|
+ FieldName = fieldDic[field],
|
|
|
+ FieldEnName = field,
|
|
|
+ Value = items.Rows[0][field].ToString()
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1464,5 +1646,59 @@ namespace Util
|
|
|
if(str.StartsWith("#{") && str.EndsWith("MONTH}#")) str = "DATE_ADD(" + data[0] + ",INTERVAL " + data[1] + " MONTH)";
|
|
|
return str;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public static string GetQueryTableData(List<QueryCondition> condiDic, string key)
|
|
|
+ {
|
|
|
+ return condiDic.Any(m => m.FieldEnName == key) ? condiDic.FirstOrDefault(m => m.FieldEnName == key).Value.ToString() : "0";
|
|
|
+ }
|
|
|
+ public static string GetQueryTableTitle(List<QueryCondition> condiDic, string key)
|
|
|
+ {
|
|
|
+ return condiDic.Any(m => m.FieldEnName == key) ? condiDic.FirstOrDefault(m => m.FieldEnName == key).FieldName : "";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static void addLog(int projectId, int prizeIn, string requestParam)
|
|
|
+ {
|
|
|
+ var logService = App.GetService<IPriLogService>();
|
|
|
+ logService.Add(new PriLog()
|
|
|
+ {
|
|
|
+ createDate = DateTime.Now,
|
|
|
+ projectId = projectId,
|
|
|
+ batchNo = batchNo,
|
|
|
+ prizeIn = prizeIn,
|
|
|
+ requestParam = requestParam,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ public static void setLogPrizeAmount(decimal prizeAmount)
|
|
|
+ {
|
|
|
+ var logService = App.GetService<IPriLogService>();
|
|
|
+ var log = logService.GetFirst(m => m.batchNo == batchNo);
|
|
|
+ if(log != null)
|
|
|
+ {
|
|
|
+ log.prizeAmount = prizeAmount;
|
|
|
+ logService.Update(log);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public static void setLogStep(string step)
|
|
|
+ {
|
|
|
+ var logService = App.GetService<IPriLogService>();
|
|
|
+ var log = logService.GetFirst(m => m.batchNo == batchNo);
|
|
|
+ if(log != null)
|
|
|
+ {
|
|
|
+ log.stepList = step;
|
|
|
+ logService.Update(log);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public static void setLogStatus(int status)
|
|
|
+ {
|
|
|
+ var logService = App.GetService<IPriLogService>();
|
|
|
+ var log = logService.GetFirst(m => m.batchNo == batchNo);
|
|
|
+ if(log != null)
|
|
|
+ {
|
|
|
+ log.status = status;
|
|
|
+ logService.Update(log);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|