You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.2 KiB
50 lines
1.2 KiB
package main
|
|
|
|
import (
|
|
"dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao"
|
|
"dsBaseRpc/Utils/CommonUtil"
|
|
"fmt"
|
|
)
|
|
|
|
func main() {
|
|
fileName := `./Tools/InitOrg/Data/22.23.24.25.通告稿_主体校、附设班信息.xlsx`
|
|
f, err := excelize.OpenFile(fileName)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
return
|
|
}
|
|
sheetName := `通告稿_附设班信息`
|
|
rows, err := f.GetRows(sheetName)
|
|
if err != nil {
|
|
fmt.Println(err.Error())
|
|
}
|
|
for i, row := range rows {
|
|
//放过第一行
|
|
if i == 0 {
|
|
continue
|
|
}
|
|
//单位名称
|
|
orgName := row[1]
|
|
//机构编码
|
|
orgCode := row[2]
|
|
//附设教学班类型
|
|
fsbCode := row[10]
|
|
//插入附设班数据
|
|
list, err := BaseOrganizationDao.GetBureauInfoByCode(orgCode)
|
|
if err != nil {
|
|
fmt.Println(orgCode)
|
|
//panic("查询机构代码出错!")
|
|
continue
|
|
}
|
|
if list == nil || len(list) == 0 {
|
|
fmt.Println(orgCode)
|
|
//panic("查询机构代码出错!")
|
|
continue
|
|
}
|
|
bureauId := list[0]["org_id"].(string)
|
|
BaseOrganizationDao.UpdateFsb(bureauId, []string{fsbCode})
|
|
fmt.Println(CommonUtil.ConvertIntToString(i) + ":完成" + orgName)
|
|
}
|
|
fmt.Println("恭喜,所有数据初始化完成!")
|
|
}
|