// Copyright 2019 github.com. All rights reserved. // Use of this source code is governed by github.com. package impl import ( "context" "smart-site-management/impl/v1/alarm" "smart-site-management/impl/v1/dust" "smart-site-management/impl/v1/staff" "smart-site-management/impl/v1/vehicle" "smart-site-management/impl/v1/tower" "smart-site-management/pb" "smart-site-management/pb/v1" "smart-site-management/impl/v1/camera" "smart-site-management/impl/v1/project" "smart-site-management/impl/v1/user" "github.com/jaryhe/gopkgs/tasker/rpctasker" "google.golang.org/grpc" ) // 具体实现 type Rcvr struct { } func Register(s *grpc.Server) { pb.RegisterSmartSiteProjectServer(s, &Rcvr{}) } // 修改密码 func (c *Rcvr) ChangePasswd(ctx context.Context, req *v1.ChangePasswdRequest) (reply *v1.ChangePasswdReply, err error) { t1 := func() error { reply, err = user.ChangePasswd(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } func (c *Rcvr) EmailUpdate(ctx context.Context, req *v1.EmailUpdateRequest) (reply *v1.EmailUpdateReply, err error) { t1 := func() error { reply, err = user.EmailUpdate(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } func (c *Rcvr) EmailPrepare(ctx context.Context, req *v1.EmailPrepareRequest) (reply *v1.EmailPrepareReply, err error) { t1 := func() error { reply, err = user.EmailPrepare(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } func (c *Rcvr) PhoneUpdate(ctx context.Context, req *v1.PhoneUpdateRequest) (reply *v1.PhoneUpdateReply, err error) { t1 := func() error { reply, err = user.PhoneUpdate(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } func (c *Rcvr) UserInfo(ctx context.Context, req *v1.UserInfoRequest) (reply *v1.UserInfoReply, err error) { t1 := func() error { reply, err = user.UserInfo(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } func (c *Rcvr) Login(ctx context.Context, req *v1.LoginRequest) (reply *v1.LoginReply, err error) { t1 := func() error { reply, err = user.Login(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 项目变更申请 func (c *Rcvr) ProjectChange(ctx context.Context, req *v1.ProjectChangeRequest) (reply *v1.ProjectChangeReply, err error) { t1 := func() error { reply, err = project.ProjectChange(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 设置工程平面图或效果图 func (c *Rcvr) ProjectSetPic(ctx context.Context, req *v1.ProjectSetPicRequest) (reply *v1.ProjectSetPicReply, err error) { t1 := func() error { reply, err = project.ProjectSetPic(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 修改工程名或地址,不需审批 func (c *Rcvr) ProjectUpdate(ctx context.Context, req *v1.ProjectUpdateRequest) (reply *v1.ProjectUpdateReply, err error) { t1 := func() error { reply, err = project.ProjectUpdate(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 获取项目变更所需的原始字段和value信息 func (c *Rcvr) ProjectInfoForChange(ctx context.Context, req *v1.ProjectInfoForChangeRequest) (reply *v1.ProjectInfoForChangeReply, err error) { t1 := func() error { reply, err = project.ProjectInfoForChange(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 项目变更工单列表 func (c *Rcvr) ProjectChangeInfoList(ctx context.Context, req *v1.ProjectChangeInfoListRequest) (reply *v1.ProjectChangeInfoListReply, err error) { t1 := func() error { reply, err = project.ProjectChangeInfoList(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 设备列表 func (c *Rcvr) DeviceList(ctx context.Context, req *v1.DeviceListRequest) (reply *v1.DeviceListReply, err error) { t1 := func() error { reply, err = project.DeviceList(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 获取设备绑定的摄像头 func (c *Rcvr) DeviceVideoChannel(ctx context.Context, req *v1.DeviceVideoChannelRequest) (reply *v1.DeviceVideoChannelReply, err error) { t1 := func() error { reply, err = project.DeviceVideoChannel(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } func (c *Rcvr) ChannelUpdate(ctx context.Context, req *v1.ChannelUpdateRequest) (reply *v1.ChannelUpdateReply, err error) { t1 := func() error { reply, err = camera.ChannelUpdate(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 视频设备列表 func (c *Rcvr) VedioList(ctx context.Context, req *v1.VedioListRequest) (reply *v1.VedioListReply, err error) { t1 := func() error { reply, err = camera.VedioList(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 运渣车辆列表 func (c *Rcvr) VehicleList(ctx context.Context, req *v1.VehicleListRequest) (reply *v1.VehicleListReply, err error) { t1 := func() error { reply, err = vehicle.VehicleList(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 获取实时播放地址 func (c *Rcvr) RealPlay(ctx context.Context, req *v1.RealPlayRequest) (reply *v1.RealPlayReply, err error) { t1 := func() error { reply, err = camera.RealPlay(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } func (c *Rcvr) Ptz(ctx context.Context, req *v1.PtzRequest) (reply *v1.PtzReply, err error) { t1 := func() error { reply, err = camera.Ptz(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } func (c *Rcvr) VedioPing(ctx context.Context, req *v1.VedioPingRequest) (reply *v1.VedioPingReply, err error) { t1 := func() error { reply, err = camera.VedioPing(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 最近一次考勤数据 func (c *Rcvr) LatestStaffData(ctx context.Context, req *v1.LatestStaffDataRequest) (reply *v1.LatestStaffDataReply, err error) { t1 := func() error { reply, err = staff.LatestStaffData(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } func (c *Rcvr) StaffList(ctx context.Context, req *v1.StaffListRequest) (reply *v1.StaffListReply, err error) { t1 := func() error { reply, err = staff.StaffList(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } func (c *Rcvr) StaffAttendance(ctx context.Context, req *v1.StaffAttendanceRequest) (reply *v1.StaffAttendanceReply, err error) { t1 := func() error { reply, err = staff.StaffAttendance(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 按工种进行考勤统计 func (c *Rcvr) StaffWorkTypeStatistics(ctx context.Context, req *v1.StaffWorkTypeStatisticsRequest) (reply *v1.StaffWorkTypeStatisticsReply, err error) { t1 := func() error { reply, err = staff.StaffWorkTypeStatistics(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 按员工类型进行考勤统计 func (c *Rcvr) StaffTypeStatistics(ctx context.Context, req *v1.StaffTypeStatisticsRequest) (reply *v1.StaffTypeStatisticsReply, err error) { t1 := func() error { reply, err = staff.StaffTypeStatistics(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 按劳务公司进行考勤统计 func (c *Rcvr) LaborCompanyStatistics(ctx context.Context, req *v1.LaborCompanyStatisticsRequest) (reply *v1.LaborCompanyStatisticsReply, err error) { t1 := func() error { reply, err = staff.LaborCompanyStatistics(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 最近一次扬尘数据 func (c *Rcvr) LatestDustMonitorData(ctx context.Context, req *v1.LatestDustMonitorDataRequest) (reply *v1.LatestDustMonitorDataReply, err error) { t1 := func() error { reply, err = dust.LatestDustMonitorData(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 历史扬尘数据 func (c *Rcvr) DustMonitorHistory(ctx context.Context, req *v1.DustMonitorHistoryRequest) (reply *v1.DustMonitorHistoryReply, err error) { t1 := func() error { reply, err = dust.DustMonitorHistory(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 扬尘设备列表 func (c *Rcvr) DustList(ctx context.Context, req *v1.DustListRequest) (reply *v1.DustListReply, err error) { t1 := func() error { reply, err = dust.DustList(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 扬尘列表 func (c *Rcvr) DustAqi(ctx context.Context, req *v1.DustAqiRequest) (reply *v1.DustAqiReply, err error) { t1 := func() error { reply, err = dust.DustAqi(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 告警列表 func (c *Rcvr) AlarmList(ctx context.Context, req *v1.AlarmListRequest) (reply *v1.AlarmListReply, err error) { t1 := func() error { reply, err = alarm.AlarmList(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 摄像头(通道列表) func (c *Rcvr) CameraList(ctx context.Context, req *v1.CameraListRequest) (reply *v1.CameraListReply, err error) { t1 := func() error { reply, err = camera.CameraList(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 设备绑定摄像头 func (c *Rcvr) DeviceBindCamera(ctx context.Context, req *v1.DeviceBindCameraRequest) (reply *v1.DeviceBindCameraReply, err error) { t1 := func() error { reply, err = camera.DeviceBindCamera(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 设备入库审批 func (c *Rcvr) DeviceApprove(ctx context.Context, req *v1.DeviceApproveRequest) (reply *v1.DeviceApproveReply, err error) { t1 := func() error { reply, err = project.DeviceApprove(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 设备解绑摄像头 func (c *Rcvr) DeviceUnbindCamera(ctx context.Context, req *v1.DeviceUnbindCameraRequest) (reply *v1.DeviceUnbindCameraReply, err error) { t1 := func() error { reply, err = camera.DeviceUnbindCamera(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 视屏设备下的通道列表 func (c *Rcvr) ChannelList(ctx context.Context, req *v1.ChannelListRequest) (reply *v1.ChannelListReply, err error) { t1 := func() error { reply, err = camera.ChannelList(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 项目(工程)信息 func (c *Rcvr) ProjectInfo(ctx context.Context, req *v1.ProjectInfoRequest) (reply *v1.ProjectInfoReply, err error) { t1 := func() error { reply, err = project.ProjectInfo(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 项目设备统计 func (c *Rcvr) ProjectDeviceStatistics(ctx context.Context, req *v1.ProjectDeviceStatisticsRequest) (reply *v1.ProjectDeviceStatisticsReply, err error) { t1 := func() error { reply, err = project.ProjectDeviceStatistics(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 获取项目进度 func (c *Rcvr) ProjectProgress(ctx context.Context, req *v1.ProjectProgressRequest) (reply *v1.ProjectProgressReply, err error) { t1 := func() error { reply, err = project.ProjectProgress(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 添加项目进度 func (c *Rcvr) ProjectProgressAdd(ctx context.Context, req *v1.ProjectProgressAddRequest) (reply *v1.ProjectProgressAddReply, err error) { t1 := func() error { reply, err = project.ProjectProgressAdd(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 进度完成设置 func (c *Rcvr) ProjectProgressSet(ctx context.Context, req *v1.ProjectProgressSetRequest) (reply *v1.ProjectProgressSetReply, err error) { t1 := func() error { reply, err = project.ProjectProgressSet(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 删除项目进度 func (c *Rcvr) ProjectProgressDel(ctx context.Context, req *v1.ProjectProgressDelRequest) (reply *v1.ProjectProgressDelReply, err error) { t1 := func() error { reply, err = project.ProjectProgressDel(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 添加告警规则 func (c *Rcvr) AlarmRuleAdd(ctx context.Context, req *v1.AlarmRuleAddRequest) (reply *v1.AlarmRuleAddReply, err error) { t1 := func() error { reply, err = alarm.AlarmRuleAdd(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 删除告警规则 func (c *Rcvr) AlarmRuleDelete(ctx context.Context, req *v1.AlarmRuleDeleteRequest) (reply *v1.AlarmRuleDeleteReply, err error) { t1 := func() error { reply, err = alarm.AlarmRuleDelete(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 告警规则列表 func (c *Rcvr) AlarmRuleList(ctx context.Context, req *v1.AlarmRuleListRequest) (reply *v1.AlarmRuleListReply, err error) { t1 := func() error { reply, err = alarm.AlarmRuleList(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 更新告警规则 func (c *Rcvr) AlarmRuleUpdate(ctx context.Context, req *v1.AlarmRuleUpdateRequest) (reply *v1.AlarmRuleUpdateReply, err error) { t1 := func() error { reply, err = alarm.AlarmRuleUpdate(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 告警规则启停用 func (c *Rcvr) AlarmRuleOnOff(ctx context.Context, req *v1.AlarmRuleOnOffRequest) (reply *v1.AlarmRuleOnOffReply, err error) { t1 := func() error { reply, err = alarm.AlarmRuleOnOff(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 添加告警联系人 func (c *Rcvr) AlarmContactAdd(ctx context.Context, req *v1.AlarmContactAddRequest) (reply *v1.AlarmContactAddReply, err error) { t1 := func() error { reply, err = alarm.AlarmContactAdd(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 删除告警联系人 func (c *Rcvr) AlarmContactDelete(ctx context.Context, req *v1.AlarmContactDeleteRequest) (reply *v1.AlarmContactDeleteReply, err error) { t1 := func() error { reply, err = alarm.AlarmContactDelete(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 编辑告警联系人 func (c *Rcvr) AlarmContactUpdate(ctx context.Context, req *v1.AlarmContactUpdateRequest) (reply *v1.AlarmContactUpdateReply, err error) { t1 := func() error { reply, err = alarm.AlarmContactUpdate(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 告警联系人列表 func (c *Rcvr) AlarmContactList(ctx context.Context, req *v1.AlarmContactListRequest) (reply *v1.AlarmContactListReply, err error) { t1 := func() error { reply, err = alarm.AlarmContactList(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 最近一次塔吊数据 func (c *Rcvr) LatestTowerMonitorData(ctx context.Context, req *v1.LatestTowerMonitorDataRequest) (reply *v1.LatestTowerMonitorDataReply, err error) { t1 := func() error { reply, err = tower.LatestTowerMonitorData(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // 历史塔吊数据 func (c *Rcvr) TowerMonitorHistory(ctx context.Context, req *v1.TowerMonitorHistoryRequest) (reply *v1.TowerMonitorHistoryReply, err error) { t1 := func() error { reply, err = tower.TowerMonitorHistory(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // iot设备列表 func (c *Rcvr) IotList(ctx context.Context, req *v1.IotListRequest) (reply *v1.IotListReply, err error) { t1 := func() error { reply, err = tower.IotList(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } func (c *Rcvr) IotLast(ctx context.Context, req *v1.IotLastRequest) (reply *v1.IotLastReply, err error) { t1 := func() error { reply, err = tower.IotLast(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) } // iot设备类型列表 func (c *Rcvr) IotTypeList(ctx context.Context, req *v1.IotTypeListRequest) (reply *v1.IotTypeListReply, err error) { t1 := func() error { reply, err = tower.IotTypeList(ctx, req) return err } return reply, rpctasker.Exec(ctx, t1) }