LongcheerConfig.java 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. package com.uas.eis.longcheer.config;
  2. import org.springframework.boot.context.properties.ConfigurationProperties;
  3. import org.springframework.stereotype.Component;
  4. /**
  5. * 龙旗接口对接配置属性
  6. *
  7. * @author ZXL
  8. * @date 2026-06-26
  9. */
  10. @Component
  11. @ConfigurationProperties(prefix = "longcheer")
  12. public class LongcheerConfig {
  13. /** 库存同步接口配置 */
  14. private Inventory inventory = new Inventory();
  15. /** 采购订单推送接口配置 */
  16. private Po po = new Po();
  17. /** 请求超时时间(毫秒),默认 30000 */
  18. private int timeout = 30000;
  19. /** 失败重试次数,默认 3 */
  20. private int retryTimes = 3;
  21. /** 重试间隔(毫秒),默认 30000 */
  22. private int retryInterval = 30000;
  23. /** ELS 账号 -> 租户标识 的映射关系,用于龙旗不传 master 参数时自动定位租户 */
  24. private java.util.Map<String, String> accountMapping = new java.util.HashMap<String, String>();
  25. /** 租户标识 -> 供应商 ERP 编码 的映射关系,用于库存推送接口动态填 supplierErpCode */
  26. private java.util.Map<String, String> supplierMapping = new java.util.HashMap<String, String>();
  27. public static class Inventory {
  28. /** 应用密钥 Key(默认值,credentials 未匹配时使用) */
  29. private String appKey;
  30. /** 应用密钥 Secret(默认值,credentials 未匹配时使用) */
  31. private String appSecret;
  32. /** 接口地址 */
  33. private String url;
  34. /** 按 master 区分的凭证映射,key=master,value=该 master 对应的 appKey/appSecret */
  35. private java.util.Map<String, Credential> credentials = new java.util.HashMap<String, Credential>();
  36. public String getAppKey() {
  37. return appKey;
  38. }
  39. public void setAppKey(String appKey) {
  40. this.appKey = appKey;
  41. }
  42. public String getAppSecret() {
  43. return appSecret;
  44. }
  45. public void setAppSecret(String appSecret) {
  46. this.appSecret = appSecret;
  47. }
  48. public String getUrl() {
  49. return url;
  50. }
  51. public void setUrl(String url) {
  52. this.url = url;
  53. }
  54. public java.util.Map<String, Credential> getCredentials() {
  55. return credentials;
  56. }
  57. public void setCredentials(java.util.Map<String, Credential> credentials) {
  58. this.credentials = credentials;
  59. }
  60. }
  61. public static class Po {
  62. /** 应用密钥 Key(默认值,credentials 未匹配时使用) */
  63. private String appKey;
  64. /** 应用密钥 Secret(默认值,credentials 未匹配时使用) */
  65. private String appSecret;
  66. /** 接口地址 */
  67. private String url;
  68. /** 按 elsAccount 区分的凭证映射,key=elsAccount,value=该 elsAccount 对应的 appKey/appSecret */
  69. private java.util.Map<String, Credential> credentials = new java.util.HashMap<String, Credential>();
  70. public String getAppKey() {
  71. return appKey;
  72. }
  73. public void setAppKey(String appKey) {
  74. this.appKey = appKey;
  75. }
  76. public String getAppSecret() {
  77. return appSecret;
  78. }
  79. public void setAppSecret(String appSecret) {
  80. this.appSecret = appSecret;
  81. }
  82. public String getUrl() {
  83. return url;
  84. }
  85. public void setUrl(String url) {
  86. this.url = url;
  87. }
  88. public java.util.Map<String, Credential> getCredentials() {
  89. return credentials;
  90. }
  91. public void setCredentials(java.util.Map<String, Credential> credentials) {
  92. this.credentials = credentials;
  93. }
  94. }
  95. /**
  96. * 凭证信息(appKey + appSecret)
  97. */
  98. public static class Credential {
  99. /** 应用密钥 Key */
  100. private String appKey;
  101. /** 应用密钥 Secret */
  102. private String appSecret;
  103. public String getAppKey() {
  104. return appKey;
  105. }
  106. public void setAppKey(String appKey) {
  107. this.appKey = appKey;
  108. }
  109. public String getAppSecret() {
  110. return appSecret;
  111. }
  112. public void setAppSecret(String appSecret) {
  113. this.appSecret = appSecret;
  114. }
  115. }
  116. public Inventory getInventory() {
  117. return inventory;
  118. }
  119. public void setInventory(Inventory inventory) {
  120. this.inventory = inventory;
  121. }
  122. public Po getPo() {
  123. return po;
  124. }
  125. public void setPo(Po po) {
  126. this.po = po;
  127. }
  128. public int getTimeout() {
  129. return timeout;
  130. }
  131. public void setTimeout(int timeout) {
  132. this.timeout = timeout;
  133. }
  134. public int getRetryTimes() {
  135. return retryTimes;
  136. }
  137. public void setRetryTimes(int retryTimes) {
  138. this.retryTimes = retryTimes;
  139. }
  140. public int getRetryInterval() {
  141. return retryInterval;
  142. }
  143. public void setRetryInterval(int retryInterval) {
  144. this.retryInterval = retryInterval;
  145. }
  146. public java.util.Map<String, String> getAccountMapping() {
  147. return accountMapping;
  148. }
  149. public void setAccountMapping(java.util.Map<String, String> accountMapping) {
  150. this.accountMapping = accountMapping;
  151. }
  152. public java.util.Map<String, String> getSupplierMapping() {
  153. return supplierMapping;
  154. }
  155. public void setSupplierMapping(java.util.Map<String, String> supplierMapping) {
  156. this.supplierMapping = supplierMapping;
  157. }
  158. }