|
@@ -47,17 +47,16 @@ func ImportCompany() {
|
|
|
rows := sheet.MaxRow
|
|
|
for i := 0; i < rows; i++ {
|
|
|
if i > 2 {
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
- realName := cells[1].String()
|
|
|
+ row, _ := sheet.Row(i)
|
|
|
+ realName := row.GetCell(1).String()
|
|
|
realName = strings.Trim(realName, " ")
|
|
|
realName = strings.Replace(realName, " ", "", -1)
|
|
|
|
|
|
- mobile := cells[2].String()
|
|
|
+ mobile := row.GetCell(2).String()
|
|
|
mobile = strings.Trim(mobile, " ")
|
|
|
mobile = strings.Replace(mobile, " ", "", -1)
|
|
|
fmt.Println(mobile)
|
|
|
- companyName := cells[6].String()
|
|
|
+ companyName := row.GetCell(6).String()
|
|
|
fmt.Println(companyName)
|
|
|
companyName = strings.Trim(companyName, " ")
|
|
|
companyName = strings.Replace(companyName, " ", "", -1)
|
|
@@ -161,18 +160,16 @@ func ImportCompanyUsers() {
|
|
|
rows := sheet.MaxRow
|
|
|
for i := 0; i < rows; i++ {
|
|
|
if i > 2 {
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
-
|
|
|
- realName := cells[1].String()
|
|
|
+ row, _ := sheet.Row(i)
|
|
|
+ realName := row.GetCell(1).String()
|
|
|
realName = strings.Trim(realName, " ")
|
|
|
realName = strings.Replace(realName, " ", "", -1)
|
|
|
|
|
|
- mobile := cells[2].String()
|
|
|
+ mobile := row.GetCell(2).String()
|
|
|
mobile = strings.Trim(mobile, " ")
|
|
|
mobile = strings.Replace(mobile, " ", "", -1)
|
|
|
|
|
|
- email := cells[5].String()
|
|
|
+ email := row.GetCell(5).String()
|
|
|
email = strings.Trim(email, " ")
|
|
|
email = strings.Replace(email, " ", "", -1)
|
|
|
fmt.Println(mobile)
|
|
@@ -223,18 +220,16 @@ func ImportCompanyCreditCode() {
|
|
|
rows := sheet.MaxRow
|
|
|
for i := 0; i < rows; i++ {
|
|
|
if i > 2 {
|
|
|
- row := sheet.Row(i)
|
|
|
- cells := row.Cells
|
|
|
-
|
|
|
- companyName := cells[0].String()
|
|
|
+ row, _ := sheet.Row(i)
|
|
|
+ companyName := row.GetCell(0).String()
|
|
|
companyName = strings.Trim(companyName, " ")
|
|
|
companyName = strings.Replace(companyName, " ", "", -1)
|
|
|
|
|
|
- creditCode := cells[4].String()
|
|
|
+ creditCode := row.GetCell(4).String()
|
|
|
creditCode = strings.Trim(creditCode, " ")
|
|
|
creditCode = strings.Replace(creditCode, " ", "", -1)
|
|
|
|
|
|
- industryName := cells[5].String()
|
|
|
+ industryName := row.GetCell(5).String()
|
|
|
industryName = strings.Trim(industryName, " ")
|
|
|
industryName = strings.Replace(industryName, " ", "", -1)
|
|
|
|
|
@@ -246,30 +241,30 @@ func ImportCompanyCreditCode() {
|
|
|
if companyItem == nil {
|
|
|
fmt.Println("companyItem is nil")
|
|
|
}
|
|
|
- count,err:=models.GetCompanyCountByCreditCode(creditCode)
|
|
|
- if err!=nil {
|
|
|
- fmt.Println("GetCompanyCountByCreditCode Err:"+err.Error())
|
|
|
+ count, err := models.GetCompanyCountByCreditCode(creditCode)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("GetCompanyCountByCreditCode Err:" + err.Error())
|
|
|
continue
|
|
|
}
|
|
|
- if count>0 {
|
|
|
+ if count > 0 {
|
|
|
fmt.Println("creditCode exist")
|
|
|
continue
|
|
|
- }else{
|
|
|
- industryItem,err:=models.GetCompanyIndustryByName(industryName)
|
|
|
- if err!=nil {
|
|
|
- fmt.Println("GetCompanyIndustryByName Err:"+err.Error())
|
|
|
+ } else {
|
|
|
+ industryItem, err := models.GetCompanyIndustryByName(industryName)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("GetCompanyIndustryByName Err:" + err.Error())
|
|
|
return
|
|
|
}
|
|
|
- fmt.Println(industryItem.IndustryId,industryItem.IndustryName)
|
|
|
+ fmt.Println(industryItem.IndustryId, industryItem.IndustryName)
|
|
|
|
|
|
- err=models.ModifyCompanyCreditCode(companyItem.CompanyId,creditCode)
|
|
|
- if err!=nil {
|
|
|
- fmt.Println("Err:"+err.Error())
|
|
|
+ err = models.ModifyCompanyCreditCode(companyItem.CompanyId, creditCode)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("Err:" + err.Error())
|
|
|
return
|
|
|
}
|
|
|
- err=models.ModifyCompanyIndustry(industryItem.IndustryId,companyItem.CompanyId,industryName)
|
|
|
- if err!=nil {
|
|
|
- fmt.Println("Err:"+err.Error())
|
|
|
+ err = models.ModifyCompanyIndustry(industryItem.IndustryId, companyItem.CompanyId, industryName)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("Err:" + err.Error())
|
|
|
return
|
|
|
}
|
|
|
}
|