物管理后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.3 KiB

  1. @startuml
  2. 'https://plantuml.com/activity-diagram-beta
  3. start
  4. note left: TsKvNativeSQL.amSumV1
  5. repeat:forEach protoList
  6. :dataProto;
  7. :初始化参数:\n inter:时间间隔(min 换算成 ms)\n thingCode: 物编码 \n key: 属性编码 \n value: 属性值 \n ts: 数据时间 \n stTs: 基于当前时间计算获取的开始时间 \n enTs: 基于当前时间计算获取的结束时间;
  8. if ((ts - inter) == stTs \n 当前时间可用于统计) then (yes)
  9. : 查询stTs~enTs在每个inter之间的最小值 \n => rowList;
  10. switch(rowList.size)
  11. case (多条)
  12. :计算连续数据的差值\n作为单个am数据值;
  13. :收集am到amList;
  14. case (1条)
  15. :向ts之前查询第一条数据;
  16. if (存在) then (yes)
  17. :与当前数据value计算差值\n作为单个am数据值;
  18. :收集am到amList;
  19. else (false)
  20. :设置am值为0并收集;
  21. :log error;
  22. endif
  23. if (当前时间 > enTs)
  24. :查询ts之后的第一条数据;
  25. :与之前查询出的1条计算差值\n收集到amList;
  26. endif
  27. endswitch
  28. : todo;
  29. else (false)
  30. :将stTs向左移动一个inter的时间\n然后查询新的开始时间~ts之间的数据\n => rowList;
  31. switch(rowList.size)
  32. case (多条)
  33. :计算连续数据的差值\n作为单个am数据值;
  34. :收集am到amList;
  35. case (1条)
  36. :向stTs之前查询第一条数据;
  37. if (存在) then (yes)
  38. :与当前数据value计算差值\n作为单个am数据值;
  39. :收集am到amList;
  40. else (false)
  41. :设置am值为0并收集;
  42. :log error;
  43. endif
  44. if (当前时间 > enTs)
  45. :查询enTs之后的第一条数据;
  46. :与之前查询出的1条计算差值\n收集到amList;
  47. endif
  48. endswitch
  49. endif
  50. repeat while(hasNext?)
  51. if (amList非空) then (yes)
  52. : 存储聚合好的amList数据;
  53. : 将amList推送到数据消费事件中(v1/tskv/latest);
  54. endif
  55. stop
  56. @enduml