فهرست منبع

Merge remote-tracking branch 'origin/master'

gaoyagang 1 سال پیش
والد
کامیت
59304eedfd
41فایلهای تغییر یافته به همراه621 افزوده شده و 265 حذف شده
  1. 0 26
      app/cmd/api/internal/handler/datacenter/itemHistoryDataHandler.go
  2. 0 28
      app/cmd/api/internal/handler/datacenter/itemHistoryDataInfoHandler.go
  3. 0 24
      app/cmd/api/internal/handler/datacenter/workingChestHandler.go
  4. 0 24
      app/cmd/api/internal/handler/datacenter/workingPumpHandler.go
  5. 0 25
      app/cmd/api/internal/handler/datacenter/workingValveHandler.go
  6. 9 5
      app/cmd/dtgateway/desc/dtgateway.api
  7. 12 0
      app/cmd/dtgateway/desc/dtgateway/dtgateway.api
  8. 5 7
      app/cmd/dtgateway/dtgateway.go
  9. 4 4
      app/cmd/dtgateway/etc/dtgateway.yaml
  10. 0 0
      app/cmd/dtgateway/internal/config/config.go
  11. 28 0
      app/cmd/dtgateway/internal/handler/dtgateway/itemHistoryDataHandler.go
  12. 25 0
      app/cmd/dtgateway/internal/handler/dtgateway/itemHistoryDataInfoHandler.go
  13. 5 5
      app/cmd/dtgateway/internal/handler/dtgateway/itemHistoryDataListHandler.go
  14. 25 0
      app/cmd/dtgateway/internal/handler/dtgateway/itemHistoryDataMaxMinHandler.go
  15. 26 0
      app/cmd/dtgateway/internal/handler/dtgateway/itemHistoryDataMultiAddHandler.go
  16. 28 0
      app/cmd/dtgateway/internal/handler/dtgateway/workingChestHandler.go
  17. 28 0
      app/cmd/dtgateway/internal/handler/dtgateway/workingPumpHandler.go
  18. 6 6
      app/cmd/dtgateway/internal/handler/dtgateway/workingRoHandler.go
  19. 6 6
      app/cmd/dtgateway/internal/handler/dtgateway/workingUfHandler.go
  20. 28 0
      app/cmd/dtgateway/internal/handler/dtgateway/workingValveHandler.go
  21. 16 11
      app/cmd/dtgateway/internal/handler/routes.go
  22. 3 3
      app/cmd/dtgateway/internal/logic/dtgateway/itemHistoryDataInfoLogic.go
  23. 4 3
      app/cmd/dtgateway/internal/logic/dtgateway/itemHistoryDataListLogic.go
  24. 30 0
      app/cmd/dtgateway/internal/logic/dtgateway/itemHistoryDataLogic.go
  25. 41 0
      app/cmd/dtgateway/internal/logic/dtgateway/itemHistoryDataMaxMinLogic.go
  26. 7 7
      app/cmd/dtgateway/internal/logic/dtgateway/itemHistoryDataMultiAddLogic.go
  27. 3 3
      app/cmd/dtgateway/internal/logic/dtgateway/workingChestLogic.go
  28. 3 3
      app/cmd/dtgateway/internal/logic/dtgateway/workingPumpLogic.go
  29. 3 3
      app/cmd/dtgateway/internal/logic/dtgateway/workingRoLogic.go
  30. 4 3
      app/cmd/dtgateway/internal/logic/dtgateway/workingUfLogic.go
  31. 3 3
      app/cmd/dtgateway/internal/logic/dtgateway/workingValveLogic.go
  32. 1 1
      app/cmd/dtgateway/internal/svc/serviceContext.go
  33. 12 0
      app/cmd/dtgateway/internal/types/types.go
  34. 37 0
      app/cmd/organization/internal/logic/itemHistoryDataMaxMinByTimeLogic.go
  35. 5 0
      app/cmd/organization/internal/server/organizationServer.go
  36. 6 0
      app/cmd/organization/organization.proto
  37. 7 0
      app/cmd/organization/organization/organization.go
  38. 130 49
      app/cmd/organization/pb/organization.pb.go
  39. 45 8
      app/cmd/organization/pb/organization_grpc.pb.go
  40. 25 3
      app/model/dcitemhistorydatamodel.go
  41. 1 5
      deploy/test.sh

+ 0 - 26
app/cmd/api/internal/handler/datacenter/itemHistoryDataHandler.go

@@ -1,26 +0,0 @@
-package datacenter
-
-import (
-	"GtDataStore/common/result"
-	"net/http"
-
-	"GtDataStore/app/cmd/api/internal/logic/datacenter"
-	"GtDataStore/app/cmd/api/internal/svc"
-	"GtDataStore/app/cmd/api/internal/types"
-	"github.com/zeromicro/go-zero/rest/httpx"
-)
-
-func ItemHistoryDataHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.MultiAddItemHistoryDataReq
-		if err := httpx.Parse(r, &req); err != nil {
-			httpx.Error(w, err)
-			return
-		}
-
-		l := datacenter.NewItemHistoryDataLogic(r.Context(), svcCtx)
-		resp, err := l.ItemHistoryData(&req)
-		result.HttpResult(r, w, resp, err)
-
-	}
-}

+ 0 - 28
app/cmd/api/internal/handler/datacenter/itemHistoryDataInfoHandler.go

@@ -1,28 +0,0 @@
-package datacenter
-
-import (
-	"net/http"
-
-	"GtDataStore/app/cmd/api/internal/logic/datacenter"
-	"GtDataStore/app/cmd/api/internal/svc"
-	"GtDataStore/app/cmd/api/internal/types"
-	"github.com/zeromicro/go-zero/rest/httpx"
-)
-
-func ItemHistoryDataInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.ItemHistoryDataByTimeResq
-		if err := httpx.Parse(r, &req); err != nil {
-			httpx.ErrorCtx(r.Context(), w, err)
-			return
-		}
-
-		l := datacenter.NewItemHistoryDataInfoLogic(r.Context(), svcCtx)
-		resp, err := l.ItemHistoryDataInfo(&req)
-		if err != nil {
-			httpx.ErrorCtx(r.Context(), w, err)
-		} else {
-			httpx.OkJsonCtx(r.Context(), w, resp)
-		}
-	}
-}

+ 0 - 24
app/cmd/api/internal/handler/datacenter/workingChestHandler.go

@@ -1,24 +0,0 @@
-package datacenter
-
-import (
-	"GtDataStore/app/cmd/api/internal/logic/datacenter"
-	"GtDataStore/app/cmd/api/internal/svc"
-	"GtDataStore/app/cmd/api/internal/types"
-	"GtDataStore/common/result"
-	"github.com/zeromicro/go-zero/rest/httpx"
-	"net/http"
-)
-
-func WorkingChestHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.DcWorkingReq
-		if err := httpx.Parse(r, &req); err != nil {
-			httpx.Error(w, err)
-			return
-		}
-
-		l := datacenter.NewWorkingChestLogic(r.Context(), svcCtx)
-		resp, err := l.WorkingChest(&req)
-		result.HttpResult(r, w, resp, err)
-	}
-}

+ 0 - 24
app/cmd/api/internal/handler/datacenter/workingPumpHandler.go

