ziwen 2 lat temu
rodzic
commit
8f50fc51f5

+ 16 - 7
controller/contract/pre_payment.go

@@ -140,10 +140,14 @@ func (rg *PrePaymentController) Add(c *gin.Context) {
 		return
 	}
 
+	payDate,err := time.Parse(utils.FormatDate,req.PaymentDate)
+	if e != nil {
+		resp.FailMsg("日期转换失败", "日期转换失败, Err: "+e.Error(), c)
+		return
+	}
+
 	ob := new(fms.ContractPrePayment)
 	ob.CompanyName = req.CompanyName
-	ob.SellerId = req.SellerId
-	ob.SellerName = req.SellerName
 	ob.CurrencyUnit = req.CurrencyUnit
 	ob.StartDate = startDate
 	ob.EndDate = endDate
@@ -153,7 +157,7 @@ func (rg *PrePaymentController) Add(c *gin.Context) {
 	ob.OriginAmount = req.Amount
 	ob.CurrencyUnit = req.CurrencyUnit
 	ob.Remark = req.Remark
-	ob.NewCompany = req.NewCompany
+	ob.PaymentDate = payDate
 	ob.Set()
 
 
@@ -238,9 +242,14 @@ func (rg *PrePaymentController) Edit(c *gin.Context) {
 		resp.FailMsg("操作失败", "获取预到款登记信息失败, Err:"+e.Error(), c)
 		return
 	}
+
+	payDate,err := time.Parse(utils.FormatDate,req.PaymentDate)
+	if e != nil {
+		resp.FailMsg("日期转换失败", "日期转换失败, Err: "+e.Error(), c)
+		return
+	}
+
 	item.CompanyName = req.CompanyName
-	item.SellerId = req.SellerId
-	item.SellerName = req.SellerName
 	item.CurrencyUnit = req.CurrencyUnit
 	item.StartDate = startDate
 	item.EndDate = endDate
@@ -250,12 +259,12 @@ func (rg *PrePaymentController) Edit(c *gin.Context) {
 	item.OriginAmount = req.Amount
 	item.CurrencyUnit = req.CurrencyUnit
 	item.Remark = req.Remark
-	item.NewCompany = req.NewCompany
+	item.PaymentDate  = payDate
 	item.ModifyTime = time.Now().Local()
 
 	updateCols := []string{
 		"ContractCode", "CompanyName", "SellerId", "SellerName", "Amount", "StartDate", "EndDate",
-		"Remark", "ModifyTime","NewCompany", "OriginAmount", "CurrencyUnit",
+		"Remark", "ModifyTime","NewCompany", "OriginAmount", "CurrencyUnit", "PaymentDate",
 	}
 	if e = item.Update(updateCols); e != nil {
 		resp.FailMsg("操作失败", "更新到预款登记失败, Err:"+e.Error(), c)

+ 1 - 1
controller/contract/register.go

@@ -317,7 +317,7 @@ func (rg *RegisterController) Add(c *gin.Context) {
 			OriginAmount:       ppItem.OriginAmount,
 			CurrencyUnit:       ppItem.CurrencyUnit,
 			InvoiceType:        fms.ContractInvoiceTypePay,
-			InvoiceDate:        ppItem.CreateTime,
+			InvoiceDate:        ppItem.PaymentDate,
 			AdminId:            int(adminInfo.AdminId),
 			AdminName:          adminInfo.RealName,
 			Remark:             ppItem.Remark,

+ 4 - 3
models/fms/contract_pre_payment.go

@@ -24,6 +24,7 @@ type ContractPrePayment struct {
 	StartDate          time.Time `gorm:"column:start_date" json:"start_date" description:"约定开始时间"`
 	EndDate            time.Time `gorm:"column:end_date" json:"end_date" description:"约定结束时间"`
 	NewCompany         int       `gorm:"column:new_company" json:"new_company" description:"是否为新客户: 0-否; 1-是"`
+	PaymentDate        time.Time `gorm:"column:payment_date" json:"payment_date" description:"约定结束时间"`
 	base.TimeBase
 }
 
@@ -43,6 +44,7 @@ type ContractPrePaymentRespItem struct {
 	Remark             string  `gorm:"column:remark" json:"remark" description:"备注信息"`
 	StartDate          string  `gorm:"column:start_date" json:"start_date" description:"约定开始时间"`
 	EndDate            string  `gorm:"column:end_date" json:"end_date" description:"约定结束时间"`
+	PaymentDate        string  `gorm:"column:payment_date" json:"payment_date" description:"约定结束时间"`
 	NewCompany         int     `gorm:"column:new_company" json:"new_company" description:"是否为新客户: 0-否; 1-是"`
 	CreateTime         string  `gorm:"autoCreateTime;column:create_time" json:"create_time" description:"创建时间"`
 	ModifyTime         string  `gorm:"autoUpdateTime:milli;column:modify_time" json:"modify_time" description:"最后更新时间"`
@@ -98,6 +100,7 @@ func formatPrePay2Item(item *ContractPrePayment) (formatItem *ContractPrePayment
 	formatItem.AdminName = item.AdminName
 	formatItem.Remark = item.Remark
 	formatItem.NewCompany = item.NewCompany
+	formatItem.PaymentDate = utils.TimeTransferString(utils.FormatDate, item.PaymentDate)
 	formatItem.CreateTime = utils.TimeTransferString(utils.FormatDateTime, item.CreateTime)
 	formatItem.ModifyTime = utils.TimeTransferString(utils.FormatDateTime, item.ModifyTime)
 	return
@@ -106,14 +109,12 @@ func formatPrePay2Item(item *ContractPrePayment) (formatItem *ContractPrePayment
 // PrepayAddReq 新增到款预登记请求体
 type PrepayAddReq struct {
 	CompanyName  string  `json:"company_name" binding:"required" description:"客户名称"`
-	SellerId     int     `json:"seller_id" binding:"required" description:"CRM系统-销售ID"`
-	SellerName   string  `json:"seller_name" binding:"required" description:"CRM系统-销售名称"`
 	Amount       float64 `json:"amount" binding:"required" description:"到款金额"`
 	CurrencyUnit string  `json:"currency_unit" binding:"required" description:"货币单位"`
 	StartDate    string  `json:"start_date" binding:"required" description:"约定开始日期"`
 	EndDate      string  `json:"end_date" binding:"required" description:"约定结束日期"`
 	Remark       string  `json:"remark" description:"备注信息"`
-	NewCompany   int     `json:"new_company" description:"是否为新客户: 0-否; 1-是"`
+	PaymentDate  string  `json:"payment_date" description:"到款日"`
 }
 
 func (c *ContractPrePayment) Create() (err error) {