瀏覽代碼

no message

xingzai 6 月之前
父節點
當前提交
234f7f2bf9
共有 3 個文件被更改,包括 91 次插入0 次删除
  1. 64 0
      controllers/statistic_company_merge.go
  2. 11 0
      models/company/company_approval.go
  3. 16 0
      models/company/company_contract.go

+ 64 - 0
controllers/statistic_company_merge.go

@@ -1855,3 +1855,67 @@ func init323() {
 		}
 	}
 }
+
+//func init() {
+//	init16_1_02()
+//}
+
+func init16_1_01() {
+	var condition string
+	var pars []interface{}
+
+	condition = "  AND  product_id = 2 "
+	var companyIds []int
+	companyContractList, e := company.GetCompanyContractList(condition, pars)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		fmt.Println(e)
+		return
+	}
+
+	for _, v := range companyContractList {
+		if utils.InArrayByInt(companyIds, v.CompanyId) {
+			continue
+		}
+		companyIds = append(companyIds, v.CompanyId)
+	}
+
+	condition = "   AND company_id IN (" + (utils.GetOrmInReplace(len(companyIds))) + ") AND product_id = 2  AND share_seller_id > 0  "
+	pars = append(pars, companyIds)
+	listCompanyProduct, e := company.GetCompanyProductList(condition, pars)
+	if e != nil {
+		fmt.Println(e)
+		return
+	}
+	for _, v := range listCompanyProduct {
+		fmt.Println(v.ShareSellerId, v.ShareSeller)
+
+		e = company.UpdateCompanyContractTypeinit16_1_01(v.ShareSeller, v.ShareSellerId, v.CompanyId)
+		if e != nil {
+			fmt.Println(e)
+			return
+		}
+	}
+}
+
+func init16_1_02() {
+	var condition string
+	var pars []interface{}
+
+	condition = "  AND  product_id = 2  AND company_contract_id > 0  "
+
+	CompanyApprovalList, e := company.GetCompanyApprovalList(condition, pars)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		fmt.Println(e)
+		return
+	}
+
+	for _, v := range CompanyApprovalList {
+		fmt.Println(v.CompanyId, v.CompanyContractId, "__", v.CompanyApprovalId)
+
+		e = company.UpdateCompanyContractTypeinit16_1_02(v.ApplyRealName, v.ApplyUserId, v.CompanyContractId)
+		if e != nil {
+			fmt.Println(e)
+			return
+		}
+	}
+}

+ 11 - 0
models/company/company_approval.go

@@ -1665,3 +1665,14 @@ GROUP BY
 
 	return
 }
+
+func GetCompanyApprovalList(condition string, pars []interface{}) (items []*CompanyApproval, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM company_approval WHERE 1 = 1  `
+
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}

+ 16 - 0
models/company/company_contract.go

@@ -350,3 +350,19 @@ func GetFirstContractRai(companyId int) (item *CompanyContract, err error) {
 	err = o.Raw(sql, companyId).QueryRow(&item)
 	return
 }
+
+// 更新合同类型
+func UpdateCompanyContractTypeinit16_1_01(share_seller_init string, share_seller_id_init, companyId int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE company_contract SET share_seller_init = ? , share_seller_id_init = ?  WHERE company_id = ?  AND product_id= 2 `
+	_, err = o.Raw(sql, share_seller_init, share_seller_id_init, companyId).Exec()
+	return
+}
+
+// 更新合同类型
+func UpdateCompanyContractTypeinit16_1_02(seller_name_init string, seller_id_init, company_contract_id int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE company_contract SET seller_name_init = ? , seller_id_init = ?  WHERE company_contract_id = ?  AND product_id= 2 `
+	_, err = o.Raw(sql, seller_name_init, seller_id_init, company_contract_id).Exec()
+	return
+}