types.go 8.7 KB

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