ctr_contract_collection_plan.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. package contract
  2. import (
  3. "context"
  4. model "dashoo.cn/micro/app/model/contract"
  5. service "dashoo.cn/micro/app/service/contract"
  6. "dashoo.cn/common_definition/comm_def"
  7. "github.com/gogf/gf/frame/g"
  8. )
  9. type CtrContractCollectionPlan struct{}
  10. // Swagger:CtrContractCollectionPlan 合同回款计划 合同回款计划详情
  11. func (c *CtrContractCollectionPlan) Get(ctx context.Context, req *model.IdRequiredReq, rsp *comm_def.CommonMsg) error {
  12. g.Log().Infof("CtrContractCollectionPlan.Get request %#v ", *req)
  13. s, err := service.NewCtrContractCollectionPlanService(ctx)
  14. if err != nil {
  15. return err
  16. }
  17. ent, err := s.Get(ctx, req.Id)
  18. // _, err, code, msg := myerrors.CheckError(err)
  19. if err != nil {
  20. return err
  21. }
  22. //rsp.Code = code
  23. //rsp.Msg = msg
  24. rsp.Data = ent
  25. return nil
  26. }
  27. // Swagger:CtrContractCollectionPlan 合同回款计划 查询合同回款计划
  28. func (c *CtrContractCollectionPlan) List(ctx context.Context, req *model.CtrContractCollectionPlanListReq, rsp *comm_def.CommonMsg) error {
  29. g.Log().Infof("CtrContractCollectionPlan.List request %#v ", *req)
  30. s, err := service.NewCtrContractCollectionPlanService(ctx)
  31. if err != nil {
  32. return err
  33. }
  34. total, ent, err := s.List(ctx, req)
  35. //_, err, code, msg := myerrors.CheckError(err)
  36. if err != nil {
  37. return err
  38. }
  39. if ent == nil {
  40. ent = []*model.CtrContractCollectionPlanListRsp{}
  41. }
  42. //rsp.Code = code
  43. //rsp.Msg = msg
  44. rsp.Data = map[string]interface{}{
  45. "total": total,
  46. "list": ent,
  47. }
  48. return nil
  49. }
  50. // Swagger:CtrContractCollectionPlan 合同回款计划 添加合同回款计划
  51. func (c *CtrContractCollectionPlan) Add(ctx context.Context, req *model.CtrContractCollectionPlanAddReq, rsp *comm_def.CommonMsg) error {
  52. g.Log().Infof("CtrContractCollectionPlan.Add request %#v ", *req)
  53. s, err := service.NewCtrContractCollectionPlanService(ctx)
  54. if err != nil {
  55. return err
  56. }
  57. id, err := s.Add(ctx, req)
  58. //_, err, code, msg := myerrors.CheckError(err)
  59. if err != nil {
  60. return err
  61. }
  62. //rsp.Code = code
  63. //rsp.Msg = msg
  64. rsp.Data = id
  65. return nil
  66. }
  67. // Swagger:CtrContractCollectionPlan 合同回款计划 更新合同回款计划
  68. func (c *CtrContractCollectionPlan) Update(ctx context.Context, req *model.CtrContractCollectionPlanUpdateReq, rsp *comm_def.CommonMsg) error {
  69. g.Log().Infof("CtrContractCollectionPlan.Update request %#v ", *req)
  70. s, err := service.NewCtrContractCollectionPlanService(ctx)
  71. if err != nil {
  72. return err
  73. }
  74. err = s.Update(ctx, req)
  75. //_, err, code, msg := myerrors.CheckError(err)
  76. if err != nil {
  77. return err
  78. }
  79. //rsp.Code = code
  80. //rsp.Msg = msg
  81. return nil
  82. }
  83. // Swagger:CtrContractCollectionPlan 合同回款计划 删除合同回款计划
  84. func (c *CtrContractCollectionPlan) Delete(ctx context.Context, req *model.IdsReq, rsp *comm_def.CommonMsg) error {
  85. g.Log().Infof("CtrContractCollectionPlan.Delete request %#v ", *req)
  86. s, err := service.NewCtrContractCollectionPlanService(ctx)
  87. if err != nil {
  88. return err
  89. }
  90. err = s.Delete(ctx, req.Id)
  91. //_, err, code, msg := myerrors.CheckError(err)
  92. if err != nil {
  93. return err
  94. }
  95. //rsp.Code = code
  96. //rsp.Msg = msg
  97. return nil
  98. }