@@ -1,24 +0,0 @@
-package datacenter
-
-import (
-	"GtDataStore/app/cmd/api/internal/logic/datacenter"
-	"GtDataStore/app/cmd/api/internal/svc"
-	"GtDataStore/app/cmd/api/internal/types"
-	"GtDataStore/common/result"
-	"github.com/zeromicro/go-zero/rest/httpx"
-	"net/http"
-)
-
-func WorkingPumpHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.DcWorkingReq
-		if err := httpx.Parse(r, &req); err != nil {
-			httpx.Error(w, err)
-			return
-		}
-
-		l := datacenter.NewWorkingPumpLogic(r.Context(), svcCtx)
-		resp, err := l.WorkingPump(&req)
-		result.HttpResult(r, w, resp, err)
-	}
-}

+ 0 - 25
app/cmd/api/internal/handler/datacenter/workingValveHandler.go

@@ -1,25 +0,0 @@
-package datacenter
-
-import (
-	"net/http"
-
-	"GtDataStore/app/cmd/api/internal/logic/datacenter"
-	"GtDataStore/app/cmd/api/internal/svc"
-	"GtDataStore/app/cmd/api/internal/types"
-	"GtDataStore/common/result"
-	"github.com/zeromicro/go-zero/rest/httpx"
-)
-
-func WorkingValveHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
-	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.DcWorkingReq
-		if err := httpx.Parse(r, &req); err != nil {
-			httpx.Error(w, err)
-			return
-		}
-
-		l := datacenter.NewWorkingValveLogic(r.Context(), svcCtx)
-		resp, err := l.WorkingValve(&req)
-		result.HttpResult(r, w, resp, err)
-	}
-}

+ 9 - 5
app/cmd/api/desc/datacenter.api → app/cmd/dtgateway/desc/dtgateway.api

@@ -1,14 +1,14 @@
 syntax = "v1"
 
 import (
-	"datacenter/datacenter.api"
+	"dtgateway/dtgateway.api"
 )
 
 @server(
-	prefix: api/datacenter/v1
-	group: datacenter
+	prefix: api/dtgateway/v1
+	group: dtgateway
 )
-service datacenter {
+service dtgateway {
 	@doc "查询working uf信息"
 	@handler WorkingUf
 	get /working-uf/info (DcWorkingReq) returns (WorkingUfResp)
@@ -30,7 +30,7 @@ service datacenter {
 	get /working-valve/info (DcWorkingReq) returns (WorkingValveResp)
 	
 	@doc "秒级单点数据批量入库"
-	@handler ItemHistoryData
+	@handler ItemHistoryDataMultiAdd
 	post /item-history/multi-add (MultiAddItemHistoryDataReq) returns (MultiAddItemHistoryDataResq)
 	
 	@doc "点位历史数据查询"
@@ -40,4 +40,8 @@ service datacenter {
 	@doc "按时间点位历史数据查询"
 	@handler ItemHistoryDataInfo
 	post /item-history/info (ItemHistoryDataByTimeResq) returns (MultiAddItemHistoryDataReq)
+	
+	@doc "按时间点位历史数据最大值最小值查询"
+	@handler ItemHistoryDataMaxMin
+	get /item-history/max-min (ItemHistoryDataMaxMinByTimeReq) returns (ItemHistoryDataMaxMinByTimeResq)
 }

+ 12 - 0
app/cmd/api/desc/datacenter/datacenter.api → app/cmd/dtgateway/desc/dtgateway/dtgateway.api

@@ -177,5 +177,17 @@ type (
         STime       string    `json:"stime"`
         ETime       string    `json:"etime"`
     }
+
+    ItemHistoryDataMaxMinByTimeReq{
+        ProjectId   int64     `form:"project_id"`
+        ItemName    string    `form:"item_name"`
+        STime       string    `form:"stime"`
+        ETime       string    `form:"etime"`
+    }
+
+    ItemHistoryDataMaxMinByTimeResq{
+        MaxVal    float64     `json:"max_val"`
+        MinVal    float64     `json:"min_val"`
+    }
 )
 

+ 5 - 7
app/cmd/api/datacenter.go → app/cmd/dtgateway/dtgateway.go

@@ -1,18 +1,18 @@
 package main
 
 import (
-	"GtDataStore/app/cmd/api/internal/config"
-	"GtDataStore/app/cmd/api/internal/handler"
-	"GtDataStore/app/cmd/api/internal/svc"
 	"flag"
 	"fmt"
-	"github.com/zeromicro/go-zero/core/logx"
+
+	"GtDataStore/app/cmd/dtgateway/internal/config"
+	"GtDataStore/app/cmd/dtgateway/internal/handler"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
 
 	"github.com/zeromicro/go-zero/core/conf"
 	"github.com/zeromicro/go-zero/rest"
 )
 
-var configFile = flag.String("f", "etc/datacenter.yaml", "the config file")
+var configFile = flag.String("f", "etc/dtgateway.yaml", "the config file")
 
 func main() {
 	flag.Parse()
@@ -26,8 +26,6 @@ func main() {
 	ctx := svc.NewServiceContext(c)
 	handler.RegisterHandlers(server, ctx)
 
-	logx.DisableStat()
-
 	fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
 	server.Start()
 

+ 4 - 4
app/cmd/api/etc/datacenter.yaml → app/cmd/dtgateway/etc/dtgateway.yaml

@@ -1,6 +1,6 @@
-Name: datacenter-api
+Name: dtgateway-api
 Host: 0.0.0.0
-Port: 1001
+Port: 1009
 Mode: dev
 Timeout: 0
 #100MB
@@ -13,13 +13,13 @@ JwtAuth:
 
 #日志配置
 Log:
-  ServiceName: datacenter-api
+  ServiceName: dtgateway-api
   Mode: console
   Level: error
 
 #rpc service
 OrganizationRpcConf:
   Endpoints:
-    - 127.0.0.1:1111
+    - 127.0.0.1:1117
   NonBlock: true
   Timeout: 0

+ 0 - 0
app/cmd/api/internal/config/config.go → app/cmd/dtgateway/internal/config/config.go


+ 28 - 0
app/cmd/dtgateway/internal/handler/dtgateway/itemHistoryDataHandler.go

@@ -0,0 +1,28 @@
+package dtgateway
+
+import (
+	"net/http"
+
+	"GtDataStore/app/cmd/dtgateway/internal/logic/dtgateway"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func ItemHistoryDataHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.MultiAddItemHistoryDataReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := dtgateway.NewItemHistoryDataLogic(r.Context(), svcCtx)
+		resp, err := l.ItemHistoryData(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 25 - 0
app/cmd/dtgateway/internal/handler/dtgateway/itemHistoryDataInfoHandler.go

@@ -0,0 +1,25 @@
+package dtgateway
+
+import (
+	"GtDataStore/common/result"
+	"net/http"
+
+	"GtDataStore/app/cmd/dtgateway/internal/logic/dtgateway"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func ItemHistoryDataInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.ItemHistoryDataByTimeResq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.Error(w, err)
+			return
+		}
+
+		l := dtgateway.NewItemHistoryDataInfoLogic(r.Context(), svcCtx)
+		resp, err := l.ItemHistoryDataInfo(&req)
+		result.HttpResult(r, w, resp, err)
+	}
+}

+ 5 - 5
app/cmd/api/internal/handler/datacenter/itemHistoryDataListHandler.go → app/cmd/dtgateway/internal/handler/dtgateway/itemHistoryDataListHandler.go

@@ -1,12 +1,12 @@
-package datacenter
+package dtgateway
 
 import (
 	"GtDataStore/common/result"
 	"net/http"
 
-	"GtDataStore/app/cmd/api/internal/logic/datacenter"
-	"GtDataStore/app/cmd/api/internal/svc"
-	"GtDataStore/app/cmd/api/internal/types"
+	"GtDataStore/app/cmd/dtgateway/internal/logic/dtgateway"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
 	"github.com/zeromicro/go-zero/rest/httpx"
 )
 
@@ -18,7 +18,7 @@ func ItemHistoryDataListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
 			return
 		}
 
-		l := datacenter.NewItemHistoryDataListLogic(r.Context(), svcCtx)
+		l := dtgateway.NewItemHistoryDataListLogic(r.Context(), svcCtx)
 		resp, err := l.ItemHistoryDataList(&req)
 		result.HttpResult(r, w, resp, err)
 	}

+ 25 - 0
app/cmd/dtgateway/internal/handler/dtgateway/itemHistoryDataMaxMinHandler.go

@@ -0,0 +1,25 @@
+package dtgateway
+
+import (
+	"GtDataStore/common/result"
+	"net/http"
+
+	"GtDataStore/app/cmd/dtgateway/internal/logic/dtgateway"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func ItemHistoryDataMaxMinHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.ItemHistoryDataMaxMinByTimeReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.Error(w, err)
+			return
+		}
+
+		l := dtgateway.NewItemHistoryDataMaxMinLogic(r.Context(), svcCtx)
+		resp, err := l.ItemHistoryDataMaxMin(&req)
+		result.HttpResult(r, w, resp, err)
+	}
+}

