|
@@ -42,6 +42,9 @@ using XF.Utility.EnumExtensions;
|
|
|
using System.Threading;
|
|
|
using Hotline.Caching.Interfaces;
|
|
|
using Hotline.Import;
|
|
|
+using Hotline.Caching.Services;
|
|
|
+using Hotline.Share.Enums.Order;
|
|
|
+using MiniExcelLibs;
|
|
|
|
|
|
namespace Hotline.Api.Controllers
|
|
|
{
|
|
@@ -806,23 +809,23 @@ namespace Hotline.Api.Controllers
|
|
|
[HttpGet("knowledge-status-data")]
|
|
|
public Dictionary<string, dynamic> KnowledgeStatus()
|
|
|
{
|
|
|
- //var tabNames = new List<KeyValuePair<int, string>>
|
|
|
- //{
|
|
|
- // new KeyValuePair<int, string>(3, "已上架"),
|
|
|
- // new KeyValuePair<int, string>(4, "已下架"),
|
|
|
- // new KeyValuePair<int, string>(1, "审核中"),
|
|
|
- // new KeyValuePair<int, string>(8, "草稿"),
|
|
|
- // new KeyValuePair<int, string>(-1, "全部")
|
|
|
- //};
|
|
|
- var tabNames = EnumExts.GetDescriptions<EKnowledgeStatusRequest>();
|
|
|
-
|
|
|
- //var tabNewDraftsNames = new List<KeyValuePair<int, string>>
|
|
|
- //{
|
|
|
- // new KeyValuePair<int, string>(-1, "全部"),
|
|
|
- // new KeyValuePair<int, string>(0, "待提交"),
|
|
|
- // new KeyValuePair<int, string>(5, "审核不通过"),
|
|
|
- //};
|
|
|
- var tabNewDraftsNames = EnumExts.GetDescriptions<EKnowledgeDraftTypeRequest>();
|
|
|
+ var tabNames = new List<KeyValuePair<int, string>>
|
|
|
+ {
|
|
|
+ new KeyValuePair<int, string>(3, "已上架"),
|
|
|
+ new KeyValuePair<int, string>(4, "已下架"),
|
|
|
+ new KeyValuePair<int, string>(1, "审核中"),
|
|
|
+ new KeyValuePair<int, string>(8, "草稿"),
|
|
|
+ new KeyValuePair<int, string>(-1, "全部")
|
|
|
+ };
|
|
|
+ //var tabNames = EnumExts.GetDescriptions<EKnowledgeStatusRequest>();
|
|
|
+
|
|
|
+ var tabNewDraftsNames = new List<KeyValuePair<int, string>>
|
|
|
+ {
|
|
|
+ new KeyValuePair<int, string>(-1, "全部"),
|
|
|
+ new KeyValuePair<int, string>(0, "待提交"),
|
|
|
+ new KeyValuePair<int, string>(5, "审核不通过"),
|
|
|
+ };
|
|
|
+ //var tabNewDraftsNames = EnumExts.GetDescriptions<EKnowledgeDraftTypeRequest>();
|
|
|
|
|
|
|
|
|
var tabAuditingNames = new List<KeyValuePair<string, string>>
|
|
@@ -958,8 +961,8 @@ namespace Hotline.Api.Controllers
|
|
|
/// 下载知识导入模板
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- [HttpGet("dl-kn-template")]
|
|
|
- public async Task<object> DownLoadKnowledgeTemplate()
|
|
|
+ [HttpGet("dl-template")]
|
|
|
+ public object DownLoadKnowledgeTemplate()
|
|
|
{
|
|
|
return _exportApplication.ExportData(new List<KnowledgeImportTemplate>
|
|
|
{
|
|
@@ -967,6 +970,194 @@ namespace Hotline.Api.Controllers
|
|
|
}, "知识模板.xlsx");
|
|
|
}
|
|
|
|
|
|
+ //[HttpPost("import-knowledge")]
|
|
|
+ //public async Task<object> ImportKnowledge(IFormFile file)
|
|
|
+ //{
|
|
|
+ // using (var stream = new MemoryStream())
|
|
|
+ // {
|
|
|
+ // file.CopyTo(stream);
|
|
|
+ // var list = MiniExcel.Query<KnowledgeImportTemplate>(stream).ToList();
|
|
|
+ // int count = 0;
|
|
|
+ // int errorCount = 0;
|
|
|
+ // int addCount = 0;
|
|
|
+ // int modifyCount = 0;
|
|
|
+ // var allowSources = new Dictionary<string, string>
|
|
|
+ // {
|
|
|
+ // { "麻辣社区", "MLSQ" }, { "人民网", "RMW" }, { "省长信箱", "SZXX" }, { "问政四川", "WZSC" }
|
|
|
+ // };
|
|
|
+ // var errorMessage = new StringBuilder();
|
|
|
+ // if (list == null || list.Count == 0)
|
|
|
+ // {
|
|
|
+ // return new { Count = count, ErrorCount = errorCount, AddCount = addCount, ModifyCount = modifyCount, ErrorMessage = "数据为空" };
|
|
|
+ // }
|
|
|
+
|
|
|
+ // count = list.Count;
|
|
|
+ // var i = 0;
|
|
|
+ // foreach (var item in list)
|
|
|
+ // {
|
|
|
+ // i++;
|
|
|
+ // try
|
|
|
+ // {
|
|
|
+ // var validationResult = item.ValidateObject(false);
|
|
|
+ // if (validationResult.NotNullOrEmpty())
|
|
|
+ // {
|
|
|
+ // errorMessage.Append($"第{i + 1}行: {validationResult}\r\n");
|
|
|
+ // errorCount++;
|
|
|
+ // continue;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // var allowSource = allowSources.FirstOrDefault(m => m.Key == item.Source).Value;
|
|
|
+ // if (allowSource.IsNullOrEmpty())
|
|
|
+ // {
|
|
|
+ // errorCount++;
|
|
|
+ // continue;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // var SourceCode = (ESource)Enum.Parse(typeof(ESource), allowSource);
|
|
|
+ // var acceptType = _sysDicDataCacheManager.AcceptType
|
|
|
+ // .FirstOrDefault(m => m.DicDataName == item.AcceptType);
|
|
|
+
|
|
|
+ // if (acceptType == null)
|
|
|
+ // {
|
|
|
+ // errorMessage.Append($"第{i + 1}行: 不能通过受理类型 {item.AcceptType} 查询到对应的受理类型Code\r\n");
|
|
|
+ // continue;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // var order = await _orderRepository.GetAsync(x => x.ExternalId == item.ExternalId && x.Source == SourceCode,
|
|
|
+ // HttpContext.RequestAborted) ?? new Orders.Order();
|
|
|
+ // item.Source = SourceCode.ToString();
|
|
|
+ // order = _mapper.Map(item, order);
|
|
|
+ // order.AcceptTypeCode = acceptType.DicDataValue;
|
|
|
+ // order.SourceChannel = SourceCode.GetDescription();
|
|
|
+ // order.SourceChannelCode = ((int)SourceCode).ToString();
|
|
|
+ // order.Status = EOrderStatus.Visited;
|
|
|
+ // #region 处理数据开始
|
|
|
+
|
|
|
+ // // order.Source = SourceCode; //来源
|
|
|
+
|
|
|
+ // //处理热点
|
|
|
+ // //处理一级热点
|
|
|
+ // string hotspotId = "";
|
|
|
+ // string hotspotName = "";
|
|
|
+ // string hotspotFullName = "";
|
|
|
+ // var hotspotOne = await _hotspotTypeRepository.Queryable()
|
|
|
+ // .FirstAsync(x => x.HotSpotName == item.HotspotNameOne, HttpContext.RequestAborted);
|
|
|
+ // if (hotspotOne != null)
|
|
|
+ // {
|
|
|
+ // hotspotId = hotspotOne.Id;
|
|
|
+ // hotspotName = hotspotOne.HotSpotName;
|
|
|
+ // hotspotFullName = hotspotOne.HotSpotFullName;
|
|
|
+ // var hotspotTwo = await _hotspotTypeRepository.Queryable()
|
|
|
+ // .FirstAsync(x => x.HotSpotName == item.HotspotNameTwo && x.ParentId == hotspotId, HttpContext.RequestAborted);
|
|
|
+ // if (hotspotTwo != null)
|
|
|
+ // {
|
|
|
+ // hotspotId = hotspotTwo.Id;
|
|
|
+ // hotspotName = hotspotTwo.HotSpotName;
|
|
|
+ // hotspotFullName = hotspotTwo.HotSpotFullName;
|
|
|
+ // var hotspotThree = await _hotspotTypeRepository.Queryable()
|
|
|
+ // .FirstAsync(x => x.HotSpotName == item.HotspotNameThree && x.ParentId == hotspotId, HttpContext.RequestAborted);
|
|
|
+ // if (hotspotThree != null)
|
|
|
+ // {
|
|
|
+ // hotspotId = hotspotThree.Id;
|
|
|
+ // hotspotName = hotspotThree.HotSpotName;
|
|
|
+ // hotspotFullName = hotspotThree.HotSpotFullName;
|
|
|
+ // var hotspotFour = await _hotspotTypeRepository.Queryable()
|
|
|
+ // .FirstAsync(x => x.HotSpotName == item.HotspotNameFour && x.ParentId == hotspotId,
|
|
|
+ // HttpContext.RequestAborted);
|
|
|
+ // if (hotspotFour != null)
|
|
|
+ // {
|
|
|
+ // hotspotId = hotspotFour.Id;
|
|
|
+ // hotspotName = hotspotFour.HotSpotName;
|
|
|
+ // hotspotFullName = hotspotFour.HotSpotFullName;
|
|
|
+ // var hotspotFive = await _hotspotTypeRepository.Queryable()
|
|
|
+ // .FirstAsync(x => x.HotSpotName == item.HotspotNameFive && x.ParentId == hotspotId,
|
|
|
+ // HttpContext.RequestAborted);
|
|
|
+ // if (hotspotFive != null)
|
|
|
+ // {
|
|
|
+ // hotspotId = hotspotFive.Id;
|
|
|
+ // hotspotName = hotspotFive.HotSpotName;
|
|
|
+ // hotspotFullName = hotspotFive.HotSpotFullName;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // order.HotspotId = hotspotId;
|
|
|
+ // order.HotspotName = hotspotName;
|
|
|
+ // order.HotspotSpliceName = hotspotFullName;
|
|
|
+
|
|
|
+ // //处理部门
|
|
|
+ // var orgOne = await _organizeRepository.Queryable()
|
|
|
+ // .FirstAsync(x => x.Name == item.OrgLevelOneName, HttpContext.RequestAborted);
|
|
|
+ // if (orgOne != null)
|
|
|
+ // {
|
|
|
+ // order.OrgLevelOneCode = orgOne.Id;
|
|
|
+ // order.OrgLevelOneName = orgOne.Name;
|
|
|
+ // var orgTwo = await _organizeRepository.Queryable()
|
|
|
+ // .FirstAsync(x => x.Name == item.OrgLevelTwoName && x.ParentId == order.OrgLevelOneCode, HttpContext.RequestAborted);
|
|
|
+ // if (orgTwo != null)
|
|
|
+ // {
|
|
|
+ // order.OrgLevelTwoCode = orgTwo.Id;
|
|
|
+ // order.OrgLevelTwoName = orgTwo.Name;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // //承办部门
|
|
|
+ // var ActualHandleOrg = await _organizeRepository.Queryable()
|
|
|
+ // .FirstAsync(x => x.Name == item.ActualHandleOrgName, HttpContext.RequestAborted);
|
|
|
+ // if (ActualHandleOrg != null)
|
|
|
+ // {
|
|
|
+ // order.ActualHandleOrgCode = ActualHandleOrg.Id;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // //处理地址
|
|
|
+ // order.FullAddress = $"{order.Address}{order.Street}";
|
|
|
+
|
|
|
+ // order.FirstVisitResultCode = _sysDicDataCacheManager
|
|
|
+ // .GetSysDicDataCache(SysDicTypeConsts.VisitSatisfaction)
|
|
|
+ // .FirstOrDefault(m => m.DicDataName == item.VisitResult)?.DicDataValue
|
|
|
+ // ?? order.FirstVisitResultCode;
|
|
|
+
|
|
|
+ // #endregion
|
|
|
+
|
|
|
+ // if (order.Id.IsNullOrEmpty())
|
|
|
+ // {
|
|
|
+ // //order.Source = item;
|
|
|
+ // var id = await _orderDomainService.AddAsync(order, false, HttpContext.RequestAborted);
|
|
|
+ // if (!string.IsNullOrEmpty(id))
|
|
|
+ // {
|
|
|
+ // addCount++;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // errorCount++;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // // _mapper.Map(item, order);
|
|
|
+ // await _orderRepository.UpdateAsync(order, HttpContext.RequestAborted);
|
|
|
+ // modifyCount++;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // catch (Exception ex)
|
|
|
+ // {
|
|
|
+ // errorCount++;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // return new
|
|
|
+ // {
|
|
|
+ // Count = count,
|
|
|
+ // ErrorCount = errorCount,
|
|
|
+ // AddCount = addCount,
|
|
|
+ // ModifyCount = modifyCount,
|
|
|
+ // ErrorMessage = errorMessage.ToString()
|
|
|
+ // };
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 我的知识删除列表
|