|
@@ -9,6 +9,7 @@ using Microsoft.Extensions.Logging;
|
|
|
using System.Security.Cryptography;
|
|
|
using System.Text;
|
|
|
using System.Text.Json;
|
|
|
+using XF.Domain.Exceptions;
|
|
|
using XF.Domain.Repository;
|
|
|
|
|
|
namespace DataSharing.CityStateDataExchange
|
|
@@ -49,65 +50,36 @@ namespace DataSharing.CityStateDataExchange
|
|
|
/// 市州工单互转
|
|
|
/// </summary>
|
|
|
/// <param name="dto"></param>
|
|
|
- /// <param name="platformSource"></param>
|
|
|
/// <param name="cancellationToken"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task InitCityDataAsync(OrderDto dto, string platformSource, CancellationToken cancellationToken)
|
|
|
+ public async Task InitCityDataAsync(OrderDto dto, CancellationToken cancellationToken)
|
|
|
{
|
|
|
- //判断推送市州
|
|
|
- string sendSource = _sharingConfigurationManager.GetHotlineName();
|
|
|
-
|
|
|
- var userInfo = await _dsUserTokenInfoRepository.GetAsync(p => p.PlatformSource == platformSource && p.State == "1", cancellationToken);
|
|
|
- if (userInfo is null)
|
|
|
- return;
|
|
|
-
|
|
|
- string secretKey = GetMD5(sendSource + userInfo.AccountSecret);
|
|
|
-
|
|
|
- var serverName = dto.IdentityType == EIdentityType.Enterprise ? "企业" : "市民";
|
|
|
- Dictionary<string, string> dicParam = new()
|
|
|
- {
|
|
|
- { "Code", secretKey },
|
|
|
- { "FSHCode", dto.No },
|
|
|
- { "ServerName", serverName},
|
|
|
- { "PurTypeName", dto.AcceptType },
|
|
|
- { "ConTypeName", dto.HotspotSpliceName},
|
|
|
- { "Title", dto.Title},
|
|
|
- { "LinkName", dto.FromName},
|
|
|
- { "Gender",dto.FromGender switch
|
|
|
- {
|
|
|
- EGender.Female => "2",
|
|
|
- EGender.Male => "1",
|
|
|
- _ => "0",
|
|
|
- }
|
|
|
- },
|
|
|
- { "Mobile", dto.Contact},
|
|
|
- { "Mail","" },
|
|
|
- { "Address", dto.FullAddress },
|
|
|
- { "Content", dto.Content},
|
|
|
- { "Source",sendSource }
|
|
|
- };
|
|
|
|
|
|
ConfigurationCityHandOver config = new();
|
|
|
if (_sharingConfigurationManager.IsCity(ConfigurationConsts.YiBin))
|
|
|
+ {
|
|
|
+ dto.Source = ESource.CityDataExchangeYB;
|
|
|
config = _sharingConfigurationManager.GetYiBinConfig().CityHandOver;
|
|
|
+ }
|
|
|
else if (_sharingConfigurationManager.IsCity(ConfigurationConsts.ZiGong))
|
|
|
+ {
|
|
|
+ dto.Source = ESource.CityDataExchangeZG;
|
|
|
config = _sharingConfigurationManager.GetZiGongConfig().CityHandOver;
|
|
|
+ }
|
|
|
+ else if (_sharingConfigurationManager.IsCity(ConfigurationConsts.LuZhou))
|
|
|
+ {
|
|
|
+ dto.Source = ESource.CityDataExchangeLz;
|
|
|
+ config = _sharingConfigurationManager.GetLuZhouConfig().CityHandOver;
|
|
|
+ }
|
|
|
|
|
|
- if (config == null)
|
|
|
- return;
|
|
|
-
|
|
|
- string path = "";
|
|
|
- if (config.IsNew)
|
|
|
- path = config.NewPushOrder;
|
|
|
- else
|
|
|
- path = config.PushOrder;
|
|
|
- //写入待推送数据
|
|
|
- // await _initPushDataService.InitPushDataAsync(platformSource, path, System.Text.Json.JsonSerializer.Serialize(dicParam),
|
|
|
- // dto.No, platformSource: EPlatformSource.CityDataExchange, cancellationToken: cancellationToken);
|
|
|
+ var userInfo = await _dsUserTokenInfoRepository.GetAsync(p => p.PlatformSource == dto.Source.ToString() && p.State == "1", cancellationToken);
|
|
|
+ if (userInfo is null)
|
|
|
+ throw UserFriendlyException.SameMessage("未配置接收市州!");
|
|
|
|
|
|
- var request = JsonSerializer.Serialize(dicParam, ProvinceJsonSerializerOptions.UnStandardDatetimeJsonOptions);
|
|
|
- await _initPushDataService.InitDsSendTaskOtherPlatforms(platformSource, path, dto.No,
|
|
|
+ var request = JsonSerializer.Serialize(dto, ProvinceJsonSerializerOptions.UnStandardDatetimeJsonOptions);
|
|
|
+ await _initPushDataService.InitDsSendTaskOtherPlatforms(dto.Source.ToString(), config.PushOrder, dto.No,
|
|
|
request, request, EPlatformSource.CityDataExchange, cancellationToken: cancellationToken);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -118,77 +90,26 @@ namespace DataSharing.CityStateDataExchange
|
|
|
/// <returns></returns>
|
|
|
public async Task UndertakAdviceAsync(OrderDto dto, CancellationToken cancellationToken)
|
|
|
{
|
|
|
- //判断推送市州
|
|
|
- string sendSource = _sharingConfigurationManager.GetHotlineName();
|
|
|
-
|
|
|
-
|
|
|
var userInfo = await _dsUserTokenInfoRepository.GetAsync(p => p.PlatformSource == dto.Source.ToString() && p.State == "1", cancellationToken);
|
|
|
if (userInfo is null)
|
|
|
- return;
|
|
|
-
|
|
|
- string secretKey = GetMD5(sendSource + userInfo.AccountSecret);
|
|
|
-
|
|
|
- Dictionary<string, object> dic = new()
|
|
|
- {
|
|
|
- { "Code", secretKey }, //请求Code
|
|
|
- { "SCDRCode", dto.ExternalId }, //工单编号
|
|
|
- { "UndertakAdvice", dto.ActualOpinion.Trim()}, //承办意见
|
|
|
- { "Source", sendSource } //来源
|
|
|
- };
|
|
|
+ throw UserFriendlyException.SameMessage("未配置接收市州!");
|
|
|
|
|
|
ConfigurationCityHandOver config = new();
|
|
|
if (_sharingConfigurationManager.IsCity(ConfigurationConsts.YiBin))
|
|
|
config = _sharingConfigurationManager.GetYiBinConfig().CityHandOver;
|
|
|
else if (_sharingConfigurationManager.IsCity(ConfigurationConsts.ZiGong))
|
|
|
config = _sharingConfigurationManager.GetZiGongConfig().CityHandOver;
|
|
|
+ else if (_sharingConfigurationManager.IsCity(ConfigurationConsts.LuZhou))
|
|
|
+ config = _sharingConfigurationManager.GetLuZhouConfig().CityHandOver;
|
|
|
|
|
|
if (config == null)
|
|
|
- return;
|
|
|
-
|
|
|
- string path = "";
|
|
|
- if (config.IsNew)
|
|
|
- path = config.NewPushOpinion;
|
|
|
- else
|
|
|
- path = config.PushOpinion;
|
|
|
+ throw UserFriendlyException.SameMessage("未配置结果接口!");
|
|
|
|
|
|
- //写入待推送数据
|
|
|
- // await _initPushDataService.InitPushDataAsync(userInfo.PlatformSource, path, System.Text.Json.JsonSerializer.Serialize(dic),
|
|
|
- // dto.No, platformSource: EPlatformSource.CityDataExchange, cancellationToken: cancellationToken);
|
|
|
- var request = JsonSerializer.Serialize(dic, ProvinceJsonSerializerOptions.UnStandardDatetimeJsonOptions);
|
|
|
- await _initPushDataService.InitDsSendTaskOtherPlatforms(userInfo.PlatformSource, path, dto.No,
|
|
|
+ var request = JsonSerializer.Serialize(dto, ProvinceJsonSerializerOptions.UnStandardDatetimeJsonOptions);
|
|
|
+ await _initPushDataService.InitDsSendTaskOtherPlatforms(userInfo.PlatformSource, config.PushOpinion, dto.No,
|
|
|
request, request, EPlatformSource.CityDataExchange, cancellationToken: cancellationToken);
|
|
|
|
|
|
}
|
|
|
|
|
|
- #region MD5 32位加密
|
|
|
- /// <summary>
|
|
|
- /// MD5 32位加密
|
|
|
- /// </summary>
|
|
|
- /// <param name="myString"></param>
|
|
|
- /// <returns></returns>
|
|
|
- private static string GetMD5(string myString)
|
|
|
- {
|
|
|
- string cl = myString;
|
|
|
- string pwd = "";
|
|
|
- try
|
|
|
- {
|
|
|
- //实例化一个md5对像
|
|
|
- MD5 md5 = MD5.Create();
|
|
|
- // 加密后是一个字节类型的数组,这里要注意编码UTF8/Unicode等的选择
|
|
|
- byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(cl));
|
|
|
- // 通过使用循环,将字节类型的数组转换为字符串,此字符串是常规字符格式化所得
|
|
|
- for (int i = 0; i < s.Length; i++)
|
|
|
- {
|
|
|
- // 将得到的字符串使用十六进制类型格式。格式后的字符是小写的字母,如果使用大写(X)则格式后的字符是大写字符
|
|
|
- pwd = pwd + s[i].ToString("X2");
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
- }
|
|
|
- return pwd;
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
}
|
|
|
}
|