|
@@ -1,4 +1,4 @@
|
|
|
-using Fw.Utility.UnifyResponse;
|
|
|
+using Hotline.DataSharing;
|
|
|
using Hotline.DataSharing.Order;
|
|
|
using Hotline.DataSharing.Province.Notifications;
|
|
|
using Hotline.DataSharing.WebPortal;
|
|
@@ -11,7 +11,6 @@ using MapsterMapper;
|
|
|
using MediatR;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
-using MongoDB.Driver.Linq;
|
|
|
using Sharing.Share.Dtos.DataSharing.WebPortal;
|
|
|
using SqlSugar;
|
|
|
using XF.Domain.Filters;
|
|
@@ -31,6 +30,7 @@ namespace Hotline.Api.Controllers.DataSharing
|
|
|
private readonly IRepository<DsWebFlowAccept> _webFlowAcceptRepository;
|
|
|
private readonly IRepository<DsWebUserRegister> _webUserRegisterRepository;
|
|
|
private readonly IRepository<DsWebUserAuth> _webUserAuthRepository;
|
|
|
+ private readonly IChannelConfigurationManager _channelConfigurationManager;
|
|
|
|
|
|
/// <summary>
|
|
|
///
|
|
@@ -42,12 +42,14 @@ namespace Hotline.Api.Controllers.DataSharing
|
|
|
/// <param name="webFlowAcceptRepository"></param>
|
|
|
/// <param name="webUserRegisterRepository"></param>
|
|
|
/// <param name="webUserAuthRepository"></param>
|
|
|
+ /// <param name="channelConfigurationManager"></param>
|
|
|
public WebPortalController(IMapper mapper, IMediator mediator,
|
|
|
IRepository<DsBulletin> bulletinRepository,
|
|
|
IRepository<DsOrder> dataOrderRepository,
|
|
|
IRepository<DsWebFlowAccept> webFlowAcceptRepository,
|
|
|
IRepository<DsWebUserRegister> webUserRegisterRepository,
|
|
|
- IRepository<DsWebUserAuth> webUserAuthRepository)
|
|
|
+ IRepository<DsWebUserAuth> webUserAuthRepository,
|
|
|
+ IChannelConfigurationManager channelConfigurationManager)
|
|
|
{
|
|
|
_mapper = mapper;
|
|
|
_mediator = mediator;
|
|
@@ -56,7 +58,7 @@ namespace Hotline.Api.Controllers.DataSharing
|
|
|
_webFlowAcceptRepository = webFlowAcceptRepository;
|
|
|
_webUserRegisterRepository = webUserRegisterRepository;
|
|
|
_webUserAuthRepository = webUserAuthRepository;
|
|
|
-
|
|
|
+ _channelConfigurationManager = channelConfigurationManager;
|
|
|
}
|
|
|
|
|
|
#region 通知
|
|
@@ -72,13 +74,13 @@ namespace Hotline.Api.Controllers.DataSharing
|
|
|
RefAsync<int> total = 0;
|
|
|
var items = await _bulletinRepository.Queryable()
|
|
|
.Where(p => p.LoseEfficacyTime >= DateTime.Now)
|
|
|
- .Where(p => p.PushRanges.Contains(new() { Key = "2", Value = "门户网站" }))
|
|
|
+ // .Where(p => p.PushRanges.Contains(new() { Key = "2", Value = "门户网站" }))
|
|
|
.Where(p => p.BulletinTypeId == dto.NoticeType)
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Condition), p => p.Title.Contains(dto.Condition))
|
|
|
.OrderByDescending(p => p.BulletinTime)
|
|
|
.Select(it => new
|
|
|
{
|
|
|
- Page = SqlFunc.MappingColumn(default(int), " row_number() over( order by 'NoticeCreateDate' desc ) "),
|
|
|
+ Page = SqlFunc.RowNumber($"{it.BulletinTime} desc "),// SqlFunc.MappingColumn(default(int), " row_number() over( order by 'NoticeCreateDate' ) "),
|
|
|
NoticeID = it.Id,
|
|
|
NoticeContent = it.Content,
|
|
|
NoticeTypeName = it.BulletinTypeName,
|
|
@@ -101,36 +103,69 @@ namespace Hotline.Api.Controllers.DataSharing
|
|
|
return OpenResponse.Ok(WebPortalDeResponse<ArticleListDataDto>.Success(dataDto));
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 获取通知公告前几条数据
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [AllowAnonymous]
|
|
|
+ [HttpPost("getarticlelistbynum")]
|
|
|
+ public async Task<OpenResponse> GetArticleListByNum([FromBody] ArticleIdByNumDto dto)
|
|
|
+ {
|
|
|
+ Kv kv = new() { Key = "2", Value = "门户网站" };
|
|
|
+
|
|
|
+ var items = await _bulletinRepository.Queryable()
|
|
|
+ .Where(p => p.LoseEfficacyTime >= DateTime.Now)
|
|
|
+ // .Where(p => p.PushRanges.Contains(new() { Key = "2", Value = "门户网站" }))
|
|
|
+ .Where(p => p.BulletinTypeId == dto.BulletinTypeId)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.CheckChar), p => p.Content.Contains(dto.CheckChar))
|
|
|
+ .OrderByDescending(p => p.BulletinTime)
|
|
|
+ .Select(it => new
|
|
|
+ {
|
|
|
+ DataID = it.Id,
|
|
|
+ Title = it.Title,
|
|
|
+ CreateDate = it.BulletinTime,
|
|
|
+ Content = it.Content
|
|
|
+ })
|
|
|
+ .Take(dto.Num)
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ var data = _mapper.Map<IReadOnlyList<DataListTopDto>>(items);
|
|
|
+ return OpenResponse.Ok(WebPortalDeResponse<IReadOnlyList<DataListTopDto>>.Success(data, "成功"));
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 获取详情,修改阅读次数
|
|
|
/// </summary>
|
|
|
- /// <param name="id"></param>
|
|
|
+ /// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
[AllowAnonymous]
|
|
|
[HttpPost("getarticledetails")]
|
|
|
- public async Task<OpenResponse> GetArticleDetails(string id)
|
|
|
+ public async Task<OpenResponse> GetArticleDetails([FromBody] ArticleIdDto dto)
|
|
|
{
|
|
|
- var data = await _bulletinRepository.GetAsync(p => p.Id == id, HttpContext.RequestAborted);
|
|
|
-
|
|
|
+ var data = await _bulletinRepository.GetAsync(p => p.Id == dto.Id, HttpContext.RequestAborted);
|
|
|
+ ArticleDetailsDto detailsDto = null;
|
|
|
if (data != null)
|
|
|
{
|
|
|
data.ReadedNum = data.ReadedNum++;
|
|
|
await _bulletinRepository.UpdateAsync(data, HttpContext.RequestAborted);
|
|
|
- }
|
|
|
|
|
|
- ArticleDetailsDto detailsDto = new()
|
|
|
- {
|
|
|
- NoticeID = data.Id,
|
|
|
- NoticeTypeName = data.BulletinTypeName,
|
|
|
- NoticeTitle = data.Title,
|
|
|
- NoticeBMName = data.SourceOrgName,
|
|
|
- NoticeCreateDate = data.BulletinTime,
|
|
|
- NoticeRCount = data.ReadedNum,
|
|
|
- WNED_VideoUrl = "",
|
|
|
- NoticeContent = data.Content
|
|
|
- };
|
|
|
-
|
|
|
- return OpenResponse.Ok(WebPortalDeResponse<ArticleDetailsDto>.Success(detailsDto));
|
|
|
+ detailsDto = new()
|
|
|
+ {
|
|
|
+ NoticeID = data.Id,
|
|
|
+ NoticeTypeName = data.BulletinTypeName,
|
|
|
+ NoticeTitle = data.Title,
|
|
|
+ NoticeBMName = data.SourceOrgName,
|
|
|
+ NoticeCreateDate = data.BulletinTime,
|
|
|
+ NoticeRCount = data.ReadedNum,
|
|
|
+ WNED_VideoUrl = "",
|
|
|
+ NoticeContent = data.Content
|
|
|
+ };
|
|
|
+ }
|
|
|
+ else
|
|
|
+ detailsDto = new();
|
|
|
+ List<ArticleDetailsDto> dataDto = new() { detailsDto };
|
|
|
+ return OpenResponse.Ok(WebPortalDeResponse<IReadOnlyList<ArticleDetailsDto>>.Success(dataDto));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -144,10 +179,11 @@ namespace Hotline.Api.Controllers.DataSharing
|
|
|
{
|
|
|
var sugar = _bulletinRepository.Queryable()
|
|
|
.Where(p => p.LoseEfficacyTime >= DateTime.Now)
|
|
|
- .Where(p => p.PushRanges.Contains(new() { Key = "2", Value = "门户网站" }));
|
|
|
+ // .Where(p => p.PushRanges.Contains(new() { Key = "2", Value = "门户网站" }))
|
|
|
+ ;
|
|
|
if (dto.FullSearch == "1")//全文搜索
|
|
|
{
|
|
|
- sugar.Where(p => p.BulletinTypeId == "1" || p.BulletinTypeId == "5" || p.BulletinTypeId == "6" || p.BulletinTypeId == "7" || p.BulletinTypeId == "3")
|
|
|
+ sugar.Where(p => p.BulletinTypeId == "1" || p.BulletinTypeId == "5" || p.BulletinTypeId == "6" || p.BulletinTypeId == "7" || p.BulletinTypeId == "3" || p.BulletinTypeId == "4")
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Condition), p => p.Content.Contains(dto.Condition) || p.Title.Contains(dto.Condition));
|
|
|
}
|
|
|
else//指定分类
|
|
@@ -159,7 +195,7 @@ namespace Hotline.Api.Controllers.DataSharing
|
|
|
var list = await sugar.OrderByDescending(p => p.BulletinTime)
|
|
|
.Select(it => new
|
|
|
{
|
|
|
- Page = SqlFunc.MappingColumn(default(int), " row_number() over( order by 'NoticeCreateDate' desc ) "),
|
|
|
+ Page = SqlFunc.RowNumber($"{it.BulletinTime} desc "),// SqlFunc.MappingColumn(default(int), " row_number() over( order by 'NoticeCreateDate' ) "),
|
|
|
NoticeID = it.Id,
|
|
|
NoticeTitle = it.Title,
|
|
|
NoticeCreateDate = it.BulletinTime
|
|
@@ -216,13 +252,13 @@ namespace Hotline.Api.Controllers.DataSharing
|
|
|
RefAsync<int> total = 0;
|
|
|
var items = await _bulletinRepository.Queryable()
|
|
|
.Where(p => p.LoseEfficacyTime >= DateTime.Now)
|
|
|
- .Where(p => p.PushRanges.Contains(new() { Key = "2", Value = "门户网站" }))
|
|
|
- .Where(p => p.BulletinTypeId == "1" || p.BulletinTypeId == "5" || p.BulletinTypeId == "6" || p.BulletinTypeId == "7" || p.BulletinTypeId == "3")
|
|
|
+ // .Where(p => p.PushRanges.Contains(new() { Key = "2", Value = "门户网站" }))
|
|
|
+ .Where(p => p.BulletinTypeId == "1" || p.BulletinTypeId == "5" || p.BulletinTypeId == "6" || p.BulletinTypeId == "7" || p.BulletinTypeId == "3" || p.BulletinTypeId == "4")
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.Condition), p => p.Title.Contains(dto.Condition))
|
|
|
.OrderByDescending(p => p.BulletinTime)
|
|
|
.Select(it => new
|
|
|
{
|
|
|
- Page = SqlFunc.MappingColumn(default(int), " row_number() over( order by 'NoticeCreateDate' desc ) "),
|
|
|
+ Page = SqlFunc.RowNumber($"{it.BulletinTime} desc "),// SqlFunc.MappingColumn(default(int), " row_number() over( order by 'NoticeCreateDate' ) "),
|
|
|
NoticeID = it.Id,
|
|
|
Content = it.Content,
|
|
|
NoticeTypeID = it.BulletinTypeId,
|
|
@@ -247,12 +283,37 @@ namespace Hotline.Api.Controllers.DataSharing
|
|
|
#endregion
|
|
|
|
|
|
#region 办件
|
|
|
+ /// <summary>
|
|
|
+ /// 获取信件前6条数据
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("getorderlistbynum")]
|
|
|
+ [AllowAnonymous]
|
|
|
+ public async Task<OpenResponse> GetOrderListByNum([FromBody] QueryOrderListByNumDto dto)
|
|
|
+ {
|
|
|
+ var items = await _dataOrderRepository.Queryable()
|
|
|
+ .Where(p => p.IsPublish == EDsPublishState.Open)
|
|
|
+ .Where(p => p.HandleState == "办理完成")
|
|
|
+ .OrderByDescending(p => p.PublishDate)
|
|
|
+ .Select(it => new
|
|
|
+ {
|
|
|
+ DataID = it.OrderId,
|
|
|
+ Title = it.Title,
|
|
|
+ CreateDate = it.PublishDate
|
|
|
+ })
|
|
|
+ .Take(dto.Num)
|
|
|
+ .ToListAsync();
|
|
|
+ var data = _mapper.Map<IReadOnlyList<DataListTopDto>>(items);
|
|
|
+ return OpenResponse.Ok(WebPortalDeResponse<IReadOnlyList<DataListTopDto>>.Success(data, "成功"));
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 办件摘编列表数据
|
|
|
/// </summary>
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
- [HttpPost("GetOrderList")]
|
|
|
+ [HttpPost("getorderlist")]
|
|
|
[AllowAnonymous]
|
|
|
public async Task<OpenResponse> GetOrderList([FromBody] QueryOrderListDto dto)
|
|
|
{
|
|
@@ -285,30 +346,48 @@ namespace Hotline.Api.Controllers.DataSharing
|
|
|
/// <summary>
|
|
|
/// 办件摘编详情
|
|
|
/// </summary>
|
|
|
- /// <param name="id"></param>
|
|
|
+ /// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
[AllowAnonymous]
|
|
|
[HttpPost("getorderdetailbyid")]
|
|
|
- public async Task<OpenResponse> GetOrderDetailById(string id)
|
|
|
+ public async Task<OpenResponse> GetOrderDetailById([FromBody] ArticleIdDto dto)
|
|
|
{
|
|
|
- var data = await _dataOrderRepository.GetAsync(p => p.OrderId == id);
|
|
|
+ var data = await _dataOrderRepository.GetAsync(p => p.OrderId == dto.Id);
|
|
|
|
|
|
var orderDetail = _mapper.Map<OrderDetail>(data);
|
|
|
- return OpenResponse.Ok(WebPortalDeResponse<OrderDetail>.Success(orderDetail));
|
|
|
+ if (data != null)
|
|
|
+ {
|
|
|
+ orderDetail.IsProvinceOrder = data.IsProvince == true ? "1" : "0";
|
|
|
+ switch (data.VisitTypeState)
|
|
|
+ {
|
|
|
+ case EVisitTypeState.UnVisit:
|
|
|
+ orderDetail.VisitType = "0";
|
|
|
+ break;
|
|
|
+ case EVisitTypeState.Visit:
|
|
|
+ orderDetail.VisitType = "1";
|
|
|
+ break;
|
|
|
+ case EVisitTypeState.Reviewed:
|
|
|
+ orderDetail.VisitType = "2";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<OrderDetail> dataDto = new List<OrderDetail>() { orderDetail };
|
|
|
+ return OpenResponse.Ok(WebPortalDeResponse<IReadOnlyList<OrderDetail>>.Success(dataDto));
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据编号和密码查询信件ID
|
|
|
/// </summary>
|
|
|
- /// <param name="OrderNo"></param>
|
|
|
- /// <param name="Pwd"></param>
|
|
|
+ /// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
[AllowAnonymous]
|
|
|
[HttpPost("getorderid")]
|
|
|
- public async Task<OpenResponse> GetOrderId(string OrderNo, string Pwd)
|
|
|
+ public async Task<OpenResponse> GetOrderId([FromBody] GetOrderCodePwd dto)
|
|
|
{
|
|
|
- var data = await _dataOrderRepository.GetAsync(p => p.OrderNo == OrderNo && p.Password == Pwd);
|
|
|
-
|
|
|
+ //var data = await _webFlowAcceptRepository.GetAsync(p => p.Code == dto.OrderNo && p.Pwd == dto.Pwd);
|
|
|
+ var data = await _dataOrderRepository.GetAsync(p => p.OrderNo == dto.OrderNo && p.Password == dto.Pwd);
|
|
|
return OpenResponse.Ok(WebPortalDeResponse<string>.Success(data?.OrderId));
|
|
|
}
|
|
|
|
|
@@ -324,14 +403,20 @@ namespace Hotline.Api.Controllers.DataSharing
|
|
|
var data = _mapper.Map<AddOrderDto>(dto);
|
|
|
data.SourceChannel = "网站";
|
|
|
data.SourceChannelCode = "WZ";
|
|
|
- data.Source = ESource.Hotline;
|
|
|
+ data.Source = ESource.WebPortal;
|
|
|
if (!string.IsNullOrEmpty(data.LicenceNo))
|
|
|
{
|
|
|
data.LicenceTypeCode = "10";
|
|
|
data.LicenceType = "中华人民共和国居民身份证";
|
|
|
}
|
|
|
+ data.ExternalId = Guid.NewGuid().ToString();
|
|
|
var result = await _mediator.Send(new ReceiveOrderNotify { AddOrderDto = data }, HttpContext.RequestAborted);
|
|
|
-
|
|
|
+ //var result = new AddOrderResponse
|
|
|
+ //{
|
|
|
+ // Id = Guid.NewGuid().ToString(),
|
|
|
+ // No = "20231221000009",
|
|
|
+ // Password = "123456"
|
|
|
+ //};
|
|
|
OrderAcceptanceReturnDto returnDto = new();
|
|
|
if (result != null && !string.IsNullOrEmpty(result.Id))
|
|
|
{
|
|
@@ -488,6 +573,70 @@ namespace Hotline.Api.Controllers.DataSharing
|
|
|
else
|
|
|
return OpenResponse.Ok(WebPortalDeResponse<string>.Failed());
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 用户中心用户写信数据
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("getorderbyuserlist")]
|
|
|
+ [AllowAnonymous]
|
|
|
+ public async Task<OpenResponse> GetOrderByUserList([FromBody] QueryOrderListByUserDto dto)
|
|
|
+ {
|
|
|
+ var dataUser = await _webUserAuthRepository.GetAsync(p => p.DataId == dto.UserId, HttpContext.RequestAborted);
|
|
|
+ if (dataUser != null)
|
|
|
+ {
|
|
|
+ RefAsync<int> total = 0;
|
|
|
+ var items = await _webFlowAcceptRepository.Queryable()
|
|
|
+ .LeftJoin<DsOrder>((o, or) => o.OrderId == or.OrderId)
|
|
|
+ .Where(o=>o.WebUserID== dataUser.WebUserID)
|
|
|
+ //重新构建数据
|
|
|
+ .Select((o, or) => new
|
|
|
+ {
|
|
|
+ FlowID = o.OrderId,
|
|
|
+ FlowCode = o.Code,
|
|
|
+ FlowPwd = o.Pwd,
|
|
|
+ FlowTitle = o.Title,
|
|
|
+ FlowFromName = or.CaseSource,
|
|
|
+ FlowPurTypeName = o.PurTypeName,
|
|
|
+ ConTypeName = or.HotspotName,
|
|
|
+ FlowAddDate = o.CreationTime,
|
|
|
+ RSFlagName = or.HandleState,
|
|
|
+ WebUserID=o.WebUserID
|
|
|
+ })
|
|
|
+ //将结果合并成一个表
|
|
|
+ .MergeTable()
|
|
|
+ // .Where(p => p.WebUserID == dataUser.WebUserID)
|
|
|
+ .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
|
|
|
+
|
|
|
+ //计算总页数
|
|
|
+ int nPageCount = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(total) / dto.PageSize));
|
|
|
+ OrderListReturnDto returnDto = new()
|
|
|
+ {
|
|
|
+ PageNum = dto.PageIndex,
|
|
|
+ PageCount = nPageCount,
|
|
|
+ Data = _mapper.Map<IReadOnlyList<OrderListDto>>(items)
|
|
|
+ };
|
|
|
+
|
|
|
+ return OpenResponse.Ok(WebPortalDeResponse<OrderListReturnDto>.Success(returnDto, "成功"));
|
|
|
+ }
|
|
|
+ return OpenResponse.Ok(WebPortalDeResponse<OrderListReturnDto>.Success(new OrderListReturnDto(), "成功"));
|
|
|
+
|
|
|
+ }
|
|
|
#endregion
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 系统主题颜色
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [AllowAnonymous]
|
|
|
+ [HttpPost("getsystemsettingstheme")]
|
|
|
+ public async Task<OpenResponse> GetSystemSettingsTheme()
|
|
|
+ {
|
|
|
+ var data = _channelConfigurationManager.GetConfigurationWebPortal();
|
|
|
+ return OpenResponse.Ok(WebPortalDeResponse<string>.Success(data.SystemSettingsTheme));
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|