ctr_contract_application.go 910 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package contract
  2. import (
  3. "context"
  4. "dashoo.cn/common_definition/comm_def"
  5. "dashoo.cn/opms_libary/myerrors"
  6. service "dashoo.cn/opms_parent/app/service/contract"
  7. model "dashoo.cn/opms_parent/app/model/contract"
  8. "github.com/gogf/gf/frame/g"
  9. )
  10. type CtrContractApplication struct{}
  11. func (c *CtrContractApplication) CreateFromBusiness(ctx context.Context, req *model.CreateFromBusinessReq, rsp *comm_def.CommonMsg) error {
  12. g.Log().Infof("CtrContractApplication.CreateFromBusiness request %#v ", *req)
  13. if req.NboId <= 0 {
  14. return myerrors.ValidError("项目ID不能为空")
  15. }
  16. if req.NboName == "" {
  17. return myerrors.ValidError("项目名称不能为空")
  18. }
  19. s, err := service.NewCtrContractApplicationService(ctx)
  20. if err != nil {
  21. return err
  22. }
  23. id, err := s.CreateFromBusiness(req)
  24. if err != nil {
  25. return err
  26. }
  27. rsp.Msg = "合同申请已提交"
  28. rsp.Data = g.Map{"id": id}
  29. return nil
  30. }