From 530fed8ec225453572d57b15c200ab062c335457 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期三, 01 十一月 2023 19:20:21 +0800 Subject: [PATCH] 公海member_id使用0 --- api/v1/serviceCollectionPlan.go | 38 +++++++++++++++++++++++++++----------- 1 files changed, 27 insertions(+), 11 deletions(-) diff --git a/api/v1/serviceCollectionPlan.go b/api/v1/serviceCollectionPlan.go index 7476dd7..3a32ccf 100644 --- a/api/v1/serviceCollectionPlan.go +++ b/api/v1/serviceCollectionPlan.go @@ -1,6 +1,7 @@ package v1 import ( + "aps_crm/constvar" "aps_crm/model/request" "aps_crm/model/response" "aps_crm/pkg/contextx" @@ -13,8 +14,8 @@ type ServiceCollectionPlanApi struct{} // Add -// @Tags 鏈嶅姟鍚堝悓鏀舵璁″垝绠$悊 -// @Summary 娣诲姞鏈嶅姟鍚堝悓鏀舵璁″垝 +// @Tags 鏀舵璁″垝绠$悊 +// @Summary 娣诲姞鏀舵璁″垝 // @Produce application/json // @Param object body request.AddServiceCollectionPlan true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} @@ -24,6 +25,21 @@ ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return + } + + for _, plan := range params.List { + if plan.SourceType == 0 || + plan.SourceId == 0 || + plan.CollectionType == 0 || + plan.CollectionDate == "" || + plan.Amount.IsZero() || + plan.Percent.IsZero() || + plan.PrincipalId == 0 { + ctx.Fail(ecode.ParamsErr) + return + } + plan.AmountTotal = plan.AmountReceivable + plan.Status = constvar.CollectionStatusUnCollected } errCode := service.NewServiceCollectionPlanService().AddServiceCollectionPlan(params.List) @@ -36,8 +52,8 @@ } // Delete -// @Tags 鏈嶅姟鍚堝悓鏀舵璁″垝绠$悊 -// @Summary 鍒犻櫎鏈嶅姟鍚堝悓鏀舵璁″垝 +// @Tags 鏀舵璁″垝绠$悊 +// @Summary 鍒犻櫎鏀舵璁″垝 // @Produce application/json // @Param id path int true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} @@ -59,8 +75,8 @@ } // Update -// @Tags 鏈嶅姟鍚堝悓鏀舵璁″垝绠$悊 -// @Summary 鏇存柊鏈嶅姟鍚堝悓鏀舵璁″垝 +// @Tags 鏀舵璁″垝绠$悊 +// @Summary 鏇存柊鏀舵璁″垝 // @Produce application/json // @Param object body request.UpdateServiceCollectionPlan true "鏌ヨ鍙傛暟" // @Success 200 {object} contextx.Response{} @@ -86,12 +102,12 @@ } // List -// @Tags 鏈嶅姟鍚堝悓鏀舵璁″垝绠$悊 -// @Summary 鑾峰彇鏈嶅姟鍚堝悓鏀舵璁″垝鍒楄〃 +// @Tags 鏀舵璁″垝绠$悊 +// @Summary 鑾峰彇鏀舵璁″垝鍒楄〃 // @Produce application/json -// @Param object query request.GetServiceCollectionPlanList true "鍙傛暟" +// @Param object body request.GetServiceCollectionPlanList true "鍙傛暟" // @Success 200 {object} response.ListResponse{data=[]model.ServiceCollectionPlan} -// @Router /api/serviceCollectionPlan/list [get] +// @Router /api/serviceCollectionPlan/list [post] func (s *ServiceCollectionPlanApi) List(c *gin.Context) { var params request.GetServiceCollectionPlanList ctx, ok := contextx.NewContext(c, ¶ms) @@ -99,7 +115,7 @@ return } - serviceCollectionPlan, total, errCode := service.NewServiceCollectionPlanService().GetServiceCollectionPlanList(params.ServiceContractId) + serviceCollectionPlan, total, errCode := service.NewServiceCollectionPlanService().GetServiceCollectionPlanList(params.SourceType, params.SourceId) if errCode != ecode.OK { ctx.Fail(errCode) return -- Gitblit v1.8.0