|
@@ -616,8 +616,8 @@ func UpdateContractPreRegister(item *ContractRegister, updateCols []string, serv
|
|
|
}
|
|
|
|
|
|
for i := range invoiceList {
|
|
|
- fmt.Println("invoiceList[i].SellerName",invoiceList[i].SellerName)
|
|
|
- fmt.Println("invoiceList[i].SellerId",invoiceList[i].SellerId)
|
|
|
+ fmt.Println("invoiceList[i].SellerName", invoiceList[i].SellerName)
|
|
|
+ fmt.Println("invoiceList[i].SellerId", invoiceList[i].SellerId)
|
|
|
if invoiceList[i].ContractInvoiceId == 0 {
|
|
|
if e := invoiceList[i].Create(); e != nil {
|
|
|
err = e
|
|
@@ -663,9 +663,9 @@ func UpdateContractPreRegister(item *ContractRegister, updateCols []string, serv
|
|
|
SellerTeamId: sellerItem.TeamId,
|
|
|
SellerTeamName: sellerItem.TeamName,
|
|
|
}
|
|
|
- if registerType == 3{
|
|
|
- tx.Model(&invoiceItem).Select([]string{"StartDate", "EndDate", "CurrencyUnit","SellerId",
|
|
|
- "SellerName","SellerGroupId","SellerGroupName","SellerTeamId","SellerTeamName"}).Where("contract_register_id = ? AND invoice_type = 4", item.ContractRegisterId).Updates(invoiceItem)
|
|
|
+ if registerType == 3 {
|
|
|
+ tx.Model(&invoiceItem).Select([]string{"StartDate", "EndDate", "CurrencyUnit", "SellerId",
|
|
|
+ "SellerName", "SellerGroupId", "SellerGroupName", "SellerTeamId", "SellerTeamName"}).Where("contract_register_id = ? AND invoice_type = 4", item.ContractRegisterId).Updates(invoiceItem)
|
|
|
} else {
|
|
|
tx.Model(&invoiceItem).Select([]string{"StartDate", "EndDate", "CurrencyUnit"}).Where("contract_register_id", item.ContractRegisterId).Updates(invoiceItem)
|
|
|
}
|
|
@@ -789,14 +789,12 @@ func UpdateContractRegisterPre(item *ContractRegister, updateCols []string, serv
|
|
|
otherInvoiceItem.SellerTeamId = invoiceList[0].SellerTeamId
|
|
|
otherInvoiceItem.SellerTeamName = invoiceList[0].SellerTeamName
|
|
|
}
|
|
|
- tx.Model(&otherInvoiceItem).Select([]string{"ServiceProductId","SellerId", "SellerName", "SellerGroupId","SellerGroupName","SellerTeamId","SellerTeamName"}).Updates(otherInvoiceItem)
|
|
|
+ tx.Model(&otherInvoiceItem).Select([]string{"ServiceProductId", "SellerId", "SellerName", "SellerGroupId", "SellerGroupName", "SellerTeamId", "SellerTeamName"}).Updates(otherInvoiceItem)
|
|
|
} else {
|
|
|
otherInvoiceItem.ContractInvoiceId = ppItem.InvoiceId
|
|
|
tx.Model(&otherInvoiceItem).Select([]string{"ServiceProductId"}).Updates(otherInvoiceItem)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
//更新另一类型的invoice表数据
|
|
|
invoiceItem := ContractInvoice{
|
|
|
ContractRegisterId: item.ContractRegisterId,
|
|
@@ -910,13 +908,15 @@ func UpdateSupplementContractPreRegister(item *ContractRegister, serviceAmountLi
|
|
|
}
|
|
|
|
|
|
type CheckContractDuplicateReq struct {
|
|
|
- CompanyName string `json:"company_name" form:"company_name" description:"客户名称"`
|
|
|
- StartDate string `json:"start_date" form:"start_date" description:"合同开始日期"`
|
|
|
- EndDate string `json:"end_date" form:"end_date" description:"合同结束日期"`
|
|
|
- Services []ContractServiceAddReq `json:"services" description:"服务套餐内容"`
|
|
|
+ CompanyName string `json:"company_name" form:"company_name" description:"客户名称"`
|
|
|
+ StartDate string `json:"start_date" form:"start_date" description:"合同开始日期"`
|
|
|
+ EndDate string `json:"end_date" form:"end_date" 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-有"`
|
|
|
+ Services []ContractServiceAddReq `json:"services" description:"服务套餐内容"`
|
|
|
}
|
|
|
|
|
|
-func CheckContractDuplicate(condition string, pars []interface{}) (list []*ContractRegister,err error) {
|
|
|
+func CheckContractDuplicate(condition string, pars []interface{}) (list []*ContractRegister, err error) {
|
|
|
query := global.DEFAULT_MYSQL.Table("contract_register AS a").
|
|
|
Select("a.* ").
|
|
|
Joins(" JOIN contract_service AS b ON a.contract_register_id = b.contract_register_id ").
|
|
@@ -926,7 +926,6 @@ func CheckContractDuplicate(condition string, pars []interface{}) (list []*Contr
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-
|
|
|
type CheckContractDuplicateResp struct {
|
|
|
Exist int `json:"exist" description:"是否存在重复的合同:0不存在,1存在"`
|
|
|
}
|
|
@@ -937,4 +936,4 @@ func CheckContractServiceDuplicate(registerIds []int) (ids []*string, err error)
|
|
|
Where("contract_register_id IN (?)", registerIds).
|
|
|
Group("contract_register_id").Scan(&ids).Error
|
|
|
return
|
|
|
-}
|
|
|
+}
|