types.go 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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. )
  180. type (
  181. // 响应结构部分
  182. GetWorkingPumpByCodeResp struct {
  183. Code int `json:"code"`
  184. Msg string `json:"msg"`
  185. Data struct {
  186. List []WorkingPump `json:"list"`
  187. } `json:"data"`
  188. }
  189. GetWorkingChestByCodeResp struct {
  190. Code int `json:"code"`
  191. Msg string `json:"msg"`
  192. Data struct {
  193. List []WorkingChest `json:"list"`
  194. } `json:"data"`
  195. }
  196. GetWorkingRoByCodeResp struct {
  197. Code int `json:"code"`
  198. Msg string `json:"msg"`
  199. Data struct {
  200. List []WorkingRo `json:"list"`
  201. } `json:"data"`
  202. }
  203. FindWorkingUfByCycleResp struct {
  204. Code int `json:"code"`
  205. Msg string `json:"msg"`
  206. Data struct {
  207. List []WorkingUf `json:"list"`
  208. } `json:"data"`
  209. }
  210. GetWorkingUfByCodeResp struct {
  211. Code int `json:"code"`
  212. Msg string `json:"msg"`
  213. Data struct {
  214. List []WorkingUf `json:"list"`
  215. } `json:"data"`
  216. }
  217. RangeMaxMinResp struct {
  218. Code int `json:"code"`
  219. Msg string `json:"msg"`
  220. Data *InstrumentCompareData `json:"data"`
  221. }
  222. RangeFirstLastResp struct {
  223. Code int `json:"code"`
  224. Msg string `json:"msg"`
  225. Data *RangeFirstLast `json:"data"`
  226. }
  227. ItemHistoryRespList struct {
  228. List []ItemHistoryResp
  229. }
  230. MultiAddBody struct {
  231. Code int `json:"code"`
  232. Msg string `json:"msg"`
  233. }
  234. ItemHistoryBody struct {
  235. Code int `json:"code"`
  236. Msg string `json:"msg"`
  237. Data ItemHistoryRespList `json:"data"`
  238. }
  239. )
  240. type (
  241. // DcAPI 在这里定义了数据中心接口, 具体实现在版本目录中(目前只有v1)
  242. DcAPI interface {
  243. // GetItemHistory 查询历史点位数据
  244. GetItemHistory(req ItemHistoryReq) (resp []ItemHistoryResp, err error)
  245. // MultiAddData 点位数据写入
  246. MultiAddData(req MultiAddReq) (err error)
  247. // ObtainRangeMaxMin 查询最大最小值
  248. ObtainRangeMaxMin(req *RangeMaxMinReq) (resp *InstrumentCompareData, err error)
  249. // ObtainRangeMaxMin 查询最大最小值
  250. ObtainRangeFirstLast(req *RangeFirstLastReq) (resp *RangeFirstLast, err error)
  251. // GetWorkingUfByCode 获得uf工况数据
  252. GetWorkingUfByCode(DcWorkingReq) (*GetWorkingUfByCodeResp, error)
  253. // FindWorkingUfByCycle 查询uf工况数据, 按周期进行过滤
  254. FindWorkingUfByCycle(FindWorkingUfByCycleReq) (*FindWorkingUfByCycleResp, error)
  255. // GetWorkingRoByCode 查询ro工况数据
  256. GetWorkingRoByCode(DcWorkingReq) (*GetWorkingRoByCodeResp, error)
  257. // GetWorkingChestByCode 查询液体容器类工况数据
  258. GetWorkingChestByCode(DcWorkingReq) (*GetWorkingChestByCodeResp, error)
  259. // GetWorkingPumpByCode 查询泵类工况数据
  260. GetWorkingPumpByCode(DcWorkingReq) (*GetWorkingPumpByCodeResp, error)
  261. }
  262. )