+ 26 - 0
app/cmd/dtgateway/internal/handler/dtgateway/itemHistoryDataMultiAddHandler.go

@@ -0,0 +1,26 @@
+package dtgateway
+
+import (
+	"GtDataStore/common/result"
+	"net/http"
+
+	"GtDataStore/app/cmd/dtgateway/internal/logic/dtgateway"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func ItemHistoryDataMultiAddHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.MultiAddItemHistoryDataReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.Error(w, err)
+			return
+		}
+
+		l := dtgateway.NewItemHistoryDataMultiAddLogic(r.Context(), svcCtx)
+		resp, err := l.ItemHistoryDataMultiAdd(&req)
+		result.HttpResult(r, w, resp, err)
+
+	}
+}

+ 28 - 0
app/cmd/dtgateway/internal/handler/dtgateway/workingChestHandler.go

@@ -0,0 +1,28 @@
+package dtgateway
+
+import (
+	"net/http"
+
+	"GtDataStore/app/cmd/dtgateway/internal/logic/dtgateway"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func WorkingChestHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.DcWorkingReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := dtgateway.NewWorkingChestLogic(r.Context(), svcCtx)
+		resp, err := l.WorkingChest(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 28 - 0
app/cmd/dtgateway/internal/handler/dtgateway/workingPumpHandler.go

@@ -0,0 +1,28 @@
+package dtgateway
+
+import (
+	"net/http"
+
+	"GtDataStore/app/cmd/dtgateway/internal/logic/dtgateway"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func WorkingPumpHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.DcWorkingReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := dtgateway.NewWorkingPumpLogic(r.Context(), svcCtx)
+		resp, err := l.WorkingPump(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 6 - 6
app/cmd/api/internal/handler/datacenter/workingRoHandler.go → app/cmd/dtgateway/internal/handler/dtgateway/workingRoHandler.go

@@ -1,12 +1,12 @@
-package datacenter
+package dtgateway
 
 import (
+	"GtDataStore/common/result"
 	"net/http"
 
-	"GtDataStore/app/cmd/api/internal/logic/datacenter"
-	"GtDataStore/app/cmd/api/internal/svc"
-	"GtDataStore/app/cmd/api/internal/types"
-	"GtDataStore/common/result"
+	"GtDataStore/app/cmd/dtgateway/internal/logic/dtgateway"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
 	"github.com/zeromicro/go-zero/rest/httpx"
 )
 
@@ -18,7 +18,7 @@ func WorkingRoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
 			return
 		}
 
-		l := datacenter.NewWorkingRoLogic(r.Context(), svcCtx)
+		l := dtgateway.NewWorkingRoLogic(r.Context(), svcCtx)
 		resp, err := l.WorkingRo(&req)
 		result.HttpResult(r, w, resp, err)
 	}

+ 6 - 6
app/cmd/api/internal/handler/datacenter/workingUfHandler.go → app/cmd/dtgateway/internal/handler/dtgateway/workingUfHandler.go

@@ -1,12 +1,12 @@
-package datacenter
+package dtgateway
 
 import (
+	"GtDataStore/common/result"
 	"net/http"
 
-	"GtDataStore/app/cmd/api/internal/logic/datacenter"
-	"GtDataStore/app/cmd/api/internal/svc"
-	"GtDataStore/app/cmd/api/internal/types"
-	"GtDataStore/common/result"
+	"GtDataStore/app/cmd/dtgateway/internal/logic/dtgateway"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
 	"github.com/zeromicro/go-zero/rest/httpx"
 )
 
@@ -18,7 +18,7 @@ func WorkingUfHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
 			return
 		}
 
-		l := datacenter.NewWorkingUfLogic(r.Context(), svcCtx)
+		l := dtgateway.NewWorkingUfLogic(r.Context(), svcCtx)
 		resp, err := l.WorkingUf(&req)
 		result.HttpResult(r, w, resp, err)
 	}

+ 28 - 0
app/cmd/dtgateway/internal/handler/dtgateway/workingValveHandler.go

@@ -0,0 +1,28 @@
+package dtgateway
+
+import (
+	"net/http"
+
+	"GtDataStore/app/cmd/dtgateway/internal/logic/dtgateway"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func WorkingValveHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.DcWorkingReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := dtgateway.NewWorkingValveLogic(r.Context(), svcCtx)
+		resp, err := l.WorkingValve(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 16 - 11
app/cmd/api/internal/handler/routes.go → app/cmd/dtgateway/internal/handler/routes.go

@@ -4,8 +4,8 @@ package handler
 import (
 	"net/http"
 
-	datacenter "GtDataStore/app/cmd/api/internal/handler/datacenter"
-	"GtDataStore/app/cmd/api/internal/svc"
+	dtgateway "GtDataStore/app/cmd/dtgateway/internal/handler/dtgateway"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
 
 	"github.com/zeromicro/go-zero/rest"
 )
@@ -16,44 +16,49 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 			{
 				Method:  http.MethodGet,
 				Path:    "/working-uf/info",
-				Handler: datacenter.WorkingUfHandler(serverCtx),
+				Handler: dtgateway.WorkingUfHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodGet,
 				Path:    "/working-ro/info",
-				Handler: datacenter.WorkingRoHandler(serverCtx),
+				Handler: dtgateway.WorkingRoHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodGet,
 				Path:    "/working-chest/info",
-				Handler: datacenter.WorkingChestHandler(serverCtx),
+				Handler: dtgateway.WorkingChestHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodGet,
 				Path:    "/working-pump/info",
-				Handler: datacenter.WorkingPumpHandler(serverCtx),
+				Handler: dtgateway.WorkingPumpHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodGet,
 				Path:    "/working-valve/info",
-				Handler: datacenter.WorkingValveHandler(serverCtx),
+				Handler: dtgateway.WorkingValveHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/item-history/multi-add",
-				Handler: datacenter.ItemHistoryDataHandler(serverCtx),
+				Handler: dtgateway.ItemHistoryDataMultiAddHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/item-history/list",
-				Handler: datacenter.ItemHistoryDataListHandler(serverCtx),
+				Handler: dtgateway.ItemHistoryDataListHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
 				Path:    "/item-history/info",
-				Handler: datacenter.ItemHistoryDataInfoHandler(serverCtx),
+				Handler: dtgateway.ItemHistoryDataInfoHandler(serverCtx),
+			},
+			{
+				Method:  http.MethodGet,
+				Path:    "/item-history/max-min",
+				Handler: dtgateway.ItemHistoryDataMaxMinHandler(serverCtx),
 			},
 		},
-		rest.WithPrefix("/api/datacenter/v1"),
+		rest.WithPrefix("/api/dtgateway/v1"),
 	)
 }

