123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570 |
- // 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)
- }
|