types.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. package datacenter_client
  2. type (
  3. // 公共部分
  4. Pagination struct {
  5. Current uint32 `json:"current"`
  6. PageSize uint32 `json:"pageSize"`
  7. Total uint32 `json:"total"`
  8. }
  9. AppInfo struct {
  10. Id int64 `json:"id"`
  11. AppName string `json:"app_name"`
  12. ProjectIds []int64 `json:"project_ids"`
  13. Secret string `json:"secret"`
  14. Status int64 `json:"status"`
  15. ExpireAt string `json:"expire_at"`
  16. CTime string `json:"c_time"`
  17. }
  18. ItemHistoryResp struct {
  19. ProjectId int `json:"project_id"`
  20. ItemName string `json:"item_name"`
  21. Val float64 `json:"val"`
  22. HTime string `json:"h_time"`
  23. }
  24. InstrumentCompareData struct {
  25. Max float64 `json:"max_val"`
  26. Min float64 `json:"min_val"`
  27. Avg float64 `json:"avg_val"`
  28. }
  29. RangeFirstLast struct {
  30. First float64 `json:"first"`
  31. Last float64 `json:"last"`
  32. }
  33. WorkingPump struct {
  34. Id int64 `json:"id"`
  35. ProjectId int64 `json:"project_id"`
  36. DeviceCode string `json:"device_code"`
  37. FeedPressure float64 `json:"feed_pressure"`
  38. OutPressure float64 `json:"out_pressure"`
  39. Duration int64 `json:"duration"`
  40. Current float64 `json:"current"`
  41. Frequency float64 `json:"frequency"`
  42. Lift float64 `json:"lift"`
  43. Efficiency float64 `json:"efficiency"`
  44. RunStatus int64 `json:"run_status"`
  45. FaultStatus int64 `json:"fault_status"`
  46. CTime string `json:"c_time"`
  47. }
  48. WorkingChest struct {
  49. Id int64 `json:"id"`
  50. ProjectId int64 `json:"project_id"`
  51. DeviceCode string `json:"device_code"`
  52. Switch int64 `json:"switch"`
  53. Level float64 `json:"level"`
  54. AgitatorStatus int64 `json:"agitator_status"`
  55. AgitatorDuration int64 `json:"agitator_duration"`
  56. AgitatorFaultStatus int64 `json:"agitator_fault_status"`
  57. CTime string `json:"c_time"`
  58. }
  59. WorkingRo struct {
  60. Id int64 `json:"id"`
  61. ProjectId int64 `json:"project_id"`
  62. DeviceCode string `json:"device_code"`
  63. WaterTemperature float64 `json:"water_temperature"`
  64. FeedFlow_1St float64 `json:"feed_flow_1st"`
  65. ConFlow_1St float64 `json:"con_flow_1st"`
  66. ProductFlow_1St float64 `json:"product_flow_1st"`
  67. FeedPressure_1St float64 `json:"feed_pressure_1st"`
  68. ConPressure_1St float64 `json:"con_pressure_1st"`
  69. ProductPressure_1St float64 `json:"product_pressure_1st"`
  70. Tmp_1St float64 `json:"tmp_1st"`
  71. Flux_1St float64 `json:"flux_1st"`
  72. Permeability_1St float64 `json:"permeability_1st"`
  73. FeedFlow_2Nd float64 `json:"feed_flow_2nd"`
  74. ConFlow_2Nd float64 `json:"con_flow_2nd"`
  75. ProductFlow_2Nd float64 `json:"product_flow_2nd"`
  76. FeedPressure_2Nd float64 `json:"feed_pressure_2nd"`
  77. ConPressure_2Nd float64 `json:"con_pressure_2nd"`
  78. ProductPressure_2Nd float64 `json:"product_pressure_2nd"`
  79. Tmp_2Nd float64 `json:"tmp_2nd"`
  80. Flux_2Nd float64 `json:"flux_2nd"`
  81. Permeability_2Nd float64 `json:"permeability_2nd"`
  82. FeedFlow_3Th float64 `json:"feed_flow_3th"`
  83. ConFlow_3Th float64 `json:"con_flow_3th"`
  84. ProductFlow_3Th float64 `json:"product_flow_3th"`
  85. FeedPressure_3Th float64 `json:"feed_pressure_3th"`
  86. ConPressure_3Th float64 `json:"con_pressure_3th"`
  87. ProductPressure_3Th float64 `json:"product_pressure_3th"`
  88. Tmp_3Th float64 `json:"tmp_3th"`
  89. Flux_3Th float64 `json:"flux_3th"`
  90. Permeability_3Th float64 `json:"permeability_3th"`
  91. FeedWqTurbidity float64 `json:"feed_wq_turbidity"`
  92. FeedWqPh int64 `json:"feed_wq_ph"`
  93. ProductWqPh int64 `json:"product_wq_ph"`
  94. FeedWqAl float64 `json:"feed_wq_al"`
  95. ProductWqAl float64 `json:"product_wq_al"`
  96. FeedWqFe float64 `json:"feed_wq_fe"`
  97. ProductWqFe float64 `json:"product_wq_fe"`
  98. FeedWqMn float64 `json:"feed_wq_mn"`
  99. ProductWqMn float64 `json:"product_wq_mn"`
  100. FeedWqSio2 float64 `json:"feed_wq_sio_2"`
  101. ProductWqSio2 float64 `json:"product_wq_sio_2"`
  102. FeedWqCod float64 `json:"feed_wq_cod"`
  103. ProductWqCod float64 `json:"product_wq_cod"`
  104. FeedWqP float64 `json:"feed_wq_p"`
  105. ProductWqP float64 `json:"product_wq_p"`
  106. Step int64 `json:"step"`
  107. FilterTime float64 `json:"filter_time"`
  108. FilterCycle int64 `json:"filter_cycle"`
  109. CTime string `json:"c_time"`
  110. }
  111. WorkingUf struct {
  112. Id int64 `json:"id"`
  113. ProjectId int64 `json:"project_id"`
  114. DeviceCode string `json:"device_code"`
  115. WaterTemperature float64 `json:"water_temperature"`
  116. FeedFlow float64 `json:"feed_flow"`
  117. ConFlow float64 `json:"con_flow"`
  118. ProductFlow float64 `json:"product_flow"`
  119. FeedPressure float64 `json:"feed_pressure"`
  120. ConPressure float64 `json:"con_pressure"`
  121. ProductPressure float64 `json:"product_pressure"`
  122. Tmp float64 `json:"tmp"`
  123. Flux float64 `json:"flux"`
  124. Permeability float64 `json:"permeability"`
  125. FeedWqTurbidity float64 `json:"feed_wq_turbidity"`
  126. FeedWqPh int64 `json:"feed_wq_ph"`
  127. ProductWqPh int64 `json:"product_wq_ph"`
  128. FeedWqAl float64 `json:"feed_wq_al"`
  129. ProductWqAl float64 `json:"product_wq_al"`
  130. FeedWqFe float64 `json:"feed_wq_fe"`
  131. ProductWqFe float64 `json:"product_wq_fe"`
  132. FeedWqMn float64 `json:"feed_wq_mn"`
  133. ProductWqMn float64 `json:"product_wq_mn"`
  134. FeedWqSio2 float64 `json:"feed_wq_sio_2"`
  135. ProductWqSio2 float64 `json:"product_wq_sio_2"`
  136. FeedWqCod float64 `json:"feed_wq_cod"`
  137. ProductWqCod float64 `json:"product_wq_cod"`
  138. FeedWqP float64 `json:"feed_wq_p"`
  139. ProductWqP float64 `json:"product_wq_p"`
  140. Step int64 `json:"step"`
  141. FilterTime float64 `json:"filter_time"`
  142. FilterCycle int64 `json:"filter_cycle"`
  143. CTime string `json:"c_time"`
  144. }
  145. DataDescribeInfo struct {
  146. Count uint32 `json:"count"`
  147. Min float64 `json:"min"`
  148. Max float64 `json:"max"`
  149. Mean float64 `json:"mean"`
  150. StdDev float64 `json:"std_dev"`
  151. VarDev float64 `json:"var_dev"`
  152. P25 float64 `json:"p25"`
  153. P50 float64 `json:"p50"`
  154. P75 float64 `json:"p75"`
  155. St string `json:"st"`
  156. Et string `json:"et"`
  157. }
  158. RelatedItems struct {
  159. Item string `json:"item"`
  160. Coefficient float32 `json:"coefficient"`
  161. }
  162. DataCorrelationInfo struct {
  163. RelatedItems map[string]*RelatedItems `json:"related_items"`
  164. St string `json:"st"`
  165. Et string `json:"et"`
  166. }
  167. DataDescribeMinAndMaxInfo struct {
  168. Min float64 `json:"min"`
  169. Max float64 `json:"max"`
  170. }
  171. KyLinkInfo struct {
  172. Id int64 `json:"id"`
  173. ProjectId int64 `json:"project_id"`
  174. Customer int64 `json:"customer"`
  175. Name string `json:"name"`
  176. COM1_D1_PH float64 `json:"COM1_D1_PH"`
  177. COM1_D2_Tag1 float64 `json:"COM1_D2_Tag1"`
  178. COM1_D2_Tag2 float64 `json:"COM1_D2_Tag2"`
  179. COM2_D1_Tag1 float64 `json:"COM2_D1_Tag1"`
  180. COM2_D1_Tag2 float64 `json:"COM2_D1_Tag2"`
  181. COM2_D2_Tag1 float64 `json:"COM2_D2_Tag1"`
  182. COM2_D2_Tag2 float64 `json:"COM2_D2_Tag2"`
  183. CTime string `json:"c_time"`
  184. }
  185. )
  186. type (
  187. // 请求参数部分
  188. FindWorkingUfByCycleReq struct {
  189. ProjectId int64
  190. DeviceCode string
  191. FilterCycle int64
  192. Step int64
  193. FilterTimeStart float64
  194. FilterTimeEnd float64
  195. Limit int64
  196. }
  197. DcWorkingReq struct {
  198. ProjectId int64
  199. DeviceCode string
  200. Stime string
  201. Etime string
  202. Page int64
  203. PageSize int64
  204. Order string
  205. }
  206. // 点位最大 and 最小值请求
  207. RangeMaxMinReq struct {
  208. ProjectId string
  209. ItemName string
  210. Stime string
  211. Etime string
  212. }
  213. RangeFirstLastReq struct {
  214. ProjectId string
  215. ItemName string
  216. Stime string
  217. Etime string
  218. }
  219. ItemHistoryReq struct {
  220. ProjectId string
  221. ItemName string
  222. Stime string
  223. Etime string
  224. }
  225. // 点位数据写入结构
  226. ItemHistoryData struct {
  227. ProjectId int `json:"project_id"`
  228. ItemName string `json:"item_name"`
  229. Val float64 `json:"val"`
  230. HTime string `json:"h_time"`
  231. }
  232. // 点位数据写入请求
  233. MultiAddReq struct {
  234. List []ItemHistoryData `json:"list"`
  235. }
  236. ItemHistoryListReq struct {
  237. ProjectId int
  238. ItemName string
  239. Stime string
  240. Etime string
  241. Size int
  242. Interval string // 时间单位 minute,h,day,s
  243. Aggregator string // 聚合方式 min,max,avg,sum,realtime, new
  244. MaxVal float64 `json:"max_val"`
  245. MinVal float64 `json:"min_val"`
  246. }
  247. FindAppListReq struct {
  248. ProjectId int64 `json:"project_id"`
  249. Page int64 `json:"page"`
  250. PageSize int64 `json:"page_size"`
  251. Order string `json:"order"`
  252. }
  253. GetAppInfoReq struct {
  254. ProjectId int64 `json:"project_id"`
  255. AppName string `json:"app_name"`
  256. }
  257. CreateAppInfoReq struct {
  258. ProjectId int64 `json:"project_id"`
  259. AppName string `json:"app_name"`
  260. ProjectIds []int64 `json:"project_ids"`
  261. Expire int64 `json:"expire"`
  262. }
  263. RemoveAppInfoReq struct {
  264. ProjectId int64 `json:"project_id"`
  265. AppName string `json:"app_name"`
  266. }
  267. DisableAppInfoReq struct {
  268. ProjectId int64 `json:"project_id"`
  269. AppName string `json:"app_name"`
  270. }
  271. EnableAppInfoReq struct {
  272. ProjectId int64 `json:"project_id"`
  273. AppName string `json:"app_name"`
  274. }
  275. ResetAppSecretReq struct {
  276. ProjectId int64 `json:"project_id"`
  277. AppName string `json:"app_name"`
  278. }
  279. ExpireAppSecretReq struct {
  280. ProjectId int64 `json:"project_id"`
  281. AppName string `json:"app_name"`
  282. Expire int64 `json:"expire"`
  283. }
  284. ResetAppProjectReq struct {
  285. ProjectId int64 `json:"project_id"`
  286. AppName string `json:"app_name"`
  287. ProjectIds []int64 `json:"project_ids"`
  288. }
  289. FindDataDescribeReq struct {
  290. ProjectId int64
  291. Items []string
  292. Stime string
  293. Etime string
  294. }
  295. FindDataCorrelationReq struct {
  296. ProjectId int64
  297. Items []string
  298. Stime string
  299. Etime string
  300. }
  301. FindDataMinAndMaxReq struct {
  302. ProjectId int64
  303. Items []string
  304. Stime string
  305. Etime string
  306. }
  307. FindKyLinkDataReq struct {
  308. ProjectId int64
  309. Customer string
  310. Stime string
  311. Etime string
  312. Page int64
  313. PageSize int64
  314. Order string
  315. OnlyEven int
  316. }
  317. )
  318. type (
  319. // 响应结构部分
  320. GetWorkingPumpByCodeResp struct {
  321. Code int `json:"code"`
  322. Msg string `json:"msg"`
  323. Data struct {
  324. List []WorkingPump `json:"list"`
  325. } `json:"data"`
  326. }
  327. GetWorkingChestByCodeResp struct {
  328. Code int `json:"code"`
  329. Msg string `json:"msg"`
  330. Data struct {
  331. List []WorkingChest `json:"list"`
  332. } `json:"data"`
  333. }
  334. GetWorkingRoByCodeResp struct {
  335. Code int `json:"code"`
  336. Msg string `json:"msg"`
  337. Data struct {
  338. List []WorkingRo `json:"list"`
  339. } `json:"data"`
  340. }
  341. FindWorkingUfByCycleResp struct {
  342. Code int `json:"code"`
  343. Msg string `json:"msg"`
  344. Data struct {
  345. List []WorkingUf `json:"list"`
  346. } `json:"data"`
  347. }
  348. GetWorkingUfByCodeResp struct {
  349. Code int `json:"code"`
  350. Msg string `json:"msg"`
  351. Data struct {
  352. List []WorkingUf `json:"list"`
  353. } `json:"data"`
  354. }
  355. RangeMaxMinResp struct {
  356. Code int `json:"code"`
  357. Msg string `json:"msg"`
  358. Data *InstrumentCompareData `json:"data"`
  359. }
  360. RangeFirstLastResp struct {
  361. Code int `json:"code"`
  362. Msg string `json:"msg"`
  363. Data *RangeFirstLast `json:"data"`
  364. }
  365. ItemHistoryRespList struct {
  366. List []ItemHistoryResp
  367. }
  368. ItemHistoryListResp struct {
  369. Name string `json:"name"`
  370. Htime string `json:"htime_at"`
  371. Val float64 `json:"val"`
  372. }
  373. ItemHistoryListRespList struct {
  374. List []ItemHistoryListResp
  375. }
  376. MultiAddBody struct {
  377. Code int `json:"code"`
  378. Msg string `json:"msg"`
  379. }
  380. ItemHistoryBody struct {
  381. Code int `json:"code"`
  382. Msg string `json:"msg"`
  383. Data ItemHistoryRespList `json:"data"`
  384. }
  385. ItemHistoryListBody struct {
  386. Code int `json:"code"`
  387. Msg string `json:"msg"`
  388. Data ItemHistoryListRespList `json:"data"`
  389. }
  390. FindAppListResp struct {
  391. Code int `json:"code"`
  392. Msg string `json:"msg"`
  393. Data struct {
  394. List []*AppInfo `json:"list"`
  395. Pagination *Pagination `json:"pagination"`
  396. } `json:"data"`
  397. }
  398. GetAppInfoResp struct {
  399. Code int `json:"code"`
  400. Msg string `json:"msg"`
  401. Data struct {
  402. AppInfo *AppInfo `json:"app_info"`
  403. } `json:"data"`
  404. }
  405. CreateAppInfoResp struct {
  406. Code int `json:"code"`
  407. Msg string `json:"msg"`
  408. Data struct {
  409. AppInfo *AppInfo `json:"app_info"`
  410. } `json:"data"`
  411. }
  412. RemoveAppInfoResp struct {
  413. Code int `json:"code"`
  414. Msg string `json:"msg"`
  415. Data struct {
  416. Ok bool `json:"ok"`
  417. } `json:"data"`
  418. }
  419. DisableAppInfoResp struct {
  420. Code int `json:"code"`
  421. Msg string `json:"msg"`
  422. Data struct {
  423. Ok bool `json:"ok"`
  424. } `json:"data"`
  425. }
  426. EnableAppInfoResp struct {
  427. Code int `json:"code"`
  428. Msg string `json:"msg"`
  429. Data struct {
  430. Ok bool `json:"ok"`
  431. } `json:"data"`
  432. }
  433. ResetAppSecretResp struct {
  434. Code int `json:"code"`
  435. Msg string `json:"msg"`
  436. Data struct {
  437. Secret string `json:"secret"`
  438. } `json:"data"`
  439. }
  440. ExpireAppSecretResp struct {
  441. Code int `json:"code"`
  442. Msg string `json:"msg"`
  443. Data struct {
  444. ExpireAt string `json:"expire_at"`
  445. } `json:"data"`
  446. }
  447. ResetAppProjectResp struct {
  448. Code int `json:"code"`
  449. Msg string `json:"msg"`
  450. Data struct {
  451. RemoveProjectIds []int64 `json:"remove_project_ids"`
  452. } `json:"data"`
  453. }
  454. FindDataDescribeResp struct {
  455. Code int `json:"code"`
  456. Msg string `json:"msg"`
  457. Data struct {
  458. List map[string]*DataDescribeInfo `json:"list"`
  459. } `json:"data"`
  460. }
  461. FindDataCorrelationResp struct {
  462. Code int `json:"code"`
  463. Msg string `json:"msg"`
  464. Data struct {
  465. DataCorrelationInfo
  466. List map[string]*DataCorrelationInfo `json:"list"`
  467. } `json:"data"`
  468. }
  469. FindKyLinkDataResp struct {
  470. Code int `json:"code"`
  471. Msg string `json:"msg"`
  472. Data struct {
  473. List []*KyLinkInfo `json:"list"`
  474. } `json:"data"`
  475. }
  476. FindDataMinAndMaxResp struct {
  477. Code int `json:"code"`
  478. Msg string `json:"msg"`
  479. Data struct {
  480. DataCorrelationInfo
  481. List map[string]*DataDescribeMinAndMaxInfo `json:"list"`
  482. } `json:"data"`
  483. }
  484. )
  485. type (
  486. // DcAPI 在这里定义了数据中心接口, 具体实现在版本目录中(目前只有v1)
  487. DcAPI interface {
  488. // GetItemHistory 查询历史点位数据
  489. GetItemHistory(req ItemHistoryReq) (resp []ItemHistoryResp, err error)
  490. // MultiAddData 点位数据写入
  491. MultiAddData(req MultiAddReq) (err error)
  492. // ObtainRangeMaxMin 查询最大最小值
  493. ObtainRangeMaxMin(req *RangeMaxMinReq) (resp *InstrumentCompareData, err error)
  494. // ObtainRangeMaxMin 查询最大最小值
  495. ObtainRangeFirstLast(req *RangeFirstLastReq) (resp *RangeFirstLast, err error)
  496. // GetWorkingUfByCode 获得uf工况数据
  497. GetWorkingUfByCode(DcWorkingReq) (*GetWorkingUfByCodeResp, error)
  498. // FindWorkingUfByCycle 查询uf工况数据, 按周期进行过滤
  499. FindWorkingUfByCycle(FindWorkingUfByCycleReq) (*FindWorkingUfByCycleResp, error)
  500. // GetWorkingRoByCode 查询ro工况数据
  501. GetWorkingRoByCode(DcWorkingReq) (*GetWorkingRoByCodeResp, error)
  502. // GetWorkingChestByCode 查询液体容器类工况数据
  503. GetWorkingChestByCode(DcWorkingReq) (*GetWorkingChestByCodeResp, error)
  504. // GetWorkingPumpByCode 查询泵类工况数据
  505. GetWorkingPumpByCode(DcWorkingReq) (*GetWorkingPumpByCodeResp, error)
  506. // 平替双胞胎图表接口(时间区间内按要求聚合)
  507. GetItemHistoryList(ItemHistoryListReq) (resp []ItemHistoryListResp, err error)
  508. FindAppList(FindAppListReq) (*FindAppListResp, error)
  509. GetAppInfo(GetAppInfoReq) (*GetAppInfoResp, error)
  510. CreateAppInfo(CreateAppInfoReq) (*CreateAppInfoResp, error)
  511. RemoveAppInfo(RemoveAppInfoReq) (*RemoveAppInfoResp, error)
  512. DisableAppInfo(DisableAppInfoReq) (*DisableAppInfoResp, error)
  513. EnableAppInfo(EnableAppInfoReq) (*EnableAppInfoResp, error)
  514. ResetAppSecret(ResetAppSecretReq) (*ResetAppSecretResp, error)
  515. ExpireAppSecret(ExpireAppSecretReq) (*ExpireAppSecretResp, error)
  516. ResetAppProject(ResetAppProjectReq) (*ResetAppProjectResp, error)
  517. // FindDataDescribe 拉取数据分析结果, 某一个时间段内的数据, 该时间段不会跨段
  518. FindDataDescribe(FindDataDescribeReq) (*FindDataDescribeResp, error)
  519. // FindDataCorrelation 拉取数据相关性列表
  520. FindDataCorrelation(FindDataCorrelationReq) (*FindDataCorrelationResp, error)
  521. // FindDataMinAndMax 拉取数据分析结果, 时间段内的最小与最大值
  522. FindDataMinAndMax(FindDataMinAndMaxReq) (*FindDataMinAndMaxResp, error)
  523. // FindKyLink 泛联数据接口
  524. FindKyLink(FindKyLinkDataReq) (*FindKyLinkDataResp, error)
  525. }
  526. )