|
|
@@ -24,14 +24,17 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
private readonly NewClientDataRepository _clientDataRepository;
|
|
|
private readonly SqlSugarClient _sqlSugar;
|
|
|
+
|
|
|
+ private readonly ILogger<MarketCustomerResourcesController> _logger;
|
|
|
private string keyName = "newClient_SearchKey";
|
|
|
/// <summary>
|
|
|
/// 初始化
|
|
|
/// </summary>
|
|
|
- public MarketCustomerResourcesController(NewClientDataRepository clientDataRepository, SqlSugarClient sqlSugar)
|
|
|
+ public MarketCustomerResourcesController(NewClientDataRepository clientDataRepository, SqlSugarClient sqlSugar, ILogger<MarketCustomerResourcesController> logger)
|
|
|
{
|
|
|
this._clientDataRepository = clientDataRepository;
|
|
|
_sqlSugar = sqlSugar;
|
|
|
+ _logger = logger;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -450,70 +453,23 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
Dictionary<int, List<int>> keyValuePairs = new Dictionary<int, List<int>>();
|
|
|
|
|
|
- // 四川
|
|
|
- keyValuePairs.Add(349, new List<int>() { 376, 378, 381, 387, 389, 1296 }); // 四川省级
|
|
|
- keyValuePairs.Add(350, new List<int>() { 377, 382, 388, 390, 1303 }); // 成都市级
|
|
|
- keyValuePairs.Add(348, new List<int>() { 387 }); // 四川地市州 - Explicitly assigning to ensure all source2 IDs are used
|
|
|
- keyValuePairs.Add(701, new List<int>() { 388 }); // 成都区市县
|
|
|
-
|
|
|
- // 云南
|
|
|
- keyValuePairs.Add(399, new List<int>() { 407, 408, 409, 410, 451 }); // 云南省级
|
|
|
- keyValuePairs.Add(400, new List<int>() { 449, 452, 453, 1297, 1304 }); // 昆明市级
|
|
|
- keyValuePairs.Add(450, new List<int>() { 410 }); // 云南地市州
|
|
|
- keyValuePairs.Add(566, new List<int>() { 567 }); // 昆明区市县
|
|
|
-
|
|
|
- // 贵州
|
|
|
- keyValuePairs.Add(401, new List<int>() { 424, 426, 427, 428, 1298 }); // 贵州省级
|
|
|
- keyValuePairs.Add(402, new List<int>() { 425, 429, 1306, 1307, 1305 }); // 贵阳市级
|
|
|
- keyValuePairs.Add(414, new List<int>() { 428 }); // 贵州地市州
|
|
|
- //keyValuePairs.Add(1305, new List<int>() { /* Add relevant IDs if available */ }); // 贵阳区市县 - Placeholder for now
|
|
|
-
|
|
|
-
|
|
|
- // 重庆
|
|
|
- keyValuePairs.Add(403, new List<int>() { 417, 418, 454, 456, 1314 }); // 重庆市级
|
|
|
- keyValuePairs.Add(404, new List<int>() { 1313 }); // 重庆区县 - No direct match in source1
|
|
|
-
|
|
|
-
|
|
|
- // 西藏
|
|
|
- keyValuePairs.Add(405, new List<int>() { 415, 1317, 1316, 1315 }); // 西藏自治区
|
|
|
- keyValuePairs.Add(406, new List<int>() { 455, 1321, 1320, 1319, 1318 }); // 拉萨市级
|
|
|
- keyValuePairs.Add(413, new List<int>() { 416 }); // 西藏地市州
|
|
|
-
|
|
|
-
|
|
|
- // 青海
|
|
|
- keyValuePairs.Add(579, new List<int>() { 581, 582, 583, 1300 }); // 青海省级
|
|
|
- keyValuePairs.Add(580, new List<int>() { 1299 }); // 青海市州县 (Includes 地市州)
|
|
|
-
|
|
|
-
|
|
|
- // 陕西
|
|
|
- keyValuePairs.Add(585, new List<int>() { 588, 589, 590, 591, 1301 }); // 陕西省级
|
|
|
- keyValuePairs.Add(586, new List<int>() { 589 }); // 陕西地市州
|
|
|
- keyValuePairs.Add(587, new List<int>() { 592, 593, 1309, 1310, 1308 }); // 西安市级
|
|
|
- //keyValuePairs.Add(1308, new List<int>() { /* Add relevant IDs if available */ }); // 西安区市县 - Placeholder
|
|
|
-
|
|
|
-
|
|
|
- // 宁夏
|
|
|
- keyValuePairs.Add(594, new List<int>() { 597, 598, 599, 600, 601, 1322 }); // 宁夏自治区 (Includes 地市州 and 区级)
|
|
|
- keyValuePairs.Add(595, new List<int>() { 597 }); // 宁夏地市州
|
|
|
- keyValuePairs.Add(596, new List<int>() { 598, 599, 600, 603, 604, 602, 1323, 1324 }); // 银川市级 (Includes 区级)
|
|
|
- //keyValuePairs.Add(602, new List<int>()); // 银川区市县 - No direct match, but could be considered covered by "区级"
|
|
|
-
|
|
|
-
|
|
|
- // 甘肃
|
|
|
- keyValuePairs.Add(614, new List<int>() { 617, 618, 619, 620, 621, 1302 }); // 甘肃省级
|
|
|
- keyValuePairs.Add(615, new List<int>() { 618 }); // 甘肃地市州
|
|
|
- keyValuePairs.Add(616, new List<int>() { 622, 623, 624, 1312, 1311 }); // 兰州市级
|
|
|
- //keyValuePairs.Add(1311, new List<int>() { /* Add relevant IDs if available */ }); // 兰州区市县 - Placeholder
|
|
|
-
|
|
|
-
|
|
|
- // 新疆
|
|
|
- keyValuePairs.Add(627, new List<int>() { 630, 631, 632, 1327, 1326, 1325 }); // 新疆自治区级
|
|
|
- keyValuePairs.Add(628, new List<int>() { 1326 }); // 新疆地市州 - No direct match
|
|
|
- keyValuePairs.Add(629, new List<int>() { 633, 1331, 1330, 1329, 1328 }); // 乌鲁木齐市级
|
|
|
-
|
|
|
- // 中央直属企业 (Special case)
|
|
|
- keyValuePairs.Add(351, new List<int>() { 754 }); // Using "未分级" for 中央直属企业
|
|
|
-
|
|
|
+ _sqlSugar.Queryable<Sys_SetData>()
|
|
|
+ .Where(x => x.STid == 33 && x.IsDel == 0)
|
|
|
+ .Select(x => new { x.Id, x.Name, x.Remark })
|
|
|
+ .ToList()
|
|
|
+ .ForEach(x =>
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var list = JsonConvert.DeserializeObject<List<int>>(x.Remark);
|
|
|
+ keyValuePairs.Add(x.Id, list);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ _logger.LogError($"MCRSecondSetting JsonConvert.DeserializeObject ERROR: {ex.Message}");
|
|
|
+ keyValuePairs.Add(x.Id, new List<int>());
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
return keyValuePairs;
|
|
|
}
|
|
|
@@ -522,38 +478,23 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
var keyValuePairs = new Dictionary<int, List<int>>();
|
|
|
|
|
|
- // 四川 (419)
|
|
|
- keyValuePairs.Add(419, new List<int>() { 348, 349, 350, 701 }); // Includes all Sichuan-related IDs from source2
|
|
|
-
|
|
|
- // 云南 (420)
|
|
|
- keyValuePairs.Add(420, new List<int>() { 399, 400, 450, 566 }); // Includes all Yunnan-related IDs
|
|
|
-
|
|
|
- // 贵州 (421)
|
|
|
- keyValuePairs.Add(421, new List<int>() { 401, 402, 414 });
|
|
|
-
|
|
|
- // 西藏 (422)
|
|
|
- keyValuePairs.Add(422, new List<int>() { 405, 406, 413 });
|
|
|
-
|
|
|
- // 重庆 (423)
|
|
|
- keyValuePairs.Add(423, new List<int>() { 403, 404 });
|
|
|
-
|
|
|
- // 青海 (578)
|
|
|
- keyValuePairs.Add(578, new List<int>() { 579, 580, 626 }); // Includes 市州县 and 西宁市级
|
|
|
-
|
|
|
- // 陕西 (605)
|
|
|
- keyValuePairs.Add(605, new List<int>() { 585, 586, 587 });
|
|
|
-
|
|
|
- // 宁夏 (606)
|
|
|
- keyValuePairs.Add(606, new List<int>() { 594, 595, 596 });
|
|
|
-
|
|
|
- // 甘肃 (625)
|
|
|
- keyValuePairs.Add(625, new List<int>() { 614, 615, 616 });
|
|
|
-
|
|
|
- // 新疆 (634)
|
|
|
- keyValuePairs.Add(634, new List<int>() { 627, 628, 629 });
|
|
|
-
|
|
|
- // 未分级 (351) - You'll likely want to remove this as it's no longer a primary key.
|
|
|
- // keyValuePairs.Add(351, new List<int>()); //Remove this line.
|
|
|
+ _sqlSugar.Queryable<Sys_SetData>()
|
|
|
+ .Where(x => x.STid == 42 && x.IsDel == 0)
|
|
|
+ .Select(x => new { x.Id, x.Name, x.Remark })
|
|
|
+ .ToList()
|
|
|
+ .ForEach(x =>
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var list = JsonConvert.DeserializeObject<List<int>>(x.Remark);
|
|
|
+ keyValuePairs.Add(x.Id, list);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ _logger.LogError($"MCRLvSetting JsonConvert.DeserializeObject ERROR: {ex.Message}");
|
|
|
+ keyValuePairs.Add(x.Id, new List<int>());
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
return keyValuePairs;
|
|
|
}
|
|
|
@@ -565,21 +506,35 @@ namespace OASystem.API.Controllers
|
|
|
var jw = JsonView(true, "获取成功!");
|
|
|
|
|
|
var dic_lv = MCRLvSetting();
|
|
|
- var keyValuePairs = MCRSetting();
|
|
|
+ var dic_setting = MCRSecondSetting();
|
|
|
ArrayList arr = new ArrayList();
|
|
|
ArrayList lvArr = new ArrayList();
|
|
|
var ids = new List<int>();
|
|
|
var lvids = new List<int>();
|
|
|
- foreach (var item in Dto.SetDataIdArr)
|
|
|
- {
|
|
|
- if (keyValuePairs.Keys.Contains(item))
|
|
|
- {
|
|
|
- ids.AddRange(keyValuePairs[item]);
|
|
|
- }
|
|
|
|
|
|
- if (dic_lv.Keys.Contains(item))
|
|
|
+ var items = _sqlSugar.Queryable<Sys_SetData>()
|
|
|
+ .Where(x => x.STid == 42 && x.IsDel == 0)
|
|
|
+ .Where(x => Dto.SetDataIdArr.Contains(x.Id))
|
|
|
+ .Select(x => new { x.Id, x.Name, x.Remark })
|
|
|
+ .ToList();
|
|
|
+
|
|
|
+
|
|
|
+ foreach (var item in items)
|
|
|
+ {
|
|
|
+ if (dic_lv.Keys.Contains(item.Id))
|
|
|
{
|
|
|
- lvids.AddRange(dic_lv[item]);
|
|
|
+ lvids.AddRange(dic_lv[item.Id]);
|
|
|
+ var remarkids = JsonConvert.DeserializeObject<List<int>>(item.Remark);
|
|
|
+ if (remarkids.Any())
|
|
|
+ {
|
|
|
+ foreach (var remarkid in remarkids)
|
|
|
+ {
|
|
|
+ if (dic_setting.Keys.Contains(remarkid))
|
|
|
+ {
|
|
|
+ ids.AddRange(dic_setting[remarkid]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|