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.
75 lines
1.8 KiB
75 lines
1.8 KiB
package main
|
|
|
|
import (
|
|
"dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationDao"
|
|
"dsBaseRpc/RpcService/BaseOrganization/BaseOrganizationService"
|
|
"dsBaseRpc/Utils/CommonUtil"
|
|
"dsBaseRpc/models"
|
|
"fmt"
|
|
"github.com/xuri/excelize/v2"
|
|
)
|
|
|
|
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]
|
|
//机构所在地
|
|
areaCode := row[4][0:6]
|
|
//上级管理单位
|
|
managerAreaCode := row[6][0:6]
|
|
//举办者类型码
|
|
xxjbzm := row[8]
|
|
//办学类型
|
|
xxbxlxm := row[10]
|
|
//城乡级别
|
|
szdcxlxm := row[14]
|
|
|
|
//已有的数据不再处理
|
|
if orgCode == "3422000032" || orgCode == "3122001304" {
|
|
continue
|
|
}
|
|
//增加学校
|
|
model := new(models.TBaseOrganization)
|
|
model.OrgId = CommonUtil.GetUUID()
|
|
model.BureauId = model.OrgId
|
|
model.OrgName = orgName
|
|
model.BUse = 1
|
|
model.ManagerAreaCode = managerAreaCode
|
|
model.ProvinceCode = "220000"
|
|
model.CityCode = "220100"
|
|
model.DistrictCode = areaCode
|
|
model.SortId = 1
|
|
model.Xxbxlxm = xxbxlxm
|
|
model.MainSchoolId = model.BureauId
|
|
model.OrgType = 2
|
|
model.ParentId = "0"
|
|
model.AreaCode = areaCode
|
|
model.OrgCode = orgCode
|
|
model.MainSchoolType = 1
|
|
model.Szdcxlxm = szdcxlxm
|
|
model.Xxjbzm = xxjbzm
|
|
BaseOrganizationDao.AddBaseOrganization(*model)
|
|
//通过管理员帐号
|
|
BaseOrganizationService.UpdateManager(model.OrgId, 1)
|
|
fmt.Println(CommonUtil.ConvertIntToString(i) + ":成功完成" + orgName + "。")
|
|
}
|
|
fmt.Println("恭喜,所有学校初始化完成!")
|
|
}
|