| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- package opsdev
- import (
- "context"
- "dashoo.cn/common_definition/comm_def"
- "dashoo.cn/opms_libary/myerrors"
- "dashoo.cn/opms_parent/app/model/opsdev"
- opssrv "dashoo.cn/opms_parent/app/service/opsdev"
- "github.com/gogf/gf/frame/g"
- "github.com/gogf/gf/util/gvalid"
- )
- type ProjectInventoryHandler struct{}
- func (h *ProjectInventoryHandler) GetList(ctx context.Context, req *opsdev.ProjectInventorySearchReq, rsp *comm_def.CommonMsg) error {
- srv, err := opssrv.NewProjectInventoryService(ctx)
- if err != nil {
- return err
- }
- total, list, err := srv.GetList(req)
- if err != nil {
- return err
- }
- rsp.Data = g.Map{"list": list, "total": total}
- return nil
- }
- func (h *ProjectInventoryHandler) GetProjectManagers(ctx context.Context, req *opsdev.ProjectManagerReq, rsp *comm_def.CommonMsg) error {
- srv, err := opssrv.NewProjectInventoryService(ctx)
- if err != nil {
- return err
- }
- records, err := srv.GetProjectManagers(req.RoleType)
- if err != nil {
- return err
- }
- rsp.Data = records
- return nil
- }
- func (h *ProjectInventoryHandler) GetContractProducts(ctx context.Context, req *opsdev.ContractProductReq, rsp *comm_def.CommonMsg) error {
- if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
- return myerrors.ValidError(err.Error())
- }
- srv, err := opssrv.NewProjectInventoryService(ctx)
- if err != nil {
- return err
- }
- records, err := srv.GetContractProducts(req.ContractId)
- if err != nil {
- return err
- }
- rsp.Data = records
- return nil
- }
- func (h *ProjectInventoryHandler) GetProductLines(ctx context.Context, req *struct{}, rsp *comm_def.CommonMsg) error {
- srv, err := opssrv.NewProjectInventoryService(ctx)
- if err != nil {
- return err
- }
- rsp.Data = srv.GetProductLines()
- return nil
- }
- func (h *ProjectInventoryHandler) GetProjectStatusList(ctx context.Context, req *struct{}, rsp *comm_def.CommonMsg) error {
- srv, err := opssrv.NewProjectInventoryService(ctx)
- if err != nil {
- return err
- }
- rsp.Data = srv.GetProjectStatusList()
- return nil
- }
- func (h *ProjectInventoryHandler) GetDeliveryNodes(ctx context.Context, req *struct{}, rsp *comm_def.CommonMsg) error {
- srv, err := opssrv.NewProjectInventoryService(ctx)
- if err != nil {
- return err
- }
- rsp.Data = srv.GetDeliveryNodes()
- return nil
- }
- func (h *ProjectInventoryHandler) Export(ctx context.Context, req *opsdev.ProjectInventoryExportReq, rsp *comm_def.CommonMsg) error {
- srv, err := opssrv.NewProjectInventoryService(ctx)
- if err != nil {
- return err
- }
- content, err := srv.Export(ctx, req)
- if err != nil {
- return err
- }
- rsp.Data = content
- return nil
- }
|