|
@@ -222,7 +222,7 @@ func (this *StatisticCompanyMergerController) MergeCompanyList() {
|
|
} else {
|
|
} else {
|
|
condition1, pars1 = getQueryParams(condition1, pars1, sysUser, "c.")
|
|
condition1, pars1 = getQueryParams(condition1, pars1, sysUser, "c.")
|
|
}
|
|
}
|
|
- condition1 += ` AND a.create_time >= ? AND a.create_time <= ? AND a.operation in ("add","receive") AND b.company_id NOT IN ( SELECT company_id FROM company_operation_record WHERE product_id = 2 AND operation ="loss" GROUP BY company_id ) `
|
|
|
|
|
|
+ condition1 += ` AND a.create_time >= ? AND a.create_time <= ? AND a.operation in ("add","receive") AND b.company_id NOT IN ( SELECT company_id FROM company_operation_record WHERE product_id = 2 AND operation ="loss" GROUP BY company_id ) AND c.status = '试用' `
|
|
pars1 = append(pars1, startDate, endDate)
|
|
pars1 = append(pars1, startDate, endDate)
|
|
|
|
|
|
total, err := models.GetIncrementalCompanyCountByOperationRecord(condition1, pars1)
|
|
total, err := models.GetIncrementalCompanyCountByOperationRecord(condition1, pars1)
|
|
@@ -360,7 +360,7 @@ func (this *StatisticCompanyMergerController) MergeCompanyList() {
|
|
condition1 += condition
|
|
condition1 += condition
|
|
pars1 = append(pars1, pars)
|
|
pars1 = append(pars1, pars)
|
|
|
|
|
|
- condition1 += ` AND a.end_date >= ? AND a.end_date <= ? `
|
|
|
|
|
|
+ condition1 += ` AND a.not_renewal_hide = 0 AND a.status = 1 AND a.start_date >= '2020-01-01' AND a.end_date >= ? AND a.end_date <= ? `
|
|
pars1 = append(pars1, startDate, endDate)
|
|
pars1 = append(pars1, startDate, endDate)
|
|
//condition1 += ` AND a.operation = ? `
|
|
//condition1 += ` AND a.operation = ? `
|
|
//pars1 = append(pars1, "try_out")
|
|
//pars1 = append(pars1, "try_out")
|
|
@@ -2342,7 +2342,7 @@ func init323() {
|
|
}
|
|
}
|
|
|
|
|
|
//func init() {
|
|
//func init() {
|
|
-// init16_1_03()
|
|
|
|
|
|
+// init16_1_06()
|
|
//}
|
|
//}
|
|
|
|
|
|
func init16_1_01() {
|
|
func init16_1_01() {
|
|
@@ -2422,6 +2422,88 @@ func init16_1_03() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func init16_1_04() {
|
|
|
|
+ var condition string
|
|
|
|
+ var pars []interface{}
|
|
|
|
+
|
|
|
|
+ condition = " AND product_id = 2 AND seller_id_init = 0 "
|
|
|
|
+
|
|
|
|
+ CompanyApprovalList, e := company.GetCompanyContracList(condition, pars)
|
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
+ fmt.Println(e)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for _, v := range CompanyApprovalList {
|
|
|
|
+ productItem, e := company.GetCompanyProductByCompanyIdAndProductId(v.CompanyId, 2)
|
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
+ fmt.Println(e)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if productItem == nil {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ e = company.UpdateCompanyContractTypeinit16_1_02(productItem.SellerName, productItem.SellerId, v.CompanyContractId)
|
|
|
|
+ if e != nil {
|
|
|
|
+ fmt.Println(e)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//func init16_1_05() {
|
|
|
|
+// var condition string
|
|
|
|
+// var pars []interface{}
|
|
|
|
+//
|
|
|
|
+// condition = " AND product_id = 2 "
|
|
|
|
+//
|
|
|
|
+// listProduct, e := company.GetCompanyProductList(condition, pars)
|
|
|
|
+// if e != nil {
|
|
|
|
+// fmt.Println(e)
|
|
|
|
+// return
|
|
|
|
+// }
|
|
|
|
+// for _, v := range listProduct {
|
|
|
|
+// e = company.UpdateCompanyProductSellerUnexpiredInitinit16_1_05(v.SellerId, v.SellerName, v.CompanyId)
|
|
|
|
+// if e != nil {
|
|
|
|
+// fmt.Println(e)
|
|
|
|
+// return
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// fmt.Println("end")
|
|
|
|
+//}
|
|
|
|
+
|
|
|
|
+func init16_1_06() {
|
|
|
|
+ var condition string
|
|
|
|
+ var pars []interface{}
|
|
|
|
+
|
|
|
|
+ listContractMax, e := company.GetCompanyContracListInit(condition, pars)
|
|
|
|
+ if e != nil {
|
|
|
|
+ fmt.Println(e)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ maxId := make(map[int]int)
|
|
|
|
+ for _, v := range listContractMax {
|
|
|
|
+ maxId[v.MaxCompanyContractId] = v.MaxCompanyContractId
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ listContract, e := company.GetCompanyContracListInit_CRM_16_1(condition, pars)
|
|
|
|
+ if e != nil {
|
|
|
|
+ fmt.Println(e)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ var updateId []string
|
|
|
|
+ for _, v := range listContract {
|
|
|
|
+ if maxId[v.CompanyContractId] > 0 {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ updateId = append(updateId, strconv.Itoa(v.CompanyContractId))
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ err := company.UpdateCompanyContracthide(updateId)
|
|
|
|
+ fmt.Println((err))
|
|
|
|
+ fmt.Println((updateId))
|
|
|
|
+}
|
|
|
|
+
|
|
//更新权益销客户后一个正式的销售为当前销售
|
|
//更新权益销客户后一个正式的销售为当前销售
|
|
//func init(){
|
|
//func init(){
|
|
// SELECT * FROM company_product WHERE 1= 1 AND product_id =2 AND share_seller_id > 0 ;
|
|
// SELECT * FROM company_product WHERE 1= 1 AND product_id =2 AND share_seller_id > 0 ;
|