MarketCustomerResourcesController.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. using OASystem.API.OAMethodLib;
  2. using OASystem.Domain.AesEncryption;
  3. using OASystem.Domain.Dtos.CRM;
  4. using OASystem.Domain.Entities.Customer;
  5. using OASystem.Infrastructure.Repositories.CRM;
  6. using System.Collections;
  7. using System.Diagnostics;
  8. namespace OASystem.API.Controllers
  9. {
  10. /// <summary>
  11. /// 市场客户资料
  12. /// </summary>
  13. [Route("api/[controller]/[action]")]
  14. public class MarketCustomerResourcesController : ControllerBase
  15. {
  16. private readonly NewClientDataRepository _clientDataRepository;
  17. private readonly SqlSugarClient _sqlSugar;
  18. /// <summary>
  19. /// 初始化
  20. /// </summary>
  21. public MarketCustomerResourcesController(NewClientDataRepository clientDataRepository, SqlSugarClient sqlSugar)
  22. {
  23. this._clientDataRepository = clientDataRepository;
  24. _sqlSugar = sqlSugar;
  25. }
  26. /// <summary>
  27. /// 客户资料数据
  28. /// 基础数据
  29. /// </summary>
  30. /// <returns></returns>
  31. [HttpPost]
  32. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  33. public async Task<IActionResult> MarketCustomerInit(MarketCustomerInitDto dto)
  34. {
  35. JsonView jw = new JsonView();
  36. try
  37. {
  38. Result resultData = await _clientDataRepository._Init(dto);
  39. if (resultData.Code == 0)
  40. {
  41. jw = JsonView(true, "查询成功!", resultData.Data);
  42. }
  43. else
  44. {
  45. jw = JsonView(false, resultData.Msg);
  46. }
  47. }
  48. catch (Exception)
  49. {
  50. jw = JsonView(false, "程序错误!");
  51. }
  52. return Ok(jw);
  53. }
  54. /// <summary>
  55. /// 查询客户资料数据
  56. /// </summary>
  57. /// <returns></returns>
  58. [HttpPost]
  59. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  60. public async Task<IActionResult> QueryNewClientData(NewClientDataQueryDto dto)
  61. {
  62. #region 参数验证
  63. if (dto.OperationUserId < 0)
  64. return Ok(JsonView(false, "请传入有效的OperationUserId参数!"));
  65. if (dto.PortType < 0)
  66. return Ok(JsonView(false, "请传入有效的PortType参数!"));
  67. #endregion
  68. JsonView jw = new JsonView();
  69. try
  70. {
  71. Result resultData = await _clientDataRepository.QueryNewClientData(dto);
  72. if (resultData.Code == 0)
  73. {
  74. #region 客户资料表操作记录
  75. await GeneralMethod.NewClientOperationRecord(dto.PortType, OperationEnum.NoOperation, dto.OperationUserId, 0, "");
  76. #endregion
  77. jw = JsonView(true, resultData.Msg, resultData.Data);
  78. }
  79. else
  80. {
  81. jw = JsonView(false, resultData.Msg);
  82. }
  83. }
  84. catch (Exception)
  85. {
  86. jw = JsonView(false, "程序错误!");
  87. }
  88. return Ok(jw);
  89. }
  90. /// <summary>
  91. /// 客户资料数据
  92. /// Details
  93. /// </summary>
  94. /// <returns></returns>
  95. [HttpPost]
  96. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  97. public async Task<IActionResult> PostNewClientDataDetails(NewClientDataDetailsDto dto)
  98. {
  99. #region 参数验证
  100. if (dto.Id < 0)
  101. return Ok(JsonView(false, "请传入有效的Id参数!"));
  102. if (dto.UserId < 0)
  103. return Ok(JsonView(false, "请传入有效的UserId参数!"));
  104. if (dto.PortType < 0)
  105. return Ok(JsonView(false, "请传入有效的PortType参数!"));
  106. #endregion
  107. JsonView jw = new JsonView();
  108. try
  109. {
  110. Result resultData = await _clientDataRepository._Details(dto.PortType, dto.Id);
  111. if (resultData.Code == 0)
  112. {
  113. #region 客户资料表操作记录
  114. await GeneralMethod.NewClientOperationRecord(dto.PortType, OperationEnum.Details, dto.UserId, dto.Id, "");
  115. #endregion
  116. jw = JsonView(true, "查询成功!", resultData.Data);
  117. }
  118. else
  119. {
  120. jw = JsonView(false, resultData.Msg);
  121. }
  122. }
  123. catch (Exception)
  124. {
  125. jw = JsonView(false, "程序错误!");
  126. }
  127. return Ok(jw);
  128. }
  129. /// <summary>
  130. /// 客户资料操作(Status:1.新增,2.修改)
  131. /// </summary>
  132. /// <param name="dto"></param>
  133. /// <returns></returns>
  134. [HttpPost]
  135. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  136. public async Task<IActionResult> NewClientOp(NewClientOpDto dto)
  137. {
  138. #region 参数验证
  139. if (dto.CreateUserId < 0)
  140. {
  141. return Ok(JsonView(false, "请传入有效的CreateUserId参数!"));
  142. }
  143. if (dto.PortType < 0)
  144. {
  145. return Ok(JsonView(false, "请传入有效的PortType参数!"));
  146. }
  147. #endregion
  148. try
  149. {
  150. Domain.Result result = await _clientDataRepository.NewClientOp(dto);
  151. if (result.Code != 0)
  152. {
  153. return Ok(JsonView(false, result.Msg));
  154. }
  155. #region 客户资料操作记录
  156. OperationEnum operationEnum = OperationEnum.NoOperation;
  157. if (dto.Status == 1)
  158. {
  159. operationEnum = OperationEnum.Add;
  160. dto.Id = Convert.ToInt32(result.Data);
  161. }
  162. else if (dto.Status == 2) operationEnum = OperationEnum.Edit;
  163. await GeneralMethod.NewClientOperationRecord(dto.PortType, operationEnum, dto.CreateUserId, dto.Id, "");
  164. #endregion
  165. return Ok(JsonView(true, result.Msg + "Id:" + dto.Id));
  166. }
  167. catch (Exception ex)
  168. {
  169. return Ok(JsonView(false, "程序错误!Msg:" + ex.Message));
  170. }
  171. }
  172. /// <summary>
  173. /// 新客户资料操作(删除)
  174. /// </summary>
  175. /// <param name="dto"></param>
  176. /// <returns></returns>
  177. [HttpPost]
  178. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  179. public async Task<IActionResult> NewClientDel(DelBaseDto dto)
  180. {
  181. #region 参数验证
  182. if (dto.Id < 0)
  183. {
  184. return Ok(JsonView(false, "请传入有效的Id参数!"));
  185. }
  186. if (dto.DeleteUserId < 0)
  187. {
  188. return Ok(JsonView(false, "请传入有效的DeleteUserId参数!"));
  189. }
  190. if (dto.PortType < 0)
  191. {
  192. return Ok(JsonView(false, "请传入有效的PortType参数!"));
  193. }
  194. #endregion
  195. var res = await _clientDataRepository.DelNewClientData(dto);
  196. if (res.Code != 0)
  197. {
  198. return Ok(JsonView(false, "删除失败"));
  199. }
  200. #region 客户资料表操作记录
  201. await GeneralMethod.NewClientOperationRecord(dto.PortType, OperationEnum.Del, dto.DeleteUserId, dto.Id, "");
  202. #endregion
  203. return Ok(JsonView(true, "删除成功!"));
  204. }
  205. /// <summary>
  206. /// 获取下拉列表数据和单条数据信息
  207. /// </summary>
  208. /// <param name="dto"></param>
  209. /// <returns></returns>
  210. [HttpPost]
  211. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  212. public async Task<IActionResult> QuerySelectAndSingleData(QuerySingleDto dto)
  213. {
  214. JsonView jw = new JsonView();
  215. var result = await _clientDataRepository.QuerySelectAndSingleData(dto);
  216. if (result.Code == 0)
  217. {
  218. #region 客户资料表操作记录
  219. await GeneralMethod.NewClientOperationRecord(dto.PortType, OperationEnum.Details, dto.UserId, dto.Id, "");
  220. #endregion
  221. jw = JsonView(true, result.Msg, result.Data);
  222. }
  223. else
  224. {
  225. jw = JsonView(false, result.Msg);
  226. }
  227. return Ok(jw);
  228. }
  229. /// <summary>
  230. /// 获取现有负责人
  231. /// </summary>
  232. /// <returns></returns>
  233. [HttpPost]
  234. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  235. public async Task<IActionResult> QueryUserSelect()
  236. {
  237. try
  238. {
  239. Result resTable = _clientDataRepository.QueryUserSelect();
  240. return Ok(JsonView(true, resTable.Msg, resTable.Data));
  241. }
  242. catch (Exception)
  243. {
  244. return Ok(JsonView(false, "程序错误!"));
  245. }
  246. }
  247. /// <summary>
  248. /// 获取出团数据
  249. /// </summary>
  250. /// <returns></returns>
  251. [HttpPost]
  252. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  253. public async Task<IActionResult> QueryNumberGroups()
  254. {
  255. var result = await _clientDataRepository.QueryNumberGroups();
  256. if (result.Code != 0)
  257. {
  258. return Ok(JsonView(false, result.Msg));
  259. }
  260. return Ok(JsonView(true, result.Msg, result.Data));
  261. }
  262. /// <summary>
  263. /// 新客户资料操作
  264. /// 批量分配
  265. /// </summary>
  266. /// <param name="dto"></param>
  267. /// <returns></returns>
  268. [HttpPost]
  269. [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
  270. public async Task<IActionResult> PostBatchAssignment(BatchAssignmentDto dto)
  271. {
  272. #region 参数验证
  273. if (dto.UserId < 0)
  274. {
  275. return Ok(JsonView(false, "请传入有效的UserId参数!"));
  276. }
  277. if (dto.PortType < 0)
  278. {
  279. return Ok(JsonView(false, "请传入有效的PortType参数!"));
  280. }
  281. #endregion
  282. var res = await _clientDataRepository._BatchAssignment(dto);
  283. if (res.Code != 0)
  284. {
  285. return Ok(JsonView(false, res.Msg));
  286. }
  287. return Ok(JsonView(true, "操作成功!"));
  288. }
  289. private Dictionary<int, List<int>> MCRSetting()
  290. {
  291. Dictionary<int, List<int>> keyValuePairs = new Dictionary<int, List<int>>();
  292. keyValuePairs.Add(419, new List<int>() //四川
  293. {
  294. 376,377,378,381,382,387,388,389,390,753,754,1296,1303
  295. });
  296. keyValuePairs.Add(420, new List<int>() //云南
  297. {
  298. 407,408,409,410,449,451,452,453,567,754,1297,1304
  299. });
  300. keyValuePairs.Add(421, new List<int>() { 424, 425, 426, 427, 428, 429, 754,1298, 1305,1307,1306 }); // 贵州
  301. keyValuePairs.Add(422, new List<int>() { 415, 416, 754,1317,1316,1315, 455,1321, 1320, 1319, 1318 }); // 西藏
  302. keyValuePairs.Add(423, new List<int>() { 417, 418, 454, 456, 754, 1313, 1314 }); // 重庆
  303. keyValuePairs.Add(578, new List<int>() { 581, 582, 583, 754,1299,1300 }); // 青海
  304. keyValuePairs.Add(605, new List<int>() { 588, 589, 590, 591, 592, 593, 754,1301,1310,1309,1308 }); // 陕西
  305. keyValuePairs.Add(606, new List<int>() { 597, 598, 599, 600, 601, 602, 603, 604, 754,1324,1323,1322 }); // 宁夏
  306. keyValuePairs.Add(625, new List<int>() { 617, 618, 619, 620, 621, 622, 622, 623, 624, 754,1302,1312,1311 }); // 甘肃
  307. keyValuePairs.Add(634, new List<int>() { 630, 631, 632, 633, 754 }); // 新疆
  308. return keyValuePairs;
  309. }
  310. private Dictionary<int, List<int>> MCRSecondSetting()
  311. {
  312. Dictionary<int, List<int>> keyValuePairs = new Dictionary<int, List<int>>();
  313. // 四川
  314. keyValuePairs.Add(349, new List<int>() { 376, 378, 381, 387, 389, 1296 }); // 四川省级
  315. keyValuePairs.Add(350, new List<int>() { 377, 382, 388, 390, 1303 }); // 成都市级
  316. keyValuePairs.Add(348, new List<int>() { 387 }); // 四川地市州 - Explicitly assigning to ensure all source2 IDs are used
  317. keyValuePairs.Add(701, new List<int>() { 388 }); // 成都区市县
  318. // 云南
  319. keyValuePairs.Add(399, new List<int>() { 407, 408, 409, 410, 451 }); // 云南省级
  320. keyValuePairs.Add(400, new List<int>() { 449, 452, 453, 1297, 1304 }); // 昆明市级
  321. keyValuePairs.Add(450, new List<int>() { 410 }); // 云南地市州
  322. keyValuePairs.Add(566, new List<int>() { 567 }); // 昆明区市县
  323. // 贵州
  324. keyValuePairs.Add(401, new List<int>() { 424, 426, 427, 428, 1298 }); // 贵州省级
  325. keyValuePairs.Add(402, new List<int>() { 425, 429, 1306, 1307, 1305 }); // 贵阳市级
  326. keyValuePairs.Add(414, new List<int>() { 428 }); // 贵州地市州
  327. //keyValuePairs.Add(1305, new List<int>() { /* Add relevant IDs if available */ }); // 贵阳区市县 - Placeholder for now
  328. // 重庆
  329. keyValuePairs.Add(403, new List<int>() { 417, 418, 454, 456, 1314 }); // 重庆市级
  330. keyValuePairs.Add(404, new List<int>() { 1313 }); // 重庆区县 - No direct match in source1
  331. // 西藏
  332. keyValuePairs.Add(405, new List<int>() { 415, 1317, 1316, 1315 }); // 西藏自治区
  333. keyValuePairs.Add(406, new List<int>() { 455, 1321, 1320, 1319, 1318 }); // 拉萨市级
  334. keyValuePairs.Add(413, new List<int>() { 416 }); // 西藏地市州
  335. // 青海
  336. keyValuePairs.Add(579, new List<int>() { 581, 582, 583, 1300 }); // 青海省级
  337. keyValuePairs.Add(580, new List<int>() { 1299 }); // 青海市州县 (Includes 地市州)
  338. // 陕西
  339. keyValuePairs.Add(585, new List<int>() { 588, 589, 590, 591, 1301 }); // 陕西省级
  340. keyValuePairs.Add(586, new List<int>() { 589 }); // 陕西地市州
  341. keyValuePairs.Add(587, new List<int>() { 592, 593, 1309, 1310 , 1308 }); // 西安市级
  342. //keyValuePairs.Add(1308, new List<int>() { /* Add relevant IDs if available */ }); // 西安区市县 - Placeholder
  343. // 宁夏
  344. keyValuePairs.Add(594, new List<int>() { 597, 598, 599, 600, 601, 1322 }); // 宁夏自治区 (Includes 地市州 and 区级)
  345. keyValuePairs.Add(595, new List<int>() { 597 }); // 宁夏地市州
  346. keyValuePairs.Add(596, new List<int>() { 598, 599, 600, 603, 604, 602, 1323, 1324 }); // 银川市级 (Includes 区级)
  347. //keyValuePairs.Add(602, new List<int>()); // 银川区市县 - No direct match, but could be considered covered by "区级"
  348. // 甘肃
  349. keyValuePairs.Add(614, new List<int>() { 617, 618, 619, 620, 621, 1302 }); // 甘肃省级
  350. keyValuePairs.Add(615, new List<int>() { 618 }); // 甘肃地市州
  351. keyValuePairs.Add(616, new List<int>() { 622, 623, 624, 1312, 1311 }); // 兰州市级
  352. //keyValuePairs.Add(1311, new List<int>() { /* Add relevant IDs if available */ }); // 兰州区市县 - Placeholder
  353. // 新疆
  354. keyValuePairs.Add(627, new List<int>() { 630, 631, 632 , 1327,1326 ,1325 }); // 新疆自治区级
  355. keyValuePairs.Add(628, new List<int>() { 1326 }); // 新疆地市州 - No direct match
  356. keyValuePairs.Add(629, new List<int>() { 633,1331,1330,1329 ,1328 }); // 乌鲁木齐市级
  357. // 中央直属企业 (Special case)
  358. keyValuePairs.Add(351, new List<int>() { 754 }); // Using "未分级" for 中央直属企业
  359. return keyValuePairs;
  360. }
  361. private Dictionary<int, List<int>> MCRLvSetting()
  362. {
  363. var keyValuePairs = new Dictionary<int, List<int>>();
  364. // 四川 (419)
  365. keyValuePairs.Add(419, new List<int>() { 348, 349, 350, 701 }); // Includes all Sichuan-related IDs from source2
  366. // 云南 (420)
  367. keyValuePairs.Add(420, new List<int>() { 399, 400, 450, 566 }); // Includes all Yunnan-related IDs
  368. // 贵州 (421)
  369. keyValuePairs.Add(421, new List<int>() { 401, 402, 414 });
  370. // 西藏 (422)
  371. keyValuePairs.Add(422, new List<int>() { 405, 406, 413 });
  372. // 重庆 (423)
  373. keyValuePairs.Add(423, new List<int>() { 403, 404 });
  374. // 青海 (578)
  375. keyValuePairs.Add(578, new List<int>() { 579, 580, 626 }); // Includes 市州县 and 西宁市级
  376. // 陕西 (605)
  377. keyValuePairs.Add(605, new List<int>() { 585, 586, 587 });
  378. // 宁夏 (606)
  379. keyValuePairs.Add(606, new List<int>() { 594, 595, 596 });
  380. // 甘肃 (625)
  381. keyValuePairs.Add(625, new List<int>() { 614, 615, 616 });
  382. // 新疆 (634)
  383. keyValuePairs.Add(634, new List<int>() { 627, 628, 629 });
  384. // 未分级 (351) - You'll likely want to remove this as it's no longer a primary key.
  385. // keyValuePairs.Add(351, new List<int>()); //Remove this line.
  386. return keyValuePairs;
  387. }
  388. [HttpPost]
  389. public IActionResult QueryClientType(QueryClientTypeDto Dto)
  390. {
  391. var jw = JsonView(true,"获取成功!");
  392. var dic_lv = MCRLvSetting();
  393. var keyValuePairs = MCRSetting();
  394. ArrayList arr = new ArrayList();
  395. ArrayList lvArr = new ArrayList();
  396. var ids = new List<int>();
  397. var lvids = new List<int>();
  398. foreach (var item in Dto.SetDataIdArr)
  399. {
  400. if (keyValuePairs.Keys.Contains(item))
  401. {
  402. ids.AddRange(keyValuePairs[item]);
  403. }
  404. if (dic_lv.Keys.Contains(item))
  405. {
  406. lvids.AddRange(dic_lv[item]);
  407. }
  408. }
  409. arr.AddRange(_sqlSugar.Queryable<Sys_SetData>()
  410. .Where(u => ids.Contains(u.Id) && u.IsDel == 0)
  411. .Select(x => new { x.Id, x.Name , x.Remark })
  412. .ToList());
  413. if (arr.Count == 0)
  414. {
  415. arr.AddRange(_sqlSugar.Queryable<Sys_SetData>()
  416. .Where(u => u.STid == 37 && u.IsDel == 0)
  417. .Select(x => new { x.Id, x.Name, x.Remark }).ToList());
  418. }
  419. // 创建比较器实例
  420. IComparer remakeComparer = new RemakeComparer();
  421. // 使用ArrayList.Sort方法和自定义比较器对arr进行排序
  422. arr.Sort(remakeComparer);
  423. var rangelv = _sqlSugar.Queryable<Sys_SetData>()
  424. .Where(u => lvids.Contains(u.Id) && u.IsDel == 0)
  425. .Select(x => new { x.Id, x.Name })
  426. .ToList();
  427. lvArr.AddRange(rangelv);
  428. if (lvArr.Count == 0)
  429. {
  430. lvArr.AddRange(_sqlSugar.Queryable<Sys_SetData>()
  431. .Where(u => u.STid == 33 && u.IsDel == 0)
  432. .Select(x => new { x.Id, x.Name}).ToList());
  433. }
  434. jw.Data = new
  435. {
  436. TypeArr = arr,
  437. LvArr = lvArr,
  438. };
  439. return Ok(jw);
  440. }
  441. [HttpPost]
  442. public IActionResult QueryClientTypeSecond(QueryClientTypeDto Dto)
  443. {
  444. var jw = JsonView(true, "获取成功!");
  445. var keyValuePairs = MCRSecondSetting();
  446. ArrayList arr = new ArrayList();
  447. var ids = new List<int>();
  448. foreach (var item in Dto.SetDataIdArr)
  449. {
  450. if (keyValuePairs.Keys.Contains(item))
  451. {
  452. ids.AddRange(keyValuePairs[item]);
  453. }
  454. }
  455. arr.AddRange(_sqlSugar.Queryable<Sys_SetData>()
  456. .Where(u => ids.Contains(u.Id) && u.IsDel == 0)
  457. .Select(x => new { x.Id, x.Name, x.Remark })
  458. .ToList());
  459. if (arr.Count == 0)
  460. {
  461. arr.AddRange(_sqlSugar.Queryable<Sys_SetData>()
  462. .Where(u => u.STid == 37 && u.IsDel == 0)
  463. .Select(x => new { x.Id, x.Name, x.Remark }).ToList());
  464. }
  465. // 创建比较器实例
  466. IComparer remakeComparer = new RemakeComparer();
  467. // 使用ArrayList.Sort方法和自定义比较器对arr进行排序
  468. arr.Sort(remakeComparer);
  469. jw.Data = arr;
  470. return Ok(jw);
  471. }
  472. [HttpPost]
  473. public IActionResult SynchronizationData()
  474. {
  475. var keyValuePairs = new Dictionary<int, List<string>>
  476. {
  477. { 5, new List<string> { "省级部门", "省级单位" } },
  478. { 10, new List<string> { "市州" } },
  479. { 15, new List<string> { "省属国企" } },
  480. { 20, new List<string> { "省属学校", "省属高校" } },
  481. { 25, new List<string> { "省级行业协会", "省级社团", "省级联合会" , "省属行业协会", "民营企业", "地方国企" } },
  482. { 30, new List<string> { "市级部门", "市级单位" } },
  483. { 35, new List<string> { "区市县" } },
  484. { 40, new List<string> { "市级国企", "市属国企" } },
  485. { 45, new List<string> { "市属学校", "市属高校" } },
  486. { 50, new List<string> { "市级行业协会", "市级社团", "市级联合会" } }
  487. };
  488. var setting = MCRSetting();
  489. var arr = new List<List<Sys_SetData>>();
  490. foreach (var item in setting.Keys)
  491. {
  492. var setDataList_DB = _sqlSugar.Queryable<Sys_SetData>()
  493. .Where(x => x.IsDel == 0 && setting[item].Contains(x.Id))
  494. .ToList();
  495. foreach (var setData in setDataList_DB)
  496. {
  497. foreach (var lv in keyValuePairs.Keys)
  498. {
  499. var islv = keyValuePairs[lv].Where(x => setData.Name.Contains(x)).Count() > 0;
  500. if (islv)
  501. {
  502. setData.Remark = lv.ToString();
  503. }
  504. }
  505. }
  506. arr.Add(setDataList_DB);
  507. }
  508. _sqlSugar.Updateable(arr.SelectMany(x => x).ToList()).UpdateColumns(x => new
  509. {
  510. x.Remark
  511. }).ExecuteCommand();
  512. return Ok(arr);
  513. }
  514. }
  515. }