Browse Source

no message

zhangchuanxing 2 months ago
parent
commit
37d5c1000b
2 changed files with 6 additions and 5 deletions
  1. 3 3
      controllers/statistic_company_merge.go
  2. 3 2
      models/company/company_contract.go

+ 3 - 3
controllers/statistic_company_merge.go

@@ -2504,9 +2504,9 @@ func init16_1_06() {
 		fmt.Println(e)
 		return
 	}
-	maxId := make(map[int]int)
+	maxId := make(map[int]string)
 	for _, v := range listContractMax {
-		maxId[v.MaxCompanyContractId] = v.MaxCompanyContractId
+		maxId[v.CompanyId] = v.MaxEndDate
 	}
 
 	listContract, e := company.GetCompanyContracListInit_CRM_16_1(condition, pars)
@@ -2516,7 +2516,7 @@ func init16_1_06() {
 	}
 	var updateId []string
 	for _, v := range listContract {
-		if maxId[v.CompanyContractId] > 0 {
+		if maxId[v.CompanyId] == v.EndDate {
 			continue
 		}
 		updateId = append(updateId, strconv.Itoa(v.CompanyContractId))

+ 3 - 2
models/company/company_contract.go

@@ -419,6 +419,7 @@ type CompanyContractRespInit struct {
 	ContractCode         string    `description:"合同编码"`
 	StartDate            string    `description:"合同开始时间"`
 	EndDate              string    `description:"合同结束时间"`
+	MaxEndDate           string    `description:"合同结束时间"`
 	Money                float64   `description:"合同金额"`
 	PayMethod            string    `description:"支付方式"`
 	PayChannel           string    `description:"支付渠道"`
@@ -436,7 +437,7 @@ type CompanyContractRespInit struct {
 func GetCompanyContracListInit(condition string, pars []interface{}) (items []*CompanyContractRespInit, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
-	MAX( company_contract_id ) AS max_company_contract_id,
+	MAX( a.end_date ) AS max_end_date,
 	COUNT(a.company_id) AS cc ,
 	a.* 
 FROM
@@ -476,7 +477,7 @@ WHERE
 	1 = 1 -- 		AND b.company_name LIKE "%上海亘%"
 	
 	AND c.product_id = 2 -- 		AND b.company_name LIKE "%上海亘%"
-	
+
 	AND c.product_id = 2 
 	AND a.not_renewal_hide = 0 
 	AND a.STATUS = 1