|
|
@ -1,4 +1,5 @@ |
|
|
|
using SqlSugar.Extensions; |
|
|
|
using SqlSugar.Extensions; |
|
|
|
|
|
|
|
using Tiobon.Core.IServices; |
|
|
|
|
|
|
|
|
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
|
|
|
|
|
|
|
@ -614,6 +615,88 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<dynamic> QueryRecord(long id) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
dynamic obj = new ExpandoObject(); |
|
|
|
|
|
|
|
dynamic data = new ExpandoObject(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var entity = await base.QueryById(id); |
|
|
|
|
|
|
|
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(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.Count = await Db.Queryable<Ghre_SurveyRecord>().Where(x => x.SurveyId == id).CountAsync(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var records = await Db.Queryable<Ghre_SurveyRecord>().Where(x => x.SurveyId == id).ToListAsync(); |
|
|
|
|
|
|
|
var recordOptions = await Db.Queryable<Ghre_SurveyRecordOption>().Where(x => x.SurveyId == id).ToListAsync(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region columns |
|
|
|
|
|
|
|
var columns = new JArray(); |
|
|
|
|
|
|
|
var item = new JObject |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new JProperty("Filed", "No"), |
|
|
|
|
|
|
|
new JProperty("Name", "序号"), |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
columns.Add(item); |
|
|
|
|
|
|
|
item = new JObject |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new JProperty("Filed", "StaffName"), |
|
|
|
|
|
|
|
new JProperty("Name", "填写人"), |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
columns.Add(item); |
|
|
|
|
|
|
|
item = new JObject |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new JProperty("Filed", "BeginTime"), |
|
|
|
|
|
|
|
new JProperty("Name", "开始时间"), |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
columns.Add(item); |
|
|
|
|
|
|
|
item = new JObject |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new JProperty("Filed", "SubmitTime"), |
|
|
|
|
|
|
|
new JProperty("Name", "提交时间"), |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
columns.Add(item); |
|
|
|
|
|
|
|
item = new JObject |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new JProperty("Filed", "Duration"), |
|
|
|
|
|
|
|
new JProperty("Name", "提交时长"), |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
columns.Add(item); |
|
|
|
|
|
|
|
int i = 1; |
|
|
|
|
|
|
|
questions.ForEach(x => |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
item = new JObject |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new JProperty("Filed", "Question"+i), |
|
|
|
|
|
|
|
new JProperty("Name", "题目"+i) |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
columns.Add(item); |
|
|
|
|
|
|
|
i++; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
data.Columns = columns; |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 记录 |
|
|
|
|
|
|
|
var Records = new JArray(); |
|
|
|
|
|
|
|
for (int j = 1; j <= records.Count; j++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var record = records[i]; |
|
|
|
|
|
|
|
var StaffName = await Db.Queryable<Ghra_Staff>().Where(x => x.StaffID == record.StaffId).Select(x => x.StaffID).FirstAsync(); |
|
|
|
|
|
|
|
item = new JObject |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new JProperty("No", i), |
|
|
|
|
|
|
|
new JProperty("StaffName", StaffName), |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
columns.Add(item); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
obj.Data = data; |
|
|
|
|
|
|
|
obj.Success = true; |
|
|
|
|
|
|
|
obj.code = "0"; |
|
|
|
|
|
|
|
obj.type = "success"; |
|
|
|
|
|
|
|
obj.message = "查询成功!"; |
|
|
|
|
|
|
|
obj.Status = 200; |
|
|
|
|
|
|
|
return obj; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|