|
@@ -376,7 +376,7 @@ namespace Hotline.Repository.SqlSugar.Orders
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
public async Task<DataTable> OrderHotspotTimeExport(TimeSharingPagedKeywordRequest dto)
|
|
|
- {
|
|
|
+ {
|
|
|
List<int> dts = new();
|
|
|
for (int i = 0; i < 24; i++)
|
|
|
{
|
|
@@ -429,7 +429,7 @@ namespace Hotline.Repository.SqlSugar.Orders
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
public async Task<object> OrderAcceptanceTime(TimeSharingPagedKeywordRequest dto)
|
|
|
- {
|
|
|
+ {
|
|
|
List<int> dts = new List<int>();
|
|
|
for (int i = 0; i < 24; i++)
|
|
|
{
|
|
@@ -450,7 +450,7 @@ namespace Hotline.Repository.SqlSugar.Orders
|
|
|
|
|
|
var listOrg = Db.Queryable<SystemDicData>()
|
|
|
.LeftJoin(listOrder, (s, p) => s.DicDataValue == p.AcceptTypeCode)
|
|
|
- .Where((s, p) => s.DicTypeCode == "AcceptType")
|
|
|
+ .Where((s, p) => s.DicTypeCode == "AcceptType")
|
|
|
.GroupBy((s, p) => s.DicDataValue).GroupBy((s, p) => s.DicDataName)
|
|
|
.GroupBy((s, p) => p.Hour)
|
|
|
.OrderBy((s, p) => s.DicDataValue)
|
|
@@ -464,34 +464,34 @@ namespace Hotline.Repository.SqlSugar.Orders
|
|
|
.MergeTable();
|
|
|
|
|
|
var list = await listHour.LeftJoin(listOrg, (x, p) => x.ColumnName.ToString() == p.Hour)
|
|
|
- //.Where((x,p)=> !string.IsNullOrEmpty(p.DicDataValue))
|
|
|
- .OrderBy((x,p) => x.ColumnName )
|
|
|
+ //.Where((x,p)=> !string.IsNullOrEmpty(p.DicDataValue))
|
|
|
+ .OrderBy((x, p) => x.ColumnName)
|
|
|
.Select((x, p) => new
|
|
|
{
|
|
|
Hour = x.ColumnName.ToString() + ":00 - " + x.ColumnName.ToString() + ":59",
|
|
|
p.DicDataValue,
|
|
|
p.count
|
|
|
})
|
|
|
- .MergeTable()
|
|
|
- .ToPivotTableAsync(p => p.DicDataValue, p => p.Hour, p => p.Sum(x => x.count));
|
|
|
+ .MergeTable()
|
|
|
+ .ToPivotTableAsync(p => p.DicDataValue, p => p.Hour, p => p.Sum(x => x.count));
|
|
|
|
|
|
var col = list.Columns.Contains("Column1");
|
|
|
if (col)
|
|
|
{
|
|
|
- list.Columns.Remove("Column1");
|
|
|
- }
|
|
|
+ list.Columns.Remove("Column1");
|
|
|
+ }
|
|
|
var dtList = list.Clone();
|
|
|
|
|
|
- if (await Db.Queryable<StatisticsPurTypeSatisfied>().Where(x => x.Time >= dto.StartTime && x.Time <= dto.EndTime).AnyAsync())
|
|
|
+ if (await Db.Queryable<StatisticsPurTypeSatisfied>().Where(x => x.Time >= dto.StartTime && x.Time <= dto.EndTime).AnyAsync())
|
|
|
{
|
|
|
- // 老系统数据
|
|
|
- var oldData = await Db.Queryable<StatisticsPurTypeSatisfied>()
|
|
|
+ // 老系统数据
|
|
|
+ var oldData = await Db.Queryable<StatisticsPurTypeSatisfied>()
|
|
|
.Where(x => x.Time >= dto.StartTime && x.Time <= dto.EndTime)
|
|
|
.GroupBy(x => x.Month)
|
|
|
.Select(x => new
|
|
|
{
|
|
|
- Hour = x.Month.ToString() + ":00 - " + x.Month.ToString() + ":59",
|
|
|
- _1 = SqlFunc.AggregateSum(x.Opinion),
|
|
|
+ Hour = x.Month.ToString() + ":00 - " + x.Month.ToString() + ":59",
|
|
|
+ _1 = SqlFunc.AggregateSum(x.Opinion),
|
|
|
_2 = SqlFunc.AggregateSum(x.PeopleHelp),
|
|
|
_3 = SqlFunc.AggregateSum(x.PollutionReporting),
|
|
|
_10 = SqlFunc.AggregateSum(x.Consult),
|
|
@@ -505,62 +505,62 @@ namespace Hotline.Repository.SqlSugar.Orders
|
|
|
_SB = SqlFunc.AggregateSum(x.Declare),
|
|
|
}).ToDataTableAsync();
|
|
|
|
|
|
- #region 处理数据
|
|
|
-
|
|
|
- foreach (DataColumn column in dtList.Columns)
|
|
|
- {
|
|
|
- if (column.ColumnName != "Hour") column.DataType = typeof(Int64);
|
|
|
- }
|
|
|
-
|
|
|
- for (int i = 0; i < list.Rows.Count; i++)
|
|
|
- {
|
|
|
- DataRow newRow = dtList.NewRow();
|
|
|
- for (int j = 0; j < list.Columns.Count; j++)
|
|
|
- {
|
|
|
- if (oldData.Columns[j].ColumnName == "Hour")
|
|
|
- {
|
|
|
- newRow[j] = list.Rows[i][j];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- var num = string.IsNullOrEmpty(list.Rows[i][j].ToString()) ? 0 : int.Parse(list.Rows[i][j].ToString());
|
|
|
- var oldRow = oldData.Select("Hour ='" + list.Rows[i]["Hour"] + "'").FirstOrDefault();
|
|
|
+ #region 处理数据
|
|
|
+
|
|
|
+ foreach (DataColumn column in dtList.Columns)
|
|
|
+ {
|
|
|
+ if (column.ColumnName != "Hour") column.DataType = typeof(Int64);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < list.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ DataRow newRow = dtList.NewRow();
|
|
|
+ for (int j = 0; j < list.Columns.Count; j++)
|
|
|
+ {
|
|
|
+ if (oldData.Columns[j].ColumnName == "Hour")
|
|
|
+ {
|
|
|
+ newRow[j] = list.Rows[i][j];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var num = string.IsNullOrEmpty(list.Rows[i][j].ToString()) ? 0 : int.Parse(list.Rows[i][j].ToString());
|
|
|
+ var oldRow = oldData.Select("Hour ='" + list.Rows[i]["Hour"] + "'").FirstOrDefault();
|
|
|
var oldColName = "_" + dtList.Columns[j].ColumnName;
|
|
|
var allNum = oldRow == null ? num : oldRow.Field<Int64>(oldColName) + num;
|
|
|
- newRow[j] = allNum;
|
|
|
- }
|
|
|
- }
|
|
|
- dtList.Rows.Add(newRow);
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
- }
|
|
|
- return ToDynamicList(dtList);
|
|
|
+ newRow[j] = allNum;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dtList.Rows.Add(newRow);
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+ return ToDynamicList(dtList);
|
|
|
}
|
|
|
- public static List<dynamic> ToDynamicList( DataTable dt)
|
|
|
- {
|
|
|
- List<dynamic> dynamicList = new List<dynamic>();
|
|
|
-
|
|
|
- foreach (DataRow row in dt.Rows)
|
|
|
- {
|
|
|
- dynamic dynamicObj = new ExpandoObject();
|
|
|
- var expandoDict = (IDictionary<string, object>)dynamicObj;
|
|
|
- foreach (DataColumn column in dt.Columns)
|
|
|
- {
|
|
|
- expandoDict[column.ColumnName] = row[column];
|
|
|
- }
|
|
|
- dynamicList.Add(dynamicObj);
|
|
|
- }
|
|
|
-
|
|
|
- return dynamicList;
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 受理类型分时统计---导出
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- public async Task<DataTable> OrderAcceptanceTimeExport(TimeSharingPagedKeywordRequest dto, List<Kv> title)
|
|
|
+ public static List<dynamic> ToDynamicList(DataTable dt)
|
|
|
+ {
|
|
|
+ List<dynamic> dynamicList = new List<dynamic>();
|
|
|
+
|
|
|
+ foreach (DataRow row in dt.Rows)
|
|
|
+ {
|
|
|
+ dynamic dynamicObj = new ExpandoObject();
|
|
|
+ var expandoDict = (IDictionary<string, object>)dynamicObj;
|
|
|
+ foreach (DataColumn column in dt.Columns)
|
|
|
+ {
|
|
|
+ expandoDict[column.ColumnName] = row[column];
|
|
|
+ }
|
|
|
+ dynamicList.Add(dynamicObj);
|
|
|
+ }
|
|
|
+
|
|
|
+ return dynamicList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 受理类型分时统计---导出
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<DataTable> OrderAcceptanceTimeExport(TimeSharingPagedKeywordRequest dto, List<Kv> title)
|
|
|
{
|
|
|
List<int> dts = new();
|
|
|
for (int i = 0; i < 24; i++)
|
|
@@ -604,71 +604,71 @@ namespace Hotline.Repository.SqlSugar.Orders
|
|
|
p.count
|
|
|
})
|
|
|
.ToPivotTableAsync(p => p.DicDataName, p => p.Hour, p => p.Sum(x => x.count));
|
|
|
- var dtList = list.Clone();
|
|
|
-
|
|
|
- if (await Db.Queryable<StatisticsPurTypeSatisfied>().Where(x => x.Time >= dto.StartTime && x.Time <= dto.EndTime).AnyAsync())
|
|
|
- {
|
|
|
- // 老系统数据
|
|
|
- var oldData = await Db.Queryable<StatisticsPurTypeSatisfied>()
|
|
|
- .Where(x => x.Time >= dto.StartTime && x.Time <= dto.EndTime)
|
|
|
- .GroupBy(x => x.Month)
|
|
|
- .Select(x => new
|
|
|
- {
|
|
|
- Hour = x.Month.ToString() + ":00 - " + x.Month.ToString() + ":59",
|
|
|
- _1 = SqlFunc.AggregateSum(x.Opinion),
|
|
|
- _2 = SqlFunc.AggregateSum(x.PeopleHelp),
|
|
|
- _3 = SqlFunc.AggregateSum(x.PollutionReporting),
|
|
|
- _10 = SqlFunc.AggregateSum(x.Consult),
|
|
|
- _15 = SqlFunc.AggregateSum(x.Suggest),
|
|
|
- _20 = SqlFunc.AggregateSum(x.SeekHelp),
|
|
|
- _25 = SqlFunc.AggregateSum(x.Praise),
|
|
|
- _30 = SqlFunc.AggregateSum(x.Report),
|
|
|
- _35 = SqlFunc.AggregateSum(x.Complaint),
|
|
|
- _40 = SqlFunc.AggregateSum(x.Rests) + SqlFunc.AggregateSum(x.Invalid),
|
|
|
- _50 = SqlFunc.AggregateSum(x.Epidemic),
|
|
|
- _SB = SqlFunc.AggregateSum(x.Declare),
|
|
|
- }).ToDataTableAsync();
|
|
|
-
|
|
|
- #region 处理数据
|
|
|
-
|
|
|
- foreach (var item in title)
|
|
|
- {
|
|
|
- var isColumn = oldData.Columns.Contains("_"+item.Key);
|
|
|
- if (isColumn)
|
|
|
- {
|
|
|
- oldData.Columns["_" + item.Key].ColumnName = item.Value;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- foreach (DataColumn col in dtList.Columns)
|
|
|
- {
|
|
|
- if (col.ColumnName != "Hour") col.DataType = typeof(Int64);
|
|
|
- }
|
|
|
-
|
|
|
- for (int i = 0; i < list.Rows.Count; i++)
|
|
|
- {
|
|
|
- DataRow newRow = dtList.NewRow();
|
|
|
- for (int j = 0; j < list.Columns.Count; j++)
|
|
|
- {
|
|
|
- if (oldData.Columns[j].ColumnName == "Hour")
|
|
|
- {
|
|
|
- newRow[j] = list.Rows[i][j];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- var num = string.IsNullOrEmpty(list.Rows[i][j].ToString()) ? 0 : int.Parse(list.Rows[i][j].ToString());
|
|
|
- var oldRow = oldData.Select("Hour ='"+ list.Rows[i]["Hour"] + "'").FirstOrDefault();
|
|
|
- //var oldColName = "_" + dtList.Columns[j].ColumnName;
|
|
|
- var allNum = oldRow == null ? num : oldRow.Field<Int64>(dtList.Columns[j].ColumnName) + num;
|
|
|
- newRow[j] = allNum;
|
|
|
- }
|
|
|
- }
|
|
|
- dtList.Rows.Add(newRow);
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
- }
|
|
|
- return InitDatatTable(dtList, dto.AddColumnName);
|
|
|
+ var dtList = list.Clone();
|
|
|
+
|
|
|
+ if (await Db.Queryable<StatisticsPurTypeSatisfied>().Where(x => x.Time >= dto.StartTime && x.Time <= dto.EndTime).AnyAsync())
|
|
|
+ {
|
|
|
+ // 老系统数据
|
|
|
+ var oldData = await Db.Queryable<StatisticsPurTypeSatisfied>()
|
|
|
+ .Where(x => x.Time >= dto.StartTime && x.Time <= dto.EndTime)
|
|
|
+ .GroupBy(x => x.Month)
|
|
|
+ .Select(x => new
|
|
|
+ {
|
|
|
+ Hour = x.Month.ToString() + ":00 - " + x.Month.ToString() + ":59",
|
|
|
+ _1 = SqlFunc.AggregateSum(x.Opinion),
|
|
|
+ _2 = SqlFunc.AggregateSum(x.PeopleHelp),
|
|
|
+ _3 = SqlFunc.AggregateSum(x.PollutionReporting),
|
|
|
+ _10 = SqlFunc.AggregateSum(x.Consult),
|
|
|
+ _15 = SqlFunc.AggregateSum(x.Suggest),
|
|
|
+ _20 = SqlFunc.AggregateSum(x.SeekHelp),
|
|
|
+ _25 = SqlFunc.AggregateSum(x.Praise),
|
|
|
+ _30 = SqlFunc.AggregateSum(x.Report),
|
|
|
+ _35 = SqlFunc.AggregateSum(x.Complaint),
|
|
|
+ _40 = SqlFunc.AggregateSum(x.Rests) + SqlFunc.AggregateSum(x.Invalid),
|
|
|
+ _50 = SqlFunc.AggregateSum(x.Epidemic),
|
|
|
+ _SB = SqlFunc.AggregateSum(x.Declare),
|
|
|
+ }).ToDataTableAsync();
|
|
|
+
|
|
|
+ #region 处理数据
|
|
|
+
|
|
|
+ foreach (var item in title)
|
|
|
+ {
|
|
|
+ var isColumn = oldData.Columns.Contains("_" + item.Key);
|
|
|
+ if (isColumn)
|
|
|
+ {
|
|
|
+ oldData.Columns["_" + item.Key].ColumnName = item.Value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (DataColumn col in dtList.Columns)
|
|
|
+ {
|
|
|
+ if (col.ColumnName != "Hour") col.DataType = typeof(Int64);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < list.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ DataRow newRow = dtList.NewRow();
|
|
|
+ for (int j = 0; j < list.Columns.Count; j++)
|
|
|
+ {
|
|
|
+ if (oldData.Columns[j].ColumnName == "Hour")
|
|
|
+ {
|
|
|
+ newRow[j] = list.Rows[i][j];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var num = string.IsNullOrEmpty(list.Rows[i][j].ToString()) ? 0 : int.Parse(list.Rows[i][j].ToString());
|
|
|
+ var oldRow = oldData.Select("Hour ='" + list.Rows[i]["Hour"] + "'").FirstOrDefault();
|
|
|
+ //var oldColName = "_" + dtList.Columns[j].ColumnName;
|
|
|
+ var allNum = oldRow == null ? num : oldRow.Field<Int64>(dtList.Columns[j].ColumnName) + num;
|
|
|
+ newRow[j] = allNum;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dtList.Rows.Add(newRow);
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+ return InitDatatTable(dtList, dto.AddColumnName);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -1471,9 +1471,9 @@ namespace Hotline.Repository.SqlSugar.Orders
|
|
|
{
|
|
|
bool IsCenter = _sessionContext.OrgIsCenter;
|
|
|
if (IsCenter == false && string.IsNullOrEmpty(dto.PickOrgCode))
|
|
|
- dto.PickOrgCode = _sessionContext.RequiredOrgId;
|
|
|
+ dto.PickOrgCode = _sessionContext.RequiredOrgId;
|
|
|
|
|
|
- return _orderVisitDetailRepository.Queryable()
|
|
|
+ return _orderVisitDetailRepository.Queryable()
|
|
|
.Includes(x => x.OrderVisit, o => o.Order, d => d.CallRecord)
|
|
|
.Where(x => x.OrderVisit.VisitTime >= dto.StartTime && x.OrderVisit.VisitTime <= dto.EndTime && x.VisitTarget == EVisitTarget.Org && x.OrderVisit.VisitState == EVisitState.Visited)
|
|
|
.WhereIF(dto.OrgCode == "001", x => x.VisitOrgCode == dto.OrgCode)
|
|
@@ -1485,8 +1485,8 @@ namespace Hotline.Repository.SqlSugar.Orders
|
|
|
//.WhereIF(IsCenter == true && dto.IsOnlyMy == null, x => x.VisitOrgCode.StartsWith(dto.OrgCode))
|
|
|
//.WhereIF(IsCenter == true , x=> x.VisitOrgCode.StartsWith(dto.OrgCode))
|
|
|
//.WhereIF(IsCenter == false, x => x.VisitOrgCode == dto.OrgCode)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) && (string.IsNullOrEmpty(dto.PickOrgCode) || dto.OrgCode != dto.PickOrgCode), x => x.VisitOrgCode.StartsWith(dto.OrgCode))
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) && (!string.IsNullOrEmpty(dto.PickOrgCode) && dto.PickOrgCode == dto.OrgCode) ,x=>x.VisitOrgCode == dto.OrgCode)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) && (string.IsNullOrEmpty(dto.PickOrgCode) || dto.OrgCode != dto.PickOrgCode), x => x.VisitOrgCode.StartsWith(dto.OrgCode))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.OrgCode) && (!string.IsNullOrEmpty(dto.PickOrgCode) && dto.PickOrgCode == dto.OrgCode), x => x.VisitOrgCode == dto.OrgCode)
|
|
|
.WhereIF(dto.TypeId is 1, x => SqlFunc.JsonField(x.OrgProcessingResults, "Key") == dto.DateValue)
|
|
|
.WhereIF(dto.TypeId is 2, x => SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == dto.DateValue)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.LineNum), x => x.OrderVisit.Order.CallRecord.Gateway == dto.LineNum)
|
|
@@ -1542,7 +1542,12 @@ namespace Hotline.Repository.SqlSugar.Orders
|
|
|
.WhereIF(dto.OrgVisitStatisticsType.HasValue, x => x.OrderVisit.Order.ProcessType == (EProcessType)((int)dto.OrgVisitStatisticsType))
|
|
|
.WhereIF(dto.Keyword.NotNullOrEmpty(), x => x.OrderVisit.Order.Title.Contains(dto.Keyword)) // 根据关键字匹配
|
|
|
.WhereIF(dto.TypeCode != 0, x => x.OrderVisit.Order.IdentityType == (EIdentityType)dto.TypeCode)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.OrgProcessingResults), dto.AttitudeType == EAttitudeType.ProcessingResult ? x => SqlFunc.JsonField(x.OrgProcessingResults, "Key") == dto.OrgProcessingResults : x => SqlFunc.JsonField(x.OrgHandledAttitude, "Key") == dto.OrgProcessingResults)
|
|
|
+ //任务 218 市州通用-部门满意度明细:办件结果查询优化为多选
|
|
|
+ .WhereIF(dto.OrgProcessingResults != null && dto.OrgProcessingResults.Any() && dto.AttitudeType == EAttitudeType.ProcessingResult,
|
|
|
+ x => dto.OrgProcessingResults.Contains(SqlFunc.JsonField(x.OrgProcessingResults, "Key")))
|
|
|
+ .WhereIF(dto.OrgProcessingResults != null && dto.OrgProcessingResults.Any() && dto.AttitudeType == EAttitudeType.WorkAttitude,
|
|
|
+ x => dto.OrgProcessingResults.Contains(SqlFunc.JsonField(x.OrgHandledAttitude, "Key")))
|
|
|
+
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.VisitUser), x => x.OrderVisit.Employee.Name.Contains(dto.VisitUser))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.No), x => x.OrderVisit.Order.No == dto.No)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Title), x => x.OrderVisit.Order.Title.Contains(dto.Title))
|