From 6f52e069fe72b4e37b0712a7e097e3af97bbc25e Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期一, 07 八月 2023 10:22:11 +0800
Subject: [PATCH] 收款计划兼容其他模块

---
 model/serviceCollectionPlan.go |   41 ++++++++++++++++++++++-------------------
 1 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/model/serviceCollectionPlan.go b/model/serviceCollectionPlan.go
index be9da1b..cb15770 100644
--- a/model/serviceCollectionPlan.go
+++ b/model/serviceCollectionPlan.go
@@ -5,27 +5,30 @@
 	"aps_crm/pkg/mysqlx"
 	"errors"
 	"fmt"
+	"github.com/shopspring/decimal"
 	"gorm.io/gorm"
+	"time"
 )
 
 type (
-	// ServiceCollectionPlan 鏈嶅姟鍚堝悓鏀舵璁″垝
+	// ServiceCollectionPlan 鏀舵璁″垝
 	ServiceCollectionPlan struct {
-		Id                int     `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
-		CollectionType    int     `gorm:"collection_type" json:"collectionType"`        // 绫诲瀷锛�1 璁″垝鏀舵鏃ユ湡 2 椤圭洰鐘舵�侊級
-		ServiceContractId int     `gorm:"service_contract_id" json:"serviceContractId"` // 鏈嶅姟鍚堝悓id
-		PrincipalId       int     `gorm:"principal_id" json:"principalId"`              // 鏀舵璐熻矗浜篒D
-		Term              int     `gorm:"term" json:"term"`                             // 鏈熸
-		Percent           float64 `gorm:"percent" json:"percent"`                       // 姣斾緥
-		Amount            float64 `gorm:"amount" json:"amount"`                         // 閲戦
-		MoneyType         string  `gorm:"money_type" json:"moneyType"`                  // 甯佺
-		CollectionDate    string  `gorm:"collection_date" json:"collectionDate"`        // 璁″垝鏀舵鏃ユ湡
-		Remark            string  `gorm:"remark" json:"remark"`                         // 澶囨敞
-		Status            int     `gorm:"status" json:"status"`                         // 鐘舵�侊紙1鏈敹2宸叉敹锛�
-		FileId            int     `gorm:"file_id" json:"fileId"`                        // 闄勪欢id
+		Id             int                       `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
+		CollectionType int                       `gorm:"collection_type" json:"collectionType"` // 绫诲瀷锛�1 璁″垝鏀舵鏃ユ湡 2 椤圭洰鐘舵�侊級
+		SourceType     int                       `gorm:"source_type" json:"sourceType"`         // 婧愬崟绫诲瀷锛�1閿�鍞槑缁�2鏈嶅姟鍚堝悓3閿�鍞彂绁級
+		SourceId       int                       `gorm:"source_id" json:"sourceId"`             // 婧愬崟id
+		PrincipalId    int                       `gorm:"principal_id" json:"principalId"`       // 鏀舵璐熻矗浜篒D
+		Term           int                       `gorm:"term" json:"term"`                      // 鏈熸
+		Percent        decimal.Decimal           `gorm:"percent" json:"percent"`                // 姣斾緥
+		Amount         decimal.Decimal           `gorm:"amount" json:"amount"`                  // 閲戦
+		MoneyType      string                    `gorm:"money_type" json:"moneyType"`           // 甯佺
+		CollectionDate time.Time                 `gorm:"collection_date" json:"collectionDate"` // 璁″垝鏀舵鏃ユ湡
+		Remark         string                    `gorm:"remark" json:"remark"`                  // 澶囨敞
+		Status         constvar.CollectionStatus `gorm:"status" json:"status"`                  // 鐘舵�侊紙1鏈敹2宸叉敹锛�
+		FileId         int                       `gorm:"file_id" json:"fileId"`                 // 闄勪欢id
 	}
 
-	// ServiceCollectionPlanSearch 鏈嶅姟鍚堝悓鏀舵璁″垝鎼滅储鏉′欢
+	// ServiceCollectionPlanSearch 鏀舵璁″垝鎼滅储鏉′欢
 	ServiceCollectionPlanSearch struct {
 		ServiceCollectionPlan
 		Orm         *gorm.DB
@@ -38,7 +41,7 @@
 )
 
 func (ServiceCollectionPlan) TableName() string {
-	return "service_collection_plan"
+	return "collection_plan"
 }
 
 func NewServiceCollectionPlanSearch() *ServiceCollectionPlanSearch {
@@ -53,8 +56,8 @@
 		db = db.Where("id = ?", slf.Id)
 	}
 
-	if slf.ServiceContractId != 0 {
-		db = db.Where("service_contract_id = ?", slf.ServiceContractId)
+	if slf.SourceId != 0 {
+		db = db.Where("source_id = ?", slf.SourceId)
 	}
 
 	return db
@@ -97,8 +100,8 @@
 	return slf
 }
 
-func (slf *ServiceCollectionPlanSearch) SetServiceContractId(id int) *ServiceCollectionPlanSearch {
-	slf.ServiceContractId = id
+func (slf *ServiceCollectionPlanSearch) SetSourceId(id int) *ServiceCollectionPlanSearch {
+	slf.SourceId = id
 	return slf
 }
 

--
Gitblit v1.8.0