types.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  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_1_st"`
  65. ConFlow_1St float64 `json:"con_flow_1_st"`
  66. ProductFlow_1St float64 `json:"product_flow_1_st"`
  67. FeedPressure_1St float64 `json:"feed_pressure_1_st"`
  68. ConPressure_1St float64 `json:"con_pressure_1_st"`
  69. ProductPressure_1St float64 `json:"product_pressure_1_st"`
  70. Tmp_1St float64 `json:"tmp_1_st"`
  71. Flux_1St float64 `json:"flux_1_st"`
  72. Permeability_1St float64 `json:"permeability_1_st"`
  73. FeedFlow_2Nd float64 `json:"feed_flow_2_nd"`
  74. ConFlow_2Nd float64 `json:"con_flow_2_nd"`
  75. ProductFlow_2Nd float64 `json:"product_flow_2_nd"`
  76. FeedPressure_2Nd float64 `json:"feed_pressure_2_nd"`
  77. ConPressure_2Nd float64 `json:"con_pressure_2_nd"`
  78. ProductPressure_2Nd float64 `json:"product_pressure_2_nd"`
  79. Tmp_2Nd float64 `json:"tmp_2_nd"`
  80. Flux_2Nd float64 `json:"flux_2_nd"`
  81. Permeability_2Nd float64 `json:"permeability_2_nd"`
  82. FeedFlow_3Th float64 `json:"feed_flow_3_th"`
  83. ConFlow_3Th float64 `json:"con_flow_3_th"`
  84. ProductFlow_3Th float64 `json:"product_flow_3_th"`
  85. FeedPressure_3Th float64 `json:"feed_pressure_3_th"`
  86. ConPressure_3Th float64 `json:"con_pressure_3_th"`
  87. ProductPressure_3Th float64 `json:"product_pressure_3_th"`
  88. Tmp_3Th float64 `json:"tmp_3_th"`
  89. Flux_3Th float64 `json:"flux_3_th"`
  90. Permeability_3Th float64 `json:"permeability_3_th"`
  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. CTime string `json:"c_time"`
  108. }
  109. WorkingUf struct {
  110. Id int64 `json:"id"`
  111. ProjectId int64 `json:"project_id"`
  112. DeviceCode string `json:"device_code"`
  113. WaterTemperature float64 `json:"water_temperature"`
  114. FeedFlow float64 `json:"feed_flow"`
  115. ConFlow float64 `json:"con_flow"`
  116. ProductFlow float64 `json:"product_flow"`
  117. FeedPressure float64 `json:"feed_pressure"`
  118. ConPressure float64 `json:"con_pressure"`
  119. ProductPressure float64 `json:"product_pressure"`
  120. Tmp float64 `json:"tmp"`
  121. Flux float64 `json:"flux"`
  122. Permeability float64 `json:"permeability"`
  123. FeedWqTurbidity float64 `json:"feed_wq_turbidity"`
  124. FeedWqPh int64 `json:"feed_wq_ph"`
  125. ProductWqPh int64 `json:"product_wq_ph"`
  126. FeedWqAl float64 `json:"feed_wq_al"`
  127. ProductWqAl float64 `json:"product_wq_al"`
  128. FeedWqFe float64 `json:"feed_wq_fe"`
  129. ProductWqFe float64 `json:"product_wq_fe"`
  130. FeedWqMn float64 `json:"feed_wq_mn"`
  131. ProductWqMn float64 `json:"product_wq_mn"`
  132. FeedWqSio2 float64 `json:"feed_wq_sio_2"`
  133. ProductWqSio2 float64 `json:"product_wq_sio_2"`
  134. FeedWqCod float64 `json:"feed_wq_cod"`
  135. ProductWqCod float64 `json:"product_wq_cod"`
  136. FeedWqP float64 `json:"feed_wq_p"`
  137. ProductWqP float64 `json:"product_wq_p"`
  138. Step int64 `json:"step"`
  139. FilterTime float64 `json:"filter_time"`
  140. FilterCycle int64 `json:"filter_cycle"`
  141. CTime string `json:"c_time"`
  142. }
  143. DataDescribeInfo struct {
  144. Count uint32 `json:"count"`
  145. Min float64 `json:"min"`
  146. Max float64 `json:"max"`
  147. Mean float64 `json:"mean"`
  148. StdDev float64 `json:"std_dev"`
  149. VarDev float64 `json:"var_dev"`
  150. P25 float64 `json:"p25"`
  151. P50 float64 `json:"p50"`
  152. P75 float64 `json:"p75"`
  153. St string `json:"st"`
  154. Et string `json:"et"`
  155. }
  156. RelatedItems struct {
  157. Item string `json:"item"`
  158. Coefficient float32 `json:"coefficient"`
  159. }
  160. DataCorrelationInfo struct {
  161. RelatedItems map[string]*RelatedItems `json:"related_items"`
  162. St string `json:"st"`
  163. Et string `json:"et"`
  164. }
  165. DataDescribeMinAndMaxInfo struct {
  166. Min float64 `json:"min"`
  167. Max float64 `json:"max"`
  168. }
  169. )
  170. type (
  171. // 请求参数部分
  172. FindWorkingUfByCycleReq struct {
  173. ProjectId int64
  174. DeviceCode string
  175. FilterCycle int64
  176. Step int64
  177. FilterTimeStart float64
  178. FilterTimeEnd float64
  179. Limit int64
  180. }
  181. DcWorkingReq struct {
  182. ProjectId int64
  183. DeviceCode string
  184. Stime string
  185. Etime string
  186. Page int64
  187. PageSize int64
  188. Order string
  189. }
  190. // 点位最大 and 最小值请求
  191. RangeMaxMinReq struct {
  192. ProjectId string
  193. ItemName string
  194. Stime string
  195. Etime string
  196. }
  197. RangeFirstLastReq struct {
  198. ProjectId string
  199. ItemName string
  200. Stime string
  201. Etime string
  202. }
  203. ItemHistoryReq struct {
  204. ProjectId string
  205. ItemName string
  206. Stime string
  207. Etime string
  208. }
  209. // 点位数据写入结构
  210. ItemHistoryData struct {
  211. ProjectId int `json:"project_id"`
  212. ItemName string `json:"item_name"`
  213. Val float64 `json:"val"`
  214. HTime string `json:"h_time"`
  215. }
  216. // 点位数据写入请求
  217. MultiAddReq struct {
  218. List []ItemHistoryData `json:"list"`
  219. }
  220. ItemHistoryListReq struct {
  221. ProjectId int
  222. ItemName string
  223. Stime string
  224. Etime string
  225. Size int
  226. Interval string // 时间单位 minute,h,day,s
  227. Aggregator string // 聚合方式 min,max,avg,sum,realtime, new
  228. MaxVal float64 `json:"max_val"`
  229. MinVal float64 `json:"min_val"`
  230. }
  231. FindAppListReq struct {
  232. ProjectId int64 `json:"project_id"`
  233. Page int64 `json:"page"`
  234. PageSize int64 `json:"page_size"`
  235. Order string `json:"order"`
  236. }
  237. GetAppInfoReq struct {
  238. ProjectId int64 `json:"project_id"`
  239. AppName string `json:"app_name"`
  240. }
  241. CreateAppInfoReq struct {
  242. ProjectId int64 `json:"project_id"`
  243. AppName string `json:"app_name"`
  244. ProjectIds []int64 `json:"project_ids"`
  245. Expire int64 `json:"expire"`
  246. }
  247. RemoveAppInfoReq struct {
  248. ProjectId int64 `json:"project_id"`
  249. AppName string `json:"app_name"`
  250. }
  251. DisableAppInfoReq struct {
  252. ProjectId int64 `json:"project_id"`
  253. AppName string `json:"app_name"`
  254. }
  255. EnableAppInfoReq struct {
  256. ProjectId int64 `json:"project_id"`
  257. AppName string `json:"app_name"`
  258. }
  259. ResetAppSecretReq struct {
  260. ProjectId int64 `json:"project_id"`
  261. AppName string `json:"app_name"`
  262. }
  263. ExpireAppSecretReq struct {
  264. ProjectId int64 `json:"project_id"`
  265. AppName string `json:"app_name"`
  266. Expire int64 `json:"expire"`
  267. }
  268. ResetAppProjectReq struct {
  269. ProjectId int64 `json:"project_id"`
  270. AppName string `json:"app_name"`
  271. ProjectIds []int64 `json:"project_ids"`
  272. }
  273. FindDataDescribeReq struct {
  274. ProjectId int64
  275. Items []string
  276. Stime string
  277. Etime string
  278. }
  279. FindDataCorrelationReq struct {
  280. ProjectId int64
  281. Items []string
  282. Stime string
  283. Etime string
  284. }
  285. FindDataMinAndMaxReq struct {
  286. ProjectId int64
  287. Items []string
  288. Stime string
  289. Etime string
  290. }
  291. )
  292. type (
  293. // 响应结构部分
  294. GetWorkingPumpByCodeResp struct {
  295. Code int `json:"code"`
  296. Msg string `json:"msg"`
  297. Data struct {
  298. List []WorkingPump `json:"list"`
  299. } `json:"data"`
  300. }
  301. GetWorkingChestByCodeResp struct {
  302. Code int `json:"code"`
  303. Msg string `json:"msg"`
  304. Data struct {
  305. List []WorkingChest `json:"list"`
  306. } `json:"data"`
  307. }
  308. GetWorkingRoByCodeResp struct {
  309. Code int `json:"code"`
  310. Msg string `json:"msg"`
  311. Data struct {
  312. List []WorkingRo `json:"list"`
  313. } `json:"data"`
  314. }
  315. FindWorkingUfByCycleResp struct {
  316. Code int `json:"code"`
  317. Msg string `json:"msg"`
  318. Data struct {
  319. List []WorkingUf `json:"list"`
  320. } `json:"data"`
  321. }
  322. GetWorkingUfByCodeResp struct {
  323. Code int `json:"code"`
  324. Msg string `json:"msg"`
  325. Data struct {
  326. List []WorkingUf `json:"list"`
  327. } `json:"data"`
  328. }
  329. RangeMaxMinResp struct {
  330. Code int `json:"code"`
  331. Msg string `json:"msg"`
  332. Data *InstrumentCompareData `json:"data"`
  333. }
  334. RangeFirstLastResp struct {
  335. Code int `json:"code"`
  336. Msg string `json:"msg"`
  337. Data *RangeFirstLast `json:"data"`
  338. }
  339. ItemHistoryRespList struct {
  340. List []ItemHistoryResp
  341. }
  342. ItemHistoryListResp struct {
  343. Name string `json:"name"`
  344. Htime string `json:"htime_at"`
  345. Val float64 `json:"val"`
  346. }
  347. ItemHistoryListRespList struct {
  348. List []ItemHistoryListResp
  349. }
  350. MultiAddBody struct {
  351. Code int `json:"code"`
  352. Msg string `json:"msg"`
  353. }
  354. ItemHistoryBody struct {
  355. Code int `json:"code"`
  356. Msg string `json:"msg"`
  357. Data ItemHistoryRespList `json:"data"`
  358. }
  359. ItemHistoryListBody struct {
  360. Code int `json:"code"`
  361. Msg string `json:"msg"`
  362. Data ItemHistoryListRespList `json:"data"`
  363. }
  364. FindAppListResp struct {
  365. Code int `json:"code"`
  366. Msg string `json:"msg"`
  367. Data struct {
  368. List []*AppInfo `json:"list"`
  369. Pagination *Pagination `json:"pagination"`
  370. } `json:"data"`
  371. }
  372. GetAppInfoResp struct {
  373. Code int `json:"code"`
  374. Msg string `json:"msg"`
  375. Data struct {
  376. AppInfo *AppInfo `json:"app_info"`
  377. } `json:"data"`
  378. }
  379. CreateAppInfoResp struct {
  380. Code int `json:"code"`
  381. Msg string `json:"msg"`
  382. Data struct {
  383. AppInfo *AppInfo `json:"app_info"`
  384. } `json:"data"`
  385. }
  386. RemoveAppInfoResp struct {
  387. Code int `json:"code"`
  388. Msg string `json:"msg"`
  389. Data struct {
  390. Ok bool `json:"ok"`
  391. } `json:"data"`
  392. }
  393. DisableAppInfoResp struct {
  394. Code int `json:"code"`
  395. Msg string `json:"msg"`
  396. Data struct {
  397. Ok bool `json:"ok"`
  398. } `json:"data"`
  399. }
  400. EnableAppInfoResp struct {
  401. Code int `json:"code"`
  402. Msg string `json:"msg"`
  403. Data struct {
  404. Ok bool `json:"ok"`
  405. } `json:"data"`
  406. }
  407. ResetAppSecretResp struct {
  408. Code int `json:"code"`
  409. Msg string `json:"msg"`
  410. Data struct {
  411. Secret string `json:"secret"`
  412. } `json:"data"`
  413. }
  414. ExpireAppSecretResp struct {
  415. Code int `json:"code"`
  416. Msg string `json:"msg"`
  417. Data struct {
  418. ExpireAt string `json:"expire_at"`
  419. } `json:"data"`
  420. }
  421. ResetAppProjectResp struct {
  422. Code int `json:"code"`
  423. Msg string `json:"msg"`
  424. Data struct {
  425. RemoveProjectIds []int64 `json:"remove_project_ids"`
  426. } `json:"data"`
  427. }
  428. FindDataDescribeResp struct {
  429. Code int `json:"code"`
  430. Msg string `json:"msg"`
  431. Data struct {
  432. List map[string]*DataDescribeInfo `json:"list"`
  433. } `json:"data"`
  434. }
  435. FindDataCorrelationResp struct {
  436. Code int `json:"code"`
  437. Msg string `json:"msg"`
  438. Data struct {
  439. DataCorrelationInfo
  440. List map[string]*DataCorrelationInfo `json:"list"`
  441. } `json:"data"`
  442. }
  443. FindDataMinAndMaxResp struct {
  444. Code int `json:"code"`
  445. Msg string `json:"msg"`
  446. Data struct {
  447. DataCorrelationInfo
  448. List map[string]*DataDescribeMinAndMaxInfo `json:"list"`
  449. } `json:"data"`
  450. }
  451. )
  452. type (
  453. // DcAPI 在这里定义了数据中心接口, 具体实现在版本目录中(目前只有v1)
  454. DcAPI interface {
  455. // GetItemHistory 查询历史点位数据
  456. GetItemHistory(req ItemHistoryReq) (resp []ItemHistoryResp, err error)
  457. // MultiAddData 点位数据写入
  458. MultiAddData(req MultiAddReq) (err error)
  459. // ObtainRangeMaxMin 查询最大最小值
  460. ObtainRangeMaxMin(req *RangeMaxMinReq) (resp *InstrumentCompareData, err error)
  461. // ObtainRangeMaxMin 查询最大最小值
  462. ObtainRangeFirstLast(req *RangeFirstLastReq) (resp *RangeFirstLast, err error)
  463. // GetWorkingUfByCode 获得uf工况数据
  464. GetWorkingUfByCode(DcWorkingReq) (*GetWorkingUfByCodeResp, error)
  465. // FindWorkingUfByCycle 查询uf工况数据, 按周期进行过滤
  466. FindWorkingUfByCycle(FindWorkingUfByCycleReq) (*FindWorkingUfByCycleResp, error)
  467. // GetWorkingRoByCode 查询ro工况数据
  468. GetWorkingRoByCode(DcWorkingReq) (*GetWorkingRoByCodeResp, error)
  469. // GetWorkingChestByCode 查询液体容器类工况数据
  470. GetWorkingChestByCode(DcWorkingReq) (*GetWorkingChestByCodeResp, error)
  471. // GetWorkingPumpByCode 查询泵类工况数据
  472. GetWorkingPumpByCode(DcWorkingReq) (*GetWorkingPumpByCodeResp, error)
  473. // 平替双胞胎图表接口(时间区间内按要求聚合)
  474. GetItemHistoryList(ItemHistoryListReq) (resp []ItemHistoryListResp, err error)
  475. FindAppList(FindAppListReq) (*FindAppListResp, error)
  476. GetAppInfo(GetAppInfoReq) (*GetAppInfoResp, error)
  477. CreateAppInfo(CreateAppInfoReq) (*CreateAppInfoResp, error)
  478. RemoveAppInfo(RemoveAppInfoReq) (*RemoveAppInfoResp, error)
  479. DisableAppInfo(DisableAppInfoReq) (*DisableAppInfoResp, error)
  480. EnableAppInfo(EnableAppInfoReq) (*EnableAppInfoResp, error)
  481. ResetAppSecret(ResetAppSecretReq) (*ResetAppSecretResp, error)
  482. ExpireAppSecret(ExpireAppSecretReq) (*ExpireAppSecretResp, error)
  483. ResetAppProject(ResetAppProjectReq) (*ResetAppProjectResp, error)
  484. // FindDataDescribe 拉取数据分析结果, 某一个时间段内的数据, 该时间段不会跨段
  485. FindDataDescribe(FindDataDescribeReq) (*FindDataDescribeResp, error)
  486. // FindDataCorrelation 拉取数据相关性列表
  487. FindDataCorrelation(FindDataCorrelationReq) (*FindDataCorrelationResp, error)
  488. // FindDataMinAndMax 拉取数据分析结果, 时间段内的最小与最大值
  489. FindDataMinAndMax(FindDataMinAndMaxReq) (*FindDataMinAndMaxResp, error)
  490. }
  491. )