Эх сурвалжийг харах

Merge branch 'pool_660' into debug

ziwen 1 жил өмнө
parent
commit
f55f383dce

+ 33 - 4
controller/contract/pre_register.go

@@ -99,6 +99,24 @@ func (rg *PreRegisterController) List(c *gin.Context) {
 		item := new(fms.ContractPreRegisterList)
 		item.ContractPreRegisterItem = v
 		item.ServicesName = serviceMap[v.ContractRegisterId]
+		if v.HasPayment == 1 {
+			//代付
+			if v.ContractType == 1 {
+				item.ContractTypeString = "代付合同(新签)"
+			} else if v.ContractType == 2 {
+				item.ContractTypeString = "代付合同(续约)"
+			} else {
+				item.ContractTypeString = "代付合同(补充)"
+			}
+		} else {
+			if v.ContractType == 1 {
+				item.ContractTypeString = "自付合同(新签)"
+			} else if v.ContractType == 2 {
+				item.ContractTypeString = "自付合同(续约)"
+			} else {
+				item.ContractTypeString = "自付合同(补充)"
+			}
+		}
 		respList = append(respList, item)
 	}
 
@@ -190,7 +208,8 @@ func (rg *PreRegisterController) Add(c *gin.Context) {
 	ob.HasInvoice = 1
 	ob.Set()
 	ob.CurrencyUnit = currencyUnit
-	ob.ContractType = 2
+	ob.ContractType = req.ContractType
+	ob.HasPayment = req.HasPayment
 	if req.RegisterType == fms.ContractInvoiceTypePreMake {
 		//sellerItem := sellerMap[r.SellerId]
 		//if sellerItem == nil {
@@ -309,6 +328,8 @@ func (rg *PreRegisterController) Add(c *gin.Context) {
 		}
 		pp.Set()
 		pp.CurrencyUnit = r.CurrencyUnit
+		pp.ContractType = req.ContractType
+		pp.HasPayment = req.HasPayment
 		if pp.InvoiceType == fms.ContractInvoiceTypePreMake {
 			//开票走开票字段
 			pp.InvoiceId = v.ContractInvoiceId
@@ -461,6 +482,8 @@ func (rg *PreRegisterController) Edit(c *gin.Context) {
 	ob.EndDate = endDate
 	ob.ModifyTime = time.Now().Local()
 	ob.CurrencyUnit = currencyUnit
+	ob.ContractType = req.ContractType
+	ob.HasPayment = req.HasPayment
 	if req.RegisterType == fms.ContractInvoiceTypePreMake {
 		//sellerItem := sellerMap[r.SellerId]
 		//if sellerItem == nil {
@@ -487,7 +510,7 @@ func (rg *PreRegisterController) Edit(c *gin.Context) {
 	}
 	updateCols := []string{
 		"ProductIds", "CompanyName", "SellerId", "SellerName", "StartDate", "EndDate",
-		"RaiSellerId", "RaiSellerName", "ModifyTime", "CurrencyUnit",
+		"RaiSellerId", "RaiSellerName", "ModifyTime", "CurrencyUnit","ContractType","HasPayment",
 	}
 
 	invoiceList := make([]*fms.ContractInvoice, 0)
@@ -568,6 +591,8 @@ func (rg *PreRegisterController) Edit(c *gin.Context) {
 		}
 		pp.Set()
 		pp.CurrencyUnit = r.CurrencyUnit
+		pp.ContractType = req.ContractType
+		pp.HasPayment = req.HasPayment
 		ppUpdateCols := make([]string, 0)
 		if pp.InvoiceType == fms.ContractInvoiceTypePreMake {
 			//开票走开票字段
@@ -599,7 +624,7 @@ func (rg *PreRegisterController) Edit(c *gin.Context) {
 			pp.PaymentSellerTeamName = sellerItem.TeamName
 			ppUpdateCols = append(ppUpdateCols, "InvoiceDate", "Amount", "OriginAmount", "SellerId",
 				"SellerName", "SellerGroupId", "SellerGroupName", "SellerTeamId", "SellerTeamName", "InvoiceId",
-				"PaymentSellerId", "PaymentSellerName", "PaymentSellerGroupId", "PaymentSellerGroupName", "PaymentSellerTeamId", "PaymentSellerTeamName")
+				"PaymentSellerId", "PaymentSellerName", "PaymentSellerGroupId", "PaymentSellerGroupName", "PaymentSellerTeamId", "PaymentSellerTeamName","ContractType","HasPayment")
 		} else {
 			//到款
 			pp.ArriveRemark = r.Remark
@@ -622,7 +647,7 @@ func (rg *PreRegisterController) Edit(c *gin.Context) {
 			pp.PaymentSellerTeamId = sellerItem.TeamId
 			pp.PaymentSellerTeamName = sellerItem.TeamName
 			ppUpdateCols = append(ppUpdateCols, "CurrencyUnit", "ArriveDate", "ArriveAmount", "ArriveOriginAmount", "ArriveId",
-				"PaymentSellerId", "PaymentSellerName", "PaymentSellerGroupId", "PaymentSellerGroupName", "PaymentSellerTeamId", "PaymentSellerTeamName")
+				"PaymentSellerId", "PaymentSellerName", "PaymentSellerGroupId", "PaymentSellerGroupName", "PaymentSellerTeamId", "PaymentSellerTeamName","ContractType","HasPayment")
 		}
 
 		if pp.PreRegisterId == 0 {
@@ -1007,6 +1032,8 @@ func (rg *PreRegisterController) Save(c *gin.Context) {
 	ob.EndDate = endDate
 	ob.ModifyTime = time.Now()
 	ob.CurrencyUnit = req.List[0].CurrencyUnit
+	ob.ContractType = req.ContractType
+	ob.HasPayment = req.HasPayment
 	if req.RegisterType == fms.ContractInvoiceTypePreMake {
 		//sellerItem := sellerMap[r.SellerId]
 		//if sellerItem == nil {
@@ -1128,6 +1155,8 @@ func (rg *PreRegisterController) Save(c *gin.Context) {
 		}
 		pp.Set()
 		pp.CurrencyUnit = r.CurrencyUnit
+		pp.ContractType = req.ContractType
+		pp.HasPayment = req.HasPayment
 		if pp.InvoiceType == fms.ContractInvoiceTypePreMake {
 			//开票走开票字段
 			pp.Remark = r.Remark

+ 6 - 0
models/fms/contract_pre_payment.go

@@ -114,6 +114,8 @@ type PreRegisterAddReq struct {
 	RegisterType int                     `json:"register_type" description:"预登记类型 3-开票预登记 4-到款预登记"`
 	ProductIds   string                  `gorm:"column:product_ids" json:"product_ids" description:"产品ID:1-FICC; 2-权益, 如果两者都有,则用英文逗号拼接"`
 	SellerIds    string                  `json:"seller_ids" description:"CRM系统-销售ID"`
+	ContractType int                     `json:"contract_type" binding:"oneof=1 2 3 4" description:"合同类型: 1-新签; 2-续约; 3-代付; 4-补充协议"`
+	HasPayment   int                     `json:"has_payment" description:"是否有代付: 0-无; 1-有"`
 	List         []PreRegisterAddReqItem `json:"list" binding:"required" description:"预登记列表"`
 	Services     []ContractServiceAddReq `json:"services" description:"服务套餐内容"`
 }
@@ -161,6 +163,8 @@ type PreRegisterEditReq struct {
 	SellerIds          string `json:"seller_ids" description:"CRM系统-销售ID"`
 	DelInvoiceIds      []int  `json:"del_invoice_ids" description:"删除的开票到款记录ids"`
 	DelPreRegisterIds  []int  `json:"del_pre_register_ids" description:"删除的预登记记录ids"`
+	ContractType       int    `json:"contract_type" binding:"oneof=1 2 3 4" description:"合同类型: 1-新签; 2-续约; 3-代付; 4-补充协议"`
+	HasPayment         int    `json:"has_payment" description:"是否有代付: 0-无; 1-有"`
 	List               []*PreRegisterEditReqItem
 	Services           []ContractServiceAddReq `json:"services" description:"服务套餐内容"`
 }
@@ -208,6 +212,8 @@ type PreRegisterSaveReq struct {
 	RegisterType       int                      `json:"register_type" description:"预登记类型 3-开票预登记 4-到款预登记"`
 	ProductIds         string                   `gorm:"column:product_ids" json:"product_ids" description:"产品ID:1-FICC; 2-权益, 如果两者都有,则用英文逗号拼接"`
 	SellerIds          string                   `json:"seller_ids" description:"CRM系统-销售ID"`
+	ContractType       int                      `json:"contract_type" binding:"oneof=1 2 3 4" description:"合同类型: 1-新签; 2-续约; 3-代付; 4-补充协议"`
+	HasPayment         int                      `json:"has_payment" description:"是否有代付: 0-无; 1-有"`
 	List               []PreRegisterSaveReqItem `json:"list" binding:"required" description:"预登记列表"`
 	Services           []ContractServiceAddReq  `json:"services" description:"服务套餐内容"`
 }

+ 8 - 1
models/fms/contract_pre_register.go

@@ -36,6 +36,8 @@ type ContractPreRegister struct {
 	IsPrePay               int       `gorm:"column:is_pre_pay" json:"is_pre_pay" description:"是否预付款: 0-不是; 1-是"`
 	StartDate              time.Time `gorm:"column:start_date" json:"start_date" description:"约定开始时间"`
 	EndDate                time.Time `gorm:"column:end_date" json:"end_date" description:"约定结束时间"`
+	ContractType           int       `gorm:"column:contract_type" json:"contract_type" description:"合同类型: 1-新签; 2-续约; 3-代付; 4-补充协议"`
+	HasPayment             int       `gorm:"column:has_payment" json:"has_payment" description:"是否有代付: 0-无; 1-有"`
 	PaymentSellerId        int       `gorm:"column:payment_seller_id;default:0;NOT NULL" json:"payment_seller_id"`             // 销售ID
 	PaymentSellerName      string    `gorm:"column:payment_seller_name;NOT NULL" json:"payment_seller_name"`                   // 销售名称
 	PaymentSellerGroupId   int       `gorm:"column:payment_seller_group_id;default:0;NOT NULL" json:"payment_seller_group_id"` // 销售分组ID
@@ -76,6 +78,8 @@ type ContractPreRegisterItem struct {
 	EndDate                string  `gorm:"column:end_date" json:"end_date" description:"约定结束时间"`
 	AdminId                int     `gorm:"column:admin_id" json:"admin_id" description:"操作人ID"`
 	CreateTime             string  `gorm:"column:create_time" json:"create_time" description:"创建时间"`
+	ContractType           int     `json:"contract_type" binding:"oneof=1 2 3 4" description:"合同类型: 1-新签; 2-续约; 3-代付; 4-补充协议"`
+	HasPayment             int     `json:"has_payment" description:"是否有代付: 0-无; 1-有"`
 	PaymentSellerId        int     `gorm:"column:payment_seller_id;default:0;NOT NULL" json:"payment_seller_id"`             // 销售ID
 	PaymentSellerName      string  `gorm:"column:payment_seller_name;NOT NULL" json:"payment_seller_name"`                   // 销售名称
 	PaymentSellerGroupId   int     `gorm:"column:payment_seller_group_id;default:0;NOT NULL" json:"payment_seller_group_id"` // 销售分组ID
@@ -116,6 +120,8 @@ func formatContractPreRegister2Item(item *ContractPreRegister) (formatItem *Cont
 	formatItem.PaymentSellerGroupName = item.PaymentSellerGroupName
 	formatItem.PaymentSellerTeamId = item.PaymentSellerTeamId
 	formatItem.PaymentSellerTeamName = item.PaymentSellerTeamName
+	formatItem.ContractType = item.ContractType
+	formatItem.HasPayment = item.HasPayment
 	return
 }
 
@@ -209,7 +215,8 @@ func formatContractPreRegister2ItemList(list []*ContractPreRegister) (itemList [
 // ContractPreRegisterList 预登记列表
 type ContractPreRegisterList struct {
 	*ContractPreRegisterItem
-	ServicesName string `json:"services" description:"套餐名称"`
+	ServicesName       string `json:"services" description:"套餐名称"`
+	ContractTypeString string `json:"contract_type_string" description:"合同类型"`
 }
 
 // PreRegisterDetailReq 预登记详情请求体