types.go 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. package datacenter_client
  2. type (
  3. // 公共部分
  4. ItemHistoryResp struct {
  5. ProjectId int `json:"project_id"`
  6. ItemName string `json:"item_name"`
  7. Val float64 `json:"val"`
  8. HTime string `json:"h_time"`
  9. }
  10. InstrumentCompareData struct {
  11. Max float64 `json:"max_val"`
  12. Min float64 `json:"min_val"`
  13. }
  14. RangeFirstLast struct {
  15. First float64 `json:"first"`
  16. Last float64 `json:"last"`
  17. }
  18. WorkingPump struct {
  19. Id int64 `json:"id"`
  20. ProjectId int64 `json:"project_id"`
  21. DeviceCode string `json:"device_code"`
  22. FeedPressure float64 `json:"feed_pressure"`
  23. OutPressure float64 `json:"out_pressure"`
  24. Duration int64 `json:"duration"`
  25. Current float64 `json:"current"`
  26. Frequency float64 `json:"frequency"`
  27. Lift float64 `json:"lift"`
  28. Efficiency float64 `json:"efficiency"`
  29. RunStatus int64 `json:"run_status"`
  30. FaultStatus int64 `json:"fault_status"`
  31. CTime string `json:"c_time"`
  32. }
  33. WorkingChest struct {
  34. Id int64 `json:"id"`
  35. ProjectId int64 `json:"project_id"`
  36. DeviceCode string `json:"device_code"`
  37. Switch int64 `json:"switch"`
  38. Level float64 `json:"level"`
  39. AgitatorStatus int64 `json:"agitator_status"`
  40. AgitatorDuration int64 `json:"agitator_duration"`
  41. AgitatorFaultStatus int64 `json:"agitator_fault_status"`
  42. CTime string `json:"c_time"`
  43. }
  44. WorkingRo struct {
  45. Id int64 `json:"id"`
  46. ProjectId int64 `json:"project_id"`
  47. DeviceCode string `json:"device_code"`
  48. WaterTemperature float64 `json:"water_temperature"`
  49. FeedFlow_1St float64 `json:"feed_flow_1_st"`
  50. ConFlow_1St float64 `json:"con_flow_1_st"`
  51. ProductFlow_1St float64 `json:"product_flow_1_st"`
  52. FeedPressure_1St float64 `json:"feed_pressure_1_st"`
  53. ConPressure_1St float64 `json:"con_pressure_1_st"`
  54. ProductPressure_1St float64 `json:"product_pressure_1_st"`
  55. Tmp_1St float64 `json:"tmp_1_st"`
  56. Flux_1St float64 `json:"flux_1_st"`
  57. Permeability_1St float64 `json:"permeability_1_st"`
  58. FeedFlow_2Nd float64 `json:"feed_flow_2_nd"`
  59. ConFlow_2Nd float64 `json:"con_flow_2_nd"`
  60. ProductFlow_2Nd float64 `json:"product_flow_2_nd"`
  61. FeedPressure_2Nd float64 `json:"feed_pressure_2_nd"`
  62. ConPressure_2Nd float64 `json:"con_pressure_2_nd"`
  63. ProductPressure_2Nd float64 `json:"product_pressure_2_nd"`
  64. Tmp_2Nd float64 `json:"tmp_2_nd"`
  65. Flux_2Nd float64 `json:"flux_2_nd"`
  66. Permeability_2Nd float64 `json:"permeability_2_nd"`
  67. FeedFlow_3Th float64 `json:"feed_flow_3_th"`
  68. ConFlow_3Th float64 `json:"con_flow_3_th"`
  69. ProductFlow_3Th float64 `json:"product_flow_3_th"`
  70. FeedPressure_3Th float64 `json:"feed_pressure_3_th"`
  71. ConPressure_3Th float64 `json:"con_pressure_3_th"`
  72. ProductPressure_3Th float64 `json:"product_pressure_3_th"`
  73. Tmp_3Th float64 `json:"tmp_3_th"`
  74. Flux_3Th float64 `json:"flux_3_th"`
  75. Permeability_3Th float64 `json:"permeability_3_th"`
  76. FeedWqTurbidity float64 `json:"feed_wq_turbidity"`
  77. FeedWqPh int64 `json:"feed_wq_ph"`
  78. ProductWqPh int64 `json:"product_wq_ph"`
  79. FeedWqAl float64 `json:"feed_wq_al"`
  80. ProductWqAl float64 `json:"product_wq_al"`
  81. FeedWqFe float64 `json:"feed_wq_fe"`
  82. ProductWqFe float64 `json:"product_wq_fe"`
  83. FeedWqMn float64 `json:"feed_wq_mn"`
  84. ProductWqMn float64 `json:"product_wq_mn"`
  85. FeedWqSio2 float64 `json:"feed_wq_sio_2"`
  86. ProductWqSio2 float64 `json:"product_wq_sio_2"`
  87. FeedWqCod float64 `json:"feed_wq_cod"`
  88. ProductWqCod float64 `json:"product_wq_cod"`
  89. FeedWqP float64 `json:"feed_wq_p"`
  90. ProductWqP float64 `json:"product_wq_p"`
  91. Step int64 `json:"step"`
  92. CTime string `json:"c_time"`
  93. }
  94. WorkingUf struct {
  95. Id int64 `json:"id"`
  96. ProjectId int64 `json:"project_id"`
  97. DeviceCode string `json:"device_code"`
  98. WaterTemperature float64 `json:"water_temperature"`
  99. FeedFlow float64 `json:"feed_flow"`
  100. ConFlow float64 `json:"con_flow"`
  101. ProductFlow float64 `json:"product_flow"`
  102. FeedPressure float64 `json:"feed_pressure"`
  103. ConPressure float64 `json:"con_pressure"`
  104. ProductPressure float64 `json:"product_pressure"`
  105. Tmp float64 `json:"tmp"`
  106. Flux float64 `json:"flux"`
  107. Permeability float64 `json:"permeability"`
  108. FeedWqTurbidity float64 `json:"feed_wq_turbidity"`
  109. FeedWqPh int64 `json:"feed_wq_ph"`
  110. ProductWqPh int64 `json:"product_wq_ph"`
  111. FeedWqAl float64 `json:"feed_wq_al"`
  112. ProductWqAl float64 `json:"product_wq_al"`
  113. FeedWqFe float64 `json:"feed_wq_fe"`
  114. ProductWqFe float64 `json:"product_wq_fe"`
  115. FeedWqMn float64 `json:"feed_wq_mn"`
  116. ProductWqMn float64 `json:"product_wq_mn"`
  117. FeedWqSio2 float64 `json:"feed_wq_sio_2"`
  118. ProductWqSio2 float64 `json:"product_wq_sio_2"`
  119. FeedWqCod float64 `json:"feed_wq_cod"`
  120. ProductWqCod float64 `json:"product_wq_cod"`
  121. FeedWqP float64 `json:"feed_wq_p"`
  122. ProductWqP float64 `json:"product_wq_p"`
  123. Step int64 `json:"step"`
  124. FilterTime float64 `json:"filter_time"`
  125. FilterCycle int64 `json:"filter_cycle"`
  126. CTime string `json:"c_time"`
  127. }
  128. )
  129. type (
  130. // 请求参数部分
  131. FindWorkingUfByCycleReq struct {
  132. ProjectId int64
  133. DeviceCode string
  134. FilterCycle int64
  135. Step int64
  136. FilterTimeStart float64
  137. FilterTimeEnd float64
  138. Limit int64
  139. }
  140. DcWorkingReq struct {
  141. ProjectId int64
  142. DeviceCode string
  143. Stime string
  144. Etime string
  145. Page int64
  146. PageSize int64
  147. Order string
  148. }
  149. // 点位最大 and 最小值请求
  150. RangeMaxMinReq struct {
  151. ProjectId string
  152. ItemName string
  153. Stime string
  154. Etime string
  155. }
  156. RangeFirstLastReq struct {
  157. ProjectId string
  158. ItemName string
  159. Stime string
  160. Etime string
  161. }
  162. ItemHistoryReq struct {
  163. ProjectId string
  164. ItemName string
  165. Stime string
  166. Etime string
  167. }
  168. // 点位数据写入结构
  169. ItemHistoryData struct {
  170. ProjectId int `json:"project_id"`
  171. ItemName string `json:"item_name"`
  172. Val float64 `json:"val"`
  173. HTime string `json:"h_time"`
  174. }
  175. // 点位数据写入请求
  176. MultiAddReq struct {
  177. List []ItemHistoryData `json:"list"`
  178. }
  179. ItemHistoryListReq struct {
  180. ProjectId int
  181. ItemName string
  182. Stime string
  183. Etime string
  184. Size int
  185. Interval string // 时间单位 minute,h,day,s
  186. Aggregator string // 聚合方式 min,max,avg,sum,realtime, new
  187. }
  188. )
  189. type (
  190. // 响应结构部分
  191. GetWorkingPumpByCodeResp struct {
  192. Code int `json:"code"`
  193. Msg string `json:"msg"`
  194. Data struct {
  195. List []WorkingPump `json:"list"`
  196. } `json:"data"`
  197. }
  198. GetWorkingChestByCodeResp struct {
  199. Code int `json:"code"`
  200. Msg string `json:"msg"`
  201. Data struct {
  202. List []WorkingChest `json:"list"`
  203. } `json:"data"`
  204. }
  205. GetWorkingRoByCodeResp struct {
  206. Code int `json:"code"`
  207. Msg string `json:"msg"`
  208. Data struct {
  209. List []WorkingRo `json:"list"`
  210. } `json:"data"`
  211. }
  212. FindWorkingUfByCycleResp struct {
  213. Code int `json:"code"`
  214. Msg string `json:"msg"`
  215. Data struct {
  216. List []WorkingUf `json:"list"`
  217. } `json:"data"`
  218. }
  219. GetWorkingUfByCodeResp struct {
  220. Code int `json:"code"`
  221. Msg string `json:"msg"`
  222. Data struct {
  223. List []WorkingUf `json:"list"`
  224. } `json:"data"`
  225. }
  226. RangeMaxMinResp struct {
  227. Code int `json:"code"`
  228. Msg string `json:"msg"`
  229. Data *InstrumentCompareData `json:"data"`
  230. }
  231. RangeFirstLastResp struct {
  232. Code int `json:"code"`
  233. Msg string `json:"msg"`
  234. Data *RangeFirstLast `json:"data"`
  235. }
  236. ItemHistoryRespList struct {
  237. List []ItemHistoryResp
  238. }
  239. ItemHistoryListResp struct {
  240. Name string `json:"name"`
  241. Htime string `json:"htime_at"`
  242. Val float64 `json:"val"`
  243. }
  244. ItemHistoryListRespList struct {
  245. List []ItemHistoryListResp
  246. }
  247. MultiAddBody struct {
  248. Code int `json:"code"`
  249. Msg string `json:"msg"`
  250. }
  251. ItemHistoryBody struct {
  252. Code int `json:"code"`
  253. Msg string `json:"msg"`
  254. Data ItemHistoryRespList `json:"data"`
  255. }
  256. ItemHistoryListBody struct {
  257. Code int `json:"code"`
  258. Msg string `json:"msg"`
  259. Data ItemHistoryListRespList `json:"data"`
  260. }
  261. )
  262. type (
  263. // DcAPI 在这里定义了数据中心接口, 具体实现在版本目录中(目前只有v1)
  264. DcAPI interface {
  265. // GetItemHistory 查询历史点位数据
  266. GetItemHistory(req ItemHistoryReq) (resp []ItemHistoryResp, err error)
  267. // MultiAddData 点位数据写入
  268. MultiAddData(req MultiAddReq) (err error)
  269. // ObtainRangeMaxMin 查询最大最小值
  270. ObtainRangeMaxMin(req *RangeMaxMinReq) (resp *InstrumentCompareData, err error)
  271. // GetWorkingUfByCode 获得uf工况数据
  272. GetWorkingUfByCode(DcWorkingReq) (*GetWorkingUfByCodeResp, error)
  273. // FindWorkingUfByCycle 查询uf工况数据, 按周期进行过滤
  274. FindWorkingUfByCycle(FindWorkingUfByCycleReq) (*FindWorkingUfByCycleResp, error)
  275. // GetWorkingRoByCode 查询ro工况数据
  276. GetWorkingRoByCode(DcWorkingReq) (*GetWorkingRoByCodeResp, error)
  277. // GetWorkingChestByCode 查询液体容器类工况数据
  278. GetWorkingChestByCode(DcWorkingReq) (*GetWorkingChestByCodeResp, error)
  279. // GetWorkingPumpByCode 查询泵类工况数据
  280. GetWorkingPumpByCode(DcWorkingReq) (*GetWorkingPumpByCodeResp, error)
  281. // 平替双胞胎图表接口(时间区间内按要求聚合)
  282. GetItemHistoryList(ItemHistoryListReq) (resp []ItemHistoryListResp, err error)
  283. }
  284. )