|
@@ -0,0 +1,240 @@
|
|
|
+using DataSharing.Common;
|
|
|
+using DataSharing.ConvergenceMedia;
|
|
|
+using DataSharing.FwDataExchange;
|
|
|
+using DataSharing.RawData;
|
|
|
+using DataSharing.Share.Dtos;
|
|
|
+using DataSharing.Share.Dtos.Common;
|
|
|
+using DataSharing.Share.Dtos.ConvergenceMedia;
|
|
|
+using DataSharing.Share.Dtos.HotlineSetting;
|
|
|
+using DataSharing.Share.Dtos.OtherPlatformsYB;
|
|
|
+using DotNetCore.CAP;
|
|
|
+using MapsterMapper;
|
|
|
+using MediatR;
|
|
|
+using Microsoft.AspNetCore.Authorization;
|
|
|
+using Microsoft.AspNetCore.Mvc;
|
|
|
+using XF.Domain.Filters;
|
|
|
+using XF.Domain.Repository;
|
|
|
+
|
|
|
+namespace DataSharing.Host.Controllers
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// 网络理政
|
|
|
+ /// </summary>
|
|
|
+ public class WllzYBController : BaseDataController
|
|
|
+ {
|
|
|
+ private readonly IMapper _mapper;
|
|
|
+ private readonly IMediator _mediator;
|
|
|
+ private readonly ICapPublisher _capPublisher;
|
|
|
+ private readonly IRepository<DsOrder> _dataOrderRepository;
|
|
|
+ private readonly IRepository<DsReceiveMediaData> _dsReceiveMediaDataRepository;
|
|
|
+ private readonly IRepository<DsUserTokenInfo> _dsUserTokenInfoRepository;
|
|
|
+ private readonly FwClient _fwClient;
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ ///
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="mapper"></param>
|
|
|
+ /// <param name="mediator"></param>
|
|
|
+ /// <param name="capPublisher"></param>
|
|
|
+ /// <param name="dataOrderRepository"></param>
|
|
|
+ /// <param name="dsReceiveMediaDataRepository"></param>
|
|
|
+ /// <param name="dsUserTokenInfoRepository"></param>
|
|
|
+ /// <param name="fwClient"></param>
|
|
|
+ public WllzYBController(IMapper mapper, IMediator mediator,
|
|
|
+ ICapPublisher capPublisher,
|
|
|
+ IRepository<DsOrder> dataOrderRepository,
|
|
|
+ IRepository<DsReceiveMediaData> dsReceiveMediaDataRepository,
|
|
|
+ IRepository<DsUserTokenInfo> dsUserTokenInfoRepository,
|
|
|
+ FwClient fwClient)
|
|
|
+ {
|
|
|
+ _mapper = mapper;
|
|
|
+ _mediator = mediator;
|
|
|
+ _capPublisher = capPublisher;
|
|
|
+ _dataOrderRepository = dataOrderRepository;
|
|
|
+ _dsReceiveMediaDataRepository = dsReceiveMediaDataRepository;
|
|
|
+ _dsUserTokenInfoRepository = dsUserTokenInfoRepository;
|
|
|
+ _fwClient = fwClient;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 1.3.1查询受理类型
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="strVailCode"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("e_GetTypeID")]
|
|
|
+ [AllowAnonymous]
|
|
|
+ public async Task<OpenResponse> GetAcceptType([FromForm] string strVailCode)
|
|
|
+ {
|
|
|
+ var accountDto = await CheckAccountAsync(strVailCode);
|
|
|
+ if (accountDto is null || accountDto.IsCheckAccount == false)
|
|
|
+ return OpenResponse.Ok(OtherPlatformsDeResponse<string>.Failed("密钥错误", "-900"));
|
|
|
+ List<AcceptTypeListDto> acceptTypeListDtos = new()
|
|
|
+ {
|
|
|
+ new() { Name = "咨询", Value = "10" },
|
|
|
+ new() { Name = "建议", Value = "15" },
|
|
|
+ new() { Name = "求助", Value = "20" },
|
|
|
+ new() { Name = "表扬", Value = "25" },
|
|
|
+ new() { Name = "举报", Value = "30" },
|
|
|
+ new() { Name = "投诉", Value = "35" },
|
|
|
+ new() { Name = "其他", Value = "40" },
|
|
|
+ new() { Name = "意见", Value = "1" },
|
|
|
+ new() { Name = "惠民帮助", Value = "2" },
|
|
|
+ new() { Name = "大气污染举报", Value = "3" }
|
|
|
+ };
|
|
|
+
|
|
|
+ return OpenResponse.Ok(OtherPlatformsDeResponse<List<AcceptTypeListDto>>.Success(acceptTypeListDtos));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ ///1.3.2网上写信
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("e_WriteInfo")]
|
|
|
+ [AllowAnonymous]
|
|
|
+ public async Task<OpenResponse> WriteInfo([FromForm] AddWriteInfoDto dto)
|
|
|
+ {
|
|
|
+ var accountDto = await CheckAccountAsync(dto.strVailCode);
|
|
|
+ if (accountDto is null || accountDto.IsCheckAccount == false)
|
|
|
+ return OpenResponse.Ok(OtherPlatformsDeResponse<string>.Failed("密钥错误", "-900"));
|
|
|
+
|
|
|
+ //验证数据
|
|
|
+ string strResult = dto.Validate();
|
|
|
+ if (!string.IsNullOrEmpty(strResult))
|
|
|
+ return OpenResponse.Ok(OtherPlatformsDeResponse<string>.Failed(strResult, "0"));
|
|
|
+
|
|
|
+ //写入原始数据
|
|
|
+ DsReceiveMediaData dsReceiveMediaData = new()
|
|
|
+ {
|
|
|
+ ServiceInterface = "e_WriteInfo",
|
|
|
+ PlatformsName = accountDto.PlatformSource,
|
|
|
+ // ExternalId = dto.strZZCode,
|
|
|
+ ReceiveData = System.Text.Json.JsonSerializer.Serialize(dto)
|
|
|
+ };
|
|
|
+ dsReceiveMediaData.Id = await _dsReceiveMediaDataRepository.AddAsync(dsReceiveMediaData, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ Hotline.Share.Dtos.Order.AddOrderDto data = new()
|
|
|
+ {
|
|
|
+ Title = dto.strTitle,
|
|
|
+ FromName = dto.strUserName,
|
|
|
+ Contact = dto.strPhone,
|
|
|
+ FullAddress = dto.strAddress,
|
|
|
+ Content = dto.strContent,
|
|
|
+ IsSecret = false,
|
|
|
+ AcceptTypeCode = dto.strTypeID,
|
|
|
+ Source = (Hotline.Share.Enums.Order.ESource)Enum.Parse(typeof(Hotline.Share.Enums.Order.ESource), accountDto.PlatformSource),
|
|
|
+ FromGender = dto.strGender switch
|
|
|
+ {
|
|
|
+ "1" => Hotline.Share.Enums.Order.EGender.Male,
|
|
|
+ "2" => Hotline.Share.Enums.Order.EGender.Female,
|
|
|
+ _ => Hotline.Share.Enums.Order.EGender.Unknown,
|
|
|
+ },
|
|
|
+ IdentityType = Hotline.Share.Enums.Order.EIdentityType.Citizen,
|
|
|
+ Transpond = false,
|
|
|
+ IsEnforcementOrder = false,
|
|
|
+ SourceChannel = "网络理政—市民中心大厅",
|
|
|
+ SourceChannelCode = "WLLZ"
|
|
|
+ };
|
|
|
+
|
|
|
+ //调用工单创建接口
|
|
|
+ var result = await _fwClient.RequestNoTokenAsync<HotlineClientResponse>("api/v1/Order/add-anonymous", "Post", System.Text.Json.JsonSerializer.Serialize(data));
|
|
|
+ if (result != null && result.code == 0)
|
|
|
+ {
|
|
|
+ dsReceiveMediaData.ExternalId = result.result.id;
|
|
|
+ dsReceiveMediaData.OrderCode = result.result.no;
|
|
|
+ await _dsReceiveMediaDataRepository.UpdateAsync(dsReceiveMediaData, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ List<WriteInfoReturnDto> returnData = new()
|
|
|
+ {
|
|
|
+ new WriteInfoReturnDto() { LetterCode = result.result.no, LetterPwd = result.result.password }
|
|
|
+ };
|
|
|
+ return OpenResponse.Ok(OtherPlatformsDeResponse<List<WriteInfoReturnDto>>.Success(returnData));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ return OpenResponse.Ok(OtherPlatformsDeResponse<string>.Failed("接口调用失败!", "0"));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 1.3.3办件结果查询
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("e_OrderInfo")]
|
|
|
+ [AllowAnonymous]
|
|
|
+ public async Task<OpenResponse> GetFlowInfo([FromForm] WllzGetOrderInfo dto)
|
|
|
+ {
|
|
|
+ var accountDto = await CheckAccountAsync(dto.strVailCode);
|
|
|
+ if (accountDto is null || accountDto.IsCheckAccount == false)
|
|
|
+ return OpenResponse.Ok(OtherPlatformsDeResponse<string>.Failed("密钥错误", "-900"));
|
|
|
+
|
|
|
+ //验证数据
|
|
|
+ string strResult = dto.Validate();
|
|
|
+ if (!string.IsNullOrEmpty(strResult))
|
|
|
+ return OpenResponse.Ok(OtherPlatformsDeResponse<string>.Failed(strResult, "0"));
|
|
|
+
|
|
|
+ //写入原始数据
|
|
|
+ DsReceiveMediaData dsReceiveMediaData = new()
|
|
|
+ {
|
|
|
+ ServiceInterface = "e_WriteResult",
|
|
|
+ PlatformsName = accountDto.PlatformSource,
|
|
|
+ ReceiveData = System.Text.Json.JsonSerializer.Serialize(dto),
|
|
|
+ OrderCode = dto.strCodes,
|
|
|
+ };
|
|
|
+ await _dsReceiveMediaDataRepository.AddAsync(dsReceiveMediaData, HttpContext.RequestAborted);
|
|
|
+
|
|
|
+ string[] arrCode = dto.strCodes.Split(',');
|
|
|
+ if (arrCode == null || arrCode.Length == 0)
|
|
|
+ return OpenResponse.Ok(OtherPlatformsDeResponse<string>.Failed("工单编号错误", "0"));
|
|
|
+
|
|
|
+ List<WllzOrderInfoReturnDto> returnDtos = new();
|
|
|
+ foreach (var item in arrCode)
|
|
|
+ {
|
|
|
+ var itemOrder = await _dataOrderRepository.GetAsync(p => p.OrderNo == item, HttpContext.RequestAborted);
|
|
|
+ if (itemOrder != null)
|
|
|
+ {
|
|
|
+ returnDtos.Add(new()
|
|
|
+ {
|
|
|
+ Code = itemOrder.OrderNo,
|
|
|
+ State = itemOrder.HandleState,
|
|
|
+ Ccontent = itemOrder.ActualOpinion,
|
|
|
+ AcceptName = itemOrder.ActualHandleOrgName,
|
|
|
+ AcceptDate = itemOrder.ActualHandleTime != null ? itemOrder.ActualHandleTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ returnDtos.Add(new()
|
|
|
+ {
|
|
|
+ Code = item,
|
|
|
+ State = "受理中",
|
|
|
+ Ccontent = "",
|
|
|
+ AcceptName = "热线中心",
|
|
|
+ AcceptDate = ""
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return OpenResponse.Ok(OtherPlatformsDeResponse<List<WllzOrderInfoReturnDto>>.Success(returnDtos));
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 验证密钥
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="Code"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private async Task<CheckAccountDto> CheckAccountAsync(string Code)
|
|
|
+ {
|
|
|
+ CheckAccountDto accountDto = new() { IsCheckAccount = false };
|
|
|
+ var data = await _dsUserTokenInfoRepository.GetAsync(p => p.AccountId == Code && p.State == "1", HttpContext.RequestAborted);
|
|
|
+ if (data is not null)
|
|
|
+ {
|
|
|
+ accountDto.PlatformSource = data.PlatformSource;
|
|
|
+ accountDto.IsCheckAccount = true;
|
|
|
+ return accountDto;
|
|
|
+ }
|
|
|
+
|
|
|
+ accountDto.Message = "授权账号或密码验证不通过";
|
|
|
+ return accountDto;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|