From 8bf1cad94113d5c604e95e370cf068efdea87d27 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期三, 30 八月 2023 09:43:49 +0800
Subject: [PATCH] fix
---
api/v1/serviceCollectionPlan.go | 34 +++++++++++++++++++++++++---------
1 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/api/v1/serviceCollectionPlan.go b/api/v1/serviceCollectionPlan.go
index 7476dd7..134a633 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}
@@ -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