TANG JIANG 1 year ago
parent
commit
dbf75ae5a4

+ 1 - 1
src/Sharing.Api/config/appsettings.Development.json

@@ -10,7 +10,7 @@
     "Origins": [ "http://localhost:8888", "http://admin.hotline.fw.com", "http://hotline.fw.com" ]
   },
   "DatabaseConfiguration": {
-    "ApplyDbMigrations": false,
+    "ApplyDbMigrations": true,
     "ApplySeed": false
   },
   "MqConfiguration": {

+ 83 - 49
src/Sharing.DaoShu110/Controllers/PoliceDSController.cs

@@ -3,8 +3,6 @@ using MapsterMapper;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
-using Microsoft.IdentityModel.Tokens;
-using Newtonsoft.Json.Linq;
 using Sharing.DaoShu110.Dtos;
 using Sharing.DaoShu110.Extensions;
 using Sharing.Province.XieTong.Knowledge;
@@ -265,7 +263,7 @@ namespace Sharing.DaoShu110.Controllers
             CToken_DaoShu cToken = new();
             string sm4 = cToken.token3_sm4_mw;
 
-            IApiResultR apiR;
+            IApiResultR apiR = null;
             try
             {
                 // 验证dcsm
@@ -286,21 +284,34 @@ namespace Sharing.DaoShu110.Controllers
                             // json 转 实体类
                             openData = System.Text.Json.JsonSerializer.Deserialize<OpenData>(jsonRes);
                     }
-
-                    var listData = await _policeSendChainAlarmDsRepository.Queryable()
+                    bool bRun = true;
+                    if (!string.IsNullOrEmpty(openData.StartDate) || !CComm.IsDate(openData.StartDate))
+                    {
+                        bRun = false;
+                        apiR = ApiResultR.Failed("【创建开始时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
+                    }
+                    if (!string.IsNullOrEmpty(openData.EndDate) || !CComm.IsDate(openData.EndDate))
+                    {
+                        bRun = false;
+                        apiR = ApiResultR.Failed("【创建结束时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
+                    }
+                    if (bRun)
+                    {
+                        var listData = await _policeSendChainAlarmDsRepository.Queryable()
                              .WhereIF(!string.IsNullOrEmpty(openData.StartDate), p => p.CallPoliceTime >= Convert.ToDateTime(openData.StartDate))
                              .WhereIF(!string.IsNullOrEmpty(openData.EndDate), p => p.CallPoliceTime >= Convert.ToDateTime(openData.EndDate))
                              .OrderBy(p => p.CallPoliceTime)
                              .Take(50)
                              .ToListAsync();
 
-                    if (null == listData)
-                        apiR = ApiResultR.Failed();
-                    else
-                    {
-                        var dto = _mapper.Map<IReadOnlyList<ChainAlarm_DS>>(listData);
-                        // 返回数据
-                        apiR = ApiResultR.Succeed(System.Text.Json.JsonSerializer.Serialize(dto));
+                        if (null == listData)
+                            apiR = ApiResultR.Failed();
+                        else
+                        {
+                            var dto = _mapper.Map<IReadOnlyList<ChainAlarm_DS>>(listData);
+                            // 返回数据
+                            apiR = ApiResultR.Succeed(System.Text.Json.JsonSerializer.Serialize(dto), "调用成功");
+                        }
                     }
                 }
             }
@@ -340,7 +351,7 @@ namespace Sharing.DaoShu110.Controllers
             CToken_DaoShu cToken = new();
             string sm4 = cToken.token2_sm4_mw;
 
-            IApiResultR apiR;
+            IApiResultR apiR = null;
             try
             {
                 // 验证dcsm
@@ -352,7 +363,6 @@ namespace Sharing.DaoShu110.Controllers
                 else
                 {
                     string base64String = await CComm.getStreamBase64(HttpContext.Request);
-
                     OpenData openData = new();
                     if (!string.IsNullOrEmpty(base64String))
                     {
@@ -362,25 +372,39 @@ namespace Sharing.DaoShu110.Controllers
                             // json 转 实体类
                             openData = System.Text.Json.JsonSerializer.Deserialize<OpenData>(jsonRes);
                     }
+                    bool bRun = true;
 
-                    var listData = await _policeSendChainDealDsRepository.Queryable()
-                             .WhereIF(!string.IsNullOrEmpty(openData.StartDate), p => p.WarehousingTime >= Convert.ToDateTime(openData.StartDate))
-                             .WhereIF(!string.IsNullOrEmpty(openData.EndDate), p => p.WarehousingTime >= Convert.ToDateTime(openData.EndDate))
-                             .WhereIF(!string.IsNullOrEmpty(openData.AlarmReceiptNumber), p => p.AlarmReceiptNumber == openData.AlarmReceiptNumber)
-                             .Where(p => p.DisposalType == openData.DisposalType)
-                             .OrderBy(p => p.WarehousingTime)
-                             .Take(50)
-                             .ToListAsync();
-
-                    if (null == listData)
-                        apiR = ApiResultR.Failed();
-                    else
+                    if (!string.IsNullOrEmpty(openData.StartDate) && !CComm.IsDate(openData.StartDate))
                     {
-                        var dto = _mapper.Map<IReadOnlyList<ChainDeal_DS>>(listData);
-                        // 返回数据
-                        apiR = ApiResultR.Succeed(System.Text.Json.JsonSerializer.Serialize(dto));
+                        bRun = false;
+                        apiR = ApiResultR.Failed("【创建开始时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
+                    }
+                    if (!string.IsNullOrEmpty(openData.EndDate) && !CComm.IsDate(openData.EndDate))
+                    {
+                        bRun = false;
+                        apiR = ApiResultR.Failed("【创建结束时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
                     }
 
+                    if (bRun)
+                    {
+                        var listData = await _policeSendChainDealDsRepository.Queryable()
+                                 .WhereIF(!string.IsNullOrEmpty(openData.StartDate), p => p.WarehousingTime >= Convert.ToDateTime(openData.StartDate))
+                                 .WhereIF(!string.IsNullOrEmpty(openData.EndDate), p => p.WarehousingTime >= Convert.ToDateTime(openData.EndDate))
+                                 .WhereIF(!string.IsNullOrEmpty(openData.AlarmReceiptNumber), p => p.AlarmReceiptNumber == openData.AlarmReceiptNumber)
+                                 .Where(p => p.DisposalType == openData.DisposalType)
+                                 .OrderBy(p => p.WarehousingTime)
+                                 .Take(50)
+                                 .ToListAsync();
+
+                        if (null == listData)
+                            apiR = ApiResultR.Failed();
+                        else
+                        {
+                            var dto = _mapper.Map<IReadOnlyList<ChainDeal_DS>>(listData);
+                            // 返回数据
+                            apiR = ApiResultR.Succeed(System.Text.Json.JsonSerializer.Serialize(dto), "调用成功");
+                        }
+                    }
                 }
             }
             catch (System.Exception)
@@ -411,17 +435,17 @@ namespace Sharing.DaoShu110.Controllers
         public async Task<HttpResponseMessage> Get_Knowledge_Info()
         {
             // 测试Json
-            // {"createTimeBegin":"2003-04-07 10:59:14","createTimeEnd":"2023-04-07 10:59:21","keyWord":"测试"}
-            // {"createTimeBegin":"2003-04-07 10:59:14","createTimeEnd":"2023-04-07 10:59:21","keyWord":""}
+            // {"createTimeBegin":"2003-04-07 10:59:14","createTimeEnd":"2023-08-07 10:59:21","keyWord":"222"}
+            // {"createTimeBegin":"2003-04-07 10:59:14","createTimeEnd":"2023-08-07 10:59:21","keyWord":""}
 
             // 测试Base64
-            // 93ObxWa6vhYID1pe3rx0ThmtcsgBLXGqvIYCMM8iUwPpItcJamHEbCHDV62/5tDIG7LZfbQCYscMo05nhdfdoQKo0xVndLdYFCsp6s291ecXIz2INGfLR7MVJjDLpg0orf2b9KCj4h8PDRwKY0FBqg==
-            // 93ObxWa6vhYID1pe3rx0ThmtcsgBLXGqvIYCMM8iUwPpItcJamHEbCHDV62/5tDIG7LZfbQCYscMo05nhdfdoQKo0xVndLdYFCsp6s291efskazkOkKJlTsM8iK4mdwj
+            // sVGPN7BDsKnDLrd6NzrGx+2IH6vVAo6bjGSenIgCJATssZduYxBOLdQi7TVdsBCy7AGk15xjKRVe4AdovL6r49fxDvWjyDlxS8K4qkukEOtYs/VyP6WIdiKQL6PC3i/T
+            // sVGPN7BDsKnDLrd6NzrGx+2IH6vVAo6bjGSenIgCJATssZduYxBOLdQi7TVdsBCy7AGk15xjKRVe4AdovL6r49fxDvWjyDlxS8K4qkukEOuaeRL4jMcFsN7HoUTHfDrk
 
             CToken_DaoShu cToken = new();
             string sm4 = cToken.token5_sm4_mw;
 
-            IApiResultR apiR;
+            IApiResultR apiR = null;
             try
             {
                 // 验证dcsm
@@ -444,7 +468,20 @@ namespace Sharing.DaoShu110.Controllers
                             get_Knowledge = System.Text.Json.JsonSerializer.Deserialize<Get_Knowledge>(jsonRes);
                     }
 
-                    var listData = await _knowledgeRawDataRepository
+                    bool bRun = true;
+                    if (!string.IsNullOrEmpty(get_Knowledge.createTimeBegin) || !CComm.IsDate(get_Knowledge.createTimeBegin))
+                    {
+                        bRun = false;
+                        apiR = ApiResultR.Failed("【创建开始时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
+                    }
+                    if (!string.IsNullOrEmpty(get_Knowledge.createTimeEnd) || !CComm.IsDate(get_Knowledge.createTimeEnd))
+                    {
+                        bRun = false;
+                        apiR = ApiResultR.Failed("【创建结束时间】不是日期格式 yyyy-MM-dd HH:mm:ss");
+                    }
+                    if (bRun)
+                    {
+                        var listData = await _knowledgeRawDataRepository
                         .Queryable()
                         .WhereIF(!string.IsNullOrEmpty(get_Knowledge.createTimeBegin), p => p.CreatDate >= Convert.ToDateTime(get_Knowledge.createTimeBegin))
                           .WhereIF(!string.IsNullOrEmpty(get_Knowledge.createTimeEnd), p => p.CreatDate <= Convert.ToDateTime(get_Knowledge.createTimeEnd))
@@ -452,15 +489,15 @@ namespace Sharing.DaoShu110.Controllers
                          .OrderByDescending(p => p.CreatDate)
                           .ToListAsync();
 
-                    if (null == listData)
-                        apiR = ApiResultR.Failed();
-                    else
-                    {
-                        var dto = _mapper.Map<IReadOnlyList<KnowledgeDto>>(listData);
-                        // 返回数据
-                        apiR = ApiResultR.Succeed(System.Text.Json.JsonSerializer.Serialize(dto));
+                        if (null == listData)
+                            apiR = ApiResultR.Failed();
+                        else
+                        {
+                            var dto = _mapper.Map<IReadOnlyList<KnowledgeDto>>(listData);
+                            // 返回数据
+                            apiR = ApiResultR.Succeed(System.Text.Json.JsonSerializer.Serialize(dto), "调用成功");
+                        }
                     }
-
                 }
             }
             catch (System.Exception)
@@ -499,9 +536,7 @@ namespace Sharing.DaoShu110.Controllers
                 // 验证dcsm
                 string dcsmMsg = CComm.checkDcsm(Request.Headers["dcsm"].ToString(), cToken.token6_dcsm);
                 if (!string.IsNullOrEmpty(dcsmMsg))
-                {
                     apiR = ApiResultR.Failed(dcsmMsg);
-                }
                 else
                 {
                     string base64String = await CComm.getStreamBase64(HttpContext.Request);
@@ -524,13 +559,12 @@ namespace Sharing.DaoShu110.Controllers
                     {
                         var data = await _knowledgeRawDataRepository.GetAsync(p => p.Id == get_Knowledge.id);
                         if (null == data)
-                        {
                             apiR = ApiResultR.Failed();
-                        }
                         else
                         {
-                            KeyValuePair<string, string> keyValuePair = new("content", data.KContent);
-                            apiR = ApiResultR.Succeed(keyValuePair);
+                            var dto = _mapper.Map<KnowledgeContent>(data);
+                            // 返回数据
+                            apiR = ApiResultR.Succeed(System.Text.Json.JsonSerializer.Serialize(dto), "调用成功");
                         }
                     }
                 }

+ 12 - 0
src/Sharing.DaoShu110/Dtos/KnowledgeDto.cs

@@ -22,4 +22,16 @@ namespace Sharing.DaoShu110.Dtos
         [JsonPropertyName("createTime")]
         public string CreatDate { get; set; }
     }
+
+    /// <summary>
+    /// 知识内容
+    /// </summary>
+    public class KnowledgeContent
+    {
+        /// <summary>
+        /// 知识内容
+        /// </summary>
+        [JsonPropertyName("content")]
+        public string KContent { get; set; }
+    }
 }

+ 12 - 12
src/Sharing.DaoShu110/Extensions/CToken_Yibin.cs

@@ -49,21 +49,21 @@
         //5、从公安网侧获取12345政务服务热线平台知识库列表
         //   send-知识库列表
         //   http://10.12.185.168:8001/service/api/ds/get_knowledge_info
-        public static string token5_token = "";
-        public static string token5_dcsm = "";
-        public static string token5_sm2_public = "";
-        public static string token5_sm2_private = "";
-        public static string token5_sm4 = "";
-        public static string token5_sm4_mw = "";
+        public static string token5_token = "1fbbac1b09b89d11bc569168aabb3c8b";
+        public static string token5_dcsm = "3873c1b1ff0ce3b8120d63509d3b85169cda4856b0a0d89625a4744641a343951d8ced868bd5c7fc60826403bd6314a02e5a26ba8808dae5a9d9f851555338d0";
+        public static string token5_sm2_public = "VgjJ7FfA23vY3Hr1pVrdbi3MZt7X0k/nMf9kwEyyC32CXgT2ccWBlxf3kGPXLO56HSBoo9IA7sSEG3eJYVQmLw==";
+        public static string token5_sm2_private = "QNTPy2nPBe2JY308G0LHO4r42iomDWcdedf81FapkWA=";
+        public static string token5_sm4 = "BKNpLwBCT2MvXwhLRcZ6FoMm4GaXs6LXqVmEa5hMJ3d9G+vC/5j7xtQh9HRKIfSfXkDQI0EQS7UR4inEXks/AnKsLYGhmhRjyzM7AGpEsujr2vJTwcwIWpBmpuc7k0uBQ34bN+kopafIo5UVyk7rIek=";
+        public static string token5_sm4_mw = "2938d7acb2754a09";
 
         //6、从公安网侧获取12345政务服务热线平台知识内容
         //   send-知识库内容
         //   http://10.12.185.168:8001/service/api/ds/get_knowledge_content
-        public static string token6_token = "";
-        public static string token6_dcsm = "";
-        public static string token6_sm2_public = "";
-        public static string token6_sm2_private = "";
-        public static string token6_sm4 = "";
-        public static string token6_sm4_mw = "";
+        public static string token6_token = "1fbbac1b09b89d11bc569168aabb3c8b";
+        public static string token6_dcsm = "3873c1b1ff0ce3b8120d63509d3b85169cda4856b0a0d89625a4744641a343951d8ced868bd5c7fc60826403bd6314a02e5a26ba8808dae5a9d9f851555338d0";
+        public static string token6_sm2_public = "VgjJ7FfA23vY3Hr1pVrdbi3MZt7X0k/nMf9kwEyyC32CXgT2ccWBlxf3kGPXLO56HSBoo9IA7sSEG3eJYVQmLw==";
+        public static string token6_sm2_private = "QNTPy2nPBe2JY308G0LHO4r42iomDWcdedf81FapkWA=";
+        public static string token6_sm4 = "BKNpLwBCT2MvXwhLRcZ6FoMm4GaXs6LXqVmEa5hMJ3d9G+vC/5j7xtQh9HRKIfSfXkDQI0EQS7UR4inEXks/AnKsLYGhmhRjyzM7AGpEsujr2vJTwcwIWpBmpuc7k0uBQ34bN+kopafIo5UVyk7rIek=";
+        public static string token6_sm4_mw = "2938d7acb2754a09";
     }
 }

+ 2 - 0
src/Sharing/DaoShu110/PoliceReceiveChainAlarmDs.cs

@@ -1,4 +1,5 @@
 using SqlSugar;
+using System.ComponentModel;
 using XF.Domain.Repository;
 
 namespace Sharing.DaoShu110.Dtos
@@ -6,6 +7,7 @@ namespace Sharing.DaoShu110.Dtos
     /// <summary>
     /// 道枢受理工单表
     /// </summary>
+    [Description("道枢受理工单表-接收")]
     public class PoliceReceiveChainAlarmDs : CreationModificationEntity
     {
         /// <summary>

+ 2 - 0
src/Sharing/DaoShu110/PoliceReceiveChainDealDs.cs

@@ -1,4 +1,5 @@
 using SqlSugar;
+using System.ComponentModel;
 using XF.Domain.Repository;
 
 namespace Sharing.DaoShu110.Dtos
@@ -6,6 +7,7 @@ namespace Sharing.DaoShu110.Dtos
     /// <summary>
     /// 道枢办理结果表
     /// </summary>
+    [Description("道枢办理结果表-接收")]
     public class PoliceReceiveChainDealDs : CreationModificationEntity
     {
         /// <summary>

+ 2 - 0
src/Sharing/DaoShu110/PoliceSendChainAlarmDs.cs

@@ -1,4 +1,5 @@
 using SqlSugar;
+using System.ComponentModel;
 using XF.Domain.Repository;
 
 namespace Sharing.DaoShu110.Dtos
@@ -6,6 +7,7 @@ namespace Sharing.DaoShu110.Dtos
     /// <summary>
     /// 道枢受理工单表
     /// </summary>
+    [Description("道枢受理工单表-发送")]
     public class PoliceSendChainAlarmDs : CreationModificationEntity
     {
         /// <summary>

+ 2 - 0
src/Sharing/DaoShu110/PoliceSendChainDealDs.cs

@@ -1,4 +1,5 @@
 using SqlSugar;
+using System.ComponentModel;
 using XF.Domain.Repository;
 
 namespace Sharing.DaoShu110.Dtos
@@ -6,6 +7,7 @@ namespace Sharing.DaoShu110.Dtos
     /// <summary>
     /// 道枢办理结果表
     /// </summary>
+    [Description("道枢办理结果表-发送")]
     public class PoliceSendChainDealDs : CreationModificationEntity
     {
         /// <summary>

+ 14 - 4
src/Sharing/Province/XieTong/Knowledge/KnowledgeRawData.cs

@@ -1,4 +1,5 @@
 using SqlSugar;
+using System.ComponentModel;
 using XF.Domain.Repository;
 
 namespace Sharing.Province.XieTong.Knowledge
@@ -6,70 +7,79 @@ namespace Sharing.Province.XieTong.Knowledge
     /// <summary>
     /// 知识库原始数据
     /// </summary>
+    [Description("知识库原始数据")]
     public class KnowledgeRawData:FullStateEntity
     {
         /// <summary>
         /// 知识类别code
         /// </summary>
+        [SugarColumn(ColumnDescription = "知识类别code", ColumnDataType = "varchar(50)")]
         public string CategoryCode { get; set; }
 
         /// <summary>
         /// 知识类别名称
         /// </summary>
+        [SugarColumn(ColumnDescription = "知识类别名称", ColumnDataType = "varchar(50)")]
         public string CategoryName { get; set; }
 
         /// <summary>
         /// 发布人
         /// </summary>
+        [SugarColumn(ColumnDescription = "发布人", ColumnDataType = "varchar(50)")]
         public string PublishPerson { get; set; }
 
         /// <summary>
         /// 所属部门名称
         /// </summary>
+        [SugarColumn(ColumnDescription = "所属部门名称", ColumnDataType = "varchar(200)")]
         public string OuName { get; set; }
 
         /// <summary>
         /// 知识名称
         /// </summary>
+        [SugarColumn(ColumnDescription = "知识名称", ColumnDataType = "varchar(200)")]
         public string KName { get; set; }
 
         /// <summary>
         /// 知识内容
         /// </summary>
+        [SugarColumn(ColumnDescription = "知识内容", ColumnDataType = "text")]
         public string KContent { get; set; }
 
         /// <summary>
         /// 发布日期
         /// </summary>
-        [SugarColumn(IsIgnore = true)]
+        [SugarColumn(ColumnDescription = "发布日期", IsNullable = true)]
         public DateTime? CreatDate { get; set; }
 
         /// <summary>
         /// 生效时间
         /// </summary>
-        [SugarColumn(IsIgnore = true)]
+        [SugarColumn(ColumnDescription = "生效时间", IsNullable = true)]
         public DateTime? BeginDate { get; set; }
 
         /// <summary>
         /// 失效时间
         /// </summary>
-        [SugarColumn(IsIgnore = true)]
+        [SugarColumn(ColumnDescription = "生效时间", IsNullable = true)]
         public DateTime? DisableDate { get; set; }
 
         /// <summary>
         /// 上报知识唯一标识
         /// </summary>
+        [SugarColumn(ColumnDescription = "上报知识唯一标识", ColumnDataType = "varchar(50)")]
         public string UID { get; set; }
 
         /// <summary>
         /// 行政区划代码
         /// </summary>
+        [SugarColumn(ColumnDescription = "行政区划代码", ColumnDataType = "varchar(24)", IsNullable = true)]
         public string AreaCode { get; set; }
 
         /// <summary>
         /// 材料标识
         /// </summary>
-        [SugarColumn(IsIgnore = true)]
+        [SugarColumn(ColumnDescription = "材料标识", ColumnDataType = "varchar(50)", IsNullable = true)]
         public string CliengGuid { get; set; }
     }
 }