|
|
|
@ -46,6 +46,13 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins |
|
|
|
|
var entity = await base.QueryById(id); |
|
|
|
|
var data = Mapper.Map(entity).ToANew<InsertGhre_SurveyExtend>(); |
|
|
|
|
|
|
|
|
|
data.BeginEndTime.Add(data.BeginTime); |
|
|
|
|
data.BeginEndTime.Add(data.EndTime); |
|
|
|
|
if (entity.StaffId.IsNotEmptyOrNull()) |
|
|
|
|
data.StaffIds = JsonHelper.JsonToObj<List<int>>(entity.StaffId); |
|
|
|
|
if (entity.DeptId.IsNotEmptyOrNull()) |
|
|
|
|
data.DeptIds = JsonHelper.JsonToObj<List<int>>(entity.DeptId); |
|
|
|
|
|
|
|
|
|
var questions = await Db.Queryable<Ghre_SurveyQuestion>().OrderBy(x => x.SortNo).Where(x => x.SurveyId == id).ToListAsync(); |
|
|
|
|
var options = await Db.Queryable<Ghre_SurveyOption>().OrderBy(x => x.SortNo).Where(x => x.SurveyId == id).ToListAsync(); |
|
|
|
|
|
|
|
|
@ -101,12 +108,26 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins |
|
|
|
|
|
|
|
|
|
public async Task<ServiceResult<long>> InsertData(long id, InsertGhre_SurveyExtend insertModel) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
if (insertModel.BeginEndTime != null && insertModel.BeginEndTime.Count == 2) |
|
|
|
|
{ |
|
|
|
|
insertModel.BeginTime = insertModel.BeginEndTime[0]; |
|
|
|
|
insertModel.EndTime = insertModel.BeginEndTime[1]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var data = ServiceResult<long>.OprateSuccess("新增成功", id); |
|
|
|
|
if (id == 0) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
var insert = Mapper.Map(insertModel).ToANew<InsertGhre_SurveyInput>(); |
|
|
|
|
insert.Status = "Temporary"; |
|
|
|
|
|
|
|
|
|
if (insertModel.StaffIds != null && insertModel.StaffIds.Any()) |
|
|
|
|
insert.StaffId = JsonHelper.ObjToJson(insertModel.StaffIds); |
|
|
|
|
|
|
|
|
|
if (insertModel.DeptIds != null && insertModel.DeptIds.Any()) |
|
|
|
|
insert.DeptId = JsonHelper.ObjToJson(insertModel.DeptIds); |
|
|
|
|
|
|
|
|
|
id = await Add(insert); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < insertModel.Questions.Count; i++) |
|
|
|
@ -137,6 +158,12 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins |
|
|
|
|
|
|
|
|
|
var insert = Mapper.Map(insertModel).ToANew<EditGhre_SurveyInput>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (insertModel.StaffIds != null && insertModel.StaffIds.Any()) |
|
|
|
|
insert.StaffId = JsonHelper.ObjToJson(insertModel.StaffIds); |
|
|
|
|
|
|
|
|
|
if (insertModel.DeptIds != null && insertModel.DeptIds.Any()) |
|
|
|
|
insert.DeptId = JsonHelper.ObjToJson(insertModel.DeptIds); |
|
|
|
|
await Update(id, insert, null, ["Status"]); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < insertModel.Questions.Count; i++) |
|
|
|
|