BX_SyncService.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. using HH.YiDaSyncNC.Dtos;
  2. using HH.YiDaSyncNC.Dtos.NC;
  3. using HH.YiDaSyncNC.Dtos.YIDA;
  4. using HH.YiDaSyncNC.Helper;
  5. using HH.YiDaSyncNC.Models;
  6. using Newtonsoft.Json;
  7. using SqlSugar;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Configuration;
  11. using System.Linq;
  12. using System.Reflection;
  13. using System.Runtime.Remoting.Messaging;
  14. using System.Text;
  15. using System.Threading.Tasks;
  16. using System.Xml.Linq;
  17. namespace HH.YiDaSyncNC.DataSync
  18. {
  19. public class BX_SyncService
  20. {
  21. public string _AppType;
  22. public string _SystemToken;
  23. public string _UserId;
  24. public string _FormId;
  25. public SqlSugarClient _db;
  26. public SqlSugarClient _db_nc;
  27. public string _NCApiUrl;
  28. public static string _Static_PK_bd_project = ConfigurationManager.AppSettings["bd_project"];
  29. public static string _Static_pk_org_jt = ConfigurationManager.AppSettings["pk_org_jt"];
  30. public BX_SyncService(string AppType, string SystemToken, string UserId, string FormId, SqlSugarClient db, SqlSugarClient db_nc, string NCApiUrl)
  31. {
  32. _AppType = AppType;
  33. _SystemToken = SystemToken;
  34. _UserId = UserId;
  35. _FormId = FormId;
  36. _db = db;
  37. _db_nc = db_nc;
  38. _NCApiUrl = NCApiUrl;
  39. }
  40. #region 宜搭费用报销单
  41. public void DataSyncFYBX()
  42. {
  43. try
  44. {
  45. DingTalkService _dingTalkService = new DingTalkService(_AppType, _SystemToken, _UserId, _FormId);
  46. // 宜搭全量数据Id
  47. var serchKeyListJson = new
  48. {
  49. //radioField_lycrvvtk = "Y",
  50. //selectField_lrnh633d = "预付",
  51. };
  52. var idList = _dingTalkService.GetFormCodeList(JsonConvert.SerializeObject(serchKeyListJson));
  53. //LogHelper.WriteLog(JsonConvert.SerializeObject(idList.Count), "idList");
  54. #region 获取NC中选项数据的Id
  55. #endregion
  56. foreach (var item in idList)
  57. {
  58. var ydDataSource = _dingTalkService.GetFormDataByCode(item);
  59. string jsonData = JsonConvert.SerializeObject(ydDataSource);
  60. YiDa_FYBXD thisYiDaData = JsonConvert.DeserializeObject<YiDa_FYBXD>(jsonData);//模型还未完成
  61. }
  62. }
  63. catch (Exception ex)
  64. {
  65. throw;
  66. }
  67. }
  68. #endregion
  69. #region 宜搭差旅报销单
  70. public void DataSyncCLBX()
  71. {
  72. try
  73. {
  74. DingTalkService _dingTalkService = new DingTalkService(_AppType, _SystemToken, _UserId, _FormId);
  75. // 宜搭全量数据Id
  76. var serchKeyListJson = new
  77. {
  78. //radioField_lycrvvtk = "Y",
  79. //selectField_lrnh633d = "预付",
  80. };
  81. var idList = _dingTalkService.GetFormCodeList(JsonConvert.SerializeObject(serchKeyListJson));
  82. //LogHelper.WriteLog(JsonConvert.SerializeObject(idList.Count), "idList");
  83. #region 获取NC中选项数据的Id
  84. #endregion
  85. foreach (var item in idList)
  86. {
  87. var ydDataSource = _dingTalkService.GetFormDataByCode(item);
  88. string jsonData = JsonConvert.SerializeObject(ydDataSource);
  89. }
  90. }
  91. catch (Exception ex)
  92. {
  93. throw;
  94. }
  95. }
  96. #endregion
  97. }
  98. }