types.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  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. )
  144. type (
  145. // 请求参数部分
  146. FindWorkingUfByCycleReq struct {
  147. ProjectId int64
  148. DeviceCode string
  149. FilterCycle int64
  150. Step int64
  151. FilterTimeStart float64
  152. FilterTimeEnd float64
  153. Limit int64
  154. }
  155. DcWorkingReq struct {
  156. ProjectId int64
  157. DeviceCode string
  158. Stime string
  159. Etime string
  160. Page int64
  161. PageSize int64
  162. Order string
  163. }
  164. // 点位最大 and 最小值请求
  165. RangeMaxMinReq struct {
  166. ProjectId string
  167. ItemName string
  168. Stime string
  169. Etime string
  170. }
  171. RangeFirstLastReq struct {
  172. ProjectId string
  173. ItemName string
  174. Stime string
  175. Etime string
  176. }
  177. ItemHistoryReq struct {
  178. ProjectId string
  179. ItemName string
  180. Stime string
  181. Etime string
  182. }
  183. // 点位数据写入结构
  184. ItemHistoryData struct {
  185. ProjectId int `json:"project_id"`
  186. ItemName string `json:"item_name"`
  187. Val float64 `json:"val"`
  188. HTime string `json:"h_time"`
  189. }
  190. // 点位数据写入请求
  191. MultiAddReq struct {
  192. List []ItemHistoryData `json:"list"`
  193. }
  194. ItemHistoryListReq struct {
  195. ProjectId int
  196. ItemName string
  197. Stime string
  198. Etime string
  199. Size int
  200. Interval string // 时间单位 minute,h,day,s
  201. Aggregator string // 聚合方式 min,max,avg,sum,realtime, new
  202. MaxVal float64 `json:"max_val"`
  203. MinVal float64 `json:"min_val"`
  204. }
  205. FindAppListReq struct {
  206. ProjectId int64 `json:"project_id"`
  207. Page int64 `json:"page"`
  208. PageSize int64 `json:"page_size"`
  209. Order string `json:"order"`
  210. }
  211. GetAppInfoReq struct {
  212. ProjectId int64 `json:"project_id"`
  213. AppName string `json:"app_name"`
  214. }
  215. CreateAppInfoReq struct {
  216. ProjectId int64 `json:"project_id"`
  217. AppName string `json:"app_name"`
  218. ProjectIds []int64 `json:"project_ids"`
  219. Expire int64 `json:"expire"`
  220. }
  221. RemoveAppInfoReq struct {
  222. ProjectId int64 `json:"project_id"`
  223. AppName string `json:"app_name"`
  224. }
  225. DisableAppInfoReq struct {
  226. ProjectId int64 `json:"project_id"`
  227. AppName string `json:"app_name"`
  228. }
  229. EnableAppInfoReq struct {
  230. ProjectId int64 `json:"project_id"`
  231. AppName string `json:"app_name"`
  232. }
  233. ResetAppSecretReq struct {
  234. ProjectId int64 `json:"project_id"`
  235. AppName string `json:"app_name"`
  236. }
  237. ExpireAppSecretReq struct {
  238. ProjectId int64 `json:"project_id"`
  239. AppName string `json:"app_name"`
  240. Expire int64 `json:"expire"`
  241. }
  242. ResetAppProjectReq struct {
  243. ProjectId int64 `json:"project_id"`
  244. AppName string `json:"app_name"`
  245. ProjectIds []int64 `json:"project_ids"`
  246. }
  247. )
  248. type (
  249. // 响应结构部分
  250. GetWorkingPumpByCodeResp struct {
  251. Code int `json:"code"`
  252. Msg string `json:"msg"`
  253. Data struct {
  254. List []WorkingPump `json:"list"`
  255. } `json:"data"`
  256. }
  257. GetWorkingChestByCodeResp struct {
  258. Code int `json:"code"`
  259. Msg string `json:"msg"`
  260. Data struct {
  261. List []WorkingChest `json:"list"`
  262. } `json:"data"`
  263. }
  264. GetWorkingRoByCodeResp struct {
  265. Code int `json:"code"`
  266. Msg string `json:"msg"`
  267. Data struct {
  268. List []WorkingRo `json:"list"`
  269. } `json:"data"`
  270. }
  271. FindWorkingUfByCycleResp struct {
  272. Code int `json:"code"`
  273. Msg string `json:"msg"`
  274. Data struct {
  275. List []WorkingUf `json:"list"`
  276. } `json:"data"`
  277. }
  278. GetWorkingUfByCodeResp struct {
  279. Code int `json:"code"`
  280. Msg string `json:"msg"`
  281. Data struct {
  282. List []WorkingUf `json:"list"`
  283. } `json:"data"`
  284. }
  285. RangeMaxMinResp struct {
  286. Code int `json:"code"`
  287. Msg string `json:"msg"`
  288. Data *InstrumentCompareData `json:"data"`
  289. }
  290. RangeFirstLastResp struct {
  291. Code int `json:"code"`
  292. Msg string `json:"msg"`
  293. Data *RangeFirstLast `json:"data"`
  294. }
  295. ItemHistoryRespList struct {
  296. List []ItemHistoryResp
  297. }
  298. ItemHistoryListResp struct {
  299. Name string `json:"name"`
  300. Htime string `json:"htime_at"`
  301. Val float64 `json:"val"`
  302. }
  303. ItemHistoryListRespList struct {
  304. List []ItemHistoryListResp
  305. }
  306. MultiAddBody struct {
  307. Code int `json:"code"`
  308. Msg string `json:"msg"`
  309. }
  310. ItemHistoryBody struct {
  311. Code int `json:"code"`
  312. Msg string `json:"msg"`
  313. Data ItemHistoryRespList `json:"data"`
  314. }
  315. ItemHistoryListBody struct {
  316. Code int `json:"code"`
  317. Msg string `json:"msg"`
  318. Data ItemHistoryListRespList `json:"data"`
  319. }
  320. FindAppListResp struct {
  321. Code int `json:"code"`
  322. Msg string `json:"msg"`
  323. Data struct {
  324. List []*AppInfo `json:"list"`
  325. Pagination *Pagination `json:"pagination"`
  326. } `json:"data"`
  327. }
  328. GetAppInfoResp struct {
  329. Code int `json:"code"`
  330. Msg string `json:"msg"`
  331. Data struct {
  332. AppInfo *AppInfo `json:"app_info"`
  333. } `json:"data"`
  334. }
  335. CreateAppInfoResp struct {
  336. Code int `json:"code"`
  337. Msg string `json:"msg"`
  338. Data struct {
  339. AppInfo *AppInfo `json:"app_info"`
  340. } `json:"data"`
  341. }
  342. RemoveAppInfoResp struct {
  343. Code int `json:"code"`
  344. Msg string `json:"msg"`
  345. Data struct {
  346. Ok bool `json:"ok"`
  347. } `json:"data"`
  348. }
  349. DisableAppInfoResp struct {
  350. Code int `json:"code"`
  351. Msg string `json:"msg"`
  352. Data struct {
  353. Ok bool `json:"ok"`
  354. } `json:"data"`
  355. }
  356. EnableAppInfoResp struct {
  357. Code int `json:"code"`
  358. Msg string `json:"msg"`
  359. Data struct {
  360. Ok bool `json:"ok"`
  361. } `json:"data"`
  362. }
  363. ResetAppSecretResp struct {
  364. Code int `json:"code"`
  365. Msg string `json:"msg"`
  366. Data struct {
  367. Secret string `json:"secret"`
  368. } `json:"data"`
  369. }
  370. ExpireAppSecretResp struct {
  371. Code int `json:"code"`
  372. Msg string `json:"msg"`
  373. Data struct {
  374. ExpireAt string `json:"expire_at"`
  375. } `json:"data"`
  376. }
  377. ResetAppProjectResp struct {
  378. Code int `json:"code"`
  379. Msg string `json:"msg"`
  380. Data struct {
  381. RemoveProjectIds []int64 `json:"remove_project_ids"`
  382. } `json:"data"`
  383. }
  384. )
  385. type (
  386. // DcAPI 在这里定义了数据中心接口, 具体实现在版本目录中(目前只有v1)
  387. DcAPI interface {
  388. // GetItemHistory 查询历史点位数据
  389. GetItemHistory(req ItemHistoryReq) (resp []ItemHistoryResp, err error)
  390. // MultiAddData 点位数据写入
  391. MultiAddData(req MultiAddReq) (err error)
  392. // ObtainRangeMaxMin 查询最大最小值
  393. ObtainRangeMaxMin(req *RangeMaxMinReq) (resp *InstrumentCompareData, err error)
  394. // ObtainRangeMaxMin 查询最大最小值
  395. ObtainRangeFirstLast(req *RangeFirstLastReq) (resp *RangeFirstLast, err error)
  396. // GetWorkingUfByCode 获得uf工况数据
  397. GetWorkingUfByCode(DcWorkingReq) (*GetWorkingUfByCodeResp, error)
  398. // FindWorkingUfByCycle 查询uf工况数据, 按周期进行过滤
  399. FindWorkingUfByCycle(FindWorkingUfByCycleReq) (*FindWorkingUfByCycleResp, error)
  400. // GetWorkingRoByCode 查询ro工况数据
  401. GetWorkingRoByCode(DcWorkingReq) (*GetWorkingRoByCodeResp, error)
  402. // GetWorkingChestByCode 查询液体容器类工况数据
  403. GetWorkingChestByCode(DcWorkingReq) (*GetWorkingChestByCodeResp, error)
  404. // GetWorkingPumpByCode 查询泵类工况数据
  405. GetWorkingPumpByCode(DcWorkingReq) (*GetWorkingPumpByCodeResp, error)
  406. // 平替双胞胎图表接口(时间区间内按要求聚合)
  407. GetItemHistoryList(ItemHistoryListReq) (resp []ItemHistoryListResp, err error)
  408. FindAppList(FindAppListReq) (*FindAppListResp, error)
  409. GetAppInfo(GetAppInfoReq) (*GetAppInfoResp, error)
  410. CreateAppInfo(CreateAppInfoReq) (*CreateAppInfoResp, error)
  411. RemoveAppInfo(RemoveAppInfoReq) (*RemoveAppInfoResp, error)
  412. DisableAppInfo(DisableAppInfoReq) (*DisableAppInfoResp, error)
  413. EnableAppInfo(EnableAppInfoReq) (*EnableAppInfoResp, error)
  414. ResetAppSecret(ResetAppSecretReq) (*ResetAppSecretResp, error)
  415. ExpireAppSecret(ExpireAppSecretReq) (*ExpireAppSecretResp, error)
  416. ResetAppProject(ResetAppProjectReq) (*ResetAppProjectResp, error)
  417. }
  418. )