From 9a7e0a7da01a9f9625ceaca0c61a59c540c6438f Mon Sep 17 00:00:00 2001 From: wangpengfei <274878379@qq.com> Date: 星期五, 18 八月 2023 17:32:10 +0800 Subject: [PATCH] fix --- api/v1/serviceCollectionPlan.go | 32 ++++++++++++++++++++++++-------- 1 files changed, 24 insertions(+), 8 deletions(-) diff --git a/api/v1/serviceCollectionPlan.go b/api/v1/serviceCollectionPlan.go index 7476dd7..46525a4 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,8 +102,8 @@ } // List -// @Tags 鏈嶅姟鍚堝悓鏀舵璁″垝绠$悊 -// @Summary 鑾峰彇鏈嶅姟鍚堝悓鏀舵璁″垝鍒楄〃 +// @Tags 鏀舵璁″垝绠$悊 +// @Summary 鑾峰彇鏀舵璁″垝鍒楄〃 // @Produce application/json // @Param object query request.GetServiceCollectionPlanList true "鍙傛暟" // @Success 200 {object} response.ListResponse{data=[]model.ServiceCollectionPlan} -- Gitblit v1.8.0