zhangchuanxing пре 3 недеља
родитељ
комит
f108d34e69
2 измењених фајлова са 62 додато и 1 уклоњено
  1. 51 1
      controllers/statistic_company_merge.go
  2. 11 0
      models/company/company_product.go

+ 51 - 1
controllers/statistic_company_merge.go

@@ -2342,7 +2342,7 @@ func init323() {
 }
 
 //func init() {
-//	init16_1_03()
+//	init16_1_05()
 //}
 
 func init16_1_01() {
@@ -2422,6 +2422,56 @@ 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 init(){
 //	SELECT * FROM company_product  WHERE 1= 1  AND  product_id =2   AND  share_seller_id > 0 ;

+ 11 - 0
models/company/company_product.go

@@ -723,3 +723,14 @@ func UpdateCompanyProductSellerUnexpired(sellerId, shareSellerInit int, sellerNa
 	_, err = o.Raw(sql, sellerId, sellerName, shareSellerInit, shareSeller, companyId).Exec()
 	return
 }
+
+// 合同未到期更新对应销售的信息
+func UpdateCompanyProductSellerUnexpiredInitinit16_1_05(sellerId int, sellerName string, companyId int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE company_product SET
+                            seller_id_last = ? , 
+                            seller_name_last = ? 
+                            WHERE company_id = ?  AND product_id= 2 `
+	_, err = o.Raw(sql, sellerId, sellerName, companyId).Exec()
+	return
+}