入职任务预览,入职任务cope,验证填入的信息
This commit is contained in:
+17
-5
@@ -110,12 +110,13 @@ public class OnboardingContractSnapshotService : IOnboardingContractSnapshotServ
|
||||
};
|
||||
}
|
||||
|
||||
private static string ResolveValue(
|
||||
internal static string ResolveValue(
|
||||
ObTemplateVariable definition,
|
||||
ObTaskEmployeeInfo employeeInfo,
|
||||
IReadOnlyDictionary<string, string> dynamicValues,
|
||||
ObCompany company,
|
||||
ObOnboardingTask task)
|
||||
ObOnboardingTask task,
|
||||
bool useEmployeePlaceholder = false)
|
||||
{
|
||||
var sourceField = GetSourceField(definition);
|
||||
if (definition.VariableType == ContractVariableType.Employee)
|
||||
@@ -133,7 +134,15 @@ public class OnboardingContractSnapshotService : IOnboardingContractSnapshotServ
|
||||
if (doc.RootElement.TryGetProperty(sourceField, out var prop)
|
||||
|| doc.RootElement.TryGetProperty(definition.VariableCode, out prop))
|
||||
{
|
||||
var str = prop.GetString();
|
||||
var str = prop.ValueKind switch
|
||||
{
|
||||
global::System.Text.Json.JsonValueKind.String => prop.GetString(),
|
||||
global::System.Text.Json.JsonValueKind.Number => prop.ToString(),
|
||||
global::System.Text.Json.JsonValueKind.True => bool.TrueString,
|
||||
global::System.Text.Json.JsonValueKind.False => bool.FalseString,
|
||||
global::System.Text.Json.JsonValueKind.Null => null,
|
||||
_ => throw Oops.Bah($"员工补充变量“{definition.VariableName}”格式不正确")
|
||||
};
|
||||
if (!string.IsNullOrWhiteSpace(str)) return str;
|
||||
}
|
||||
}
|
||||
@@ -143,8 +152,11 @@ public class OnboardingContractSnapshotService : IOnboardingContractSnapshotServ
|
||||
}
|
||||
}
|
||||
|
||||
return dynamicValues.TryGetValue(sourceField, out var dynamicValue)
|
||||
? dynamicValue
|
||||
if (dynamicValues.TryGetValue(sourceField, out var dynamicValue))
|
||||
return dynamicValue;
|
||||
|
||||
return useEmployeePlaceholder
|
||||
? $"【待员工填写:{definition.VariableName ?? definition.VariableCode}】"
|
||||
: definition.DefaultValue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user