111
This commit is contained in:
+47
-22
@@ -19,7 +19,7 @@ public class OnboardingPublicTaskService : IOnboardingPublicTaskService
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过有效 Token 获取任务创建时冻结的字段、材料和合同信息。
|
||||
/// 通过有效 Token 获取任务创建时冻结的材料、合同和新版入职登记表信息。
|
||||
/// </summary>
|
||||
public async Task<OnboardingTaskPublicDetailOutput> Detail(OnboardingTaskPublicAccessInput input)
|
||||
{
|
||||
@@ -30,39 +30,49 @@ public class OnboardingPublicTaskService : IOnboardingPublicTaskService
|
||||
link.AccessCount++;
|
||||
link.LastAccessedAt = DateTime.Now;
|
||||
await _db.Updateable(link).ExecuteCommandAsync();
|
||||
|
||||
var formRequirements = await _db.Queryable<ObTaskFormRequirement>()
|
||||
.Where(item => item.TaskId == task.Id)
|
||||
.OrderBy(item => item.SortCode)
|
||||
.ToListAsync();
|
||||
var materialRequirements = await _db.Queryable<ObTaskMaterialRequirement>()
|
||||
.Where(item => item.TaskId == task.Id)
|
||||
.OrderBy(item => item.SortCode)
|
||||
.ToListAsync();
|
||||
|
||||
var contracts = await _db.Queryable<ObTaskContract>()
|
||||
.Where(item => item.TaskId == task.Id)
|
||||
.ToListAsync();
|
||||
var templateVersionIds = contracts
|
||||
.Select(item => item.TemplateVersionId)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
var contractVariables = new List<OnboardingPublicContractVariableOutput>();
|
||||
if (templateVersionIds.Count > 0)
|
||||
{
|
||||
var employeeVariables = await _db.Queryable<ObTemplateVariable>()
|
||||
.Where(item => templateVersionIds.Contains(item.TemplateVersionId)
|
||||
&& item.VariableType == ContractVariableType.Employee)
|
||||
.OrderBy(item => item.SortCode)
|
||||
.ToListAsync();
|
||||
contractVariables = employeeVariables.Select(item => new OnboardingPublicContractVariableOutput
|
||||
{
|
||||
VariableCode = item.VariableCode,
|
||||
VariableName = item.VariableName,
|
||||
VariableType = item.VariableType,
|
||||
DataType = item.DataType,
|
||||
DefaultValue = item.DefaultValue,
|
||||
OptionsJson = item.OptionsJson,
|
||||
Required = item.Required
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
return new OnboardingTaskPublicDetailOutput
|
||||
{
|
||||
Task = task,
|
||||
EmployeeInfo = await _db.Queryable<ObTaskEmployeeInfo>()
|
||||
.FirstAsync(item => item.TaskId == task.Id),
|
||||
Contracts = await _db.Queryable<ObTaskContract>()
|
||||
.Where(item => item.TaskId == task.Id)
|
||||
.ToListAsync(),
|
||||
DynamicValues = await _db.Queryable<ObTaskFormValue>()
|
||||
.Where(item => item.TaskId == task.Id)
|
||||
.ToListAsync(),
|
||||
Contracts = contracts,
|
||||
DynamicValues = new List<ObTaskFormValue>(),
|
||||
Materials = await _db.Queryable<ObTaskMaterial>()
|
||||
.Where(item => item.TaskId == task.Id)
|
||||
.ToListAsync(),
|
||||
FormFields = formRequirements.Select(requirement => new OnboardingPublicFormFieldOutput
|
||||
{
|
||||
FieldId = requirement.FieldId,
|
||||
FieldCode = requirement.FieldCode,
|
||||
FieldName = requirement.FieldName,
|
||||
DataType = requirement.DataType,
|
||||
OptionsJson = requirement.OptionsJson,
|
||||
Required = requirement.Required
|
||||
}).ToList(),
|
||||
FormFields = new List<OnboardingPublicFormFieldOutput>(),
|
||||
MaterialRequirements = materialRequirements.Select(requirement => new OnboardingPublicMaterialOutput
|
||||
{
|
||||
MaterialTypeId = requirement.MaterialTypeId,
|
||||
@@ -70,7 +80,8 @@ public class OnboardingPublicTaskService : IOnboardingPublicTaskService
|
||||
AllowedExtensions = requirement.AllowedExtensions,
|
||||
MaxFileCount = requirement.MaxFileCount,
|
||||
Required = requirement.Required
|
||||
}).ToList()
|
||||
}).ToList(),
|
||||
ContractVariables = contractVariables
|
||||
};
|
||||
}
|
||||
|
||||
@@ -92,15 +103,29 @@ public class OnboardingPublicTaskService : IOnboardingPublicTaskService
|
||||
.FirstAsync(item => item.TaskId == task.Id);
|
||||
var entity = input.Adapt<ObTaskEmployeeInfo>();
|
||||
entity.TaskId = task.Id;
|
||||
entity.IsDelete = false;
|
||||
|
||||
if (old == null)
|
||||
{
|
||||
entity.Id = global::SimpleAdmin.Core.Utils.CommonUtils.GetSingleId();
|
||||
entity.Status = CommonStatusConst.ENABLE;
|
||||
entity.CreateTime = DateTime.Now;
|
||||
entity.CreateUserId = null;
|
||||
entity.CreateUser = null;
|
||||
await _db.Insertable(entity).ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.Id = old.Id;
|
||||
entity.Status = old.Status;
|
||||
entity.CreateTime = old.CreateTime;
|
||||
entity.CreateUserId = old.CreateUserId;
|
||||
entity.CreateUser = old.CreateUser;
|
||||
entity.ExtJson = old.ExtJson;
|
||||
entity.IsDelete = old.IsDelete;
|
||||
entity.UpdateTime = DateTime.Now;
|
||||
entity.UpdateUserId = null;
|
||||
entity.UpdateUser = null;
|
||||
await _db.Updateable(entity).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user