+ 3 - 3
app/cmd/api/internal/logic/datacenter/itemHistoryDataInfoLogic.go → app/cmd/dtgateway/internal/logic/dtgateway/itemHistoryDataInfoLogic.go

@@ -1,12 +1,12 @@
-package datacenter
+package dtgateway
 
 import (
 	"GtDataStore/app/cmd/organization/pb"
 	"context"
 	"github.com/jinzhu/copier"
 
-	"GtDataStore/app/cmd/api/internal/svc"
-	"GtDataStore/app/cmd/api/internal/types"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 4 - 3
app/cmd/api/internal/logic/datacenter/itemHistoryDataListLogic.go → app/cmd/dtgateway/internal/logic/dtgateway/itemHistoryDataListLogic.go

@@ -1,12 +1,13 @@
-package datacenter
+package dtgateway
 
 import (
-	"GtDataStore/app/cmd/api/internal/svc"
-	"GtDataStore/app/cmd/api/internal/types"
 	"GtDataStore/app/cmd/organization/pb"
 	"context"
 	"github.com/jinzhu/copier"
 
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
+
 	"github.com/zeromicro/go-zero/core/logx"
 )
 

+ 30 - 0
app/cmd/dtgateway/internal/logic/dtgateway/itemHistoryDataLogic.go

@@ -0,0 +1,30 @@
+package dtgateway
+
+import (
+	"context"
+
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type ItemHistoryDataLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewItemHistoryDataLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ItemHistoryDataLogic {
+	return &ItemHistoryDataLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *ItemHistoryDataLogic) ItemHistoryData(req *types.MultiAddItemHistoryDataReq) (resp *types.MultiAddItemHistoryDataResq, err error) {
+	// todo: add your logic here and delete this line
+
+	return
+}

+ 41 - 0
app/cmd/dtgateway/internal/logic/dtgateway/itemHistoryDataMaxMinLogic.go

@@ -0,0 +1,41 @@
+package dtgateway
+
+import (
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
+	"GtDataStore/app/cmd/organization/pb"
+	"context"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type ItemHistoryDataMaxMinLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewItemHistoryDataMaxMinLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ItemHistoryDataMaxMinLogic {
+	return &ItemHistoryDataMaxMinLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *ItemHistoryDataMaxMinLogic) ItemHistoryDataMaxMin(req *types.ItemHistoryDataMaxMinByTimeReq) (resp *types.ItemHistoryDataMaxMinByTimeResq, err error) {
+	rpcData, err := l.svcCtx.OrganizationRpc.ItemHistoryDataMaxMinByTime(l.ctx, &pb.ItemHistoryDataByTimeReq{
+		ProjectId: req.ProjectId,
+		ItemName:  req.ItemName,
+		Stime:     req.STime,
+		Etime:     req.ETime,
+	})
+	if err != nil {
+		return nil, err
+	}
+
+	return &types.ItemHistoryDataMaxMinByTimeResq{
+		MaxVal: rpcData.MaxVal,
+		MinVal: rpcData.MinVal,
+	}, nil
+}

+ 7 - 7
app/cmd/api/internal/logic/datacenter/itemHistoryDataLogic.go → app/cmd/dtgateway/internal/logic/dtgateway/itemHistoryDataMultiAddLogic.go

@@ -1,31 +1,31 @@
-package datacenter
+package dtgateway
 
 import (
 	"GtDataStore/app/cmd/organization/pb"
 	"context"
 	"github.com/jinzhu/copier"
 
-	"GtDataStore/app/cmd/api/internal/svc"
-	"GtDataStore/app/cmd/api/internal/types"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )
 
-type ItemHistoryDataLogic struct {
+type ItemHistoryDataMultiAddLogic struct {
 	logx.Logger
 	ctx    context.Context
 	svcCtx *svc.ServiceContext
 }
 
-func NewItemHistoryDataLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ItemHistoryDataLogic {
-	return &ItemHistoryDataLogic{
+func NewItemHistoryDataMultiAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ItemHistoryDataMultiAddLogic {
+	return &ItemHistoryDataMultiAddLogic{
 		Logger: logx.WithContext(ctx),
 		ctx:    ctx,
 		svcCtx: svcCtx,
 	}
 }
 
-func (l *ItemHistoryDataLogic) ItemHistoryData(req *types.MultiAddItemHistoryDataReq) (resp *types.MultiAddItemHistoryDataResq, err error) {
+func (l *ItemHistoryDataMultiAddLogic) ItemHistoryDataMultiAdd(req *types.MultiAddItemHistoryDataReq) (resp *types.MultiAddItemHistoryDataResq, err error) {
 	dataList := make([]*pb.ItemHistoryData, 0)
 	for _, line := range req.List {
 		tmp := &pb.ItemHistoryData{}

+ 3 - 3
app/cmd/api/internal/logic/datacenter/workingChestLogic.go → app/cmd/dtgateway/internal/logic/dtgateway/workingChestLogic.go

@@ -1,10 +1,10 @@
-package datacenter
+package dtgateway
 
 import (
 	"context"
 
-	"GtDataStore/app/cmd/api/internal/svc"
-	"GtDataStore/app/cmd/api/internal/types"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 3 - 3
app/cmd/api/internal/logic/datacenter/workingPumpLogic.go → app/cmd/dtgateway/internal/logic/dtgateway/workingPumpLogic.go

@@ -1,10 +1,10 @@
-package datacenter
+package dtgateway
 
 import (
 	"context"
 
-	"GtDataStore/app/cmd/api/internal/svc"
-	"GtDataStore/app/cmd/api/internal/types"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 3 - 3
app/cmd/api/internal/logic/datacenter/workingRoLogic.go → app/cmd/dtgateway/internal/logic/dtgateway/workingRoLogic.go

@@ -1,4 +1,4 @@
-package datacenter
+package dtgateway
 
 import (
 	"GtDataStore/app/cmd/organization/pb"
@@ -6,8 +6,8 @@ import (
 	"context"
 	"github.com/jinzhu/copier"
 
-	"GtDataStore/app/cmd/api/internal/svc"
-	"GtDataStore/app/cmd/api/internal/types"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 4 - 3
app/cmd/api/internal/logic/datacenter/workingUfLogic.go → app/cmd/dtgateway/internal/logic/dtgateway/workingUfLogic.go

@@ -1,13 +1,14 @@
-package datacenter
+package dtgateway
 
 import (
-	"GtDataStore/app/cmd/api/internal/svc"
-	"GtDataStore/app/cmd/api/internal/types"
 	"GtDataStore/app/cmd/organization/pb"
 	"GtDataStore/common/xerr"
 	"context"
 	"github.com/jinzhu/copier"
 
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
+
 	"github.com/zeromicro/go-zero/core/logx"
 )
 

+ 3 - 3
app/cmd/api/internal/logic/datacenter/workingValveLogic.go → app/cmd/dtgateway/internal/logic/dtgateway/workingValveLogic.go

@@ -1,10 +1,10 @@
-package datacenter
+package dtgateway
 
 import (
 	"context"
 
-	"GtDataStore/app/cmd/api/internal/svc"
-	"GtDataStore/app/cmd/api/internal/types"
+	"GtDataStore/app/cmd/dtgateway/internal/svc"
+	"GtDataStore/app/cmd/dtgateway/internal/types"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )

+ 1 - 1
app/cmd/api/internal/svc/serviceContext.go → app/cmd/dtgateway/internal/svc/serviceContext.go

@@ -1,7 +1,7 @@
 package svc
 
 import (
-	"GtDataStore/app/cmd/api/internal/config"
+	"GtDataStore/app/cmd/dtgateway/internal/config"
 	"GtDataStore/app/cmd/organization/organization"
 	"github.com/zeromicro/go-zero/zrpc"
 )

+ 12 - 0
app/cmd/api/internal/types/types.go → app/cmd/dtgateway/internal/types/types.go

@@ -179,3 +179,15 @@ type ItemHistoryDataByTimeResq struct {
 	STime     string `json:"stime"`
 	ETime     string `json:"etime"`
 }
+
+type ItemHistoryDataMaxMinByTimeReq struct {
+	ProjectId int64  `form:"project_id"`
+	ItemName  string `form:"item_name"`
+	STime     string `form:"stime"`
+	ETime     string `form:"etime"`
+}
+
+type ItemHistoryDataMaxMinByTimeResq struct {
+	MaxVal float64 `json:"max_val"`
+	MinVal float64 `json:"min_val"`
+}

+ 37 - 0
app/cmd/organization/internal/logic/itemHistoryDataMaxMinByTimeLogic.go

@@ -0,0 +1,37 @@
+package logic
+
+import (
+	"GtDataStore/common/xerr"
+	"context"
+	"github.com/pkg/errors"
+
+	"GtDataStore/app/cmd/organization/internal/svc"
+	"GtDataStore/app/cmd/organization/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type ItemHistoryDataMaxMinByTimeLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewItemHistoryDataMaxMinByTimeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ItemHistoryDataMaxMinByTimeLogic {
+	return &ItemHistoryDataMaxMinByTimeLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *ItemHistoryDataMaxMinByTimeLogic) ItemHistoryDataMaxMinByTime(in *pb.ItemHistoryDataByTimeReq) (*pb.ItemHistoryDataMaxMinResp, error) {
+	modelData, err := l.svcCtx.ItemHistoryData.QueryHistoryDataMaxMinByTime(l.ctx, in)
+	if err != nil {
+		return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "model QueryHistoryDataMaxMinByTime get data err:%v", err)
+	}
+	return &pb.ItemHistoryDataMaxMinResp{
+		MaxVal: modelData.MaxVal,
+		MinVal: modelData.MinVal,
+	}, nil
+}

+ 5 - 0
app/cmd/organization/internal/server/organizationServer.go

@@ -61,3 +61,8 @@ func (s *OrganizationServer) ItemHistoryDataByTime(ctx context.Context, in *pb.I
 	l := logic.NewItemHistoryDataByTimeLogic(ctx, s.svcCtx)
 	return l.ItemHistoryDataByTime(in)
 }
+
+func (s *OrganizationServer) ItemHistoryDataMaxMinByTime(ctx context.Context, in *pb.ItemHistoryDataByTimeReq) (*pb.ItemHistoryDataMaxMinResp, error) {
+	l := logic.NewItemHistoryDataMaxMinByTimeLogic(ctx, s.svcCtx)
+	return l.ItemHistoryDataMaxMinByTime(in)
+}

+ 6 - 0
app/cmd/organization/organization.proto

@@ -162,6 +162,11 @@ message ItemHistoryDataByTimeReq {
   string    etime = 4;
 }
 
+message ItemHistoryDataMaxMinResp {
+  double    max_val = 1;
+  double    min_val = 2;
+}
+
 service Organization {
   rpc GetWorkingUfByCode(DcWorkingReq) returns(WorkingUf);
   rpc GetWorkingRoByCode(DcWorkingReq) returns(WorkingRo);
@@ -171,4 +176,5 @@ service Organization {
   rpc MultiAddItemHistoryData(MultiAddItemHistoryDataReq) returns(MultiAddItemHistoryDataResp);
   rpc ItemHistoryDataList(ItemHistoryDataListReq) returns(MultiAddItemHistoryDataReq);
   rpc ItemHistoryDataByTime(ItemHistoryDataByTimeReq) returns(MultiAddItemHistoryDataReq);
+  rpc ItemHistoryDataMaxMinByTime(ItemHistoryDataByTimeReq) returns(ItemHistoryDataMaxMinResp);
 }

+ 7 - 0
app/cmd/organization/organization/organization.go

@@ -17,6 +17,7 @@ type (
 	ItemHistoryData             = pb.ItemHistoryData
 	ItemHistoryDataByTimeReq    = pb.ItemHistoryDataByTimeReq
 	ItemHistoryDataListReq      = pb.ItemHistoryDataListReq
+	ItemHistoryDataMaxMinResp   = pb.ItemHistoryDataMaxMinResp
 	MultiAddItemHistoryDataReq  = pb.MultiAddItemHistoryDataReq
 	MultiAddItemHistoryDataResp = pb.MultiAddItemHistoryDataResp
 	WorkingChest                = pb.WorkingChest
@@ -34,6 +35,7 @@ type (
 		MultiAddItemHistoryData(ctx context.Context, in *MultiAddItemHistoryDataReq, opts ...grpc.CallOption) (*MultiAddItemHistoryDataResp, error)
 		ItemHistoryDataList(ctx context.Context, in *ItemHistoryDataListReq, opts ...grpc.CallOption) (*MultiAddItemHistoryDataReq, error)
 		ItemHistoryDataByTime(ctx context.Context, in *ItemHistoryDataByTimeReq, opts ...grpc.CallOption) (*MultiAddItemHistoryDataReq, error)
+		ItemHistoryDataMaxMinByTime(ctx context.Context, in *ItemHistoryDataByTimeReq, opts ...grpc.CallOption) (*ItemHistoryDataMaxMinResp, error)
 	}
 
 	defaultOrganization struct {
@@ -86,3 +88,8 @@ func (m *defaultOrganization) ItemHistoryDataByTime(ctx context.Context, in *Ite
 	client := pb.NewOrganizationClient(m.cli.Conn())
 	return client.ItemHistoryDataByTime(ctx, in, opts...)
 }
+
+func (m *defaultOrganization) ItemHistoryDataMaxMinByTime(ctx context.Context, in *ItemHistoryDataByTimeReq, opts ...grpc.CallOption) (*ItemHistoryDataMaxMinResp, error) {
+	client := pb.NewOrganizationClient(m.cli.Conn())
+	return client.ItemHistoryDataMaxMinByTime(ctx, in, opts...)
+}

+ 130 - 49
app/cmd/organization/pb/organization.pb.go

@@ -1464,6 +1464,61 @@ func (x *ItemHistoryDataByTimeReq) GetEtime() string {
 	return ""
 }
 
+type ItemHistoryDataMaxMinResp struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	MaxVal float64 `protobuf:"fixed64,1,opt,name=max_val,json=maxVal,proto3" json:"max_val,omitempty"`
+	MinVal float64 `protobuf:"fixed64,2,opt,name=min_val,json=minVal,proto3" json:"min_val,omitempty"`
+}
+
+func (x *ItemHistoryDataMaxMinResp) Reset() {
+	*x = ItemHistoryDataMaxMinResp{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_organization_proto_msgTypes[11]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *ItemHistoryDataMaxMinResp) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ItemHistoryDataMaxMinResp) ProtoMessage() {}
+
+func (x *ItemHistoryDataMaxMinResp) ProtoReflect() protoreflect.Message {
+	mi := &file_organization_proto_msgTypes[11]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use ItemHistoryDataMaxMinResp.ProtoReflect.Descriptor instead.
+func (*ItemHistoryDataMaxMinResp) Descriptor() ([]byte, []int) {
+	return file_organization_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *ItemHistoryDataMaxMinResp) GetMaxVal() float64 {
+	if x != nil {
+		return x.MaxVal
+	}
+	return 0
+}
+
+func (x *ItemHistoryDataMaxMinResp) GetMinVal() float64 {
+	if x != nil {
+		return x.MinVal
+	}
+	return 0
+}
+
 var File_organization_proto protoreflect.FileDescriptor
 
 var file_organization_proto_rawDesc = []byte{
@@ -1735,44 +1790,55 @@ var file_organization_proto_rawDesc = []byte{
 	0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x74, 0x65, 0x6d, 0x4e, 0x61,
 	0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
 	0x09, 0x52, 0x05, 0x73, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x74, 0x69, 0x6d,
-	0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x32, 0xb7,
-	0x04, 0x0a, 0x0c, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12,
-	0x35, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x55, 0x66, 0x42,
+	0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x4d,
+	0x0a, 0x19, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74,
+	0x61, 0x4d, 0x61, 0x78, 0x4d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x17, 0x0a, 0x07, 0x6d,
+	0x61, 0x78, 0x5f, 0x76, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x6d, 0x61,
+	0x78, 0x56, 0x61, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x18,
+	0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x6d, 0x69, 0x6e, 0x56, 0x61, 0x6c, 0x32, 0x93, 0x05,
+	0x0a, 0x0c, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x35,
+	0x0a, 0x12, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x55, 0x66, 0x42, 0x79,
+	0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x63, 0x57, 0x6f, 0x72, 0x6b,
+	0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b,
+	0x69, 0x6e, 0x67, 0x55, 0x66, 0x12, 0x35, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b,
+	0x69, 0x6e, 0x67, 0x52, 0x6f, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x2e, 0x70, 0x62,
+	0x2e, 0x44, 0x63, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e,
+	0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x6f, 0x12, 0x3b, 0x0a, 0x15,
+	0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x73, 0x74, 0x42,
 	0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x63, 0x57, 0x6f, 0x72,
-	0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72,
-	0x6b, 0x69, 0x6e, 0x67, 0x55, 0x66, 0x12, 0x35, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72,
-	0x6b, 0x69, 0x6e, 0x67, 0x52, 0x6f, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x2e, 0x70,
-	0x62, 0x2e, 0x44, 0x63, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x0d,
-	0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x6f, 0x12, 0x3b, 0x0a,
-	0x15, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x73, 0x74,
-	0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x63, 0x57, 0x6f,
-	0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f,
-	0x72, 0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x14, 0x47, 0x65,
-	0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x50, 0x75, 0x6d, 0x70, 0x42, 0x79, 0x43, 0x6f,
-	0x64, 0x65, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x63, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e,
-	0x67, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e,
-	0x67, 0x50, 0x75, 0x6d, 0x70, 0x12, 0x3b, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b,
-	0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10,
-	0x2e, 0x70, 0x62, 0x2e, 0x44, 0x63, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71,
-	0x1a, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c,
-	0x76, 0x65, 0x12, 0x5a, 0x0a, 0x17, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x41, 0x64, 0x64, 0x49, 0x74,
-	0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1e, 0x2e,
-	0x70, 0x62, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x41, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x48,
-	0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x1a, 0x1f, 0x2e,
-	0x70, 0x62, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x41, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x48,
-	0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x12, 0x51,
-	0x0a, 0x13, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74,
-	0x61, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x48,
-	0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65,
-	0x71, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x41, 0x64, 0x64, 0x49,
-	0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65,
-	0x71, 0x12, 0x55, 0x0a, 0x15, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79,
-	0x44, 0x61, 0x74, 0x61, 0x42, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e,
-	0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x42,
-	0x79, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x75,
-	0x6c, 0x74, 0x69, 0x41, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72,
-	0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
-	0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72,
+	0x6b, 0x69, 0x6e, 0x67, 0x43, 0x68, 0x65, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x14, 0x47, 0x65, 0x74,
+	0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x50, 0x75, 0x6d, 0x70, 0x42, 0x79, 0x43, 0x6f, 0x64,
+	0x65, 0x12, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x63, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67,
+	0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67,
+	0x50, 0x75, 0x6d, 0x70, 0x12, 0x3b, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x57, 0x6f, 0x72, 0x6b, 0x69,
+	0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x2e,
+	0x70, 0x62, 0x2e, 0x44, 0x63, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x1a,
+	0x10, 0x2e, 0x70, 0x62, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x76,
+	0x65, 0x12, 0x5a, 0x0a, 0x17, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x41, 0x64, 0x64, 0x49, 0x74, 0x65,
+	0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1e, 0x2e, 0x70,
+	0x62, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x41, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69,
+	0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x1a, 0x1f, 0x2e, 0x70,
+	0x62, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x41, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69,
+	0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x12, 0x51, 0x0a,
+	0x13, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61,
+	0x4c, 0x69, 0x73, 0x74, 0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69,
+	0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71,
+	0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x41, 0x64, 0x64, 0x49, 0x74,
+	0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71,
+	0x12, 0x55, 0x0a, 0x15, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44,
+	0x61, 0x74, 0x61, 0x42, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x49,
+	0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x42, 0x79,
+	0x54, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x75, 0x6c,
+	0x74, 0x69, 0x41, 0x64, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79,
+	0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x12, 0x5a, 0x0a, 0x1b, 0x49, 0x74, 0x65, 0x6d, 0x48,
+	0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x4d, 0x61, 0x78, 0x4d, 0x69, 0x6e,
+	0x42, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d,
+	0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x42, 0x79, 0x54, 0x69, 0x6d,
+	0x65, 0x52, 0x65, 0x71, 0x1a, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x48, 0x69,
+	0x73, 0x74, 0x6f, 0x72, 0x79, 0x44, 0x61, 0x74, 0x61, 0x4d, 0x61, 0x78, 0x4d, 0x69, 0x6e, 0x52,
+	0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
+	0x74, 0x6f, 0x33,
 }
 
 var (
@@ -1787,7 +1853,7 @@ func file_organization_proto_rawDescGZIP() []byte {
 	return file_organization_proto_rawDescData
 }
 
-var file_organization_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
+var file_organization_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
 var file_organization_proto_goTypes = []interface{}{
 	(*DcWorkingReq)(nil),                // 0: pb.DcWorkingReq
 	(*WorkingUf)(nil),                   // 1: pb.WorkingUf
@@ -1800,6 +1866,7 @@ var file_organization_proto_goTypes = []interface{}{
 	(*MultiAddItemHistoryDataResp)(nil), // 8: pb.MultiAddItemHistoryDataResp
 	(*ItemHistoryDataListReq)(nil),      // 9: pb.ItemHistoryDataListReq
 	(*ItemHistoryDataByTimeReq)(nil),    // 10: pb.ItemHistoryDataByTimeReq
+	(*ItemHistoryDataMaxMinResp)(nil),   // 11: pb.ItemHistoryDataMaxMinResp
 }
 var file_organization_proto_depIdxs = []int32{
 	6,  // 0: pb.MultiAddItemHistoryDataReq.list:type_name -> pb.ItemHistoryData
@@ -1811,16 +1878,18 @@ var file_organization_proto_depIdxs = []int32{
 	7,  // 6: pb.Organization.MultiAddItemHistoryData:input_type -> pb.MultiAddItemHistoryDataReq
 	9,  // 7: pb.Organization.ItemHistoryDataList:input_type -> pb.ItemHistoryDataListReq
 	10, // 8: pb.Organization.ItemHistoryDataByTime:input_type -> pb.ItemHistoryDataByTimeReq
-	1,  // 9: pb.Organization.GetWorkingUfByCode:output_type -> pb.WorkingUf
-	2,  // 10: pb.Organization.GetWorkingRoByCode:output_type -> pb.WorkingRo
-	3,  // 11: pb.Organization.GetWorkingChestByCode:output_type -> pb.WorkingChest
-	4,  // 12: pb.Organization.GetWorkingPumpByCode:output_type -> pb.WorkingPump
-	5,  // 13: pb.Organization.GetWorkingValueByCode:output_type -> pb.WorkingValve
-	8,  // 14: pb.Organization.MultiAddItemHistoryData:output_type -> pb.MultiAddItemHistoryDataResp
-	7,  // 15: pb.Organization.ItemHistoryDataList:output_type -> pb.MultiAddItemHistoryDataReq
-	7,  // 16: pb.Organization.ItemHistoryDataByTime:output_type -> pb.MultiAddItemHistoryDataReq
-	9,  // [9:17] is the sub-list for method output_type
-	1,  // [1:9] is the sub-list for method input_type
+	10, // 9: pb.Organization.ItemHistoryDataMaxMinByTime:input_type -> pb.ItemHistoryDataByTimeReq
+	1,  // 10: pb.Organization.GetWorkingUfByCode:output_type -> pb.WorkingUf
+	2,  // 11: pb.Organization.GetWorkingRoByCode:output_type -> pb.WorkingRo
+	3,  // 12: pb.Organization.GetWorkingChestByCode:output_type -> pb.WorkingChest
+	4,  // 13: pb.Organization.GetWorkingPumpByCode:output_type -> pb.WorkingPump
+	5,  // 14: pb.Organization.GetWorkingValueByCode:output_type -> pb.WorkingValve
+	8,  // 15: pb.Organization.MultiAddItemHistoryData:output_type -> pb.MultiAddItemHistoryDataResp
+	7,  // 16: pb.Organization.ItemHistoryDataList:output_type -> pb.MultiAddItemHistoryDataReq
+	7,  // 17: pb.Organization.ItemHistoryDataByTime:output_type -> pb.MultiAddItemHistoryDataReq
+	11, // 18: pb.Organization.ItemHistoryDataMaxMinByTime:output_type -> pb.ItemHistoryDataMaxMinResp
+	10, // [10:19] is the sub-list for method output_type
+	1,  // [1:10] is the sub-list for method input_type
 	1,  // [1:1] is the sub-list for extension type_name
 	1,  // [1:1] is the sub-list for extension extendee
 	0,  // [0:1] is the sub-list for field type_name
@@ -1964,6 +2033,18 @@ func file_organization_proto_init() {
 				return nil
 			}
 		}
+		file_organization_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*ItemHistoryDataMaxMinResp); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
 	}
 	type x struct{}
 	out := protoimpl.TypeBuilder{
@@ -1971,7 +2052,7 @@ func file_organization_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_organization_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   11,
+			NumMessages:   12,
 			NumExtensions: 0,
 			NumServices:   1,
 		},

+ 45 - 8
app/cmd/organization/pb/organization_grpc.pb.go

@@ -19,14 +19,15 @@ import (
 const _ = grpc.SupportPackageIsVersion7
 
 const (
-	Organization_GetWorkingUfByCode_FullMethodName      = "/pb.Organization/GetWorkingUfByCode"
-	Organization_GetWorkingRoByCode_FullMethodName      = "/pb.Organization/GetWorkingRoByCode"
-	Organization_GetWorkingChestByCode_FullMethodName   = "/pb.Organization/GetWorkingChestByCode"
-	Organization_GetWorkingPumpByCode_FullMethodName    = "/pb.Organization/GetWorkingPumpByCode"
-	Organization_GetWorkingValueByCode_FullMethodName   = "/pb.Organization/GetWorkingValueByCode"
-	Organization_MultiAddItemHistoryData_FullMethodName = "/pb.Organization/MultiAddItemHistoryData"
-	Organization_ItemHistoryDataList_FullMethodName     = "/pb.Organization/ItemHistoryDataList"
-	Organization_ItemHistoryDataByTime_FullMethodName   = "/pb.Organization/ItemHistoryDataByTime"
+	Organization_GetWorkingUfByCode_FullMethodName          = "/pb.Organization/GetWorkingUfByCode"
+	Organization_GetWorkingRoByCode_FullMethodName          = "/pb.Organization/GetWorkingRoByCode"
+	Organization_GetWorkingChestByCode_FullMethodName       = "/pb.Organization/GetWorkingChestByCode"
+	Organization_GetWorkingPumpByCode_FullMethodName        = "/pb.Organization/GetWorkingPumpByCode"
+	Organization_GetWorkingValueByCode_FullMethodName       = "/pb.Organization/GetWorkingValueByCode"
+	Organization_MultiAddItemHistoryData_FullMethodName     = "/pb.Organization/MultiAddItemHistoryData"
+	Organization_ItemHistoryDataList_FullMethodName         = "/pb.Organization/ItemHistoryDataList"
+	Organization_ItemHistoryDataByTime_FullMethodName       = "/pb.Organization/ItemHistoryDataByTime"
+	Organization_ItemHistoryDataMaxMinByTime_FullMethodName = "/pb.Organization/ItemHistoryDataMaxMinByTime"
 )
 
 // OrganizationClient is the client API for Organization service.
@@ -41,6 +42,7 @@ type OrganizationClient interface {
 	MultiAddItemHistoryData(ctx context.Context, in *MultiAddItemHistoryDataReq, opts ...grpc.CallOption) (*MultiAddItemHistoryDataResp, error)
 	ItemHistoryDataList(ctx context.Context, in *ItemHistoryDataListReq, opts ...grpc.CallOption) (*MultiAddItemHistoryDataReq, error)
 	ItemHistoryDataByTime(ctx context.Context, in *ItemHistoryDataByTimeReq, opts ...grpc.CallOption) (*MultiAddItemHistoryDataReq, error)
+	ItemHistoryDataMaxMinByTime(ctx context.Context, in *ItemHistoryDataByTimeReq, opts ...grpc.CallOption) (*ItemHistoryDataMaxMinResp, error)
 }
 
 type organizationClient struct {
@@ -123,6 +125,15 @@ func (c *organizationClient) ItemHistoryDataByTime(ctx context.Context, in *Item
 	return out, nil
 }
 
+func (c *organizationClient) ItemHistoryDataMaxMinByTime(ctx context.Context, in *ItemHistoryDataByTimeReq, opts ...grpc.CallOption) (*ItemHistoryDataMaxMinResp, error) {
+	out := new(ItemHistoryDataMaxMinResp)
+	err := c.cc.Invoke(ctx, Organization_ItemHistoryDataMaxMinByTime_FullMethodName, in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // OrganizationServer is the server API for Organization service.
 // All implementations must embed UnimplementedOrganizationServer
 // for forward compatibility
@@ -135,6 +146,7 @@ type OrganizationServer interface {
 	MultiAddItemHistoryData(context.Context, *MultiAddItemHistoryDataReq) (*MultiAddItemHistoryDataResp, error)
 	ItemHistoryDataList(context.Context, *ItemHistoryDataListReq) (*MultiAddItemHistoryDataReq, error)
 	ItemHistoryDataByTime(context.Context, *ItemHistoryDataByTimeReq) (*MultiAddItemHistoryDataReq, error)
+	ItemHistoryDataMaxMinByTime(context.Context, *ItemHistoryDataByTimeReq) (*ItemHistoryDataMaxMinResp, error)
 	mustEmbedUnimplementedOrganizationServer()
 }
 
@@ -166,6 +178,9 @@ func (UnimplementedOrganizationServer) ItemHistoryDataList(context.Context, *Ite
 func (UnimplementedOrganizationServer) ItemHistoryDataByTime(context.Context, *ItemHistoryDataByTimeReq) (*MultiAddItemHistoryDataReq, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method ItemHistoryDataByTime not implemented")
 }
+func (UnimplementedOrganizationServer) ItemHistoryDataMaxMinByTime(context.Context, *ItemHistoryDataByTimeReq) (*ItemHistoryDataMaxMinResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method ItemHistoryDataMaxMinByTime not implemented")
+}
 func (UnimplementedOrganizationServer) mustEmbedUnimplementedOrganizationServer() {}
 
 // UnsafeOrganizationServer may be embedded to opt out of forward compatibility for this service.
@@ -323,6 +338,24 @@ func _Organization_ItemHistoryDataByTime_Handler(srv interface{}, ctx context.Co
 	return interceptor(ctx, in, info, handler)
 }
 
+func _Organization_ItemHistoryDataMaxMinByTime_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(ItemHistoryDataByTimeReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(OrganizationServer).ItemHistoryDataMaxMinByTime(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: Organization_ItemHistoryDataMaxMinByTime_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(OrganizationServer).ItemHistoryDataMaxMinByTime(ctx, req.(*ItemHistoryDataByTimeReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // Organization_ServiceDesc is the grpc.ServiceDesc for Organization service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -362,6 +395,10 @@ var Organization_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "ItemHistoryDataByTime",
 			Handler:    _Organization_ItemHistoryDataByTime_Handler,
 		},
+		{
+			MethodName: "ItemHistoryDataMaxMinByTime",
+			Handler:    _Organization_ItemHistoryDataMaxMinByTime_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "organization.proto",

+ 25 - 3
app/model/dcitemhistorydatamodel.go

@@ -18,11 +18,17 @@ type (
 		dcItemHistoryDataModel
 		MultiInsert(ctx context.Context, datas []DcItemHistoryData) (int64, error)
 		QueryHistoryDataByTime(ctx context.Context, in *pb.ItemHistoryDataByTimeReq) ([]DcItemHistoryData, error)
+		QueryHistoryDataMaxMinByTime(ctx context.Context, in *pb.ItemHistoryDataByTimeReq) (*MaxMinData, error)
 	}
 
 	customDcItemHistoryDataModel struct {
 		*defaultDcItemHistoryDataModel
 	}
+
+	MaxMinData struct {
+		MaxVal float64 `db:"max_val"` // 最大值
+		MinVal float64 `db:"min_val"` // 最小值
+	}
 )
 
 // NewDcItemHistoryDataModel returns a model for the database table.
@@ -33,11 +39,11 @@ func NewDcItemHistoryDataModel(conn sqlx.SqlConn) DcItemHistoryDataModel {
 }
 
 func (m *defaultDcItemHistoryDataModel) MultiInsert(ctx context.Context, datas []DcItemHistoryData) (int64, error) {
-	query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?)", m.table, dcItemHistoryDataRowsExpectAutoSet)
+	query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?)", m.table, dcItemHistoryDataRowsExpectAutoSet)
 
 	if bulk, err := sqlx.NewBulkInserter(m.conn, query); err == nil {
 		for _, data := range datas {
-			if err = bulk.Insert(data.ProjectId, data.ItemName, data.Val, data.CTime); err != nil {
+			if err = bulk.Insert(data.ProjectId, data.ItemName, data.Val, data.HTime, data.CTime); err != nil {
 				return 0, err
 			}
 		}
@@ -52,7 +58,7 @@ func (m *defaultDcItemHistoryDataModel) MultiInsert(ctx context.Context, datas [
 func (m *defaultDcItemHistoryDataModel) QueryHistoryDataByTime(ctx context.Context, in *pb.ItemHistoryDataByTimeReq) ([]DcItemHistoryData, error) {
 	resp := make([]DcItemHistoryData, 0)
 	var err error
-	query := fmt.Sprintf("SELECT * FROM %s WHERE project_id = ? AND item_name in (?) AND c_time BETWEEN ? AND ? ORDER BY id desc", m.table)
+	query := fmt.Sprintf("SELECT * FROM %s WHERE project_id = ? AND item_name in (?) AND h_time BETWEEN ? AND ? ORDER BY id desc", m.table)
 	if strings.Index(in.ItemName, ",") > 0 {
 		err = m.conn.QueryRowsCtx(ctx, &resp, query, in.ProjectId, strings.Split(in.ItemName, ","), in.Stime, in.Etime)
 	} else {
@@ -69,6 +75,22 @@ func (m *defaultDcItemHistoryDataModel) QueryHistoryDataByTime(ctx context.Conte
 	}
 }
 
+func (m *defaultDcItemHistoryDataModel) QueryHistoryDataMaxMinByTime(ctx context.Context, in *pb.ItemHistoryDataByTimeReq) (*MaxMinData, error) {
+	resp := &MaxMinData{}
+	var err error
+	query := fmt.Sprintf("SELECT max(val) as max_val, min(val) as min_val FROM %s WHERE project_id = ? AND item_name = ? AND h_time BETWEEN ? AND ? ORDER BY id desc", m.table)
+	err = m.conn.QueryRowCtx(ctx, resp, query, in.ProjectId, in.ItemName, in.Stime, in.Etime)
+
+	switch err {
+	case nil:
+		return resp, nil
+	case sqlc.ErrNotFound:
+		return nil, ErrNotFound
+	default:
+		return nil, err
+	}
+}
+
 /*
 func (m *defaultDcItemHistoryDataModel) QueryHistoryData(ctx context.Context, in *pb.ItemHistoryDataListReq) ([]DcItemHistoryData, error) {
 	resp := make([]DcItemHistoryData, 0)

+ 1 - 5
deploy/test.sh

@@ -11,11 +11,7 @@ build () {
 
     echo "build for ${1}"
     rm -f ${1}
-    if [ "${1}" == "datacenter" ]; then
-        GOOS=linux GOARCH=amd64 go build -o ${1} app/cmd/api/${1}.go
-    else
-        GOOS=linux GOARCH=amd64 go build -o ${1} app/cmd/${1}/${1}.go
-    fi
+    GOOS=linux GOARCH=amd64 go build -o ${1} app/cmd/${1}/${1}.go
     # shellcheck disable=SC2181
     if [ "$?" != "0" ]; then
         exit $?