Explorar el Código

照明系统,能源系统

huangyan hace 2 meses
padre
commit
b34f5ec44b

BIN
cmd/server/city_chips


+ 12 - 0
cmd/server/wire/wire.go

@@ -27,6 +27,10 @@ var RepositorySet = wire.NewSet(
 	repository.NewHomeRepository,
 	repository.NewElevatorRepository,
 	repository.NewBroadcastRepository,
+	repository.NewPropertyRepository,
+	repository.NewInformationRepository,
+	repository.NewIlluminatingRepository,
+	repository.NewEnergyRepository,
 )
 
 var ServiceSet = wire.NewSet(
@@ -38,6 +42,10 @@ var ServiceSet = wire.NewSet(
 	service.NewHomeService,
 	service.NewElevatorService,
 	service.NewBroadcastService,
+	service.NewPropertyService,
+	service.NewInformationService,
+	service.NewIlluminatingService,
+	service.NewEnergyService,
 )
 
 var HandlerSet = wire.NewSet(
@@ -49,6 +57,10 @@ var HandlerSet = wire.NewSet(
 	handler.NewHomeHandler,
 	handler.NewElevatorHandler,
 	handler.NewBroadcastHandler,
+	handler.NewPropertyHandler,
+	handler.NewInformationHandler,
+	handler.NewIlluminatingHandler,
+	handler.NewEnergyHandler,
 )
 
 func NewWire(*viper.Viper, *log.Logger) (*gin.Engine, func(), error) {

+ 16 - 4
cmd/server/wire/wire_gen.go

@@ -43,7 +43,19 @@ func NewWire(viperViper *viper.Viper, logger *log.Logger) (*gin.Engine, func(),
 	broadcastRepository := repository.NewBroadcastRepository(repositoryRepository)
 	broadcastService := service.NewBroadcastService(serviceService, broadcastRepository)
 	broadcastHandler := handler.NewBroadcastHandler(handlerHandler, broadcastService, viperViper)
-	engine := server.NewServerHTTP(logger, accessControlHandler, hikvisionHandler, conferenceHandler, homeHandler, elevatorHandler, broadcastHandler)
+	propertyRepository := repository.NewPropertyRepository(repositoryRepository)
+	propertyService := service.NewPropertyService(serviceService, propertyRepository)
+	propertyHandler := handler.NewPropertyHandler(handlerHandler, propertyService, viperViper)
+	informationRepository := repository.NewInformationRepository(repositoryRepository)
+	informationService := service.NewInformationService(serviceService, informationRepository)
+	informationHandler := handler.NewInformationHandler(handlerHandler, informationService, viperViper)
+	illuminatingRepository := repository.NewIlluminatingRepository(repositoryRepository)
+	illuminatingService := service.NewIlluminatingService(serviceService, illuminatingRepository)
+	illuminatingHandler := handler.NewIlluminatingHandler(handlerHandler, illuminatingService, viperViper)
+	energyRepository := repository.NewEnergyRepository(repositoryRepository)
+	energyService := service.NewEnergyService(serviceService, energyRepository)
+	energyHandler := handler.NewEnergyHandler(handlerHandler, energyService, viperViper)
+	engine := server.NewServerHTTP(logger, accessControlHandler, hikvisionHandler, conferenceHandler, homeHandler, elevatorHandler, broadcastHandler, propertyHandler, informationHandler, illuminatingHandler, energyHandler)
 	return engine, func() {
 	}, nil
 }
@@ -52,8 +64,8 @@ func NewWire(viperViper *viper.Viper, logger *log.Logger) (*gin.Engine, func(),
 
 var ServerSet = wire.NewSet(server.NewServerHTTP)
 
-var RepositorySet = wire.NewSet(repository.NewDb, repository.NewRedis, repository.NewRepository, repository.NewUserRepository, repository.NewAccessControlRepository, repository.NewHikvisionRepository, repository.NewConferenceRepository, repository.NewHomeRepository, repository.NewElevatorRepository, repository.NewBroadcastRepository)
+var RepositorySet = wire.NewSet(repository.NewDb, repository.NewRedis, repository.NewRepository, repository.NewUserRepository, repository.NewAccessControlRepository, repository.NewHikvisionRepository, repository.NewConferenceRepository, repository.NewHomeRepository, repository.NewElevatorRepository, repository.NewBroadcastRepository, repository.NewPropertyRepository, repository.NewInformationRepository, repository.NewIlluminatingRepository, repository.NewEnergyRepository)
 
-var ServiceSet = wire.NewSet(service.NewService, service.NewUserService, service.NewAccessControlService, service.NewHikvisionService, service.NewConferenceService, service.NewHomeService, service.NewElevatorService, service.NewBroadcastService)
+var ServiceSet = wire.NewSet(service.NewService, service.NewUserService, service.NewAccessControlService, service.NewHikvisionService, service.NewConferenceService, service.NewHomeService, service.NewElevatorService, service.NewBroadcastService, service.NewPropertyService, service.NewInformationService, service.NewIlluminatingService, service.NewEnergyService)
 
-var HandlerSet = wire.NewSet(handler.NewHandler, handler.NewUserHandler, handler.NewAccessControlHandler, handler.NewHikvisionHandler, handler.NewConferenceHandler, handler.NewHomeHandler, handler.NewElevatorHandler, handler.NewBroadcastHandler)
+var HandlerSet = wire.NewSet(handler.NewHandler, handler.NewUserHandler, handler.NewAccessControlHandler, handler.NewHikvisionHandler, handler.NewConferenceHandler, handler.NewHomeHandler, handler.NewElevatorHandler, handler.NewBroadcastHandler, handler.NewPropertyHandler, handler.NewInformationHandler, handler.NewIlluminatingHandler, handler.NewEnergyHandler)

+ 17 - 16
internal/handler/broadcast.go

@@ -7,6 +7,7 @@ import (
 	"fmt"
 	"github.com/gin-gonic/gin"
 	"github.com/spf13/viper"
+	"math/rand"
 	"time"
 )
 
@@ -35,8 +36,8 @@ func (h *BroadcastHandler) GetBroadcast(ctx *gin.Context) {
 		list := model.DeviceList{
 			Id:          i + 1,
 			DeviceName:  sprintf,
-			UseState:    0,
-			OnlineState: 0,
+			UseState:    rand.Intn(2),
+			OnlineState: rand.Intn(2),
 		}
 		device = append(device, list)
 	}
@@ -49,19 +50,19 @@ func (h *BroadcastHandler) GetBroadcast(ctx *gin.Context) {
 		termin = append(termin, log)
 	}
 
-	terminal["2025-5-1"] = 65
-	terminal["2025-5-2"] = 213
-	terminal["2025-5-3"] = 87
-	terminal["2025-5-4"] = 31
-	terminal["2025-5-5"] = 654
-	terminal["2025-5-6"] = 165
-	terminal["2025-5-7"] = 6745
-	m["device"] = device            //设备列表
-	m["TerminalOffline"] = terminal //终端离线
-	m["RunStateUse"] = 34           //运行统计-使用中
-	m["FreeStateUse"] = 53          //运行统计-空闲
-	m["offlineStateUse"] = 543      //运行统计-离线
-	m["TerminalLog"] = termin       //终端日志
-	m["PlaybackControls"] = device  //播放控制
+	terminal["2025-5-1"] = rand.Intn(100)
+	terminal["2025-5-2"] = rand.Intn(100)
+	terminal["2025-5-3"] = rand.Intn(100)
+	terminal["2025-5-4"] = rand.Intn(100)
+	terminal["2025-5-5"] = rand.Intn(100)
+	terminal["2025-5-6"] = rand.Intn(100)
+	terminal["2025-5-7"] = rand.Intn(100)
+	m["device"] = device                  //设备列表
+	m["TerminalOffline"] = terminal       //终端离线
+	m["RunStateUse"] = rand.Intn(100)     //运行统计-使用中
+	m["FreeStateUse"] = rand.Intn(100)    //运行统计-空闲
+	m["offlineStateUse"] = rand.Intn(100) //运行统计-离线
+	m["TerminalLog"] = termin             //终端日志
+	m["PlaybackControls"] = device        //播放控制
 	resp.HandleSuccess(ctx, m)
 }

+ 35 - 34
internal/handler/elevator.go

@@ -3,6 +3,7 @@ package handler
 import (
 	"city_chips/internal/service"
 	"city_chips/pkg/helper/resp"
+	"math/rand"
 
 	"github.com/gin-gonic/gin"
 	"github.com/spf13/viper"
@@ -29,40 +30,40 @@ func (h *ElevatorHandler) GetElevator(ctx *gin.Context) {
 	Overload := make(map[string]any)
 	TrappedPerson := make(map[string]any)
 	Abnormal := make(map[string]any)
-	m["ElevatorCount"] = 543     //电梯总量
-	m["RunningNormally"] = 43    //运行正常
-	m["RunningAbnormal"] = 12    //运行异常
-	m["OverloadWarning"] = 1234  //超载报警
-	m["TrappedPersonAlarm"] = 90 //困人报警
-	m["AbnormalVibration"] = 655 //异常震动
-	RunState["2025-5-1"] = 330
-	RunState["2025-5-2"] = 321
-	RunState["2025-5-3"] = 12
-	RunState["2025-5-4"] = 90
-	RunState["2025-5-5"] = 43
-	RunState["2025-5-6"] = 23
-	RunState["2025-5-7"] = 56
-	Overload["2025-5-1"] = 231
-	Overload["2025-5-2"] = 32
-	Overload["2025-5-3"] = 56
-	Overload["2025-5-4"] = 231
-	Overload["2025-5-5"] = 654
-	Overload["2025-5-6"] = 231
-	Overload["2025-5-7"] = 654
-	TrappedPerson["2025-5-1"] = 321
-	TrappedPerson["2025-5-2"] = 654
-	TrappedPerson["2025-5-3"] = 764
-	TrappedPerson["2025-5-4"] = 23
-	TrappedPerson["2025-5-5"] = 65
-	TrappedPerson["2025-5-6"] = 12
-	TrappedPerson["2025-5-7"] = 65
-	Abnormal["2025-5-1"] = 65
-	Abnormal["2025-5-2"] = 213
-	Abnormal["2025-5-3"] = 87
-	Abnormal["2025-5-4"] = 31
-	Abnormal["2025-5-5"] = 654
-	Abnormal["2025-5-6"] = 165
-	Abnormal["2025-5-7"] = 6745
+	m["ElevatorCount"] = rand.Intn(1000)      //电梯总量
+	m["RunningNormally"] = rand.Intn(1000)    //运行正常
+	m["RunningAbnormal"] = rand.Intn(1000)    //运行异常
+	m["OverloadWarning"] = rand.Intn(1000)    //超载报警
+	m["TrappedPersonAlarm"] = rand.Intn(1000) //困人报警
+	m["AbnormalVibration"] = rand.Intn(1000)  //异常震动
+	RunState["2025-5-1"] = rand.Intn(1000)
+	RunState["2025-5-2"] = rand.Intn(1000)
+	RunState["2025-5-3"] = rand.Intn(1000)
+	RunState["2025-5-4"] = rand.Intn(1000)
+	RunState["2025-5-5"] = rand.Intn(1000)
+	RunState["2025-5-6"] = rand.Intn(1000)
+	RunState["2025-5-7"] = rand.Intn(1000)
+	Overload["2025-5-1"] = rand.Intn(1000)
+	Overload["2025-5-2"] = rand.Intn(1000)
+	Overload["2025-5-3"] = rand.Intn(1000)
+	Overload["2025-5-4"] = rand.Intn(1000)
+	Overload["2025-5-5"] = rand.Intn(1000)
+	Overload["2025-5-6"] = rand.Intn(1000)
+	Overload["2025-5-7"] = rand.Intn(1000)
+	TrappedPerson["2025-5-1"] = rand.Intn(1000)
+	TrappedPerson["2025-5-2"] = rand.Intn(1000)
+	TrappedPerson["2025-5-3"] = rand.Intn(1000)
+	TrappedPerson["2025-5-4"] = rand.Intn(1000)
+	TrappedPerson["2025-5-5"] = rand.Intn(1000)
+	TrappedPerson["2025-5-6"] = rand.Intn(1000)
+	TrappedPerson["2025-5-7"] = rand.Intn(1000)
+	Abnormal["2025-5-1"] = rand.Intn(1000)
+	Abnormal["2025-5-2"] = rand.Intn(1000)
+	Abnormal["2025-5-3"] = rand.Intn(1000)
+	Abnormal["2025-5-4"] = rand.Intn(1000)
+	Abnormal["2025-5-5"] = rand.Intn(1000)
+	Abnormal["2025-5-6"] = rand.Intn(1000)
+	Abnormal["2025-5-7"] = rand.Intn(1000)
 	m["OverloadCount"] = Overload      //超载预警
 	m["RunState"] = RunState           //运行状态
 	m["AbnormalCount"] = Abnormal      //异常告警

+ 68 - 0
internal/handler/energy.go

@@ -0,0 +1,68 @@
+package handler
+
+import (
+	"city_chips/internal/service"
+	"city_chips/pkg/helper/resp"
+	"fmt"
+	"github.com/gin-gonic/gin"
+	"github.com/spf13/viper"
+	"math/rand"
+)
+
+type EnergyHandler struct {
+	*Handler
+	energyService service.EnergyService
+	conf          *viper.Viper
+}
+
+func NewEnergyHandler(
+	handler *Handler,
+	energyService service.EnergyService,
+	conf *viper.Viper,
+) *EnergyHandler {
+	return &EnergyHandler{
+		Handler:       handler,
+		energyService: energyService,
+		conf:          conf,
+	}
+}
+
+// GetEnergy 获取能源系统数据
+func (h *EnergyHandler) GetEnergy(ctx *gin.Context) {
+	m := make(map[string]any)
+	OnedayPowerConsumption := make(map[string]any)
+	OnedayWaterConsumption := make(map[string]any)
+	LastYearEnergyConsumption := make(map[string]any)
+	YearEnergyConsumption := make(map[string]any)
+	LastYearCarbonEmissions := make(map[string]any)
+	YearCarbonEmissions := make(map[string]any)
+	for i := 0; i < 24; i++ {
+		name := fmt.Sprintf("%v时", i+1)
+		OnedayPowerConsumption[name] = rand.Intn(100)
+		OnedayWaterConsumption[name] = rand.Intn(100)
+	}
+	for i := 0; i < 12; i++ {
+		name := fmt.Sprintf("%v月", i+1)
+		LastYearEnergyConsumption[name] = rand.Intn(1000)
+		YearEnergyConsumption[name] = rand.Intn(1000)
+		LastYearCarbonEmissions[name] = rand.Intn(1000)
+		YearCarbonEmissions[name] = rand.Intn(1000)
+	}
+	m["PowerConsumption"] = rand.Intn(1000)                    //今日实时电耗
+	m["WaterConsumption"] = rand.Intn(1000)                    //今日实时水耗
+	m["YesterdayConsumption"] = rand.Intn(1000)                //昨日电耗
+	m["MonthElectricityConsumption"] = rand.Intn(1000)         //本月电耗
+	m["YesterdayWaterConsumption"] = rand.Intn(1000)           //昨日水耗
+	m["MonthWaterConsumption"] = rand.Intn(1000)               //本月水耗
+	m["OnedayPowerConsumption"] = OnedayPowerConsumption       //本月水耗
+	m["OnedayWaterConsumption"] = OnedayWaterConsumption       //本月水耗
+	m["EnergyCount"] = rand.Intn(10000)                        //能源总量
+	m["EnergyIntensity"] = rand.Intn(1000)                     //能耗强度
+	m["CarbonEmissions"] = rand.Intn(1000)                     //碳排总量
+	m["CarbonIsntensity"] = rand.Intn(1000)                    //碳排强度
+	m["LastYearEnergyConsumption"] = LastYearEnergyConsumption //去年能耗
+	m["YearEnergyConsumption"] = YearEnergyConsumption         //今年能耗
+	m["LastYearCarbonEmissions"] = LastYearCarbonEmissions     //去年碳排
+	m["YearCarbonEmissions"] = YearCarbonEmissions             //今年碳排
+	resp.HandleSuccess(ctx, m)
+}

+ 33 - 32
internal/handler/home.go

@@ -5,6 +5,7 @@ import (
 	"city_chips/pkg/helper/resp"
 	"github.com/gin-gonic/gin"
 	"github.com/spf13/viper"
+	"math/rand"
 )
 
 type HomeHandler struct {
@@ -25,38 +26,38 @@ func NewHomeHandler(handler *Handler, homeService service.HomeService, conf *vip
 func (h *HomeHandler) GetHome(ctx *gin.Context) {
 	m := make(map[string]any)
 	Alarm := make(map[string]any)
-	m["Area"] = 20000                //建筑面积
-	m["FloorSpace"] = 20000          //占地面积
-	m["BuildingHeight"] = 30         //建筑高度
-	m["Storey"] = 30                 //建筑层数
-	m["Device"] = 30                 //设备总数
-	m["Runing"] = 30                 //运行总数
-	m["Fault"] = 30                  //设备故障
-	m["Alarm"] = 30                  //报警数量
-	m["TodayConsumption"] = 9342     //今日电能耗
-	m["WeekConsumption"] = 30        //本周电能耗
-	m["MonthConsumption"] = 432      //本月电能耗
-	m["YearConsumption"] = 133       //本年电能耗
-	m["Impetus"] = 67                //动力能耗
-	m["illuminating"] = 432          //照明能耗
-	m["SpecialElectricity"] = 10     //特殊用电能耗
-	m["AirConditioningSockets"] = 30 //空调插座能耗
-	m["TodaysTicket"] = 30           //今日工单
-	m["ConductedTicket"] = 909       //进行工单
-	m["TimeoutTicket"] = 30          //超时工单
-	m["Demands"] = 30                //诉求总数
-	m["DisposeDemands"] = 30         //已处理诉求
-	m["UnDisposeDemands"] = 30       //未处理诉求
-	m["TodayDisposeDemands"] = 30    //今日新增
-	m["OccupationDriveway"] = 321    //占用车位
-	m["IdleDriveway"] = 30           //空闲车位
-	Alarm["2025-5-1"] = 10
-	Alarm["2025-5-2"] = 2210
-	Alarm["2025-5-3"] = 30
-	Alarm["2025-5-4"] = 40
-	Alarm["2025-5-5"] = 5320
-	Alarm["2025-5-6"] = 60
-	Alarm["2025-5-7"] = 70
+	m["Area"] = rand.Intn(1000)                   //建筑面积
+	m["FloorSpace"] = rand.Intn(1000)             //占地面积
+	m["BuildingHeight"] = rand.Intn(1000)         //建筑高度
+	m["Storey"] = rand.Intn(1000)                 //建筑层数
+	m["Device"] = rand.Intn(1000)                 //设备总数
+	m["Runing"] = rand.Intn(1000)                 //运行总数
+	m["Fault"] = rand.Intn(1000)                  //设备故障
+	m["Alarm"] = rand.Intn(1000)                  //报警数量
+	m["TodayConsumption"] = rand.Intn(1000)       //今日电能耗
+	m["WeekConsumption"] = rand.Intn(1000)        //本周电能耗
+	m["MonthConsumption"] = rand.Intn(1000)       //本月电能耗
+	m["YearConsumption"] = rand.Intn(1000)        //本年电能耗
+	m["Impetus"] = rand.Intn(1000)                //动力能耗
+	m["illuminating"] = rand.Intn(1000)           //照明能耗
+	m["SpecialElectricity"] = rand.Intn(1000)     //特殊用电能耗
+	m["AirConditioningSockets"] = rand.Intn(1000) //空调插座能耗
+	m["TodaysTicket"] = rand.Intn(1000)           //今日工单
+	m["ConductedTicket"] = rand.Intn(1000)        //进行工单
+	m["TimeoutTicket"] = rand.Intn(1000)          //超时工单
+	m["Demands"] = rand.Intn(1000)                //诉求总数
+	m["DisposeDemands"] = rand.Intn(1000)         //已处理诉求
+	m["UnDisposeDemands"] = rand.Intn(1000)       //未处理诉求
+	m["TodayDisposeDemands"] = rand.Intn(1000)    //今日新增
+	m["OccupationDriveway"] = rand.Intn(1000)     //占用车位
+	m["IdleDriveway"] = rand.Intn(1000)           //空闲车位
+	Alarm["2025-5-1"] = rand.Intn(1000)
+	Alarm["2025-5-2"] = rand.Intn(1000)
+	Alarm["2025-5-3"] = rand.Intn(1000)
+	Alarm["2025-5-4"] = rand.Intn(1000)
+	Alarm["2025-5-5"] = rand.Intn(1000)
+	Alarm["2025-5-6"] = rand.Intn(1000)
+	Alarm["2025-5-7"] = rand.Intn(1000)
 	m["AlarmCount"] = Alarm //报警统计
 	resp.HandleSuccess(ctx, m)
 }

+ 73 - 0
internal/handler/illuminating.go

@@ -0,0 +1,73 @@
+package handler
+
+import (
+	"city_chips/internal/model"
+	"city_chips/internal/service"
+	"city_chips/pkg/helper/resp"
+	"fmt"
+	"github.com/gin-gonic/gin"
+	"github.com/spf13/viper"
+	"math/rand"
+	"time"
+)
+
+type IlluminatingHandler struct {
+	*Handler
+	illuminatingService service.IlluminatingService
+	conf                *viper.Viper
+}
+
+func NewIlluminatingHandler(
+	handler *Handler,
+	illuminatingService service.IlluminatingService,
+	conf *viper.Viper,
+) *IlluminatingHandler {
+	return &IlluminatingHandler{
+		Handler:             handler,
+		illuminatingService: illuminatingService,
+		conf:                conf,
+	}
+}
+
+func (h *IlluminatingHandler) GetIlluminating(ctx *gin.Context) {
+	m := make(map[string]any)
+	runAnaly := make(map[string]any)
+	var illuminatingDevice []model.IlluminatingDevice
+	var eventList []model.EventList
+	var runAnalyse model.RunAnalyse
+	for i := 0; i < 20; i++ {
+		name := fmt.Sprintf("回路%v", i+1)
+		device := model.IlluminatingDevice{
+			Id:             i + 1,
+			DeviceName:     name,
+			SwitchStatus:   rand.Intn(2),
+			OnlinePresence: rand.Intn(2),
+		}
+		illuminatingDevice = append(illuminatingDevice, device)
+	}
+	for i := 0; i < 10; i++ {
+		name := fmt.Sprintf("设备%v", i+1)
+		list := model.EventList{
+			Id:           i + 1,
+			DeviceName:   name,
+			DeviceStatus: rand.Intn(2),
+			EventDate:    time.Now().Format("2006-01-02 15:04:05"),
+		}
+		eventList = append(eventList, list)
+	}
+	for i := 0; i < 7; i++ {
+		date := fmt.Sprintf("2025-5-%v", i+1)
+		runAnalyse.FaultCount = rand.Intn(100)
+		runAnalyse.OpenCount = rand.Intn(100)
+		runAnalyse.OffCount = rand.Intn(100)
+		runAnaly[date] = runAnalyse
+	}
+	m["IlluminatingDevice"] = illuminatingDevice //设备列表
+	m["DeviceCount"] = rand.Intn(100)            //设备总数
+	m["OpenCount"] = rand.Intn(100)              //开启数量
+	m["OffCount"] = rand.Intn(100)               //关闭数量
+	m["FaultCount"] = rand.Intn(100)             //故障数量
+	m["RunAnalyse"] = runAnaly                   //运行分析
+	m["EventList"] = eventList                   //事件列表
+	resp.HandleSuccess(ctx, m)
+}

+ 71 - 0
internal/handler/information.go

@@ -0,0 +1,71 @@
+package handler
+
+import (
+	"city_chips/internal/model"
+	"city_chips/internal/service"
+	"city_chips/pkg/helper/resp"
+	"fmt"
+	"github.com/gin-gonic/gin"
+	"github.com/spf13/viper"
+	"math/rand"
+)
+
+type InformationHandler struct {
+	*Handler
+	informationService service.InformationService
+	conf               *viper.Viper
+}
+
+func NewInformationHandler(
+	handler *Handler,
+	informationService service.InformationService,
+	conf *viper.Viper,
+) *InformationHandler {
+	return &InformationHandler{
+		Handler:            handler,
+		informationService: informationService,
+		conf:               conf,
+	}
+}
+
+// GetInformation 获取信息发布数据
+func (h *InformationHandler) GetInformation(ctx *gin.Context) {
+	m := make(map[string]any)
+	readings := make(map[string]any)
+	var Large []model.LargeController
+	var information []model.InformationCount
+	for i := 0; i < 10; i++ {
+		name := fmt.Sprintf("显示大屏%v", i+1)
+		records := model.LargeController{
+			Id:         i + 1,
+			DeviceName: name,
+			UseState:   rand.Intn(2),
+		}
+		Large = append(Large, records)
+	}
+	for i := 0; i < 4; i++ {
+		name := fmt.Sprintf("类型%v", i+1)
+		count := model.InformationCount{
+			Id:              i + 1,
+			InformationType: name,
+			Vale:            rand.Intn(1000),
+		}
+		information = append(information, count)
+	}
+	readings["Under30"] = rand.Intn(1000)      //30以下
+	readings["Under30And40"] = rand.Intn(1000) //30-40
+	readings["Under40And50"] = rand.Intn(1000) //40-50
+	readings["Under50And60"] = rand.Intn(1000) //50-60
+	readings["More60"] = rand.Intn(1000)       //60以上
+	m["LargeScreen"] = rand.Intn(1000)         //大屏总数
+	m["Normal"] = rand.Intn(1000)              //大屏正常数
+	m["Fault"] = rand.Intn(1000)               //大屏故障数
+	m["Idle"] = rand.Intn(1000)                //大屏空闲数
+	m["UrgentNotice"] = rand.Intn(1000)        //紧急通知
+	m["Policy"] = rand.Intn(1000)              //政策法规
+	m["Activity"] = rand.Intn(1000)            //活动预告
+	m["Large"] = Large                         //大屏控制
+	m["Information"] = information             //进入信息占比
+	m["Readings"] = readings                   //车辆出入记录
+	resp.HandleSuccess(ctx, m)
+}

+ 94 - 0
internal/handler/property.go

@@ -0,0 +1,94 @@
+package handler
+
+import (
+	"city_chips/internal/model"
+	"city_chips/internal/service"
+	"city_chips/pkg/helper/resp"
+	"fmt"
+	"github.com/gin-gonic/gin"
+	"github.com/spf13/viper"
+	"math/rand"
+	"time"
+)
+
+type PropertyHandler struct {
+	*Handler
+	propertyService service.PropertyService
+	conf            *viper.Viper
+}
+
+func NewPropertyHandler(
+	handler *Handler,
+	propertyService service.PropertyService,
+	conf *viper.Viper,
+) *PropertyHandler {
+	return &PropertyHandler{
+		Handler:         handler,
+		propertyService: propertyService,
+		conf:            conf,
+	}
+}
+
+// GetProperty 获取物业管理系统数据
+func (h *PropertyHandler) GetProperty(ctx *gin.Context) {
+	m := make(map[string]any)
+	access := make(map[string]any)
+	garageCount := make(map[string]any)
+	var accessData model.AccessData
+	var accessRecords []model.AccessRecords
+	var garRecords []model.GarRecords
+	var garage model.Garage
+	m["HousesCount"] = rand.Intn(100)     //房屋数
+	m["HouseholdCount"] = rand.Intn(100)  //住户数
+	m["DrivewayCount"] = rand.Intn(100)   //车位数
+	m["PopulationCount"] = rand.Intn(100) //人口总数
+	m["Under30"] = rand.Intn(100)         //30以下
+	m["Under40"] = rand.Intn(100)         //40以下
+	m["Under50"] = rand.Intn(100)         //50以下
+	m["More60"] = rand.Intn(100)          //60以上
+	for i := 0; i < 7; i++ {
+		date := fmt.Sprintf("2025-5-%v", i+1)
+
+		accessData.Remote = rand.Intn(100)
+		accessData.CreditCard = rand.Intn(100)
+		accessData.BrushFace = rand.Intn(100)
+
+		garage.Storage = rand.Intn(100)
+		garage.OutboundShipments = rand.Intn(100)
+		access[date] = accessData
+		garageCount[date] = garage
+	}
+	for i := 0; i < 10; i++ {
+		name := fmt.Sprintf("人员%v", i+1)
+		records := model.AccessRecords{
+			Name:  name,
+			State: 0,
+			Date:  time.Now().Format("2006-01-02 15:04:05"),
+		}
+		accessRecords = append(accessRecords, records)
+	}
+
+	for i := 0; i < 10; i++ {
+		name := fmt.Sprintf("贵A%v", i+1)
+		records := model.GarRecords{
+			GarName: name,
+			State:   0,
+			GarImag: "https://img95.699pic.com/photo/40041/1120.jpg_wh860.jpg",
+			Date:    time.Now().Format("2006-01-02 15:04:05"),
+		}
+		garRecords = append(garRecords, records)
+	}
+	m["HousesCount"] = rand.Intn(100)     //房屋数
+	m["HouseholdCount"] = rand.Intn(100)  //住户数
+	m["DrivewayCount"] = rand.Intn(100)   //车位数
+	m["PopulationCount"] = rand.Intn(100) //人口总数
+	m["Under30"] = rand.Intn(100)         //30以下
+	m["Under40"] = rand.Intn(100)         //40以下
+	m["Under50"] = rand.Intn(100)         //50以下
+	m["More60"] = rand.Intn(100)          //60以上
+	m["AccessRecords"] = accessRecords    //人员出入记录
+	m["GarRecords"] = garRecords          //车辆出入记录
+	m["Access"] = access                  //门禁管理
+	m["GarageCount"] = access             //车库流动管理
+	resp.HandleSuccess(ctx, m)
+}

+ 11 - 0
internal/model/energy.go

@@ -0,0 +1,11 @@
+package model
+
+import "gorm.io/gorm"
+
+type Energy struct {
+	gorm.Model
+}
+
+func (m *Energy) TableName() string {
+	return "energy"
+}

+ 28 - 0
internal/model/illuminating.go

@@ -0,0 +1,28 @@
+package model
+
+import "gorm.io/gorm"
+
+type Illuminating struct {
+	gorm.Model
+}
+type IlluminatingDevice struct {
+	Id             int    `json:"Id"`
+	DeviceName     string `json:"DeviceName"`     //设备名称
+	SwitchStatus   int    `json:"SwitchStatus"`   //开工状态
+	OnlinePresence int    `json:"OnlinePresence"` //在线状态
+}
+type RunAnalyse struct {
+	OpenCount  int `json:"OpenCount"`  //开启数量
+	OffCount   int `json:"OffCount"`   //关闭数量
+	FaultCount int `json:"FaultCount"` //故障数量
+}
+type EventList struct {
+	Id           int    `json:"Id"`
+	DeviceName   string `json:"DeviceName"`   //设备名称
+	DeviceStatus int    `json:"DeviceStatus"` //设备状态
+	EventDate    string `json:"EventDate"`    //事件时间
+}
+
+func (m *Illuminating) TableName() string {
+	return "illuminating"
+}

+ 21 - 0
internal/model/information.go

@@ -0,0 +1,21 @@
+package model
+
+import "gorm.io/gorm"
+
+type Information struct {
+	gorm.Model
+}
+type LargeController struct {
+	Id         int    `json:"id"`
+	DeviceName string `json:"DeviceName"` //设备名称
+	UseState   int    `json:"UseState"`   //设备使用状态
+}
+type InformationCount struct {
+	Id              int    `json:"id"`
+	InformationType string `json:"InformationType"` //信息发布类型
+	Vale            int    `json:"UseState"`        //占比
+}
+
+func (m *Information) TableName() string {
+	return "information"
+}

+ 31 - 0
internal/model/property.go

@@ -0,0 +1,31 @@
+package model
+
+import "gorm.io/gorm"
+
+type Property struct {
+	gorm.Model
+}
+type AccessRecords struct {
+	Name  string `json:"Name"`  //人员姓名
+	State int    `json:"State"` //状态
+	Date  string `json:"Date"`  //时间
+}
+type AccessData struct {
+	BrushFace  int `json:"BrushFace"`  //刷脸进入
+	CreditCard int `json:"CreditCard"` //刷卡进入
+	Remote     int `json:"Remote"`     //远程开门
+}
+type GarRecords struct {
+	GarName string `json:"GarName"` //车牌
+	State   int    `json:"State"`   //状态
+	GarImag string `json:"GarImag"` //图片
+	Date    string `json:"Date"`    //时间
+}
+type Garage struct {
+	OutboundShipments int `json:"OutboundShipments"` //出库
+	Storage           int `json:"Storage"`           //入库
+}
+
+func (m *Property) TableName() string {
+	return "property"
+}

+ 28 - 0
internal/repository/energy.go

@@ -0,0 +1,28 @@
+package repository
+
+import (
+	"city_chips/internal/model"
+	
+)
+
+type EnergyRepository interface {
+	GetEnergy(ctx context.Context, id int64) (*model.Energy, error)
+}
+
+func NewEnergyRepository(
+	repository *Repository,
+) EnergyRepository {
+	return &energyRepository{
+		Repository: repository,
+	}
+}
+
+type energyRepository struct {
+	*Repository
+}
+
+func (r *energyRepository) GetEnergy(ctx context.Context, id int64) (*model.Energy, error) {
+	var energy model.Energy
+
+	return &energy, nil
+}

+ 28 - 0
internal/repository/illuminating.go

@@ -0,0 +1,28 @@
+package repository
+
+import (
+	"city_chips/internal/model"
+	"context"
+)
+
+type IlluminatingRepository interface {
+	GetIlluminating(ctx context.Context, id int64) (*model.Illuminating, error)
+}
+
+func NewIlluminatingRepository(
+	repository *Repository,
+) IlluminatingRepository {
+	return &illuminatingRepository{
+		Repository: repository,
+	}
+}
+
+type illuminatingRepository struct {
+	*Repository
+}
+
+func (r *illuminatingRepository) GetIlluminating(ctx context.Context, id int64) (*model.Illuminating, error) {
+	var illuminating model.Illuminating
+
+	return &illuminating, nil
+}

+ 28 - 0
internal/repository/information.go

@@ -0,0 +1,28 @@
+package repository
+
+import (
+	"city_chips/internal/model"
+	"context"
+)
+
+type InformationRepository interface {
+	GetInformation(ctx context.Context, id int64) (*model.Information, error)
+}
+
+func NewInformationRepository(
+	repository *Repository,
+) InformationRepository {
+	return &informationRepository{
+		Repository: repository,
+	}
+}
+
+type informationRepository struct {
+	*Repository
+}
+
+func (r *informationRepository) GetInformation(ctx context.Context, id int64) (*model.Information, error) {
+	var information model.Information
+
+	return &information, nil
+}

+ 28 - 0
internal/repository/property.go

@@ -0,0 +1,28 @@
+package repository
+
+import (
+	"city_chips/internal/model"
+	"context"
+)
+
+type PropertyRepository interface {
+	GetProperty(ctx context.Context, id int64) (*model.Property, error)
+}
+
+func NewPropertyRepository(
+	repository *Repository,
+) PropertyRepository {
+	return &propertyRepository{
+		Repository: repository,
+	}
+}
+
+type propertyRepository struct {
+	*Repository
+}
+
+func (r *propertyRepository) GetProperty(ctx context.Context, id int64) (*model.Property, error) {
+	var property model.Property
+
+	return &property, nil
+}

+ 26 - 1
internal/server/http.go

@@ -14,7 +14,12 @@ func NewServerHTTP(
 	conference *handler.ConferenceHandler,
 	home *handler.HomeHandler,
 	elevator *handler.ElevatorHandler,
-	broadcast *handler.BroadcastHandler) *gin.Engine {
+	broadcast *handler.BroadcastHandler,
+	property *handler.PropertyHandler,
+	information *handler.InformationHandler,
+	illuminating *handler.IlluminatingHandler,
+	energy *handler.EnergyHandler,
+) *gin.Engine {
 	gin.SetMode(gin.ReleaseMode)
 	r := gin.Default()
 	r.Use(
@@ -57,5 +62,25 @@ func NewServerHTTP(
 	{
 		bro.GET("/count", broadcast.GetBroadcast)
 	}
+	//物业管理系统
+	pro := r.Group("/property")
+	{
+		pro.GET("/count", property.GetProperty)
+	}
+	//信息发布管理平台
+	info := r.Group("/information")
+	{
+		info.GET("/count", information.GetInformation)
+	}
+	//照明系统
+	ill := r.Group("/illuminating")
+	{
+		ill.GET("/count", illuminating.GetIlluminating)
+	}
+	//能源系统
+	ener := r.Group("/energy")
+	{
+		ener.GET("/count", energy.GetEnergy)
+	}
 	return r
 }

+ 33 - 0
internal/service/energy.go

@@ -0,0 +1,33 @@
+package service
+
+import (
+	"city_chips/internal/model"
+	"city_chips/internal/repository"
+	
+)
+
+type EnergyService interface {
+	GetEnergy(ctx context.Context, id int64) (*model.Energy, error)
+}
+error)
+}
+	service *Service,
+	energyRepository repository.EnergyRepository,
+func NewEnergyService(
+    service *Service,
+		Service:          service,
+) EnergyService {
+	return &energyService{
+		Service:        service,
+		energyRepository: energyRepository,
+	}
+}
+
+type energyService struct {
+	*Service
+	energyRepository repository.EnergyRepository
+}
+
+func (s *energyService) GetEnergy(ctx context.Context, id int64) (*model.Energy, error) {
+	return s.energyRepository.GetEnergy(ctx, id)
+}

+ 30 - 0
internal/service/illuminating.go

@@ -0,0 +1,30 @@
+package service
+
+import (
+	"city_chips/internal/model"
+	"city_chips/internal/repository"
+	"context"
+)
+
+type IlluminatingService interface {
+	GetIlluminating(ctx context.Context, id int64) (*model.Illuminating, error)
+}
+
+func NewIlluminatingService(
+	service *Service,
+	illuminatingRepository repository.IlluminatingRepository,
+) IlluminatingService {
+	return &illuminatingService{
+		Service:                service,
+		illuminatingRepository: illuminatingRepository,
+	}
+}
+
+type illuminatingService struct {
+	*Service
+	illuminatingRepository repository.IlluminatingRepository
+}
+
+func (s *illuminatingService) GetIlluminating(ctx context.Context, id int64) (*model.Illuminating, error) {
+	return s.illuminatingRepository.GetIlluminating(ctx, id)
+}

+ 30 - 0
internal/service/information.go

@@ -0,0 +1,30 @@
+package service
+
+import (
+	"city_chips/internal/model"
+	"city_chips/internal/repository"
+	"context"
+)
+
+type InformationService interface {
+	GetInformation(ctx context.Context, id int64) (*model.Information, error)
+}
+
+func NewInformationService(
+	service *Service,
+	informationRepository repository.InformationRepository,
+) InformationService {
+	return &informationService{
+		Service:               service,
+		informationRepository: informationRepository,
+	}
+}
+
+type informationService struct {
+	*Service
+	informationRepository repository.InformationRepository
+}
+
+func (s *informationService) GetInformation(ctx context.Context, id int64) (*model.Information, error) {
+	return s.informationRepository.GetInformation(ctx, id)
+}

+ 30 - 0
internal/service/property.go

@@ -0,0 +1,30 @@
+package service
+
+import (
+	"city_chips/internal/model"
+	"city_chips/internal/repository"
+	"context"
+)
+
+type PropertyService interface {
+	GetProperty(ctx context.Context, id int64) (*model.Property, error)
+}
+
+func NewPropertyService(
+	service *Service,
+	propertyRepository repository.PropertyRepository,
+) PropertyService {
+	return &propertyService{
+		Service:            service,
+		propertyRepository: propertyRepository,
+	}
+}
+
+type propertyService struct {
+	*Service
+	propertyRepository repository.PropertyRepository
+}
+
+func (s *propertyService) GetProperty(ctx context.Context, id int64) (*model.Property, error) {
+	return s.propertyRepository.GetProperty(ctx, id)
+}