Ver Fonte

no message

xingzai há 1 ano atrás
pai
commit
33d0864b7e
1 ficheiros alterados com 18 adições e 13 exclusões
  1. 18 13
      services/company_contract.go

+ 18 - 13
services/company_contract.go

@@ -276,6 +276,10 @@ func InitCompanyContractMerge() {
 //	return
 //}
 
+//func init() {
+//	AddCompanyContractMergeByCompanyContractId(1214)
+//}
+
 // AddCompanyContractMergeByCompanyContractId 通过合同ID对合同进行合并
 func AddCompanyContractMergeByCompanyContractId(companyContractId int) {
 	var err error
@@ -301,12 +305,13 @@ func AddCompanyContractMergeByCompanyContractId(companyContractId int) {
 		err = errors.New("GetCompanyContractMergeDetail, Err: " + e.Error())
 		return
 	}
-	fmt.Println(contractMergeInfo)
+	//fmt.Println(contractMergeInfo)
 	e = company.UpdateCompanyContractMergeIsBestNew(0, contractInfo.CompanyId)
 	if e != nil {
 		err = errors.New("UpdateCompanyContractMergeIsBestNew, Err: " + e.Error())
 		return
 	}
+	//fmt.Println(contractInfo)
 	item := new(company.CompanyContractMerge)
 	item.ContractType = contractInfo.ContractType
 	item.ProductId = contractInfo.ProductId
@@ -344,7 +349,7 @@ func AddCompanyContractMergeByCompanyContractId(companyContractId int) {
 				pars = append(pars, contractMergeInfo.CompanyId, contractMergeInfo.CompanyContractMergeId)
 				detailPrevious, e := company.GetCompanyContractMergeDetail(condition, pars)
 				if e != nil {
-					err = errors.New("GetCompanyContractMergeDetail, Err: " + e.Error())
+					err = errors.New("GetCompanyContractMergeDetail-Update, Err: " + e.Error())
 					return
 				}
 				if item.Money > detailPrevious.Money {
@@ -370,21 +375,21 @@ func AddCompanyContractMergeByCompanyContractId(companyContractId int) {
 			item.CompanyContractIdGroup = strconv.Itoa(companyContractId)
 			//如果是续约合同就对比跟上一份合并之后的合同的差距
 			if item.ContractType == "续约合同" {
-				pars = make([]interface{}, 0)
-				condition = " AND company_id = ?  AND company_contract_merge_id != ?   ORDER BY start_date DESC   LIMIT  1  "
-				pars = append(pars, contractMergeInfo.CompanyId, contractMergeInfo.CompanyContractMergeId)
-				detailPrevious, e := company.GetCompanyContractMergeDetail(condition, pars)
-				if e != nil {
-					err = errors.New("GetCompanyContractMergeDetail, Err: " + e.Error())
-					return
-				}
-				if item.Money > detailPrevious.Money {
+				//pars = make([]interface{}, 0)
+				//condition = " AND company_id = ?  AND company_contract_merge_id != ?   ORDER BY start_date DESC   LIMIT  1  "
+				//pars = append(pars, contractMergeInfo.CompanyId, contractMergeInfo.CompanyContractMergeId)
+				//detailPrevious, e := company.GetCompanyContractMergeDetail(condition, pars)
+				//if e != nil {
+				//	err = errors.New("GetCompanyContractMergeDetail——add, Err: " + e.Error())
+				//	return
+				//}
+				if item.Money > contractMergeInfo.Money {
 					item.PackageDifference = "增加套餐"
 				}
-				if item.Money == detailPrevious.Money {
+				if item.Money == contractMergeInfo.Money {
 					item.PackageDifference = "维持套餐"
 				}
-				if item.Money < detailPrevious.Money {
+				if item.Money < contractMergeInfo.Money {
 					item.PackageDifference = "减少套餐"
 				}
 			}